cleanups in gajim-remote.py: use ininstance and use in and not in instead of many or
This commit is contained in:
parent
20a7a0c426
commit
85c957f49d
|
@ -192,7 +192,7 @@ Please specify account for sending the message.') % sys.argv[2])
|
||||||
else:
|
else:
|
||||||
self.send_error(_('You have no active account'))
|
self.send_error(_('You have no active account'))
|
||||||
elif self.command == 'list_accounts':
|
elif self.command == 'list_accounts':
|
||||||
if type(res) == list:
|
if isinstance(res, list):
|
||||||
for account in res:
|
for account in res:
|
||||||
print account
|
print account
|
||||||
elif self.command == 'list_contacts':
|
elif self.command == 'list_contacts':
|
||||||
|
@ -284,32 +284,30 @@ Please specify account for sending the message.') % sys.argv[2])
|
||||||
for val in prop_dict:
|
for val in prop_dict:
|
||||||
if val is None:
|
if val is None:
|
||||||
ret_str +='\t'
|
ret_str +='\t'
|
||||||
elif type(val) == unicode or type(val) == int or \
|
elif type(val) in (unicode, int, str):
|
||||||
type(val) == str:
|
|
||||||
ret_str +='\t' + str(val)
|
ret_str +='\t' + str(val)
|
||||||
elif type(val) == list or type(val) == tuple:
|
elif type(val) in (list, tuple):
|
||||||
res = ''
|
res = ''
|
||||||
for items in val:
|
for items in val:
|
||||||
res += self.print_info(level+1, items)
|
res += self.print_info(level+1, items)
|
||||||
if res != '':
|
if res != '':
|
||||||
ret_str += '\t' + res
|
ret_str += '\t' + res
|
||||||
ret_str = '%s(%s)\n' % (spacing, ret_str[1:])
|
ret_str = '%s(%s)\n' % (spacing, ret_str[1:])
|
||||||
elif type(prop_dict) is dict:
|
elif isinstance(prop_dict, dict):
|
||||||
for key in prop_dict.keys():
|
for key in prop_dict.keys():
|
||||||
val = prop_dict[key]
|
val = prop_dict[key]
|
||||||
spacing = ' ' * level * 4
|
spacing = ' ' * level * 4
|
||||||
if type(val) == unicode or type(val) == int or \
|
elif type(val) in (unicode, int, str):
|
||||||
type(val) == str:
|
|
||||||
if val is not None:
|
if val is not None:
|
||||||
val = val.strip()
|
val = val.strip()
|
||||||
ret_str += '%s%-10s: %s\n' % (spacing, key, val)
|
ret_str += '%s%-10s: %s\n' % (spacing, key, val)
|
||||||
elif type(val) == list or type(val) == tuple:
|
elif type(val) in (list, tuple):
|
||||||
res = ''
|
res = ''
|
||||||
for items in val:
|
for items in val:
|
||||||
res += self.print_info(level+1, items)
|
res += self.print_info(level+1, items)
|
||||||
if res != '':
|
if res != '':
|
||||||
ret_str += '%s%s: \n%s' % (spacing, key, res)
|
ret_str += '%s%s: \n%s' % (spacing, key, res)
|
||||||
elif type(val) == dict:
|
elif isinstance(val, dict):
|
||||||
res = self.print_info(level+1, val)
|
res = self.print_info(level+1, val)
|
||||||
if res != '':
|
if res != '':
|
||||||
ret_str += '%s%s: \n%s' % (spacing, key, res)
|
ret_str += '%s%s: \n%s' % (spacing, key, res)
|
||||||
|
@ -395,7 +393,7 @@ Please specify account for sending the message.') % sys.argv[2])
|
||||||
if value[1] == '}':
|
if value[1] == '}':
|
||||||
break
|
break
|
||||||
key, next = self.unrepr(value[1:])
|
key, next = self.unrepr(value[1:])
|
||||||
if type(key) != str and type(key) != unicode:
|
if type(key) not in (str, unicode):
|
||||||
send_error('Wrong string: %s' % value)
|
send_error('Wrong string: %s' % value)
|
||||||
next = next.strip()
|
next = next.strip()
|
||||||
if not next or next[0] != ':':
|
if not next or next[0] != ':':
|
||||||
|
|
Loading…
Reference in New Issue