Browse Source

Fixed some methods' documentation

Roland Haroutiounian 7 years ago
parent
commit
adfe7b886a

+ 2
- 2
lodel/leapi/datahandlers/base_classes.py View File

@@ -421,7 +421,7 @@ class MultipleRef(Reference):
421 421
         return new_val
422 422
 
423 423
     ##@brief Utility method designed to fetch referenced objects
424
-    #@param value mixed : the field value
424
+    #@param values mixed : the field values
425 425
     #@return A list of LeObject child class instance
426 426
     #@throw LodelDataHandlerConsistencyException if some referenced objects
427 427
     #were not found
@@ -453,7 +453,7 @@ some referenced objects. Followinf uid were not found : %s" % ','.join(left))
453 453
 class DatasConstructor(object):
454 454
 
455 455
     ## @brief Init a DatasConstructor
456
-    # @param lec LeCrud : @ref LeObject child class
456
+    # @param leobject LeCrud : @ref LeObject child class
457 457
     # @param datas dict : dict with field name as key and field values as value
458 458
     # @param fields_handler dict : dict with field name as key and data handler instance as value
459 459
     def __init__(self, leobject, datas, fields_handler):

+ 0
- 2
lodel/leapi/datahandlers/datas.py View File

@@ -21,7 +21,6 @@ build its content'
21 21
     
22 22
     ##@brief Build its content with a field list and a format string
23 23
     # @param format_string str
24
-    # @param max_length int : the maximum length of the handled value
25 24
     # @param field_list list : List of field to use
26 25
     # @param **kwargs
27 26
     def __init__(self, format_string, field_list, **kwargs):
@@ -115,7 +114,6 @@ class Concat(FormatString):
115 114
     
116 115
     ##@brief Build its content with a field list and a separator
117 116
     # @param field_list list : List of field to use
118
-    # @param max_length int : the maximum length of the handled value
119 117
     # @param separator str
120 118
     # @param **kwargs    
121 119
     def __init__(self, field_list, separator = ' ', **kwargs):

+ 4
- 3
lodel/leapi/datahandlers/datas_base.py View File

@@ -44,9 +44,10 @@ class Integer(DataField):
44 44
         super().__init__( **kwargs)
45 45
 
46 46
     ##@brief Check and cast value in appropriate type
47
-    #@param value *
48
-    #@throw FieldValidationError if value is unappropriate or can not be cast 
49
-    #@return value
47
+    # @param value *
48
+    # @param strict bool : tells if the value must be an integer or a value that can be converted into an integer
49
+    # @throw FieldValidationError if value is unappropriate or can not be cast
50
+    # @return value
50 51
     def _check_data_value(self, value, strict = False):
51 52
         value = super()._check_data_value(value)
52 53
         if (strict and not isinstance(value, int)):

+ 10
- 8
lodel/leapi/datahandlers/references.py View File

@@ -16,9 +16,11 @@ class Link(SingleRef):
16 16
 class List(MultipleRef):
17 17
 
18 18
     ##@brief instanciates a list reference
19
-    # @param allowed_classes list | None : list of allowed em classes if None no restriction
20
-    # @param internal bool
19
+    # @param max_length int
21 20
     # @param kwargs
21
+    #   - allowed_classes list | None : list of allowed em classes if None no restriction
22
+    #   - internal bool
23
+
22 24
     def __init__(self, max_length = None, **kwargs):
23 25
         super().__init__(**kwargs)
24 26
 
@@ -43,9 +45,9 @@ a list : %s" % e)
43 45
 class Set(MultipleRef):
44 46
 
45 47
     ##@brief instanciates a set reference
46
-    # @param allowed_classes list | None : list of allowed em classes if None no restriction
47
-    # @param internal bool : if False, the field is not internal
48
-    # @param kwargs : Other named arguments
48
+    # @param kwargs : named arguments
49
+    #   - allowed_classes list | None : list of allowed em classes if None no restriction
50
+    #   - internal bool : if False, the field is not internal
49 51
     def __init__(self, **kwargs):
50 52
         super().__init__(**kwargs)
51 53
 
@@ -69,9 +71,9 @@ a set : %s" % e)
69 71
 class Map(MultipleRef):
70 72
 
71 73
     ##@brief instanciates a dict reference
72
-    # @param allowed_classes list | None : list of allowed em classes if None no restriction
73
-    # @param internal bool : if False, the field is not internal
74
-    # @param kwargs : Other named arguments
74
+    # @param kwargs : named arguments
75
+    #   - allowed_classes list | None : list of allowed em classes if None no restriction
76
+    #   - internal bool : if False, the field is not internal
75 77
     def __init__(self, **kwargs):
76 78
         super().__init__(**kwargs)
77 79
 

+ 0
- 1
lodel/leapi/lefactory.py View File

@@ -115,7 +115,6 @@ def forge_optval(optval):
115 115
 
116 116
 ##@brief Generate dyncode from an EmClass
117 117
 # @param model EditorialModel : 
118
-# @param emclass EmClass : EmClass instance
119 118
 # @todo delete imports. It is never use, consequently changed return parameters.
120 119
 # @return a tuple with emclass python code, a set containing modules name to import, and a list of python instruction to bootstrap dynamic code, in this order
121 120
 def generate_classes(model):

+ 1
- 1
lodel/leapi/lefactory_common.py View File

@@ -17,7 +17,7 @@ def name2class(name):
17 17
 ##@brief Return a dynamically generated class given it's name
18 18
 #@note Case insensitive version of name2class
19 19
 #@param name str
20
-#@retrun False or a child class of LeObject
20
+#@return False or a child class of LeObject
21 21
 def lowername2class(name):
22 22
     name = name.lower()
23 23
     new_dict = {k.lower():v for k,v in dynclasses_dict.items()}

+ 5
- 5
lodel/leapi/leobject.py View File

@@ -34,6 +34,7 @@ CLASS_ID_FIELDNAME = "classname"
34 34
 class LeObjectValues(object):
35 35
     
36 36
     ##@brief Construct a new LeObjectValues
37
+    # @param fieldnames_callback method
37 38
     # @param set_callback method : The LeObject.set_datas() method of corresponding LeObject class
38 39
     # @param get_callback method : The LeObject.get_datas() method of corresponding LeObject class
39 40
     def __init__(self, fieldnames_callback, set_callback, get_callback):
@@ -294,7 +295,7 @@ class LeObject(object):
294 295
 
295 296
     ##@brief Read only access to all datas
296 297
     # @note for fancy data accessor use @ref LeObject.g attribute @ref LeObjectValues instance
297
-    # @param name str : field name
298
+    # @param field_name str : field name
298 299
     # @return the Value
299 300
     # @throw RuntimeError if the field is not initialized yet
300 301
     # @throw NameError if name is not an existing field name
@@ -516,6 +517,7 @@ construction and consitency when datas are not complete\n")
516 517
     # @warning assert that datas is complete
517 518
     # @param cls
518 519
     # @param datas dict : Datas that have been returned by LeCrud.prepare_datas() method
520
+    # @param type_query str : Type of query to be performed , default value : insert
519 521
     @classmethod
520 522
     def make_consistency(cls, datas, type_query = 'insert'):
521 523
         for fname, dh in cls._fields.items():
@@ -565,8 +567,8 @@ construction and consitency when datas are not complete\n")
565 567
         return result
566 568
     
567 569
     ## @brief Delete instances of LeObject
568
-    #@param uids a list: lists of (fieldname, fieldvalue), with fieldname in cls._uids
569
-    #@returns the 
570
+    #@param query_filters list
571
+    #@returns the number of deleted items
570 572
     @classmethod
571 573
     def delete_bundle(cls, query_filters):
572 574
         deleted = 0
@@ -585,7 +587,6 @@ construction and consitency when datas are not complete\n")
585 587
             
586 588
     ## @brief Get instances of LeObject
587 589
     #
