Skip to content

Commit

Permalink
Update relative import paths in common
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmundt committed Jan 7, 2025
1 parent 83767d3 commit 8f6092b
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 30 deletions.
4 changes: 2 additions & 2 deletions pyomo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________

from . import common
from .version import __version__
from pyomo import common
from pyomo.version import __version__


#
Expand Down
18 changes: 9 additions & 9 deletions pyomo/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@

# The log should be imported first so that the Pyomo LogHandler can be
# set up as soon as possible
from . import log
from . import envvar
from pyomo.common import log
from pyomo.common import envvar

from .factory import Factory
from pyomo.common.factory import Factory

from .fileutils import (
from pyomo.common.fileutils import (
Executable,
Library,
# The following will be deprecated soon
register_executable,
registered_executable,
unregister_executable,
)
from . import config, dependencies, shutdown, timing
from .deprecation import deprecated
from .errors import DeveloperError
from ._command import pyomo_command, get_pyomo_commands
from pyomo.common import config, dependencies, shutdown, timing
from pyomo.common.deprecation import deprecated
from pyomo.common.errors import DeveloperError
from pyomo.common._command import pyomo_command, get_pyomo_commands

#
# declare deprecation paths for removed modules
#
from .deprecation import moved_module
from pyomo.common.deprecation import moved_module

moved_module('pyomo.common.getGSL', 'pyomo.common.gsl', version='6.5.0')
moved_module('pyomo.common.plugin', 'pyomo.common.plugin_base', version='6.5.0')
Expand Down
8 changes: 4 additions & 4 deletions pyomo/common/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from collections.abc import MutableMapping, MutableSet, Mapping, Set, Sequence
from collections import UserDict

from .orderedset import OrderedDict, OrderedSet
from .component_map import ComponentMap, DefaultComponentMap
from .component_set import ComponentSet
from .bunch import Bunch
from pyomo.common.collections.orderedset import OrderedDict, OrderedSet
from pyomo.common.collections.component_map import ComponentMap, DefaultComponentMap
from pyomo.common.collections.component_set import ComponentSet
from pyomo.common.collections.bunch import Bunch
2 changes: 1 addition & 1 deletion pyomo/common/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ def _finalize_numpy(np, available):
# fail when run under pytest.
import numpy.testing

from . import numeric_types
from pyomo.common import numeric_types

# Register ndarray as a native type to prevent 1-element ndarrays
# from accidentally registering ndarray as a native_numeric_type.
Expand Down
9 changes: 4 additions & 5 deletions pyomo/common/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
import sys
import subprocess

from . import envvar
from .deprecation import deprecated
from .errors import DeveloperError
import pyomo.common
from pyomo.common import envvar, Factory
from pyomo.common.deprecation import deprecated
from pyomo.common.errors import DeveloperError
from pyomo.common.dependencies import attempt_import

request = attempt_import('urllib.request')[0]
Expand All @@ -35,7 +34,7 @@

logger = logging.getLogger('pyomo.common.download')

DownloadFactory = pyomo.common.Factory('library downloaders')
DownloadFactory = Factory('library downloaders')


class FileDownloader(object):
Expand Down
2 changes: 1 addition & 1 deletion pyomo/common/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import os

from .dependencies import ctypes
from pyomo.common.dependencies import ctypes


def _as_bytes(val):
Expand Down
6 changes: 3 additions & 3 deletions pyomo/common/fileutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
import subprocess
import sys

from . import envvar
from .dependencies import ctypes
from .deprecation import deprecated, relocated_module_attribute
from pyomo.common import envvar
from pyomo.common.dependencies import ctypes
from pyomo.common.deprecation import deprecated, relocated_module_attribute

relocated_module_attribute('StreamIndenter', 'pyomo.common.formatting', version='6.2')

Expand Down
4 changes: 2 additions & 2 deletions pyomo/common/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________

from .dependencies import random
from pyomo.common.dependencies import random

# [Aug 24] Importing for backwards compatibility; may deprecate this import later
from .flags import FlagType, NOTSET
from pyomo.common.flags import FlagType, NOTSET

# Backward compatibility with the previous name for this flag
NoArgumentGiven = NOTSET
Expand Down
4 changes: 1 addition & 3 deletions pyomo/common/tests/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
mpi4py_available,
)

import pyomo.common.tests.dep_mod as dep_mod

from . import deps
from pyomo.common.tests import deps, dep_mod


# global objects for the submodule tests
Expand Down

0 comments on commit 8f6092b

Please sign in to comment.