Pylint error and warning fixes
Changes:
- C0114: Missing module docstring
- C0209: Formatting a regular string which could be a f-string
- W0201: Attribute __websocket defined outside __init__
Tested:
- python3 -m pylint lib/event_notification.py
Change-Id: I74ddb48e9675d054a329d350f2650c4f36088185
Signed-off-by: Shaheena Begum Mohammed <shaheena@gfwa180.aus.stglabs.ibm.com>
diff --git a/lib/event_notification.py b/lib/event_notification.py
index 53c010e..dfc51ca 100755
--- a/lib/event_notification.py
+++ b/lib/event_notification.py
@@ -1,15 +1,19 @@
#!/usr/bin/env python3
-
+r"""
+This is an extended user library to support Robot Selenium code.
+The class contains functions which the robot framework will use
+and import as a user-defined keyword.
+"""
import json
import ssl
-import gen_print as gp
-import gen_valid as gv
+import gen_print as gp # NOQA
+import gen_valid as gv # NOQA
import requests
import websocket
-class event_notification:
+class event_notification: # NOQA
r"""
Main class to subscribe and receive event notifications.
"""
@@ -26,6 +30,7 @@
self.__host = host
self.__user = username
self.__password = password
+ self.__websocket = None
def __del__(self):
try:
@@ -92,7 +97,7 @@
websocket.enableTrace(enable_trace)
self.__websocket = websocket.create_connection(
- "wss://{host}/subscribe".format(host=self.__host),
+ f"wss://{self.__host}/subscribe",
sslopt={"cert_reqs": ssl.CERT_NONE},
cookie=cookies,
)