1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-18 06:55:09 +00:00

Fix all params appearing as NotRequired[...]

This commit is contained in:
RGBCube 2022-06-26 17:25:36 +03:00
parent 9e97298f7c
commit 132f42cf28
2 changed files with 119 additions and 118 deletions

View file

@ -8,16 +8,16 @@ if TYPE_CHECKING:
class LicenseSimple(TypedDict): class LicenseSimple(TypedDict):
# Example: mit # Example: mit
key: NotRequired[str] key: str
# Example: MIT License # Example: MIT License
name: NotRequired[str] name: str
# Format: uri # Format: uri
# Example: https://api.github.com/licenses/mit # Example: https://api.github.com/licenses/mit
url: NotRequired[Optional[str]] url: Optional[str]
# Example: MIT # Example: MIT
spdx_id: NotRequired[Optional[str]] spdx_id: Optional[str]
# Example: MDc6TGljZW5zZW1pdA== # Example: MDc6TGljZW5zZW1pdA==
node_id: NotRequired[str] node_id: str
# Format: uri # Format: uri
html_url: NotRequired[str] html_url: NotRequired[str]
@ -26,57 +26,57 @@ class SimpleUser(TypedDict):
name: NotRequired[Optional[str]] name: NotRequired[Optional[str]]
email: NotRequired[Optional[str]] email: NotRequired[Optional[str]]
# Example: octocat # Example: octocat
login: NotRequired[str] login: str
# Example: 1 # Example: 1
id: NotRequired[int] id: int
# Example: MDQ6VXNlcjE= # Example: MDQ6VXNlcjE=
node_id: NotRequired[str] node_id: str
# Format: uri # Format: uri
# Example: https://github.com/images/error/octocat_happy.gif # Example: https://github.com/images/error/octocat_happy.gif
avatar_url: NotRequired[str] avatar_url: str
# Example: 41d064eb2195891e12d0413f63227ea7 # Example: 41d064eb2195891e12d0413f63227ea7
gravatar_id: NotRequired[Optional[str]] gravatar_id: Optional[str]
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat # Example: https://api.github.com/users/octocat
url: NotRequired[str] url: str
# Format: uri # Format: uri
# Example: https://github.com/octocat # Example: https://github.com/octocat
html_url: NotRequired[str] html_url: str
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat/followers # Example: https://api.github.com/users/octocat/followers
followers_url: NotRequired[str] followers_url: str
# Example: https://api.github.com/users/octocat/following{/other_user} # Example: https://api.github.com/users/octocat/following{/other_user}
following_url: NotRequired[str] following_url: str
# Example: https://api.github.com/users/octocat/gists{/gist_id} # Example: https://api.github.com/users/octocat/gists{/gist_id}
gists_url: NotRequired[str] gists_url: str
# Example: https://api.github.com/users/octocat/starred{/owner}{/repo} # Example: https://api.github.com/users/octocat/starred{/owner}{/repo}
starred_url: NotRequired[str] starred_url: str
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat/subscriptions # Example: https://api.github.com/users/octocat/subscriptions
subscriptions_url: NotRequired[str] subscriptions_url: str
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat/orgs # Example: https://api.github.com/users/octocat/orgs
organizations_url: NotRequired[str] organizations_url: str
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat/repos # Example: https://api.github.com/users/octocat/repos
repos_url: NotRequired[str] repos_url: str
# Example: https://api.github.com/users/octocat/events{/privacy} # Example: https://api.github.com/users/octocat/events{/privacy}
events_url: NotRequired[str] events_url: str
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat/received_events # Example: https://api.github.com/users/octocat/received_events
received_events_url: NotRequired[str] received_events_url: str
# Example: User # Example: User
type: NotRequired[str] type: str
site_admin: NotRequired[bool] site_admin: bool
# Example: "2020-07-09T00:17:55Z" # Example: "2020-07-09T00:17:55Z"
starred_at: NotRequired[str] starred_at: NotRequired[str]
class Permissions(TypedDict): class Permissions(TypedDict):
admin: NotRequired[bool] admin: bool
pull: NotRequired[bool] pull: bool
triage: NotRequired[bool] triage: NotRequired[bool]
push: NotRequired[bool] push: bool
maintain: NotRequired[bool] maintain: NotRequired[bool]
@ -84,213 +84,213 @@ class SimpleUser(TypedDict):
name: NotRequired[Optional[str]] name: NotRequired[Optional[str]]
email: NotRequired[Optional[str]] email: NotRequired[Optional[str]]
# Example: octocat # Example: octocat
login: NotRequired[str] login: str
# Example: 1 # Example: 1
id: NotRequired[int] id: int
# Example: MDQ6VXNlcjE= # Example: MDQ6VXNlcjE=
node_id: NotRequired[str] node_id: str
# Format: uri # Format: uri
# Example: https://github.com/images/error/octocat_happy.gif # Example: https://github.com/images/error/octocat_happy.gif
avatar_url: NotRequired[str] avatar_url: str
# Example: 41d064eb2195891e12d0413f63227ea7 # Example: 41d064eb2195891e12d0413f63227ea7
gravatar_id: NotRequired[Optional[str]] gravatar_id: Optional[str]
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat # Example: https://api.github.com/users/octocat
url: NotRequired[str] url: str
# Format: uri # Format: uri
# Example: https://github.com/octocat # Example: https://github.com/octocat
html_url: NotRequired[str] html_url: str
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat/followers # Example: https://api.github.com/users/octocat/followers
followers_url: NotRequired[str] followers_url: str
# Example: https://api.github.com/users/octocat/following{/other_user} # Example: https://api.github.com/users/octocat/following{/other_user}
following_url: NotRequired[str] following_url: str
# Example: https://api.github.com/users/octocat/gists{/gist_id} # Example: https://api.github.com/users/octocat/gists{/gist_id}
gists_url: NotRequired[str] gists_url: str
# Example: https://api.github.com/users/octocat/starred{/owner}{/repo} # Example: https://api.github.com/users/octocat/starred{/owner}{/repo}
starred_url: NotRequired[str] starred_url: str
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat/subscriptions # Example: https://api.github.com/users/octocat/subscriptions
subscriptions_url: NotRequired[str] subscriptions_url: str
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat/orgs # Example: https://api.github.com/users/octocat/orgs
organizations_url: NotRequired[str] organizations_url: str
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat/repos # Example: https://api.github.com/users/octocat/repos
repos_url: NotRequired[str] repos_url: str
# Example: https://api.github.com/users/octocat/events{/privacy} # Example: https://api.github.com/users/octocat/events{/privacy}
events_url: NotRequired[str] events_url: str
# Format: uri # Format: uri
# Example: https://api.github.com/users/octocat/received_events # Example: https://api.github.com/users/octocat/received_events
received_events_url: NotRequired[str] received_events_url: str
# Example: User # Example: User
type: NotRequired[str] type: str
site_admin: NotRequired[bool] site_admin: bool
# Example: "2020-07-09T00:17:55Z" # Example: "2020-07-09T00:17:55Z"
starred_at: NotRequired[str] starred_at: NotRequired[str]
class Repository(TypedDict): class Repository(TypedDict):
# Example: 42 # Example: 42
id: NotRequired[int] id: int
# Example: MDEwOlJlcG9zaXRvcnkxMjk2MjY5 # Example: MDEwOlJlcG9zaXRvcnkxMjk2MjY5
node_id: NotRequired[str] node_id: str
# Example: Team Environment # Example: Team Environment
name: NotRequired[str] name: str
# Example: octocat/Hello-World # Example: octocat/Hello-World
full_name: NotRequired[str] full_name: str
license: NotRequired[Optional[LicenseSimple]] license: Optional[LicenseSimple]
organization: NotRequired[Optional[SimpleUser]] organization: NotRequired[Optional[SimpleUser]]
forks: NotRequired[int] forks: int
permissions: NotRequired[Permissions] permissions: NotRequired[Permissions]
owner: NotRequired[SimpleUser] owner: SimpleUser
private: NotRequired[bool] private: bool
# Format: uri # Format: uri
# Example: https://github.com/octocat/Hello-World # Example: https://github.com/octocat/Hello-World
html_url: NotRequired[str] html_url: str
# Example: This your first repo! # Example: This your first repo!
description: NotRequired[Optional[str]] description: Optional[str]
fork: NotRequired[bool] fork: bool
# Format: uri # Format: uri
# Example: https://api.github.com/repos/octocat/Hello-World # Example: https://api.github.com/repos/octocat/Hello-World
url: NotRequired[str] url: str
# Example: http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref} # Example: http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}
archive_url: NotRequired[str] archive_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/assignees{/user} # Example: http://api.github.com/repos/octocat/Hello-World/assignees{/user}
assignees_url: NotRequired[str] assignees_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha} # Example: http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}
blobs_url: NotRequired[str] blobs_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/branches{/branch} # Example: http://api.github.com/repos/octocat/Hello-World/branches{/branch}
branches_url: NotRequired[str] branches_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator} # Example: http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}
collaborators_url: NotRequired[str] collaborators_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/comments{/number} # Example: http://api.github.com/repos/octocat/Hello-World/comments{/number}
comments_url: NotRequired[str] comments_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/commits{/sha} # Example: http://api.github.com/repos/octocat/Hello-World/commits{/sha}
commits_url: NotRequired[str] commits_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head} # Example: http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}
compare_url: NotRequired[str] compare_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/contents/{+path} # Example: http://api.github.com/repos/octocat/Hello-World/contents/{+path}
contents_url: NotRequired[str] contents_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/contributors # Example: http://api.github.com/repos/octocat/Hello-World/contributors
contributors_url: NotRequired[str] contributors_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/deployments # Example: http://api.github.com/repos/octocat/Hello-World/deployments
deployments_url: NotRequired[str] deployments_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/downloads # Example: http://api.github.com/repos/octocat/Hello-World/downloads
downloads_url: NotRequired[str] downloads_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/events # Example: http://api.github.com/repos/octocat/Hello-World/events
events_url: NotRequired[str] events_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/forks # Example: http://api.github.com/repos/octocat/Hello-World/forks
forks_url: NotRequired[str] forks_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/git/commits{/sha} # Example: http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}
git_commits_url: NotRequired[str] git_commits_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/git/refs{/sha} # Example: http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}
git_refs_url: NotRequired[str] git_refs_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/git/tags{/sha} # Example: http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}
git_tags_url: NotRequired[str] git_tags_url: str
# Example: git:github.com/octocat/Hello-World.git # Example: git:github.com/octocat/Hello-World.git
git_url: NotRequired[str] git_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/issues/comments{/number} # Example: http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}
issue_comment_url: NotRequired[str] issue_comment_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/issues/events{/number} # Example: http://api.github.com/repos/octocat/Hello-World/issues/events{/number}
issue_events_url: NotRequired[str] issue_events_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/issues{/number} # Example: http://api.github.com/repos/octocat/Hello-World/issues{/number}
issues_url: NotRequired[str] issues_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/keys{/key_id} # Example: http://api.github.com/repos/octocat/Hello-World/keys{/key_id}
keys_url: NotRequired[str] keys_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/labels{/name} # Example: http://api.github.com/repos/octocat/Hello-World/labels{/name}
labels_url: NotRequired[str] labels_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/languages # Example: http://api.github.com/repos/octocat/Hello-World/languages
languages_url: NotRequired[str] languages_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/merges # Example: http://api.github.com/repos/octocat/Hello-World/merges
merges_url: NotRequired[str] merges_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/milestones{/number} # Example: http://api.github.com/repos/octocat/Hello-World/milestones{/number}
milestones_url: NotRequired[str] milestones_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating} # Example: http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}
notifications_url: NotRequired[str] notifications_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/pulls{/number} # Example: http://api.github.com/repos/octocat/Hello-World/pulls{/number}
pulls_url: NotRequired[str] pulls_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/releases{/id} # Example: http://api.github.com/repos/octocat/Hello-World/releases{/id}
releases_url: NotRequired[str] releases_url: str
# Example: git@github.com:octocat/Hello-World.git # Example: git@github.com:octocat/Hello-World.git
ssh_url: NotRequired[str] ssh_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/stargazers # Example: http://api.github.com/repos/octocat/Hello-World/stargazers
stargazers_url: NotRequired[str] stargazers_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/statuses/{sha} # Example: http://api.github.com/repos/octocat/Hello-World/statuses/{sha}
statuses_url: NotRequired[str] statuses_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/subscribers # Example: http://api.github.com/repos/octocat/Hello-World/subscribers
subscribers_url: NotRequired[str] subscribers_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/subscription # Example: http://api.github.com/repos/octocat/Hello-World/subscription
subscription_url: NotRequired[str] subscription_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/tags # Example: http://api.github.com/repos/octocat/Hello-World/tags
tags_url: NotRequired[str] tags_url: str
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/teams # Example: http://api.github.com/repos/octocat/Hello-World/teams
teams_url: NotRequired[str] teams_url: str
# Example: http://api.github.com/repos/octocat/Hello-World/git/trees{/sha} # Example: http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}
trees_url: NotRequired[str] trees_url: str
# Example: https://github.com/octocat/Hello-World.git # Example: https://github.com/octocat/Hello-World.git
clone_url: NotRequired[str] clone_url: str
# Format: uri # Format: uri
# Example: git:git.example.com/octocat/Hello-World # Example: git:git.example.com/octocat/Hello-World
mirror_url: NotRequired[Optional[str]] mirror_url: Optional[str]
# Format: uri # Format: uri
# Example: http://api.github.com/repos/octocat/Hello-World/hooks # Example: http://api.github.com/repos/octocat/Hello-World/hooks
hooks_url: NotRequired[str] hooks_url: str
# Format: uri # Format: uri
# Example: https://svn.github.com/octocat/Hello-World # Example: https://svn.github.com/octocat/Hello-World
svn_url: NotRequired[str] svn_url: str
# Format: uri # Format: uri
# Example: https://github.com # Example: https://github.com
homepage: NotRequired[Optional[str]] homepage: Optional[str]
language: NotRequired[Optional[str]] language: Optional[str]
# Example: 9 # Example: 9
forks_count: NotRequired[int] forks_count: int
# Example: 80 # Example: 80
stargazers_count: NotRequired[int] stargazers_count: int
# Example: 80 # Example: 80
watchers_count: NotRequired[int] watchers_count: int
# Example: 108 # Example: 108
size: NotRequired[int] size: int
# Example: master # Example: master
default_branch: NotRequired[str] default_branch: str
# Example: 0 # Example: 0
open_issues_count: NotRequired[int] open_issues_count: int
# Example: True # Example: True
is_template: NotRequired[bool] is_template: NotRequired[bool]
topics: NotRequired[List[str]] topics: NotRequired[List[str]]
# Example: True # Example: True
has_issues: NotRequired[bool] has_issues: bool
# Example: True # Example: True
has_projects: NotRequired[bool] has_projects: bool
# Example: True # Example: True
has_wiki: NotRequired[bool] has_wiki: bool
has_pages: NotRequired[bool] has_pages: bool
# Example: True # Example: True
has_downloads: NotRequired[bool] has_downloads: bool
archived: NotRequired[bool] archived: bool
disabled: NotRequired[bool] disabled: bool
visibility: NotRequired[str] visibility: NotRequired[str]
# Format: date-time # Format: date-time
# Example: 2011-01-26T19:06:43Z # Example: 2011-01-26T19:06:43Z
pushed_at: NotRequired[Optional[str]] pushed_at: Optional[str]
# Format: date-time # Format: date-time
# Example: 2011-01-26T19:01:12Z # Example: 2011-01-26T19:01:12Z
created_at: NotRequired[Optional[str]] created_at: Optional[str]
# Format: date-time # Format: date-time
# Example: 2011-01-26T19:14:43Z # Example: 2011-01-26T19:14:43Z
updated_at: NotRequired[Optional[str]] updated_at: Optional[str]
# Example: True # Example: True
allow_rebase_merge: NotRequired[bool] allow_rebase_merge: NotRequired[bool]
template_repository: NotRequired[Optional[dict]] template_repository: NotRequired[Optional[dict]]
@ -309,8 +309,8 @@ class Repository(TypedDict):
allow_forking: NotRequired[bool] allow_forking: NotRequired[bool]
subscribers_count: NotRequired[int] subscribers_count: NotRequired[int]
network_count: NotRequired[int] network_count: NotRequired[int]
open_issues: NotRequired[int] open_issues: int
watchers: NotRequired[int] watchers: int
master_branch: NotRequired[str] master_branch: NotRequired[str]
# Example: "2020-07-09T00:17:42Z" # Example: "2020-07-09T00:17:42Z"
starred_at: NotRequired[str] starred_at: NotRequired[str]

View file

@ -126,7 +126,8 @@ def generate_typed_dicts_from_json_schema(
value, title=key.capitalize(), no_comments=no_comments value, title=key.capitalize(), no_comments=no_comments
) )
result.append(extras) result.append(extras)
if param_annotation not in obj.get("required", []):
if key not in obj.get("required", []):
param_annotation = f"NotRequired[{param_annotation}]" param_annotation = f"NotRequired[{param_annotation}]"
if not no_comments: if not no_comments: