Skip to content
This repository was archived by the owner on Feb 19, 2023. It is now read-only.

Commit 0a65e2f

Browse files
author
MarcoGorelli
committed
make other entry
1 parent d98037e commit 0a65e2f

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ci:
22
autofix_prs: false
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v3.4.0
5+
rev: v4.4.0
66
hooks:
77
- id: check-docstring-first
88
- id: check-yaml
@@ -12,36 +12,37 @@ repos:
1212
- id: requirements-txt-fixer
1313
- id: trailing-whitespace
1414
- repo: https://github.com/asottile/setup-cfg-fmt
15-
rev: v1.17.0
15+
rev: v2.2.0
1616
hooks:
1717
- id: setup-cfg-fmt
1818
- repo: https://github.com/PyCQA/flake8
19-
rev: 3.9.0
19+
rev: 6.0.0
2020
hooks:
2121
- id: flake8
22-
additional_dependencies: [flake8-typing-imports==1.7.0]
22+
additional_dependencies: [flake8-typing-imports==1.14.0]
2323
args: [--extend-ignore=E203]
2424
- repo: https://github.com/psf/black
25-
rev: 20.8b1
25+
rev: 22.12.0
2626
hooks:
2727
- id: black
2828
args: [--line-length, '79']
2929
- repo: https://github.com/PyCQA/isort
30-
rev: 5.8.0
30+
rev: 5.11.4
3131
hooks:
3232
- id: isort
3333
args: [--profile, black]
3434
- repo: https://github.com/asottile/add-trailing-comma
35-
rev: v2.1.0
35+
rev: v2.4.0
3636
hooks:
3737
- id: add-trailing-comma
38-
args: [--py37-plus]
38+
args: [--py36-plus]
3939
- repo: https://github.com/asottile/pyupgrade
40-
rev: v2.12.0
40+
rev: v3.3.1
4141
hooks:
4242
- id: pyupgrade
4343
args: [--py37-plus]
4444
- repo: https://github.com/pre-commit/mirrors-mypy
45-
rev: v0.812
45+
rev: v0.991
4646
hooks:
4747
- id: mypy
48+
additional_dependencies: [types-setuptools]

pandas_dev_flaker/__main__.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import ast
2-
from io import StringIO
1+
from __future__ import annotations
2+
33
import argparse
4+
import ast
45
import tokenize
5-
from typing import Iterator, Sequence, Tuple
6+
from io import StringIO
7+
from typing import Iterator, Sequence
68

79
import pkg_resources
810

@@ -17,7 +19,7 @@
1719
def run(
1820
tree: ast.Module,
1921
file_tokens: Sequence[tokenize.TokenInfo],
20-
) -> Iterator[Tuple[int, int, str, str]]:
22+
) -> Iterator[tuple[int, int, str, str]]:
2123
callbacks_tree = visit_tree(FUNCS_TREE, tree)
2224
if not callbacks_tree:
2325
return
@@ -34,8 +36,9 @@ def run(
3436
run.name = pkg_name # type: ignore
3537
run.version = pkg_version # type: ignore
3638

37-
def run_flaker(path):
38-
with open(path, encoding='utf-8') as fd:
39+
40+
def run_flaker(path: str) -> int: # pragma: no cover
41+
with open(path, encoding="utf-8") as fd:
3942
content = fd.read()
4043
try:
4144
tree = ast.parse(content)
@@ -49,26 +52,27 @@ def run_flaker(path):
4952
if not callbacks_tree:
5053
pass
5154
for line, col, msg in callbacks_tree:
52-
print(f'{path}:{line}:{col}: {msg}')
55+
print(f"{path}:{line}:{col}: {msg}")
5356
ret = 1
5457

5558
callbacks_tokens = visit_tokens(FUNCS_TOKENS, file_tokens)
5659
if not callbacks_tokens:
5760
pass
5861
for line, col, msg in callbacks_tokens:
59-
print(f'{path}:{line}:{col}: {msg}')
62+
print(f"{path}:{line}:{col}: {msg}")
6063
ret = 1
6164
return ret
6265

6366

64-
def main(argv = None):
67+
def main(argv: Sequence[str] | None = None) -> int: # pragma: no cover
6568
parser = argparse.ArgumentParser()
66-
parser.add_argument('paths', nargs='*')
69+
parser.add_argument("paths", nargs="*")
6770
args = parser.parse_args(argv)
6871
ret = 0
6972
for path in args.paths:
7073
ret |= run_flaker(path)
7174
return ret
7275

73-
if __name__ == '__main__':
76+
77+
if __name__ == "__main__":
7478
main()

0 commit comments

Comments
 (0)