Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black update #381

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Main plugin file registering plugin commands in bianryninja."""

from logging import info, warning
from os.path import dirname, realpath
from sys import path
Expand Down
1 change: 1 addition & 0 deletions decompiler/backend/codegenerator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module in charge of bundling all classes utilized to generate c-code from an AST."""

from string import Template
from typing import Iterable, List

Expand Down
1 change: 1 addition & 0 deletions decompiler/backend/variabledeclarations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module containing the visitors used to generate variable declarations."""

from collections import defaultdict
from typing import Iterable, Iterator, List

Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""module for anything pipeline related."""

from .binaryninja.frontend import BinaryninjaFrontend
from .frontend import Frontend
from .lifter import Lifter
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/frontend.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Class implementing the main binaryninja frontend interface."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Main module containing all binaryninja handlers."""

from .assignments import AssignmentHandler
from .binary import BinaryOperationHandler
from .calls import CallHandler
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/assignments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the AssignmentHandler for binaryninja."""

import logging
from functools import partial

Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/binary.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the handler for binaryninja's binary operations."""

from functools import partial

from binaryninja import MediumLevelILInstruction, mediumlevelil
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/calls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the binaryninja CallHandler."""

from functools import partial
from typing import List

Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/conditions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the ConditionHandler class."""

from functools import partial

from binaryninja import mediumlevelil
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the ConstantHandler for the binaryninja frontend."""

import math

from binaryninja import BinaryView, DataVariable, SectionSemantics, SymbolType, Type, mediumlevelil
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/controlflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the ConditionHandler class."""

from binaryninja import mediumlevelil
from decompiler.frontend.lifter import Handler
from decompiler.structures.pseudo import Branch, Condition, Constant, IndirectBranch, OperationType, Return
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/globals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the ConstantHandler for the binaryninja frontend."""

from typing import Callable, Optional, Tuple, Union

from binaryninja import BinaryView, DataVariable, Endianness, MediumLevelILInstruction, Type
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/phi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing lifting of phi and memphi instructions."""

from typing import List

from binaryninja import MediumLevelILMemPhi, MediumLevelILVarPhi
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/symbols.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing lifting of binaryninja symbols."""

from logging import warning
from typing import Union

Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/unary.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the UnaryOperationHandler."""

import logging
from functools import partial
from typing import Union
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/handlers/variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing variable lifting for the binaryninja observer lifer."""

from typing import Optional

from binaryninja import (
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/lifter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the BinaryNinjaLifter of the binaryninja frontend."""

from logging import warning
from typing import Optional, Tuple, Union

Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements the parser for the binaryninja frontend."""

from logging import info, warning
from typing import Dict, Iterator, List, Tuple

Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/binaryninja/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""WIP test suite for binaryninja lifter."""

from os import listdir
from os.path import abspath, dirname, isfile, join, realpath
from sys import path
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/frontend.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the interface for different frontends."""

from __future__ import annotations

from abc import ABC, abstractmethod
Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/lifter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Interface for frontend lifters."""

from abc import ABC, abstractmethod
from typing import Callable, Dict, Type, TypeVar

Expand Down
1 change: 1 addition & 0 deletions decompiler/frontend/parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module defining the parser interface."""

from abc import ABC, abstractmethod

from decompiler.structures.graphs.cfg import ControlFlowGraph
Expand Down
1 change: 1 addition & 0 deletions decompiler/logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module in charge of logger initialization and settings."""

