Skip to content

Commit

Permalink
- Add ruff format linting to workflows
Browse files Browse the repository at this point in the history
- Run ruff format
  • Loading branch information
oerc0122 committed Feb 11, 2025
1 parent 97124eb commit 22bbd45
Show file tree
Hide file tree
Showing 56 changed files with 10 additions and 84 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
src: "./MDANSE/Src"
args: "check"

lint-mdanse-gui:
lint_format_ruff_gui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
- uses: astral-sh/ruff-action@v3
with:
options: "--check --verbose"
src: "MDANSE_GUI/Src"
src: "./MDANSE_GUI/Src"
args: "format --check"

lint_check_ruff_gui:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ def left_widgets(self) -> list[QWidget]:
self.combo_boxes = []

for k, v in self.settings.items():

if isinstance(v, bool):
check_layout = QHBoxLayout()
checkbox = QCheckBox()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class CorrelationFramesWidget(FramesWidget):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


class DerivativeOrderWidget(WidgetBase):

def __init__(self, *args, **kwargs):
super().__init__(*args, layout_type="QHBoxLayout", **kwargs)
self._field = QSpinBox(self._base)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


class DistHistCutoffWidget(RangeWidget):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class HDFTrajectoryWidget(WidgetBase):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
source_object = kwargs.get("source_object", None)
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@


class InputFileWidget(WidgetBase):

def __init__(self, *args, file_dialog=QFileDialog.getOpenFileName, **kwargs):
super().__init__(*args, **kwargs)
configurator = kwargs.get("configurator", None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
class MDAnalysisCoordinateFileWidget(
MultiInputFileWidget, MDAnalysisTopologyFileWidget
):

def __init__(self, *args, file_dialog=QFileDialog.getOpenFileNames, **kwargs):
super().__init__(
*args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class MDAnalysisMDTrajTimeStepWidget(FloatWidget):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


class MDAnalysisTopologyFileWidget(InputFileWidget):

def __init__(self, *args, format_options=sorted(mda._PARSERS.keys()), **kwargs):
self.format_options = ["AUTO"] + list(format_options)
super().__init__(*args, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class MDTrajTopologyFileWidget(InputFileWidget):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@


class MultiInputFileWidget(InputFileWidget):

def __init__(self, *args, file_dialog=QFileDialog.getOpenFileNames, **kwargs):
super().__init__(
*args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class OptionalFloatWidget(WidgetBase):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@


class OutputTrajectoryWidget(WidgetBase):

def __init__(self, *args, **kwargs):
super().__init__(*args, layout_type="QGridLayout", **kwargs)
default_value = self._configurator.default
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@


class VectorModel(QStandardItemModel):

type_changed = Signal()
input_is_valid = Signal(bool)

Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class RangeWidget(WidgetBase):

def __init__(self, *args, **kwargs):
super().__init__(*args, layout_type="QGridLayout", **kwargs)
self.setup_fields(*args, **kwargs)
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/UnitCellWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class UnitCellWidget(WidgetBase):

def __init__(self, *args, **kwargs):
super().__init__(*args, layout_type="grid", **kwargs)
self._changing_label = QLabel("Unit cell", parent=self._base)
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


class WidgetBase(QObject):

valid_changed = Signal()
value_updated = Signal()
value_changed = Signal()
Expand Down
4 changes: 0 additions & 4 deletions MDANSE_GUI/Src/MDANSE_GUI/Session/StructuredSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


class UserSettingsModel(QStandardItemModel):

file_loaded = Signal(str)

def __init__(self, *args, settings_filename: str = "", **kwargs):
Expand Down Expand Up @@ -187,7 +186,6 @@ def writeout_settings(self):


class SettingsGroup:

def __init__(self, group_name: str) -> None:
self._name = group_name
self._settings = {}
Expand Down Expand Up @@ -261,9 +259,7 @@ def as_dict(self):


class SettingsFile:

def __init__(self, name, settings_path: str = None):

if settings_path is None:
settings_path = PLATFORM.application_directory()
self._top_name = name
Expand Down
7 changes: 0 additions & 7 deletions MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobState.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class JobState(ABC):

_label = "JobState"
_allowed_actions = []

Expand Down Expand Up @@ -54,7 +53,6 @@ def fail(self):


class Running(JobState):

_label = "Running"
_allowed_actions = [
"Pause",
Expand Down Expand Up @@ -92,7 +90,6 @@ def fail(self):


class Aborted(JobState):

_label = "Aborted"
_allowed_actions = ["Delete"]

Expand All @@ -119,7 +116,6 @@ def fail(self):


class Failed(JobState):

_label = "Failed"
_allowed_actions = ["Delete"]

Expand All @@ -146,7 +142,6 @@ def fail(self):


class Finished(JobState):

_label = "Finished"
_allowed_actions = ["Delete"]

Expand All @@ -173,7 +168,6 @@ def fail(self):


class Starting(JobState):

_label = "Starting"
_allowed_actions = [
"Pause",
Expand Down Expand Up @@ -206,7 +200,6 @@ def fail(self):


class Paused(JobState):

_label = "Paused"
_allowed_actions = [
"Resume",
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/Subprocess/Subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@


class Subprocess(Process):

def __init__(self, *args, **kwargs):
super().__init__()
job_name = kwargs.get("job_name")
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/Tabs/InstrumentTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@


class InstrumentTab(GeneralTab):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._core.add_button("Create Instrument", self._view.add_instrument)
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@


class GuiLogHandler(Handler):

def __init__(self, *args, **kwargs):
self._visualiser = None
super().__init__(*args, **kwargs)
Expand Down
2 changes: 0 additions & 2 deletions MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobHolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@


class JobThread(QThread):

def __init__(
self,
job_comm: "JobCommunicator",
Expand Down Expand Up @@ -90,7 +89,6 @@ def run(self):


class JobLogHandler(Handler):

def __init__(self):
super().__init__()
self.records = []
Expand Down
3 changes: 0 additions & 3 deletions MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/PlotDataModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def populate(self, file):


class DataSetItem(BasicPlotDataItem):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._item_type = "dataset"
Expand All @@ -79,7 +78,6 @@ def file_number(self) -> int:


class DataFileItem(BasicPlotDataItem):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._item_type = "file"
Expand All @@ -92,7 +90,6 @@ def file_number(self) -> int:


class MDADataStructure:

def __init__(self, filename: str):
self._file = h5py.File(filename)
self.check_metadata()
Expand Down
3 changes: 0 additions & 3 deletions MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/PlottingContext.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def get_mpl_colours():


class SingleDataset:

def __init__(self, name: str, source: "h5py.File"):
self._name = name
self._filename = source.filename
Expand Down Expand Up @@ -228,7 +227,6 @@ def planes_vs_axis(self, axis_number: int) -> List[np.ndarray]:


class SingleCurve:

def __init__(self, data_name: str, file_name: str, *args, **kwargs):
self._name = data_name
self._filename = file_name
Expand Down Expand Up @@ -289,7 +287,6 @@ def standard_items(self, key: int) -> List["QStandardItem"]:


class PlottingContext(QStandardItemModel):

needs_an_update = Signal()

def __init__(self, *args, unit_lookup=None, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@


class AxesWrapper:

def __init__(self, *args, **kwargs):
self._axes = kwargs.pop("axes", None)
self._plot_elements = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@


class NullNorms:

def __call__(self, *args, **kwds) -> float:
return 1.0
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@


class NullWeights:

def __call__(self, *args, **kwds) -> float:
return 1.0
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/Tabs/PlotSelectionTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@


class PlotSelectionTab(GeneralTab):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._core.add_button("Load .MDA results", self.load_files)
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/Tabs/PlotTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@


class PlotTab(GeneralTab):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._visualiser._unit_lookup = self
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/Tabs/Plotters/Grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


class Grid(Plotter):

def __init__(self) -> None:
super().__init__()
self._figure = None
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/Tabs/Plotters/Heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@


class Heatmap(Plotter):

def __init__(self) -> None:
super().__init__()
self._figure = None
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/Tabs/Plotters/Plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


class Plotter(metaclass=SubclassFactory):

def __init__(self) -> None:
self._figure = None
self._axes = []
Expand Down
1 change: 0 additions & 1 deletion MDANSE_GUI/Src/MDANSE_GUI/Tabs/Plotters/PlotterTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@


class PlotterTemplate(metaclass=SubclassFactory):

def __init__(self) -> None:
self._figure = None
self._axes = {}
Expand Down
Loading

0 comments on commit 22bbd45

Please sign in to comment.