Skip to content

Commit 18814d3

Browse files
authored
Upgrade black formatter (#262)
Update black formatter to 22.3.0
1 parent b36838f commit 18814d3

File tree

8 files changed

+23
-27
lines changed

8 files changed

+23
-27
lines changed

examples/application/vote_deploy.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,13 @@ def main():
401401
max_votes = 0
402402
max_votes_choice = None
403403
for key, value in global_state.items():
404-
if (
405-
key
406-
not in (
407-
"RegBegin",
408-
"RegEnd",
409-
"VoteBegin",
410-
"VoteEnd",
411-
"Creator",
412-
)
413-
and isinstance(value, int)
414-
):
404+
if key not in (
405+
"RegBegin",
406+
"RegEnd",
407+
"VoteBegin",
408+
"VoteEnd",
409+
"Creator",
410+
) and isinstance(value, int):
415411
if value > max_votes:
416412
max_votes = value
417413
max_votes_choice = key

pyteal/ast/int.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, value: int) -> None:
2323

2424
if type(value) is not int:
2525
raise TealInputError("invalid input type {} to Int".format(type(value)))
26-
elif value >= 0 and value < 2 ** 64:
26+
elif value >= 0 and value < 2**64:
2727
self.value = value
2828
else:
2929
raise TealInputError("Int {} is out of range".format(value))

pyteal/ast/int_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
def test_int():
12-
values = [0, 1, 8, 232323, 2 ** 64 - 1]
12+
values = [0, 1, 8, 232323, 2**64 - 1]
1313

1414
for value in values:
1515
expr = Int(value)
@@ -30,7 +30,7 @@ def test_int_invalid():
3030
Int(-1)
3131

3232
with pytest.raises(TealInputError):
33-
Int(2 ** 64)
33+
Int(2**64)
3434

3535
with pytest.raises(TealInputError):
3636
Int("0")

pyteal/ast/substring.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ def __getOp(self, options: "CompileOptions"):
3838
)
3939

4040
if l > 0 and options.version >= Op.extract.min_version:
41-
if s < 2 ** 8 and l < 2 ** 8:
41+
if s < 2**8 and l < 2**8:
4242
return Op.extract
4343
else:
4444
return Op.extract3
4545
else:
46-
if s < 2 ** 8 and e < 2 ** 8:
46+
if s < 2**8 and e < 2**8:
4747
return Op.substring
4848
else:
4949
return Op.substring3
@@ -124,7 +124,7 @@ def __init__(self, stringArg: Expr, startArg: Expr, lenArg: Expr) -> None:
124124
# helper method for correctly populating op
125125
def __getOp(self, options: "CompileOptions"):
126126
s, l = cast(Int, self.startArg).value, cast(Int, self.lenArg).value
127-
if s < 2 ** 8 and l > 0 and l < 2 ** 8:
127+
if s < 2**8 and l > 0 and l < 2**8:
128128
return Op.extract
129129
else:
130130
return Op.extract3
@@ -192,7 +192,7 @@ def __getOp(self, options: "CompileOptions"):
192192
return Op.substring3
193193

194194
s = cast(Int, self.startArg).value
195-
if s < 2 ** 8:
195+
if s < 2**8:
196196
return Op.extract
197197
else:
198198
return Op.substring3

pyteal/ast/unaryexpr_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def test_bsqrt():
376376

377377
def test_bsqrt_invalid():
378378
with pytest.raises(TealTypeError):
379-
BytesSqrt(Int(2 ** 64 - 1))
379+
BytesSqrt(Int(2**64 - 1))
380380

381381

382382
def test_b_zero():

pyteal/compiler/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def createConstantBlocks(ops: List[TealComponent]) -> List[TealComponent]:
158158
intBlock = [
159159
val
160160
for i, val in enumerate(sortedInts)
161-
if intFreqs[val] > 1 and (i < 4 or isinstance(val, str) or val >= 2 ** 7)
161+
if intFreqs[val] > 1 and (i < 4 or isinstance(val, str) or val >= 2**7)
162162
]
163163

164164
byteBlock = [

pyteal/compiler/constants_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -610,12 +610,12 @@ def test_createConstantBlocks_intc():
610610
TealOp(None, Op.int, 2),
611611
TealOp(None, Op.int, 3),
612612
TealOp(None, Op.int, 3),
613-
TealOp(None, Op.int, 2 ** 7),
614-
TealOp(None, Op.int, 2 ** 7),
613+
TealOp(None, Op.int, 2**7),
614+
TealOp(None, Op.int, 2**7),
615615
]
616616

617617
expected = [
618-
TealOp(None, Op.intcblock, 0, 1, 2, 3, 2 ** 7),
618+
TealOp(None, Op.intcblock, 0, 1, 2, 3, 2**7),
619619
TealOp(None, Op.intc_0, "//", 0),
620620
TealOp(None, Op.intc_0, "//", 0),
621621
TealOp(None, Op.intc_1, "//", 1),
@@ -624,8 +624,8 @@ def test_createConstantBlocks_intc():
624624
TealOp(None, Op.intc_2, "//", 2),
625625
TealOp(None, Op.intc_3, "//", 3),
626626
TealOp(None, Op.intc_3, "//", 3),
627-
TealOp(None, Op.intc, 4, "//", 2 ** 7),
628-
TealOp(None, Op.intc, 4, "//", 2 ** 7),
627+
TealOp(None, Op.intc, 4, "//", 2**7),
628+
TealOp(None, Op.intc, 4, "//", 2**7),
629629
]
630630

631631
actual = createConstantBlocks(ops)
@@ -637,7 +637,7 @@ def test_createConstantBlocks_small_constant():
637637
and it can be stored in one varuint it byte then Op.pushint is used.
638638
"""
639639

640-
for cur in range(4, 2 ** 7):
640+
for cur in range(4, 2**7):
641641
ops = [
642642
TealOp(None, Op.int, 0),
643643
TealOp(None, Op.int, 0),

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
black==21.7b0
1+
black==22.3.0
22
mypy==0.931
33
pytest
44
pytest-timeout

0 commit comments

Comments
 (0)