Skip to content

Commit b91f3b3

Browse files
committed
more ruff fixes
1 parent 79e9948 commit b91f3b3

4 files changed

Lines changed: 18 additions & 16 deletions

File tree

.github/workflows/ruff.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Ruff
2+
on: [workflow_dispatch, pull_request]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- name: Install Python
9+
uses: actions/setup-python@v5
10+
with:
11+
python-version: "3.13"
12+
- uses: astral-sh/ruff-action@v3
13+
with:
14+
args: "check --fix"
15+
continue-on-error: false

probables/__init__.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
""" pyprobables module """
22

3-
from typing import List
4-
53
from probables.blooms import (
64
BloomFilter,
75
BloomFilterOnDisk,
86
CountingBloomFilter,
97
ExpandingBloomFilter,
108
RotatingBloomFilter,
119
)
12-
from probables.countminsketch import (
13-
CountMeanMinSketch,
14-
CountMeanSketch,
15-
CountMinSketch,
16-
HeavyHitters,
17-
StreamThreshold,
18-
)
10+
from probables.countminsketch import CountMeanMinSketch, CountMeanSketch, CountMinSketch, HeavyHitters, StreamThreshold
1911
from probables.cuckoo import CountingCuckooFilter, CuckooFilter
2012
from probables.exceptions import (
2113
CuckooFilterFullError,

probables/blooms/expandingbloom.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,7 @@ def check_alt(self, hashes: HashResultsT) -> bool:
145145
hashes (list): The hash representation to check for in the Bloom Filter
146146
Returns:
147147
bool: `True` if the element is likely present; `False` if definately not present"""
148-
for blm in self._blooms:
149-
if blm.check_alt(hashes):
150-
return True
151-
return False
148+
return any(blm.check_alt(hashes) for blm in self._blooms)
152149

153150
def add(self, key: KeyT, force: bool = False) -> None:
154151
"""Add the key to the Bloom Filter

probables/quotientfilter/quotientfilter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,7 @@ def _is_run_start(self, elt: int) -> bool:
496496
def _is_run_or_cluster_start(self, elt: int) -> bool:
497497
if self._is_cluster_start(elt):
498498
return True
499-
if self._is_run_start(elt):
500-
return True
501-
return False
499+
return bool(self._is_run_start(elt))
502500

503501
def _is_empty_element(self, elt: int) -> bool:
504502
"""Is this an empty element?"""

0 commit comments

Comments
 (0)