From f53eeaea5c101bbf5eb8a2c5f8a92737df200f21 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.dos.anjos@gmail.com>
Date: Mon, 9 Nov 2020 18:30:03 +0100
Subject: [PATCH] [algorithm,database,dataformat,library] De-duplicated
 documentation of attributes

---
 beat/backend/python/algorithm.py  | 31 +++++++++++--------------------
 beat/backend/python/database.py   |  4 +---
 beat/backend/python/dataformat.py | 15 ++-------------
 beat/backend/python/library.py    | 13 ++-----------
 4 files changed, 16 insertions(+), 47 deletions(-)

diff --git a/beat/backend/python/algorithm.py b/beat/backend/python/algorithm.py
index 2190b40..ee6c448 100644
--- a/beat/backend/python/algorithm.py
+++ b/beat/backend/python/algorithm.py
@@ -404,8 +404,6 @@ class Algorithm(object):
 
     Attributes:
 
-      name (str): The algorithm name
-
       dataformats (dict): A dictionary containing all pre-loaded dataformats
         used by this algorithm. Data format objects will be of type
         :py:class:`.dataformat.DataFormat`.
@@ -413,15 +411,6 @@ class Algorithm(object):
       libraries (dict): A mapping object defining other libraries this
         algorithm needs to load so it can work properly.
 
-      uses (dict): A mapping object defining the required library import name
-        (keys) and the full-names (values).
-
-      parameters (dict): A dictionary containing all pre-defined parameters
-        that this algorithm accepts.
-
-      splittable (bool): A boolean value that indicates if this algorithm is
-        automatically parallelizeable by our backend.
-
       input_map (dict): A dictionary where the key is the input name and the
         value, its type. All input names (potentially from different groups)
         are comprised in this dictionary.
@@ -430,11 +419,6 @@ class Algorithm(object):
         value, its type. All output names (potentially from different groups)
         are comprised in this dictionary.
 
-      results (dict): If this algorithm is actually an analyzer (i.e., there
-        are no formal outputs, but results that must be saved by the platform),
-        then this dictionary contains the names and data types of those
-        elements.
-
       groups (dict): A list containing dictionaries with inputs and outputs
         belonging to the same synchronization group.
 
@@ -653,13 +637,13 @@ class Algorithm(object):
 
     @property
     def name(self):
-        """Returns the name of this object
+        """The name of this object
         """
         return self._name or "__unnamed_algorithm__"
 
     @name.setter
     def name(self, value):
-        """Sets the name of this object
+        """The name of this object
 
         Parameters:
             name (str): Name of this object
@@ -801,6 +785,8 @@ class Algorithm(object):
 
     @property
     def uses(self):
+        "Mapping object defining the required library import name (keys) and the full-names (values)"""
+
         return self.data.get("uses")
 
     @uses.setter
@@ -818,7 +804,12 @@ class Algorithm(object):
 
     @property
     def results(self):
-        """The results of this algorithm"""
+        """The results of this algorithm (analyzer) as a dictionary
+
+        If this algorithm is actually an analyzer (i.e., there are no formal
+        outputs, but results that must be saved by the platform), then this
+        dictionary contains the names and data types of those elements.
+        """
 
         return self.data.get("results")
 
@@ -829,7 +820,7 @@ class Algorithm(object):
 
     @property
     def parameters(self):
-        """The parameters of this algorithm"""
+        """Dictionary containing all pre-defined parameters that this algorithm accepts"""
 
         return self.data.get("parameters")
 
diff --git a/beat/backend/python/database.py b/beat/backend/python/database.py
index 1f5ce1d..d9af1c2 100644
--- a/beat/backend/python/database.py
+++ b/beat/backend/python/database.py
@@ -240,8 +240,6 @@ class Database(object):
 
     Attributes:
 
-      name (str): The full, valid name of this database
-
       data (dict): The original data for this database, as loaded by our JSON
         decoder.
 
@@ -330,7 +328,7 @@ class Database(object):
 
     @property
     def name(self):
-        """Returns the name of this object
+        """The full (valid) name of this database
         """
         return self._name or "__unnamed_database__"
 
diff --git a/beat/backend/python/dataformat.py b/beat/backend/python/dataformat.py
index fba3199..2d030fd 100644
--- a/beat/backend/python/dataformat.py
+++ b/beat/backend/python/dataformat.py
@@ -120,13 +120,6 @@ class DataFormat(object):
 
     Attributes:
 
-      name (str): The full, valid name of this dataformat
-
-      description (str): The short description string, loaded from the JSON
-        file if one was set.
-
-      documentation (str): The full-length docstring for this object.
-
       storage (object): A simple object that provides information about file
         paths for this dataformat
 
@@ -262,9 +255,7 @@ class DataFormat(object):
 
     @property
     def name(self):
-        """Returns the name of this object, either from the filename or composed
-        from the hierarchy it belongs.
-        """
+        """Name of this object, either from the filename or composed from the hierarchy it belongs."""
         if self.parent and self._name is None:
             return self.parent[0].name + "." + self.parent[1] + "_type"
         else:
@@ -362,12 +353,11 @@ class DataFormat(object):
 
     @property
     def description(self):
-        """The short description for this object"""
+        "Short description string, loaded from the JSON file if one was set"""
         return self.data.get("#description", None)
 
     @description.setter
     def description(self, value):
-        """Sets the short description for this object"""
         self.data["#description"] = value
 
     @property
@@ -383,7 +373,6 @@ class DataFormat(object):
 
     @documentation.setter
     def documentation(self, value):
-        """Sets the full-length description for this object"""
 
         if not self._name:
             raise RuntimeError("dataformat has no name")
diff --git a/beat/backend/python/library.py b/beat/backend/python/library.py
index 22bd721..db89e69 100644
--- a/beat/backend/python/library.py
+++ b/beat/backend/python/library.py
@@ -109,22 +109,12 @@ class Library(object):
 
     Attributes:
 
-      name (str): The library name
-
-      description (str): The short description string, loaded from the JSON
-        file if one was set.
-
-      documentation (str): The full-length docstring for this object.
-
       storage (object): A simple object that provides information about file
         paths for this library
 
       libraries (dict): A mapping object defining other libraries this library
         needs to load so it can work properly.
 
-      uses (dict): A mapping object defining the required library import name
-        (keys) and the full-names (values).
-
       errors (list): A list containing errors found while loading this
         library.
 
@@ -223,7 +213,7 @@ class Library(object):
 
     @property
     def name(self):
-        """Returns the name of this object"""
+        """The name of this object"""
 
         return self._name or "__unnamed_library__"
 
@@ -262,6 +252,7 @@ class Library(object):
 
     @property
     def uses(self):
+        """Mapping object defining the required library import name (keys) and the full-names (values)"""
         return self.data.get("uses")
 
     @uses.setter
-- 
GitLab