Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
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
cpython
Commits
9f9fc68b
Kaydet (Commit)
9f9fc68b
authored
Agu 20, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
return sets instead of tuples from some symtable methods
üst
87069fd8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
13 deletions
+16
-13
symtable.rst
Doc/library/symtable.rst
+5
-5
symtable.py
Lib/symtable.py
+3
-3
test_symtable.py
Lib/test/test_symtable.py
+5
-5
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/symtable.rst
Dosyayı görüntüle @
9f9fc68b
...
...
@@ -95,19 +95,19 @@ Examining Symbol Tables
.. method:: get_parameters()
Return a
tuple
containing names of parameters to this function.
Return a
set
containing names of parameters to this function.
.. method:: get_locals()
Return a
tuple
containing names of locals in this function.
Return a
set
containing names of locals in this function.
.. method:: get_globals()
Return a
tuple
containing names of globals in this function.
Return a
set
containing names of globals in this function.
.. method:: get_frees()
Return a
tuple
containing names of free variables in this function.
Return a
set
containing names of free variables in this function.
.. class:: Class
...
...
@@ -116,7 +116,7 @@ Examining Symbol Tables
.. method:: get_methods()
Return a
tuple
containing the names of methods declared in the class.
Return a
set
containing the names of methods declared in the class.
.. class:: Symbol
...
...
Lib/symtable.py
Dosyayı görüntüle @
9f9fc68b
...
...
@@ -129,8 +129,8 @@ class Function(SymbolTable):
__globals
=
None
def
__idents_matching
(
self
,
test_func
):
return
tuple
([
ident
for
ident
in
self
.
get_identifiers
()
if
test_func
(
self
.
_table
.
symbols
[
ident
])]
)
return
frozenset
(
ident
for
ident
in
self
.
get_identifiers
()
if
test_func
(
self
.
_table
.
symbols
[
ident
])
)
def
get_parameters
(
self
):
if
self
.
__params
is
None
:
...
...
@@ -165,7 +165,7 @@ class Class(SymbolTable):
d
=
{}
for
st
in
self
.
_table
.
children
:
d
[
st
.
name
]
=
1
self
.
__methods
=
tuple
(
d
)
self
.
__methods
=
frozenset
(
d
)
return
self
.
__methods
...
...
Lib/test/test_symtable.py
Dosyayı görüntüle @
9f9fc68b
...
...
@@ -80,11 +80,11 @@ class SymtableTest(unittest.TestCase):
def
test_function_info
(
self
):
func
=
self
.
spam
self
.
assertEqual
(
func
.
get_parameters
(),
(
"a"
,
"b"
,
"kw"
,
"var"
)
)
self
.
assertEqual
(
func
.
get_parameters
(),
{
"a"
,
"b"
,
"kw"
,
"var"
}
)
self
.
assertEqual
(
func
.
get_locals
(),
(
"a"
,
"b"
,
"bar"
,
"glob"
,
"internal"
,
"kw"
,
"var"
,
"x"
)
)
self
.
assertEqual
(
func
.
get_globals
(),
(
"bar"
,
"glob"
)
)
self
.
assertEqual
(
self
.
internal
.
get_frees
(),
(
"x"
,)
)
{
"a"
,
"b"
,
"bar"
,
"glob"
,
"internal"
,
"kw"
,
"var"
,
"x"
}
)
self
.
assertEqual
(
func
.
get_globals
(),
{
"bar"
,
"glob"
}
)
self
.
assertEqual
(
self
.
internal
.
get_frees
(),
{
"x"
}
)
def
test_globals
(
self
):
self
.
assertTrue
(
self
.
spam
.
lookup
(
"glob"
)
.
is_global
())
...
...
@@ -142,7 +142,7 @@ class SymtableTest(unittest.TestCase):
self
.
assertEqual
(
self
.
Mine
.
get_name
(),
"Mine"
)
def
test_class_info
(
self
):
self
.
assertEqual
(
self
.
Mine
.
get_methods
(),
(
'a_method'
,)
)
self
.
assertEqual
(
self
.
Mine
.
get_methods
(),
{
'a_method'
}
)
def
test_filename_correct
(
self
):
### Bug tickler: SyntaxError file name correct whether error raised
...
...
Misc/NEWS
Dosyayı görüntüle @
9f9fc68b
...
...
@@ -249,6 +249,9 @@ Extension Modules
Library
-------
- symtable.Function's ``get_locals()``, ``get_globals()``, ``get_parameters()``,
and ``get_frees()`` and symtable.Class's ``get_methods()`` now return sets.
- The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of
symtable.Symbol have been removed.
...
...
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