Skip to content

Commit ce06b32

Browse files
committed
fix(chip): typecheck optional hypothesis cad deps
1 parent e247484 commit ce06b32

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

packages/chip/scripts/generate_e1_phone_cad.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ def write_step_validation_artifacts(solid_cad: dict[str, Any]) -> dict[str, Any]
19801980
if path.is_file() and expected:
19811981
try:
19821982
imported = cq.importers.importStep(str(path))
1983-
bbox = imported.val().BoundingBox()
1983+
bbox = cast(Any, imported.val()).BoundingBox()
19841984
actual = [bbox.xlen, bbox.ylen, bbox.zlen]
19851985
errors = [abs(float(a) - float(e)) for a, e in zip(actual, expected, strict=True)]
19861986
case.update(
@@ -2008,7 +2008,7 @@ def write_step_validation_artifacts(solid_cad: dict[str, Any]) -> dict[str, Any]
20082008
if assembly_path.is_file():
20092009
try:
20102010
imported = cq.importers.importStep(str(assembly_path))
2011-
bbox = imported.val().BoundingBox()
2011+
bbox = cast(Any, imported.val()).BoundingBox()
20122012
assembly_case.update(
20132013
{
20142014
"imported": True,

packages/chip/scripts/test_check_cpu_2028_target.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,22 @@
3838

3939
check_cpu_2028_target = importlib.import_module("check_cpu_2028_target")
4040

41+
given: Any
42+
settings: Any
43+
HealthCheck: Any
44+
st: Any
45+
4146
try:
42-
from hypothesis import HealthCheck, given, settings
43-
from hypothesis import strategies as st
47+
from hypothesis import HealthCheck as _HypothesisHealthCheck
48+
from hypothesis import given as _hypothesis_given
49+
from hypothesis import settings as _hypothesis_settings
50+
from hypothesis import strategies as _hypothesis_st
4451

4552
HYPOTHESIS_AVAILABLE = True
53+
given = _hypothesis_given
54+
settings = _hypothesis_settings
55+
HealthCheck = _HypothesisHealthCheck
56+
st = _hypothesis_st
4657
except ImportError: # pragma: no cover - skip when hypothesis is absent
4758
HYPOTHESIS_AVAILABLE = False
4859

@@ -70,18 +81,20 @@ def characters(self, *_args: object, **_kwargs: object) -> _MissingStrategy:
7081
def integers(self, *_args: object, **_kwargs: object) -> _MissingStrategy:
7182
return _MissingStrategy()
7283

73-
def given(*_args: object, **_kwargs: object):
74-
def decorator(fn):
84+
def _missing_given(*_args: object, **_kwargs: object):
85+
def decorator(fn: Any) -> Any:
7586
return fn
7687

7788
return decorator
7889

79-
def settings(*_args: object, **_kwargs: object):
80-
def decorator(fn):
90+
def _missing_settings(*_args: object, **_kwargs: object):
91+
def decorator(fn: Any) -> Any:
8192
return fn
8293

8394
return decorator
8495

96+
given = _missing_given
97+
settings = _missing_settings
8598
HealthCheck = _MissingHealthCheck
8699
st = _MissingStrategies()
87100

0 commit comments

Comments
 (0)