update to the latest mypy bringin the code base to the new requirements

Bug #1781893 reported by Sergio Schvezov on 2018-07-16
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Medium
Unassigned

Bug Description

The latest mypy, 0.620, fixes many of the required ignores we have, but comes with a few additional checks, particularly the use of None when returning a specific type,

napcraft/extractors/_metadata.py:83: error: Incompatible return value type (got "Optional[str]", expected "str")
snapcraft/extractors/_metadata.py:92: error: Incompatible return value type (got "Optional[str]", expected "str")
snapcraft/extractors/_metadata.py:101: error: Incompatible return value type (got "Optional[str]", expected "str")
snapcraft/extractors/_metadata.py:110: error: Incompatible return value type (got "Optional[str]", expected "str")
snapcraft/extractors/_metadata.py:119: error: Incompatible return value type (got "Optional[str]", expected "str")
snapcraft/extractors/_metadata.py:128: error: Incompatible return value type (got "Optional[str]", expected "str")
snapcraft/extractors/_metadata.py:137: error: Incompatible return value type (got "Optional[List[str]]", expected "List[str]")
snapcraft/internal/steps.py:26: error: Incompatible types in assignment (expression has type "None", variable has type "int")
snapcraft/internal/steps.py:41: error: Incompatible return value type (got "None", expected "Step")
snapcraft/internal/steps.py:47: error: Incompatible return value type (got "None", expected "Step")
snapcraft/internal/dirs.py:41: error: Value of type variable "AnyStr" of "join" cannot be "Optional[str]"
snapcraft/internal/dirs.py:42: error: Value of type variable "AnyStr" of "join" cannot be "Optional[str]"
snapcraft/internal/dirs.py:43: error: Value of type variable "AnyStr" of "join" cannot be "Optional[str]"
snapcraft/internal/dirs.py:44: error: Value of type variable "AnyStr" of "join" cannot be "Optional[str]"
snapcraft/config.py:80: error: Incompatible types in assignment (expression has type "None", variable has type "str")
snapcraft/config.py:107: error: Incompatible return value type (got "None", expected "str")
snapcraft/config.py:184: error: Incompatible return value type (got "None", expected "str")
snapcraft/project/_project_options.py:247: error: Incompatible types in assignment (expression has type "None", variable has type "str")
snapcraft/project/_project_options.py:252: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")
snapcraft/internal/elf.py:184: error: Incompatible return value type (got "None", expected "str")
snapcraft/internal/elf.py:223: error: Incompatible types in assignment (expression has type "None", variable has type "Tuple[str, str, str]")
snapcraft/_store.py:165: error: Item "None" of "Optional[StoreClient]" has no attribute "login"
snapcraft/_store.py:180: error: Item "None" of "Optional[StoreClient]" has no attribute "login"
snapcraft/storeapi/_store_client.py:127: error: Incompatible return value type (got "Dict[str, Union[List[str], str, None]]", expected "Dict[str, Union[List[str], str]]")
snapcraft/extractors/setuppy.py:50: error: Item "None" of "Optional[Loader]" has no attribute "exec_module"
snapcraft/extractors/setuppy.py:59: error: Argument "description" to "ExtractedMetadata" has incompatible type "Optional[str]"; expected "str"
snapcraft/extractors/setuppy.py:59: error: Argument "version" to "ExtractedMetadata" has incompatible type "Optional[str]"; expected "str"
snapcraft/extractors/appstream.py:45: error: Item "None" of "Optional[str]" has no attribute "strip"
snapcraft/extractors/appstream.py:51: error: Item "None" of "Optional[str]" has no attribute "strip"
snapcraft/extractors/appstream.py:56: error: Argument "icon" to "ExtractedMetadata" has incompatible type "Union[str, Any, None]"; expected "str"
snapcraft/extractors/appstream.py:70: error: Incompatible return value type (got "None", expected "str")
snapcraft/extractors/appstream.py:83: error: Incompatible return value type (got "None", expected "str")
snapcraft/project/_project.py:37: error: Incompatible types in assignment (expression has type "None", variable has type "ProjectInfo")
snapcraft/internal/build_providers/_multipass/_multipass.py:38: error: Return type of "_mount_snaps_directory" incompatible with supertype "Provider"
snapcraft/internal/build_providers/_multipass/_multipass.py:51: error: Incompatible types in assignment (expression has type "None", variable has type "InstanceInfo")
snapcraft/plugins/python.py:252: error: Incompatible return value type (got "None", expected "str")
snapcraft/internal/project_loader/grammar/_statement.py:62: error: Incompatible types in assignment (expression has type "None", variable has type "Set[str]")
snapcraft/internal/project_loader/grammar/_statement.py:63: error: Incompatible types in assignment (expression has type "None", variable has type "Set[str]")
snapcraft/internal/project_loader/grammar/_try.py:57: error: Argument "call_stack" to "__init__" of "Statement" has incompatible type "Optional[List[Any]]"; expected "List[Any]"
snapcraft/internal/project_loader/grammar/_to.py:65: error: Argument "call_stack" to "__init__" of "Statement" has incompatible type "Optional[List[Any]]"; expected "List[Any]"
snapcraft/internal/project_loader/grammar/_to.py:109: error: Item "None" of "Optional[Match[str]]" has no attribute "group"
snapcraft/internal/project_loader/grammar/_on.py:72: error: Argument "call_stack" to "__init__" of "Statement" has incompatible type "Optional[List[Any]]"; expected "List[Any]"
snapcraft/internal/project_loader/grammar/_on.py:118: error: Item "None" of "Optional[Match[str]]" has no attribute "group"
snapcraft/internal/project_loader/grammar/_compound.py:46: error: Argument "call_stack" to "__init__" of "Statement" has incompatible type "Optional[List[Any]]"; expected "List[Any]"
snapcraft/internal/project_loader/grammar/_processor.py:91: error: Incompatible types in assignment (expression has type "None", variable has type "Statement")
snapcraft/internal/project_loader/grammar/_processor.py:98: error: Argument 2 to "_handle_else" has incompatible type "None"; expected "List[Union[str, Dict[str, Any]]]"
snapcraft/internal/project_loader/grammar/_processor.py:136: error: Item "None" of "Optional[Match[str]]" has no attribute "groups"
snapcraft/internal/project_loader/grammar/_processor.py:140: error: Argument "body" to "OnStatement" has incompatible type "None"; expected "List[Union[str, Dict[str, Any]]]"
snapcraft/internal/project_loader/grammar/_processor.py:143: error: Argument "body" to "ToStatement" has incompatible type "None"; expected "List[Union[str, Dict[str, Any]]]"
snapcraft/internal/pluginhandler/__init__.py:292: error: Incompatible return value type (got "None", expected "OutdatedReport")
snapcraft/internal/pluginhandler/__init__.py:339: error: Incompatible return value type (got "None", expected "DirtyReport")
snapcraft/internal/build_providers/_qemu/_qemu_driver.py:70: error: Incompatible types in assignment (expression has type "None", variable has type "Popen")
snapcraft/internal/build_providers/_qemu/_qemu_driver.py:119: error: Argument 1 to "_popen" has incompatible type "List[Optional[str]]"; expected "List[str]"
snapcraft/internal/build_providers/_qemu/_qemu_driver.py:143: error: Argument "exit_code" to "ProviderStopError" has incompatible type "None"; expected "int"
snapcraft/cli/_options.py:59: error: Item "None" of "Optional[Context]" has no attribute "params"
snapcraft/internal/meta/_snap_packaging.py:242: error: Incompatible return value type (got "None", expected "str")

Changed in snapcraft:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers