Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
2c239f9e
Commit
2c239f9e
authored
Mar 11, 2020
by
Conor Finn
Browse files
RE #27722 autopep8 E302 Expected blank lines
parent
4e16602f
Changes
244
Hide whitespace changes
Inline
Side-by-side
Framework/PythonInterface/mantid/kernel/funcinspect.py
View file @
2c239f9e
...
...
@@ -18,6 +18,7 @@ import inspect
import
sys
import
dis
def
replace_signature
(
func
,
signature
):
"""
Replace the signature of the given function object with that given by
...
...
@@ -74,6 +75,8 @@ def customise_func(func, name, signature, docstring):
return
func
#-------------------------------------------------------------------------------
def
decompile
(
code_object
):
"""
Taken from
...
...
@@ -128,6 +131,7 @@ __operator_names = set(['CALL_FUNCTION', 'CALL_FUNCTION_VAR', 'CALL_FUNCTION_KW'
'CALL_FUNCTION_EX'
,
'LOAD_METHOD'
,
'CALL_METHOD'
])
#--------------------------------------------------------------------------------------
def
process_frame
(
frame
):
"""Returns the number of arguments on the left of assignment along
with the names of the variables for the given frame.
...
...
@@ -216,6 +220,7 @@ def process_frame(frame):
#-------------------------------------------------------------------------------
def
lhs_info
(
output_type
=
'both'
,
frame
=
None
):
"""Returns the number of arguments on the left of assignment along
with the names of the variables.
...
...
Framework/PythonInterface/mantid/kernel/plugins.py
View file @
2c239f9e
...
...
@@ -38,6 +38,7 @@ from . import logger, Logger, config
# String that separates paths (should be in the ConfigService)
PATH_SEPARATOR
=
";"
class
PluginLoader
(
object
):
extension
=
".py"
...
...
@@ -68,6 +69,7 @@ class PluginLoader(object):
# High-level functions to assist with loading
#======================================================================================================================
def
get_plugin_paths_as_set
(
key
):
"""
Returns the value of the given key in the config service
...
...
@@ -81,6 +83,7 @@ def get_plugin_paths_as_set(key):
s
.
remove
(
''
)
return
s
def
check_for_plugins
(
top_dir
):
"""
Runs a quick check to see if any plugin files exist in the given directory
...
...
@@ -119,6 +122,7 @@ def find_plugins(top_dir):
#======================================================================================================================
def
load
(
path
):
"""
High-level function to import the module(s) on the given path.
...
...
@@ -151,6 +155,7 @@ def load(path):
#======================================================================================================================
def
load_from_list
(
paths
):
"""
Load all modules in the given list
...
...
@@ -168,6 +173,7 @@ def load_from_list(paths):
#======================================================================================================================
def
load_from_dir
(
directory
):
"""
Load all modules in the given directory
...
...
@@ -183,6 +189,7 @@ def load_from_dir(directory):
#======================================================================================================================
def
load_from_file
(
filepath
):
"""
Loads the plugin file. Any code present at the top-level will
...
...
@@ -200,6 +207,7 @@ def load_from_file(filepath):
#======================================================================================================================
def
load_plugin
(
plugin_path
):
"""
Load a plugin and return the name & module object
...
...
@@ -215,6 +223,7 @@ def load_plugin(plugin_path):
#======================================================================================================================
def
sync_attrs
(
source
,
attrs
,
clients
):
"""
Syncs the attribute definitions between the
...
...
@@ -234,6 +243,7 @@ def sync_attrs(source, attrs, clients):
#======================================================================================================================
def
contains_algorithm
(
filename
):
"""
Inspects the file to look for an algorithm registration line
...
...
Framework/PythonInterface/mantid/plots/_compatability.py
View file @
2c239f9e
...
...
@@ -19,6 +19,8 @@ LOGGER = Logger("mantid.plots.plotCompatability")
# ================================================
# Compatability functions
# ================================================
def
plotSpectrum
(
workspaces
,
indices
=
None
,
distribution
=
None
,
error_bars
=
False
,
type
=
None
,
window
=
None
,
clearWindow
=
None
,
waterfall
=
None
,
spectrum_nums
=
None
):
...
...
Framework/PythonInterface/mantid/plots/mantidaxes.py
View file @
2c239f9e
...
...
@@ -35,6 +35,8 @@ WATERFALL_XOFFSET_DEFAULT, WATERFALL_YOFFSET_DEFAULT = 10, 20
# -----------------------------------------------------------------------------
# Decorators
# -----------------------------------------------------------------------------
def
plot_decorator
(
func
):
def
wrapper
(
self
,
*
args
,
**
kwargs
):
func_value
=
func
(
self
,
*
args
,
**
kwargs
)
...
...
@@ -56,6 +58,8 @@ def plot_decorator(func):
# -----------------------------------------------------------------------------
# MantidAxes
# -----------------------------------------------------------------------------
class
MantidAxes
(
Axes
):
"""
This class defines the **mantid** projection for 2d plotting. One chooses
...
...
@@ -1101,6 +1105,8 @@ class MantidAxes(Axes):
# -----------------------------------------------------------------------------
# MantidAxes3D
# -----------------------------------------------------------------------------
class
MantidAxes3D
(
Axes3D
):
"""
This class defines the **mantid3d** projection for 3d plotting. One chooses
...
...
Framework/PythonInterface/mantid/plots/plotfunctions.py
View file @
2c239f9e
...
...
@@ -40,6 +40,8 @@ MARKER_MAP = {'square': 's', 'plus (filled)': 'P', 'point': '.', 'tickdown': 3,
# -----------------------------------------------------------------------------
# Decorators
# -----------------------------------------------------------------------------
def
manage_workspace_names
(
func
):
"""
A decorator to go around plotting functions.
...
...
@@ -81,6 +83,7 @@ def figure_title(workspaces, fig_num):
return
wsname
(
first
)
+
'-'
+
str
(
fig_num
)
@
manage_workspace_names
def
plot
(
workspaces
,
spectrum_nums
=
None
,
wksp_indices
=
None
,
errors
=
False
,
overplot
=
False
,
fig
=
None
,
plot_kwargs
=
None
,
ax_properties
=
None
,
...
...
Framework/PythonInterface/plugins/algorithms/ExportSampleLogsToCSVFile.py
View file @
2c239f9e
...
...
@@ -10,6 +10,8 @@ from mantid.kernel import *
from
distutils.version
import
LooseVersion
import
numpy
as
np
import
os
class
ExportSampleLogsToCSVFile
(
PythonAlgorithm
):
""" Python algorithm to export sample logs to spread sheet file
for VULCAN
...
...
Framework/PythonInterface/plugins/algorithms/LRAutoReduction.py
View file @
2c239f9e
...
...
@@ -20,6 +20,8 @@ from mantid.simpleapi import *
from
mantid.kernel
import
*
from
reduction_gui.reduction.reflectometer.refl_data_series
import
DataSeries
from
reduction_gui.reduction.reflectometer.refl_data_script
import
DataSets
class
LRAutoReduction
(
PythonAlgorithm
):
def
category
(
self
):
...
...
Framework/PythonInterface/plugins/algorithms/LRScalingFactors.py
View file @
2c239f9e
...
...
@@ -10,6 +10,8 @@ import re
from
mantid.api
import
*
from
mantid.simpleapi
import
*
from
mantid.kernel
import
*
class
LRScalingFactors
(
PythonAlgorithm
):
"""
This algorithm runs through a sequence of direct beam data sets
...
...
Framework/PythonInterface/plugins/algorithms/RetrieveRunInfo.py
View file @
2c239f9e
...
...
@@ -12,6 +12,7 @@ from mantid import config
import
os
from
itertools
import
filterfalse
class
Intervals
(
object
):
# Having "*intervals" as a parameter instead of "intervals" allows us
# to type "Intervals( (0,3), (6, 8) )" instead of "Intervals( ( (0,3), (6, 8) ) )"
...
...
Framework/PythonInterface/plugins/algorithms/SelectNexusFilesByMetadata.py
View file @
2c239f9e
...
...
@@ -9,6 +9,7 @@ from mantid.simpleapi import *
from
mantid.kernel
import
*
from
mantid.api
import
*
class
SelectNexusFilesByMetadata
(
PythonAlgorithm
):
_criteria_splitted
=
[]
...
...
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MSDFit.py
View file @
2c239f9e
...
...
@@ -8,6 +8,8 @@
from
mantid.simpleapi
import
*
from
mantid.api
import
*
from
mantid.kernel
import
*
class
MSDFit
(
DataProcessorAlgorithm
):
_output_fit_ws
=
None
_model
=
None
...
...
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransmissionUtils.py
View file @
2c239f9e
...
...
@@ -9,6 +9,8 @@ from mantid.api import *
from
mantid.kernel
import
*
import
os
import
sys
def
simple_algorithm
(
algorithm_str
,
parameters
):
return
_execute
(
algorithm_str
,
parameters
)
...
...
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/USANSReduction.py
View file @
2c239f9e
...
...
@@ -13,6 +13,8 @@ import numpy
import
sys
import
os
import
json
class
USANSReduction
(
PythonAlgorithm
):
wl_list
=
None
...
...
Framework/PythonInterface/test/python/mantid/ImportModuleTest.py
View file @
2c239f9e
...
...
@@ -8,6 +8,7 @@ import unittest
from
mantid.api
import
AlgorithmFactory
class
ImportModuleTest
(
unittest
.
TestCase
):
def
test_import_succeeds
(
self
):
...
...
Framework/PythonInterface/test/python/mantid/SimpleAPIFitTest.py
View file @
2c239f9e
...
...
@@ -18,6 +18,7 @@ from mantid.api import mtd, MatrixWorkspace, ITableWorkspace, IFunction
import
numpy
as
np
from
testhelpers
import
run_algorithm
class
SimpleAPIFitTest
(
unittest
.
TestCase
):
_raw_ws
=
None
...
...
Framework/PythonInterface/test/python/mantid/SimpleAPILoadTest.py
View file @
2c239f9e
...
...
@@ -11,6 +11,7 @@ import unittest
from
mantid.simpleapi
import
Load
,
LoadDialog
from
mantid.api
import
mtd
,
MatrixWorkspace
,
WorkspaceGroup
class
SimpleAPILoadTest
(
unittest
.
TestCase
):
def
tearDown
(
self
):
...
...
Framework/PythonInterface/test/python/mantid/SimpleAPIRenameWorkspaceTest.py
View file @
2c239f9e
...
...
@@ -13,6 +13,7 @@ import platform
from
mantid.api
import
mtd
from
mantid.simpleapi
import
CreateSampleWorkspace
,
RenameWorkspace
class
SimpleAPIRenameWorkspaceTest
(
unittest
.
TestCase
):
_raw_ws
=
None
...
...
Framework/PythonInterface/test/python/mantid/api/AlgorithmHistoryTest.py
View file @
2c239f9e
...
...
@@ -9,6 +9,8 @@ from mantid.simpleapi import CreateWorkspace, set_properties
from
mantid.api
import
(
MatrixWorkspaceProperty
,
AlgorithmFactory
,
AlgorithmManager
,
DataProcessorAlgorithm
,
PythonAlgorithm
)
from
mantid.kernel
import
Direction
class
ChildAlg
(
PythonAlgorithm
):
def
PyInit
(
self
):
...
...
Framework/PythonInterface/test/python/mantid/api/AlgorithmTest.py
View file @
2c239f9e
...
...
@@ -10,6 +10,7 @@ import json
from
mantid.api
import
AlgorithmID
,
AlgorithmManager
,
FrameworkManagerImpl
from
testhelpers
import
run_algorithm
class
AlgorithmTest
(
unittest
.
TestCase
):
_load
=
None
...
...
Framework/PythonInterface/test/python/mantid/api/AxisTest.py
View file @
2c239f9e
...
...
@@ -9,6 +9,7 @@ from testhelpers import run_algorithm
from
mantid.api
import
NumericAxis
,
SpectraAxis
,
TextAxis
,
mtd
import
numpy
as
np
class
AxisTest
(
unittest
.
TestCase
):
_test_ws
=
None
...
...
Prev
1
2
3
4
5
…
13
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment