Skip to content

Commit

Permalink
COMP: Keep local functions out of global namespace
Browse files Browse the repository at this point in the history
Remove unused variable warning.
  • Loading branch information
hjmjohnson committed Oct 21, 2020
1 parent 9f6cf00 commit 05eef39
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Wrapping/Generators/Python/itkConfig.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ NotInPlace: bool = False
# Internal settings


def itkFormatWarning(msg, *a, **kwa):
def _itk_format_warning(msg, *_, **__):
""""Format the warnings issued by itk to display only the message.

This will ignore the filename and the line number where the warning was
Expand All @@ -60,35 +60,35 @@ def itkFormatWarning(msg, *a, **kwa):


# Redefine the format of the warnings
warnings.formatwarning = itkFormatWarning
warnings.formatwarning = _itk_format_warning


def normalized_path(relative_posix_path):
def _normalized_path(relative_posix_path):
if relative_posix_path != "None":
file_dir = os.path.split(__file__)[0]
relative_path = relative_posix_path.replace("/", os.sep)
return os.path.normpath(os.path.join(file_dir, relative_path))


# swig_lib: location of the swig-generated shared libraries
swig_lib = normalized_path("@CONFIG_PYTHON_SWIGLIB_DIR@")
swig_lib = _normalized_path("@CONFIG_PYTHON_SWIGLIB_DIR@")

# swig_py: location of the xxxPython.py swig-generated python interfaces
swig_py = normalized_path("@CONFIG_PYTHON_SWIGPY_DIR@")
swig_py = _normalized_path("@CONFIG_PYTHON_SWIGPY_DIR@")

# config_py: location of xxxConfig.py CMake-generated library descriptions
config_py = normalized_path("@CONFIG_PYTHON_CONFIGPY_DIR@")
config_py = _normalized_path("@CONFIG_PYTHON_CONFIGPY_DIR@")

# put the itkConfig.py path in the path list
path = [os.path.join(config_py, "..")]
# also populate path with the WRAPITK_PYTHON_PATH var
if "WRAPITK_PYTHON_PATH" in os.environ:
path.extend(os.environ["WRAPITK_PYTHON_PATH"].split(":"))

doxygen_root = normalized_path("../Doc")
doxygen_root = _normalized_path("../Doc")

ITK_GLOBAL_VERSION_STRING :str = "@ITK_VERSION_MAJOR@.@ITK_VERSION_MINOR@.@ITK_VERSION_PATCH@"
ITK_GLOBAL_VERSION_STRING: str = "@ITK_VERSION_MAJOR@.@ITK_VERSION_MINOR@.@ITK_VERSION_PATCH@"

del normalized_path
del _normalized_path
del os
del warnings

0 comments on commit 05eef39

Please sign in to comment.