Skip to content

Commit

Permalink
Merge pull request #1122 from sirosen/pre-commit-update
Browse files Browse the repository at this point in the history
Update pre-commit hooks & apply
  • Loading branch information
sirosen authored Dec 19, 2024
2 parents 3993dc9 + 1f03c14 commit 813dfc4
Show file tree
Hide file tree
Showing 45 changed files with 69 additions and 67 deletions.
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ repos:
- id: check-merge-conflict
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.3
rev: 0.30.0
hooks:
- id: check-github-workflows
- id: check-readthedocs
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.19.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]
Expand All @@ -23,19 +23,19 @@ repos:
- id: black
name: "Autoformat python files"
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.18.0
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: ['black==23.9.1']
additional_dependencies: ['black==24.10.0']
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
name: "Lint python files"
additional_dependencies:
- 'flake8-bugbear==24.8.19'
- 'flake8-comprehensions==3.15.0'
- 'flake8-typing-as-t==0.0.3'
- 'flake8-bugbear==24.12.12'
- 'flake8-comprehensions==3.16.0'
- 'flake8-typing-as-t==1.0.0'
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
Expand All @@ -46,7 +46,7 @@ repos:
hooks:
- id: bad-backticks
- repo: https://github.com/sirosen/slyp
rev: 0.7.1
rev: 0.8.1
hooks:
- id: slyp
- repo: https://github.com/codespell-project/codespell
Expand All @@ -55,7 +55,7 @@ repos:
- id: codespell
args: ["--ignore-regex", "https://[^\\s]*"]
- repo: https://github.com/sirosen/texthooks
rev: 0.6.7
rev: 0.6.8
hooks:
- id: alphabetize-codeowners
- repo: https://github.com/rhysd/actionlint
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/_lazy_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def load(cls, module_name: str, pyi_filename: str) -> _ParsedPYIData:
cls._CACHE[(module_name, pyi_filename)] = cls(module_name, pyi_filename)
return cls._CACHE[(module_name, pyi_filename)]

def __init__(self, module_name: str, pyi_filename: str):
def __init__(self, module_name: str, pyi_filename: str) -> None:
self.module_name = module_name
self.pyi_filename = pyi_filename
self._ast = _parse_pyi_ast(module_name, pyi_filename)
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/_testing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(
self,
*data: RegisteredResponse,
metadata: dict[str, t.Any] | None = None,
):
) -> None:
self.responses = list(data)
self._metadata = metadata
self.parent: ResponseSet | None = None
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/authorizers/access_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AccessTokenAuthorizer(StaticGlobusAuthorizer):
:param access_token: An access token for Globus Auth
"""

def __init__(self, access_token: str):
def __init__(self, access_token: str) -> None:
log.info(
"Setting up an AccessTokenAuthorizer. It will use an "
"auth type of Bearer and cannot handle 401s."
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/authorizers/client_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(
on_refresh: (
None | t.Callable[[globus_sdk.OAuthClientCredentialsResponse], t.Any]
) = None,
):
) -> None:
# values for _get_token_data
self.confidential_client = confidential_client
self.scopes = scopes_to_str(scopes)
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/authorizers/refresh_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(
on_refresh: (
None | t.Callable[[globus_sdk.OAuthRefreshTokenResponse], t.Any]
) = None,
):
) -> None:
log.info(
"Setting up RefreshTokenAuthorizer with auth_client="
f"[instance:{id(auth_client)}]"
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(
authorizer: GlobusAuthorizer | None = None,
app_name: str | None = None,
transport_params: dict[str, t.Any] | None = None,
):
) -> None:
# Determine the client's environment.
if app is not None:
# If we're using a GlobusApp, the client's environment must either match the
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/exc/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class GlobusAPIError(GlobusError):
MESSAGE_FIELDS = ["message", "detail", "title"]
RECOGNIZED_AUTHZ_SCHEMES = ["bearer", "basic", "globus-goauthtoken"]

def __init__(self, r: requests.Response, *args: t.Any, **kwargs: t.Any):
def __init__(self, r: requests.Response, *args: t.Any, **kwargs: t.Any) -> None:
self._cached_raw_json: t.Any = _CACHE_SENTINEL

self.http_status = r.status_code
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/exc/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NetworkError(GlobusError):
to explain potentially confusing or inconsistent exceptions passed to us
"""

