mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 08:05:55 +03:00
[PR #695] Add type annotations for Spotify JSON objects #997
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#997
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/spotipy-dev/spotipy/pull/695
Author: @akathorn
Created: 6/23/2021
Status: 🔄 Open
Base:
v3_oldprsonly← Head:typings📝 Commits (10+)
49e42f9Add representation for JSON return values0047299Add typing_extensions as dependencya6804afAnnotate util.py and exceptions.py24416a3Partly annotate client.py6fdfc57Annotate cache_handler.py6eabb04Small anotation in scope.pyc60a562Annotate all arguments in client.pycc90ddaAnnotate most of oauth2.py public api61ce06cA big pass over client.py95e4859Annotate all return types in client.py📊 Changes
8 files changed (+1144 additions, -202 deletions)
View changed files
📝
setup.py(+1 -0)📝
spotipy/cache_handler.py(+13 -10)📝
spotipy/client.py(+212 -130)📝
spotipy/exceptions.py(+5 -1)➕
spotipy/json_types.py(+847 -0)📝
spotipy/oauth2.py(+62 -58)📝
spotipy/scope.py(+2 -2)📝
spotipy/util.py(+2 -1)📄 Description
Working on #439. It is WIP but I would like some feedback before I validate the return types one by one.
All public methods are annotated. I haven't added anything that alters the runtime behavior in any way.
The arguments are straightforward since they are all basic types, but I had to define new types for the return values. The alternative is using
Dict[str, Any]for all the JSON dicts, which would be more "lightweight" but provides near-zero typing information.It works on nearly examples!
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.