Skip to content

Commit 00cc0e3

Browse files
committed
add flake8 checks
Signed-off-by: Chris Snow <[email protected]>
1 parent 97ebf39 commit 00cc0e3

File tree

14 files changed

+169
-150
lines changed

14 files changed

+169
-150
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
install:
3030
- pip3 install flake8 # TODO: install 'flake8-docstrings'
3131
script:
32-
- flake8 bin/ # TODO: add docstring 'flake8 --docstring-convention numpy hpecp/ bin/ tests/'
32+
- flake8 bin/ hpecp/ # TODO: add docstring 'flake8 --docstring-convention numpy hpecp/ bin/ tests/'
3333
- stage: format
3434
name: "Check code formatting"
3535
python: 3.8

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@
2020
"python.testing.nosetestsEnabled": false,
2121
"python.linting.pylintEnabled": false,
2222
"python.linting.flake8Enabled": true,
23+
"python.linting.flake8Args": [
24+
"per-file-ignores=hpecp/__init__.py:F401"
25+
],
2326
"python.linting.enabled": true,
2427
"python.formatting.provider": "black",
2528
"python.pythonPath": "/bin/python3",
2629
"python.envFile": "${workspaceFolder}/gitpod.env",
2730
"editor.formatOnSave": true,
2831
"files.insertFinalNewline": true,
2932
"git.alwaysSignOff": true
30-
}
33+
}

hpecp/catalog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ def tabulate(
266266

267267
self.display_columns = columns
268268

269-
# FIXME: https://github.com/hpe-container-platform-community/hpecp-python-library/issues/5
269+
# FIXME:
270+
# https://github.com/hpe-container-platform-community/hpecp-python-library/issues/5
270271
if display_headers:
271272
return tabulate(self, headers=columns, tablefmt=style)
272273
else:

hpecp/client.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class ContainerPlatformClient(object):
7272
use_ssl : bool:
7373
Connect to HPECP using SSL: True|False
7474
verify_ssl : bool|str
75-
See "https://requests.readthedocs.io/en/master/user/advanced/#ssl-cert-verification"
75+
See "https://requests.readthedocs.io/en/master/user/advanced/
76+
#ssl-cert-verification"
7677
warn_ssl : bool
7778
Disable ssl warnings
7879
@@ -244,25 +245,25 @@ def create_from_env(cls):
244245
"""
245246

246247
if "HPECP_USERNAME" in os.environ:
247-
HPECP_USERNAME = os.environ[HPECP_USERNAME]
248+
HPECP_USERNAME = os.environ["HPECP_USERNAME"]
248249

249250
if "HPECP_PASSWORD" in os.environ:
250-
HPECP_PASSWORD = os.environ[HPECP_PASSWORD]
251+
HPECP_PASSWORD = os.environ["HPECP_PASSWORD"]
251252

252253
if "HPECP_API_HOST" in os.environ:
253-
HPECP_API_HOST = os.environ[HPECP_API_HOST]
254+
HPECP_API_HOST = os.environ["HPECP_API_HOST"]
254255

255256
if "HPECP_API_PORT" in os.environ:
256-
HPECP_API_PORT = os.environ[HPECP_API_PORT]
257+
HPECP_API_PORT = os.environ["HPECP_API_PORT"]
257258

258259
if "HPECP_USE_SSL" in os.environ:
259-
HPECP_USE_SSL = os.environ[HPECP_USE_SSL]
260+
HPECP_USE_SSL = os.environ["HPECP_USE_SSL"]
260261

261262
if "HPECP_VERIFY_SSL" in os.environ:
262-
HPECP_VERIFY_SSL = os.environ[HPECP_VERIFY_SSL]
263+
HPECP_VERIFY_SSL = os.environ["HPECP_VERIFY_SSL"]
263264

264-
if "HPECP_warn_ssl" in os.environ:
265-
HPECP_warn_ssl = os.environ[HPECP_warn_ssl]
265+
if "HPECP_WARN_SSL" in os.environ:
266+
HPECP_WARN_SSL = os.environ["HPECP_WARN_SSL"]
266267

267268
return cls(
268269
username=HPECP_USERNAME,
@@ -271,7 +272,7 @@ def create_from_env(cls):
271272
api_port=HPECP_API_PORT,
272273
use_ssl=HPECP_USE_SSL,
273274
verify_ssl=HPECP_VERIFY_SSL,
274-
warn_ssl=HPECP_warn_ssl,
275+
warn_ssl=HPECP_WARN_SSL,
275276
)
276277

277278
def __init__(
@@ -781,17 +782,21 @@ def catalog(self):
781782
@property
782783
def role(self):
783784
"""
784-
This attribute is a reference to an object of type `.role.RoleController`.
785+
This attribute is a reference to an object of type
786+
`.role.RoleController`.
785787
786-
See the class :py:class:`.role.RoleController` for the methods available.
788+
See the class :py:class:`.role.RoleController` for the methods
789+
available.
787790
788791
Example::
789792
790793
client = ContainerPlatformClient(...)
791794
client.create_session()
792795
client.role.get()
793796
794-
This example calls the method :py:meth:`get() <.role.RoleController.get>` in :py:class:`.role.RoleController`.
797+
This example calls the method :py:meth:`get()
798+
<.role.RoleController.get>`
799+
in :py:class:`.role.RoleController`.
795800
"""
796801

797802
return self._role

hpecp/config.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,6 @@
2020

2121
from __future__ import absolute_import
2222

23-
from .logger import Logger
24-
25-
from datetime import datetime, timedelta
26-
import time
27-
import requests
28-
import json
29-
30-
try:
31-
from urllib import quote # Python 2.X
32-
except ImportError:
33-
from urllib.parse import quote # Python 3+
34-
3523

3624
class ConfigController:
3725
def __init__(self, client):
@@ -40,8 +28,7 @@ def __init__(self, client):
4028
def auth(self, data):
4129
"""
4230
Example::
43-
44-
data = {
31+
data = {
4532
"external_identity_server": {
4633
"bind_pwd":"5ambaPwd@",
4734
"user_attribute":"sAMAccountName",
@@ -52,7 +39,7 @@ def auth(self, data):
5239
"base_dn":"CN=Users,DC=samdom,DC=example,DC=com",
5340
"verify_peer": False,
5441
"type":"Active Directory",
55-
"port":636
42+
"port":636
5643
}
5744
}
5845
"""

hpecp/gateway.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,8 @@ def tabulate(
533533

534534
self.display_columns = columns
535535

536-
# FIXME https://github.com/hpe-container-platform-community/hpecp-python-library/issues/5
536+
# FIXME
537+
# https://github.com/hpe-container-platform-community/hpecp-python-library/issues/5
537538
if display_headers:
538539
return tabulate(self, headers=columns, tablefmt=style)
539540
else:

0 commit comments

Comments
 (0)