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

Updated mypy finds new typing improvement opportunities #484

Open
hacklschorsch opened this issue Nov 7, 2024 · 0 comments
Open

Updated mypy finds new typing improvement opportunities #484

hacklschorsch opened this issue Nov 7, 2024 · 0 comments

Comments

@hacklschorsch
Copy link
Member

After updating Python and MyPy the CI reports typing errors where it did not before:

https://app.circleci.com/pipelines/github/PrivateStorageio/ZKAPAuthorizer/1984/workflows/b4211e58-9f2b-4a73-9561-34cb5422c7e3/jobs/9919

src/_zkapauthorizer/_types.py:48:37: error: Missing type parameters for generic
type "Sequence"  [type-arg]
    JSON = Union[None, int, float, str, Sequence, Mapping]
                                        ^
src/_zkapauthorizer/_types.py:48:47: error: Missing type parameters for generic
type "Mapping"  [type-arg]
    JSON = Union[None, int, float, str, Sequence, Mapping]
                                                  ^
src/_zkapauthorizer/validators.py:159:16: error: Function
"Callable[[object, Attribute[bytes], bytes], None]" could always be true in
boolean context  [truthy-function]
            if not is_base64_encoded(urlsafe_b64decode):
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/config.py:85: error: Unused "type: ignore" comment 
[unused-ignore]
        _basedir: FilePath = FilePath(".")  # type: ignore[no-untyped-call...
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/config.py:85:15: error: Missing type parameters for generic
type "FilePath"  [type-arg]
        _basedir: FilePath = FilePath(".")  # type: ignore[no-untyped-call...
                  ^
src/_zkapauthorizer/config.py:85:15: note: Error code "type-arg" not covered by "type: ignore" comment
src/_zkapauthorizer/config.py:97: error: Unused "type: ignore" comment 
[unused-ignore]
            private = self._basedir.child("private")  # type: ignore[no-un...
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/config.py:99:21: error: Redundant cast to "str" 
[redundant-cast]
            child_str = cast(str, child.path)
                        ^
src/_zkapauthorizer/config.py:111: error: Unused "type: ignore" comment 
[unused-ignore]
            FilePath(config.get_config_path("node.url"))  # type: ignore[n...
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/tests/issuer.py:39:23: error: Missing type parameters for
generic type "FilePath"  [type-arg]
        signing_key_path: FilePath
                          ^
src/_zkapauthorizer/tests/issuer.py:189:56: error: Missing type parameters for
generic type "FilePath"  [type-arg]
    ...un_issuer(reactor: IReactorTCP, signing_key_path: FilePath) -> Issuer:
                                                         ^
src/_zkapauthorizer/tahoe.py:240:14: error: Missing type parameters for generic
type "FilePath"  [type-arg]
        outpath: FilePath,
                 ^
src/_zkapauthorizer/tahoe.py:264: error: Unused "type: ignore" comment 
[unused-ignore]
        outtemp = outpath.temporarySibling()  # type: ignore[no-untyped-ca...
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tahoe.py:445:40: error: Missing type parameters for generic
type "FilePath"  [type-arg]
        def get_private_path(name: str) -> FilePath:
                                           ^
src/_zkapauthorizer/tahoe.py:451:18: error: Missing type parameters for generic
type "FilePath"  [type-arg]
            outpath: FilePath,
                     ^
src/_zkapauthorizer/tahoe.py:531:46: error: Missing type parameters for generic
type "FilePath"  [type-arg]
        def get_private_path(self, name: str) -> FilePath:
                                                 ^
src/_zkapauthorizer/tahoe.py:535: error: Unused "type: ignore" comment 
[unused-ignore]
            return FilePath(self._node_config.get_private_path(name))  # t...
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/tahoe.py:537:39: error: Missing type parameters for generic
type "FilePath"  [type-arg]
        async def download(self, outpath: FilePath, cap: ReadCapability) -...
                                          ^
src/_zkapauthorizer/tahoe.py:596:27: error: Missing type parameters for generic
type "FilePath"  [type-arg]
            basedir: Optional[FilePath] = None,
                              ^
