Skip to content
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

refactor: use identity check for comparison to a singleton #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pywisp_emibcn/pywisp.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def main():
# Get devices
devices = pywisp.wisp.get_host(
pywisp.args.host, deep=pywisp.args.deep, from_br=pywisp.args.from_br)
if devices == None or len(devices) == 0:
if devices is None or len(devices) == 0:
pywisp.log.error("No devices found: '%s'" % (pywisp.args.host))
return 1

Expand Down
4 changes: 2 additions & 2 deletions pywisp_emibcn/sshdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def setBackupName(self, backup_file=""):

def login(self):
'''Open SSH connection only if it is not already opened'''
if self.client == False:
if self.client is False:

# Start SSH connection
self.client = paramiko.SSHClient()
Expand All @@ -99,7 +99,7 @@ def login(self):

def logout(self):
'''Close SSH connection only if it is opened'''
if self.client != False:
if self.client is not False:
self.client.close()
# Higiene
del self.client
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pywisp.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_host(self, name, deep=False, from_br=None):

# Get devices
device = pywisp.wisp.get_host(pywisp.args.host)
assert device != None, 'get_host should have returned a list or a device'
assert device is not None, 'get_host should have returned a list or a device'
if not len(device):
raise AssertionError(
'get_host should have returned a list with at least one device')
Expand Down
Loading