Skip to content
Commits on Source (5)
Metadata-Version: 1.1
Name: typed-ast
Version: 1.1.1
Version: 1.2.0
Summary: a fork of Python 2 and 3 ast modules with type comment support
Home-page: https://github.com/python/typed_ast
Author: David Fisher
......@@ -23,4 +23,5 @@ Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development
......@@ -9,11 +9,11 @@ parser similar to the standard `ast` library. Unlike `ast`, the parsers in
comments and are independent of the version of Python under which they are run.
The `typed_ast` parsers produce the standard Python AST (plus type comments),
and are both fast and correct, as they are based on the CPython 2.7 and 3.6
parsers. `typed_ast` runs on Python 3.3-3.6 on Linux, OS X and Windows.
parsers. `typed_ast` runs on Python 3.3-3.7 on Linux, OS X and Windows.
## Development Philosophy
This project is a drop-in replacement for the builtin `ast` module. It is
This project is a (mostly) drop-in replacement for the builtin `ast` module. It is
intended to be bug-for-bug compatible and behave identically, except for the
presence of a few additional fields on the returned classes and a few
additional optional arguments to the `parse` call. Therefore, `typed_ast` will
......@@ -22,9 +22,22 @@ instead. To avoid feature bloat, any new features for `typed_ast` should have
the potential to be broadly useful and not be built just for one niche usecase
or in a manner such that only one project can use them.
### Incompatabilities
For the purposes of *consuming* syntax trees, this should be a drop-in replacement.
It is not a drop-in replacement for users that wish to create or transform ASTs,
as a number of syntax tree classes have additional fields that must be populated
when constructing them.
### Python 3.7
`typed_ast` has not yet been updated to be based on the Python 3.7
parser. The main consequence of this that `await` and `async` are
not treated as keywords.
## Submodules
### ast3
The `ast3` parser produces the AST from the latest version of Python 3
The `ast3` parser produces the AST from a recent version of Python 3
(currently Python 3.6). When new versions of Python 3 are released, it will be
updated to match any changes in their AST. (For rationale and technical
details, see [here](update_process.md).) The AST it currently produces is described in
......
python3-typed-ast (1.2.0-1) unstable; urgency=medium
* New upstream version
-- Michael R. Crusoe <michael.crusoe@gmail.com> Thu, 17 Jan 2019 01:01:44 -0800
python3-typed-ast (1.1.1-1) unstable; urgency=medium
* New upstream version
......
......@@ -9,18 +9,17 @@ Build-Depends: debhelper (>= 11~),
python3-all,
python3-setuptools,
python3-all-dev
Standards-Version: 4.2.1
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/med-team/python3-typed-ast
Vcs-Git: https://salsa.debian.org/med-team/python3-typed-ast.git
Homepage: http://www.mypy-lang.org/
Package: python3-typed-ast
Architecture: any
X-Python3-Version: ${python3:Versions}
Provides: ${python3:Provides}
Depends: ${python3:Depends},
${misc:Depends},
${shlibs:Depends}
Provides: ${python3:Provides}
Description: AST with PEP 484 type comments support
A fork of the CPython 2.7 and 3.5 ast modules with the ability to parse
PEP 484 type comments. The primary goals of this package are correctness and
......
......@@ -113,6 +113,7 @@ setup (name = 'typed-ast',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development',
],
packages = ['typed_ast'],
......
Metadata-Version: 1.1
Name: typed-ast
Version: 1.1.1
Version: 1.2.0
Summary: a fork of Python 2 and 3 ast modules with type comment support
Home-page: https://github.com/python/typed_ast
Author: David Fisher
......@@ -23,4 +23,5 @@ Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development
__version__ = "1.1.1"
__version__ = "1.2.0"
......@@ -283,7 +283,7 @@ class NodeTransformer(NodeVisitor):
def visit_Name(self, node):
return copy_location(Subscript(
value=Name(id='data', ctx=Load()),
slice=Index(value=Str(s=node.id)),
slice=Index(value=Str(s=node.id, kind='')),
ctx=node.ctx
), node)
......
......@@ -53,8 +53,8 @@ def parse(source, filename='<unknown>', mode='exec', feature_version=LATEST_MINO
fully supported for Python 3.5+ with partial support for Python 3.4.
So, feature_version=3 or less are all equivalent to feature_version=4.
When feature_version=4, the parser will forbid the use of the async/await
keywords and the '@' operator, but will not forbid the use of PEP 448
When feature_version=4, the parser will forbid the use of the async/await
keywords and the '@' operator, but will not forbid the use of PEP 448
additional unpacking generalizations, which were also added in Python 3.5.
"""
return _ast3._parse(source, filename, mode, feature_version)
......@@ -306,7 +306,7 @@ class NodeTransformer(NodeVisitor):
def visit_Name(self, node):
return copy_location(Subscript(
value=Name(id='data', ctx=Load()),
slice=Index(value=Str(s=node.id)),
slice=Index(value=Str(s=node.id, kind='')),
ctx=node.ctx
), node)
......
......@@ -106,7 +106,8 @@ class _AST2To3(ast27.NodeTransformer):
keywords.append(ast3.keyword("file", self.visit(n.dest)))
if not n.nl:
keywords.append(ast3.keyword("end", ast3.Str(" ", lineno=n.lineno, col_offset=-1)))
keywords.append(ast3.keyword("end",
ast3.Str(s=" ", kind='', lineno=n.lineno, col_offset=-1)))
return ast3.Expr(ast3.Call(ast3.Name("print", ast3.Load(), lineno=n.lineno, col_offset=-1),
self.visit(n.values),
......@@ -218,7 +219,7 @@ class _AST2To3(ast27.NodeTransformer):
if isinstance(s.s, bytes):
return ast3.Bytes(s.s)
else:
return ast3.Str(s.s)
return ast3.Str(s.s, s.kind)
def visit_Num(self, n):
new = self.generic_visit(n)
......