Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tighten the mypy belt once more #908

Merged
merged 1 commit into from
Dec 7, 2023
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
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ disallow_untyped_defs = false
[mypy-globus_cli.services.transfer.client]
disallow_untyped_defs = false

[mypy-globus_cli.services.transfer.data]
disallow_untyped_defs = false

[mypy-globus_cli.services.transfer.delegate_proxy]
disallow_untyped_defs = false

Expand Down
23 changes: 10 additions & 13 deletions src/globus_cli/services/transfer/data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import typing as t
import uuid

import click
import globus_sdk
Expand All @@ -24,7 +23,12 @@ def add_batch_to_transfer_data(
@click.argument("source_path", type=TaskPath(base_dir=source_base_path))
@click.argument("dest_path", type=TaskPath(base_dir=dest_base_path))
@mutex_option_group("--recursive", "--external-checksum")
def process_batch_line(dest_path, source_path, recursive, external_checksum):
def process_batch_line(
dest_path: TaskPath,
source_path: TaskPath,
recursive: bool | None,
external_checksum: str | None,
) -> None:
"""
Parse a line of batch input and turn it into a transfer submission
item.
Expand All @@ -44,8 +48,8 @@ def display_name_or_cname(ep_doc: dict | globus_sdk.GlobusHTTPResponse) -> str:
return t.cast(str, ep_doc["display_name"] or ep_doc["canonical_name"])


def iterable_response_to_dict(iterator):
output_dict = {"DATA": []}
def iterable_response_to_dict(iterator: t.Iterable[t.Any]) -> dict[str, list[t.Any]]:
output_dict: dict[str, list[t.Any]] = {"DATA": []}
for item in iterator:
dat = item
try:
Expand All @@ -56,12 +60,5 @@ def iterable_response_to_dict(iterator):
return output_dict


def assemble_generic_doc(datatype, **kwargs):
doc = {"DATA_TYPE": datatype}
for key, val in kwargs.items():
if isinstance(val, uuid.UUID):
val = str(val)

if val is not None:
doc[key] = ExplicitNullType.nullify(val)
return doc
def assemble_generic_doc(datatype: str, **kwargs: t.Any) -> dict[str, t.Any]:
return ExplicitNullType.nullify_dict({"DATA_TYPE": datatype, **kwargs})
Loading