Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @jbristow @zprobst @ccloes @angelosantos4 @rreddy15
* @jbristow @zprobst @ccloes @angelosantos4 @rreddy2
2 changes: 1 addition & 1 deletion nodestream_github/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
enterprise_name: str,
actions: list[str] | None = None,
lookback_period: dict[str, int] | None = None,
**github_client_kwargs: dict[str, Any] | None,
**github_client_kwargs: Any | None,
):
self.enterprise_name = enterprise_name
self.client = GithubRestApiClient(**github_client_kwargs)
Expand Down
2 changes: 1 addition & 1 deletion nodestream_github/client/githubclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(
max_retries: int | None = None,
rate_limit_per_minute: int | None = None,
max_retry_wait_seconds: int | None = None,
**_kwargs: dict[str, Any],
**_kwargs: Any,
):
if per_page is None:
per_page = DEFAULT_PAGE_SIZE
Expand Down
2 changes: 1 addition & 1 deletion nodestream_github/orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(
*,
include_members: bool | None = True,
include_repositories: bool | None = True,
**kwargs: dict[str, Any],
**kwargs: Any,
):

self.include_members = include_members is True
Expand Down
2 changes: 1 addition & 1 deletion nodestream_github/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class GithubReposExtractor(Extractor):
def __init__(
self,
collecting: CollectWhichRepos | dict[str, Any] | None = None,
**kwargs: dict[str, Any],
**kwargs: Any,
):
if isinstance(collecting, CollectWhichRepos):
self.collecting = collecting
Expand Down
2 changes: 1 addition & 1 deletion nodestream_github/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


class GithubTeamsExtractor(Extractor):
def __init__(self, **github_client_kwargs: dict[str, Any]):
def __init__(self, **github_client_kwargs: Any):
self.client = GithubRestApiClient(**github_client_kwargs)

async def extract_records(self) -> AsyncGenerator[TeamRecord]:
Expand Down
2 changes: 1 addition & 1 deletion nodestream_github/transformer/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(
self,
*,
full_name_key: str = "full_name",
**kwargs: dict[str, Any],
**kwargs: Any,
):
self.client = GithubRestApiClient(**kwargs)
self.full_name_key = full_name_key
Expand Down
2 changes: 1 addition & 1 deletion nodestream_github/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
from .httpx import HeaderTypes, PrimitiveData, QueryParamTypes

