bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def setup_ui(self, parent): self.widgets = [QLabel('&'+self.col_metadata['name']+':', parent), QComboBox(parent)] w = self.widgets[1] items = [_('Yes'), _('No'), _('Undefined')] icons = [I('ok.png'), I('list_remove.png'), I('blank.png')] for icon, text in zip(icons, items): w.addItem(QIcon(icon), text) | def setup_ui(self, parent): self.widgets = [QLabel('&'+self.col_metadata['name']+':', parent), QComboBox(parent)] w = self.widgets[1] items = [_('Yes'), _('No'), _('Undefined'), _('Do not change')] icons = [I('ok.png'), I('list_remove.png'), I('blank.png'), I('blank.png')] for icon, text in zip(icons, items): w.addItem... | 451,800 |
def setter(self, val): val = {None: 2, False: 1, True: 0}[val] self.widgets[1].setCurrentIndex(val) | def getter(self): val = self.widgets[1].currentIndex() return {3: 'nochange', 2: None, 1: False, 0: True}[val] def setter(self, val): val = {'nochange': 3, None: 2, False: 1, True: 0}[val] self.widgets[1].setCurrentIndex(val) | 451,801 |
def commit(self, book_ids, notify=False): val = self.gui_val val = self.normalize_ui_val(val) if val != self.initial_val: if tweaks['bool_custom_columns_are_tristate'] == 'no' and val is None: val = False self.db.set_custom_bulk(book_ids, val, num=self.col_id, notify=notify) | def commit(self, book_ids, notify=False): val = self.gui_val val = self.normalize_ui_val(val) if val != self.initial_val and val != 'nochange': if tweaks['bool_custom_columns_are_tristate'] == 'no' and val is None: val = False self.db.set_custom_bulk(book_ids, val, num=self.col_id, notify=notify) | 451,802 |
def opts_and_words(name, op, words): opts = '|'.join(options(op)) words = '|'.join([w.replace("'", "\\'") for w in words]) return ('_'+name+'()'+\ | def opts_and_words(name, op, words): opts = '|'.join(options(op)) words = '|'.join([w.replace("'", "\\'") for w in words]) return ('_'+name+'()'+\ | 451,803 |
def opts_and_words(name, op, words): opts = '|'.join(options(op)) words = '|'.join([w.replace("'", "\\'") for w in words]) return ('_'+name+'()'+\ | def opts_and_words(name, op, words): opts = '|'.join(options(op)) words = '|'.join([w.replace("'", "\\'") for w in words]) return ('_'+name+'()'+\ | 451,804 |
def strftime(epoch, 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) | def strftime(epoch, zone=time.localtime): try: src = time.strftime("%w, %d %m %Y %H:%M:%S GMT", zone(epoch)).split() except: src = time.strftime("%w, %d %m %Y %H:%M:%S GMT", zone()).split() src[0] = INVERSE_DAY_MAP[int(src[0][:-1])]+',' src[2] = INVERSE_MONTH_MAP[int(src[2])] return ' '.join(src) | 451,805 |
def __eq__(self, other): return self.fsize == other.fsize \ and self.italic == other.italic \ and self.bold == other.bold \ and self.href == other.href \ and self.valign == other.valign \ and self.preserve == other.preserve \ and self.family == other.family \ and self.bgcolor == other.bgcolor \ and self.fgcolor == othe... | def __eq__(self, other): return self.fsize == other.fsize \ and self.italic == other.italic \ and self.bold == other.bold \ and self.href == other.href \ and self.valign == other.valign \ and self.preserve == other.preserve \ and self.family == other.family \ and self.bgcolor == other.bgcolor \ and self.fgcolor == othe... | 451,806 |
def dump(raw, where): import os dp = getattr(self.extra_opts, 'debug_pipeline', None) if dp and os.path.exists(dp): odir = os.path.join(dp, 'input') if os.path.exists(odir): odir = os.path.join(odir, where) if not os.path.exists(odir): os.makedirs(odir) name, i = None, 0 while not name or os.path.exists(os.path.join(od... | def dump(raw, where): import os dp = getattr(self.extra_opts, 'debug_pipeline', None) if dp and os.path.exists(dp): odir = os.path.join(dp, 'input') if os.path.exists(odir): odir = os.path.join(odir, where) if not os.path.exists(odir): os.makedirs(odir) name, i = None, 0 while not name or os.path.exists(os.path.join(od... | 451,807 |
def fetchBooksByTitle(self): self.updateProgressFullStep("Fetching database") | def fetchBooksByTitle(self): self.updateProgressFullStep("Fetching database") | 451,808 |
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'") | 451,809 |
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[] | 451,810 |
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[] | 451,811 |
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[] | 451,812 |
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[] | 451,813 |
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[] | 451,814 |
def generateHTMLByTags(self): # Generate individual HTML files for each tag, e.g. Fiction, Nonfiction ... # Note that special tags - ~+*[] - have already been filtered from books[] | defgenerateHTMLByTags(self):#GenerateindividualHTMLfilesforeachtag,e.g.Fiction,Nonfiction...#Notethatspecialtags-~+*[]-havealreadybeenfilteredfrombooks[] | 451,815 |
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[] | 451,816 |
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' | 451,817 |
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' | 451,818 |
def generateNCXByGenre(self, tocTitle): # Create an NCX section for 'By Genre' # Add each genre as an article # 'tag', 'file', 'authors' | defgenerateNCXByGenre(self,tocTitle):#CreateanNCXsectionfor'ByGenre'#Addeachgenreasanarticle#'tag','file','authors' | 451,819 |
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' | 451,820 |
def generateNCXByGenre(self, tocTitle): # Create an NCX section for 'By Genre' # Add each genre as an article # 'tag', 'file', 'authors' | defgenerateNCXByGenre(self,tocTitle):#CreateanNCXsectionfor'ByGenre'#Addeachgenreasanarticle#'tag','file','authors' | 451,821 |
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' | 451,822 |
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 | 451,823 |
def next_tag(tags): for (i, tag) in enumerate(tags): if i < len(tags) - 1: yield tag + ", " else: yield tag | def next_tag(tags): for (i, tag) in enumerate(tags): if i < len(tags) - 1: yield tag + ", " else: yield tag | 451,824 |
def next_tag(tags): for (i, tag) in enumerate(tags): if i < len(tags) - 1: yield tag + ", " else: yield tag | def next_tag(tags): for (i, tag) in enumerate(tags): if i < len(tags) - 1: yield tag + ", " else: yield tag | 451,825 |
def generateHTMLByGenre(self, genre, section_head, books, outfile): # Write an HTML file of this genre's book list # Return a list with [(first_author, first_book), (last_author, last_book)] | def generateHTMLByGenre(self, genre, section_head, books, outfile): # Write an HTML file of this genre's book list # Return a list with [(first_author, first_book), (last_author, last_book)] | 451,826 |
def generateHTMLByGenre(self, genre, section_head, books, outfile): # Write an HTML file of this genre's book list # Return a list with [(first_author, first_book), (last_author, last_book)] | def generateHTMLByGenre(self, genre, section_head, books, outfile): # Write an HTML file of this genre's book list # Return a list with [(first_author, first_book), (last_author, last_book)] | 451,827 |
def generateHTMLByGenre(self, genre, section_head, books, outfile): # Write an HTML file of this genre's book list # Return a list with [(first_author, first_book), (last_author, last_book)] | def for genre_tag in self.genre_tags_dict: if self.genre_tags_dict[genre_tag] == genre: friendly_tag = genre_tag break generateHTMLByGenre(self, for genre_tag in self.genre_tags_dict: if self.genre_tags_dict[genre_tag] == genre: friendly_tag = genre_tag break genre, for genre_tag in self.genre_tags_dict: if self... | 451,828 |
def generateHTMLByGenre(self, genre, section_head, books, outfile): # Write an HTML file of this genre's book list # Return a list with [(first_author, first_book), (last_author, last_book)] | def generateHTMLByGenre(self, genre, section_head, books, outfile): # Write an HTML file of this genre's book list # Return a list with [(first_author, first_book), (last_author, last_book)] | 451,829 |
def is_case_sensitive(self, path): if self._is_case_sensitive is not None: return self._is_case_sensitive if not path or not os.path.exists(path): return islinux or isfreebsd self._is_case_sensitive = os.path.exists(path.lower()) \ and os.path.exists(path.upper()) return self._is_case_sensitive | def is_case_sensitive(self, path): if getattr(self, '_is_case_sensitive', None) is not None: return self._is_case_sensitive if not path or not os.path.exists(path): return islinux or isfreebsd self._is_case_sensitive = os.path.exists(path.lower()) \ and os.path.exists(path.upper()) return self._is_case_sensitive | 451,830 |
def update(self, booklists, collections_attributes): debug_print('Starting update', collections_attributes) for i, booklist in booklists.items(): playlist_map = self.build_id_playlist_map(i) debug_print('Updating XML Cache:', i) root = self.record_roots[i] lpath_map = self.build_lpath_map(root) gtz_count = ltz_count = ... | def update(self, booklists, collections_attributes): debug_print('Starting update', collections_attributes) for i, booklist in booklists.items(): playlist_map = self.build_id_playlist_map(i) debug_print('Updating XML Cache:', i) root = self.record_roots[i] lpath_map = self.build_lpath_map(root) gtz_count = ltz_count = ... | 451,831 |
def update(self, booklists, collections_attributes): debug_print('Starting update', collections_attributes) for i, booklist in booklists.items(): playlist_map = self.build_id_playlist_map(i) debug_print('Updating XML Cache:', i) root = self.record_roots[i] lpath_map = self.build_lpath_map(root) gtz_count = ltz_count = ... | def update(self, booklists, collections_attributes): debug_print('Starting update', collections_attributes) for i, booklist in booklists.items(): playlist_map = self.build_id_playlist_map(i) debug_print('Updating XML Cache:', i) root = self.record_roots[i] lpath_map = self.build_lpath_map(root) gtz_count = ltz_count = ... | 451,832 |
def update_text_record(self, record, book, path, bl_index, gtz_count, ltz_count): ''' Update the Sony database from the book. This is done if the timestamp in the db differs from the timestamp on the file. ''' | def update_text_record(self, record, book, path, bl_index, gtz_count, ltz_count, use_tz_var): ''' Update the Sony database from the book. This is done if the timestamp in the db differs from the timestamp on the file. ''' | 451,833 |
def update_text_record(self, record, book, path, bl_index, gtz_count, ltz_count): ''' Update the Sony database from the book. This is done if the timestamp in the db differs from the timestamp on the file. ''' | def update_text_record(self, record, book, path, bl_index, gtz_count, ltz_count): ''' Update the Sony database from the book. This is done if the timestamp in the db differs from the timestamp on the file. ''' | 451,834 |
def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | 451,835 |
def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | 451,836 |
def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | 451,837 |
def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | 451,838 |
def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | defclean(x):ifisbytestring(x):x=x.decode(preferred_encoding,'replace')x.replace(u'\0','')returnx | 451,839 |
def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | def clean(x): if isbytestring(x): x = x.decode(preferred_encoding, 'replace') x.replace(u'\0', '') return x | 451,840 |
def validate(self): tmpl = preprocess_template(self.opt_template.text()) fa = {} for x in FORMAT_ARG_DESCS.keys(): fa[x]='' try: tmpl.format(**fa) except Exception, err: error_dialog(self, _('Invalid template'), '<p>'+_('The template %s is invalid:')%tmpl + \ '<br>'+str(err), show=True) return False return True | def validate(self): tmpl = preprocess_template(self.opt_template.text()) fa = {} for x in FORMAT_ARG_DESCS.keys(): fa[x]='random long string' try: tmpl.format(**fa) except Exception, err: error_dialog(self, _('Invalid template'), '<p>'+_('The template %s is invalid:')%tmpl + \ '<br>'+str(err), show=True) return False r... | 451,841 |
def __init__(self, parent, items): QDialog.__init__(self, parent) Ui_DeleteMatchingFromDeviceDialog.__init__(self) self.setupUi(self) | def __init__(self, parent, items): QDialog.__init__(self, parent) Ui_DeleteMatchingFromDeviceDialog.__init__(self) self.setupUi(self) | 451,842 |
def __init__(self, parent, items): QDialog.__init__(self, parent) Ui_DeleteMatchingFromDeviceDialog.__init__(self) self.setupUi(self) | def __init__(self, parent, items): QDialog.__init__(self, parent) Ui_DeleteMatchingFromDeviceDialog.__init__(self) self.setupUi(self) | 451,843 |
def __init__(self, parent, items): QDialog.__init__(self, parent) Ui_DeleteMatchingFromDeviceDialog.__init__(self) self.setupUi(self) | def __init__(self, parent, items): QDialog.__init__(self, parent) Ui_DeleteMatchingFromDeviceDialog.__init__(self) self.setupUi(self) | 451,844 |
def sanitize_sort_field_name(self, field): field = field.lower().strip() if field not in self.field_metadata.iterkeys(): if field in ('author', 'tag', 'comment'): field += 's' if field == 'date': field = 'timestamp' elif field == 'title': field = 'sort' elif field == 'authors': field = 'author_sort' return field | def sanitize_sort_field_name(self, field): field = field.lower().strip() if field not in self.field_metadata.iterkeys(): if field in ('author', 'tag', 'comment'): field += 's' if field == 'date': field = 'timestamp' elif field == 'title': field = 'sort' elif field == 'authors': field = 'author_sort' return field | 451,845 |
def run(self, path_to_output, opts, db, notification=DummyReporter()): self.fmt = path_to_output.rpartition('.')[2] self.notification = notification | def run(self, path_to_output, opts, db, notification=DummyReporter()): self.fmt = path_to_output.rpartition('.')[2] self.notification = notification | 451,846 |
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' | 451,847 |
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' | 451,848 |
def cleanup_title(s): if s is None: s = _('Unknown') s = s.strip().lower() s = prefix_pat.sub(' ', s) s = trailing_paren_pat.sub('', s) s = whitespace_pat.sub(' ', s) return s.strip() | def cleanup_title(s): if s is None: s = _('Unknown') s = s.strip().lower() s = prefix_pat.sub(' ', s) s = trailing_paren_pat.sub('', s) s = whitespace_pat.sub(' ', s) return s.strip() | 451,849 |
def generate_calibredb_help(preamble, info): from calibre.library.cli import COMMANDS, get_parser import calibre.library.cli as cli preamble = preamble[:preamble.find('\n\n\n', preamble.find('code-block'))] preamble += textwrap.dedent(''' :command:`calibredb` is the command line interface to the |app| database. It has... | def generate_calibredb_help(preamble, info): from calibre.library.cli import COMMANDS, get_parser import calibre.library.cli as cli preamble = preamble[:preamble.find('\n\n\n', preamble.find('code-block'))] preamble += textwrap.dedent(''' :command:`calibredb` is the command line interface to the |app| database. It has... | 451,850 |
def setData(self, index, value, role=Qt.EditRole): if not index.isValid(): return NONE # set up to position at the category label path = self.path_for_index(self.parent(index)) val = unicode(value.toString()) if not val: error_dialog(self.tags_view, _('Item is blank'), _('An item cannot be set to nothing. Delete it ins... | def setData(self, index, value, role=Qt.EditRole): if not index.isValid(): return NONE # set up to position at the category label path = self.path_for_index(self.parent(index)) val = unicode(value.toString()) if not val: error_dialog(self.tags_view, _('Item is blank'), _('An item cannot be set to nothing. Delete it ins... | 451,851 |
def setData(self, index, value, role=Qt.EditRole): if not index.isValid(): return NONE # set up to position at the category label path = self.path_for_index(self.parent(index)) val = unicode(value.toString()) if not val: error_dialog(self.tags_view, _('Item is blank'), _('An item cannot be set to nothing. Delete it ins... | def setData(self, index, value, role=Qt.EditRole): if not index.isValid(): return NONE # set up to position at the category label path = self.path_for_index(self.parent(index)) val = unicode(value.toString()) if not val: error_dialog(self.tags_view, _('Item is blank'), _('An item cannot be set to nothing. Delete it ins... | 451,852 |
def __init__(self, db): self.library_view.model().count_changed_signal.connect(self.tags_view.recount) self.tags_view.set_database(self.library_view.model().db, self.tag_match, self.sort_by) self.tags_view.tags_marked.connect(self.search.search_from_tags) self.tags_view.tags_marked.connect(self.saved_search.clear_to_he... | def __init__(self, db): self.library_view.model().count_changed_signal.connect(self.tags_view.recount) self.tags_view.set_database(self.library_view.model().db, self.tag_match, self.sort_by) self.tags_view.tags_marked.connect(self.search.search_from_tags) self.tags_view.tags_marked.connect(self.saved_search.clear_to_he... | 451,853 |
def dump_text(self, elem, stylizer, page, tag_stack=[]): if not isinstance(elem.tag, basestring) \ or namespace(elem.tag) != XHTML_NS: return [] | def dump_text(self, elem, stylizer, page, tag_stack=[]): if not isinstance(elem.tag, basestring) \ or namespace(elem.tag) != XHTML_NS: return [] | 451,854 |
def get_value(self, key, args, mi): from calibre.library.save_to_disk import explode_string_template_value try: prefix, key, suffix = explode_string_template_value(key) ign, v = mi.format_field(key, series_with_index=False) if v is None: return '' if v == '': return '' return prefix + unicode(v) + suffix except: return... | def get_value(self, key, args, mi): from calibre.library.save_to_disk import explode_string_template_value try: prefix, key, suffix = explode_string_template_value(key) ign, v = mi.format_field(key, series_with_index=False) if v is None: return '' if v == '': return '' return prefix + v + suffix except: return key | 451,855 |
def format_field_extended(self, key, series_with_index=True): from calibre.ebooks.metadata import authors_to_string ''' returns the tuple (field_name, formatted_value) ''' if key in self.user_metadata_keys(): res = self.get(key, None) cmeta = self.get_user_metadata(key, make_copy=False) if cmeta['datatype'] != 'composi... | def format_field_extended(self, key, series_with_index=True): from calibre.ebooks.metadata import authors_to_string ''' returns the tuple (field_name, formatted_value) ''' if key in self.user_metadata_keys(): res = self.get(key, None) cmeta = self.get_user_metadata(key, make_copy=False) if cmeta['datatype'] != 'composi... | 451,856 |
def format_field_extended(self, key, series_with_index=True): from calibre.ebooks.metadata import authors_to_string ''' returns the tuple (field_name, formatted_value) ''' if key in self.user_metadata_keys(): res = self.get(key, None) cmeta = self.get_user_metadata(key, make_copy=False) if cmeta['datatype'] != 'composi... | def format_field_extended(self, key, series_with_index=True): from calibre.ebooks.metadata import authors_to_string ''' returns the tuple (field_name, formatted_value) ''' if key in self.user_metadata_keys(): res = self.get(key, None) cmeta = self.get_user_metadata(key, make_copy=False) if cmeta['datatype'] != 'composi... | 451,857 |
def write_mimetypes(f): for x in all_input_formats(): mt = guess_type('dummy.'+x)[0] if mt: f.write('MimeType=%s;\n'%mt) | def write_mimetypes(f): for x in all_input_formats(): mt = guess_type('dummy.'+x)[0] if mt: f.write('MimeType=%s;\n'%mt) | 451,858 |
def opts_and_exts(name, op, exts): opts = ' '.join(options(op)) exts.extend([i.upper() for i in exts]) exts='|'.join(exts) fname = name.replace('-', '_') return '_'+fname+'()'+\ | def opts_and_exts(name, op, exts): opts = ' '.join(options(op)) exts.extend([i.upper() for i in exts]) exts='|'.join(exts) fname = name.replace('-', '_') return '_'+fname+'()'+\ | 451,859 |
def opts_and_exts(name, op, exts): opts = ' '.join(options(op)) exts.extend([i.upper() for i in exts]) exts='|'.join(exts) fname = name.replace('-', '_') return '_'+fname+'()'+\ | def opts_and_exts(name, op, exts): opts = ' '.join(options(op)) exts.extend([i.upper() for i in exts]) exts='|'.join(exts) fname = name.replace('-', '_') return '_'+fname+'()'+\ | 451,860 |
def browse_get_book_args(self, mi, id_): fmts = self.db.formats(id_, index_is_id=True) if not fmts: fmts = '' fmts = [x.lower() for x in fmts.split(',') if x] pf = prefs['output_format'].lower() fmt = pf if pf in fmts else fmts[0] args = {'id':id_, 'mi':mi, } for key in mi.all_field_keys(): val = mi.format_field(key)[1... | def browse_get_book_args(self, mi, id_): fmts = self.db.formats(id_, index_is_id=True) if not fmts: fmts = '' fmts = [x.lower() for x in fmts.split(',') if x] pf = prefs['output_format'].lower() try: fmt = pf if pf in fmts else fmts[0] except: fmt = None args = {'id':id_, 'mi':mi, } for key in mi.all_field_keys(): val ... | 451,861 |
def browse_booklist_page(self, ids=None, sort=None): if sort == 'null': sort = None if ids is None: ids = json.dumps('[]') try: ids = json.loads(ids) except: raise cherrypy.HTTPError(404, 'invalid ids') summs = [] for id_ in ids: try: id_ = int(id_) mi = self.db.get_metadata(id_, index_is_id=True) except: continue args... | def browse_booklist_page(self, ids=None, sort=None): if sort == 'null': sort = None if ids is None: ids = json.dumps('[]') try: ids = json.loads(ids) except: raise cherrypy.HTTPError(404, 'invalid ids') summs = [] for id_ in ids: try: id_ = int(id_) mi = self.db.get_metadata(id_, index_is_id=True) except: continue args... | 451,862 |
def browse_booklist_page(self, ids=None, sort=None): if sort == 'null': sort = None if ids is None: ids = json.dumps('[]') try: ids = json.loads(ids) except: raise cherrypy.HTTPError(404, 'invalid ids') summs = [] for id_ in ids: try: id_ = int(id_) mi = self.db.get_metadata(id_, index_is_id=True) except: continue args... | def browse_booklist_page(self, ids=None, sort=None): if sort == 'null': sort = None if ids is None: ids = json.dumps('[]') try: ids = json.loads(ids) except: raise cherrypy.HTTPError(404, 'invalid ids') summs = [] for id_ in ids: try: id_ = int(id_) mi = self.db.get_metadata(id_, index_is_id=True) except: continue args... | 451,863 |
def browse_booklist_page(self, ids=None, sort=None): if sort == 'null': sort = None if ids is None: ids = json.dumps('[]') try: ids = json.loads(ids) except: raise cherrypy.HTTPError(404, 'invalid ids') summs = [] for id_ in ids: try: id_ = int(id_) mi = self.db.get_metadata(id_, index_is_id=True) except: continue args... | def browse_booklist_page(self, ids=None, sort=None): if sort == 'null': sort = None if ids is None: ids = json.dumps('[]') try: ids = json.loads(ids) except: raise cherrypy.HTTPError(404, 'invalid ids') summs = [] for id_ in ids: try: id_ = int(id_) mi = self.db.get_metadata(id_, index_is_id=True) except: continue args... | 451,864 |
def generateNCXByDateAdded(self, tocTitle): | def generateNCXByDateAdded(self, tocTitle): | 451,865 |
def set_device_connected(self, is_connected): self.device_connected = is_connected self.db.refresh_ondevice() self.refresh() self.research() if is_connected and self.sorted_on[0] == 'ondevice': self.resort() | def set_device_connected(self, is_connected): self.device_connected = is_connected self.db.refresh_ondevice() self.refresh() self.research() if is_connected and self.sorted_on[0] == 'ondevice': self.resort() | 451,866 |
def set_device_connected(self, is_connected): self.device_connected = is_connected self.db.refresh_ondevice() self.refresh() self.research() if is_connected and self.sorted_on[0] == 'ondevice': self.resort() | def set_device_connected(self, is_connected): self.device_connected = is_connected self.db.refresh_ondevice() self.refresh() self.research() if is_connected and self.sorted_on[0] == 'ondevice': self.resort() | 451,867 |
def sort(self, col, order, reset=True): if not self.db: return self.about_to_be_sorted.emit(self.db.id) ascending = order == Qt.AscendingOrder label = self.column_map[col] self.db.sort(label, ascending) if reset: self.clear_caches() self.reset() self.sorted_on = (label, order) self.sort_history.insert(0, self.sorted_on... | def sort(self, col, order, reset=True, update_history=True): if not self.db: return self.about_to_be_sorted.emit(self.db.id) ascending = order == Qt.AscendingOrder label = self.column_map[col] self.db.sort(label, ascending) if reset: self.clear_caches() self.reset() self.sorted_on = (label, order) self.sort_history.ins... | 451,868 |
def sort(self, col, order, reset=True): if not self.db: return self.about_to_be_sorted.emit(self.db.id) ascending = order == Qt.AscendingOrder label = self.column_map[col] self.db.sort(label, ascending) if reset: self.clear_caches() self.reset() self.sorted_on = (label, order) self.sort_history.insert(0, self.sorted_on... | def sort(self, col, order, reset=True): if not self.db: return self.about_to_be_sorted.emit(self.db.id) ascending = order == Qt.AscendingOrder label = self.column_map[col] self.db.sort(label, ascending) if reset: self.clear_caches() self.reset() self.sorted_on = (label, order) if update_history: self.sort_history.inser... | 451,869 |
def refresh(self, reset=True): try: col = self.column_map.index(self.sorted_on[0]) except: col = 0 self.db.refresh(field=None) self.sort(col, self.sorted_on[1], reset=reset) | def refresh(self, reset=True): self.db.refresh(field=None) self.sort(col, self.sorted_on[1], reset=reset) | 451,870 |
def refresh(self, reset=True): try: col = self.column_map.index(self.sorted_on[0]) except: col = 0 self.db.refresh(field=None) self.sort(col, self.sorted_on[1], reset=reset) | def refresh(self, reset=True): try: col = self.column_map.index(self.sorted_on[0]) except: col = 0 self.db.refresh(field=None) self.sort(col, self.sorted_on[1], reset=reset) | 451,871 |
def update_booklist(mountpath, 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(os.sep):] ... | def update_booklist(mountpath, 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(os.sep):] ... | 451,872 |
def sendmail(msg, from_, to, localhost=None, verbose=0, timeout=30, relay=None, username=None, password=None, encryption='TLS', port=-1): if relay is None: for x in to: return sendmail_direct(from_, x, msg, timeout, localhost, verbose) import smtplib class SMTP_SSL(smtplib.SMTP_SSL): # Workaround for bug in smtplib.py ... | def sendmail(msg, from_, to, localhost=None, verbose=0, timeout=30, relay=None, username=None, password=None, encryption='TLS', port=-1): if relay is None: for x in to: return sendmail_direct(from_, x, msg, timeout, localhost, verbose) import smtplib class SMTP_SSL(smtplib.SMTP_SSL): # Workaround for bug in smtplib.py ... | 451,873 |
def __init__(self, parent): QWizard.__init__(self, parent) self.setWindowTitle(__appname__+' '+_('welcome wizard')) p = QPixmap() p.loadFromData(open(P('content_server/calibre.png'), 'rb').read()) self.setPixmap(self.LogoPixmap, p.scaledToHeight(80, Qt.SmoothTransformation)) self.setPixmap(self.WatermarkPixmap, QPixma... | def __init__(self, parent): QWizard.__init__(self, parent) self.setWindowTitle(__appname__+' '+_('welcome wizard')) p = QPixmap() p.loadFromData(open(P('content_server/calibre.png'), 'rb').read()) self.setPixmap(self.LogoPixmap, p.scaledToHeight(80, Qt.SmoothTransformation)) self.setPixmap(self.WatermarkPixmap, QPixma... | 451,874 |
def setData(self, index, value, role): if role == Qt.EditRole: row, col = index.row(), index.column() column = self.column_map[col] if self.is_custom_column(column): if not self.set_custom_column_data(row, column, value): return False else: if column not in self.editable_cols: return False val = int(value.toInt()[0]) i... | def setData(self, index, value, role): if role == Qt.EditRole: row, col = index.row(), index.column() column = self.column_map[col] if self.is_custom_column(column): if not self.set_custom_column_data(row, column, value): return False else: if column not in self.editable_cols: return False val = int(value.toInt()[0]) i... | 451,875 |
def catalog_generated(self, job): if job.failed: return self.job_exception(job) id = self.library_view.model().add_catalog(job.catalog_file_path, job.catalog_title) self.library_view.model().reset() if job.catalog_sync: sync = dynamic.get('catalogs_to_be_synced', set([])) sync.add(id) dynamic.set('catalogs_to_be_synced... | def catalog_generated(self, job): if job.failed: return self.job_exception(job) id = self.library_view.model().add_catalog(job.catalog_file_path, job.catalog_title) self.library_view.model().reset() if job.catalog_sync: sync = dynamic.get('catalogs_to_be_synced', set([])) sync.add(id) dynamic.set('catalogs_to_be_synced... | 451,876 |
def __init__(self, window, row, db, accepted_callback=None, cancel_all=False): ResizableDialog.__init__(self, window) self.bc_box.layout().setAlignment(self.cover, Qt.AlignCenter|Qt.AlignHCenter) self.cancel_all = False if cancel_all: self.__abort_button = self.button_box.addButton(self.button_box.Abort) self.__abort_b... | def __init__(self, window, row, db, accepted_callback=None, cancel_all=False): ResizableDialog.__init__(self, window) self.bc_box.layout().setAlignment(self.cover, Qt.AlignCenter|Qt.AlignHCenter) self.cancel_all = False if cancel_all: self.__abort_button = self.button_box.addButton(self.button_box.Abort) self.__abort_b... | 451,877 |
def __init__(self): md = QMenu() md.addAction(_('Edit metadata individually'), partial(self.edit_metadata, False)) md.addSeparator() md.addAction(_('Edit metadata in bulk'), partial(self.edit_metadata, False, bulk=True)) md.addSeparator() md.addAction(_('Download metadata and covers'), partial(self.download_metadata, F... | def __init__(self): md = QMenu() md.addAction(_('Edit metadata individually'), partial(self.edit_metadata, False, bulk=False)) md.addSeparator() md.addAction(_('Edit metadata in bulk'), partial(self.edit_metadata, False, bulk=True)) md.addSeparator() md.addAction(_('Download metadata and covers'), partial(self.download... | 451,878 |
def mlize(self): output = [ u'' ] stylizer = Stylizer(self.item.data, self.item.href, self.oeb_book, self.opts, self.opts.output_profile) content = unicode(etree.tostring(self.item.data.find(XHTML('body')), encoding=unicode)) | def mlize(self): output = [ u'' ] stylizer = Stylizer(self.item.data, self.item.href, self.oeb_book, self.opts, self.opts.output_profile) content = unicode(etree.tostring(self.item.data.find(XHTML('body')), encoding=unicode)) | 451,879 |
def mlize(self): output = [ u'' ] stylizer = Stylizer(self.item.data, self.item.href, self.oeb_book, self.opts, self.opts.output_profile) content = unicode(etree.tostring(self.item.data.find(XHTML('body')), encoding=unicode)) | def mlize(self): output = [ u'' ] stylizer = Stylizer(self.item.data, self.item.href, self.oeb_book, self.opts, self.opts.output_profile) content = unicode(etree.tostring(self.item.data.find(XHTML('body')), encoding=unicode)) | 451,880 |
def __init__(self, in_file, bug_handler, copy = None, #run_level = 1, | defrun_level = 1, __init__(self,run_level = 1, in_file,run_level = 1, bug_handler,run_level = 1, copyrun_level = 1, =run_level = 1, None,run_level = 1, #run_levelrun_level = 1, =run_level = 1, 1, | 451,881 |
def __init__(self, in_file, bug_handler, copy = None, #run_level = 1, | def __init__(self, in_file, bug_handler, copy = None, #run_level = 1, | 451,882 |
def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | 451,883 |
def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | defself.__uc_value.pop() __unicode_process(self,self.__uc_value.pop() token):self.__uc_value.pop() #changeself.__uc_value.pop() scopeself.__uc_value.pop() inself.__uc_value.pop() ifself.__uc_value.pop() tokenself.__uc_value.pop() ==self.__uc_value.pop() '\{':self.__uc_value.pop() self.__uc_value.append(self.__uc_value[... | 451,884 |
def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | def elif self.__uc_bin: self.__uc_bin = False return '' __unicode_process(self, elif self.__uc_bin: self.__uc_bin = False return '' token): elif self.__uc_bin: self.__uc_bin = False return '' #change elif self.__uc_bin: self.__uc_bin = False return '' scope elif self.__uc_bin: self.__uc_bin = False return '' in el... | 451,885 |
def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | 451,886 |
def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | 451,887 |
def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | 451,888 |
def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | 451,889 |
def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | def __unicode_process(self, token): #change scope in if token == '\{': self.__uc_value.append(self.__uc_value[-1]) #basic error handling self.__reini_utf8_counters() return token #change scope out: evaluate dict and rebuild elif token == '\}': #self.__uc_value.pop() self.__reini_utf8_counters() return token #add a uc c... | 451,890 |
def __sub_reg_split(self,input_file): input_file = self.__replace_spchar.mreplace(input_file) #input_file = re.sub(self.__utf_exp, self.__from_ms_to_utf8, input_file) # line = re.sub( self.__neg_utf_exp, self.__neg_unicode_func, line) # this is for older RTF #line = re.sub(self.__par_exp, '\\par ', line) input_file = r... | def __sub_reg_split(self,input_file): input_file = self.__replace_spchar.mreplace(input_file) #input_file = re.sub(self.__utf_exp, self.__from_ms_to_utf8, input_file) # line = re.sub( self.__neg_utf_exp, self.__neg_unicode_func, line) # this is for older RTF #line = re.sub(self.__par_exp, '\\par ', line) input_file = r... | 451,891 |
def __sub_reg_split(self,input_file): input_file = self.__replace_spchar.mreplace(input_file) #input_file = re.sub(self.__utf_exp, self.__from_ms_to_utf8, input_file) # line = re.sub( self.__neg_utf_exp, self.__neg_unicode_func, line) # this is for older RTF #line = re.sub(self.__par_exp, '\\par ', line) input_file = r... | def __sub_reg_split(self,input_file): input_file = self.__replace_spchar.mreplace(input_file) #input_file = re.sub(self.__utf_exp, self.__from_ms_to_utf8, input_file) # line = re.sub( self.__neg_utf_exp, self.__neg_unicode_func, line) # this is for older RTF #line = re.sub(self.__par_exp, '\\par ', line) input_file = r... | 451,892 |
def __compile_expressions(self): SIMPLE_RPL = { "\\\\": "\\backslash ", "\\~": "\\~ ", "\\;": "\\; ", "&": "&", "<": "<", ">": ">", "\\~": "\\~ ", "\\_": "\\_ ", "\\:": "\\: ", "\\-": "\\- ", # turn into a generic token to eliminate special # cases and make processing easier "\\{": "\\ob ", # turn into a gene... | def __compile_expressions(self): SIMPLE_RPL = { "\\\\": "\\backslash ", "\\~": "\\~ ", "\\;": "\\; ", "&": "&", "<": "<", ">": ">", "\\~": "\\~ ", "\\_": "\\_ ", "\\:": "\\: ", "\\-": "\\- ", # turn into a generic token to eliminate special # cases and make processing easier "\\{": "\\ob ", # turn into a gene... | 451,893 |
def __compile_expressions(self): SIMPLE_RPL = { "\\\\": "\\backslash ", "\\~": "\\~ ", "\\;": "\\; ", "&": "&", "<": "<", ">": ">", "\\~": "\\~ ", "\\_": "\\_ ", "\\:": "\\: ", "\\-": "\\- ", # turn into a generic token to eliminate special # cases and make processing easier "\\{": "\\ob ", # turn into a gene... | def__compile_expressions(self):SIMPLE_RPL={"\\\\":"\\backslash","\\~":"\\~","\\;":"\\;","&":"&","<":"<",">":">","\\~":"\\~","\\_":"\\_","\\:":"\\:","\\-":"\\-",#turnintoagenerictokentoeliminatespecial#casesandmakeprocessingeasier"\\{":"\\ob",#turnintoagenerictokentoeliminatespecial#casesandmakeprocessingeasie... | 451,894 |
def __compile_expressions(self): SIMPLE_RPL = { "\\\\": "\\backslash ", "\\~": "\\~ ", "\\;": "\\; ", "&": "&", "<": "<", ">": ">", "\\~": "\\~ ", "\\_": "\\_ ", "\\:": "\\: ", "\\-": "\\- ", # turn into a generic token to eliminate special # cases and make processing easier "\\{": "\\ob ", # turn into a gene... | def __compile_expressions(self): SIMPLE_RPL = { "\\\\": "\\backslash ", "\\~": "\\~ ", "\\;": "\\; ", "&": "&", "<": "<", ">": ">", "\\~": "\\~ ", "\\_": "\\_ ", "\\:": "\\: ", "\\-": "\\- ", # turn into a generic token to eliminate special # cases and make processing easier "\\{": "\\ob ", # turn into a gene... | 451,895 |
def __compile_expressions(self): SIMPLE_RPL = { "\\\\": "\\backslash ", "\\~": "\\~ ", "\\;": "\\; ", "&": "&", "<": "<", ">": ">", "\\~": "\\~ ", "\\_": "\\_ ", "\\:": "\\: ", "\\-": "\\- ", # turn into a generic token to eliminate special # cases and make processing easier "\\{": "\\ob ", # turn into a gene... | def __compile_expressions(self): SIMPLE_RPL = { "\\\\": "\\backslash ", "\\~": "\\~ ", "\\;": "\\; ", "&": "&", "<": "<", ">": ">", "\\~": "\\~ ", "\\_": "\\_ ", "\\:": "\\: ", "\\-": "\\- ", # turn into a generic token to eliminate special # cases and make processing easier "\\{": "\\ob ", # turn into a gene... | 451,896 |
def _generate_index(self): self._oeb.log('Generating INDX ...') self._primary_index_record = None | def _generate_index(self): self._oeb.log('Generating INDX ...') self._primary_index_record = None | 451,897 |
def _clean_text_value(self, text): if text is not None and text.strip() : text = text.strip() if not isinstance(text, unicode): text = text.decode('utf-8', 'replace') text = text.encode('utf-8') else : text = "(none)".encode('utf-8') return text | def _clean_text_value(self, text): if text is not None and text.strip() : text = text.strip() if not isinstance(text, unicode): text = text.decode('utf-8', 'replace') text = text.encode('cp1252','replace') else : text = "(none)".encode('utf-8') return text | 451,898 |
def _clean_text_value(self, text): if text is not None and text.strip() : text = text.strip() if not isinstance(text, unicode): text = text.decode('utf-8', 'replace') text = text.encode('utf-8') else : text = "(none)".encode('utf-8') return text | def _clean_text_value(self, text): if text is not None and text.strip() : text = text.strip() if not isinstance(text, unicode): text = text.decode('utf-8', 'replace') text = text.encode('utf-8') else : text = text.encode('cp1252') return text | 451,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.