Skip to content

fix(typing): reword the comment mypy reads as a # type: comment - #370

Open
Danipulok wants to merge 1 commit into
KurimuzonAkuma:devfrom
Danipulok:fix/mypy-type-comment
Open

fix(typing): reword the comment mypy reads as a # type: comment#370
Danipulok wants to merge 1 commit into
KurimuzonAkuma:devfrom
Danipulok:fix/mypy-type-comment

Conversation

@Danipulok

Copy link
Copy Markdown
Contributor

What

mypy cannot check this project at all. One run, on a clean tree:

pyrogram/connection/transport/tcp/web_proxy_carrier.py:40: error: Invalid syntax  [syntax]
Found 1 error in 1 file (errors prevented further checking)

The file parses fine and every other tool reads it. What mypy chokes on is a comment:

# type:u8 | stream_id:u24 (big-endian) | length:u32 (big-endian) | payload, laid
#  out by tdesktop's `SerializeFrame`.

A comment that begins # type: is a PEP 484 type comment, so mypy parses the rest of the
line as a type expression, fails, and stops. It reports the one syntax error and checks
nothing else in the tree.

The change

The comment says the same thing, starting from a word instead of from type::

# A frame header is `type:u8 | stream_id:u24 (big-endian) | length:u32 (big-endian) |
#  payload`, laid out by tdesktop's `SerializeFrame`. It cannot start at `type:`, which
#  `mypy` reads as a `# type:` comment and refuses to parse.

No code changes. Afterwards:

Found 7492 errors in 1110 files (checked 4119 source files)

That number is what the annotations actually look like today, and it is a separate matter —
this only makes it visible.

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.

1 participant