Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
4 votes
2 answers
186 views

Class for validating code in different Conda environments with PyTorch

I wrote the Validator class. In the project, the presented code is located at the path ".../validator/init.py". It is needed for testing code in different virtual Conda environments, in the ...
Sindik's user avatar
  • 143
0 votes
0 answers
80 views

Nostr OAuth 2 authentication using Fastapi

I liked the idea of being able to authenticate using your own private key using Nostr protocol. The idea is based on events, so you prove your identity by signing an event. It's close to Wallet ...
uak's user avatar
  • 101
1 vote
1 answer
321 views

Validate that the console input contains positive integers only

The function validates whether the input is an int, is there a way to make this more concise and is it best practise to use the try/except or just if/else? I then want to create a similar function for ...
Luca's user avatar
  • 67
1 vote
1 answer
62 views

Model validation through the combination of PCA with classifiers

I use the code below for building machine learning algorithm. In the end, I need to validate model performance. However, I am confused if I do it correctly or not. ...
vdu16's user avatar
  • 21
1 vote
3 answers
465 views

Decorator to validate that Python function arguments are positive

I have a list of functions whose parameters in the signature should be validated with the same criteria each time. ...
SeF's user avatar
  • 199
12 votes
3 answers
3k views

Pythonic way for validating and categorizing user input

In multiple parts of my program, user input needs to be validated and categorized. As these "validation trees" can get pretty unwieldy, I've started splitting them out in different functions,...
Jan van Wijk's user avatar
1 vote
0 answers
91 views

Check that inputs are valid dates

I have a method in a class that accepts either a datetime or string parameter. It is shown in the last code block (I didn't include the class). A little background is that I am defining a wrapper ...
Travis DePriest's user avatar
2 votes
2 answers
161 views

Function to validate that an email address meets some requirements

I want to create a function that checks if an email has a username that is 5 to 20 characters long, starts with an alphabet letter and ends with one domain names of (.org, .net, .org). It also ...
Taylan GÜNAY's user avatar
1 vote
1 answer
93 views

Dont let duplicated values in Iterator return of a function

I'm trying to build a function to return an Iterator with no duplicated float values, its working, but there is a better way of handling this duplicated values? ...
eddyxide's user avatar
  • 141
4 votes
1 answer
696 views

Python function: user input to get positive integer using assert

Is it a bad thing to use asserts to validate user inputs? Or should I keep using an if statement in case the number isnt positive? Code with assert statement: ...
eddyxide's user avatar
  • 141
3 votes
1 answer
170 views

Take in 10 numbers, validate each input, append then in a list and then prints the sum of the list values

I'm practicing loops in Python and started trying to have a better approach with user inputs, is there better ways of dealing with inputs when coding? And I tried using deques too, it worked very well,...
eddyxide's user avatar
  • 141
1 vote
1 answer
68 views

UPDATE on Newspaper Bill Calculator CLI with Python (2 of 3, CLI)

Code is posted after explanation. Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused. Post 1 of 3, Core: UPDATE 1 on Newspaper ...
eccentricOrange's user avatar
3 votes
1 answer
175 views

Newspaper Bill Calculator CLI with Python (2 of 3, CLI)

Code is posted after explanation. Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused. Post 1 of 3, Core: Newspaper Bill ...
eccentricOrange's user avatar
2 votes
1 answer
134 views

Newspaper Bill Calculator CLI with Python (1 of 3, Core)

Code is posted after explanation. Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused. Post 2 of 3, CLI: Newspaper Bill ...
eccentricOrange's user avatar
6 votes
2 answers
837 views

CSV file parser with some checks for header fields and duplicate rows

I have built a sample Parser class on top of the csv module for basic checks that we normally need as the first step of pre-processing. I would love a bit of feedback on the code and any areas that I ...
SDRJ's user avatar
  • 181

15 30 50 per page
1
2 3 4 5
7