Package pytils :: Module dt
[hide private]

Module dt

source code

Russian dates without locales

Functions [hide private]
unicode
distance_of_time_in_words(from_time, accuracy=1, to_time=None)
Represents distance of time in words
source code
unicode
ru_strftime(format=u'%d.%m.%Y', date=None, inflected=False, inflected_day=False)
Russian strftime without locale
source code
Variables [hide private]
  __revision__ = '$Id: dt.py 63 2007-01-02 09:22:16Z the.pythy $'
  __id__ = '$Id: dt.py 63 2007-01-02 09:22:16Z the.pythy $'
  __url__ = '$URL: https://pythy.googlecode.com/svn/trunk/pytils...
  DAY_ALTERNATIVES = {1: (u'\u0432\u0447\u0435\u0440\u0430', u'\...
Day alternatives (i.e.
  DAY_VARIANTS = (u'\u0434\u0435\u043d\u044c', u'\u0434\u043d\u0...
Forms (1, 2, 5) for noun 'day'
  HOUR_VARIANTS = (u'\u0447\u0430\u0441', u'\u0447\u0430\u0441\u...
Forms (1, 2, 5) for noun 'hour'
  MINUTE_VARIANTS = (u'\u043c\u0438\u043d\u0443\u0442\u0443', u'...
Forms (1, 2, 5) for noun 'minute'
  PREFIX_IN = u'\u0447\u0435\u0440\u0435\u0437'
Prefix 'in' (i.e.
  SUFFIX_AGO = u'\u043d\u0430\u0437\u0430\u0434'
Prefix 'ago' (i.e.
  MONTH_NAMES = ((u'\u044f\u043d\u0432', u'\u044f\u043d\u0432\u0...
Month names (abbreviated, full, inflected)
  DAY_NAMES = ((u'\u043f\u043d', u'\u043f\u043e\u043d\u0435\u043...
Day names (abbreviated, full, inflected)
Function Details [hide private]

distance_of_time_in_words(from_time, accuracy=1, to_time=None)

source code 
Represents distance of time in words
Parameters:
  • from_time (int, float or datetime.datetime) - source time (in seconds from epoch)
  • accuracy (int) - level of accuracy (1..3), default=1
  • to_time (int, float or datetime.datetime) - target time (in seconds from epoch), default=None translates to current time
Returns: unicode
distance of time in words
Raises:
  • TypeError - input parameters' check failed
  • ValueError - accuracy is lesser or equal zero

ru_strftime(format=u'%d.%m.%Y', date=None, inflected=False, inflected_day=False)

source code 
Russian strftime without locale
Parameters:
  • format (unicode) - strftime format, default=u'%d.%m.%Y'
  • date (datetime.date or datetime.datetime) - date value, default=None translates to today
Returns: unicode
strftime string
Raises:
  • TypeError - input parameters' check failed

Variables Details [hide private]

__url__

Value:
'$URL: https://pythy.googlecode.com/svn/trunk/pytils/pytils/dt.py $'

DAY_ALTERNATIVES

Day alternatives (i.e. one day ago -> yesterday)
Value:
{1: (u'\u0432\u0447\u0435\u0440\u0430',
     u'\u0437\u0430\u0432\u0442\u0440\u0430'),
 2: (u'\u043f\u043e\u0437\u0430\u0432\u0447\u0435\u0440\u0430',
     u'\u043f\u043e\u0441\u043b\u0435\u0437\u0430\u0432\u0442\u0440\u0\
430')}

DAY_VARIANTS

Forms (1, 2, 5) for noun 'day'
Value:
(u'\u0434\u0435\u043d\u044c',
 u'\u0434\u043d\u044f',
 u'\u0434\u043d\u0435\u0439')

HOUR_VARIANTS

Forms (1, 2, 5) for noun 'hour'
Value:
(u'\u0447\u0430\u0441',
 u'\u0447\u0430\u0441\u0430',
 u'\u0447\u0430\u0441\u043e\u0432')

MINUTE_VARIANTS

Forms (1, 2, 5) for noun 'minute'
Value:
(u'\u043c\u0438\u043d\u0443\u0442\u0443',
 u'\u043c\u0438\u043d\u0443\u0442\u044b',
 u'\u043c\u0438\u043d\u0443\u0442')

PREFIX_IN

Prefix 'in' (i.e. in three hours)
Value:
u'\u0447\u0435\u0440\u0435\u0437'

SUFFIX_AGO

Prefix 'ago' (i.e. three hours ago)
Value:
u'\u043d\u0430\u0437\u0430\u0434'

MONTH_NAMES

Month names (abbreviated, full, inflected)
Value:
((u'\u044f\u043d\u0432',
  u'\u044f\u043d\u0432\u0430\u0440\u044c',
  u'\u044f\u043d\u0432\u0430\u0440\u044f'),
 (u'\u0444\u0435\u0432',
  u'\u0444\u0435\u0432\u0440\u0430\u043b\u044c',
  u'\u0444\u0435\u0432\u0440\u0430\u043b\u044f'),
 (u'\u043c\u0430\u0440',
  u'\u043c\u0430\u0440\u0442',
...

DAY_NAMES

Day names (abbreviated, full, inflected)
Value:
((u'\u043f\u043d',
  u'\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\
',
  u'\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\
'),
 (u'\u0432\u0442',
  u'\u0432\u0442\u043e\u0440\u043d\u0438\u043a',
  u'\u0432\u0442\u043e\u0440\u043d\u0438\u043a'),
...