src/_zkapauthorizer/tahoe.py:604: error: Unused "type: ignore" comment 
[unused-ignore]
                basedir = FilePath(mkdtemp(suffix=".memory-tahoe"))  # typ...
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/tahoe.py:726:15: error: Missing type parameters for generic
type "FilePath"  [type-arg]
        _nodedir: FilePath
                  ^
src/_zkapauthorizer/tahoe.py:730: error: Unused "type: ignore" comment 
[unused-ignore]
            self._nodedir.child("private").makedirs(ignoreExistingDirector...
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/tahoe.py:738:46: error: Missing type parameters for generic
type "FilePath"  [type-arg]
        def get_private_path(self, name: str) -> FilePath:
                                                 ^
src/_zkapauthorizer/tahoe.py:743: error: Unused "type: ignore" comment 
[unused-ignore]
            return cast(FilePath, self._nodedir.child("private").child(nam...
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/tahoe.py:743:16: error: Redundant cast to "FilePath[Any]" 
[redundant-cast]
            return cast(FilePath, self._nodedir.child("private").child(nam...
                   ^
src/_zkapauthorizer/tahoe.py:743:16: note: Error code "redundant-cast" not covered by "type: ignore" comment
src/_zkapauthorizer/tahoe.py:743:21: error: Missing type parameters for generic
type "FilePath"  [type-arg]
            return cast(FilePath, self._nodedir.child("private").child(nam...
                        ^
src/_zkapauthorizer/tahoe.py:743:21: note: Error code "type-arg" not covered by "type: ignore" comment
src/_zkapauthorizer/tahoe.py:745:39: error: Missing type parameters for generic
type "FilePath"  [type-arg]
        async def download(self, outpath: FilePath, cap: ReadCapability) -...
                                          ^
src/_zkapauthorizer/tahoe.py:748: error: Unused "type: ignore" comment 
[unused-ignore]
            outpath.setContent(data)  # type: ignore[no-untyped-call]
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tahoe.py:784:14: error: Missing type parameters for generic
type "FilePath"  [type-arg]
        outpath: FilePath,
                 ^
src/_zkapauthorizer/private.py:96: error: Argument 1 of "PrivateRealm" is
incompatible with "requestAvatar" of supertype "IRealm"; supertype defines the
argument type as "bytes | tuple[()]"  [override]
        def requestAvatar(
        ^~~~~~~~~~~~~~~~~
src/_zkapauthorizer/private.py:96: note: This violates the Liskov substitution principle
src/_zkapauthorizer/private.py:96: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
src/_zkapauthorizer/private.py:96: error: Return type
"tuple[InterfaceClass, IResource, Callable[[], None]]" of "PrivateRealm"
incompatible with return type
"Deferred[tuple[type[Interface], object, Callable[[], None]]] | tuple[type[Interface], object, Callable[[], None]]"
in "requestAvatar" of supertype "IRealm"  [override]
        def requestAvatar(
        ^~~~~~~~~~~~~~~~~
src/_zkapauthorizer/private.py:111: error: Unused "type: ignore" comment 
[unused-ignore]
        portal = Portal(realm, [checker])  # type: ignore[no-untyped-call]
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/private.py:111:29: error: List item 0 has incompatible type
"TokenChecker"; expected "ICredentialsChecker"  [list-item]
        portal = Portal(realm, [checker])  # type: ignore[no-untyped-call]
                                ^~~~~~~
src/_zkapauthorizer/private.py:111:29: note: Error code "list-item" not covered by "type: ignore" comment
src/_zkapauthorizer/replicate.py:307: error: Unused "type: ignore" comment 
[unused-ignore]
            if config_path.exists():  # type: ignore[no-untyped-call]
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/replicate.py:309: error: Unused "type: ignore" comment 
[unused-ignore]
                    config_path.getContent().decode("ascii")  # type: igno...
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/replicate.py:318: error: Unused "type: ignore" comment 
[unused-ignore]
            config_path.setContent(rw_str.encode("ascii"))  # type: ignore...
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/replicate.py:335: error: Unused "type: ignore" comment 
[unused-ignore]
        if FilePath(config.get_private_path(REPLICA_RWCAP_BASENAME)).exist...
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/replicate.py:345: error: Unused "type: ignore" comment 
[unused-ignore]
        rwcap_file = FilePath(config.get_private_path(REPLICA_RWCAP_BASENA...
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/replicate.py:346: error: Unused "type: ignore" comment 
[unused-ignore]
        rwcap_bytes: bytes = rwcap_file.getContent()  # type: ignore[no-un...
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/replicate.py:545:48: error: Argument 1 to "append" of
"list" has incompatible type
"tuple[bool, str, Iterable[SupportsLenAndGetItem[str | Buffer | int | float | None | Any] | Mapping[str, str | Buffer | int | float | None | Any]]]";
expected
"tuple[bool, str, Iterable[tuple[int | float | str | bytes | datetime | None, ...]]]"
 [arg-type]
                self._connection._mutations.append((self._important, state...
                                                   ^~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/model.py:266:30: error: Missing type parameters for generic
type "FilePath"  [type-arg]
    def path_to_memory_uri(path: FilePath) -> str:
                                 ^
src/_zkapauthorizer/model.py:288: error: Unused "type: ignore" comment 
[unused-ignore]
                path=path.asTextMode().path.split(os.sep),  # type: ignore...
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/model.py:305: error: Unused "type: ignore" comment 
[unused-ignore]
        pseudo_path: FilePath = FilePath(path)  # type: ignore[no-untyped-...
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/model.py:305:18: error: Missing type parameters for generic
type "FilePath"  [type-arg]
        pseudo_path: FilePath = FilePath(path)  # type: ignore[no-untyped-...
                     ^
src/_zkapauthorizer/model.py:305:18: note: Error code "type-arg" not covered by "type: ignore" comment
src/_zkapauthorizer/model.py:1259:31: error: Invalid index type "int" for
"SupportsLenAndGetItem[str | Buffer | int | float | None | Any] | Mapping[str, str | Buffer | int | float | None | Any]";
expected type "str"  [index]
                    counter = row[3]
                                  ^
src/_zkapauthorizer/model.py:1263:32: error: Invalid index type "int" for
"SupportsLenAndGetItem[str | Buffer | int | float | None | Any] | Mapping[str, str | Buffer | int | float | None | Any]";
expected type "str"  [index]
                    finished = row[0]
                                   ^
src/_zkapauthorizer/model.py:1269:35: error: Invalid index type "int" for
"SupportsLenAndGetItem[str | Buffer | int | float | None | Any] | Mapping[str, str | Buffer | int | float | None | Any]";
expected type "str"  [index]
                    token_count = row[1]
                                      ^
src/_zkapauthorizer/model.py:1272:40: error: Invalid index type "int" for
"SupportsLenAndGetItem[str | Buffer | int | float | None | Any] | Mapping[str, str | Buffer | int | float | None | Any]";
expected type "str"  [index]
                        parse_datetime(row[0], delimiter=" "),
                                           ^
src/_zkapauthorizer/model.py:1277:51: error: Invalid index type "slice" for
"SupportsLenAndGetItem[str | Buffer | int | float | None | Any] | Mapping[str, str | Buffer | int | float | None | Any]";
expected type "int"  [index]
            number, created, expected_tokens, state = row[:4]
                                                      ^
src/_zkapauthorizer/model.py:1277:51: error: Invalid index type "slice" for
"SupportsLenAndGetItem[str | Buffer | int | float | None | Any] | Mapping[str, str | Buffer | int | float | None | Any]";
expected type "str"  [index]
            number, created, expected_tokens, state = row[:4]
                                                      ^
src/_zkapauthorizer/model.py:1277:51: error: Unpacking a string is disallowed 
[misc]
            number, created, expected_tokens, state = row[:4]
                                                      ^~~~~~~
src/_zkapauthorizer/model.py:1277:51: error: "Buffer" object is not iterable 
[misc]
            number, created, expected_tokens, state = row[:4]
                                                      ^~~~~~~
src/_zkapauthorizer/model.py:1277:51: error: "int" object is not iterable 
[misc]
            number, created, expected_tokens, state = row[:4]
                                                      ^~~~~~~
src/_zkapauthorizer/model.py:1277:51: error: "float" object is not iterable 
[misc]
            number, created, expected_tokens, state = row[:4]
                                                      ^~~~~~~
src/_zkapauthorizer/model.py:1277:51: error: "None" object is not iterable 
[misc]
            number, created, expected_tokens, state = row[:4]
                                                      ^~~~~~~
src/_zkapauthorizer/model.py:1292:41: error: Invalid index type "slice" for
"SupportsLenAndGetItem[str | Buffer | int | float | None | Any] | Mapping[str, str | Buffer | int | float | None | Any]";
expected type "int"  [index]
                state=state_from_row(state, row[4:]),
                                            ^
src/_zkapauthorizer/model.py:1292:41: error: Invalid index type "slice" for
"SupportsLenAndGetItem[str | Buffer | int | float | None | Any] | Mapping[str, str | Buffer | int | float | None | Any]";
expected type "str"  [index]
                state=state_from_row(state, row[4:]),
                                            ^
src/_zkapauthorizer/model.py:1292:41: error: Argument 2 to "state_from_row" has
incompatible type "str | Buffer | int | float | Any | None"; expected
"SupportsLenAndGetItem[str | Buffer | int | float | None | Any] | Mapping[str, str | Buffer | int | float | None | Any]"
 [arg-type]
                state=state_from_row(state, row[4:]),
                                            ^~~~~~~
src/_zkapauthorizer/tests/common.py:141:17: error: Argument 1 to "partial" has
incompatible type
"Callable[[_I, InterfaceClass, str, str], Callable[_P, _B] | _DelayedMethodDescriptor[_I, _B, _P]]";
expected
"Callable[..., Callable[[VarArg(Never), KwArg(Never)], Never] | _DelayedMethodDescriptor[_I, Never, Never]]"
 [arg-type]
            partial(controller._descriptorFactory, obj),
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/lease_maintenance.py:396:20: error: Missing type parameters
for generic type "FilePath"  [type-arg]
        last_run_path: FilePath,
                       ^
src/_zkapauthorizer/lease_maintenance.py:599:30: error: Missing type parameters
for generic type "FilePath"  [type-arg]
    def write_time_to_path(path: FilePath, when: datetime) -> None:
                                 ^
src/_zkapauthorizer/lease_maintenance.py:607: error: Unused "type: ignore"
comment  [unused-ignore]
        path.setContent(when.isoformat().encode("utf-8"))  # type: ignore[...
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/lease_maintenance.py:610:31: error: Missing type parameters
for generic type "FilePath"  [type-arg]
    def read_time_from_path(path: FilePath) -> Optional[datetime]:
                                  ^
src/_zkapauthorizer/lease_maintenance.py:620: error: Unused "type: ignore"
comment  [unused-ignore]
            when = path.getContent()  # type: ignore[no-untyped-call]
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/strategies.py:284:34: error: Argument
"blacklist_categories" to "characters" has incompatible type "tuple[str, str]";
expected
"Collection[Literal['L', 'Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'M', 'Mn', 'Mc', 'Me', 'N', 'Nd', 'Nl', 'No', 'P', 'Pc', 'Pd', 'Ps', 'Pe', 'Pi', 'Pf', 'Po', 'S', 'Sm', 'Sc', 'Sk', 'So', 'Z', 'Zs', 'Zl', 'Zp', 'C', 'Cc', 'Cf', 'Cs', 'Co', 'Cn']] | None"
 [arg-type]
                blacklist_categories=(
                                     ^
src/_zkapauthorizer/tests/strategies.py:316:45: error: Missing type parameters
for generic type "FilePath"  [type-arg]
    def server_configurations(signing_key_path: FilePath) -> SearchStrateg...
                                                ^
src/_zkapauthorizer/tests/strategies.py:379: error: Unused "type: ignore"
comment, use narrower [typeddict-unknown-key] instead of [typeddict-item] code 
[unused-ignore]
                config["allowed-public-keys"] = ",".join(allowed_public_ke...
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/tests/strategies.py:1103:16: error: Need type annotation
for "children"  [var-annotated]
        children = dictionaries(
                   ^
src/_zkapauthorizer/tests/strategies.py:1302:34: error: Argument
"blacklist_categories" to "characters" has incompatible type "tuple[str, str]";
expected
"Collection[Literal['L', 'Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'M', 'Mn', 'Mc', 'Me', 'N', 'Nd', 'Nl', 'No', 'P', 'Pc', 'Pd', 'Ps', 'Pe', 'Pi', 'Pf', 'Po', 'S', 'Sm', 'Sc', 'Sk', 'So', 'Z', 'Zs', 'Zl', 'Zp', 'C', 'Cc', 'Cf', 'Cs', 'Co', 'Cn']] | None"
 [arg-type]
                blacklist_categories=("Cs", "Lu"),
                                     ^~~~~~~~~~~~
src/_zkapauthorizer/_storage_server.py:1005:6: error: Missing type parameters
for generic type "FilePath"  [type-arg]
    ) -> FilePath:
         ^
src/_zkapauthorizer/_storage_server.py:1010: error: Unused "type: ignore"
comment  [unused-ignore]
            FilePath(storage_server.sharedir)  # type: ignore[no-untyped-c...
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/storage_common.py:91:16: error: Missing type
parameters for generic type "FilePath"  [type-arg]
        sharepath: FilePath, version: int, size: int, leases: list[bytes],...
                   ^
src/_zkapauthorizer/tests/storage_common.py:112:25: error: Argument 1 to "open"
of "FilePath" has incompatible type "Literal['wb']"; expected
"Literal['r', 'w', 'a', 'r+', 'w+', 'a+']"  [arg-type]
        with sharepath.open("wb") as share:
                            ^~~~
src/_zkapauthorizer/tests/resources.py:43:31: error: Missing type parameters
for generic type "FilePath"  [type-arg]
    def eliottree_from_file(path: FilePath) -> Content:
                                  ^
src/_zkapauthorizer/tests/resources.py:79:64: error: Missing type parameters
for generic type "FilePath"  [type-arg]
    ...  def make(self, dependency_resources: dict[str, object]) -> FilePath:
                                                                    ^
src/_zkapauthorizer/tests/resources.py:89:21: error: Missing type parameters
for generic type "FilePath"  [type-arg]
    def read_text(path: FilePath) -> str:
                        ^
src/_zkapauthorizer/tests/resources.py:98:25: error: Missing type parameters
for generic type "FilePath"  [type-arg]
    def wait_for_path(path: FilePath, retry: Iterable[float] = RETRY_DELAY...
                            ^
src/_zkapauthorizer/tests/resources.py:118:34: error: Missing type parameters
for generic type "FilePath"  [type-arg]
    def setup_exit_trigger(node_dir: FilePath) -> None:
                                     ^
src/_zkapauthorizer/tests/resources.py:146:15: error: Missing type parameters
for generic type "FilePath"  [type-arg]
        node_dir: FilePath
                  ^
src/_zkapauthorizer/tests/resources.py:160:33: error: Missing type parameters
for generic type "FilePath"  [type-arg]
        def eliot_log_path(self) -> FilePath:
                                    ^
src/_zkapauthorizer/tests/resources.py:164: error: Unused "type: ignore"
comment  [unused-ignore]
            return self.node_dir.child("log.eliot")  # type: ignore[no-any...
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/tests/resources.py:223:5: error: Missing return statement 
[empty-body]
        def create_unsafely(self) -> str:
        ^
src/_zkapauthorizer/tests/resources.py:255:55: error: Argument 1 to "open" of
"FilePath" has incompatible type "Literal['wb']"; expected
"Literal['r', 'w', 'a', 'r+', 'w+', 'a+']"  [arg-type]
                stdout=self.node_dir.child("stdout").open("wb"),
                                                          ^~~~
src/_zkapauthorizer/tests/resources.py:256:55: error: Argument 1 to "open" of
"FilePath" has incompatible type "Literal['wb']"; expected
"Literal['r', 'w', 'a', 'r+', 'w+', 'a+']"  [arg-type]
                stderr=self.node_dir.child("stderr").open("wb"),
                                                          ^~~~
src/_zkapauthorizer/tests/resources.py:277:71: error: Missing type parameters
for generic type "FilePath"  [type-arg]
    ...et_share_path(self, cap: VerifyCapability, sharenum: int) -> FilePath:
                                                                    ^
src/_zkapauthorizer/tests/resources.py:286: error: Unused "type: ignore"
comment  [unused-ignore]
            return (  # type: ignore[no-any-return]
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/resources.py:292:44: error: Missing type parameters
for generic type "FilePath"  [type-arg]
        def get_corruption_advisories(self) -> FilePath:
                                               ^
src/_zkapauthorizer/tests/resources.py:297: error: Unused "type: ignore"
comment  [unused-ignore]
            return self.node_dir.descendant(("storage", "corruption-adviso...
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/tests/resources.py:516:17: error: Missing type parameters
for generic type "FilePath"  [type-arg]
        issuer_dir: FilePath
                    ^
src/_zkapauthorizer/_plugin.py:208: error: Unused "type: ignore" comment 
[unused-ignore]
                db_path = FilePath(node_config.get_private_path(CONFIG_DB_...
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/_plugin.py:259: error: Unused "type: ignore" comment 
[unused-ignore]
                metrics_path = FilePath(metrics_pathname)  # type: ignore[...
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/_plugin.py:260: error: Unused "type: ignore" comment 
[unused-ignore]
                metrics_path.parent().makedirs(ignoreExistingDirectory=Tru...
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/_plugin.py:267: error: Unused "type: ignore" comment 
[unused-ignore]
            key_path = FilePath(configuration["ristretto-signing-key-path"...
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/_plugin.py:466: error: Unused "type: ignore" comment 
[unused-ignore]
        last_run_path = FilePath(node_config.get_private_path("last-lease-...
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/_plugin.py:506:28: error: Missing type parameters for
generic type "FilePath"  [type-arg]
    def load_signing_key(path: FilePath) -> SigningKey:
                               ^
src/_zkapauthorizer/_plugin.py:522: error: Unused "type: ignore" comment 
[unused-ignore]
        key_bytes = path.getContent()  # type: ignore[no-untyped-call]
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/fixtures.py:59:14: error: Missing type parameters for
generic type "FilePath"  [type-arg]
        tempdir: FilePath = attr.ib(default=None)
                 ^
src/_zkapauthorizer/tests/fixtures.py:105:9: error: Trying to assign name
"tempdir" that is not in "__slots__" of type
"_zkapauthorizer.tests.fixtures.TemporaryVoucherStore"  [misc]
            self.tempdir = self.useFixture(TempDir())
            ^~~~~~~~~~~~
src/_zkapauthorizer/tests/fixtures.py:106:9: error: Trying to assign name
"config" that is not in "__slots__" of type
"_zkapauthorizer.tests.fixtures.TemporaryVoucherStore"  [misc]
            self.config = self.get_config(self.tempdir.join("node"), "tub....
            ^~~~~~~~~~~
src/_zkapauthorizer/tests/fixtures.py:224:17: error: Set comprehension has
incompatible type Set[FilePath[str]]; expected Set[str]  [misc]
                    e.realpath()
                    ^~~~~~~~~~~~
src/_zkapauthorizer/tests/test_model.py:1008:56: error: Argument 1 to
"from_bytes" of "EventStream" has incompatible type "bytes"; expected
"IO[bytes]"  [arg-type]
    ...  self.assertThat(lambda: EventStream.from_bytes(serialized), raises(V...
                                                        ^~~~~~~~~~
src/_zkapauthorizer/tests/foolscap.py:39:23: error: Incompatible default for
argument "argument" (default has type "foolscap.constraint.Any", argument has
type "RIEcho")  [assignment]
        def echo(argument=Any()):  # type: ignore[no-untyped-def]
                          ^~~~~
src/_zkapauthorizer/tests/foolscap.py:39:23: note: Error code "assignment" not covered by "type: ignore" comment
src/_zkapauthorizer/tests/test_storage_protocol.py:306:17: error: Argument 1 to
"callRemote" of "LocalRemote" has incompatible type "str"; expected
"foolscap.constraint.Any"  [arg-type]
                    "allocate_buckets",
                    ^~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_storage_protocol.py:307:17: error: Argument 2 to
"callRemote" of "LocalRemote" has incompatible type "list[bytes]"; expected
"foolscap.constraint.Any"  [arg-type]
                    list(pass_.pass_bytes for pass_ in all_passes),
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_storage_protocol.py:308:17: error: Argument 3 to
"callRemote" of "LocalRemote" has incompatible type "bytes"; expected
"foolscap.constraint.Any"  [arg-type]
                    storage_index,
                    ^~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_storage_protocol.py:309:17: error: Argument 4 to
"callRemote" of "LocalRemote" has incompatible type "bytes"; expected
"foolscap.constraint.Any"  [arg-type]
                    renew_secret,
                    ^~~~~~~~~~~~
src/_zkapauthorizer/tests/test_storage_protocol.py:310:17: error: Argument 5 to
"callRemote" of "LocalRemote" has incompatible type "bytes"; expected
"foolscap.constraint.Any"  [arg-type]
                    cancel_secret,
                    ^~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_storage_protocol.py:311:17: error: Argument 6 to
"callRemote" of "LocalRemote" has incompatible type "set[int]"; expected
"foolscap.constraint.Any"  [arg-type]
                    sharenums,
                    ^~~~~~~~~
src/_zkapauthorizer/tests/test_storage_protocol.py:312:17: error: Argument 7 to
"callRemote" of "LocalRemote" has incompatible type "int"; expected
"foolscap.constraint.Any"  [arg-type]
                    size,
                    ^~~~
src/_zkapauthorizer/tests/test_storage_protocol.py:313:24: error: Argument
"canary" to "callRemote" of "LocalRemote" has incompatible type
"IRemoteReference"; expected "foolscap.constraint.Any"  [arg-type]
                    canary=self.canary,
                           ^~~~~~~~~~~
src/_zkapauthorizer/tests/test_storage_protocol.py:765:29: error: Argument 1 to
"open" of "FilePath" has incompatible type "Literal['wb']"; expected
"Literal['r', 'w', 'a', 'r+', 'w+', 'a+']"  [arg-type]
            with sharepath.open("wb") as fobj:
                                ^~~~
src/_zkapauthorizer/tests/test_plugin.py:150:47: error: Argument 1 to
"LocalRemote" has incompatible type "DummyReferenceable"; expected
"Referenceable"  [arg-type]
        return cast(IRemoteReference, LocalRemote(DummyReferenceable(inter...
                                                  ^~~~~~~~~~~~~~~~~~~~~~~~...
src/_zkapauthorizer/tests/test_plugin.py:998:33: error: Argument 1 to
"setContent" of "FilePath" has incompatible type "str"; expected "bytes" 
[arg-type]
                privpath.setContent(value)
                                    ^~~~~
src/_zkapauthorizer/tests/test_foolscap.py:56:29: error: Incompatible default
for argument "arg" (default has type "foolscap.constraint.Any", argument has
type "IHasSchema")  [assignment]
        def whatever_method(arg=Any()):  # type: ignore[no-untyped-def]
                                ^~~~~
src/_zkapauthorizer/tests/test_foolscap.py:56:29: note: Error code "assignment" not covered by "type: ignore" comment
src/_zkapauthorizer/tests/test_foolscap.py:83:30: error: Argument 1 to
"LocalRemote" has incompatible type "DummyReferenceable"; expected
"Referenceable"  [arg-type]
                just(LocalRemote(DummyReferenceable(RIStub))),
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:108:27: error: Argument 1 to
"LocalRemote" has incompatible type "DummyReferenceable"; expected
"Referenceable"  [arg-type]
            ref = LocalRemote(DummyReferenceable(IHasSchema))
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:110:28: error: Argument 1 to
"callRemote" of "LocalRemote" has incompatible type "str"; expected
"foolscap.constraint.Any"  [arg-type]
                ref.callRemote("method", None),
                               ^~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:110:38: error: Argument 2 to
"callRemote" of "LocalRemote" has incompatible type "None"; expected
"foolscap.constraint.Any"  [arg-type]
                ref.callRemote("method", None),
                                         ^~~~
src/_zkapauthorizer/tests/test_foolscap.py:125:27: error: Argument 1 to
"LocalRemote" has incompatible type "DummyReferenceable"; expected
"Referenceable"  [arg-type]
            ref = LocalRemote(DummyReferenceable(IHasSchema))
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:127:28: error: Argument 1 to
"callRemote" of "LocalRemote" has incompatible type "str"; expected
"foolscap.constraint.Any"  [arg-type]
                ref.callRemote("method", 0),
                               ^~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:127:38: error: Argument 2 to
"callRemote" of "LocalRemote" has incompatible type "int"; expected
"foolscap.constraint.Any"  [arg-type]
                ref.callRemote("method", 0),
                                         ^
src/_zkapauthorizer/tests/test_foolscap.py:142:27: error: Argument 1 to
"LocalRemote" has incompatible type "DummyReferenceable"; expected
"Referenceable"  [arg-type]
            ref = LocalRemote(DummyReferenceable(IHasSchema))
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:144:28: error: Argument 1 to
"callRemote" of "LocalRemote" has incompatible type "str"; expected
"foolscap.constraint.Any"  [arg-type]
                ref.callRemote("good_method", 0),
                               ^~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:144:43: error: Argument 2 to
"callRemote" of "LocalRemote" has incompatible type "int"; expected
"foolscap.constraint.Any"  [arg-type]
                ref.callRemote("good_method", 0),
                                              ^
src/_zkapauthorizer/tests/test_foolscap.py:153:27: error: Argument 1 to
"LocalRemote" has incompatible type "DummyReferenceable"; expected
"Referenceable"  [arg-type]
            ref = LocalRemote(DummyReferenceable(IHasSchema))
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:155:28: error: Argument 1 to
"callRemote" of "LocalRemote" has incompatible type "str"; expected
"foolscap.constraint.Any"  [arg-type]
                ref.callRemote("whatever_method", BrokenCopyable()),
                               ^~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:155:47: error: Argument 2 to
"callRemote" of "LocalRemote" has incompatible type "BrokenCopyable"; expected
"foolscap.constraint.Any"  [arg-type]
                ref.callRemote("whatever_method", BrokenCopyable()),
                                                  ^~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:169:27: error: Argument 1 to
"LocalRemote" has incompatible type "BrokenResultReferenceable"; expected
"Referenceable"  [arg-type]
            ref = LocalRemote(BrokenResultReferenceable(IHasSchema))
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:171:28: error: Argument 1 to
"callRemote" of "LocalRemote" has incompatible type "str"; expected
"foolscap.constraint.Any"  [arg-type]
                ref.callRemote("whatever_method", None),
                               ^~~~~~~~~~~~~~~~~
src/_zkapauthorizer/tests/test_foolscap.py:171:47: error: Argument 2 to
"callRemote" of "LocalRemote" has incompatible type "None"; expected
"foolscap.constraint.Any"  [arg-type]
                ref.callRemote("whatever_method", None),
                                                  ^~~~
Found 129 errors in 21 files (checked 66 source files)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant