From 4d5bae7131804f3057b3e0ee8f5b9fe63cf7ab6b Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 18 Jan 2013 11:18:56 +0100 Subject: [PATCH] Removing some obsolete functions --- lib/core/common.py | 45 --------------------------------------------- lib/core/convert.py | 19 ------------------- 2 files changed, 64 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index ed71fe843..45aeb1997 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1307,20 +1307,6 @@ def getCharset(charsetType=None): return asciiTbl -def searchEnvPath(filename): - retVal = None - path = os.environ.get("PATH", "") - paths = path.split(";") if IS_WIN else path.split(":") - - for _ in paths: - _ = _.replace(";", "") - retVal = os.path.exists(os.path.normpath(os.path.join(_, filename))) - - if retVal: - break - - return retVal - def directoryPath(filepath): """ Returns directory path for a given filepath @@ -1428,13 +1414,6 @@ def showStaticWords(firstPage, secondPage): logger.info(infoMsg) -def isWindowsPath(filepath): - """ - Returns True if given filepath is in Windows format - """ - - return re.search("\A[\w]\:\\\\", filepath) is not None - def isWindowsDriveLetterPath(filepath): """ Returns True if given filepath starts with a Windows drive letter @@ -2467,20 +2446,6 @@ def showHttpErrorCodes(): for code, count in kb.httpErrorCodes.items()) logger.warn(warnMsg) -def getComparePageRatio(firstPage, secondPage, filtered=False): - """ - Returns comparison ratio between two given pages - """ - - if filtered: - (firstPage, secondPage) = map(getFilteredPageContent, (firstPage, secondPage)) - - seqMatcher = getCurrentThreadData().seqMatcher - seqMatcher.set_seq1(firstPage) - seqMatcher.set_seq2(secondPage) - - return seqMatcher.quick_ratio() - def openFile(filename, mode='r'): """ Returns file handle of a given filename @@ -2734,16 +2699,6 @@ def unsafeSQLIdentificatorNaming(name): return retVal -def isBinaryData(value): - """ - Tests given value for binary content - """ - - retVal = False - if isinstance(value, basestring): - retVal = reduce(lambda x, y: x or not (y in string.printable or ord(y) > 255), value, False) - return retVal - def isNoneValue(value): """ Returns whether the value is unusable (None or '') diff --git a/lib/core/convert.py b/lib/core/convert.py index 792b6ea31..48c904e9e 100644 --- a/lib/core/convert.py +++ b/lib/core/convert.py @@ -47,25 +47,6 @@ def hexdecode(value): def hexencode(value): return utf8encode(value).encode("hex") -def md5hash(value): - if "hashlib" in sys.modules: - return hashlib.md5(value).hexdigest() - else: - return md5.new(value).hexdigest() - -def orddecode(value): - packedString = struct.pack("!" + "I" * len(value), *value) - return "".join(chr(char) for char in struct.unpack("!" + "I" * (len(packedString) / 4), packedString)) - -def ordencode(value): - return tuple(ord(char) for char in value) - -def sha1hash(value): - if "hashlib" in sys.modules: - return hashlib.sha1(value).hexdigest() - else: - return sha.new(value).hexdigest() - def unicodeencode(value, encoding=None): """ Return 8-bit string representation of the supplied unicode value: