Skip to content

Commit

Permalink
Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Sep 22, 2020
1 parent e3e77fb commit 44c07f2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
8 changes: 2 additions & 6 deletions bytecode/bytecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ def update_flags(self, *, is_async=None):


class _BaseBytecodeList(BaseBytecode, list):
"""List subclass providing type stable slicing and copying.
"""
"""List subclass providing type stable slicing and copying."""

def __getitem__(self, index):
value = super().__getitem__(index)
Expand All @@ -97,9 +95,7 @@ def copy(self):
return new

def legalize(self):
"""Check that all the element of the list are valid and remove SetLineno.
"""
"""Check that all the element of the list are valid and remove SetLineno."""
lineno_pos = []
set_lineno = None
current_lineno = self.first_lineno
Expand Down
10 changes: 3 additions & 7 deletions bytecode/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ def copy(self):
return new

def legalize(self, first_lineno):
"""Check that all the element of the list are valid and remove SetLineno.
"""
"""Check that all the element of the list are valid and remove SetLineno."""
lineno_pos = []
set_lineno = None
current_lineno = first_lineno
Expand Down Expand Up @@ -89,7 +87,7 @@ def get_jump(self):


def _compute_stack_size(block, size, maxsize):
""" Generator used to reduce the use of function stacks.
"""Generator used to reduce the use of function stacks.
This allows to avoid nested recursion and allow to treat more cases.
Expand Down Expand Up @@ -175,9 +173,7 @@ def __init__(self):
self.add_block()

def legalize(self):
"""Legalize all blocks.
"""
"""Legalize all blocks."""
current_lineno = self.first_lineno
for block in self._blocks:
current_lineno = block.legalize(current_lineno)
Expand Down
7 changes: 6 additions & 1 deletion bytecode/peephole_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
import sys
from bytecode import Instr, Bytecode, ControlFlowGraph, BasicBlock, Compare

JUMPS_ON_TRUE = frozenset(("POP_JUMP_IF_TRUE", "JUMP_IF_TRUE_OR_POP",))
JUMPS_ON_TRUE = frozenset(
(
"POP_JUMP_IF_TRUE",
"JUMP_IF_TRUE_OR_POP",
)
)

NOT_COMPARE = {
Compare.IN: Compare.NOT_IN,
Expand Down
4 changes: 1 addition & 3 deletions bytecode/tests/test_concrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -1390,9 +1390,7 @@ def test_extreme_compute_jumps_convergence(self):
code.to_code(compute_jumps_passes=(len(labels) + 1))

def test_general_constants(self):
"""Test if general object could be linked as constants.
"""
"""Test if general object could be linked as constants."""

class CustomObject:
pass
Expand Down

0 comments on commit 44c07f2

Please sign in to comment.