Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 20, 2024
1 parent b5209c4 commit 3cec0b3
Show file tree
Hide file tree
Showing 29 changed files with 7 additions and 45 deletions.
2 changes: 0 additions & 2 deletions claripy/ast/bits.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,3 @@ def _check_replaceability(old, new):
raise ClaripyOperationError("replacements must have matching sizes")

__len__ = size


2 changes: 2 additions & 0 deletions claripy/ast/bool.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

_boolv_cache = {}


# This is a hilarious hack to get around some sort of bug in z3's python bindings, where
# under some circumstances stuff gets destructed out of order
def cleanup():
Expand All @@ -20,6 +21,7 @@ def cleanup():

atexit.register(cleanup)


class Bool(Base):
__slots__ = ()

Expand Down
1 change: 0 additions & 1 deletion claripy/ast/bv.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def cleanup():
del _bvv_cache



atexit.register(cleanup)


Expand Down
1 change: 0 additions & 1 deletion claripy/ast/fp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .bool import Bool



class FP(Bits):
"""
An AST representing a set of operations culminating in an IEEE754 floating point number.
Expand Down
2 changes: 0 additions & 2 deletions claripy/backends/backend_smtlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
l = logging.getLogger("claripy.backends.backend_smt")




def _expr_to_smtlib(e, daggify=True):
"""
Dump the symbol in its smt-format depending on its type
Expand Down
1 change: 0 additions & 1 deletion claripy/backends/backend_smtlib_solvers/abc_popen.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,4 @@ def solver(self, timeout=None, max_memory=None):
return ABCProxy()



backend_manager.backends._register_backend(SolverBackendABC(), "smtlib_abc", False, False)
1 change: 0 additions & 1 deletion claripy/backends/backend_smtlib_solvers/cvc4_popen.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ def solver(self, timeout=None, max_memory=None):
return CVC4Proxy(timeout, max_memory)



backend_manager.backends._register_backend(SolverBackendCVC4(), "smtlib_cvc4", False, False)
1 change: 0 additions & 1 deletion claripy/backends/backend_smtlib_solvers/z3_popen.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,4 @@ def solver(self, timeout=None, max_memory=None):
return Z3Proxy(timeout=timeout, max_memory=max_memory)



backend_manager.backends._register_backend(SolverBackendZ3(), "smtlib_z3", False, False)
1 change: 0 additions & 1 deletion claripy/backends/backend_smtlib_solvers/z3str_popen.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,4 @@ def solver(self, timeout=None, max_memory=None):
return Z3StrProxy(timeout=timeout, max_memory=max_memory)



backend_manager.backends._register_backend(SolverBackendZ3Str(), "smtlib_z3str", False, False)
1 change: 0 additions & 1 deletion claripy/backends/backend_z3.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def popitem(self):
#



class BackendZ3(Backend):
_split_on = {"And", "Or"}

Expand Down
2 changes: 0 additions & 2 deletions claripy/backends/backend_z3_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,3 @@ def resolve(self, *args, **kwargs):

def simplify(self, *args, **kwargs):
return self._synchronize("simplify", *args, **kwargs)


1 change: 0 additions & 1 deletion claripy/balancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,4 +721,3 @@ def is_true(a):

def is_false(a):
return backends.vsa.is_false(a)

