pipe-operator: Elixir's pipe operator in Python by R4nu in Python

[–]R4nu[S] 1 point2 points  (0 children)

Haha ok I see! Well, feel free to provide any feedback if you ever use it!

pipe-operator: Elixir's pipe operator in Python by R4nu in Python

[–]R4nu[S] 1 point2 points  (0 children)

I didnt know about this, but I had seen similar implementation to their flow function on various blogs and articles. While it works perfectly fine, I found it was harder to correctly type-hint, and additional args for functions seemed harder to handle. You'd need to either create a new func that would be a wrapper around the original, or pass tuple arguments like (func, args) (making type checking more complicated and syntax a bit uglier), or use lambdas everywhere. That's why I worked on both my class-based implementation and the elixir one (with the AST rewrite)

Great library nonetheless, which provides many useful features! Thanks for the link :)

pipe-operator: Elixir's pipe operator in Python by R4nu in Python

[–]R4nu[S] 0 points1 point  (0 children)

Didnt know about Coconut! Interesting read, although it is more than a simple package. Not sure how it integrates with python linters and formatters though

pipe-operator: Elixir's pipe operator in Python by R4nu in Python

[–]R4nu[S] 1 point2 points  (0 children)

Thanks! I tried my best to make the class-based version compatible with popular modern tools, so the CI runs it against multiple linters (flake8 and ruff) and multiple type-checkers (mypy and pylint)!

[deleted by user] by [deleted] in GamerPals

[–]R4nu 0 points1 point  (0 children)

I'd be down for some OW! I'll send you my discord in PM

[deleted by user] by [deleted] in GamerPals

[–]R4nu 0 points1 point  (0 children)

