Skip to content

Commit 2144b5a

Browse files
committed
fix more doc strings
Signed-off-by: Chris Snow <[email protected]>
1 parent c8d65f7 commit 2144b5a

File tree

3 files changed

+57
-46
lines changed

3 files changed

+57
-46
lines changed

hpecp/client.py

+55-43
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1919
# OTHER DEALINGS IN THE SOFTWARE.
2020

21+
"""HPE Container Platform Client."""
22+
2123
from __future__ import absolute_import
2224

2325
import configparser
@@ -52,8 +54,9 @@
5254

5355

5456
class ContainerPlatformClient(object):
55-
"""Client object for HPE Container Platform. This is the central object
56-
that users of this library work with.
57+
"""Client object for HPE Container Platform.
58+
59+
This is the central object that users of this library work with.
5760
5861
Parameters
5962
----------
@@ -126,7 +129,6 @@ def create_from_config_file(
126129
username = admin
127130
password = admin123
128131
"""
129-
130132
if profile is None:
131133
profile = "default"
132134

@@ -230,23 +232,24 @@ def get_config_value(key, profile):
230232

231233
@classmethod
232234
def create_from_env(cls):
233-
"""Create an instance of ContainerPlatformClient from environment variables:
234-
235-
Variables::
236-
237-
HPECP_USERNAME
238-
HPECP_PASSWORD
239-
HPECP_API_HOST
240-
HPECP_API_PORT
241-
HPECP_USE_SSL
242-
HPECP_VERIFY_SSL
243-
HPECP_warn_ssl
244-
235+
"""Create an instance of ContainerPlatformClient from environment variables.
236+
237+
Variables
238+
---------
239+
HPECP_USERNAME
240+
HPECP_PASSWORD
241+
HPECP_API_HOST
242+
HPECP_API_PORT
243+
HPECP_USE_SSL
244+
HPECP_VERIFY_SSL
245+
HPECP_WARN_SSL
246+
247+
See Also
248+
--------
245249
See ContainerPlatformClient
246250
:py:class:`constructor <ContainerPlatformClient>` for the paramaeter
247251
definitions.
248252
"""
249-
250253
if "HPECP_USERNAME" in os.environ:
251254
HPECP_USERNAME = os.environ["HPECP_USERNAME"]
252255

@@ -288,7 +291,6 @@ def __init__(
288291
verify_ssl=True,
289292
warn_ssl=False,
290293
):
291-
"""Doc string is defined at the top of the class"""
292294
self._log = Logger().get_logger(self.__class__.__name__)
293295

294296
if verify_ssl == "True":
@@ -361,13 +363,11 @@ def __init__(
361363
self._role = RoleController(self)
362364

363365
def create_session(self):
364-
"""Create a session with the HPE CP controller defined in the object
365-
366-
:py:class:`ContainerPlatformClient`.
366+
"""Create a session with the HPE CP controller.
367367
368368
Returns
369369
-------
370-
ContainerPlatformClient:
370+
ContainerPlatformClient
371371
An instance of ContainerPlatformClient is returned.
372372
373373
Raises
@@ -377,7 +377,6 @@ def create_session(self):
377377
requests.exceptions.RequestException
378378
for exceptions that are not a connection error
379379
"""
380-
381380
url = self.base_url + "/api/v1/login"
382381
auth = {"name": self.username, "password": self.password}
383382

@@ -569,8 +568,9 @@ def _request(
569568

570569
@property
571570
def tenant(self):
572-
"""Reference to an object of type `.tenant.TenantController`. See
573-
the class :py:class:`.tenant.TenantController` for the methods
571+
"""Retrieve a reference to `.tenant.TenantController` object.
572+
573+
See the class :py:class:`.tenant.TenantController` for the methods
574574
available.
575575
576576
Example
@@ -587,8 +587,9 @@ def tenant(self):
587587

588588
@property
589589
def config(self):
590-
"""Reference to an object of type `.config.ConfigController`. See
591-
the class :py:class:`.config.ConfigController` for the methods
590+
"""Retrieve a reference to `.config.ConfigController` object.
591+
592+
See the class :py:class:`.config.ConfigController` for the methods
592593
available.
593594
594595
Example
@@ -619,12 +620,12 @@ def config(self):
619620
... }
620621
... )
621622
""" # noqa: E501
622-
623623
return self._config
624624

625625
@property
626626
def k8s_cluster(self):
627-
"""Reference to an object of type `.k8s_cluster.K8sClusterController`.
627+
"""Retrieve a reference to `.k8s_cluster.K8sClusterController` object.
628+
628629
See the class :py:class:`.k8s_cluster.K8sClusterController` for the
629630
methods available.
630631
@@ -642,7 +643,8 @@ def k8s_cluster(self):
642643

643644
@property
644645
def k8s_worker(self):
645-
"""Reference to an object of type `.k8s_worker.K8sWorkerController`.
646+
"""Retrieve a reference to `.k8s_worker.K8sWorkerController` object.
647+
646648
See the class :py:class:`.k8s_worker.K8sWorkerController` for the
647649
methods available.
648650
@@ -660,8 +662,9 @@ def k8s_worker(self):
660662

661663
@property
662664
def gateway(self):
663-
"""Reference to an object of type `.gateway.GatewayController`. See
664-
the class :py:class:`.gateway.GatewayController` for the methods
665+
"""Retrieve a reference to `.gateway.GatewayController` object.
666+
667+
See the class :py:class:`.gateway.GatewayController` for the methods
665668
available.
666669
667670
Example
@@ -678,8 +681,9 @@ def gateway(self):
678681

679682
@property
680683
def license(self):
681-
"""Reference to an object of type `.license.LicenseController`. See
682-
the class :py:class:`.license.LicenseController` for the methods
684+
"""Retrieve a reference to a `.license.LicenseController` object.
685+
686+
See the class :py:class:`.license.LicenseController` for the methods
683687
available.
684688
685689
Example
@@ -696,8 +700,10 @@ def license(self):
696700

697701
@property
698702
def lock(self):
699-
"""Reference to an object of type `.lock.LockController`. See the
700-
class :py:class:`.lock.LockController` for the methods available.
703+
"""Retrieve a reference to a `.lock.LockController` object.
704+
705+
See the class :py:class:`.lock.LockController` for the methods
706+
available.
701707
702708
Example
703709
-------
@@ -713,7 +719,9 @@ class :py:class:`.lock.LockController` for the methods available.
713719

714720
@property
715721
def log(self):
716-
"""Reference to :py:class:`.logger.Logger`. The log function can be
722+
"""Retrieve a reference to a `:py:class:`.logger.Logger`.
723+
724+
The log function can be
717725
called from controller objects via the `client` parameter passed in
718726
during instantiation of the controller.
719727
@@ -729,13 +737,14 @@ def some_method(self):
729737
...
730738
self.client.log.error("Some Error")
731739
"""
732-
733740
return self._log
734741

735742
@property
736743
def user(self):
737-
"""Reference to an object of type `.user.UserController`. See the
738-
class :py:class:`.lock.UserController` for the methods available.
744+
"""Retrieve a reference to a `.lock.LockController` object.
745+
746+
See the class :py:class:`.lock.UserController` for the methods
747+
available.
739748
740749
Example
741750
-------
@@ -751,8 +760,9 @@ class :py:class:`.lock.UserController` for the methods available.
751760

752761
@property
753762
def catalog(self):
754-
"""Reference to an object of type `.catalog.CatalogController`. See
755-
the class :py:class:`.catalog.CatalogController` for the methods
763+
"""Retrieve a reference to a `.catalog.CatalogController` object.
764+
765+
See the class :py:class:`.catalog.CatalogController` for the methods
756766
available.
757767
758768
Example
@@ -769,8 +779,10 @@ def catalog(self):
769779

770780
@property
771781
def role(self):
772-
"""Reference to an object of type `.role.RoleController`. See the
773-
class :py:class:`.role.RoleController` for the methods available.
782+
"""Retrieve a reference to a `.role.RoleController` object.
783+
784+
See the class :py:class:`.role.RoleController` for the methods
785+
available.
774786
775787
Example
776788
-------

setup.cfg

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ description-file = README.md
44
[flake8]
55
per-file-ignores = hpecp/__init__.py:F401
66
# Temporarily disable docstring violations
7-
hpecp/client.py:D101,D102,D100,D107,D105,D209,D400,D202,D205,D401,D200,D412
87
hpecp/catalog.py:D101,D102,D100,D107,D105,D209,D400,D202,D205,D401,D200,D412
98
hpecp/config.py:D101,D102,D100,D107,D105,D209,D400,D202,D205,D401,D200,D412
109
hpecp/gateway.py:D101,D102,D100,D107,D105,D209,D400,D202,D205,D401,D200,D412
@@ -16,7 +15,7 @@ per-file-ignores = hpecp/__init__.py:F401
1615
hpecp/exceptions.py:D101,D102,D100,D107,D105,D209,D400,D202,D205,D401,D200,D412
1716
hpecp/user.py:D101,D102,D100,D107,D105,D209,D400,D202,D205,D401,D200,D412
1817
hpecp/tenant.py:D101,D102,D100,D107,D105,D209,D400,D202,D205,D401,D200,D412
19-
hpecp/role.py:D101,D102,D100,D107,D105,D209,D400,D202,D205,D401,D200,D412
18+
exclude = hpecp/role.py
2019

2120
[pycodestyle]
2221
max-line-length = 79

tests/library/k8s_cluster_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def test_get_k8sclusters(self, mock_get, mock_post):
218218
"+-------------+-----------------------+\n"
219219
"| my cluster | /api/v2/k8scluster/20 |\n"
220220
"+-------------+-----------------------+",
221-
) # noqa: E131
221+
)
222222

223223

224224
class TestCreateCluster(TestCase):

0 commit comments

Comments
 (0)