Skip to content

Commit 84a9668

Browse files
committed
chore: remove assertions that are now covered by type checking
1 parent 905f608 commit 84a9668

File tree

9 files changed

+2
-19
lines changed

9 files changed

+2
-19
lines changed

src/grizzly/common/fuzzmanager.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def __init__(self, crash_id: int) -> None:
5656
Arguments:
5757
crash_id: ID of the requested crash on the server side
5858
"""
59-
assert isinstance(crash_id, int)
6059
self._crash_id = crash_id
6160
self._coll = Collector()
6261
self._contents: list[Path] | None = None
@@ -128,7 +127,6 @@ def _subset(tests: list[Path], subset: list[int]) -> list[Path]:
128127
Returns:
129128
Directories that have been selected.
130129
"""
131-
assert isinstance(subset, list)
132130
assert tests
133131
count = len(tests)
134132
# deduplicate and limit requested indices to valid range
@@ -273,7 +271,6 @@ def __init__(self, bucket_id: int) -> None:
273271
Arguments:
274272
bucket_id: ID of the requested bucket on the server.
275273
"""
276-
assert isinstance(bucket_id, int)
277274
self._bucket_id = bucket_id
278275
self._sig_filename: Path | None = None
279276
self._coll = Collector()

src/grizzly/common/plugins.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def load_plugin(name: str, group: str, base_type: type) -> Any:
2929
Returns:
3030
Loaded plug-in object.
3131
"""
32-
assert isinstance(base_type, type)
3332
for entry in iter_entry_points(group):
3433
if entry.name == name:
3534
plugin = entry.load()

src/grizzly/common/reporter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ def add_extra_metadata(self, key: str, value: Any) -> None:
221221
Returns:
222222
None
223223
"""
224-
assert isinstance(key, str)
225224
assert key not in self._extra_metadata
226225
# deep copy and ensure that value is JSON serializable
227226
self._extra_metadata[key] = loads(dumps(value))

src/grizzly/common/stack_hasher.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,6 @@ def height_limit(self) -> int:
480480

481481
@height_limit.setter
482482
def height_limit(self, value: int) -> None:
483-
assert isinstance(value, int)
484483
assert value >= 0
485484
self._height_limit = value
486485
# force recalculation of hashes

src/grizzly/common/status.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ def count(self, result_id: str, desc: str) -> tuple[int, bool]:
149149
Returns:
150150
Current count for given result_id.
151151
"""
152-
assert isinstance(result_id, str)
153152
self._count[result_id] += 1
154153
initial = False
155154
if result_id not in self._desc:
@@ -166,7 +165,6 @@ def get(self, result_id: str) -> ResultEntry:
166165
Returns:
167166
ResultEntry: Count and description.
168167
"""
169-
assert isinstance(result_id, str)
170168
return ResultEntry(
171169
result_id, self._count.get(result_id, 0), self._desc.get(result_id, None)
172170
)
@@ -345,7 +343,6 @@ def is_frequent(self, result_id: str) -> bool:
345343
Returns:
346344
True if limit has been exceeded otherwise False.
347345
"""
348-
assert isinstance(result_id, str)
349346
if self._limit < 1:
350347
return False
351348
if result_id in self._frequent:
@@ -381,7 +378,6 @@ def mark_frequent(self, result_id: str) -> None:
381378
Returns:
382379
None
383380
"""
384-
assert isinstance(result_id, str)
385381
if result_id not in self._frequent:
386382
self._frequent.add(result_id)
387383

@@ -709,7 +705,6 @@ def record(self, name: str, duration: float) -> None:
709705
None
710706
"""
711707
if self._enable_profiling:
712-
assert isinstance(duration, (float, int))
713708
try:
714709
self._profiles[name]["count"] += 1
715710
if self._profiles[name]["max"] < duration:

src/grizzly/common/storage.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,6 @@ def load(
386386
Returns:
387387
A TestCase.
388388
"""
389-
assert isinstance(path, Path)
390389
# load test case info
391390
entry_point, info = cls.load_meta(path, entry_point=entry_point)
392391
# create test case
@@ -545,7 +544,6 @@ def sanitize_path(path: str) -> str:
545544
Returns:
546545
Sanitized path.
547546
"""
548-
assert isinstance(path, str)
549547
# check for missing filename or path containing drive letter (Windows)
550548
if split(path)[-1] in ("", ".", "..") or ":" in path:
551549
raise ValueError(f"invalid path {path!r}")

src/grizzly/replay/replay.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ def run(
278278
if self._harness is None:
279279
server_map.set_redirect("grz_start", "grz_current_test", required=False)
280280
else:
281-
assert isinstance(self._harness, bytes)
282281
assert self._harness, "harness must contain data"
283282

284283
def harness_fn(_: str) -> bytes: # pragma: no cover

src/grizzly/target/target.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
from threading import Lock
1111
from typing import TYPE_CHECKING, final
1212

13-
from sapphire import CertificateBundle
14-
1513
from ..common.utils import grz_tmp
1614
from .assets import AssetManager
1715

1816
if TYPE_CHECKING:
1917
from collections.abc import Iterable, Mapping
2018
from pathlib import Path
2119

20+
from sapphire import CertificateBundle
21+
2222
from ..common.report import Report
2323
from .target_monitor import TargetMonitor
2424

@@ -82,7 +82,6 @@ def __init__(
8282
assert log_limit >= 0
8383
assert memory_limit >= 0
8484
assert binary is not None and binary.is_file()
85-
assert certs is None or isinstance(certs, CertificateBundle)
8685
self._asset_mgr = AssetManager(base_path=grz_tmp("target"))
8786
self._https = False
8887
self._lock = Lock()
@@ -122,7 +121,6 @@ def asset_mgr(self, asset_mgr: AssetManager) -> None:
122121
AssetManager.
123122
"""
124123
self._asset_mgr.cleanup()
125-
assert isinstance(asset_mgr, AssetManager)
126124
self._asset_mgr = asset_mgr
127125

128126
@abstractmethod

src/loki/loki.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ def fuzz_data(self, data: bytes) -> bytes:
146146
Returns:
147147
Fuzzed data.
148148
"""
149-
assert isinstance(data, bytes)
150149
# open a temp file in memory for fuzzing
151150
with SpooledTemporaryFile(max_size=0x800000, mode="r+b") as tmp_fp:
152151
tmp_fp.write(data)

0 commit comments

Comments
 (0)