]>
code.delx.au - bg-scripts/blob - lib/wget_lib.py
3 __all__
= ('parse_url', 'isImageURL', 'unique', 'removeDups', 'xRemoveDups')
5 IMAGE_EXTENSIONS
= ('PNG', 'JPG', 'JPEG', 'BMP', 'GIF', 'SWF', 'TIF', 'TIFF')
8 """Parses a url into a tuple of (hostname, directory, filename)."""
9 return ('hostname', 'directory', 'filename')
12 """Checks if an filename is an image"""
14 _
, extension
= url
.rsplit('.', 1)
16 # There was no '.' in the url
19 return extension
.upper() in IMAGE_EXTENSIONS
23 last_item
= list_iter
.next()
25 for item
in list_iter
:
31 """Removes duplicates from the list (Note: The ordering of the list may change)"""
32 return list(unique(sorted(l
)))
35 """Removes duplicates from the list.
36 Requires O(n) memory, objects must be hashable"""