diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-08-10 22:00:55 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-08-10 22:00:55 (GMT) |
commit | 1878c9f36973e1c25a19d9e02f4eed60eab35905 (patch) | |
tree | e3ffe29a0f643ae3b1b516a022088df0136e3b80 /src/sugar | |
parent | 29d8a15016edb9b93aa8959e189f67ff352291d6 (diff) |
Pylint cleanups.
Diffstat (limited to 'src/sugar')
-rw-r--r-- | src/sugar/util.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/sugar/util.py b/src/sugar/util.py index 8f81210..a713cb0 100644 --- a/src/sugar/util.py +++ b/src/sugar/util.py @@ -20,10 +20,10 @@ import time import sha import random import binascii -import string -from gettext import gettext as _ import gettext +_ = gettext.gettext + def printable_hash(in_hash): """Convert binary hash data into printable characters.""" printable = "" @@ -58,7 +58,12 @@ def unique_id(data = ''): ACTIVITY_ID_LEN = 40 def is_hex(s): - return s.strip(string.hexdigits) == '' + try: + int(s, 16) + except ValueError: + return False + + return True def validate_activity_id(actid): """Validate an activity ID.""" @@ -106,6 +111,7 @@ class LRU: http://pype.sourceforge.net Copyright 2003 Josiah Carlson. """ + # pylint: disable-msg=W0102,W0612 def __init__(self, count, pairs=[]): self.count = max(count, 1) self.d = {} |