bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def doit(func, *args, **kwargs): try: func(*args, **kwargs) except: if ignore_errors: traceback.print_exc() else: raise | defdoit(func,*args,**kwargs):try:func(*args,**kwargs)except:ifignore_errors:traceback.print_exc()else:raise | 452,000 |
def create_book_entry(self, mi, cover=None, add_duplicates=True): self._add_newbook_tag(mi) if not add_duplicates and self.has_book(mi): return None series_index = 1.0 if mi.series_index is None else mi.series_index aus = mi.author_sort if mi.author_sort else self.author_sort_from_authors(mi.authors) title = mi.title i... | def create_book_entry(self, mi, cover=None, add_duplicates=True): self._add_newbook_tag(mi) if not add_duplicates and self.has_book(mi): return None series_index = 1.0 if mi.series_index is None else mi.series_index aus = mi.author_sort if mi.author_sort else self.author_sort_from_authors(mi.authors) title = mi.title i... | 452,001 |
def create_book_entry(self, mi, cover=None, add_duplicates=True): self._add_newbook_tag(mi) if not add_duplicates and self.has_book(mi): return None series_index = 1.0 if mi.series_index is None else mi.series_index aus = mi.author_sort if mi.author_sort else self.author_sort_from_authors(mi.authors) title = mi.title i... | def create_book_entry(self, mi, cover=None, add_duplicates=True): self._add_newbook_tag(mi) if not add_duplicates and self.has_book(mi): return None series_index = 1.0 if mi.series_index is None else mi.series_index aus = mi.author_sort if mi.author_sort else self.author_sort_from_authors(mi.authors) title = mi.title i... | 452,002 |
def can_handle(cls, dev, debug=False): return dev[3] == 'Elonex' and dev[4] == 'eBook' | def can_handle(cls, dev, debug=False): return dev[3] == 'Elonex' and dev[4] == 'eBook' | 452,003 |
def can_handle(cls, dev, debug=False): return dev[3] == 'Elonex' and dev[4] == 'eBook' | def can_handle(cls, dev, debug=False): return dev[3] == 'Elonex' and dev[4] == 'eBook' | 452,004 |
def __unicode__(self): s = u'' open_containers = collections.deque() for c in self.content: if isinstance(c, basestring): s += c elif c is None: if open_containers: p = open_containers.pop() s += u'</%s>'%(p.name,) else: s += unicode(c) if not c.self_closing: open_containers.append(c) | def __unicode__(self): s = u'' open_containers = collections.deque() for c in self.content: if isinstance(c, basestring): s += prepare_string_for_xml(c) elif c is None: if open_containers: p = open_containers.pop() s += u'</%s>'%(p.name,) else: s += unicode(c) if not c.self_closing: open_containers.append(c) | 452,005 |
def strftime(epoch, zone=time.gmtime): src = time.strftime("%w, %d %m %Y %H:%M:%S GMT", zone(epoch)).split() src[0] = INVERSE_DAY_MAP[int(src[0][:-1])]+',' src[2] = INVERSE_MONTH_MAP[int(src[2])] return ' '.join(src) | def strftime(epoch, zone=None): zone = time.gmtime if islinux: zone = time.localtime src = time.strftime("%w, %d %m %Y %H:%M:%S GMT", zone(epoch)).split() src[0] = INVERSE_DAY_MAP[int(src[0][:-1])]+',' src[2] = INVERSE_MONTH_MAP[int(src[2])] return ' '.join(src) | 452,006 |
def update_booklist(prefix, path, title, authors, mime, date, ContentType, ImageID, readstatus): changed = False # if path_to_ext(path) in self.FORMATS: try: lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] lpath = lpath.replace('\\', '/') | def update_booklist(prefix, path, title, authors, mime, date, ContentType, ImageID, readstatus): changed = False # if path_to_ext(path) in self.FORMATS: try: lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] lpath = lpath.replace('\\', '/') | 452,007 |
def __ge__(self, other): return unicode(self.text()).lower() >= unicode(other.text()).lower() | def __ge__(self, other): return unicode(self.text()).lower() >= unicode(other.text()).lower() | 452,008 |
def __lt__(self, other): return unicode(self.text()).lower() < unicode(other.text()).lower() | def __lt__(self, other): return unicode(self.text()).lower() < unicode(other.text()).lower() | 452,009 |
def __init__(self, db, opts, embedded=False, show_tracebacks=True, wsgi=False): self.is_wsgi = bool(wsgi) self.opts = opts self.embedded = embedded self.state_callback = None self.max_cover_width, self.max_cover_height = \ map(int, self.opts.max_cover.split('x')) path = P('content_server') self.build_time = fromtimesta... | def __init__(self, db, opts, embedded=False, show_tracebacks=True, wsgi=False): self.is_wsgi = bool(wsgi) self.opts = opts self.embedded = embedded self.state_callback = None self.max_cover_width, self.max_cover_height = \ map(int, self.opts.max_cover.split('x')) path = P('content_server') self.build_time = fromtimesta... | 452,010 |
def fetchBooksByTitle(self): | def fetchBooksByTitle(self): | 452,011 |
def get_metadata(self, idx, index_is_id=False, get_cover=False): ''' Convenience method to return metadata as a :class:`Metadata` object. ''' self.gm_count += 1 mi = self.data.get(idx, self.FIELD_MAP['all_metadata'], row_is_id = index_is_id) if mi is not None: return mi | def get_metadata(self, idx, index_is_id=False, get_cover=False): ''' Convenience method to return metadata as a :class:`Metadata` object. ''' self.gm_count += 1 mi = self.data.get(idx, self.FIELD_MAP['all_metadata'], row_is_id = index_is_id) if mi is not None: return mi | 452,012 |
def mlize_spine(self): output = self.header() if 'titlepage' in self.oeb_book.guide: href = self.oeb_book.guide['titlepage'].href item = self.oeb_book.manifest.hrefs[href] if item.spine_position is None: stylizer = Stylizer(item.data, item.href, self.oeb_book, self.opts, self.opts.output_profile) output += self.dump_te... | def mlize_spine(self): output = self.header() if 'titlepage' in self.oeb_book.guide: href = self.oeb_book.guide['titlepage'].href item = self.oeb_book.manifest.hrefs[href] if item.spine_position is None: stylizer = Stylizer(item.data, item.href, self.oeb_book, self.opts, self.opts.output_profile) content = unicode(etre... | 452,013 |
def get_anchor(self, name): if not self.anchors.has_key(name): self.anchors[name] = "anchor%03d" % (len(self.anchors) + 1) return self.anchors.get(name) | def get_anchor(self, name): if not self.anchors.has_key(name): self.anchors[name] = "anchor%d" % (len(self.anchors) + 1) return self.anchors.get(name) | 452,014 |
def e_text_h(self, tag, attrs): """ Headings end """ self.writedata() level = int(attrs[(TEXTNS,'outline-level')]) if level > 6: level = 6 # Heading levels go only to 6 in XHTML if level < 1: level = 1 lev = self.headinglevels[1:level+1] outline = '.'.join(map(str,lev) ) anchor = self.get_anchor("%s.%s" % ( outline, ''... | def e_text_h(self, tag, attrs): """ Headings end """ self.writedata() level = int(attrs[(TEXTNS,'outline-level')]) if level > 6: level = 6 # Heading levels go only to 6 in XHTML if level < 1: level = 1 lev = self.headinglevels[1:level+1] outline = '.'.join(map(str,lev) ) tail = ''.join(self.data) anchor = self.get_anch... | 452,015 |
def do(self, *args, **kwargs): sort_val = None cookie = cherrypy.request.cookie if cookie.has_key(eself.sort_cookie_name): sort_val = cookie[eself.sort_cookie_name].value kwargs[eself.sort_kwarg] = sort_val | def do(self, *args, **kwargs): sort_val = None cookie = cherrypy.request.cookie if cookie.has_key(eself.sort_cookie_name): sort_val = cookie[eself.sort_cookie_name].value kwargs[eself.sort_kwarg] = sort_val | 452,016 |
def browse_category_group(self, category=None, group=None, category_sort=None): sort = category_sort if sort not in ('rating', 'name', 'popularity'): sort = 'name' categories = self.categories_cache() if category not in categories: raise cherrypy.HTTPError(404, 'category not found') | def browse_category_group(self, category=None, group=None, sort=None): if sort == 'null': sort = None if sort not in ('rating', 'name', 'popularity'): sort = 'name' categories = self.categories_cache() if category not in categories: raise cherrypy.HTTPError(404, 'category not found') | 452,017 |
def browse_matches(self, category=None, cid=None, list_sort=None): if not cid: raise cherrypy.HTTPError(404, 'invalid category id: %r'%cid) categories = self.categories_cache() | def browse_matches(self, category=None, cid=None, list_sort=None): if not cid: raise cherrypy.HTTPError(404, 'invalid category id: %r'%cid) categories = self.categories_cache() | 452,018 |
def convert(self, stream, options, file_ext, log, accelerators): from calibre.utils.zipfile import ZipFile from calibre import walk from calibre.ebooks import DRMError from calibre.ebooks.metadata.opf2 import OPF zf = ZipFile(stream) zf.extractall(os.getcwd()) encfile = os.path.abspath(os.path.join('META-INF', 'encrypt... | def convert(self, stream, options, file_ext, log, accelerators): from calibre.utils.zipfile import ZipFile from calibre import walk from calibre.ebooks import DRMError from calibre.ebooks.metadata.opf2 import OPF zf = ZipFile(stream) zf.extractall(os.getcwd()) encfile = os.path.abspath(os.path.join('META-INF', 'encrypt... | 452,019 |
def get_metadata(stream, extract_cover=True): """ Return metadata as a L{MetaInfo} object """ mi = MetaInformation(None, [_('Unknown')]) stream.seek(0) pheader = PdbHeaderReader(stream) # Only Dropbook produced 132 byte record0 files are supported if len(pheader.section_data(0)) == 132: hr = HeaderRecord(pheader.sect... | def get_metadata(stream, extract_cover=True): """ Return metadata as a L{MetaInfo} object """ mi = MetaInformation(None, [_('Unknown')]) stream.seek(0) pheader = PdbHeaderReader(stream) # Only Dropbook produced 132 byte record0 files are supported if len(pheader.section_data(0)) == 132: hr = HeaderRecord(pheader.sect... | 452,020 |
def get_metadata(stream, extract_cover=True): """ Return metadata as a L{MetaInfo} object """ mi = MetaInformation(None, [_('Unknown')]) stream.seek(0) pheader = PdbHeaderReader(stream) # Only Dropbook produced 132 byte record0 files are supported if len(pheader.section_data(0)) == 132: hr = HeaderRecord(pheader.sect... | def get_metadata(stream, extract_cover=True): """ Return metadata as a L{MetaInfo} object """ mi = MetaInformation(None, [_('Unknown')]) stream.seek(0) pheader = PdbHeaderReader(stream) # Only Dropbook produced 132 byte record0 files are supported if len(pheader.section_data(0)) == 132: hr = HeaderRecord(pheader.sect... | 452,021 |
def _save_books(self, paths, target): '''Copy books from device to disk''' for path in paths: name = path.rpartition(getattr(self.device, 'path_sep', '/'))[2] dest = os.path.join(target, name) if os.path.abspath(dest) != os.path.abspath(path): f = open(dest, 'wb') self.device.get_file(path, f) f.close() | def _save_books(self, paths, target): '''Copy books from device to disk''' for path in paths: name = path.rpartition(os.sep)[2] dest = os.path.join(target, name) if os.path.abspath(dest) != os.path.abspath(path): f = open(dest, 'wb') self.device.get_file(path, f) f.close() | 452,022 |
def dump_text(self, subitems, elem, stylizer, end='', pre=False, li = ''): | def dump_text(self, subitems, elem, stylizer, end='', pre=False, li = ''): | 452,023 |
def dump_text(self, subitems, elem, stylizer, end='', pre=False, li = ''): | def dump_text(self, subitems, elem, stylizer, end='', pre=False, li = ''): | 452,024 |
def dump_text(self, subitems, elem, stylizer, end='', pre=False, li = ''): | def dump_text(self, subitems, elem, stylizer, end='', pre=False, li = ''): | 452,025 |
def _reformat(self, data): try: data = xml_to_unicode(data, strip_encoding_pats=True)[0] soup = BeautifulSoup(data) except ValueError: # hit some strange encoding problems... print "Unable to parse html for cleaning, leaving it :(" return data # nuke javascript... [s.extract() for s in soup('script')] # remove forward ... | def _reformat(self, data): try: data = xml_to_unicode(data, strip_encoding_pats=True)[0] soup = BeautifulSoup(data) except ValueError: # hit some strange encoding problems... print "Unable to parse html for cleaning, leaving it :(" return data # nuke javascript... [s.extract() for s in soup('script')] # remove forward ... | 452,026 |
def _reformat(self, data): try: data = xml_to_unicode(data, strip_encoding_pats=True)[0] soup = BeautifulSoup(data) except ValueError: # hit some strange encoding problems... print "Unable to parse html for cleaning, leaving it :(" return data # nuke javascript... [s.extract() for s in soup('script')] # remove forward ... | def _reformat(self, data): try: data = xml_to_unicode(data, strip_encoding_pats=True)[0] soup = BeautifulSoup(data) except ValueError: # hit some strange encoding problems... print "Unable to parse html for cleaning, leaving it :(" return data # nuke javascript... [s.extract() for s in soup('script')] # remove forward ... | 452,027 |
def _reformat(self, data): try: data = xml_to_unicode(data, strip_encoding_pats=True)[0] soup = BeautifulSoup(data) except ValueError: # hit some strange encoding problems... print "Unable to parse html for cleaning, leaving it :(" return data # nuke javascript... [s.extract() for s in soup('script')] # remove forward ... | def _reformat(self, data): try: data = xml_to_unicode(data, strip_encoding_pats=True)[0] soup = BeautifulSoup(data) except ValueError: # hit some strange encoding problems... print "Unable to parse html for cleaning, leaving it :(" return data # nuke javascript... [s.extract() for s in soup('script')] # remove forward ... | 452,028 |
def run_in_debug_mode(logpath=None): e = sys.executable if getattr(sys, 'frozen', False) else sys.argv[0] import tempfile, subprocess fd, logpath = tempfile.mkstemp('.txt') if hasattr(sys, 'frameworks_dir'): base = os.path.dirname(sys.frameworks_dir) if 'console.app' not in base: base = os.path.join(base, 'console.app... | def run_in_debug_mode(logpath=None): e = sys.executable if getattr(sys, 'frozen', False) else sys.argv[0] import tempfile, subprocess fd, logpath = tempfile.mkstemp('.txt') if hasattr(sys, 'frameworks_dir'): base = os.path.dirname(sys.frameworks_dir) if 'console.app' not in base: base = os.path.join(base, 'console.app... | 452,029 |
def run_gui(opts, args, actions, listener, app, gui_debug=None): initialize_file_icon_provider() if not dynamic.get('welcome_wizard_was_run', False): from calibre.gui2.wizard import wizard wizard().exec_() dynamic.set('welcome_wizard_was_run', True) runner = GuiRunner(opts, args, actions, listener, app, gui_debug=gui_d... | def run_gui(opts, args, actions, listener, app, gui_debug=None): initialize_file_icon_provider() if not dynamic.get('welcome_wizard_was_run', False): from calibre.gui2.wizard import wizard wizard().exec_() dynamic.set('welcome_wizard_was_run', True) runner = GuiRunner(opts, args, actions, listener, app, gui_debug=gui_d... | 452,030 |
def set_search_string(self, txt, store_in_history=False, emit_changed=True): self.setFocus(Qt.OtherFocusReason) if not txt: self.clear() else: self.normalize_state() self.setEditText(txt) self.line_edit.end(False) if emit_changed: self.changed.emit() self._do_search(store_in_history=store_in_history) self.focus_to_libr... | def set_search_string(self, txt, store_in_history=False, emit_changed=True): self.setFocus(Qt.OtherFocusReason) if not txt: self.clear() else: self.normalize_state() self.setEditText(txt) self.line_edit.end(False) if emit_changed: self.changed.emit() self._do_search(store_in_history=store_in_history) self.focus_to_libr... | 452,031 |
def write_content(self, oeb_book, out_stream, metadata=None): pmlmlizer = PMLMLizer(self.log) pml = unicode(pmlmlizer.extract_content(oeb_book, self.opts)).encode('cp1252', 'replace') | def write_content(self, oeb_book, out_stream, metadata=None): pmlmlizer = PMLMLizer(self.log) pml = unicode(pmlmlizer.extract_content(oeb_book, self.opts)).encode('cp1252', 'replace') | 452,032 |
def cleanup_html_remove_redundant(self, html): for key in self.STATES_TAGS.keys(): open, close = self.STATES_TAGS[key] if key in self.STATES_VALUE_REQ: html = re.sub(r'(?u)%s\s*%s' % (open % '.*?', close), '', html) else: html = re.sub(r'(?u)%s\s*%s' % (open, close), '', html) html = re.sub(r'<p>\s*</p>', '', html) ret... | def cleanup_html_remove_redundant(self, html): for key in self.STATES_TAGS.keys(): open, close = self.STATES_TAGS[key] if key in self.STATES_VALUE_REQ: html = re.sub(r'(?u)%s\s*%s' % (open % '.*?', close), '', html) else: html = re.sub(r'(?u)%s\s*%s' % (open, close), '', html) html = re.sub(r'(?imu)<p>\s*</p>', '', htm... | 452,033 |
def __init__(self, server, path): self.ok, self.err = True, None try: import dbus self.dbus = dbus self._notify = dbus.SessionBus().get_object(server, path) except Exception, err: self.ok = False self.err = str(err) | def __init__(self, server, path, interface): self.ok, self.err = True, None try: import dbus self.dbus = dbus self._notify = dbus.SessionBus().get_object(server, path) except Exception, err: self.ok = False self.err = str(err) | 452,034 |
def __init__(self, server, path): self.ok, self.err = True, None try: import dbus self.dbus = dbus self._notify = dbus.SessionBus().get_object(server, path) except Exception, err: self.ok = False self.err = str(err) | def __init__(self, server, path): self.ok, self.err = True, None try: import dbus self.dbus = dbus self._notify = dbus.Interface(dbus.SessionBus().get_object(server, path), interface) except Exception, err: self.ok = False self.err = str(err) | 452,035 |
def __init__(self): DBUSNotifier.__init__(self, 'org.kde.VisualNotifications', '/VisualNotifications') | def __init__(self): DBUSNotifier.__init__(self, 'org.kde.VisualNotifications', '/VisualNotifications') | 452,036 |
def __init__(self): DBUSNotifier.__init__(self, 'org.freedesktop.Notifications', '/org/freedesktop/Notifications') | def __init__(self): DBUSNotifier.__init__(self, 'org.freedesktop.Notifications', '/org/freedesktop/Notifications') | 452,037 |
def do_one(self, id): remove_all, remove, add, au, aus, do_aus, rating, pub, do_series, \ do_autonumber, do_remove_format, remove_format, do_swap_ta, \ do_remove_conv, do_auto_author, series, do_series_restart, \ series_start_value, do_title_case, clear_series = self.args | def do_one(self, id): remove_all, remove, add, au, aus, do_aus, rating, pub, do_series, \ do_autonumber, do_remove_format, remove_format, do_swap_ta, \ do_remove_conv, do_auto_author, series, do_series_restart, \ series_start_value, do_title_case, clear_series = self.args | 452,038 |
def accept(self): if len(self.ids) < 1: return QDialog.accept(self) | def accept(self): if len(self.ids) < 1: return QDialog.accept(self) | 452,039 |
def setup_help(self, help_provider): w = textwrap.TextWrapper(80) for name in self._options: g = getattr(self, 'opt_'+name, None) if g is None: continue help = help_provider(name) if not help: continue g._help = help g.setToolTip('\n'.join(w.wrap(help))) g.setWhatsThis('\n'.join(w.wrap(help))) g.__class__.enterEvent = ... | def setup_help(self, help_provider): w = textwrap.TextWrapper(80) for name in self._options: g = getattr(self, 'opt_'+name, None) if g is None: continue help = help_provider(name) if not help: continue g._help = help htext = u'<div>%s</div>'%prepare_string_for_xml( '\n'.join(w.wrap(help))) g.setToolTip(htext) g.setWhat... | 452,040 |
def get_metadata(self, idx, index_is_id=False, get_cover=False): ''' Convenience method to return metadata as a :class:`Metadata` object. Note that the list of formats is not verified. ''' self.gm_count += 1 mi = self.data.get(idx, self.FIELD_MAP['all_metadata'], row_is_id = index_is_id) if mi is not None: if get_cover... | def get_metadata(self, idx, index_is_id=False, get_cover=False): ''' Convenience method to return metadata as a :class:`Metadata` object. Note that the list of formats is not verified. ''' self.gm_count += 1 mi = self.data.get(idx, self.FIELD_MAP['all_metadata'], row_is_id = index_is_id) if mi is not None: if get_cover... | 452,041 |
def doit(func, *args, **kwargs): try: func(*args, **kwargs) except: if ignore_errors: traceback.print_exc() else: raise | def doit(func, *args, **kwargs): try: func(*args, **kwargs) except: if ignore_errors: traceback.print_exc() else: raise | 452,042 |
def __call__(self, data, add_namespace=False): from calibre.ebooks.oeb.base import XHTML_CSS_NAMESPACE data = self.PAGE_PAT.sub('', data) if not add_namespace: return data ans, namespaced = [], False for line in data.splitlines(): ll = line.lstrip() if not (namespaced or ll.startswith('@import') or ll.startswith('@char... | def __call__(self, data, add_namespace=False): from calibre.ebooks.oeb.base import XHTML_CSS_NAMESPACE data = self.PAGE_PAT.sub('', data) if not add_namespace: return data ans, namespaced = [], False for line in data.splitlines(): ll = line.lstrip() if not (namespaced or ll.startswith('@import') or ll.startswith('@char... | 452,043 |
def get_toc(self): ''' Generation of inline TOC ''' | def get_toc(self): ''' Generation of inline TOC ''' | 452,044 |
def mouse_released(self, event): self.normalize_state() if self.as_you_type: self.timer.start(1500) | def mouse_released(self, event): self.normalize_state() if self.as_you_type: self.timer.start(1500) | 452,045 |
def set_database(self, db): self.save_state() self._model.set_database(db) self.tags_delegate.set_database(db) self.authors_delegate.set_auto_complete_function(db.all_authors) self.series_delegate.set_auto_complete_function(db.all_series) self.publisher_delegate.set_auto_complete_function(db.all_publishers) | def set_database(self, db): self.save_state() self._model.set_database(db) self.tags_delegate.set_database(db) self.authors_delegate.set_auto_complete_function( lambda: [(x, y.replace('|', ',')) for (x, y) in db.all_authors()]) self.series_delegate.set_auto_complete_function(db.all_series) self.publisher_delegate.set_a... | 452,046 |
def browse_matches(self, category=None, cid=None, list_sort=None): if list_sort: list_sort = unquote(list_sort) if not cid: raise cherrypy.HTTPError(404, 'invalid category id: %r'%cid) categories = self.categories_cache() | def browse_matches(self, category=None, cid=None, list_sort=None): if list_sort: list_sort = unquote(list_sort) if not cid: raise cherrypy.HTTPError(404, 'invalid category id: %r'%cid) categories = self.categories_cache() | 452,047 |
def browse_matches(self, category=None, cid=None, list_sort=None): if list_sort: list_sort = unquote(list_sort) if not cid: raise cherrypy.HTTPError(404, 'invalid category id: %r'%cid) categories = self.categories_cache() | def browse_matches(self, category=None, cid=None, list_sort=None): if list_sort: list_sort = unquote(list_sort) if not cid: raise cherrypy.HTTPError(404, 'invalid category id: %r'%cid) categories = self.categories_cache() | 452,048 |
def cleanup_html(self): self.log.debug('Cleaning up HTML...') self.processed_html = re.sub(r'<div height="0(pt|px|ex|em|%){0,1}"></div>', '', self.processed_html) if self.book_header.ancient and '<html' not in self.mobi_html[:300].lower(): self.processed_html = '<html><p>' + self.processed_html.replace('\n\n', '<p>') +... | def cleanup_html(self): self.log.debug('Cleaning up HTML...') self.processed_html = re.sub(r'<div height="0(pt|px|ex|em|%){0,1}"></div>', '', self.processed_html) if self.book_header.ancient and '<html' not in self.mobi_html[:300].lower(): self.processed_html = '<html><p>' + self.processed_html.replace('\n\n', '<p>') +... | 452,049 |
def convert(self, oeb_book, output_path, input_plugin, opts, log): # Create temp dir with TemporaryDirectory('_snb_output') as tdir: # Create stub directories snbfDir = os.path.join(tdir, 'snbf') snbcDir = os.path.join(tdir, 'snbc') snbiDir = os.path.join(tdir, 'snbc/images') os.mkdir(snbfDir) os.mkdir(snbcDir) os.mkdi... | def convert(self, oeb_book, output_path, input_plugin, opts, log): # Create temp dir with TemporaryDirectory('_snb_output') as tdir: # Create stub directories snbfDir = os.path.join(tdir, 'snbf') snbcDir = os.path.join(tdir, 'snbc') snbiDir = os.path.join(tdir, 'snbc/images') os.mkdir(snbfDir) os.mkdir(snbcDir) os.mkdi... | 452,050 |
def do_remove_custom_column(db, label, force): if not force: q = raw_input(_('You will lose all data in the column: %r.' ' Are you sure (y/n)? ')%label) if q.lower().strip() != 'y': return db.delete_custom_column(label=label) prints('Column %r removed.'%label) | def do_remove_custom_column(db, label, force): if not force: q = raw_input(_('You will lose all data in the column: %r.' ' Are you sure (y/n)? ')%label) if q.lower().strip() != _('y'): return db.delete_custom_column(label=label) prints('Column %r removed.'%label) | 452,051 |
def serialize_guide(self): buffer = self.buffer hrefs = self.oeb.manifest.hrefs buffer.write('<guide>') for ref in self.oeb.guide.values(): path = urldefrag(ref.href)[0] if hrefs[path].media_type not in OEB_DOCS: continue | def serialize_guide(self): buffer = self.buffer hrefs = self.oeb.manifest.hrefs buffer.write('<guide>') for ref in self.oeb.guide.values(): path = urldefrag(ref.href)[0] if path not in hrefs or hrefs[path].media_type not in OEB_DOCS: continue | 452,052 |
def divide_num(self, numerator, denominator): try: numerator = float(re.search('[0-9.]+', numerator).group()) except TypeError, msg: if self.__run_level > 3: msg = 'no number to process?\n' msg += 'this indicates that the token ' msg += ' \(\\li\) should have a number and does not\n' msg += 'numerator is "%s"\n' % nume... | def divide_num(self, numerator, denominator): try: numerator = float(re.search('[0-9.\-]+', numerator).group()) except TypeError, msg: if self.__run_level > 3: msg = 'no number to process?\n' msg += 'this indicates that the token ' msg += ' \(\\li\) should have a number and does not\n' msg += 'numerator is "%s"\n' % nu... | 452,053 |
def genesis(self): m = QMenu(self.gui) for text, icon, target, shortcut in [ (_('Books by same author'), 'user_profile.svg', 'authors', _('Alt+A')), (_('Books in this series'), 'books_in_series.svg', 'series', _('Alt+S')), (_('Books by this publisher'), 'publisher.png', 'publisher', _('Alt+P')), (_('Books with the same... | def genesis(self): m = QMenu(self.gui) for text, icon, target, shortcut in [ (_('Books by same author'), 'user_profile.svg', 'authors', _('Alt+A')), (_('Books in this series'), 'books_in_series.svg', 'series', _('Alt+Shift+S')), (_('Books by this publisher'), 'publisher.png', 'publisher', _('Alt+P')), (_('Books with th... | 452,054 |
def render_html(path_to_html, width=590, height=750): from PyQt4.QtWebKit import QWebPage from PyQt4.Qt import QEventLoop, QPalette, Qt, SIGNAL, QUrl, QSize from calibre.gui2 import is_ok_to_use_qt if not is_ok_to_use_qt(): return None path_to_html = os.path.abspath(path_to_html) with CurrentDir(os.path.dirname(path_to... | def render_html(path_to_html, width=590, height=750): from PyQt4.QtWebKit import QWebPage from PyQt4.Qt import QEventLoop, QPalette, Qt, SIGNAL, QUrl, QSize from calibre.gui2 import is_ok_to_use_qt if not is_ok_to_use_qt(): return None path_to_html = os.path.abspath(path_to_html) with CurrentDir(os.path.dirname(path_to... | 452,055 |
def update_booklist(mountpath, ContentID, filename, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(filename) in self.FORMATS: try: # lpath = os.path.join(path, filename).partition(self.normalize_path(prefix))[2] # if lpath.startswith(os.sep): # lpath = lpath[len... | def update_booklist(mountpath, ContentID, filename, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(filename) in self.FORMATS: try: # lpath = os.path.join(path, filename).partition(self.normalize_path(prefix))[2] # if lpath.startswith(os.sep): # lpath = lpath[len... | 452,056 |
def update_booklist(mountpath, ContentID, filename, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(filename) in self.FORMATS: try: # lpath = os.path.join(path, filename).partition(self.normalize_path(prefix))[2] # if lpath.startswith(os.sep): # lpath = lpath[len... | def update_booklist(mountpath, ContentID, filename, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(filename) in self.FORMATS: try: # lpath = os.path.join(path, filename).partition(self.normalize_path(prefix))[2] # if lpath.startswith(os.sep): # lpath = lpath[len... | 452,057 |
def update_booklist(mountpath, ContentID, filename, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(filename) in self.FORMATS: try: # lpath = os.path.join(path, filename).partition(self.normalize_path(prefix))[2] # if lpath.startswith(os.sep): # lpath = lpath[len... | def update_booklist(mountpath, ContentID, filename, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(filename) in self.FORMATS: try: # lpath = os.path.join(path, filename).partition(self.normalize_path(prefix))[2] # if lpath.startswith(os.sep): # lpath = lpath[len... | 452,058 |
def delete_books(self, paths, end_session=True): for i, path in enumerate(paths): self.report_progress((i+1) / float(len(paths)), _('Removing books from device...')) path = self.normalize_path(path) print "Delete file normalized path: " + path extension = os.path.splitext(path)[1] | def delete_books(self, paths, end_session=True): for i, path in enumerate(paths): self.report_progress((i+1) / float(len(paths)), _('Removing books from device...')) path = self.normalize_path(path) extension = os.path.splitext(path)[1] | 452,059 |
def fetchBooksByTitle(self): | def fetchBooksByTitle(self): | 452,060 |
def generateSortTitle(self, title): # Convert the actual title to a string suitable for sorting. # Ignore leading stop words # Optionally convert leading numbers to strings from calibre.ebooks.metadata import title_sort # Strip stop words title_words = title_sort(title).split() translated = [] | def generateSortTitle(self, title): # Convert the actual title to a string suitable for sorting. # Ignore leading stop words # Optionally convert leading numbers to strings from calibre.ebooks.metadata import title_sort # Strip stop words title_words = title_sort(title).split() translated = [] | 452,061 |
def item(i): templ = (u'<div title="{4}" class="category-item">' '<div class="category-name">{0}</div><div>{1}</div>' '<div>{2}' '<span class="href">{3}</span></div></div>') rating, rstring = render_rating(i.avg_rating) name = xml(i.name) if datatype == 'rating': name = xml(_('%d stars')%int(i.avg_rating)) id_ = i.id i... | def item(i): templ = (u'<div title="{4}" class="category-item">' '<div class="category-name">{0}</div><div>{1}</div>' '<div>{2}' '<span class="href">{3}</span></div></div>') rating, rstring = render_rating(i.avg_rating) name = xml(i.name) if datatype == 'rating': name = xml(_('%d stars')%int(i.avg_rating)) id_ = i.id i... | 452,062 |
def update_booklist(prefix, path, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(path) in self.FORMATS: try: lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] lpath = lpath.replace('\\', '/') | def update_booklist(prefix, path, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(path) in self.FORMATS: try: lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] lpath = lpath.replace('\\', '/') | 452,063 |
def update_booklist(prefix, path, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(path) in self.FORMATS: try: lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] lpath = lpath.replace('\\', '/') | def update_booklist(prefix, path, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(path) in self.FORMATS: try: lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] lpath = lpath.replace('\\', '/') | 452,064 |
def update_booklist(prefix, path, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(path) in self.FORMATS: try: lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] lpath = lpath.replace('\\', '/') | def update_booklist(prefix, path, title, authors, mime, date, ContentType, ImageID): changed = False # if path_to_ext(path) in self.FORMATS: try: lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] lpath = lpath.replace('\\', '/') | 452,065 |
def path_from_contentid(self, ContentID, ContentType, oncard): path = ContentID | def path_from_contentid(self, ContentID, ContentType, oncard): path = ContentID | 452,066 |
def path_from_contentid(self, ContentID, ContentType, oncard): path = ContentID | def path_from_contentid(self, ContentID, ContentType, oncard): path = ContentID | 452,067 |
def path_from_contentid(self, ContentID, ContentType, oncard): path = ContentID | def path_from_contentid(self, ContentID, ContentType, oncard): path = ContentID | 452,068 |
def path_from_contentid(self, ContentID, ContentType, oncard): path = ContentID | def path_from_contentid(self, ContentID, ContentType, oncard): path = ContentID | 452,069 |
def convert(self, stream, options, file_ext, log, accelerators): from calibre.ebooks.metadata.meta import get_metadata from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.rtf2xml.ParseRtf import RtfInvalidCodeException self.options = options self.log = log self.log('Converting RTF to XML...') #Name ... | def convert(self, stream, options, file_ext, log, accelerators): from calibre.ebooks.metadata.meta import get_metadata from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.rtf2xml.ParseRtf import RtfInvalidCodeException self.opts = options self.log = log self.log('Converting RTF to XML...') #Name of ... | 452,070 |
def convert(self, stream, options, file_ext, log, accelerators): from calibre.ebooks.metadata.meta import get_metadata from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.rtf2xml.ParseRtf import RtfInvalidCodeException self.options = options self.log = log self.log('Converting RTF to XML...') #Name ... | def convert(self, stream, options, file_ext, log, accelerators): from calibre.ebooks.metadata.meta import get_metadata from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.rtf2xml.ParseRtf import RtfInvalidCodeException self.options = options self.log = log self.log('Converting RTF to XML...') #Name ... | 452,071 |
def convert(self, stream, options, file_ext, log, accelerators): from calibre.ebooks.metadata.meta import get_metadata from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.rtf2xml.ParseRtf import RtfInvalidCodeException self.options = options self.log = log self.log('Converting RTF to XML...') #Name ... | def convert(self, stream, options, file_ext, log, accelerators): from calibre.ebooks.metadata.meta import get_metadata from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.rtf2xml.ParseRtf import RtfInvalidCodeException self.options = options self.log = log self.log('Converting RTF to XML...') #Name ... | 452,072 |
def smart_update(self, other): ''' Merge the information in C{other} into self. In case of conflicts, the information in C{other} takes precedence, unless the information in C{other} is NULL. ''' | def smart_update(self, other, replace_metadata=False): ''' Merge the information in C{other} into self. In case of conflicts, the information in C{other} takes precedence, unless the information in C{other} is NULL. ''' | 452,073 |
def smart_update(self, other): ''' Merge the information in C{other} into self. In case of conflicts, the information in C{other} takes precedence, unless the information in C{other} is NULL. ''' | def smart_update(self, other): ''' Merge the information in C{other} into self. In case of conflicts, the information in C{other} takes precedence, unless the information in C{other} is NULL. ''' | 452,074 |
def add_book(self, book, replace_metadata): try: b = self.index(book) except (ValueError, IndexError): b = None if b is None: self.append(book) return True if replace_metadata: self[b].smart_update(book) return True return False | def add_book(self, book, replace_metadata): try: b = self.index(book) except (ValueError, IndexError): b = None if b is None: self.append(book) return True if replace_metadata: self[b].smart_update(book, replace_metadata=True) return True return False | 452,075 |
def get_metadata(br, asin, mi): q = 'http://amzn.com/'+asin try: raw = br.open_novisit(q).read() except Exception, e: if callable(getattr(e, 'getcode', None)) and \ e.getcode() == 404: return False raise if '<title>404 - ' in raw: return False raw = xml_to_unicode(raw, strip_encoding_pats=True, resolve_entities=True)[0... | def get_metadata(br, asin, mi): q = 'http://amzn.com/'+asin try: raw = br.open_novisit(q).read() except Exception, e: if callable(getattr(e, 'getcode', None)) and \ e.getcode() == 404: return False raise if '<title>404 - ' in raw: return False raw = xml_to_unicode(raw, strip_encoding_pats=True, resolve_entities=True)[0... | 452,076 |
def convert(self, stream, options, file_ext, log, accelerators): log.debug("Parsing SNB file...") snbFile = SNBFile() try: snbFile.Parse(stream) except: raise ValueError("Invalid SNB file") if not snbFile.IsValid(): log.debug("Invaild SNB file") raise ValueError("Invalid SNB file") log.debug("Handle meta data ...") fro... | def convert(self, stream, options, file_ext, log, accelerators): log.debug("Parsing SNB file...") snbFile = SNBFile() try: snbFile.Parse(stream) except: raise ValueError("Invalid SNB file") if not snbFile.IsValid(): log.debug("Invaild SNB file") raise ValueError("Invalid SNB file") log.debug("Handle meta data ...") fro... | 452,077 |
def generate_xml(self, stream): from calibre.ebooks.rtf2xml.ParseRtf import ParseRtf ofile = 'out.xml' parser = ParseRtf( in_file = stream, out_file = ofile, | def generate_xml(self, stream): from calibre.ebooks.rtf2xml.ParseRtf import ParseRtf ofile = 'out.xml' parser = ParseRtf( in_file = stream, out_file = ofile, | 452,078 |
def __call__(self, html): self.log("********* Preprocessing HTML *********") | def __call__(self, html): self.log("********* Preprocessing HTML *********") | 452,079 |
def __call__(self, html): self.log("********* Preprocessing HTML *********") | def__call__(self,html):self.log("*********PreprocessingHTML*********") | 452,080 |
def __call__(self, html): self.log("********* Preprocessing HTML *********") | def __call__(self, html): self.log("********* Preprocessing HTML *********") | 452,081 |
def set_books_in_library(self, booklists, reset=False): if reset: # First build a cache of the library, so the search isn't On**2 self.db_book_title_cache = {} self.db_book_uuid_cache = set() db = self.library_view.model().db for id in db.data.iterallids(): mi = db.get_metadata(id, index_is_id=True) title = re.sub('(?u... | def set_books_in_library(self, booklists, reset=False): if reset: # First build a cache of the library, so the search isn't On**2 self.db_book_title_cache = {} self.db_book_uuid_cache = set() db = self.library_view.model().db for id in db.data.iterallids(): mi = db.get_metadata(id, index_is_id=True) title = re.sub('(?u... | 452,082 |
def set_books_in_library(self, booklists, reset=False): if reset: # First build a cache of the library, so the search isn't On**2 self.db_book_title_cache = {} self.db_book_uuid_cache = set() db = self.library_view.model().db for id in db.data.iterallids(): mi = db.get_metadata(id, index_is_id=True) title = re.sub('(?u... | def set_books_in_library(self, booklists, reset=False): if reset: # First build a cache of the library, so the search isn't On**2 self.db_book_title_cache = {} self.db_book_uuid_cache = set() db = self.library_view.model().db for id in db.data.iterallids(): mi = db.get_metadata(id, index_is_id=True) title = re.sub('(?u... | 452,083 |
def __eq__(self, other): # use lpath because the prefix can change, changing path return self.path == getattr(other, 'lpath', None) | def __eq__(self, other): # use lpath because the prefix can change, changing path return self.path == getattr(other, 'lpath', None) | 452,084 |
def get_filelist(htmlfile, dir, opts, log): ''' Build list of files referenced by html file or try to detect and use an OPF file instead. ''' log.info('Building file list...') filelist = traverse(htmlfile, max_levels=int(opts.max_levels), verbose=opts.verbose, encoding=opts.input_encoding)\ [0 if opts.breadth_first els... | def get_filelist(htmlfile, dir, opts, log): ''' Build list of files referenced by html file or try to detect and use an OPF file instead. ''' log.info('Building file list...') filelist = traverse(htmlfile, max_levels=int(opts.max_levels), verbose=opts.verbose, encoding=opts.input_encoding)\ [0 if opts.breadth_first els... | 452,085 |
def get_opds_acquisition_feed(self, ids, offset, page_url, up_url, id_, sort_by='title', ascending=True, version=0): idx = self.db.FIELD_MAP['id'] ids &= self.get_opds_allowed_ids_for_version(version) if not ids: raise cherrypy.HTTPError(404, 'No books found') items = [x for x in self.db.data.iterall() if x[idx] in ids... | def get_opds_acquisition_feed(self, ids, offset, page_url, up_url, id_, sort_by='title', ascending=True, version=0): idx = self.db.FIELD_MAP['id'] ids &= self.get_opds_allowed_ids_for_version(version) if not ids: raise cherrypy.HTTPError(404, 'No books found') items = [x for x in self.db.data.iterall() if x[idx] in ids... | 452,086 |
def opds_category_group(self, category=None, which=None, version=0, offset=0): try: offset = int(offset) version = int(version) except: raise cherrypy.HTTPError(404, 'Not found') | def opds_category_group(self, category=None, which=None, version=0, offset=0): try: offset = int(offset) version = int(version) except: raise cherrypy.HTTPError(404, 'Not found') | 452,087 |
def __init__(self, text, count): self.text, self.count = text, count | def __init__(self, text, count): self.text, self.count = text, count | 452,088 |
def opds(self, version=0): version = int(version) if version not in BASE_HREFS: raise cherrypy.HTTPError(404, 'Not found') categories = self.categories_cache( self.get_opds_allowed_ids_for_version(version)) category_meta = self.db.field_metadata cats = [ (_('Newest'), _('Date'), 'Onewest'), (_('Title'), _('Title'), 'Ot... | def opds(self, version=0): version = int(version) if version not in BASE_HREFS: raise cherrypy.HTTPError(404, 'Not found') categories = self.categories_cache( self.get_opds_allowed_ids_for_version(version)) category_meta = self.db.field_metadata cats = [ (_('Newest'), _('Date'), 'Onewest'), (_('Title'), _('Title'), 'Ot... | 452,089 |
def fetch_metadata(self): isbn = re.sub(r'[^0-9a-zA-Z]', '', unicode(self.isbn.text())) title = unicode(self.title.text()) try: author = string_to_authors(unicode(self.authors.text()))[0] except: author = '' publisher = unicode(self.publisher.currentText()) if isbn or title or author or publisher: d = FetchMetadata(... | def fetch_metadata(self): isbn = re.sub(r'[^0-9a-zA-Z]', '', unicode(self.isbn.text())) title = unicode(self.title.text()) try: author = string_to_authors(unicode(self.authors.text()))[0] except: author = '' publisher = unicode(self.publisher.currentText()) if isbn or title or author or publisher: d = FetchMetadata(... | 452,090 |
def update_text_record(self, record, book, path, bl_index): timestamp = os.path.getctime(path) date = strftime(timestamp) if date != record.get('date', None): record.set('date', date) record.set('size', str(os.stat(path).st_size)) title = book.title if book.title else _('Unknown') record.set('title', title) ts = book.t... | def update_text_record(self, record, book, path, bl_index): timestamp = os.path.getmtime(path) if iswindows and time.daylight: timestamp -= time.altzone - time.timezone date = strftime(timestamp) if date != record.get('date', None): record.set('date', date) record.set('size', str(os.stat(path).st_size)) title = book.t... | 452,091 |
def __init__(self, tree, path, oeb, opts, profile=PROFILES['PRS505'], extra_css='', user_css=''): self.oeb, self.opts = oeb, opts self.profile = profile self.logger = oeb.logger item = oeb.manifest.hrefs[path] basename = os.path.basename(path) cssname = os.path.splitext(basename)[0] + '.css' stylesheets = [html_css_sty... | def __init__(self, tree, path, oeb, opts, profile=PROFILES['PRS505'], extra_css='', user_css=''): self.oeb, self.opts = oeb, opts self.profile = profile self.logger = oeb.logger item = oeb.manifest.hrefs[path] basename = os.path.basename(path) cssname = os.path.splitext(basename)[0] + '.css' stylesheets = [html_css_sty... | 452,092 |
def update_booklist(prefix, path, title, authors, mime, date, ContentType, ImageID, readstatus): changed = False # if path_to_ext(path) in self.FORMATS: try: lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] lpath = lpath.replace('\\', '/') # debug_print("LP... | def update_booklist(prefix, path, title, authors, mime, date, ContentType, ImageID, readstatus): changed = False # if path_to_ext(path) in self.FORMATS: try: lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] lpath = lpath.replace('\\', '/') # debug_print("LP... | 452,093 |
def contentid_from_path(self, path, ContentType): if ContentType == 6: if self.dbversion < 8: ContentID = os.path.splitext(path)[0] # Remove the prefix on the file. it could be either ContentID = ContentID.replace(self._main_prefix, '') else: ContentID = path ContentID = ContentID.replace(self._main_prefix + '.kobo/ke... | def contentid_from_path(self, path, ContentType): if ContentType == 6: if self.dbversion < 8: ContentID = os.path.splitext(path)[0] # Remove the prefix on the file. it could be either ContentID = ContentID.replace(self._main_prefix, '') else: ContentID = path ContentID = ContentID.replace(self._main_prefix + '.kobo/ke... | 452,094 |
def update_device_database_collections(self, booklists, collections_attributes, oncard): | def update_device_database_collections(self, booklists, collections_attributes, oncard): | 452,095 |
def _update_playorder(self, ncx): hrefs = set(xpath(ncx, '//ncx:content/@src')) playorder = {} next = 1 selector = XPath('h:body//*[@id or @name]') for item in self.spine: base = item.href if base in hrefs: playorder[base] = next next += 1 for elem in selector(item.data): added = False for attr in ('id', 'name'): id = ... | def _update_playorder(self, ncx): hrefs = set(map(urlnormalize, xpath(ncx, '//ncx:content/@src'))) playorder = {} next = 1 selector = XPath('h:body//*[@id or @name]') for item in self.spine: base = item.href if base in hrefs: playorder[base] = next next += 1 for elem in selector(item.data): added = False for attr in ('... | 452,096 |
def _update_playorder(self, ncx): hrefs = set(xpath(ncx, '//ncx:content/@src')) playorder = {} next = 1 selector = XPath('h:body//*[@id or @name]') for item in self.spine: base = item.href if base in hrefs: playorder[base] = next next += 1 for elem in selector(item.data): added = False for attr in ('id', 'name'): id = ... | def _update_playorder(self, ncx): hrefs = set(xpath(ncx, '//ncx:content/@src')) playorder = {} next = 1 selector = XPath('h:body//*[@id or @name]') for item in self.spine: base = item.href if base in hrefs: playorder[base] = next next += 1 for elem in selector(item.data): added = False for attr in ('id', 'name'): id = ... | 452,097 |
def ExtractFiles(self, output_dir=os.getcwdu()): for path in self.Contents(): lpath = os.path.join(output_dir, path) self._ensure_dir(lpath) try: data = self.GetFile(path) except: self.log.exception('Failed to extract %s from CHM, ignoring'%path) continue if lpath.find(';') != -1: # fix file names with ";<junk>" at the... | def ExtractFiles(self, output_dir=os.getcwdu()): for path in self.Contents(): lpath = os.path.join(output_dir, path) self._ensure_dir(lpath) try: data = self.GetFile(path) except: self.log.exception('Failed to extract %s from CHM, ignoring'%path) continue if lpath.find(';') != -1: # fix file names with ";<junk>" at the... | 452,098 |
def __init__(self, parent, model, server=None): ResizableDialog.__init__(self, parent) self.ICON_SIZES = {0:QSize(48, 48), 1:QSize(32,32), 2:QSize(24,24)} self._category_model = CategoryModel() | def __init__(self, parent, model, server=None): ResizableDialog.__init__(self, parent) self.ICON_SIZES = {0:QSize(48, 48), 1:QSize(32,32), 2:QSize(24,24)} self._category_model = CategoryModel() | 452,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.