Current Path: > > lib64 > python2.7 > compiler
Operation : Linux premium107.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 198.54.126.246 | Your IP: 216.73.216.181 Domains : 1034 Domain(s) Permission : [ 0755 ]
| Name | Type | Size | Last Modified | Actions |
|---|---|---|---|---|
| __init__.py | File | 1023 bytes | April 10 2024 04:58:35. | |
| __init__.pyc | File | 1297 bytes | April 10 2024 04:58:46. | |
| __init__.pyo | File | 1297 bytes | April 10 2024 04:58:46. | |
| ast.py | File | 37508 bytes | April 10 2024 04:58:35. | |
| ast.pyc | File | 72125 bytes | April 10 2024 04:58:46. | |
| ast.pyo | File | 72125 bytes | April 10 2024 04:58:46. | |
| consts.py | File | 468 bytes | April 10 2024 04:58:35. | |
| consts.pyc | File | 737 bytes | April 10 2024 04:58:46. | |
| consts.pyo | File | 737 bytes | April 10 2024 04:58:46. | |
| future.py | File | 1893 bytes | April 10 2024 04:58:35. | |
| future.pyc | File | 2956 bytes | April 10 2024 04:58:46. | |
| future.pyo | File | 2956 bytes | April 10 2024 04:58:46. | |
| misc.py | File | 1794 bytes | April 10 2024 04:58:35. | |
| misc.pyc | File | 3733 bytes | April 10 2024 04:58:46. | |
| misc.pyo | File | 3733 bytes | April 10 2024 04:58:46. | |
| pyassem.py | File | 24268 bytes | April 10 2024 04:58:35. | |
| pyassem.pyc | File | 25951 bytes | April 10 2024 04:58:46. | |
| pyassem.pyo | File | 25377 bytes | April 10 2024 04:58:43. | |
| pycodegen.py | File | 47809 bytes | April 10 2024 04:58:35. | |
| pycodegen.pyc | File | 56515 bytes | April 10 2024 04:58:46. | |
| pycodegen.pyo | File | 56071 bytes | April 10 2024 04:58:43. | |
| symbols.py | File | 14489 bytes | April 10 2024 04:58:35. | |
| symbols.pyc | File | 17677 bytes | April 10 2024 04:58:46. | |
| symbols.pyo | File | 17643 bytes | April 10 2024 04:58:43. | |
| syntax.py | File | 1444 bytes | April 10 2024 04:58:35. | |
| syntax.pyc | File | 1882 bytes | April 10 2024 04:58:46. | |
| syntax.pyo | File | 1882 bytes | April 10 2024 04:58:46. | |
| transformer.py | File | 53116 bytes | April 10 2024 04:58:35. | |
| transformer.pyc | File | 47645 bytes | April 10 2024 04:58:46. | |
| transformer.pyo | File | 45830 bytes | April 10 2024 04:58:43. | |
| visitor.py | File | 3896 bytes | April 10 2024 04:58:35. | |
| visitor.pyc | File | 4187 bytes | April 10 2024 04:58:46. | |
| visitor.pyo | File | 4187 bytes | April 10 2024 04:58:46. |
"""Parser for future statements
"""
from compiler import ast, walk
def is_future(stmt):
"""Return true if statement is a well-formed future statement"""
if not isinstance(stmt, ast.From):
return 0
if stmt.modname == "__future__":
return 1
else:
return 0
class FutureParser:
features = ("nested_scopes", "generators", "division",
"absolute_import", "with_statement", "print_function",
"unicode_literals")
def __init__(self):
self.found = {} # set
def visitModule(self, node):
stmt = node.node
for s in stmt.nodes:
if not self.check_stmt(s):
break
def check_stmt(self, stmt):
if is_future(stmt):
for name, asname in stmt.names:
if name in self.features:
self.found[name] = 1
else:
raise SyntaxError, \
"future feature %s is not defined" % name
stmt.valid_future = 1
return 1
return 0
def get_features(self):
"""Return list of features enabled by future statements"""
return self.found.keys()
class BadFutureParser:
"""Check for invalid future statements"""
def visitFrom(self, node):
if hasattr(node, 'valid_future'):
return
if node.modname != "__future__":
return
raise SyntaxError, "invalid future statement " + repr(node)
def find_futures(node):
p1 = FutureParser()
p2 = BadFutureParser()
walk(node, p1)
walk(node, p2)
return p1.get_features()
if __name__ == "__main__":
import sys
from compiler import parseFile, walk
for file in sys.argv[1:]:
print file
tree = parseFile(file)
v = FutureParser()
walk(tree, v)
print v.found
print
SILENT KILLER Tool