10000 rfctr: Blacken code base · python-openxml/python-docx@629f942 · GitHub
[go: up one dir, main page]

Skip to content

Commit 629f942

Browse files
committed
rfctr: Blacken code base
1 parent 36cac78 commit 629f942
  • opc
  • oxml
  • parts
  • styles
  • text
  • features
  • tests
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    157 files changed

    +7141
    -6738
    lines changed

    docs/conf.py

    Lines changed: 30 additions & 31 deletions
    Original file line numberDiff line numberDiff line change
    @@ -18,7 +18,7 @@
    1818
    # If extensions (or modules to document with autodoc) are in another directory,
    1919
    # add these directories to sys.path here. If the directory is relative to the
    2020
    # documentation root, use os.path.abspath to make it absolute, like shown here.
    21-
    sys.path.insert(0, os.path.abspath('..'))
    21+
    sys.path.insert(0, os.path.abspath(".."))
    2222

    2323
    from docx import __version__ # noqa
    2424

    @@ -31,28 +31,28 @@
    3131
    # Add any Sphinx extension module names here, as strings. They can be
    3232
    # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
    3333
    extensions = [
    34-
    'sphinx.ext.autodoc',
    35-
    'sphinx.ext.intersphinx',
    36-
    'sphinx.ext.todo',
    37-
    'sphinx.ext.coverage',
    38-
    'sphinx.ext.viewcode'
    34+
    "sphinx.ext.autodoc",
    35+
    "sphinx.ext.intersphinx",
    36+
    "sphinx.ext.todo",
    37+
    "sphinx.ext.coverage",
    38+
    "sphinx.ext.viewcode",
    3939
    ]
    4040

    4141
    # Add any paths that contain templates here, relative to this directory.
    42-
    templates_path = ['_templates']
    42+
    templates_path = ["_templates"]
    4343

    4444
    # The suffix of source filenames.
    45-
    source_suffix = '.rst'
    45+
    source_suffix = ".rst"
    4646

    4747
    # The encoding of source files.
    4848
    # source_encoding = 'utf-8-sig'
    4949

    5050
    # The master toctree document.
    51-
    master_doc = 'index'
    51+
    master_doc = "index"
    5252

    5353
    # General information about the project.
    54-
    project = u'python-docx'
    55-
    copyright = u'2013, Steve Canny'
    54+
    project = "python-docx"
    55+
    copyright = "2013, Steve Canny"
    5656

    5757
    # The version info for the project you're documenting, acts as replacement for
    5858
    # |version| and |release|, also used in various other places throughout the
    @@ -193,7 +193,7 @@
    193193

    194194
    # List of patterns, relative to source directory, that match files and
    195195
    # directories to ignore when looking for source files.
    196-
    exclude_patterns = ['.build']
    196+
    exclude_patterns = [".build"]
    197197

    198198
    # The reST default role (used for this markup: `text`) to use for all
    199199
    # documents.
    @@ -211,7 +211,7 @@
    211211
    # show_authors = False
    212212

    213213
    # The name of the Pygments (syntax highlighting) style to use.
    214-
    pygments_style = 'sphinx'
    214+
    pygments_style = "sphinx"
    215215

    216216
    # A list of ignored prefixes for module index sorting.
    217217
    # modindex_common_prefix = []
    @@ -221,15 +221,15 @@
    221221

    222222
    # The theme to use for HTML and HTML Help pages. See the documentation for
    223223
    # a list of builtin themes.
    224-
    html_theme = 'armstrong'
    224+
    html_theme = "armstrong"
    225225

    226226
    # Theme options are theme-specific and customize the look and feel of a theme
    227227
    # further. For a list of options available for each theme, see the
    228228
    # documentation.
    229229
    # html_theme_options = {}
    230230

    231231
    # Add any paths that contain custom themes here, relative to this directory.
    232-
    html_theme_path = ['_themes']
    232+
    html_theme_path = ["_themes"]
    233233

    234234
    # The name for this set of Sphinx documents. If None, it defaults to
    235235
    # "<project> v<release> documentation".
    @@ -250,7 +250,7 @@
    250250
    # Add any paths that contain custom static files (such as style sheets) here,
    251251
    # relative to this directory. They are copied after the builtin static files,
    252252
    # so a file named "default.css" will overwrite the builtin "default.css".
    253-
    html_static_path = ['_static']
    253+
    html_static_path = ["_static"]
    254254

    255255
    # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
    256256
    # using the given strftime format.
    @@ -263,8 +263,7 @@
    263263
    # Custom sidebar templates, maps document names to template names.
    264264
    # html_sidebars = {}
    265265
    html_sidebars = {
    266-
    '**': ['localtoc.html', 'relations.html', 'sidebarlinks.html',
    267-
    'searchbox.html']
    266+
    "**": ["localtoc.html", "relations.html", "sidebarlinks.html", "searchbox.html"]
    268267
    }
    269268

    270269
    # Additional templates that should be rendered to pages, maps page names to
    @@ -298,18 +297,16 @@
    298297
    # html_file_suffix = None
    299298

    300299
    # Output file base name for HTML help builder.
    301-
    htmlhelp_basename = 'python-docxdoc'
    300+
    htmlhelp_basename = "python-docxdoc"
    302301

    303302

    304303
    # -- Options for LaTeX output -----------------------------------------------
    305304

    306305
    latex_elements = {
    307306
    # The paper size ('letterpaper' or 'a4paper').
    308307
    # 'papersize': 'letterpaper',
    309-
    310308
    # The font size ('10pt', '11pt' or '12pt').
    311309
    # 'pointsize': '10pt',
    312-
    313310
    # Additional stuff for the LaTeX preamble.
    314311
    # 'preamble': '',
    315312
    }
    @@ -321,8 +318,7 @@
    321318
    # author,
    322319
    # documentclass [howto/manual]).
    323320
    latex_documents = [
    324-
    ('index', 'python-docx.tex', u'python-docx Documentation',
    325-
    u'Steve Canny', 'manual'),
    321+
    ("index", "python-docx.tex", "python-docx Documentation", "Steve Canny", "manual"),
    326322
    ]
    327323

    328324
    # The name of an image file (relative to this directory) to place at the top of
    @@ -350,10 +346,7 @@
    350346

    351347
    # One entry per manual page. List of tuples
    352348
    # (source start file, name, description, authors, manual section).
    353-
    man_pages = [
    354-
    ('index', 'python-docx', u'python-docx Documentation',
    355-
    [u'Steve Canny'], 1)
    356-
    ]
    349+
    man_pages = [("index", "python-docx", "python-docx Documentation", ["Steve Canny"], 1)]
    357350

    358351
    # If true, show URL addresses after external links.
    359352
    # man_show_urls = False
    @@ -365,9 +358,15 @@
    365358
    # (source start file, target name, title, author,
    366359
    # dir menu entry, description, category)
    367360
    texinfo_documents = [
    368-
    ('index', 'python-docx', u'python-docx Documentation',
    369-
    u'Steve Canny', 'python-docx', 'One line description of project.',
    370-
    'Miscellaneous'),
    361+
    (
    362+
    "index",
    363+
    "python-docx",
    364+
    "python-docx Documentation",
    365+
    "Steve Canny",
    366+
    "python-docx&q 10000 uot;,
    367+
    "One line description of project.",
    368+
    "Miscellaneous",
    369+
    ),
    371370
    ]
    372371

    373372
    # Documents to append as an appendix to all manuals.
    @@ -381,4 +380,4 @@
    381380

    382381

    383382
    # Example configuration for intersphinx: refer to the Python standard library.
    384-
    intersphinx_mapping = {'http://docs.python.org/3/': None}
    383+
    intersphinx_mapping = {"http://docs.python.org/3/": None}

    docx/api.py

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -34,4 +34,4 @@ def _default_docx_path():
    3434
    Return the path to the built-in default .docx package.
    3535
    """
    3636
    _thisdir = os.path.split(__file__)[0]
    37-
    return os.path.join(_thisdir, 'templates', 'default.docx')
    37+
    return os.path.join(_thisdir, "templates", "default.docx")

    docx/blkcntnr.py

    Lines changed: 3 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -25,7 +25,7 @@ def __init__(self, element, parent):
    2525
    super(BlockItemContainer, self).__init__(parent)
    2626
    self._element = element
    2727

    28-
    def add_paragraph(self, text='', style=None):
    28+
    def add_paragraph(self, text="", style=None):
    2929
    """
    3030
    Return a paragraph newly added to the end of the content in this
    3131
    container, having *text* in a single run if present, and having
    @@ -46,6 +46,7 @@ def add_table(self, rows, cols, width):
    4646
    distributed between the table columns.
    4747
    """
    4848
    from .table import Table
    49+
    4950
    tbl = CT_Tbl.new_tbl(rows, cols, width)
    5051
    self._element._insert_tbl(tbl)
    5152
    return Table(tbl, self)
    @@ -65,6 +66,7 @@ def tables(self):
    6566
    Read-only.
    6667
    """
    6768
    from .table import Table
    69+
    6870
    return [Table(tbl, self) for tbl in self._element.tbl_lst]
    6971

    7072
    def _add_paragraph(self):

    docx/compat.py

    Lines changed: 0 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -13,7 +13,6 @@
    1313
    # ===========================================================================
    1414

    1515
    if sys.version_info >= (3, 0):
    16-
    1716
    from collections.abc import Sequence
    1817
    from io import BytesIO
    1918

    @@ -28,7 +27,6 @@ def is_string(obj):
    2827
    # ===========================================================================
    2928

    3029
    else:
    31-
    3230
    from collections import Sequence # noqa
    3331
    from StringIO import StringIO as BytesIO # noqa
    3432

    docx/dml/color.py

    Lines changed: 1 addition & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -4,9 +4,7 @@
    44
    DrawingML objects related to color, ColorFormat being the most prominent.
    55
    """
    66

    7-
    from __future__ import (
    8-
    absolute_import, division, print_function, unicode_literals
    9-
    )
    7+
    from __future__ import absolute_import, division, print_function, unicode_literals
    108

    119
    from ..enum.dml import MSO_COLOR_TYPE
    1210
    from ..oxml.simpletypes import ST_HexColorAuto

    docx/document.py

    Lines changed: 4 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -18,7 +18,7 @@ class Document(ElementProxy):
    1818
    a document.
    1919
    """
    2020

    21-
    __slots__ = ('_part', '__body')
    21+
    __slots__ = ("_part", "__body")
    2222

    2323
    def __init__(self, element, part):
    2424
    super(Document, self).__init__(element)
    @@ -44,7 +44,7 @@ def add_page_break(self):
    4444
    paragraph.add_run().add_break(WD_BREAK.PAGE)
    4545
    return paragraph
    4646

    47-
    def add_paragraph(self, text='', style=None):
    47+
    def add_paragraph(self, text="", style=None):
    4848
    """
    4949
    Return a paragraph newly added to the end of the document, populated
    5050
    with *text* and having paragraph style *style*. *text* can contain
    @@ -172,9 +172,7 @@ def _block_width(self):
    172172
    space between the margins of the last section of this document.
    173173
    """
    174174
    section = self.sections[-1]
    175-
    return Emu(
    176-
    section.page_width - section.left_margin - section.right_margin
    177-
    )
    175+
    return Emu(section.page_width - section.left_margin - section.right_margin)
    178176

    179177
    @property
    180178
    def _body(self):
    @@ -191,6 +189,7 @@ class _Body(BlockItemContainer):
    191189
    Proxy for ``<w:body>`` element in this document, having primarily a
    192190
    container role.
    193191
    """
    192+
    194193
    def __init__(self, body_elm, parent):
    195194
    super(_Body, self).__init__(body_elm, parent)
    196195
    self._body = body_elm

    docx/enum/__init__.py

    Lines changed: 0 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -8,7 +8,6 @@
    88

    99

    1010
    class Enumeration(object):
    11-
    1211
    @classmethod
    1312
    def from_xml(cls, xml_val):
    1413
    return cls._xml_to_idx[xml_val]

    0 commit comments

    Comments
     (0)
    0