From d9cc7e881f5f7586add02fd72e70019d67cad99b Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Wed, 10 Apr 2024 10:54:36 +0200 Subject: [PATCH] DOC: Sphinx now has hardly any errors left. --- src/caosadvancedtools/cfood.py | 6 ++-- src/caosadvancedtools/cfoods/h5.py | 5 ++- src/caosadvancedtools/json_schema_exporter.py | 4 +-- .../serverside/generic_analysis.py | 2 +- src/caosadvancedtools/suppressKnown.py | 11 +++--- src/caosadvancedtools/utils.py | 34 ++++++++++++------- src/doc/conf.py | 4 +++ 7 files changed, 40 insertions(+), 26 deletions(-) diff --git a/src/caosadvancedtools/cfood.py b/src/caosadvancedtools/cfood.py index c0da4f01..588476bd 100644 --- a/src/caosadvancedtools/cfood.py +++ b/src/caosadvancedtools/cfood.py @@ -27,12 +27,14 @@ CaosDB can automatically be filled with Records based on some structure, a file structure, a table or similar. + The Crawler will iterate over the respective items and test for each item whether a CFood class exists that matches the file path, i.e. whether CFood class wants to treat that pariticular item. If one does, it is instanciated to treat the match. This occurs in basically three steps: + 1. Create a list of identifiables, i.e. unique representation of CaosDB Records -(such as an experiment belonging to a project and a date/time). + (such as an experiment belonging to a project and a date/time). 2. The identifiables are either found in CaosDB or they are created. 3. The identifiables are update based on the date in the file structure. """ @@ -333,7 +335,7 @@ class AbstractFileCFood(AbstractCFood): out : str The regular expression, starting with ``.*\\.`` and ending with the EOL dollar character. The actual extension will be accessible in the - :py:attribute:`pattern group name<python:re.Pattern.groupindexe>` ``ext``. + :py:attr:`pattern group name <python:re.Pattern.groupindex>` ``ext``. """ if not extensions: diff --git a/src/caosadvancedtools/cfoods/h5.py b/src/caosadvancedtools/cfoods/h5.py index f3d41dd0..dfd6f290 100644 --- a/src/caosadvancedtools/cfoods/h5.py +++ b/src/caosadvancedtools/cfoods/h5.py @@ -22,8 +22,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. -"""A CFood for hdf5 files - +"""A CFood for hdf5 files. This module allows to parse hdf5 files and reproduce their structure in form of Records that reference each other. @@ -130,7 +129,7 @@ class H5CFood(AbstractFileCFood): @staticmethod def get_re(): - """Return a regular expression string to match *.h5, *.nc, *.hdf, *.hdf5.""" + """Return a regular expression string to match ``*.h5``, ``*.nc``, ``*.hdf``, ``*.hdf5``.""" extensions = [ "h5", "nc", diff --git a/src/caosadvancedtools/json_schema_exporter.py b/src/caosadvancedtools/json_schema_exporter.py index 3ac5247d..c36c9d0b 100644 --- a/src/caosadvancedtools/json_schema_exporter.py +++ b/src/caosadvancedtools/json_schema_exporter.py @@ -575,8 +575,8 @@ def recordtype_to_json_schema(rt: db.RecordType, additional_properties: bool = T wrap_files_in_objects : bool, optional Whether (lists of) files should be wrapped into an array of objects that have a file property. The sole purpose of this wrapping is to provide a - workaround for a `react-jsonschema-form - bug<https://github.com/rjsf-team/react-jsonschema-form/issues/3957>`_ so + workaround for a `react-jsonschema-form bug + <https://github.com/rjsf-team/react-jsonschema-form/issues/3957>`_ so only set this to True if you're using the exported schema with react-json-form and you are experiencing the bug. Default is False. diff --git a/src/caosadvancedtools/serverside/generic_analysis.py b/src/caosadvancedtools/serverside/generic_analysis.py index 85d0c860..7c7b26cc 100644 --- a/src/caosadvancedtools/serverside/generic_analysis.py +++ b/src/caosadvancedtools/serverside/generic_analysis.py @@ -38,7 +38,7 @@ Das aufgerufene Skript kann beliebige Eigenschaften benutzen und erstellen. ABER wenn die Standardeigenschaften (InputDataSet, etc) verwendet werden, kann der Record leicht erzeugt werden. - +.. code-block:: "Analyze" "Perform Anlysis" Knopf an Record Form im WebUI diff --git a/src/caosadvancedtools/suppressKnown.py b/src/caosadvancedtools/suppressKnown.py index c4b57039..1b31de7e 100644 --- a/src/caosadvancedtools/suppressKnown.py +++ b/src/caosadvancedtools/suppressKnown.py @@ -16,8 +16,11 @@ class SuppressKnown(logging.Filter): added to the appropriate Logger and logging calls (e.g. to warning, info etc.) need to have an additional `extra` argument. This argument should be a dict that contains an identifier and a category. - Example: `extra={"identifier":"<Record>something</Record>", - category="entities"} + + Example:: + + extra={"identifier":"<Record>something</Record>", category="entities"} + The identifier is used to check whether a message was shown before and should be a string. The category can be used to remove a specific group of messages from memory and the logger would show those messages again even @@ -74,9 +77,7 @@ class SuppressKnown(logging.Filter): return sha256((txt+str(identifier)).encode("utf-8")).hexdigest() def filter(self, record): - """ - Return whether the record shall be logged. - + """Return whether the record shall be logged. If either identifier of category is missing 1 is returned (logging enabled). If the record has both attributes, it is checked whether the diff --git a/src/caosadvancedtools/utils.py b/src/caosadvancedtools/utils.py index 4d6a4b36..05000a34 100644 --- a/src/caosadvancedtools/utils.py +++ b/src/caosadvancedtools/utils.py @@ -113,17 +113,22 @@ def read_field_as_list(field): return [field] -def get_referenced_files(glob, prefix=None, filename=None, location=None): +def get_referenced_files(glob: str, prefix: str = None, filename: str = None, location: str = None): """ queries the database for files referenced by the provided glob - Parameters: - glob: the glob referencing the file(s) - prefix: the glob can be relative to some path, in that case that path needs - to be given as prefix - filename: the file in which the glob is given (used for error messages) - location: the location in the file in which the glob is given (used for - error messages) + Parameters + ---------- + glob: str + the glob referencing the file(s) + prefix: str, optional + the glob can be relative to some path, in that case that path needs + to be given as prefix + filename: str, optional + the file in which the glob is given (used for error messages) + location: str, optional + the location in the file in which the glob is given (used for + error messages) """ orig_glob = glob @@ -161,16 +166,19 @@ def get_referenced_files(glob, prefix=None, filename=None, location=None): return files -def check_win_path(path, filename=None): +def check_win_path(path: str, filename: str = None): """ check whether '/' are in the path but no '\'. If that is the case, it is likely, that the path is not a Windows path. - Parameters: - path: path to be checked - filename: if the path is located in a file, this parameter can be used to - direct the user to the file where the path is located. + Parameters + ---------- + path: str + Path to be checked. + filename: str + If the path is located in a file, this parameter can be used to + direct the user to the file where the path is located. """ if r"\\" not in path and "/" in path: diff --git a/src/doc/conf.py b/src/doc/conf.py index 37397f24..db77cd71 100644 --- a/src/doc/conf.py +++ b/src/doc/conf.py @@ -199,3 +199,7 @@ autodoc_default_options = { 'members': None, 'undoc-members': None, } +autodoc_mock_imports = [ + "caosadvancedtools.bloxberg", + "labfolder", +] -- GitLab