Skip to content

Strict type checking and re-enable mypy#16

Open
Avasam wants to merge 1 commit intojaraco:mainfrom
Avasam:Strict-type-checking-and-re-enable-mypy
Open

Strict type checking and re-enable mypy#16
Avasam wants to merge 1 commit intojaraco:mainfrom
Avasam:Strict-type-checking-and-re-enable-mypy

Conversation

@Avasam
Copy link
Contributor

@Avasam Avasam commented Feb 8, 2025

Closes #15

Ref: jaraco/skeleton#143

Comment on lines +158 to +162
# reversed makes cmgrs no longer variadic, breaking type validation
# Mypy infers compose_two as Callable[[function, function], function]. See:
# - https://github.com/python/typeshed/issues/7580
# - https://github.com/python/mypy/issues/8240
return functools.reduce(compose_two, reversed(cmgrs)) # type: ignore[return-value, arg-type]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# Disable due to many false positives
overload-overlap,

# jaraco/backports.tarfile#1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mypy-backports.*]
follow_untyped_imports = True

# jaraco/portend#17
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Avasam Avasam force-pushed the Strict-type-checking-and-re-enable-mypy branch 5 times, most recently from 2c189f1 to 3206ddc Compare February 8, 2025 21:38
Comment on lines -303 to 312

def __exit__(self, *exc_info):
type = exc_info[0]
matches = type and issubclass(type, self.exceptions)
def __exit__(
self,
*exc_info: Unpack[_UnpackableOptExcInfo], # noqa: PYI036 # We can do better than object
) -> builtins.type[BaseException] | None | bool:
exc_type = exc_info[0]
matches = exc_type and issubclass(exc_type, self.exceptions)
if matches:
self.exc_info = exc_info
self.exc_info = exc_info # type: ignore[assignment]
return matches
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively:

    def __exit__(
        self,
        exc_type: builtins.type[BaseException] | None,
        exc: BaseException | None,
        exc_tb: TracebackType | None,
    ) -> builtins.type[BaseException] | None | bool:
        matches = exc_type and issubclass(exc_type, self.exceptions)
        if matches:
            self.exc_info = (exc_type, exc, exc_tb)  # type: ignore[assignment]
        return matches

@jaraco
Copy link
Owner

jaraco commented Dec 24, 2025

Looks like we addressed #11 and #17 in other PRs. @Avasam would you consider rebasing or otherwise resolving the conflicts (for the fixes for #15)?

@Avasam Avasam force-pushed the Strict-type-checking-and-re-enable-mypy branch from fa436ae to 208d1e5 Compare December 24, 2025 19:53
@Avasam
Copy link
Contributor Author

Avasam commented Dec 24, 2025

Rebased to a single commit and I resolved comments that no longer apply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lack of parameter annotations makes mypy consider functions as untyped

2 participants

Comments