From 45efa075daa81370c19b1487da7ab00675c84532 Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Wed, 10 Apr 2024 10:12:55 +0200 Subject: [PATCH] MAINT: Cleaning up Sphinx documentation. --- src/caosadvancedtools/cache.py | 17 +++++++++++------ src/caosadvancedtools/json_schema_exporter.py | 4 ++-- src/caosadvancedtools/models/parser.py | 10 +++++----- .../table_json_conversion/table_generator.py | 2 +- src/doc/conf.py | 4 ++-- src/doc/crawler.rst | 4 ++-- src/doc/index.rst | 5 +++-- 7 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/caosadvancedtools/cache.py b/src/caosadvancedtools/cache.py index cf74e330..bf1287ba 100644 --- a/src/caosadvancedtools/cache.py +++ b/src/caosadvancedtools/cache.py @@ -150,13 +150,18 @@ class AbstractCache(ABC): finally: conn.close() - def run_sql_commands(self, commands, fetchall=False): - """ - Run a list of SQL commands on self.db_file. + def run_sql_commands(self, commands, fetchall: bool = False): + """Run a list of SQL commands on self.db_file. + +Parameters +---------- + +commands: + List of sql commands (tuples) to execute - commands: list of sql commands (tuples) to execute - fetchall: When True, run fetchall as last command and return the results. - Otherwise nothing is returned. +fetchall: bool, optional + When True, run fetchall as last command and return the results. + Otherwise nothing is returned. """ conn = sqlite3.connect(self.db_file) c = conn.cursor() diff --git a/src/caosadvancedtools/json_schema_exporter.py b/src/caosadvancedtools/json_schema_exporter.py index 11e74369..3ac5247d 100644 --- a/src/caosadvancedtools/json_schema_exporter.py +++ b/src/caosadvancedtools/json_schema_exporter.py @@ -88,7 +88,7 @@ class JsonSchemaExporter: If True, do not attempt to connect to a LinkAhead server at all. Default is False. Note that the exporter may fail if this option is activated and the data model is not self-sufficient. - use_rt_pool : DataModel, optional + use_rt_pool : models.data_model.DataModel, optional If given, do not attempt to retrieve RecordType information remotely but from this parameter instead. multiple_choice : list[str], optional @@ -562,7 +562,7 @@ def recordtype_to_json_schema(rt: db.RecordType, additional_properties: bool = T parameter, the behavior is undefined. no_remote : bool, optional If True, do not attempt to connect to a LinkAhead server at all. Default is False. - use_rt_pool : DataModel, optional + use_rt_pool : models.data_model.DataModel, optional If given, do not attempt to retrieve RecordType information remotely but from this parameter instead. multiple_choice : list[str], optional diff --git a/src/caosadvancedtools/models/parser.py b/src/caosadvancedtools/models/parser.py index fa21aa13..f9bea924 100644 --- a/src/caosadvancedtools/models/parser.py +++ b/src/caosadvancedtools/models/parser.py @@ -248,7 +248,7 @@ debug : bool, optional Returns ------- - out : DataModel + out : data_model.DataModel The created DataModel """ with open(filename, 'r') as outfile: @@ -269,7 +269,7 @@ debug : bool, optional Returns ------- - out : DataModel + out : data_model.DataModel The created DataModel """ ymlmodel = yaml.load(string, Loader=SafeLineLoader) @@ -289,7 +289,7 @@ debug : bool, optional Returns ------- - out : DataModel + out : data_model.DataModel The created DataModel """ @@ -706,7 +706,7 @@ class JsonSchemaParser(Parser): Returns ------- - out : DataModel + out : data_model.DataModel The created DataModel """ # @author Florian Spreckelsen @@ -732,7 +732,7 @@ class JsonSchemaParser(Parser): Returns ------- - our : DataModel + our : data_model.DataModel The datamodel defined in `model_dict` """ # @review Timm Fitschen 2023-05-25 diff --git a/src/caosadvancedtools/table_json_conversion/table_generator.py b/src/caosadvancedtools/table_json_conversion/table_generator.py index 5caefc8d..8ca026a8 100644 --- a/src/caosadvancedtools/table_json_conversion/table_generator.py +++ b/src/caosadvancedtools/table_json_conversion/table_generator.py @@ -282,7 +282,7 @@ class XLSXTemplateGenerator(TableTemplateGenerator): foreign_keys: dict A configuration that defines which attributes shall be used to create additional columns when a list of references exists. See ``foreign_keys`` - argument of :ref:`TableTemplateGenerator.generate` . + argument of :meth:`TableTemplateGenerator.generate` . filepath: str The XLSX file will be stored under this path. """ diff --git a/src/doc/conf.py b/src/doc/conf.py index 590feca4..37397f24 100644 --- a/src/doc/conf.py +++ b/src/doc/conf.py @@ -64,7 +64,7 @@ master_doc = 'index' # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -190,7 +190,7 @@ epub_exclude_files = ['search.html'] # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { "python": ("https://docs.python.org/", None), - "caosdb-pylib": ("https://caosdb.gitlab.io/caosdb-pylib/", None), + "linkahead-pylib": ("https://docs.indiscale.com/caosdb-pylib/", None), } diff --git a/src/doc/crawler.rst b/src/doc/crawler.rst index aea02319..d7b351bb 100644 --- a/src/doc/crawler.rst +++ b/src/doc/crawler.rst @@ -77,8 +77,8 @@ problems. The exact behavior depends on your setup. However, you can have a look at the example in the `tests <https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/blob/main/integrationtests/crawl.py>`__. -.. Note:: The crawler depends on the CaosDB Python client, so make sure to install :doc:`pycaosdb - <caosdb-pylib:getting_started>`. +.. Note:: The crawler depends on the LinkAhead Python client, so make sure to install :doc:`pylinkahead + <linkahead-pylib:README_SETUP>`. Call ``python3 crawl.py --help`` to see what parameters can be provided. diff --git a/src/doc/index.rst b/src/doc/index.rst index 15a7b7ab..aa5cedca 100644 --- a/src/doc/index.rst +++ b/src/doc/index.rst @@ -4,8 +4,8 @@ Welcome to caosadvancedtools' documentation! Welcome to the advanced Python tools for CaosDB! -This documentation helps you to :doc:`get started<getting_started>`, explains the most important -:doc:`concepts<concepts>` and offers a range of :doc:`tutorials<tutorials>`. +This documentation helps you to :doc:`get started<README_SETUP>`, explains the most important +:doc:`concepts<concepts>` and offers a range of deep dives into specific sub-topics. .. toctree:: :maxdepth: 2 @@ -16,6 +16,7 @@ This documentation helps you to :doc:`get started<getting_started>`, explains th The Caosdb Crawler <crawler> YAML data model specification <yaml_interface> Specifying a datamodel with JSON schema <json_schema_interface> + Conversion between XLSX, JSON and LinkAhead Entities <table-json-conversion/specs> _apidoc/modules Related Projects <related_projects/index> Back to overview <https://docs.indiscale.com/> -- GitLab