From e51448bafb6ff2774baa973395880cc3d0debb2e Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson <oscar.gustafsson@gmail.com> Date: Wed, 18 Jan 2023 21:47:42 +0100 Subject: [PATCH] Even more documentation fixes --- .gitlab-ci.yml | 8 ++++---- b_asic/graph_component.py | 9 ++++++--- b_asic/operation.py | 9 +++++++-- b_asic/port.py | 7 +++++-- b_asic/scheduler_gui/compile.py | 31 ++++++++++++++++++++----------- b_asic/signal.py | 26 ++++++++++++++++++-------- b_asic/signal_flow_graph.py | 4 ++-- 7 files changed, 62 insertions(+), 32 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c4e0cbb2..ce19f75c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,13 +34,13 @@ run-test-3.10: image: python:3.10 extends: ".run-test" -run-test-3.11: - image: python:3.11 - extends: ".run-test" +#run-test-3.11: +# image: python:3.11 +# extends: ".run-test" pages: stage: deploy - image: python:3.11 + image: python:3.10 script: - sphinx-build -b html docs_sphinx public artifacts: diff --git a/b_asic/graph_component.py b/b_asic/graph_component.py index 32b8e170..89f7785c 100644 --- a/b_asic/graph_component.py +++ b/b_asic/graph_component.py @@ -67,21 +67,24 @@ class GraphComponent(ABC): @abstractmethod def param(self, name: str) -> Any: - """Get the value of a parameter. + """ + Get the value of a parameter. Returns None if the parameter is not defined. """ raise NotImplementedError @abstractmethod def set_param(self, name: str, value: Any) -> None: - """Set the value of a parameter. + """ + Set the value of a parameter. Adds the parameter if it is not already defined. """ raise NotImplementedError @abstractmethod def copy_component(self, *args, **kwargs) -> "GraphComponent": - """Get a new instance of this graph component type with the same name, id and parameters. + """ + Get a new instance of this graph component type with the same name, id and parameters. """ raise NotImplementedError diff --git a/b_asic/operation.py b/b_asic/operation.py index 9ee6d5ff..56999add 100644 --- a/b_asic/operation.py +++ b/b_asic/operation.py @@ -195,7 +195,11 @@ class Operation(GraphComponent, SignalSourceProvider): Get the current output at the given index of this operation, if available. The delays parameter will be used for lookup. The prefix parameter will be used as a prefix for the key string when looking for delays. - See also: current_outputs, evaluate_output, evaluate_outputs. + + See also + ======== + + current_outputs, evaluate_output, evaluate_outputs. """ raise NotImplementedError @@ -422,7 +426,8 @@ class AbstractOperation(Operation, AbstractGraphComponent): @abstractmethod def evaluate(self, *inputs) -> Any: # pylint: disable=arguments-differ - """Evaluate the operation and generate a list of output values given a list of input values. + """ + Evaluate the operation and generate a list of output values given a list of input values. """ raise NotImplementedError diff --git a/b_asic/port.py b/b_asic/port.py index a7598466..7b750451 100644 --- a/b_asic/port.py +++ b/b_asic/port.py @@ -80,8 +80,11 @@ class Port(ABC): If the entered signal still is connected to this port then disconnect the entered signal from the port as well. - Keyword arguments: - - signal: Signal to remove. + Parameters + ========== + + signal : Signal + Signal to remove. """ raise NotImplementedError diff --git a/b_asic/scheduler_gui/compile.py b/b_asic/scheduler_gui/compile.py index 957f5d44..5e367b7a 100644 --- a/b_asic/scheduler_gui/compile.py +++ b/b_asic/scheduler_gui/compile.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- -"""B-ASIC Scheduler-gui Resource and Form Compiler Module. +""" +B-ASIC Scheduler-gui Resource and Form Compiler Module. Compiles Qt5 resource and form files. Requires PySide2 or PyQt5 to be installed. If no arguments is given, the compiler search for and compiles all form (.ui) @@ -25,16 +25,20 @@ except ModuleNotFoundError: def _check_filenames(*filenames: str) -> None: - """Check if the filename(s) exist, otherwise raise FileNotFoundError - exception.""" + """ + Check if the filename(s) exist, otherwise raise FileNotFoundError + exception. + """ for filename in filenames: if not os.path.exists(filename): raise FileNotFoundError(filename) def _check_qt_version() -> None: - """Check if PySide2 or PyQt5 is installed, otherwise raise AssertionError - exception.""" + """ + Check if PySide2 or PyQt5 is installed, otherwise raise AssertionError + exception. + """ assert uic.PYSIDE2 or uic.PYQT5, "PySide2 or PyQt5 need to be installed" @@ -49,7 +53,8 @@ def replace_qt_bindings(filename: str) -> None: def compile_rc(*filenames: str) -> None: - """Compile resource file(s) given by 'filenames'. If no arguments are given, + """ + Compile resource file(s) given by 'filenames'. If no arguments are given, the compiler will search for resource (.qrc) files and compile accordingly. """ _check_qt_version() @@ -114,8 +119,10 @@ def compile_rc(*filenames: str) -> None: def compile_ui(*filenames: str) -> None: - """Compile form file(s) given by 'filenames'. If no arguments are given, the - compiler will search for form (.ui) files and compile accordingly.""" + """ + Compile form file(s) given by 'filenames'. If no arguments are given, the + compiler will search for form (.ui) files and compile accordingly. + """ _check_qt_version() def compile(filename: str) -> None: @@ -178,8 +185,10 @@ def compile_ui(*filenames: str) -> None: def compile_all(): - """The compiler will search for resource (.qrc) files and form (.ui) files - and compile accordingly.""" + """ + The compiler will search for resource (.qrc) files and form (.ui) files + and compile accordingly. + """ compile_rc() compile_ui() diff --git a/b_asic/signal.py b/b_asic/signal.py index b374400e..179817f4 100644 --- a/b_asic/signal.py +++ b/b_asic/signal.py @@ -66,8 +66,11 @@ class Signal(AbstractGraphComponent): connect to the entered source OutputPort. Also connect the entered source port to the signal if it hasn't already been connected. - Keyword arguments: - - src: OutputPort to connect as source to the signal. + Parameters + ========== + + src : OutputPort + OutputPort to connect as source to the signal. """ if src is not self._source: self.remove_source() @@ -76,12 +79,16 @@ class Signal(AbstractGraphComponent): src.add_signal(self) def set_destination(self, dest: "InputPort") -> None: - """Disconnect the previous destination InputPort of the signal and + """ + Disconnect the previous destination InputPort of the signal and connect to the entered destination InputPort. Also connect the entered destination port to the signal if it hasn't already been connected. - Keywords arguments: - - dest : InputPort to connect as destination to the signal. + Parameters + ========== + + dest : InputPort + InputPort to connect as destination to the signal. """ if dest is not self._destination: self.remove_destination() @@ -90,7 +97,8 @@ class Signal(AbstractGraphComponent): dest.add_signal(self) def remove_source(self) -> None: - """Disconnect the source OutputPort of the signal. If the source port + """ + Disconnect the source OutputPort of the signal. If the source port still is connected to this signal then also disconnect the source port. """ src = self._source @@ -108,8 +116,10 @@ class Signal(AbstractGraphComponent): dest.remove_signal(self) def dangling(self) -> bool: - """Returns true if the signal is missing either a source or a destination, - else false.""" + """ + Returns True if the signal is missing either a source or a destination, + else False. + """ return self._source is None or self._destination is None @property diff --git a/b_asic/signal_flow_graph.py b/b_asic/signal_flow_graph.py index e351c6cb..54cf0d18 100644 --- a/b_asic/signal_flow_graph.py +++ b/b_asic/signal_flow_graph.py @@ -1223,7 +1223,7 @@ class SFG(AbstractOperation): show_id : Boolean, optional If True, the graph_id:s of signals are shown. The default is False. - engine: string, optional + engine : string, optional Graphviz layout engine to be used, see https://graphviz.org/documentation/. Most common are "dot" and "neato". Default is None leading to dot. @@ -1274,7 +1274,7 @@ class SFG(AbstractOperation): show_id : Boolean, optional If True, the graph_id:s of signals are shown. The default is False. - engine: string, optional + engine : string, optional Graphviz layout engine to be used, see https://graphviz.org/documentation/. Most common are "dot" and "neato". Default is None leading to dot. """ -- GitLab