diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 849f42c..aebaa99 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,20 +1,20 @@ repos: - repo: https://github.com/ambv/black - rev: 23.7.0 + rev: 23.12.1 hooks: - id: black language_version: python3 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.8.0 hooks: - id: mypy - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.0.277' + rev: 'v0.1.13' hooks: - id: ruff args: [--fix] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-toml - id: check-yaml diff --git a/roles/role.py b/roles/role.py index 9330d12..2b01f2c 100644 --- a/roles/role.py +++ b/roles/role.py @@ -329,7 +329,7 @@ def assign( # First role class rolebases = (cls, self) - rolecls = self.newclass(cls, rolebases) + rolecls: type = self.newclass(cls, rolebases) return method(rolecls, subj) @@ -350,7 +350,7 @@ def revoke(self, subj: R, method: Callable[[Type[T], R], T] = instance) -> T: __call__ = assign # type: ignore[assignment] @contextmanager - def played_by(self, subj: T) -> Iterator[Union[T, R]]: + def played_by(self, subj: T) -> Iterator[T]: """Shorthand for using roles in with statements. >>> class Biker(metaclass=RoleType): @@ -363,9 +363,9 @@ def played_by(self, subj: T) -> Iterator[Union[T, R]]: 'bike, bike' """ if isinstance(subj, self): - yield subj # type: ignore[misc] + yield subj else: - newsubj: Union[T, R] = self.assign(subj) + newsubj: T = self.assign(subj) try: yield newsubj finally: