bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def get_matches(self, location, query): matches = set([]) if query and query.strip(): location = location.lower().strip() | def get_matches(self, location, query): matches = set([]) if query and query.strip(): location = location.lower().strip() | 450,800 |
def chapter_head(self, match): chap = match.group('chap') title = match.group('title') if not title: self.html_preprocess_sections = self.html_preprocess_sections + 1 self.log("found " + unicode(self.html_preprocess_sections) + " chapters. - " + unicode(chap)) return '<h2>'+chap+'</h2>\n' else: self.html_preprocess_sec... | def chapter_head(self, match): chap = match.group('chap') title = match.group('title') if not title: self.html_preprocess_sections = self.html_preprocess_sections + 1 self.log("marked " + unicode(self.html_preprocess_sections) + " chapters. - " + unicode(chap)) return '<h2>'+chap+'</h2>\n' else: self.html_preprocess_se... | 450,801 |
def chapter_head(self, match): chap = match.group('chap') title = match.group('title') if not title: self.html_preprocess_sections = self.html_preprocess_sections + 1 self.log("found " + unicode(self.html_preprocess_sections) + " chapters. - " + unicode(chap)) return '<h2>'+chap+'</h2>\n' else: self.html_preprocess_sec... | def chapter_head(self, match): chap = match.group('chap') title = match.group('title') if not title: self.html_preprocess_sections = self.html_preprocess_sections + 1 self.log("marked " + unicode(self.html_preprocess_sections) + " chapters. - " + unicode(chap)) return '<h2>'+chap+'</h2>\n' else: self.html_preprocess_se... | 450,802 |
def __call__(self, html): self.log("********* Preprocessing HTML *********") | def __call__(self, html): self.log("********* Preprocessing HTML *********") | 450,803 |
def __call__(self, html): self.log("********* Preprocessing HTML *********") | def __call__(self, html): self.log("********* Preprocessing HTML *********") | 450,804 |
def search(self, query, return_matches=False, ignore_search_restriction=False): if not query or not query.strip(): q = '' if not ignore_search_restriction: q = self.search_restriction elif not ignore_search_restriction: q = u'%s (%s)' % (self.search_restriction, query) if not q: if return_matches: return list(self._map... | def search(self, query, return_matches=False, ignore_search_restriction=False): if not query or not query.strip(): q = '' if not ignore_search_restriction: q = self.search_restriction else: if ignore_search_restriction: q = u'%s' % query else: q = u'%s (%s)' % (self.search_restriction, query) if not q: if return_matche... | 450,805 |
def search(self, query, return_matches=False, ignore_search_restriction=False): if not query or not query.strip(): q = '' if not ignore_search_restriction: q = self.search_restriction elif not ignore_search_restriction: q = u'%s (%s)' % (self.search_restriction, query) if not q: if return_matches: return list(self._map... | def search(self, query, return_matches=False, ignore_search_restriction=False): if not query or not query.strip(): q = '' if not ignore_search_restriction: q = self.search_restriction elif not ignore_search_restriction: q = u'%s (%s)' % (self.search_restriction, query) if not q: if return_matches: return list(self._map... | 450,806 |
def search(self, query, return_matches=False, ignore_search_restriction=False): if not query or not query.strip(): q = '' if not ignore_search_restriction: q = self.search_restriction elif not ignore_search_restriction: q = u'%s (%s)' % (self.search_restriction, query) if not q: if return_matches: return list(self._map... | def search(self, query, return_matches=False, ignore_search_restriction=False): if not query or not query.strip(): q = '' if not ignore_search_restriction: q = self.search_restriction elif not ignore_search_restriction: q = u'%s (%s)' % (self.search_restriction, query) if not q: if return_matches: return list(self._map... | 450,807 |
def _unit_convert(self, value, base=None, font=None): ' Return value in pts' if isinstance(value, (int, long, float)): return value try: return float(value) * 72.0 / self._profile.dpi except: pass result = value m = self.UNIT_RE.match(value) if m is not None and m.group(1): value = float(m.group(1)) unit = m.group(2) i... | def _unit_convert(self, value, base=None, font=None): ' Return value in pts' if isinstance(value, (int, long, float)): return value try: return float(value) * 72.0 / self._profile.dpi except: pass result = value m = self.UNIT_RE.match(value) if m is not None and m.group(1): value = float(m.group(1)) unit = m.group(2) i... | 450,808 |
def process_encryption(self, encfile, opf, log): key = None for item in opf.identifier_iter(): scheme = None for key in item.attrib.keys(): if key.endswith('scheme'): scheme = item.get(key) if (scheme and scheme.lower() == 'uuid') or \ (item.text and item.text.startswith('urn:uuid:')): key = str(item.text).rpartition('... | def process_encryption(self, encfile, opf, log): key = None for item in opf.identifier_iter(): scheme = None for xkey in item.attrib.keys(): if xkey.endswith('scheme'): scheme = item.get(xkey) if (scheme and scheme.lower() == 'uuid') or \ (item.text and item.text.startswith('urn:uuid:')): key = str(item.text).rpartitio... | 450,809 |
def get_cover(opf, opf_path, stream, reader=None): import posixpath from calibre.ebooks import render_html_svg_workaround from calibre.utils.logging import default_log raster_cover = opf.raster_cover stream.seek(0) zf = ZipFile(stream) if raster_cover: if reader is not None and \ reader.encryption_meta.is_encrypted(ras... | def get_cover(opf, opf_path, stream, reader=None): import posixpath from calibre.ebooks import render_html_svg_workaround from calibre.utils.logging import default_log raster_cover = opf.raster_cover stream.seek(0) zf = ZipFile(stream) if raster_cover: base = posixpath.dirname(opf_path) cpath = posixpath.normpath(posix... | 450,810 |
def get_value(self, key, args, kwargs): try: key = key.lower() try: b = self.book.get_user_metadata(key, False) except: if DEBUG: traceback.print_exc() b = None | def get_value(self, key, args, kwargs): try: key = key.lower() try: b = self.book.get_user_metadata(key, False) except: traceback.print_exc() b = None | 450,811 |
def get_value(self, key, args, kwargs): try: key = key.lower() try: b = self.book.get_user_metadata(key, False) except: if DEBUG: traceback.print_exc() b = None | defget_value(self,key,args,kwargs):try:key=key.lower()try:b=self.book.get_user_metadata(key,False)except:ifDEBUG:traceback.print_exc()b=None | 450,812 |
def get_value(self, key, args, kwargs): try: key = key.lower() try: b = self.book.get_user_metadata(key, False) except: if DEBUG: traceback.print_exc() b = None | def get_value(self, key, args, kwargs): try: key = key.lower() try: b = self.book.get_user_metadata(key, False) except: traceback.print_exc() b = None | 450,813 |
def process_images(self, soup, baseurl): diskpath = unicode_path(os.path.join(self.current_dir, 'images')) if not os.path.exists(diskpath): os.mkdir(diskpath) c = 0 for tag in soup.findAll(lambda tag: tag.name.lower()=='img' and tag.has_key('src')): iurl = tag['src'] if callable(self.image_url_processor): iurl = self.i... | def process_images(self, soup, baseurl): diskpath = unicode_path(os.path.join(self.current_dir, 'images')) if not os.path.exists(diskpath): os.mkdir(diskpath) c = 0 for tag in soup.findAll(lambda tag: tag.name.lower()=='img' and tag.has_key('src')): iurl = tag['src'] if callable(self.image_url_processor): iurl = self.i... | 450,814 |
def process_images(self, soup, baseurl): diskpath = unicode_path(os.path.join(self.current_dir, 'images')) if not os.path.exists(diskpath): os.mkdir(diskpath) c = 0 for tag in soup.findAll(lambda tag: tag.name.lower()=='img' and tag.has_key('src')): iurl = tag['src'] if callable(self.image_url_processor): iurl = self.i... | def process_images(self, soup, baseurl): diskpath = unicode_path(os.path.join(self.current_dir, 'images')) if not os.path.exists(diskpath): os.mkdir(diskpath) c = 0 for tag in soup.findAll(lambda tag: tag.name.lower()=='img' and tag.has_key('src')): iurl = tag['src'] if callable(self.image_url_processor): iurl = self.i... | 450,815 |
def show_splash_screen(self): self.splash_pixmap = QPixmap() self.splash_pixmap.load(I('library.png')) self.splash_screen = QSplashScreen(self.splash_pixmap, Qt.SplashScreen|Qt.WindowStaysOnTopHint) self.splash_screen.showMessage(_('Starting %s: Loading books...') % __appname__) self.splash_screen.show() QApplication.i... | def show_splash_screen(self): self.splash_pixmap = QPixmap() self.splash_pixmap.load(I('library.png')) self.splash_screen = QSplashScreen(self.splash_pixmap, Qt.SplashScreen) self.splash_screen.showMessage(_('Starting %s: Loading books...') % __appname__) self.splash_screen.show() QApplication.instance().processEvents(... | 450,816 |
def do_one(self, id): 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, 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 | 450,817 |
def generateHTMLDescriptions(self): # Write each title to a separate HTML file in contentdir self.updateProgressFullStep("'Descriptions'") | def generateHTMLDescriptions(self): # Write each title to a separate HTML file in contentdir self.updateProgressFullStep("'Descriptions'") | 450,818 |
def processSpecialTags(self, tags, this_title, opts): tag_list = [] for tag in tags: tag = self.convertHTMLEntities(tag) if tag.startswith(opts.note_tag): this_title['notes'] = tag[1:] elif tag == opts.read_tag: this_title['read'] = True elif re.search(opts.exclude_genre, tag): continue else: tag_list.append(tag) retur... | def processSpecialTags(self, tags, this_title, opts): tag_list = [] for tag in tags: tag = self.convertHTMLEntities(tag) if tag.startswith(opts.note_tag): this_title['notes'] = tag[len(self.opts.note_tag):] elif tag == opts.read_tag: this_title['read'] = True elif re.search(opts.exclude_genre, tag): continue else: tag_... | 450,819 |
def can_handle(cls, device_info, debug=False): if isunix: return device_info[3] == 'Bookeen' and (device_info[4] == 'Cybook Gen3' or device_info[4] == 'Cybook Opus') return True | def can_handle(cls, device_info, debug=False): if isunix: return device_info[3] == 'Bookeen' and (device_info[4] == 'Cybook Gen3' or device_info[4] == 'Cybook Opus') return True | 450,820 |
def lang_name(l): if l == 'en': l = 'en-us' return l.lower().replace('_', '-') | def lang_name(l): if l == 'en': l = 'en-us' return l.lower().replace('_', '-') | 450,821 |
def reorder_playlists(self): for title in self.tag_order.keys(): pl = self.playlist_by_title(title) if not pl: continue db_ids = [i.getAttribute('id') for i in pl.childNodes if hasattr(i, 'getAttribute')] pl_book_ids = [self.book_by_id(i.getAttribute('id')).db_id for i in pl.childNodes if hasattr(i, 'getAttribute')] m... | def reorder_playlists(self): for title in self.tag_order.keys(): pl = self.playlist_by_title(title) if not pl: continue db_ids = [i.getAttribute('id') for i in pl.childNodes if hasattr(i, 'getAttribute')] pl_book_ids = [getattr(self.book_by_id(i), 'db_id', None) for i in db_ids] map = {} for i, j in zip(pl_book_ids, db... | 450,822 |
def read_ncx_toc(self, toc): self.base_path = os.path.dirname(toc) raw = xml_to_unicode(open(toc, 'rb').read(), assume_utf8=True)[0] soup = NCXSoup(raw) | def read_ncx_toc(self, toc): self.base_path = os.path.dirname(toc) raw = xml_to_unicode(open(toc, 'rb').read(), assume_utf8=True)[0] soup = NCXSoup(raw) | 450,823 |
def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.fin... | def process_navpoint(np, dest): try: play_order = int(get_attr(np, 1)) except: play_order = 1 href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.findAll(text=True)]) content = np.find(re.co... | 450,824 |
def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.fin... | def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = nl_path(np) if nl: nl = nl[0] text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.findAll(text=True)]) con... | 450,825 |
def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.fin... | def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in txt_path(nl): text += etree.tostring(txt, method='text', encoding=unicode, wi... | 450,826 |
def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.fin... | def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.fin... | 450,827 |
def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.fin... | def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.fin... | 450,828 |
def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.fin... | def process_navpoint(np, dest): play_order = np.get('playOrder', None) if play_order is None: play_order = int(np.get('playorder', 1)) href = fragment = text = None nl = np.find(re.compile('navlabel')) if nl is not None: text = u'' for txt in nl.findAll(re.compile('text')): text += u''.join([unicode(s) for s in txt.fin... | 450,829 |
def __init__(self, db, opts, plugin, notification=DummyReporter(), stylesheet="content/stylesheet.css"): self.__opts = opts self.__authors = None self.__basename = opts.basename self.__booksByAuthor = None self.__booksByTitle = None self.__catalogPath = PersistentTemporaryDirectory("_epub_mobi_catalog", prefix='') self... | def __init__(self, db, opts, plugin, report_progress=DummyReporter(), stylesheet="content/stylesheet.css"): self.__opts = opts self.__authors = None self.__basename = opts.basename self.__booksByAuthor = None self.__booksByTitle = None self.__catalogPath = PersistentTemporaryDirectory("_epub_mobi_catalog", prefix='') s... | 450,830 |
def __init__(self, db, opts, plugin, notification=DummyReporter(), stylesheet="content/stylesheet.css"): self.__opts = opts self.__authors = None self.__basename = opts.basename self.__booksByAuthor = None self.__booksByTitle = None self.__catalogPath = PersistentTemporaryDirectory("_epub_mobi_catalog", prefix='') self... | def __init__(self, db, opts, plugin, notification=DummyReporter(), stylesheet="content/stylesheet.css"): self.__opts = opts self.__authors = None self.__basename = opts.basename self.__booksByAuthor = None self.__booksByTitle = None self.__catalogPath = PersistentTemporaryDirectory("_epub_mobi_catalog", prefix='') self... | 450,831 |
def __init__(self, db, opts, plugin, notification=DummyReporter(), stylesheet="content/stylesheet.css"): self.__opts = opts self.__authors = None self.__basename = opts.basename self.__booksByAuthor = None self.__booksByTitle = None self.__catalogPath = PersistentTemporaryDirectory("_epub_mobi_catalog", prefix='') self... | def __init__(self, db, opts, plugin, notification=DummyReporter(), stylesheet="content/stylesheet.css"): self.__opts = opts self.__authors = None self.__basename = opts.basename self.__booksByAuthor = None self.__booksByTitle = None self.__catalogPath = PersistentTemporaryDirectory("_epub_mobi_catalog", prefix='') self... | 450,832 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | 450,833 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,834 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,835 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,836 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,837 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,838 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self): if not self.booksByTitle: self.fetchBooksByTitle() | 450,839 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self): if not self.booksByTitle: self.fetchBooksByTitle() | 450,840 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,841 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,842 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,843 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,844 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,845 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,846 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self):if not self.booksByTitle: self.fetchBooksByTitle() | 450,847 |
def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | def buildSources(self): if getattr(self.reporter, 'cancel_requested', False): return 1 if not self.booksByTitle: self.fetchBooksByTitle() | 450,848 |
def fetchBooksByTitle(self): self.opts.log.info(self.updateProgressFullStep("fetchBooksByTitle()")) | def fetchBooksByTitle(self): self.opts.log.info(self.updateProgressFullStep("fetchBooksByTitle()")) | 450,849 |
def fetchBooksByTitle(self): self.opts.log.info(self.updateProgressFullStep("fetchBooksByTitle()")) | def fetchBooksByTitle(self): self.opts.log.info(self.updateProgressFullStep("fetchBooksByTitle()")) | 450,850 |
def fetchBooksByAuthor(self): # Generate a list of titles sorted by author from the database | def fetchBooksByAuthor(self): # Generate a list of titles sorted by author from the database | 450,851 |
def generateHTMLDescriptions(self): # Write each title to a separate HTML file in contentdir self.opts.log.info(self.updateProgressFullStep("generateHTMLDescriptions()")) | def generateHTMLDescriptions(self): # Write each title to a separate HTML file in contentdir self.opts.log.info(self.updateProgressFullStep("generateHTMLDescriptions()")) | 450,852 |
def generateHTMLDescriptions(self): # Write each title to a separate HTML file in contentdir self.opts.log.info(self.updateProgressFullStep("generateHTMLDescriptions()")) | def generateHTMLDescriptions(self): # Write each title to a separate HTML file in contentdir self.opts.log.info(self.updateProgressFullStep("generateHTMLDescriptions()")) | 450,853 |
def generateHTMLByTitle(self): # Write books by title A-Z to HTML file | def generateHTMLByTitle(self): # Write books by title A-Z to HTML file | 450,854 |
def generateHTMLByAuthor(self): # Write books by author A-Z self.opts.log.info(self.updateProgressFullStep("generateHTMLByAuthor()")) | def generateHTMLByAuthor(self): # Write books by author A-Z self.opts.log.info(self.updateProgressFullStep("generateHTMLByAuthor()")) | 450,855 |
def add_books_to_HTML(this_months_list, dtc): if len(this_months_list): date_string = strftime(u'%b %Y', current_date.timetuple()) this_months_list = sorted(this_months_list, key=lambda x:(x['title_sort'], x['title_sort'])) this_months_list = sorted(this_months_list, key=lambda x:(x['author_sort'], x['author_sort'])) #... | def add_books_to_HTML(this_months_list, dtc): if len(this_months_list): date_string = strftime(u'%B %Y', current_date.timetuple()) this_months_list = sorted(this_months_list, key=lambda x:(x['title_sort'], x['title_sort'])) this_months_list = sorted(this_months_list, key=lambda x:(x['author_sort'], x['author_sort'])) #... | 450,856 |
def add_books_to_HTML(this_months_list, dtc): if len(this_months_list): date_string = strftime(u'%b %Y', current_date.timetuple()) this_months_list = sorted(this_months_list, key=lambda x:(x['title_sort'], x['title_sort'])) this_months_list = sorted(this_months_list, key=lambda x:(x['author_sort'], x['author_sort'])) #... | def add_books_to_HTML(this_months_list, dtc): if len(this_months_list): date_string = strftime(u'%b %Y', current_date.timetuple()) this_months_list = sorted(this_months_list, key=lambda x:(x['title_sort'], x['title_sort'])) this_months_list = sorted(this_months_list, key=lambda x:(x['author_sort'], x['author_sort'])) #... | 450,857 |
def add_books_to_HTML(this_months_list, dtc): if len(this_months_list): date_string = strftime(u'%b %Y', current_date.timetuple()) this_months_list = sorted(this_months_list, key=lambda x:(x['title_sort'], x['title_sort'])) this_months_list = sorted(this_months_list, key=lambda x:(x['author_sort'], x['author_sort'])) #... | def add_books_to_HTML(this_months_list, dtc): if len(this_months_list): date_string = strftime(u'%b %Y', current_date.timetuple()) this_months_list = sorted(this_months_list, key=lambda x:(x['title_sort'], x['title_sort'])) this_months_list = sorted(this_months_list, key=lambda x:(x['author_sort'], x['author_sort'])) #... | 450,858 |
def generateHTMLByTags(self): # Generate individual HTML files for each tag, e.g. Fiction, Nonfiction ... # Note that special tags - ~+*[] - have already been filtered from books[] | def generateHTMLByTags(self): # Generate individual HTML files for each tag, e.g. Fiction, Nonfiction ... # Note that special tags - ~+*[] - have already been filtered from books[] | 450,859 |
def generateThumbnails(self): # Generate a thumbnail per cover. If a current thumbnail exists, skip # If a cover doesn't exist, use default # Return list of active thumbs | def generateThumbnails(self): # Generate a thumbnail per cover. If a current thumbnail exists, skip # If a cover doesn't exist, use default # Return list of active thumbs | 450,860 |
def generateThumbnails(self): # Generate a thumbnail per cover. If a current thumbnail exists, skip # If a cover doesn't exist, use default # Return list of active thumbs | def generateThumbnails(self): # Generate a thumbnail per cover. If a current thumbnail exists, skip # If a cover doesn't exist, use default # Return list of active thumbs | 450,861 |
def generateThumbnails(self): # Generate a thumbnail per cover. If a current thumbnail exists, skip # If a cover doesn't exist, use default # Return list of active thumbs | def generateThumbnails(self): # Generate a thumbnail per cover. If a current thumbnail exists, skip # If a cover doesn't exist, use default # Return list of active thumbs | 450,862 |
def generateThumbnails(self): # Generate a thumbnail per cover. If a current thumbnail exists, skip # If a cover doesn't exist, use default # Return list of active thumbs | def generateThumbnails(self): # Generate a thumbnail per cover. If a current thumbnail exists, skip # If a cover doesn't exist, use default # Return list of active thumbs | 450,863 |
def generateOPF(self): | def generateOPF(self): | 450,864 |
def generateNCXHeader(self): | def generateNCXHeader(self): | 450,865 |
def generateNCXDescriptions(self, tocTitle): | def generateNCXDescriptions(self, tocTitle): | 450,866 |
def generateNCXByTitle(self, tocTitle): self.opts.log.info(self.updateProgressFullStep("generateNCXByTitle()")) | def generateNCXByTitle(self, tocTitle): self.opts.log.info(self.updateProgressFullStep("generateNCXByTitle()")) | 450,867 |
def generateNCXByAuthor(self, tocTitle): self.opts.log.info(self.updateProgressFullStep("generateNCXByAuthor()")) | def generateNCXByAuthor(self, tocTitle): self.opts.log.info(self.updateProgressFullStep("generateNCXByAuthor()")) | 450,868 |
def generateNCXByDateAdded(self, tocTitle): self.opts.log.info(self.updateProgressFullStep("generateNCXByDateAdded()")) | def generateNCXByDateAdded(self, tocTitle): self.opts.log.info(self.updateProgressFullStep("generateNCXByDateAdded()")) | 450,869 |
def add_to_master_month_list(current_titles_list): current_titles_list = " • ".join(current_titles_list) current_titles_list = self.generateShortDescription(self.formatNCXText(current_titles_list)) master_month_list.append((current_titles_list, current_date)) | def add_to_master_month_list(current_titles_list): current_titles_list = " • ".join(current_titles_list) current_titles_list = self.generateShortDescription(self.formatNCXText(current_titles_list)) master_month_list.append((current_titles_list, current_date)) | 450,870 |
def add_to_master_month_list(current_titles_list): current_titles_list = " • ".join(current_titles_list) current_titles_list = self.generateShortDescription(self.formatNCXText(current_titles_list)) master_month_list.append((current_titles_list, current_date)) | def add_to_master_month_list(current_titles_list): current_titles_list = " • ".join(current_titles_list) current_titles_list = self.generateShortDescription(self.formatNCXText(current_titles_list)) master_month_list.append((current_titles_list, current_date)) | 450,871 |
def generateNCXByGenre(self, tocTitle): # Create an NCX section for 'By Genre' # Add each genre as an article # 'tag', 'file', 'authors' | def generateNCXByGenre(self, tocTitle): # Create an NCX section for 'By Genre' # Add each genre as an article # 'tag', 'file', 'authors' | 450,872 |
def writeNCX(self): self.opts.log.info(self.updateProgressFullStep("writeNCX()")) | def writeNCX(self): self.opts.log.info(self.updateProgressFullStep("writeNCX()")) | 450,873 |
def filterDbTags(self, tags): # Remove the special marker tags from the database's tag list, # return sorted list of tags representing valid genres | def filterDbTags(self, tags): # Remove the special marker tags from the database's tag list, # return sorted list of tags representing valid genres | 450,874 |
def updateProgressFullStep(self, description): | defupdateProgressFullStep(self,description): | 450,875 |
def updateProgressFullStep(self, description): | def updateProgressFullStep(self, description): | 450,876 |
def updateProgressMicroStep(self, description, micro_step_pct): step_range = 100/self.total_steps self.progressString = description coarse_progress = float((self.current_step-1)/self.total_steps) fine_progress = float((micro_step_pct*step_range)/100) self.progressInt = coarse_progress + fine_progress self.reporter(self... | def updateProgressMicroStep(self, description, micro_step_pct): step_range = 100/self.total_steps self.progressString = description coarse_progress = float((self.current_step-1)/self.total_steps) fine_progress = float((micro_step_pct*step_range)/100) self.progressInt = coarse_progress + fine_progress self.reporter(self... | 450,877 |
def run(self, path_to_output, opts, db, notification=DummyReporter()): | defrun(self,path_to_output,opts,db,notification=DummyReporter()): | 450,878 |
def run(self, path_to_output, opts, db, notification=DummyReporter()): | def run(self, path_to_output, opts, db, notification=DummyReporter()): | 450,879 |
def run(self, path_to_output, opts, db, notification=DummyReporter()): | def run(self, path_to_output, opts, db, notification=DummyReporter()): | 450,880 |
def run(self, path_to_output, opts, db, notification=DummyReporter()): | def run(self, path_to_output, opts, db, notification=DummyReporter()): | 450,881 |
def exists(self, path): path = os.path.join(self.rootdir, urlunquote(path)) return os.path.isfile(path) | def exists(self, path): try: path = os.path.join(self.rootdir, urlunquote(path)) except ValueError: return False return os.path.isfile(path) | 450,882 |
def test_bcd_windows(self, device_id, bcd): if bcd is None or len(bcd) == 0: return True for c in bcd: # Bug in winutil.get_usb_devices converts a to : rev = ('rev_%4.4x'%c).replace('a', ':') if rev in device_id: return True return False | def test_bcd_windows(self, device_id, bcd): if bcd is None or len(bcd) == 0: return True for c in bcd: # Bug in winutil.get_usb_devices converts a to :rev = 'rev_%4.4x'%c if rev in device_id or rev.replace('a', ':') in device_id: return True return False | 450,883 |
def start_fetch(self, url): soup = BeautifulSoup(u'<a href="'+url+'" />') self.log.debug('Downloading') res = self.process_links(soup, url, 0, into_dir='') self.log.debug('%s saved to %s'%( url, res)) return res | def start_fetch(self, url): soup = BeautifulSoup(u'<a href="'+url+'" />') self.log.debug('Downloading') res = self.process_links(soup, url, 0, into_dir='') self.log.debug(url, 'saved to', res) return res | 450,884 |
def process_stylesheets(self, soup, baseurl): diskpath = unicode_path(os.path.join(self.current_dir, 'stylesheets')) if not os.path.exists(diskpath): os.mkdir(diskpath) for c, tag in enumerate(soup.findAll(lambda tag: tag.name.lower()in ['link', 'style'] and tag.has_key('type') and tag['type'].lower() == 'text/css')): ... | def process_stylesheets(self, soup, baseurl): diskpath = unicode_path(os.path.join(self.current_dir, 'stylesheets')) if not os.path.exists(diskpath): os.mkdir(diskpath) for c, tag in enumerate(soup.findAll(lambda tag: tag.name.lower()in ['link', 'style'] and tag.has_key('type') and tag['type'].lower() == 'text/css')): ... | 450,885 |
def process_stylesheets(self, soup, baseurl): diskpath = unicode_path(os.path.join(self.current_dir, 'stylesheets')) if not os.path.exists(diskpath): os.mkdir(diskpath) for c, tag in enumerate(soup.findAll(lambda tag: tag.name.lower()in ['link', 'style'] and tag.has_key('type') and tag['type'].lower() == 'text/css')): ... | def process_stylesheets(self, soup, baseurl): diskpath = unicode_path(os.path.join(self.current_dir, 'stylesheets')) if not os.path.exists(diskpath): os.mkdir(diskpath) for c, tag in enumerate(soup.findAll(lambda tag: tag.name.lower()in ['link', 'style'] and tag.has_key('type') and tag['type'].lower() == 'text/css')): ... | 450,886 |
def process_images(self, soup, baseurl): diskpath = unicode_path(os.path.join(self.current_dir, 'images')) if not os.path.exists(diskpath): os.mkdir(diskpath) c = 0 for tag in soup.findAll(lambda tag: tag.name.lower()=='img' and tag.has_key('src')): iurl = tag['src'] if callable(self.image_url_processor): iurl = self.i... | def process_images(self, soup, baseurl): diskpath = unicode_path(os.path.join(self.current_dir, 'images')) if not os.path.exists(diskpath): os.mkdir(diskpath) c = 0 for tag in soup.findAll(lambda tag: tag.name.lower()=='img' and tag.has_key('src')): iurl = tag['src'] if callable(self.image_url_processor): iurl = self.i... | 450,887 |
def process_links(self, soup, baseurl, recursion_level, into_dir='links'): res = '' diskpath = os.path.join(self.current_dir, into_dir) if not os.path.exists(diskpath): os.mkdir(diskpath) prev_dir = self.current_dir try: self.current_dir = diskpath tags = list(soup.findAll('a', href=True)) | def process_links(self, soup, baseurl, recursion_level, into_dir='links'): res = '' diskpath = os.path.join(self.current_dir, into_dir) if not os.path.exists(diskpath): os.mkdir(diskpath) prev_dir = self.current_dir try: self.current_dir = diskpath tags = list(soup.findAll('a', href=True)) | 450,888 |
def cover_flow_do_sync(self): self.cover_flow_sync_flag = True try: if self.cover_flow.isVisible() and self.cf_last_updated_at is not None and \ time.time() - self.cf_last_updated_at > 0.5: self.cf_last_updated_at = None row = self.cover_flow.currentSlide() m = self.library_view.model() index = m.index(row, 0) if self.... | def cover_flow_do_sync(self): self.cover_flow_sync_flag = True try: if self.cover_flow.isVisible() and self.cf_last_updated_at is not None and \ time.time() - self.cf_last_updated_at > 0.5: self.cf_last_updated_at = None row = self.cover_flow.currentSlide() m = self.library_view.model() index = m.index(row, 0) if self.... | 450,889 |
def detect(aBuf): import calibre.ebooks.chardet.universaldetector as universaldetector u = universaldetector.UniversalDetector() u.reset() u.feed(aBuf) u.close() return u.result | def detect(aBuf): import calibre.ebooks.chardet.universaldetector as universaldetector u = universaldetector.UniversalDetector() u.reset() u.feed(aBuf) u.close() return u.result | 450,890 |
def books_deleted(self, job): ''' Called once deletion is done on the device ''' for view in (self.memory_view, self.card_a_view, self.card_b_view): view.model().deletion_done(job, job.failed) if job.failed: self.device_job_exception(job) return | def books_deleted(self, job): ''' Called once deletion is done on the device ''' for view in (self.memory_view, self.card_a_view, self.card_b_view): view.model().deletion_done(job, job.failed) if job.failed: self.device_job_exception(job) return | 450,891 |
def book_on_device(self, id, format=None, reset=False): ''' Return an indication of whether the given book represented by its db id is on the currently connected device. It returns a 5 element list. The first three elements represent memory locations main, carda, and cardb, and are true if the book is identifiably in t... | def book_on_device(self, id, reset=False): ''' Return an indication of whether the given book represented by its db id is on the currently connected device. It returns a 5 element list. The first three elements represent memory locations main, carda, and cardb, and are true if the book is identifiably in that memory. T... | 450,892 |
def book_on_device(self, id, format=None, reset=False): ''' Return an indication of whether the given book represented by its db id is on the currently connected device. It returns a 5 element list. The first three elements represent memory locations main, carda, and cardb, and are true if the book is identifiably in t... | def book_on_device(self, id, format=None, reset=False): ''' Return an indication of whether the given book represented by its db id is on the currently connected device. It returns a 5 element list. The first three elements represent memory locations main, carda, and cardb, and are true if the book is identifiably in t... | 450,893 |
def get_library_path(): library_path = prefs['library_path'] if library_path is None: # Need to migrate to new database layout base = os.path.expanduser('~') if iswindows: base = plugins['winutil'][0].special_folder_path( plugins['winutil'][0].CSIDL_PERSONAL) if not base or not os.path.exists(base): from PyQt4.Qt impor... | def get_default_library_path(): fname = _('Calibre Library') if isinstance(fname, unicode): try: fname = fname.encode(filesystem_encoding) except: fname = 'Calibre Library' x = os.path.expanduser('~'+os.sep+fname) if not os.path.exists(x): try: os.makedirs(x) except: x = os.path.expanduser('~') return x def get_libr... | 450,894 |
def get_library_path(): library_path = prefs['library_path'] if library_path is None: # Need to migrate to new database layout base = os.path.expanduser('~') if iswindows: base = plugins['winutil'][0].special_folder_path( plugins['winutil'][0].CSIDL_PERSONAL) if not base or not os.path.exists(base): from PyQt4.Qt impor... | def get_library_path(): library_path = prefs['library_path'] if library_path is None: # Need to migrate to new database layout base = os.path.expanduser('~') if iswindows: base = plugins['winutil'][0].special_folder_path( plugins['winutil'][0].CSIDL_PERSONAL) if not base or not os.path.exists(base): from PyQt4.Qt impor... | 450,895 |
def get_library_path(): library_path = prefs['library_path'] if library_path is None: # Need to migrate to new database layout base = os.path.expanduser('~') if iswindows: base = plugins['winutil'][0].special_folder_path( plugins['winutil'][0].CSIDL_PERSONAL) if not base or not os.path.exists(base): from PyQt4.Qt impor... | def get_library_path(): library_path = prefs['library_path'] if library_path is None: # Need to migrate to new database layout base = os.path.expanduser('~') if iswindows: base = plugins['winutil'][0].special_folder_path( plugins['winutil'][0].CSIDL_PERSONAL) if not base or not os.path.exists(base): from PyQt4.Qt impor... | 450,896 |
def initialize_db_stage2(self, db, tb): repair_pd = getattr(self, 'repair_pd', None) if repair_pd is not None: repair_pd.cancel() | def initialize_db_stage2(self, db, tb): repair_pd = getattr(self, 'repair_pd', None) if repair_pd is not None: repair_pd.cancel() | 450,897 |
def initialize_db_stage2(self, db, tb): repair_pd = getattr(self, 'repair_pd', None) if repair_pd is not None: repair_pd.cancel() | def initialize_db_stage2(self, db, tb): repair_pd = getattr(self, 'repair_pd', None) if repair_pd is not None: repair_pd.cancel() | 450,898 |
def initialize(self, *args): if gprefs.get('show_splash_screen', True): self.show_splash_screen() | def initialize(self, *args): if gprefs.get('show_splash_screen', True): self.show_splash_screen() | 450,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.