import logging.config
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/commons/livenessanalysis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Liveness Analysis due to Brandner et al. : Algorithms 4 (Compute liveness sets by exploring paths from variable uses"""

from collections import defaultdict
from typing import DefaultDict

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class UnsupportedOperationType(Exception):


class UnsupportedValueType(Exception):

"""Indicates that the value type of one constant is not supported."""

pass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing various readability based refinements."""

from __future__ import annotations

from typing import Union
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/controlflowanalysis/restructuring.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Module for pattern independent restructuring
"""

from __future__ import annotations

import logging
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for AST processing steps."""

import logging
from typing import Callable, Dict, Iterable, List, Optional, Set, Tuple, Union

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Module for Condition Based Refinement
"""

from itertools import combinations
from typing import Iterator, List, Optional, Set, Tuple

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to compute graph slices."""

from __future__ import annotations

from typing import Iterator, List, Set
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to structure Loops"""

from typing import Optional

from decompiler.pipeline.controlflowanalysis.restructuring_commons.ast_processor import LoopProcessor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to find restructurable regions."""

from __future__ import annotations

from abc import abstractmethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing detection of array element accesses"""

import logging
from collections import defaultdict
from dataclasses import dataclass, field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing common subexpression elimination."""

from __future__ import annotations

from collections import defaultdict, deque
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the DeadLoopElimination pipeline stage."""

from logging import info, warning
from typing import Dict, Generator, Optional, Tuple, Union

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the DeadPathElimination pipeline stage."""

from logging import info, warning
from typing import Iterator, Optional, Set, Union

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing code elimination based on Hols et al."""

from collections import defaultdict, namedtuple
from typing import DefaultDict, Optional, Set

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing a pipeline stage eliminating congruent variables."""

from __future__ import annotations

from collections import defaultdict, namedtuple
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/dataflowanalysis/type_propagation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing horizontal type propagation as a pipeline stage."""

from __future__ import annotations

from collections import Counter, defaultdict
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/expressions/deadcomponentpruner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing Dead code elimination based on ExpressionGraphs."""

from typing import Iterator

from decompiler.pipeline.stage import PipelineStage
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/expressions/edgepruner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing common subexpression elimination on ExpressionGraphs."""

from typing import Iterator, List

from decompiler.pipeline.stage import PipelineStage
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module containing pipeline definitions for the decompiler."""

from __future__ import annotations

from logging import debug, error, warning
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/preprocessing/coherence.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing frontend data harmonization."""

from itertools import chain
from logging import info
from typing import Dict, Iterator, List
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for handling compiler idioms that have already been marked in BinaryNinja"""

import logging
from dataclasses import dataclass
from typing import Iterable, List, Optional
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/preprocessing/missing_definitions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module dedicated to insert definitions for otherwise definitionless values."""

from collections import defaultdict
from logging import error
from typing import DefaultDict, Dict, List, Optional, Set, Tuple, Union
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/preprocessing/phi_predecessors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module fixing the Control Glow Graph such that it contains all information we need for our analysis."""

from typing import Dict, List, Optional

from decompiler.pipeline.stage import PipelineStage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to handle Register pairs."""

from __future__ import annotations

from collections import namedtuple
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/preprocessing/remove_stack_canary.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for removing ELF stack canaries."""

from typing import Iterator

from decompiler.pipeline.stage import PipelineStage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for finding variable relevant to switch"""

from typing import Optional

from decompiler.pipeline.stage import PipelineStage
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/preprocessing/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helper functions for modules in the preprocessing pipeline."""

from collections import defaultdict
from typing import DefaultDict, Dict, Set, Tuple

Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/ssa/outofssatranslation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing Out of SSA."""

import logging
from collections import defaultdict
from configparser import NoOptionError
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/ssa/phi_cleaner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for removing unnecessary Phi-functions in Out of SSA."""

from typing import Dict, Iterator, List

from decompiler.pipeline.ssa.phi_dependency_graph import PhiDependencyGraph
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/ssa/phi_dependency_resolver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for removing circular dependency of Phi-functions in Out of SSA."""

import logging
from typing import Dict, List

Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/ssa/phi_lifting.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for removing Phi-functions by lifting in Out of SSA."""

import logging
from typing import DefaultDict, Iterator, List, Optional

Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/ssa/variable_renaming.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for renaming variables in Out of SSA."""

import logging
from collections import defaultdict
from dataclasses import dataclass, field
Expand Down
1 change: 1 addition & 0 deletions decompiler/pipeline/stage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing the PipelineStage interface."""

from abc import ABC, abstractmethod

from decompiler.task import DecompilerTask
Expand Down
1 change: 1 addition & 0 deletions decompiler/structures/ast/reachability_graph.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to handle the reaches attribute using graphs."""

from __future__ import annotations

from itertools import chain, permutations, product
Expand Down
1 change: 1 addition & 0 deletions decompiler/structures/graphs/basic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing basic nodes based on aa given (printable) python object."""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions decompiler/structures/graphs/basicblock.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module defining the BasicBlock class utilized in ControlFlowGraphs."""

from __future__ import annotations

from enum import Enum
Expand Down
1 change: 1 addition & 0 deletions decompiler/structures/graphs/branches.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module defining the various branches between BasicBlocks used in ControlFlowGraphs."""

from __future__ import annotations

from abc import ABC, abstractmethod
Expand Down
1 change: 1 addition & 0 deletions decompiler/structures/graphs/cfg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module defining a control flow graph with the graph interface."""

from __future__ import annotations

from itertools import chain
Expand Down
1 change: 1 addition & 0 deletions decompiler/structures/graphs/classifiedgraph.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing edge classification for NetworkXGraph."""

from __future__ import annotations

from collections import defaultdict
Expand Down
1 change: 1 addition & 0 deletions decompiler/structures/graphs/expressiongraph.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module defining the ExpressionGraph used for various pipeline stages."""

from __future__ import annotations

from decompiler.structures.graphs.cfg import ControlFlowGraph
Expand Down
1 change: 1 addition & 0 deletions decompiler/structures/graphs/interface/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Module defining the graph interface."""

from .graph import EDGE, NODE, GraphEdgeInterface, GraphInterface, GraphNodeInterface
from .rooted import RootedGraphInterface
Loading
Loading