Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#407)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit
- [github.com/astral-sh/ruff-pre-commit: v0.4.10 → v0.5.0](astral-sh/ruff-pre-commit@v0.4.10...v0.5.0)

* Apply ruff fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kevin Phoenix <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and twizmwazin authored Jul 1, 2024
1 parent 6fa4592 commit 1bced44
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ repos:
- id: check-builtin-literals
- id: check-docstring-first

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.10
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
hooks:
- id: ruff
8 changes: 2 additions & 6 deletions claripy/backends/backend_smtlib_solvers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,10 @@ def _simplify(self, e):
return e

def _is_false(self, e, extra_constraints=(), solver=None, model_callback=None):
if e.is_constant() and e.constant_value() is False:
return True
return False
return e.is_constant() and e.constant_value() is False

def _is_true(self, e, extra_constraints=(), solver=None, model_callback=None):
if e.is_constant() and e.constant_value() is True:
return True
return False
return e.is_constant() and e.constant_value() is True

def _batch_eval(self, exprs, n, extra_constraints=(), solver=None, model_callback=None):
return [
Expand Down
4 changes: 1 addition & 3 deletions claripy/vsa/bool_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ def identical(self, other):
return False
if self._op != other._op:
return False
if self._args != other._args:
return False
return True
return self._args == other._args

def union(self, other):
raise NotImplementedError
Expand Down
13 changes: 5 additions & 8 deletions claripy/vsa/strided_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,7 @@ def solution(self, b):
"Oops, Strided intervals cannot be passed as parameter to function solution. To implement"
)

if self.intersection(b).is_empty:
return False
return True
return not self.intersection(b).is_empty

#
# Private methods
Expand Down Expand Up @@ -1900,17 +1898,16 @@ def _is_surrounded(self, b):
elif b.is_top:
return True

if (
return bool(
b._surrounds_member(a.lower_bound)
and b._surrounds_member(a.upper_bound)
and (
(b.lower_bound == a.lower_bound and b.upper_bound == a.upper_bound)
b.lower_bound == a.lower_bound
and b.upper_bound == a.upper_bound
or not a._surrounds_member(b.lower_bound)
or not a._surrounds_member(b.upper_bound)
)
):
return True
return False
)

#
# Arithmetic operations
Expand Down
4 changes: 1 addition & 3 deletions tests/test_smart_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ def check_si_fields(si, stride, lb, ub):
return False
if si.lower_bound != lb:
return False
if si.upper_bound != ub:
return False
return True
return si.upper_bound == ub


def test_smart_join():
Expand Down
4 changes: 1 addition & 3 deletions tests/test_strided_intervals.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ def check_si_fields(si, stride, lb, ub):
return False
if si.lower_bound != lb:
return False
if si.upper_bound != ub:
return False
return True
return si.upper_bound == ub


def test_division():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def is_equal(ast_0, ast_1):
# ValueSet
#

def VS(name=None, bits=None, region=None, val=None):
def VS(name=None, bits=None, region=None, val=None): # noqa: F811 # TODO: Refactor this test case
region = "foobar" if region is None else region
return claripy.ValueSet(bits, region=region, region_base_addr=0, value=val, name=name)

Expand Down

0 comments on commit 1bced44

Please sign in to comment.