588
-    #@param target_class LeObject : class of object the query is about
589 590
     #@param query_filters dict : (filters, relational filters), with filters is a list of tuples : (FIELD, OPERATOR, VALUE) )
590 591
     #@param field_list list|None : list of string representing fields see 
591 592
     #@ref leobject_filters
@@ -593,7 +594,6 @@ construction and consitency when datas are not complete\n")
593 594
     #@param group list : A list of field names or tuple (FIELDNAME,[ASC | DESC])
594 595
     #@param limit int : The maximum number of returned results
595 596
     #@param offset int : offset
596
-    #@param Inst
597 597
     #@return a list of items (lists of (fieldname, fieldvalue))
598 598
     @classmethod
599 599
     def get(cls, query_filters, field_list=None, order=None, group=None, limit=None, offset=0):

+ 9
- 11
lodel/leapi/query.py View File

@@ -485,7 +485,7 @@ abstract LeObject : %s" % target_class)
485 485
         super().__init__(target_class)
486 486
     
487 487
     ## @brief Implements an insert query operation, with only one insertion
488
-    # @param new_datas : datas to be inserted
488
+    # @param datas : datas to be inserted
489 489
     def _query(self, datas):
490 490
         datas = self._target_class.prepare_datas(datas, True, False)
491 491
         id_inserted = self._rw_datasource.insert(self._target_class, datas)
@@ -544,8 +544,6 @@ target to LeUpdateQuery constructor"
544 544
         super().__init__(target_class, query_filters)
545 545
 
546 546
     ##@brief Implements an update query
547
-    #@param filters list : see @ref LeFilteredQuery
548
-    #@param rel_filters list : see @ref LeFilteredQuery
549 547
     #@param datas dict : datas to update
550 548
     #@returns the number of updated items
551 549
     #@todo change stategy for instance update. Datas should be allowed
@@ -599,12 +597,12 @@ class LeDeleteQuery(LeFilteredQuery):
599 597
         super().__init__(target_class, query_filter)
600 598
 
601 599
     ## @brief Execute the delete query
600
+    # @param datas
602 601
     def execute(self, datas=None):
603 602
         return super().execute()
604 603
 
605 604
     ##@brief Implements delete query operations
606
-    #@param filters list : see @ref LeFilteredQuery
607
-    #@param rel_filters list : see @ref LeFilteredQuery
605
+    # @param datas
608 606
     #@returns the number of deleted items
609 607
     def _query(self, datas=None):
610 608
         filters, rel_filters = self._query_filter
@@ -619,12 +617,12 @@ class LeGetQuery(LeFilteredQuery):
619 617
     #@param target_class LeObject : class of object the query is about
620 618
     #@param query_filters dict : {OP, list of query filters}
621 619
     # or tuple (FIELD, OPERATOR, VALUE) )
622
-    #@param field_list list|None : list of string representing fields see
623
-    # @ref leobject_filters
624
-    #@param order list : A list of field names or tuple (FIELDNAME,[ASC | DESC])
625
-    #@param group list : A list of field names or tuple (FIELDNAME,[ASC | DESC])
626
-    #@param limit int : The maximum number of returned results
627
-    #@param offset int : offset
620
+    #@param kwargs dict : other query-related arguments and options
621
+    #   - field_list list|None : list of string representing fields see @ref leobject_filters
622
+    #   - order list : A list of field names or tuple (FIELDNAME,[ASC | DESC])
623
+    #   - group list : A list of field names or tuple (FIELDNAME,[ASC | DESC])
624
+    #   - limit int : The maximum number of returned results
625
+    #   - offset int : offset
628 626
     def __init__(self, target_class, query_filters, **kwargs):
629 627
         super().__init__(target_class, query_filters)
630 628
         ##@brief The fields to get

+ 2
- 2
lodel/plugin/datasource_plugin.py View File

@@ -31,7 +31,7 @@ reimplemented by plugin datasource child class")
31 31
         self._abs_err()
32 32
 
33 33
     ##@brief returns a selection of documents from the datasource
34
-    #@param target_cls Emclass
34
+    #@param target Emclass
35 35
     #@param field_list list
