pep8'd sugar3
This commit is contained in:
parent
1252d95671
commit
c736ffefcd
@ -18,6 +18,7 @@ SUBDIRS = bin src po
|
|||||||
|
|
||||||
check: test
|
check: test
|
||||||
pyflakes $(top_srcdir)
|
pyflakes $(top_srcdir)
|
||||||
|
pep8 $(top_srcdir)
|
||||||
|
|
||||||
test:
|
test:
|
||||||
mkdir -p $(TESTS_TMPDIR)
|
mkdir -p $(TESTS_TMPDIR)
|
||||||
|
@ -39,7 +39,7 @@ def get_profile_path(path=None):
|
|||||||
except OSError:
|
except OSError:
|
||||||
print 'Could not create user directory.'
|
print 'Could not create user directory.'
|
||||||
|
|
||||||
if path != None:
|
if path is not None:
|
||||||
return os.path.join(base, path)
|
return os.path.join(base, path)
|
||||||
else:
|
else:
|
||||||
return base
|
return base
|
||||||
@ -47,7 +47,7 @@ def get_profile_path(path=None):
|
|||||||
|
|
||||||
def get_logs_path(path=None):
|
def get_logs_path(path=None):
|
||||||
base = os.environ.get('SUGAR_LOGS_DIR', get_profile_path('logs'))
|
base = os.environ.get('SUGAR_LOGS_DIR', get_profile_path('logs'))
|
||||||
if path != None:
|
if path is not None:
|
||||||
return os.path.join(base, path)
|
return os.path.join(base, path)
|
||||||
else:
|
else:
|
||||||
return base
|
return base
|
||||||
@ -57,5 +57,6 @@ def get_user_activities_path():
|
|||||||
return os.environ.get("SUGAR_ACTIVITIES_PATH",
|
return os.environ.get("SUGAR_ACTIVITIES_PATH",
|
||||||
os.path.expanduser('~/Activities'))
|
os.path.expanduser('~/Activities'))
|
||||||
|
|
||||||
|
|
||||||
def get_user_library_path():
|
def get_user_library_path():
|
||||||
return os.path.expanduser('~/Library')
|
return os.path.expanduser('~/Library')
|
||||||
|
@ -147,7 +147,8 @@ def start(log_filename=None):
|
|||||||
if e.errno != errno.ENOSPC:
|
if e.errno != errno.ENOSPC:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING,
|
logging.basicConfig(
|
||||||
|
level=logging.WARNING,
|
||||||
format="%(created)f %(levelname)s %(name)s: %(message)s",
|
format="%(created)f %(levelname)s %(name)s: %(message)s",
|
||||||
stream=SafeLogWrapper(sys.stderr))
|
stream=SafeLogWrapper(sys.stderr))
|
||||||
|
|
||||||
@ -218,7 +219,7 @@ def trace(logger=None, logger_name=None, skip_args=None, skip_kwargs=None,
|
|||||||
|
|
||||||
params_formatted = ", ".join(
|
params_formatted = ", ".join(
|
||||||
[trace_repr.repr(a)
|
[trace_repr.repr(a)
|
||||||
for (idx, a) in enumerate(args) if idx not in skip_args] + \
|
for (idx, a) in enumerate(args) if idx not in skip_args] +
|
||||||
['%s=%s' % (k, trace_repr.repr(v))
|
['%s=%s' % (k, trace_repr.repr(v))
|
||||||
for (k, v) in kwargs.items() if k not in skip_kwargs])
|
for (k, v) in kwargs.items() if k not in skip_kwargs])
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ def _get_supported_image_mime_types():
|
|||||||
_extensions = {}
|
_extensions = {}
|
||||||
_globs_timestamps = []
|
_globs_timestamps = []
|
||||||
_generic_types = [
|
_generic_types = [
|
||||||
{
|
{
|
||||||
'id': GENERIC_TYPE_TEXT,
|
'id': GENERIC_TYPE_TEXT,
|
||||||
'name': _('Text'),
|
'name': _('Text'),
|
||||||
'icon': 'text-x-generic',
|
'icon': 'text-x-generic',
|
||||||
@ -58,7 +58,7 @@ _generic_types = [
|
|||||||
'text/plain', 'text/rtf', 'application/pdf', 'application/x-pdf',
|
'text/plain', 'text/rtf', 'application/pdf', 'application/x-pdf',
|
||||||
'text/html', 'application/vnd.oasis.opendocument.text',
|
'text/html', 'application/vnd.oasis.opendocument.text',
|
||||||
'application/rtf', 'text/rtf', 'application/epub+zip'],
|
'application/rtf', 'text/rtf', 'application/epub+zip'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': GENERIC_TYPE_IMAGE,
|
'id': GENERIC_TYPE_IMAGE,
|
||||||
'name': _('Image'),
|
'name': _('Image'),
|
||||||
|
@ -184,14 +184,14 @@ class LRU:
|
|||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
cur = self.first
|
cur = self.first
|
||||||
while cur != None:
|
while cur is not None:
|
||||||
cur2 = cur.next
|
cur2 = cur.next
|
||||||
yield cur.me[1]
|
yield cur.me[1]
|
||||||
cur = cur2
|
cur = cur2
|
||||||
|
|
||||||
def iteritems(self):
|
def iteritems(self):
|
||||||
cur = self.first
|
cur = self.first
|
||||||
while cur != None:
|
while cur is not None:
|
||||||
cur2 = cur.next
|
cur2 = cur.next
|
||||||
yield cur.me
|
yield cur.me
|
||||||
cur = cur2
|
cur = cur2
|
||||||
|
Loading…
Reference in New Issue
Block a user