-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MyPy flags a type incompatibility in line 436 of Ozone.py. This is in the get_specific_parameter method #79
Comments
Strange, mypy does not complain about it to me (I bet it's something on my end, though). Good catch either way. I don't have anything to say about fixing the mypy warning. However, I have something to say about the possible solution. I changed the implementation of
I don't think this duplication of logic should be maintained. If What do you think? @Milind220 |
Also after I think about it, any further fixes to |
@lahdjirayhan i agree with line of reasoning of grouping steps from 1 to 5 in a private method for it to be reused to reduce the redundancy in both methods, it makes perfect sense! would you like to hold the beer for this one ? |
@lahdjirayhan Definitely agree with you there - a private method to cover that functionality would be ideal and much cleaner than repeating the code. @Sam-damn ahahaha I love that line "would you like to hold the beer for this one?" - Great stuff hahaha |
This issue is actually only a symptom of the actual problem that you've pointed out. Let's close this issue and create a new one to address the need for refactoring that section of code. |
after validating it. This is an attempt to address things mentioned in Ozon3Org#80 and briefly in Ozon3Org#79
after validating it. This is an attempt to address things mentioned in Ozon3Org#80 and briefly in Ozon3Org#79
The problem
Here's the warning that's displayed:
Argument of type "Series[Unknown]" cannot be assigned to parameter "x" of type "SupportsFloat | SupportsIndex | str | bytes |
This is the line of code that causes this:
Possible explanation
Here, row is a Pandas dataframe, and air_param is a column in it
This warning, if I understand correctly, is basically indicating that MyPy has no guarantee that the value stored in that cell is a number. Due to this, it's not comfortable with us type casting it as a float while assigning it to result.
Possible solution
Better implementation of
get_specific_parameter
method. This method currently creates an entire dataframe by callingget_city_air
, when all it requires is a single number. A more lightweight method of implementing it would be to make an API call, and then get the required parameter directly from the JSON response, and return it from there.The text was updated successfully, but these errors were encountered: