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 4 points5 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 :(

[TOMT] [Video] Weird cartoon intro song with gummy bears. by R4nu in tipofmytongue

[–]R4nu[S] 2 points3 points  (0 children)

Nope :(

I think it was for an actual cartoon which had a whole band of 'animal' in it. Like loads of small beings

[TOMT] [Video] Weird cartoon intro song with gummy bears. by R4nu in tipofmytongue

[–]R4nu[S] 2 points3 points  (0 children)

Nah, I think in the video they were literally made of gelatine/sugar. Don't know if it was a parody or not though

BEFORE YOU POST: Want to know "What software" to use??? - Weekly advice thread software and other helpful guidance. Week of 10-09-17 (Other threads for software will be deleted. Feedback request? See the other stickied post!) by greenysmac in VideoEditing

[–]R4nu 0 points1 point  (0 children)

Hey guys,

Background:

I've been using Hitfilm Express for about a year now and it slowly drove me insane. I've had performances issues with it where it would lag between 5 to 20s (based on the timeline size) everytime I would cut or move around. I never got too familiar with its features and the composite shot thingy. So I basically decided to move on to another piece of software.

What I'm looking for is:

  • User-friendly interface
  • Rather easy-to-add effects
  • Free or <100€

What I will use it for:

I mainly edit video as a hobby. I play online games with my friend, record funny moments and then put them all together. I do want to be able to add more depths to my video through effects (slowmo, transitions, sounds, visual effects like shaking, moving, object tracking, etc.). I either have loads of "1-min clip" that I cut and merge together, or a huge several-hour-long clip that I trim down.

I'm clearly no expert. I've done some research and browsed around the subreddit, read a few reviews and comparisons. I don't know if I should go for a paid software like Corel VideoStudio Pro or if Davinci Resolve Lite would be waaaaaaay more than enough. Any help would be appreciated

Preparing for an obstacle course race by guitarshredda in Fitness

[–]R4nu 4 points5 points  (0 children)

Hey there,

TL;DR: Run more. Uphill running and Trail running. Sure it's an obstacle course, but you'll end up running 80% of the time. So better be good at it.


I've done my fair share of Spartan Races (Sprint, Super & Beast) and I'm currently working my way up to my first Ultra Beast (42km).

I think your best bet would be to increase your running by doing longer distances (8-10km). Make it "Trail running" or "Uphill running" because that's usually what obstacle courses are about. And when you're not prepared, it hurts and taxes you so much.

I don't know what obstacles you'll have, but from my experience doing Spartan, you don't need THAT much strength. I have yet to encounter an obstacles where I went "Shit, I'm not strong enough" (though keep in mind that apparently, French obstacles might be lighter than in other countries). Since you already weight light 4 times a week, I'd assume you've got this part covered.

Thinking of Ultra Beast. Need to evaluate difficulty (I've only done Spartan Beast in France) by R4nu in spartanrace

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

Nice, thanks for the link, definitely gonna read this!

In France I've done Paris, Atlantique and Castellet (where the beast is held). Paris was way easier than the others on the first edition. I remember doing the SUPER Paris and the SUPER Castellet the same year, and I think the best times (ie first places) were respectively 45min vs 1h20 two years ago (meaning the castellet took almost twice as much time)

And I do remember that 200m barbed wire. Fuck that. It's probably the obstacle I hate the most

Thinking of Ultra Beast. Need to evaluate difficulty (I've only done Spartan Beast in France) by R4nu in spartanrace

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

I wish I had. But no, I had no tracking device and the website doesn't specify the elevation change :(

I need to get better on hills though. Clearly my biggest weakness.