From 1878c9f36973e1c25a19d9e02f4eed60eab35905 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 11 Aug 2008 00:00:55 +0200 Subject: [PATCH] Pylint cleanups. --- src/sugar/util.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sugar/util.py b/src/sugar/util.py index 8f81210c..a713cb0e 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 = {}