Skip to content

Commit

Permalink
Update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
amolenaar committed Jan 16, 2024
1 parent 83fb62f commit b202827
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .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
8 changes: 4 additions & 4 deletions roles/role.py
Expand Up @@ -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)

Expand All @@ -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):
Expand All @@ -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:
Expand Down

0 comments on commit b202827

Please sign in to comment.