PK!fЁ pendulum/__init__.py# -*- coding: utf-8 -*- # Types from .pendulum import Pendulum from .date import Date from .time import Time from .interval import Interval from .period import Period # Mimicking standard library date = Date time = Time # Constants from .constants import ( MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY, YEARS_PER_CENTURY, YEARS_PER_DECADE, MONTHS_PER_YEAR, WEEKS_PER_YEAR, DAYS_PER_WEEK, HOURS_PER_DAY, MINUTES_PER_HOUR, SECONDS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY ) from .tz.timezone import Timezone from .mixins.default import TranslatableMixin, FormattableMixing, TestableMixin from ._global import Global PRE_TRANSITION = Timezone.PRE_TRANSITION POST_TRANSITION = Timezone.POST_TRANSITION TRANSITION_ERROR = Timezone.TRANSITION_ERROR # Global helpers test = Global.test set_test_now = Global.set_test_now has_test_now = Global.has_test_now get_test_now = Global.get_test_now set_locale = Global.set_locale get_locale = Global.get_locale translator = Global.translator set_translator = Global.set_translator set_formatter = Global.set_formatter get_formatter = Global.get_formatter # Helpers from .parser import parse instance = Pendulum.instance now = Pendulum.now utcnow = Pendulum.utcnow today = Pendulum.today tomorrow = Pendulum.tomorrow yesterday = Pendulum.yesterday create = Pendulum.create from_format = Pendulum.create_from_format strptime = Pendulum.strptime from_timestamp = Pendulum.create_from_timestamp set_to_string_format = Pendulum.set_to_string_format reset_to_string_format = Pendulum.reset_to_string_format set_transition_rule = Pendulum.set_transition_rule get_transition_rule = Pendulum.get_transition_rule # Standard helpers min = Pendulum.min max = Pendulum.max fromtimestamp = Pendulum.fromtimestamp utcfromtimestamp = Pendulum.utcfromtimestamp fromordinal = Pendulum.fromordinal combine = Pendulum.combine # Interval interval = Interval # Period period = Period # Timezones from .tz import timezone, timezones, local_timezone, UTC def datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, tz=None, dst_rule=None): fold = None if dst_rule == POST_TRANSITION: fold = 1 elif dst_rule == PRE_TRANSITION: fold = 0 return Pendulum( year, month, day, hour, minute, second, microsecond, tzinfo=tzinfo or tz or UTC, fold=fold ) PK!VTDDpendulum/_compat.py# -*- coding: utf-8 -*- import sys PY2 = sys.version_info[0] == 2 PY3K = sys.version_info[0] >= 3 PY36 = sys.version_info >= (3, 6) try: # Python 2 long unicode basestring except NameError: # Python 3 long = int unicode = str basestring = str try: # Python >= 3.3 FileNotFoundError = FileNotFoundError except NameError: # Python < 3.3 FileNotFoundError = IOError # cf PEP-3151 def decode(string, encodings=None): if not PY2 and not isinstance(string, bytes): return string if PY2 and isinstance(string, unicode): return string encodings = encodings or ['utf-8', 'latin1', 'ascii'] for encoding in encodings: try: return string.decode(encoding) except (UnicodeEncodeError, UnicodeDecodeError): pass return string.decode(encodings[0], errors='ignore') def encode(string, encodings=None): if not PY2 and isinstance(string, bytes): return string if PY2 and isinstance(string, str): return string encodings = encodings or ['utf-8', 'latin1', 'ascii'] for encoding in encodings: try: return string.encode(encoding) except (UnicodeEncodeError, UnicodeDecodeError): pass return string.encode(encodings[0], errors='ignore') PK! pendulum/_extensions/__init__.pyPK!+)}g}gpendulum/_extensions/_helpers.c/* ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include #include #ifndef PyVarObject_HEAD_INIT #define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, #endif #if PY_MAJOR_VERSION < 3 #define PyLong_FromLong PyInt_FromLong #endif /* ------------------------------------------------------------------------- */ #define EPOCH_YEAR 1970 #define DAYS_PER_N_YEAR 365 #define DAYS_PER_L_YEAR 366 #define USECS_PER_SEC 1000000 #define SECS_PER_MIN 60 #define SECS_PER_HOUR (60 * SECS_PER_MIN) #define SECS_PER_DAY (SECS_PER_HOUR * 24) // 400-year chunks always have 146097 days (20871 weeks). #define DAYS_PER_400_YEARS 146097L #define SECS_PER_400_YEARS ((int64_t)DAYS_PER_400_YEARS * (int64_t)SECS_PER_DAY) // The number of seconds in an aligned 100-year chunk, for those that // do not begin with a leap year and those that do respectively. const int64_t SECS_PER_100_YEARS[2] = { (uint64_t)(76L * DAYS_PER_N_YEAR + 24L * DAYS_PER_L_YEAR) * SECS_PER_DAY, (uint64_t)(75L * DAYS_PER_N_YEAR + 25L * DAYS_PER_L_YEAR) * SECS_PER_DAY }; // The number of seconds in an aligned 4-year chunk, for those that // do not begin with a leap year and those that do respectively. const int32_t SECS_PER_4_YEARS[2] = { (4 * DAYS_PER_N_YEAR + 0 * DAYS_PER_L_YEAR) * SECS_PER_DAY, (3 * DAYS_PER_N_YEAR + 1 * DAYS_PER_L_YEAR) * SECS_PER_DAY }; // The number of seconds in non-leap and leap years respectively. const int32_t SECS_PER_YEAR[2] = { DAYS_PER_N_YEAR * SECS_PER_DAY, DAYS_PER_L_YEAR * SECS_PER_DAY }; #define MONTHS_PER_YEAR 12 // The month lengths in non-leap and leap years respectively. const int32_t DAYS_PER_MONTHS[2][13] = { {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {-1, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} }; // The day offsets of the beginning of each (1-based) month in non-leap // and leap years respectively. // For example, in a leap year there are 335 days before December. const int32_t MONTHS_OFFSETS[2][14] = { {-1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, {-1, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} }; const int DAY_OF_WEEK_TABLE[12] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }; #define TM_SUNDAY 0 #define TM_MONDAY 1 #define TM_TUESDAY 2 #define TM_WEDNESDAY 3 #define TM_THURSDAY 4 #define TM_FRIDAY 5 #define TM_SATURDAY 6 #define TM_JANUARY 0 #define TM_FEBRUARY 1 #define TM_MARCH 2 #define TM_APRIL 3 #define TM_MAY 4 #define TM_JUNE 5 #define TM_JULY 6 #define TM_AUGUST 7 #define TM_SEPTEMBER 8 #define TM_OCTOBER 9 #define TM_NOVEMBER 10 #define TM_DECEMBER 11 /* ------------------------------------------------------------------------- */ int is_leap(int year) { return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); } int week_day(int year, int month, int day) { int y; int w; y = year - (month < 3); w = (y + y/4 - y/100 + y /400 + DAY_OF_WEEK_TABLE[month - 1] + day) % 7; if (!w) { w = 7; } return w; } int days_in_year(int year) { if (is_leap(year)) { return DAYS_PER_L_YEAR; } return DAYS_PER_N_YEAR; } /* ------------------------ Custom Types ------------------------------- */ #if defined(PY_MAJOR_VERSION) /* * class FixedOffset(tzinfo): */ typedef struct { PyObject_HEAD int offset; } FixedOffset; /* * def __init__(self, offset): * self.offset = offset */ static int FixedOffset_init(FixedOffset *self, PyObject *args, PyObject *kwargs) { int offset; if (!PyArg_ParseTuple(args, "i", &offset)) return -1; self->offset = offset; return 0; } /* * def utcoffset(self, dt): * return timedelta(seconds=self.offset * 60) */ static PyObject *FixedOffset_utcoffset(FixedOffset *self, PyObject *args) { return PyDelta_FromDSU(0, self->offset, 0); } /* * def dst(self, dt): * return timedelta(seconds=self.offset * 60) */ static PyObject *FixedOffset_dst(FixedOffset *self, PyObject *args) { return PyDelta_FromDSU(0, self->offset, 0); } /* * def tzname(self, dt): * sign = '+' * if self.offset < 0: * sign = '-' * return "%s%d:%d" % (sign, self.offset / 60, self.offset % 60) */ static PyObject *FixedOffset_tzname(FixedOffset *self, PyObject *args) { char tzname[7] = {0}; char sign = '+'; int offset = self->offset; if (offset < 0) { sign = '-'; offset *= -1; } sprintf( tzname, "%c%02d:%02d", sign, offset / SECS_PER_HOUR, offset / SECS_PER_MIN % SECS_PER_MIN ); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(tzname); #else return PyString_FromString(tzname); #endif } /* * def __repr__(self): * return self.tzname() */ static PyObject *FixedOffset_repr(FixedOffset *self) { return FixedOffset_tzname(self, NULL); } /* * Class member / class attributes */ static PyMemberDef FixedOffset_members[] = { {"offset", T_INT, offsetof(FixedOffset, offset), 0, "UTC offset"}, {NULL} }; /* * Class methods */ static PyMethodDef FixedOffset_methods[] = { {"utcoffset", (PyCFunction)FixedOffset_utcoffset, METH_VARARGS, ""}, {"dst", (PyCFunction)FixedOffset_dst, METH_VARARGS, ""}, {"tzname", (PyCFunction)FixedOffset_tzname, METH_VARARGS, ""}, {NULL} }; #if PY_MAJOR_VERSION >= 3 static PyTypeObject FixedOffset_type = { PyVarObject_HEAD_INIT(NULL, 0) "rfc3339.FixedOffset_type", /* tp_name */ sizeof(FixedOffset), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_as_async */ (reprfunc)FixedOffset_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)FixedOffset_repr, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ "TZInfo with fixed offset", /* tp_doc */ }; #else static PyTypeObject FixedOffset_type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "_helpers.FixedOffset_type", /*tp_name*/ sizeof(FixedOffset), /*tp_basicsize*/ 0, /*tp_itemsize*/ 0, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ (reprfunc)FixedOffset_repr,/*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash */ 0, /*tp_call*/ (reprfunc)FixedOffset_repr,/*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ "TZInfo with fixed offset",/* tp_doc */ }; #endif /* * Instantiate new FixedOffset_type object * Skip overhead of calling PyObject_New and PyObject_Init. * Directly allocate object. */ static PyObject *new_fixed_offset_ex(int offset, PyTypeObject *type) { FixedOffset *self = (FixedOffset *) (type->tp_alloc(type, 0)); if (self != NULL) self->offset = offset; return (PyObject *) self; } #define new_fixed_offset(offset) new_fixed_offset_ex(offset, &FixedOffset_type) /* -------------------------- Functions --------------------------*/ PyObject* local_time(PyObject *self, PyObject *args) { double unix_time; int32_t utc_offset; int32_t year; int32_t microsecond; int64_t seconds; int32_t leap_year; int64_t sec_per_100years; int64_t sec_per_4years; int32_t sec_per_year; int32_t month; int32_t day; int32_t month_offset; int32_t hour; int32_t minute; int32_t second; if (!PyArg_ParseTuple(args, "dii", &unix_time, &utc_offset, µsecond)) { PyErr_SetString( PyExc_ValueError, "Invalid parameters" ); return NULL; } year = EPOCH_YEAR; seconds = (int64_t) floor(unix_time); // Shift to a base year that is 400-year aligned. if (seconds >= 0) { seconds -= 10957L * SECS_PER_DAY; year += 30; // == 2000; } else { seconds += (int64_t)(146097L - 10957L) * SECS_PER_DAY; year -= 370; // == 1600; } seconds += utc_offset; // Handle years in chunks of 400/100/4/1 year += 400 * (seconds / SECS_PER_400_YEARS); seconds %= SECS_PER_400_YEARS; if (seconds < 0) { seconds += SECS_PER_400_YEARS; year -= 400; } leap_year = 1; // 4-century aligned sec_per_100years = SECS_PER_100_YEARS[leap_year]; while (seconds >= sec_per_100years) { seconds -= sec_per_100years; year += 100; leap_year = 0; // 1-century, non 4-century aligned sec_per_100years = SECS_PER_100_YEARS[leap_year]; } sec_per_4years = SECS_PER_4_YEARS[leap_year]; while (seconds >= sec_per_4years) { seconds -= sec_per_4years; year += 4; leap_year = 1; // 4-year, non century aligned sec_per_4years = SECS_PER_4_YEARS[leap_year]; } sec_per_year = SECS_PER_YEAR[leap_year]; while (seconds >= sec_per_year) { seconds -= sec_per_year; year += 1; leap_year = 0; // non 4-year aligned sec_per_year = SECS_PER_YEAR[leap_year]; } // Handle months and days month = TM_DECEMBER + 1; day = seconds / SECS_PER_DAY + 1; seconds %= SECS_PER_DAY; while (month != TM_JANUARY + 1) { month_offset = MONTHS_OFFSETS[leap_year][month]; if (day > month_offset) { day -= month_offset; break; } month -= 1; } // Handle hours, minutes and seconds hour = seconds / SECS_PER_HOUR; seconds %= SECS_PER_HOUR; minute = seconds / SECS_PER_MIN; second = seconds % SECS_PER_MIN; return Py_BuildValue("NNNNNNN", PyLong_FromLong(year), PyLong_FromLong(month), PyLong_FromLong(day), PyLong_FromLong(hour), PyLong_FromLong(minute), PyLong_FromLong(second), PyLong_FromLong(microsecond) ); } PyObject* parse_iso8601(PyObject *self, PyObject *args) { char* str; char* c; PyObject *obj; PyObject *tzinfo; // day_first is only here for compatibility // It will be removed in the next major version // since it's not ISO 8601 compliant. int day_first; int year = 0; int month = 1; int day = 1; int hour = 0; int minute = 0; int second = 0; int subsecond = 0; int monthday = 0; int week = 0; int weekday = 1; int ordinal; int tz_sign = 0; int offset = 0; int leap = 0; int ambiguous_date = 0; int separators = 0; int time = 0; int has_time = 0; int has_offset = 0; int i; int j; if (!PyArg_ParseTuple(args, "si", &str, &day_first)) { PyErr_SetString( PyExc_ValueError, "Invalid parameters" ); return NULL; } c = str; // Year for (i = 0; i < 4; i++) { if (*c >= '0' && *c <= '9') { year = 10 * year + *c++ - '0'; } else { PyErr_SetString( PyExc_ValueError, "Invalid ISO8601 string" ); return NULL; } } leap = is_leap(year); // Optional separator if (*c == '-') { separators++; c++; } // Checking for week dates if (*c == 'W') { c++; i = 0; while (*c != '\0' && *c != ' ' && *c != 'T') { if (*c == '-') { separators++; c++; continue; } week = 10 * week + *c++ - '0'; i++; } switch (i) { case 2: // Only week number break; case 3: // Week with weekday if (!(separators == 0 || separators == 2)) { // We should have 2 or no separator PyErr_SetString( PyExc_ValueError, "Invalid week date" ); return NULL; } weekday = week % 10; week /= 10; break; default: // Any other case is wrong PyErr_SetString( PyExc_ValueError, "Invalid week date" ); return NULL; } // Checks if (week > 53) { PyErr_SetString( PyExc_ValueError, "Invalid week number" ); return NULL; } if (weekday > 7) { PyErr_SetString( PyExc_ValueError, "Invalid weekday number" ); return NULL; } // Calculating ordinal day ordinal = week * 7 + weekday - (week_day(year, 1, 4) + 3); if (ordinal < 1) { // Previous year ordinal += days_in_year(year - 1); year -= 1; leap = is_leap(year); } if (ordinal > days_in_year(year)) { // Next year ordinal -= days_in_year(year); year += 1; leap = is_leap(year); } for (j = 1; j < 14; j++) { if (ordinal <= MONTHS_OFFSETS[leap][j]) { day = ordinal - MONTHS_OFFSETS[leap][j - 1]; month = j - 1; break; } } } else { // At this point we need to check the number // of characters until the end of the date part // (or the end of the string). // // If two, we have only a month if there is a separator, it may be a time otherwise. // If three, we have an ordinal date. // If four, we have a complete date i = 0; while (*c != '\0' && *c != ' ' && *c != 'T') { if (*c == '-') { separators++; c++; continue; } if (!(*c >= '0' && *c <='9')) { PyErr_SetString( PyExc_ValueError, "Invalid date" ); return NULL; } monthday = 10 * monthday + *c++ - '0'; i++; } switch (i) { case 0: // No month/day specified (only a year) break; case 2: if (!separators) { // The date looks like 201207 // which is invalid for a date // But it might be a time in the form hhmmss ambiguous_date = 1; } month = monthday; break; case 3: // Ordinal day if (separators > 1) { PyErr_SetString( PyExc_ValueError, "Invalid date" ); return NULL; } if (monthday < 1 || monthday > MONTHS_OFFSETS[leap][13]) { PyErr_SetString( PyExc_ValueError, "Invalid ordinal day for year" ); return NULL; } for (j = 1; j < 14; j++) { if (monthday <= MONTHS_OFFSETS[leap][j]) { day = monthday - MONTHS_OFFSETS[leap][j - 1]; month = j - 1; break; } } break; case 4: // Month and day if (day_first) { month = monthday % 100; day = monthday / 100; } else { month = monthday / 100; day = monthday % 100; } break; default: PyErr_SetString( PyExc_ValueError, "Invalid month and/or day" ); return NULL; } } // Checks if (separators && !monthday && !week) { PyErr_SetString( PyExc_ValueError, "Invalid date" ); return NULL; } if (month > 12) { PyErr_SetString( PyExc_ValueError, "Invalid month" ); return NULL; } if (day > DAYS_PER_MONTHS[leap][month]) { PyErr_SetString( PyExc_ValueError, "Day is invalid for month" ); return NULL; } separators = 0; if (*c == 'T' || *c == ' ') { if (ambiguous_date) { PyErr_SetString( PyExc_ValueError, "Invalid date" ); return NULL; } has_time = 1; c++; // Grabbing time information i = 0; while (*c != '\0' && *c != '.' && *c != ',' && *c != 'Z' && *c != '+' && *c != '-') { if (*c == ':') { separators++; c++; continue; } if (!(*c >= '0' && *c <='9')) { PyErr_SetString( PyExc_ValueError, "Invalid time" ); return NULL; } time = 10 * time + *c++ - '0'; i++; } switch (i) { case 2: // Hours only if (separators > 0) { // Extraneous separators PyErr_SetString( PyExc_ValueError, "Invalid time" ); return NULL; } hour = time; break; case 4: // Hours and minutes if (separators > 1) { // Extraneous separators PyErr_SetString( PyExc_ValueError, "Invalid time" ); return NULL; } hour = time / 100; minute = time % 100; break; case 6: // Hours, minutes and seconds if (!(separators == 0 || separators == 2)) { // We should have either two separators or none PyErr_SetString( PyExc_ValueError, "Invalid time" ); return NULL; } hour = time / 10000; minute = time / 100 % 100; second = time % 100; break; default: // Any other case is wrong PyErr_SetString( PyExc_ValueError, "Invalid time" ); return NULL; } // Checks if (hour > 23) { PyErr_SetString( PyExc_ValueError, "Invalid hour" ); return NULL; } if (minute > 59) { PyErr_SetString( PyExc_ValueError, "Invalid minute" ); return NULL; } if (second > 59) { PyErr_SetString( PyExc_ValueError, "Invalid second" ); return NULL; } // Subsecond if (*c == '.' || *c == ',') { c++; time = 0; i = 0; while (*c != '\0' && *c != 'Z' && *c != '+' && *c != '-') { if (!(*c >= '0' && *c <='9')) { PyErr_SetString( PyExc_ValueError, "Invalid subsecond" ); return NULL; } time = 10 * time + *c++ - '0'; i++; } if (i > 9) { subsecond = time / 1e9; } else if (i <= 9) { subsecond = time * pow(10, 9 - i); } } // Timezone if (*c == 'Z') { has_offset = 1; c++; } else if (*c == '+' || *c == '-') { tz_sign = 1; if (*c == '-') { tz_sign = -1; } has_offset = 1; c++; i = 0; time = 0; separators = 0; while (*c != '\0') { if (*c == ':') { separators++; c++; continue; } if (!(*c >= '0' && *c <= '9')) { PyErr_SetString( PyExc_ValueError, "Invalid timezone offset" ); return NULL; } time = 10 * time + *c++ - '0'; i++; } switch (i) { case 2: // hh Format if (separators) { // Extraneous separators PyErr_SetString( PyExc_ValueError, "Invalid timezone offset" ); return NULL; } offset = tz_sign * (time * 3600); break; case 4: // hhmm Format if (separators > 1) { // Extraneous separators PyErr_SetString( PyExc_ValueError, "Invalid timezone offset" ); return NULL; } offset = tz_sign * ((time / 100 * 3600) + (time % 100 * 60)); break; default: // Wrong format PyErr_SetString( PyExc_ValueError, "Invalid timezone offset" ); return NULL; } } } if (!has_time) { // Date only if (ambiguous_date) { // We can "safely" assume that the ambiguous // date was actually a time in the form hhmmss hour = year / 100; minute = year % 100; second = month; obj = PyDateTimeAPI->Time_FromTime( hour, minute, second, subsecond / 1000, Py_BuildValue(""), PyDateTimeAPI->TimeType ); } else { obj = PyDateTimeAPI->Date_FromDate( year, month, day, PyDateTimeAPI->DateType ); } } else { if (!has_offset) { tzinfo = Py_BuildValue(""); } else { tzinfo = new_fixed_offset(offset); } obj = PyDateTimeAPI->DateTime_FromDateAndTime( year, month, day, hour, minute, second, subsecond / 1000, tzinfo, PyDateTimeAPI->DateTimeType ); Py_DECREF(tzinfo); } return obj; } PyObject* parse(PyObject *self, PyObject *args) { char* str; char* c; int day_first; int separators = 0; PyObject *obj; if (!PyArg_ParseTuple(args, "si", &str, &day_first)) { PyErr_SetString( PyExc_ValueError, "Invalid parameters" ); return NULL; } c = str; c++; separators++; obj = PyDateTimeAPI->Date_FromDate( 2017, 3, 21, PyDateTimeAPI->DateType ); return obj; } /* ------------------------------------------------------------------------- */ static PyMethodDef helpers_methods[] = { { "local_time", (PyCFunction) local_time, METH_VARARGS, PyDoc_STR("Returns a UNIX time as a broken down time for a particular transition type.") }, { "parse_iso8601", (PyCFunction) parse_iso8601, METH_VARARGS, PyDoc_STR("Parses a ISO8601 string into a tuple.") }, {NULL} }; /* ------------------------------------------------------------------------- */ #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "_helpers", NULL, -1, helpers_methods, NULL, NULL, NULL, NULL, }; #endif PyMODINIT_FUNC #if PY_MAJOR_VERSION >= 3 PyInit__helpers(void) #else init_helpers(void) #endif { PyObject *module; PyDateTime_IMPORT; #if PY_MAJOR_VERSION >= 3 module = PyModule_Create(&moduledef); #else module = Py_InitModule3("_helpers", helpers_methods, NULL); #endif if (module == NULL) #if PY_MAJOR_VERSION >= 3 return NULL; #else return; #endif FixedOffset_type.tp_new = PyType_GenericNew; FixedOffset_type.tp_base = PyDateTimeAPI->TZInfoType; FixedOffset_type.tp_methods = FixedOffset_methods; FixedOffset_type.tp_members = FixedOffset_members; FixedOffset_type.tp_init = (initproc)FixedOffset_init; if (PyType_Ready(&FixedOffset_type) < 0) #if PY_MAJOR_VERSION >= 3 return NULL; #else return; #endif Py_INCREF(&FixedOffset_type); PyModule_AddObject(module, "TZFixedOffset", (PyObject *)&FixedOffset_type); #if PY_MAJOR_VERSION >= 3 return module; #endif } #endif PK!>>3pendulum/_extensions/_helpers.cpython-36m-darwin.so p(__TEXT __text__TEXT"__stubs__TEXTB__stub_helper__TEXTTT__const__TEXTP__cstring__TEXT0c0__unwind_info__TEXTh__DATA  __nl_symbol_ptr__DATA   __got__DATA   __la_symbol_ptr__DATA X __data__DATA 0 __bss__DATA#H__LINKEDIT00"00((0Px0x12gx9  PLL Y9QVmw:Oɓ$ * 82/usr/lib/libSystem.B.dylib&2)2UH1@u&HcHiQHH?HH%kd9t]H'iɐ19]UH1)AAAAAHcHizII?H DHiQII?H DHcLaDA HcHi$IH ȉЍ))ѸE]DUH@u6HcHiQHH%HH?kd9ǸnuH'iɐ)tm]fUHAWAVAUATSH(HHUHMLE1HHEf: H,HcMHHH?IY`HL!pHHHXDF5HHHHH?H!HiIHH)ߍ@ILH)ٸHHHQAH9|IcHiQHH?HH%kdAA9uH'iE1A9A1z-HRLDA]W11 fIA},~@-t@T@@ TWHH8H5HH8H5 1HH8[A\A]A^A_]11Ҁ,fA]Iŀ,~ -utg u`Tt[ـЀ ,ˍ4tq뿃uhƃu^LcIigfffHH?H"44A)6}ZnHr Hc H1һA1 HH8H5A6|HH8H5AHqH8H5H[H8H51@1A 2~Mk8H= A;t84MHH8H5W}HcLiQLH?I%AAkd)EODA\7IcHizHH?H LiQMI?LH DD< L HcHiٓ$IH |;ߍ))߾)9ٹE΍4)AAE~CEAAHcHiQHH?H%kdAA)11 AAmE1A,1A;t8A;t8~yA;t8 ~mA;t8~aA;t8~UA;t8~IA;t8~=A;t8 ~1A;t8$~% A;t8(~ A;t8,~ 1A;t80Ã LAD+41 LH%DkdA9I'EAiA9DGmAu:IcHiQHH%HH?kdA9ɿnuH'iːD)tmA9Au:IcHiQHH%HH?kdA9ɹnuH'iD)tmA)AE1Au>IcHiQHH?HH%kdAA9uH'iϐE1A9AEMk8H=h 1E;t8AAE;t8AE;t8 AE;t8~~AE;t8~qAE;t8~dAE;t8~WAE;t8 ~JAE;t8$~=A E;t8(~0A E;t8,~#A E;t80~A E;t84ZDLD+4D1 utH H8H5 ^ |H H8H5 CHcIk4HHD;4~H H8H5 AEhG4h^*hx hh hLQAS%AhheA΄3;Zx0Nm<[y1OndiiInvalid parametersNNNNNNNsiInvalid ISO8601 stringInvalid week dateInvalid week numberInvalid weekday numberInvalid dateInvalid ordinal day for yearInvalid month and/or dayInvalid monthDay is invalid for monthInvalid timeInvalid hourInvalid minuteInvalid secondInvalid subsecondInvalid timezone offsetdatetime.datetime_CAPITZFixedOffsetrfc3339.FixedOffset_typeTZInfo with fixed offset%c%02d:%02d_helperslocal_timeReturns a UNIX time as a broken down time for a particular transition type.parse_iso8601Parses a ISO8601 string into a tuple.utcoffsetdsttznameoffsetUTC offseti 888 $@@P!XT^hr|"@@06 Djrtrxr! [Fpp(pp@p8p(p pRASAp RASASAQ>@_PyExc_ValueErrorQq@_PyType_GenericNew@dyld_stub_binderq >@_PyArg_ParseTupleq(>@_PyCapsule_Importq0>@_PyErr_SetStringq8>@_PyLong_FromLongq@>@_PyModule_AddObjectqH>@_PyModule_Create2qP>@_PyType_ReadyqX>@_PyUnicode_FromStringq`>@_Py_BuildValueqh@___exp10qp@___sprintf_chk_ is_leaprweek_daywdays_in_year|local_timeparsePyInit__helpersSECS_PER_DAYMONTHS_OFFSETS   _iso8601/0100_YEARS4_YEARSYEAR888S_PER_MONTHS_OF_WEEK_TABLE89: PP pP0dd!f8Z.$$PNP.@$@$N.$$PNP.0$0$N. $ $ N . $$pNp.0$0$N.$$$PNP.@6$@$N.H$$N.\$$0N0.s$$"N"      & & & @!& "0& 0#E& #dTf@x   @! " 0#  # &60G[m|0 @+=P^tYZ[]^_abcdef@\`YZ[]^_abcde _DAYS_PER_MONTHS_DAY_OF_WEEK_TABLE_MONTHS_OFFSETS_PyInit__helpers_SECS_PER_100_YEARS_SECS_PER_4_YEARS_SECS_PER_YEAR_days_in_year_is_leap_local_time_parse_parse_iso8601_week_day_PyArg_ParseTuple_PyCapsule_Import_PyErr_SetString_PyExc_ValueError_PyLong_FromLong_PyModule_AddObject_PyModule_Create2_PyType_GenericNew_PyType_Ready_PyUnicode_FromString_Py_BuildValue___exp10___sprintf_chkdyld_stub_binder/private/var/folders/ct/d6qd8xl16wz_8kfpb7zq00m00000gn/T/tmpisn2nujt/pendulum-1.5.1/pendulum/_extensions/_helpers.c/var/folders/ct/d6qd8xl16wz_8kfpb7zq00m00000gn/T/tmpisn2nujt/pendulum-1.5.1/build/temp.macosx-10.13-x86_64-3.6/pendulum/_extensions/_helpers.o_is_leappendulum/_extensions/_helpers.c_week_day_days_in_year_local_time_parse_iso8601_parse_PyInit__helpers_FixedOffset_init_FixedOffset_repr_FixedOffset_tzname_FixedOffset_utcoffset_FixedOffset_dst_SECS_PER_100_YEARS_SECS_PER_4_YEARS_SECS_PER_YEAR_DAYS_PER_MONTHS_MONTHS_OFFSETS_DAY_OF_WEEK_TABLE_moduledef_FixedOffset_members_FixedOffset_type_helpers_methods_FixedOffset_methods_PyDateTimeAPI_FixedOffset_init_FixedOffset_repr_FixedOffset_tzname_FixedOffset_utcoffset_FixedOffset_dst_moduledef_FixedOffset_members_FixedOffset_type_helpers_methods_FixedOffset_methods_PyDateTimeAPIPK!S" pendulum/_extensions/helpers.py# -*- coding: utf-8 -*- import math from ..constants import ( EPOCH_YEAR, SECS_PER_DAY, SECS_PER_400_YEARS, SECS_PER_100_YEARS, SECS_PER_4_YEARS, SECS_PER_YEAR, SECS_PER_HOUR, SECS_PER_MIN, MONTHS_OFFSETS, TM_DECEMBER, TM_JANUARY ) def local_time(unix_time, utc_offset, microseconds): """ Returns a UNIX time as a broken down time for a particular transition type. :type unix_time: int :type utc_offset: int :type microseconds: int :rtype: tuple """ year = EPOCH_YEAR seconds = int(math.floor(unix_time)) # Shift to a base year that is 400-year aligned. if seconds >= 0: seconds -= 10957 * SECS_PER_DAY year += 30 # == 2000 else: seconds += (146097 - 10957) * SECS_PER_DAY year -= 370 # == 1600 seconds += utc_offset # Handle years in chunks of 400/100/4/1 year += 400 * (seconds // SECS_PER_400_YEARS) seconds %= SECS_PER_400_YEARS if seconds < 0: seconds += SECS_PER_400_YEARS year -= 400 leap_year = 1 # 4-century aligned sec_per_100years = SECS_PER_100_YEARS[leap_year] while seconds >= sec_per_100years: seconds -= sec_per_100years year += 100 leap_year = 0 # 1-century, non 4-century aligned sec_per_100years = SECS_PER_100_YEARS[leap_year] sec_per_4years = SECS_PER_4_YEARS[leap_year] while seconds >= sec_per_4years: seconds -= sec_per_4years year += 4 leap_year = 1 # 4-year, non century aligned sec_per_4years = SECS_PER_4_YEARS[leap_year] sec_per_year = SECS_PER_YEAR[leap_year] while seconds >= sec_per_year: seconds -= sec_per_year year += 1 leap_year = 0 # non 4-year aligned sec_per_year = SECS_PER_YEAR[leap_year] # Handle months and days month = TM_DECEMBER + 1 day = seconds // SECS_PER_DAY + 1 seconds %= SECS_PER_DAY while month != TM_JANUARY + 1: month_offset = MONTHS_OFFSETS[leap_year][month] if day > month_offset: day -= month_offset break month -= 1 # Handle hours, minutes, seconds and microseconds hour = seconds // SECS_PER_HOUR seconds %= SECS_PER_HOUR minute = seconds // SECS_PER_MIN second = seconds % SECS_PER_MIN return ( year, month, day, hour, minute, second, microseconds ) PK!6pendulum/_global.py# -*- coding: utf-8 -*- from .mixins.default import ( TestableMixin, FormattableMixing, TranslatableMixin ) from .pendulum import Pendulum from .date import Date from .time import Time class Global(TestableMixin, FormattableMixing, TranslatableMixin): @classmethod def set_test_now(cls, test_now=None): cls._test_now = test_now Pendulum.set_test_now(test_now) Date.set_test_now(test_now) Time.set_test_now(test_now) @classmethod def set_formatter(cls, formatter=None): super(Global, cls).set_formatter(formatter) Pendulum.set_formatter(formatter) Date.set_formatter(formatter) Time.set_formatter(formatter) @classmethod def set_locale(cls, locale): super(Global, cls).set_locale(locale) Pendulum.set_locale(locale) Date.set_locale(locale) Time.set_locale(locale) PK!LC& pendulum/constants.py# -*- coding: utf-8 -*- # The day constants SUNDAY = 0 MONDAY = 1 TUESDAY = 2 WEDNESDAY = 3 THURSDAY = 4 FRIDAY = 5 SATURDAY = 6 # Number of X in Y. YEARS_PER_CENTURY = 100 YEARS_PER_DECADE = 10 MONTHS_PER_YEAR = 12 WEEKS_PER_YEAR = 52 DAYS_PER_WEEK = 7 HOURS_PER_DAY = 24 MINUTES_PER_HOUR = 60 SECONDS_PER_MINUTE = 60 SECONDS_PER_HOUR = MINUTES_PER_HOUR * SECONDS_PER_MINUTE SECONDS_PER_DAY = HOURS_PER_DAY * SECONDS_PER_HOUR # Formats ATOM = '%Y-%m-%dT%H:%M:%S%_z' COOKIE = '%A, %d-%b-%Y %H:%M:%S %Z' ISO8601 = '%Y-%m-%dT%H:%M:%S%_z' ISO8601_EXTENDED = '%Y-%m-%dT%H:%M:%S.%f%_z' RFC822 = '%a, %d %b %y %H:%M:%S %z' RFC850 = '%A, %d-%b-%y %H:%M:%S %Z' RFC1036 = '%a, %d %b %y %H:%M:%S %z' RFC1123 = '%a, %d %b %Y %H:%M:%S %z' RFC2822 = '%a, %d %b %Y %H:%M:%S %z' RFC3339 = '%Y-%m-%dT%H:%M:%S%_z' RFC3339_EXTENDED = '%Y-%m-%dT%H:%M:%S.%f%_z' RSS = '%a, %d %b %Y %H:%M:%S %z' W3C = '%Y-%m-%dT%H:%M:%S%_z' EPOCH_YEAR = 1970 DAYS_PER_N_YEAR = 365 DAYS_PER_L_YEAR = 366 USECS_PER_SEC = 1000000 SECS_PER_MIN = 60 SECS_PER_HOUR = 60 * SECS_PER_MIN SECS_PER_DAY = SECS_PER_HOUR * 24 # 400-year chunks always have 146097 days (20871 weeks). SECS_PER_400_YEARS = 146097 * SECS_PER_DAY # The number of seconds in an aligned 100-year chunk, for those that # do not begin with a leap year and those that do respectively. SECS_PER_100_YEARS = ( (76 * DAYS_PER_N_YEAR + 24 * DAYS_PER_L_YEAR) * SECS_PER_DAY, (75 * DAYS_PER_N_YEAR + 25 * DAYS_PER_L_YEAR) * SECS_PER_DAY ) # The number of seconds in an aligned 4-year chunk, for those that # do not begin with a leap year and those that do respectively. SECS_PER_4_YEARS = ( (4 * DAYS_PER_N_YEAR + 0 * DAYS_PER_L_YEAR) * SECS_PER_DAY, (3 * DAYS_PER_N_YEAR + 1 * DAYS_PER_L_YEAR) * SECS_PER_DAY ) # The number of seconds in non-leap and leap years respectively. SECS_PER_YEAR = ( DAYS_PER_N_YEAR * SECS_PER_DAY, DAYS_PER_L_YEAR * SECS_PER_DAY ) # The month lengths in non-leap and leap years respectively. DAYS_PER_MONTHS = ( (-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31), (-1, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) ) # The day offsets of the beginning of each (1-based) month in non-leap # and leap years respectively. # For example, in a leap year there are 335 days before December. MONTHS_OFFSETS = ( (-1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365), (-1, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366) ) DAY_OF_WEEK_TABLE = ( 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 ) TM_SUNDAY = 0 TM_MONDAY = 1 TM_TUESDAY = 2 TM_WEDNESDAY = 3 TM_THURSDAY = 4 TM_FRIDAY = 5 TM_SATURDAY = 6 TM_JANUARY = 0 TM_FEBRUARY = 1 TM_MARCH = 2 TM_APRIL = 3 TM_MAY = 4 TM_JUNE = 5 TM_JULY = 6 TM_AUGUST = 7 TM_SEPTEMBER = 8 TM_OCTOBER = 9 TM_NOVEMBER = 10 TM_DECEMBER = 11 PK!>n}}pendulum/date.py# -*- coding: utf-8 -*- from __future__ import division import calendar import math import warnings from datetime import date, timedelta from dateutil.relativedelta import relativedelta from .exceptions import PendulumDeprecationWarning from .period import Period from .formatting.difference_formatter import DifferenceFormatter from .mixins.default import TranslatableMixin, FormattableMixing, TestableMixin from .constants import ( DAYS_PER_WEEK, YEARS_PER_DECADE, YEARS_PER_CENTURY, MONTHS_PER_YEAR, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY ) from .exceptions import PendulumException class Date(TranslatableMixin, FormattableMixing, TestableMixin, date): # Names of days of the week _days = { SUNDAY: 'Sunday', MONDAY: 'Monday', TUESDAY: 'Tuesday', WEDNESDAY: 'Wednesday', THURSDAY: 'Thursday', FRIDAY: 'Friday', SATURDAY: 'Saturday' } # First day of week _week_starts_at = MONDAY # Last day of week _week_ends_at = SUNDAY # Weekend days _weekend_days = [ SATURDAY, SUNDAY ] _MODIFIERS_VALID_UNITS = ['day', 'week', 'month', 'year', 'decade', 'century'] _diff_formatter = None @classmethod def instance(cls, dt): """ Return a new Date instance given a native date instance. :param dt: The native date instance. :type dt: date :rtype: Date """ return cls(dt.year, dt.month, dt.day) @classmethod def create(cls, year=None, month=None, day=None): """ Create a new Date instance from a specific date. If any of year, month or day are set to None their today() values will be used. :type year: int :type month: int :type day: int :rtype: Date """ if any([year is None, month is None, day is None]): now = date.today() if year is None: year = now.year if month is None: month = now.month if day is None: day = now.day return cls(year, month, day) @classmethod def today(cls, tz=None): """ Create a Date instance for today. :param tz: The timezone :type tz: Timezone or TimezoneInfo or str or None :rtype: Date """ if cls.has_test_now(): return cls.get_test_now() return cls.create() @classmethod def yesterday(cls): return cls.today().subtract(days=1) @classmethod def tomorrow(cls): return cls.today().add(days=1) ### Getters/Setters def year_(self, year): warnings.warn( 'The year_() method will be removed in version 2.0. ' 'Use set(year={}) instead.'.format(year), PendulumDeprecationWarning, stacklevel=2 ) return self.set(year=year) def month_(self, month): warnings.warn( 'The month_() method will be removed in version 2.0. ' 'Use set(month={}) instead.'.format(month), PendulumDeprecationWarning, stacklevel=2 ) return self.set(month=month) def day_(self, day): warnings.warn( 'The day_() method will be removed in version 2.0. ' 'Use set(day={}) instead.'.format(day), PendulumDeprecationWarning, stacklevel=2 ) return self.set(day=day) def set(self, year=None, month=None, day=None): return self.replace( year=year, month=month, day=day ) @property def day_of_week(self): """ Returns the day of the week (0-6). :rtype: int """ return self.isoweekday() % 7 @property def day_of_year(self): """ Returns the day of the year (1-366). :rtype: int """ k = 1 if self.is_leap_year() else 2 return ( (275 * self.month) // 9 - k * ((self.month + 9) // 12) + self.day - 30 ) @property def week_of_year(self): return self.isocalendar()[1] @property def days_in_month(self): return calendar.monthrange(self.year, self.month)[1] @property def week_of_month(self): return int(math.ceil(self.day / DAYS_PER_WEEK)) @property def age(self): return self.diff().in_years() @property def quarter(self): return int(math.ceil(self.month / 3)) ### Special week days @classmethod def get_week_starts_at(cls): """ Get the first day of the week. :rtype: int """ return cls._week_starts_at @classmethod def set_week_starts_at(cls, value): """ Set the first day of the week. :type value: int """ if value not in cls._days: raise ValueError('Invalid day of the week: {}'.format(value)) cls._week_starts_at = value @classmethod def get_week_ends_at(cls): """ Get the last day of the week. :rtype: int """ return cls._week_ends_at @classmethod def set_week_ends_at(cls, value): """ Set the last day of the week. :type value: int """ if value not in cls._days: raise ValueError('Invalid day of the week: {}'.format(value)) cls._week_ends_at = value @classmethod def get_weekend_days(cls): """ Get weekend days. :rtype: list """ return cls._weekend_days @classmethod def set_weekend_days(cls, values): """ Set weekend days. :type value: list """ for value in values: if value not in cls._days: raise ValueError('Invalid day of the week: {}' .format(value)) cls._weekend_days = values # String Formatting def to_date_string(self): """ Format the instance as date. :rtype: str """ return self.format('%Y-%m-%d', formatter='classic') def to_formatted_date_string(self): """ Format the instance as a readable date. :rtype: str """ return self.format('%b %d, %Y', formatter='classic') # COMPARISONS def between(self, dt1, dt2, equal=True): """ Determines if the instance is between two others. :type dt1: Date or date :type dt2: Date or date :param equal: Indicates if a > and < comparison shoud be used or <= and >= :rtype: bool """ warnings.warn( 'The between() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) if dt1 > dt2: dt1, dt2 = dt2, dt1 if equal: return self >= dt1 and self <= dt2 return self > dt1 and self < dt2 def closest(self, dt1, dt2): """ Get the closest date from the instance. :type dt1: Date or date :type dt2: Date or date :rtype: Date """ dt1 = self._get_date(dt1, True) dt2 = self._get_date(dt2, True) if self.diff(dt1).in_seconds() < self.diff(dt2).in_seconds(): return dt1 return dt2 def farthest(self, dt1, dt2): """ Get the farthest date from the instance. :type dt1: Date or date :type dt2: Date or date :rtype: Date """ dt1 = self._get_date(dt1, True) dt2 = self._get_date(dt2, True) if self.diff(dt1).in_seconds() > self.diff(dt2).in_seconds(): return dt1 return dt2 def min_(self, dt=None): """ Get the minimum instance between a given instance (default utcnow) and the current instance. :type dt: Date or date :rtype: Date """ warnings.warn( 'The min_() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) if dt is None: dt = Date.today() if self < dt: return self return self._get_date(dt, True) def minimum(self, dt=None): """ Get the minimum instance between a given instance (default now) and the current instance. :type dt: Date or date :rtype: Date """ warnings.warn( 'The minimum() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.min_(dt) def max_(self, dt=None): """ Get the maximum instance between a given instance (default now) and the current instance. :type dt: Date or date :rtype: Date """ warnings.warn( 'The max_() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) if dt is None: dt = Date.today() if self > dt: return self return self._get_date(dt, True) def maximum(self, dt=None): """ Get the maximum instance between a given instance (default utcnow) and the current instance. :type dt: Date or date :rtype: Date """ warnings.warn( 'The maximum() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.max_(dt) def is_weekday(self): """ Determines if the instance is a weekday. :rtype: bool """ warnings.warn( 'The is_weekday() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return not self.is_weekend() def is_weekend(self): """ Determines if the instance is a weekend day. :rtype: bool """ warnings.warn( 'The is_weekend() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.day_of_week in self._weekend_days def is_yesterday(self): """ Determines if the instance is yesterday. :rtype: bool """ warnings.warn( 'The is_yesterday() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self == self.yesterday() def is_today(self): """ Determines if the instance is today. :rtype: bool """ warnings.warn( 'The is_today() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self == self.today() def is_tomorrow(self): """ Determines if the instance is tomorrow. :rtype: bool """ warnings.warn( 'The is_tomorrow() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self == self.tomorrow() def is_future(self): """ Determines if the instance is in the future, ie. greater than now. :rtype: bool """ return self > self.today() def is_past(self): """ Determines if the instance is in the past, ie. less than now. :rtype: bool """ return self < self.today() def is_leap_year(self): """ Determines if the instance is a leap year. :rtype: bool """ return calendar.isleap(self.year) def is_long_year(self): """ Determines if the instance is a long year See link ``_ :rtype: bool """ return Date(self.year, 12, 28).isocalendar()[1] == 53 def is_same_day(self, dt): """ Checks if the passed in date is the same day as the instance current day. :type dt: Date or date :rtype: bool """ warnings.warn( 'The is_same_day() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self == dt def is_sunday(self): """ Checks if this day is a sunday. :rtype: bool """ warnings.warn( 'The is_sunday() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.day_of_week == SUNDAY def is_monday(self): """ Checks if this day is a monday. :rtype: bool """ warnings.warn( 'The is_monday() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.day_of_week == MONDAY def is_tuesday(self): """ Checks if this day is a tuesday. :rtype: bool """ warnings.warn( 'The is_tuesday() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.day_of_week == TUESDAY def is_wednesday(self): """ Checks if this day is a wednesday. :rtype: bool """ warnings.warn( 'The is_wednesday() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.day_of_week == WEDNESDAY def is_thursday(self): """ Checks if this day is a thursday. :rtype: bool """ warnings.warn( 'The is_thursday() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.day_of_week == THURSDAY def is_friday(self): """ Checks if this day is a friday. :rtype: bool """ warnings.warn( 'The is_friday() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.day_of_week == FRIDAY def is_saturday(self): """ Checks if this day is a saturday. :rtype: bool """ warnings.warn( 'The is_saturday() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.day_of_week == SATURDAY def is_birthday(self, dt=None): """ Check if its the birthday. Compares the date/month values of the two dates. :rtype: bool """ if dt is None: dt = Date.today() instance = self._get_date(dt, True) return (self.month, self.day) == (instance.month, instance.day) # ADDITIONS AND SUBSTRACTIONS def add(self, years=0, months=0, weeks=0, days=0): """ Add duration to the instance. :param years: The number of years :type years: int :param months: The number of months :type months: int :param weeks: The number of weeks :type weeks: int :param days: The number of days :type days: int :rtype: Date """ delta = relativedelta( years=years, months=months, weeks=weeks, days=days, ) return self.instance(date(self.year, self.month, self.day) + delta) def subtract(self, years=0, months=0, weeks=0, days=0): """ Remove duration from the instance. :param years: The number of years :type years: int :param months: The number of months :type months: int :param weeks: The number of weeks :type weeks: int :param days: The number of days :type days: int :rtype: Date """ delta = relativedelta( years=years, months=months, weeks=weeks, days=days ) return self.instance(date(self.year, self.month, self.day) - delta) def add_timedelta(self, delta): """ Add timedelta duration to the instance. :param delta: The timedelta instance :type delta: datetime.timedelta :rtype: Date """ warnings.warn( 'The add_timedelta() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.add(days=delta.days) def subtract_timedelta(self, delta): """ Remove timedelta duration from the instance. :param delta: The timedelta instance :type delta: datetime.timedelta :rtype: Date """ warnings.warn( 'The subtract_timedelta() method will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) return self.subtract(days=delta.days) def __add__(self, other): if not isinstance(other, timedelta): return NotImplemented return self.add_timedelta(other) def __sub__(self, other): if isinstance(other, timedelta): return self.subtract_timedelta(other) try: return self._get_date(other, True).diff(self, False) except ValueError: return NotImplemented # DIFFERENCES @property def diff_formatter(self): """ Returns a DifferenceFormatter instance. :rtype: DifferenceFormatter """ if not self.__class__._diff_formatter: self.__class__._diff_formatter = DifferenceFormatter(self.__class__.translator()) return self.__class__._diff_formatter def diff(self, dt=None, abs=True): """ Returns the difference between two Date objects as a Period. :type dt: Date or None :param abs: Whether to return an absolute interval or not :type abs: bool :rtype: Period """ if dt is None: dt = self.today() return Period(self, self._get_date(dt, True), absolute=abs) def diff_for_humans(self, other=None, absolute=False, locale=None): """ Get the difference in a human readable format in the current locale. When comparing a value in the past to default now: 1 day ago 5 months ago When comparing a value in the future to default now: 1 day from now 5 months from now When comparing a value in the past to another value: 1 day before 5 months before When comparing a value in the future to another value: 1 day after 5 months after :type other: Date :param absolute: removes time difference modifiers ago, after, etc :type absolute: bool :param locale: The locale to use for localization :type locale: str :rtype: str """ return self.diff_formatter.diff_for_humans(self, other, absolute, locale) # MODIFIERS def start_of(self, unit): """ Returns a copy of the instance with the time reset with the following rules: * day: time to 00:00:00 * week: date to first day of the week and time to 00:00:00 * month: date to first day of the month and time to 00:00:00 * year: date to first day of the year and time to 00:00:00 * decade: date to first day of the decade and time to 00:00:00 * century: date to first day of century and time to 00:00:00 :param unit: The unit to reset to :type unit: str :rtype: Date """ if unit not in self._MODIFIERS_VALID_UNITS: raise ValueError('Invalid unit "{}" for start_of()'.format(unit)) return getattr(self, '_start_of_{}'.format(unit))() def end_of(self, unit): """ Returns a copy of the instance with the time reset with the following rules: * week: date to last day of the week * month: date to last day of the month * year: date to last day of the year * decade: date to last day of the decade * century: date to last day of century :param unit: The unit to reset to :type unit: str :rtype: Date """ if unit not in self._MODIFIERS_VALID_UNITS: raise ValueError('Invalid unit "%s" for end_of()' % unit) return getattr(self, '_end_of_%s' % unit)() def _start_of_day(self): """ Compatibility method. :rtype: Date """ return self def _end_of_day(self): """ Compatibility method :rtype: Date """ return self def _start_of_month(self): """ Reset the date to the first day of the month. :rtype: Date """ return self.replace(self.year, self.month, 1) def _end_of_month(self): """ Reset the date to the last day of the month. :rtype: Date """ return self.replace( self.year, self.month, self.days_in_month ) def _start_of_year(self): """ Reset the date to the first day of the year. :rtype: Date """ return self.replace(self.year, 1, 1) def _end_of_year(self): """ Reset the date to the last day of the year. :rtype: Date """ return self.replace(self.year, 12, 31) def _start_of_decade(self): """ Reset the date to the first day of the decade. :rtype: Date """ year = self.year - self.year % YEARS_PER_DECADE return self.replace(year, 1, 1) def _end_of_decade(self): """ Reset the date to the last day of the decade. :rtype: Date """ year = self.year - self.year % YEARS_PER_DECADE + YEARS_PER_DECADE - 1 return self.replace(year, 12, 31) def _start_of_century(self): """ Reset the date to the first day of the century. :rtype: Date """ year = self.year - 1 - (self.year - 1) % YEARS_PER_CENTURY + 1 return self.replace(year, 1, 1) def _end_of_century(self): """ Reset the date to the last day of the century. :rtype: Date """ year = self.year - 1 - (self.year - 1) % YEARS_PER_CENTURY + YEARS_PER_CENTURY return self.replace(year, 12, 31) def _start_of_week(self): """ Reset the date to the first day of the week. :rtype: Date """ dt = self if self.day_of_week != self._week_starts_at: dt = self.previous(self._week_starts_at) return dt.start_of('day') def _end_of_week(self): """ Reset the date to the last day of the week. :rtype: Date """ dt = self if self.day_of_week != self._week_ends_at: dt = self.next(self._week_ends_at) return dt.end_of('day') def next(self, day_of_week=None): """ Modify to the next occurrence of a given day of the week. If no day_of_week is provided, modify to the next occurrence of the current day of the week. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :param day_of_week: The next day of week to reset to. :type day_of_week: int or None :rtype: Date """ if day_of_week is None: day_of_week = self.day_of_week if day_of_week < SUNDAY or day_of_week > SATURDAY: raise ValueError('Invalid day of week') dt = self.add(days=1) while dt.day_of_week != day_of_week: dt = dt.add(days=1) return dt def previous(self, day_of_week=None): """ Modify to the previous occurrence of a given day of the week. If no day_of_week is provided, modify to the previous occurrence of the current day of the week. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :param day_of_week: The previous day of week to reset to. :type day_of_week: int or None :rtype: Date """ if day_of_week is None: day_of_week = self.day_of_week if day_of_week < SUNDAY or day_of_week > SATURDAY: raise ValueError('Invalid day of week') dt = self.subtract(days=1) while dt.day_of_week != day_of_week: dt = dt.subtract(days=1) return dt def first_of(self, unit, day_of_week=None): """ Returns an instance set to the first occurrence of a given day of the week in the current unit. If no day_of_week is provided, modify to the first day of the unit. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. Supported units are month, quarter and year. :param unit: The unit to use :type unit: str :type day_of_week: int or None :rtype: Date """ if unit not in ['month', 'quarter', 'year']: raise ValueError('Invalid unit "{}" for first_of()'.format(unit)) return getattr(self, '_first_of_{}'.format(unit))(day_of_week) def last_of(self, unit, day_of_week=None): """ Returns an instance set to the last occurrence of a given day of the week in the current unit. If no day_of_week is provided, modify to the last day of the unit. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. Supported units are month, quarter and year. :param unit: The unit to use :type unit: str :type day_of_week: int or None :rtype: Date """ if unit not in ['month', 'quarter', 'year']: raise ValueError('Invalid unit "{}" for first_of()'.format(unit)) return getattr(self, '_last_of_{}'.format(unit))(day_of_week) def nth_of(self, unit, nth, day_of_week): """ Returns a new instance set to the given occurrence of a given day of the week in the current unit. If the calculated occurrence is outside the scope of the current unit, then raise an error. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. Supported units are month, quarter and year. :param unit: The unit to use :type unit: str :type nth: int :type day_of_week: int or None :rtype: Date """ if unit not in ['month', 'quarter', 'year']: raise ValueError('Invalid unit "{}" for first_of()'.format(unit)) dt = getattr(self, '_nth_of_{}'.format(unit))(nth, day_of_week) if dt is False: raise PendulumException('Unable to find occurence {} of {} in {}'.format( nth, self._days[day_of_week], unit)) return dt def _first_of_month(self, day_of_week): """ Modify to the first occurrence of a given day of the week in the current month. If no day_of_week is provided, modify to the first day of the month. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :type day_of_week: int :rtype: Date """ dt = self if day_of_week is None: return dt.day_(1) month = calendar.monthcalendar(dt.year, dt.month) calendar_day = (day_of_week - 1) % 7 if month[0][calendar_day] > 0: day_of_month = month[0][calendar_day] else: day_of_month = month[1][calendar_day] return dt.day_(day_of_month) def _last_of_month(self, day_of_week=None): """ Modify to the last occurrence of a given day of the week in the current month. If no day_of_week is provided, modify to the last day of the month. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :type day_of_week: int or None :rtype: Date """ dt = self if day_of_week is None: return dt.day_(self.days_in_month) month = calendar.monthcalendar(dt.year, dt.month) calendar_day = (day_of_week - 1) % 7 if month[-1][calendar_day] > 0: day_of_month = month[-1][calendar_day] else: day_of_month = month[-2][calendar_day] return dt.day_(day_of_month) def _nth_of_month(self, nth, day_of_week): """ Modify to the given occurrence of a given day of the week in the current month. If the calculated occurrence is outside, the scope of the current month, then return False and no modifications are made. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :type nth: int :type day_of_week: int or None :rtype: Date """ if nth == 1: return self.first_of('month', day_of_week) dt = self.first_of('month') check = dt.format('%Y-%m') for i in range(nth - (1 if dt.day_of_week == day_of_week else 0)): dt = dt.next(day_of_week) if dt.format('%Y-%m') == check: return self.day_(dt.day) return False def _first_of_quarter(self, day_of_week=None): """ Modify to the first occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the first day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :type day_of_week: int or None :rtype: Date """ return self.replace(self.year, self.quarter * 3 - 2, 1).first_of('month', day_of_week) def _last_of_quarter(self, day_of_week=None): """ Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :type day_of_week: int or None :rtype: Date """ return self.replace(self.year, self.quarter * 3, 1).last_of('month', day_of_week) def _nth_of_quarter(self, nth, day_of_week): """ Modify to the given occurrence of a given day of the week in the current quarter. If the calculated occurrence is outside, the scope of the current quarter, then return False and no modifications are made. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :type nth: int :type day_of_week: int or None :rtype: Date """ if nth == 1: return self.first_of('quarter', day_of_week) dt = self.replace(self.year, self.quarter * 3, 1) last_month = dt.month year = dt.year dt = dt.first_of('quarter') for i in range(nth - (1 if dt.day_of_week == day_of_week else 0)): dt = dt.next(day_of_week) if last_month < dt.month or year != dt.year: return False return self.replace(self.year, dt.month, dt.day) def _first_of_year(self, day_of_week=None): """ Modify to the first occurrence of a given day of the week in the current year. If no day_of_week is provided, modify to the first day of the year. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :type day_of_week: int or None :rtype: Date """ return self.month_(1).first_of('month', day_of_week) def _last_of_year(self, day_of_week=None): """ Modify to the last occurrence of a given day of the week in the current year. If no day_of_week is provided, modify to the last day of the year. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :type day_of_week: int or None :rtype: Date """ return self.month_(MONTHS_PER_YEAR).last_of('month', day_of_week) def _nth_of_year(self, nth, day_of_week): """ Modify to the given occurrence of a given day of the week in the current year. If the calculated occurrence is outside, the scope of the current year, then return False and no modifications are made. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :type nth: int :type day_of_week: int or None :rtype: Date """ if nth == 1: return self.first_of('year', day_of_week) dt = self.first_of('year') year = dt.year for i in range(nth - (1 if dt.day_of_week == day_of_week else 0)): dt = dt.next(day_of_week) if year != dt.year: return False return self.replace(self.year, dt.month, dt.day) def average(self, dt=None): """ Modify the current instance to the average of a given instance (default now) and the current instance. :type dt: Date or date :rtype: Date """ if dt is None: dt = Date.today() return self.add(days=int(self.diff(dt, False).in_days() / 2)) def _get_date(self, value, as_date=False): """ Gets a date from a given value. :param value: The value to get the datetime from. :type value: Date or date. :param pendulum: Whether to return a Date instance. :type pendulum: bool :rtype: date or Date """ if value is None: return None if isinstance(value, Date): return value._datetime if not as_date else value if isinstance(value, date): return value if not as_date else Date.instance(value) raise ValueError('Invalid date "{}"'.format(value)) # Testing aids @classmethod def set_test_now(cls, test_now=None): """ Set a Date instance (real or mock) to be returned when a "now" instance is created. The provided instance will be returned specifically under the following conditions: - A call to the classmethod today() method, ex.Date.now() - When nothing is passed to create(), ex. Date.create() To clear the test instance call this method using the default parameter of None. :type test_now: Date or Pendulum or None """ if test_now is not None and not isinstance(test_now, Date): raise TypeError( 'Date.set_test_now() only accepts a Date instance, ' 'a Pendulum instance or None.' ) cls._test_now = test_now @classmethod def get_test_now(cls): if cls._test_now is None: return None if isinstance(cls._test_now, Date): return cls._test_now return cls._test_now.date() # Native methods override @classmethod def fromtimestamp(cls, t): return cls.instance(super(Date, cls).fromtimestamp(t)) @classmethod def fromordinal(cls, n): return cls.instance(super(Date, cls).fromordinal(n)) def replace(self, year=None, month=None, day=None): year = year if year is not None else self.year month = month if month is not None else self.month day = day if day is not None else self.day return self.__class__(year, month, day) PK!#pendulum/exceptions.py# -*- coding: utf-8 -*- class PendulumException(BaseException): pass class PendulumWarning(Warning): pass class PendulumDeprecationWarning(PendulumWarning): pass PK!J)''pendulum/formatting/__init__.py# -*- coding: utf-8 -*- from .formatter import Formatter from .classic_formatter import ClassicFormatter from .alternative_formatter import AlternativeFormatter FORMATTERS = { 'classic': ClassicFormatter(), 'alternative': AlternativeFormatter(), } def register_formatter(name, formatter): """ Register a new formatter. :param name: The name of the formatter. :type name: str :param formatter: The formatter instance :type formatter: Formatter :rtype: None """ if name in FORMATTERS: raise ValueError('Formatter [{}] already exists'.format(name)) if not isinstance(formatter, Formatter): raise ValueError( 'The formatter instance ' 'must be an instance of Formatter' ) FORMATTERS[name] = formatter PK!Ex1x1,pendulum/formatting/alternative_formatter.py# -*- coding: utf-8 -*- import re import datetime from .._compat import decode from .formatter import Formatter _MATCH_1 = re.compile('\d') _MATCH_2 = re.compile('\d\d') _MATCH_3 = re.compile('\d{3}') _MATCH_4 = re.compile('\d{4}') _MATCH_6 = re.compile('[+-]?\d{6}') _MATCH_1_TO_2 = re.compile('\d\d?') _MATCH_1_TO_3 = re.compile('\d{1,3}') _MATCH_1_TO_4 = re.compile('\d{1,4}') _MATCH_1_TO_6 = re.compile('[+-]?\d{1,6}') _MATCH_3_TO_4 = re.compile('\d{3}\d?') _MATCH_5_TO_6 = re.compile('\d{5}\d?') _MATCH_UNSIGNED = re.compile('\d+') _MATCH_SIGNED = re.compile('[+-]?\d+') _MATCH_OFFSET = re.compile('(?i)Z|[+-]\d\d:?\d\d') _MATCH_SHORT_OFFSET = re.compile('(?i)Z|[+-]\d\d(?::?\d\d)?') _MATCH_TIMESTAMP = re.compile('[+-]?\d+(\.\d{1,3})?') _MATCH_WORD = re.compile("[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}") class AlternativeFormatter(Formatter): _TOKENS = '\[([^\[]*)\]|\\\(.)|' \ '(' \ 'Mo|MM?M?M?' \ '|Do|DDDo|DD?D?D?|ddd?d?|do?' \ '|w[o|w]?|W[o|W]?|Qo?' \ '|YYYY|YY|Y' \ '|gg(ggg?)?|GG(GGG?)?' \ '|e|E|a|A' \ '|hh?|HH?|kk?' \ '|mm?|ss?|S{1,9}' \ '|x|X' \ '|zz?|ZZ?' \ '|LTS|LT|LL?L?L?' \ ')' _FORMAT_RE = re.compile(_TOKENS) _LOCALIZABLE_TOKENS = ( 'Mo', 'MMM', 'MMMM', 'Qo', 'Do', 'DDDo', 'do', 'dd', 'ddd', 'dddd', 'wo', 'Wo', 'A', 'a', ) _TOKENS_RULES = { # Year 'YYYY': lambda dt: '{:d}'.format(dt.year), 'YY': lambda dt: '{:d}'.format(dt.year)[2:], 'Y': lambda dt: '{:d}'.format(dt.year), # Quarter 'Q': lambda dt: '{:d}'.format(dt.quarter), # Month 'MM': lambda dt: '{:02d}'.format(dt.month), 'M': lambda dt: '{:d}'.format(dt.month), # Day 'DD': lambda dt: '{:02d}'.format(dt.day), 'D': lambda dt: '{:d}'.format(dt.day), # Day of Year 'DDDD': lambda dt: '{:03d}'.format(dt.day_of_year), 'DDD': lambda dt: '{:d}'.format(dt.day_of_year), # Day of Week 'd': lambda dt: '{:d}'.format(dt.day_of_week), # Hour 'HH': lambda dt: '{:02d}'.format(dt.hour), 'H': lambda dt: '{:d}'.format(dt.hour), 'hh': lambda dt: '{:02d}'.format(dt.hour % 12 or 12), 'h': lambda dt: '{:d}'.format(dt.hour % 12 or 12), # Minute 'mm': lambda dt: '{:02d}'.format(dt.minute), 'm': lambda dt: '{:d}'.format(dt.minute), # Second 'ss': lambda dt: '{:02d}'.format(dt.second), 's': lambda dt: '{:d}'.format(dt.second), # Fractional second 'S': lambda dt: '{:01d}'.format(dt.microsecond // 100000), 'SS': lambda dt: '{:02d}'.format(dt.microsecond // 10000), 'SSS': lambda dt: '{:03d}'.format(dt.microsecond // 1000), 'SSSS': lambda dt: '{:04d}'.format(dt.microsecond // 100), 'SSSSS': lambda dt: '{:05d}'.format(dt.microsecond // 10), 'SSSSSS': lambda dt: '{:06d}'.format(dt.microsecond), # Timestamp 'X': lambda dt: '{:d}'.format(dt.int_timestamp), # Timezone 'z': lambda dt: '{}'.format(dt.tzinfo.abbrev), 'zz': lambda dt: '{}'.format(dt.timezone_name), } _DEFAULT_DATE_FORMATS = { 'LTS': 'h:mm:ss A', 'LT': 'h:mm A', 'L': 'MM/DD/YYYY', 'LL': 'MMMM D, YYYY', 'LLL': 'MMMM D, YYYY h:mm A', 'LLLL': 'dddd, MMMM D, YYYY h:mm A', } _REGEX_TOKENS = { 'Y': _MATCH_SIGNED, 'YY': (_MATCH_1_TO_2, _MATCH_2), 'YYYY': (_MATCH_1_TO_4, _MATCH_4), 'Q': _MATCH_1, 'Qo': None, 'M': _MATCH_1_TO_2, 'MM': (_MATCH_1_TO_2, _MATCH_2), 'MMM': None, 'MMMM': None, 'D': _MATCH_1_TO_2, 'DD': (_MATCH_1_TO_2, _MATCH_2), 'DDD': _MATCH_1_TO_3, 'DDDD': _MATCH_3, 'Do': None, 'H': _MATCH_1_TO_2, 'HH': (_MATCH_1_TO_2, _MATCH_2), 'h': _MATCH_1_TO_2, 'hh': (_MATCH_1_TO_2, _MATCH_2), 'm': _MATCH_1_TO_2, 'mm': (_MATCH_1_TO_2, _MATCH_2), 's': _MATCH_1_TO_2, 'ss': (_MATCH_1_TO_2, _MATCH_2), 'S': (_MATCH_1_TO_3, _MATCH_1), 'SS': (_MATCH_1_TO_3, _MATCH_2), 'SSS': (_MATCH_1_TO_3, _MATCH_3), 'SSSS': _MATCH_UNSIGNED, 'SSSSS': _MATCH_UNSIGNED, 'SSSSSS': _MATCH_UNSIGNED, 'a': None, 'x': _MATCH_SIGNED, 'X': re.compile('[+-]?\d+(\.\d{1,3})?') } _PARSE_TOKENS = { 'YYYY': lambda year: int(year), 'YY': lambda year: 1900 + int(year), 'Q': lambda quarter: int(quarter), 'MMMM': lambda month: None, 'MMM': lambda month: None, 'MM': lambda month: int(month), 'M': lambda month: int(month), 'DDDD': lambda day: int(day), 'DDD': lambda day: int(day), 'DD': lambda day: int(day), 'D': lambda day: int(day), 'HH': lambda hour: int(hour), 'H': lambda hour: int(hour), 'hh': lambda hour: int(hour), 'h': lambda hour: int(hour), 'mm': lambda minute: int(minute), 'm': lambda minute: int(minute), 'ss': lambda second: int(second), 's': lambda second: int(second), 'S': lambda us: int(us) * 100000, 'SS': lambda us: int(us) * 10000, 'SSS': lambda us: int(us) * 1000, 'SSSS': lambda us: int(us) * 100, 'SSSSS': lambda us: int(us) * 10, 'SSSSSS': lambda us: int(us), 'a': lambda meridiem: None, 'X': lambda ts: float(ts), 'x': lambda ts: float(ts) / 1e3, } def format(self, dt, fmt, locale=None): """ Formats a Pendulum instance with a given format and locale. :param dt: The instance to format :type dt: pendulum.Pendulum :param fmt: The format to use :type fmt: str :param locale: The locale to use :type locale: str or None :rtype: str """ if not locale: locale = dt.get_locale() return self._FORMAT_RE.sub( lambda m: m.group(1) if m.group(1) else m.group(2) if m.group(2) else self._format_token(dt, m.group(3), locale), fmt ) def _format_token(self, dt, token, locale): """ Formats a Pendulum instance with a given token and locale. :param dt: The instance to format :type dt: pendulum.Pendulum :param token: The token to use :type token: str :param locale: The locale to use :type locale: str or None :rtype: str """ if token in self._DEFAULT_DATE_FORMATS: fmt = dt.translator().transchoice('date_formats', token, locale=locale) if fmt == 'date_formats': fmt = self._DEFAULT_DATE_FORMATS[token] return self.format(dt, fmt, locale) if token in self._LOCALIZABLE_TOKENS: return self._format_localizable_token(dt, token, locale) if token in self._TOKENS_RULES: return self._TOKENS_RULES[token](dt) # Timezone if token in ['ZZ', 'Z']: separator = ':' if token == 'ZZ' else '' offset = dt.utcoffset() or datetime.timedelta() minutes = offset.total_seconds() / 60 if minutes >= 0: sign = '+' else: sign = '-' hour, minute = divmod(abs(int(minutes)), 60) return '{}{:02d}{}{:02d}'.format(sign, hour, separator, minute) def _format_localizable_token(self, dt, token, locale): """ Formats a Pendulum instance with a given localizable token and locale. :param dt: The instance to format :type dt: pendulum.Pendulum :param token: The token to use :type token: str :param locale: The locale to use :type locale: str or None :rtype: str """ trans_id = '' count = 0 if token == 'MMM': count = dt.month trans_id = 'months_abbrev' elif token == 'MMMM': count = dt.month trans_id = 'months' elif token in ('dd', 'ddd'): count = dt.day_of_week trans_id = 'days_abbrev' elif token == 'dddd': count = dt.day_of_week trans_id = 'days' elif token == 'Do': count = dt.day trans_id = 'ordinal' elif token == 'do': count = dt.day_of_week trans_id = 'ordinal' elif token == 'Mo': count = dt.month trans_id = 'ordinal' elif token == 'Qo': count = dt.quarter trans_id = 'ordinal' elif token == 'wo': count = dt.week_of_year trans_id = 'ordinal' elif token == 'DDDo': count = dt.day_of_year trans_id = 'ordinal' elif token == 'A': count = (dt.hour, dt.minute) trans_id = 'meridian' trans = dt.translator().transchoice(trans_id, count, locale=locale) if trans_id == 'ordinal': trans = '{:d}{}'.format(count, trans) if trans_id == trans: # Unable to find the corresponding translation # Defaulting to english return self._format_localizable_token(dt, token, 'en') return decode(trans) def parse(self, time, fmt): """ Parses a time string matching a given format as a tuple. :param time: The timestring :type time: str :param fmt: The format :type fmt: str :rtype: tuple """ fmt = re.escape(fmt) tokens = self._FORMAT_RE.findall(fmt) if not tokens: return time parsed = { 'year': None, 'month': None, 'day': None, 'hour': None, 'minute': None, 'second': None, 'microsecond': None, 'tz': None, 'quarter': None, 'day_of_week': None, 'day_of_year': None, 'meridiem': None, 'timestamp': None } pattern = self._FORMAT_RE.sub(lambda m: self._replace_tokens(m.group(0)), fmt) if not re.match(pattern, time): raise ValueError('String does not match format {}'.format(fmt)) re.sub(pattern, lambda m: self._get_parsed_values(m, parsed), time) return parsed def _get_parsed_values(self, m, parsed): for token, index in m.re.groupindex.items(): self._get_parsed_value(token, m.group(index), parsed) def _get_parsed_value(self, token, value, parsed): parsed_token = self._PARSE_TOKENS[token](value) if 'Y' in token: parsed['year'] = parsed_token elif 'Q' == token: parsed['quarter'] = parsed_token elif 'M' in token: parsed['month'] = parsed_token elif token in ['DDDD', 'DDD']: parsed['day_of_year'] = parsed_token elif 'D' in token: parsed['day'] = parsed_token elif 'H' in token: parsed['hour'] = parsed_token elif token in ['hh', 'h']: parsed['hour'] = parsed_token elif 'm' in token: parsed['minute'] = parsed_token elif 's' in token: parsed['second'] = parsed_token elif 'S' in token: parsed['microsecond'] = parsed_token elif token in ['MMM', 'MMMM']: parsed['day_of_week'] = parsed_token elif token == 'a': pass elif token in ['X', 'x']: parsed['timestamp'] = parsed_token def _replace_tokens(self, token): if token.startswith('[') and token.endswith(']'): return token[1:-1] elif token.startswith('\\'): return token elif token not in self._REGEX_TOKENS: raise ValueError('Unsupported token: {}'.format(token)) candidates = self._REGEX_TOKENS[token] if not candidates: raise ValueError('Unsupported token: {}'.format(token)) if not isinstance(candidates, tuple): candidates = (candidates,) pattern = '(?P<{}>{})'.format(token, '|'.join([p.pattern for p in candidates])) return pattern PK! N (pendulum/formatting/classic_formatter.py# -*- coding: utf-8 -*- import re import datetime from .._compat import decode from .formatter import Formatter class ClassicFormatter(Formatter): _CUSTOM_FORMATTERS = ['_z', '_t'] _FORMATTERS_REGEX = re.compile('%%(%s)' % '|'.join(_CUSTOM_FORMATTERS)) def format(self, dt, fmt, locale=None): """ Formats a Pendulum instance with a given format and locale. :param dt: The instance to format :type dt: pendulum.Pendulum or pendulum.Date :param fmt: The format to use :type fmt: str :param locale: The locale to use :type locale: str or None :rtype: str """ if not locale: locale = dt.get_locale() # Checking for custom formatters fmt = self._FORMATTERS_REGEX.sub(lambda m: self._strftime(dt, m, locale), fmt) # Checking for localizable directives fmt = re.sub('%(a|A|b|B|p)', lambda m: self._localize_directive(dt, m.group(1), locale), fmt) if hasattr(dt, '_datetime'): trans = dt._datetime.strftime(fmt) elif hasattr(dt, '_time'): trans = dt._time.strftime(fmt) else: trans = datetime.date(dt.year, dt.month, dt.day).strftime(fmt) return decode(trans) def _localize_directive(self, dt, directive, locale): """ Localize a native strftime directive. :param dt: The instance to format :type dt: pendulum.Pendulum :param directive: The directive to localize :type directive: str :param locale: The locale to use for localization :type locale: str :rtype: str """ if directive == 'a': id = 'days_abbrev' number = dt.day_of_week elif directive == 'A': id = 'days' number = dt.day_of_week elif directive == 'b': id = 'months_abbrev' number = dt.month elif directive == 'B': id = 'months' number = dt.month elif directive == 'p': id = 'meridian' number = (dt.hour, dt.minute) else: raise ValueError('Unlocalizable directive [{}]'.format(directive)) translation = dt.translator().transchoice(id, number, locale=locale) if translation == id: return '' return translation def _strftime(self, dt, m, locale): """ Handles custom formatters in format string. :param dt: The instance to format :type dt: pendulum.Pendulum :return: str """ fmt = m.group(1) if fmt == '_z': offset = dt.utcoffset() or datetime.timedelta() minutes = offset.total_seconds() / 60 if minutes >= 0: sign = '+' else: sign = '-' hour, minute = divmod(abs(int(minutes)), 60) return '{0}{1:02d}:{2:02d}'.format(sign, hour, minute) elif fmt == '_t': translation = dt.translator().transchoice('ordinal', dt.day, locale=locale) if translation == 'ordinal': translation = '' return translation raise ValueError('Unknown formatter %%{}'.format(fmt)) PK!1 1 +pendulum/formatting/difference_formatter.py# -*- coding: utf-8 -*- from .._compat import decode from ..translator import Translator class DifferenceFormatter(object): """ Handles formatting differences in text. """ def __init__(self, translator=Translator()): self._translator = translator def diff_for_humans(self, date, other=None, absolute=False, locale=None): """ Get the difference in a human readable format. :param date: The datetime to start with. :type date: pendulum.Date or pendulum.Pendulum :param other: The datetime to compare against (defaults to now). :type other: pendulum.Date or pendulum.Pendulum or None :param absolute: Removes time difference modifiers ago, after, etc :type absolute: bool :param locale: The locale to use :type locale: str or None :rtype: str """ is_now = other is None if is_now: if hasattr(date, 'now'): other = date.now(date.timezone) else: other = date.today() diff = date.diff(other) count = diff.remaining_seconds unit = 'second' if diff.years > 0: unit = 'year' count = diff.years if diff.months > 6: count += 1 elif diff.months == 11 and (diff.weeks * 7 + diff.remaining_days) > 15: unit = 'year' count = 1 elif diff.months > 0: unit = 'month' count = diff.months if (diff.weeks * 7 + diff.remaining_days) >= 27: count += 1 elif diff.weeks > 0: unit = 'week' count = diff.weeks if diff.remaining_days > 3: count += 1 elif diff.remaining_days > 0: unit = 'day' count = diff.remaining_days elif diff.hours > 0: unit = 'hour' count = diff.hours elif diff.minutes > 0: unit = 'minute' count = diff.minutes if count == 0: count = 1 time = self._translator.transchoice(unit, count, {'count': count}, locale=locale) if absolute: return decode(time) is_future = diff.invert if is_now: trans_id = 'from_now' if is_future else 'ago' else: trans_id = 'after' if is_future else 'before' # Some langs have special pluralization for past and future tense try_key_exists = '%s_%s' % (unit, trans_id) if try_key_exists != self._translator.transchoice(try_key_exists, count, locale=locale): time = self._translator.transchoice(try_key_exists, count, {'count': count}, locale=locale) trans = self._translator.trans(trans_id, {'time': time}, locale=locale) return decode(trans) PK!Dm pendulum/formatting/formatter.py# -*- coding: utf-8 -*- class Formatter(object): """ Base class for all formatters. """ def format(self, dt, fmt, locale=None): """ Formats a Pendulum instance with a given format and locale. :param dt: The instance to format :type dt: Pendulum :param fmt: The format to use :type fmt: str :param locale: The locale to use :type locale: str or None :rtype: str """ raise NotImplementedError() PK!夤  pendulum/helpers.py# -*- coding: utf-8 -*- import pendulum from math import copysign from datetime import datetime, timedelta try: from ._extensions._helpers import local_time, parse_iso8601 as _parse_iso8601 def parse_iso8601(text, day_first=False): return _parse_iso8601(text, day_first) except ImportError: from ._extensions.helpers import local_time parse_iso8601 = None from .constants import ( DAYS_PER_MONTHS, DAY_OF_WEEK_TABLE, DAYS_PER_L_YEAR, DAYS_PER_N_YEAR ) def is_leap(year): return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) def add_duration(dt, years=0, months=0, weeks=0, days=0, hours=0, minutes=0, seconds=0, microseconds=0): """ Adds a duration to a datetime instance. :param dt: The datetime instance :type dt: datetime.datetime :param years: The number of years :type years: int :param months: The number of months :type months: int :param weeks: The number of weeks :type weeks: int :param days: The number of days :type days: int :param hours: The number of hours :type hours: int :param minutes: The number of minutes :type minutes: int :param seconds: The number of seconds :type seconds: int :param microseconds: The number of microseconds :type microseconds: int :rtype: datetime.datetime """ days += weeks * 7 # Normalizing if abs(microseconds) > 999999: s = _sign(microseconds) div, mod = divmod(microseconds * s, 1000000) microseconds = mod * s seconds += div * s if abs(seconds) > 59: s = _sign(seconds) div, mod = divmod(seconds * s, 60) seconds = mod * s minutes += div * s if abs(minutes) > 59: s = _sign(minutes) div, mod = divmod(minutes * s, 60) minutes = mod * s hours += div * s if abs(hours) > 23: s = _sign(hours) div, mod = divmod(hours * s, 24) hours = mod * s days += div * s if abs(months) > 11: s = _sign(months) div, mod = divmod(months * s, 12) months = mod * s years += div * s year = dt.year + years month = dt.month if months: month += months if month > 12: year += 1 month -= 12 elif month < 1: year -= 1 month += 12 day = min(DAYS_PER_MONTHS[int(is_leap(year))][month], dt.day) dt = dt.replace(year=year, month=month, day=day) return dt + timedelta( days=days, hours=hours, minutes=minutes, seconds=seconds, microseconds=microseconds ) def precise_diff(d1, d2): """ Calculate a precise difference between two datetimes. :param d1: The first datetime :type d1: pendulum.Pendulum or pendulum.Date :param d2: The second datetime :type d2: pendulum.Pendulum or pendulum.Date :rtype: dict """ diff = { 'years': 0, 'months': 0, 'days': 0, 'hours': 0, 'minutes': 0, 'seconds': 0, 'microseconds': 0, 'total': { 'days': 0 } } sign = 1 if d1 == d2: return diff tzinfo1 = d1.tzinfo if isinstance(d1, datetime) else None tzinfo2 = d2.tzinfo if isinstance(d2, datetime) else None if (tzinfo1 is None and tzinfo2 is not None or tzinfo2 is None and tzinfo1 is not None): raise ValueError( 'Comparison between naive and aware datetimes is not supported' ) if d1 > d2: d1, d2 = d2, d1 sign = -1 d_diff = 0 hour_diff = 0 min_diff = 0 sec_diff = 0 mic_diff = 0 total_days = ( _day_number(d2.year, d2.month, d2.day) - _day_number(d1.year, d1.month, d1.day) ) in_same_tz = False tz1 = None tz2 = None # Trying to figure out the timezone names # If we can't find them, we assume different timezones if tzinfo1 and tzinfo2: if hasattr(tzinfo1, 'name'): # Pendulum timezone tz1 = tzinfo1.name elif hasattr(tzinfo1, 'zone'): # pytz timezone tz1 = tzinfo1.zone if hasattr(tzinfo2, 'name'): tz2 = tzinfo2.name elif hasattr(tzinfo2, 'zone'): tz2 = tzinfo2.zone in_same_tz = tz1 == tz2 and tz1 is not None if hasattr(d2, 'hour'): # If we are not in the same timezone # we need to adjust # # We also need to adjust if we do not # have variable-length units if not in_same_tz or total_days == 0: offset1 = d1.utcoffset() offset2 = d2.utcoffset() if offset1: d1 = d1 - offset1 if offset2: d2 = d2 - offset2 hour_diff = d2.hour - d1.hour min_diff = d2.minute - d1.minute sec_diff = d2.second - d1.second mic_diff = d2.microsecond - d1.microsecond if mic_diff < 0: mic_diff += 1000000 sec_diff -= 1 if sec_diff < 0: sec_diff += 60 min_diff -= 1 if min_diff < 0: min_diff += 60 hour_diff -= 1 if hour_diff < 0: hour_diff += 24 d_diff -= 1 if d1 > d2: d1, d2 = d2, d1 sign = -1 y_diff = d2.year - d1.year m_diff = d2.month - d1.month d_diff += d2.day - d1.day if d_diff < 0: year = d2.year month = d2.month if month == 1: month = 12 year -= 1 else: month -= 1 leap = int(is_leap(year)) days_in_last_month = DAYS_PER_MONTHS[leap][month] days_in_month = DAYS_PER_MONTHS[int(is_leap(d2.year))][d2.month] if d_diff < days_in_month - days_in_last_month: # We don't have a full month, we calculate days if days_in_last_month < d1.day: d_diff += d1.day else: d_diff += days_in_last_month elif d_diff == days_in_month - days_in_last_month: # We have exactly a full month # We remove the days difference # and add one to the months difference d_diff = 0 m_diff += 1 else: # We have a full month d_diff += days_in_last_month m_diff -= 1 if m_diff < 0: m_diff += 12 y_diff -= 1 diff['microseconds'] = sign * mic_diff diff['seconds'] = sign * sec_diff diff['minutes'] = sign * min_diff diff['hours'] = sign * hour_diff diff['days'] = sign * d_diff diff['months'] = sign * m_diff diff['years'] = sign * y_diff diff['total']['days'] = sign * total_days return diff def week_day(year, month, day): if month < 3: year -= 1 w = (year + year//4 - year//100 + year//400 + DAY_OF_WEEK_TABLE[month - 1] + day) % 7 if not w: w = 7 return w def days_in_year(year): if is_leap(year): return DAYS_PER_L_YEAR return DAYS_PER_N_YEAR def _sign(x): return int(copysign(1, x)) def _day_number(year, month, day): month = (month + 9) % 12 year = year - month // 10 return ( 365 * year + year // 4 - year // 100 + year // 400 + (month * 306 + 5) // 10 + (day - 1 ) ) PK!7''pendulum/interval.py# -*- coding: utf-8 -*- from datetime import timedelta from .mixins.interval import ( WordableIntervalMixin ) from .constants import ( SECONDS_PER_DAY, SECONDS_PER_HOUR, SECONDS_PER_MINUTE ) def _divide_and_round(a, b): """divide a by b and round result to the nearest integer When the ratio is exactly half-way between two integers, the even integer is returned. """ # Based on the reference implementation for divmod_near # in Objects/longobject.c. q, r = divmod(a, b) # round up if either r / b > 0.5, or r / b == 0.5 and q is odd. # The expression r / b > 0.5 is equivalent to 2 * r > b if b is # positive, 2 * r < b if b negative. r *= 2 greater_than_half = r > b if b > 0 else r < b if greater_than_half or r == b and q % 2 == 1: q += 1 return q class BaseInterval(timedelta): """ Base class for all inherited interval classes. """ _y = None _m = None _w = None _d = None _h = None _i = None _s = None _invert = None def __new__(cls, days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0): self = timedelta.__new__( cls, days, seconds, microseconds, milliseconds, minutes, hours, weeks ) # Intuitive normalization total = self.total_seconds() m = 1 if total < 0: m = -1 self._microseconds = round(total % m * 1e6) self._seconds = abs(int(total)) % SECONDS_PER_DAY * m self._days = abs(int(total)) // SECONDS_PER_DAY * m return self def total_minutes(self): return self.total_seconds() / SECONDS_PER_MINUTE def total_hours(self): return self.total_seconds() / SECONDS_PER_HOUR def total_days(self): return self.total_seconds() / SECONDS_PER_DAY def total_weeks(self): return self.total_days() / 7 @property def weeks(self): return abs(self.days) // 7 * self._sign(self._days) @property def days(self): return self._days @property def remaining_days(self): return abs(self._days) % 7 * self._sign(self._days) @property def hours(self): if self._h is None: seconds = self._seconds self._h = 0 if abs(seconds) >= 3600: self._h = (abs(seconds) // 3600 % 24) * self._sign(seconds) return self._h @property def minutes(self): if self._i is None: seconds = self._seconds self._i = 0 if abs(seconds) >= 60: self._i = (abs(seconds) // 60 % 60) * self._sign(seconds) return self._i @property def seconds(self): return self._seconds @property def remaining_seconds(self): if self._s is None: self._s = self._seconds self._s = abs(self._s) % 60 * self._sign(self._s) return self._s @property def microseconds(self): return self._microseconds @property def invert(self): if self._invert is None: self._invert = self.total_seconds() < 0 return self._invert def in_weeks(self): return int(self.total_weeks()) def in_days(self): return int(self.total_days()) def in_hours(self): return int(self.total_hours()) def in_minutes(self): return int(self.total_minutes()) def in_seconds(self): return int(self.total_seconds()) def _sign(self, value): if value < 0: return -1 return 1 def as_timedelta(self): """ Return the interval as a native timedelta. :rtype: timedelta """ return timedelta(seconds=self.total_seconds()) class Interval(WordableIntervalMixin, BaseInterval): """ Replacement for the standard timedelta class. Provides several improvements over the base class. """ @classmethod def instance(cls, delta): """ Creates a Interval from a timedelta :type delta: timedelta :rtype: Interval """ return cls(days=delta.days, seconds=delta.seconds, microseconds=delta.microseconds) def __add__(self, other): if isinstance(other, timedelta): return self.__class__(seconds=self.total_seconds() + other.total_seconds()) return NotImplemented __radd__ = __add__ def __sub__(self, other): if isinstance(other, timedelta): return self.__class__(seconds=self.total_seconds() - other.total_seconds()) return NotImplemented def __neg__(self): return self.__class__(seconds=-self.total_seconds()) def _to_microseconds(self): return ((self._days * (24*3600) + self._seconds) * 1000000 + self._microseconds) def __mul__(self, other): if isinstance(other, int): return self.__class__(seconds=self.total_seconds() * other) if isinstance(other, float): usec = self._to_microseconds() a, b = other.as_integer_ratio() return self.__class__(0, 0, _divide_and_round(usec * a, b)) return NotImplemented __rmul__ = __mul__ def __floordiv__(self, other): if not isinstance(other, (int, timedelta)): return NotImplemented usec = self._to_microseconds() if isinstance(other, timedelta): return usec // other._to_microseconds() if isinstance(other, int): return self.__class__(0, 0, usec // other) def __truediv__(self, other): if not isinstance(other, (int, float, timedelta)): return NotImplemented usec = self._to_microseconds() if isinstance(other, timedelta): return usec / other._to_microseconds() if isinstance(other, int): return self.__class__(0, 0, _divide_and_round(usec, other)) if isinstance(other, float): a, b = other.as_integer_ratio() return self.__class__(0, 0, _divide_and_round(b * usec, a)) __div__ = __floordiv__ def __mod__(self, other): if isinstance(other, timedelta): r = self._to_microseconds() % other._to_microseconds() return self.__class__(0, 0, r) return NotImplemented def __divmod__(self, other): if isinstance(other, timedelta): q, r = divmod(self._to_microseconds(), other._to_microseconds()) return q, self.__class__(0, 0, r) return NotImplemented Interval.min = Interval(-999999999) Interval.max = Interval(days=999999999, hours=23, minutes=59, seconds=59, microseconds=999999) Interval.resolution = Interval(microseconds=1) class AbsoluteInterval(Interval): """ Interval that expresses a time difference in absolute values. """ def __new__(cls, days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0): self = timedelta.__new__( cls, days, seconds, microseconds, milliseconds, minutes, hours, weeks ) # We need to compute the total_seconds() value # on a native timedelta object delta = timedelta( days, seconds, microseconds, milliseconds, minutes, hours, weeks ) # Intuitive normalization self._total = delta.total_seconds() total = abs(self._total) self._microseconds = round(total % 1 * 1e6) self._seconds = int(total) % SECONDS_PER_DAY self._days = int(total) // SECONDS_PER_DAY return self def total_seconds(self): return abs(self._total) @property def invert(self): if self._invert is None: self._invert = self._total < 0 return self._invert PK!Є77pendulum/lang/__init__.py# -*- coding: utf-8 -*- from .af import translations as af_translations from .ar import translations as ar_translations from .az import translations as az_translations from .bg import translations as bg_translations from .bn import translations as bn_translations from .ca import translations as ca_translations from .cs import translations as cs_translations from .da import translations as da_translations from .de import translations as de_translations from .el import translations as el_translations from .en import translations as en_translations from .eo import translations as eo_translations from .es import translations as es_translations from .et import translations as et_translations from .eu import translations as eu_translations from .fa import translations as fa_translations from .fi import translations as fi_translations from .fo import translations as fo_translations from .fr import translations as fr_translations from .gl import translations as gl_translations from .he import translations as he_translations from .hr import translations as hr_translations from .hu import translations as hu_translations from .hy import translations as hy_translations from .id import translations as id_translations from .it import translations as it_translations from .ja import translations as ja_translations from .ka import translations as ka_translations from .ko import translations as ko_translations from .lt import translations as lt_translations from .lv import translations as lv_translations from .mk import translations as mk_translations from .ms import translations as ms_translations from .nl import translations as nl_translations from .nn import translations as nn_translations from .pl import translations as pl_translations from .pt_br import translations as pt_br_translations from .ro import translations as ro_translations from .ru import translations as ru_translations from .sk import translations as sk_translations from .sl import translations as sl_translations from .sq import translations as sq_translations from .sr import translations as sr_translations from .sv import translations as sv_translations from .th import translations as th_translations from .tr import translations as tr_translations from .uk import translations as uk_translations from .uz import translations as uz_translations from .vi import translations as vi_translations from .zh import translations as zh_translations from .zh_tw import translations as zh_tw_translations TRANSLATIONS = { "af": af_translations, "ar": ar_translations, "az": az_translations, "bg": bg_translations, "bn": bn_translations, "ca": ca_translations, "cs": cs_translations, "da": da_translations, "de": de_translations, "el": el_translations, "en": en_translations, "eo": eo_translations, "es": es_translations, "et": et_translations, "eu": eu_translations, "fa": fa_translations, "fi": fi_translations, "fo": fo_translations, "fr": fr_translations, "gl": gl_translations, "he": he_translations, "hr": hr_translations, "hu": hu_translations, "hy": hy_translations, "id": id_translations, "it": it_translations, "ja": ja_translations, "ka": ka_translations, "ko": ko_translations, "lt": lt_translations, "lv": lv_translations, "mk": mk_translations, "ms": ms_translations, "nl": nl_translations, "nn": nn_translations, "pl": pl_translations, "pt_br": pt_br_translations, "ro": ro_translations, "ru": ru_translations, "sk": sk_translations, "sl": sl_translations, "sq": sq_translations, "sr": sr_translations, "sv": sv_translations, "th": th_translations, "tr": tr_translations, "uk": uk_translations, "uz": uz_translations, "vi": vi_translations, "zh": zh_translations, "zh_tw": zh_tw_translations, } PK!erpendulum/lang/af.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Sondag', 1: 'Maandag', 2: 'Dinsdag', 3: 'Woensdag', 4: 'Donderdag', 5: 'Vrydag', 6: 'Saterdag' }, 'days_abbrev': { 0: 'Son', 1: 'Maa', 2: 'Din', 3: 'Woe', 4: 'Don', 5: 'Vry', 6: 'Sat' }, # Months 'months': { 1: 'Januarie', 2: 'Februarie', 3: 'Maart', 4: 'April', 5: 'Mei', 6: 'Junie', 7: 'Julie', 8: 'Augustus', 9: 'September', 10: 'Oktober', 11: 'November', 12: 'Desember', }, 'months_abbrev': { 1: 'Jan', 2: 'Feb', 3: 'Mrt', 4: 'Apr', 5: 'Mei', 6: 'Jun', 7: 'Jul', 8: 'Aug', 9: 'Sep', 10: 'Okt', 11: 'Nov', 12: 'Des', }, # Units of time 'year': ['{count} jaar', '{count} jare'], 'month': ['{count} maand', '{count} maande'], 'week': ['{count} week', '{count} weke'], 'day': ['{count} dag', '{count} dae'], 'hour': ['{count} uur', '{count} ure'], 'minute': ['{count} minuut', '{count} minute'], 'second': ['{count} sekond', '{count} sekondes'], # Relative time 'ago': '{time} terug', 'from_now': '{time} van nou af', 'after': '{time} na', 'before': '{time} voor', # Meridians 'meridian': lambda time: 'VM' if 0 <= time[0] < 12 else 'NM', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!%њ pendulum/lang/ar.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'الاثنين', 1: 'الأحد', 2: 'السبت', 3: 'الجمعة', 4: 'الخميس', 5: 'الأربعاء', 6: 'الثلاثاء' }, 'days_abbrev': { 0: 'اثنين', 1: 'أحد', 2: 'سبت', 3: 'جمعة', 4: 'خميس', 5: 'أربعاء', 6: 'ثلاثاء' }, # Months 'months': { 1: 'يوليو', 2: 'يونيو', 3: 'مايو', 4: 'أبريل', 5: 'مارس', 6: 'فبراير', 7: 'يناير', 8: 'ديسمبر', 9: 'نوفمبر', 10: 'أكتوبر', 11: 'سبتمبر', 12: 'أغسطس', }, 'months_abbrev': { 1: 'يوليو', 2: 'يونيو', 3: 'مايو', 4: 'أبريل', 5: 'مارس', 6: 'فبراير', 7: 'يناير', 8: 'ديسمبر', 9: 'نوفمبر', 10: 'أكتوبر', 11: 'سبتمبر', 12: 'أغسطس', }, # Units of time 'year': { 0: 'سنة', 1: 'سنة', 2: 'سنتين', (3, 10): '{count} سنوات', 'default': '{count} سنة' }, 'month': { 0: 'شهر', 1: ' شهر', 2: 'شهرين', (3, 10): '{count} أشهر', 'default': '{count} شهر' }, 'week': { 0: 'إسبوع', 1: 'إسبوع', 2: 'إسبوعين', (3, 10): '{count} أسابيع', 'default': '{count} إسبوع' }, 'day': { 0: 'يوم', 1: 'يوم', 2: 'يومين', (3, 10): '{count} أيام', 'default': ' يوم' }, 'hour': { 0: 'ساعة', 1: 'ساعة', 2: 'ساعتين', (3, 10): '{count} ساعات', 'default': '{count} ساعة' }, 'minute': { 0: 'دقيقة', 1: 'دقيقة', 2: 'دقيقتين', (3, 10): '{count} دقائق', 'default': '{count} دقيقة' }, 'second': { 0: 'ثانية', 1: 'ثانية', 2: 'ثانيتين', (3, 10): '{count} ثوان', 'default': '{count} ثانية' }, # Relative time 'ago': 'منذ {time}', 'from_now': 'من الآن {time}', 'after': 'بعد {time}', 'before': 'قبل {time}', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd D MMMM YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'D/\u200FM/\u200FYYYY', }, } PK!nkpendulum/lang/az.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Bazar', 1: 'Bazar ertəsi', 2: 'Çərşənbə axşamı', 3: 'Çərşənbə', 4: 'Cümə axşamı', 5: 'Cümə', 6: 'Şənbə' }, 'days_abbrev': { 0: 'Baz', 1: 'BzE', 2: 'ÇAx', 3: 'Çər', 4: 'CAx', 5: 'Cüm', 6: 'Şən' }, # Months 'months': { 1: 'yanvar', 2: 'fevral', 3: 'mart', 4: 'aprel', 5: 'may', 6: 'iyun', 7: 'iyul', 8: 'avqust', 9: 'sentyabr', 10: 'oktyabr', 11: 'noyabr', 12: 'dekabr', }, 'months_abbrev': { 1: 'yan', 2: 'fev', 3: 'mar', 4: 'apr', 5: 'may', 6: 'iyn', 7: 'iyl', 8: 'avq', 9: 'sen', 10: 'okt', 11: 'noy', 12: 'dek', }, # Units of time 'year': '{count} il', 'month': '{count} ay', 'week': '{count} həftə', 'day': '{count} gün', 'hour': '{count} saat', 'minute': '{count} dəqiqə', 'second': '{count} saniyə', # Relative time 'ago': '{time} öncə', 'from_now': '{time} sonra', 'after': '{time} sonra', 'before': '{time} öncə', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD.MM.YYYY', }, } PK!"Qpendulum/lang/bg.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'неделя', 1: 'понеделник', 2: 'вторник', 3: 'сряда', 4: 'четвъртък', 5: 'петък', 6: 'събота' }, 'days_abbrev': { 0: 'нед', 1: 'пон', 2: 'вт', 3: 'ср', 4: 'четв', 5: 'пет', 6: 'съб' }, # Months 'months': { 1: 'януари', 2: 'февруари', 3: 'март', 4: 'април', 5: 'май', 6: 'юни', 7: 'юли', 8: 'август', 9: 'септември', 10: 'октомври', 11: 'ноември', 12: 'декември', }, 'months_abbrev': { 1: 'ян', 2: 'февр', 3: 'март', 4: 'апр', 5: 'май', 6: 'юни', 7: 'юли', 8: 'авг', 9: 'септ', 10: 'окт', 11: 'ноем', 12: 'дек', }, # Units of time 'year': ['{count} година', '{count} години'], 'month': ['{count} месец', '{count} месеца'], 'week': ['{count} седмица', '{count} седмици'], 'day': ['{count} ден', '{count} дни'], 'hour': ['{count} час', '{count} часа'], 'minute': ['{count} минута', '{count} минути'], 'second': ['{count} секунда', '{count} секунди'], # Relative time 'ago': 'преди {time}', 'from_now': '{time} от сега', 'after': 'след {time}', 'before': 'преди {time}', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd, D MMMM YYYY H:mm', 'LLL': 'D MMMM YYYY H:mm', 'LL': 'D MMMM YYYY', 'L': 'D.MM.YYYY', }, } PK!u2& & pendulum/lang/bn.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'রবিবার', 1: 'সোমবার', 2: 'মঙ্গলবার', 3: 'বুধবার', 4: 'বৃহস্পতিবার', 5: 'শুক্রবার', 6: 'শনিবার' }, 'days_abbrev': { 0: 'রবি', 1: 'সোম', 2: 'মঙ্গল', 3: 'বুধ', 4: 'বৃহঃ', 5: 'শুক্র', 6: 'শনি' }, # Months 'months': { 1: 'জানুয়ারি', 2: 'ফেব্রুয়ারি', 3: 'মার্চ', 4: 'এপ্রিল', 5: 'মে', 6: 'জুন', 7: 'জুলাই', 8: 'আগস্ট', 9: 'সেপ্টেম্বর', 10: 'অক্টোবর', 11: 'নভেম্বর', 12: 'ডিসেম্বর', }, 'months_abbrev': { 1: 'জানু', 2: 'ফেব', 3: 'মার্চ', 4: 'এপ্রি', 5: 'মে', 6: 'জুন', 7: 'জুল', 8: 'অগা', 9: 'সেপ্ট', 10: 'অক্টো', 11: 'নভে', 12: 'ডিসে', }, # Units of time 'year': ['১ বছর', '{count} বছর'], 'month': ['১ মাস', '{count} মাস'], 'week': ['১ সপ্তাহ', '{count} সপ্তাহ'], 'day': ['১ দিন', '{count} দিন'], 'hour': ['১ ঘন্টা', '{count} ঘন্টা'], 'minute': ['১ মিনিট', '{count} মিনিট'], 'second': ['১ সেকেন্ড', '{count} সেকেন্ড'], 'ago': '{time} পূর্বে', 'from_now': 'এখন থেকে {time}', 'after': '{time} পরে', 'before': '{time} আগে', # Meridians 'meridian': lambda time: 'সকাল' if 0 <= time[0] < 12 else 'বিকাল', # Date formats 'date_formats': { 'LTS': 'A h:mm:ss সময়', 'LT': 'A h:mm সময়', 'LLLL': 'dddd, D MMMM YYYY, A h:mm সময়', 'LLL': 'D MMMM YYYY, A h:mm সময়', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!eppendulum/lang/ca.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Diumenge', 1: 'Dilluns', 2: 'Dimarts', 3: 'Dimecres', 4: 'Dijous', 5: 'Divendres', 6: 'Dissabte' }, 'days_abbrev': { 0: 'Diumenge', 1: 'Dilluns', 2: 'Dimarts', 3: 'Dimecres', 4: 'Dijous', 5: 'Divendres', 6: 'Dissabte' }, # Months 'months': { 1: 'Gener', 2: 'Febrer', 3: 'Març', 4: 'Abril', 5: 'Maig', 6: 'Juny', 7: 'Juliol', 8: 'Agost', 9: 'Setembre', 10: 'Octubre', 11: 'Novembre', 12: 'Desembre', }, 'months_abbrev': { 1: 'Gener', 2: 'Febrer', 3: 'Març', 4: 'Abril', 5: 'Maig', 6: 'Juny', 7: 'Juliol', 8: 'Agost', 9: 'Setembre', 10: 'Octubre', 11: 'Novembre', 12: 'Desembre', }, # Units of time 'year': ['{count} any', '{count} anys'], 'month': ['{count} mes', '{count} mesos'], 'week': ['{count} setmana', '{count} setmanes'], 'day': ['{count} dia', '{count} díes'], 'hour': ['{count} hora', '{count} hores'], 'minute': ['{count} minut', '{count} minuts'], 'second': ['{count} segon', '{count} segons'], # Relative time 'ago': 'Fa {time}', 'from_now': 'Dins de {time}', 'after': '{time} després', 'before': '{time} abans', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd D MMMM YYYY H:mm', 'LLL': 'D MMMM YYYY H:mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!^ppendulum/lang/cs.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'neděle', 1: 'pondělí', 2: 'úterý', 3: 'středa', 4: 'čtvrtek', 5: 'pátek', 6: 'sobota' }, 'days_abbrev': { 0: 'ne', 1: 'po', 2: 'út', 3: 'st', 4: 'čt', 5: 'pá', 6: 'so' }, # Months 'months': { 1: 'leden', 2: 'únor', 3: 'březen', 4: 'duben', 5: 'květen', 6: 'červen', 7: 'červenec', 8: 'srpen', 9: 'září', 10: 'říjen', 11: 'listopad', 12: 'prosinec', }, 'months_abbrev': { 1: 'led', 2: 'úno', 3: 'bře', 4: 'dub', 5: 'kvě', 6: 'čvn', 7: 'čvc', 8: 'srp', 9: 'zář', 10: 'říj', 11: 'lis', 12: 'pro', }, # Units of time 'year': ['{count} rok', '{count} roky', '{count} let'], 'month': ['{count} měsíc', '{count} měsíce', '{count} měsíců'], 'week': ['{count} týden', '{count} týdny', '{count} týdnů'], 'day': ['{count} den', '{count} dny', '{count} dní'], 'hour': ['{count} hodina', '{count} hodiny', '{count} hodin'], 'minute': ['{count} minuta', '{count} minuty', '{count} minut'], 'second': ['{count} sekunda', '{count} sekundy', '{count} sekund'], # Relative time 'ago': '{time} nazpět', 'from_now': 'za {time}', 'after': '{time} později', 'before': '{time} předtím', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd D. MMMM YYYY H:mm', 'LLL': 'D. MMMM YYYY H:mm', 'LL': 'D. MMMM YYYY', 'L': 'DD.MM.YYYY', }, } PK!7{{pendulum/lang/da.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'søndag', 1: 'mandag', 2: 'tirsdag', 3: 'onsdag', 4: 'torsdag', 5: 'fredag', 6: 'lørdag' }, 'days_abbrev': { 0: 'søn', 1: 'man', 2: 'tir', 3: 'ons', 4: 'tor', 5: 'fre', 6: 'lør' }, # Months 'months': { 1: 'januar', 2: 'februar', 3: 'marts', 4: 'april', 5: 'maj', 6: 'juni', 7: 'juli', 8: 'august', 9: 'september', 10: 'oktober', 11: 'november', 12: 'december', }, 'months_abbrev': { 1: 'jan', 2: 'feb', 3: 'mar', 4: 'apr', 5: 'maj', 6: 'jun', 7: 'jul', 8: 'aug', 9: 'sep', 10: 'okt', 11: 'nov', 12: 'dec', }, # Units of time 'year': ['{count} år', '{count} år'], 'month': ['{count} måned', '{count} måneder'], 'week': ['{count} uge', '{count} uger'], 'day': ['{count} dag', '{count} dage'], 'hour': ['{count} time', '{count} timer'], 'minute': ['{count} minut', '{count} minutter'], 'second': ['{count} sekund', '{count} sekunder'], # Relative time 'ago': '{time} siden', 'from_now': 'om {time}', 'after': '{time} efter', 'before': '{time} før', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd [d.] D. MMMM YYYY HH:mm', 'LLL': 'D. MMMM YYYY HH:mm', 'LL': 'D. MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!>롰77pendulum/lang/de.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Sonntag', 1: 'Montag', 2: 'Dienstag', 3: 'Mittwoch', 4: 'Donnerstag', 5: 'Freitag', 6: 'Samstag' }, 'days_abbrev': { 0: 'So', 1: 'Mo', 2: 'Di', 3: 'Mi', 4: 'Do', 5: 'Fr', 6: 'Sa' }, # Months 'months': { 1: 'Januar', 2: 'Februar', 3: 'März', 4: 'April', 5: 'Mai', 6: 'Juni', 7: 'Juli', 8: 'August', 9: 'September', 10: 'Oktober', 11: 'November', 12: 'Dezember', }, 'months_abbrev': { 1: 'Jan', 2: 'Feb', 3: 'Mär', 4: 'Apr', 5: 'Mai', 6: 'Jun', 7: 'Jul', 8: 'Aug', 9: 'Sep', 10: 'Okt', 11: 'Nov', 12: 'Dez', }, # Units of time 'year': ['{count} Jahr', '{count} Jahre'], 'month': ['{count} Monat', '{count} Monate'], 'week': ['{count} Woche', '{count} Wochen'], 'day': ['{count} Tag', '{count} Tage'], 'hour': ['{count} Stunde', '{count} Stunden'], 'minute': ['{count} Minute', '{count} Minuten'], 'second': ['{count} Sekunde', '{count} Sekunden'], # Relative time 'ago': 'vor {time}', 'from_now': 'in {time}', 'after': '{time} später', 'before': '{time} zuvor', 'year_from_now': ['{count} Jahr', '{count} Jahren'], 'month_from_now': ['{count} Monat', '{count} Monaten'], 'week_from_now': ['{count} Woche', '{count} Wochen'], 'day_from_now': ['{count} Tag', '{count} Tagen'], 'year_ago': ['{count} Jahr', '{count} Jahren'], 'month_ago': ['{count} Monat', '{count} Monaten'], 'week_ago': ['{count} Woche', '{count} Wochen'], 'day_ago': ['{count} Tag', '{count} Tagen'], # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D. MMMM YYYY HH:mm', 'LLL': 'D. MMMM YYYY HH:mm', 'LL': 'D. MMMM YYYY', 'L': 'DD.MM.YYYY', }, } PK!rpendulum/lang/el.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Κυριακή', 1: 'Δευτέρα', 2: 'Τρίτη', 3: 'Τετάρτη', 4: 'Πέμπτη', 5: 'Παρασκευή', 6: 'Σάββατο' }, 'days_abbrev': { 0: 'Κυρ', 1: 'Δευ', 2: 'Τρι', 3: 'Τετ', 4: 'Πεμ', 5: 'Παρ', 6: 'Σαβ' }, # Months 'months': { 1: 'Ιανουαρίου', 2: 'Φεβρουαρίου', 3: 'Μαρτίου', 4: 'Απριλίου', 5: 'Μαΐου', 6: 'Ιουνίου', 7: 'Ιουλίου', 8: 'Αυγούστου', 9: 'Σεπτεμβρίου', 10: 'Οκτωβρίου', 11: 'Νοεμβρίου', 12: 'Δεκεμβρίου', }, 'months_abbrev': { 1: 'Ιαν', 2: 'Φεβ', 3: 'Μαρ', 4: 'Απρ', 5: 'Μαϊ', 6: 'Ιον', 7: 'Ιολ', 8: 'Αυγ', 9: 'Σεπ', 10: 'Οκτ', 11: 'Νοε', 12: 'Δεκ', }, # Units of time 'year': ['{count} χρόνος', '{count} χρόνια'], 'month': ['{count} μήνας', '{count} μήνες'], 'week': ['{count} εβδομάδα', '{count} εβδομάδες'], 'day': ['{count} μέρα', '{count} μέρες'], 'hour': ['{count} ώρα', '{count} ώρες'], 'minute': ['{count} λεπτό', '{count} λεπτά'], 'second': ['{count} δευτερόλεπτο', '{count} δευτερόλεπτα'], # Relative time 'ago': 'πρίν απο {time}', 'from_now': 'σε {time} απο τώρα', 'after': '{time} μετά', 'before': '{time} πρίν', # Date formats 'date_formats': { 'LTS': 'h:mm:ss A', 'LT': 'h:mm A', 'LLLL': 'dddd, D MMMM YYYY h:mm A', 'LLL': 'D MMMM YYYY h:mm A', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!;xxpendulum/lang/en.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Sunday', 1: 'Monday', 2: 'Tuesday', 3: 'Wednesday', 4: 'Thursday', 5: 'Friday', 6: 'Saturday' }, 'days_abbrev': { 0: 'Sun', 1: 'Mon', 2: 'Tue', 3: 'Wed', 4: 'Thu', 5: 'Fri', 6: 'Sat' }, # Months 'months': { 1: 'January', 2: 'February', 3: 'March', 4: 'April', 5: 'May', 6: 'June', 7: 'July', 8: 'August', 9: 'September', 10: 'October', 11: 'November', 12: 'December', }, 'months_abbrev': { 1: 'Jan', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'May', 6: 'Jun', 7: 'Jul', 8: 'Aug', 9: 'Sep', 10: 'Oct', 11: 'Nov', 12: 'Dec', }, # Units of time 'year': ['{count} year', '{count} years'], 'month': ['{count} month', '{count} months'], 'week': ['{count} week', '{count} weeks'], 'day': ['{count} day', '{count} days'], 'hour': ['{count} hour', '{count} hours'], 'minute': ['{count} minute', '{count} minutes'], 'second': ['{count} second', '{count} seconds'], # Relative time 'ago': '{time} ago', 'from_now': '{time} from now', 'after': '{time} after', 'before': '{time} before', # Ordinals 'ordinal': lambda x: 'th' if 10 <= x % 100 < 20 else {1: 'st', 2: 'nd', 3: 'rd'}.get(x % 10, "th"), # Meridians # [time] is a (hour, minute) tuple 'meridian': lambda time: 'AM' if 0 <= time[0] < 12 else 'PM', # Date formats 'date_formats': { 'LTS': 'h:mm:ss A', 'LT': 'h:mm A', 'L': 'MM/DD/YYYY', 'LL': 'MMMM D, YYYY', 'LLL': 'MMMM D, YYYY h:mm A', 'LLLL': 'dddd, MMMM D, YYYY h:mm A', }, } PK!pendulum/lang/eo.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'dimanĉo', 1: 'lundo', 2: 'mardo', 3: 'merkredo', 4: 'ĵaŭdo', 5: 'vendredo', 6: 'sabato' }, 'days_abbrev': { 0: 'dim', 1: 'lun', 2: 'mar', 3: 'mer', 4: 'ĵaŭ', 5: 'ven', 6: 'sab' }, # Months 'months': { 1: 'januaro', 2: 'februaro', 3: 'marto', 4: 'aprilo', 5: 'majo', 6: 'junio', 7: 'julio', 8: 'aŭgusto', 9: 'septembro', 10: 'oktobro', 11: 'novembro', 12: 'decembro', }, 'months_abbrev': { 1: 'jan', 2: 'feb', 3: 'mar', 4: 'apr', 5: 'maj', 6: 'jun', 7: 'jul', 8: 'aŭg', 9: 'sep', 10: 'okt', 11: 'nov', 12: 'dec', }, # Units of time 'year': ['{count} jaro', '{count} jaroj'], 'month': ['{count} monato', '{count} monatoj'], 'week': ['{count} semajno', '{count} semajnoj'], 'day': ['{count} tago', '{count} tagoj'], 'hour': ['{count} horo', '{count} horoj'], 'minute': ['{count} minuto', '{count} minutoj'], 'second': ['{count} sekundo', '{count} sekundoj'], # Relative time 'ago': 'antaŭ {time}', 'from_now': 'je {time}', 'after': '{time} poste', 'before': '{time} antaŭe', # Meridians 'meridian': lambda time: 'ATM' if 0 <= time[0] < 12 else 'PTM', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, [la] D[-an de] MMMM, YYYY HH:mm', 'LLL': 'D[-an de] MMMM, YYYY HH:mm', 'LL': 'D[-an de] MMMM, YYYY', 'L': 'YYYY-MM-DD', }, } PK!&NJ.pendulum/lang/es.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'domingo', 1: 'lunes', 2: 'martes', 3: 'miércoles', 4: 'jueves', 5: 'viernes', 6: 'sábado', }, 'days_abbrev': { 0: 'dom', 1: 'lun', 2: 'mar', 3: 'mie', 4: 'jue', 5: 'vie', 6: 'sab' }, # Months 'months': { 1: 'enero', 2: 'febrero', 3: 'marzo', 4: 'abril', 5: 'mayo', 6: 'junio', 7: 'julio', 8: 'agosto', 9: 'septiembre', 10: 'octubre', 11: 'noviembre', 12: 'diciembre', }, 'months_abbrev': { 1: 'ene', 2: 'feb', 3: 'mar', 4: 'abr', 5: 'may', 6: 'jun', 7: 'jul', 8: 'ago', 9: 'sep', 10: 'oct', 11: 'nov', 12: 'dec', }, # Units of time 'year': ['{count} año', '{count} años'], 'month': ['{count} mes', '{count} meses'], 'week': ['{count} semana', '{count} semanas'], 'day': ['{count} día', '{count} días'], 'hour': ['{count} hora', '{count} horas'], 'minute': ['{count} minuto', '{count} minutos'], 'second': ['{count} segundo', '{count} segundos'], # Relative time 'ago': 'hace {time}', 'from_now': 'dentro de {time}', 'after': '{time} después', 'before': '{time} antes', # Ordinals 'ordinal': 'º', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd, D [de] MMMM [de] YYYY H:mm', 'LLL': 'D [de] MMMM [de] YYYY H:mm', 'LL': 'D [de] MMMM [de] YYYY', 'L': 'DD/MM/YYYY', }, } PK!w pendulum/lang/et.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'pühapäev', 1: 'esmaspäev', 2: 'teisipäev', 3: 'kolmapäev', 4: 'neljapäev', 5: 'reede', 6: 'laupäev' }, 'days_abbrev': { 0: 'P', 1: 'E', 2: 'T', 3: 'K', 4: 'N', 5: 'R', 6: 'L' }, # Months 'months': { 1: 'jaanuar', 2: 'veebruar', 3: 'märts', 4: 'aprill', 5: 'mai', 6: 'juuni', 7: 'juuli', 8: 'august', 9: 'september', 10: 'oktoober', 11: 'november', 12: 'detsember', }, 'months_abbrev': { 1: 'jaan', 2: 'veebr', 3: 'märts', 4: 'apr', 5: 'mai', 6: 'juuni', 7: 'juuli', 8: 'aug', 9: 'sept', 10: 'okt', 11: 'nov', 12: 'dets', }, # Units of time 'year': ['{count} aasta', '{count} aastat'], 'month': ['{count} kuu', '{count} kuud'], 'week': ['{count} nädal', '{count} nädalat'], 'day': ['{count} päev', '{count} päeva'], 'hour': ['{count} tund', '{count} tundi'], 'minute': ['{count} minut', '{count} minutit'], 'second': ['{count} sekund', '{count} sekundit'], # Relative time 'ago': '{time} tagasi', 'from_now': '{time} pärast', 'after': '{time} pärast', 'before': '{time} enne', 'year_from_now': '{count} aasta', 'month_from_now': '{count} kuu', 'week_from_now': '{count} nädala', 'day_from_now': '{count} päeva', 'hour_from_now': '{count} tunni', 'minute_from_now': '{count} minuti', 'second_from_now': '{count} sekundi', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LLLL': 'dddd, D. MMMM YYYY H:mm', 'LLL': 'dddd, D. MMMM YYYY H:mm', 'LL': 'dddd, D. MMMM YYYY H:mm', 'L': 'dddd, D. MMMM YYYY H:mm', }, } PK![pendulum/lang/eu.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'igandea', 1: 'astelehena', 2: 'asteartea', 3: 'asteazkena', 4: 'osteguna', 5: 'ostirala', 6: 'larunbata' }, 'days_abbrev': { 0: 'ig', 1: 'al', 2: 'ar', 3: 'az', 4: 'og', 5: 'ol', 6: 'lr' }, # Months 'months': { 1: 'urtarrilak', 2: 'otsailak', 3: 'martxoak', 4: 'apirilak', 5: 'maiatzak', 6: 'ekainak', 7: 'uztailak', 8: 'abuztuak', 9: 'irailak', 10: 'urriak', 11: 'azaroak', 12: 'abenduak', }, 'months_abbrev': { 1: 'urt', 2: 'ots', 3: 'mar', 4: 'api', 5: 'mai', 6: 'eka', 7: 'uzt', 8: 'abu', 9: 'ira', 10: 'urr', 11: 'aza', 12: 'abe', }, # Units of time 'year': ['Urte 1', '{count} urte'], 'month': ['Hile 1', '{count} hile'], 'week': ['Aste 1', '{count} aste'], 'day': ['Egun 1', '{count} egun'], 'hour': ['Ordu 1', '{count} ordu'], 'minute': ['Minutu 1', '{count} minutu'], 'second': ['Segundu 1', '{count} segundu'], # Relative time 'ago': 'Orain dela {time}', 'from_now': '{time} barru', 'after': '{time} geroago', 'before': '{time} lehenago', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', 'LLL': 'YYYY[ko] MMMM[ren] D[a] HH:mm', 'LL': 'YYYY[ko] MMMM[ren] D[a]', 'L': 'YYYY-MM-DD', }, } PK!ZLaapendulum/lang/fa.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'یکشنبه', 1: 'دو شنبه', 2: 'سه شنبه', 3: 'چهارشنبه', 4: 'پنجشنبه', 5: 'جمعه', 6: 'شنبه' }, 'days_abbrev': { 0: 'یکشنبه', 1: 'دوشنبه', 2: 'سهشنبه', 3: 'چهارشنبه', 4: 'پنجشنبه', 5: 'جمعه', 6: 'شنبه' }, # Months 'months': { 1: 'ژانویه', 2: 'فوریه', 3: 'مارس', 4: 'آوریل', 5: 'مه', 6: 'ژوئن', 7: 'ژوئیه', 8: 'اوت', 9: 'سپتامبر', 10: 'اکتبر', 11: 'نوامبر', 12: 'دسامبر' }, 'months_abbrev': { 1: 'ژانویه', 2: 'فوریه', 3: 'مارس', 4: 'آوریل', 5: 'مه', 6: 'ژوئن', 7: 'ژوئیه', 8: 'اوت', 9: 'سپتامبر', 10: 'اکتبر', 11: 'نوامبر', 12: 'دسامبر', }, # Units of time 'year': '{count} سال', 'month': '{count} ماه', 'week': '{count} هفته', 'day': '{count} روز', 'hour': '{count} ساعت', 'minute': '{count} دقیقه', 'second': '{count} ثانیه', # Relative time 'ago': '{time} پیش', 'from_now': '{time} بعد', 'after': '{time} پس از', 'before': '{time} پیش از', # Meridians 'meridian': lambda time: 'قبل از ظهر' if 0 <= time[0] < 12 else 'بعد از ظهر', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!7mpendulum/lang/fi.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'sunnuntai', 1: 'maanantai', 2: 'tiistai', 3: 'keskiviikko', 4: 'torstai', 5: 'perjantai', 6: 'lauantai' }, 'days_abbrev': { 0: 'su', 1: 'ma', 2: 'ti', 3: 'ke', 4: 'to', 5: 'pe', 6: 'la' }, # Months 'months': { 1: 'tammikuu', 2: 'helmikuu', 3: 'maaliskuu', 4: 'huhtikuu', 5: 'toukokuu', 6: 'kesäkuu', 7: 'heinäkuu', 8: 'elokuu', 9: 'syyskuu', 10: 'lokakuu', 11: 'marraskuu', 12: 'joulukuu', }, 'months_abbrev': { 1: 'tammi', 2: 'helmi', 3: 'maalis', 4: 'huhti', 5: 'touko', 6: 'kesä', 7: 'heinä', 8: 'elo', 9: 'syys', 10: 'loka', 11: 'marras', 12: 'joulu', }, # Units of time 'year': ['{count} vuosi', '{count} vuotta'], 'month': ['{count} kuukausi', '{count} kuukautta'], 'week': ['{count} viikko', '{count} viikkoa'], 'day': ['{count} päivä', '{count} päivää'], 'hour': ['{count} tunti', '{count} tuntia'], 'minute': ['{count} minuutti', '{count} minuuttia'], 'second': ['{count} sekunti', '{count} sekuntia'], # Relative time 'ago': '{time} sitten', 'from_now': '{time} tästä hetkestä', 'after': '{time} sen jälkeen', 'before': '{time} ennen', # Date formats 'date_formats': { 'LTS': 'HH.mm.ss', 'LT': 'HH.mm', 'LLLL': 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', 'LLL': 'Do MMMM[ta] YYYY, [klo] HH.mm', 'LL': 'Do MMMM[ta] YYYY', 'L': 'DD.MM.YYYY', }, } PK!Tpendulum/lang/fo.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'sunnudagur', 1: 'mánadagur', 2: 'týsdagur', 3: 'mikudagur', 4: 'hósdagur', 5: 'fríggjadagur', 6: 'leygardagur' }, 'days_abbrev': { 0: 'sun', 1: 'mán', 2: 'týs', 3: 'mik', 4: 'hós', 5: 'frí', 6: 'ley' }, # Months 'months': { 1: 'januar', 2: 'februar', 3: 'mars', 4: 'apríl', 5: 'mai', 6: 'juni', 7: 'juli', 8: 'august', 9: 'september', 10: 'oktober', 11: 'november', 12: 'desember', }, 'months_abbrev': { 1: 'jan', 2: 'feb', 3: 'mar', 4: 'apr', 5: 'mai', 6: 'jun', 7: 'jul', 8: 'aug', 9: 'sep', 10: 'okt', 11: 'nov', 12: 'des', }, # Units of time 'year': ['{count} ár', '{count} ár'], 'month': ['{count} mánaður', '{count} mánaðir'], 'week': ['{count} vika', '{count} vikur'], 'day': ['{count} dag', '{count} dagar'], 'hour': ['{count} tími', '{count} tímar'], 'minute': ['{count} minutt', '{count} minuttir'], 'second': ['{count} sekund', '{count} sekundir'], # Relative time 'ago': '{time} síðan', 'from_now': 'um {time}', 'after': '{time} aftaná', 'before': '{time} áðrenn', # Ordinals 'ordinal': '.', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd D. MMMM, YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK! pendulum/lang/fr.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'dimanche', 1: 'lundi', 2: 'mardi', 3: 'mercredi', 4: 'jeudi', 5: 'vendredi', 6: 'samedi' }, 'days_abbrev': { 0: 'dim', 1: 'lun', 2: 'mar', 3: 'mer', 4: 'jeu', 5: 'ven', 6: 'sam' }, # Months 'months': { 1: 'janvier', 2: 'février', 3: 'mars', 4: 'avril', 5: 'mai', 6: 'juin', 7: 'juillet', 8: 'août', 9: 'septembre', 10: 'octobre', 11: 'novembre', 12: 'décembre', }, 'months_abbrev': { 1: 'janv', 2: 'févr', 3: 'mars', 4: 'avr', 5: 'mai', 6: 'juin', 7: 'juil', 8: 'août', 9: 'sept', 10: 'oct', 11: 'nov', 12: 'déc', }, # Units of time 'year': ['{count} an', '{count} ans'], 'month': '{count} mois', 'week': ['{count} semaine', '{count} semaines'], 'day': ['{count} jour', '{count} jours'], 'hour': ['{count} heure', '{count} heures'], 'minute': ['{count} minute', '{count} minutes'], 'second': ['{count} seconde', '{count} secondes'], # Relative Time 'ago': 'il y a {time}', 'from_now': 'dans {time}', 'after': '{time} après', 'before': '{time} avant', # Ordinals 'ordinal': { 1: 'er', 'default': 'e' }, # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd D MMMM YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!#pendulum/lang/gl.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Domingo', 1: 'Luns', 2: 'Martes', 3: 'Mércores', 4: 'Xoves', 5: 'Venres', 6: 'Sábado' }, 'days_abbrev': { 0: 'Dom.', 1: 'Lun.', 2: 'Mar.', 3: 'Mér.', 4: 'Xov.', 5: 'Ven.', 6: 'Sáb.' }, # Months 'months': { 1: 'Xaneiro', 2: 'Febreiro', 3: 'Marzo', 4: 'Abril', 5: 'Maio', 6: 'Xuño', 7: 'Xullo', 8: 'Agosto', 9: 'Setembro', 10: 'Outubro', 11: 'Novembro', 12: 'Decembro', }, 'months_abbrev': { 1: 'Xan.', 2: 'Feb.', 3: 'Mar.', 4: 'Abr.', 5: 'Mai.', 6: 'Xuñ.', 7: 'Xul.', 8: 'Ago.', 9: 'Set.', 10: 'Out.', 11: 'Nov.', 12: 'Dec.' }, # Units of time 'year': ['{count} ano', '{count} anos'], 'month': ['{count} mes', '{count} meses'], 'week': ['{count} semana', '{count} semanas'], 'day': ['{count} día', '{count} días'], 'hour': ['{count} hora', '{count} horas'], 'minute': ['{count} minuto', '{count} minutos'], 'second': ['{count} segundo', '{count} segundos'], # Relative time 'ago': 'fai {time}', 'from_now': 'dentro de {time}', 'after': '{time} despois', 'before': '{time} antes', # Ordinals 'ordinal': 'º', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd D MMMM YYYY H:mm', 'LLL': 'D MMMM YYYY H:mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!wpendulum/lang/he.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'ראשון', 1: 'שני', 2: 'שלישי', 3: 'רביעי', 4: 'חמישי', 5: 'שישי', 6: 'שבת' }, 'days_abbrev': { 0: 'א׳', 1: 'ב׳', 2: 'ג׳', 3: 'ד׳', 4: 'ה׳', 5: 'ו׳', 6: 'ש׳' }, # Months 'months': { 1: 'ינואר', 2: 'פברואר', 3: 'מרץ', 4: 'אפריל', 5: 'מאי', 6: 'יוני', 7: 'יולי', 8: 'אוגוסט', 9: 'ספטמבר', 10: 'אוקטובר', 11: 'נובמבר', 12: 'דצמבר', }, 'months_abbrev': { 1: 'ינו׳', 2: 'פבר׳', 3: 'מרץ', 4: 'אפר׳', 5: 'מאי', 6: 'יוני', 7: 'יולי', 8: 'אוג׳', 9: 'ספט׳', 10: 'אוק׳', 11: 'נוב׳', 12: 'דצמ׳', }, # Units of time 'year': { 1: 'שנה', 2: 'שנתיים', 'default': '{count} שנים' }, 'month': { 1: 'חודש', 2: 'חודשיים', 'default': '{count} חודשים' }, 'week': { 1: 'שבוע', 2: 'שבועיים', 'default': '{count} שבועות' }, 'day': { 1: 'יום', 2: 'יומיים', 'default': '{count} ימים' }, 'hour': { 1: 'שעה', 2: 'שעתיים', 'default': '{count} שעות' }, 'minute': { 1: 'דקה', 2: 'דקותיים', 'default': '{count} דקות' }, 'second': ['שניה', '{count} שניות'], # Relative time 'ago': 'לפני {time}', 'from_now': 'בעוד {time}', 'after': 'אחרי {time}', 'before': 'לפני {time}', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D [ב]MMMM YYYY HH:mm', 'LLL': 'D [ב]MMMM YYYY HH:mm', 'LL': 'D [ב]MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!fj))pendulum/lang/hr.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Nedjelja', 1: 'Ponedjeljak', 2: 'Utorak', 3: 'Srijeda', 4: 'Četvrtak', 5: 'Petak', 6: 'Subota' }, 'days_abbrev': { 0: 'Ne', 1: 'Po', 2: 'Ut', 3: 'Sr', 4: 'Če', 5: 'Pe', 6: 'Su' }, # Months 'months': { 1: 'Siječanj', 2: 'Veljača', 3: 'Ožujak', 4: 'Travanj', 5: 'Svibanj', 6: 'Lipanj', 7: 'Srpanj', 8: 'Kolovoz', 9: 'Rujan', 10: 'Listopad', 11: 'Studeni', 12: 'Prosinac', }, 'months_abbrev': { 1: 'Sij', 2: 'Velj', 3: 'Ožu', 4: 'Tra', 5: 'Svi', 6: 'Lip', 7: 'Srp', 8: 'Kol', 9: 'Ruj', 10: 'Lis', 11: 'Stu', 12: 'Pro', }, # Units of time 'year': ['{count} godinu', '{count} godine', '{count} godina'], 'month': ['{count} mjesec', '{count} mjeseca', '{count} mjeseci'], 'week': ['{count} tjedan', '{count} tjedna', '{count} tjedana'], 'day': ['{count} dan', '{count} dana', '{count} dana'], 'hour': ['{count} sat', '{count} sata', '{count} sati'], 'minute': ['{count} minutu', '{count} minute ', '{count} minuta'], 'second': ['{count} sekundu', '{count} sekunde', '{count} sekundi'], # Relative time 'ago': 'prije {time}', 'from_now': 'za {time}', 'after': 'za {time}', 'before': 'prije {time}', # Ordinals 'ordinal': '.', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd, D. MMMM YYYY H:mm', 'LLL': 'D. MMMM YYYY H:mm', 'LL': 'D. MMMM YYYY', 'L': 'DD. MM. YYYY', }, } PK!wW pendulum/lang/hu.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'vasárnap', 1: 'hétfő', 2: 'kedd', 3: 'szerda', 4: 'csütörtök', 5: 'péntek', 6: 'szombat' }, 'days_abbrev': { 0: 'vas', 1: 'hét', 2: 'kedd', 3: 'szer', 4: 'csüt', 5: 'pént', 6: 'szom' }, # Months 'months': { 1: 'január', 2: 'február', 3: 'március', 4: 'április', 5: 'május', 6: 'június', 7: 'július', 8: 'augusztus', 9: 'szeptember', 10: 'október', 11: 'november', 12: 'december', }, 'months_abbrev': { 1: 'jan', 2: 'febr', 3: 'márc', 4: 'ápr', 5: 'máj', 6: 'jún', 7: 'júl', 8: 'aug', 9: 'szept', 10: 'okt', 11: 'nov', 12: 'dec', }, # Units of time 'year': '{count} év', 'month': '{count} hónap', 'week': '{count} hét', 'day': '{count} nap', 'hour': '{count} óra', 'minute': '{count} perc', 'second': '{count} másodperc', # Relative time 'ago': '{time}', 'from_now': '{time} múlva', 'after': '{time} később', 'before': '{time} korábban', 'year_ago': '{count} éve', 'month_ago': '{count} hónapja', 'week_ago': '{count} hete', 'day_ago': '{count} napja', 'hour_ago': '{count} órája', 'minute_ago': '{count} perce', 'second_ago': '{count} másodperce', 'year_after': '{count} évvel', 'month_after': '{count} hónappal', 'week_after': '{count} héttel', 'day_after': '{count} nappal', 'hour_after': '{count} órával', 'minute_after': '{count} perccel', 'second_after': '{count} másodperccel', 'year_before': '{count} évvel', 'month_before': '{count} hónappal', 'week_before': '{count} héttel', 'day_before': '{count} nappal', 'hour_before': '{count} órával', 'minute_before': '{count} perccel', 'second_before': '{count} másodperccel', # Meridians 'meridian': lambda time: 'DE' if 0 <= time[0] < 12 else 'DU', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'YYYY. MMMM D., dddd H:mm', 'LLL': 'YYYY. MMMM D. H:mm', 'LL': 'YYYY. MMMM D.', 'L': 'YYYY.MM.DD.', }, } PK!cϻpendulum/lang/hy.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'կիրակի', 1: 'երկուշաբթի', 2: 'երեքշաբթի', 3: 'չորեքշաբթի', 4: 'հինգշաբթի', 5: 'ուրբաթ', 6: 'շաբաթ' }, 'days_abbrev': { 0: 'կրկ', 1: 'երկ', 2: 'երք', 3: 'չրք', 4: 'հնգ', 5: 'ուրբ', 6: 'շբթ' }, # Months 'months': { 1: 'հունվար', 2: 'փետրվար', 3: 'մարտ', 4: 'ապրիլ', 5: 'մայիս', 6: 'հունիս', 7: 'հուլիս', 8: 'օգոստոս', 9: 'սեպտեմբեր', 10: 'հոկտեմբեր', 11: 'նոյեմբեր', 12: 'դեկտեմբեր', }, 'months_abbrev': { 1: 'հնվ', 2: 'փտր', 3: 'մրտ', 4: 'ապր', 5: 'մյս', 6: 'հնս', 7: 'հլս', 8: 'օգս', 9: 'սպտ', 10: 'հկտ', 11: 'նմբ', 12: 'դկտ', }, # Units of time 'year': '{count} տարի', 'month': '{count} ամիս', 'week': '{count} շաբաթ', 'day': '{count} օր', 'hour': '{count} ժամ', 'minute': '{count} րոպե', 'second': '{count} վայրկյան', # Relative time 'ago': '{time} առաջ', 'from_now': '{time} հետո', 'after': '{time} հետո', 'before': '{time} առաջ', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM YYYY թ., HH:mm', 'LLL': 'D MMMM YYYY թ., HH:mm', 'LL': 'D MMMM YYYY թ.', 'L': 'DD.MM.YYYY', }, } PK!فypendulum/lang/id.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Minggu', 1: 'Senin', 2: 'Selasa', 3: 'Rabu', 4: 'Kamis', 5: 'Jumat', 6: 'Sabtu' }, 'days_abbrev': { 0: 'Min', 1: 'Sen', 2: 'Sel', 3: 'Rab', 4: 'Kam', 5: 'Jum', 6: 'Sab' }, # Months 'months': { 1: 'Januari', 2: 'Februari', 3: 'Maret', 4: 'April', 5: 'Mei', 6: 'Juni', 7: 'Juli', 8: 'Agustus', 9: 'September', 10: 'Oktober', 11: 'November', 12: 'Desember' }, 'months_abbrev': { 1: 'Jan', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'Mei', 6: 'Jun', 7: 'Jul', 8: 'Ags', 9: 'Sep', 10: 'Okt', 11: 'Nov', 12: 'Des' }, # Units of time 'year': '{count} tahun', 'month': '{count} bulan', 'week': '{count} minggu', 'day': '{count} hari', 'hour': '{count} jam', 'minute': '{count} menit', 'second': '{count} detik', # Relative time 'ago': '{time} yang lalu', 'from_now': '{time} dari sekarang', 'after': '{time} setelah', 'before': '{time} sebelum', # Date formats 'date_formats': { 'LTS': 'HH.mm.ss', 'LT': 'HH.mm', 'LLLL': 'dddd, D MMMM YYYY [pukul] HH.mm', 'LLL': 'D MMMM YYYY [pukul] HH.mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!i pendulum/lang/it.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'domenica', 1: 'lunedì', 2: 'martedì', 3: 'mercoledì', 4: 'giovedì', 5: 'venerdì', 6: 'sabato' }, 'days_abbrev': { 0: 'dom', 1: 'lun', 2: 'mar', 3: 'mer', 4: 'gio', 5: 'ven', 6: 'sab' }, # Months 'months': { 1: 'gennaio', 2: 'febbraio', 3: 'marzo', 4: 'aprile', 5: 'maggio', 6: 'giugno', 7: 'luglio', 8: 'agosto', 9: 'settembre', 10: 'ottobre', 11: 'novembre', 12: 'dicembre', }, 'months_abbrev': { 1: 'gen', 2: 'feb', 3: 'mar', 4: 'apr', 5: 'mag', 6: 'giu', 7: 'lug', 8: 'ago', 9: 'set', 10: 'ott', 11: 'nov', 12: 'dic', }, # Units of time 'year': ['{count} anno', '{count} anni'], 'month': ['{count} mese', '{count} mesi'], 'week': ['{count} settimana', '{count} settimane'], 'day': ['{count} giorno', '{count} giorni'], 'hour': ['{count} ora', '{count} ore'], 'minute': ['{count} minuto', '{count} minuti'], 'second': ['{count} secondo', '{count} secondi'], # Relative time 'ago': '{time} fa', 'from_now': '{time} da adesso', 'after': '{time} dopo', 'before': '{time} prima', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!AZOOpendulum/lang/ja.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: '日曜日', 1: '月曜日', 2: '火曜日', 3: '水曜日', 4: '木曜日', 5: '金曜日', 6: '土曜日' }, 'days_abbrev': { 0: '日', 1: '月', 2: '火', 3: '水', 4: '木', 5: '金', 6: '土' }, # Months 'months': { 1: '1月', 2: '2月', 3: '3月', 4: '4月', 5: '5月', 6: '6月', 7: '7月', 8: '8月', 9: '9月', 10: '10月', 11: '11月', 12: '12月', }, 'months_abbrev': { 1: ' 1', 2: ' 2', 3: ' 3', 4: ' 4', 5: ' 5', 6: ' 6', 7: ' 7', 8: ' 8', 9: ' 9', 10: '10', 11: '11', 12: '12', }, # Units of time 'year': '{count} 年', 'month': '{count} ヶ月', 'week': '{count} 週間', 'day': '{count} 日', 'hour': '{count} 時間', 'minute': '{count} 分', 'second': '{count} 秒', # Relative time 'ago': '{time} 前', 'from_now': '今から {time}', 'after': '{time} 後', 'before': '{time} 前', # Meridians 'meridian': lambda time: '午前' if 0 <= time[0] < 12 else '午後', # Date formats 'date_formats': { 'LTS': 'Ah時m分s秒', 'LT': 'Ah時m分', 'LLLL': 'YYYY年M月D日Ah時m分 dddd', 'LLL': 'YYYY年M月D日Ah時m分', 'LL': 'YYYY年M月D日', 'L': 'YYYY/MM/DD', }, } PK!N pendulum/lang/ka.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'კვირა', 1: 'ორშაბათი', 2: 'სამშაბათი', 3: 'ოთხშაბათი', 4: 'ხუთშაბათი', 5: 'პარასკევი', 6: 'შაბათი' }, 'days_abbrev': { 0: 'კვი', 1: 'ორშ', 2: 'სამ', 3: 'ოთხ', 4: 'ხუთ', 5: 'პარ', 6: 'შაბ' }, # Months 'months': { 1: 'იანვარი', 2: 'თებერვალი', 3: 'მარტი', 4: 'აპრილი', 5: 'მაისი', 6: 'ივნისი', 7: 'ივლისი', 8: 'აგვისტო', 9: 'სექტემბერი', 10: 'ოქტომბერი', 11: 'ნოემბერი', 12: 'დეკემბერი' }, 'months_abbrev': { 1: 'იან', 2: 'თებ', 3: 'მარ', 4: 'აპრ', 5: 'მაი', 6: 'ივნ', 7: 'ივლ', 8: 'აგვ', 9: 'სექ', 10: 'ოქტ', 11: 'ნოე', 12: 'დეკ' }, # Units of time 'year': '{count} წლის', 'month': '{count} თვის', 'week': '{count} კვირის', 'day': '{count} დღის', 'hour': '{count} საათის', 'minute': '{count} წუთის', 'second': '{count} წამის', # Relative time 'ago': '{time} უკან', 'from_now': '{time} შემდეგ', 'after': '{time} შემდეგ', 'before': '{time} უკან', # Date formats 'date_formats': { 'LTS': 'h:mm:ss A', 'LT': 'h:mm A', 'LLLL': 'dddd, D MMMM YYYY h:mm A', 'LLL': 'D MMMM YYYY h:mm A', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!5ZZpendulum/lang/ko.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: '일요일', 1: '월요일', 2: '화요일', 3: '수요일', 4: '목요일', 5: '금요일', 6: '토요일' }, 'days_abbrev': { 0: '일', 1: '월', 2: '화', 3: '수', 4: '목', 5: '금', 6: '토' }, # Months 'months': { 1: '1월', 2: '2월', 3: '3월', 4: '4월', 5: '5월', 6: '6월', 7: '7월', 8: '8월', 9: '9월', 10: '10월', 11: '11월', 12: '12월', }, 'months_abbrev': { 1: ' 1', 2: ' 2', 3: ' 3', 4: ' 4', 5: ' 5', 6: ' 6', 7: ' 7', 8: ' 8', 9: ' 9', 10: '10', 11: '11', 12: '12', }, # Units of time 'year': '{count} 년', 'month': '{count} 개월', 'week': '{count} 주일', 'day': '{count} 일', 'hour': '{count} 시간', 'minute': '{count} 분', 'second': '{count} 초', # Relative time 'ago': '{time} 전', 'from_now': '{time} 후', 'after': '{time} 뒤', 'before': '{time} 앞', # Meridians 'meridian': lambda time: '오전' if 0 <= time[0] < 12 else '오후', # Date formats 'date_formats': { 'LTS': 'A h시 m분 s초', 'LT': 'A h시 m분', 'LLLL': 'YYYY년 MMMM D일 dddd A h시 m분', 'LLL': 'YYYY년 MMMM D일 A h시 m분', 'LL': 'YYYY년 MMMM D일', 'L': 'YYYY.MM.DD', }, } PK!Pq pendulum/lang/lt.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'sekmadienis', 1: 'pirmadienis', 2: 'antradienis', 3: 'trečiadienis', 4: 'ketvirtadienis', 5: 'penktadienis', 6: 'šeštadienis' }, 'days_abbrev': { 0: 'Sek', 1: 'Pir', 2: 'Ant', 3: 'Tre', 4: 'Ket', 5: 'Pen', 6: 'Šeš' }, # Months 'months': { 1: 'sausis', 2: 'vasaris', 3: 'kovas', 4: 'balandis', 5: 'gegužė', 6: 'birželis', 7: 'liepa', 8: 'rugpjūtis', 9: 'rugsėjis', 10: 'spalis', 11: 'lapkritis', 12: 'gruodis' }, 'months_abbrev': { 1: 'sau', 2: 'vas', 3: 'kov', 4: 'bal', 5: 'geg', 6: 'bir', 7: 'lie', 8: 'rgp', 9: 'rgs', 10: 'spa', 11: 'lap', 12: 'grd' }, # Units of time 'year': ['{count} metus', '{count} metus', '{count} metų'], 'month': ['{count} mėnesį', '{count} mėnesius', '{count} mėnesių'], 'week': ['{count} savaitę', '{count} savaites', '{count} savaičių'], 'day': ['{count} dieną', '{count} dienas', '{count} dienų'], 'hour': ['{count} valandą', '{count} valandas', '{count} valandų'], 'minute': ['{count} minutę', '{count} minutes', '{count} minučių'], 'second': ['{count} sekundę', '{count} sekundes', '{count} sekundžių'], # Relative time 'second_from_now': ['{count} sekundės', '{count} sekundžių', '{count} sekundžių'], 'minute_from_now': ['{count} minutės', '{count} minučių', '{count} minučių'], 'hour_from_now': ['{count} valandos', '{count} valandų', '{count} valandų'], 'day_from_now': ['{count} dienos', '{count} dienų', '{count} dienų'], 'week_from_now': ['{count} savaitės', '{count} savaičių', '{count} savaičių'], 'month_from_now': ['{count} mėnesio', '{count} mėnesių', '{count} mėnesių'], 'year_from_now': 'metų', 'ago': 'prieš {time}', 'from_now': 'už {time}', 'after': 'po {time}', 'before': '{time} nuo dabar', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', 'LLL': 'YYYY [m.] MMMM D [d.], HH:mm [val.]', 'LL': 'YYYY [m.] MMMM D [d.]', 'L': 'YYYY-MM-DD', }, } PK!/P5 5 pendulum/lang/lv.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'svētdiena', 1: 'pirmdiena', 2: 'otrdiena', 3: 'trešdiena', 4: 'ceturtdiena', 5: 'piektdiena', 6: 'sestdiena' }, 'days_abbrev': { 0: 'Sv', 1: 'P', 2: 'O', 3: 'T', 4: 'C', 5: 'Pk', 6: 'S' }, # Months 'months': { 1: 'janvāris', 2: 'februāris', 3: 'marts', 4: 'aprīlis', 5: 'maijs', 6: 'jūnijs', 7: 'jūlijs', 8: 'augusts', 9: 'septembris', 10: 'oktobris', 11: 'novembris', 12: 'decembris' }, 'months_abbrev': { 1: 'jan', 2: 'feb', 3: 'mar', 4: 'apr', 5: 'mai', 6: 'jūn', 7: 'jūl', 8: 'aug', 9: 'sep', 10: 'okt', 11: 'nov', 12: 'dec' }, # Units of time 'year': ['0 gadiem', '{count} gada', '{count} gadiem'], 'month': ['0 mēnešiem', '{count} mēneša', '{count} mēnešiem'], 'week': ['0 nedēļām', '{count} nedēļas', '{count} nedēļām'], 'day': ['0 dienām', '{count} dienas', '{count} dienām'], 'hour': ['0 stundām', '{count} stundas', '{count} stundām'], 'minute': ['0 minūtēm', '{count} minūtes', '{count} minūtēm'], 'second': ['0 sekundēm', '{count} sekundes', '{count} sekundēm'], # Relative time 'ago': 'pirms {time}', 'from_now': 'pēc {time}', 'after': '{time} vēlāk', 'before': '{time} pirms', 'year_after': ['0 gadus', '{count} gadu', '{count} gadus'], 'month_after': ['0 mēnešus', '{count} mēnesi', '{count} mēnešus'], 'week_after': ['0 nedēļas', '{count} nedēļu', '{count} nedēļas'], 'day_after': ['0 dienas', '{count} dienu', '{count} dienas'], 'hour_after': ['0 stundas', '{count} stundu', '{count} stundas'], 'minute_after': ['0 minūtes', '{count} minūti', '{count} minūtes'], 'second_after': ['0 sekundes', '{count} sekundi', '{count} sekundes'], 'year_before': ['0 gadus', '{count} gadu', '{count} gadus'], 'month_before': ['0 mēnešus', '{count} mēnesi', '{count} mēnešus'], 'week_before': ['0 nedēļas', '{count} nedēļu', '{count} nedēļas'], 'day_before': ['0 dienas', '{count} dienu', '{count} dienas'], 'hour_before': ['0 stundas', '{count} stundu', '{count} stundas'], 'minute_before': ['0 minūtes', '{count} minūti', '{count} minūtes'], 'second_before': ['0 sekundes', '{count} sekundi', '{count} sekundes'], # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'YYYY. [gada] D. MMMM, dddd, HH:mm', 'LLL': 'YYYY. [gada] D. MMMM, HH:mm', 'LL': 'YYYY. [gada] D. MMMM', 'L': 'DD.MM.YYYY.', }, } PK!pendulum/lang/mk.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: ' Недела', 1: 'Понеделник', 2: ' Вторник', 3: ' Среда', 4: ' Четврток', 5: ' Петок', 6: ' Сабота' }, 'days_abbrev': { 0: ' Нед.', 1: 'Пон.', 2: ' Вт.', 3: ' Сре.', 4: ' Чет.', 5: ' Пет.', 6: ' Саб.' }, # Months 'months': { 1: 'Јануари', 2: 'Февруари', 3: 'Март', 4: 'Април', 5: 'Мај', 6: 'Јуни', 7: 'Јули', 8: 'Август', 9: 'Септември', 10: 'Октомври', 11: 'Ноември', 12: 'Декември', }, 'months_abbrev': { 1: 'Јан.', 2: ' Фев.', 3: ' Мар.', 4: ' Апр.', 5: ' Мај', 6: ' Јун.', 7: ' Јул.', 8: ' Авг.', 9: ' Септ.', 10: ' Окт.', 11: ' Ноем.', 12: ' Декем.', }, # Units of time 'year': ['{count} година', '{count} години'], 'month': ['{count} месец', '{count} месеци'], 'week': ['{count} седмица', '{count} седмици'], 'day': ['{count} ден', '{count} дена'], 'hour': ['{count} час', '{count} часа'], 'minute': ['{count} минута', '{count} минути'], 'second': ['{count} секунда', '{count} секунди'], # Relative time 'ago': 'пред {time}', 'from_now': '{time} од сега', 'after': 'по {time}', 'before': 'пред {time}', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd, D MMMM YYYY H:mm', 'LLL': 'D MMMM YYYY H:mm', 'LL': 'D MMMM YYYY', 'L': 'D.MM.YYYY', }, } PK!31pendulum/lang/ms.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Ahad', 1: 'Isnin', 2: 'Selasa', 3: 'Rabu', 4: 'Khamis', 5: 'Jumaat', 6: 'Sabtu' }, 'days_abbrev': { 0: 'Ahd', 1: 'Isn', 2: 'Sel', 3: 'Rab', 4: 'Kha', 5: 'Jum', 6: 'Sab' }, # Months 'months': { 1: 'Januari', 2: 'Februari', 3: 'Mac', 4: 'April', 5: 'Mei', 6: 'Jun', 7: 'Julai', 8: 'Ogos', 9: 'September', 10: 'Oktober', 11: 'November', 12: 'Disember' }, 'months_abbrev': { 1: 'Jan', 2: 'Feb', 3: 'Mac', 4: 'Apr', 5: 'Mei', 6: 'Jun', 7: 'Jul', 8: 'Ogs', 9: 'Sep', 10: 'Okt', 11: 'Nov', 12: 'Dis' }, # Units of time 'year': '{count} tahun', 'month': '{count} bulan', 'week': '{count} minggu', 'day': '{count} hari', 'hour': '{count} jam', 'minute': '{count} minit', 'second': '{count} saat', # Relative time 'ago': '{time} yang lalu', 'from_now': '{time} dari sekarang', 'after': '{time} selepas', 'before': '{time} sebelum', # Date formats 'date_formats': { 'LTS': 'HH.mm.ss', 'LT': 'HH.mm', 'LLLL': 'dddd, D MMMM YYYY [pukul] HH.mm', 'LLL': 'D MMMM YYYY [pukul] HH.mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!AκXXpendulum/lang/nl.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'zondag', 1: 'maandag', 2: 'dinsdag', 3: 'woensdag', 4: 'donderdag', 5: 'vrijdag', 6: 'zaterdag' }, 'days_abbrev': { 0: 'zo', 1: 'ma', 2: 'di', 3: 'wo', 4: 'do', 5: 'vr', 6: 'za' }, # Months 'months': { 1: 'januari', 2: 'februari', 3: 'maart', 4: 'april', 5: 'mei', 6: 'juni', 7: 'juli', 8: 'augustus', 9: 'september', 10: 'oktober', 11: 'november', 12: 'december', }, 'months_abbrev': { 1: 'jan', 2: 'feb', 3: 'mrt', 4: 'apr', 5: 'mei', 6: 'jun', 7: 'jul', 8: 'aug', 9: 'sep', 10: 'okt', 11: 'nov', 12: 'dec', }, # Units of time 'year': '{count} jaar', 'month': ['{count} maand', '{count} maanden'], 'week': ['{count} week', '{count} weken'], 'day': ['{count} dag', '{count} dagen'], 'hour': '{count} uur', 'minute': ['{count} minuut', '{count} minuten'], 'second': ['{count} seconde', '{count} seconden'], # Relative time 'ago': '{time} geleden', 'from_now': 'over {time}', 'after': '{time} later', 'before': '{time} eerder', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd D MMMM YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD-MM-YYYY', }, } PK!gpendulum/lang/nn.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'søndag', 1: 'mandag', 2: 'tirsdag', 3: 'onsdag', 4: 'torsdag', 5: 'fredag', 6: 'lørdag' }, 'days_abbrev': { 0: 'sø.', 1: 'ma.', 2: 'ti.', 3: 'on.', 4: 'to.', 5: 'fr.', 6: 'lø.' }, # Months 'months': { 1: 'januar', 2: 'februar', 3: 'mars', 4: 'april', 5: 'mai', 6: 'juni', 7: 'juli', 8: 'august', 9: 'september', 10: 'oktober', 11: 'november', 12: 'desember' }, 'months_abbrev': { 1: 'jan.', 2: 'feb.', 3: 'mars', 4: 'april', 5: 'mai', 6: 'juni', 7: 'juli', 8: 'aug.', 9: 'sep.', 10: 'okt.', 11: 'nov.', 12: 'des.' }, # Units of time 'year': ['{count} år', '{count} år'], 'month': ['{count} måned', '{count} måneder'], 'week': ['{count} uke', '{count} uker'], 'day': ['{count} dag', '{count} dager'], 'hour': ['{count} time', '{count} timer'], 'minute': ['{count} minutt', '{count} minutter'], 'second': ['{count} sekund', '{count} sekunder'], # Relative time 'ago': '{time} siden', 'from_now': 'om {time}', 'after': '{time} etter', 'before': '{time} før', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd D. MMMM YYYY [kl.] HH:mm', 'LLL': 'D. MMMM YYYY [kl.] H:mm', 'LL': 'D. MMMM YYYY', 'L': 'DD.MM.YYYY', }, } PK!`pendulum/lang/pl.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'niedziela', 1: 'poniedziałek', 2: 'wtorek', 3: 'środa', 4: 'czwartek', 5: 'piątek', 6: 'sobota' }, 'days_abbrev': { 0: 'Nd', 1: 'Pn', 2: 'Wt', 3: 'Śr', 4: 'Czw', 5: 'Pt', 6: 'So' }, # Months 'months': { 1: 'styczeń', 2: 'luty', 3: 'marzec', 4: 'kwiecień', 5: 'maj', 6: 'czerwiec', 7: 'lipiec', 8: 'sierpień', 9: 'wrzesień', 10: 'październik', 11: 'listopad', 12: 'grudzień', }, 'months_abbrev': { 1: 'sty', 2: 'lut', 3: 'mar', 4: 'kwi', 5: 'maj', 6: 'cze', 7: 'lip', 8: 'sie', 9: 'wrz', 10: 'paź', 11: 'lis', 12: 'gru', }, # Units of time 'year': ['{count} rok', '{count} lata', '{count} lat'], 'month': ['{count} miesiąc', '{count} miesiące', '{count} miesięcy'], 'week': ['{count} tydzień', '{count} tygodnie', '{count} tygodni'], 'day': ['{count} dzień', '{count} dni', '{count} dni'], 'hour': ['{count} godzina', '{count} godziny', '{count} godzin'], 'minute': ['{count} minuta', '{count} minuty', '{count} minut'], 'second': ['{count} sekunda', '{count} sekundy', '{count} sekund'], # Relative time 'ago': '{time} temu', 'from_now': '{time} od teraz', 'after': '{time} po', 'before': '{time} przed', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD.MM.YYYY', }, } PK!Jpendulum/lang/pt_br.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Domingo', 1: 'Segunda-feira', 2: 'Terça-feira', 3: 'Quarta-feira', 4: 'Quinta-feira', 5: 'Sexta-feira', 6: 'Sábado' }, 'days_abbrev': { 0: 'Dom', 1: 'Seg', 2: 'Ter', 3: 'Qua', 4: 'Qui', 5: 'Sex', 6: 'Sab' }, # Months 'months': { 1: 'Janeiro', 2: 'Fevereiro', 3: 'Março', 4: 'Abril', 5: 'Maio', 6: 'Junho', 7: 'Julho', 8: 'Agosto', 9: 'Setembro', 10: 'Outubro', 11: 'Novembro', 12: 'Dezembro', }, 'months_abbrev': { 1: 'Jan', 2: 'Fev', 3: 'Mar', 4: 'Abr', 5: 'Maio', 6: 'Jun', 7: 'Jul', 8: 'Ago', 9: 'Set', 10: 'Out', 11: 'Nov', 12: 'Dez', }, # Units of time 'year': ['{count} ano', '{count} anos'], 'month': ['{count} mês', '{count} meses'], 'week': ['{count} semana', '{count} semanas'], 'day': ['{count} dia', '{count} dias'], 'hour': ['{count} hora', '{count} horas'], 'minute': ['{count} minuto', '{count} minutos'], 'second': ['{count} segundo', '{count} segundos'], # Relative time 'ago': 'há {time}', 'from_now': 'dentro de {time}', 'after': 'após {time}', 'before': '{time} atrás', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D [de] MMMM [de] YYYY [às] HH:mm', 'LLL': 'D [de] MMMM [de] YYYY [às] HH:mm', 'LL': 'D [de] MMMM [de] YYYY', 'L': 'DD/MM/YYYY', }, } PK!apendulum/lang/ro.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'duminică', 1: 'luni', 2: 'marți', 3: 'miercuri', 4: 'joi', 5: 'vineri', 6: 'sâmbătă' }, 'days_abbrev': { 0: 'Dum', 1: 'Lun', 2: 'Mar', 3: 'Mie', 4: 'Joi', 5: 'Vin', 6: 'Sâm' }, # Months 'months': { 1: 'ianuarie', 2: 'februarie', 3: 'martie', 4: 'aprilie', 5: 'mai', 6: 'iunie', 7: 'iulie', 8: 'august', 9: 'septembrie', 10: 'octombrie', 11: 'noiembrie', 12: 'decembrie' }, 'months_abbrev': { 1: 'ian.', 2: 'febr.', 3: 'mart.', 4: 'apr.', 5: 'mai', 6: 'iun.', 7: 'iul.', 8: 'aug.', 9: 'sept.', 10: 'oct.', 11: 'nov.', 12: 'dec.' }, # Units of time 'year': ['un an', '{count} ani', '{count} ani'], 'month': ['o lună', '{count} luni', '{count} luni'], 'week': ['o săptămână', '{count} săptămâni', '{count} săptămâni'], 'day': ['o zi', '{count} zile', '{count} zile'], 'hour': ['o oră', '{count} ore', '{count} ore'], 'minute': ['un minut', '{count} minute', '{count} minute'], 'second': ['o secundă', '{count} secunde', '{count} secunde'], # Relative time 'ago': 'acum {time}', 'from_now': '{time} de acum', 'after': 'peste {time}', 'before': 'acum {time}', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd, D MMMM YYYY H:mm', 'LLL': 'D MMMM YYYY H:mm', 'LL': 'D MMMM YYYY', 'L': 'DD.MM.YYYY', }, } PK! ##pendulum/lang/ru.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'воскресенье', 1: 'понедельник', 2: 'вторник', 3: 'среда', 4: 'четверг', 5: 'пятница', 6: 'суббота' }, 'days_abbrev': { 0: 'вс', 1: 'пн', 2: 'вт', 3: 'ср', 4: 'чт', 5: 'пт', 6: 'сб' }, # Months 'months': { 1: 'января', 2: 'февраля', 3: 'марта', 4: 'апреля', 5: 'мая', 6: 'июня', 7: 'июля', 8: 'августа', 9: 'сентября', 10: 'октября', 11: 'ноября', 12: 'декабря', }, 'months_abbrev': { 1: 'янв', 2: 'фев', 3: 'мар', 4: 'апр', 5: 'май', 6: 'июн', 7: 'июл', 8: 'авг', 9: 'сен', 10: 'окт', 11: 'ноя', 12: 'дек', }, # Units of time 'year': ['{count} год', '{count} года', '{count} лет'], 'month': ['{count} месяц', '{count} месяца', '{count} месяцев'], 'week': ['{count} неделю', '{count} недели', '{count} недель'], 'day': ['{count} день', '{count} дня', '{count} дней'], 'hour': ['{count} час', '{count} часа', '{count} часов'], 'minute': ['{count} минуту', '{count} минуты', '{count} минут'], 'second': ['{count} секунду', '{count} секунды', '{count} секунд'], # Relative time 'ago': '{time} назад', 'from_now': 'через {time}', 'after': '{time} после', 'before': '{time} до', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM YYYY г., HH:mm', 'LLL': 'D MMMM YYYY г., HH:mm', 'LL': 'D MMMM YYYY г.', 'L': 'DD.MM.YYYY', }, } PK!pendulum/lang/sk.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'nedeľa', 1: 'pondelok', 2: 'utorok', 3: 'streda', 4: 'štvrtok', 5: 'piatok', 6: 'sobota' }, 'days_abbrev': { 0: 'ne', 1: 'po', 2: 'ut', 3: 'st', 4: 'št', 5: 'pi', 6: 'so' }, # Months 'months': { 1: 'január', 2: 'február', 3: 'marec', 4: 'apríl', 5: 'máj', 6: 'jún', 7: 'júl', 8: 'august', 9: 'september', 10: 'október', 11: 'november', 12: 'december' }, 'months_abbrev': { 1: 'jan', 2: 'feb', 3: 'mar', 4: 'apr', 5: 'máj', 6: 'jún', 7: 'júl', 8: 'aug', 9: 'sep', 10: 'okt', 11: 'nov', 12: 'dec' }, # Units of time 'year': ['rok', '{count} roky', '{count} rokov'], 'month': ['mesiac', '{count} mesiace', '{count} mesiacov'], 'week': ['týždeň', '{count} týždne', '{count} týždňov'], 'day': ['deň', '{count} dni', '{count} dní'], 'hour': ['hodinu', '{count} hodiny', '{count} hodín'], 'minute': ['minútu', '{count} minúty', '{count} minút'], 'second': ['sekundu', '{count} sekundy', '{count} sekúnd'], # Relative time 'ago': 'pred {time}', 'from_now': 'o {time}', 'after': '{time} neskôr', 'before': '{time} predtým', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd D. MMMM YYYY H:mm', 'LLL': 'D. MMMM YYYY H:mm', 'LL': 'D. MMMM YYYY', 'L': 'DD.MM.YYYY', }, } PK!> pendulum/lang/sl.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'nedelja', 1: 'ponedeljek', 2: 'torek', 3: 'sreda', 4: 'četrtek', 5: 'petek', 6: 'sobota' }, 'days_abbrev': { 0: 'ned.', 1: 'pon.', 2: 'tor.', 3: 'sre.', 4: 'čet.', 5: 'pet.', 6: 'sob.' }, # Months 'months': { 1: 'januar', 2: 'februar', 3: 'marec', 4: 'april', 5: 'maj', 6: 'junij', 7: 'julij', 8: 'avgust', 9: 'september', 10: 'oktober', 11: 'november', 12: 'december' }, 'months_abbrev': { 1: 'jan.', 2: 'feb.', 3: 'mar.', 4: 'apr.', 5: 'maj.', 6: 'jun.', 7: 'jul.', 8: 'avg.', 9: 'sep.', 10: 'okt.', 11: 'nov.', 12: 'dec.' }, # Units of time 'year': ['{count} leto', '{count} leti', '{count} leta', '{count} let'], 'month': ['{count} mesec', '{count} meseca', '{count} mesece', '{count} mesecev'], 'week': ['{count} teden', '{count} tedna', '{count} tedne', '{count} tednov'], 'day': ['{count} dan', '{count} dni', '{count} dni', '{count} dni'], 'hour': ['{count} uro', '{count} uri', '{count} ure', '{count} ur'], 'minute': ['{count} minuto', '{count} minuti', '{count} minute', '{count} minut'], 'second': ['{count} sekundo', '{count} sekundi', '{count} sekunde', '{count} sekund'], # Relative time 'year_ago': ['{count} letom', '{count} leti', '{count} leti', '{count} leti'], 'month_ago': ['{count} mesecem', '{count} meseci', '{count} meseci', '{count} meseci'], 'week_ago': ['{count} tednom', '{count} tednoma', '{count} tedni', '{count} tedni'], 'day_ago': ['{count} dnem', '{count} dnevoma', '{count} dnevi', '{count} dnevi'], 'hour_ago': ['{count} uro', '{count} urama', '{count} urami', '{count} urami'], 'minute_ago': ['{count} minuto', '{count} minutama', '{count} minutami', '{count} minutami'], 'second_ago': ['{count} sekundo', '{count} sekundama', '{count} sekundami', '{count} sekundami'], 'ago': 'pred {time}', 'from_now': 'čez {time}', 'after': 'čez {time}', 'before': 'pred {time}', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd, D. MMMM YYYY H:mm', 'LLL': 'D. MMMM YYYY H:mm', 'LL': 'D. MMMM YYYY', 'L': 'DD. MM. YYYY', }, } PK!Y pendulum/lang/sq.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'E Diel', 1: 'E Hënë', 2: 'E Martë', 3: 'E Mërkurë', 4: 'E Enjte', 5: 'E Premte', 6: 'E Shtunë' }, 'days_abbrev': { 0: 'Die', 1: 'Hën', 2: 'Mar', 3: 'Mër', 4: 'Enj', 5: 'Pre', 6: 'Sht' }, # Months 'months': { 1: 'Janar', 2: 'Shkurt', 3: 'Mars', 4: 'Prill', 5: 'Maj', 6: 'Qershor', 7: 'Korrik', 8: 'Gusht', 9: 'Shtator', 10: 'Tetor', 11: 'Nëntor', 12: 'Dhjetor' }, 'months_abbrev': { 1: 'Jan', 2: 'Shk', 3: 'Mar', 4: 'Pri', 5: 'Maj', 6: 'Qer', 7: 'Kor', 8: 'Gus', 9: 'Sht', 10: 'Tet', 11: 'Nën', 12: 'Dhj' }, # Units of time 'year': ['{count} vit', '{count} vjet'], 'month': ['{count} muaj', '{count} muaj'], 'week': ['{count} javë', '{count} javë'], 'day': ['{count} ditë', '{count} ditë'], 'hour': ['{count} orë', '{count} orë'], 'minute': ['{count} minutë', '{count} minuta'], 'second': ['{count} sekondë', '{count} sekonda'], # Relative time 'ago': '{time} më parë', 'from_now': '{time} nga tani', 'after': '{time} pas', 'before': '{time} para', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!#pendulum/lang/sr.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'nedelja', 1: 'ponedeljak', 2: 'utorak', 3: 'sreda', 4: 'četvrtak', 5: 'petak', 6: 'subota' }, 'days_abbrev': { 0: 'ned.', 1: 'pon.', 2: 'uto.', 3: 'sre.', 4: 'čet.', 5: 'pet.', 6: 'sub.' }, # Months 'months': { 1: 'januar', 2: 'februar', 3: 'mart', 4: 'april', 5: 'maj', 6: 'jun', 7: 'jul', 8: 'avgust', 9: 'septembar', 10: 'oktobar', 11: 'novembar', 12: 'decembar' }, 'months_abbrev': { 1: 'jan.', 2: 'feb.', 3: 'mar.', 4: 'apr.', 5: 'maj', 6: 'jun', 7: 'jul', 8: 'avg.', 9: 'sep.', 10: 'okt.', 11: 'nov.', 12: 'dec.' }, # Units of time 'year': ['{count} godina', '{count} godine', '{count} godina'], 'month': ['{count} mesec', '{count} meseca', '{count} meseci'], 'week': ['{count} nedelja', '{count} nedelje', '{count} nedelja'], 'day': ['{count} dan', '{count} dana', '{count} dana'], 'hour': ['{count} sat', '{count} sata', '{count} sati'], 'minute': ['{count} minut', '{count} minuta ', '{count} minuta'], 'second': ['{count} sekund', '{count} sekunde', '{count} sekunde'], # Relative time 'ago': 'pre {time}', 'from_now': '{time} od sada', 'after': 'nakon {time}', 'before': 'pre {time}', # Date formats 'date_formats': { 'LTS': 'H:mm:ss', 'LT': 'H:mm', 'LLLL': 'dddd, D. MMMM YYYY H:mm', 'LLL': 'D. MMMM YYYY H:mm', 'LL': 'D. MMMM YYYY', 'L': 'DD. MM. YYYY', }, } PK!,'pendulum/lang/sv.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'söndag', 1: 'måndag', 2: 'tisdag', 3: 'onsdag', 4: 'torsdag', 5: 'fredag', 6: 'lördag' }, 'days_abbrev': { 0: 'sön', 1: 'mån', 2: 'tis', 3: 'ons', 4: 'tor', 5: 'fre', 6: 'lör' }, # Months 'months': { 1: 'januari', 2: 'februari', 3: 'mars', 4: 'april', 5: 'maj', 6: 'juni', 7: 'juli', 8: 'augusti', 9: 'september', 10: 'oktober', 11: 'november', 12: 'december', }, 'months_abbrev': { 1: 'jan', 2: 'feb', 3: 'mar', 4: 'apr', 5: 'maj', 6: 'jun', 7: 'jul', 8: 'aug', 9: 'sep', 10: 'okt', 11: 'nov', 12: 'dec', }, # Units of time 'year': ['{count} år', '{count} år'], 'month': ['{count} månad', '{count} månader'], 'week': ['{count} vecka', '{count} veckor'], 'day': ['{count} dag', '{count} dagar'], 'hour': ['{count} timme', '{count} timmar'], 'minute': ['{count} minut', '{count} minuter'], 'second': ['{count} sekund', '{count} sekunder'], # Relative time 'ago': '{time} sedan', 'from_now': 'om {time}', 'after': '{time} efter', 'before': '{time} före', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd D MMMM YYYY [kl.] HH:mm', 'LLL': 'D MMMM YYYY [kl.] HH:mm', 'LL': 'D MMMM YYYY', 'L': 'YYYY-MM-DD', }, } PK!j) ) pendulum/lang/th.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'อาทิตย์', 1: 'จันทร์', 2: 'อังคาร', 3: 'พุธ', 4: 'พฤหัสบดี', 5: 'ศุกร์', 6: 'เสาร์' }, 'days_abbrev': { 0: 'อา', 1: 'จ', 2: 'อ', 3: 'พ', 4: 'พฤ', 5: 'ศ', 6: 'ส' }, # Months 'months': { 1: 'มกราคม', 2: 'กุมภาพันธ์', 3: 'มีนาคม', 4: 'เมษายน', 5: 'พฤษภาคม', 6: 'มิถุนายน', 7: 'กรกฎาคม', 8: 'สิงหาคม', 9: 'กันยายน', 10: 'ตุลาคม', 11: 'พฤศจิกายน', 12: 'ธันวาคม', }, 'months_abbrev': { 1: 'ม.ค.', 2: 'ก.พ.', 3: 'มี.ค.', 4: 'เม.ย.', 5: 'พ.ค.', 6: 'มิ.ย.', 7: 'ก.ค.', 8: 'ส.ค.', 9: 'ก.ย.', 10: 'ต.ค.', 11: 'พ.ย.', 12: 'ธ.ค.', }, # Units of time 'year': ['{count} ปี', '{count} ปี'], 'month': ['{count} เดือน', '{count} เดือน'], 'week': ['{count} สัปดาห์', '{count} สัปดาห์'], 'day': ['{count} วัน', '{count} วัน'], 'hour': ['{count} ชั่วโมง', '{count} ชั่วโมง'], 'minute': ['{count} นาที', '{count} นาที'], 'second': ['{count} วินาที', '{count} วินาที'], # Relative time 'ago': '{time} ที่แล้ว', 'from_now': '{time} จากนี้', 'after': 'หลัง{time}', 'before': 'ก่อน{time}', # Date formats 'date_formats': { 'LTS': 'H นาฬิกา m นาที s วินาที', 'LT': 'H นาฬิกา m นาที', 'LLLL': 'วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที', 'LLL': 'D MMMM YYYY เวลา H นาฬิกา m นาที', 'LL': 'D MMMM YYYY', 'L': 'YYYY/MM/DD', }, } PK!m!pendulum/lang/tr.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Pazar', 1: 'Pazartesi', 2: 'Salı', 3: 'Çarşamba', 4: 'Perşembe', 5: 'Cuma', 6: 'Cumartesi' }, 'days_abbrev': { 0: 'Paz', 1: 'Pzt', 2: 'Sal', 3: 'Çar', 4: 'Per', 5: 'Cum', 6: 'Cmt' }, # Months 'months': { 1: 'Ocak', 2: 'Şubat', 3: 'Mart', 4: 'Nisan', 5: 'Mayıs', 6: 'Haziran', 7: 'Temmuz', 8: 'Ağustos', 9: 'Eylül', 10: 'Ekim', 11: 'Kasım', 12: 'Aralık', }, 'months_abbrev': { 1: 'Oca', 2: 'Şub', 3: 'Mar', 4: 'Nis', 5: 'May', 6: 'Haz', 7: 'Tem', 8: 'Ağu', 9: 'Eyl', 10: 'Eki', 11: 'Kas', 12: 'Ara', }, # Units of time 'year': '{count} yıl', 'month': '{count} ay', 'week': '{count} hafta', 'day': '{count} gün', 'hour': '{count} saat', 'minute': '{count} dakika', 'second': '{count} saniye', # Relative time 'ago': '{time} önce', 'from_now': '{time} sonra', 'after': '{time} sonra', 'before': '{time} önce', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM YYYY HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD.MM.YYYY', }, } PK!ٷuDCCpendulum/lang/uk.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'неділя', 1: 'понеділок', 2: 'вівторок', 3: 'середа', 4: 'четвер', 5: 'п\'ятниця', 6: 'субота' }, 'days_abbrev': { 0: 'Нд', 1: 'Пн', 2: 'Вт', 3: 'Ср', 4: 'Чт', 5: 'Пт', 6: 'Сб' }, # Months 'months': { 1: 'січня', 2: 'лютого', 3: 'березня', 4: 'квітня', 5: 'травня', 6: 'червня', 7: 'липня', 8: 'серпня', 9: 'вересня', 10: 'жовтня', 11: 'листопада', 12: 'грудня' }, 'months_abbrev': { 1: 'січ', 2: 'лют', 3: 'бер', 4: 'квіт', 5: 'трав', 6: 'черв', 7: 'лип', 8: 'серп', 9: 'вер', 10: 'жовт', 11: 'лист', 12: 'груд' }, # Units of time 'year': ['{count} рік', '{count} роки', '{count} років'], 'month': ['{count} місяць', '{count} місяці', '{count} місяців'], 'week': ['{count} тиждень', '{count} тижні', '{count} тижнів'], 'day': ['{count} день', '{count} дні', '{count} днів'], 'hour': ['{count} година', '{count} години', '{count} годин'], 'minute': ['{count} хвилину', '{count} хвилини', '{count} хвилин'], 'second': ['{count} секунду', '{count} секунди', '{count} секунд'], # Relative time 'ago': '{time} назад', 'from_now': 'через {time}', 'after': '{time} після', 'before': '{time} до', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM YYYY р., HH:mm', 'LLL': 'D MMMM YYYY р., HH:mm', 'LL': 'D MMMM YYYY р.', 'L': 'DD.MM.YYYY', }, } PK!$-nnpendulum/lang/uz.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Якшанба', 1: 'Душанба', 2: 'Сешанба', 3: 'Чоршанба', 4: 'Пайшанба', 5: 'Жума', 6: 'Шанба' }, 'days_abbrev': { 0: 'Якш', 1: 'Душ', 2: 'Сеш', 3: 'Чор', 4: 'Пай', 5: 'Жум', 6: 'Шан' }, # Months 'months': { 1: 'январ', 2: 'феврал', 3: 'март', 4: 'апрел', 5: 'май', 6: 'июн', 7: 'июл', 8: 'август', 9: 'сентябр', 10: 'октябр', 11: 'ноябр', 12: 'декабр' }, 'months_abbrev': { 1: 'янв', 2: 'фев', 3: 'мар', 4: 'апр', 5: 'май', 6: 'июн', 7: 'июл', 8: 'авг', 9: 'сен', 10: 'окт', 11: 'ноя', 12: 'дек' }, # Units of time 'year': ['{count} yil', '{count} yil', '{count} yil'], 'month': ['{count} oy', '{count} oy', '{count} oylar'], 'week': ['{count} hafta', '{count} hafta', '{count} hafta'], 'day': ['{count} kun', '{count} kun', '{count} kun'], 'hour': ['{count} soat', '{count} soat', '{count} soat'], 'minute': ['{count} minut', '{count} minut', '{count} minut'], 'second': ['{count} sekund', '{count} sekund', '{count} sekund'], # Relative time 'ago': '{time} avval', 'from_now': 'keyin {time}', 'after': '{time} keyin', 'before': '{time} gacha', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'D MMMM YYYY, dddd HH:mm', 'LLL': 'D MMMM YYYY HH:mm', 'LL': 'D MMMM YYYY', 'L': 'DD/MM/YYYY', }, } PK!wpendulum/lang/vi.py# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'Chủ Nhật', 1: 'Thứ Hai', 2: 'Thứ Ba', 3: 'Thứ Tư', 4: 'Thứ Năm', 5: 'Thứ Sáu', 6: 'Thứ Bảy' }, 'days_abbrev': { 0: 'CN', 1: 'Thứ 2', 2: 'Thứ 3', 3: 'Thứ 4', 4: 'Thứ 5', 5: 'Thứ 6', 6: 'Thứ 7' }, # Months 'months': { 1: 'Tháng Một', 2: 'Tháng Hai', 3: 'Tháng Ba', 4: 'Tháng Tư', 5: 'Tháng Năm', 6: 'Tháng Sáu', 7: 'Tháng Bảy', 8: 'Tháng Tám', 9: 'Tháng Chín', 10: 'Tháng Mười', 11: 'Tháng Mười Một', 12: 'Tháng Mười Hai', }, 'months_abbrev': { 1: 'Tháng 1', 2: 'Tháng 2', 3: 'Tháng 3', 4: 'Tháng 4', 5: 'Tháng 5', 6: 'Tháng 6', 7: 'Tháng 7', 8: 'Tháng 8', 9: 'Tháng 9', 10: 'Tháng 10', 11: 'Tháng 11', 12: 'Tháng 12', }, # Units of time 'year': '{count} năm', 'month': '{count} tháng', 'week': '{count} tuần', 'day': '{count} ngày', 'hour': '{count} giờ', 'minute': '{count} phút', 'second': '{count} giây', # Relative time 'ago': '{time} trước', 'from_now': '{time} từ bây giờ', 'after': '{time} sau', 'before': '{time} trước', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd, D MMMM [năm] YYYY HH:mm', 'LLL': 'D MMMM [năm] YYYY HH:mm', 'LL': 'D MMMM [năm] YYYY', 'L': 'DD/MM/YYYY', }, } PK!c+Ԉpendulum/lang/zh.py# -*- coding: utf-8 -*- def meridian(hour, minute): hm = hour * 100 + minute if hm < 600: return '凌晨' elif hm < 900: return '早上' elif hm < 1130: return '上午' elif hm < 1230: return '中午' elif hm < 1800: return '下午' return '晚上' translations = { # Days 'days': { 0: '星期日', 1: '星期一', 2: '星期二', 3: '星期三', 4: '星期四', 5: '星期五', 6: '星期六' }, 'days_abbrev': { 0: '日', 1: '一', 2: '二', 3: '三', 4: '四', 5: '五', 6: '六' }, # Months 'months': { 1: '一月', 2: '二月', 3: '三月', 4: '四月', 5: '五月', 6: '六月', 7: '七月', 8: '八月', 9: '九月', 10: '十月', 11: '十一月', 12: '十二月', }, 'months_abbrev': { 1: '1月', 2: '2月', 3: '3月', 4: '4月', 5: '5月', 6: '6月', 7: '7月', 8: '8月', 9: '9月', 10: '10月', 11: '11月', 12: '12月', }, # Units of time 'year': '{count}年', 'month': '{count}个月', 'week': '{count}周', 'day': '{count}天', 'hour': '{count}小时', 'minute': '{count}分钟', 'second': '{count}秒', # Relative time 'ago': '{time}前', 'from_now': '距现在{time}', 'after': '{time}后', 'before': '{time}前', # Meridians 'meridian': lambda time: meridian(*time), # Date formats 'date_formats': { 'LTS': 'Ah点m分s秒', 'LT': 'Ah点mm分', 'LLLL': 'YYYY年MMMD日ddddAh点mm分', 'LLL': 'YYYY年MMMD日Ah点mm分', 'LL': 'YYYY年MMMD日', 'L': 'YYYY-MM-DD', }, } PK!Upzzpendulum/lang/zh_tw.py# -*- coding: utf-8 -*- def meridian(hour, minute): hm = hour * 100 + minute if hm < 600: return '凌晨' elif hm < 900: return '早上' elif hm < 1130: return '上午' elif hm < 1230: return '中午' elif hm < 1800: return '下午' return '晚上' translations = { # Days 'days': { 0: '周日', 1: '周一', 2: '周二', 3: '周三', 4: '周四', 5: '周五', 6: '周六' }, 'days_abbrev': { 0: '日', 1: '一', 2: '二', 3: '三', 4: '四', 5: '五', 6: '六' }, # Months 'months': { 1: '一月', 2: '二月', 3: '三月', 4: '四月', 5: '五月', 6: '六月', 7: '七月', 8: '八月', 9: '九月', 10: '十月', 11: '十一月', 12: '十二月', }, 'months_abbrev': { 1: '1月', 2: '2月', 3: '3月', 4: '4月', 5: '5月', 6: '6月', 7: '7月', 8: '8月', 9: '9月', 10: '10月', 11: '11月', 12: '12月', }, # Units of time 'year': '{count} 年', 'month': '{count} 月', 'week': '{count} 周', 'day': '{count} 天', 'hour': '{count} 小時', 'minute': '{count} 分鐘', 'second': '{count} 秒', # Relative time 'ago': '{time}前', 'from_now': '距現在 {time}', 'after': '{time}後', 'before': '{time}前', # Meridians 'meridian': lambda time: meridian(*time), # Date formats 'date_formats': { 'LTS': 'Ah點m分s秒', 'LT': 'Ah點mm分', 'LLLL': 'YYYY年MMMD日ddddAh點mm分', 'LLL': 'YYYY年MMMD日Ah點mm分', 'LL': 'YYYY年MMMD日', 'L': 'YYYY年MMMD日', }, } PK!pendulum/mixins/__init__.py# -*- coding: utf-8 -*- PK!2qpendulum/mixins/default.py# -*- coding: utf-8 -*- import locale as _locale import warnings from contextlib import contextmanager from ..exceptions import PendulumDeprecationWarning from ..translator import Translator from ..formatting import FORMATTERS class TranslatableMixin(object): _translator = None @classmethod def translator(cls): """ Initialize the translator instance if necessary. :rtype: Translator """ if cls._translator is None: cls._translator = Translator('en') cls.set_locale('en') return cls._translator @classmethod def set_translator(cls, translator): """ Set the translator instance to use. :param translator: The translator :type translator: Translator """ cls._translator = translator @classmethod def get_locale(cls): """ Get the current translator locale. :rtype: str """ return cls.translator().locale @classmethod def set_locale(cls, locale): """ Set the current translator locale and indicate if the source locale file exists. :type locale: str :rtype: bool """ if not cls.translator().has_translations(locale): return False cls.translator().locale = locale return True class FormattableMixing(object): # Default format to use for __str__ method when type juggling occurs. DEFAULT_TO_STRING_FORMAT = None _to_string_format = DEFAULT_TO_STRING_FORMAT _DEFAULT_FORMATTER = 'classic' _FORMATTER = _DEFAULT_FORMATTER @classmethod def reset_to_string_format(cls): """ Reset the format used to the default when type juggling a Date instance to a string. """ warnings.warn( 'The reset_to_string_format() helper ' 'will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) cls.set_to_string_format(cls.DEFAULT_TO_STRING_FORMAT) @classmethod def set_to_string_format(cls, fmt): """ Set the default format used when type juggling a Date instance to a string :type fmt: str """ warnings.warn( 'The set_to_string_format() helper ' 'will be removed in version 2.0.', PendulumDeprecationWarning, stacklevel=2 ) cls._to_string_format = fmt def format(self, fmt, locale=None, formatter=None): """ Formats the instance using the given format. :param fmt: The format to use :type fmt: str :param locale: The locale to use :type locale: str or None :param formatter: The formatter to use :type formatter: str or None :rtype: str """ if formatter is None: formatter = self._FORMATTER if formatter not in FORMATTERS: raise ValueError('Invalid formatter [{}]'.format(formatter)) return FORMATTERS[formatter].format(self, fmt, locale) def strftime(self, fmt): """ Formats the instance using the given format. :param fmt: The format to use :type fmt: str :rtype: str """ return self.format(fmt, _locale.getlocale()[0], 'classic') @classmethod def set_formatter(cls, formatter=None): """ Sets the default string formatter. :param formatter: The parameter to set as default. :type formatter: str or None """ if formatter is None: formatter = cls._DEFAULT_FORMATTER if formatter not in FORMATTERS: raise ValueError('Invalid formatter [{}]'.format(formatter)) cls._FORMATTER = formatter @classmethod def get_formatter(cls): """ Gets the currently used string formatter. :rtype: str """ return cls._FORMATTER def for_json(self): """ Methods for automatic json serialization by simplejson :rtype: str """ return str(self) def __format__(self, format_spec): if len(format_spec) > 0: return self.format(format_spec) return str(self) def __str__(self): if self._to_string_format is None: return self.isoformat() return self.format(self._to_string_format, formatter='classic') def __repr__(self): return '<{0} [{1}]>'.format(self.__class__.__name__, str(self)) class TestableMixin(object): # A test Pendulum instance to be returned when now instances are created. _test_now = None @classmethod @contextmanager def test(cls, mock): """ Context manager to temporarily set the test_now value. :type mock: Pendulum or Date or Time or None """ cls.set_test_now(mock) yield cls.set_test_now() @classmethod def set_test_now(cls, test_now=None): """ Set a Pendulum instance (real or mock) to be returned when a "now" instance is created. The provided instance will be returned specifically under the following conditions: - A call to the classmethod now() method, ex. Pendulum.now() - When nothing is passed to the constructor or parse(), ex. Pendulum() - When the string "now" is passed to parse(), ex. Pendulum.parse('now') Note the timezone parameter was left out of the examples above and has no affect as the mock value will be returned regardless of its value. To clear the test instance call this method using the default parameter of null. :type test_now: Pendulum or None """ cls._test_now = test_now @classmethod def get_test_now(cls): """ Get the Pendulum instance (real or mock) to be returned when a "now" instance is created. :rtype: Pendulum or None """ return cls._test_now @classmethod def has_test_now(cls): return cls._test_now is not None PK!'e!pendulum/mixins/interval.py# -*- coding: utf-8 -*- from .._compat import decode from .default import TranslatableMixin class WordableIntervalMixin(TranslatableMixin): def in_words(self, locale=None, separator=' ', _periods=None): """ Get the current interval in words in the current locale. Ex: 6 jours 23 heures 58 minutes :param locale: The locale to use. Defaults to current locale. :type locale: str :param separator: The separator to use between each unit :type separator: str :param _periods: Custom periods to use as word parts :type _periods: list or None :rtype: str """ if _periods is None: _periods = [ ('week', self.weeks), ('day', self.remaining_days), ('hour', self.hours), ('minute', self.minutes), ('second', self.remaining_seconds) ] parts = [] for period in _periods: unit, count = period if abs(count) > 0: parts.append( self.translator().transchoice( unit, abs(count), {'count': count}, locale=locale ) ) if not parts and abs(self.microseconds) > 0: translation = self.translator().transchoice( 'second', 1, {'count': '{:.2f}'.format(abs(self.microseconds) / 1e6)}, locale=locale ) parts.append(translation) return decode(separator.join(parts)) def __str__(self): return self.in_words() def __repr__(self): return '<{0} [{1}]>'.format(self.__class__.__name__, str(self)) PK!t]pendulum/parser.py# -*- coding: utf-8 -*- from __future__ import division from .parsing import Parser as BaseParser from .tz import UTC from .pendulum import Pendulum from .date import Date from .time import Time from ._global import Global class Parser(BaseParser): """ Parser that returns known types (Pendulum, Date, Time) """ def parse(self, text): """ Parses a string with the given options. :param text: The string to parse. :type text: str :rtype: mixed """ # Handling special cases if text == 'now': return Pendulum.now() parsed = super(Parser, self).parse(text) if not self.is_exact(): return self._create_pendulum_object(parsed) # Checking for date if 'year' in parsed: # Checking for time if 'hour' in parsed: return self._create_pendulum_object(parsed) else: return self._create_date_object(parsed) return self._create_time_object(parsed) def _create_pendulum_object(self, parsed): if parsed['offset'] is None: tz = self._options.get('tz', UTC) else: tz = parsed['offset'] / 3600 return Pendulum( parsed['year'], parsed['month'], parsed['day'], parsed['hour'], parsed['minute'], parsed['second'], parsed['subsecond'], tzinfo=tz ) def _create_date_object(self, parsed): return Date( parsed['year'], parsed['month'], parsed['day'] ) def _create_time_object(self, parsed): return Time( parsed['hour'], parsed['minute'], parsed['second'], parsed['subsecond'] ) def parse(text, **options): # Use the mock now value if it exists options['now'] = options.get('now', Global.get_test_now()) return Parser(**options).parse(text) PK!``pendulum/parsing/__init__.py# -*- coding: utf-8 -*- from .parser import Parser def parse(text, **options): """ Parses a string with the given options. :param text: The string to parse. :type text: str :param options: The parsing options. :type options: dict :rtype: dict :raises: ParserError """ return Parser(**options).parse(text) PK!CC'pendulum/parsing/exceptions/__init__.py# -*- coding: utf-8 -*- class ParserError(ValueError): pass PK!R#|00pendulum/parsing/parser.py# -*- coding: utf-8 -*- import re import copy import warnings from datetime import datetime, date, time from dateutil import parser from ..exceptions import PendulumDeprecationWarning from ..helpers import parse_iso8601, week_day, days_in_year from .exceptions import ParserError class Parser(object): """ Parser which parses common formats (like RFC3339 and ISO8601). """ COMMON = re.compile( # Date (optional) '^' '(?P' ' (?P' # Classic date (YYYY-MM-DD) or ordinal (YYYY-DDD) ' (?P\d{4})' # Year ' (?P' ' (?P[-/:])?(?P\d{2})' # Month (optional) ' ((?P[-/:])?(?P\d{1,2}))?' # Day (optional) ' )?' ' )' ' |' ' (?P' # Calendar date (2016-W05 or 2016-W05-5) ' (?P\d{4})' # Year ' -?' # Separator (optional) ' W' # W separator ' (?P\d{2})' # Week number ' -?' # Separator (optional) ' (?P\d)?' # Weekday (optional) ' )' ')?' # Time (optional) '(?P