diff --git a/cclib/parser/data.py b/cclib/parser/data.py index d4d5de046..592915ddf 100644 --- a/cclib/parser/data.py +++ b/cclib/parser/data.py @@ -227,15 +227,15 @@ def listify(self) -> None: attrlist = [k for k in self._attrlist if hasattr(self, k)] for k in attrlist: v = self._attributes[k].type - if v == numpy.ndarray: + if v is numpy.ndarray: setattr(self, k, getattr(self, k).tolist()) - elif v == list and k in self._listsofarrays: + elif v is list and k in self._listsofarrays: setattr(self, k, [x.tolist() for x in getattr(self, k)]) - elif v == dict and k in self._dictsofarrays: + elif v is dict and k in self._dictsofarrays: items = getattr(self, k).items() pairs = [(key, val.tolist()) for key, val in items] setattr(self, k, dict(pairs)) - elif v == dict and k in self._dictsofdicts: + elif v is dict and k in self._dictsofdicts: items = getattr(self, k).items() pairs = [ (key, {subkey: subval.tolist()}) @@ -253,15 +253,15 @@ def arrayify(self) -> None: precision = "d" if k in self._intarrays: precision = "i" - if v == numpy.ndarray: + if v is numpy.ndarray: setattr(self, k, numpy.array(getattr(self, k), precision)) - elif v == list and k in self._listsofarrays: + elif v is list and k in self._listsofarrays: setattr(self, k, [numpy.array(x, precision) for x in getattr(self, k)]) - elif v == dict and k in self._dictsofarrays: + elif v is dict and k in self._dictsofarrays: items = getattr(self, k).items() pairs = [(key, numpy.array(val, precision)) for key, val in items] setattr(self, k, dict(pairs)) - elif v == dict and k in self._dictsofdicts: + elif v is dict and k in self._dictsofdicts: items = getattr(self, k).items() pairs = [ ( @@ -328,7 +328,7 @@ def typecheck(self) -> None: self.arrayify() for attr in [a for a in self._attrlist if hasattr(self, a)]: val = getattr(self, attr) - if type(val) == self._attributes[attr].type: + if type(val) is self._attributes[attr].type: continue try: diff --git a/cclib/parser/gaussianparser.py b/cclib/parser/gaussianparser.py index 301d4e51c..adf44ec81 100644 --- a/cclib/parser/gaussianparser.py +++ b/cclib/parser/gaussianparser.py @@ -223,7 +223,7 @@ def extract(self, inputfile, line): f"{self.YEAR_SUFFIXES_TO_YEARS[year_suffix]}+{revision}" ) self.metadata["platform"] = groupdict["platform"] - run_date = next(inputfile).strip() + run_date = next(inputfile).strip() # noqa: F841 if line.strip().startswith("Link1: Proceeding to internal job step number"): self.new_internal_job()