diff options
author | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
---|---|---|
committer | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
commit | 4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch) | |
tree | ee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/docx/enum | |
parent | cc961e04ba734dd72309fb548a2f97d67d578813 (diff) | |
download | gn-ai-master.tar.gz |
Diffstat (limited to '.venv/lib/python3.12/site-packages/docx/enum')
-rw-r--r-- | .venv/lib/python3.12/site-packages/docx/enum/__init__.py | 0 | ||||
-rw-r--r-- | .venv/lib/python3.12/site-packages/docx/enum/base.py | 146 | ||||
-rw-r--r-- | .venv/lib/python3.12/site-packages/docx/enum/dml.py | 103 | ||||
-rw-r--r-- | .venv/lib/python3.12/site-packages/docx/enum/section.py | 86 | ||||
-rw-r--r-- | .venv/lib/python3.12/site-packages/docx/enum/shape.py | 19 | ||||
-rw-r--r-- | .venv/lib/python3.12/site-packages/docx/enum/style.py | 452 | ||||
-rw-r--r-- | .venv/lib/python3.12/site-packages/docx/enum/table.py | 136 | ||||
-rw-r--r-- | .venv/lib/python3.12/site-packages/docx/enum/text.py | 367 |
8 files changed, 1309 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/docx/enum/__init__.py b/.venv/lib/python3.12/site-packages/docx/enum/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/.venv/lib/python3.12/site-packages/docx/enum/__init__.py diff --git a/.venv/lib/python3.12/site-packages/docx/enum/base.py b/.venv/lib/python3.12/site-packages/docx/enum/base.py new file mode 100644 index 00000000..bc96ab6a --- /dev/null +++ b/.venv/lib/python3.12/site-packages/docx/enum/base.py @@ -0,0 +1,146 @@ +"""Base classes and other objects used by enumerations.""" + +from __future__ import annotations + +import enum +import textwrap +from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar + +if TYPE_CHECKING: + from typing_extensions import Self + +_T = TypeVar("_T", bound="BaseXmlEnum") + + +class BaseEnum(int, enum.Enum): + """Base class for Enums that do not map XML attr values. + + The enum's value will be an integer, corresponding to the integer assigned the + corresponding member in the MS API enum of the same name. + """ + + def __new__(cls, ms_api_value: int, docstr: str): + self = int.__new__(cls, ms_api_value) + self._value_ = ms_api_value + self.__doc__ = docstr.strip() + return self + + def __str__(self): + """The symbolic name and string value of this member, e.g. 'MIDDLE (3)'.""" + return f"{self.name} ({self.value})" + + +class BaseXmlEnum(int, enum.Enum): + """Base class for Enums that also map XML attr values. + + The enum's value will be an integer, corresponding to the integer assigned the + corresponding member in the MS API enum of the same name. + """ + + xml_value: str + + def __new__(cls, ms_api_value: int, xml_value: str, docstr: str): + self = int.__new__(cls, ms_api_value) + self._value_ = ms_api_value + self.xml_value = xml_value + self.__doc__ = docstr.strip() + return self + + def __str__(self): + """The symbolic name and string value of this member, e.g. 'MIDDLE (3)'.""" + return f"{self.name} ({self.value})" + + @classmethod + def from_xml(cls, xml_value: str | None) -> Self: + """Enumeration member corresponding to XML attribute value `xml_value`. + + Example:: + + >>> WD_PARAGRAPH_ALIGNMENT.from_xml("center") + WD_PARAGRAPH_ALIGNMENT.CENTER + + """ + member = next((member for member in cls if member.xml_value == xml_value), None) + if member is None: + raise ValueError(f"{cls.__name__} has no XML mapping for '{xml_value}'") + return member + + @classmethod + def to_xml(cls: Type[_T], value: int | _T | None) -> str | None: + """XML value of this enum member, generally an XML attribute value.""" + # -- presence of multi-arg `__new__()` method fools type-checker, but getting a + # -- member by its value using EnumCls(val) works as usual. + return cls(value).xml_value + + +class DocsPageFormatter: + """Generate an .rst doc page for an enumeration. + + Formats a RestructuredText documention page (string) for the enumeration class parts + passed to the constructor. An immutable one-shot service object. + """ + + def __init__(self, clsname: str, clsdict: Dict[str, Any]): + self._clsname = clsname + self._clsdict = clsdict + + @property + def page_str(self): + """The RestructuredText documentation page for the enumeration. + + This is the only API member for the class. + """ + tmpl = ".. _%s:\n\n%s\n\n%s\n\n----\n\n%s" + components = ( + self._ms_name, + self._page_title, + self._intro_text, + self._member_defs, + ) + return tmpl % components + + @property + def _intro_text(self): + """Docstring of the enumeration, formatted for documentation page.""" + try: + cls_docstring = self._clsdict["__doc__"] + except KeyError: + cls_docstring = "" + + if cls_docstring is None: + return "" + + return textwrap.dedent(cls_docstring).strip() + + def _member_def(self, member: BaseEnum | BaseXmlEnum): + """Return an individual member definition formatted as an RST glossary entry, + wrapped to fit within 78 columns.""" + assert member.__doc__ is not None + member_docstring = textwrap.dedent(member.__doc__).strip() + member_docstring = textwrap.fill( + member_docstring, + width=78, + initial_indent=" " * 4, + subsequent_indent=" " * 4, + ) + return "%s\n%s\n" % (member.name, member_docstring) + + @property + def _member_defs(self): + """A single string containing the aggregated member definitions section of the + documentation page.""" + members = self._clsdict["__members__"] + member_defs = [self._member_def(member) for member in members if member.name is not None] + return "\n".join(member_defs) + + @property + def _ms_name(self): + """The Microsoft API name for this enumeration.""" + return self._clsdict["__ms_name__"] + + @property + def _page_title(self): + """The title for the documentation page, formatted as code (surrounded in + double-backtics) and underlined with '=' characters.""" + title_underscore = "=" * (len(self._clsname) + 4) + return "``%s``\n%s" % (self._clsname, title_underscore) diff --git a/.venv/lib/python3.12/site-packages/docx/enum/dml.py b/.venv/lib/python3.12/site-packages/docx/enum/dml.py new file mode 100644 index 00000000..27c63a28 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/docx/enum/dml.py @@ -0,0 +1,103 @@ +"""Enumerations used by DrawingML objects.""" + +from .base import BaseEnum, BaseXmlEnum + + +class MSO_COLOR_TYPE(BaseEnum): + """Specifies the color specification scheme. + + Example:: + + from docx.enum.dml import MSO_COLOR_TYPE + + assert font.color.type == MSO_COLOR_TYPE.SCHEME + + MS API name: `MsoColorType` + + http://msdn.microsoft.com/en-us/library/office/ff864912(v=office.15).aspx + """ + + RGB = (1, "Color is specified by an |RGBColor| value.") + """Color is specified by an |RGBColor| value.""" + + THEME = (2, "Color is one of the preset theme colors.") + """Color is one of the preset theme colors.""" + + AUTO = (101, "Color is determined automatically by the application.") + """Color is determined automatically by the application.""" + + +class MSO_THEME_COLOR_INDEX(BaseXmlEnum): + """Indicates the Office theme color, one of those shown in the color gallery on the + formatting ribbon. + + Alias: ``MSO_THEME_COLOR`` + + Example:: + + from docx.enum.dml import MSO_THEME_COLOR + + font.color.theme_color = MSO_THEME_COLOR.ACCENT_1 + + MS API name: `MsoThemeColorIndex` + + http://msdn.microsoft.com/en-us/library/office/ff860782(v=office.15).aspx + """ + + NOT_THEME_COLOR = (0, "UNMAPPED", "Indicates the color is not a theme color.") + """Indicates the color is not a theme color.""" + + ACCENT_1 = (5, "accent1", "Specifies the Accent 1 theme color.") + """Specifies the Accent 1 theme color.""" + + ACCENT_2 = (6, "accent2", "Specifies the Accent 2 theme color.") + """Specifies the Accent 2 theme color.""" + + ACCENT_3 = (7, "accent3", "Specifies the Accent 3 theme color.") + """Specifies the Accent 3 theme color.""" + + ACCENT_4 = (8, "accent4", "Specifies the Accent 4 theme color.") + """Specifies the Accent 4 theme color.""" + + ACCENT_5 = (9, "accent5", "Specifies the Accent 5 theme color.") + """Specifies the Accent 5 theme color.""" + + ACCENT_6 = (10, "accent6", "Specifies the Accent 6 theme color.") + """Specifies the Accent 6 theme color.""" + + BACKGROUND_1 = (14, "background1", "Specifies the Background 1 theme color.") + """Specifies the Background 1 theme color.""" + + BACKGROUND_2 = (16, "background2", "Specifies the Background 2 theme color.") + """Specifies the Background 2 theme color.""" + + DARK_1 = (1, "dark1", "Specifies the Dark 1 theme color.") + """Specifies the Dark 1 theme color.""" + + DARK_2 = (3, "dark2", "Specifies the Dark 2 theme color.") + """Specifies the Dark 2 theme color.""" + + FOLLOWED_HYPERLINK = ( + 12, + "followedHyperlink", + "Specifies the theme color for a clicked hyperlink.", + ) + """Specifies the theme color for a clicked hyperlink.""" + + HYPERLINK = (11, "hyperlink", "Specifies the theme color for a hyperlink.") + """Specifies the theme color for a hyperlink.""" + + LIGHT_1 = (2, "light1", "Specifies the Light 1 theme color.") + """Specifies the Light 1 theme color.""" + + LIGHT_2 = (4, "light2", "Specifies the Light 2 theme color.") + """Specifies the Light 2 theme color.""" + + TEXT_1 = (13, "text1", "Specifies the Text 1 theme color.") + """Specifies the Text 1 theme color.""" + + TEXT_2 = (15, "text2", "Specifies the Text 2 theme color.") + """Specifies the Text 2 theme color.""" + + +MSO_THEME_COLOR = MSO_THEME_COLOR_INDEX diff --git a/.venv/lib/python3.12/site-packages/docx/enum/section.py b/.venv/lib/python3.12/site-packages/docx/enum/section.py new file mode 100644 index 00000000..982e1911 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/docx/enum/section.py @@ -0,0 +1,86 @@ +"""Enumerations related to the main document in WordprocessingML files.""" + +from .base import BaseXmlEnum + + +class WD_HEADER_FOOTER_INDEX(BaseXmlEnum): + """Alias: **WD_HEADER_FOOTER** + + Specifies one of the three possible header/footer definitions for a section. + + For internal use only; not part of the python-docx API. + + MS API name: `WdHeaderFooterIndex` + URL: https://docs.microsoft.com/en-us/office/vba/api/word.wdheaderfooterindex + """ + + PRIMARY = (1, "default", "Header for odd pages or all if no even header.") + """Header for odd pages or all if no even header.""" + + FIRST_PAGE = (2, "first", "Header for first page of section.") + """Header for first page of section.""" + + EVEN_PAGE = (3, "even", "Header for even pages of recto/verso section.") + """Header for even pages of recto/verso section.""" + + +WD_HEADER_FOOTER = WD_HEADER_FOOTER_INDEX + + +class WD_ORIENTATION(BaseXmlEnum): + """Alias: **WD_ORIENT** + + Specifies the page layout orientation. + + Example:: + + from docx.enum.section import WD_ORIENT + + section = document.sections[-1] section.orientation = WD_ORIENT.LANDSCAPE + + MS API name: `WdOrientation` + MS API URL: http://msdn.microsoft.com/en-us/library/office/ff837902.aspx + """ + + PORTRAIT = (0, "portrait", "Portrait orientation.") + """Portrait orientation.""" + + LANDSCAPE = (1, "landscape", "Landscape orientation.") + """Landscape orientation.""" + + +WD_ORIENT = WD_ORIENTATION + + +class WD_SECTION_START(BaseXmlEnum): + """Alias: **WD_SECTION** + + Specifies the start type of a section break. + + Example:: + + from docx.enum.section import WD_SECTION + + section = document.sections[0] section.start_type = WD_SECTION.NEW_PAGE + + MS API name: `WdSectionStart` + MS API URL: http://msdn.microsoft.com/en-us/library/office/ff840975.aspx + """ + + CONTINUOUS = (0, "continuous", "Continuous section break.") + """Continuous section break.""" + + NEW_COLUMN = (1, "nextColumn", "New column section break.") + """New column section break.""" + + NEW_PAGE = (2, "nextPage", "New page section break.") + """New page section break.""" + + EVEN_PAGE = (3, "evenPage", "Even pages section break.") + """Even pages section break.""" + + ODD_PAGE = (4, "oddPage", "Section begins on next odd page.") + """Section begins on next odd page.""" + + +WD_SECTION = WD_SECTION_START diff --git a/.venv/lib/python3.12/site-packages/docx/enum/shape.py b/.venv/lib/python3.12/site-packages/docx/enum/shape.py new file mode 100644 index 00000000..ed086c38 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/docx/enum/shape.py @@ -0,0 +1,19 @@ +"""Enumerations related to DrawingML shapes in WordprocessingML files.""" + +import enum + + +class WD_INLINE_SHAPE_TYPE(enum.Enum): + """Corresponds to WdInlineShapeType enumeration. + + http://msdn.microsoft.com/en-us/library/office/ff192587.aspx. + """ + + CHART = 12 + LINKED_PICTURE = 4 + PICTURE = 3 + SMART_ART = 15 + NOT_IMPLEMENTED = -6 + + +WD_INLINE_SHAPE = WD_INLINE_SHAPE_TYPE diff --git a/.venv/lib/python3.12/site-packages/docx/enum/style.py b/.venv/lib/python3.12/site-packages/docx/enum/style.py new file mode 100644 index 00000000..d2474611 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/docx/enum/style.py @@ -0,0 +1,452 @@ +"""Enumerations related to styles.""" + +from .base import BaseEnum, BaseXmlEnum + + +class WD_BUILTIN_STYLE(BaseEnum): + """Alias: **WD_STYLE** + + Specifies a built-in Microsoft Word style. + + Example:: + + from docx import Document + from docx.enum.style import WD_STYLE + + document = Document() + styles = document.styles + style = styles[WD_STYLE.BODY_TEXT] + + + MS API name: `WdBuiltinStyle` + + http://msdn.microsoft.com/en-us/library/office/ff835210.aspx + """ + + BLOCK_QUOTATION = (-85, "Block Text.") + """Block Text.""" + + BODY_TEXT = (-67, "Body Text.") + """Body Text.""" + + BODY_TEXT_2 = (-81, "Body Text 2.") + """Body Text 2.""" + + BODY_TEXT_3 = (-82, "Body Text 3.") + """Body Text 3.""" + + BODY_TEXT_FIRST_INDENT = (-78, "Body Text First Indent.") + """Body Text First Indent.""" + + BODY_TEXT_FIRST_INDENT_2 = (-79, "Body Text First Indent 2.") + """Body Text First Indent 2.""" + + BODY_TEXT_INDENT = (-68, "Body Text Indent.") + """Body Text Indent.""" + + BODY_TEXT_INDENT_2 = (-83, "Body Text Indent 2.") + """Body Text Indent 2.""" + + BODY_TEXT_INDENT_3 = (-84, "Body Text Indent 3.") + """Body Text Indent 3.""" + + BOOK_TITLE = (-265, "Book Title.") + """Book Title.""" + + CAPTION = (-35, "Caption.") + """Caption.""" + + CLOSING = (-64, "Closing.") + """Closing.""" + + COMMENT_REFERENCE = (-40, "Comment Reference.") + """Comment Reference.""" + + COMMENT_TEXT = (-31, "Comment Text.") + """Comment Text.""" + + DATE = (-77, "Date.") + """Date.""" + + DEFAULT_PARAGRAPH_FONT = (-66, "Default Paragraph Font.") + """Default Paragraph Font.""" + + EMPHASIS = (-89, "Emphasis.") + """Emphasis.""" + + ENDNOTE_REFERENCE = (-43, "Endnote Reference.") + """Endnote Reference.""" + + ENDNOTE_TEXT = (-44, "Endnote Text.") + """Endnote Text.""" + + ENVELOPE_ADDRESS = (-37, "Envelope Address.") + """Envelope Address.""" + + ENVELOPE_RETURN = (-38, "Envelope Return.") + """Envelope Return.""" + + FOOTER = (-33, "Footer.") + """Footer.""" + + FOOTNOTE_REFERENCE = (-39, "Footnote Reference.") + """Footnote Reference.""" + + FOOTNOTE_TEXT = (-30, "Footnote Text.") + """Footnote Text.""" + + HEADER = (-32, "Header.") + """Header.""" + + HEADING_1 = (-2, "Heading 1.") + """Heading 1.""" + + HEADING_2 = (-3, "Heading 2.") + """Heading 2.""" + + HEADING_3 = (-4, "Heading 3.") + """Heading 3.""" + + HEADING_4 = (-5, "Heading 4.") + """Heading 4.""" + + HEADING_5 = (-6, "Heading 5.") + """Heading 5.""" + + HEADING_6 = (-7, "Heading 6.") + """Heading 6.""" + + HEADING_7 = (-8, "Heading 7.") + """Heading 7.""" + + HEADING_8 = (-9, "Heading 8.") + """Heading 8.""" + + HEADING_9 = (-10, "Heading 9.") + """Heading 9.""" + + HTML_ACRONYM = (-96, "HTML Acronym.") + """HTML Acronym.""" + + HTML_ADDRESS = (-97, "HTML Address.") + """HTML Address.""" + + HTML_CITE = (-98, "HTML Cite.") + """HTML Cite.""" + + HTML_CODE = (-99, "HTML Code.") + """HTML Code.""" + + HTML_DFN = (-100, "HTML Definition.") + """HTML Definition.""" + + HTML_KBD = (-101, "HTML Keyboard.") + """HTML Keyboard.""" + + HTML_NORMAL = (-95, "Normal (Web).") + """Normal (Web).""" + + HTML_PRE = (-102, "HTML Preformatted.") + """HTML Preformatted.""" + + HTML_SAMP = (-103, "HTML Sample.") + """HTML Sample.""" + + HTML_TT = (-104, "HTML Typewriter.") + """HTML Typewriter.""" + + HTML_VAR = (-105, "HTML Variable.") + """HTML Variable.""" + + HYPERLINK = (-86, "Hyperlink.") + """Hyperlink.""" + + HYPERLINK_FOLLOWED = (-87, "Followed Hyperlink.") + """Followed Hyperlink.""" + + INDEX_1 = (-11, "Index 1.") + """Index 1.""" + + INDEX_2 = (-12, "Index 2.") + """Index 2.""" + + INDEX_3 = (-13, "Index 3.") + """Index 3.""" + + INDEX_4 = (-14, "Index 4.") + """Index 4.""" + + INDEX_5 = (-15, "Index 5.") + """Index 5.""" + + INDEX_6 = (-16, "Index 6.") + """Index 6.""" + + INDEX_7 = (-17, "Index 7.") + """Index 7.""" + + INDEX_8 = (-18, "Index 8.") + """Index 8.""" + + INDEX_9 = (-19, "Index 9.") + """Index 9.""" + + INDEX_HEADING = (-34, "Index Heading") + """Index Heading""" + + INTENSE_EMPHASIS = (-262, "Intense Emphasis.") + """Intense Emphasis.""" + + INTENSE_QUOTE = (-182, "Intense Quote.") + """Intense Quote.""" + + INTENSE_REFERENCE = (-264, "Intense Reference.") + """Intense Reference.""" + + LINE_NUMBER = (-41, "Line Number.") + """Line Number.""" + + LIST = (-48, "List.") + """List.""" + + LIST_2 = (-51, "List 2.") + """List 2.""" + + LIST_3 = (-52, "List 3.") + """List 3.""" + + LIST_4 = (-53, "List 4.") + """List 4.""" + + LIST_5 = (-54, "List 5.") + """List 5.""" + + LIST_BULLET = (-49, "List Bullet.") + """List Bullet.""" + + LIST_BULLET_2 = (-55, "List Bullet 2.") + """List Bullet 2.""" + + LIST_BULLET_3 = (-56, "List Bullet 3.") + """List Bullet 3.""" + + LIST_BULLET_4 = (-57, "List Bullet 4.") + """List Bullet 4.""" + + LIST_BULLET_5 = (-58, "List Bullet 5.") + """List Bullet 5.""" + + LIST_CONTINUE = (-69, "List Continue.") + """List Continue.""" + + LIST_CONTINUE_2 = (-70, "List Continue 2.") + """List Continue 2.""" + + LIST_CONTINUE_3 = (-71, "List Continue 3.") + """List Continue 3.""" + + LIST_CONTINUE_4 = (-72, "List Continue 4.") + """List Continue 4.""" + + LIST_CONTINUE_5 = (-73, "List Continue 5.") + """List Continue 5.""" + + LIST_NUMBER = (-50, "List Number.") + """List Number.""" + + LIST_NUMBER_2 = (-59, "List Number 2.") + """List Number 2.""" + + LIST_NUMBER_3 = (-60, "List Number 3.") + """List Number 3.""" + + LIST_NUMBER_4 = (-61, "List Number 4.") + """List Number 4.""" + + LIST_NUMBER_5 = (-62, "List Number 5.") + """List Number 5.""" + + LIST_PARAGRAPH = (-180, "List Paragraph.") + """List Paragraph.""" + + MACRO_TEXT = (-46, "Macro Text.") + """Macro Text.""" + + MESSAGE_HEADER = (-74, "Message Header.") + """Message Header.""" + + NAV_PANE = (-90, "Document Map.") + """Document Map.""" + + NORMAL = (-1, "Normal.") + """Normal.""" + + NORMAL_INDENT = (-29, "Normal Indent.") + """Normal Indent.""" + + NORMAL_OBJECT = (-158, "Normal (applied to an object).") + """Normal (applied to an object).""" + + NORMAL_TABLE = (-106, "Normal (applied within a table).") + """Normal (applied within a table).""" + + NOTE_HEADING = (-80, "Note Heading.") + """Note Heading.""" + + PAGE_NUMBER = (-42, "Page Number.") + """Page Number.""" + + PLAIN_TEXT = (-91, "Plain Text.") + """Plain Text.""" + + QUOTE = (-181, "Quote.") + """Quote.""" + + SALUTATION = (-76, "Salutation.") + """Salutation.""" + + SIGNATURE = (-65, "Signature.") + """Signature.""" + + STRONG = (-88, "Strong.") + """Strong.""" + + SUBTITLE = (-75, "Subtitle.") + """Subtitle.""" + + SUBTLE_EMPHASIS = (-261, "Subtle Emphasis.") + """Subtle Emphasis.""" + + SUBTLE_REFERENCE = (-263, "Subtle Reference.") + """Subtle Reference.""" + + TABLE_COLORFUL_GRID = (-172, "Colorful Grid.") + """Colorful Grid.""" + + TABLE_COLORFUL_LIST = (-171, "Colorful List.") + """Colorful List.""" + + TABLE_COLORFUL_SHADING = (-170, "Colorful Shading.") + """Colorful Shading.""" + + TABLE_DARK_LIST = (-169, "Dark List.") + """Dark List.""" + + TABLE_LIGHT_GRID = (-161, "Light Grid.") + """Light Grid.""" + + TABLE_LIGHT_GRID_ACCENT_1 = (-175, "Light Grid Accent 1.") + """Light Grid Accent 1.""" + + TABLE_LIGHT_LIST = (-160, "Light List.") + """Light List.""" + + TABLE_LIGHT_LIST_ACCENT_1 = (-174, "Light List Accent 1.") + """Light List Accent 1.""" + + TABLE_LIGHT_SHADING = (-159, "Light Shading.") + """Light Shading.""" + + TABLE_LIGHT_SHADING_ACCENT_1 = (-173, "Light Shading Accent 1.") + """Light Shading Accent 1.""" + + TABLE_MEDIUM_GRID_1 = (-166, "Medium Grid 1.") + """Medium Grid 1.""" + + TABLE_MEDIUM_GRID_2 = (-167, "Medium Grid 2.") + """Medium Grid 2.""" + + TABLE_MEDIUM_GRID_3 = (-168, "Medium Grid 3.") + """Medium Grid 3.""" + + TABLE_MEDIUM_LIST_1 = (-164, "Medium List 1.") + """Medium List 1.""" + + TABLE_MEDIUM_LIST_1_ACCENT_1 = (-178, "Medium List 1 Accent 1.") + """Medium List 1 Accent 1.""" + + TABLE_MEDIUM_LIST_2 = (-165, "Medium List 2.") + """Medium List 2.""" + + TABLE_MEDIUM_SHADING_1 = (-162, "Medium Shading 1.") + """Medium Shading 1.""" + + TABLE_MEDIUM_SHADING_1_ACCENT_1 = (-176, "Medium Shading 1 Accent 1.") + """Medium Shading 1 Accent 1.""" + + TABLE_MEDIUM_SHADING_2 = (-163, "Medium Shading 2.") + """Medium Shading 2.""" + + TABLE_MEDIUM_SHADING_2_ACCENT_1 = (-177, "Medium Shading 2 Accent 1.") + """Medium Shading 2 Accent 1.""" + + TABLE_OF_AUTHORITIES = (-45, "Table of Authorities.") + """Table of Authorities.""" + + TABLE_OF_FIGURES = (-36, "Table of Figures.") + """Table of Figures.""" + + TITLE = (-63, "Title.") + """Title.""" + + TOAHEADING = (-47, "TOA Heading.") + """TOA Heading.""" + + TOC_1 = (-20, "TOC 1.") + """TOC 1.""" + + TOC_2 = (-21, "TOC 2.") + """TOC 2.""" + + TOC_3 = (-22, "TOC 3.") + """TOC 3.""" + + TOC_4 = (-23, "TOC 4.") + """TOC 4.""" + + TOC_5 = (-24, "TOC 5.") + """TOC 5.""" + + TOC_6 = (-25, "TOC 6.") + """TOC 6.""" + + TOC_7 = (-26, "TOC 7.") + """TOC 7.""" + + TOC_8 = (-27, "TOC 8.") + """TOC 8.""" + + TOC_9 = (-28, "TOC 9.") + """TOC 9.""" + + +WD_STYLE = WD_BUILTIN_STYLE + + +class WD_STYLE_TYPE(BaseXmlEnum): + """Specifies one of the four style types: paragraph, character, list, or table. + + Example:: + + from docx import Document + from docx.enum.style import WD_STYLE_TYPE + + styles = Document().styles + assert styles[0].type == WD_STYLE_TYPE.PARAGRAPH + + MS API name: `WdStyleType` + + http://msdn.microsoft.com/en-us/library/office/ff196870.aspx + """ + + CHARACTER = (2, "character", "Character style.") + """Character style.""" + + LIST = (4, "numbering", "List style.") + """List style.""" + + PARAGRAPH = (1, "paragraph", "Paragraph style.") + """Paragraph style.""" + + TABLE = (3, "table", "Table style.") + """Table style.""" diff --git a/.venv/lib/python3.12/site-packages/docx/enum/table.py b/.venv/lib/python3.12/site-packages/docx/enum/table.py new file mode 100644 index 00000000..eb1eb9dc --- /dev/null +++ b/.venv/lib/python3.12/site-packages/docx/enum/table.py @@ -0,0 +1,136 @@ +"""Enumerations related to tables in WordprocessingML files.""" + +from docx.enum.base import BaseEnum, BaseXmlEnum + + +class WD_CELL_VERTICAL_ALIGNMENT(BaseXmlEnum): + """Alias: **WD_ALIGN_VERTICAL** + + Specifies the vertical alignment of text in one or more cells of a table. + + Example:: + + from docx.enum.table import WD_ALIGN_VERTICAL + + table = document.add_table(3, 3) + table.cell(0, 0).vertical_alignment = WD_ALIGN_VERTICAL.BOTTOM + + MS API name: `WdCellVerticalAlignment` + + https://msdn.microsoft.com/en-us/library/office/ff193345.aspx + """ + + TOP = (0, "top", "Text is aligned to the top border of the cell.") + """Text is aligned to the top border of the cell.""" + + CENTER = (1, "center", "Text is aligned to the center of the cell.") + """Text is aligned to the center of the cell.""" + + BOTTOM = (3, "bottom", "Text is aligned to the bottom border of the cell.") + """Text is aligned to the bottom border of the cell.""" + + BOTH = ( + 101, + "both", + "This is an option in the OpenXml spec, but not in Word itself. It's not" + " clear what Word behavior this setting produces. If you find out please" + " let us know and we'll update this documentation. Otherwise, probably best" + " to avoid this option.", + ) + """This is an option in the OpenXml spec, but not in Word itself. + + It's not clear what Word behavior this setting produces. If you find out please let + us know and we'll update this documentation. Otherwise, probably best to avoid this + option. + """ + + +WD_ALIGN_VERTICAL = WD_CELL_VERTICAL_ALIGNMENT + + +class WD_ROW_HEIGHT_RULE(BaseXmlEnum): + """Alias: **WD_ROW_HEIGHT** + + Specifies the rule for determining the height of a table row + + Example:: + + from docx.enum.table import WD_ROW_HEIGHT_RULE + + table = document.add_table(3, 3) + table.rows[0].height_rule = WD_ROW_HEIGHT_RULE.EXACTLY + + MS API name: `WdRowHeightRule` + + https://msdn.microsoft.com/en-us/library/office/ff193620.aspx + """ + + AUTO = ( + 0, + "auto", + "The row height is adjusted to accommodate the tallest value in the row.", + ) + """The row height is adjusted to accommodate the tallest value in the row.""" + + AT_LEAST = (1, "atLeast", "The row height is at least a minimum specified value.") + """The row height is at least a minimum specified value.""" + + EXACTLY = (2, "exact", "The row height is an exact value.") + """The row height is an exact value.""" + + +WD_ROW_HEIGHT = WD_ROW_HEIGHT_RULE + + +class WD_TABLE_ALIGNMENT(BaseXmlEnum): + """Specifies table justification type. + + Example:: + + from docx.enum.table import WD_TABLE_ALIGNMENT + + table = document.add_table(3, 3) + table.alignment = WD_TABLE_ALIGNMENT.CENTER + + MS API name: `WdRowAlignment` + + http://office.microsoft.com/en-us/word-help/HV080607259.aspx + """ + + LEFT = (0, "left", "Left-aligned") + """Left-aligned""" + + CENTER = (1, "center", "Center-aligned.") + """Center-aligned.""" + + RIGHT = (2, "right", "Right-aligned.") + """Right-aligned.""" + + +class WD_TABLE_DIRECTION(BaseEnum): + """Specifies the direction in which an application orders cells in the specified + table or row. + + Example:: + + from docx.enum.table import WD_TABLE_DIRECTION + + table = document.add_table(3, 3) + table.direction = WD_TABLE_DIRECTION.RTL + + MS API name: `WdTableDirection` + + http://msdn.microsoft.com/en-us/library/ff835141.aspx + """ + + LTR = ( + 0, + "The table or row is arranged with the first column in the leftmost position.", + ) + """The table or row is arranged with the first column in the leftmost position.""" + + RTL = ( + 1, + "The table or row is arranged with the first column in the rightmost position.", + ) + """The table or row is arranged with the first column in the rightmost position.""" diff --git a/.venv/lib/python3.12/site-packages/docx/enum/text.py b/.venv/lib/python3.12/site-packages/docx/enum/text.py new file mode 100644 index 00000000..99e776fe --- /dev/null +++ b/.venv/lib/python3.12/site-packages/docx/enum/text.py @@ -0,0 +1,367 @@ +"""Enumerations related to text in WordprocessingML files.""" + +from __future__ import annotations + +import enum + +from docx.enum.base import BaseXmlEnum + + +class WD_PARAGRAPH_ALIGNMENT(BaseXmlEnum): + """Alias: **WD_ALIGN_PARAGRAPH** + + Specifies paragraph justification type. + + Example:: + + from docx.enum.text import WD_ALIGN_PARAGRAPH + + paragraph = document.add_paragraph() + paragraph.alignment = WD_ALIGN_PARAGRAPH.CENTER + """ + + LEFT = (0, "left", "Left-aligned") + """Left-aligned""" + + CENTER = (1, "center", "Center-aligned.") + """Center-aligned.""" + + RIGHT = (2, "right", "Right-aligned.") + """Right-aligned.""" + + JUSTIFY = (3, "both", "Fully justified.") + """Fully justified.""" + + DISTRIBUTE = ( + 4, + "distribute", + "Paragraph characters are distributed to fill entire width of paragraph.", + ) + """Paragraph characters are distributed to fill entire width of paragraph.""" + + JUSTIFY_MED = ( + 5, + "mediumKashida", + "Justified with a medium character compression ratio.", + ) + """Justified with a medium character compression ratio.""" + + JUSTIFY_HI = ( + 7, + "highKashida", + "Justified with a high character compression ratio.", + ) + """Justified with a high character compression ratio.""" + + JUSTIFY_LOW = (8, "lowKashida", "Justified with a low character compression ratio.") + """Justified with a low character compression ratio.""" + + THAI_JUSTIFY = ( + 9, + "thaiDistribute", + "Justified according to Thai formatting layout.", + ) + """Justified according to Thai formatting layout.""" + + +WD_ALIGN_PARAGRAPH = WD_PARAGRAPH_ALIGNMENT + + +class WD_BREAK_TYPE(enum.Enum): + """Corresponds to WdBreakType enumeration. + + http://msdn.microsoft.com/en-us/library/office/ff195905.aspx. + """ + + COLUMN = 8 + LINE = 6 + LINE_CLEAR_LEFT = 9 + LINE_CLEAR_RIGHT = 10 + LINE_CLEAR_ALL = 11 # -- added for consistency, not in MS version -- + PAGE = 7 + SECTION_CONTINUOUS = 3 + SECTION_EVEN_PAGE = 4 + SECTION_NEXT_PAGE = 2 + SECTION_ODD_PAGE = 5 + TEXT_WRAPPING = 11 + + +WD_BREAK = WD_BREAK_TYPE + + +class WD_COLOR_INDEX(BaseXmlEnum): + """Specifies a standard preset color to apply. + + Used for font highlighting and perhaps other applications. + + * MS API name: `WdColorIndex` + * URL: https://msdn.microsoft.com/EN-US/library/office/ff195343.aspx + """ + + INHERITED = (-1, None, "Color is inherited from the style hierarchy.") + """Color is inherited from the style hierarchy.""" + + AUTO = (0, "default", "Automatic color. Default; usually black.") + """Automatic color. Default; usually black.""" + + BLACK = (1, "black", "Black color.") + """Black color.""" + + BLUE = (2, "blue", "Blue color") + """Blue color""" + + BRIGHT_GREEN = (4, "green", "Bright green color.") + """Bright green color.""" + + DARK_BLUE = (9, "darkBlue", "Dark blue color.") + """Dark blue color.""" + + DARK_RED = (13, "darkRed", "Dark red color.") + """Dark red color.""" + + DARK_YELLOW = (14, "darkYellow", "Dark yellow color.") + """Dark yellow color.""" + + GRAY_25 = (16, "lightGray", "25% shade of gray color.") + """25% shade of gray color.""" + + GRAY_50 = (15, "darkGray", "50% shade of gray color.") + """50% shade of gray color.""" + + GREEN = (11, "darkGreen", "Green color.") + """Green color.""" + + PINK = (5, "magenta", "Pink color.") + """Pink color.""" + + RED = (6, "red", "Red color.") + """Red color.""" + + TEAL = (10, "darkCyan", "Teal color.") + """Teal color.""" + + TURQUOISE = (3, "cyan", "Turquoise color.") + """Turquoise color.""" + + VIOLET = (12, "darkMagenta", "Violet color.") + """Violet color.""" + + WHITE = (8, "white", "White color.") + """White color.""" + + YELLOW = (7, "yellow", "Yellow color.") + """Yellow color.""" + + +WD_COLOR = WD_COLOR_INDEX + + +class WD_LINE_SPACING(BaseXmlEnum): + """Specifies a line spacing format to be applied to a paragraph. + + Example:: + + from docx.enum.text import WD_LINE_SPACING + + paragraph = document.add_paragraph() + paragraph.line_spacing_rule = WD_LINE_SPACING.EXACTLY + + + MS API name: `WdLineSpacing` + + URL: http://msdn.microsoft.com/en-us/library/office/ff844910.aspx + """ + + SINGLE = (0, "UNMAPPED", "Single spaced (default).") + """Single spaced (default).""" + + ONE_POINT_FIVE = (1, "UNMAPPED", "Space-and-a-half line spacing.") + """Space-and-a-half line spacing.""" + + DOUBLE = (2, "UNMAPPED", "Double spaced.") + """Double spaced.""" + + AT_LEAST = ( + 3, + "atLeast", + "Minimum line spacing is specified amount. Amount is specified separately.", + ) + """Minimum line spacing is specified amount. Amount is specified separately.""" + + EXACTLY = ( + 4, + "exact", + "Line spacing is exactly specified amount. Amount is specified separately.", + ) + """Line spacing is exactly specified amount. Amount is specified separately.""" + + MULTIPLE = ( + 5, + "auto", + "Line spacing is specified as multiple of line heights. Changing font size" + " will change line spacing proportionately.", + ) + """Line spacing is specified as multiple of line heights. Changing font size will + change the line spacing proportionately.""" + + +class WD_TAB_ALIGNMENT(BaseXmlEnum): + """Specifies the tab stop alignment to apply. + + MS API name: `WdTabAlignment` + + URL: https://msdn.microsoft.com/EN-US/library/office/ff195609.aspx + """ + + LEFT = (0, "left", "Left-aligned.") + """Left-aligned.""" + + CENTER = (1, "center", "Center-aligned.") + """Center-aligned.""" + + RIGHT = (2, "right", "Right-aligned.") + """Right-aligned.""" + + DECIMAL = (3, "decimal", "Decimal-aligned.") + """Decimal-aligned.""" + + BAR = (4, "bar", "Bar-aligned.") + """Bar-aligned.""" + + LIST = (6, "list", "List-aligned. (deprecated)") + """List-aligned. (deprecated)""" + + CLEAR = (101, "clear", "Clear an inherited tab stop.") + """Clear an inherited tab stop.""" + + END = (102, "end", "Right-aligned. (deprecated)") + """Right-aligned. (deprecated)""" + + NUM = (103, "num", "Left-aligned. (deprecated)") + """Left-aligned. (deprecated)""" + + START = (104, "start", "Left-aligned. (deprecated)") + """Left-aligned. (deprecated)""" + + +class WD_TAB_LEADER(BaseXmlEnum): + """Specifies the character to use as the leader with formatted tabs. + + MS API name: `WdTabLeader` + + URL: https://msdn.microsoft.com/en-us/library/office/ff845050.aspx + """ + + SPACES = (0, "none", "Spaces. Default.") + """Spaces. Default.""" + + DOTS = (1, "dot", "Dots.") + """Dots.""" + + DASHES = (2, "hyphen", "Dashes.") + """Dashes.""" + + LINES = (3, "underscore", "Double lines.") + """Double lines.""" + + HEAVY = (4, "heavy", "A heavy line.") + """A heavy line.""" + + MIDDLE_DOT = (5, "middleDot", "A vertically-centered dot.") + """A vertically-centered dot.""" + + +class WD_UNDERLINE(BaseXmlEnum): + """Specifies the style of underline applied to a run of characters. + + MS API name: `WdUnderline` + + URL: http://msdn.microsoft.com/en-us/library/office/ff822388.aspx + """ + + INHERITED = (-1, None, "Inherit underline setting from containing paragraph.") + """Inherit underline setting from containing paragraph.""" + + NONE = ( + 0, + "none", + "No underline.\n\nThis setting overrides any inherited underline value, so can" + " be used to remove underline from a run that inherits underlining from its" + " containing paragraph. Note this is not the same as assigning |None| to" + " Run.underline. |None| is a valid assignment value, but causes the run to" + " inherit its underline value. Assigning `WD_UNDERLINE.NONE` causes" + " underlining to be unconditionally turned off.", + ) + """No underline. + + This setting overrides any inherited underline value, so can be used to remove + underline from a run that inherits underlining from its containing paragraph. Note + this is not the same as assigning |None| to Run.underline. |None| is a valid + assignment value, but causes the run to inherit its underline value. Assigning + ``WD_UNDERLINE.NONE`` causes underlining to be unconditionally turned off. + """ + + SINGLE = ( + 1, + "single", + "A single line.\n\nNote that this setting is write-only in the sense that" + " |True| (rather than `WD_UNDERLINE.SINGLE`) is returned for a run having" + " this setting.", + ) + """A single line. + + Note that this setting is write-only in the sense that |True| + (rather than ``WD_UNDERLINE.SINGLE``) is returned for a run having this setting. + """ + + WORDS = (2, "words", "Underline individual words only.") + """Underline individual words only.""" + + DOUBLE = (3, "double", "A double line.") + """A double line.""" + + DOTTED = (4, "dotted", "Dots.") + """Dots.""" + + THICK = (6, "thick", "A single thick line.") + """A single thick line.""" + + DASH = (7, "dash", "Dashes.") + """Dashes.""" + + DOT_DASH = (9, "dotDash", "Alternating dots and dashes.") + """Alternating dots and dashes.""" + + DOT_DOT_DASH = (10, "dotDotDash", "An alternating dot-dot-dash pattern.") + """An alternating dot-dot-dash pattern.""" + + WAVY = (11, "wave", "A single wavy line.") + """A single wavy line.""" + + DOTTED_HEAVY = (20, "dottedHeavy", "Heavy dots.") + """Heavy dots.""" + + DASH_HEAVY = (23, "dashedHeavy", "Heavy dashes.") + """Heavy dashes.""" + + DOT_DASH_HEAVY = (25, "dashDotHeavy", "Alternating heavy dots and heavy dashes.") + """Alternating heavy dots and heavy dashes.""" + + DOT_DOT_DASH_HEAVY = ( + 26, + "dashDotDotHeavy", + "An alternating heavy dot-dot-dash pattern.", + ) + """An alternating heavy dot-dot-dash pattern.""" + + WAVY_HEAVY = (27, "wavyHeavy", "A heavy wavy line.") + """A heavy wavy line.""" + + DASH_LONG = (39, "dashLong", "Long dashes.") + """Long dashes.""" + + WAVY_DOUBLE = (43, "wavyDouble", "A double wavy line.") + """A double wavy line.""" + + DASH_LONG_HEAVY = (55, "dashLongHeavy", "Long heavy dashes.") + """Long heavy dashes.""" |