Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable local partial types by default #10169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Enable local partial types by default #10169

wants to merge 1 commit into from

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Mar 5, 2021

Local partial types prevent inferring the variable type from two
separate scopes. For example, this is no longer accepted:

class A:
    x = []  # Need type annotation here

    def f(self) -> None:
        self.x.append(1)

Also, initialization with just None is usually not allowed and
requires a type annotation:

x = None  # Error
y: None = None  # OK
z: Optional[str] = None  # OK

The mypy daemon only supports local partial types. This makes the
daemon and non-daemon modes behave consistently.

Add the --no-local-partial-types flag to revert to the old behavior.

Also make local partial types behavior closer to the old behavior
in a few cases:

  • allow x = f(...) even if the return type of f(...) is None when
    f is generic
  • allow x = None in an enum class body
  • allor for loop index variable to have an inferred None type

Related to #6740.

Local partial types prevent inferring the variable type from two
separate scopes. For example, this is no longer accepted:

```
class A:
    x = []  # Need type annotation here

    def f(self) -> None:
        self.x.append(1)
```

Also, initialization with just `None` is usually not allowed and
requires a type annotation:

```
x = None  # Error
y: None = None  # OK
z: Optional[str] = None  # OK
```

The mypy daemon only supports local partial types. This makes the
daemon and non-daemon modes behave consistently.

Add the `--no-local-partial-types` flag to revert to the old behavior.

Also make local partial types behavior closer to the old behavior
in a few cases:

- allow `x = f(...)` even if the return type of `f(...)` is `None` when
  `f` is generic
- allow `x = None` in an enum class body
- allor for loop index variable to have an inferred `None` type
init_type = get_proper_type(init_type)
if isinstance(init_type, NoneType):
if isinstance(init_expr, CallExpr):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PR description, you say it is only OK for generic functions, is this still true? Or a different error will be shown for non-generic? Add a more detailed comment here maybe.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For functions that always return None we generate error about a called function not returning a value, which happens elsewhere and isn't related to this code, which only deals with type inference.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2021

Diff from mypy_primer, showing the effect of this PR on open source code:

