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
6 changes: 3 additions & 3 deletions astromodels/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, directory, message):
free_space / 1024.0 / 1024.0,
)

super(CannotWriteModel, self).__init__(message)
super().__init__(message)


class ModelInternalError(ValueError):
Expand Down Expand Up @@ -92,7 +92,7 @@ def __init__(self, *sources):
# Setup the node, using the special name '__root__' to indicate that this is the
# root of the tree

super(Model, self).__init__("__root__")
super().__init__("__root__")

# Dictionary to keep point sources

Expand Down Expand Up @@ -703,7 +703,7 @@ def display(self, complete: bool = False) -> None:
# This will automatically choose the best representation among repr and
# repr_html

super(Model, self).display()
super().display()

# Go back to default

Expand Down
6 changes: 3 additions & 3 deletions astromodels/core/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ def __init__(
# This extends ParameterBase by adding the possibility for free/fix, and a delta
# for fitting purposes, as well as a prior

super(Parameter, self).__init__(
super().__init__(
name,
value,
min_value=min_value,
Expand Down Expand Up @@ -1467,7 +1467,7 @@ def _repr__base(self, rich_output=False):
def to_dict(self, minimal=False):
"""Returns the representation for serialization."""

data = super(Parameter, self).to_dict()
data = super().to_dict()

# Add wether is a normalization or not
data["is_normalization"] = self._is_normalization
Expand Down Expand Up @@ -1573,7 +1573,7 @@ class IndependentVariable(ParameterBase):

def __init__(self, name, value, unit, min_value=None, max_value=None, desc=None):

super(IndependentVariable, self).__init__(
super().__init__(
name,
value,
unit=unit,
Expand Down
2 changes: 1 addition & 1 deletion astromodels/core/parameter_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def backward(self, internal_value):
class LogarithmicTransformation(ParameterTransformation):
def __init__(self):

super(LogarithmicTransformation, self).__init__(is_positive=True)
super().__init__(is_positive=True)

def forward(self, external_value, vector=False):

Expand Down
6 changes: 3 additions & 3 deletions astromodels/core/polarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self, degree, angle):
:param degree: The polarization degree
:param angle: The polarization angle
"""
super(LinearPolarization, self).__init__(polarization_type="linear")
super().__init__(polarization_type="linear")
self._callable = False

if callable(degree):
Expand Down Expand Up @@ -143,7 +143,7 @@ def __init__(self, Q=None, U=None, **kwargs):
if len(kwargs.keys()) > 0:
log.warning("Only support Stokes parameters Q and U currently")

super(StokesPolarization, self).__init__(polarization_type="stokes")
super().__init__(polarization_type="stokes")

if callable(Q):
self._Q = StokesParameter("Q", Q)
Expand Down Expand Up @@ -197,7 +197,7 @@ def to_linear_polarization(self):

class Unpolarized(Polarization):
def __init__(self):
super(Unpolarized, self).__init__(polarization_type="unpolarized")
super().__init__(polarization_type="unpolarized")

def __call__(self, *args, **kwargs):
return 1
Expand Down
4 changes: 2 additions & 2 deletions astromodels/core/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _set_parent(self, parent):
# we intecept here becuase we want
# to make sure the eval works

super(PropertyBase, self)._set_parent(parent)
super()._set_parent(parent)

# now we want to update because we have a parent
self.value = self._internal_value
Expand Down Expand Up @@ -195,7 +195,7 @@ def __init__(
defer: bool = False,
eval_func: Optional[str] = None,
):
super(FunctionProperty, self).__init__(
super().__init__(
name=name,
desc=desc,
value=value,
Expand Down
2 changes: 1 addition & 1 deletion astromodels/core/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __new__(cls, *args, **kwargs):
cls.angle = property(*(cls._create_property("angle")))
cls.area = property(*(cls._create_property("area")))

obj = super(_AstromodelsUnits, cls).__new__(cls)
obj = super().__new__(cls)

return obj

Expand Down
10 changes: 5 additions & 5 deletions astromodels/functions/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def info():
# Now call the __new__ of the "type" class (which then will call the __init__
# of this metaclass)

return super(FunctionMeta, mcs).__new__(mcs, name, bases, dct)
return super().__new__(mcs, name, bases, dct)

def __init__(cls, name, bases, dct):
# This is the MetaClass init, which is called after the __new__ is done
Expand All @@ -353,7 +353,7 @@ def __init__(cls, name, bases, dct):

# Finally call the init of the type class

super(FunctionMeta, cls).__init__(name, bases, dct)
super().__init__(name, bases, dct)

@staticmethod
def class_init(instance, **kwargs):
Expand Down Expand Up @@ -729,7 +729,7 @@ def __init__(

# Set up the node

super(Function, self).__init__(name)
super().__init__(name)

# Store name, number of dimensions and the latex formula

Expand Down Expand Up @@ -899,7 +899,7 @@ def external_functions(self):
return self._external_functions

def to_dict(self, minimal: bool = False):
data = super(Function, self).to_dict(minimal)
data = super().to_dict(minimal)

if not minimal:
# link the external functions
Expand Down Expand Up @@ -2153,7 +2153,7 @@ def __call__(self, x):
# Override the to_dict method of the Node class to add the expression to re-build
# this composite function
def to_dict(self, minimal=False):
data = super(CompositeFunction, self).to_dict(minimal)
data = super().to_dict(minimal)

if not minimal:
data["expression"] = self._expression
Expand Down
4 changes: 2 additions & 2 deletions astromodels/functions/template_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,10 @@ def _custom_init_(
)

if other_name is None:
super(TemplateModel, self).__init__(name, function_definition, parameters)
super().__init__(name, function_definition, parameters)

else:
super(TemplateModel, self).__init__(
super().__init__(
other_name, function_definition, parameters
)

Expand Down
4 changes: 2 additions & 2 deletions astromodels/tests/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, name):

self._placeholder = 2

super(_SimpleInheritance, self).__init__(name)
super().__init__(name)

@property
def placeholder(self):
Expand All @@ -28,7 +28,7 @@ def placeholder(self):
class _ComplexInheritance(Node):
def __init__(self, name, min_value, max_value):

super(_ComplexInheritance, self).__init__(name)
super().__init__(name)

self._min_value = min_value * u.Unit("1 / (keV * cm**2 * s)")
self._max_value = max_value * u.Unit("1 / (keV * cm**2 * s)")
Expand Down
2 changes: 1 addition & 1 deletion astromodels/utils/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ def _base_repr_(self, html=False, show_name=True, **kwargs):

class NumericMatrix(Table):
def _base_repr_(self, html=False, show_name=True, **kwargs):
return super(NumericMatrix, self)._base_repr_(html, False)
return super()._base_repr_(html, False)
Loading