Skip to content
Snippets Groups Projects
Commit 36a81616 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

DOC STY: Formatting of docstrings.

parent 0ae5bed5
Branches
Tags
2 merge requests!22Release 0.3,!3Bloxberg proof of concept
...@@ -171,13 +171,16 @@ class UpdateCache(Cache): ...@@ -171,13 +171,16 @@ class UpdateCache(Cache):
return old_ones return old_ones
def insert(self, cont, run_id): def insert(self, cont, run_id):
""" insert a pending, unauthorized update """Insert a pending, unauthorized update
Parameters:
----------- Parameters
----------
cont: Container with the records to be updated containing the desired cont: Container with the records to be updated containing the desired
version, i.e. the state after the update. version, i.e. the state after the update.
run_id: the id of the crawler run
run_id: int
The id of the crawler run
""" """
cont = put_in_container(cont) cont = put_in_container(cont)
old_ones = UpdateCache.get_previous_version(cont) old_ones = UpdateCache.get_previous_version(cont)
......
"""Submodule for working with data models.
"""
...@@ -106,7 +106,7 @@ class DataModel(dict): ...@@ -106,7 +106,7 @@ class DataModel(dict):
print(ent.name) print(ent.name)
if noquestion or str(input("Do you really want to insert those " if noquestion or str(input("Do you really want to insert those "
"entities? [y] ")).lower() == "y": "entities? [y/N] ")).lower() == "y":
non_existing_entities.insert() non_existing_entities.insert()
self.sync_ids_by_name(non_existing_entities) self.sync_ids_by_name(non_existing_entities)
print("Updated entities.") print("Updated entities.")
...@@ -131,7 +131,7 @@ class DataModel(dict): ...@@ -131,7 +131,7 @@ class DataModel(dict):
if any_change: if any_change:
if noquestion or input("Do you really want to apply the above " if noquestion or input("Do you really want to apply the above "
"changes? [y]") == "y": "changes? [y/N]") == "y":
existing_entities.update() existing_entities.update()
print("Synchronized existing entities.") print("Synchronized existing entities.")
else: else:
...@@ -171,9 +171,7 @@ class DataModel(dict): ...@@ -171,9 +171,7 @@ class DataModel(dict):
A iterable with entities. A iterable with entities.
names : iterable of str names : iterable of str
Only entities which do *not* have one of these names will end up in Only entities which do *not* have one of these names will end up in
the the returned iterable.
returned iterable.
Returns Returns
------- -------
......
""" """
This script provides methods to read a DataModel from a yaml file. This module (and script) provides methods to read a DataModel from a YAML file.
If a file name is passed to parse_model_from_yaml it is parsed and a DataModel If a file name is passed to parse_model_from_yaml it is parsed and a DataModel
is created. The yaml file needs to be structured in a certain way which will be is created. The yaml file needs to be structured in a certain way which will be
...@@ -13,7 +13,7 @@ and will be added with the respective importance. These properties can be ...@@ -13,7 +13,7 @@ and will be added with the respective importance. These properties can be
RecordTypes or Properties and can be defined right there. RecordTypes or Properties and can be defined right there.
Every Property or RecordType only needs to be defined once anywhere. When it is Every Property or RecordType only needs to be defined once anywhere. When it is
not defined, simply the name can be supplied with no value. not defined, simply the name can be supplied with no value.
Parents can be provided under the inherit_from_xxxx keywords. The value needs Parents can be provided under the 'inherit_from_xxxx' keywords. The value needs
to be a list with the names. Here, NO NEW entities can be defined. to be a list with the names. Here, NO NEW entities can be defined.
""" """
import re import re
...@@ -24,9 +24,10 @@ import yaml ...@@ -24,9 +24,10 @@ import yaml
from .data_model import DataModel from .data_model import DataModel
# Keywords which are allowed in data model descriptions.
KEYWORDS = ["parent", KEYWORDS = ["parent",
"importance", "importance",
"datatype", "datatype", # for example TEXT, INTEGER or REFERENCE
"unit", "unit",
"description", "description",
"recommended_properties", "recommended_properties",
......
...@@ -17,12 +17,13 @@ ...@@ -17,12 +17,13 @@
# sys.path.insert(0, os.path.abspath('../caosdb')) # sys.path.insert(0, os.path.abspath('../caosdb'))
# -- Project information -----------------------------------------------------
import sphinx_rtd_theme import sphinx_rtd_theme
# -- Project information -----------------------------------------------------
project = 'caosadvancedtools' project = 'caosadvancedtools'
copyright = '2020, IndiScale GmbH' copyright = '2021, IndiScale GmbH'
author = 'Daniel Hornung' author = 'Daniel Hornung'
# The short X.Y version # The short X.Y version
...@@ -92,6 +93,9 @@ html_theme = "sphinx_rtd_theme" ...@@ -92,6 +93,9 @@ html_theme = "sphinx_rtd_theme"
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static'] html_static_path = ['_static']
# Disable static path to remove warning.
html_static_path = []
# Custom sidebar templates, must be a dictionary that maps document names # Custom sidebar templates, must be a dictionary that maps document names
# to template names. # to template names.
...@@ -185,10 +189,11 @@ epub_exclude_files = ['search.html'] ...@@ -185,10 +189,11 @@ epub_exclude_files = ['search.html']
# Example configuration for intersphinx: refer to the Python standard library. # Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = { intersphinx_mapping = {
'https://docs.python.org/': None, "python": ("https://docs.python.org/", None),
"caosdb-pylib": ("https://caosdb.gitlab.io/caosdb-pylib/", None), "caosdb-pylib": ("https://caosdb.gitlab.io/caosdb-pylib/", None),
} }
# TODO Which options do we want? # TODO Which options do we want?
autodoc_default_options = { autodoc_default_options = {
'members': None, 'members': None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment