Skip to content
Open
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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ testpaths = [
dev = [
"pytest>=8.3.5",
"pytest-cov>=5.0.0",
"ruff>=0.15.0",
"ty>=0.0.13",
"ruff==0.15.7",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff should be stable within minor releases, so maybe you'd want this instead?

Suggested change
"ruff==0.15.7",
"ruff~=0.15.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to be this precise? I ask since the version of ruff that comes packaged with EB 2025b toolchains is 0.14.3. (But maybe this is only ever used as part of a developer's venv and it's not an issue for central installations).

"ty==0.0.25",
"imas-simdb[server, imas-validator, postgres, auth]"
]
2 changes: 1 addition & 1 deletion src/simdb/cli/remote_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def _push_file(
path: Path,
uuid: uuid.UUID,
file_type: str,
sim_data: Dict,
sim_data: Dict[str, Any],
chunk_size: int,
out_stream: IO,
type: DataObject.Type,
Expand Down
8 changes: 4 additions & 4 deletions src/simdb/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def list_simulation_data(
for name in meta_keys:
if name in ("alias", "uuid"):
continue
names_filters.append(m_b.c.element.ilike(name)) # type: ignore[union-attr]
names_filters.append(m_b.c.element.ilike(name)) # type: ignore
if names_filters:
query = query.filter(or_(*names_filters))

Expand Down Expand Up @@ -533,11 +533,11 @@ def query_meta_data(
query = (
self.session.query(s_b, m_b)
.outerjoin(Simulation.meta)
.filter(s_b.c.id.in_(sim_ids)) # type: ignore[union-attr]
.filter(s_b.c.id.in_(sim_ids)) # type: ignore
)
query = query.filter(m_b.c.element.in_(meta_keys)) # type: ignore[union-attr]
query = query.filter(m_b.c.element.in_(meta_keys)) # type: ignore
else:
query = self.session.query(s_b).filter(s_b.c.id.in_(sim_ids)) # type: ignore[union-attr]
query = self.session.query(s_b).filter(s_b.c.id.in_(sim_ids)) # type: ignore

if sort_query is not None:
query = query.join(sort_query, Simulation.id == sort_query.c.id).order_by(
Expand Down
6 changes: 3 additions & 3 deletions src/simdb/database/models/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Patch to allow sphix doc generation
from sqlalchemy.sql.elements import ClauseElement

ClauseElement.__bool__ = lambda self: True # type: ignore[invalid-assignment]
ClauseElement.__bool__ = lambda self: True # type: ignore

import re

Expand Down Expand Up @@ -357,8 +357,8 @@ def from_data_model(cls, data: SimulationData) -> "Simulation":

def data(
self, recurse: bool = False, meta_keys: Optional[List[str]] = None
) -> Dict[str, Union[str, List]]:
data = {
) -> Dict[str, Any]:
data: Dict[str, Any] = {
"uuid": self.uuid,
"alias": self.alias,
"datetime": self.datetime.isoformat(),
Expand Down
4 changes: 2 additions & 2 deletions src/simdb/imas/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ def load_imas_metadata(ids_dist, entry) -> dict:
raise ValueError("Could not determine the latest DD version.")
ids = imas.convert_ids(ids, latest_dd_version)
for node in imas.util.tree_iter(ids):
metadata[extract_ids_path(str(node.coordinates)).replace("/", ".")] = ( # type: ignore[unresolved-attribute]
node.value # type: ignore[unresolved-attribute]
metadata[extract_ids_path(str(node.coordinates)).replace("/", ".")] = ( # type: ignore
node.value # type: ignore
)
return metadata

Expand Down
4 changes: 2 additions & 2 deletions src/simdb/remote/apis/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

@api.route("/metadata")
class MetaData(Resource):
@cache.cached(key_prefix=cache_key) # type: ignore[invalid-argument-type]
@cache.cached(key_prefix=cache_key) # type: ignore
@pydantic_validate(api)
def get(self) -> MetadataKeyInfoList:
return MetadataKeyInfoList.model_validate(current_app.db.list_metadata_keys())


@api.route("/metadata/<string:name>")
class MetaDataValues(Resource):
@cache.cached(key_prefix=cache_key) # type: ignore[invalid-argument-type]
@cache.cached(key_prefix=cache_key) # type: ignore
@pydantic_validate(api)
def get(self, name: str) -> MetadataValueList:
return MetadataValueList.model_validate(
Expand Down
6 changes: 3 additions & 3 deletions src/simdb/remote/apis/v1_2/simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def post(
@api.route("/simulation/<path:sim_id>")
class Simulation(Resource):
@requires_auth()
@cache.cached(key_prefix=cache_key) # type: ignore[invalid-argument-type]
@cache.cached(key_prefix=cache_key) # type: ignore
@pydantic_validate(api)
def get(self, sim_id: str, user: User) -> SimulationDataResponse:
try:
Expand Down Expand Up @@ -400,7 +400,7 @@ def delete(self, sim_id: str, user: User) -> SimulationDeleteResponse:
@api.route("/simulation/metadata/<path:sim_id>")
class SimulationMeta(Resource):
@requires_auth()
@cache.cached(key_prefix=cache_key) # type: ignore[invalid-argument-type]
@cache.cached(key_prefix=cache_key) # type: ignore
@pydantic_validate(api)
def get(self, sim_id: str, user: User) -> MetadataDataList:
simulation = current_app.db.get_simulation(sim_id)
Expand Down Expand Up @@ -469,7 +469,7 @@ def post(self, sim_id, user: User) -> ValidationResult:
@api.route("/trace/<path:sim_id>")
class SimulationTrace(Resource):
@requires_auth()
@cache.cached(key_prefix=cache_key) # type: ignore[invalid-argument-type]
@cache.cached(key_prefix=cache_key) # type: ignore
@pydantic_validate(api)
def get(self, sim_id: str, user: User) -> SimulationTraceData:
return _build_trace(sim_id)
Expand Down
4 changes: 2 additions & 2 deletions src/simdb/validation/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class ValidationError(Exception):
pass


class CustomValidator(cerberus.Validator): # type: ignore[misc]
types_mapping = cerberus.Validator.types_mapping.copy() # type: ignore[attr-defined]
class CustomValidator(cerberus.Validator): # type: ignore
types_mapping = cerberus.Validator.types_mapping.copy() # type: ignore
types_mapping["numpy"] = cerberus.TypeDefinition("numpy", (np.ndarray,), ())

def _validate_exists(self, check_exists, field, value):
Expand Down
Loading