Commit 94c352be authored by legac's avatar legac
Browse files

Replace (rtype, return) by returns

parent 85e0cb0d
......@@ -195,7 +195,7 @@ def to_field(field, composite=True, linkedcombo=True, **kwargs):
class. They are applied in the following order:
constructor, modifiers and keyword arguments.
:retruns: Field or C{None}
:returns: Field or C{None}
:note: Return None when composite is C{True} and when
the field is consumed by a C{FieldContainer}.
......@@ -800,7 +800,7 @@ def to_treeNodes():
The Node structure is defined in the application model using
L{ViewportModifier}.
:rtype: list
:returns: list
"""
cfg = []
......
......@@ -173,8 +173,8 @@ class DbSvc(BaseSvc):
"[table1.field1] belongs (1, 2, 3)"
"([table1.field1] == [table2.field2]) | ([table1.field2] == [table2.field1])"
:rtype: tuple of gluon.dal.Query
:return:
:returns:
tuple of gluon.dal.Query --:
- the first element is the full query with all conditions or an empty string.
- the second element contains only the left join conditions or an empty string.
- the third element contains only the filter conditions or an empty string.
......@@ -234,10 +234,10 @@ class DbSvc(BaseSvc):
:type id: int
:param id:
:rtype: dict
:return: key, value pairs where each key corresponds
to a field of the table. Foreign keys are resolved.
The key are encoded as C{Table1Field1}.
:returns:
dict -- key, value pairs where each key corresponds
to a field of the table. Foreign keys are resolved.
The key are encoded as C{Table1Field1}.
"""
db = current.globalenv['db']
......@@ -266,7 +266,7 @@ class DbSvc(BaseSvc):
:type field: gluon.dal.Field
:param field:
:rtype: bool
:returns: bool
"""
return field in current.globalenv['db'][table].fields
......@@ -283,10 +283,10 @@ class DbSvc(BaseSvc):
:param fields: key, value pairs where each key corresponds
to a C{gluon.dal.Field}
:rtype: dict
:return: key, value pairs for each field with errors.
The key is encoded as C{Table1Field1} and the value is a string
describing the error message.
:returns:
dict -- key, value pairs for each field with errors.
The key is encoded as C{Table1Field1} and the value is a string
describing the error message.
"""
di = {}
......@@ -363,9 +363,9 @@ class DbSvc(BaseSvc):
- The keys are encoded as C{Table1Field1}.
:rtype: gluon.storage.Storage
:return:
:returns:
gluon.storage.Storage
- C{Storage(errors=[], records=[])}
- One to one correspondence between the errors
......@@ -449,9 +449,9 @@ class DbSvc(BaseSvc):
- The keys are encoded as C{Table1Field1}.
:rtype: dict
:return:
:returns:
dict
- C{{success: True, records:[{Table1Field1: val, ... }, ... ],
msg: 'blalbla'}}
......@@ -537,8 +537,8 @@ class DbSvc(BaseSvc):
- C{records} the list of C{id} for the records
to be deleted, C{[id1, id2, ... ]}.
:rtype: dict
:return:
:returns:
dict
- C{{success: True, records:[{Table1Id1: id}, ...], msg: 'blalbla'}}
......@@ -642,8 +642,8 @@ class DbSvc(BaseSvc):
- sort
- dir
:rtype: dict
:return:
:returns:
dict
- C{{success: True, records: [{TableField: value, ...}, ...]}}
......@@ -754,8 +754,8 @@ class DbSvc(BaseSvc):
- The keys are encoded as C{Table1Field1}.
:rtype: dict
:return:
:returns:
dict
- C{{success: True, records:[{Table1Field1: val, ... }, ... ],
msg: 'blalbla'}}
......
......@@ -81,10 +81,12 @@ class DirectSvc(BaseSvc):
of the function / method on the server.
:rtype: str
:return:
- the response of the function / method run
on the server side
- the response is encoded as a JSON string.
:returns:
str --:
- the response of the function / method run
on the server side
- the response is encoded as a JSON string.
:raise gluon.http.HTTP: when the request has no arguments
or when the function / method crashed.
......@@ -134,8 +136,8 @@ class DirectSvc(BaseSvc):
:type f: function
:rtype: function
:return: f
:returns:
function -- the input argument
"""
......@@ -157,8 +159,8 @@ class DirectSvc(BaseSvc):
"""Route the myrequest to the appropriate function / method,
pass the proper arguments and return the results.
:rtype: str
:return: the response of the function / method
:returns:
str -- the response of the function / method
encoded as a JSON string.
:raise gluon.http.HTTP:
......
......@@ -168,7 +168,7 @@ class GridColumn(dict):
class GridColumnModel(list):
"""Configurator for C{Ext.grid.ColumnModel}.
:note:It is implemented as a C{list} of L{GridColumn}.
:note: It is implemented as a C{list} of L{GridColumn}.
"""
......
......@@ -12,7 +12,7 @@ def CLEAN_COMMA(value):
:type value: str or unicode
:param value:
:rtype: str or unicode
:returns: str or unicode
:note: return the value unchanged when it is not a string.
......@@ -30,7 +30,7 @@ def CLEAN_SPACES(value):
:type value: str or unicode
:param value:
:rtype: str or unicode
:returns: str or unicode
:note: return the value unchanged when it is not a string.
......
......@@ -32,7 +32,7 @@ def as_list(val):
:type val: any
:param val: input value
:rtype: list
:returns: list
"""
if not isinstance(val, (list, tuple)):
......@@ -66,7 +66,7 @@ def decode_field(field):
:type field: str
:rtype: tuple
:returns: tuple
"""
li = []
......@@ -94,7 +94,7 @@ def dummy_row(table, value=''):
:type value: string
:param value: value associated to each field either an empty string of None
:rtype: gluon.dal.Row
:returns: gluon.dal.Row
"""
db = table._db
......@@ -120,7 +120,7 @@ def encode_field(*args):
"""Encode the string arguments into a CapitalizeWords.
The reverse function is L{decode_field}.
:rtype: str
:returns: str
:note: useful to build database field name like C{TableField}
or C{TableFieldFunc}.
......@@ -142,9 +142,9 @@ def encode_validator_errors(error):
:param error: the key is the table field encode as C[TablenameFieldname]
while the value is the error message return by the validator
:rtype: dict
:return: error message are translated and should be more friendly
since it contains the field name with its error.
:returns:
dict -- error message are translated and should be more friendly
since it contains the field name with its error.
"""
di = {}
......@@ -161,7 +161,7 @@ def get_all_tables(dal):
:type dal: gluon.dal.DAL
:param dal:
:rtype: list
:returns: list
:note: It is recommend to use standard iterator provided by
the gluon.dal.DAL class. However by construction, they ignore
......@@ -184,8 +184,7 @@ def get_create_id(table, **kwargs):
:type table: gluon.dal.Table
:rtype: int
:return: the C{id} of the record.
:returns: int -- the C{id} of the record.
"""
id = get_id(table, **kwargs)
......@@ -202,10 +201,10 @@ def get_field_validators(field):
:type field: gluon.dal.Field
:rtype: dict
:return: The keys depend on the validators.
Typical one are C{minValue}, C{maxValue}, C{regex}, C{regexText},
C{maxLength}, C{minLength}, ...
:returns:
dict -- The keys depend on the validators.
Typical one are C{minValue}, C{maxValue}, C{regex}, C{regexText},
C{maxLength}, C{minLength}, ...
"""
cfg = {}
......@@ -277,8 +276,7 @@ def get_file_paths(path, ext=None, alpha=True):
:type alpha: bool
:param alpha: sort the paths in alphabetic order
:rtype: list
:return: local paths for all selected files.
:returns: list -- local paths for all selected files.
"""
li = []
......@@ -311,8 +309,8 @@ def get_foreign_field(field):
:type field: gluon.dal.Field
:rtype: tuple
:return:
:returns:
tuple
- C{(k_tablename, k_fieldname, k_keyname)}
......@@ -370,8 +368,7 @@ def get_id(table, **kwargs):
:type table: gluon.dal.Table
:rtype: int or None
:return: the C{id} of the record.
:returns: int or None -- the C{id} of the record.
"""
query = None
......@@ -394,8 +391,7 @@ def get_language():
"""Get the primary language of the application from the HTML
language code, I{i.e} C{en}, C{fr}, ....
:rtype: str
:return:
:returns: str
"""
lg = current.T.accepted_language
......@@ -415,8 +411,9 @@ def get_plugin_path(plugin_name):
:type plugin_name: str
:param plugin_name: name of the plugin, I{i.e} C{"plugin_dbui"}.
:rtype: str
:return:
:returns:
str
- the path of the first directory starting with C{plugin_name}.
- the local path is relative to the application directory.
- C{None} if the plugin is not found.
......@@ -443,8 +440,7 @@ def get_reference_paths():
- The local path is relative to the applications directory.
It is useful on the client-side
:rtype: tuple
:return: C{("applications/myapp", "/myapp")}
:returns: tuple -- C{("applications/myapp", "/myapp")}
"""
server_path = os.path.join('applications', current.request.application)
......@@ -459,7 +455,7 @@ def get_set_field(field):
:type field: gluon.dal.Field
:param field:
:rtype: list
:returns: list
"""
validators = as_list(field.requires)
......@@ -500,7 +496,9 @@ def get_script_path(plugin):
:param plugin:
:rtype: str
:return:
:returns:
str
- the local path of the script file
- the local paths is relative to the application directory.
......@@ -533,8 +531,7 @@ def get_store_id(name):
"""Build the store identifier using C{name}.
:type name: str
:rtype: str
:return: C{nameStore}
:returns: str -- C{nameStore}
"""
return STOREID % name
......@@ -543,9 +540,9 @@ def get_store_id(name):
def get_versions():
"""Get the versions of the application and plugins.
:rtype: list of dict
:return: each dictionary contains the name of the software
and its version identifier. The keys are C{code} and C{version}
:returns:
list of dict -- each dictionary contains the name of the software
and its version identifier. The keys are C{code} and C{version}
"""
server_path, client_path = get_reference_paths()
......@@ -644,8 +641,8 @@ def get_where_query(table):
:type table: gluon.dal.Table
:param table:
:rtype: gluon.dal.Query or None
:return: C{None} when the table has no foreign key
:returns:
gluon.dal.Query or None -- C{None} when the table has no foreign key
"""
db = table._db
......@@ -672,7 +669,7 @@ def is_foreign_field(field):
:type field: gluon.dal.Field
:param field:
:rtype: bool
:returns: bool
"""
return field.type.startswith("reference")
......@@ -681,8 +678,7 @@ def is_foreign_field(field):
def is_mathjax():
"""Return C{True} when the plugin mathjax is installed.
:rtype: bool
:return:
:returns: bool
"""
return get_plugin_path('plugin_mathjax') != None
......@@ -694,7 +690,7 @@ def is_set_field(field):
:type field: gluon.dal.Field
:rtype: bool
:returns: bool
"""
validators = as_list(field.requires)
......@@ -712,7 +708,7 @@ def is_table_with_foreign_fields(table):
:type table: gluon.dal.Table
:rtype: bool
:returns: bool
"""
for field in table:
......@@ -727,12 +723,14 @@ def rows_serializer(rows):
table and where function are applied.
:type rows: gluon.dal.Rows
:rtype: list
:return:
- C{[{Table1Field1: val1,...}, {Table1Field1: val2,...}, ...]}
- A dictionary per row.
- Field are encoded as TableField.
- Field with an applied function like COUNT(table.field)
:returns:
list
* C{[{Table1Field1: val1,...}, {Table1Field1: val2,...}, ...]}
* A dictionary per row.
* Field are encoded as TableField.
* Field with an applied function like COUNT(table.field)
are encoded as TableFieldCount.
"""
......
......@@ -10,8 +10,7 @@ def map_default(fields):
:type fields: list
:param fields: list of database field names
:rtype: list
:return: the input list
:returns: list -- the input list
"""
return fields
......@@ -25,8 +24,7 @@ def map_tabpanel(fieldsets):
:type fieldsets: list of FieldSet
:rtype: list
:return: the C{TapPanel} encapsulated in a list.
:returns: list -- the C{TapPanel} encapsulated in a list.
"""
......
......@@ -82,8 +82,8 @@ class Node(object):
def get_node(self):
"""Get the dictionary defining the node.
:rtype: dict
:return:
:returns:
dict
- C{text} (str): name of the node
......
......@@ -126,8 +126,7 @@ class Selector(Storage):
def as_dict(self):
"""Return the selector fields and their values.
:rtype: dict
:return:
:returns: dict
"""
di = {}
......@@ -139,8 +138,7 @@ class Selector(Storage):
def fields(self):
"""Get the list of field names defined in the selector.
:rtype: list
:return:
:returns: list
"""
li = []
......@@ -161,7 +159,7 @@ class Selector(Storage):
:type table: gluon.dal.Table
:rtype: gluon.dal.Query
:returns: gluon.dal.Query
"""
db = table._db
......@@ -202,8 +200,7 @@ class Selector(Storage):
def repr_url(self):
"""Get the URL string corresponding to the current request.
:rtype: str
:return:
:returns: str
"""
vars = []
......@@ -241,7 +238,7 @@ class Selector(Storage):
The keyword arguments are those of the
gluon.dal.Set.select method: orderby, groupby, ....
:rtype: gluon.dal.Rows
:returns: gluon.dal.Rows
"""
db = table._db
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment