More pep8 fixes

This commit is contained in:
Jonas Borgström 2011-10-31 21:18:28 +01:00
parent ddc1d02e90
commit 2e4e8f1ab2
1 changed files with 10 additions and 2 deletions

View File

@ -250,6 +250,7 @@ def format_file_mode(mod):
for m, s in ((4, 'r'), (2, 'w'), (1, 'x'))) for m, s in ((4, 'r'), (2, 'w'), (1, 'x')))
return '%s%s%s' % (x(mod / 64), x(mod / 8), x(mod)) return '%s%s%s' % (x(mod / 64), x(mod / 8), x(mod))
def format_file_size(v): def format_file_size(v):
"""Format file size into a human friendly format """Format file size into a human friendly format
""" """
@ -262,12 +263,15 @@ def format_file_size(v):
else: else:
return '%d B' % v return '%d B' % v
class IntegrityError(Exception): class IntegrityError(Exception):
""" """
""" """
def memoize(function): def memoize(function):
cache = {} cache = {}
def decorated_function(*args): def decorated_function(*args):
try: try:
return cache[args] return cache[args]
@ -277,6 +281,7 @@ def memoize(function):
return val return val
return decorated_function return decorated_function
@memoize @memoize
def uid2user(uid): def uid2user(uid):
try: try:
@ -284,6 +289,7 @@ def uid2user(uid):
except KeyError: except KeyError:
return None return None
@memoize @memoize
def user2uid(user): def user2uid(user):
try: try:
@ -291,6 +297,7 @@ def user2uid(user):
except KeyError: except KeyError:
return None return None
@memoize @memoize
def gid2group(gid): def gid2group(gid):
try: try:
@ -298,6 +305,7 @@ def gid2group(gid):
except KeyError: except KeyError:
return None return None
@memoize @memoize
def group2gid(group): def group2gid(group):
try: try: