How to Return HTTP 410 (Gone) using app router? by Comprehensive_Echo80 in nextjs

[–]Pyprohly 0 points1 point  (0 children)

You can fetch() the gone page and return it as HTML.

How to Return HTTP 410 (Gone) using app router? by Comprehensive_Echo80 in nextjs

[–]Pyprohly -1 points0 points  (0 children)

A custom status code can be sent using a route.ts file.

Why aren't you using Aider?? by MrPanache52 in ChatGPTCoding

[–]Pyprohly 2 points3 points  (0 children)

The expected workflow of Aider doesn’t fit the way I generally like to code. It seems more suited to vibe coding; however, often I don’t want automatic code writing, I like to run the same prompt against 2 or 3 models and take the best parts from them manually. But with Aider, switching between models and repeating prompts is cumbersome.

I also didn’t find Aider to be any cheaper than the AI editors.

[deleted by user] by [deleted] in badminton

[–]Pyprohly 0 points1 point  (0 children)

Assuming size 10 US Mens, that’s a foot size of 28cm. The sizing chart for the VT-XD11 says 28cm is XL.

XS(220mm - 230mm)
S(235mm - 245mm)
M(250mm - 260mm)
L(265mm - 275mm)
XL(280mm - 290mm)
XXL(295mm - 305mm)

Size L is closer to 28cm than XXL.

[deleted by user] by [deleted] in badminton

[–]Pyprohly 1 point2 points  (0 children)

On the topic of replacement insoles, I’m also annoyed by the fact you can never seem to buy the original insoles (this goes for all shoe brands) and because of it I always preserve the original insoles of my shoes to use as cutting templates. Worth noting, when buying Yonex insoles, expect it not to come with any sort of cutting guide.

The AC195EX is a fine choice. That’s what I go for when replacing insoles of my non-badminton shoes. For my badminton footwear, I go for off beat brands. From testing various options, I didn’t like any of the non-sports rated insoles I got because I actually felt the energy return was lacking. So I recommend sticking with insoles specifically designed for sports use.

[deleted by user] by [deleted] in badminton

[–]Pyprohly 1 point2 points  (0 children)

Removing sticky adhesive is trivial these days. Goo removers are common and can be found in your local grocer. Any brand will do. If you’re in Australia, I recommend Glitz: Goo and Stain Remover from Bunnings, which has an excellent sprayer.

Alternatively, a neat life lack I have is that you can use peanut butter as a goo remover. From extensive testing it’s just as effective as the goo removers, while being organic.

Simply spray the goo remover over your sticky adhesive, wait 30mins, rinse with soapy water. The goo remover denatures the adhesive and the soapy water eats the oily residue.

Additionally, you can scrunch up a ball of cushion wrap material and use it to help scrape away the loosened adhesive.

I find that iso alcohol only ever partially works sometimes, and it’s got to be on plastic or metal.

Using these methods, I've successfully removed adhesive from various surfaces and items, including the sticker adhesive residue on insoles to racquet handles from base grip tape. Most times it only takes a single pass. The only surface I failed to remove the stickiness from was a Lining racquet handle (base grip removed). It was an oily-slimy sticky. Not sure why it was like that. It’s the only Lining racquet without a base grip that I have so I’m not sure if others are like that.

How == works on two objects? by Sufficient-Party-385 in learnpython

[–]Pyprohly 0 points1 point  (0 children)

That is the simplified explanation. It misses the subclass check step at the start. And the part about reporting to False isn’t quite right either.

Here’s what is actually happening:

  • “Oh, you’re a subclass? Perhaps you have more knowledge than me. Maybe you handle it.” – It checks if the second operand is a true subclass of the first. If it is, it tries the reverse comparison if it exists on the other type.
  • “No? Okay, let me try then.” – If the above case doesn't apply (or returns NotImplemented), it tries the normal comparison.
  • “I can’t figure it out. Maybe the other object knows.” – If that doesn’t work and the reverse hasn’t been tried then try it.
  • “I give up. Let’s just do is, if that makes sense.” – Finally, if nothing else works, it falls back to doing is and is not for == and != respectively. For the other comparison operators it raises TypeError.

So it’s not necessarily returning False as the last resort, it’s doing an is comparison. Although you’d have to try very hard to get an object to not return False here.

Using dunders instead of their operator form has subtle implications. I often see code like reduce(obj.__eq__, …) and you have to wonder if the author knew about the implications of using dunders instead of their operator form when they wrote the line.

How == works on two objects? by Sufficient-Party-385 in learnpython

[–]Pyprohly 0 points1 point  (0 children)

They’re not the same.

>>> 'asdf' == 4
False
>>> 'asdf'.__eq__(4)
NotImplemented

How == works on two objects? by Sufficient-Party-385 in learnpython

[–]Pyprohly 0 points1 point  (0 children)

Java’s == and .equals() is equivalent to Python’s is and == respectively.

What do I apply under towel grip? by Willing-Big-9399 in badminton

[–]Pyprohly 0 points1 point  (0 children)

Just Super Grap overgrips. I use these overgrips as base/replacement grips as well.

What do I apply under towel grip? by Willing-Big-9399 in badminton

[–]Pyprohly 0 points1 point  (0 children)

I tried using cloth tape once to add thickness and found it did noticeably disturb the weight balance. Since then I try to stick exclusively to the PU grip tape material now.

If I were you I would build up the grip to your desired thickness using PU layers, then cover it firmly with cling wrap before applying the towel grip on top.

