mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2026-09-05 00:20:40 +00:00
[V2] Upgrade ruff and mypy version, format files (#4474)
This commit is contained in:
committed by
GitHub
parent
918f719ab2
commit
86d41e1f06
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Check formatting, type-check and run offline tests.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -15,9 +16,7 @@ def run(*args: str) -> int:
|
||||
def main() -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
exit(
|
||||
run("isort", ".", "-c", "--profile", "black", "--gitignore")
|
||||
or run("black", ".", "--check", "--extend-exclude", BLACK_IGNORE)
|
||||
or run("mypy", "--strict", ".")
|
||||
run("mypy", "--strict", ".")
|
||||
or run("ruff", "check", ".")
|
||||
or run("sphinx", "-M", "dummy", "client/doc", tmp_dir, "-n", "-W")
|
||||
or run("pytest", ".", "-m", "not net")
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Run `telethon_generator.codegen` on both `api.tl` and `mtproto.tl` to output
|
||||
corresponding Python code in the default directories under the `client/`.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
@@ -110,13 +110,13 @@ def main() -> None:
|
||||
function.args.args[0].annotation = None
|
||||
|
||||
if isinstance(function, ast.AsyncFunctionDef):
|
||||
call = ast.Await(value=call)
|
||||
call = ast.Await(value=call) # type: ignore [arg-type]
|
||||
|
||||
match function.returns:
|
||||
case ast.Constant(value=None):
|
||||
call = ast.Expr(value=call)
|
||||
call = ast.Expr(value=call) # type: ignore [arg-type]
|
||||
case _:
|
||||
call = ast.Return(value=call)
|
||||
call = ast.Return(value=call) # type: ignore [arg-type]
|
||||
|
||||
function.body.append(call)
|
||||
class_body.append(function)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Run `sphinx-build` to create HTML documentation and detect errors.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Sort imports and format code.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
Reference in New Issue
Block a user