-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
+package preface | ||
+alias xfakeclasses preface.xfakeclasses | ||
|
||
[] > xtuple | ||
xfakeclasses.pyTupleClass > @ | ||
|
9 changes: 7 additions & 2 deletions
9
...er/src/main/scala/org/polystat/py2eo/transpiler/AddExplicitConstructionOfCollection.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...ler/src/main/scala/org/polystat/py2eo/transpiler/SimplifyAssignmentToCollectionCons.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.polystat.py2eo.transpiler | ||
|
||
import org.polystat.py2eo.parser.Expression.{CallIndex, CollectionCons, Field, Ident} | ||
import org.polystat.py2eo.parser.Statement | ||
import org.polystat.py2eo.parser.Statement.{Assign, Suite} | ||
import org.polystat.py2eo.transpiler.GenericStatementPasses.NamesU | ||
|
||
object SimplifyAssignmentToCollectionCons { | ||
def apply(s : Statement.T, ns : NamesU) : (Statement.T, NamesU) = s match { | ||
case Assign(List(CollectionCons(_, lhs, _), rhs), ann) => | ||
val (iter, ns1) = ns("it") | ||
val iterID = Ident(iter, ann.pos) | ||
val extractIter = Assign(List( | ||
iterID, | ||
CallIndex(true, Field(rhs, "__iter__", ann.pos), List(), ann.pos) | ||
), ann.pos) | ||
val assignments = lhs.map(lhs => | ||
Assign(List(lhs, CallIndex(true, Field(iterID, "__next__", ann.pos), List(), ann.pos)), ann.pos) | ||
) | ||
( | ||
Suite((extractIter :: assignments), ann.pos), | ||
ns1 | ||
) | ||
case _ => (s, ns) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...tat/py2eo/transpiler/simple-tests/simple-statements/annotated-assignment/annotated-3.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
enabled: False | ||
enabled: True | ||
python: | | ||
def test(): | ||
a: int;b: int;c: int | ||
a,b,c = range(3) | ||
print(a,b,c) #As output 0 1 2 | ||
return len((a, b, c)) == 3 and (a, b, c).__class__ is tuple |
1de4f85
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to retrieve PDD puzzles from the code base and submit them to github. If you think that it's a bug on our side, please submit it to yegor256/0pdd:
Please, copy and paste this stack trace to GitHub: