feat: API Fixes and Adjustments (#23)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Alexandre Teles (afterSt0rm)
2023-07-19 23:32:48 -03:00
committed by GitHub
parent 1273f9224b
commit b18097e030
24 changed files with 563 additions and 565 deletions

View File

@@ -93,17 +93,40 @@ class Contributor(dict):
avatar_url: str,
html_url: str,
contributions: Optional[int] = None,
bio: Optional[str] = None,
):
if contributions:
dict.__init__(
self,
login=login,
avatar_url=avatar_url,
html_url=html_url,
contributions=contributions,
)
else:
dict.__init__(self, login=login, avatar_url=avatar_url, html_url=html_url)
match contributions, bio:
case None, None:
dict.__init__(
self, login=login, avatar_url=avatar_url, html_url=html_url, bio=bio
)
case int(_), None:
dict.__init__(
self,
login=login,
avatar_url=avatar_url,
html_url=html_url,
contributions=contributions,
)
case None, str(_):
dict.__init__(
self,
login=login,
avatar_url=avatar_url,
html_url=html_url,
bio=bio,
)
case int(_), str(_):
dict.__init__(
self,
login=login,
avatar_url=avatar_url,
html_url=html_url,
contributions=contributions,
bio=bio,
)
case _:
raise ValueError("Invalid arguments")
@dataclass