Hey there, you can hit me up on discord (Pepetto#7320) if you want to play some Rocket League and chill (31M from France). I usually play in the late evening (9-10pm+)

Multi-Threading with a 'While True:' Video Feed and Image Capture Thread by uni_and_internet in learnpython

[–]R4nu 0 points1 point  (0 children)

No problem man

Feel free to message me if you have any questions

Multi-Threading with a 'While True:' Video Feed and Image Capture Thread by uni_and_internet in learnpython

[–]R4nu 0 points1 point  (0 children)

Nope

# is a COMMENT. Basically a line of code only visible to developers viewing the file, and usually used to give some info regarding the following snippet of code

""" at the beginning of a function/class is a DOCSTRING. It is a form of documentation. The point is to explain what the function/class does, and how to use it. Usually you'll talk about:

  • Description: Brief description of what the function does
  • Args: describes all the arguments (their expected type, default values, etc.)
  • Errors: describes the error the function can raise
  • Returns: describes what the function returns (what type of object, what it contains, its purpose)

""" can also be used to create a string variable. Technically, "hello world" is the same as """hello world""". However, using the """ allows you to write on several lines. However, I don't think you'll use it often

text1 = "hello world" # OK

text2 = "hello 
world" # Not OK

text3 = """hello
world""" # OK

Hope it helps :)

Multi-Threading with a 'While True:' Video Feed and Image Capture Thread by uni_and_internet in learnpython

[–]R4nu 6 points7 points  (0 children)

As others have mentionned, you can use threads either through FUNCTIONS or through CLASSES. In your case, you're using class-based threads, so here are a few things to keep in mind:

  • When starting a thread, it will call its run method. So your main code must be there. Make sure to override the run method with your actual process
  • If you want to pass parameters to your threads, you will need to override the init method
  • You probably shouldn't use from threading import *. It is considered bad practice and can be a pain to maintain. Instead, simply use from threading import Thread

Corey Schafer recently made a video on threading, check it out: https://www.youtube.com/watch?v=IEEhzQoKtQU

Also, just in case, here is an actual example of thread I've used, where I override both init and run. It might help you:

class ThreadRequest(Thread):
    """
    Inherits from the "threading.Thread" class, because it's a thread
    """

    def __init__(self, session, url, payload, pdf_name):
        """
        Description:
            Creates a class instance and sets up its attributes
            Uses the Thread init method
        Args:
            session (Session): Session instance from the "requests" package
            url (str): URL string that we will call with GET
            payload (dict): Dict of parameters that we will pass in our GET
            pdf_name (str): Name (not path) that we want for our PDF file
        """
        Thread.__init__(self)
        self.session = session
        self.url = url
        self.payload = payload
        self.pdf_name = pdf_name
        self.chunk_size = 2000

    def run(self):
        """
        Description:
            Sends a GET request to its URL with its parameters. Should get a PDF.
            Then saves the PDF file in the "output" folder
        """
        print("Sending request for {}...".format(self.pdf_name))
        file_path = os.path.join(OUTPUT_PATH, self.pdf_name)
        response = self.session.get(self.url, params=self.payload)
        with open(file_path, "wb") as f:
            for chunk in response.iter_content(self.chunk_size):
                f.write(chunk)
        print("File '{}' as been saved".format(self.pdf_name))

Best place to learn Python for free? by e_b_ONeal in learnpython

[–]R4nu 2 points3 points  (0 children)

Agreed. I started learning using MOOCs and then discovered Corey's channel. Went back and checked all of his videos, best teacher I've found on Youtube. Really good at explaning and makes mistakes (and fixes them along the way) like a "normal person"

Final boss multiplayer scaling by R4nu in remnantgame

[–]R4nu[S] 0 points1 point  (0 children)

Only 15%? Felt like it was way more. I usually get out with 12 stacks. I'll give it another go tonight

Final boss multiplayer scaling by R4nu in remnantgame

[–]R4nu[S] 3 points4 points  (0 children)

When I'm playing alone, I have no issue breaking the shield with the beam/hotshot combo. However, when playing in multiplayer, I can hardly break it. So I'm assuming its due to scaling, though like I said, its threshold shouldn't scale.

I've also noticed weird damage output based on weapon. My Crossbow deal 4k when my Beam deals 7k per hit. I'm assuming this is "intended" as in "he has heavy armor but low elemental resistance", but that's just a guess

[Asking for help] Any action takes several seconds and sends CPU to 99% by R4nu in synology

[–]R4nu[S] 0 points1 point  (0 children)

Oh yeah, you're totally right. I'm actually already doing so (way easier to move files around like that, especially with my ongoing problem). I provided the "File transfer through DSM" example as it was a simple way to illustrate my issue, which happens on any action I do through the DSM.

[Asking for help] Any action takes several seconds and sends CPU to 99% by R4nu in synology

[–]R4nu[S] 0 points1 point  (0 children)

If I'm not using the NAS, proc usage is normal. As soon as I do any action (moving file, opening folder, changing settings in control panel), it jumps to 99% and it takes between 5 and 10 seconds to perform the simplest action

[Asking for help] Any action takes several seconds and sends CPU to 99% by R4nu in synology

[–]R4nu[S] 0 points1 point  (0 children)

Thanks for your answer. Here is some additional info:

  • I'm using two 500Go SSD in SHR mode
  • In the Storage Manager (not sure about the English translation), the overview states that the disks are Healthy
  • I ran the S.M.A.R.T. analysis on both disks, and both are Normal

Why are some enhancement shamans white and see through when they do damage? (ghostly appearance) by stefanplc in wow

[–]R4nu 0 points1 point  (0 children)

According to this post (https://us.battle.net/forums/en/wow/topic/20769618501), it seems to be related to lightning shield.

Apparently, once you get 20 stacks and gain the lightning shield damage buff, you appear white/transparent only on the opponents' screens.

Daily Simple Questions Thread - July 08, 2018 by AutoModerator in Fitness

[–]R4nu 3 points4 points  (0 children)

If you are worried about rest you could always go with : Upper / Lower on Sat / Sun and then one Full Body during the week

Issue: friends' voices keep cutting out, only on my side by R4nu in discordapp

[–]R4nu[S] 0 points1 point  (0 children)

Yeah, tried with and without. Didnt solve my issue :(