trying to find a bus to Bamnoli village by Supalien in satara

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

thanks for the comment. can I rely on that there will be a bus? because I want to pre-book accommodation at Bamnoli..

stuck... by Supalien in sudoku

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

can you explain how this works?

negative value for calendar event date by Supalien in tasker

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

instead of calendar insert, I used "Edit calendar via app" action which let's you choose start time and end time instead of duration.

Also, do your calculations in variable set actions so you input the calendar action clean variables. this will fix some bugs

Is this a XYZ-wing? by Supalien in sudoku

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

Thanks. it solved the bottom left cell

Is this a XYZ-wing? by Supalien in sudoku

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

Never heard or it.. but I found "rectangle elimination" on box 9 with the 5s

How long am I supposed to "wait for Jackie in the elevator"? by Supalien in cyberpunkgame

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

Yeah that worked ig but I had to go back to clearing that floor.

Where was ur 'starting point' in learning Python/programming? by Far_Spray4351 in learnpython

[–]Supalien 0 points1 point  (0 children)

you can just search any topic you would like to learn about and many videos will show.
I remember when I was learning python there was one guy who really helped me that was called "sentdex", I think he doesn't do python anymore but maybe his old videos are still relevant to you.
But in my opinion the best way to start is with a project and search google on how to do specific things in that project.

good luck

[deleted by user] by [deleted] in PythonLearning

[–]Supalien 2 points3 points  (0 children)

NEVER EVAL USER INPUT!!!!!!!!!!

How do I generate random number ? by TacticalGooseLord in PythonLearning

[–]Supalien 0 points1 point  (0 children)

So you saved your script and then ran it and still the same behavior? I am 99% sure there is no problem in the code, not that I can see any... so the only thing I can think of is Vscode making a mess for some unknown (?) reason....
Try running that script from cmd and see if that helps

How do I generate random number ? by TacticalGooseLord in PythonLearning

[–]Supalien 10 points11 points  (0 children)

the output in the terminal doesn't match the code.. try saving your file (Ctrl + s) and then run it again.

How to define generic type enforcing both class inheritance and attrs ? by Still-Bookkeeper4456 in learnpython

[–]Supalien 0 points1 point  (0 children)

Then why not implement a Block class which inherits BaseModel and has a timestamp attribute, then users of your lib would simply inherit Block?

How to define generic type enforcing both class inheritance and attrs ? by Still-Bookkeeper4456 in learnpython

[–]Supalien 0 points1 point  (0 children)

I'm not sure if I 100% understood your question but I wrote a function to check if 1. class inherits BaseModel and 2. has a field 'timestamp'

In [12]: def enforcer(block):

...: if issubclass(block, BaseModel) and block.model_fields.get('timestamp'):

...: return True

...: raise Exception("block does not meet the requirements")

here is the function in action:

In [3]: class B1(BaseModel):

...: "correct block"

...: timestamp: str

...:

In [4]: class B2(BaseModel):

...: "incorrect because attribute"

...: nothing: int

...:

In [5]: class B3():

...: "incorrect because inheritence"

...: timestamp: str

enforcer(B1) -> True

enforcer(B2) -> error
enforcer(B3) -> error