MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/alt/python35/lib/python3.5/site-packages/humanize/__pycache__/time.cpython-35.pyc


�dT��@s�dZddlZddlmZmZmZddlmZmZdddd	gZ	d
d�Z
dd
�Zdd�Zddd�Z
dddd�Zddd�Zdd	�ZdS)zZTime humanizing functions.  These are largely borrowed from Django's
``contrib.humanize``.�N)�datetime�	timedelta�date�)�ngettext�gettext�naturaldelta�naturaltime�
naturalday�naturaldatecCs
tj�S)N)r�now�r
r
�/time.py�_nowsrcCs(|jdkr$t�}|||S|S)zUReturns an "absolute" value for a timedelta, always representing a
    time distance.r)�daysr)�deltarr
r
r�
abs_timedeltas	rcCs�t�}t|t�r+|}||}npt|t�rM||}|}nNy)t|�}td|�}||}Wn"ttfk
r�d|fSYnX|t|�fS)z�Turn a value into a date and a timedelta which represents how long ago
    it was.  If that's not possible, return (None, value).�secondsN)r�
isinstancerr�int�
ValueError�	TypeErrorr)�valuerrrr
r
r�date_and_deltas	

	rTcCs�t�}t|�\}}|dkr+|S|}t|j�}t|j�}|d}|d}t|d�}|r�|dkr�|dkr�td�S|dkr�td�S|dkr�td	d
|�|Sd|ko�dknr�td�Sd|kod
knr2|d}	tdd|	�|	Sd
|koId"knrXtd�Sd
|kr�|d
}
tdd|
�|
Sn|dkr|dkr�td�S|s�tdd|�|S|s�tdd|�|S|dkr�td�Stdd|�|Sn�|dkr�|r,|r,td�S|sFtdd|�|S|ry|dkrbtd�Stdd|�|Sq�tdd|�|Sntd d!|�|SdS)#a2Given a timedelta or a number of seconds, return a natural
    representation of the amount of time elapsed.  This is similar to
    ``naturaltime``, but does not add tense to the result.  If ``months``
    is True, then a number of months (based on 30.5 days) will be used
    for fuzziness between years.Nimg�>@rrza momentza second�<z	%d secondz
%d seconds�xza minuteiz	%d minutez
%d minutes�zan hourz%d hourz%d hoursza dayz%d dayz%d daysza monthz%d monthz	%d monthsza yearz1 year, %d dayz1 year, %d daysz1 year, 1 monthz1 year, %d monthz1 year, %d monthsz%d yearz%d yearsi )rr�absrrr�_r)r�monthsrrrZ
use_monthsrrZyearsZminutesZhoursr
r
rr*sb	











FcCs�t�}t|�\}}|dkr+|St|ttf�rL||k}|r^td�n	td�}t||�}|td�kr�td�S||S)a�Given a datetime or a number of seconds, return a natural representation
    of that time in a resolution that makes sense.  This is more or less
    compatible with Django's ``naturaltime`` filter.  ``future`` is ignored for
    datetimes, where the tense is always figured out based on the current time.
    If an integer is passed, the return value will be past tense by default,
    unless ``future`` is set to True.Nz%s from nowz%s agoza momentr)rrrrrrr)r�futurerrrrZagor
r
rr	ks	
z%b %dcCs�yt|j|j|j�}Wn1tk
r7|SYnttfk
rR|SYnX|tj�}|jdkr|t	d�S|jdkr�t	d�S|jdkr�t	d�S|j
|�S)z�For date values that are tomorrow, today or yesterday compared to
    present day returns representing string. Otherwise, returns a string
    formatted according to ``format``.r�todayrZtomorrowZ	yesterday���)r�year�month�day�AttributeError�
OverflowErrorrr!rr�strftime)r�formatrr
r
rr
�s
	


cCs�yt|j|j|j�}Wn1tk
r7|SYnttfk
rR|SYnXt|tj��}|j	dkr�t
|d�St
|�S)zRLike naturalday, but will append a year for dates that are a year
    ago or more.imz%b %d %Y)rr#r$r%r&r'rrr!rr
)rrr
r
rr�s
	
)�__doc__�timerrrZi18nrrr�__all__rrrrr	r
rr
r
r
r�<module>sA