36 36
     #@param filters list : List of filters
37 37
     #@param rel_filters list : List of relational filters
@@ -231,7 +231,7 @@ but %s is a %s" % (ds_name, pinstance.__class__.__name__))
231 231
         return pinstance
232 232
 
233 233
     ##@brief Return a datasource class given a datasource name
234
-    #@param ds_name str : datasource plugin name
234
+    #@param ds_plugin_name str : datasource plugin name
235 235
     #@throw PluginError if ds_name is not an existing plugin name
236 236
     #@throw PluginTypeError if ds_name is not the name of a DatasourcePlugin
237 237
     @classmethod

+ 0
- 1
lodel/plugin/plugins.py View File

@@ -883,7 +883,6 @@ CustomMethod::STATIC_METHOD, but got %s" % self._type)
883 883
     
884 884
     ##@brief called just after __init__
885 885
     #@param fun function : the decorated function
886
-    #@param return the function
887 886
     def __call__(self, fun):
888 887
         if self._method_name is None:
889 888
             self._method_name = fun.__name__

+ 1
- 1
lodel/plugin/scripts.py View File

@@ -81,7 +81,7 @@ class LodelScript(object, metaclass=MetaLodelScript):
81 81
         raise NotImplementedError("Static class")
82 82
     
83 83
     ##@brief Virtual method. Designed to initialize arguement parser.
84
-    #@param argparser ArgumentParser : Child class argument parser instance
84
+    #@param parser ArgumentParser : Child class argument parser instance
85 85
     #@return MUST return the argument parser (NOT SURE ABOUT THAT !! Maybe it \
86 86
     #works by reference)
87 87
     @classmethod

+ 2
- 2
lodel/plugins/dummy_datasource/datasource.py View File

@@ -18,10 +18,10 @@ class DummyDatasource(AbstractDatasource):
18 18
         pass
19 19
 
20 20
     ##@brief returns a selection of documents from the datasource
21
-    #@param target_cls Emclass
21
+    #@param target Emclass
22 22
     #@param field_list list
23 23
     #@param filters list : List of filters
24
-    #@param rel_filters list : List of relational filters
24
+    #@param relational_filters list : List of relational filters
25 25
     #@param order list : List of column to order. ex: order = [('title', 'ASC'),]
26 26
     #@param group list : List of tupple representing the column to group together. ex: group = [('title', 'ASC'),]
27 27
     #@param limit int : Number of records to be returned

+ 1
- 1
lodel/settings/settings.py View File

@@ -80,7 +80,7 @@ class Settings(object, metaclass=MetaSettings):
80 80
     
81 81
     ## @brief Instanciate the Settings singleton
82 82
     # @param conf_dir str : The configuration directory
83
-    #@param custom_confspec None | dict : if given overwrite default lodel2
83
+    #@param custom_confspecs None | dict : if given overwrite default lodel2
84 84
     #confspecs
85 85
     def __init__(self, conf_dir, custom_confspecs = None):
86 86
         self.singleton_assert() # check that it is the only instance

+ 4
- 1
lodel/settings/validator.py View File

@@ -406,7 +406,10 @@ SettingValidator.create_re_validator(
406 406
 ##@brief Append a piece of confspec
407 407
 #@note orig is modified during the process
408 408
 #@param orig dict : the confspec to update
409
-#@param upd dict : the confspec to add
409
+#@param section str : section name
410
+#@param key str
411
+#@param validator SettingValidator : the validator to use to check this configuration key's value
412
+#@param default
410 413
 #@return new confspec
411 414
 def confspec_append(orig, section, key, validator, default):
412 415
     if section not in orig:

+ 1
- 0
progs/slim/slim.py View File

@@ -281,6 +281,7 @@ def get_pid(name):
281 281
 
282 282
 ##@brief Start an instance
283 283
 #@param names list : instance name list
284
+#@param foreground bool
284 285
 def start_instances(names, foreground):
285 286
     pids = get_pids()
286 287
     store_datas = get_store_datas()

Loading…
Cancel
Save