core (https://github.com/home-assistant/core.git)
+ homeassistant/components/automation/config.py:85: error: Need type annotation for "raw_config"  [var-annotated]

scrapy (https://github.com/scrapy/scrapy.git)
+ scrapy/utils/testproc.py:9: error: Need type annotation for "command"
+ scrapy/spiders/feed.py:103: error: Need type annotation for "delimiter"
+ scrapy/spiders/feed.py:104: error: Need type annotation for "quotechar"
+ scrapy/spiders/feed.py:105: error: Need type annotation for "headers"
+ scrapy/utils/log.py:117: error: Need type annotation for "_scrapy_root_handler"
+ scrapy/pipelines/files.py:80: error: Need type annotation for "AWS_ACCESS_KEY_ID"
+ scrapy/pipelines/files.py:81: error: Need type annotation for "AWS_SECRET_ACCESS_KEY"
+ scrapy/pipelines/files.py:82: error: Need type annotation for "AWS_ENDPOINT_URL"
+ scrapy/pipelines/files.py:83: error: Need type annotation for "AWS_REGION_NAME"
+ scrapy/pipelines/files.py:84: error: Need type annotation for "AWS_USE_SSL"
+ scrapy/pipelines/files.py:85: error: Need type annotation for "AWS_VERIFY"
+ scrapy/pipelines/files.py:186: error: Need type annotation for "GCS_PROJECT_ID"
+ scrapy/pipelines/files.py:192: error: Need type annotation for "POLICY"
+ scrapy/pipelines/files.py:246: error: Need type annotation for "FTP_USERNAME"
+ scrapy/pipelines/files.py:247: error: Need type annotation for "FTP_PASSWORD"
+ scrapy/pipelines/files.py:248: error: Need type annotation for "USE_ACTIVE_MODE"
+ tests/spiders.py:263: error: Need type annotation for "seed"
+ tests/spiders.py:264: error: Need type annotation for "callback_func"
+ tests/spiders.py:265: error: Need type annotation for "errback_func"

streamlit (https://github.com/streamlit/streamlit.git)
+ lib/streamlit/watcher/event_based_file_watcher.py: note: In class "_MultiFileWatcher":
+ lib/streamlit/watcher/event_based_file_watcher.py:92:5: error: Need type annotation for "_singleton"  [var-annotated]
+ lib/tests/streamlit/scriptrunner/test_data/runtime_error.py:23:1: error: Need type annotation for "bad"  [var-annotated]
+ lib/streamlit/metrics.py: note: In class "Client":
+ lib/streamlit/metrics.py:43:5: error: Need type annotation for "_singleton"  [var-annotated]

SinbadCogs (https://github.com/mikeshardmind/SinbadCogs.git)
+ devtools/patches.py:25: error: Need type annotation for "patch_bot_restore"

zulip (https://github.com/zulip/zulip.git)
+ zproject/dev_settings.py:165: error: Need type annotation for "LANDING_PAGE_NAVBAR_MESSAGE"  [var-annotated]
+ zproject/dev_settings.py:180: error: Need type annotation for "MEMCACHED_USERNAME"  [var-annotated]
+ zproject/default_settings.py:128: error: Need type annotation for "S3_REGION"  [var-annotated]
+ zproject/default_settings.py:129: error: Need type annotation for "S3_ENDPOINT_URL"  [var-annotated]
+ zproject/backends.py:310: error: Need type annotation for "_logger"  [var-annotated]
+ zproject/computed_settings.py:196: error: Need type annotation for "ANONYMOUS_USER_ID"  [var-annotated]
+ zproject/test_extra_settings.py:210: error: Need type annotation for "PUSH_NOTIFICATION_BOUNCER_URL"  [var-annotated]
+ zproject/test_extra_settings.py:262: error: Need type annotation for "FREE_TRIAL_DAYS"  [var-annotated]

pycryptodome (https://github.com/Legrandin/pycryptodome.git)
+ lib/Crypto/SelfTest/Hash/test_HMAC.py:43: error: Need type annotation for "default_hash"

jax (https://github.com/google/jax.git)
+ jax/lib/xla_bridge.py:121: error: Need type annotation for "_backends" (hint: "_backends: Dict[<type>, <type>] = ...")  [var-annotated]
+ jax/lib/xla_bridge.py:144: error: Need type annotation for "_tpu_backend"  [var-annotated]
+ jax/numpy/fft.py:40: error: Need type annotation for "_NOT_IMPLEMENTED" (hint: "_NOT_IMPLEMENTED: List[<type>] = ...")  [var-annotated]
+ jax/interpreters/batching.py:105: error: Need type annotation for "not_mapped"  [var-annotated]
+ jax/_src/numpy/lax_numpy.py:65: error: Need type annotation for "newaxis"  [var-annotated]
+ jax/numpy/linalg.py:44: error: Need type annotation for "_NOT_IMPLEMENTED" (hint: "_NOT_IMPLEMENTED: List[<type>] = ...")  [var-annotated]
+ jax/experimental/jet.py:348: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:370: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:384: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:404: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, NamedArg(Any, 'y')], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:428: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:440: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:455: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:469: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:513: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, KwArg(Any)], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:542: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, KwArg(Any)], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:550: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, KwArg(Any)], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:568: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:584: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "partial[Any]")  [assignment]
+ jax/experimental/jet.py:591: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, NamedArg(Any, 'fun_jaxpr'), NamedArg(Any, 'jvp_jaxpr_thunk')], Any]", target has type "partial[Any]")  [assignment]

pydantic (https://github.com/samuelcolvin/pydantic.git)
+ pydantic/networks.py:60: error: Need type annotation for "_url_regex_cache"  [var-annotated]
+ pydantic/networks.py:61: error: Need type annotation for "_ascii_domain_regex_cache"  [var-annotated]
+ pydantic/networks.py:62: error: Need type annotation for "_int_domain_regex_cache"  [var-annotated]
+ pydantic/main.py:115: error: Need type annotation for "title"  [var-annotated]
+ pydantic/main.py:118: error: Need type annotation for "min_anystr_length"  [var-annotated]
+ pydantic/main.py:119: error: Need type annotation for "max_anystr_length"  [var-annotated]
+ pydantic/env_settings.py:71: error: Need type annotation for "env_file"  [var-annotated]
+ pydantic/env_settings.py:72: error: Need type annotation for "env_file_encoding"  [var-annotated]
+ pydantic/env_settings.py:73: error: Need type annotation for "secrets_dir"  [var-annotated]

freqtrade (https://github.com/freqtrade/freqtrade.git)
+ freqtrade/rpc/fiat_convert.py:69: error: Need type annotation for "__instance"

scipy (https://github.com/scipy/scipy.git)
+ scipy/io/idl.py:73: error: Need type annotation for "STRUCT_DICT" (hint: "STRUCT_DICT: Dict[<type>, <type>] = ...")  [var-annotated]
+ scipy/fft/_pocketfft/tests/test_basic.py:766: error: Need type annotation for "dtype"  [var-annotated]
+ scipy/fft/_pocketfft/tests/test_basic.py:767: error: Need type annotation for "cdtype"  [var-annotated]
+ scipy/fft/_pocketfft/tests/test_basic.py:812: error: Need type annotation for "dtype"  [var-annotated]
+ scipy/fft/_pocketfft/tests/test_basic.py:813: error: Need type annotation for "cdtype"  [var-annotated]
+ scipy/_lib/_ccallback.py:7: error: Need type annotation for "ffi"  [var-annotated]
+ scipy/sparse/linalg/isolve/minres.py:364: error: Need type annotation for "residuals" (hint: "residuals: List[<type>] = ...")  [var-annotated]
+ scipy/fftpack/tests/test_basic.py:698: error: Need type annotation for "dtype"  [var-annotated]
+ scipy/fftpack/tests/test_basic.py:699: error: Need type annotation for "cdtype"  [var-annotated]
+ scipy/optimize/tests/test__shgo.py:182: error: Need type annotation for "g"  [var-annotated]
+ scipy/optimize/tests/test__shgo.py:215: error: Need type annotation for "g"  [var-annotated]
+ scipy/optimize/tests/test__shgo.py:240: error: Need type annotation for "g"  [var-annotated]

dragonchain (https://github.com/dragonchain/dragonchain.git)
+ dragonchain/lib/keys.py:46:1: error: Need type annotation for "_my_keys"
+ dragonchain/lib/database/redisearch.py:101:1: error: Need type annotation for "_redis_connection"

pip (https://github.com/pypa/pip.git)
- src/pip/_internal/metadata/pkg_resources.py:79: error: Argument 1 to "Environment" has incompatible type "None"; expected "WorkingSet"
+ src/pip/_internal/metadata/pkg_resources.py:79: error: Argument 1 to "Environment" has incompatible type "Optional[Any]"; expected "WorkingSet"
- src/pip/_internal/commands/show.py:62: error: "None" has no attribute "__iter__" (not iterable)
+ src/pip/_internal/commands/show.py:62: error: Item "None" of "Optional[Any]" has no attribute "__iter__" (not iterable)
- src/pip/_internal/commands/show.py:76: error: "None" has no attribute "__iter__" (not iterable)
+ src/pip/_internal/commands/show.py:76: error: Item "None" of "Optional[Any]" has no attribute "__iter__" (not iterable)


PyGithub (https://github.com/PyGithub/PyGithub.git)
+ tests/Framework.py:246: error: Need type annotation for "retry"
+ tests/Framework.py:247: error: Need type annotation for "pool_size"

paasta (https://github.com/yelp/paasta.git)
+ paasta_tools/utils.py:1270: error: Need type annotation for "_log_writer"
+ paasta_tools/utils.py:1272: error: Need type annotation for "_log_writer_classes" (hint: "_log_writer_classes: Dict[<type>, <type>] = ...")
+ paasta_tools/cli/cmds/logs.py:469: error: Need type annotation for "_log_reader_classes" (hint: "_log_reader_classes: Dict[<type>, <type>] = ...")
+ paasta_tools/api/api.py:158: error: Need type annotation for "_app"

sockeye (https://github.com/awslabs/sockeye.git)
+ sockeye/constants.py:305: error: Need type annotation for "GRADIENT_COMPRESSION_NONE"
+ sockeye/encoder.py:34: error: Need type annotation for "ImageEncoderConfig"

aiohttp (https://github.com/aio-libs/aiohttp.git)
+ aiohttp/http_exceptions.py:23: error: Need type annotation for "headers"  [var-annotated]
+ aiohttp/multipart.py:565: error: Need type annotation for "multipart_reader_cls"  [var-annotated]
+ aiohttp/multipart.py:668: error: Returning Any from function declared to return "Union[MultipartReader, BodyPartReader]"  [no-any-return]
+ aiohttp/connector.py:73: error: Need type annotation for "_source_traceback"  [var-annotated]
+ aiohttp/connector.py:74: error: Need type annotation for "_transport"  [var-annotated]
+ aiohttp/connector.py:178: error: Need type annotation for "_source_traceback"  [var-annotated]
+ aiohttp/client_reqrep.py:173: error: Need type annotation for "auth"  [var-annotated]
+ aiohttp/client_reqrep.py:174: error: Need type annotation for "response"  [var-annotated]
+ aiohttp/client_reqrep.py:176: error: Need type annotation for "_writer"  [var-annotated]
+ aiohttp/client_reqrep.py:177: error: Need type annotation for "_continue"  [var-annotated]
+ aiohttp/client_reqrep.py:651: error: Need type annotation for "version"  [var-annotated]
+ aiohttp/client_reqrep.py:653: error: Need type annotation for "reason"  [var-annotated]
+ aiohttp/client_reqrep.py:659: error: Need type annotation for "_connection"  [var-annotated]
+ aiohttp/client_reqrep.py:660: error: Need type annotation for "_source_traceback"  [var-annotated]

sympy (https://github.com/sympy/sympy.git)
+ sympy/core/core.py:64: error: Need type annotation for "all_classes" (hint: "all_classes: Set[<type>] = ...")
+ sympy/utilities/timeutils.py:44: error: Need type annotation for "_timestack"
+ sympy/polys/polyconfig.py:25: error: Need type annotation for "_current_config" (hint: "_current_config: Dict[<type>, <type>] = ...")
+ sympy/testing/tests/diagnose_imports.py:123: error: Need type annotation for "sorted_messages" (hint: "sorted_messages: List[<type>] = ...")
+ sympy/logic/boolalg.py:684: error: Need type annotation for "nargs"
+ sympy/core/numbers.py:1022: error: Need type annotation for "is_rational"
+ sympy/core/numbers.py:1023: error: Need type annotation for "is_irrational"
+ sympy/core/numbers.py:3204: error: Need type annotation for "is_extended_real"
+ sympy/core/numbers.py:3205: error: Need type annotation for "is_real"
+ sympy/core/numbers.py:3206: error: Need type annotation for "is_rational"
+ sympy/core/numbers.py:3207: error: Need type annotation for "is_algebraic"
+ sympy/core/numbers.py:3208: error: Need type annotation for "is_transcendental"
+ sympy/core/numbers.py:3209: error: Need type annotation for "is_integer"
+ sympy/core/numbers.py:3211: error: Need type annotation for "is_finite"
+ sympy/core/numbers.py:3212: error: Need type annotation for "is_zero"
+ sympy/core/numbers.py:3213: error: Need type annotation for "is_prime"
+ sympy/core/numbers.py:3214: error: Need type annotation for "is_positive"
+ sympy/core/numbers.py:3215: error: Need type annotation for "is_negative"
+ sympy/core/numbers.py:3825: error: Need type annotation for "is_irrational"
+ sympy/core/numbers.py:3884: error: Need type annotation for "is_irrational"
+ sympy/core/evalf.py:1259: error: Need type annotation for "evalf_table"
+ sympy/assumptions/assume.py:397: error: Need type annotation for "handler"
+ sympy/polys/polyoptions.py:126: error: Need type annotation for "__order__"
+ sympy/functions/elementary/piecewise.py:117: error: Need type annotation for "nargs"
+ sympy/polys/domains/modularinteger.py:18: error: Need type annotation for "_parent"
+ sympy/polys/domains/modularinteger.py:18: error: Need type annotation for "dom"
+ sympy/polys/domains/modularinteger.py:18: error: Need type annotation for "mod"
+ sympy/polys/domains/modularinteger.py:18: error: Need type annotation for "sym"
+ sympy/polys/domains/compositedomain.py:15: error: Need type annotation for "domain"
+ sympy/polys/domains/compositedomain.py:15: error: Need type annotation for "gens"
+ sympy/polys/domains/compositedomain.py:15: error: Need type annotation for "ngens"
+ sympy/polys/domains/compositedomain.py:15: error: Need type annotation for "symbols"
+ sympy/simplify/trigsimp.py:754: error: Need type annotation for "_trigpat"
+ sympy/simplify/hyperexpand.py:1971: error: Need type annotation for "_collection"
+ sympy/simplify/hyperexpand.py:2215: error: Need type annotation for "_meijercollection"
+ sympy/simplify/fu.py:1702: error: Need type annotation for "_ROOT2"
+ sympy/printing/pycode.py:80: error: Need type annotation for "modules"
+ sympy/polys/rings.py:565: error: Need type annotation for "_hash"
+ sympy/polys/fields.py:312: error: Need type annotation for "_hash"
+ sympy/polys/compatibility.py:229: error: Need type annotation for "symbols"
+ sympy/polys/compatibility.py:230: error: Need type annotation for "ngens"
+ sympy/polys/compatibility.py:231: error: Need type annotation for "domain"
+ sympy/polys/compatibility.py:232: error: Need type annotation for "order"
+ sympy/polys/compatibility.py:233: error: Need type annotation for "gens"
+ sympy/polys/domains/finitefield.py:110: error: Need type annotation for "dom"
+ sympy/polys/domains/finitefield.py:111: error: Need type annotation for "mod"
+ sympy/matrices/common.py:63: error: Need type annotation for "_simplify"
+ sympy/integrals/transforms.py:798: error: Need type annotation for "_allowed"
+ sympy/integrals/meijerint.py:1453: error: Need type annotation for "_lookup_table"
+ sympy/integrals/manualintegrate.py:99: error: Need type annotation for "evaluators" (hint: "evaluators: Dict[<type>, <type>] = ...")
+ sympy/functions/elementary/trigonometric.py:1607: error: Need type annotation for "_reciprocal_of"
+ sympy/functions/elementary/hyperbolic.py:860: error: Need type annotation for "_reciprocal_of"
- sympy/assumptions/relation/equality.py:59: error: Incompatible types in assignment (expression has type "bool", base class "BinaryRelation" defined the type as "None")
- sympy/assumptions/relation/equality.py:60: error: Incompatible types in assignment (expression has type "bool", base class "BinaryRelation" defined the type as "None")
- sympy/assumptions/relation/equality.py:97: error: Incompatible types in assignment (expression has type "bool", base class "BinaryRelation" defined the type as "None")
- sympy/assumptions/relation/equality.py:98: error: Incompatible types in assignment (expression has type "bool", base class "BinaryRelation" defined the type as "None")
+ sympy/assumptions/relation/binrel.py:75: error: Need type annotation for "is_reflexive"
+ sympy/assumptions/relation/binrel.py:76: error: Need type annotation for "is_symmetric"
+ sympy/printing/c.py:218: error: Need type annotation for "math_macros"
+ sympy/integrals/heurisch.py:240: error: Need type annotation for "_bessel_table"
+ sympy/combinatorics/prufer.py:24: error: Need type annotation for "_prufer_repr"
+ sympy/combinatorics/prufer.py:25: error: Need type annotation for "_tree_repr"
+ sympy/combinatorics/prufer.py:26: error: Need type annotation for "_nodes"
+ sympy/combinatorics/prufer.py:27: error: Need type annotation for "_rank"
+ sympy/combinatorics/permutations.py:877: error: Need type annotation for "_array_form"
+ sympy/combinatorics/permutations.py:878: error: Need type annotation for "_cyclic_form"
+ sympy/combinatorics/permutations.py:879: error: Need type annotation for "_cycle_structure"
+ sympy/combinatorics/permutations.py:880: error: Need type annotation for "_size"
+ sympy/combinatorics/permutations.py:881: error: Need type annotation for "_rank"
+ sympy/combinatorics/permutations.py:3010: error: Need type annotation for "print_cyclic"
+ sympy/combinatorics/partitions.py:25: error: Need type annotation for "_rank"
+ sympy/combinatorics/partitions.py:26: error: Need type annotation for "_partition"
+ sympy/combinatorics/partitions.py:333: error: Need type annotation for "_dict"
+ sympy/combinatorics/partitions.py:334: error: Need type annotation for "_keys"
+ sympy/combinatorics/graycode.py:52: error: Need type annotation for "_rank"
+ sympy/combinatorics/free_groups.py:356: error: Need type annotation for "_hash"
+ sympy/combinatorics/subsets.py:31: error: Need type annotation for "_rank_binary"
+ sympy/combinatorics/subsets.py:32: error: Need type annotation for "_rank_lex"
+ sympy/combinatorics/subsets.py:33: error: Need type annotation for "_rank_graycode"
+ sympy/combinatorics/subsets.py:34: error: Need type annotation for "_subset"
+ sympy/combinatorics/subsets.py:35: error: Need type annotation for "_superset"
+ sympy/combinatorics/coset_table.py:50: error: Need type annotation for "coset_table_limit"
+ sympy/assumptions/relation/equality.py:103: error: Need type annotation for "handler"
+ sympy/combinatorics/polyhedron.py:32: error: Need type annotation for "_edges"
+ sympy/utilities/codegen.py:541: error: Need type annotation for "printer"
+ sympy/printing/llvmjitcode.py:142: error: Need type annotation for "exe_engines" (hint: "exe_engines: List[<type>] = ...")
+ sympy/printing/llvmjitcode.py:145: error: Need type annotation for "link_names" (hint: "link_names: Set[<type>] = ...")
+ sympy/holonomic/holonomic.py:2314: error: Need type annotation for "_lookup_table"
+ sympy/holonomic/holonomic.py:2315: error: Need type annotation for "domain_for_table"
+ sympy/core/tests/test_logic.py:7: error: Need type annotation for "U"
+ sympy/core/tests/test_facts.py:8: error: Need type annotation for "U"
+ sympy/parsing/latex/_parse_latex_antlr.py:13: error: Need type annotation for "MathErrorListener"

aioredis (https://github.com/aio-libs/aioredis.git)
+ aioredis/stream.py:52: error: Need type annotation for "_parser"

porcupine (https://github.com/Akuli/porcupine.git)
+ porcupine/utils.py:220: error: Need type annotation for "tipwindow"  [var-annotated]

starlette (https://github.com/encode/starlette.git)
+ starlette/responses.py:38: error: Need type annotation for "media_type"

sphinx (https://github.com/sphinx-doc/sphinx.git)
+ sphinx/util/typing.py:36:5: error: Need type comment for "types_Union"
+ sphinx/addnodes.py: note: In class "meta":
+ sphinx/addnodes.py:331:5: error: Need type comment for "rawcontent"
+ sphinx/util/docutils.py: note: In class "SphinxRole":
+ sphinx/util/docutils.py:350:5: error: Need type comment for "name"
+ sphinx/util/docutils.py:351:5: error: Need type comment for "rawtext"
+ sphinx/util/docutils.py:352:5: error: Need type comment for "text"
+ sphinx/util/docutils.py:353:5: error: Need type comment for "lineno"
+ sphinx/util/docutils.py:354:5: error: Need type comment for "inliner"
+ sphinx/util/docutils.py:355:5: error: Need type comment for "options"
+ sphinx/util/docutils.py:357:5: error: Need type comment for "content"
+ sphinx/util/docutils.py: note: At top level:
+ sphinx/util/docutils.py:398: error: unused 'type: ignore' comment
+ sphinx/util/docutils.py: note: In class "ReferenceRole":
+ sphinx/util/docutils.py:411:5: error: Need type comment for "has_explicit_title"
+ sphinx/util/docutils.py:413:5: error: Need type comment for "title"
+ sphinx/util/docutils.py:414:5: error: Need type comment for "target"
+ sphinx/ext/intersphinx.py: note: In function "inspect_main":
+ sphinx/ext/intersphinx.py:390:9: error: Need type comment for "user_agent"
+ sphinx/writers/latex.py: note: In member "translate" of class "LaTeXWriter":
+ sphinx/writers/latex.py:102:23: error: Incompatible types in assignment (expression has type "str", variable has type "None")

pandas (https://github.com/pandas-dev/pandas.git)
+ pandas/_version.py:54: error: Need type annotation for "HANDLERS" (hint: "HANDLERS: Dict[<type>, <type>] = ...")  [var-annotated]
+ pandas/core/dtypes/dtypes.py:81: error: Need type annotation for "subdtype"  [var-annotated]
+ pandas/core/dtypes/dtypes.py:86: error: Need type annotation for "base"  [var-annotated]
+ pandas/core/dtypes/common.py:81: error: Need type annotation for "_is_scipy_sparse"  [var-annotated]
+ pandas/core/arrays/masked.py:71: error: Need type annotation for "base"  [var-annotated]
+ pandas/plotting/_core.py:1730: error: Need type annotation for "_backends" (hint: "_backends: Dict[<type>, <type>] = ...")  [var-annotated]
+ pandas/io/excel/_base.py:788: error: Need type annotation for "path"  [var-annotated]
+ pandas/io/pytables.py:240: error: Need type annotation for "_table_mod"  [var-annotated]
+ pandas/plotting/_matplotlib/converter.py:68: error: Need type annotation for "_mpl_units" (hint: "_mpl_units: Dict[<type>, <type>] = ...")  [var-annotated]
+ pandas/tseries/holiday.py:352: error: Need type annotation for "holiday_calendars" (hint: "holiday_calendars: Dict[<type>, <type>] = ...")  [var-annotated]
+ pandas/tseries/holiday.py:390: error: Need type annotation for "_cache"  [var-annotated]
+ pandas/tests/io/test_gbq.py:21: error: Need type annotation for "PROJECT_ID"  [var-annotated]
+ pandas/tests/io/test_gbq.py:22: error: Need type annotation for "PRIVATE_KEY_JSON_PATH"  [var-annotated]
+ pandas/tests/io/test_gbq.py:23: error: Need type annotation for "PRIVATE_KEY_JSON_CONTENTS"  [var-annotated]

manticore (https://github.com/trailofbits/manticore.git)
+ tests/auto_generators/trace.py:95: error: Need type annotation for "_arch"
+ tests/auto_generators/make_dump.py:108: error: Need type annotation for "_arch"
+ tests/other/test_tui_api.py:25: error: Need type annotation for "logs" (hint: "logs: List[<type>] = ...")
+ tests/other/test_tui_api.py:26: error: Need type annotation for "state_captures" (hint: "state_captures: List[<type>] = ...")
+ manticore/core/smtlib/solver.py:744: error: Need type annotation for "choice"
+ tests/native/test_armv7unicorn.py:19: error: Need type annotation for "ks"
+ tests/native/test_armv7unicorn.py:20: error: Need type annotation for "ks_thumb"
+ tests/native/test_armv7unicorn.py:1487: error: Need type annotation for "cpu"
+ tests/native/test_armv7unicorn.py:1488: error: Need type annotation for "state"
+ tests/native/test_armv7cpu.py:16: error: Need type annotation for "ks"
+ tests/native/test_armv7cpu.py:17: error: Need type annotation for "ks_thumb"
+ tests/native/test_aarch64cpu.py:21: error: Need type annotation for "ks"


alerta (https://github.com/alerta/alerta.git)
+ alerta/settings.py:37: error: Need type annotation for "MONGO_DATABASE"
+ alerta/settings.py:42: error: Need type annotation for "POSTGRES_DB"
+ alerta/settings.py:46: error: Need type annotation for "DATABASE_NAME"
+ alerta/settings.py:54: error: Need type annotation for "CELERY_BROKER_URL"
+ alerta/settings.py:55: error: Need type annotation for "CELERY_RESULT_BACKEND"
+ alerta/settings.py:86: error: Need type annotation for "OAUTH2_CLIENT_ID"
+ alerta/settings.py:87: error: Need type annotation for "OAUTH2_CLIENT_SECRET"
+ alerta/settings.py:92: error: Need type annotation for "COGNITO_USER_POOL_ID"
+ alerta/settings.py:93: error: Need type annotation for "COGNITO_DOMAIN"
+ alerta/settings.py:129: error: Need type annotation for "KEYCLOAK_URL"
+ alerta/settings.py:130: error: Need type annotation for "KEYCLOAK_REALM"
+ alerta/settings.py:134: error: Need type annotation for "OIDC_ISSUER_URL"
+ alerta/settings.py:135: error: Need type annotation for "OIDC_AUTH_URL"
+ alerta/settings.py:136: error: Need type annotation for "OIDC_LOGOUT_URL"
+ alerta/settings.py:144: error: Need type annotation for "SAML2_ENTITY_ID"
+ alerta/settings.py:145: error: Need type annotation for "SAML2_METADATA_URL"
+ alerta/settings.py:156: error: Need type annotation for "AUDIT_LOG"
+ alerta/settings.py:159: error: Need type annotation for "AUDIT_URL"
+ alerta/settings.py:174: error: Need type annotation for "DEFAULT_NORMAL_SEVERITY"
+ alerta/settings.py:175: error: Need type annotation for "DEFAULT_PREVIOUS_SEVERITY"
+ alerta/settings.py:197: error: Need type annotation for "SSL_KEY_FILE"
+ alerta/settings.py:198: error: Need type annotation for "SSL_CERT_FILE"
+ alerta/settings.py:208: error: Need type annotation for "DEFAULT_AUDIO_FILE"
+ alerta/settings.py:236: error: Need type annotation for "GOOGLE_TRACKING_ID"
+ alerta/models/alarms/__init__.py:16: error: Need type annotation for "name"

pylint (https://github.com/pycqa/pylint.git)
+ pylint/lint/parallel.py:18: error: Need type annotation for "_worker_linter"

poetry (https://github.com/python-poetry/poetry.git)
+ poetry/utils/env.py:303: error: Need type annotation for "_env"
+ poetry/utils/shell.py:23: error: Need type annotation for "_shell"

tornado (https://github.com/tornadoweb/tornado.git)
+ tornado/process.py:79: error: Need type annotation for "_task_id"
+ tornado/process.py:82: error: Missing return statement
+ tornado/process.py:138: error: Argument 1 to "range" has incompatible type "Optional[int]"; expected "_SupportsIndex"
+ tornado/process.py:213: error: Need type annotation for "_old_sigchld"
+ tornado/autoreload.py:109: error: Need type annotation for "_watched_files" (hint: "_watched_files: Set[<type>] = ...")
+ tornado/autoreload.py:110: error: Need type annotation for "_reload_hooks" (hint: "_reload_hooks: List[<type>] = ...")
+ tornado/autoreload.py:115: error: Need type annotation for "_original_spec"
+ tornado/test/web_test.py:88: error: Need type annotation for "Handler"
+ tornado/test/httpserver_test.py:77: error: Need type annotation for "Handler"

graphql-core (https://github.com/graphql-python/graphql-core.git)
+ src/graphql/pyutils/cached_property.py:4: error: Need type annotation for "standard_cached_property"
+ src/graphql/language/visitor.py:52: error: Need type annotation for "IDLE"
+ src/graphql/language/visitor.py:174: error: Need type annotation for "IDLE"

stone (https://github.com/dropbox/stone.git)
+ stone/backends/python_type_stubs.py:99: error: Need type annotation for "cur_namespace"
+ stone/backends/python_client.py:113: error: Need type annotation for "supported_auth_types"

spark (https://github.com/apache/spark.git)
+ python/pyspark/_globals.py:54: error: Need type annotation for "__instance"
+ python/pyspark/shuffle.py:37: error: Need type annotation for "process"
+ python/pyspark/streaming/util.py:37: error: Need type annotation for "_emptyRDD"

dulwich (https://github.com/dulwich/dulwich.git)
+ dulwich/diff_tree.py:53: error: Need type annotation for "REWRITE_THRESHOLD"
+ dulwich/diff_tree.py:411: error: Cannot determine type of 'REWRITE_THRESHOLD'
+ dulwich/server.py:147: error: Need type annotation for "object_store"
+ dulwich/server.py:148: error: Need type annotation for "refs"
+ dulwich/client.py:1220: error: Need type annotation for "git_command"

parso (https://github.com/davidhalter/parso.git)
+ parso/python/errors.py:986: error: Need type annotation for "_fstring_grammar"

pytest (https://github.com/pytest-dev/pytest.git)
+ src/_pytest/python_api.py:49: error: Need type annotation for "__array_ufunc__"  [var-annotated]
+ src/_pytest/nodes.py:553: error: Need type annotation for "nextitem"  [var-annotated]
+ src/_pytest/capture.py:214: error: Need type annotation for "encoding"  [var-annotated]
+ src/_pytest/capture.py:249: error: Need type annotation for "EMPTY_BUFFER"  [var-annotated]
+ src/_pytest/capture.py:549: error: Need type annotation for "_state"  [var-annotated]
+ testing/test_pytester.py:33: error: Need type annotation for "excinfo"  [var-annotated]
+ testing/test_pytester.py:46: error: Need type annotation for "excinfo"  [var-annotated]
+ testing/test_config.py:992: error: Need type annotation for "files"  [var-annotated]
+ testing/python/metafunc.py:37: error: Need type annotation for "name2fixturedefs"  [var-annotated]
+ src/_pytest/doctest.py:62: error: Need type annotation for "RUNNER_CLASS"  [var-annotated]
+ testing/test_junitxml.py:949: error: Need type annotation for "workerinput"  [var-annotated]
+ testing/test_junitxml.py:959: error: Need type annotation for "junitprefix"  [var-annotated]

scikit-learn (https://github.com/scikit-learn/scikit-learn.git)
+ sklearn/ensemble/_hist_gradient_boosting/grower.py:69: error: Need type annotation for "split_info"
+ sklearn/ensemble/_hist_gradient_boosting/grower.py:70: error: Need type annotation for "left_child"
+ sklearn/ensemble/_hist_gradient_boosting/grower.py:71: error: Need type annotation for "right_child"
+ sklearn/ensemble/_hist_gradient_boosting/grower.py:72: error: Need type annotation for "histograms"
+ sklearn/utils/_testing.py:39: error: Need type annotation for "WindowsError"
+ sklearn/utils/estimator_checks.py:69: error: Need type annotation for "REGRESSION_DATASET"
+ sklearn/metrics/tests/test_score_objects.py:120: error: Need type annotation for "X_mm"
+ sklearn/metrics/tests/test_score_objects.py:120: error: Need type annotation for "y_ml_mm"
+ sklearn/metrics/tests/test_score_objects.py:120: error: Need type annotation for "y_mm"
+ sklearn/metrics/tests/test_score_objects.py:121: error: Need type annotation for "ESTIMATORS"
+ sklearn/metrics/tests/test_score_objects.py:122: error: Need type annotation for "TEMP_FOLDER"
+ sklearn/datasets/tests/test_lfw.py:27: error: Need type annotation for "SCIKIT_LEARN_DATA"
+ sklearn/datasets/tests/test_lfw.py:28: error: Need type annotation for "SCIKIT_LEARN_EMPTY_DATA"
+ sklearn/datasets/tests/test_lfw.py:29: error: Need type annotation for "LFW_HOME"
+ sklearn/model_selection/tests/test_validation.py:83: error: Need type annotation for "WindowsError"

asynq (https://github.com/quora/asynq.git)
+ asynq/tests/test_multiple_inheritance.py:26: error: Need type annotation for "called" (hint: "called: Dict[<type>, <type>] = ...")
+ asynq/tests/test_contexts.py:23: error: Need type annotation for "current_context"

schemathesis (https://github.com/schemathesis/schemathesis.git)
+ src/schemathesis/serializers.py:20: error: Need type annotation for "SERIALIZERS" (hint: "SERIALIZERS: Dict[<type>, <type>] = ...")
+ src/schemathesis/specs/openapi/_hypothesis.py:26: error: Need type annotation for "STRING_FORMATS" (hint: "STRING_FORMATS: Dict[<type>, <type>] = ...")

@JukkaL
Copy link
Collaborator Author

JukkaL commented Mar 8, 2021

The new errors from mypy primer are expected. However, it may be possible to improve some of the error messages.

bl2ck2

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants