U
    "FZhp
  ã                   @   sà   d Z ddlZddlmZ eedœdd„Zeedœdd	„Zeed
œdd„Zeedœdd„Z	eedœdd„Z
ejedœdd„Zeedœdd„Zeedœdd„Zeedœdd„Zeedœdd„Zeedœdd „Zeejdœd!d"„ZdS )#z"Contains the Duration helper APIs.é    N)ÚDuration)ÚvalueÚreturnc                 C   s   t ƒ }| | ¡ |S )a.  Converts a string to Duration.

  Args:
    value: A string to be converted. The string must end with 's'. Any
      fractional digits (or none) are accepted as long as they fit into
      precision. For example: "1s", "1.01s", "1.0000001s", "-3.100s"

  Raises:
    ValueError: On parsing problems.
  )r   ZFromJsonString)r   Úduration© r   ú_/home/aprabhat/apps/x.techxrdev.in/venv/lib/python3.8/site-packages/google/protobuf/duration.pyÚfrom_json_string   s    
r   )Úmicrosr   c                 C   s   t ƒ }| | ¡ |S )z"Converts microseconds to Duration.)r   ZFromMicroseconds)r	   r   r   r   r   Úfrom_microseconds   s    
r
   )Úmillisr   c                 C   s   t ƒ }| | ¡ |S )z"Converts milliseconds to Duration.)r   ZFromMilliseconds)r   r   r   r   r   Úfrom_milliseconds&   s    
r   )Únanosr   c                 C   s   t ƒ }| | ¡ |S )z!Converts nanoseconds to Duration.)r   ZFromNanoseconds)r   r   r   r   r   Úfrom_nanoseconds-   s    
r   )Úsecondsr   c                 C   s   t ƒ }| | ¡ |S )zConverts seconds to Duration.)r   ZFromSeconds)r   r   r   r   r   Úfrom_seconds4   s    
r   )Útdr   c                 C   s   t ƒ }| | ¡ |S )zConverts timedelta to Duration.)r   ZFromTimedelta)r   r   r   r   r   Úfrom_timedelta;   s    
r   )r   r   c                 C   s   |   ¡ S )a  Converts Duration to string format.

  Returns:
    A string converted from self. The string format will contains
    3, 6, or 9 fractional digits depending on the precision required to
    represent the exact Duration value. For example: "1s", "1.010s",
    "1.000000100s", "-3.100s"
  )ZToJsonString©r   r   r   r   Úto_json_stringB   s    	r   c                 C   s   |   ¡ S )z$Converts a Duration to microseconds.)ZToMicrosecondsr   r   r   r   Úto_microsecondsN   s    r   c                 C   s   |   ¡ S )z$Converts a Duration to milliseconds.)ZToMillisecondsr   r   r   r   Úto_millisecondsS   s    r   c                 C   s   |   ¡ S )z#Converts a Duration to nanoseconds.)ZToNanosecondsr   r   r   r   Úto_nanosecondsX   s    r   c                 C   s   |   ¡ S )zConverts a Duration to seconds.)Z	ToSecondsr   r   r   r   Ú
to_seconds]   s    r   c                 C   s   |   ¡ S )zConverts Duration to timedelta.)ZToTimedeltar   r   r   r   Úto_timedeltab   s    r   )Ú__doc__ÚdatetimeZgoogle.protobuf.duration_pb2r   Ústrr   Úfloatr
   r   r   r   Ú	timedeltar   r   Úintr   r   r   r   r   r   r   r   r   Ú<module>   s   