mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 21:03:21 -07:00
Remove Python 2 handling code (#2098)
* Remove Python 2 update modal * Remove Python 2 handling code * Remove backports dependencies * Remove uses of future and __future__ * Fix import * Remove requirements * Update lib folder * Clean up imports and blank lines --------- Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
This commit is contained in:
parent
dcec1f6f5f
commit
de3393d62b
97 changed files with 7443 additions and 2917 deletions
|
@ -9,11 +9,11 @@ python-modernize licence: BSD (from python-modernize/LICENSE)
|
|||
"""
|
||||
|
||||
from lib2to3.fixer_util import (FromImport, Newline, is_import,
|
||||
find_root, does_tree_import, Comma)
|
||||
find_root, does_tree_import,
|
||||
Call, Name, Comma)
|
||||
from lib2to3.pytree import Leaf, Node
|
||||
from lib2to3.pygram import python_symbols as syms, python_grammar
|
||||
from lib2to3.pygram import python_symbols as syms
|
||||
from lib2to3.pygram import token
|
||||
from lib2to3.fixer_util import (Node, Call, Name, syms, Comma, Number)
|
||||
import re
|
||||
|
||||
|
||||
|
@ -116,7 +116,7 @@ def suitify(parent):
|
|||
"""
|
||||
for node in parent.children:
|
||||
if node.type == syms.suite:
|
||||
# already in the prefered format, do nothing
|
||||
# already in the preferred format, do nothing
|
||||
return
|
||||
|
||||
# One-liners have no suite node, we have to fake one up
|
||||
|
@ -390,6 +390,7 @@ def touch_import_top(package, name_to_import, node):
|
|||
break
|
||||
insert_pos = idx
|
||||
|
||||
children_hooks = []
|
||||
if package is None:
|
||||
import_ = Node(syms.import_name, [
|
||||
Leaf(token.NAME, u"import"),
|
||||
|
@ -413,8 +414,6 @@ def touch_import_top(package, name_to_import, node):
|
|||
]
|
||||
)
|
||||
children_hooks = [install_hooks, Newline()]
|
||||
else:
|
||||
children_hooks = []
|
||||
|
||||
# FromImport(package, [Leaf(token.NAME, name_to_import, prefix=u" ")])
|
||||
|
||||
|
@ -448,7 +447,6 @@ def check_future_import(node):
|
|||
else:
|
||||
node = node.children[3]
|
||||
# now node is the import_as_name[s]
|
||||
# print(python_grammar.number2symbol[node.type]) # breaks sometimes
|
||||
if node.type == syms.import_as_names:
|
||||
result = set()
|
||||
for n in node.children:
|
||||
|
|
|
@ -37,7 +37,7 @@ from lib2to3.fixer_util import Name, syms, Node, Leaf, touch_import, Call, \
|
|||
|
||||
def has_metaclass(parent):
|
||||
""" we have to check the cls_node without changing it.
|
||||
There are two possiblities:
|
||||
There are two possibilities:
|
||||
1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta')
|
||||
2) clsdef => simple_stmt => expr_stmt => Leaf('__meta')
|
||||
"""
|
||||
|
@ -63,7 +63,7 @@ def fixup_parse_tree(cls_node):
|
|||
# already in the preferred format, do nothing
|
||||
return
|
||||
|
||||
# !%@#! oneliners have no suite node, we have to fake one up
|
||||
# !%@#! one-liners have no suite node, we have to fake one up
|
||||
for i, node in enumerate(cls_node.children):
|
||||
if node.type == token.COLON:
|
||||
break
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue