Ejemplo n.º 1
0
    3: u"триста",
    4: u"четыреста",
    5: u"пятьсот",
    6: u"шестьсот",
    7: u"семьсот",
    8: u"восемьсот",
    9: u"девятьсот",
    }  #: Hundreds

MALE = 1    #: sex - male
FEMALE = 2  #: sex - female
NEUTER = 3  #: sex - neuter


@takes((int, long, float, Decimal),
       optional(int),
       signs=optional(int))
def _get_float_remainder(fvalue, signs=9):
    """
    Get remainder of float, i.e. 2.05 -> '05'

    @param fvalue: input value
    @type fvalue: C{int}, C{long}, C{float} or C{Decimal}

    @param signs: maximum number of signs
    @type signs: C{int} or C{long}

    @return: remainder
    @rtype: C{str}

    @raise L{pytils.err.InputParameterError}: input parameters' check failed
Ejemplo n.º 2
0
    (u"ноя", u"ноябрь", u"ноября"),
    (u"дек", u"декабрь", u"декабря"),
)  #: Month names (abbreviated, full, inflected)

DAY_NAMES = ((u"пн", u"понедельник", u"понедельник",
              u"в\xa0"), (u"вт", u"вторник", u"вторник",
                          u"во\xa0"), (u"ср", u"среда", u"среду", u"в\xa0"),
             (u"чт", u"четверг", u"четверг",
              u"в\xa0"), (u"пт", u"пятница", u"пятницу",
                          u"в\xa0"), (u"сб", u"суббота", u"субботу", u"в\xa0"),
             (u"вск", u"воскресенье", u"воскресенье", u"в\xa0")
             )  #: Day names (abbreviated, full, inflected, preposition)


@takes((int, float, datetime.datetime),
       optional(int),
       optional((int, float, datetime.datetime)),
       accuracy=optional(int),
       to_time=optional((int, float, datetime.datetime)))
@returns(unicode)
def distance_of_time_in_words(from_time, accuracy=1, to_time=None):
    """
    Represents distance of time in words

    @param from_time: source time (in seconds from epoch)
    @type from_time: C{int}, C{float} or C{datetime.datetime}

    @param accuracy: level of accuracy (1..3), default=1
    @type accuracy: C{int}

    @param to_time: target time (in seconds from epoch),
Ejemplo n.º 3
0
    2: u"двести",
    3: u"триста",
    4: u"четыреста",
    5: u"пятьсот",
    6: u"шестьсот",
    7: u"семьсот",
    8: u"восемьсот",
    9: u"девятьсот",
}  #: Hundreds

MALE = 1  #: sex - male
FEMALE = 2  #: sex - female
NEUTER = 3  #: sex - neuter


@takes((int, long, float), optional(int), signs=optional(int))
def _get_float_remainder(fvalue, signs=9):
    """
    Get remainder of float, i.e. 2.05 -> '05'

    @param fvalue: input value
    @type fvalue: C{int}, C{long} or C{float}

    @param signs: maximum number of signs
    @type signs: C{int} or C{long}

    @return: remainder
    @rtype: C{str}

    @raise L{pytils.err.InputParameterError}: input parameters' check failed
        (fvalue neither C{int}, no C{float})
Ejemplo n.º 4
0
    (u"ноя", u"ноябрь", u"ноября"),
    (u"дек", u"декабрь", u"декабря"),
    )  #: Month names (abbreviated, full, inflected)

DAY_NAMES = (
    (u"пн", u"понедельник", u"понедельник", u"в\xa0"),
    (u"вт", u"вторник", u"вторник", u"во\xa0"),
    (u"ср", u"среда", u"среду", u"в\xa0"),
    (u"чт", u"четверг", u"четверг", u"в\xa0"),
    (u"пт", u"пятница", u"пятницу", u"в\xa0"),
    (u"сб", u"суббота", u"субботу", u"в\xa0"),
    (u"вск", u"воскресенье", u"воскресенье", u"в\xa0")
    )  #: Day names (abbreviated, full, inflected, preposition)

@takes((int, float, datetime.datetime),
       optional(int),
       optional((int, float, datetime.datetime)),
       accuracy=optional(int),
       to_time=optional((int, float, datetime.datetime)))
@returns(unicode)
def distance_of_time_in_words(from_time, accuracy=1, to_time=None):
    """
    Represents distance of time in words

    @param from_time: source time (in seconds from epoch)
    @type from_time: C{int}, C{float} or C{datetime.datetime}

    @param accuracy: level of accuracy (1..3), default=1
    @type accuracy: C{int}

    @param to_time: target time (in seconds from epoch),