Skip to content

Commit 6e053a6

Browse files
authored
chore: added check to doc style (#128)
1 parent 83b4d0c commit 6e053a6

File tree

298 files changed

+10780
-12384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+10780
-12384
lines changed

.circleci/config.yml

+13
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,25 @@ jobs:
9494
pip install twine --user
9595
python setup.py sdist bdist_wheel
9696
twine check dist/*
97+
check-docstyle:
98+
docker:
99+
- image: *default-python
100+
environment:
101+
PIPENV_VENV_IN_PROJECT: true
102+
steps:
103+
- checkout
104+
- run:
105+
name: Checks compliance with Python docstring convention.
106+
command: |
107+
pip install pydocstyle --user
108+
pydocstyle --count influxdb_client
97109
98110
workflows:
99111
version: 2
100112
build:
101113
jobs:
102114
- check-code-style
115+
- check-docstyle
103116
- check-twine
104117
- tests-python:
105118
name: test-3.6

influxdb_client/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
# flake8: noqa
44

55
"""
6-
Influx API Service
6+
Influx API Service.
77
8-
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
8+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
99
10-
OpenAPI spec version: 0.1.0
11-
Generated by: https://openapi-generator.tech
10+
OpenAPI spec version: 0.1.0
11+
Generated by: https://openapi-generator.tech
1212
"""
1313

1414

influxdb_client/api_client.py

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# coding: utf-8
22
"""
3-
Influx API Service
3+
Influx API Service.
44
5-
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
5+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
66
7-
OpenAPI spec version: 0.1.0
8-
Generated by: https://openapi-generator.tech
7+
OpenAPI spec version: 0.1.0
8+
Generated by: https://openapi-generator.tech
99
"""
1010

1111
from __future__ import absolute_import
@@ -28,7 +28,7 @@
2828

2929

3030
class ApiClient(object):
31-
"""Generic API client for OpenAPI client library builds.
31+
"""Generic API client for OpenAPI client library Build.
3232
3333
OpenAPI generic API client. This client handles the client-
3434
server communication, and is invariant across implementations. Specifics of
@@ -64,6 +64,7 @@ class ApiClient(object):
6464

6565
def __init__(self, configuration=None, header_name=None, header_value=None,
6666
cookie=None, pool_threads=None):
67+
"""Initialize generic API client."""
6768
if configuration is None:
6869
configuration = Configuration()
6970
self.configuration = configuration
@@ -78,6 +79,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
7879
self.user_agent = 'influxdb-client-python/1.9.0dev'
7980

8081
def __del__(self):
82+
"""Dispose pools."""
8183
if self._pool:
8284
self._pool.close()
8385
self._pool.join()
@@ -87,23 +89,23 @@ def __del__(self):
8789

8890
@property
8991
def pool(self):
90-
"""Create thread pool on first request
91-
avoids instantiating unused threadpool for blocking clients.
92-
"""
92+
"""Create thread pool on first request avoids instantiating unused threadpool for blocking clients."""
9393
if self._pool is None:
9494
self._pool = ThreadPool(self.pool_threads)
9595
return self._pool
9696

9797
@property
9898
def user_agent(self):
99-
"""User agent for this API client"""
99+
"""User agent for this API client."""
100100
return self.default_headers['User-Agent']
101101

102102
@user_agent.setter
103103
def user_agent(self, value):
104+
"""Set User agent for this API client."""
104105
self.default_headers['User-Agent'] = value
105106

106107
def set_default_header(self, header_name, header_value):
108+
"""Set HTTP header for this API client."""
107109
self.default_headers[header_name] = header_value
108110

109111
def __call_api(
@@ -186,7 +188,7 @@ def __call_api(
186188
response_data.getheaders())
187189

188190
def sanitize_for_serialization(self, obj):
189-
"""Builds a JSON POST object.
191+
"""Build a JSON POST object.
190192
191193
If obj is None, return None.
192194
If obj is str, int, long, float, bool, return directly.
@@ -294,7 +296,7 @@ def call_api(self, resource_path, method,
294296
response_type=None, auth_settings=None, async_req=None,
295297
_return_http_data_only=None, collection_formats=None,
296298
_preload_content=True, _request_timeout=None):
297-
"""Makes the HTTP request (synchronous) and returns deserialized data.
299+
"""Make the HTTP request (synchronous) and Return deserialized data.
298300
299301
To make an async_req request, set the async_req parameter.
300302
@@ -351,7 +353,7 @@ def call_api(self, resource_path, method,
351353
def request(self, method, url, query_params=None, headers=None,
352354
post_params=None, body=None, _preload_content=True,
353355
_request_timeout=None):
354-
"""Makes the HTTP request using RESTClient."""
356+
"""Make the HTTP request using RESTClient."""
355357
if method == "GET":
356358
return self.rest_client.GET(url,
357359
query_params=query_params,
@@ -440,7 +442,7 @@ def parameters_to_tuples(self, params, collection_formats):
440442
return new_params
441443

442444
def prepare_post_parameters(self, post_params=None, files=None):
443-
"""Builds form parameters.
445+
"""Build form parameters.
444446
445447
:param post_params: Normal form parameters.
446448
:param files: File parameters.
@@ -468,7 +470,7 @@ def prepare_post_parameters(self, post_params=None, files=None):
468470
return params
469471

470472
def select_header_accept(self, accepts):
471-
"""Returns `Accept` based on an array of accepts provided.
473+
"""Return `Accept` based on an array of accepts provided.
472474
473475
:param accepts: List of headers.
474476
:return: Accept (e.g. application/json).
@@ -484,7 +486,7 @@ def select_header_accept(self, accepts):
484486
return ', '.join(accepts)
485487

486488
def select_header_content_type(self, content_types):
487-
"""Returns `Content-Type` based on an array of content_types provided.
489+
"""Return `Content-Type` based on an array of content_types provided.
488490
489491
:param content_types: List of content-types.
490492
:return: Content-Type (e.g. application/json).
@@ -500,7 +502,7 @@ def select_header_content_type(self, content_types):
500502
return content_types[0]
501503

502504
def update_params_for_auth(self, headers, querys, auth_settings):
503-
"""Updates header and query params based on authentication setting.
505+
"""Update header and query params based on authentication setting.
504506
505507
:param headers: Header parameters dict to be updated.
506508
:param querys: Query parameters tuple list to be updated.
@@ -524,7 +526,7 @@ def update_params_for_auth(self, headers, querys, auth_settings):
524526
)
525527

526528
def __deserialize_file(self, response):
527-
"""Deserializes body to file
529+
"""Deserializes body to file.
528530
529531
Saves response body into a file in a temporary folder,
530532
using the filename from the `Content-Disposition` header if provided.
@@ -615,7 +617,6 @@ def __deserialize_model(self, data, klass):
615617
:param klass: class literal.
616618
:return: model object.
617619
"""
618-
619620
if not klass.openapi_types and not hasattr(klass,
620621
'get_real_child_model'):
621622
return data

influxdb_client/client/__init__.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
from __future__ import absolute_import
2-
31
# flake8: noqa
42

3+
"""
4+
Influx API Service.
5+
6+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
7+
8+
OpenAPI spec version: 0.1.0
9+
Generated by: https://openapi-generator.tech
10+
"""
11+
12+
13+
from __future__ import absolute_import
14+
515
# import apis into api package
616
from influxdb_client.service.authorizations_service import AuthorizationsService
717
from influxdb_client.service.buckets_service import BucketsService

influxdb_client/client/authorizations_api.py

+26-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
"""Authorization is about managing the security of your InfluxDB instance."""
2+
13
from influxdb_client import Authorization, AuthorizationsService, User, Organization
24

35

46
class AuthorizationsApi(object):
7+
"""Implementation for '/api/v2/authorizations' endpoint."""
58

69
def __init__(self, influxdb_client):
10+
"""Initialize defaults."""
711
self._influxdb_client = influxdb_client
812
self._authorizations_service = AuthorizationsService(influxdb_client.api_client)
913

1014
def create_authorization(self, org_id=None, permissions: list = None,
1115
authorization: Authorization = None) -> Authorization:
1216
"""
13-
Creates an authorization
17+
Create an authorization.
18+
1419
:type permissions: list of Permission
1520
:param org_id: organization id
1621
:param permissions: list of permissions
@@ -26,15 +31,17 @@ def create_authorization(self, org_id=None, permissions: list = None,
2631

2732
def find_authorization_by_id(self, auth_id: str) -> Authorization:
2833
"""
29-
Finds authorization by id
34+
Find authorization by id.
35+
3036
:param auth_id: authorization id
3137
:return: Authorization
3238
"""
3339
return self._authorizations_service.get_authorizations_id(auth_id=auth_id)
3440

3541
def find_authorizations(self, **kwargs):
3642
"""
37-
Gets a list of all authorizations
43+
Get a list of all authorizations.
44+
3845
:param str user_id: filter authorizations belonging to a user id
3946
:param str user: filter authorizations belonging to a user name
4047
:param str org_id: filter authorizations belonging to a org id
@@ -47,58 +54,64 @@ def find_authorizations(self, **kwargs):
4754

4855
def find_authorizations_by_user(self, user: User):
4956
"""
50-
Finds authorization by User
57+
Find authorization by User.
58+
5159
:return: Authorization list
5260
"""
5361
return self.find_authorizations(user_id=user.id)
5462

5563
def find_authorizations_by_user_id(self, user_id: str):
5664
"""
57-
Finds authorization by user id
65+
Find authorization by user id.
66+
5867
:return: Authorization list
5968
"""
6069
return self.find_authorizations(user_id=user_id)
6170

6271
def find_authorizations_by_user_name(self, user_name: str):
6372
"""
64-
Finds authorization by user name
73+
Find authorization by user name.
74+
6575
:return: Authorization list
6676
"""
6777
return self.find_authorizations(user=user_name)
6878

6979
def find_authorizations_by_org(self, org: Organization):
7080
"""
71-
Finds authorization by user name
81+
Find authorization by user name.
82+
7283
:return: Authorization list
7384
"""
74-
7585
if isinstance(org, Organization):
7686
return self.find_authorizations(org_id=org.id)
7787

7888
def find_authorizations_by_org_name(self, org_name: str):
7989
"""
80-
Finds authorization by org name
90+
Find authorization by org name.
91+
8192
:return: Authorization list
8293
"""
8394
return self.find_authorizations(org=org_name)
8495

8596
def find_authorizations_by_org_id(self, org_id: str):
8697
"""
87-
Finds authorization by org id
98+
Find authorization by org id.
99+
88100
:return: Authorization list
89101
"""
90102
return self.find_authorizations(org_id=org_id)
91103

92104
def update_authorization(self, auth):
93105
"""
94-
Updates authorization object
106+
Update authorization object.
107+
95108
:param auth:
96109
:return:
97110
"""
98111
return self._authorizations_service.patch_authorizations_id(auth_id=auth.id, authorization_update_request=auth)
99112

100113
def clone_authorization(self, auth) -> Authorization:
101-
114+
"""Clone an authorization."""
102115
if isinstance(auth, Authorization):
103116
cloned = Authorization(org_id=auth.org_id, permissions=auth.permissions)
104117
# cloned.description = auth.description
@@ -112,6 +125,7 @@ def clone_authorization(self, auth) -> Authorization:
112125
raise ValueError("Invalid argument")
113126

114127
def delete_authorization(self, auth):
128+
"""Delete a authorization."""
115129
if isinstance(auth, Authorization):
116130
return self._authorizations_service.delete_authorizations_id(auth_id=auth.id)
117131

0 commit comments

Comments
 (0)