Commit 0a61cc25 authored by Wout De Nolf's avatar Wout De Nolf
Browse files

flake8

parent 8749bde5
Pipeline #52597 passed with stages
in 15 minutes and 30 seconds
......@@ -16,10 +16,10 @@ check_style:
stage: style
image: docker-registry.esrf.fr/dau/est:python3.7_stretch_pyqt5_gtk3_wxpython
before_script:
- pip install black
- pip install black flake8
script:
# run black
- LC_ALL=C.UTF-8 black --check --safe .
- flake8
# build
......
......@@ -36,9 +36,6 @@ __date__ = "10/12/2020"
import logging
logging.basicConfig()
import sys
from silx.utils.launcher import Launcher
......@@ -50,6 +47,9 @@ except ImportError:
import_version = False
logging.basicConfig()
def main():
"""Main function of the launcher
......
......@@ -10,7 +10,8 @@ except ImportError:
else:
old_config = False
from .splash import splash_screen, getIcon
import os, sys
import os
import sys
from Orange.misc import environ
import pkg_resources
......
......@@ -152,7 +152,7 @@ class Larch_pre_edge(
_xas_obj,
data_keys=(
_NexusDatasetDef(
"flat", units="{}(E)".format(MU_CHAR), units_latex="\mu(E)"
"flat", units="{}(E)".format(MU_CHAR), units_latex=r"\mu(E)"
),
_NexusDatasetDef("dmude"),
_NexusDatasetDef("edge_step_poly"),
......@@ -162,11 +162,11 @@ class Larch_pre_edge(
_NexusDatasetDef("pre_edge_details"),
_NexusDatasetDef("e0", "eV"),
_NexusDatasetDef(
"Mu", units="{}(E)".format(MU_CHAR), units_latex="\mu(E)"
"Mu", units="{}(E)".format(MU_CHAR), units_latex=r"\mu(E)"
),
_NexusDatasetDef("energy", "eV"),
_NexusDatasetDef(
"mu_ref", units="{}(E)".format(MU_CHAR), units_latex="\mu(E)"
"mu_ref", units="{}(E)".format(MU_CHAR), units_latex=r"\mu(E)"
),
_NexusDatasetDef("I0"),
_NexusDatasetDef("I1"),
......@@ -179,7 +179,7 @@ class Larch_pre_edge(
auxiliary_signals=None,
silx_style={"signal_scale_type": "linear"},
title="Mu",
title_latex="\mu",
title_latex=r"\mu",
),
_NexusSpectrumDef(
signal="Mu",
......@@ -196,7 +196,7 @@ class Larch_pre_edge(
auxiliary_signals=("mu_ref",),
silx_style={"signal_scale_type": "linear"},
title="Mu vs Mu ref",
title_latex="\mu \quad vs \quad \mu_{ref}",
title_latex=r"\mu \quad vs \quad \mu_{ref}",
),
_NexusSpectrumDef(
signal="flat",
......@@ -204,7 +204,7 @@ class Larch_pre_edge(
auxiliary_signals=None,
silx_style={"signal_scale_type": "linear"},
title="Mu flat",
title_latex="\mu_{flat}",
title_latex=r"\mu_{flat}",
),
),
)
......
......@@ -188,41 +188,41 @@ class Larch_xftf(
_NexusDatasetDef(
"chir_im",
units="{}^(-3)".format(ANGSTROM_CHAR),
units_latex="\mathring{A}^{-3}",
units_latex=r"\mathring{A}^{-3}",
),
_NexusDatasetDef("chir_re"),
_NexusDatasetDef(
"chir_mag",
units="{}^(-3)".format(ANGSTROM_CHAR),
units_latex="\mathring{A}^{-3}",
units_latex=r"\mathring{A}^{-3}",
),
_NexusDatasetDef(
"masked_chir_mag",
units="{}".format(ANGSTROM_CHAR),
units_latex="\mathring{A}",
units_latex=r"\mathring{A}",
),
_NexusDatasetDef(
"r", units="{}".format(ANGSTROM_CHAR), units_latex="\mathring{A}"
"r", units="{}".format(ANGSTROM_CHAR), units_latex=r"\mathring{A}"
),
_NexusDatasetDef(
"masked_r",
units="{}".format(ANGSTROM_CHAR),
units_latex="\mathring{A}",
units_latex=r"\mathring{A}",
),
_NexusDatasetDef(
"k",
units="{}^(-1)".format(ANGSTROM_CHAR),
units_latex="\mathring{A}^{-1}",
units_latex=r"\mathring{A}^{-1}",
),
_NexusDatasetDef(
"masked_k",
units="{}^(-1)".format(ANGSTROM_CHAR),
units_latex="\mathring{A}^{-1}",
units_latex=r"\mathring{A}^{-1}",
),
_NexusDatasetDef(
"masked_chi_weighted_k",
units="{}^(-2)".format(ANGSTROM_CHAR),
units_latex="\mathring{A}^{-2}",
units_latex=r"\mathring{A}^{-2}",
),
),
plots=(
......@@ -232,7 +232,7 @@ class Larch_xftf(
auxiliary_signals=None,
silx_style={"signal_scale_type": "linear"},
title="chi(k)*k^k_weight",
title_latex="\chi(k).k^{k\_weight}",
title_latex=r"\chi(k).k^{k\_weight}",
),
_NexusSpectrumDef(
signal="masked_chir_mag",
......
......@@ -32,7 +32,7 @@ import functools
import logging
import multiprocessing
from PyMca5.PyMcaPhysics.xas.XASClass import XASClass
from est.core.process.process import Process, Progress
from est.core.process.process import Process
from est.core.process.process import _NexusDatasetDef
from est.core.types import Spectrum, XASObject
......
......@@ -23,7 +23,7 @@
#
# ###########################################################################*/
"""
unit test for workflow composed of pymca process
unit test for workflow composed of pymca process
"""
__authors__ = ["H. Payno"]
__license__ = "MIT"
......
......@@ -70,7 +70,7 @@ class _SavitskyGolayNoiseOpts(qt.QWidget):
qt.QWidget.__init__(self, parent)
self.setLayout(qt.QFormLayout())
## Inputs
# Inputs
self.layout().addRow(qt.QLabel("Inputs", self))
# add window size
......@@ -104,8 +104,9 @@ class _SavitskyGolayNoiseOpts(qt.QWidget):
self._eEnd.setValue(10000000000)
self.layout().addRow(qt.QLabel(" - E end", self), self._eEnd)
## Outputs
# Outputs
self.layout().addRow(qt.QLabel("Outputs", self))
# raw data average noise
self._rawData = qt.QLineEdit("", self)
self._rawData.setReadOnly(True)
......
......@@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
#############################################################################*/
# ############################################################################*/
"""
This module is used to manage the rsync between files for transfert.
......
......@@ -64,8 +64,7 @@ class ROISelector(qt.QWidget):
self._roi.setName("ROI")
self._roiManager.addRoi(self._roi)
self.__roi_first_definition = True
"""flag used make sure the roi is clearly visible at least during the
first processing"""
"""flag used make sure the roi is clearly visible at least during the first processing"""
# Create the table widget displaying
self._roiTable = RegionOfInterestTableWidget()
......
......@@ -161,6 +161,7 @@ def load_data(
assert name == "spectra"
# TODO: might need to be improved because this is redefined each
# time. Not sure about the cost
@silx.io.h5py_utils.retry(retry_timeout=timeout)
def read_dataset(url):
spectra = []
......
......@@ -50,6 +50,7 @@ Thus 2.1.0a3 is hexversion 0x020100a3.
"""
from __future__ import absolute_import, print_function, division
from collections import namedtuple
__authors__ = ["Jérôme Kieffer", "H.Payno"]
__license__ = "MIT"
......@@ -83,8 +84,6 @@ SERIAL = 1 # <16
date = __date__
from collections import namedtuple
_version_info = namedtuple(
"version_info", ["major", "minor", "micro", "releaselevel", "serial"]
)
......
......@@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
#############################################################################*/
# ############################################################################*/
__authors__ = ["H.Payno"]
......
......@@ -44,6 +44,7 @@ import time
import unittest
import collections
from argparse import ArgumentParser
import warnings
class StreamHandlerUnittestReady(logging.StreamHandler):
......@@ -79,7 +80,6 @@ logging.root.addHandler(createBasicHandler())
# Capture all default warnings
logging.captureWarnings(True)
import warnings
warnings.simplefilter("default")
......
......@@ -57,10 +57,8 @@ class AnalysisThread(threading.Thread):
max_raw_energy = max(self.spectrum.energy)
if HAS_REACH_END_VALUE:
norm2 = max_raw_energy - 100
spline_range_end = max_raw_energy - 50
else:
norm2 = max_raw_energy
spline_range_end = max_raw_energy
ft_k_range_end = etok(norm2) # here ft_k value seems really strange no ?
return {
......@@ -155,7 +153,7 @@ class AnalysisThread(threading.Thread):
with HDF5File(filename=url.file_path(), mode="r") as h5f:
if url.data_path() in h5f:
setattr(input_information, set_fct, url)
except:
except Exception:
_logger.warning("{} not set because not found".format(set_fct))
self.mu_ref_url = DataUrl(
......@@ -173,19 +171,19 @@ class AnalysisThread(threading.Thread):
# TODO: add a process attact to attach informations from an url.
try:
xas_obj.spectra.data.flat[0].I0 = get_data(self.I0_url)
except:
except Exception:
pass
try:
xas_obj.spectra.data.flat[0].I1 = get_data(self.I1_url)
except:
except Exception:
pass
try:
xas_obj.spectra.data.flat[0].I2 = get_data(self.I2_url)
except:
except Exception:
pass
try:
xas_obj.spectra.data.flat[0].mu_ref = get_data(self.mu_ref_url)
except:
except Exception:
pass
configuration = self.get_configuration()
......@@ -267,7 +265,7 @@ class AnalysisThread(threading.Thread):
):
try:
I_data = silx_utils.get_data(IX_url)
except:
except Exception:
pass
else:
concurrent.submitToQtMainThread(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment