8000 rfctr: bulk Python 2 formatting updates · python-openxml/python-docx@cbf940c · GitHub
[go: up one dir, main page]

Skip to content

Commit cbf940c

Browse files
committed
rfctr: bulk Python 2 formatting updates
* encoding header is no longer needed * from __future__ imports no longer needed * make module docstrings PEP 257 compliant.
1 parent 5cb952f commit cbf940c

Some content is hidden

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

56 files changed

+273
-728
lines changed

features/environment.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
# encoding: utf-8
2-
3-
"""
4-
Used by behave to set testing environment before and after running acceptance
5-
tests.
6-
"""
1+
"""Set testing environment before and after behave acceptance test runs."""
72

83
import os
94

src/docx/api.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
# encoding: utf-8
1+
"""Directly exposed API functions and classes, :func:`Document` for now.
22
3-
"""
4-
Directly exposed API functions and classes, :func:`Document` for now.
53
Provides a syntactically more convenient API for interacting with the
64
OpcPackage graph.
75
"""
86

9-
from __future__ import absolute_import, division, print_function
10-
117
import os
128

139
from docx.opc.constants import CONTENT_TYPE as CT

src/docx/blkcntnr.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
# encoding: utf-8
2-
31
"""Block item container, used by body, cell, header, etc.
42
53
Block level items are things like paragraph and table, although there are a few other
64
specialized ones like structured document tags.
75
"""
86

9-
from __future__ import absolute_import, division, print_function, unicode_literals
10-
117
from docx.oxml.table import CT_Tbl
128
from docx.shared import Parented
139
from docx.text.paragraph import Paragraph

src/docx/dml/color.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
# encoding: utf-8
2-
3-
"""
4-
DrawingML objects related to color, ColorFormat being the most prominent.
5-
"""
6-
7-
from __future__ import absolute_import, division, print_function, unicode_literals
1+
"""DrawingML objects related to color, ColorFormat being the most prominent."""
82

93
from ..enum.dml import MSO_COLOR_TYPE
104
from ..oxml.simpletypes import ST_HexColorAuto

src/docx/enum/__init__.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
# encoding: utf-8
2-
3-
"""
4-
Enumerations used in python-docx
5-
"""
6-
7-
from __future__ import absolute_import, print_function, unicode_literals
1+
"""Enumerations used in python-docx."""
82

93

104
class Enumeration(object):

src/docx/enum/shape.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
# encoding: utf-8
2-
3-
"""
4-
Enumerations related to DrawingML shapes in WordprocessingML files
5-
"""
6-
7-
from __future__ import absolute_import, print_function, unicode_literals
1+
"""Enumerations related to DrawingML shapes in WordprocessingML files."""
82

93

104
class WD_INLINE_SHAPE_TYPE(object):

src/docx/enum/text.py

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@
55

66
@alias("WD_ALIGN_PARAGRAPH")
77
class WD_PARAGRAPH_ALIGNMENT(XmlEnumeration):
8-
"""
9-
alias: **WD_ALIGN_PARAGRAPH**
8+
"""Alias: **WD_ALIGN_PARAGRAPH**
109
1110
Specifies paragraph justification type.
1211
1312
Example::
1413
15-
from docx.enum.text import WD_ALIGN_PARAGRAPH
14+
from docx.enum.text import WD_ALIGN_PARAGRAPH
1615
17-
paragraph = document.add_paragraph()
18-
paragraph.alignment = WD_ALIGN_PARAGRAPH.CENTER
16+
paragraph = document.add_paragraph() paragraph.alignment = WD_ALIGN_PARAGRAPH.CENTER
1917
"""
2018

2119
__ms_name__ = "WdParagraphAlignment"
@@ -38,34 +36,32 @@ class WD_PARAGRAPH_ALIGNMENT(XmlEnumeration):
3836
"JUSTIFY_MED",
3937
5,
4038
"mediumKashida",
41-
"Justified with a medium char" "acter compression ratio.",
39+
"Justified with a medium character compression ratio.",
4240
),
4341
XmlMappedEnumMember(
4442
"JUSTIFY_HI",
4543
7,
4644
"highKashida",
47-
"Justified with a high character" " compression ratio.",
45+
"Justified with a high character compression ratio.",
4846
),
4947
XmlMappedEnumMember(
5048
"JUSTIFY_LOW",
5149
8,
5250
"lowKashida",
53-
"Justified with a low character " "compression ratio.",
51+
"Justified with a low character compression ratio.",
5452
),
5553
XmlMappedEnumMember(
5654
"THAI_JUSTIFY",
5755
9,
5856
"thaiDistribute",
59-
"Justified according to Tha" "i formatting layout.",
57+
"Justified according to Thai formatting layout.",
6058
),
6159
)
6260

6361

6462
class WD_BREAK_TYPE(object):
65-
"""
66-
Corresponds to WdBreakType enumeration
67-
http://msdn.microsoft.com/en-us/library/office/ff195905.aspx
68-
"""
63+
"""Corresponds to WdBreakType enumeration http://msdn.microsoft.com/en-
64+
us/library/office/ff195905.aspx."""
6965

7066
COLUMN = 8
7167
LINE = 6
@@ -85,9 +81,9 @@ class WD_BREAK_TYPE(object):
8581

8682
@alias("WD_COLOR")
8783
class WD_COLOR_INDEX(XmlEnumeration):
88-
"""
89-
Specifies a standard preset color to apply. Used for font highlighting and
90-
perhaps other applications.
84+
"""Specifies a standard preset color to apply.
85+
86+
Used for font highlighting and perhaps other applications.
9187
"""
9288

9389
__ms_name__ = "WdColorIndex"
@@ -121,15 +117,14 @@ class WD_COLOR_INDEX(XmlEnumeration):
121117

122118

123119
class WD_LINE_SPACING(XmlEnumeration):
124-
"""
125-
Specifies a line spacing format to be applied to a paragraph.
120+
"""Specifies a line spacing format to be applied to a paragraph.
126121
127122
Example::
128123
129-
from docx.enum.text import WD_LINE_SPACING
124+
from docx.enum.text import WD_LINE_SPACING
130125
131-
paragraph = document.add_paragraph()
132-
paragraph.line_spacing_rule = WD_LINE_SPACING.EXACTLY
126+
paragraph = document.add_paragraph() paragraph.line_spacing_rule =
127+
WD_LINE_SPACING.EXACTLY
133128
"""
134129

135130
__ms_name__ = "WdLineSpacing"
@@ -166,9 +161,7 @@ class WD_LINE_SPACING(XmlEnumeration):
166161

167162

168163
class WD_TAB_ALIGNMENT(XmlEnumeration):
169-
"""
170-
Specifies the tab stop alignment to apply.
171-
"""
164+
"""Specifies the tab stop alignment to apply."""
172165

173166
__ms_name__ = "WdTabAlignment"
174167

@@ -189,9 +182,7 @@ class WD_TAB_ALIGNMENT(XmlEnumeration):
189182

190183

191184
class WD_TAB_LEADER(XmlEnumeration):
192-
"""
193-
Specifies the character to use as the leader with formatted tabs.
194-
"""
185+
"""Specifies the character to use as the leader with formatted tabs."""
195186

196187
__ms_name__ = "WdTabLeader"
197188

@@ -208,9 +199,7 @@ class WD_TAB_LEADER(XmlEnumeration):
208199

209200

210201
class WD_UNDERLINE(XmlEnumeration):
211-
"""
212-
Specifies the style of underline applied to a run of characters.
213-
"""
202+
"""Specifies the style of underline applied to a run of characters."""
214203

215204
__ms_name__ = "WdUnderline"
216205

src/docx/exceptions.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# encoding: utf-8
2-
3-
"""
4-
Exceptions used with python-docx.
1+
"""Exceptions used with python-docx.
52
63
The base exception class is PythonDocxError.
74
"""

src/docx/image/bmp.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# encoding: utf-8
2-
3-
from __future__ import absolute_import, division, print_function
4-
51
from .constants import MIME_TYPE
62
from .helpers import LITTLE_ENDIAN, StreamReader
73
from .image import BaseImageHeader

src/docx/image/constants.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
# encoding: utf-8
2-
3-
"""
4-
Constants specific the the image sub-package
5-
"""
1+
"""Constants specific the the image sub-package."""
62

73

84
class JPEG_MARKER_CODE(object):

src/docx/image/exceptions.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
# encoding: utf-8
2-
3-
"""
4-
Exceptions specific the the image sub-package
5-
"""
1+
"""Exceptions specific the the image sub-package."""
62

73

84
class InvalidImageStreamError(Exception):

src/docx/image/gif.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# encoding: utf-8
2-
3-
from __future__ import absolute_import, division, print_function
4-
51
from struct import Struct
62

73
from .constants import MIME_TYPE

0 commit comments

Comments
 (0)
0