File: //home/arjun/projects/env/lib/python3.10/site-packages/docx/__pycache__/api.cpython-310.pyc
o
$we� � @ sT d Z ddlmZ ddlZddlmZ ddlmZ ddl m
Z
d
dd d
�Zdd� ZdS )z�Directly exposed API functions and classes, :func:`Document` for now.
Provides a syntactically more convenient API for interacting with the OpcPackage graph.
� )�annotationsN)�IO)�CONTENT_TYPE)�Package�docx�str | IO[bytes] | Nonec C sF | du rt � n| } t�| �j}|jtjkr d}t|| |jf ��|jS )z�Return a |Document| object loaded from `docx`, where `docx` can be either a path
to a ``.docx`` file (a string) or a file-like object.
If `docx` is missing or ``None``, the built-in default document "template" is
loaded.
Nz2file '%s' is not a Word file, content type is '%s') �_default_docx_pathr �open�main_document_part�content_type�CT�WML_DOCUMENT_MAIN�
ValueError�document)r �
document_part�tmpl� r �A/home/arjun/projects/env/lib/python3.10/site-packages/docx/api.py�Document s r c C s t j�t�d } t j�| dd�S )z6Return the path to the built-in default .docx package.r � templateszdefault.docx)�os�path�split�__file__�join)�_thisdirr r r r s r )N)r r )
�__doc__�
__future__r r �typingr �docx.opc.constantsr r �docx.packager r r r r r r �<module> s