Skip to content

Commit

Permalink
Update mypy to 0.910
Browse files Browse the repository at this point in the history
mypy 0.730 is not compatible with Python 3.9, resulting in the following
bogus error message:

    python/mypy#4125
  • Loading branch information
juergbi committed Oct 27, 2021
1 parent 27069d4 commit 4fe08f9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/buildstream/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class Plugin:
which are included in the buildstream namespace.
"""

BST_MIN_VERSION = None
BST_MIN_VERSION: Optional[str] = None
"""The minimum required version of BuildStream required by this plugin.
The version must be expressed as the string *"<major>.<minor>"*, where the
Expand Down Expand Up @@ -278,7 +278,7 @@ class Foo(Source):
__TABLE = WeakValueDictionary() # type: WeakValueDictionary[int, Plugin]

try:
__multiprocessing_context = multiprocessing.get_context("forkserver")
__multiprocessing_context: multiprocessing.context.BaseContext = multiprocessing.get_context("forkserver")
except ValueError:
# We are on a system without `forkserver` support. Let's default to
# spawn. This seems to be hanging however in some rare cases.
Expand Down
3 changes: 2 additions & 1 deletion src/buildstream/plugins/sources/tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class ReadableTarInfo(tarfile.TarInfo):
so that the owner-read bit is always set.
"""

@property
# https://github.com/python/mypy/issues/4125
@property # type: ignore
def mode(self):
# Respect umask instead of the file mode stored in the archive.
# The only bit used from the embedded mode is the executable bit for files.
Expand Down
6 changes: 3 additions & 3 deletions src/buildstream/plugins/sources/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def set_ref(self, ref: SourceRef, node: MappingNode) -> None:
# init_workspace()
#
# Raises AssertionError: existing workspaces should not be reinitialized
def init_workspace(self, directory: Directory) -> None:
def init_workspace(self, directory: str) -> None:
raise AssertionError("Attempting to re-open an existing workspace")

def fetch(self) -> None: # pylint: disable=arguments-differ
def fetch(self, *, previous_sources_dir=None) -> None: # pylint: disable=arguments-differ
pass # pragma: nocover

def stage(self, directory):
Expand Down Expand Up @@ -133,5 +133,5 @@ def __do_stage(self, directory: Directory) -> None:


# Plugin entry point
def setup() -> WorkspaceSource:
def setup():
return WorkspaceSource
6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ skip_install = True
commands =
mypy {posargs}
deps =
mypy==0.730
mypy==0.910
types-protobuf
types-python-dateutil
types-setuptools
types-ujson
-rrequirements/requirements.txt
-rrequirements/dev-requirements.txt

Expand Down

0 comments on commit 4fe08f9

Please sign in to comment.