
    ,h                         d Z ddlmZ ddlZ G d de      Z G d de      Z G d d	e      Z G d
 de      Z G d de      Z	 G d de      Z
 G d de      Z G d de      Zy)zUtility functions and classes.    )divisionNc                       e Zd ZdZdZdZdZdZdZd Z	e
d        Ze
d	        Ze
d
        Ze
d        Ze
d        Ze
d        Zy)Lengthz
    Base class for length classes Inches, Emu, Cm, Mm, Pt, and Px. Provides
    properties for converting length values to convenient units.
    i    i@~ i  i1  c                 .    t         j                  | |      S N)int__new__clsemus     K/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/util.pyr
   zLength.__new__   s    {{3$$    c                 2    | t        | j                        z  S )z1
        Floating point length in inches
        )float_EMUS_PER_INCHselfs    r   incheszLength.inches   s    
 eD//000r   c                      | | j                   z  S )z
        Integer length in hundredths of a point (1/7200 inch). Used
        internally because PowerPoint stores font size in centipoints.
        )_EMUS_PER_CENTIPOINTr   s    r   centipointszLength.centipoints    s     t0000r   c                 2    | t        | j                        z  S )z6
        Floating point length in centimeters
        )r   _EMUS_PER_CMr   s    r   cmz	Length.cm(       
 eD--...r   c                     | S )z8
        Integer length in English Metric Units
         r   s    r   r   z
Length.emu/   s	    
 r   c                 2    | t        | j                        z  S )z6
        Floating point length in millimeters
        )r   _EMUS_PER_MMr   s    r   mmz	Length.mm6   r   r   c                 2    | t        | j                        z  S )z1
        Floating point length in points
        )r   _EMUS_PER_PTr   s    r   ptz	Length.pt=   r   r   N)__name__
__module____qualname____doc__r   r   r   r    r#   r
   propertyr   r   r   r   r!   r$   r   r   r   r   r   
   s    
 NLLL% 1 1 1 1 / /   / / / /r   r   c                       e Zd ZdZd Zy)Inchesz6
    Convenience constructor for length in inches
    c                 f    t        |t        j                  z        }t        j                  | |      S r   )r	   r   r   r
   )r   r   r   s      r   r
   zInches.__new__J   s(    &60001~~c3''r   Nr%   r&   r'   r(   r
   r   r   r   r+   r+   E       (r   r+   c                       e Zd ZdZd Zy)CentipointszE
    Convenience constructor for length in hundredths of a point
    c                 f    t        |t        j                  z        }t        j                  | |      S r   )r	   r   r   r
   )r   r   r   s      r   r
   zCentipoints.__new__T   s(    + ; ;;<~~c3''r   Nr-   r   r   r   r0   r0   O   r.   r   r0   c                       e Zd ZdZd Zy)Cmz;
    Convenience constructor for length in centimeters
    c                 f    t        |t        j                  z        }t        j                  | |      S r   )r	   r   r   r
   )r   r   r   s      r   r
   z
Cm.__new__^   (    "v***+~~c3''r   Nr-   r   r   r   r3   r3   Y   r.   r   r3   c                       e Zd ZdZd Zy)EmuzD
    Convenience constructor for length in english metric units
    c                 @    t         j                  | t        |            S r   )r   r
   r	   r   s     r   r
   zEmu.__new__h   s    ~~c3s8,,r   Nr-   r   r   r   r7   r7   c   s    -r   r7   c                       e Zd ZdZd Zy)Mmz;
    Convenience constructor for length in millimeters
    c                 f    t        |t        j                  z        }t        j                  | |      S r   )r	   r   r    r
   )r   r!   r   s      r   r
   z
Mm.__new__q   r5   r   Nr-   r   r   r   r:   r:   l   r.   r   r:   c                       e Zd ZdZd Zy)PtzC
    Convenience value class for specifying a length in points
    c                 f    t        |t        j                  z        }t        j                  | |      S r   )r	   r   r#   r
   )r   pointsr   s      r   r
   z
