diff --git a/modules/core/test/test_direction.py b/modules/core/test/test_direction.py index 69f534a335..dc3cf22042 100644 --- a/modules/core/test/test_direction.py +++ b/modules/core/test/test_direction.py @@ -12,7 +12,7 @@ class DirectionRestraint(IMP.Restraint): """Harmonically restrain a Direction to a vector.""" def __init__(self, m, pi, v, k): - super(DirectionRestraint, self).__init__(m, "DirectionRestraint%1%") + super().__init__(m, "DirectionRestraint%1%") self.pi, self.u = pi, v.get_unit_vector() self.uf = IMP.core.Cosine(k, 1, 0) diff --git a/modules/core/test/test_direction_angle.py b/modules/core/test/test_direction_angle.py index 76e1e515e5..c1ad99b622 100644 --- a/modules/core/test/test_direction_angle.py +++ b/modules/core/test/test_direction_angle.py @@ -12,7 +12,7 @@ class AngleRestraint(IMP.Restraint): """Harmonically restrain an angle between two directions to a value.""" def __init__(self, m, pi, a, k): - super(AngleRestraint, self).__init__(m, "AngleRestraint%1%") + super().__init__(m, "AngleRestraint%1%") self.pi = pi self.a = a self.k = k diff --git a/modules/core/test/test_hierarchy.py b/modules/core/test/test_hierarchy.py index cf7317a512..65f83b0f4e 100644 --- a/modules/core/test/test_hierarchy.py +++ b/modules/core/test/test_hierarchy.py @@ -5,7 +5,7 @@ class TestVisitor(IMP.core.HierarchyVisitor): def __init__(self, descend=True): - super(TestVisitor, self).__init__() + super().__init__() self.descend = descend self.seen = [] def __call__(self, h): diff --git a/modules/kernel/pyext/IMP_kernel.argparse.i b/modules/kernel/pyext/IMP_kernel.argparse.i index 60f49140ad..45a458e5da 100644 --- a/modules/kernel/pyext/IMP_kernel.argparse.i +++ b/modules/kernel/pyext/IMP_kernel.argparse.i @@ -65,7 +65,7 @@ class ArgumentParser(argparse.ArgumentParser): def __init__(self, *args, **kwargs): # Don't add --help option (since the Boost option parser handles it) kwargs['add_help'] = False - super(ArgumentParser, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) for ntoken in (0, 1): flags = _get_all_flags(ntoken) for f in flags: @@ -85,7 +85,7 @@ class ArgumentParser(argparse.ArgumentParser): @returns args """ self._boost_command_line = [sys.argv[0]] - ret = super(ArgumentParser, self).parse_args(args, namespace) + ret = super().parse_args(args, namespace) if len(self._boost_command_line) > 1: self._handle_boost() return ret diff --git a/modules/mmcif/pyext/src/data.py b/modules/mmcif/pyext/src/data.py index 772b918007..cbde378738 100644 --- a/modules/mmcif/pyext/src/data.py +++ b/modules/mmcif/pyext/src/data.py @@ -84,7 +84,7 @@ class _EntityMapper(dict): share sequence.""" def __init__(self, system): self.system = system - super(_EntityMapper, self).__init__() + super().__init__() self._sequence_dict = {} self._entities = [] self._alphabet_map = { @@ -165,7 +165,7 @@ def __init__(self, entity, asym_id, name): class _ComponentMapper: """Handle mapping from IMP Chains to CIF AsymUnits.""" def __init__(self, system): - super(_ComponentMapper, self).__init__() + super().__init__() self.system = system self._used_entities = set() self._all_components = [] @@ -385,12 +385,12 @@ class _StartingModel(ihm.startmodel.StartingModel): def __init__(self, asym_unit, struc_prov): self.filename = struc_prov[0].get_filename() - super(_StartingModel, self).__init__( - asym_unit=asym_unit(0, 0), # will update in _add_residue() - # will fill in later with _set_sources_datasets() - dataset=None, - asym_id=struc_prov[0].get_chain_id(), - offset=struc_prov[0].get_residue_offset()) + super().__init__( + asym_unit=asym_unit(0, 0), # will update in _add_residue() + # will fill in later with _set_sources_datasets() + dataset=None, + asym_id=struc_prov[0].get_chain_id(), + offset=struc_prov[0].get_residue_offset()) def _add_residue(self, resind): # Update seq_id_range to accommodate this residue @@ -519,7 +519,7 @@ def _get_starting_model(sp, resind): class _Datasets: """Store all datasets used.""" def __init__(self, system): - super(_Datasets, self).__init__() + super().__init__() self._datasets = {} self._groups = {} self.system = system @@ -563,7 +563,7 @@ class _AllSoftware: def __init__(self, system): self.system = system self._by_namever = {} - super(_AllSoftware, self).__init__() + super().__init__() def add_hierarchy(self, h, top_h=None): # todo: if no SoftwareProvenance available, use RMF producer field @@ -627,18 +627,18 @@ def __init__(self, prov, num_models_begin, assembly, all_software): method = prov.get_method() if prov.get_number_of_replicas() > 1: method = "Replica exchange " + method - super(_ProtocolStep, self).__init__( - assembly=assembly, - # todo: fill in useful value for dataset_group - dataset_group=None, - method=method, name='Sampling', - num_models_begin=num_models_begin, - num_models_end=prov.get_number_of_frames(), - # todo: support multiple states, time ordered - multi_state=False, ordered=False, - # todo: revisit assumption all models are multiscale - multi_scale=True, - software=all_software._add_previous_provenance(prov)) + super().__init__( + assembly=assembly, + # todo: fill in useful value for dataset_group + dataset_group=None, + method=method, name='Sampling', + num_models_begin=num_models_begin, + num_models_end=prov.get_number_of_frames(), + # todo: support multiple states, time ordered + multi_state=False, ordered=False, + # todo: revisit assumption all models are multiscale + multi_scale=True, + software=all_software._add_previous_provenance(prov)) def add_combine(self, prov): self.num_models_end = prov.get_number_of_frames() diff --git a/modules/mmcif/pyext/src/restraint.py b/modules/mmcif/pyext/src/restraint.py index 8f4cd5f983..2f7c927c2c 100644 --- a/modules/mmcif/pyext/src/restraint.py +++ b/modules/mmcif/pyext/src/restraint.py @@ -120,7 +120,7 @@ def __init__(self, imp_restraint, info, components, system): self._asyms = tuple(asyms) p = IMP.mmcif.metadata._GMMParser() r = p.parse_file(info['filename']) - super(_EM3DRestraint, self).__init__( + super().__init__( dataset=r['dataset'], assembly=assembly, number_of_gaussians=r['number_of_gaussians'], fitting_method='Gaussian mixture model') @@ -157,7 +157,7 @@ def __init__(self, imp_restraint, info, components, image_number): details="Electron microscopy class average") dataset = ihm.dataset.EM2DClassDataset(loc) - super(_EM2DRestraint, self).__init__( + super().__init__( dataset=dataset, assembly=assembly, segment=False, number_raw_micrographs=info['micrographs number'] or None, @@ -203,7 +203,7 @@ def __init__(self, imp_restraint, info, components, system): loc = ihm.location.InputFileLocation( info['filename'], details='SAXS profile') dataset = ihm.dataset.SASDataset(loc) - super(_SAXSRestraint, self).__init__( + super().__init__( dataset=dataset, assembly=assembly, segment=False, fitting_method='IMP SAXS restraint', fitting_atom_type=info['form factor type'], @@ -232,7 +232,7 @@ def __init__(self, imp_restraint, info, components, system): smiles_canonical=info.get('linker smiles canonical'), inchi=info.get('linker inchi'), inchi_key=info.get('linker inchi key')) - super(_CrossLinkRestraint, self).__init__( + super().__init__( dataset=dataset, linker=linker) # Map from IMP/RMF chain names to ihm.Entity cmap = {e.description: e for e in system.entities} @@ -292,7 +292,7 @@ class _GeometricRestraint(ihm.restraint.GeometricRestraint): def __init__(self, imp_restraint, info, components, system): self._info = info asym = _AsymMapper(imp_restraint.get_model(), components) - super(_GeometricRestraint, self).__init__( + super().__init__( dataset=None, geometric_object=self._geom_object, feature=asym.get_feature( diff --git a/modules/test/pyext/src/__init__.py b/modules/test/pyext/src/__init__.py index c533713681..93167be073 100644 --- a/modules/test/pyext/src/__init__.py +++ b/modules/test/pyext/src/__init__.py @@ -834,7 +834,7 @@ def __del__(self): class _TestResult(unittest.TextTestResult): def __init__(self, stream=None, descriptions=None, verbosity=None): - super(_TestResult, self).__init__(stream, descriptions, verbosity) + super().__init__(stream, descriptions, verbosity) self.all_tests = [] def stopTestRun(self): @@ -851,10 +851,10 @@ def stopTestRun(self): fname = Path("Z:") / fname with open(str(fname), 'wb') as fh: pickle.dump(self.all_tests, fh, protocol) - super(_TestResult, self).stopTestRun() + super().stopTestRun() def startTest(self, test): - super(_TestResult, self).startTest(test) + super().startTest(test) test.start_time = datetime.datetime.now() def _test_finished(self, test, state, detail=None): @@ -884,27 +884,27 @@ def _test_finished(self, test, state, detail=None): def addSuccess(self, test): self._test_finished(test, 'OK') - super(_TestResult, self).addSuccess(test) + super().addSuccess(test) def addError(self, test, err): self._test_finished(test, 'ERROR', err) - super(_TestResult, self).addError(test, err) + super().addError(test, err) def addFailure(self, test, err): self._test_finished(test, 'FAIL', err) - super(_TestResult, self).addFailure(test, err) + super().addFailure(test, err) def addSkip(self, test, reason): self._test_finished(test, 'SKIP', reason) - super(_TestResult, self).addSkip(test, reason) + super().addSkip(test, reason) def addExpectedFailure(self, test, err): self._test_finished(test, 'EXPFAIL', err) - super(_TestResult, self).addExpectedFailure(test, err) + super().addExpectedFailure(test, err) def addUnexpectedSuccess(self, test): self._test_finished(test, 'UNEXPSUC') - super(_TestResult, self).addUnexpectedSuccess(test) + super().addUnexpectedSuccess(test) def getDescription(self, test): doc_first_line = test.shortDescription()