
    	                     x    S r SSKJr  SSKJr  SSKJr  SSKrSS jr\R                  " / SQ5      rS r	S	 r
S
 rg)z Utilities for manipulating text.    )absolute_import)division)unicode_literalsNc                 .    U S:X  a  U$ U=(       d    US-   $ )zPluralize word based on num.

Args:
  num: int, the number of objects to count.
  word: str, the word to pluralize.
  plural: str, the plural form of word if not "add s"

Returns:
  str: the plural or singular form of word in accord with num.
   s )numwordplurals      $lib/googlecloudsdk/core/util/text.py	Pluralizer      s     	AXK		4#:    ))secondr   )minute<   )houri  )dayiQ c                     U S   S;   a  S$ S$ )z&Gets article (a or an) for given noun.r   )aeiouanr   r	   )nouns    r   
GetArticler   /   s    a55>3>r   c                 F    U R                   S-  S-  S-  U R                  -   $ )zGRe-implementation of datetime.timedelta.total_seconds() for Python 2.6.   r   )daysseconds)deltas    r   _TotalSecondsr#   4   s#    	b2		"U]]	22r   c                     [        [        U 5      5      nUnSn[        R                  5        H  u  pEX:  a    O
UnX-  nM     SR	                  U[        X#5      5      $ )a  Pretty print the given time delta.

Rounds down.

>>> _PrettyTimeDelta(datetime.timedelta(seconds=0))
'0 seconds'
>>> _PrettyTimeDelta(datetime.timedelta(minutes=1))
'1 minute'
>>> _PrettyTimeDelta(datetime.timedelta(hours=2))
'2 hours'
>>> _PrettyTimeDelta(datetime.timedelta(days=3))
'3 days'

Args:
  delta: a datetime.timedelta object

Returns:
  str, a human-readable version of the time delta
r   z{0} {1})intr#   _SECONDS_PERitemsformatr   )r"   r!   r
   unitr   seconds_pers         r   PrettyTimeDeltar+   9   sb    ( e$%'#	$$**,naD

 C	 -
 
		#y3	44r   )N)__doc__
__future__r   r   r   collectionsr   OrderedDictr&   r   r#   r+   r	   r   r   <module>r0      sA    ' &  '  && ( ?
3
5r   