2 changes: 0 additions & 2 deletions claripy/fp.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,5 +478,3 @@ def fpIsInf(x):
Checks whether the argument is a floating point infinity.
"""
return math.isinf(x)


2 changes: 0 additions & 2 deletions claripy/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,3 @@ def _split_constraints(constraints, concrete=True):
results.append(({"CONCRETE"}, concrete_constraints))

return results


1 change: 0 additions & 1 deletion claripy/frontend_mixins/constraint_expansion_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ def solution(self, e, v, extra_constraints=(), exact=None, **kwargs):
if b is False and len(extra_constraints) == 0:
self.add([e != v], invalidate_cache=False)
return b

2 changes: 1 addition & 1 deletion claripy/frontend_mixins/constraint_filter_mixin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from ..errors import UnsatError, ClaripyValueError
from .. import false


class ConstraintFilterMixin:
def _constraint_filter(self, constraints, **kwargs):
if type(constraints) not in (tuple, list):
Expand Down Expand Up @@ -65,4 +66,3 @@ def is_true(self, e, extra_constraints=(), **kwargs):
def is_false(self, e, extra_constraints=(), **kwargs):
ec = self._constraint_filter(extra_constraints)
return super().is_false(e, extra_constraints=ec, **kwargs)

2 changes: 0 additions & 2 deletions claripy/frontend_mixins/constraint_fixer_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ def add(self, constraints: Union["Bool", List["Bool"], Set["Bool"], Tuple["Bool"

constraints = [BoolV(c) if isinstance(c, bool) else c for c in constraints]
return super().add(constraints, **kwargs)


3 changes: 1 addition & 2 deletions claripy/frontend_mixins/eager_resolution_mixin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .. import backends
from ..errors import BackendError


class EagerResolutionMixin:
def _concrete_value(self, e):
r = super()._concrete_value(e)
Expand All @@ -16,5 +17,3 @@ def _concrete_value(self, e):
return None

_concrete_constraint = _concrete_value


3 changes: 1 addition & 2 deletions claripy/frontend_mixins/eval_string_to_ast_mixin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .. import String, StringV


class EvalStringsToASTsMixin:
def eval_to_ast(self, e, n, extra_constraints=(), exact=None):
if type(e) is String:
Expand All @@ -11,5 +12,3 @@ def eval_to_ast(self, e, n, extra_constraints=(), exact=None):
]

return super().eval_to_ast(e, n, extra_constraints=extra_constraints, exact=None)


1 change: 0 additions & 1 deletion claripy/frontend_mixins/model_cache_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,3 @@ def solution(self, e, v, extra_constraints=(), **kwargs):
return True

return super().solution(e, v, extra_constraints=extra_constraints, **kwargs)

3 changes: 1 addition & 2 deletions claripy/frontend_mixins/sat_cache_mixin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .. import false
from ..errors import UnsatError


class SatCacheMixin:
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -108,5 +109,3 @@ def solution(self, e, v, extra_constraints=(), **kwargs):
if len(extra_constraints) == 0:
self._cached_satness = False
raise


2 changes: 1 addition & 1 deletion claripy/frontends/composite_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
l = logging.getLogger("claripy.frontends.composite_frontend")
symbolic_count = itertools.count()


class CompositeFrontend(ConstrainedFrontend):
def __init__(self, template_frontend, template_frontend_string, track=False, **kwargs):
super().__init__(**kwargs)
Expand Down Expand Up @@ -518,4 +519,3 @@ def combine(self, others):

def split(self):
return [s.branch() for s in self._solver_list]

3 changes: 0 additions & 3 deletions claripy/frontends/constrained_frontend.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import logging

from ..ast.base import simplify
Expand All @@ -9,7 +8,6 @@
l = logging.getLogger("claripy.frontends.constrained_frontend")



class ConstrainedFrontend(Frontend): # pylint:disable=abstract-method
def __init__(self):
Frontend.__init__(self)
Expand Down Expand Up @@ -153,4 +151,3 @@ def is_true(self, e, extra_constraints=(), exact=None):

def is_false(self, e, extra_constraints=(), exact=None):
raise NotImplementedError("is_false() is not implemented")

2 changes: 0 additions & 2 deletions claripy/frontends/full_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,5 +334,3 @@ def merge(self: T, others, merge_conditions, common_ancestor=None) -> Tuple[bool
self._solver_backend.__class__.__name__ == "BackendZ3",
ConstrainedFrontend.merge(self, others, merge_conditions, common_ancestor=common_ancestor)[1],
)


2 changes: 0 additions & 2 deletions claripy/frontends/hybrid_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,3 @@ def split(self):
a.add(e.constraints)
results.append(HybridFrontend(e, a))
return results


2 changes: 0 additions & 2 deletions claripy/frontends/light_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
l = logging.getLogger("claripy.frontends.light_frontend")



class LightFrontend(ConstrainedFrontend):
def __init__(self, solver_backend, **kwargs):
# since the LightFrontend mostly cannot handle extra_constriants, it horribly misuses the cache.
Expand Down Expand Up @@ -102,4 +101,3 @@ def merge(self, others, merge_conditions, common_ancestor=None):
self._solver_backend.__class__.__name__ == "BackendZ3",
ConstrainedFrontend.merge(self, others, merge_conditions, common_ancestor=common_ancestor)[1],
)

2 changes: 0 additions & 2 deletions claripy/frontends/replacement_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
l = logging.getLogger("claripy.frontends.replacement_frontend")



class ReplacementFrontend(ConstrainedFrontend):
def __init__(
self,
Expand Down Expand Up @@ -304,4 +303,3 @@ def add(self, constraints, **kwargs):
self._actual_frontend.add(cr, **kwargs)

return added

2 changes: 0 additions & 2 deletions claripy/vsa/bool_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,3 @@ def __repr__(self):

def __bool__(self):
return False


2 changes: 0 additions & 2 deletions claripy/vsa/discrete_strided_interval_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,5 +620,3 @@ def _update_bits(self, val):
raise ClaripyVSAOperationError("Unsupported operand type %s." % type(val))

self._bits = val.bits


0 comments on commit 3cec0b3

Please sign in to comment.