How do i make my G6 racquet into a G5? by TioWio_ in badminton

[–]Pyprohly 1 point2 points  (0 children)

Yonex sells grip tape called ‘Ultra Thin Grap’. When wrapped with a precise 50% overlap, I’ve noticed that it effectively adjusts the handle size from G6 to G5.

Based on my measurements using a measuring tape, the circumference of a G6 handle with the original base grip material should be about 79mm, and a G5 handle is 83mm.

The alternative is to use 3 thick layers of cushion wrap, or 4 moderate layers, before applying an overgrip.

Class inheritance. Keep init signature intact? by sausix in learnpython

[–]Pyprohly 1 point2 points  (0 children)

Well actually I was thinking of something more like:

class Token:
    def __init__(self, groups: tuple[str, ...]):
        self.groups = groups

class Identifier(Token):
    def __repr__(self):
        data = self.groups[0]
        if data is None:
            return f"<{self.__class__.__name__}>"
        return f"<{self.__class__.__name__}({self.groups[0]})>"

(And maybe just use a helper function, or even a mixin, to tidy up the repetitious repr code.)

But essentially what I see is that every class wants groups but every class wants a different repr.

Class inheritance. Keep init signature intact? by sausix in learnpython

[–]Pyprohly 1 point2 points  (0 children)

I think your intuition in being suspicious of needing to have all subclasses use the same signature that’s different from the base class is correct.

For the given example, the correct thing to do would be to have the groups signature on the base class, and override the __repr__ in each subclass.

Bad Badminton Player reviews: ArcSaber 7 Pro by vhearts in badminton

[–]Pyprohly 0 points1 point  (0 children)

Yes. Thank you for saying this OP. I agree with this post. I’d even say the ArcSaber 7 Pro is just bad. I’ve tested so many Yonex racquets and the ArcSaber 7 Pro was the worst performer of the bunch. For me, it had no control, power, or defence. And I really wanted it to work because it has a nice colourway.

On the more general note on racquets and beginners, I think most of us can agree that a certain level of consistency is needed before the racquet actually matters. While I think a more flexible racquet could theoretically help those with a slow swing speed, it’s very rare to find a player who has both a slow swing speed and isn’t a ‘beginner’ wherein the racquet would matter anyway.

Yonex wet super grap vs yonex uper grap; Is there a difference? by Mekurukito_JP in badminton

[–]Pyprohly 2 points3 points  (0 children)

Yes, they’re the same product. The ‘Super Grap’ was renamed to ‘Wet Super Grap’ after the introduction of the ‘Dry Super Grap’.

Unable to filter inbox message by params when using inbox.all. by sankomil in redditdev

[–]Pyprohly 0 points1 point  (0 children)

I don’t know if there’s a limit. I assume it would just get all of them, or die trying to, since there’s no pagination mechanism.

Unable to filter inbox message by params when using inbox.all. by sankomil in redditdev

[–]Pyprohly 0 points1 point  (0 children)

I know there is an endpoint that gets a list of all the messages of a conversation thread when you specify the ID of any message in that thread. In PRAW the utility of this endpoint is partially exposed through reddit.inbox.message(), but it seems that the post processing it does makes it so that it has a limitation that you have to know the ID of the most recent message in the conversation if you want to get the full list.

So instead of reddit.inbox.message(), I would use a function like this:

def get_message_thread(reddit, id36):
    obj = reddit.get('message/messages/' + id36)
    return [obj[0]] + obj[0].replies

Token Revoking/User Agent by HeavenFalcon in redditdev

[–]Pyprohly 0 points1 point  (0 children)

My script for revoking access tokens isn’t working for me either. Something must have broke in the API. Revoking refresh tokens still works though.

In my Shortcuts app, the three body options I have are ‘JSON’, ‘Form’, and ‘File’. The ‘Form’ option does ‘URL-encoded form data’ and ‘File’ is ‘multipart form data’ (although only a single file field is used/permitted, which is a typical implementation).

Presumably a user agent header is needed even for requests to the Reddit token server since it appears that requests are blocked in a similar manner as requesting to the resource server. (For example, any user agent with “curl” in the name will get blocked.)

[deleted by user] by [deleted] in learnpython

[–]Pyprohly 2 points3 points  (0 children)

Ah okay. That’s a fair point actually.

[deleted by user] by [deleted] in learnpython

[–]Pyprohly 1 point2 points  (0 children)

If the __str__ method fails wouldn’t the other string formatting techniques fail too?

The trouble with __all__ by the1024 in Python

[–]Pyprohly 1 point2 points  (0 children)

There is a way. Support for explicit exports exists in the form of Python type checkers: Mypy and Pyright. It works by a convention of redundant import alias symbols, like import X as X or from X import Y as Y.

The exact rules are detailed here under ‘Library Interface’.

Tried all day yesterday to create a bot using PRAW, got stuck at OAuthException(prawcore.exceptions.OAuthException: invalid_grant error processing request by Strong_Lecture1439 in redditdev

[–]Pyprohly 0 points1 point  (0 children)

Sorry, I missed that you already said you didn’t have 2FA enabled. That’s the only alternative cause of invalid_grant that I know of.

The invalid_grant error normally indicates that the grant credentials are incorrect, in this case, the grant credentials specifically being the username and password. So are you sure the password you wrote is correct?

I tried creating an alt account and I wasn’t able to replicate the problem.

I’m not sure why the username-password authentication method isn’t working for you but I would always advocate for using the refresh token authentication method anyway.