def __init__(self, msg: str, exc: Exception, *args: t.Any, **kwargs: t.Any):
def __init__(self, msg: str, exc: Exception, *args: t.Any, **kwargs: t.Any) -> None:
super().__init__(msg)
self.underlying_exception = exc

Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/exc/err_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class AuthorizationParameterInfo(ErrorInfo):
>>> print("got authz params:", authz_params)
"""

def __init__(self, error_data: dict[str, t.Any]):
def __init__(self, error_data: dict[str, t.Any]) -> None:
# data is there if this key is present and it is a dict
self._has_data = isinstance(error_data.get("authorization_parameters"), dict)
data = t.cast(
Expand Down
4 changes: 2 additions & 2 deletions src/globus_sdk/gare/_auth_requirements_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(
required_scopes: list[str] | None = None,
prompt: str | None = None,
extra: dict[str, t.Any] | None = None,
):
) -> None:
self.session_message = validators.opt_str("session_message", session_message)
self.session_required_identities = validators.opt_str_list(
"session_required_identities", session_required_identities
Expand Down Expand Up @@ -103,7 +103,7 @@ def __init__(
authorization_parameters: dict[str, t.Any] | GlobusAuthorizationParameters,
*,
extra: dict[str, t.Any] | None = None,
):
) -> None:
self.code = validators.str_("code", code)
self.authorization_parameters = validators.instance_or_dict(
"authorization_parameters",
Expand Down
8 changes: 4 additions & 4 deletions src/globus_sdk/gare/_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(
code: Literal["ConsentRequired"],
required_scopes: list[str],
extra: dict[str, t.Any] | None = None,
):
) -> None:
self.code = _validate_consent_required_literal("code", code)
self.required_scopes = validators.str_list("required_scopes", required_scopes)
self.extra = extra or {}
Expand Down Expand Up @@ -71,7 +71,7 @@ def __init__(
code: Literal["ConsentRequired"],
required_scope: str,
extra: dict[str, t.Any] | None,
):
) -> None:
self.code = _validate_consent_required_literal("code", code)
self.required_scope = validators.str_("required_scope", required_scope)
self.extra = extra or {}
Expand Down Expand Up @@ -112,7 +112,7 @@ def __init__(
session_required_mfa: bool | None = None,
prompt: Literal["login"] | None = None,
extra: dict[str, t.Any] | None = None,
):
) -> None:
self.session_message = validators.opt_str("session_message", session_message)
self.session_required_identities = validators.opt_str_list(
"session_required_identities", session_required_identities
Expand Down Expand Up @@ -167,7 +167,7 @@ def __init__(
authorization_parameters: dict[str, t.Any] | LegacyAuthorizationParameters,
code: str | None = None,
extra: dict[str, t.Any] | None = None,
):
) -> None:
# Apply default, if necessary
self.code = validators.str_("code", code or self.DEFAULT_CODE)
self.authorization_parameters = validators.instance_or_dict(
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/globus_app/authorizer_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def __init__(
token_storage: ValidatingTokenStorage,
confidential_client: globus_sdk.ConfidentialAppAuthClient,
scope_requirements: dict[str, list[globus_sdk.Scope]],
):
) -> None:
"""
:param token_storage: The ``ValidatingTokenStorage`` used
for defining and validating the set of authorization requirements that
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/paging/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(
# the Base paginator must accept arbitrary additional kwargs to indicate that
# its child classes could define and use additional kwargs
**kwargs: t.Any,
):
) -> None:
self.method = method
self.items_key = items_key
self.client_args = client_args
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/paging/last_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(
items_key: str | None = None,
client_args: tuple[t.Any, ...],
client_kwargs: dict[str, t.Any],
):
) -> None:
super().__init__(
method,
items_key=items_key,
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/paging/limit_offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(
page_size: int,
client_args: tuple[t.Any, ...],
client_kwargs: dict[str, t.Any],
):
) -> None:
super().__init__(
method,
items_key=items_key,
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/paging/marker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
marker_key: str = "marker",
client_args: tuple[t.Any, ...],
client_kwargs: dict[str, t.Any],
):
) -> None:
super().__init__(
method,
items_key=items_key,
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/paging/next_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
items_key: str | None = None,
client_args: tuple[t.Any, ...],
client_kwargs: dict[str, t.Any],
):
) -> None:
super().__init__(
method,
items_key=items_key,
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/paging/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PaginatorTable:
Creation of ``PaginatorTable`` objects is considered a private API.
"""

def __init__(self, client: t.Any):
def __init__(self, client: t.Any) -> None:
self._client = client
# _bindings is a lazily loaded table of names -> callables which
# return paginators
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(
self,
response: Response | GlobusHTTPResponse,
client: globus_sdk.BaseClient | None = None,
):
) -> None:
# init on a GlobusHTTPResponse: we are wrapping this data
# the _response is None
if isinstance(response, GlobusHTTPResponse):
Expand Down
4 changes: 2 additions & 2 deletions src/globus_sdk/scopes/consents/_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
class ConsentParseError(Exception):
"""An error raised if consent parsing/loading fails."""

def __init__(self, message: str, raw_consent: dict[str, t.Any]):
def __init__(self, message: str, raw_consent: dict[str, t.Any]) -> None:
super().__init__(message)
self.raw_consent = raw_consent


class ConsentTreeConstructionError(Exception):
"""An error raised if consent tree construction fails."""

def __init__(self, message: str, consents: list[Consent]):
def __init__(self, message: str, consents: list[Consent]) -> None:
super().__init__(message)
self.consents = consents
4 changes: 2 additions & 2 deletions src/globus_sdk/scopes/consents/_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class ConsentForest:
[Scope: <collection2>:data_access]
"""

def __init__(self, consents: t.Iterable[t.Mapping[str, t.Any] | Consent]):
def __init__(self, consents: t.Iterable[t.Mapping[str, t.Any] | Consent]) -> None:
"""
:param consents: An iterable of consent data objects. Typically, this will be
a ConsentForestResponse retrieved via `auth_client.get_consents(identity)`.
Expand Down Expand Up @@ -225,7 +225,7 @@ class ConsentTree:
consent dependencies.
"""

def __init__(self, root_id: int, forest: ConsentForest):
def __init__(self, root_id: int, forest: ConsentForest) -> None:
self.root = forest.get_node(root_id)
self.nodes = [self.root]
self._node_by_id = {root_id: self.root}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
requested_scopes: ScopeCollectionType | None = None,
state: str = "_default",
refresh_tokens: bool = False,
):
) -> None:
# convert a scope object or iterable to string immediately on load
# and default to the default requested scopes
self.requested_scopes: str = stringify_requested_scopes(requested_scopes)
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/services/auth/flow_managers/native_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(
verifier: str | None = None,
refresh_tokens: bool = False,
prefill_named_grant: str | None = None,
):
) -> None:
self.auth_client = auth_client

