Skip to content

Commit

Permalink
Fix more F403 wild import errors
Browse files Browse the repository at this point in the history
  • Loading branch information
robertapplin committed Oct 1, 2024
1 parent d20c7ab commit c5c5372
Show file tree
Hide file tree
Showing 72 changed files with 354 additions and 195 deletions.
3 changes: 2 additions & 1 deletion Framework/Algorithms/test/NormaliseToUnityTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
import unittest
from mantid.simpleapi import *
from mantid.api import mtd
from mantid.simpleapi import CreateWorkspace, DeleteWorkspace, NormaliseToUnity


class NormaliseToUnityTest(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion Framework/DataObjects/scripts/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# This line has to be first for some reason.
# from enthought.mayavi import mlab

from pylab import *
from pylab import figure, legend, plot, title, savefig, show, xlabel, ylabel
import pickle
from scipy import stats

Expand Down
4 changes: 2 additions & 2 deletions Framework/PythonInterface/mantid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def _bin_dirs():
from mantid import dataobjects as _dataobjects # noqa: F401

# Make the aliases from each module accessible in the mantid namespace
from mantid.kernel._aliases import *
from mantid.api._aliases import *
from mantid.kernel._aliases import * # noqa: F403
from mantid.api._aliases import * # noqa: F403

# Make the version string and info accessible in the standard way
from mantid.kernel import version_str as _version_str
Expand Down
2 changes: 1 addition & 1 deletion Framework/PythonInterface/mantid/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
###############################################################################
# Make aliases accessible in this namespace
###############################################################################
from mantid.api._aliases import *
from mantid.api._aliases import * # noqa: F403
2 changes: 1 addition & 1 deletion Framework/PythonInterface/mantid/geometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
###############################################################################
# Make aliases accessible in this namespace
###############################################################################
from mantid.geometry._aliases import *
from mantid.geometry._aliases import * # noqa: F403
2 changes: 1 addition & 1 deletion Framework/PythonInterface/mantid/kernel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
# insert all the classes from _kernel in the mantid.kernel namespace
import_mantid_cext("._kernel", "mantid.kernel", globals())

from mantid.kernel._aliases import *
from mantid.kernel._aliases import * # noqa: F403
from mantid.kernel.AmendConfig import amend_config # noqa: F401
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .dataclasses import *
from .dataclasses import * # noqa: F403
6 changes: 3 additions & 3 deletions Framework/PythonInterface/mantid/simpleapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
except ImportError:
pass # matplotlib is unavailable

from mantid.kernel._aliases import *
from mantid.api._aliases import *
from mantid.fitfunctions import *
from mantid.kernel._aliases import * # noqa: F403
from mantid.api._aliases import * # noqa: F403
from mantid.fitfunctions import * # noqa: F403

MODULE_NAME = "simpleapi"

Expand Down
2 changes: 1 addition & 1 deletion Framework/PythonInterface/mantid/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from ._utils import *
from ._utils import * # noqa: F403
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=too-many-branches,too-many-locals, invalid-name
from mantid.simpleapi import *
from mantid.kernel import *
from mantid.api import *
from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, WorkspaceProperty
from mantid.kernel import Direction
from mantid.simpleapi import logger, CreateWorkspace

from scipy.io import netcdf
import numpy as np
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=too-many-branches,too-many-locals, invalid-name
from mantid.simpleapi import *
from mantid.kernel import *
from mantid.api import *
from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, WorkspaceProperty
from mantid.kernel import Direction
from mantid.simpleapi import logger, CreateWorkspace

from scipy.io import netcdf
import numpy as np
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid.api import * # PythonAlgorithm, registerAlgorithm, WorkspaceProperty
from mantid.simpleapi import *
from mantid.kernel import *
from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm
from mantid.simpleapi import CreateWorkspace, DeleteWorkspace, Plus, Rebin, RenameWorkspaces, Load

# pylint: disable=no-init, too-many-arguments

Expand Down
4 changes: 2 additions & 2 deletions Framework/PythonInterface/plugins/algorithms/CalculateFlux.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid.api import PythonAlgorithm, MatrixWorkspaceProperty, InstrumentValidator
from mantid.api import AlgorithmFactory, PythonAlgorithm, MatrixWorkspaceProperty, InstrumentValidator
from mantid.kernel import Direction, FloatBoundedValidator
from mantid.simpleapi import *
from mantid.simpleapi import CloneWorkspace, FindDetectorsInShape, GroupDetectors, Rebin
import numpy as np


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name
from mantid.simpleapi import *
from mantid.api import *
from mantid.kernel import *
from mantid.api import mtd, AlgorithmFactory, MatrixWorkspaceProperty, PythonAlgorithm
from mantid.kernel import Direction, MaterialBuilder, StringListValidator, StringMandatoryValidator
from mantid.simpleapi import ConvertToPointData, CreateWorkspace, Rebin, SetSampleMaterial
import math
import numpy as np

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name,bare-except,too-many-arguments,multiple-statements
from mantid.api import *
from mantid.kernel import *
from mantid.api import AlgorithmFactory, PythonAlgorithm
from mantid.kernel import ConfigService, Direction
import os


Expand Down
4 changes: 2 additions & 2 deletions Framework/PythonInterface/plugins/algorithms/ClipPeaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid.api import PythonAlgorithm, WorkspaceProperty
from mantid.simpleapi import *
from mantid.api import AlgorithmFactory, PythonAlgorithm, WorkspaceProperty
from mantid.simpleapi import CloneWorkspace
from mantid.kernel import Direction, IntBoundedValidator

import numpy as np
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
# pylint: disable=no-init,invalid-name,too-many-instance-attributes
import mantid
import mantid.simpleapi as api
from mantid.api import *
from mantid.kernel import *
from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm
import os


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from scipy import constants
from mantid.kernel import CompositeValidator, Direction, FloatBoundedValidator
from mantid.api import AlgorithmFactory, CommonBinsValidator, HistogramValidator, MatrixWorkspaceProperty, PythonAlgorithm
from mantid.simpleapi import *
from mantid.simpleapi import CloneWorkspace, Rebin, Rebin2D, ScaleX, Transpose


class UnitError(ValueError):
Expand Down
6 changes: 3 additions & 3 deletions Framework/PythonInterface/plugins/algorithms/ConjoinFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name
from mantid.api import *
from mantid.kernel import *
from mantid.simpleapi import *
from mantid.api import mtd, AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, WorkspaceProperty
from mantid.kernel import config, logger, Direction, IntArrayBoundedValidator, IntArrayProperty
from mantid.simpleapi import ConjoinWorkspaces, DeleteWorkspace, LoadGSS
import os


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name
from mantid.api import *
from mantid.kernel import *
from mantid.simpleapi import *
from mantid.api import mtd, AlgorithmFactory, PythonAlgorithm, TextAxis, WorkspaceGroup, WorkspaceProperty
from mantid.kernel import logger, Direction, StringListValidator, StringMandatoryValidator
from mantid.simpleapi import ConjoinWorkspaces, DeleteWorkspace, ExtractSingleSpectrum, RenameWorkspace


class ConjoinSpectra(PythonAlgorithm):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name,bare-except,too-many-arguments
from mantid.api import *
from mantid.kernel import *
from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm
from mantid.kernel import ConfigService, Direction, StringArrayProperty
import mantid
import os

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name
import mantid.simpleapi as api
from mantid.api import *
from mantid.kernel import *

_OUTPUTLEVEL = "NOOUTPUT"
from mantid.api import (
AlgorithmFactory,
AnalysisDataService,
FileAction,
FileProperty,
ITableWorkspaceProperty,
PythonAlgorithm,
WorkspaceFactory,
)
from mantid.kernel import Direction, FloatBoundedValidator, IntArrayBoundedValidator, IntArrayProperty


class CreateLeBailFitInput(PythonAlgorithm):
"""Create the input TableWorkspaces for LeBail Fitting"""

def category(self):
""" """
return "Diffraction\\Fitting;Utility\\Workspaces"

def seeAlso(self):
return ["LeBailFit"]

def name(self):
""" """
return "CreateLeBailFitInput"

def summary(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
# pylint: disable=no-init,too-many-locals,too-many-instance-attributes,too-many-arguments,invalid-name
import math
import numpy as np
from mantid.simpleapi import *
from mantid.simpleapi import (
AddSampleLogMultiple,
CreateWorkspace,
DeleteWorkspace,
ExtractSingleSpectrum,
GroupWorkspaces,
SplineInterpolation,
)
from mantid.api import (
mtd,
PythonAlgorithm,
AlgorithmFactory,
PropertyMode,
Expand Down
13 changes: 11 additions & 2 deletions Framework/PythonInterface/plugins/algorithms/EnggCalibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid.kernel import *
from mantid.api import *
from mantid.api import (
AlgorithmFactory,
FileAction,
FileProperty,
ITableWorkspaceProperty,
MatrixWorkspaceProperty,
Progress,
PropertyMode,
PythonAlgorithm,
)
from mantid.kernel import Direction, FloatArrayProperty, StringListValidator
import mantid.simpleapi as mantid


Expand Down
13 changes: 11 additions & 2 deletions Framework/PythonInterface/plugins/algorithms/EnggCalibrateFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@
# SPDX - License - Identifier: GPL - 3.0 +
import math

from mantid.kernel import *
from mantid.api import *
from mantid.api import (
AlgorithmFactory,
FileAction,
FileProperty,
ITableWorkspaceProperty,
MatrixWorkspaceProperty,
Progress,
PropertyMode,
PythonAlgorithm,
)
from mantid.kernel import Direction, FloatArrayProperty, StringListValidator, V3D
from mantid.simpleapi import SaveAscii, logger
import EnggUtils

Expand Down
19 changes: 14 additions & 5 deletions Framework/PythonInterface/plugins/algorithms/EnggFitPeaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@
# SPDX - License - Identifier: GPL - 3.0 +
import math

from mantid.kernel import *
from mantid.api import *
from mantid.simpleapi import *
from mantid.api import (
AlgorithmFactory,
FileAction,
FileProperty,
FunctionFactory,
ITableWorkspaceProperty,
MatrixWorkspaceProperty,
Progress,
PythonAlgorithm,
)
from mantid.kernel import Direction, FloatArrayProperty
from mantid.simpleapi import ConvertUnits, CreateEmptyTableWorkspace, CreateWorkspace, FindPeaks, Fit


class EnggFitPeaks(PythonAlgorithm):
Expand Down Expand Up @@ -536,7 +545,7 @@ def _find_peak_center_in_params(self, fitted_params):
return fitted_params["X0"]
else:
raise ValueError(
"Inconsistency found. I do not know how to deal with centers of peaks " "of types other than {0}".format(PEAK_TYPE)
"Inconsistency found. I do not know how to deal with centers of peaks " "of types other than {0}".format(self.PEAK_TYPE)
)

def _find_peak_intensity_in_params(self, fitted_params):
Expand All @@ -550,7 +559,7 @@ def _find_peak_intensity_in_params(self, fitted_params):
return fitted_params["I"]
else:
raise ValueError(
"Inconsistency found. I do not know how to deal with intensities of " "peaks of types other than {0}".format(PEAK_TYPE)
"Inconsistency found. I do not know how to deal with intensities of " "peaks of types other than {0}".format(self.PEAK_TYPE)
)

def _b2bexp_is_acceptable(self, fitted_params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid.kernel import *
from mantid.api import *
from mantid.simpleapi import *
from mantid.api import AlgorithmFactory, ITableWorkspaceProperty, PythonAlgorithm
from mantid.kernel import Direction
from mantid.simpleapi import ConvertTableToMatrixWorkspace, Fit


class EnggFitTOFFromPeaks(PythonAlgorithm):
Expand Down
4 changes: 2 additions & 2 deletions Framework/PythonInterface/plugins/algorithms/EnggFocus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid.kernel import *
from mantid.api import *
from mantid.api import AlgorithmFactory, ITableWorkspaceProperty, MatrixWorkspaceProperty, Progress, PropertyMode, PythonAlgorithm
from mantid.kernel import logger, Direction, FloatArrayProperty, StringListValidator

import EnggUtils

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid.api import *
from mantid.kernel import *
from mantid.api import mtd, AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm
from mantid.kernel import FloatArrayProperty, IntArrayProperty, StringArrayProperty, StringListValidator
import h5py
import numpy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid.api import *
from mantid.kernel import *
from mantid.api import mtd, AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm
from mantid.kernel import IntArrayProperty, StringArrayProperty
import h5py


Expand Down
Loading

0 comments on commit c5c5372

Please sign in to comment.