aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/ui
diff options
context:
space:
mode:
Diffstat (limited to 'libbe/ui')
-rw-r--r--libbe/ui/command_line.py14
-rw-r--r--libbe/ui/util/editor.py4
-rw-r--r--libbe/ui/util/user.py8
3 files changed, 13 insertions, 13 deletions
diff --git a/libbe/ui/command_line.py b/libbe/ui/command_line.py
index b649e24..3b8089f 100644
--- a/libbe/ui/command_line.py
+++ b/libbe/ui/command_line.py
@@ -59,13 +59,13 @@ class CmdOptionParser(optparse.OptionParser):
option.validate()
self._option_by_name[option.name] = option
long_opt = '--%s' % option.name
- if option.short_name != None:
+ if option.short_name is not None:
short_opt = '-%s' % option.short_name
assert '_' not in option.name, \
'Non-reconstructable option name %s' % option.name
kwargs = {'dest':option.name.replace('-', '_'),
'help':option.help}
- if option.arg == None: # a callback option
+ if option.arg is None: # a callback option
kwargs['action'] = 'callback'
kwargs['callback'] = self.callback
elif option.arg.type == 'bool':
@@ -77,7 +77,7 @@ class CmdOptionParser(optparse.OptionParser):
kwargs['action'] = 'store'
kwargs['metavar'] = option.arg.metavar
kwargs['default'] = option.arg.default
- if option.short_name != None:
+ if option.short_name is not None:
opt = optparse.Option(short_opt, long_opt, **kwargs)
else:
opt = optparse.Option(long_opt, **kwargs)
@@ -95,7 +95,7 @@ class CmdOptionParser(optparse.OptionParser):
for name,value in list(options.items()):
argument = None
option = self._option_by_name[name]
- if option.arg != None:
+ if option.arg is not None:
argument = option.arg
if value == '--complete':
fragment = None
@@ -108,7 +108,7 @@ class CmdOptionParser(optparse.OptionParser):
name = args[i-1][2:]
if name == option.name:
break
- elif option.short_name != None \
+ elif option.short_name is not None \
and args[i-1].startswith('-') \
and args[i-1].endswith(option.short_name):
break
@@ -163,7 +163,7 @@ class CmdOptionParser(optparse.OptionParser):
def complete(self, argument=None, fragment=None):
comps = self.command.complete(argument, fragment)
- if fragment != None:
+ if fragment is not None:
comps = [c for c in comps if c.startswith(fragment)]
if len(comps) > 0:
print('\n'.join(comps), file=self.command.stdout)
@@ -258,7 +258,7 @@ class BE (libbe.command.Command):
cmdlist = []
for name in libbe.command.commands():
Class = libbe.command.get_command_class(command_name=name)
- assert hasattr(Class, '__doc__') and Class.__doc__ != None, \
+ assert hasattr(Class, '__doc__') and Class.__doc__ is not None, \
'Command class %s missing docstring' % Class
cmdlist.append((Class.name, Class.__doc__.splitlines()[0]))
cmdlist.sort()
diff --git a/libbe/ui/util/editor.py b/libbe/ui/util/editor.py
index 8412ff6..5ab519f 100644
--- a/libbe/ui/util/editor.py
+++ b/libbe/ui/util/editor.py
@@ -64,14 +64,14 @@ def editor_string(comment=None, encoding=None):
>>> del os.environ["EDITOR"]
>>> del os.environ["VISUAL"]
"""
- if encoding == None:
+ if encoding is None:
encoding = libbe.util.encoding.get_text_file_encoding()
editor = None
for name in ('VISUAL', 'EDITOR'):
if name in os.environ and os.environ[name] != '':
editor = os.environ[name]
break
- if editor == None:
+ if editor is None:
raise CantFindEditor()
fhandle, fname = tempfile.mkstemp()
try:
diff --git a/libbe/ui/util/user.py b/libbe/ui/util/user.py
index 4a4e7f1..1d7e874 100644
--- a/libbe/ui/util/user.py
+++ b/libbe/ui/util/user.py
@@ -92,7 +92,7 @@ def create_user_id(name, email=None):
parse_user_id : inverse
"""
assert len(name) > 0
- if email == None or len(email) == 0:
+ if email is None or len(email) == 0:
return name
else:
return formataddr((name, email))
@@ -137,11 +137,11 @@ def get_user_id(storage=None):
configured it directly.
"""
user = libbe.storage.util.config.get_val('user')
- if user != None:
+ if user is not None:
return user
- if storage != None and hasattr(storage, 'get_user_id'):
+ if storage is not None and hasattr(storage, 'get_user_id'):
user = storage.get_user_id()
- if user != None:
+ if user is not None:
return user
name = get_fallback_fullname()
email = get_fallback_email()