Pt.__new__{   s(    &6.../~~c3''r   Nr-   r   r   r   r=   r=   v   r.   r   r=   c                   $    e Zd ZdZd ZddZd Zy)lazypropertya@  Decorator like @property, but evaluated only on first access.

    Like @property, this can only be used to decorate methods having only
    a `self` parameter, and is accessed like an attribute on an instance,
    i.e. trailing parentheses are not used. Unlike @property, the decorated
    method is only evaluated on first access; the resulting value is cached
    and that same value returned on second and later access without
    re-evaluation of the method.

    Like @property, this class produces a *data descriptor* object, which is
    stored in the __dict__ of the *class* under the name of the decorated
    method ('fget' nominally). The cached value is stored in the __dict__ of
    the *instance* under that same name.

    Because it is a data descriptor (as opposed to a *non-data descriptor*),
    its `__get__()` method is executed on each access of the decorated
    attribute; the __dict__ item of the same name is "shadowed" by the
    descriptor.

    While this may represent a performance improvement over a property, its
    greater benefit may be its other characteristics. One common use is to
    construct collaborator objects, removing that "real work" from the
    constructor, while still only executing once. It also de-couples client
    code from any sequencing considerations; if it's accessed from more than
    one location, it's assured it will be ready whenever needed.

    Loosely based on: https://stackoverflow.com/a/6849299/1902513.

    A lazyproperty is read-only. There is no counterpart to the optional
    "setter" (or deleter) behavior of an @property. This is critically
    important to maintaining its immutability and idempotence guarantees.
    Attempting to assign to a lazyproperty raises AttributeError
    unconditionally.

    The parameter names in the methods below correspond to this usage
    example::

        class Obj(object)

            @lazyproperty
            def fget(self):
                return 'some result'

        obj = Obj()

    Not suitable for wrapping a function (as opposed to a method) because it
    is not callable.
    c                 >    || _         t        j                  | |       y)aY  *fget* is the decorated method (a "getter" function).

        A lazyproperty is read-only, so there is only an *fget* function (a
        regular @property can also have an fset and fdel function). This name
        was chosen for consistency with Python's `property` class which uses
        this name for the corresponding parameter.
        N)_fget	functoolsupdate_wrapper)r   fgets     r   __init__zlazyproperty.__init__   s     
  t,r   Nc                     || S |j                   j                  | j                        }|*| j                  |      }||j                   | j                  <   |S )a  Called on each access of 'fget' attribute on class or instance.

        *self* is this instance of a lazyproperty descriptor "wrapping" the
        property method it decorates (`fget`, nominally).

        *obj* is the "host" object instance when the attribute is accessed
        from an object instance, e.g. `obj = Obj(); obj.fget`. *obj* is None
        when accessed on the class, e.g. `Obj.fget`.

        *type* is the class hosting the decorated getter method (`fget`) on
        both class and instance attribute access.
        )__dict__getr%   rC   )r   objtypevalues       r   __get__zlazyproperty.__get__   sS     ;K   /= JJsOE*/CLL'r   c                     t        d      )a  Raises unconditionally, to preserve read-only behavior.

        This decorator is intended to implement immutable (and idempotent)
        object attributes. For that reason, assignment to this property must
        be explicitly prevented.

        If this __set__ method was not present, this descriptor would become
        a *non-data descriptor*. That would be nice because the cached value
        would be accessed directly once set (__dict__ attrs have precedence
        over non-data descriptors on instance attribute lookup). The problem
        is, there would be nothing to stop assignment to the cached value,
        which would overwrite the result of `fget()` and break both the
        immutability and idempotence guarantees of this decorator.

        The performance with this __set__() method in place was roughly 0.4
        usec per access when measured on a 2.8GHz development machine; so
        quite snappy and probably not a rich target for optimization efforts.
        zcan't set attribute)AttributeError)r   rK   rM   s      r   __set__zlazyproperty.__set__   s    & 233r   r   )r%   r&   r'   r(   rG   rN   rQ   r   r   r   rA   rA      s    /b-84r   rA   )r(   
__future__r   rD   r	   r   r+   r0   r3   r7   r:   r=   objectrA   r   r   r   <module>rT      ss    %  8/S 8/v(V ((& (( (-& -( (( (n46 n4r   