Skip to content

Commit 6fe7c48

Browse files
authored
fix: clean up kwargs and lowercase any (#17)
1 parent 11a9aa0 commit 6fe7c48

File tree

12 files changed

+57
-34
lines changed

12 files changed

+57
-34
lines changed

nodestream_github/client/githubclient.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import logging
88
from collections.abc import AsyncGenerator
99
from enum import Enum
10+
from typing import Any
1011

1112
import httpx
1213
from limits import RateLimitItem, RateLimitItemPerMinute
@@ -82,7 +83,7 @@ def __init__(
8283
max_retries: int | None = None,
8384
rate_limit_per_minute: int | None = None,
8485
max_retry_wait_seconds: int | None = None,
85-
**_kwargs: any,
86+
**_kwargs: dict[str, Any],
8687
):
8788
if per_page is None:
8889
per_page = DEFAULT_PAGE_SIZE

nodestream_github/orgs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
from collections.abc import AsyncGenerator
9+
from typing import Any
910

1011
from nodestream.pipeline import Extractor
1112

@@ -25,7 +26,7 @@ def __init__(
2526
*,
2627
include_members: bool | None = True,
2728
include_repositories: bool | None = True,
28-
**kwargs: any,
29+
**kwargs: dict[str, Any],
2930
):
3031

3132
self.include_members = include_members is True

nodestream_github/repos.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from collections.abc import AsyncGenerator
99
from dataclasses import dataclass
10+
from typing import Any
1011

1112
from nodestream.pipeline import Extractor
1213

@@ -19,7 +20,7 @@
1920
logger = get_plugin_logger(__name__)
2021

2122

22-
def _dict_val_to_bool(d: dict[str, any], key: str) -> bool:
23+
def _dict_val_to_bool(d: dict[str, Any], key: str) -> bool:
2324
value = d.get(key)
2425
if value is None:
2526
return False
@@ -46,7 +47,7 @@ def user_any(self) -> bool:
4647
return self.user_public or self.user_private
4748

4849
@staticmethod
49-
def from_dict(raw_dict: dict[str, any]) -> "CollectWhichRepos":
50+
def from_dict(raw_dict: dict[str, Any]) -> "CollectWhichRepos":
5051
org_all = _dict_val_to_bool(raw_dict, "org_all")
5152
user_all = _dict_val_to_bool(raw_dict, "user_all")
5253

@@ -62,8 +63,8 @@ def from_dict(raw_dict: dict[str, any]) -> "CollectWhichRepos":
6263
class GithubReposExtractor(Extractor):
6364
def __init__(
6465
self,
65-
collecting: CollectWhichRepos | dict[str, any] | None = None,
66-
**kwargs: any,
66+
collecting: CollectWhichRepos | dict[str, Any] | None = None,
67+
**kwargs: dict[str, Any],
6768
):
6869
if isinstance(collecting, CollectWhichRepos):
6970
self.collecting = collecting

nodestream_github/teams.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
from collections.abc import AsyncGenerator
9+
from typing import Any
910

1011
from nodestream.pipeline import Extractor
1112

@@ -20,7 +21,7 @@
2021

2122

2223
class GithubTeamsExtractor(Extractor):
23-
def __init__(self, **github_client_kwargs: any):
24+
def __init__(self, **github_client_kwargs: dict[str, Any]):
2425
self.client = GithubRestApiClient(**github_client_kwargs)
2526

2627
async def extract_records(self) -> AsyncGenerator[TeamRecord]:

nodestream_github/transformer/repo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
from collections.abc import AsyncGenerator
3+
from typing import Any
34

45
from nodestream.pipeline import Transformer
56

@@ -17,7 +18,7 @@ def __init__(
1718
self,
1819
*,
1920
full_name_key: str = "full_name",
20-
**kwargs: any,
21+
**kwargs: dict[str, Any],
2122
):
2223
self.client = GithubRestApiClient(**kwargs)
2324
self.full_name_key = full_name_key

nodestream_github/types/enums.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ class UserRepoType(StrEnum):
2323
MEMBER = "member"
2424

2525

26-
class OrgMemberRole:
26+
class OrgMemberRole(StrEnum):
2727
ALL = "all"
2828
ADMIN = "admin"
2929
MEMBER = "member"
3030

3131

32-
class TeamMemberRole:
32+
class TeamMemberRole(StrEnum):
3333
ALL = "all"
3434
MAINTAINER = "maintainer"
3535
MEMBER = "member"

nodestream_github/users.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
from collections.abc import AsyncGenerator
9+
from typing import Any
910

1011
from nodestream.pipeline import Extractor
1112

@@ -19,7 +20,7 @@
1920

2021

2122
class GithubUserExtractor(Extractor):
22-
def __init__(self, **github_client_kwargs: any):
23+
def __init__(self, **github_client_kwargs: dict[str, Any]):
2324
self.client = GithubRestApiClient(**github_client_kwargs)
2425

2526
async def extract_records(self) -> AsyncGenerator[UserRecord]:

tests/data/orgs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
from typing import Any
2+
13
from nodestream_github.types import GithubOrg, GithubOrgSummary
24
from tests.data.util import encode_as_node_id
35

46

57
def org_summary(
6-
*, org_login: str = "github", org_id: int = 1, **kwargs: any
8+
*, org_login: str = "github", org_id: int = 1, **kwargs: dict[str, Any]
79
) -> GithubOrgSummary:
810
return {
911
"login": org_login,

tests/data/repos.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
from typing import Any
2+
13
from nodestream_github.types import GithubRepo
24
from tests.data.users import OCTOCAT_USER
35
from tests.data.util import encode_as_node_id
46

57

68
def repo(
79
*,
8-
owner: dict[str, any] | None = None,
10+
owner: dict[str, Any] | None = None,
911
repo_name: str = "Hello-World",
1012
repo_id: int = 1296269,
11-
**kwargs: any,
13+
**kwargs: dict[str, Any],
1214
) -> GithubRepo:
1315

1416
repo_owner = OCTOCAT_USER if owner is None else owner

tests/data/teams.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Any
2+
13
from nodestream_github.types import GithubOrgSummary, GithubTeam, GithubTeamSummary
24
from tests.data.orgs import GITHUB_ORG
35
from tests.data.util import encode_as_node_id
@@ -8,7 +10,7 @@ def team_summary(
810
team_id: int = 1,
911
slug: str = "justice-league",
1012
org_login: str = "github",
11-
**kwargs: any,
13+
**kwargs: dict[str, Any],
1214
) -> GithubTeamSummary:
1315
return {
1416
"id": team_id,
@@ -32,7 +34,7 @@ def team(
3234
team_id: int = 1,
3335
organization: GithubOrgSummary | None = None,
3436
slug: str = "justice-league",
35-
**kwargs: any,
37+
**kwargs: dict[str, Any],
3638
) -> GithubTeam:
3739
org = organization if organization else GITHUB_ORG
3840
summary = team_summary(team_id=team_id, org_login=org["login"], slug=slug)

0 commit comments

Comments
 (0)