__all__ = [
"GithubAuditLog",
"GithubOrg",
"GithubOrgSummary",
"GithubRepo",
"GithubTeam",
"GithubTeamSummary",
"GithubAuditLog",
"GithubUser",
"HeaderTypes",
"JSONType",
Expand Down
2 changes: 1 addition & 1 deletion nodestream_github/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


class GithubUserExtractor(Extractor):
def __init__(self, **github_client_kwargs: dict[str, Any]):
def __init__(self, **github_client_kwargs: Any):
self.client = GithubRestApiClient(**github_client_kwargs)

async def extract_records(self) -> AsyncGenerator[UserRecord]:
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ addopts = "--cov-report=term --cov-report=xml --cov=nodestream_github --junit-xm
[tool.ruff.lint]
select = ["A", "ANN", "ARG", "ASYNC", "B", "C4", "DTZ", "E", "EM", "ERA", "F", "FBT", "FURB", "G", "I", "INP", "N", "PIE", "PT", "RET", "RUF", "S", "SIM", "T20", "TC", "UP", ]
ignore = []

unfixable = ["B"]

dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101", "S106"]
"nodestream_github/logging/__init__.py" = ["A005"]
"nodestream_github/types/__init__.py" = ["A005"]

[tool.ruff.lint.flake8-annotations]
mypy-init-return = true
suppress-none-returning = true
allow-star-arg-any = true
2 changes: 1 addition & 1 deletion tests/data/orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def org_summary(
*, org_login: str = "github", org_id: int = 1, **kwargs: dict[str, Any]
*, org_login: str = "github", org_id: int = 1, **kwargs: Any
) -> GithubOrgSummary:
return {
"login": org_login,
Expand Down
2 changes: 1 addition & 1 deletion tests/data/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def repo(
owner: dict[str, Any] | None = None,
repo_name: str = "Hello-World",
repo_id: int = 1296269,
**kwargs: dict[str, Any],
**kwargs: Any,
) -> GithubRepo:

repo_owner = OCTOCAT_USER if owner is None else owner
Expand Down
4 changes: 2 additions & 2 deletions tests/data/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def team_summary(
team_id: int = 1,
slug: str = "justice-league",
org_login: str = "github",
**kwargs: dict[str, Any],
**kwargs: Any,
) -> GithubTeamSummary:
return {
"id": team_id,
Expand All @@ -34,7 +34,7 @@ def team(
team_id: int = 1,
organization: GithubOrgSummary | None = None,
slug: str = "justice-league",
**kwargs: dict[str, Any],
**kwargs: Any,
) -> GithubTeam:
org = organization if organization else GITHUB_ORG
summary = team_summary(team_id=team_id, org_login=org["login"], slug=slug)
Expand Down
2 changes: 1 addition & 1 deletion tests/data/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def user(
*,
user_login: str = "octocat",
user_id: int = 1,
**kwargs: dict[str, Any],
**kwargs: Any,
) -> GithubUser:

return {
Expand Down
38 changes: 17 additions & 21 deletions tests/mocks/githubrest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def per_page(self) -> int:
def httpx_mock(self) -> HTTPXMock:
return self._httpx_mock

def add_exception(self, *, exception: Exception, **matchers: dict[str, Any]):
def add_exception(self, *, exception: Exception, **matchers: Any):
self.httpx_mock.add_exception(exception, **matchers)

def add_response(
Expand All @@ -55,7 +55,7 @@ def add_response(
html: str | None = None,
stream: Optional[any] = None,
json: Optional[any] = None,
**matchers: dict[str, Any],
**matchers: Any,
):
self.httpx_mock.add_response(
status_code=status_code,
Expand All @@ -69,20 +69,20 @@ def add_response(
**matchers,
)

def all_orgs(self, **kwargs: dict[str, Any]) -> None:
def all_orgs(self, **kwargs: Any) -> None:
self.add_response(
url=f"{self.base_url}/organizations?per_page={self.per_page}", **kwargs
)

def get_org(self, *, org_name: str, **kwargs: dict[str, Any]) -> None:
def get_org(self, *, org_name: str, **kwargs: Any) -> None:
self.add_response(url=f"{self.base_url}/orgs/{org_name}", **kwargs)

def get_members_for_org(
self,
*,
org_name: str,
role: OrgMemberRole | None = None,
**kwargs: dict[str, Any],
**kwargs: Any,
) -> None:
actual_role = f"role={role}" if role else ""
self.add_response(
Expand All @@ -95,21 +95,21 @@ def get_repos_for_org(
*,
org_name: str,
repo_type: OrgRepoType | None = None,
**kwargs: dict[str, Any],
**kwargs: Any,
):
type_param = f"&type={repo_type}" if repo_type else ""
self.add_response(
url=f"{self.base_url}/orgs/{org_name}/repos?per_page={self.per_page}{type_param}",
**kwargs,
)

def list_teams_for_org(self, *, org_login: str, **kwargs: dict[str, Any]):
def list_teams_for_org(self, *, org_login: str, **kwargs: Any):
self.add_response(
url=f"{self.base_url}/orgs/{org_login}/teams?per_page={self.per_page}",
**kwargs,
)

def get_team(self, *, org_login: str, team_slug: str, **kwargs: dict[str, Any]):
def get_team(self, *, org_login: str, team_slug: str, **kwargs: Any):
self.add_response(
url=f"{self.base_url}/orgs/{org_login}/teams/{team_slug}", **kwargs
)
Expand All @@ -119,22 +119,20 @@ def get_members_for_team(
*,
team_id: int,
role: TeamMemberRole,
**kwargs: dict[str, Any],
**kwargs: Any,
):
self.add_response(
url=f"{self.base_url}/teams/{team_id}/members?per_page={self.per_page}&role={role}",
**kwargs,
)

def get_repos_for_team(
self, *, org_login: str, slug: str, **kwargs: dict[str, Any]
):
def get_repos_for_team(self, *, org_login: str, slug: str, **kwargs: Any):
self.add_response(
url=f"{self.base_url}/orgs/{org_login}/teams/{slug}/repos?per_page={self.per_page}",
**kwargs,
)

def all_repos(self, **kwargs: dict[str, Any]) -> None:
def all_repos(self, **kwargs: Any) -> None:
self.add_response(
url=f"{self.base_url}/repositories?per_page={self.per_page}", **kwargs
)
Expand All @@ -144,16 +142,14 @@ def get_languages_for_repo(
*,
owner_login: str,
repo_name: str,
**kwargs: dict[str, Any],
**kwargs: Any,
) -> None:
self.add_response(
url=f"{self.base_url}/repos/{owner_login}/{repo_name}/languages?per_page={self.per_page}",
**kwargs,
)

def get_webhooks_for_repo(
self, *, owner_login: str, repo_name: str, **kwargs: dict[str, Any]
):
def get_webhooks_for_repo(self, *, owner_login: str, repo_name: str, **kwargs: Any):
self.add_response(
url=f"{self.base_url}/repos/{owner_login}/{repo_name}/hooks?per_page={self.per_page}",
**kwargs,
Expand All @@ -165,14 +161,14 @@ def get_collaborators_for_repo(
owner_login: str,
repo_name: str,
affiliation: CollaboratorAffiliation,
**kwargs: dict[str, Any],
**kwargs: Any,
) -> None:
self.add_response(
url=f"{self.base_url}/repos/{owner_login}/{repo_name}/collaborators?per_page={self.per_page}&affiliation={affiliation}",
**kwargs,
)

def all_users(self, **kwargs: dict[str, Any]):
def all_users(self, **kwargs: Any):
self.add_response(
url=f"{self.base_url}/users?per_page={self.per_page}", **kwargs
)
Expand All @@ -182,15 +178,15 @@ def get_repos_for_user(
*,
user_login: str,
type_param: UserRepoType | None,
**kwargs: dict[str, Any],
**kwargs: Any,
):
type_param = f"&type={type_param}" if type_param else ""
self.add_response(
url=f"{self.base_url}/users/{user_login}/repos?per_page=100&{type_param}",
**kwargs,
)

def get_enterprise_audit_logs(self, **kwargs: dict[str, Any]):
def get_enterprise_audit_logs(self, **kwargs: Any):
url = (
f"{self.base_url}/enterprises/test-enterprise"
f"/audit-log?per_page=100&phrase=action:protected_branch.create"
Expand Down