Skip to content

Commit 75948ed

Browse files
format with latest black
1 parent 7c48bb7 commit 75948ed

10 files changed

Lines changed: 0 additions & 23 deletions

File tree

src/bytecode/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def format_bytecode(
5252
*,
5353
lineno: bool = False,
5454
) -> str:
55-
5655
try_begins: List[TryBegin] = []
5756

5857
def format_line(index, line):
@@ -87,7 +86,6 @@ def format_instr(instr, labels=None):
8786
return text
8887

8988
def format_try_begin(instr: TryBegin, labels: dict) -> str:
90-
9189
if isinstance(instr.target, Label):
9290
try:
9391
arg = "<%s>" % labels[instr.target]

src/bytecode/cfg.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ def run(self) -> Generator[Union["_StackSizeComputer", int], int, None]:
278278
# an extra object on the stack.
279279

280280
for i, instr in enumerate(self.block):
281-
282281
# Ignore SetLineno
283282
if isinstance(instr, (SetLineno)):
284283
continue
@@ -384,7 +383,6 @@ def run(self) -> Generator[Union["_StackSizeComputer", int], int, None]:
384383
# Instruction is final (return, raise, ...) so any following instruction
385384
# in the block is dead code.
386385
if instr.is_final():
387-
388386
# Check for TryEnd after the final instruction which is possible
389387
# TryEnd being only pseudo instructions.
390388
if te := self.block.get_trailing_try_end(i):
@@ -781,7 +779,6 @@ def from_bytecode(bytecode: _bytecode.Bytecode) -> "ControlFlowGraph":
781779
try_begin_inserted_in_block = False
782780
last_instr: Optional[Instr] = None
783781
for index, instr in enumerate(bytecode):
784-
785782
# Reference to the current block if we create a new one in the following.
786783
old_block: BasicBlock | None = None
787784

@@ -829,7 +826,6 @@ def from_bytecode(bytecode: _bytecode.Bytecode) -> "ControlFlowGraph":
829826
try_begin_inserted_in_block = False
830827

831828
if old_block is not None and last_instr is not None:
832-
833829
# The last instruction is final, if the current instruction is a
834830
# TryEnd insert it in the same block and move to the next instruction
835831
if last_instr.is_final() and isinstance(instr, TryEnd):
@@ -842,7 +838,6 @@ def from_bytecode(bytecode: _bytecode.Bytecode) -> "ControlFlowGraph":
842838

843839
# If we have an active TryBegin and last_instr is:
844840
elif active_try_begin is not None:
845-
846841
# - a jump whose target is beyond the TryEnd of the active
847842
# TryBegin: we remember TryEnd should be prepended to the
848843
# target block.

src/bytecode/concrete.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ def __repr__(self) -> str:
220220

221221

222222
class ConcreteBytecode(_bytecode._BaseBytecodeList[Union[ConcreteInstr, SetLineno]]):
223-
224223
#: List of "constant" objects for the bytecode
225224
consts: List
226225

@@ -297,7 +296,6 @@ def __eq__(self, other: Any) -> bool:
297296
def from_code(
298297
code: types.CodeType, *, extended_arg: bool = False
299298
) -> "ConcreteBytecode":
300-
301299
instructions: MutableSequence[Union[SetLineno, ConcreteInstr]]
302300
# For Python 3.11+ we use dis to extract the detailed location information at
303301
# reduced maintenance cost.
@@ -470,7 +468,6 @@ def _pack_linetable(
470468
# then use as many 254 offset with no line change to reduce the offset to
471469
# less than 254.
472470
if doff > 254:
473-
474471
linetable.append(struct.pack("Bb", 254, dlineno))
475472
doff -= 254
476473

@@ -692,7 +689,6 @@ def _assemble_locations(
692689

693690
# We track the last set lineno to be able to compute deltas
694691
for _, i_size, new_lineno, location in iter_in:
695-
696692
# Infer the line if location is None
697693
location = location or InstrLocation(new_lineno, None, None, None)
698694

@@ -1066,7 +1062,6 @@ def to_bytecode(
10661062

10671063

10681064
class _ConvertBytecodeToConcrete:
1069-
10701065
# XXX document attributes
10711066

10721067
#: Default number of passes of compute_jumps() before giving up. Refer to
@@ -1117,7 +1112,6 @@ def concrete_instructions(self) -> None:
11171112
free_instrs: List[int] = []
11181113

11191114
for instr in self.bytecode:
1120-
11211115
# Enforce proper use of CACHE opcode on Python 3.11+ by checking we get the
11221116
# number we expect or directly generate the needed ones.
11231117
if isinstance(instr, Instr) and instr.name == "CACHE":
@@ -1315,7 +1309,6 @@ def compute_jumps(self) -> bool:
13151309

13161310
# Resolve labels for exception handling entries
13171311
for tb, entry in self.exception_handling_blocks.items():
1318-
13191312
# Set the offset for the start and end offset from the instruction
13201313
# index stored when assembling the concrete instructions.
13211314
entry.start_offset = instruction_offsets[entry.start_offset]

src/bytecode/flags.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ def infer_flags(
134134
# If performing inference or forcing an async behavior, first inspect
135135
# the flags since this is the only way to identify iterable coroutines
136136
if is_async in (None, True):
137-
138137
if bytecode.flags & CompilerFlags.COROUTINE:
139138
if sure_generator:
140139
flags |= CompilerFlags.ASYNC_GENERATOR

src/bytecode/instr.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class BinaryOp(enum.IntEnum):
6868
# This make type checking happy but means it won't catch attempt to manipulate an unset
6969
# statically. We would need guard on object attribute narrowed down through methods
7070
class _UNSET(int):
71-
7271
instance = None
7372

7473
def __new__(cls):
@@ -667,7 +666,6 @@ def _cmp_key(self) -> Tuple[Optional[InstrLocation], str, Any]:
667666

668667

669668
class Instr(BaseInstr[InstrArg]):
670-
671669
__slots__ = ()
672670

673671
def _cmp_key(self) -> Tuple[Optional[InstrLocation], str, Any]:

tests/cell_free_vars_cases.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def f(self):
3535

3636

3737
def class_loadderef():
38-
3938
a = 1
4039

4140
class B(A):

tests/exception_handling_cases.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ def try_except_with_extended_arg2():
150150
a = list(range(10))
151151

152152
with contextlib.nullcontext() as selector:
153-
154153
while a.pop():
155154
# timeout = self._remaining_time(endtime)
156155
if sys is not None and sys.hexversion < 0:

tests/test_concrete.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ def test_invalid_types(self):
244244
ConcreteBytecode([Label()])
245245

246246
def test_to_code_lnotab(self):
247-
248247
# We use an actual function for the simple case to
249248
# ensure we get lnotab right
250249
def f():

tests/test_flags.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def test_type_validation_on_inference(self):
2323
infer_flags(1)
2424

2525
def test_flag_inference(self):
26-
2726
# Check no loss of non-infered flags
2827
code = ControlFlowGraph()
2928
code.flags |= (
@@ -138,7 +137,6 @@ def test_async_gen_flags(self):
138137
# Test inference in the presence of pre-existing flags
139138

140139
for is_async in (None, True):
141-
142140
# Infer generator
143141
code = ConcreteBytecode()
144142
code.append(ConcreteInstr("YIELD_VALUE"))

tests/test_instr.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def test_constructor(self):
111111
Instr("xxx")
112112

113113
def test_repr(self):
114-
115114
# No arg
116115
r = repr(Instr("NOP", lineno=10))
117116
self.assertIn("NOP", r)

0 commit comments

Comments
 (0)