-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pylint fixes for webapp extension #175
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ def recv(self): | |
return data | ||
|
||
|
||
# pylint: disable=no-member, too-many-instance-attributes,bare-except, | ||
class TunnelServer(object): | ||
def __init__(self, local_addr, local_port, remote_addr, remote_user_name, remote_password): | ||
self.local_addr = local_addr | ||
|
@@ -43,6 +44,8 @@ def __init__(self, local_addr, local_port, remote_addr, remote_user_name, remote | |
self.remote_addr = remote_addr | ||
self.remote_user_name = remote_user_name | ||
self.remote_password = remote_password | ||
self.client = None | ||
self.ws = None | ||
logger.info('Creating a socket on port: %s', self.local_port) | ||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
logger.info('Setting socket options') | ||
|
@@ -62,8 +65,9 @@ def create_basic_auth(self): | |
|
||
def is_port_open(self): | ||
is_port_open = False | ||
# pylint: disable=no-member | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for another disable no-member here if it is already disabled for the class (line 37) |
||
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: | ||
if sock.connect_ex(('', self.local_port)) == 0: | ||
if sock.connect_ex('', self.local_port) == 0: | ||
logger.info('Port %s is NOT open', self.local_port) | ||
else: | ||
logger.warning('Port %s is open', self.local_port) | ||
|
@@ -125,8 +129,8 @@ def listen(self): | |
logger.info('Websocket, connected status: %s', self.ws.connected) | ||
index = index + 1 | ||
logger.info('Got debugger connection... index: %s', index) | ||
debugger_thread = Thread(target=self.listen_to_client, args=(self.client, self.ws, index)) | ||
web_socket_thread = Thread(target=self.listen_to_web_socket, args=(self.client, self.ws, index)) | ||
debugger_thread = Thread(target=self._listen_to_client, args=(self.client, self.ws, index)) | ||
web_socket_thread = Thread(target=self._listen_to_web_socket, args=(self.client, self.ws, index)) | ||
debugger_thread.start() | ||
web_socket_thread.start() | ||
logger.info('Both debugger and websocket threads started...') | ||
|
@@ -136,7 +140,8 @@ def listen(self): | |
logger.info('Both debugger and websocket threads stopped...') | ||
logger.warning('Stopped local server..') | ||
|
||
def listen_to_web_socket(self, client, ws_socket, index): | ||
# pylint: disable=no-self-use | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please align this with the corresponding method |
||
def _listen_to_web_socket(self, client, ws_socket, index): | ||
while True: | ||
try: | ||
logger.info('Waiting for websocket data, connection status: %s, index: %s', ws_socket.connected, index) | ||
|
@@ -159,7 +164,8 @@ def listen_to_web_socket(self, client, ws_socket, index): | |
ws_socket.close() | ||
return False | ||
|
||
def listen_to_client(self, client, ws_socket, index): | ||
# pylint: disable=no-self-use | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please align this with the corresponding method |
||
def _listen_to_client(self, client, ws_socket, index): | ||
while True: | ||
try: | ||
logger.info('Waiting for debugger data, index: %s', index) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please space correctly and remove last ','