Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/python/src/utils/integration_test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def check_http_service(

start = time.perf_counter()
request = urllib.request.Request(url, method="GET")
with urllib.request.urlopen(request, timeout=timeout) as response:
with urllib.request.urlopen(request, timeout=timeout) as response: # nosec B310
latency = (time.perf_counter() - start) * 1000
status_code = response.getcode()

Expand Down
2 changes: 1 addition & 1 deletion src/shared/python/calc_backend/tests/test_calc_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ def test_expression_evaluator_protocol(self) -> Any:

class DummyEval:
def evaluate(self, expression: str, namespace: dict) -> float:
return eval(expression, {}, namespace)
return eval(expression, {}, namespace) # nosec B307

def validate(self, expression: str) -> bool:
return True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def make_request_with_backoff(
for key, value in headers.items():
req.add_header(key, value)

response = urllib.request.urlopen(req, timeout=10)
response = urllib.request.urlopen(req, timeout=10) # nosec B310

# Log rate-limit status on success
rate_limit_info = extract_rate_limit_info(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_read_unsupported_format_raises(self):
from upstream_drift_tools.data_processing.io import DataReader

with pytest.raises(ValueError, match="Unsupported or undetected"):
DataReader.read_file("/tmp/file.xyz_unknown_ext")
DataReader.read_file("/tmp/file.xyz_unknown_ext") # nosec B108

def test_read_parquet_no_pyarrow_raises(self):
"""If PYARROW_AVAILABLE is False, reading parquet should raise ImportError."""
Expand All @@ -106,7 +106,7 @@ def test_read_parquet_no_pyarrow_raises(self):
try:
io_mod.PYARROW_AVAILABLE = False
with pytest.raises(ImportError, match="PyArrow"):
DataReader.read_file("/tmp/fake.parquet")
DataReader.read_file("/tmp/fake.parquet") # nosec B108
finally:
io_mod.PYARROW_AVAILABLE = original

Expand Down Expand Up @@ -189,7 +189,7 @@ def test_write_parquet_no_pyarrow_raises(self, sample_df: pd.DataFrame):
try:
io_mod.PYARROW_AVAILABLE = False
with pytest.raises(ImportError, match="PyArrow"):
DataWriter.write_file(sample_df, "/tmp/fake.parquet")
DataWriter.write_file(sample_df, "/tmp/fake.parquet") # nosec B108
finally:
io_mod.PYARROW_AVAILABLE = original

Expand Down Expand Up @@ -321,7 +321,7 @@ def test_read_matlab_no_scipy_raises(self):
try:
io_mod.SCIPY_AVAILABLE = False
with pytest.raises(ImportError, match="SciPy"):
DataReader.read_file("/tmp/fake.mat")
DataReader.read_file("/tmp/fake.mat") # nosec B108
finally:
io_mod.SCIPY_AVAILABLE = original

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ class TestExportData:
def test_no_data_raises(self):
engine = DataProcessorEngine()
with pytest.raises(DataNotLoadedError):
engine.export_data("/tmp/out.csv")
engine.export_data("/tmp/out.csv") # nosec B108

def test_export_success(self):
engine = _make_engine_with_data()
with patch(
"upstream_drift_tools.data_processing.core.DataWriter.write_file"
) as mock_write:
result = engine.export_data("/tmp/out.csv", DataFormat.CSV)
result = engine.export_data("/tmp/out.csv", DataFormat.CSV) # nosec B108
mock_write.assert_called_once()
assert result.success

Expand All @@ -171,7 +171,7 @@ def test_export_oserror_raises(self):
side_effect=OSError("disk full"),
):
with pytest.raises(FileIOError, match="disk full"):
engine.export_data("/tmp/out.csv")
engine.export_data("/tmp/out.csv") # nosec B108


# ---------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_load_file_with_invalid_format_raises(self):
side_effect=ValueError("unsupported format"),
):
with pytest.raises((FileIOError, ValueError)):
engine.load_file("/tmp/bad.xyz")
engine.load_file("/tmp/bad.xyz") # nosec B108

def test_load_file_empty_path_raises(self):
from upstream_drift_tools.data_processing.core import DataProcessorEngine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_json_serializer(manager) -> Any:
res = manager._json_serializer(dt)
assert res == "2023-01-01T12:00:00"

p = Path("/tmp/foo")
p = Path("/tmp/foo") # nosec B108
res = manager._json_serializer(p)
assert res == str(p)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def ensure_texture(self, body_name: str) -> pathlib.Path | None:

path.parent.mkdir(parents=True, exist_ok=True)
try:
urllib.request.urlretrieve(url, path)
urllib.request.urlretrieve(url, path) # nosec B310
except (ConnectionError, TimeoutError, OSError):
return None

Expand Down
10 changes: 5 additions & 5 deletions src/urdf_builder_gui/tests/test_urdf_builder_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,15 @@ def test_valid_xml_output(self) -> None:
config = URDFConfig(robot_name="test_robot", height_m=1.75, mass_kg=70.0)
xml = generate_urdf_xml(config)
# Should parse without error
root = ET.fromstring(xml)
root = ET.fromstring(xml) # nosec B314
assert root.tag == "robot"
assert root.attrib["name"] == "test_robot"

def test_contains_expected_links(self) -> None:
"""Full Humanoid template should produce expected links."""
config = URDFConfig(template="Full Humanoid")
xml = generate_urdf_xml(config)
root = ET.fromstring(xml)
root = ET.fromstring(xml) # nosec B314
link_names = {link.get("name") for link in root.findall("link")}
assert "pelvis" in link_names
assert "torso" in link_names
Expand All @@ -368,7 +368,7 @@ def test_upper_body_only_excludes_legs(self) -> None:
"""Upper Body Only template should NOT include leg links."""
config = URDFConfig(template="Upper Body Only")
xml = generate_urdf_xml(config)
root = ET.fromstring(xml)
root = ET.fromstring(xml) # nosec B314
link_names = {link.get("name") for link in root.findall("link")}
assert "upper_arm_l" in link_names
assert "thigh_l" not in link_names
Expand Down Expand Up @@ -566,7 +566,7 @@ def test_preview_and_generate_same_template(self) -> None:
assert seg in preview, f"{template}: {seg} not in preview"

# Generated XML should have links for each segment
root = ET.fromstring(xml)
root = ET.fromstring(xml) # nosec B314
link_names = {link.get("name") for link in root.findall("link")}
for seg in get_template_segments(template):
assert seg in link_names, f"{template}: {seg} not in XML"
Expand All @@ -580,7 +580,7 @@ def test_different_configs_produce_different_output(self) -> None:
def test_all_inertia_values_positive(self) -> None:
"""Every inertia value in generated URDF must be positive."""
xml = generate_urdf_xml(URDFConfig())
root = ET.fromstring(xml)
root = ET.fromstring(xml) # nosec B314
for inertia_el in root.iter("inertia"):
for attr in ["ixx", "iyy", "izz"]:
val = float(inertia_el.get(attr, "0"))
Expand Down
Loading