mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Clean-up clean-up.
This commit is contained in:
parent
e299be70ff
commit
a0c7396ab5
@ -97,7 +97,7 @@ OPF_MIME = types_map['.opf']
|
|||||||
PAGE_MAP_MIME = 'application/oebps-page-map+xml'
|
PAGE_MAP_MIME = 'application/oebps-page-map+xml'
|
||||||
OEB_DOC_MIME = 'text/x-oeb1-document'
|
OEB_DOC_MIME = 'text/x-oeb1-document'
|
||||||
OEB_CSS_MIME = 'text/x-oeb1-css'
|
OEB_CSS_MIME = 'text/x-oeb1-css'
|
||||||
OPENTYPE_MIME = 'font/opentype' # Shouldn't this be 'application/x-font-opentype' as opentype/font doesn't actually exist in the IETF?
|
OPENTYPE_MIME = 'application/x-font-opentype'
|
||||||
GIF_MIME = types_map['.gif']
|
GIF_MIME = types_map['.gif']
|
||||||
JPEG_MIME = types_map['.jpeg']
|
JPEG_MIME = types_map['.jpeg']
|
||||||
PNG_MIME = types_map['.png']
|
PNG_MIME = types_map['.png']
|
||||||
@ -177,7 +177,7 @@ URL_SAFE = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|||||||
'0123456789' '_.-/~')
|
'0123456789' '_.-/~')
|
||||||
URL_UNSAFE = [ASCII_CHARS - URL_SAFE, UNIBYTE_CHARS - URL_SAFE]
|
URL_UNSAFE = [ASCII_CHARS - URL_SAFE, UNIBYTE_CHARS - URL_SAFE]
|
||||||
|
|
||||||
def urlquote(href): # Why do you have a private implementation of urlquote?
|
def urlquote(href):
|
||||||
result = []
|
result = []
|
||||||
unsafe = 0 if isinstance(href, unicode) else 1
|
unsafe = 0 if isinstance(href, unicode) else 1
|
||||||
unsafe = URL_UNSAFE[unsafe]
|
unsafe = URL_UNSAFE[unsafe]
|
||||||
@ -282,7 +282,9 @@ class Metadata(object):
|
|||||||
class Attribute(object):
|
class Attribute(object):
|
||||||
|
|
||||||
def __init__(self, attr, allowed=None):
|
def __init__(self, attr, allowed=None):
|
||||||
self.attr = attr if callable(attr) else lambda x: attr
|
if not callable(attr):
|
||||||
|
attr_, attr = attr, lambda term: attr_
|
||||||
|
self.attr = attr
|
||||||
self.allowed = allowed
|
self.allowed = allowed
|
||||||
|
|
||||||
def term_attr(self, obj):
|
def term_attr(self, obj):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user