Pylint cleanups.

This commit is contained in:
Marco Pesenti Gritti 2008-08-11 00:00:55 +02:00
parent 29d8a15016
commit 1878c9f369

View File

@ -20,10 +20,10 @@ import time
import sha import sha
import random import random
import binascii import binascii
import string
from gettext import gettext as _
import gettext import gettext
_ = gettext.gettext
def printable_hash(in_hash): def printable_hash(in_hash):
"""Convert binary hash data into printable characters.""" """Convert binary hash data into printable characters."""
printable = "" printable = ""
@ -58,7 +58,12 @@ def unique_id(data = ''):
ACTIVITY_ID_LEN = 40 ACTIVITY_ID_LEN = 40
def is_hex(s): def is_hex(s):
return s.strip(string.hexdigits) == '' try:
int(s, 16)
except ValueError:
return False
return True
def validate_activity_id(actid): def validate_activity_id(actid):
"""Validate an activity ID.""" """Validate an activity ID."""
@ -106,6 +111,7 @@ class LRU:
http://pype.sourceforge.net http://pype.sourceforge.net
Copyright 2003 Josiah Carlson. Copyright 2003 Josiah Carlson.
""" """
# pylint: disable-msg=W0102,W0612
def __init__(self, count, pairs=[]): def __init__(self, count, pairs=[]):
self.count = max(count, 1) self.count = max(count, 1)
self.d = {} self.d = {}