Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
A
astor
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
astor
Commits
13488e65
Kaydet (Commit)
13488e65
authored
Eki 31, 2017
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Cleanup and cosmetic fixes
üst
074191c3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
73 deletions
+3
-73
__init__.py
astor/__init__.py
+1
-7
rtrip.py
astor/rtrip.py
+1
-65
tree_walk.py
astor/tree_walk.py
+1
-1
No files found.
astor/__init__.py
Dosyayı görüntüle @
13488e65
...
...
@@ -23,16 +23,10 @@ __version__ = '0.6'
# DEPRECATED!!!
# These aliases support old programs. Please do not use in future.
# NOTE: We should think hard about what we want to export,
# and not just dump everything here. Some things
# will never be used by other packages, and other
# things could be accessed from their submodule.
deprecated
=
"""
get_boolop = get_binop = get_cmpop = get_unaryop = get_op_symbol
# NOQA
get_boolop = get_binop = get_cmpop = get_unaryop = get_op_symbol
get_anyop = get_op_symbol
parsefile = code_to_ast.parse_file
codetoast = code_to_ast
...
...
astor/rtrip.py
Dosyayı görüntüle @
13488e65
...
...
@@ -6,68 +6,6 @@ Part of the astor library for Python AST manipulation.
License: 3-clause BSD
Copyright (c) 2015 Patrick Maupin
Usage:
python -m astor.rtrip [readonly] [<source>]
This utility tests round-tripping of Python source to AST
and back to source.
.. versionadded:: 0.6
If readonly is specified, then the source will be tested,
but no files will be written.
if the source is specified to be "stdin" (without quotes)
then any source entered at the command line will be compiled
into an AST, converted back to text, and then compiled to
an AST again, and the results will be displayed to stdout.
If neither readonly nor stdin is specified, then rtrip
will create a mirror directory named tmp_rtrip and will
recursively round-trip all the Python source from the source
into the tmp_rtrip dir, after compiling it and then reconstituting
it through code_gen.to_source.
If the source is not specified, the entire Python library will be used.
The purpose of rtrip is to place Python code into a canonical form.
This is useful both for functional testing of astor, and for
validating code edits.
For example, if you make manual edits for PEP8 compliance,
you can diff the rtrip output of the original code against
the rtrip output of the edited code, to insure that you
didn't make any functional changes.
For testing astor itself, it is useful to point to a big codebase,
e.g::
python -m astor.rtrip
to roundtrip the standard library.
If any round-tripped files fail to be built or to match, the
tmp_rtrip directory will also contain fname.srcdmp and fname.dstdmp,
which are textual representations of the ASTs.
Note 1:
The canonical form is only canonical for a given version of
this module and the astor toolbox. It is not guaranteed to
be stable. The only desired guarantee is that two source modules
that parse to the same AST will be converted back into the same
canonical form.
Note 2:
This tool WILL TRASH the tmp_rtrip directory (unless readonly
is specified) -- as far as it is concerned, it OWNS that directory.
Note 3: Why is it "readonly" and not "-r"? Because python -m slurps
all the thingies starting with the dash.
"""
import
sys
...
...
@@ -115,8 +53,6 @@ def convert(srctree, dsttree=dsttree, readonly=False, dumpall=False,
unknown_dst_nodes
=
set
()
badfiles
=
set
()
broken
=
[]
# TODO: When issue #26 resolved, remove UnicodeDecodeError
handled_exceptions
=
SyntaxError
,
UnicodeDecodeError
oldpath
=
None
...
...
@@ -139,7 +75,7 @@ def convert(srctree, dsttree=dsttree, readonly=False, dumpall=False,
logging
.
info
(
'Converting
%
s'
%
srcfname
)
try
:
srcast
=
parse_file
(
srcfname
)
except
handled_exceptions
:
except
SyntaxError
:
badfiles
.
add
(
srcfname
)
continue
...
...
astor/tree_walk.py
Dosyayı görüntüle @
13488e65
...
...
@@ -34,7 +34,7 @@ class MetaFlatten(type):
return
type
.
__new__
(
clstype
,
name
,
newbases
,
newdict
)
MetaFlatten
=
MetaFlatten
(
'MetaFlatten'
,
(
object
,
),
{})
MetaFlatten
=
MetaFlatten
(
'MetaFlatten'
,
(
object
,),
{})
class
TreeWalk
(
MetaFlatten
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment