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
331e3459
Kaydet (Commit)
331e3459
authored
May 16, 2019
tarafından
Batuhan Taşkaya
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Implement PEP570
üst
1f357418
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
2 deletions
+32
-2
code_gen.py
astor/code_gen.py
+9
-2
changelog.rst
docs/changelog.rst
+6
-0
test_code_gen.py
tests/test_code_gen.py
+17
-0
No files found.
astor/code_gen.py
Dosyayı görüntüle @
331e3459
...
@@ -240,8 +240,15 @@ class SourceGenerator(ExplicitNodeVisitor):
...
@@ -240,8 +240,15 @@ class SourceGenerator(ExplicitNodeVisitor):
self
.
write
(
write_comma
,
arg
)
self
.
write
(
write_comma
,
arg
)
self
.
conditional_write
(
'='
,
default
)
self
.
conditional_write
(
'='
,
default
)
loop_args
(
node
.
args
,
node
.
defaults
)
posonlyargs
=
getattr
(
node
,
"posonlyargs"
,
[])
self
.
conditional_write
(
write_comma
,
'*'
,
node
.
vararg
)
offset
=
0
if
posonlyargs
:
offset
+=
len
(
node
.
defaults
)
-
len
(
node
.
args
)
loop_args
(
posonlyargs
,
node
.
defaults
[:
offset
])
self
.
write
(
write_comma
,
"/"
)
loop_args
(
node
.
args
,
node
.
defaults
[
offset
:])
self
.
conditional_write
(
write_comma
,
"*"
,
node
.
vararg
)
kwonlyargs
=
self
.
get_kwonlyargs
(
node
)
kwonlyargs
=
self
.
get_kwonlyargs
(
node
)
if
kwonlyargs
:
if
kwonlyargs
:
...
...
docs/changelog.rst
Dosyayı görüntüle @
331e3459
...
@@ -27,6 +27,12 @@ New features
...
@@ -27,6 +27,12 @@ New features
.. _`Issue 138`: https://github.com/berkerpeksag/astor/issues/138
.. _`Issue 138`: https://github.com/berkerpeksag/astor/issues/138
.. _`PR 139`: https://github.com/berkerpeksag/astor/pull/139
.. _`PR 139`: https://github.com/berkerpeksag/astor/pull/139
* Support Python3.8's positional only arguments.
(Reported and fixed by Batuhan Taskaya in `Issue 142`_ and `PR 143`_.)
.. _`Issue 138`: https://github.com/berkerpeksag/astor/issues/142
.. _`PR 139`: https://github.com/berkerpeksag/astor/pull/143
Bug fixes
Bug fixes
~~~~~~~~~
~~~~~~~~~
...
...
tests/test_code_gen.py
Dosyayı görüntüle @
331e3459
...
@@ -164,6 +164,23 @@ class CodegenTestCase(unittest.TestCase, Comparisons):
...
@@ -164,6 +164,23 @@ class CodegenTestCase(unittest.TestCase, Comparisons):
pass"""
pass"""
self
.
assertSrcRoundtrips
(
source
)
self
.
assertSrcRoundtrips
(
source
)
@unittest.skipUnless
(
sys
.
version_info
>=
(
3
,
8
,
0
,
"alpha"
,
4
),
"positional only arguments introduced in Python 3.8"
)
def
test_pos_only_arguments
(
self
):
source
=
"""
def test(a, b, /, c, *, d, **kwargs):
pass
def test(a=3, b=4, /, c=7):
pass
def test(a, b=4, /, c=8, d=9):
pass
"""
self
.
assertSrcRoundtrips
(
source
)
def
test_pass_arguments_node
(
self
):
def
test_pass_arguments_node
(
self
):
source
=
canonical
(
"""
source
=
canonical
(
"""
j = [1, 2, 3]
j = [1, 2, 3]
...
...
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