-
Notifications
You must be signed in to change notification settings - Fork 803
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
Add Type hints to function.py
#1827
Conversation
💚 CLA has been signed |
Does this type need the
Looks good.
Yes, this will have to be treated as a separate change. You are correct, this was designed many years ago with the idea of being completely dynamic. I think in the end what I'm going to end up doing is add the |
It's not required, I put it there from the perspective of it's an internal library helper type and should probably not be used from the outside. Similar to a numpy |
@Caiofcas Merging this change, but note that I have renamed But anyway, you are making great progress! :) |
* feat: add first type annotations * feat: add _JSONSafeTypes annotation to to_dict methods * feat: add typing for SF function * chore: fix linting * rename _JSONSafeTypes to JSONType * format code --------- Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com> (cherry picked from commit 76a57fd)
* feat: add first type annotations * feat: add _JSONSafeTypes annotation to to_dict methods * feat: add typing for SF function * chore: fix linting * rename _JSONSafeTypes to JSONType * format code --------- Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com> (cherry picked from commit 76a57fd) Co-authored-by: Caio Fontes <38675540+Caiofcas@users.noreply.github.com>
Continuation of #1821 (issue #1533 ).
Notable changes:
_JsonSafeTypes
inutils.py
in an attempt to properly catch all cases in.to_dict()
methods.Mapping
->MutableMapping
and.copy()
->deepcopy()
changes inSF()
function as was done inQ()
.Any
types in kwargs and params, maybe create a new ticket to tighten these up after initial type hints are done? don't know if I can just go by the test cases and assume types not present in them are invalid, the way the functions are written it seems purposefully loose.