-
Notifications
You must be signed in to change notification settings - Fork 948
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
#966 Add sketch typing for utils.py #1196
#966 Add sketch typing for utils.py #1196
Conversation
Hi I'll have a look at the PR. speaking of the credentials:
speaking of the Namedtuple:
speaking of functions:
Thank you for this contribution, the major goal here is to move forward and to type what we can so we can have a new 6.0.0 release the sooner the better 🙃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work thank you for this.
I have only a few comments regarding some details.
- About the callable, that's fine to me, I might rework it anyway
- could you please format your code, by running:
tox -e format
in order to make it pass the CI, thanks.
I updated the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I was wrong before, you were right about the type for the default_blank
it should be as mentioned in the comment. Users are allowed to pass None
as value for default blank.
apart from that I see issues with the named tuples but that will go away anyway so no worries bout them.
I see a couple of issues with the float("inf")
which has only be a pain to handle so let's merge it like this (after you revert the default blank type) then I'll have a look if I keep the Inf
value of not.
thanks again for your work.
I also changed type of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me.
thank you for your contribution.
I add sketch types for
utils.py
but have following issues:Optional imports
OAuth2Credentials, AccessTokenCredentials, GoogleCredentials, ServiceAccountCredentials are optional and only needed for oauth2client, so cannot be resolved as a type.
Currently, I have to use the following code to make it work:
But it's not ideal, because it's not type safe. I think, we can add try-except imports to functions body:
NamedTuples used as enums
NamedTuples are used for options, but it's not proper way to use them. It also produce type checking issues.
I think, we can use Enum instead of NamedTuple, if there is no reasons for backward compatibility.
Some unclear types
I'm not sure if I have set the correct types for some functions because they are not explained anywhere. Therefore, I need some validation of my propositions.