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
a40ff6df
Kaydet (Commit)
a40ff6df
authored
Ara 09, 2013
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More cleanup and use modern Python idioms.
üst
b31b9769
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
misc.py
astor/misc.py
+6
-7
treewalk.py
astor/treewalk.py
+1
-1
No files found.
astor/misc.py
Dosyayı görüntüle @
a40ff6df
...
@@ -144,7 +144,7 @@ class ExplicitNodeVisitor(ast.NodeVisitor):
...
@@ -144,7 +144,7 @@ class ExplicitNodeVisitor(ast.NodeVisitor):
"""
"""
def
abort_visit
(
node
):
def
abort_visit
(
node
):
# XXX: self?
msg
=
'No defined handler for node of type
%
s'
msg
=
'No defined handler for node of type
%
s'
raise
AttributeError
(
msg
%
node
.
__class__
.
__name__
)
raise
AttributeError
(
msg
%
node
.
__class__
.
__name__
)
...
@@ -156,9 +156,8 @@ class ExplicitNodeVisitor(ast.NodeVisitor):
...
@@ -156,9 +156,8 @@ class ExplicitNodeVisitor(ast.NodeVisitor):
def
parsefile
(
fname
):
def
parsefile
(
fname
):
f
=
open
(
fname
,
'r'
)
with
open
(
fname
,
'r'
)
as
f
:
fstr
=
f
.
read
()
fstr
=
f
.
read
()
f
.
close
()
fstr
=
fstr
.
replace
(
'
\r\n
'
,
'
\n
'
)
.
replace
(
'
\r
'
,
'
\n
'
)
fstr
=
fstr
.
replace
(
'
\r\n
'
,
'
\n
'
)
.
replace
(
'
\r
'
,
'
\n
'
)
if
not
fstr
.
endswith
(
'
\n
'
):
if
not
fstr
.
endswith
(
'
\n
'
):
fstr
+=
'
\n
'
fstr
+=
'
\n
'
...
@@ -172,8 +171,8 @@ class CodeToAst(object):
...
@@ -172,8 +171,8 @@ class CodeToAst(object):
number of compiles.
number of compiles.
"""
"""
def
__init__
(
self
,
cache
):
def
__init__
(
self
,
cache
=
None
):
self
.
cache
=
cache
self
.
cache
=
cache
or
{}
def
__call__
(
self
,
codeobj
):
def
__call__
(
self
,
codeobj
):
cache
=
self
.
cache
cache
=
self
.
cache
...
@@ -195,4 +194,4 @@ class CodeToAst(object):
...
@@ -195,4 +194,4 @@ class CodeToAst(object):
cache
[(
fname
,
obj
.
lineno
)]
=
obj
cache
[(
fname
,
obj
.
lineno
)]
=
obj
return
cache
[
key
]
return
cache
[
key
]
codetoast
=
CodeToAst
(
{}
)
codetoast
=
CodeToAst
()
astor/treewalk.py
Dosyayı görüntüle @
a40ff6df
...
@@ -57,7 +57,7 @@ class TreeWalk(MetaFlatten):
...
@@ -57,7 +57,7 @@ class TreeWalk(MetaFlatten):
"""
"""
nodestack
=
None
nodestack
=
None
def
__init__
(
self
,
node
=
None
,
name
=
''
):
def
__init__
(
self
,
node
=
None
):
self
.
setup
()
self
.
setup
()
if
node
is
not
None
:
if
node
is
not
None
:
self
.
walk
(
node
)
self
.
walk
(
node
)
...
...
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