diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-09-13 23:09:06 +0200 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2021-10-23 11:11:48 +0200 |
commit | a1d70afb5974125a1a65f590418c7c371bbdb3e6 (patch) | |
tree | 0f4d4ef4170e963aa6784a222e192d16ba753e21 /mako/ast.py | |
parent | 09cf4f68a7f7f63c2f249d61d7cc6600afe12c1a (diff) | |
download | mako-a1d70afb5974125a1a65f590418c7c371bbdb3e6.tar.gz |
Modernize codeworkflow_test_initial_1_2
- remove python 2 support
- add github workflows
- remove disable unicode
- cleanup compat file
- modernize setup
- use pep517
Change-Id: Ic38dbf478046cec5d0815b468f0c235b4ea5e20c
Diffstat (limited to 'mako/ast.py')
-rw-r--r-- | mako/ast.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/mako/ast.py b/mako/ast.py index cfae280..5e52e02 100644 --- a/mako/ast.py +++ b/mako/ast.py @@ -9,12 +9,11 @@ code, as well as generating Python from AST nodes""" import re -from mako import compat from mako import exceptions from mako import pyparser -class PythonCode(object): +class PythonCode: """represents information about a string containing Python code""" @@ -39,7 +38,7 @@ class PythonCode(object): # - AST is less likely to break with version changes # (for example, the behavior of co_names changed a little bit # in python version 2.5) - if isinstance(code, compat.string_types): + if isinstance(code, str): expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs) else: expr = code @@ -48,7 +47,7 @@ class PythonCode(object): f.visit(expr) -class ArgumentList(object): +class ArgumentList: """parses a fragment of code as a comma-separated list of expressions""" @@ -57,7 +56,7 @@ class ArgumentList(object): self.args = [] self.declared_identifiers = set() self.undeclared_identifiers = set() - if isinstance(code, compat.string_types): + if isinstance(code, str): if re.match(r"\S", code) and not re.match(r",\s*$", code): # if theres text and no trailing comma, insure its parsed # as a tuple by adding a trailing comma @@ -111,7 +110,7 @@ class PythonFragment(PythonCode): super(PythonFragment, self).__init__(code, **exception_kwargs) -class FunctionDecl(object): +class FunctionDecl: """function declaration""" |