# set client_id, then check for validity
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/services/auth/identity_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(
*,
id_batch_size: int | None = None,
cache: None | t.MutableMapping[str, dict[str, t.Any]] = None,
):
) -> None:
self.auth_client = auth_client
self.id_batch_size = id_batch_size or self._default_id_batch_size

Expand Down
4 changes: 2 additions & 2 deletions src/globus_sdk/services/compute/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
*,
python_version: str | MissingType = MISSING,
sdk_version: str | MissingType = MISSING,
):
) -> None:
warn_deprecated("ComputeFunctionMetadata is deprecated.")
super().__init__()
self["python_version"] = python_version
Expand Down Expand Up @@ -55,7 +55,7 @@ def __init__(
metadata: ComputeFunctionMetadata | MissingType = MISSING,
group: UUIDLike | MissingType = MISSING,
public: bool = False,
):
) -> None:
warn_deprecated("ComputeFunctionDocument is deprecated.")
super().__init__()
self["function_name"] = function_name
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/services/flows/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ def __init__(
authorizer: GlobusAuthorizer | None = None,
app_name: str | None = None,
transport_params: dict[str, t.Any] | None = None,
):
) -> None:
self._flow_id = flow_id
self.scopes = SpecificFlowScopeBuilder(flow_id)
super().__init__(
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/services/gcs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
authorizer: GlobusAuthorizer | None = None,
app_name: str | None = None,
transport_params: dict[str, t.Any] | None = None,
):
) -> None:
# check if the provided address was a DNS name or an HTTPS URL
if not gcs_address.startswith("https://"):
# if it's a DNS name format it accordingly
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/services/gcs/data/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def __init__(
gridftp_control_channel_port: int | None | MissingType = MISSING,
# additional fields
additional_fields: dict[str, t.Any] | MissingType = MISSING,
):
) -> None:
super().__init__()
self["DATA_TYPE"] = data_type
self["contact_email"] = contact_email
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/services/gcs/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(
self,
response: GlobusHTTPResponse,
match: str | t.Callable[[dict[str, t.Any]], bool],
):
) -> None:
super().__init__(response)

if callable(match):
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/services/groups/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def __init__(
authentication_assurance_timeout: (
int | None | utils.MissingType
) = utils.MISSING,
):
) -> None:
super().__init__()
self["is_high_assurance"] = is_high_assurance
self["group_visibility"] = group_visibility
Expand Down
Loading

0 comments on commit 813dfc4

Please sign in to comment.