Skip to content

Commit

Permalink
Work around a mypy bug with Python 3.11
Browse files Browse the repository at this point in the history
Mypy (many versions) raises a wrong error for Python 3.11:

  pgactivity/types.py:888: error: Returning Any from function declared to return "str"  [no-any-return]

Should be fixed by commit:

  python/mypy@05a3f7d
  • Loading branch information
dlax committed Nov 28, 2022
1 parent 87364cd commit 3e7e9e4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pgactivity/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,8 @@ class LockType(enum.Enum):

def __str__(self) -> str:
# Custom str(self) for transparent rendering in views.
assert isinstance(self.name, str)
# TODO ^ remove this assert for mypy > 0.991
return self.name


Expand Down

0 comments on commit 3e7e9e4

Please sign in to comment.