Skip to content
Merged
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 doc/OnlineDocs/explanation/developer_utils/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ derived classes. Consider the following example:

.. doctest::

>>> class Base(object):
>>> class Base:
... CONFIG = ConfigDict()
... CONFIG.declare('filename', ConfigValue(
... default='input.txt',
Expand Down Expand Up @@ -168,7 +168,7 @@ and for use by each ``solve()`` call:

.. testcode::

class Solver(object):
class Solver:
CONFIG = ConfigDict()
CONFIG.declare('iterlim', ConfigValue(
default=10,
Expand Down Expand Up @@ -206,7 +206,7 @@ attributes:
from pyomo.common.config import document_class_CONFIG

@document_class_CONFIG(methods=['solve'])
class MySolver(object):
class MySolver:
"""Interface to My Solver"""
#
#: Global class configuration; see :ref:`MySolver_CONFIG`
Expand Down
4 changes: 2 additions & 2 deletions examples/dae/ReactionKinetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
solver = pyo.SolverFactory('ipopt')


class Reaction(object):
class Reaction:
"""A simple class to hold the stoichiometry of a single reaction

Reaction data is stored in two dictionaries:
Expand Down Expand Up @@ -84,7 +84,7 @@ def _parseTerm(self, x):
return coef, species.strip()


class ReactionNetwork(object):
class ReactionNetwork:
"""A simple object to hold sets of reactions."""

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion examples/pyomo/p-median/solver1.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


@plugin_factory(pyo.SolverFactory)
class MySolver(object):
class MySolver:
alias('greedy')

# Declare that this is an IOptSolver plugin
Expand Down
2 changes: 1 addition & 1 deletion examples/pyomo/p-median/solver2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


@plugin_factory
class MySolver(object):
class MySolver:
alias('random')

# Declare that this is an IOptSolver plugin
Expand Down
2 changes: 1 addition & 1 deletion pyomo/common/autoslots.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def encode_as_none(encode, val):
else:
return val

class Mixin(object):
class Mixin:
"""Mixin class to configure a class hierarchy to use AutoSlots

Inheriting from this class will set up the automatic generation
Expand Down
30 changes: 15 additions & 15 deletions pyomo/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def NonNegativeFloat(val):
return ans


class In(object):
class In:
"""In(domain, cast=None)
Domain validation class admitting a Container of possible values

Expand Down Expand Up @@ -279,7 +279,7 @@ def domain_name(self):
return f'In{_dn}'


class InEnum(object):
class InEnum:
"""Domain validation class admitting an enum value/name.

This will admit any value that is in the specified Enum, including
Expand Down Expand Up @@ -312,7 +312,7 @@ def domain_name(self):
return f'InEnum[{_domain_name(self._domain)}]'


class IsInstance(object):
class IsInstance:
"""
Domain validator for type checking.

Expand Down Expand Up @@ -376,7 +376,7 @@ def domain_name(self):
return f"IsInstance[{', '.join(class_names)}]"


class ListOf(object):
class ListOf:
"""Domain validator for lists of a specified type

Parameters
Expand Down Expand Up @@ -422,7 +422,7 @@ def domain_name(self):
return f'ListOf[{_dn}]'


class Module(object):
class Module:
"""Domain validator for modules.

Modules can be specified as module objects, by module name,
Expand Down Expand Up @@ -496,7 +496,7 @@ def __call__(self, module_id):
return import_file(path)


class Path(object):
class Path:
"""
Domain validator for a
:py:term:`path-like object <path-like object>`.
Expand Down Expand Up @@ -605,7 +605,7 @@ def __call__(self, data):
return [super(PathList, self).__call__(data)]


class DynamicImplicitDomain(object):
class DynamicImplicitDomain:
"""Implicit domain that can return a custom domain based on the key.

This provides a mechanism for managing plugin-like systems, where
Expand Down Expand Up @@ -809,7 +809,7 @@ def _value2yaml(prefix, value, obj):
return _str.rstrip()


class _UnpickleableDomain(object):
class _UnpickleableDomain:
def __init__(self, obj):
self._type = type(obj).__name__
self._name = obj.name(True)
Expand Down Expand Up @@ -1008,7 +1008,7 @@ def _item_body_cb(self, indent, obj):
return types.MethodType(_item_body_cb, formatter)


class ConfigFormatter(object):
class ConfigFormatter:
def _initialize(self, indent_spacing, width, visibility):
self.out = io.StringIO()
self.indent_spacing = indent_spacing
Expand Down Expand Up @@ -1174,7 +1174,7 @@ def add_docstring_list(docstring, configdict, indent_by=4):
)


class document_kwargs_from_configdict(object):
class document_kwargs_from_configdict:
"""Decorator to append the documentation of a ConfigDict to the docstring

This adds the documentation of the specified :py:class:`ConfigDict`
Expand Down Expand Up @@ -1209,7 +1209,7 @@ class document_kwargs_from_configdict(object):
>>> from pyomo.common.config import (
... ConfigDict, ConfigValue, document_kwargs_from_configdict
... )
>>> class MyClass(object):
>>> class MyClass:
... CONFIG = ConfigDict()
... CONFIG.declare('iterlim', ConfigValue(
... default=3000,
Expand Down Expand Up @@ -1403,7 +1403,7 @@ class attributes, instance attributes, and method keyword arguments
return super().__call__(cls)


class UninitializedMixin(object):
class UninitializedMixin:
"""Mixin class to support delayed data initialization.

This mixin can be used to create a derived Config class that hides
Expand Down Expand Up @@ -1470,7 +1470,7 @@ def _data(self, value):
self._data = value


class ConfigBase(object):
class ConfigBase:
# Note: __getstate__ relies on this field ordering. Do not change.
__slots__ = (
'_parent',
Expand All @@ -1490,7 +1490,7 @@ class ConfigBase(object):
# we can tell if an argument is provided (and we can't use None as
# None is a valid user-specified argument). Making it a class helps
# when Config objects are pickled.
class NoArgument(object):
class NoArgument:
pass

def __init__(
Expand Down Expand Up @@ -2026,7 +2026,7 @@ def _setter(self, value):
self._data = _data


class MarkImmutable(object):
class MarkImmutable:
"""
Mark instances of ConfigValue as immutable.

Expand Down
8 changes: 4 additions & 4 deletions pyomo/common/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
SUPPRESS_DEPENDENCY_WARNINGS = False


class ModuleUnavailable(object):
class ModuleUnavailable:
"""Mock object that raises :py:class:`.DeferredImportError` upon attribute access

This object is returned by :py:func:`attempt_import()` in lieu of
Expand Down Expand Up @@ -129,7 +129,7 @@ def generate_import_warning(self, logger='pyomo.common'):
self.log_import_warning(logger)


class DeferredImportModule(object):
class DeferredImportModule:
"""Mock module object to support the deferred import of a module.

This object is returned by :py:func:`attempt_import()` in lieu of
Expand Down Expand Up @@ -281,7 +281,7 @@ def __new__(cls, *args, **kwargs):
return UnavailableBase


class _DeferredImportIndicatorBase(object):
class _DeferredImportIndicatorBase:
def __and__(self, other):
return _DeferredAnd(self, other)

Expand Down Expand Up @@ -857,7 +857,7 @@ def declare_deferred_modules_as_importable(globals_dict):
return declare_modules_as_importable(globals_dict).__exit__(None, None, None)


class declare_modules_as_importable(object):
class declare_modules_as_importable:
"""Make all :py:class:`ModuleType` and :py:class:`DeferredImportModules`
importable through the ``globals_dict`` context.

Expand Down
2 changes: 1 addition & 1 deletion pyomo/common/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ class RenamedClass(type):
Examples
--------
>>> from pyomo.common.deprecation import RenamedClass
>>> class NewClass(object):
>>> class NewClass:
... pass
>>> class OldClass(metaclass=RenamedClass):
... __renamed__new_class__ = NewClass
Expand Down
2 changes: 1 addition & 1 deletion pyomo/common/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
DownloadFactory = pyomo.common.Factory('library downloaders')


class FileDownloader(object):
class FileDownloader:
_os_version = None

def __init__(self, insecure=False, cacert=None):
Expand Down
10 changes: 5 additions & 5 deletions pyomo/common/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _load_dll(name, timeout=10):
_load_dll.pool = None


class _RestorableEnvironInterface(object):
class _RestorableEnvironInterface:
"""Interface to track environment changes and restore state"""

def __init__(self, dll):
Expand Down Expand Up @@ -163,7 +163,7 @@ def __delitem__(self, key):
self.dll.putenv_s(key, b'')


class _OSEnviron(object):
class _OSEnviron:
"""Helper class to proxy a "DLL-like" interface to os.environ"""

_libname = 'os.environ'
Expand Down Expand Up @@ -208,7 +208,7 @@ def wputenv_s(self, key, val):
os.environ[key] = val


class _MsvcrtDLL(object):
class _MsvcrtDLL:
"""Helper class to manage the interface with the MSVCRT runtime"""

def __init__(self, name):
Expand Down Expand Up @@ -283,7 +283,7 @@ def get_env_dict(self):
return ans


class _Win32DLL(object):
class _Win32DLL:
"""Helper class to manage the interface with the Win32 runtime"""

def __init__(self, name):
Expand Down Expand Up @@ -384,7 +384,7 @@ def get_env_dict(self):
return ans


class CtypesEnviron(object):
class CtypesEnviron:
"""A context manager for managing environment variables

This class provides a simplified interface for consistently setting
Expand Down
2 changes: 1 addition & 1 deletion pyomo/common/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# ___________________________________________________________________________


class Factory(object):
class Factory:
"""
A class that is used to define a factory for objects.

Expand Down
8 changes: 4 additions & 4 deletions pyomo/common/fileutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ def to_legal_filename(name, universal=False) -> str:
return name


class PathData(object):
class PathData:
"""An object for storing and managing a :py:class:`PathManager` path"""

def __init__(self, manager, name):
Expand Down Expand Up @@ -654,7 +654,7 @@ def executable(self, value):
self.set_path(value)


class PathManager(object):
class PathManager:
"""The PathManager defines a registry class for path locations

The :py:class:`PathManager` defines a class very similar to the
Expand Down Expand Up @@ -805,7 +805,7 @@ def rehash(self):
#
# Define singleton objects for Pyomo / Users to interact with
#
class Executable(object):
class Executable:
"""Singleton executable registry

This class cannot be instantiated. Instead, calling this type will
Expand All @@ -831,7 +831,7 @@ def rehash(cls):
return cls._manager.rehash()


class Library(object):
class Library:
"""Singleton library registry

This class cannot be instantiated. Instead, calling this type will
Expand Down
2 changes: 1 addition & 1 deletion pyomo/common/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def tabular_writer(ostream, prefix, data, header, row_generator):
)


class StreamIndenter(object):
class StreamIndenter:
"""
Mock-up of a file-like object that wraps another file-like object
and indents all data using the specified string before passing it to
Expand Down
4 changes: 2 additions & 2 deletions pyomo/common/gc_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from pyomo.common.multithread import MultiThreadWrapper


class __PauseGCCompanion(object):
class __PauseGCCompanion:
def __init__(self):
self._stack_depth = 0

Expand All @@ -41,7 +41,7 @@ def __init__(self):
# the GC will be re-enabled (if it was not initially disabled). It is
# safe to nest instances of PauseGC That is, you don't have to worry
# if an outer function/method has its own instance of PauseGC.
class PauseGC(object):
class PauseGC:
__slots__ = ("reenable_gc", "stack_pointer")

def __init__(self):
Expand Down
Loading
Loading