Skip to content

Commit b1c27ee

Browse files
committed
Misc lint
1 parent d855d66 commit b1c27ee

File tree

6 files changed

+26
-33
lines changed

6 files changed

+26
-33
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ pytest:
6868

6969
#: Clean up temporary files and .pyc files
7070
clean: clean_pyc
71-
$(PYTHON) ./setup.py $@
72-
(cd test && $(MAKE) clean)
7371

7472
#: Create source (tarball) and wheel distribution
7573
dist: distcheck

uncompyle6/__init__.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2015, 2018, 2021-2022 by Rocky Bernstein
2+
Copyright (c) 2015, 2018, 2021-2022, 2025 by Rocky Bernstein
33
Copyright (c) 2000 by hartmut Goebel <h.goebel@crazy-compilers.com>
44
Copyright (c) 1999 John Aycock
55
@@ -30,26 +30,23 @@
3030

3131
__docformat__ = "restructuredtext"
3232

33-
# from uncompyle6.version import __version__ # noqa
33+
from uncompyle6.version import __version__ # noqa
3434

35-
# if hasattr(sys, "setrecursionlimit"):
36-
# # pyston doesn't have setrecursionlimit
37-
# sys.setrecursionlimit(5000)
35+
if hasattr(sys, "setrecursionlimit"):
36+
# pyston doesn't have setrecursionlimit
37+
sys.setrecursionlimit(5000)
3838

39-
# from uncompyle6.semantics import semantics
39+
# Export some functions
40+
from uncompyle6.main import decompile_file # noqa
41+
from uncompyle6.semantics.pysource import code_deparse, deparse_code2str
4042

41-
# # Export some functions
42-
# from uncompyle6.main import decompile_file # noqa
43+
# Convenience functions so you can say:
44+
# from uncompyle6 import (code_deparse, deparse_code2str)
4345

44-
# # Convenience functions so you can say:
45-
# # from uncompyle6 import (code_deparse, deparse_code2str)
4646

47-
# from uncompyle6.semantics.pysource import code_deparse, deparse_code2str
48-
49-
# # __all__ = [
50-
# # "__version__",
51-
# # "code_deparse",
52-
# # "decompile_file",
53-
# # "deparse_code2str",
54-
# # "semantics",
55-
# # ]
47+
__all__ = [
48+
"__version__",
49+
"code_deparse",
50+
"decompile_file",
51+
"deparse_code2str",
52+
]

uncompyle6/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2018-2024 Rocky Bernstein <rocky@gnu.org>
1+
# Copyright (C) 2018-2025 Rocky Bernstein <rocky@gnu.org>
22
#
33
# This program is free software: you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by

uncompyle6/parsers/reducecheck/and_not_check.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
# Copyright (c) 2020 Rocky Bernstein
1+
# Copyright (c) 2020, 2025 Rocky Bernstein
22

33

4-
def and_not_check(
5-
self, lhs, n, rule, ast, tokens, first, last
6-
) -> bool:
4+
def and_not_check(self, lhs, n, rule, ast, tokens: list, first: int, last: int) -> bool:
75
jmp = ast[1]
86
if jmp.kind.startswith("jmp_"):
97
if last == n:

uncompyle6/parsers/reducecheck/except_handler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Copyright (c) 2020 Rocky Bernstein
1+
# Copyright (c) 2020, 2025 Rocky Bernstein
22

33

4-
def except_handler(self, lhs, n, rule, ast, tokens, first, last):
4+
def except_handler(self, lhs, n: int, rule, ast, tokens: list, first: int, last: int):
55
end_token = tokens[last - 1]
66

77
# print("XXX", first, last)
@@ -15,6 +15,6 @@ def except_handler(self, lhs, n, rule, ast, tokens, first, last):
1515
return False
1616

1717
# Make sure COME_FROMs froms come from within "except_handler".
18-
if end_token != "COME_FROM":
18+
if end_token.kind != "COME_FROM":
1919
return False
20-
return end_token.attr < tokens[first].offset
20+
return end_token.attr is not None and end_token.attr < tokens[first].offset

uncompyle6/scanners/tok.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2016-2021, 2023-2024 by Rocky Bernstein
1+
# Copyright (c) 2016-2021, 2023-2025 by Rocky Bernstein
22
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
33
# Copyright (c) 1999 John Aycock
44
#
@@ -17,9 +17,9 @@
1717

1818
import re
1919
import sys
20+
from typing import Optional, Union
2021

2122
intern = sys.intern
22-
from typing import Union
2323

2424

2525
def off2int(offset, prefer_last=True):
@@ -71,7 +71,7 @@ def __init__(
7171
):
7272
self.kind = intern(opname)
7373
self.has_arg = has_arg
74-
self.attr = attr
74+
self.attr: Optional[int] = attr
7575
self.pattr = pattr
7676
self.optype = optype
7777
if has_extended_arg:

0 commit comments

Comments
 (0)