diff --git a/recipes/atlantic.recipe b/recipes/atlantic.recipe index a8a0d7565b..51b5fda9b5 100644 --- a/recipes/atlantic.recipe +++ b/recipes/atlantic.recipe @@ -12,7 +12,7 @@ test_article = None # test_article = 'https://www.theatlantic.com/health/archive/2020/12/covid-19-second-surge/617415/?utm_source=feed' -# {{{ parse article JSON +# parse article JSON {{{ def process_image_block(lines, block): caption = block.get('captionText') caption_lines = [] diff --git a/recipes/atlantic_com.recipe b/recipes/atlantic_com.recipe index f8a96645bc..496ef3277a 100644 --- a/recipes/atlantic_com.recipe +++ b/recipes/atlantic_com.recipe @@ -12,7 +12,7 @@ test_article = None # test_article = 'https://www.theatlantic.com/health/archive/2020/12/covid-19-second-surge/617415/?utm_source=feed' -# {{{ parse article JSON +# parse article JSON {{{ def process_image_block(lines, block): caption = block.get('captionText') caption_lines = [] diff --git a/recipes/reason_magazine.recipe b/recipes/reason_magazine.recipe index e419dfb9fd..d7d8920043 100644 --- a/recipes/reason_magazine.recipe +++ b/recipes/reason_magazine.recipe @@ -9,7 +9,7 @@ from calibre import prepare_string_for_xml from calibre.web.feeds.news import BasicNewsRecipe, classes -# {{{ parse article JSON +# parse article JSON {{{ def process_image_block(lines, block): caption = block.get('captionText') caption_lines = [] diff --git a/setup/polib.py b/setup/polib.py index 64073d0b98..92e0f3ae0f 100644 --- a/setup/polib.py +++ b/setup/polib.py @@ -30,9 +30,8 @@ __all__ = ['pofile', 'POFile', 'POEntry', 'mofile', 'MOFile', 'MOEntry', # the default encoding to use when encoding cannot be detected default_encoding = 'utf-8' + # python 2/3 compatibility helpers {{{ - - PY3 = True text_type = str @@ -42,9 +41,9 @@ def b(s): def u(s): return s # }}} + + # _pofile_or_mofile {{{ - - def _pofile_or_mofile(f, type, **kwargs): """ Internal function used by :func:`polib.pofile` and :func:`polib.mofile` to @@ -67,9 +66,9 @@ def _pofile_or_mofile(f, type, **kwargs): instance.wrapwidth = kwargs.get('wrapwidth', 78) return instance # }}} + + # _is_file {{{ - - def _is_file(filename_or_contents): """ Safely returns the value of os.path.exists(filename_or_contents). @@ -85,9 +84,9 @@ def _is_file(filename_or_contents): except (TypeError, ValueError, UnicodeEncodeError): return False # }}} + + # function pofile() {{{ - - def pofile(pofile, **kwargs): """ Convenience function that parses the po or pot file ``pofile`` and returns @@ -117,9 +116,9 @@ def pofile(pofile, **kwargs): """ return _pofile_or_mofile(pofile, 'pofile', **kwargs) # }}} + + # function mofile() {{{ - - def mofile(mofile, **kwargs): """ Convenience function that parses the mo file ``mofile`` and returns a @@ -151,9 +150,9 @@ def mofile(mofile, **kwargs): """ return _pofile_or_mofile(mofile, 'mofile', **kwargs) # }}} + + # function detect_encoding() {{{ - - def detect_encoding(file, binary_mode=False): """ Try to detect the encoding used by the ``file``. The ``file`` argument can @@ -212,9 +211,9 @@ def detect_encoding(file, binary_mode=False): return enc return default_encoding # }}} + + # function escape() {{{ - - def escape(st): """ Escapes the characters ``\\\\``, ``\\t``, ``\\n``, ``\\r``, ``\\v``, @@ -229,9 +228,9 @@ def escape(st): .replace('\f', r'\f')\ .replace('\"', r'\"') # }}} + + # function unescape() {{{ - - def unescape(st): """ Unescapes the characters ``\\\\``, ``\\t``, ``\\n``, ``\\r``, ``\\v``, @@ -256,9 +255,9 @@ def unescape(st): return m # handles escaped double quote return re.sub(r'\\(\\|n|t|r|v|b|f|")', unescape_repl, st) # }}} + + # function natural_sort() {{{ - - def natural_sort(lst): """ Sort naturally the given list. @@ -271,11 +270,10 @@ def natural_sort(lst): return [convert(c) for c in re.split('([0-9]+)', key)] return sorted(lst, key=alphanum_key) - # }}} + + # class _BaseFile {{{ - - class _BaseFile(list): """ Common base class for the :class:`~polib.POFile` and :class:`~polib.MOFile` @@ -626,9 +624,9 @@ class _BaseFile(list): mixed = mixed.encode(self.encoding) return mixed # }}} + + # class POFile {{{ - - class POFile(_BaseFile): """ Po (or Pot) file reader/writer. @@ -734,9 +732,9 @@ class POFile(_BaseFile): if entry.msgid_with_context not in refpot_msgids: entry.obsolete = True # }}} + + # class MOFile {{{ - - class MOFile(_BaseFile): """ Mo file reader/writer. @@ -807,9 +805,9 @@ class MOFile(_BaseFile): """ return [] # }}} + + # class _BaseEntry {{{ - - class _BaseEntry: """ Base class for :class:`~polib.POEntry` and :class:`~polib.MOEntry` classes. @@ -942,9 +940,9 @@ class _BaseEntry: return '{}{}{}'.format(self.msgctxt, "\x04", self.msgid) return self.msgid # }}} + + # class POEntry {{{ - - class POEntry(_BaseEntry): """ Represents a po file entry. @@ -1186,9 +1184,9 @@ class POEntry(_BaseEntry): def __hash__(self): return hash((self.msgid, self.msgstr)) # }}} + + # class MOEntry {{{ - - class MOEntry(_BaseEntry): """ Represents a mo file entry. @@ -1221,11 +1219,10 @@ class MOEntry(_BaseEntry): def __hash__(self): return hash((self.msgid, self.msgstr)) - # }}} + + # class _POFileParser {{{ - - class _POFileParser: """ A finite state machine to efficiently and correctly parse po @@ -1658,9 +1655,9 @@ class _POFileParser: # don't change the current state return False # }}} + + # class _MOFileParser {{{ - - class _MOFileParser: """ A class to parse binary mo files. diff --git a/src/calibre/ebooks/mobi/debug/mobi6.py b/src/calibre/ebooks/mobi/debug/mobi6.py index 5cc26b8961..d2fb14e058 100644 --- a/src/calibre/ebooks/mobi/debug/mobi6.py +++ b/src/calibre/ebooks/mobi/debug/mobi6.py @@ -32,7 +32,7 @@ class TagX: # {{{ def __repr__(self): return 'TAGX(tag=%02d, num_values=%d, bitmask=%r, eof=%d)' % (self.tag, self.num_values, bin(self.bitmask), self.eof) - # }}} +# }}} class SecondaryIndexHeader: # {{{ @@ -231,7 +231,7 @@ class IndexHeader: # {{{ a('Number of entries in the NCX: %d'% self.ncx_count) return '\n'.join(ans) - # }}} +# }}} class Tag: # {{{ diff --git a/src/calibre/ebooks/pdf/html_writer.py b/src/calibre/ebooks/pdf/html_writer.py index deb73a5e66..43dc22df4d 100644 --- a/src/calibre/ebooks/pdf/html_writer.py +++ b/src/calibre/ebooks/pdf/html_writer.py @@ -518,7 +518,7 @@ def create_margin_files(container): # }}} -# Link handling {{{ +# Link handling {{{ def add_anchors_markup(root, uuid, anchors): body = last_tag(root) div = body.makeelement( diff --git a/src/calibre/gui2/icon_theme.py b/src/calibre/gui2/icon_theme.py index f36484f619..3a647c6c8c 100644 --- a/src/calibre/gui2/icon_theme.py +++ b/src/calibre/gui2/icon_theme.py @@ -498,7 +498,7 @@ def create_theme(folder=None, parent=None): icon_resource_manager.set_theme() # }}} -# Choose Theme {{{ +# Choose Theme {{{ def download_cover(cover_url, etag=None, cached=b''): diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 42431fb1bf..96d02b1bcd 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -151,7 +151,7 @@ class DateTimeEdit(DateTimeEditBase): # {{{ # }}} -# Number Editor {{{ +# Number Editor {{{ def make_clearing_spinbox(spinbox): diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 946681b188..f7d6262df7 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -454,7 +454,7 @@ class BooksView(QTableView): # {{{ self.preserve_state = partial(PreserveViewState, self) self.marked_changed_listener = FunctionDispatcher(self.marked_changed) - # {{{ Column Header setup + # Column Header setup {{{ self.can_add_columns = True self.was_restored = False self.allow_save_state = True diff --git a/src/calibre/gui2/tweak_book/preferences.py b/src/calibre/gui2/tweak_book/preferences.py index a532e6dd44..1d7b6d58ee 100644 --- a/src/calibre/gui2/tweak_book/preferences.py +++ b/src/calibre/gui2/tweak_book/preferences.py @@ -470,7 +470,7 @@ class PreviewSettings(BasicSettings): # {{{ # }}} -# ToolbarSettings {{{ +# ToolbarSettings {{{ class ToolbarList(QListWidget): diff --git a/src/calibre/gui2/tweak_book/reports.py b/src/calibre/gui2/tweak_book/reports.py index 652122caf6..c4adb09e93 100644 --- a/src/calibre/gui2/tweak_book/reports.py +++ b/src/calibre/gui2/tweak_book/reports.py @@ -402,7 +402,8 @@ class Jump: jump_to_location(loc) -jump = Jump() # }}} +jump = Jump() +# }}} # Images {{{ diff --git a/src/calibre/gui2/tweak_book/spell.py b/src/calibre/gui2/tweak_book/spell.py index 0933ec6be1..284c32bf37 100644 --- a/src/calibre/gui2/tweak_book/spell.py +++ b/src/calibre/gui2/tweak_book/spell.py @@ -1639,7 +1639,7 @@ class SpellCheck(Dialog): d.exec() # }}} -# Find next occurrence {{{ +# Find next occurrence {{{ def find_next(word, locations, current_editor, current_editor_name, diff --git a/src/calibre/gui2/tweak_book/widgets.py b/src/calibre/gui2/tweak_book/widgets.py index 0a1bba54ba..9887ebf1f5 100644 --- a/src/calibre/gui2/tweak_book/widgets.py +++ b/src/calibre/gui2/tweak_book/widgets.py @@ -814,10 +814,8 @@ class InsertLink(Dialog): # }}} -# Insert Semantics {{{ - -class InsertSemantics(Dialog): +class InsertSemantics(Dialog): # {{{ def __init__(self, container, parent=None): self.container = container diff --git a/src/calibre/gui2/viewer/ui.py b/src/calibre/gui2/viewer/ui.py index 1415f3625f..0f011e59f9 100644 --- a/src/calibre/gui2/viewer/ui.py +++ b/src/calibre/gui2/viewer/ui.py @@ -839,7 +839,7 @@ class EbookViewer(MainWindow): return MainWindow.closeEvent(self, ev) # }}} - # Auto-hide mouse cursor {{{ + # Auto-hide mouse cursor {{{ def setup_mouse_auto_hide(self): QApplication.instance().installEventFilter(self) self.cursor_hidden = False diff --git a/src/calibre/srv/ajax.py b/src/calibre/srv/ajax.py index 3ad57ae0fe..7499d2cef4 100644 --- a/src/calibre/srv/ajax.py +++ b/src/calibre/srv/ajax.py @@ -233,7 +233,7 @@ def books(ctx, rd, library_id): # }}} -# Categories (Tag Browser) {{{ +# Categories (Tag Browser) {{{ @endpoint('/ajax/categories/{library_id=None}', postprocess=json) diff --git a/src/calibre/srv/http_response.py b/src/calibre/srv/http_response.py index c91e71dc8f..81fdf0aed4 100644 --- a/src/calibre/srv/http_response.py +++ b/src/calibre/srv/http_response.py @@ -153,7 +153,7 @@ def get_ranges(headervalue, content_length): # {{{ return result # }}} -# gzip transfer encoding {{{ +# gzip transfer encoding {{{ def gzip_prefix():