Skip to content

Commit

Permalink
Update black
Browse files Browse the repository at this point in the history
  • Loading branch information
simonlindholm committed May 28, 2024
1 parent 2e7ec29 commit 6970f12
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 176 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.4.2
hooks:
- id: black
4 changes: 2 additions & 2 deletions m2c/asm_instruction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions and classes useful for parsing an arbitrary assembly instruction."""

from __future__ import annotations
import abc
from dataclasses import dataclass, field
Expand Down Expand Up @@ -125,8 +126,7 @@ class ArchAsmParsing(abc.ABC):
aliased_regs: Dict[str, Register]

@abc.abstractmethod
def normalize_instruction(self, instr: AsmInstruction) -> AsmInstruction:
...
def normalize_instruction(self, instr: AsmInstruction) -> AsmInstruction: ...


class NaiveParsingArch(ArchAsmParsing):
Expand Down
9 changes: 3 additions & 6 deletions m2c/asm_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,16 @@ class AsmMatch:

class AsmPattern(abc.ABC):
@abc.abstractmethod
def match(self, matcher: AsmMatcher) -> Optional[Replacement]:
...
def match(self, matcher: AsmMatcher) -> Optional[Replacement]: ...


class SimpleAsmPattern(AsmPattern):
@property
@abc.abstractmethod
def pattern(self) -> Pattern:
...
def pattern(self) -> Pattern: ...

@abc.abstractmethod
def replace(self, m: AsmMatch) -> Optional[Replacement]:
...
def replace(self, m: AsmMatch) -> Optional[Replacement]: ...

def match(self, matcher: AsmMatcher) -> Optional[Replacement]:
m = matcher.try_match(self.pattern)
Expand Down
1 change: 1 addition & 0 deletions m2c/evaluate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for evaluating assembly instructions and building Expression trees."""

from __future__ import annotations
from dataclasses import replace
import struct
Expand Down
6 changes: 2 additions & 4 deletions m2c/flow_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
class ArchFlowGraph(ArchAsm):
asm_patterns: List[AsmPattern] = []

def simplify_ir(self, flow_graph: FlowGraph) -> None:
...
def simplify_ir(self, flow_graph: FlowGraph) -> None: ...


class Reference(abc.ABC):
Expand Down Expand Up @@ -651,8 +650,7 @@ def name(self) -> str:
return str(self.block.index)

@abc.abstractmethod
def children(self) -> List[Node]:
...
def children(self) -> List[Node]: ...

def __repr__(self) -> str:
return f"<{self.__class__.__name__}: {self.name()}>"
Expand Down
6 changes: 2 additions & 4 deletions m2c/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,12 @@ class ArchAsm(ArchAsmParsing):
all_regs: List[Register]

@abc.abstractmethod
def missing_return(self) -> List[Instruction]:
...
def missing_return(self) -> List[Instruction]: ...

@abc.abstractmethod
def parse(
self, mnemonic: str, args: List[Argument], meta: InstructionMeta
) -> Instruction:
...
) -> Instruction: ...


def parse_instruction(
Expand Down
23 changes: 10 additions & 13 deletions m2c/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,7 @@ class Expression(abc.ABC):
type: Type

@abc.abstractmethod
def dependencies(self) -> List[Expression]:
...
def dependencies(self) -> List[Expression]: ...

def use(self) -> None:
"""Mark an expression as "will occur in the output". Various subclasses
Expand All @@ -805,8 +804,7 @@ def use(self) -> None:
expr.use()

@abc.abstractmethod
def format(self, fmt: Formatter) -> str:
...
def format(self, fmt: Formatter) -> str: ...

def __str__(self) -> str:
"""Stringify an expression for debug purposes. The output can change
Expand All @@ -818,18 +816,15 @@ def __str__(self) -> str:

class Condition(Expression):
@abc.abstractmethod
def negated(self) -> Condition:
...
def negated(self) -> Condition: ...


class Statement(abc.ABC):
@abc.abstractmethod
def should_write(self) -> bool:
...
def should_write(self) -> bool: ...

@abc.abstractmethod
def format(self, fmt: Formatter) -> str:
...
def format(self, fmt: Formatter) -> str: ...

def __str__(self) -> str:
"""Stringify a statement for debug purposes. The output can change
Expand Down Expand Up @@ -4352,9 +4347,11 @@ def setup_planned_vars(
prefix = f"var_{reg_name}"
if stack_info.global_info.deterministic_vars:
lineno = min(
0
if not isinstance(source, InstrRef)
else source.instruction.meta.lineno
(
0
if not isinstance(source, InstrRef)
else source.instruction.meta.lineno
)
for _, source in keys
)
prefix = f"{prefix}_{lineno}"
Expand Down
290 changes: 145 additions & 145 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ graphviz = "^0.20.1"
pre-commit = "^2.20.0"
mypy = "^1.8.0"
coverage = "^7.2.7"
black = "23.12.1"
black = "24.4.2"

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit 6970f12

Please sign in to comment.