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
919a45d5
Kaydet (Commit)
919a45d5
authored
Nis 13, 2015
tarafından
Zack M. Davis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
adds support for Python 3.5 infix matrix multiplication
üst
0d5faf3a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
misc.py
astor/misc.py
+8
-2
setup.py
setup.py
+1
-0
test_misc.py
tests/test_misc.py
+22
-0
No files found.
astor/misc.py
Dosyayı görüntüle @
919a45d5
...
@@ -10,6 +10,7 @@ Copyright 2013 (c) Berker Peksag
...
@@ -10,6 +10,7 @@ Copyright 2013 (c) Berker Peksag
"""
"""
import
ast
import
ast
import
sys
class
NonExistent
(
object
):
class
NonExistent
(
object
):
...
@@ -118,13 +119,18 @@ get_boolop = _getsymbol("""
...
@@ -118,13 +119,18 @@ get_boolop = _getsymbol("""
And and Or or
And and Or or
"""
,
all_symbols
)
"""
,
all_symbols
)
get_binop
=
_getsymbol
(
"""
binops
=
"""
Add + Mult * LShift << BitAnd &
Add + Mult * LShift << BitAnd &
Sub - Div / RShift >> BitOr |
Sub - Div / RShift >> BitOr |
Mod
%
BitXor ^
Mod
%
BitXor ^
FloorDiv //
FloorDiv //
Pow **
Pow **
"""
,
all_symbols
)
"""
if
sys
.
version_info
>=
(
3
,
5
):
binops
+=
"MatMult @"
get_binop
=
_getsymbol
(
binops
,
all_symbols
)
get_cmpop
=
_getsymbol
(
"""
get_cmpop
=
_getsymbol
(
"""
Eq == Gt > GtE >= In in Is is
Eq == Gt > GtE >= In in Is is
...
...
setup.py
Dosyayı görüntüle @
919a45d5
...
@@ -30,6 +30,7 @@ setup(
...
@@ -30,6 +30,7 @@ setup(
'Programming Language :: Python :: 3.2'
,
'Programming Language :: Python :: 3.2'
,
'Programming Language :: Python :: 3.3'
,
'Programming Language :: Python :: 3.3'
,
'Programming Language :: Python :: 3.4'
,
'Programming Language :: Python :: 3.4'
,
'Programming Language :: Python :: 3.5'
,
'Programming Language :: Python :: Implementation'
,
'Programming Language :: Python :: Implementation'
,
'Programming Language :: Python :: Implementation :: CPython'
,
'Programming Language :: Python :: Implementation :: CPython'
,
'Programming Language :: Python :: Implementation :: PyPy'
,
'Programming Language :: Python :: Implementation :: PyPy'
,
...
...
tests/test_misc.py
0 → 100644
Dosyayı görüntüle @
919a45d5
import
ast
import
unittest
import
sys
import
astor
class
GetSymbolTestCase
(
unittest
.
TestCase
):
def
test_get_mat_mult
(
self
):
if
sys
.
version_info
<
(
2
,
7
):
# We can't use `@unittest.skipIf` or `raise skipTest` in
# Python 2.6
pass
elif
sys
.
version_info
<
(
3
,
5
):
raise
unittest
.
SkipTest
(
"ast.MatMult introduced in Python 3.5"
)
else
:
self
.
assertEqual
(
'@'
,
astor
.
misc
.
get_binop
(
ast
.
MatMult
()))
if
__name__
==
'__main__'
:
unittest
.
main
()
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