Skip to content

Commit 8c80806

Browse files
global: fixes docstrings
Signed-off-by: Ioannis Tsanaktsidis <[email protected]>
1 parent 16d3d33 commit 8c80806

File tree

19 files changed

+36
-47
lines changed

19 files changed

+36
-47
lines changed

cap/factory.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
from __future__ import absolute_import, print_function
1212

1313
import os
14-
import sys
1514

16-
import pkg_resources
1715
from invenio_base.app import create_app_factory
1816
from invenio_base.wsgi import wsgi_proxyfix
1917
from invenio_cache import BytecodeCache
@@ -23,22 +21,14 @@
2321
from invenio_app.factory import (
2422
app_class,
2523
invenio_config_loader,
26-
instance_path,
27-
static_folder)
24+
instance_path
25+
)
2826

2927

3028
def config_loader(app, **kwargs_config):
31-
"""Configuration loader.
32-
33-
Adds support for loading templates from the Flask application's instance
34-
folder (``<instance_folder>/templates``).
35-
"""
36-
# This is the only place customize the Flask application right after
37-
# it has been created, but before all extensions etc are loaded.
29+
"""Add loading templates."""
3830
local_templates_path = os.path.join(app.instance_path, 'templates')
3931
if os.path.exists(local_templates_path):
40-
# Let's customize the template loader to look into packages
41-
# and application templates folders.
4232
app.jinja_loader = ChoiceLoader([
4333
FileSystemLoader(local_templates_path),
4434
app.jinja_loader,
@@ -64,4 +54,3 @@ def config_loader(app, **kwargs_config):
6454
instance_path=instance_path,
6555
app_class=app_class(),
6656
)
67-
"""Flask application factory for Invenio REST API."""

cap/modules/access/permissions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030

3131
def admin_permission_factory(view):
32-
"""Default factory for creating a permission for an admin.
32+
"""Create a permission for an admin.
3333
3434
It tries to load a :class:`invenio_access.permissions.DynamicPermission`
3535
instance if `invenio_access` is installed.

cap/modules/deposit/api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def _remove_user_permissions(self,
383383
user,
384384
permissions,
385385
session):
386-
"""Removes permissions for user for this deposit."""
386+
"""Remove permissions for user for this deposit."""
387387
for permission in permissions:
388388
session.delete(
389389
ActionUsers.query.filter(
@@ -440,7 +440,7 @@ def _init_owner_permissions(self, owner=current_user):
440440
self['_deposit']['owners'] = [owner.id]
441441

442442
def _construct_fileinfo(self, url, type):
443-
"""Constructs repo name or file name."""
443+
"""Construct repo name or file name."""
444444
url = url.rstrip('/')
445445
branch = None
446446
if type == 'repo':
@@ -602,7 +602,7 @@ def download_repo(pid, url, filename):
602602

603603

604604
def task_commit(record, response, filename, total):
605-
"""Commits file to the record."""
605+
"""Commit file to the record."""
606606
record.files[filename].file.set_contents(
607607
response,
608608
default_location=record.files.bucket.location.uri,
@@ -616,7 +616,7 @@ def ensure_content_length(
616616
session=None,
617617
max_size=FILES_URL_MAX_SIZE or 2**20,
618618
*args, **kwargs):
619-
"""Adds Content-Length when no present."""
619+
"""Add Content-Length when no present."""
620620
kwargs['stream'] = True
621621
session = session or requests.Session()
622622
r = session.request(method, url, *args, **kwargs)

cap/modules/deposit/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030

3131
def clean_empty_values(data):
32-
"""Removes empty values from model."""
32+
"""Remove empty values from model."""
3333
if not isinstance(data, (dict, list)):
3434
return data
3535
if isinstance(data, list):

cap/modules/experiments/views/atlas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
@atlas_bp.route('/yadage/workflow_submit', methods=['POST'])
4646
@atlas_permission.require(403)
4747
def yadage_workflow_submit():
48-
"""Submits a yadage workflow."""
48+
"""Submit a yadage workflow."""
4949
resp = request.get_json()
5050

5151
at = resp.get('at', None)

cap/modules/experiments/views/cms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
@cms_bp.route('/cadi/<cadi_id>', methods=['GET'])
4646
@cms_permission.require(403)
4747
def get_analysis_from_cadi(cadi_id):
48-
"""Retrieves specific CADI analysis."""
48+
"""Retrieve specific CADI analysis."""
4949
cadi_id = unquote(cadi_id).upper()
5050
url = current_app.config['CADI_GET_RECORD_URL'] + cadi_id
5151

@@ -67,7 +67,7 @@ def get_analysis_from_cadi(cadi_id):
6767
@cms_bp.route('/datasets', methods=['GET'])
6868
@cms_permission.require(403)
6969
def get_datasets_names():
70-
"""Retrieves specific dataset names."""
70+
"""Retrieve specific dataset names."""
7171
term = unquote(request.args.get('query', ''))
7272
query = {
7373
"suggest": {

cap/modules/experiments/views/lhcb.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
@lhcb_bp.route('/analysis', methods=['GET'])
4848
@lhcb_permission.require(403)
4949
def lhcb_get_analysis():
50-
"""Retrieves lhcb analysis."""
50+
"""Retrieve lhcb analysis."""
5151
query = unquote(request.args.get('query', ''))
5252
location = current_app.config.get('LHCB_DB_FILES_LOCATION', '')
5353

@@ -63,7 +63,7 @@ def lhcb_get_analysis():
6363
@lhcb_bp.route('/analysis/details', methods=['GET'])
6464
@lhcb_permission.require(403)
6565
def lhcb_get_analysis_data():
66-
"""Retrieves lhcb analysis data."""
66+
"""Retrieve lhcb analysis data."""
6767
title = unquote(request.args.get('title', ''))
6868
location = current_app.config.get('LHCB_DB_FILES_LOCATION', '')
6969

@@ -78,7 +78,7 @@ def lhcb_get_analysis_data():
7878
@lhcb_bp.route('/analysis/collisiondata/', methods=['GET'])
7979
@lhcb_permission.require(403)
8080
def lhcb_get_collision_data():
81-
"""Retrieves lhcb analysis collision data."""
81+
"""Retrieve lhcb analysis collision data."""
8282
stripping_line = request.args.get('stripping_line', '')
8383
params = parse_stripping_line(unquote(stripping_line))
8484
url = current_app.config.get('LHCB_GETCOLLISIONDATA_URL', '')
@@ -110,7 +110,7 @@ def lhcb_get_collision_data():
110110
@lhcb_bp.route('/analysis/platforms', methods=['GET'])
111111
@lhcb_permission.require(403)
112112
def lhcb_get_platforms():
113-
"""Retrieves lhcb analysis platforms."""
113+
"""Retrieve lhcb analysis platforms."""
114114
app = request.args.get('application', '').replace(' ', '-')
115115
url = current_app.config.get('LHCB_GETPLATFORM_URL', '') + app
116116

@@ -127,7 +127,7 @@ def lhcb_get_platforms():
127127

128128

129129
def get_soft_info(url):
130-
"""Retrieves lhcb analysis soft info."""
130+
"""Retrieve lhcb analysis soft info."""
131131
soft = version = ''
132132

133133
response = requests.get(url).json()
@@ -139,7 +139,7 @@ def get_soft_info(url):
139139

140140

141141
def parse_stripping_line(stripping_line):
142-
"""Parses stripping line."""
142+
"""Parse stripping line."""
143143
regex = r'Collision(?P<year>\d{2})' + \
144144
r'.*(?P<reco>Reco[^/]*)' + \
145145
r'.*(?P<stripping>Stripping[^/]*)'

cap/modules/fixtures/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def construct_draft_obj(schema, data):
5858

5959

6060
def get_entry_uuid_by_unique_field(index, dict_unique_field_value):
61-
"""Returns record by uuid."""
61+
"""Return record by uuid."""
6262
rs = RecordsSearch(index=index)
6363
res = rs.query(Q('match',
6464
**dict_unique_field_value)).execute().hits.hits
@@ -70,7 +70,7 @@ def get_entry_uuid_by_unique_field(index, dict_unique_field_value):
7070

7171

7272
def add_read_permission_for_egroup(deposit, egroup):
73-
"""Adds read permission for egroup."""
73+
"""Add read permission for egroup."""
7474
role = Role.query.filter_by(name=egroup).one()
7575
deposit._add_egroup_permissions(role,
7676
['deposit-read'],
@@ -81,7 +81,7 @@ def add_read_permission_for_egroup(deposit, egroup):
8181

8282
def add_drafts_from_file(file_path, schema,
8383
egroup=None, usermail=None, limit=None):
84-
"""Adds drafts from a specified file.
84+
"""Add drafts from a specified file.
8585
8686
Drafts with specified pid will be registered under those.
8787
For drafts without pid, new pids will be minted.

cap/modules/oauth2server/views/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
# Decorator
5151
#
5252
def client_getter():
53-
"""Decorator to retrieve Client object and check user permission."""
53+
"""Retrieve Client object and check user permission."""
5454
def wrapper(f):
5555
@wraps(f)
5656
def decorated(*args, **kwargs):
@@ -71,7 +71,7 @@ def decorated(*args, **kwargs):
7171

7272

7373
def token_getter(is_personal=True, is_internal=False):
74-
"""Decorator to retrieve Token object and check user permission.
74+
"""Retrieve Token object and check user permission.
7575
7676
:param is_personal: Search for a personal token. (Default: ``True``)
7777
:param is_internal: Search for a internal token. (Default: ``False``)

cap/modules/oauthclient/rest_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def token_delete(remote, token=''):
230230
# Error handling decorators
231231
#
232232
def oauth_error_handler(f):
233-
"""Decorator to handle exceptions."""
233+
"""Handle exceptions."""
234234
@wraps(f)
235235
def inner(*args, **kwargs):
236236
# OAuthErrors should not happen, so they are not caught here. Hence

0 commit comments

Comments
 (0)