
    i                     @    d Z ddlmZmZmZmZ ddl  G d de      Zy)z
    podgen.person
    ~~~~~~~~~~~~~

    This file contains the Person class, which is used to represent a person or
    an entity.

    :copyright: 2016, Thorben Dahl <thorben@sjostrom.no>
    :license: FreeBSD and LGPL, see license.* for more details.
    )absolute_importdivisionprint_functionunicode_literals)*c                       e Zd ZdZddZd Zed        Zej                  d        Zed        Z	e	j                  d        Z	d	 Z
d
 Zy)Personac  Data-oriented class representing a single person or entity.

    A Person can represent both real persons and less personal entities like
    organizations. Example::

        >>> p.authors = [Person("Example Radio", "mail@example.org")]

    .. note::

        At any time, one of name or email must be present.
        Both cannot be None or empty at the same time.

    .. warning::

        **Any names and email addresses** you put into a Person object will
        eventually be included and **published** together with
        the feed. If you want to keep a name or email address private, then you
        must make sure it isn't used in a Person object (or to be precise: that
        the Person object with the name or email address isn't used in any
        Podcast or Episode.)

    Example of use::

        >>> from podgen import Person
        >>> Person("John Doe")
        Person(name=John Doe, email=None)
        >>> Person(email="johndoe@example.org")
        Person(name=None, email=johndoe@example.org)
        >>> Person()
        ValueError: You must provide either a name or an email address.

    Nc                 Z    | j                  ||      st        d      || _        || _        y)a  Create new person with a name, email or both.

        You don't need to provide both a name and an email, but you must
        provide one of them.

        :param name: This person's name.
        :type name: str or None
        :param email: This person's email address. The address it made public
            when the feed is published, so be careful about adding a personal
            email address here. The spambots are always on lookout!
        :type email: str or None

        z3You must provide either a name or an email address.N)	_is_valid
ValueError_Person__name_Person__emailselfnameemails      F/root/podcast_feed/.venv/lib/python3.12/site-packages/podgen/person.py__init__zPerson.__init__3   s2     ~~dE* ( ) )    c                     |xs |S )z/Check whether one of name and email are usable. r   s      r   r   zPerson._is_validG   s    }ur   c                     | j                   S )z7This person's name.

        :type: :obj:`str`
        )r   r   s    r   r   zPerson.nameK   s     {{r   c                     | j                  || j                        st        d|d| j                  d      || _        y )NzCThe name or email must be present at any time, cannot set name to "z" as long as email is "")r   r   r   r   )r   new_names     r   r   zPerson.nameS   s:    ~~h

3)14::? @ @ r   c                     | j                   S )zGThis person's public email address.

        :type: :obj:`str`
        )r   r   s    r   r   zPerson.email[   s     ||r   c                     | j                  | j                  |      st        d|d| j                  d      || _        y )NzDThe name or email must be present at any time, cannot set email to "z" as long as name is "r   )r   r   r   r   )r   	new_emails     r   r   zPerson.emailc   s:    ~~dii3)2DII? @ @ !r   c                     | j                   | j                  S | j                  | j                   S | j                   d| j                  dS )Nz ())r   r   r   s    r   __str__zPerson.__str__k   s=    ::99YY:: $

DII66r   c                 <    d| j                   d| j                  dS )NzPerson(name=z, email=r!   )r   r   r   s    r   __repr__zPerson.__repr__s   s    .2iiDDr   )NN)__name__
__module____qualname____doc__r   r   propertyr   setterr   r"   r$   r   r   r   r	   r	      su    B(   
[[    \\! !7Er   r	   N)	r(   
__future__r   r   r   r   builtinsobjectr	   r   r   r   <module>r.      s&   	 S R cEV cEr   