Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
dakk committed Nov 16, 2023
1 parent d19501a commit 9cfccc2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 8 additions & 6 deletions qlasskit/ast2ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _replace_types_annotations(ann, arg=None):

class ASTRewriter(ast.NodeTransformer):
"""Rewrites the ast to a simplified version"""

def __init__(self, env={}, ret=None):
self.env = {}
self.const = {}
Expand Down Expand Up @@ -111,13 +111,15 @@ def visit_Subscript(self, node):

if isinstance(_sval, ast.Name) and _sval.id in self.const:
node.slice = self.const[_sval.id]

# Unroll L[a] with (L[0] if a == 0 else L[1] if a == 1 ...)
elif (isinstance(_sval, ast.Name) and _sval.id not in self.const) or isinstance(_sval, ast.Subscript):
elif (isinstance(_sval, ast.Name) and _sval.id not in self.const) or isinstance(
_sval, ast.Subscript
):
if isinstance(node.value, ast.Name):
if node.value.id == 'Tuple':
return node
if node.value.id == "Tuple":
return node

tup = self.env[node.value.id]
else:
tup = node.value
Expand Down
4 changes: 3 additions & 1 deletion qlasskit/types/qint.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ def bitwise_or(cls, tleft: TExp, tright: TExp) -> TExp:
class Qint2(Qint):
BIT_SIZE = 2


class Qint3(Qint):
BIT_SIZE = 3



class Qint4(Qint):
BIT_SIZE = 4

Expand Down

0 comments on commit 9cfccc2

Please sign in to comment.