From 212cd08ae03dcac59de05393b7189a8ae5ffe1cc Mon Sep 17 00:00:00 2001 From: Ahmed Ilyas <ahmed.ilyas@hu-berlin.de> Date: Fri, 19 Jul 2024 10:05:52 +0000 Subject: [PATCH] Update ruff --- nomad/app/v1/routers/datasets.py | 2 +- nomad/metainfo/metainfo.py | 4 ++-- nomad/mkdocs.py | 2 +- nomad/normalizing/optimade.py | 2 +- nomad/normalizing/topology.py | 2 +- requirements-dev.txt | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nomad/app/v1/routers/datasets.py b/nomad/app/v1/routers/datasets.py index bedecbeb71..92cda30c33 100644 --- a/nomad/app/v1/routers/datasets.py +++ b/nomad/app/v1/routers/datasets.py @@ -512,7 +512,7 @@ async def assign_doi( if dataset.doi is not None: doi = DOI.objects(doi=dataset.doi).first() - if type(doi) == DOI and not (doi.state == 'findable'): + if type(doi) is DOI and not (doi.state == 'findable'): _delete_dataset(user=user, dataset_id=dataset_id, dataset=dataset) raise HTTPException( status_code=_existing_dataset_with_findable_state[0], diff --git a/nomad/metainfo/metainfo.py b/nomad/metainfo/metainfo.py index d49896d6ff..fb5ee617d4 100644 --- a/nomad/metainfo/metainfo.py +++ b/nomad/metainfo/metainfo.py @@ -3488,12 +3488,12 @@ class PrimitiveQuantity(Quantity): f'The value {value} for quantity {self} has no shape {self.shape}' ) - if any(v is not None and type(v) != self._type for v in value): + if any(v is not None and type(v) is not self._type for v in value): raise TypeError( f'The value {value} with type {type(value)} for quantity {self} is not of type {self.type}' ) - elif type(value) != self._type: + elif type(value) is not self._type: raise TypeError( f'The value {value} with type {type(value)} for quantity {self} is not of type {self.type}' ) diff --git a/nomad/mkdocs.py b/nomad/mkdocs.py index c344e5ca14..72aa201b9f 100644 --- a/nomad/mkdocs.py +++ b/nomad/mkdocs.py @@ -93,7 +93,7 @@ def get_field_type_info(field: ModelField) -> Tuple[str, Set[Any]]: # identification of 'Annotated' could be done with # `get_origin(a) is Annotated``, but this is the cleanest # solution with Python 3.7. - elif type(cls) == _AnnotatedAlias: + elif type(cls) is _AnnotatedAlias: skip_parent = True else: name = str(cls).split('[', 1)[0].rsplit('.')[-1] diff --git a/nomad/normalizing/optimade.py b/nomad/normalizing/optimade.py index c8f4ea6bc1..46e4a5bbeb 100644 --- a/nomad/normalizing/optimade.py +++ b/nomad/normalizing/optimade.py @@ -114,7 +114,7 @@ class OptimadeNormalizer(SystemBasedNormalizer): value = source.m_get(quantity_def) if value is None: return - if type(value) == np.ndarray and not numpy: + if type(value) is np.ndarray and not numpy: return value.tolist() if isinstance(value, list) and numpy: return np.array(value) diff --git a/nomad/normalizing/topology.py b/nomad/normalizing/topology.py index a2a7bf774c..4f223487d5 100644 --- a/nomad/normalizing/topology.py +++ b/nomad/normalizing/topology.py @@ -635,7 +635,7 @@ class TopologyNormalizer: spg_number = symm.get_space_group_number() atom_species = conv_system.get_atomic_numbers() - if type(conv_system) == Atoms or conv_system.wyckoff_letters is None: + if type(conv_system) is Atoms or conv_system.wyckoff_letters is None: wyckoffs = symm.get_wyckoff_letters_conventional() else: wyckoffs = conv_system.wyckoff_letters diff --git a/requirements-dev.txt b/requirements-dev.txt index a941bfc5b0..89ca762799 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -215,7 +215,7 @@ rfc3987==1.3.8 # via jsonschema, -r requirements.txt rope==0.21.0 # via nomad-lab (pyproject.toml) ruamel-yaml==0.18.6 # via jupyter-telemetry, oauthenticator, pymatgen, -r requirements.txt, nomad-lab (pyproject.toml) ruamel-yaml-clib==0.2.8 # via ruamel-yaml, -r requirements.txt -ruff==0.5.0 # via nomad-lab (pyproject.toml) +ruff==0.5.3 # via nomad-lab (pyproject.toml) runstats==2.0.0 # via -r requirements.txt, nomad-lab (pyproject.toml) scikit-learn==1.5.1 # via matid, -r requirements.txt, nomad-lab (pyproject.toml) scipy==1.13.1 # via ase, griddataformats, matid, mdanalysis, pymatgen, scikit-learn, -r requirements.txt, nomad-lab (pyproject.toml) -- GitLab