__pycache__/__init__.cpython-36.opt-1.pyc000064400000000246147204751220014106 0ustar003 6cYE@sddlmZdS))VERSIONN)Z_versionr __version__rr/usr/lib/python3.6/__init__.pys__pycache__/__init__.cpython-36.pyc000064400000000246147204751220013147 0ustar003 6cYE@sddlmZdS))VERSIONN)Z_versionr __version__rr/usr/lib/python3.6/__init__.pys__pycache__/_common.cpython-36.opt-1.pyc000064400000002145147204751220013776 0ustar003 6cY@sdZGdddeZdS)z' Common code used in multiple modules. c@s:eZdZddgZd ddZddZddZdZd d ZdS) weekdaynNcCs||_||_dS)N)rr)selfrrr/usr/lib/python3.6/_common.py__init__ szweekday.__init__cCs ||jkr|S|j|j|SdS)N)r __class__r)rrrrr__call__ s zweekday.__call__c Cs:y |j|jks|j|jkrdSWntk r4dSXdS)NFT)rrAttributeError)rotherrrr__eq__s zweekday.__eq__cCs&d |j}|js|Sd||jfSdS) NMOTUWETHFRSASUz%s(%+d))r r rrrrr)rr)rsrrr__repr__s zweekday.__repr__)N) __name__ __module__ __qualname__ __slots__rrr __hash__rrrrrrs  rN)__doc__objectrrrrrs__pycache__/_common.cpython-36.pyc000064400000002145147204751220013037 0ustar003 6cY@sdZGdddeZdS)z' Common code used in multiple modules. c@s:eZdZddgZd ddZddZddZdZd d ZdS) weekdaynNcCs||_||_dS)N)rr)selfrrr/usr/lib/python3.6/_common.py__init__ szweekday.__init__cCs ||jkr|S|j|j|SdS)N)r __class__r)rrrrr__call__ s zweekday.__call__c Cs:y |j|jks|j|jkrdSWntk r4dSXdS)NFT)rrAttributeError)rotherrrr__eq__s zweekday.__eq__cCs&d |j}|js|Sd||jfSdS) NMOTUWETHFRSASUz%s(%+d))r r rrrrr)rr)rsrrr__repr__s zweekday.__repr__)N) __name__ __module__ __qualname__ __slots__rrr __hash__rrrrrrs  rN)__doc__objectrrrrrs__pycache__/_version.cpython-36.opt-1.pyc000064400000000506147204751220014172 0ustar003 6cY@s.dZdZdZdZeeefZdjeeeZdS)z2 Contains information about the dateutil version. .N) __doc__Z VERSION_MAJORZ VERSION_MINORZ VERSION_PATCHZ VERSION_TUPLEjoinmapstrVERSIONr r /usr/lib/python3.6/_version.pys  __pycache__/_version.cpython-36.pyc000064400000000506147204751220013233 0ustar003 6cY@s.dZdZdZdZeeefZdjeeeZdS)z2 Contains information about the dateutil version. .N) __doc__Z VERSION_MAJORZ VERSION_MINORZ VERSION_PATCHZ VERSION_TUPLEjoinmapstrVERSIONr r /usr/lib/python3.6/_version.pys  __pycache__/easter.cpython-36.opt-1.pyc000064400000004036147204751220013633 0ustar003 6cYE @s4dZddlZddddgZdZdZd Zefd dZdS) zx This module offers a generic easter computing method for any given year, using Western, Orthodox or Julian algorithms. Neaster EASTER_JULIANEASTER_ORTHODOXEASTER_WESTERNc Csld|kodkns td|}|d}d}|dkrd|dd}||d|d }|d krd }|d kr||d d|d dd}n|d }||dd|ddd|dd}||dd|dd|dd|d}||d|d ||dd }|||} d| d| ddd} d| dd} tjt|t| t| S)a This method was ported from the work done by GM Arts, on top of the algorithm by Claus Tondering, which was based in part on the algorithm of Ouding (1940), as quoted in "Explanatory Supplement to the Astronomical Almanac", P. Kenneth Seidelmann, editor. This algorithm implements three different easter calculation methods: 1 - Original calculation in Julian calendar, valid in dates after 326 AD 2 - Original method, with date converted to Gregorian calendar, valid in years 1583 to 4099 3 - Revised method, in Gregorian calendar, valid in years 1583 to 4099 as well These methods are represented by the constants: * ``EASTER_JULIAN = 1`` * ``EASTER_ORTHODOX = 2`` * ``EASTER_WESTERN = 3`` The default method is method 3. More about the algorithm may be found at: http://users.chariot.net.au/~gmarts/eastalg.htm and http://www.tondering.dk/claus/calendar.html rrzinvalid methodrr i@d  () ValueErrordatetimeZdateint) Zyearmethodygeijchpdmr+/usr/lib/python3.6/easter.pyrs($ ",0$ )__doc__r__all__rrrrr+r+r+r,s  __pycache__/easter.cpython-36.pyc000064400000004036147204751220012674 0ustar003 6cYE @s4dZddlZddddgZdZdZd Zefd dZdS) zx This module offers a generic easter computing method for any given year, using Western, Orthodox or Julian algorithms. Neaster EASTER_JULIANEASTER_ORTHODOXEASTER_WESTERNc Csld|kodkns td|}|d}d}|dkrd|dd}||d|d }|d krd }|d kr||d d|d dd}n|d }||dd|ddd|dd}||dd|dd|dd|d}||d|d ||dd }|||} d| d| ddd} d| dd} tjt|t| t| S)a This method was ported from the work done by GM Arts, on top of the algorithm by Claus Tondering, which was based in part on the algorithm of Ouding (1940), as quoted in "Explanatory Supplement to the Astronomical Almanac", P. Kenneth Seidelmann, editor. This algorithm implements three different easter calculation methods: 1 - Original calculation in Julian calendar, valid in dates after 326 AD 2 - Original method, with date converted to Gregorian calendar, valid in years 1583 to 4099 3 - Revised method, in Gregorian calendar, valid in years 1583 to 4099 as well These methods are represented by the constants: * ``EASTER_JULIAN = 1`` * ``EASTER_ORTHODOX = 2`` * ``EASTER_WESTERN = 3`` The default method is method 3. More about the algorithm may be found at: http://users.chariot.net.au/~gmarts/eastalg.htm and http://www.tondering.dk/claus/calendar.html rrzinvalid methodrr i@d  () ValueErrordatetimeZdateint) Zyearmethodygeijchpdmr+/usr/lib/python3.6/easter.pyrs($ ",0$ )__doc__r__all__rrrrr+r+r+r,s  __pycache__/parser.cpython-36.opt-1.pyc000064400000101672147204751220013650 0ustar003 6cY@sdZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZmZddlmZdd lmZd d gZGd d d eZGdddeZGdd d eZGdddeZGdddeZeZddd ZGdddeZeZddZddZ dS)a This module offers a generic date/time string parser which is able to parse most known formats to represent a date and/or time. This module attempts to be forgiving with regards to unlikely input formats, returning a datetime object even for dates which are ambiguous. If an element of a date/time stamp is omitted, the following rules are applied: - If AM or PM is left unspecified, a 24-hour clock is assumed, however, an hour on a 12-hour clock (``0 <= hour <= 12``) *must* be specified if AM or PM is specified. - If a time zone is omitted, a timezone-naive datetime is returned. If any other elements are missing, they are taken from the :class:`datetime.datetime` object passed to the parameter ``default``. If this results in a day number exceeding the valid number of days per month, the value falls back to the end of the month. Additional resources about date/time string formats can be found below: - `A summary of the international standard date and time notation `_ - `W3C Date and Time Formats `_ - `Time Formats (Planetary Rings Node) `_ - `CPAN ParseDate module `_ - `Java SimpleDateFormat Class `_ )unicode_literalsN)StringIO) monthrange) text_type binary_type integer_types) relativedelta)tzparse parserinfoc@sneZdZejdZddZddZddZdd Z d d Z e d d Z e ddZ e ddZe ddZdS)_timelexz([.,])cCsdt|tr|j}t|tr$t|}t|dddkrHtdj|jj d||_ g|_ g|_ d|_ dS)Nreadz8Parser must be a string or character stream, not {itype})ZitypeF) isinstancerdecoderrgetattr TypeErrorformat __class____name__instream charstack tokenstackeof)selfrr/usr/lib/python3.6/parser.py__init__4s  z_timelex.__init__cCs|jr|jjdSd}d}d}x|js|jr>|jjd}n&|jjd}x|dkrb|jjd}qLW|srd|_Pq"|s|}|j|rd}n$|j|rd}n|j|rd }PnPq"|dkrd}|j|r||7}n$|d kr||7}d }n|jj |Pq"|dkrX|j|r||7}n>|d ks:|d krHt |d krH||7}d}n|jj |Pq"|d krd}|d ks||j|r||7}n6|j|r|dd kr||7}d}n|jj |Pq"|dkr"|d ks|j|r||7}q"|j|r|dd kr||7}d }q"|jj |Pq"W|dkr|sN|j d dksN|ddkr|j j |}|d}x(|ddD]}|rp|jj |qpW|dkr|j d dkr|jd d }|S)a This function breaks the time string into lexical units (tokens), which can be parsed by the parser. Lexical units are demarcated by changes in the character set, so any continuous string of letters is considered one unit, any continuous string of numbers is considered one unit. The main complication arises from the fact that dots ('.') can be used both as separators (e.g. "Sep.20.2009") or decimal points (e.g. "4:30:21.447"). As such, it is necessary to read the full context of any dot-separated strings before breaking it into tokens; as such, this function maintains a "token stack", for when the ambiguous context demands that multiple tokens be parsed at once. rFNrTa0 .a.,0.z.,r')r#r&r')rpoprrrriswordisnumisspaceappendlencount_split_decimalsplitreplace)rZ seenletterstokenstatenextcharltokrrr get_tokenDs              "         z_timelex.get_tokencCs|S)Nr)rrrr__iter__sz_timelex.__iter__cCs|j}|dkrt|S)N)r7 StopIteration)rr2rrr__next__sz_timelex.__next__cCs|jS)N)r:)rrrrnextsz _timelex.nextcCs t||S)N)list)clssrrrr0sz_timelex.splitcCs|jS)z5 Whether or not the next character is part of a word )isalpha)r=r4rrrr)sz_timelex.iswordcCs|jS)z0 Whether the next character is part of a number )isdigit)r=r4rrrr*sz_timelex.isnumcCs|jS)z* Whether the next character is whitespace )r+)r=r4rrrr+sz_timelex.isspaceN)r __module__ __qualname__recompiler/rr7r8r:r; classmethodr0r)r*r+rrrrr 0s m   r c@s,eZdZddZddZddZddZd S) _resultbasecCs x|jD]}t||dqWdS)N) __slots__setattr)rattrrrrrs z_resultbase.__init__cCsNg}x6|jD],}t||}|dk r |jd|t|fq Wd|dj|fS)Nz%s=%sz%s(%s)z, )rGrr,reprjoin)rZ classnamer5rIvaluerrr_reprs   z_resultbase._reprcstfddjDS)Nc3s|]}t|dk VqdS)N)r).0rI)rrr sz&_resultbase.__len__..)sumrG)rr)rr__len__s z_resultbase.__len__cCs|j|jjS)N)rMrr)rrrr__repr__sz_resultbase.__repr__N)rrArBrrMrQrRrrrrrFsrFc@seZdZdZdddddddd d d d d ddddddgZdcdddedfdgdhdigZdjdkdldmdndodpdqdrdsdtdug ZdvdwdxgZdydzgZdFdGdHgZ dgZ iZ d{dJdKZ dLdMZ dNdOZdPdQZdRdSZdTdUZdVdWZdXdYZdZd[Zd\d]Zd|d^d_Zd`daZdbS)}r a Class which handles what inputs are accepted. Subclass this to customize the language and acceptable values for each parameter. :param dayfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the day (``True``) or month (``False``). If ``yearfirst`` is set to ``True``, this distinguishes between YDM and YMD. Default is ``False``. :param yearfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the year. If ``True``, the first number is taken to be the year, otherwise the last number is taken to be the year. Default is ``False``. r!r"r$;-/'ZatZonandZadmtZofstZndZrdZthMonMondayTueTuesdayWed WednesdayThuThursdayFriFridaySatSaturdaySunSundayJanJanuaryFebFebruaryMarMarchAprAprilMayJunJuneJulJulyAugAugustSepSept SeptemberOctOctoberNovNovemberDecDecemberhhourhoursminuteminutesr>secondsecondsamrpmpUTCZGMTZFcCs|j|j|_|j|j|_|j|j|_|j|j|_|j|j |_ |j|j |_ |j|j |_||_||_tjj|_|jdd|_dS)Nd)_convertJUMP_jumpWEEKDAYS _weekdaysMONTHS_monthsHMS_hmsAMPM_ampmUTCZONE_utczonePERTAIN_pertaindayfirst yearfirsttimeZ localtimeZtm_year_year_century)rrrrrrrs zparserinfo.__init__cCsPi}xFt|D]:\}}t|tr.)r-minrkeysrKeyError)rrrrrweekday7s  zparserinfo.weekdayc CsLt|tdd|jjDkrHy|j|jdStk rFYnXdS)Ncss|]}t|VqdS)N)r-)rNrrrrrO@sz#parserinfo.month..r)r-rrrrr)rrrrrmonth?s  zparserinfo.monthc Cs(y|j|jStk r"dSXdS)N)rrr)rrrrrhmsGszparserinfo.hmsc Cs(y|j|jStk r"dSXdS)N)rrr)rrrrrampmMszparserinfo.ampmcCs|j|jkS)N)rr)rrrrrpertainSszparserinfo.pertaincCs|j|jkS)N)rr)rrrrrutczoneVszparserinfo.utczonecCs||jkrdS|jj|S)Nr)rTZOFFSETget)rrrrrtzoffsetYs zparserinfo.tzoffsetcCsJ|dkrF| rF||j7}t||jdkrF||jkr>|d7}n|d8}|S)Nr2)rabsr)ryearcentury_specifiedrrr convertyear_s   zparserinfo.convertyearcCsl|jdk r|j|j|j|_|jdkr.|j s8|jdkrFd|_d|_n"|jdkrh|jrh|j|jrhd|_dS)NrrrT)rrrrtznamer)rresrrrvalidateis zparserinfo.validateN)r[r\)r]r^)r_r`)rarb)rcrd)rerf)rgrh)rirj)rkrl)rmrn)rorp)rqrq)rrrs)rtru)rvrw)rxryrz)r{r|)r}r~)rr)rrr)rXrr)r>rr)rr)rr)FF)F)rrArB__doc__rrrrrrrrrrrrrrrrrrrrrrrrr sV     csPeZdZfddZeddZeddZddZfd d Zd d Z Z S) _ymdcs$t|j|j||d|_||_dS)NF)superrrrtzstr)rrargskwargs)rrrrwsz _ymd.__init__c Cs&y t||kStk r dSXdS)NF)int ValueError)r2rrrrtoken_could_be_year|s z_ymd.token_could_be_yearcsfdd|DS)Ncsg|]}tj|r|qSr)rr)rNr2)rrr sz3_ymd.find_potential_year_tokens..r)rtokensr)rrfind_potential_year_tokenssz_ymd.find_potential_year_tokenscCsFx@t|D]4\}}tj||}t|dkr t|ddkr |Sq WdS)zk attempt to deduce if a pre 100 year was lost due to padded zeros being taken off rrr%N)rrrr-)rrindexr2Zpotential_year_tokensrrrfind_probable_year_indexs z_ymd.find_probable_year_indexcsNt|dr&|jr4t|dkr4d|_n|dkr4d|_t|j|jt|dS)NrQr%Tr)hasattrr@r-rrrr,r)rval)rrrr,s  z _ymd.appendcCs,t|}d\}}}|dkr&tdn|dks>|d kr|dkr|d krT||}||=|dksd|d kr|ddkrz|d}n|d}n|dkr|ddkr|\}}n8|ddkr|\}}n"|r|ddkr|\}}n|\}}nB|dkr"|dkr|\}}}n |dkrF|ddks.|r:|ddkr:|\}}}n |\}}}n|dkrv|ddkrj|\}}}n |\}}}n|ddks|jtj|jdks|r|ddkr|ddkr|r|ddkr|\}}}n |\}}}n8|ddks |r|ddkr|\}}}n |\}}}|||fS) NzMore than three YMD valuesrr%r )NNNr'r'r')r-rrr r0r)rmstridxrrZlen_ymdrrdayrrr resolve_ymdsR              "     "  "  z_ymd.resolve_ymd) rrArBr staticmethodrrrr,r __classcell__rr)rrrvs     rc@sFeZdZd ddZdddZGdddeZdd d Zed d Z dS)parserNcCs|pt|_dS)N)r info)rrrrrrszparser.__init__FcKsV|dkr tjjjddddd}|j|f|\}}|dkrBtdt|dkrVtdi}x&dD]} t|| } | dk r`| || <q`Wd|kr|jdkr|jn|j} |jdkr|jn|j} |j dkr|j n|j } | t | | d krt | | d |d<|jf|}|j dk r$|j r$|t j |j d}|s8t |tjsJ|r|j|krt |tjrh||j|j}n |j|j}t |tjr|}n|jdkr|jtjd}n |jr8|jtj|j|jd}|jddrN||fS|SdS)aV Parse the date/time string into a :class:`datetime.datetime` object. :param timestr: Any date/time string using the supported formats. :param default: The default datetime object, if this is a datetime object and not ``None``, elements specified in ``timestr`` replace elements in the default object. :param ignoretz: If set ``True``, time zones in parsed strings are ignored and a naive :class:`datetime.datetime` object is returned. :param tzinfos: Additional time zone names / aliases which may be present in the string. This argument maps time zone names (and optionally offsets from those time zones) to time zones. This parameter can be a dictionary with timezone aliases mapping time zone names to time zones or a function taking two parameters (``tzname`` and ``tzoffset``) and returning a time zone. The timezones to which the names are mapped can be an integer offset from UTC in minutes or a :class:`tzinfo` object. .. doctest:: :options: +NORMALIZE_WHITESPACE >>> from dateutil.parser import parse >>> from dateutil.tz import gettz >>> tzinfos = {"BRST": -10800, "CST": gettz("America/Chicago")} >>> parse("2012-01-19 17:21:00 BRST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzoffset(u'BRST', -10800)) >>> parse("2012-01-19 17:21:00 CST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzfile('/usr/share/zoneinfo/America/Chicago')) This parameter is ignored if ``ignoretz`` is set. :param **kwargs: Keyword arguments as passed to ``_parse()``. :return: Returns a :class:`datetime.datetime` object or, if the ``fuzzy_with_tokens`` option is ``True``, returns a tuple, the first element being a :class:`datetime.datetime` object, the second a tuple containing the fuzzy tokens. :raises ValueError: Raised for invalid or unknown string format, if the provided :class:`tzinfo` is not in a valid format, or if an invalid date would be created. :raises TypeError: Raised for non-string or character stream input. :raises OverflowError: Raised if the parsed date exceeds the largest valid C integer on your system. Nr)rrr microsecondzUnknown string formatzString does not contain a date.rrrrrrrr)rz9Offset must be tzinfo subclass, tz string, or int offset.)tzinfofuzzy_with_tokensF)rrrrrrr)datetimeZnowr1_parserr-rrrrrrr r collectionsCallablerrrrrr rrrZtzlocalZtzutc)rtimestrdefaultZignoretzZtzinfosrrskipped_tokensreplrIrLZcyearZcmonthZcdayretZtzdatarrrrr s\?          z parser.parsec @s&eZdZddddddddd d d g Zd S) zparser._resultrrrrrrrrrrrN)rrArBrGrrrr_resultisrcCsJ |rd}|j}|dkr|j}|dkr*|j}|j}tj|}d } t} yt|} d!} t|} d} xJ|| k ry||}t |}Wnt k rd}YnX|dk rt||}|d7}t| dkrH|d"krH|j dkrH|| ks ||dkrH|j ||dkrH||d}t |dd|_ |dkrt |dd|_qf|d kst|d kr||djd d kr||d}| r||djd d#kr| j|dd| j|dd| j|ddn|t&| fS|dfSdS)4a Private method which performs the heavy lifting of parsing, called from ``parse()``, which passes on its ``kwargs`` to this function. :param timestr: The string to parse. :param dayfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the day (``True``) or month (``False``). If ``yearfirst`` is set to ``True``, this distinguishes between YDM and YMD. If set to ``None``, this value is retrieved from the current :class:`parserinfo` object (which itself defaults to ``False``). :param yearfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the year. If ``True``, the first number is taken to be the year, otherwise the last number is taken to be the year. If this is set to ``None``, the value is retrieved from the current :class:`parserinfo` object (which itself defaults to ``False``). :param fuzzy: Whether to allow fuzzy parsing, allowing for string like "Today is January 1, 2047 at 8:21:00AM". :param fuzzy_with_tokens: If ``True``, ``fuzzy`` is automatically set to True, and the parser will return a tuple where the first element is the parsed :class:`datetime.datetime` datetimestamp and the second element is a tuple containing the portions of the string which were ignored: .. doctest:: >>> from dateutil.parser import parse >>> parse("Today is January 1, 2047 at 8:21:00AM", fuzzy_with_tokens=True) (datetime.datetime(2047, 1, 1, 8, 21), (u'Today is ', u' ', u'at ')) TNr%rrr:r"r r!<rTrUFzNo hour specified with zAM or PM flag.zInvalid hour specified for z12-hour clock.cSsg|]}|tjkr|qSr)stringascii_uppercase)rNxrrrrsz!parser._parse..+i()cSsg|]}|tjkr|qSr)rr)rNrrrrrsr')r%rr')rrr)rTrUr")NN)NN)rTrUz%No hour specified with AM or PM flag.z)Invalid hour specified for 12-hour clock.)rrT)rrT)rrTr')r'r)NN)NN)NN)NN)'rrrrr r0r<rr-floatrrrrrfindr,_parsemsrrrrrrrstrr _skip_tokenrrrrrrr IndexErrorAssertionErrorrr)rrrrZfuzzyrrrr5last_skipped_token_irZymdrlen_lrZ value_reprrLlen_lir>idxZnewidxZ sec_remaindersepZ val_is_ampmsignalrrrrrrrns)     $  ,                                 & $$            2       4 &   .&        z parser._parsecCs8||dkr"|d||7<n|j|||}|S)Nrr')r,)rrrr5rrrr-s  zparser._skip_token)N)NFN)NNFF) rrArBrr rFrrrrrrrrrs   ArcKs(|rt|j|f|Stj|f|SdS)a) Parse a string in one of the supported formats, using the ``parserinfo`` parameters. :param timestr: A string containing a date/time stamp. :param parserinfo: A :class:`parserinfo` object containing parameters for the parser. If ``None``, the default arguments to the :class:`parserinfo` constructor are used. The ``**kwargs`` parameter takes the following keyword arguments: :param default: The default datetime object, if this is a datetime object and not ``None``, elements specified in ``timestr`` replace elements in the default object. :param ignoretz: If set ``True``, time zones in parsed strings are ignored and a naive :class:`datetime` object is returned. :param tzinfos: Additional time zone names / aliases which may be present in the string. This argument maps time zone names (and optionally offsets from those time zones) to time zones. This parameter can be a dictionary with timezone aliases mapping time zone names to time zones or a function taking two parameters (``tzname`` and ``tzoffset``) and returning a time zone. The timezones to which the names are mapped can be an integer offset from UTC in minutes or a :class:`tzinfo` object. .. doctest:: :options: +NORMALIZE_WHITESPACE >>> from dateutil.parser import parse >>> from dateutil.tz import gettz >>> tzinfos = {"BRST": -10800, "CST": gettz("America/Chicago")} >>> parse("2012-01-19 17:21:00 BRST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzoffset(u'BRST', -10800)) >>> parse("2012-01-19 17:21:00 CST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzfile('/usr/share/zoneinfo/America/Chicago')) This parameter is ignored if ``ignoretz`` is set. :param dayfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the day (``True``) or month (``False``). If ``yearfirst`` is set to ``True``, this distinguishes between YDM and YMD. If set to ``None``, this value is retrieved from the current :class:`parserinfo` object (which itself defaults to ``False``). :param yearfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the year. If ``True``, the first number is taken to be the year, otherwise the last number is taken to be the year. If this is set to ``None``, the value is retrieved from the current :class:`parserinfo` object (which itself defaults to ``False``). :param fuzzy: Whether to allow fuzzy parsing, allowing for string like "Today is January 1, 2047 at 8:21:00AM". :param fuzzy_with_tokens: If ``True``, ``fuzzy`` is automatically set to True, and the parser will return a tuple where the first element is the parsed :class:`datetime.datetime` datetimestamp and the second element is a tuple containing the portions of the string which were ignored: .. doctest:: >>> from dateutil.parser import parse >>> parse("Today is January 1, 2047 at 8:21:00AM", fuzzy_with_tokens=True) (datetime.datetime(2047, 1, 1, 8, 21), (u'Today is ', u' ', u'at ')) :return: Returns a :class:`datetime.datetime` object or, if the ``fuzzy_with_tokens`` option is ``True``, returns a tuple, the first element being a :class:`datetime.datetime` object, the second a tuple containing the fuzzy tokens. :raises ValueError: Raised for invalid or unknown string format, if the provided :class:`tzinfo` is not in a valid format, or if an invalid date would be created. :raises OverflowError: Raised if the parsed date exceeds the largest valid C integer on your system. N)rr DEFAULTPARSER)rr rrrrr <s_c@s$eZdZGdddeZddZdS) _tzparserc@s<eZdZddddddgZGdddeZd d Zd d Zd S)z_tzparser._resultstdabbr stdoffsetdstabbr dstoffsetstartendc@seZdZdddddddgZdS) z_tzparser._result._attrrweekrydayjydayrrN)rrArBrGrrrr_attrsr cCs |jdS)N)rM)rrrrrRsz_tzparser._result.__repr__cCs"tj||j|_|j|_dS)N)rFrr rr)rrrrrs  z_tzparser._result.__init__N)rrArBrGrFr rRrrrrrrs rc Cs|j}tj|}yt|}d}x||kr|}x(||kr\dd||D r\|d7}q6W||kr|jsd}dj||||_nd}dj||||_|}||ko||dks||dd kr||dkrd||dk}|d7}nd}t||} | d krJt||t||dd d t||d dd|n|d|kr||ddkrt||t||d t||d d||d 7}n4| d krt||t||dd d |ndS|d7}|jrPq&Pq&W||kr0x*t ||D]}||dkrd||<qW|d7}||kr>nd|j dkoXdknrdd||dD rx|j |j fD]} t||| _ |d 7}||d krt||dd } |d7}n t||} |d 7}| r| | _t||dd| _nt||| _|d 7}t||| _|d 7}qW||kr||d!krjd#||dk}|d7}nd}|jt||||_nL|j dd kr||dj dd krdd||dD r֐x|j |j fD]} ||dkr|d7}t||| _n||dkr|d7}t||| _ |d7}|d7}t||| _| jdkr\d$| _|d7}|d7}t||dd| _nt||d| _|d7}||kr||dkr|d7}t||} | d krt||dd d t||d dd| _n|d|kr||ddkrt||d t||d d| _|d 7}|d|kr||ddkr|d 7}| jt||7_n*| d krt||dd d | _ndS|d7}|d7}qWWntttfk rdSX|S)%NrcSsg|]}|dkr|qS)z0123456789:,-+r)rNrrrrrsz#_tzparser.parse..rrr rrrT 0123456789rr%irrrSr$r cSs*g|]"}|dkr|D]}|dkr|qqS)r$rr)rNryrrrrs rUc Ss*g|]"}|dkr|D]}|dkr|qqS) r$rUJMr"rTrr)r$rUrrr"rTrr)rNrrrrrrsrrr)rrT)rrTr')rr'r'r')rTrr')r'rr')rr r0r-rrKrrHrranger.rrrr rrrrrr r rrr) rrrr5rrjZoffattrrrrrLrrrr s      " *     "    (   4 &  z_tzparser.parseN)rrArBrFrr rrrrrsrcCs tj|S)N)DEFAULTTZPARSERr )rrrr_parsetzQsrcCsFd|krt|dfS|jd\}}t|t|jddddfSdS)z9Parse a I[.F] seconds value into (seconds, microseconds).r"rrr N)rr0ljust)rLrfrrrrUs r)N)!rZ __future__rrrrrrCiorZcalendarrZsixrrrr r r __all__objectr rFr r<rrrr rrrrrrrrs<     #oX e.__pycache__/parser.cpython-36.pyc000064400000102174147204751220012707 0ustar003 6cY@sdZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZmZddlmZdd lmZd d gZGd d d eZGdddeZGdd d eZGdddeZGdddeZeZddd ZGdddeZeZddZddZ dS)a This module offers a generic date/time string parser which is able to parse most known formats to represent a date and/or time. This module attempts to be forgiving with regards to unlikely input formats, returning a datetime object even for dates which are ambiguous. If an element of a date/time stamp is omitted, the following rules are applied: - If AM or PM is left unspecified, a 24-hour clock is assumed, however, an hour on a 12-hour clock (``0 <= hour <= 12``) *must* be specified if AM or PM is specified. - If a time zone is omitted, a timezone-naive datetime is returned. If any other elements are missing, they are taken from the :class:`datetime.datetime` object passed to the parameter ``default``. If this results in a day number exceeding the valid number of days per month, the value falls back to the end of the month. Additional resources about date/time string formats can be found below: - `A summary of the international standard date and time notation `_ - `W3C Date and Time Formats `_ - `Time Formats (Planetary Rings Node) `_ - `CPAN ParseDate module `_ - `Java SimpleDateFormat Class `_ )unicode_literalsN)StringIO) monthrange) text_type binary_type integer_types) relativedelta)tzparse parserinfoc@sneZdZejdZddZddZddZdd Z d d Z e d d Z e ddZ e ddZe ddZdS)_timelexz([.,])cCsdt|tr|j}t|tr$t|}t|dddkrHtdj|jj d||_ g|_ g|_ d|_ dS)Nreadz8Parser must be a string or character stream, not {itype})ZitypeF) isinstancerdecoderrgetattr TypeErrorformat __class____name__instream charstack tokenstackeof)selfrr/usr/lib/python3.6/parser.py__init__4s  z_timelex.__init__cCs|jr|jjdSd}d}d}x|js|jr>|jjd}n&|jjd}x|dkrb|jjd}qLW|srd|_Pq"|s|}|j|rd}n$|j|rd}n|j|rd }PnPq"|dkrd}|j|r||7}n$|d kr||7}d }n|jj |Pq"|dkrX|j|r||7}n>|d ks:|d krHt |d krH||7}d}n|jj |Pq"|d krd}|d ks||j|r||7}n6|j|r|dd kr||7}d}n|jj |Pq"|dkr"|d ks|j|r||7}q"|j|r|dd kr||7}d }q"|jj |Pq"W|dkr|sN|j d dksN|ddkr|j j |}|d}x(|ddD]}|rp|jj |qpW|dkr|j d dkr|jd d }|S)a This function breaks the time string into lexical units (tokens), which can be parsed by the parser. Lexical units are demarcated by changes in the character set, so any continuous string of letters is considered one unit, any continuous string of numbers is considered one unit. The main complication arises from the fact that dots ('.') can be used both as separators (e.g. "Sep.20.2009") or decimal points (e.g. "4:30:21.447"). As such, it is necessary to read the full context of any dot-separated strings before breaking it into tokens; as such, this function maintains a "token stack", for when the ambiguous context demands that multiple tokens be parsed at once. rFNrTa0 .a.,0.z.,r')r#r&r')rpoprrrriswordisnumisspaceappendlencount_split_decimalsplitreplace)rZ seenletterstokenstatenextcharltokrrr get_tokenDs              "         z_timelex.get_tokencCs|S)Nr)rrrr__iter__sz_timelex.__iter__cCs|j}|dkrt|S)N)r7 StopIteration)rr2rrr__next__sz_timelex.__next__cCs|jS)N)r:)rrrrnextsz _timelex.nextcCs t||S)N)list)clssrrrr0sz_timelex.splitcCs|jS)z5 Whether or not the next character is part of a word )isalpha)r=r4rrrr)sz_timelex.iswordcCs|jS)z0 Whether the next character is part of a number )isdigit)r=r4rrrr*sz_timelex.isnumcCs|jS)z* Whether the next character is whitespace )r+)r=r4rrrr+sz_timelex.isspaceN)r __module__ __qualname__recompiler/rr7r8r:r; classmethodr0r)r*r+rrrrr 0s m   r c@s,eZdZddZddZddZddZd S) _resultbasecCs x|jD]}t||dqWdS)N) __slots__setattr)rattrrrrrs z_resultbase.__init__cCsNg}x6|jD],}t||}|dk r |jd|t|fq Wd|dj|fS)Nz%s=%sz%s(%s)z, )rGrr,reprjoin)rZ classnamer5rIvaluerrr_reprs   z_resultbase._reprcstfddjDS)Nc3s|]}t|dk VqdS)N)r).0rI)rrr sz&_resultbase.__len__..)sumrG)rr)rr__len__s z_resultbase.__len__cCs|j|jjS)N)rMrr)rrrr__repr__sz_resultbase.__repr__N)rrArBrrMrQrRrrrrrFsrFc@seZdZdZdddddddd d d d d ddddddgZdcdddedfdgdhdigZdjdkdldmdndodpdqdrdsdtdug ZdvdwdxgZdydzgZdFdGdHgZ dgZ iZ d{dJdKZ dLdMZ dNdOZdPdQZdRdSZdTdUZdVdWZdXdYZdZd[Zd\d]Zd|d^d_Zd`daZdbS)}r a Class which handles what inputs are accepted. Subclass this to customize the language and acceptable values for each parameter. :param dayfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the day (``True``) or month (``False``). If ``yearfirst`` is set to ``True``, this distinguishes between YDM and YMD. Default is ``False``. :param yearfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the year. If ``True``, the first number is taken to be the year, otherwise the last number is taken to be the year. Default is ``False``. r!r"r$;-/'ZatZonandZadmtZofstZndZrdZthMonMondayTueTuesdayWed WednesdayThuThursdayFriFridaySatSaturdaySunSundayJanJanuaryFebFebruaryMarMarchAprAprilMayJunJuneJulJulyAugAugustSepSept SeptemberOctOctoberNovNovemberDecDecemberhhourhoursminuteminutesr>secondsecondsamrpmpUTCZGMTZFcCs|j|j|_|j|j|_|j|j|_|j|j|_|j|j |_ |j|j |_ |j|j |_||_||_tjj|_|jdd|_dS)Nd)_convertJUMP_jumpWEEKDAYS _weekdaysMONTHS_monthsHMS_hmsAMPM_ampmUTCZONE_utczonePERTAIN_pertaindayfirst yearfirsttimeZ localtimeZtm_year_year_century)rrrrrrrs zparserinfo.__init__cCsPi}xFt|D]:\}}t|tr.)r-minrkeysrKeyError)rrrrrweekday7s  zparserinfo.weekdayc CsLt|tdd|jjDkrHy|j|jdStk rFYnXdS)Ncss|]}t|VqdS)N)r-)rNrrrrrO@sz#parserinfo.month..r)r-rrrrr)rrrrrmonth?s  zparserinfo.monthc Cs(y|j|jStk r"dSXdS)N)rrr)rrrrrhmsGszparserinfo.hmsc Cs(y|j|jStk r"dSXdS)N)rrr)rrrrrampmMszparserinfo.ampmcCs|j|jkS)N)rr)rrrrrpertainSszparserinfo.pertaincCs|j|jkS)N)rr)rrrrrutczoneVszparserinfo.utczonecCs||jkrdS|jj|S)Nr)rTZOFFSETget)rrrrrtzoffsetYs zparserinfo.tzoffsetcCsJ|dkrF| rF||j7}t||jdkrF||jkr>|d7}n|d8}|S)Nr2)rabsr)ryearcentury_specifiedrrr convertyear_s   zparserinfo.convertyearcCsl|jdk r|j|j|j|_|jdkr.|j s8|jdkrFd|_d|_n"|jdkrh|jrh|j|jrhd|_dS)NrrrT)rrrrtznamer)rresrrrvalidateis zparserinfo.validateN)r[r\)r]r^)r_r`)rarb)rcrd)rerf)rgrh)rirj)rkrl)rmrn)rorp)rqrq)rrrs)rtru)rvrw)rxryrz)r{r|)r}r~)rr)rrr)rXrr)r>rr)rr)rr)FF)F)rrArB__doc__rrrrrrrrrrrrrrrrrrrrrrrrr sV     csPeZdZfddZeddZeddZddZfd d Zd d Z Z S) _ymdcs$t|j|j||d|_||_dS)NF)superrrrtzstr)rrargskwargs)rrrrwsz _ymd.__init__c Cs&y t||kStk r dSXdS)NF)int ValueError)r2rrrrtoken_could_be_year|s z_ymd.token_could_be_yearcsfdd|DS)Ncsg|]}tj|r|qSr)rr)rNr2)rrr sz3_ymd.find_potential_year_tokens..r)rtokensr)rrfind_potential_year_tokenssz_ymd.find_potential_year_tokenscCsFx@t|D]4\}}tj||}t|dkr t|ddkr |Sq WdS)zk attempt to deduce if a pre 100 year was lost due to padded zeros being taken off rrr%N)rrrr-)rrindexr2Zpotential_year_tokensrrrfind_probable_year_indexs z_ymd.find_probable_year_indexcsNt|dr&|jr4t|dkr4d|_n|dkr4d|_t|j|jt|dS)NrQr%Tr)hasattrr@r-rrrr,r)rval)rrrr,s  z _ymd.appendcCs,t|}d\}}}|dkr&tdn|dks>|d kr|dkr|d krT||}||=|dksd|d kr|ddkrz|d}n|d}n|dkr|ddkr|\}}n8|ddkr|\}}n"|r|ddkr|\}}n|\}}nB|dkr"|dkr|\}}}n |dkrF|ddks.|r:|ddkr:|\}}}n |\}}}n|dkrv|ddkrj|\}}}n |\}}}n|ddks|jtj|jdks|r|ddkr|ddkr|r|ddkr|\}}}n |\}}}n8|ddks |r|ddkr|\}}}n |\}}}|||fS) NzMore than three YMD valuesrr%r )NNNr'r'r')r-rrr r0r)rmstridxrrZlen_ymdrrdayrrr resolve_ymdsR              "     "  "  z_ymd.resolve_ymd) rrArBr staticmethodrrrr,r __classcell__rr)rrrvs     rc@sFeZdZd ddZdddZGdddeZdd d Zed d Z dS)parserNcCs|pt|_dS)N)r info)rrrrrrszparser.__init__FcKsV|dkr tjjjddddd}|j|f|\}}|dkrBtdt|dkrVtdi}x&dD]} t|| } | dk r`| || <q`Wd|kr|jdkr|jn|j} |jdkr|jn|j} |j dkr|j n|j } | t | | d krt | | d |d<|jf|}|j dk r$|j r$|t j |j d}|s8t |tjsJ|r|j|krt |tjrh||j|j}n |j|j}t |tjr|}n|jdkr|jtjd}n |jr8|jtj|j|jd}|jddrN||fS|SdS)aV Parse the date/time string into a :class:`datetime.datetime` object. :param timestr: Any date/time string using the supported formats. :param default: The default datetime object, if this is a datetime object and not ``None``, elements specified in ``timestr`` replace elements in the default object. :param ignoretz: If set ``True``, time zones in parsed strings are ignored and a naive :class:`datetime.datetime` object is returned. :param tzinfos: Additional time zone names / aliases which may be present in the string. This argument maps time zone names (and optionally offsets from those time zones) to time zones. This parameter can be a dictionary with timezone aliases mapping time zone names to time zones or a function taking two parameters (``tzname`` and ``tzoffset``) and returning a time zone. The timezones to which the names are mapped can be an integer offset from UTC in minutes or a :class:`tzinfo` object. .. doctest:: :options: +NORMALIZE_WHITESPACE >>> from dateutil.parser import parse >>> from dateutil.tz import gettz >>> tzinfos = {"BRST": -10800, "CST": gettz("America/Chicago")} >>> parse("2012-01-19 17:21:00 BRST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzoffset(u'BRST', -10800)) >>> parse("2012-01-19 17:21:00 CST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzfile('/usr/share/zoneinfo/America/Chicago')) This parameter is ignored if ``ignoretz`` is set. :param **kwargs: Keyword arguments as passed to ``_parse()``. :return: Returns a :class:`datetime.datetime` object or, if the ``fuzzy_with_tokens`` option is ``True``, returns a tuple, the first element being a :class:`datetime.datetime` object, the second a tuple containing the fuzzy tokens. :raises ValueError: Raised for invalid or unknown string format, if the provided :class:`tzinfo` is not in a valid format, or if an invalid date would be created. :raises TypeError: Raised for non-string or character stream input. :raises OverflowError: Raised if the parsed date exceeds the largest valid C integer on your system. Nr)rrr microsecondzUnknown string formatzString does not contain a date.rrrrrrrr)rz9Offset must be tzinfo subclass, tz string, or int offset.)tzinfofuzzy_with_tokensF)rrrrrrr)datetimeZnowr1_parserr-rrrrrrr r collectionsCallablerrrrrr rrrZtzlocalZtzutc)rtimestrdefaultZignoretzZtzinfosrrskipped_tokensreplrIrLZcyearZcmonthZcdayretZtzdatarrrrr s\?          z parser.parsec @s&eZdZddddddddd d d g Zd S) zparser._resultrrrrrrrrrrrN)rrArBrGrrrr_resultisrcCst |rd}|j}|dkr|j}|dkr*|j}|j}tj|}d } t} yt|} d!} t|} d} xt|| k ry||}t |}Wnt k rd}YnX|dk rt||}|d7}t| dkrH|d"krH|j dkrH|| ks ||dkrH|j ||dkrH||d}t |dd|_ |dkrt |dd|_qf|d kst|d kr||djd d kr||d}| r||djd d#kr| j|dd| j|dd| j|ddn>> from dateutil.parser import parse >>> parse("Today is January 1, 2047 at 8:21:00AM", fuzzy_with_tokens=True) (datetime.datetime(2047, 1, 1, 8, 21), (u'Today is ', u' ', u'at ')) TNr%rrr:r"r r!<rTrUFzNo hour specified with zAM or PM flag.zInvalid hour specified for z12-hour clock.cSsg|]}|tjkr|qSr)stringascii_uppercase)rNxrrrrsz!parser._parse..+i()cSsg|]}|tjkr|qSr)rr)rNrrrrrsr')r%rr')rrr)rTrUr"r')NNr')NNr')rTrUz%No hour specified with AM or PM flag.z)Invalid hour specified for 12-hour clock.)rrT)rrT)rrTr')r'r)NN)NN)NN)NN)'rrrrr r0r<rr-floatrrrrrfindr,_parsemsrrrrAssertionErrorrrrstrr _skip_tokenrrrrrrr IndexErrorrr)rrrrZfuzzyrrrr5last_skipped_token_irZymdrlen_lrZ value_reprrLlen_lir>idxZnewidxZ sec_remaindersepZ val_is_ampmsignalrrrrrrrns)     $  ,                                 & $$            2       4 &   .&        z parser._parsecCs8||dkr"|d||7<n|j|||}|S)Nrr')r,)rrrr5rrrr-s  zparser._skip_token)N)NFN)NNFF) rrArBrr rFrrrrrrrrrs   ArcKs(|rt|j|f|Stj|f|SdS)a) Parse a string in one of the supported formats, using the ``parserinfo`` parameters. :param timestr: A string containing a date/time stamp. :param parserinfo: A :class:`parserinfo` object containing parameters for the parser. If ``None``, the default arguments to the :class:`parserinfo` constructor are used. The ``**kwargs`` parameter takes the following keyword arguments: :param default: The default datetime object, if this is a datetime object and not ``None``, elements specified in ``timestr`` replace elements in the default object. :param ignoretz: If set ``True``, time zones in parsed strings are ignored and a naive :class:`datetime` object is returned. :param tzinfos: Additional time zone names / aliases which may be present in the string. This argument maps time zone names (and optionally offsets from those time zones) to time zones. This parameter can be a dictionary with timezone aliases mapping time zone names to time zones or a function taking two parameters (``tzname`` and ``tzoffset``) and returning a time zone. The timezones to which the names are mapped can be an integer offset from UTC in minutes or a :class:`tzinfo` object. .. doctest:: :options: +NORMALIZE_WHITESPACE >>> from dateutil.parser import parse >>> from dateutil.tz import gettz >>> tzinfos = {"BRST": -10800, "CST": gettz("America/Chicago")} >>> parse("2012-01-19 17:21:00 BRST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzoffset(u'BRST', -10800)) >>> parse("2012-01-19 17:21:00 CST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzfile('/usr/share/zoneinfo/America/Chicago')) This parameter is ignored if ``ignoretz`` is set. :param dayfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the day (``True``) or month (``False``). If ``yearfirst`` is set to ``True``, this distinguishes between YDM and YMD. If set to ``None``, this value is retrieved from the current :class:`parserinfo` object (which itself defaults to ``False``). :param yearfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the year. If ``True``, the first number is taken to be the year, otherwise the last number is taken to be the year. If this is set to ``None``, the value is retrieved from the current :class:`parserinfo` object (which itself defaults to ``False``). :param fuzzy: Whether to allow fuzzy parsing, allowing for string like "Today is January 1, 2047 at 8:21:00AM". :param fuzzy_with_tokens: If ``True``, ``fuzzy`` is automatically set to True, and the parser will return a tuple where the first element is the parsed :class:`datetime.datetime` datetimestamp and the second element is a tuple containing the portions of the string which were ignored: .. doctest:: >>> from dateutil.parser import parse >>> parse("Today is January 1, 2047 at 8:21:00AM", fuzzy_with_tokens=True) (datetime.datetime(2047, 1, 1, 8, 21), (u'Today is ', u' ', u'at ')) :return: Returns a :class:`datetime.datetime` object or, if the ``fuzzy_with_tokens`` option is ``True``, returns a tuple, the first element being a :class:`datetime.datetime` object, the second a tuple containing the fuzzy tokens. :raises ValueError: Raised for invalid or unknown string format, if the provided :class:`tzinfo` is not in a valid format, or if an invalid date would be created. :raises OverflowError: Raised if the parsed date exceeds the largest valid C integer on your system. N)rr DEFAULTPARSER)rr rrrrr <s_c@s$eZdZGdddeZddZdS) _tzparserc@s<eZdZddddddgZGdddeZd d Zd d Zd S)z_tzparser._resultstdabbr stdoffsetdstabbr dstoffsetstartendc@seZdZdddddddgZdS) z_tzparser._result._attrrweekrydayjydayrrN)rrArBrGrrrr_attrsr cCs |jdS)N)rM)rrrrrRsz_tzparser._result.__repr__cCs"tj||j|_|j|_dS)N)rFrr rr)rrrrrs  z_tzparser._result.__init__N)rrArBrGrFr rRrrrrrrs rc CsZ|j}tj|}y$t|}d}x||kr|}x(||kr\dd||D r\|d7}q6W||kr|jsd}dj||||_nd}dj||||_|}||ko||dks||dd kr||dkrd||dk}|d7}nd }t||} | d krJt||t||dd d t||d dd|n|d|kr||ddkrt||t||d t||d d||d 7}n4| d krt||t||dd d |ndS|d7}|jrPq&Pq&W||krBx*t ||D]}||dkrd||<qW||dks:t |d7}||krPnd|j dkojdknrdd||dD rx|j |j fD]} t||| _|d 7}||d krt||dd!} |d7}n t||} |d 7}| r| | _t||dd| _nt||| _|d 7}t||| _|d 7}qW||kr6||d"kr|d$||dk}|d7}nd}|jt||||_n|j dd kr6||dj dd kr6dd||dD r6xF|j |j fD]4} ||dkr|d7}t||| _n||dkr|d7}t||| _|d7}||d%ksXt |d7}t||| _| jdkrd&| _|d7}||d'kst |d7}t||dd| _nt||d| _|d7}||kr||dkr|d7}t||} | d kr>t||dd d t||d dd| _n|d|kr||ddkrt||d t||d d| _|d 7}|d|kr||ddkr|d 7}| jt||7_n*| d krt||dd d | _ndS|d7}||ks||dkst |d7}qW||ks6t Wnttt fk rTdSX|S)(NrcSsg|]}|dkr|qS)z0123456789:,-+r)rNrrrrrsz#_tzparser.parse..rrr rrrT 0123456789rr%irrrSr$r cSs*g|]"}|dkr|D]}|dkr|qqS)r$rr)rNryrrrrs rUc Ss*g|]"}|dkr|D]}|dkr|qqS) r$rUJMr"rTrr)r$rUrrr"rTrr)rNrrrrrrsrrr"r)rrT)rrTr')rr'r'r')rTrr')r'r)rTr"r')rTr")rr r0r-rrKrrHrrangerr.rrrr rrrrrr r rr) rrrr5rrjZoffattrrrrrLrrrr s      " *     "    (   4 &  z_tzparser.parseN)rrArBrFrr rrrrrsrcCs tj|S)N)DEFAULTTZPARSERr )rrrr_parsetzQsrcCsFd|krt|dfS|jd\}}t|t|jddddfSdS)z9Parse a I[.F] seconds value into (seconds, microseconds).r"rrr N)rr0ljust)rLrfrrrrUs r)N)!rZ __future__rrrrrrCiorZcalendarrZsixrrrr r r __all__objectr rFr r<rrrr rrrrrrrrs<     #oX e.__pycache__/relativedelta.cpython-36.opt-1.pyc000064400000033641147204751220015201 0ustar003 6cYiZ@sddlZddlZddlZddlmZddlmZddlmZddl m Z e dde d D\Z ZZZZZZZd d d d ddddgZGdd d eZddZdS)N)copysign) integer_types)warn)weekdayccs|]}t|VqdS)N)r).0xr #/usr/lib/python3.6/relativedelta.py sr  relativedeltaMOTUWETHFRSASUc@seZdZdZd%ddZddZedd Zejd d Zd d Z d dZ ddZ ddZ ddZ ddZddZddZeZddZeZddZdZdd Zd!d"ZeZd#d$ZdS)&r a The relativedelta type is based on the specification of the excellent work done by M.-A. Lemburg in his `mx.DateTime `_ extension. However, notice that this type does *NOT* implement the same algorithm as his work. Do *NOT* expect it to behave like mx.DateTime's counterpart. There are two different ways to build a relativedelta instance. The first one is passing it two date/datetime classes:: relativedelta(datetime1, datetime2) The second one is passing it any number of the following keyword arguments:: relativedelta(arg1=x,arg2=y,arg3=z...) year, month, day, hour, minute, second, microsecond: Absolute information (argument is singular); adding or subtracting a relativedelta with absolute information does not perform an aritmetic operation, but rather REPLACES the corresponding value in the original datetime with the value(s) in relativedelta. years, months, weeks, days, hours, minutes, seconds, microseconds: Relative information, may be negative (argument is plural); adding or subtracting a relativedelta with relative information performs the corresponding aritmetic operation on the original datetime value with the information in the relativedelta. weekday: One of the weekday instances (MO, TU, etc). These instances may receive a parameter N, specifying the Nth weekday, which could be positive or negative (like MO(+1) or MO(-2). Not specifying it is the same as specifying +1. You can also use an integer, where 0=MO. leapdays: Will add given days to the date found, if year is a leap year, and the date found is post 28 of february. yearday, nlyearday: Set the yearday or the non-leap year day (jump leap days). These are converted to day/month/leapdays information. Here is the behavior of operations with relativedelta: 1. Calculate the absolute year, using the 'year' argument, or the original datetime year, if the argument is not present. 2. Add the relative 'years' argument to the absolute year. 3. Do steps 1 and 2 for month/months. 4. Calculate the absolute day, using the 'day' argument, or the original datetime day, if the argument is not present. Then, subtract from the day until it fits in the year and month found after their operations. 5. Add the relative 'days' argument to the absolute day. Notice that the 'weeks' argument is multiplied by 7 and added to 'days'. 6. Do steps 1 and 2 for hour/hours, minute/minutes, second/seconds, microsecond/microseconds. 7. If the 'weekday' argument is present, calculate the weekday, with the given (wday, nth) tuple. wday is the index of the weekday (0-6, 0=Mon), and nth is the number of weeks to add forward or backward, depending on its signal. Notice that if the calculated date is already Monday, for example, using (0, 1) or (0, -1) won't change the day. Nrc Cstdd||fDrtd|o$|rt|tjo>t|tjsHtdt|tjt|tjkrt|tjs~tjj|j}nt|tjstjj|j}d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_|j|jd|j|j}|j||j|}||krFtj}d}n tj}d}x.|||r~||7}|j||j|}qRW||}|j|j d|_|j|_nV||_||_ ||d |_ ||_ ||_ | |_ | |_| |_| |_| |_||_||_||_||_||_td d| | |||||fDr4tdtt|t rLt!||_n||_d}|rb|}n|r||}|dkr|d|_ |rddddddddddddg }x\t"|D]D\}}||kr|d|_|dkr||_n|||d|_PqWtd||j#dS)Ncss"|]}|dk o|t|kVqdS)N)int)rrr r r r csz)relativedelta.__init__..zGNon-integer years and months are ambiguous and not currently supported.z&relativedelta only diffs datetime/dater riQr css"|]}|dk ot||kVqdS)N)r)rrr r r r sz2Non-integer value passed as absolute information. z4This is not a well-defined condition and will raise zerrors in future versions.;Zxii0iNinzinvalid year day (%d)zfNon-integer value passed as absolute information. This is not a well-defined condition and will raise zNon-integer value passed as absolute information. This is not a well-defined condition and will raise errors in future versions.r)$any ValueError isinstancedatetimedate TypeError fromordinal toordinalyearsmonthsdaysleapdayshoursminutesseconds microsecondsyearmonthdayrhourminutesecond microsecond _has_time _set_months__radd__operatorgtltrDeprecationWarningrweekdays enumerate_fix)selfZdt1Zdt2r(r)r*r+weeksr,r-r.r/r0r1r2rZyeardayZ nlyeardayr3r4r5r6ZdtmZcompareZ incrementZdeltaZydayZydayidxidxZydaysr r r __init__[s                  zrelativedelta.__init__cCst|jdkrHt|j}t|j|d\}}|||_|j||7_t|jdkrt|j}t|j|d\}}|||_|j||7_t|jdkrt|j}t|j|d\}}|||_|j||7_t|jdkr"t|j}t|j|d\}}|||_|j||7_t|jdkrlt|j}t|j|d\}}|||_|j ||7_ |js|js|js|js|j dk s|j dk s|j dk s|j dk rd |_nd |_dS) Ni?Bi@Br< rrr)absr/_signdivmodr.r-r,r*r)r(r3r4r5r6r7)rAsdivmodr r r r@s<           zrelativedelta._fixcCs |jdS)Nr )r*)rAr r r rBszrelativedelta.weekscCs|j|jd|d|_dS)Nr )r*rB)rAvaluer r r rBscCsR||_t|jdkrHt|j}t|j|d\}}|||_|||_nd|_dS)NrHrr)r)rIrJrKr()rAr)rLrMrNr r r r8s   zrelativedelta._set_monthsc Cst|j}t|jd|j|d}t|}t|jd||d}t|}t|jd||d}t|}t|jd||}|j|j|j ||||||j |j |j |j |j|j|j|j|jdS)aA Return a version of this object represented entirely using integer values for the relative attributes. >>> relativedelta(days=1.5, hours=2).normalized() relativedelta(days=1, hours=14) :return: Returns a :class:`dateutil.relativedelta.relativedelta` object. rGrHrE g.A)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rr*roundr,r-r.r/ __class__r(r)r+r0r1r2rr3r4r5r6) rAr*Zhours_fr,Z minutes_fr-Z seconds_fr.r/r r r normalized s  zrelativedelta.normalizedc CsFt|tr|j|j|j|j|j|j|j|j|j|j|j|j|j|j |j |j p`|j |j dk rp|j n|j |j dk r|j n|j |j dk r|j n|j |jdk r|jn|j|jdk r|jn|j|jdk r|jn|j|jdk r|jn|j|jdk r|jn|jdSt|tjrp|j|j|j|j|j|j|j|j|j|j |j |j |j |j |j |j|j|j|j|jdSt|tjstS|jrt|tj rtjj|j}|j p|j |j}|j p|j }|jr||j7}|dkr|d7}|d8}n|dkr|d8}|d7}ttj||d|j p0|j }|||d}x*dD]"}t||}|dk rF|||<qFW|j}|j r|d krtj|r||j 7}|jf|tj||j|j|j|j d } |jrB|jj|jj pd} } t!| dd } | d kr| d | j| d 7} n| | j| d 7} | d9} | tj| d 7} | S)N)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6rr)r0r1r2r3r4r5r6)r*r,r-r.r/r r)r*)r3r4r5r6r)"r"r rSr(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6r#Z timedeltar$NotImplementedr7r&r'mincalendarZ monthrangegetattrZisleapreplacenrI) rAotherr0r1r2replattrrOr*retrZnthZjumpdaysr r r __add__/s                         zrelativedelta.__add__cCs |j|S)N)r`)rAr\r r r r9szrelativedelta.__radd__cCs|jj|S)N)__neg__r9)rAr\r r r __rsub__szrelativedelta.__rsub__cCs t|tstS|j|j|j|j|j|j|j|j|j|j|j|j |j |j |j |j pb|j |j dk rr|j n|j |j dk r|j n|j |jdk r|jn|j|jdk r|jn|j|jdk r|jn|j|jdk r|jn|j|jdk r|jn|j|jdk r|jn|jdS)N)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)r"r rVrSr(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rAr\r r r __sub__s6        zrelativedelta.__sub__cCsX|j|j |j |j |j |j |j |j |j|j |j |j |j |j |j|j|jdS)N)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rSr(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rAr r r ras  zrelativedelta.__neg__cCs|j o|j o|j o|j o|j o|j o|j o|j o|jdko|j dko|j dko|j dko|j dko|j dko|jdko|jdk S)N)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rAr r r __bool__s        zrelativedelta.__bool__cCsy t|}Wntk r tSX|jt|j|t|j|t|j|t|j|t|j |t|j |t|j ||j |j |j|j|j|j|j|j|jdS)N)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)floatr%rVrSrr(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rAr\fr r r __mul__s(       zrelativedelta.__mul__cCsNt|tstS|js|jr~|j s*|j r.dS|jj|jjkrBdS|jj|jj}}||kr~| sj|dkov| pv|dk r~dS|j|jkoL|j|jkoL|j|jkoL|j|jkoL|j |j koL|j |j koL|j |j koL|j |j koL|j |j koL|j|jkoL|j|jkoL|j|jkoL|j|jkoL|j|jkoL|j|jkS)NFr)r"r rVrr[r(r)r*r,r-r.r/r+r0r1r2r3r4r5r6)rAr\Zn1Zn2r r r __eq__s2  &zrelativedelta.__eq__cCs |j| S)N)rh)rAr\r r r __ne__szrelativedelta.__ne__c Cs0ydt|}Wntk r$tSX|j|S)Nr)rer%rVrg)rAr\Z reciprocalr r r __div__s zrelativedelta.__div__cCsg}x.dD]&}t||}|r |jd j||d q Wx6dD].}t||}|dk r:|jdj|t|d q:Wdj|jjdj|dS)Nr(r)r*r+r,r-r.r/z{attr}={value:+g})r^rOr0r1r2rr3r4r5r6z{attr}={value}z{classname}({attrs})z, )Z classnameZattrs)r(r)r*r+r,r-r.r/)r0r1r2rr3r4r5r6)rYappendformatreprrS__name__join)rAlr^rOr r r __repr__s   zrelativedelta.__repr__)NNrrrrrrrrrNNNNNNNNNN)rn __module__ __qualname____doc__rDr@propertyrBsetterr8rTr`r9rbrcrardZ __nonzero__rg__rmul__rh__hash__rirj __truediv__rqr r r r r s6G y!  #WcCsttd|S)Nr)rr)rr r r rJ"srJ)r#rXr:ZmathrZsixrwarningsrZ_commonrtuplerangerrrrrrrr>__all__objectr rJr r r r s    (__pycache__/relativedelta.cpython-36.pyc000064400000033731147204751220014242 0ustar003 6cYiZ@sddlZddlZddlZddlmZddlmZddlmZddl m Z e dde d D\Z ZZZZZZZd d d d ddddgZGdd d eZddZdS)N)copysign) integer_types)warn)weekdayccs|]}t|VqdS)N)r).0xr #/usr/lib/python3.6/relativedelta.py sr  relativedeltaMOTUWETHFRSASUc@seZdZdZd%ddZddZedd Zejd d Zd d Z d dZ ddZ ddZ ddZ ddZddZddZeZddZeZddZdZdd Zd!d"ZeZd#d$ZdS)&r a The relativedelta type is based on the specification of the excellent work done by M.-A. Lemburg in his `mx.DateTime `_ extension. However, notice that this type does *NOT* implement the same algorithm as his work. Do *NOT* expect it to behave like mx.DateTime's counterpart. There are two different ways to build a relativedelta instance. The first one is passing it two date/datetime classes:: relativedelta(datetime1, datetime2) The second one is passing it any number of the following keyword arguments:: relativedelta(arg1=x,arg2=y,arg3=z...) year, month, day, hour, minute, second, microsecond: Absolute information (argument is singular); adding or subtracting a relativedelta with absolute information does not perform an aritmetic operation, but rather REPLACES the corresponding value in the original datetime with the value(s) in relativedelta. years, months, weeks, days, hours, minutes, seconds, microseconds: Relative information, may be negative (argument is plural); adding or subtracting a relativedelta with relative information performs the corresponding aritmetic operation on the original datetime value with the information in the relativedelta. weekday: One of the weekday instances (MO, TU, etc). These instances may receive a parameter N, specifying the Nth weekday, which could be positive or negative (like MO(+1) or MO(-2). Not specifying it is the same as specifying +1. You can also use an integer, where 0=MO. leapdays: Will add given days to the date found, if year is a leap year, and the date found is post 28 of february. yearday, nlyearday: Set the yearday or the non-leap year day (jump leap days). These are converted to day/month/leapdays information. Here is the behavior of operations with relativedelta: 1. Calculate the absolute year, using the 'year' argument, or the original datetime year, if the argument is not present. 2. Add the relative 'years' argument to the absolute year. 3. Do steps 1 and 2 for month/months. 4. Calculate the absolute day, using the 'day' argument, or the original datetime day, if the argument is not present. Then, subtract from the day until it fits in the year and month found after their operations. 5. Add the relative 'days' argument to the absolute day. Notice that the 'weeks' argument is multiplied by 7 and added to 'days'. 6. Do steps 1 and 2 for hour/hours, minute/minutes, second/seconds, microsecond/microseconds. 7. If the 'weekday' argument is present, calculate the weekday, with the given (wday, nth) tuple. wday is the index of the weekday (0-6, 0=Mon), and nth is the number of weeks to add forward or backward, depending on its signal. Notice that if the calculated date is already Monday, for example, using (0, 1) or (0, -1) won't change the day. Nrc Cstdd||fDrtd|o$|rt|tjo>t|tjsHtdt|tjt|tjkrt|tjs~tjj|j}nt|tjstjj|j}d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_|j|jd|j|j}|j||j|}||krFtj}d}n tj}d}x.|||r~||7}|j||j|}qRW||}|j|j d|_|j|_nV||_||_ ||d |_ ||_ ||_ | |_ | |_| |_| |_| |_||_||_||_||_||_td d| | |||||fDr4tdtt|t rLt!||_n||_d}|rb|}n|r||}|dkr|d|_ |rddddddddddddg }x\t"|D]D\}}||kr|d|_|dkr||_n|||d|_PqWtd||j#dS)Ncss"|]}|dk o|t|kVqdS)N)int)rrr r r r csz)relativedelta.__init__..zGNon-integer years and months are ambiguous and not currently supported.z&relativedelta only diffs datetime/dater riQr css"|]}|dk ot||kVqdS)N)r)rrr r r r sz2Non-integer value passed as absolute information. z4This is not a well-defined condition and will raise zerrors in future versions.;Zxii0iNinzinvalid year day (%d)zfNon-integer value passed as absolute information. This is not a well-defined condition and will raise zNon-integer value passed as absolute information. This is not a well-defined condition and will raise errors in future versions.r)$any ValueError isinstancedatetimedate TypeError fromordinal toordinalyearsmonthsdaysleapdayshoursminutesseconds microsecondsyearmonthdayrhourminutesecond microsecond _has_time _set_months__radd__operatorgtltrDeprecationWarningrweekdays enumerate_fix)selfZdt1Zdt2r(r)r*r+weeksr,r-r.r/r0r1r2rZyeardayZ nlyeardayr3r4r5r6ZdtmZcompareZ incrementZdeltaZydayZydayidxidxZydaysr r r __init__[s                  zrelativedelta.__init__cCst|jdkrHt|j}t|j|d\}}|||_|j||7_t|jdkrt|j}t|j|d\}}|||_|j||7_t|jdkrt|j}t|j|d\}}|||_|j||7_t|jdkr"t|j}t|j|d\}}|||_|j||7_t|jdkrlt|j}t|j|d\}}|||_|j ||7_ |js|js|js|js|j dk s|j dk s|j dk s|j dk rd |_nd |_dS) Ni?Bi@Br< rrr)absr/_signdivmodr.r-r,r*r)r(r3r4r5r6r7)rAsdivmodr r r r@s<           zrelativedelta._fixcCs |jdS)Nr )r*)rAr r r rBszrelativedelta.weekscCs|j|jd|d|_dS)Nr )r*rB)rAvaluer r r rBscCsR||_t|jdkrHt|j}t|j|d\}}|||_|||_nd|_dS)NrHrr)r)rIrJrKr()rAr)rLrMrNr r r r8s   zrelativedelta._set_monthsc Cst|j}t|jd|j|d}t|}t|jd||d}t|}t|jd||d}t|}t|jd||}|j|j|j ||||||j |j |j |j |j|j|j|j|jdS)aA Return a version of this object represented entirely using integer values for the relative attributes. >>> relativedelta(days=1.5, hours=2).normalized() relativedelta(days=1, hours=14) :return: Returns a :class:`dateutil.relativedelta.relativedelta` object. rGrHrE g.A)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rr*roundr,r-r.r/ __class__r(r)r+r0r1r2rr3r4r5r6) rAr*Zhours_fr,Z minutes_fr-Z seconds_fr.r/r r r normalized s  zrelativedelta.normalizedc Cslt|tr|j|j|j|j|j|j|j|j|j|j|j|j|j|j |j |j p`|j |j dk rp|j n|j |j dk r|j n|j |j dk r|j n|j |jdk r|jn|j|jdk r|jn|j|jdk r|jn|j|jdk r|jn|j|jdk r|jn|jdSt|tjrp|j|j|j|j|j|j|j|j|j|j |j |j |j |j |j |j|j|j|j|jdSt|tjstS|jrt|tj rtjj|j}|j p|j |j}|j p|j }|jr:dt|jkodknst||j7}|dkr |d7}|d8}n|dkr:|d8}|d7}ttj||d|j pV|j }|||d}x*dD]"}t||}|dk rl|||<qlW|j}|j r|d krtj |r||j 7}|j!f|tj||j|j|j|j d } |jrh|jj|jj"pd} } t| dd } | d kr<| d | j| d 7} n| | j| d 7} | d9} | tj| d 7} | S)N)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6rr)r0r1r2r3r4r5r6)r*r,r-r.r/r r)r*)r3r4r5r6r)#r"r rSr(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6r#Z timedeltar$NotImplementedr7r&r'rIAssertionErrormincalendarZ monthrangegetattrZisleapreplacen) rAotherr0r1r2replattrrOr*retrZnthZjumpdaysr r r __add__/s             &            zrelativedelta.__add__cCs |j|S)N)ra)rAr]r r r r9szrelativedelta.__radd__cCs|jj|S)N)__neg__r9)rAr]r r r __rsub__szrelativedelta.__rsub__cCs t|tstS|j|j|j|j|j|j|j|j|j|j|j|j |j |j |j |j pb|j |j dk rr|j n|j |j dk r|j n|j |jdk r|jn|j|jdk r|jn|j|jdk r|jn|j|jdk r|jn|j|jdk r|jn|j|jdk r|jn|jdS)N)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)r"r rVrSr(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rAr]r r r __sub__s6        zrelativedelta.__sub__cCsX|j|j |j |j |j |j |j |j |j|j |j |j |j |j |j|j|jdS)N)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rSr(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rAr r r rbs  zrelativedelta.__neg__cCs|j o|j o|j o|j o|j o|j o|j o|j o|jdko|j dko|j dko|j dko|j dko|j dko|jdko|jdk S)N)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rAr r r __bool__s        zrelativedelta.__bool__cCsy t|}Wntk r tSX|jt|j|t|j|t|j|t|j|t|j |t|j |t|j ||j |j |j|j|j|j|j|j|jdS)N)r(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)floatr%rVrSrr(r)r*r,r-r.r/r+r0r1r2rr3r4r5r6)rAr]fr r r __mul__s(       zrelativedelta.__mul__cCsNt|tstS|js|jr~|j s*|j r.dS|jj|jjkrBdS|jj|jj}}||kr~| sj|dkov| pv|dk r~dS|j|jkoL|j|jkoL|j|jkoL|j|jkoL|j |j koL|j |j koL|j |j koL|j |j koL|j |j koL|j|jkoL|j|jkoL|j|jkoL|j|jkoL|j|jkoL|j|jkS)NFr)r"r rVrr\r(r)r*r,r-r.r/r+r0r1r2r3r4r5r6)rAr]Zn1Zn2r r r __eq__s2  &zrelativedelta.__eq__cCs |j| S)N)ri)rAr]r r r __ne__szrelativedelta.__ne__c Cs0ydt|}Wntk r$tSX|j|S)Nr)rfr%rVrh)rAr]Z reciprocalr r r __div__s zrelativedelta.__div__cCsg}x.dD]&}t||}|r |jd j||d q Wx6dD].}t||}|dk r:|jdj|t|d q:Wdj|jjdj|dS)Nr(r)r*r+r,r-r.r/z{attr}={value:+g})r_rOr0r1r2rr3r4r5r6z{attr}={value}z{classname}({attrs})z, )Z classnameZattrs)r(r)r*r+r,r-r.r/)r0r1r2rr3r4r5r6)rZappendformatreprrS__name__join)rAlr_rOr r r __repr__s   zrelativedelta.__repr__)NNrrrrrrrrrNNNNNNNNNN)ro __module__ __qualname____doc__rDr@propertyrBsetterr8rTrar9rcrdrbreZ __nonzero__rh__rmul__ri__hash__rjrk __truediv__rrr r r r r s6G y!  #WcCsttd|S)Nr)rr)rr r r rJ"srJ)r#rYr:ZmathrZsixrwarningsrZ_commonrtuplerangerrrrrrrr>__all__objectr rJr r r r s    (__pycache__/rrule.cpython-36.opt-1.pyc000064400000117164147204751220013510 0ustar003 6cY@sJdZddlZddlZddlZddlZyddlmZWn ek rTddlmZYnXddl m Z m Z ddl m Z mZddlZddlmZddlmZd d d d d ddddddddddddgZedgddgddgddgdd gdd!gdd"gdd#gdd$gdd%gdd&gdd'gddgd"ZeeZeeddeeddeedd(ZZZeeeeeeeeeeeeeedd"ZeeZeedNdeedOdeedPdZZZeeeeeeeeeeeeeedd"ZeeZ dQZ!dRZ"dddddd d!gd?Z#[[[ed4=ed4=e d=eeZeeZd d dddddgZ$eed"\Z%Z&Z'Z(Z)Z*Z+da,da-Gd@dAdAeZedBdCed"D\Z.Z/Z0Z1Z2Z3Z4Z5dDdEZ6GdFdGdGe7Z8GdHd d e8Z9GdIdJdJe7Z:GdKd d e8Z;GdLdMdMe7Z`_, including support for caching of results. N)gcd)advance_iterator integer_types)_threadrange)weekday)warnrrulerrulesetrrulestrYEARLYMONTHLYWEEKLYDAILYHOURLYMINUTELYSECONDLYMOTUWETHFRSASU <[y1On;Zx0Nm7cs"eZdZdZdfdd ZZS)rz7 This version of weekday does not allow n = 0. Ncs&|dkrtdtt|j||dS)NrzCan't create weekday with n==0) ValueErrorsuperr__init__)selfZwkdayn) __class__/usr/lib/python3.6/rrule.pyrCDszweekday.__init__)N)__name__ __module__ __qualname____doc__rC __classcell__rGrG)rFrHr@srccs|]}t|VqdS)N)r).0xrGrGrH KsrPcsfdd}|S)zT Decorator for rruleset methods which may invalidate the cached length. cs|f||}|j|S)N)_invalidate_cache)rDargskwargsrv)frGrH inner_funcSsz&_invalidates_cache..inner_funcrG)rUrVrG)rUrH_invalidates_cacheNs rWc@sneZdZdddZddZddZdd Zd d Zd d ZddZ dddZ dddZ dddZ dddZ dS) rrulebaseFcCs4|rg|_tj|_|jnd|_d|_d|_dS)NF)_cacher allocate_lock _cache_lockrQ_cache_complete_len)rDcacherGrGrHrC\s  zrrulebase.__init__cCs.|jrt|jS|jdkr"|jS|jSdS)N)r\iterrY_iter _iter_cached)rDrGrGrH__iter__fs   zrrulebase.__iter__cCs>|jdk r4g|_d|_|j|_|jjr4|jjd|_dS)NF)rYr\r` _cache_genr[lockedreleaser])rDrGrGrHrQns    zrrulebase._invalidate_cachec csd}|j}|j}|jj}|jj}x|r|t|kr||jr@Py$xtdD]}|jt |qLWWn&t k rd|_}d|_PYnX|||V|d7}q"Wx ||j kr||V|d7}qWdS)Nrr&Tr) rcrYr[acquirerelenr\rappendr StopIterationr])rDigenr^rfrejrGrGrHrays.      zrrulebase._iter_cachedc Cs|jr|j|St|trd|jr:|jdkr:tt||Sttj||j pJd|j pTt j |jp\dSn`|dkrt|}y"xt |dD] }t|}qWWntk rtYnX|Stt||SdS)Nrr)r\rY isinstanceslicesteplistr_ itertoolsislicestartstopsysmaxsizerrri IndexError)rDitemrkrjresrGrGrH __getitem__s$    zrrulebase.__getitem__cCs:|jr||jkSx$|D]}||kr&dS||krdSqWdS)NTF)r\rY)rDrxrjrGrGrH __contains__s  zrrulebase.__contains__cCs|jdkrx |D]}qW|jS)z Returns the number of recurrences in this set. It will have go trough the whole recurrence, if this hasn't been done before. N)r])rDrOrGrGrHcounts  zrrulebase.countcCsX|jr|j}n|}d}|r8x8|D]}||kr.P|}q Wnx|D]}||krLP|}q>W|S)z Returns the last recurrence before the given datetime instance. The inc keyword defines what happens if dt is an occurrence. With inc=True, if dt itself is an occurrence, it will be returned. N)r\rY)rDdtincrklastrjrGrGrHbefores   zrrulebase.beforecCsP|jr|j}n|}|r2x4|D]}||kr|SqWnx|D]}||kr8|Sq8WdS)z Returns the first recurrence after the given datetime instance. The inc keyword defines what happens if dt is an occurrence. With inc=True, if dt itself is an occurrence, it will be returned. N)r\rY)rDr}r~rkrjrGrGrHafters   zrrulebase.afterNccsh|jr|j}n|}|r dd}ndd}d}x6|D].}|||r2|dk rZ|d7}||krZP|Vq2WdS)aH Generator which yields up to `count` recurrences after the given datetime instance, equivalent to `after`. :param dt: The datetime at which to start generating recurrences. :param count: The maximum number of recurrences to generate. If `None` (default), dates are generated until the recurrence rule is exhausted. :param inc: If `dt` is an instance of the rule and `inc` is `True`, it is included in the output. :yields: Yields a sequence of `datetime` objects. cSs||kS)NrG)dcdtcrGrGrHsz"rrulebase.xafter..cSs||kS)NrG)rrrGrGrHrsrNr)r\rY)rDr}r|r~rkcomprEdrGrGrHxafters   zrrulebase.xafterrc Cs|jr|j}n|}d}g}|r`x|D]6}||kr4Pq$|sP||krZd}|j|q$|j|q$Wn@x>|D]6}||krvPqf|s||krd}|j|qf|j|qfW|S)a Returns all the occurrences of the rrule between after and before. The inc keyword defines what happens if after and/or before are themselves occurrences. With inc=True, they will be included in the list, if they are found in the recurrence set. FT)r\rYrh) rDrrr~r|rkZstartedlrjrGrGrHbetween s.    zrrulebase.between)F)F)F)NF)Fr)rIrJrKrCrbrQrarzr{r|rrrrrGrGrGrHrX[s      )rXcsJeZdZdZdfdd ZddZd d Zd d Zd dZddZ Z S)r a| That's the base of the rrule operation. It accepts all the keywords defined in the RFC as its constructor parameters (except byday, which was renamed to byweekday) and more. The constructor prototype is:: rrule(freq) Where freq must be one of YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, or SECONDLY. .. note:: Per RFC section 3.3.10, recurrence instances falling on invalid dates and times are ignored rather than coerced: Recurrence rules may generate recurrence instances with an invalid date (e.g., February 30) or nonexistent local time (e.g., 1:30 AM on a day where the local time is moved forward by an hour at 1:00 AM). Such recurrence instances MUST be ignored and MUST NOT be counted as part of the recurrence set. This can lead to possibly surprising behavior when, for example, the start date occurs at the end of the month: >>> from dateutil.rrule import rrule, MONTHLY >>> from datetime import datetime >>> start_date = datetime(2014, 12, 31) >>> list(rrule(freq=MONTHLY, count=4, dtstart=start_date)) ... # doctest: +NORMALIZE_WHITESPACE [datetime.datetime(2014, 12, 31, 0, 0), datetime.datetime(2015, 1, 31, 0, 0), datetime.datetime(2015, 3, 31, 0, 0), datetime.datetime(2015, 5, 31, 0, 0)] Additionally, it supports the following keyword arguments: :param cache: If given, it must be a boolean value specifying to enable or disable caching of results. If you will use the same rrule instance multiple times, enabling caching will improve the performance considerably. :param dtstart: The recurrence start. Besides being the base for the recurrence, missing parameters in the final recurrence instances will also be extracted from this date. If not given, datetime.now() will be used instead. :param interval: The interval between each freq iteration. For example, when using YEARLY, an interval of 2 means once every two years, but with HOURLY, it means once every two hours. The default interval is 1. :param wkst: The week start day. Must be one of the MO, TU, WE constants, or an integer, specifying the first day of the week. This will affect recurrences based on weekly periods. The default week start is got from calendar.firstweekday(), and may be modified by calendar.setfirstweekday(). :param count: How many occurrences will be generated. .. note:: As of version 2.5.0, the use of the ``until`` keyword together with the ``count`` keyword is deprecated per RFC-2445 Sec. 4.3.10. :param until: If given, this must be a datetime instance, that will specify the limit of the recurrence. The last recurrence in the rule is the greatest datetime that is less than or equal to the value specified in the ``until`` parameter. .. note:: As of version 2.5.0, the use of the ``until`` keyword together with the ``count`` keyword is deprecated per RFC-2445 Sec. 4.3.10. :param bysetpos: If given, it must be either an integer, or a sequence of integers, positive or negative. Each given integer will specify an occurrence number, corresponding to the nth occurrence of the rule inside the frequency period. For example, a bysetpos of -1 if combined with a MONTHLY frequency, and a byweekday of (MO, TU, WE, TH, FR), will result in the last work day of every month. :param bymonth: If given, it must be either an integer, or a sequence of integers, meaning the months to apply the recurrence to. :param bymonthday: If given, it must be either an integer, or a sequence of integers, meaning the month days to apply the recurrence to. :param byyearday: If given, it must be either an integer, or a sequence of integers, meaning the year days to apply the recurrence to. :param byweekno: If given, it must be either an integer, or a sequence of integers, meaning the week numbers to apply the recurrence to. Week numbers have the meaning described in ISO8601, that is, the first week of the year is that containing at least four days of the new year. :param byweekday: If given, it must be either an integer (0 == MO), a sequence of integers, one of the weekday constants (MO, TU, etc), or a sequence of these constants. When given, these variables will define the weekdays where the recurrence will be applied. It's also possible to use an argument n for the weekday instances, which will mean the nth occurrence of this weekday in the period. For example, with MONTHLY, or with YEARLY and BYMONTH, using FR(+1) in byweekday will specify the first friday of the month where the recurrence happens. Notice that in the RFC documentation, this is specified as BYDAY, but was renamed to avoid the ambiguity of that keyword. :param byhour: If given, it must be either an integer, or a sequence of integers, meaning the hours to apply the recurrence to. :param byminute: If given, it must be either an integer, or a sequence of integers, meaning the minutes to apply the recurrence to. :param bysecond: If given, it must be either an integer, or a sequence of integers, meaning the seconds to apply the recurrence to. :param byeaster: If given, it must be either an integer, or a sequence of integers, positive or negative. Each integer will define an offset from the Easter Sunday. Passing the offset 0 to byeaster will yield the Easter Sunday itself. This is an extension to the RFC specification. NrFc sRtt|j||s(tjjjdd}n*t|tjsFtjj|j}n |jdd}||_ |j |_ ||_ ||_ ||_i|_|rt|tj rtjj|j}||_|dk r|rtdt|dkrtj|_nt|tr||_n|j|_|dkrd|_nt|tr:|dks(d|kodkn r0td|f|_nLt||_x@|jD]6}|dksxd|kondkn rLtdqLW|jr|j|jd<| dkr:| dkr:| dkr:| dkr:| dkr:|tkr|dkr|j}d|jd<|j} d|jd<n8|tkr|j} d|jd<n|tkr:|j} d|jd <|dkrLd|_ n|j7D]4}x,|j:D]"}|j;jt|j;|_;dS)Nr)Z microsecondzUsing both 'count' and 'until' is inconsistent with RFC 2445 and has been deprecated in dateutil. Future versions will raise an error.inz:bysetpos must be between 1 and 366, or between -366 and -1bysetposbymonth bymonthday byweekday byyearday)easterbyeastercss|]}|dkr|VqdS)rNrG)rNrOrGrGrHrPsz!rrule.__init__..css|]}|dkr|VqdS)rNrG)rNrOrGrGrHrPsbyweeknorEcSsg|] }t|qSrG)r)rNrOrGrGrH Isz"rrule.__init__..cSsg|] }t|qSrG)r)rNrOrGrGrHrOs)rsbyxxxbasebyhourr*byminutebysecond)tzinfoii)?rBr rCdatetimeZnowreplacerm fromordinal toordinal_dtstartr_tzinfo_freq _interval_count_original_rule_untilr DeprecationWarningcalendarZ firstweekday_wkstrr _bysetposrAtupler monthdayrr_bymonthsortedset _byyeardayrdateutil _byeaster _bymonthday _bynmonthdayrqchain _byweekno _byweekday _bynweekdayhasattraddrErhour_byhour_rrule__construct_bysetrminute _byminutersecond _bysecond_timesetrhtimesort)rDfreqdtstartintervalwkstr|untilrrrrrrrrrrr^poswdayZorig_byweekdayZorig_bynweekdayrrr)rFrGrHrCsL      (   (                                                              zrrule.__init__c Csg}dgd\}}}|jrD|j|jjd|jjdd\}}}dt|jg}|jdkrr|jdt|j|jr|jdt t |jd d |j dk r|jd t|j |j r|j|j jd |j jd dk rDt|j }g}xJ|d D]>}|jr(|jdj|jt |d d dq|jt |qW||d <n|j }d} xFd4D]>\} } |j| } | rT|j| j| d$jd%d&| Dd'qTW|jd(j|d)j|S)5z Output a string that would generate this RRULE if passed to rrulestr. This is mostly compatible with RFC2445, except for the dateutil-specific extension BYEASTER. NrzDTSTART:%Y%m%dT%H%M%Sr"zFREQ=rz INTERVAL=zWKST=rrzCOUNT=zUNTIL=%Y%m%dT%H%M%Srz {n:+d}{wday})rErz {name}={vals}BYSETPOSrBYMONTHr BYMONTHDAYr BYYEARDAYrBYWEEKNOrBYDAYBYHOURrBYMINUTErBYSECONDrBYEASTERr,css|]}t|VqdS)N)str)rNvrGrGrHrPsz rrule.__str__..)namevals; rrrrrrrrrrrrrrrrrrrr) rrrrrrrrrr)rrhZstrftime timetuple FREQNAMESrrrrreprrrrrgetdictrEformatjoin) rDoutputhmspartsZ original_ruleZ wday_stringsrZpartfmtrkeyvaluerGrGrH__str__sT       z rrule.__str__cKsN|j|j|j|j|j|j|jdkr&dndd}|j|j|j|t f|S)zReturn new rrule with same attributes except for those attributes given new values by whichever keyword arguments are specified.NFT)rr|rrrrr^) rrrrrrrYupdaterr )rDrSZ new_kwargsrGrGrHrs  z rrule.replacec5cs|jj\ }}}}}}}}} |j} |j} |j} |j} |j}|j}|j}|j }|j }|j }|j }|j }|j}|j}|j}t|}|j||t|jt|jt|jt|jt|jt|jt|ji| }| tkr|j}nt|jt|j t|j!i| }| tko|jo||jks<| tkr|jr||jks<| tkrB|jrB||jkrBf}n ||||}d}|j"}xX||||\}} }!d}"x$|| |!D]}#|r|j#|#|ks|r|j$|# s|r|j%|#|ks|j&r|j&|# s|r|j'|# s|s|r|j(|#|kr|j)|#|ks|r|#|j*krP|#d|krP|j* |#|ks|#|j*kr|#d|j*|kr|j+ |#|j*|krd||#<d}"qW|r|rg}$x|D]}%|%dkrt,|%t-|\}&}'nt,|%dt-|\}&}'y&dd|| |!D|&}#||'}(Wnt.k r$Yn6Xt/j0j1|j2|#})t/j/j3|)|(}*|*|$kr|$j4|*qW|$j5xh|$D]`}*| r|*| kr||_6dS|*|jkrn|dk r|d8}|dkr||_6dS|d7}|*VqnWnx|| |!D]}#|#dk rt/j0j1|j2|#})xv|D]n}(t/j/j3|)|(}*| r4|*| kr4||_6dS|*|jkr|dk rf|d8}|dkrf||_6dS|d7}|*VqWqWd}+| tkr|| 7}|t/j7kr||_6dS|j||n^| tkr.|| 7}|dkrt,|d\},}-|-}||,7}|dkrd}|d8}|t/j7kr||_6dS|j||n| tkr| |krd||dd|  |jd 7}n|||  |jd 7}| }d}+n| tkr|| 7}d}+nx| tkr|"r|d || | 7}|r|j8||jd d \}.}nt,|| d \}.}|.r||.7}d}+||||}n| tkr|"rD|d |d|| | 7}d}/d}0xt9|0t:| |0D]v}1|r|j8||jdd \}2}nt,|| d\}2}t,||2d \},}|,r||,7}d}+d}"| s||kr`d}/Pq`W|/st;d||||}n"| tkr|"r,|d|d|d|| | 7}d}0d}/xt9d|0t:| |0D]}1|rl|j8||jdd \}3}nt,|| d\}3}t,||3d\},}|,r||,7}t,|d \},}|,r||,7}d}+| s||krJ| s||krJ| s||krJd}/PqJW|/st;d||||}|+r\|dkr\t.r(r"r#r)rrrir*z$Invalid combination of interval and zbyhour resulting in empty rule.iQiz!Invalid combination of interval, z&byhour and byminute resulting in emptyz rule. izCInvalid combination of interval and byhour resulting in empty rule.iQzGInvalid combination of interval, byhour and byminute resulting in emptyzMInvalid combination of interval, byhour and byminute resulting in empty rule.)>rrrrrrrrrrrrrrrrr _iterinforebuildr ydaysetrmdaysetrwdaysetrddaysetrrrrhtimesetmtimesetstimesetrmmaskwnomaskwdaymask nwdaymask eastermaskmdaymask nmdaymaskyearlen nextyearlendivmodrgrwrdater yearordinalZcombinerhrr]ZMAXYEAR_rrule__mod_distancerrrArZ monthrange)5rDyearrrrrrrZyearday_rrrrrrrrrrZ bynmonthdayrrrriiZ getdaysetZtimesetZ gettimesettotalr|ZdaysetrsendZfilteredrjZposlistrZdayposZtimeposrr ryZfixdaydivmodZndaysZvalidZrep_raterlZnhoursZnminutesZ daysinmonthrGrGrHr`s                             "          z rrule._itercCspt}t|tr|f}x@|D]8}t|j|}|dksJt|||ddkr|j|qWt|dkrltd|S)a If a `BYXXX` sequence is passed to the constructor at the same level as `FREQ` (e.g. `FREQ=HOURLY,BYHOUR={2,4,7},INTERVAL=3`), there are some specifications which cannot be reached given some starting conditions. This occurs whenever the interval is not coprime with the base of a given unit and the difference between the starting position and the ending position is not coprime with the greatest common denominator between the interval and the base. For example, with a FREQ of hourly starting at 17:00 and an interval of 4, the only valid values for BYHOUR would be {21, 1, 5, 9, 13, 17}, because 4 and 24 are not coprime. :param start: Specifies the starting position. :param byxxx: An iterable containing the list of allowed values. :param base: The largest allowable value for the specified frequency (e.g. 24 hours, 60 minutes). This does not preserve the type of the iterable, returning a set, since the values should be unique and the order is irrelevant, this will speed up later lookups. In the event of an empty set, raises a :exception:`ValueError`, as this results in an empty rrule. rrz+Invalid rrule byxxx generates an empty set.) rrmrrrr rrgrA)rDrsrrZcsetZnumZi_gcdrGrGrHZ__construct_bysets    zrrule.__construct_bysetcCsLd}xBtd|dD]0}t||j|\}}||7}||kr||fSqWdS)a Calculates the next value in a sequence where the `FREQ` parameter is specified along with a `BYXXX` parameter at the same "level" (e.g. `HOURLY` specified with `BYHOUR`). :param value: The old value of the component. :param byxxx: The `BYXXX` set, which should have been generated by `rrule._construct_byset`, or something else which checks that a valid rule is present. :param base: The largest allowable value for the specified frequency (e.g. 24 hours, 60 minutes). If a valid value is not found after `base` iterations (the maximum number before the sequence would start to repeat), this raises a :exception:`ValueError`, as no valid values were found. This returns a tuple of `divmod(n*interval, base)`, where `n` is the smallest number of `interval` repetitions until the next specified value in `byxxx` is found. rrN)rr r)rDrrrZ accumulatorrrrGrGrHZ__mod_distances zrrule.__mod_distance)NrNNNNNNNNNNNNNF) rIrJrKrLrCrrr`rrrMrGrG)rFrHr .st{>/c@sveZdZddddddddd d d d d ddgZddZddZddZddZddZddZ ddZ ddZ d d!Z d"S)#rr lastyear lastmonthr r r  yearweekdayrmrangerrrrrrcCs&x|jD]}t||dqW||_dS)N) __slots__setattrr )rDr attrrGrGrHrCDs z_iterinfo.__init__cCs|j}||jkr2dtj||_dtj|d|_tj|dd}|j|_ |j |_ tj|ddj }|jdkrt |_ t|_t|_t|d|_t|_n&t|_ t|_t|_t|d|_t|_|jsd|_n`dg|jd|_d|j |jd}}|dkr"d}|j|j |jd}n |j|}t|d\} } | | d} x|jD]} | dkrh| | d7} d| ko|| knsqN| dkr|| dd} ||kr| d|8} n|} x8tdD],}d|j| <| d7} |j| |jkrPqWqNWd|jkrr|| d} ||kr,| d|8} | |jkrrx8tdD],}d|j| <| d7} |j| |jkrBPqBW|r2d|jkrtj|dddj }d||jd}dtj|d}|dkrd}d|||jddd}nd|j|dd}nd}||jkr2xt|D]} d|j| <qW|jr||j ksR||jkrg}|j!t"kr|j#rx:|j#D]"}|j$|j|d|dqrWn d|jfg}n$|j!t%kr|j|d|dg}|rdg|j|_&x|D]\}}|d8}x|jD]\}} | dkr8|| dd} | |j| |d8} n*|| dd} | d|j| |d7} || kov|knrd|j&| <qWqW|j'rdg|jd|_(t)j)|j|j }x|j'D]}d|j(||<qW||_||_ dS) Nimrrr#r4r)*r rrZisleapr r rr rr rrM365MASKr MDAY365MASKr NMDAY365MASKrWDAYMASKr M365RANGErM366MASK MDAY366MASK NMDAY366MASK M366RANGErrrr rrrrr rrhrrrrr)rDrrrrZ firstydayrZno1wkstZ firstwkstZwyearlenrrZnumweeksrErjrlZ lyearweekdayZlno1wkstZlyearlenZ lnumweeksZrangesfirstrZeydayoffsetrGrGrHrIs                          $   z_iterinfo.rebuildcCstt|jd|jfS)Nr)rprr )rDrrrrGrGrHrsz_iterinfo.ydaysetcCsLdg|j}|j|d|d\}}xt||D] }|||<q2W|||fS)Nr)r rr)rDrrrdsetrsrrjrGrGrHrs   z_iterinfo.mdaysetcCsldg|jd}tj|||j|j}|}x4tdD](}|||<|d7}|j||jjkr6Pq6W|||fS)Nr#r) r rr rr rrr r)rDrrrr+rjrsrlrGrGrHrsz_iterinfo.wdaysetcCs:dg|j}tj|||j|j}|||<|||dfS)Nr)r rr rr )rDrrrr+rjrGrGrHrs z_iterinfo.ddaysetc CsPg}|j}x8|jD].}x(|jD]}|jtj||||jdqWqW|j|S)N)r)r rrrhrrrr)rDrrrtsetr(rGrGrHrs  z_iterinfo.htimesetcCs@g}|j}x(|jD]}|jtj||||jdqW|j|S)N)r)r rrhrrrr)rDrrrr,r(rGrGrHrs  z_iterinfo.mtimesetcCstj||||jjdfS)N)r)rrr r)rDrrrrGrGrHrs z_iterinfo.stimesetN) rIrJrKrrCrrrrrrrrrGrGrGrHr>s  rcsjeZdZdZGdddeZdfdd ZeddZed d Z ed d Z ed dZ ddZ Z S)r aL The rruleset type allows more complex recurrence setups, mixing multiple rules, dates, exclusion rules, and exclusion dates. The type constructor takes the following keyword arguments: :param cache: If True, caching of results will be enabled, improving performance of multiple queries considerably. c@s@eZdZddZddZeZddZddZd d Zd d Z d S)zrruleset._genitemc Cs>yt||_|j|Wntk r,YnX||_||_dS)N)rr}rhrigenlistrk)rDr-rkrGrGrHrC s zrruleset._genitem.__init__c Cs^yt|j|_WnHtk rX|jd|kr8szrruleset.rdatecCs|jj|dS)z Include the given rrule instance in the recurrence set exclusion list. Dates which are part of the given recurrence rules will not be generated, even if some inclusive rrule or rdate matches them. N)r<rh)rDexrulerGrGrHr?>szrruleset.exrulecCs|jj|dS)z Include the given datetime instance in the recurrence set exclusion list. Dates included that way will not be generated, even if some inclusive rrule or rdate matches them. N)r=rh)rDexdaterGrGrHr@Fszrruleset.exdateccslg}|jj|j|t|jx$dd|jDD]}|j||q2Wg}|jj|j|t|jx$dd|jDD]}|j||qxWd}d}tj|tj|x|r`|d}| s||j kr:xB|o|d|kr |d}t ||o|d|krtj ||qW| s$||dkr4|d7}|j V|j }t ||r|d|krtj ||qW||_ dS)NcSsg|] }t|qSrG)r_)rNrOrGrGrHrQsz"rruleset._iter..cSsg|] }t|qSrG)r_)rNrOrGrGrHrVsrr) r;rr9r_r:r=r<r.r1r}r heapreplacer])rDZrlistrkZexlistZlastdtrZritemZexitemrGrGrHr`Ms<    zrruleset._iter)F)rIrJrKrLobjectr9rCrWr r>r?r@r`rMrGrG)rFrHr s"    c@seZdZeeeeeee dZ dddddddd Z d d Z d d Z e Ze Ze Ze Ze Ze Ze Ze Ze Ze Ze ZddZddZddZddZeZdddZdddZddZ dS) _rrulestr)r rrrrrrrrrrrr!r")rrrrrrrcKst|||j<dS)N)intlower)rDrrkwargsrrrSrGrGrH _handle_int{sz_rrulestr._handle_intcKs dd|jdD||j<dS)NcSsg|] }t|qSrG)rD)rNrOrGrGrHrsz._rrulestr._handle_int_list..r)splitrE)rDrFrrrSrGrGrH_handle_int_list~sz_rrulestr._handle_int_listcKs|j||d<dS)Nr) _freq_map)rDrFrrrSrGrGrH _handle_FREQsz_rrulestr._handle_FREQc KsVtsddlmay$tj||jd|jdd|d<Wntk rPtdYnXdS)Nr)parserignoretztzinfos)rMrNrzinvalid until date)rLrparserrA)rDrFrrrSrGrGrH _handle_UNTILs z_rrulestr._handle_UNTILcKs|j||d<dS)Nr) _weekday_map)rDrFrrrSrGrGrH _handle_WKSTsz_rrulestr._handle_WKSTc Ksg}x|jdD]}d|krD|jd}|d}t|ddd } n^t|rx"tt|D]} || dkrZPqZW|d| p~d} || d}| rt| } ntd|jt|j|| qW||d<dS) z: Two ways to specify this: +1MO or MO(+1) r(rrNz +-0123456789z$Invalid (empty) BYDAY specification.rr)rHrDrgrrArhweekdaysrQ) rDrFrrrSrrZspltwrErjrGrGrH_handle_BYWEEKDAYs"    z_rrulestr._handle_BYWEEKDAYNFc Cs|jdd kr.|jd\}}|dkr2tdn|}i}x|jdD]} | jd\}}|j}|j}y t|d||||||dWqBtk rtd |YqBttfk rtd ||fYqBXqBWtf||d |S) N:rRRULEzunknown parameter namer=Z_handle_)rMrNzunknown parameter '%s'zinvalid '%s': %s)rr^r)findrHrAuppergetattrAttributeErrorKeyErrorr ) rDlinerr^rMrNrrrFZpairrGrGrH_parse_rfc_rrules&  z_rrulestr._parse_rfc_rrulec Cs|r d}d}|j}|js$td|r|j} d} xr| t| kr| | j} | sZ| | =q6| dkr| ddkr| | d| dd7<| | =q6| d7} q6Wn|j} | rt| dkr|jddks|jdr|j | d||||dSg} g} g}g}x| D]} | sq| jddkr,d }| }n| jdd\}}|jd }|sTtd |d}|dd}|d krx|D]}td |qxW| j |q|d krx$|D]}|dkrtd|qW| j |n|dkr x|D]}td|qW|j |n|dkrFx$|D]}|dkrtd|qW|j |nV|dkrx|D]}td|qVWt s~ddl m a t j |||d}n td|qW|st| dks| s|s|rt r| s|rddl m a t|d}x&| D]}|j|j ||||dqWx:| D]2}x*|jdD]}|jt j |||dq0Wq Wx&|D]}|j|j ||||dq\Wx:|D]2}x*|jdD]}|jt j |||dqWqW|r|r|j||S|j | d||||dSdS)NTz empty stringr rrWzRRULE:)r^rrMrNrXrzempty property namezunsupported RRULE parm: ZRDATEzVALUE=DATE-TIMEzunsupported RDATE parm: ZEXRULEzunsupported EXRULE parm: ZEXDATEzunsupported EXDATE parm: ZDTSTARTzunsupported DTSTART parm: )rL)rMrNzunsupported property: )r^)rrMrNr)rr^rMrNrr)r[striprA splitlinesrgrstriprHrZ startswithr`rhrLrrOr r r>r?r@)rDrrr^ZunfoldZforcesetZ compatiblerMrNlinesrjr_Z rrulevalsZ rdatevalsZ exrulevalsZ exdatevalsrrZparmsZparmZrsetZdatestrrGrGrH _parse_rfcs                                      z_rrulestr._parse_rfccKs|j|f|S)N)rg)rDrrSrGrGrH__call__Dsz_rrulestr.__call__)NFFN)NFFFFFN)!rIrJrKr rrrrrrrJrQrGrIZ_handle_INTERVALZ _handle_COUNTZ_handle_BYSETPOSZ_handle_BYMONTHZ_handle_BYMONTHDAYZ_handle_BYYEARDAYZ_handle_BYEASTERZ_handle_BYWEEKNOZ_handle_BYHOURZ_handle_BYMINUTEZ_handle_BYSECONDrKrPrRrVZ _handle_BYDAYr`rgrhrGrGrGrHrCnsN    irCiii) rrr*r+r,r-r.r/r0r1r2r3r4) rrr5r6r7r8r9r:r;r<r=r>r?)>rLrqrrruZmathr ImportErrorZ fractionsZsixrrZ six.movesrrr.Z_commonrZ weekdaybasewarningsr __all__rr$rprZM29ZM30ZM31r%r r&r!r'r#r"rr rrrrrrrrLrrrrrrrrTrWrBrXr rr rCr rGrGrGrHsl  .@.@ ( TDm[__pycache__/rrule.cpython-36.pyc000064400000117164147204751220012551 0ustar003 6cY@sJdZddlZddlZddlZddlZyddlmZWn ek rTddlmZYnXddl m Z m Z ddl m Z mZddlZddlmZddlmZd d d d d ddddddddddddgZedgddgddgddgdd gdd!gdd"gdd#gdd$gdd%gdd&gdd'gddgd"ZeeZeeddeeddeedd(ZZZeeeeeeeeeeeeeedd"ZeeZeedNdeedOdeedPdZZZeeeeeeeeeeeeeedd"ZeeZ dQZ!dRZ"dddddd d!gd?Z#[[[ed4=ed4=e d=eeZeeZd d dddddgZ$eed"\Z%Z&Z'Z(Z)Z*Z+da,da-Gd@dAdAeZedBdCed"D\Z.Z/Z0Z1Z2Z3Z4Z5dDdEZ6GdFdGdGe7Z8GdHd d e8Z9GdIdJdJe7Z:GdKd d e8Z;GdLdMdMe7Z`_, including support for caching of results. N)gcd)advance_iterator integer_types)_threadrange)weekday)warnrrulerrulesetrrulestrYEARLYMONTHLYWEEKLYDAILYHOURLYMINUTELYSECONDLYMOTUWETHFRSASU <[y1On;Zx0Nm7cs"eZdZdZdfdd ZZS)rz7 This version of weekday does not allow n = 0. Ncs&|dkrtdtt|j||dS)NrzCan't create weekday with n==0) ValueErrorsuperr__init__)selfZwkdayn) __class__/usr/lib/python3.6/rrule.pyrCDszweekday.__init__)N)__name__ __module__ __qualname____doc__rC __classcell__rGrG)rFrHr@srccs|]}t|VqdS)N)r).0xrGrGrH KsrPcsfdd}|S)zT Decorator for rruleset methods which may invalidate the cached length. cs|f||}|j|S)N)_invalidate_cache)rDargskwargsrv)frGrH inner_funcSsz&_invalidates_cache..inner_funcrG)rUrVrG)rUrH_invalidates_cacheNs rWc@sneZdZdddZddZddZdd Zd d Zd d ZddZ dddZ dddZ dddZ dddZ dS) rrulebaseFcCs4|rg|_tj|_|jnd|_d|_d|_dS)NF)_cacher allocate_lock _cache_lockrQ_cache_complete_len)rDcacherGrGrHrC\s  zrrulebase.__init__cCs.|jrt|jS|jdkr"|jS|jSdS)N)r\iterrY_iter _iter_cached)rDrGrGrH__iter__fs   zrrulebase.__iter__cCs>|jdk r4g|_d|_|j|_|jjr4|jjd|_dS)NF)rYr\r` _cache_genr[lockedreleaser])rDrGrGrHrQns    zrrulebase._invalidate_cachec csd}|j}|j}|jj}|jj}x|r|t|kr||jr@Py$xtdD]}|jt |qLWWn&t k rd|_}d|_PYnX|||V|d7}q"Wx ||j kr||V|d7}qWdS)Nrr&Tr) rcrYr[acquirerelenr\rappendr StopIterationr])rDigenr^rfrejrGrGrHrays.      zrrulebase._iter_cachedc Cs|jr|j|St|trd|jr:|jdkr:tt||Sttj||j pJd|j pTt j |jp\dSn`|dkrt|}y"xt |dD] }t|}qWWntk rtYnX|Stt||SdS)Nrr)r\rY isinstanceslicesteplistr_ itertoolsislicestartstopsysmaxsizerrri IndexError)rDitemrkrjresrGrGrH __getitem__s$    zrrulebase.__getitem__cCs:|jr||jkSx$|D]}||kr&dS||krdSqWdS)NTF)r\rY)rDrxrjrGrGrH __contains__s  zrrulebase.__contains__cCs|jdkrx |D]}qW|jS)z Returns the number of recurrences in this set. It will have go trough the whole recurrence, if this hasn't been done before. N)r])rDrOrGrGrHcounts  zrrulebase.countcCsX|jr|j}n|}d}|r8x8|D]}||kr.P|}q Wnx|D]}||krLP|}q>W|S)z Returns the last recurrence before the given datetime instance. The inc keyword defines what happens if dt is an occurrence. With inc=True, if dt itself is an occurrence, it will be returned. N)r\rY)rDdtincrklastrjrGrGrHbefores   zrrulebase.beforecCsP|jr|j}n|}|r2x4|D]}||kr|SqWnx|D]}||kr8|Sq8WdS)z Returns the first recurrence after the given datetime instance. The inc keyword defines what happens if dt is an occurrence. With inc=True, if dt itself is an occurrence, it will be returned. N)r\rY)rDr}r~rkrjrGrGrHafters   zrrulebase.afterNccsh|jr|j}n|}|r dd}ndd}d}x6|D].}|||r2|dk rZ|d7}||krZP|Vq2WdS)aH Generator which yields up to `count` recurrences after the given datetime instance, equivalent to `after`. :param dt: The datetime at which to start generating recurrences. :param count: The maximum number of recurrences to generate. If `None` (default), dates are generated until the recurrence rule is exhausted. :param inc: If `dt` is an instance of the rule and `inc` is `True`, it is included in the output. :yields: Yields a sequence of `datetime` objects. cSs||kS)NrG)dcdtcrGrGrHsz"rrulebase.xafter..cSs||kS)NrG)rrrGrGrHrsrNr)r\rY)rDr}r|r~rkcomprEdrGrGrHxafters   zrrulebase.xafterrc Cs|jr|j}n|}d}g}|r`x|D]6}||kr4Pq$|sP||krZd}|j|q$|j|q$Wn@x>|D]6}||krvPqf|s||krd}|j|qf|j|qfW|S)a Returns all the occurrences of the rrule between after and before. The inc keyword defines what happens if after and/or before are themselves occurrences. With inc=True, they will be included in the list, if they are found in the recurrence set. FT)r\rYrh) rDrrr~r|rkZstartedlrjrGrGrHbetween s.    zrrulebase.between)F)F)F)NF)Fr)rIrJrKrCrbrQrarzr{r|rrrrrGrGrGrHrX[s      )rXcsJeZdZdZdfdd ZddZd d Zd d Zd dZddZ Z S)r a| That's the base of the rrule operation. It accepts all the keywords defined in the RFC as its constructor parameters (except byday, which was renamed to byweekday) and more. The constructor prototype is:: rrule(freq) Where freq must be one of YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, or SECONDLY. .. note:: Per RFC section 3.3.10, recurrence instances falling on invalid dates and times are ignored rather than coerced: Recurrence rules may generate recurrence instances with an invalid date (e.g., February 30) or nonexistent local time (e.g., 1:30 AM on a day where the local time is moved forward by an hour at 1:00 AM). Such recurrence instances MUST be ignored and MUST NOT be counted as part of the recurrence set. This can lead to possibly surprising behavior when, for example, the start date occurs at the end of the month: >>> from dateutil.rrule import rrule, MONTHLY >>> from datetime import datetime >>> start_date = datetime(2014, 12, 31) >>> list(rrule(freq=MONTHLY, count=4, dtstart=start_date)) ... # doctest: +NORMALIZE_WHITESPACE [datetime.datetime(2014, 12, 31, 0, 0), datetime.datetime(2015, 1, 31, 0, 0), datetime.datetime(2015, 3, 31, 0, 0), datetime.datetime(2015, 5, 31, 0, 0)] Additionally, it supports the following keyword arguments: :param cache: If given, it must be a boolean value specifying to enable or disable caching of results. If you will use the same rrule instance multiple times, enabling caching will improve the performance considerably. :param dtstart: The recurrence start. Besides being the base for the recurrence, missing parameters in the final recurrence instances will also be extracted from this date. If not given, datetime.now() will be used instead. :param interval: The interval between each freq iteration. For example, when using YEARLY, an interval of 2 means once every two years, but with HOURLY, it means once every two hours. The default interval is 1. :param wkst: The week start day. Must be one of the MO, TU, WE constants, or an integer, specifying the first day of the week. This will affect recurrences based on weekly periods. The default week start is got from calendar.firstweekday(), and may be modified by calendar.setfirstweekday(). :param count: How many occurrences will be generated. .. note:: As of version 2.5.0, the use of the ``until`` keyword together with the ``count`` keyword is deprecated per RFC-2445 Sec. 4.3.10. :param until: If given, this must be a datetime instance, that will specify the limit of the recurrence. The last recurrence in the rule is the greatest datetime that is less than or equal to the value specified in the ``until`` parameter. .. note:: As of version 2.5.0, the use of the ``until`` keyword together with the ``count`` keyword is deprecated per RFC-2445 Sec. 4.3.10. :param bysetpos: If given, it must be either an integer, or a sequence of integers, positive or negative. Each given integer will specify an occurrence number, corresponding to the nth occurrence of the rule inside the frequency period. For example, a bysetpos of -1 if combined with a MONTHLY frequency, and a byweekday of (MO, TU, WE, TH, FR), will result in the last work day of every month. :param bymonth: If given, it must be either an integer, or a sequence of integers, meaning the months to apply the recurrence to. :param bymonthday: If given, it must be either an integer, or a sequence of integers, meaning the month days to apply the recurrence to. :param byyearday: If given, it must be either an integer, or a sequence of integers, meaning the year days to apply the recurrence to. :param byweekno: If given, it must be either an integer, or a sequence of integers, meaning the week numbers to apply the recurrence to. Week numbers have the meaning described in ISO8601, that is, the first week of the year is that containing at least four days of the new year. :param byweekday: If given, it must be either an integer (0 == MO), a sequence of integers, one of the weekday constants (MO, TU, etc), or a sequence of these constants. When given, these variables will define the weekdays where the recurrence will be applied. It's also possible to use an argument n for the weekday instances, which will mean the nth occurrence of this weekday in the period. For example, with MONTHLY, or with YEARLY and BYMONTH, using FR(+1) in byweekday will specify the first friday of the month where the recurrence happens. Notice that in the RFC documentation, this is specified as BYDAY, but was renamed to avoid the ambiguity of that keyword. :param byhour: If given, it must be either an integer, or a sequence of integers, meaning the hours to apply the recurrence to. :param byminute: If given, it must be either an integer, or a sequence of integers, meaning the minutes to apply the recurrence to. :param bysecond: If given, it must be either an integer, or a sequence of integers, meaning the seconds to apply the recurrence to. :param byeaster: If given, it must be either an integer, or a sequence of integers, positive or negative. Each integer will define an offset from the Easter Sunday. Passing the offset 0 to byeaster will yield the Easter Sunday itself. This is an extension to the RFC specification. NrFc sRtt|j||s(tjjjdd}n*t|tjsFtjj|j}n |jdd}||_ |j |_ ||_ ||_ ||_i|_|rt|tj rtjj|j}||_|dk r|rtdt|dkrtj|_nt|tr||_n|j|_|dkrd|_nt|tr:|dks(d|kodkn r0td|f|_nLt||_x@|jD]6}|dksxd|kondkn rLtdqLW|jr|j|jd<| dkr:| dkr:| dkr:| dkr:| dkr:|tkr|dkr|j}d|jd<|j} d|jd<n8|tkr|j} d|jd<n|tkr:|j} d|jd <|dkrLd|_ n|j7D]4}x,|j:D]"}|j;jt|j;|_;dS)Nr)Z microsecondzUsing both 'count' and 'until' is inconsistent with RFC 2445 and has been deprecated in dateutil. Future versions will raise an error.inz:bysetpos must be between 1 and 366, or between -366 and -1bysetposbymonth bymonthday byweekday byyearday)easterbyeastercss|]}|dkr|VqdS)rNrG)rNrOrGrGrHrPsz!rrule.__init__..css|]}|dkr|VqdS)rNrG)rNrOrGrGrHrPsbyweeknorEcSsg|] }t|qSrG)r)rNrOrGrGrH Isz"rrule.__init__..cSsg|] }t|qSrG)r)rNrOrGrGrHrOs)rsbyxxxbasebyhourr*byminutebysecond)tzinfoii)?rBr rCdatetimeZnowreplacerm fromordinal toordinal_dtstartr_tzinfo_freq _interval_count_original_rule_untilr DeprecationWarningcalendarZ firstweekday_wkstrr _bysetposrAtupler monthdayrr_bymonthsortedset _byyeardayrdateutil _byeaster _bymonthday _bynmonthdayrqchain _byweekno _byweekday _bynweekdayhasattraddrErhour_byhour_rrule__construct_bysetrminute _byminutersecond _bysecond_timesetrhtimesort)rDfreqdtstartintervalwkstr|untilrrrrrrrrrrr^poswdayZorig_byweekdayZorig_bynweekdayrrr)rFrGrHrCsL      (   (                                                              zrrule.__init__c Csg}dgd\}}}|jrD|j|jjd|jjdd\}}}dt|jg}|jdkrr|jdt|j|jr|jdt t |jd d |j dk r|jd t|j |j r|j|j jd |j jd dk rDt|j }g}xJ|d D]>}|jr(|jdj|jt |d d dq|jt |qW||d <n|j }d} xFd4D]>\} } |j| } | rT|j| j| d$jd%d&| Dd'qTW|jd(j|d)j|S)5z Output a string that would generate this RRULE if passed to rrulestr. This is mostly compatible with RFC2445, except for the dateutil-specific extension BYEASTER. NrzDTSTART:%Y%m%dT%H%M%Sr"zFREQ=rz INTERVAL=zWKST=rrzCOUNT=zUNTIL=%Y%m%dT%H%M%Srz {n:+d}{wday})rErz {name}={vals}BYSETPOSrBYMONTHr BYMONTHDAYr BYYEARDAYrBYWEEKNOrBYDAYBYHOURrBYMINUTErBYSECONDrBYEASTERr,css|]}t|VqdS)N)str)rNvrGrGrHrPsz rrule.__str__..)namevals; rrrrrrrrrrrrrrrrrrrr) rrrrrrrrrr)rrhZstrftime timetuple FREQNAMESrrrrreprrrrrgetdictrEformatjoin) rDoutputhmspartsZ original_ruleZ wday_stringsrZpartfmtrkeyvaluerGrGrH__str__sT       z rrule.__str__cKsN|j|j|j|j|j|j|jdkr&dndd}|j|j|j|t f|S)zReturn new rrule with same attributes except for those attributes given new values by whichever keyword arguments are specified.NFT)rr|rrrrr^) rrrrrrrYupdaterr )rDrSZ new_kwargsrGrGrHrs  z rrule.replacec5cs|jj\ }}}}}}}}} |j} |j} |j} |j} |j}|j}|j}|j }|j }|j }|j }|j }|j}|j}|j}t|}|j||t|jt|jt|jt|jt|jt|jt|ji| }| tkr|j}nt|jt|j t|j!i| }| tko|jo||jks<| tkr|jr||jks<| tkrB|jrB||jkrBf}n ||||}d}|j"}xX||||\}} }!d}"x$|| |!D]}#|r|j#|#|ks|r|j$|# s|r|j%|#|ks|j&r|j&|# s|r|j'|# s|s|r|j(|#|kr|j)|#|ks|r|#|j*krP|#d|krP|j* |#|ks|#|j*kr|#d|j*|kr|j+ |#|j*|krd||#<d}"qW|r|rg}$x|D]}%|%dkrt,|%t-|\}&}'nt,|%dt-|\}&}'y&dd|| |!D|&}#||'}(Wnt.k r$Yn6Xt/j0j1|j2|#})t/j/j3|)|(}*|*|$kr|$j4|*qW|$j5xh|$D]`}*| r|*| kr||_6dS|*|jkrn|dk r|d8}|dkr||_6dS|d7}|*VqnWnx|| |!D]}#|#dk rt/j0j1|j2|#})xv|D]n}(t/j/j3|)|(}*| r4|*| kr4||_6dS|*|jkr|dk rf|d8}|dkrf||_6dS|d7}|*VqWqWd}+| tkr|| 7}|t/j7kr||_6dS|j||n^| tkr.|| 7}|dkrt,|d\},}-|-}||,7}|dkrd}|d8}|t/j7kr||_6dS|j||n| tkr| |krd||dd|  |jd 7}n|||  |jd 7}| }d}+n| tkr|| 7}d}+nx| tkr|"r|d || | 7}|r|j8||jd d \}.}nt,|| d \}.}|.r||.7}d}+||||}n| tkr|"rD|d |d|| | 7}d}/d}0xt9|0t:| |0D]v}1|r|j8||jdd \}2}nt,|| d\}2}t,||2d \},}|,r||,7}d}+d}"| s||kr`d}/Pq`W|/st;d||||}n"| tkr|"r,|d|d|d|| | 7}d}0d}/xt9d|0t:| |0D]}1|rl|j8||jdd \}3}nt,|| d\}3}t,||3d\},}|,r||,7}t,|d \},}|,r||,7}d}+| s||krJ| s||krJ| s||krJd}/PqJW|/st;d||||}|+r\|dkr\t.r(r"r#r)rrrir*z$Invalid combination of interval and zbyhour resulting in empty rule.iQiz!Invalid combination of interval, z&byhour and byminute resulting in emptyz rule. izCInvalid combination of interval and byhour resulting in empty rule.iQzGInvalid combination of interval, byhour and byminute resulting in emptyzMInvalid combination of interval, byhour and byminute resulting in empty rule.)>rrrrrrrrrrrrrrrrr _iterinforebuildr ydaysetrmdaysetrwdaysetrddaysetrrrrhtimesetmtimesetstimesetrmmaskwnomaskwdaymask nwdaymask eastermaskmdaymask nmdaymaskyearlen nextyearlendivmodrgrwrdater yearordinalZcombinerhrr]ZMAXYEAR_rrule__mod_distancerrrArZ monthrange)5rDyearrrrrrrZyearday_rrrrrrrrrrZ bynmonthdayrrrriiZ getdaysetZtimesetZ gettimesettotalr|ZdaysetrsendZfilteredrjZposlistrZdayposZtimeposrr ryZfixdaydivmodZndaysZvalidZrep_raterlZnhoursZnminutesZ daysinmonthrGrGrHr`s                             "          z rrule._itercCspt}t|tr|f}x@|D]8}t|j|}|dksJt|||ddkr|j|qWt|dkrltd|S)a If a `BYXXX` sequence is passed to the constructor at the same level as `FREQ` (e.g. `FREQ=HOURLY,BYHOUR={2,4,7},INTERVAL=3`), there are some specifications which cannot be reached given some starting conditions. This occurs whenever the interval is not coprime with the base of a given unit and the difference between the starting position and the ending position is not coprime with the greatest common denominator between the interval and the base. For example, with a FREQ of hourly starting at 17:00 and an interval of 4, the only valid values for BYHOUR would be {21, 1, 5, 9, 13, 17}, because 4 and 24 are not coprime. :param start: Specifies the starting position. :param byxxx: An iterable containing the list of allowed values. :param base: The largest allowable value for the specified frequency (e.g. 24 hours, 60 minutes). This does not preserve the type of the iterable, returning a set, since the values should be unique and the order is irrelevant, this will speed up later lookups. In the event of an empty set, raises a :exception:`ValueError`, as this results in an empty rrule. rrz+Invalid rrule byxxx generates an empty set.) rrmrrrr rrgrA)rDrsrrZcsetZnumZi_gcdrGrGrHZ__construct_bysets    zrrule.__construct_bysetcCsLd}xBtd|dD]0}t||j|\}}||7}||kr||fSqWdS)a Calculates the next value in a sequence where the `FREQ` parameter is specified along with a `BYXXX` parameter at the same "level" (e.g. `HOURLY` specified with `BYHOUR`). :param value: The old value of the component. :param byxxx: The `BYXXX` set, which should have been generated by `rrule._construct_byset`, or something else which checks that a valid rule is present. :param base: The largest allowable value for the specified frequency (e.g. 24 hours, 60 minutes). If a valid value is not found after `base` iterations (the maximum number before the sequence would start to repeat), this raises a :exception:`ValueError`, as no valid values were found. This returns a tuple of `divmod(n*interval, base)`, where `n` is the smallest number of `interval` repetitions until the next specified value in `byxxx` is found. rrN)rr r)rDrrrZ accumulatorrrrGrGrHZ__mod_distances zrrule.__mod_distance)NrNNNNNNNNNNNNNF) rIrJrKrLrCrrr`rrrMrGrG)rFrHr .st{>/c@sveZdZddddddddd d d d d ddgZddZddZddZddZddZddZ ddZ ddZ d d!Z d"S)#rr lastyear lastmonthr r r  yearweekdayrmrangerrrrrrcCs&x|jD]}t||dqW||_dS)N) __slots__setattrr )rDr attrrGrGrHrCDs z_iterinfo.__init__cCs|j}||jkr2dtj||_dtj|d|_tj|dd}|j|_ |j |_ tj|ddj }|jdkrt |_ t|_t|_t|d|_t|_n&t|_ t|_t|_t|d|_t|_|jsd|_n`dg|jd|_d|j |jd}}|dkr"d}|j|j |jd}n |j|}t|d\} } | | d} x|jD]} | dkrh| | d7} d| ko|| knsqN| dkr|| dd} ||kr| d|8} n|} x8tdD],}d|j| <| d7} |j| |jkrPqWqNWd|jkrr|| d} ||kr,| d|8} | |jkrrx8tdD],}d|j| <| d7} |j| |jkrBPqBW|r2d|jkrtj|dddj }d||jd}dtj|d}|dkrd}d|||jddd}nd|j|dd}nd}||jkr2xt|D]} d|j| <qW|jr||j ksR||jkrg}|j!t"kr|j#rx:|j#D]"}|j$|j|d|dqrWn d|jfg}n$|j!t%kr|j|d|dg}|rdg|j|_&x|D]\}}|d8}x|jD]\}} | dkr8|| dd} | |j| |d8} n*|| dd} | d|j| |d7} || kov|knrd|j&| <qWqW|j'rdg|jd|_(t)j)|j|j }x|j'D]}d|j(||<qW||_||_ dS) Nimrrr#r4r)*r rrZisleapr r rr rr rrM365MASKr MDAY365MASKr NMDAY365MASKrWDAYMASKr M365RANGErM366MASK MDAY366MASK NMDAY366MASK M366RANGErrrr rrrrr rrhrrrrr)rDrrrrZ firstydayrZno1wkstZ firstwkstZwyearlenrrZnumweeksrErjrlZ lyearweekdayZlno1wkstZlyearlenZ lnumweeksZrangesfirstrZeydayoffsetrGrGrHrIs                          $   z_iterinfo.rebuildcCstt|jd|jfS)Nr)rprr )rDrrrrGrGrHrsz_iterinfo.ydaysetcCsLdg|j}|j|d|d\}}xt||D] }|||<q2W|||fS)Nr)r rr)rDrrrdsetrsrrjrGrGrHrs   z_iterinfo.mdaysetcCsldg|jd}tj|||j|j}|}x4tdD](}|||<|d7}|j||jjkr6Pq6W|||fS)Nr#r) r rr rr rrr r)rDrrrr+rjrsrlrGrGrHrsz_iterinfo.wdaysetcCs:dg|j}tj|||j|j}|||<|||dfS)Nr)r rr rr )rDrrrr+rjrGrGrHrs z_iterinfo.ddaysetc CsPg}|j}x8|jD].}x(|jD]}|jtj||||jdqWqW|j|S)N)r)r rrrhrrrr)rDrrrtsetr(rGrGrHrs  z_iterinfo.htimesetcCs@g}|j}x(|jD]}|jtj||||jdqW|j|S)N)r)r rrhrrrr)rDrrrr,r(rGrGrHrs  z_iterinfo.mtimesetcCstj||||jjdfS)N)r)rrr r)rDrrrrGrGrHrs z_iterinfo.stimesetN) rIrJrKrrCrrrrrrrrrGrGrGrHr>s  rcsjeZdZdZGdddeZdfdd ZeddZed d Z ed d Z ed dZ ddZ Z S)r aL The rruleset type allows more complex recurrence setups, mixing multiple rules, dates, exclusion rules, and exclusion dates. The type constructor takes the following keyword arguments: :param cache: If True, caching of results will be enabled, improving performance of multiple queries considerably. c@s@eZdZddZddZeZddZddZd d Zd d Z d S)zrruleset._genitemc Cs>yt||_|j|Wntk r,YnX||_||_dS)N)rr}rhrigenlistrk)rDr-rkrGrGrHrC s zrruleset._genitem.__init__c Cs^yt|j|_WnHtk rX|jd|kr8szrruleset.rdatecCs|jj|dS)z Include the given rrule instance in the recurrence set exclusion list. Dates which are part of the given recurrence rules will not be generated, even if some inclusive rrule or rdate matches them. N)r<rh)rDexrulerGrGrHr?>szrruleset.exrulecCs|jj|dS)z Include the given datetime instance in the recurrence set exclusion list. Dates included that way will not be generated, even if some inclusive rrule or rdate matches them. N)r=rh)rDexdaterGrGrHr@Fszrruleset.exdateccslg}|jj|j|t|jx$dd|jDD]}|j||q2Wg}|jj|j|t|jx$dd|jDD]}|j||qxWd}d}tj|tj|x|r`|d}| s||j kr:xB|o|d|kr |d}t ||o|d|krtj ||qW| s$||dkr4|d7}|j V|j }t ||r|d|krtj ||qW||_ dS)NcSsg|] }t|qSrG)r_)rNrOrGrGrHrQsz"rruleset._iter..cSsg|] }t|qSrG)r_)rNrOrGrGrHrVsrr) r;rr9r_r:r=r<r.r1r}r heapreplacer])rDZrlistrkZexlistZlastdtrZritemZexitemrGrGrHr`Ms<    zrruleset._iter)F)rIrJrKrLobjectr9rCrWr r>r?r@r`rMrGrG)rFrHr s"    c@seZdZeeeeeee dZ dddddddd Z d d Z d d Z e Ze Ze Ze Ze Ze Ze Ze Ze Ze Ze ZddZddZddZddZeZdddZdddZddZ dS) _rrulestr)r rrrrrrrrrrrr!r")rrrrrrrcKst|||j<dS)N)intlower)rDrrkwargsrrrSrGrGrH _handle_int{sz_rrulestr._handle_intcKs dd|jdD||j<dS)NcSsg|] }t|qSrG)rD)rNrOrGrGrHrsz._rrulestr._handle_int_list..r)splitrE)rDrFrrrSrGrGrH_handle_int_list~sz_rrulestr._handle_int_listcKs|j||d<dS)Nr) _freq_map)rDrFrrrSrGrGrH _handle_FREQsz_rrulestr._handle_FREQc KsVtsddlmay$tj||jd|jdd|d<Wntk rPtdYnXdS)Nr)parserignoretztzinfos)rMrNrzinvalid until date)rLrparserrA)rDrFrrrSrGrGrH _handle_UNTILs z_rrulestr._handle_UNTILcKs|j||d<dS)Nr) _weekday_map)rDrFrrrSrGrGrH _handle_WKSTsz_rrulestr._handle_WKSTc Ksg}x|jdD]}d|krD|jd}|d}t|ddd } n^t|rx"tt|D]} || dkrZPqZW|d| p~d} || d}| rt| } ntd|jt|j|| qW||d<dS) z: Two ways to specify this: +1MO or MO(+1) r(rrNz +-0123456789z$Invalid (empty) BYDAY specification.rr)rHrDrgrrArhweekdaysrQ) rDrFrrrSrrZspltwrErjrGrGrH_handle_BYWEEKDAYs"    z_rrulestr._handle_BYWEEKDAYNFc Cs|jdd kr.|jd\}}|dkr2tdn|}i}x|jdD]} | jd\}}|j}|j}y t|d||||||dWqBtk rtd |YqBttfk rtd ||fYqBXqBWtf||d |S) N:rRRULEzunknown parameter namer=Z_handle_)rMrNzunknown parameter '%s'zinvalid '%s': %s)rr^r)findrHrAuppergetattrAttributeErrorKeyErrorr ) rDlinerr^rMrNrrrFZpairrGrGrH_parse_rfc_rrules&  z_rrulestr._parse_rfc_rrulec Cs|r d}d}|j}|js$td|r|j} d} xr| t| kr| | j} | sZ| | =q6| dkr| ddkr| | d| dd7<| | =q6| d7} q6Wn|j} | rt| dkr|jddks|jdr|j | d||||dSg} g} g}g}x| D]} | sq| jddkr,d }| }n| jdd\}}|jd }|sTtd |d}|dd}|d krx|D]}td |qxW| j |q|d krx$|D]}|dkrtd|qW| j |n|dkr x|D]}td|qW|j |n|dkrFx$|D]}|dkrtd|qW|j |nV|dkrx|D]}td|qVWt s~ddl m a t j |||d}n td|qW|st| dks| s|s|rt r| s|rddl m a t|d}x&| D]}|j|j ||||dqWx:| D]2}x*|jdD]}|jt j |||dq0Wq Wx&|D]}|j|j ||||dq\Wx:|D]2}x*|jdD]}|jt j |||dqWqW|r|r|j||S|j | d||||dSdS)NTz empty stringr rrWzRRULE:)r^rrMrNrXrzempty property namezunsupported RRULE parm: ZRDATEzVALUE=DATE-TIMEzunsupported RDATE parm: ZEXRULEzunsupported EXRULE parm: ZEXDATEzunsupported EXDATE parm: ZDTSTARTzunsupported DTSTART parm: )rL)rMrNzunsupported property: )r^)rrMrNr)rr^rMrNrr)r[striprA splitlinesrgrstriprHrZ startswithr`rhrLrrOr r r>r?r@)rDrrr^ZunfoldZforcesetZ compatiblerMrNlinesrjr_Z rrulevalsZ rdatevalsZ exrulevalsZ exdatevalsrrZparmsZparmZrsetZdatestrrGrGrH _parse_rfcs                                      z_rrulestr._parse_rfccKs|j|f|S)N)rg)rDrrSrGrGrH__call__Dsz_rrulestr.__call__)NFFN)NFFFFFN)!rIrJrKr rrrrrrrJrQrGrIZ_handle_INTERVALZ _handle_COUNTZ_handle_BYSETPOSZ_handle_BYMONTHZ_handle_BYMONTHDAYZ_handle_BYYEARDAYZ_handle_BYEASTERZ_handle_BYWEEKNOZ_handle_BYHOURZ_handle_BYMINUTEZ_handle_BYSECONDrKrPrRrVZ _handle_BYDAYr`rgrhrGrGrGrHrCnsN    irCiii) rrr*r+r,r-r.r/r0r1r2r3r4) rrr5r6r7r8r9r:r;r<r=r>r?)>rLrqrrruZmathr ImportErrorZ fractionsZsixrrZ six.movesrrr.Z_commonrZ weekdaybasewarningsr __all__rr$rprZM29ZM30ZM31r%r r&r!r'r#r"rr rrrrrrrrLrrrrrrrrTrWrBrXr rr rCr rGrGrGrHsl  .@.@ ( TDm[__pycache__/tzwin.cpython-36.opt-1.pyc000064400000000205147204751220013515 0ustar003 6cY;@s ddlTdS))*N)Ztz.winrr/usr/lib/python3.6/tzwin.pys__pycache__/tzwin.cpython-36.pyc000064400000000205147204751220012556 0ustar003 6cY;@s ddlTdS))*N)Ztz.winrr/usr/lib/python3.6/tzwin.pystz/__pycache__/__init__.cpython-36.opt-1.pyc000064400000000462147204751220014543 0ustar003 6cY @s*ddlTdddddddd d d d d dg ZdS))*ZtzutcZtzoffsetZtzlocalZtzfileZtzrangeZtzstrZtzicalZtzwinZ tzwinlocalZgettzZenfoldZdatetime_ambiguousZdatetime_existsN)Ztz__all__rr/usr/lib/python3.6/__init__.pys  tz/__pycache__/__init__.cpython-36.pyc000064400000000462147204751220013604 0ustar003 6cY @s*ddlTdddddddd d d d d dg ZdS))*ZtzutcZtzoffsetZtzlocalZtzfileZtzrangeZtzstrZtzicalZtzwinZ tzwinlocalZgettzZenfoldZdatetime_ambiguousZdatetime_existsN)Ztz__all__rr/usr/lib/python3.6/__init__.pys  tz/__pycache__/_common.cpython-36.opt-1.pyc000064400000026262147204751220014441 0ustar003 6cY.@sddlmZddlmZddlmZmZmZedZddgZddZ e edrZdd dZ nGd d d eZ dd dZ d dZ GdddeZGdddeZddZeedeZdS))PY3)wraps)datetime timedeltatzinfotzname_in_python2enfoldcsfdd}|S)zChange unicode output into bytestrings in Python 2 tzname() API changed in Python 3. It used to return bytes, but was changed to unicode strings cs$||}|dk r t r |j}|S)N)rencode)argskwargsname)namefunc/usr/lib/python3.6/_common.pyadjust_encodings z*tzname_in_python2..adjust_encodingr)r rr)r rr s foldcCs |j|dS)a Provides a unified interface for assigning the ``fold`` attribute to datetimes both before and after the implementation of PEP-495. :param fold: The value for the ``fold`` attribute in the returned datetime. This should be either 0 or 1. :return: Returns an object for which ``getattr(dt, 'fold', 0)`` returns ``fold`` for all versions of Python. In versions prior to Python 3.6, this is a ``_DatetimeWithFold`` object, which is a subclass of :py:class:`datetime.datetime` with the ``fold`` attribute added, if ``fold`` is 1. .. versionadded:: 2.6.0 )r)replace)dtrrrrr!sc@s eZdZdZfZeddZdS)_DatetimeWithFoldz This is a class designed to provide a PEP 495-compliant interface for Python versions before 3.6. It is used only for dates in a fold, so the ``fold`` attribute is fixed at ``1``. .. versionadded:: 2.6.0 cCsdS)Nrr)selfrrrr@sz_DatetimeWithFold.foldN)__name__ __module__ __qualname____doc__ __slots__propertyrrrrrr6srcCsLt|dd|kr|S|jdd}||j|jf7}|r@t|St|SdS)a Provides a unified interface for assigning the ``fold`` attribute to datetimes both before and after the implementation of PEP-495. :param fold: The value for the ``fold`` attribute in the returned datetime. This should be either 0 or 1. :return: Returns an object for which ``getattr(dt, 'fold', 0)`` returns ``fold`` for all versions of Python. In versions prior to Python 3.6, this is a ``_DatetimeWithFold`` object, which is a subclass of :py:class:`datetime.datetime` with the ``fold`` attribute added, if ``fold`` is 1. .. versionadded:: 2.6.0 rrN)getattrZ timetupleZ microsecondrrr)rrr rrrrDscstfdd}|S)z The CPython version of ``fromutc`` checks that the input is a ``datetime`` object and that ``self`` is attached as its ``tzinfo``. cs.t|tstd|j|k r$td||S)Nz&fromutc() requires a datetime argumentzdt.tzinfo is not self) isinstancer TypeErrorr ValueError)rr)frrfromutcgs   z)_validate_fromutc_inputs..fromutc)r)r"r#r)r"r_validate_fromutc_inputsbs r$c@s<eZdZdZddZddZddZdd Zed d Z d S) _tzinfoz= Base class for all ``dateutil`` ``tzinfo`` objects. cCsV|j|d}t|dd}t|dd}|j|jk}|jdd|jddk}|oT| S)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 )rr)rrN)rr utcoffset)rrZwall_0Zwall_1Z same_offsetZsame_dtrrr is_ambiguousxs    z_tzinfo.is_ambiguouscCs4|j|r,||}t||j|jk}nd}|S)a Determine the fold status of a "wall" datetime, given a representation of the same datetime as a (naive) UTC datetime. This is calculated based on the assumption that ``dt.utcoffset() - dt.dst()`` is constant for all datetimes, and that this offset is the actual number of hours separating ``dt_utc`` and ``dt_wall``. :param dt_utc: Representation of the datetime as UTC :param dt_wall: Representation of the datetime as "wall time". This parameter must either have a `fold` attribute or have a fold-naive :class:`datetime.tzinfo` attached, otherwise the calculation may fail. r)r'intr&dst)rdt_utcdt_wallZ delta_wall_foldrrr _fold_statuss  z_tzinfo._fold_statuscCs t|ddS)Nrr)r)rrrrrr,sz _tzinfo._foldcCsh|j}|dkrtd|j}|dkr0td||}||7}t|ddj}|dkr`td||S)a Given a timezone-aware datetime in a given timezone, calculates a timezone-aware datetime in a new timezone. Since this is the one time that we *know* we have an unambiguous datetime object, we take this opportunity to determine whether the datetime is ambiguous and in a "fold" state (e.g. if it's the first occurence, chronologically, of the ambiguous datetime). :param dt: A timezone-aware :class:`datetime.datetime` object. Nz0fromutc() requires a non-None utcoffset() resultz*fromutc() requires a non-None dst() resultr)rz;fromutc(): dt.dst gave inconsistent results; cannot convert)r&r!r)r)rrZdtoffZdtdstZdeltarrr_fromutcsz_tzinfo._fromutccCs"|j|}|j||}t||dS)a Given a timezone-aware datetime in a given timezone, calculates a timezone-aware datetime in a new timezone. Since this is the one time that we *know* we have an unambiguous datetime object, we take this opportunity to determine whether the datetime is ambiguous and in a "fold" state (e.g. if it's the first occurance, chronologically, of the ambiguous datetime). :param dt: A timezone-aware :class:`datetime.datetime` object. )r)r.r-r)rrr+r,rrrr#s  z_tzinfo.fromutcN) rrrrr'r-r,r.r$r#rrrrr%ss %r%c@szeZdZdZddZddZddZedd Zd d Z d d Z ddZ ddZ e ddZdZddZddZejZdS) tzrangebasea This is an abstract base class for time zones represented by an annual transition into and out of DST. Child classes should implement the following methods: * ``__init__(self, *args, **kwargs)`` * ``transitions(self, year)`` - this is expected to return a tuple of datetimes representing the DST on and off transitions in standard time. A fully initialized ``tzrangebase`` subclass should also provide the following attributes: * ``hasdst``: Boolean whether or not the zone uses DST. * ``_dst_offset`` / ``_std_offset``: :class:`datetime.timedelta` objects representing the respective UTC offsets. * ``_dst_abbr`` / ``_std_abbr``: Strings representing the timezone short abbreviations in DST and STD, respectively. * ``_hasdst``: Whether or not the zone has DST. .. versionadded:: 2.6.0 cCs tddS)Nz%tzrangebase is an abstract base class)NotImplementedError)rrrr__init__sztzrangebase.__init__cCs*|j|}|dkrdS|r |jS|jSdS)N)_isdst _dst_offset _std_offset)rrisdstrrrr&s  ztzrangebase.utcoffsetcCs(|j|}|dkrdS|r |jStSdS)N)r2_dst_base_offsetZERO)rrr5rrrr) s  ztzrangebase.dstcCs|j|r|jS|jSdS)N)r2Z _dst_abbrZ _std_abbr)rrrrrtznames ztzrangebase.tznamec Cst|tstd|j|k r$td|j|j}|dkrF||j|S|\}}||j8}||j8}||f}|j dd}|j ||}|r||j }n ||j}t | o|j |} t|| dS)z, Given a datetime in UTC, return local time z&fromutc() requires a datetime argumentzdt.tzinfo is not selfN)r)r)rrr rr! transitionsyearr&r4r _naive_isdstr3r(r'r) rrr9dstondstoffZutc_transitionsr*r5r+r,rrrr#s$         ztzrangebase.fromutccCsD|js dS|j|j\}}|jdd}||ko>||jkSS)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 FN)r)hasdstr9r:rr6)rrstartendrrrr'>s  ztzrangebase.is_ambiguouscCsj|js dS|dkrdS|j|j}|dkr.dS|jdd}|j||}| rb|j|rb|j| S|SdS)NF)r)r>r9r:rr;r'r,)rrr9r5rrrr2Ts    ztzrangebase._isdstcCsT|\}}|jdd}||kr6||ko.|kn}n||koH|kn }|S)N)r)r)rrr9r<r=r5rrrr;is  ztzrangebase._naive_isdstcCs |j|jS)N)r3r4)rrrrr6usztzrangebase._dst_base_offsetNcCs ||k S)Nr)rotherrrr__ne__{sztzrangebase.__ne__cCs d|jjS)Nz%s(...)) __class__r)rrrr__repr__~sztzrangebase.__repr__)rrrrr1r&r)rr8r#r'r2r;rr6__hash__rBrDobject __reduce__rrrrr/s  ! r/cCs|j|jdd|jdS)NiQi@B)ZsecondsZdaysZ microseconds)Ztdrrr_total_secondssrHZ total_secondsN)r)r)Zsixr functoolsrrrrr7__all__rhasattrrrr$r%r/rHrrrrrs     vtz/__pycache__/_common.cpython-36.pyc000064400000026262147204751220013502 0ustar003 6cY.@sddlmZddlmZddlmZmZmZedZddgZddZ e edrZdd dZ nGd d d eZ dd dZ d dZ GdddeZGdddeZddZeedeZdS))PY3)wraps)datetime timedeltatzinfotzname_in_python2enfoldcsfdd}|S)zChange unicode output into bytestrings in Python 2 tzname() API changed in Python 3. It used to return bytes, but was changed to unicode strings cs$||}|dk r t r |j}|S)N)rencode)argskwargsname)namefunc/usr/lib/python3.6/_common.pyadjust_encodings z*tzname_in_python2..adjust_encodingr)r rr)r rr s foldcCs |j|dS)a Provides a unified interface for assigning the ``fold`` attribute to datetimes both before and after the implementation of PEP-495. :param fold: The value for the ``fold`` attribute in the returned datetime. This should be either 0 or 1. :return: Returns an object for which ``getattr(dt, 'fold', 0)`` returns ``fold`` for all versions of Python. In versions prior to Python 3.6, this is a ``_DatetimeWithFold`` object, which is a subclass of :py:class:`datetime.datetime` with the ``fold`` attribute added, if ``fold`` is 1. .. versionadded:: 2.6.0 )r)replace)dtrrrrr!sc@s eZdZdZfZeddZdS)_DatetimeWithFoldz This is a class designed to provide a PEP 495-compliant interface for Python versions before 3.6. It is used only for dates in a fold, so the ``fold`` attribute is fixed at ``1``. .. versionadded:: 2.6.0 cCsdS)Nrr)selfrrrr@sz_DatetimeWithFold.foldN)__name__ __module__ __qualname____doc__ __slots__propertyrrrrrr6srcCsLt|dd|kr|S|jdd}||j|jf7}|r@t|St|SdS)a Provides a unified interface for assigning the ``fold`` attribute to datetimes both before and after the implementation of PEP-495. :param fold: The value for the ``fold`` attribute in the returned datetime. This should be either 0 or 1. :return: Returns an object for which ``getattr(dt, 'fold', 0)`` returns ``fold`` for all versions of Python. In versions prior to Python 3.6, this is a ``_DatetimeWithFold`` object, which is a subclass of :py:class:`datetime.datetime` with the ``fold`` attribute added, if ``fold`` is 1. .. versionadded:: 2.6.0 rrN)getattrZ timetupleZ microsecondrrr)rrr rrrrDscstfdd}|S)z The CPython version of ``fromutc`` checks that the input is a ``datetime`` object and that ``self`` is attached as its ``tzinfo``. cs.t|tstd|j|k r$td||S)Nz&fromutc() requires a datetime argumentzdt.tzinfo is not self) isinstancer TypeErrorr ValueError)rr)frrfromutcgs   z)_validate_fromutc_inputs..fromutc)r)r"r#r)r"r_validate_fromutc_inputsbs r$c@s<eZdZdZddZddZddZdd Zed d Z d S) _tzinfoz= Base class for all ``dateutil`` ``tzinfo`` objects. cCsV|j|d}t|dd}t|dd}|j|jk}|jdd|jddk}|oT| S)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 )rr)rrN)rr utcoffset)rrZwall_0Zwall_1Z same_offsetZsame_dtrrr is_ambiguousxs    z_tzinfo.is_ambiguouscCs4|j|r,||}t||j|jk}nd}|S)a Determine the fold status of a "wall" datetime, given a representation of the same datetime as a (naive) UTC datetime. This is calculated based on the assumption that ``dt.utcoffset() - dt.dst()`` is constant for all datetimes, and that this offset is the actual number of hours separating ``dt_utc`` and ``dt_wall``. :param dt_utc: Representation of the datetime as UTC :param dt_wall: Representation of the datetime as "wall time". This parameter must either have a `fold` attribute or have a fold-naive :class:`datetime.tzinfo` attached, otherwise the calculation may fail. r)r'intr&dst)rdt_utcdt_wallZ delta_wall_foldrrr _fold_statuss  z_tzinfo._fold_statuscCs t|ddS)Nrr)r)rrrrrr,sz _tzinfo._foldcCsh|j}|dkrtd|j}|dkr0td||}||7}t|ddj}|dkr`td||S)a Given a timezone-aware datetime in a given timezone, calculates a timezone-aware datetime in a new timezone. Since this is the one time that we *know* we have an unambiguous datetime object, we take this opportunity to determine whether the datetime is ambiguous and in a "fold" state (e.g. if it's the first occurence, chronologically, of the ambiguous datetime). :param dt: A timezone-aware :class:`datetime.datetime` object. Nz0fromutc() requires a non-None utcoffset() resultz*fromutc() requires a non-None dst() resultr)rz;fromutc(): dt.dst gave inconsistent results; cannot convert)r&r!r)r)rrZdtoffZdtdstZdeltarrr_fromutcsz_tzinfo._fromutccCs"|j|}|j||}t||dS)a Given a timezone-aware datetime in a given timezone, calculates a timezone-aware datetime in a new timezone. Since this is the one time that we *know* we have an unambiguous datetime object, we take this opportunity to determine whether the datetime is ambiguous and in a "fold" state (e.g. if it's the first occurance, chronologically, of the ambiguous datetime). :param dt: A timezone-aware :class:`datetime.datetime` object. )r)r.r-r)rrr+r,rrrr#s  z_tzinfo.fromutcN) rrrrr'r-r,r.r$r#rrrrr%ss %r%c@szeZdZdZddZddZddZedd Zd d Z d d Z ddZ ddZ e ddZdZddZddZejZdS) tzrangebasea This is an abstract base class for time zones represented by an annual transition into and out of DST. Child classes should implement the following methods: * ``__init__(self, *args, **kwargs)`` * ``transitions(self, year)`` - this is expected to return a tuple of datetimes representing the DST on and off transitions in standard time. A fully initialized ``tzrangebase`` subclass should also provide the following attributes: * ``hasdst``: Boolean whether or not the zone uses DST. * ``_dst_offset`` / ``_std_offset``: :class:`datetime.timedelta` objects representing the respective UTC offsets. * ``_dst_abbr`` / ``_std_abbr``: Strings representing the timezone short abbreviations in DST and STD, respectively. * ``_hasdst``: Whether or not the zone has DST. .. versionadded:: 2.6.0 cCs tddS)Nz%tzrangebase is an abstract base class)NotImplementedError)rrrr__init__sztzrangebase.__init__cCs*|j|}|dkrdS|r |jS|jSdS)N)_isdst _dst_offset _std_offset)rrisdstrrrr&s  ztzrangebase.utcoffsetcCs(|j|}|dkrdS|r |jStSdS)N)r2_dst_base_offsetZERO)rrr5rrrr) s  ztzrangebase.dstcCs|j|r|jS|jSdS)N)r2Z _dst_abbrZ _std_abbr)rrrrrtznames ztzrangebase.tznamec Cst|tstd|j|k r$td|j|j}|dkrF||j|S|\}}||j8}||j8}||f}|j dd}|j ||}|r||j }n ||j}t | o|j |} t|| dS)z, Given a datetime in UTC, return local time z&fromutc() requires a datetime argumentzdt.tzinfo is not selfN)r)r)rrr rr! transitionsyearr&r4r _naive_isdstr3r(r'r) rrr9dstondstoffZutc_transitionsr*r5r+r,rrrr#s$         ztzrangebase.fromutccCsD|js dS|j|j\}}|jdd}||ko>||jkSS)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 FN)r)hasdstr9r:rr6)rrstartendrrrr'>s  ztzrangebase.is_ambiguouscCsj|js dS|dkrdS|j|j}|dkr.dS|jdd}|j||}| rb|j|rb|j| S|SdS)NF)r)r>r9r:rr;r'r,)rrr9r5rrrr2Ts    ztzrangebase._isdstcCsT|\}}|jdd}||kr6||ko.|kn}n||koH|kn }|S)N)r)r)rrr9r<r=r5rrrr;is  ztzrangebase._naive_isdstcCs |j|jS)N)r3r4)rrrrr6usztzrangebase._dst_base_offsetNcCs ||k S)Nr)rotherrrr__ne__{sztzrangebase.__ne__cCs d|jjS)Nz%s(...)) __class__r)rrrr__repr__~sztzrangebase.__repr__)rrrrr1r&r)rr8r#r'r2r;rr6__hash__rBrDobject __reduce__rrrrr/s  ! r/cCs|j|jdd|jdS)NiQi@B)ZsecondsZdaysZ microseconds)Ztdrrr_total_secondssrHZ total_secondsN)r)r)Zsixr functoolsrrrrr7__all__rhasattrrrr$r%r/rHrrrrrs     vtz/__pycache__/tz.cpython-36.opt-1.pyc000064400000105541147204751220013445 0ustar003 6cY @sdZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z m Z ddl m Z mZddl mZyddlmZmZWnek rdZZYnXejdZejjdZejZGd d d ejZGd d d ejZGd dde ZGdddeZGdddeZ Gddde Z!Gddde Z"Gddde"Z#GdddeZ$Gddde Z%GdddeZ&ej'dkrd d!gZ(d"d#d$d%gZ)ngZ(gZ)d0d&d'Z*d1d(d)Z+d2d*d+Z,d,d-Z-Gd.d/d/eZ.dS)3a{ This module offers timezone implementations subclassing the abstract :py:`datetime.tzinfo` type. There are classes to handle tzfile format files (usually are in :file:`/etc/localtime`, :file:`/usr/share/zoneinfo`, etc), TZ environment string (in all known formats), given ranges (with help from relative deltas), local machine timezone, fixed offset timezone, and UTC timezone. N) string_types)tzname_in_python2_tzinfo_total_seconds) tzrangebaseenfold)_validate_fromutc_inputs)tzwin tzwinlocalc@sbeZdZdZddZddZeddZdd Ze d d Z d d Z dZ ddZ ddZejZdS)tzutczD This is a tzinfo object that represents the UTC time zone. cCstS)N)ZERO)selfdtr/usr/lib/python3.6/tz.py utcoffset$sztzutc.utcoffsetcCstS)N)r )rrrrrdst'sz tzutc.dstcCsdS)NUTCr)rrrrrtzname*sz tzutc.tznamecCsdS)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 Fr)rrrrr is_ambiguous.sztzutc.is_ambiguouscCs|S)z Fast track version of fromutc() returns the original ``dt`` object for any valid :py:class:`datetime.datetime` object. r)rrrrrfromutc>sz tzutc.fromutccCs0t|ttfstSt|tp.t|to.|jtkS)N) isinstancer tzoffsetNotImplemented_offsetr )rotherrrr__eq__Fs z tzutc.__eq__NcCs ||k S)Nr)rrrrr__ne__Osz tzutc.__ne__cCs d|jjS)Nz%s()) __class____name__)rrrr__repr__Rsztzutc.__repr__)r __module__ __qualname____doc__rrrrrr rr__hash__rr!object __reduce__rrrrr s  r c@sjeZdZdZddZddZddZedd Ze d d Z d d Z ddZ dZ ddZddZejZdS)ra1 A simple class for representing a fixed offset from UTC. :param name: The timezone name, to be returned when ``tzname()`` is called. :param offset: The time zone offset in seconds, or (since version 2.6.0, represented as a :py:class:`datetime.timedelta` object. c Cs>||_y t|}Wnttfk r*YnXtj|d|_dS)N)seconds)_namer TypeErrorAttributeErrordatetime timedeltar)rnameoffsetrrr__init__cs  ztzoffset.__init__cCs|jS)N)r)rrrrrrmsztzoffset.utcoffsetcCstS)N)r )rrrrrrpsz tzoffset.dstcCs|jS)N)r))rrrrrrssztzoffset.tznamecCs ||jS)N)r)rrrrrrwsztzoffset.fromutccCsdS)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 Fr)rrrrrr{sztzoffset.is_ambiguouscCst|tstS|j|jkS)N)rrrr)rrrrrrs ztzoffset.__eq__NcCs ||k S)Nr)rrrrrrsztzoffset.__ne__cCs"d|jjt|jtt|jfS)Nz %s(%s, %s))rr reprr)intrr)rrrrr!sztzoffset.__repr__)r r"r#r$r0rrrrr rrrr%rr!r&r'rrrrrXs    rcsxeZdZdZfddZddZddZedd Zd d Z d d Z dddZ ddZ dZ ddZddZejZZS)tzlocalzR A :class:`tzinfo` subclass built around the ``time`` timezone functions. cs`tt|jtjtj d|_tjr:tjtj d|_ n|j|_ |j |j|_ t |j |_ dS)N)r()superr3r0r,r-timetimezone _std_offsetZdaylightZaltzone _dst_offset _dst_savedbool_hasdst)r)rrrr0sztzlocal.__init__cCs,|dkr|jrdS|j|r"|jS|jSdS)N)r;_isdstr8r7)rrrrrrs  ztzlocal.utcoffsetcCs0|dkr|jrdS|j|r(|j|jStSdS)N)r;r<r8r7r )rrrrrrs   z tzlocal.dstcCstj|j|S)N)r5rr<)rrrrrrsztzlocal.tznamecCs$|j|}| o"||j||jkS)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 ) _naive_is_dstr9)rrZ naive_dstrrrrs ztzlocal.is_ambiguouscCst|}tj|tjjS)N)_datetime_to_timestampr5 localtimer6Ztm_isdst)rr timestamprrrr=sztzlocal._naive_is_dstTcCsF|js dS|j|}t|dd}|j|rB|dk r>|j| SdS|S)NFfoldT)r;r=getattrr_fold)rrZ fold_naiveZdstvalrArrrr<s    ztzlocal._isdstcCs&t|tstS|j|jko$|j|jkS)N)rr3rr7r8)rrrrrrs  ztzlocal.__eq__NcCs ||k S)Nr)rrrrrr sztzlocal.__ne__cCs d|jjS)Nz%s())rr )rrrrr!sztzlocal.__repr__)T)r r"r#r$r0rrrrrr=r<rr%rr!r&r' __classcell__rr)rrr3s    (r3c@sReZdZdddddddgZdd Zd d Zd d ZdZddZddZ ddZ dS)_ttinfor/deltaisdstabbrisstdisgmt dstoffsetcCs x|jD]}t||dqWdS)N) __slots__setattr)rattrrrrr0s z_ttinfo.__init__cCsRg}x6|jD],}t||}|dk r |jd|t|fq Wd|jjdj|fS)Nz%s=%sz%s(%s)z, )rLrBappendr1rr join)rlrNvaluerrrr!s   z_ttinfo.__repr__cCsbt|tstS|j|jko`|j|jko`|j|jko`|j|jko`|j|jko`|j|jko`|j |j kS)N) rrErr/rFrGrHrIrJrK)rrrrrr$s       z_ttinfo.__eq__NcCs ||k S)Nr)rrrrrr2sz_ttinfo.__ne__cCs(i}x|jD]}t||d||<q W|S)N)rLrB)rstater.rrr __getstate__5s z_ttinfo.__getstate__cCs,x&|jD]}||krt||||qWdS)N)rLrM)rrSr.rrr __setstate__;s z_ttinfo.__setstate__) r r"r#rLr0r!rr%rrTrUrrrrrEs  rEc@s,eZdZdZdddddddd gZd d Zd S) _tzfilezw Lightweight class for holding the relevant transition and time zone information read from binary tzfiles. trans_listtrans_list_utc trans_idx ttinfo_list ttinfo_std ttinfo_dst ttinfo_before ttinfo_firstcKs(x"|jD]}t|||j|dqWdS)N)attrsrMget)rkwargsrNrrrr0Is z_tzfile.__init__N)r r"r#r$r_r0rrrrrVAs rVcseZdZdZd&fdd ZddZddZd'd d Zd d ZddZ ddZ d(ddZ ddZ ddZ ddZeddZddZdZddZd d!Zd"d#Zd$d%ZZS))tzfilea This is a ``tzinfo`` subclass thant allows one to use the ``tzfile(5)`` format timezone files to extract current and historical zone information. :param fileobj: This can be an opened file stream or a file name that the time zone information can be read from. :param filename: This is an optional parameter specifying the source of the time zone information in the event that ``fileobj`` is a file object. If omitted and ``fileobj`` is a file stream, this parameter will be set either to ``fileobj``'s ``name`` attribute or to ``repr(fileobj)``. See `Sources for Time Zone and Daylight Saving Time Data `_ for more information. Time zone files can be compiled from the `IANA Time Zone database files `_ with the `zic time zone compiler `_ Nc stt|jd}t|tr2||_t|d}d}n.|dk rB||_nt|drV|j|_n t ||_|dk r|stt |}|}|j |}WdQRX|j |dS)NFrbTr.) r4rbr0rr _filenameopenhasattrr.r1_ContextWrapper _read_tzfile _set_tzdata)rfileobjfilenameZfile_opened_hereZ file_streamtzobj)rrrr0ds"     ztzfile.__init__cCs*x$tjD]}t|d|t||qWdS)z= Set the time zone data of this object from a _tzfile object _N)rVr_rMrB)rrlrNrrrri|s ztzfile._set_tzdatacst|jdjdkr td|jdtjd|jd\}}}}}}|rnttjd||j|d_ng_|rtjd||j|_ng_g}x(t |D]} |j tjd |jd qW|j|j} |r|j |d t j |rtjd ||j|} |r"tjd ||j|} g_xt |D]} || \} }}d | dd } t}| |_tjd|_tj| d|_||_| || jd||_|| ko| | dk|_|| ko| | dk|_jj |q2WfddjD_d_d_d_jr؈js$jd__nxt |dddD]V} j| }j r`|j r`|_nj rx|jrx|_jr6jr6Pq6Wjrj rj_x,jD]}|js|_PqWjd_d}g_xltjD]^\} }|js |j}|}n*|dk r*|j||_|j| <|p2d}jj j| |qWd}x~t t t!jD]h} j| }|jr|jp|dks|j||_n|j}t"|jtjstj|jd|_|j| <qhWt#j_t#j_t#j_S)NZTZifzmagic not foundz>6lz>%dlz>%dBz>lbbz>%db<r)r(csg|]}j|qSr)rZ).0idx)outrr sz'tzfile._read_tzfile..rrz)$rVreaddecode ValueErrorstructunpacklistrXrYrangerOseekosSEEK_CURrZrEr/r,r-rKrFrGfindrHrIrJr[r\r]r^rW enumeratereversedlenrtuple)rrjZ ttisgmtcntZ ttisstdcntZleapcntZtimecntZtypecntZcharcntZttinfoirHrIrJZgmtoffrGZabbrindttiZ laststdoffsetr/r)rxrrhs                         ztzfile._read_tzfileFcCs6|js dSt|}|r|jn|j}tj||}|dS)Nr) _trans_listr>Z_trans_list_utcbisectZ bisect_right)rrin_utcr@rWrwrrr_find_last_transition^s  ztzfile._find_last_transitioncCs8|dks|dt|jkr |jS|dkr.|jS|j|S)Nrr)rr _ttinfo_stdZ_ttinfo_before _trans_idx)rrwrrr _get_ttinfoms ztzfile._get_ttinfocCs|j|}|j|S)N)_resolve_ambiguous_timer)rrrwrrr _find_ttinfoxs ztzfile._find_ttinfocCsnt|tjstd|j|k r&td|j|dd}|j|}|tj|jd}|j ||d}t |t |dS)a The ``tzfile`` implementation of :py:func:`datetime.tzinfo.fromutc`. :param dt: A :py:class:`datetime.datetime` object. :raises TypeError: Raised if ``dt`` is not a :py:class:`datetime.datetime` object. :raises ValueError: Raised if this is called with a ``dt`` which does not have this ``tzinfo`` attached. :return: Returns a :py:class:`datetime.datetime` object representing the wall time in ``self``'s time zone. z&fromutc() requires a datetime argumentzdt.tzinfo is not selfT)r)r()rw)rA) rr,r*tzinfor}rrr-r/rrr2)rrrwrZdt_outrArrrr}s   ztzfile.fromutccCsd|dkr|j|}t|}|j|}|dks4|dkr8dS|j|dj|j}|j|}|||kS)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 NrFr)rr>rr/r)rrrwr@rZodZttrrrrs   ztzfile.is_ambiguouscCsF|j|}|j|}|dks$|dkr(|St| o:|j||}||S)Nr)rrCr2r)rrrwrCZ idx_offsetrrrrs   ztzfile._resolve_ambiguous_timecCs"|dkr dS|jstS|j|jS)N)rr rrF)rrrrrrs ztzfile.utcoffsetcCs0|dkr dS|jstS|j|}|js*tS|jS)N)Z _ttinfo_dstr rrGrK)rrrrrrrs z tzfile.dstcCs |j s|dkrdS|j|jS)N)rrrH)rrrrrrsz tzfile.tznamecCs2t|tstS|j|jko0|j|jko0|j|jkS)N)rrbrrrZ _ttinfo_list)rrrrrrs    z tzfile.__eq__cCs ||k S)Nr)rrrrrrsz tzfile.__ne__cCsd|jjt|jfS)Nz%s(%s))rr r1rd)rrrrr!sztzfile.__repr__cCs |jdS)N) __reduce_ex__)rrrrr'sztzfile.__reduce__cCs|jd|jf|jfS)N)rrd__dict__)rZprotocolrrrrsztzfile.__reduce_ex__)N)F)N)r r"r#r$r0rirhrrrrrrrrrrrr%rr!r'rrDrr)rrrbNs(]  $    rbc@s6eZdZdZd ddZddZddZed d ZdS) tzrangeaQ The ``tzrange`` object is a time zone specified by a set of offsets and abbreviations, equivalent to the way the ``TZ`` variable can be specified in POSIX-like systems, but using Python delta objects to specify DST start, end and offsets. :param stdabbr: The abbreviation for standard time (e.g. ``'EST'``). :param stdoffset: An integer or :class:`datetime.timedelta` object or equivalent specifying the base offset from UTC. If unspecified, +00:00 is used. :param dstabbr: The abbreviation for DST / "Summer" time (e.g. ``'EDT'``). If specified, with no other DST information, DST is assumed to occur and the default behavior or ``dstoffset``, ``start`` and ``end`` is used. If unspecified and no other DST information is specified, it is assumed that this zone has no DST. If this is unspecified and other DST information is *is* specified, DST occurs in the zone but the time zone abbreviation is left unchanged. :param dstoffset: A an integer or :class:`datetime.timedelta` object or equivalent specifying the UTC offset during DST. If unspecified and any other DST information is specified, it is assumed to be the STD offset +1 hour. :param start: A :class:`relativedelta.relativedelta` object or equivalent specifying the time and time of year that daylight savings time starts. To specify, for example, that DST starts at 2AM on the 2nd Sunday in March, pass: ``relativedelta(hours=2, month=3, day=1, weekday=SU(+2))`` If unspecified and any other DST information is specified, the default value is 2 AM on the first Sunday in April. :param end: A :class:`relativedelta.relativedelta` object or equivalent representing the time and time of year that daylight savings time ends, with the same specification method as in ``start``. One note is that this should point to the first time in the *standard* zone, so if a transition occurs at 2AM in the DST zone and the clocks are set back 1 hour to 1AM, set the `hours` parameter to +1. **Examples:** .. testsetup:: tzrange from dateutil.tz import tzrange, tzstr .. doctest:: tzrange >>> tzstr('EST5EDT') == tzrange("EST", -18000, "EDT") True >>> from dateutil.relativedelta import * >>> range1 = tzrange("EST", -18000, "EDT") >>> range2 = tzrange("EST", -18000, "EDT", -14400, ... relativedelta(hours=+2, month=4, day=1, ... weekday=SU(+1)), ... relativedelta(hours=+1, month=10, day=31, ... weekday=SU(-1))) >>> tzstr('EST5EDT') == range1 == range2 True NcCs@ddlma||_||_y t|}Wnttfk r<YnXy t|}Wnttfk rbYnX|dk r|tj|d|_ nt |_ |dk rtj|d|_ n(|r|dk r|j tjd d|_ nt |_ |r|dkrtjd ddtj d d|_ n||_ |r|dkrtjdd d tj dd|_n||_|j |j |_t|j |_dS)Nr) relativedelta)r(r)hoursrn)rmonthdayweekday rrrrrz)dateutilr _std_abbr _dst_abbrrr*r+r,r-r7r r8SU _start_delta _end_delta_dst_base_offset_r:hasdst)rstdabbr stdoffsetdstabbrrKstartendrrrr0Js:     ztzrange.__init__cCs4|js dStj|dd}||j}||j}||fS)a For a given year, get the DST on and off transition times, expressed always on the standard time side. For zones with no transitions, this function returns ``None``. :param year: The year whose transitions you would like to query. :return: Returns a :class:`tuple` of :class:`datetime.datetime` objects, ``(dston, dstoff)`` for zones with an annual DST transition, or ``None`` for fixed offset zones. Nr)rr,rr)rZyearZ base_yearrrrrr transitionsys   ztzrange.transitionscCsVt|tstS|j|jkoT|j|jkoT|j|jkoT|j|jkoT|j|jkoT|j|jkS)N) rrrrrr7r8rr)rrrrrrs      ztzrange.__eq__cCs|jS)N)r)rrrr_dst_base_offsetsztzrange._dst_base_offset)NNNNN) r r"r#r$r0rrpropertyrrrrrrsI - rc@s,eZdZdZd ddZd ddZdd Zd S) tzstra ``tzstr`` objects are time zone objects specified by a time-zone string as it would be passed to a ``TZ`` variable on POSIX-style systems (see the `GNU C Library: TZ Variable`_ for more details). There is one notable exception, which is that POSIX-style time zones use an inverted offset format, so normally ``GMT+3`` would be parsed as an offset 3 hours *behind* GMT. The ``tzstr`` time zone object will parse this as an offset 3 hours *ahead* of GMT. If you would like to maintain the POSIX behavior, pass a ``True`` value to ``posix_offset``. The :class:`tzrange` object provides the same functionality, but is specified using :class:`relativedelta.relativedelta` objects. rather than strings. :param s: A time zone string in ``TZ`` variable format. This can be a :class:`bytes` (2.x: :class:`str`), :class:`str` (2.x: :class:`unicode`) or a stream emitting unicode characters (e.g. :class:`StringIO`). :param posix_offset: Optional. If set to ``True``, interpret strings such as ``GMT+3`` or ``UTC+3`` as being 3 hours *behind* UTC rather than ahead, per the POSIX standard. .. _`GNU C Library: TZ Variable`: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html Fc Csddlma||_tj|}|dkr,td|jd krJ| rJ|jd 9_tj||j|j|j |j ddd|j s~d|_ d|_ n&|j |j|_ |j r|j |jdd |_ t|j |_dS) Nr)parserzunknown string formatGMTrrF)rr)isend)rrrz)rr_sZ_parsetzr}rrrr0rrKrr_deltarrr:r)rsZ posix_offsetresrrrr0s"   ztzstr.__init__rcCs<ddlm}i}|jdk rr|j|d<|jdk r`|j|j|j|d<|jdkrVd|d<qpd|d<q|jr|j|d<n*|jdk r|j|d<n|jdk r|j|d <|s|sd |d<d|d<|jd|d<nd |d<d|d<|jd|d<|j dk r|j |d <nd |d <|r0|j |j }|d |j |j d8<|jf|S)Nr)rrrrrrZyeardayZ nlyeardayrnrr(i iQrrz)rrrrZweekrZydayZjydayrr5r8r7r(Zdays)rxrrrarFrrrrs<               z tzstr._deltacCsd|jjt|jfS)Nz%s(%s))rr r1r)rrrrr!sztzstr.__repr__N)F)r)r r"r#r$r0rr!rrrrrs )rc@seZdZdddZdS)_tzicalvtzcompNcCs@tj|d|_tj|d|_|j|j|_||_||_||_dS)N)r()r,r- tzoffsetfrom tzoffsetto tzoffsetdiffrGrrrule)rrrrGrrrrrr0 s z_tzicalvtzcomp.__init__)NN)r r"r#r0rrrrr srcsZeZdZgffdd ZddZddZddZd d Zed d Z d dZ e j Z Z S) _tzicalvtzcs*tt|j||_||_g|_g|_dS)N)r4rr0_tzid_comps _cachedate _cachecomp)rtzidcomps)rrrr0s z_tzicalvtz.__init__c Cs t|jdkr|jdS|jdd}y|j|jj||j|fStk rTYnXd}d}x4|jD]*}|j||}|rf| s||krf|}|}qfW|sx"|jD]}|j s|}PqW|d}|jj d||j|f|jj d|t|jdkr|jj |jj |S)Nrr)rr) rrreplacerrindexrCr} _find_compdtrGinsertpop)rrZ lastcompdtZlastcompcompcompdtrrr _find_comps4       z_tzicalvtz._find_compcCs2|jtkr|j|r||j8}|jj|dd}|S)NT)Zinc)rr rCrZbefore)rrrrrrrrIs z_tzicalvtz._find_compdtcCs|dkr dS|j|jS)N)rr)rrrrrrQsz_tzicalvtz.utcoffsetcCs|j|}|jr|jStSdS)N)rrGrr )rrrrrrrWs z_tzicalvtz.dstcCs |j|jS)N)rr)rrrrrr^sz_tzicalvtz.tznamecCsdt|jS)Nz)r1r)rrrrr!bsz_tzicalvtz.__repr__)r r"r#r0rrrrrrr!r&r'rDrr)rrrs* rc@sBeZdZdZddZddZdddZd d Zd d Zd dZ dS)tzicala\ This object is designed to parse an iCalendar-style ``VTIMEZONE`` structure as set out in `RFC 2445`_ Section 4.6.5 into one or more `tzinfo` objects. :param `fileobj`: A file or stream in iCalendar format, which should be UTF-8 encoded with CRLF endings. .. _`RFC 2445`: https://www.ietf.org/rfc/rfc2445.txt c Csjddlmat|tr(||_t|d}nt|dt||_t|}i|_ |}|j |j WdQRXdS)Nr)rrr.) rrrrrrerBr1rg_vtz _parse_rfcr{)rrjZfobjrrrr0ss   ztzical.__init__cCst|jjS)z? Retrieves the available time zones as a list. )rrkeys)rrrrrsz tzical.keysNcCsP|dkrDt|jdkr tdnt|jdkr6tdtt|j}|jj|S)a Retrieve a :py:class:`datetime.tzinfo` object by its ``tzid``. :param tzid: If there is exactly one time zone available, omitting ``tzid`` or passing :py:const:`None` value returns it. Otherwise a valid key (which can be retrieved from :func:`keys`) is required. :raises ValueError: Raised if ``tzid`` is not specified but there are either more or fewer than 1 zone defined. :returns: Returns either a :py:class:`datetime.tzinfo` object representing the relevant time zone or :py:const:`None` if the ``tzid`` was not found. Nrzno timezones definedrz more than one timezone available)rrr}nextiterr`)rrrrrr`s z tzical.getcCs|j}|std|dd kr>d|ddk}|dd}nd}t|dkrzt|dddt|ddd |St|d krt|dddt|ddd t|dd|Std |dS)Nz empty offsetr+-rrnrirsrqzinvalid offset: )rrrzr)rzrr)stripr}rr2)rrsignalrrr _parse_offsets  , <ztzical._parse_offsetcCsH|j}|stdd}xh|t|kr||j}|s>||=q|dkrv|ddkrv||d|dd7<||=q|d7}qWd}g}d}d}x|D]}|sq|jdd\} } | jd} | std| dj} | dd} |r$| d kr(| d)krn td | | }d} d} d}g}d}q@| d kr| dkr|rNtd||s\td|sjtdt|||j|<d}n| |kr| std| dkrtd|dkrtdd}|rtj dj |dddd}t | ||d k||}|j |d}n td| q@|r| dkr2|j |d} n| d*krH|j |n| dkrx| rltd| | df|j | } nj| dkr| rtd | d|j | }n>| d!kr| rtd"| d| }n| d#krn td$| n>| d%kr | rtd&| d| }n| d+krn td$| q| d kr| dkrd}g}d}qWdS),Nz empty stringr rF:;zempty property nameZBEGINSTANDARDDAYLIGHTzunknown component: ZENDZ VTIMEZONEzcomponent not closed: zmandatory TZID not foundz at least one component is neededzmandatory DTSTART not foundz mandatory TZOFFSETFROM not found T)Z compatibleZignoretzcachezinvalid component end: ZDTSTARTRRULERDATEEXRULEEXDATEZ TZOFFSETFROMzunsupported %s parm: %s Z TZOFFSETTOzunsupported TZOFFSETTO parm: ZTZNAMEzunsupported TZNAME parm: COMMENTzunsupported property: ZTZIDzunsupported TZID parm: TZURL LAST-MODIFIED)rr)rrrr)rrr) splitlinesr}rrstripsplitupperrrrZrrulestrrPrrOr)rrlinesrlinerrZinvtzZcomptyper.rRZparmsZ founddtstartrrZ rrulelinesrZrrrrrrrs                            ztzical._parse_rfccCsd|jjt|jfS)Nz%s(%s))rr r1r)rrrrr!+sztzical.__repr__)N) r r"r#r$r0rr`rrr!rrrrrhs  vrZwin32z/etc/localtimer?z/usr/share/zoneinfoz/usr/lib/zoneinfoz/usr/share/lib/zoneinfoz /etc/zoneinfocCsDd}|s,ytjd}Wntk r*YnX|dks<|dkrxtD]v}tjj|s|}x*tD] }tjj||}tjj|r\Pq\WqBtjj|rByt |}PWqBt t t fk rYqBXqBWt }nz|jdr|dd }tjj|r tjj|rt |}nd}n6x2tD]l}tjj||}tjj|sP|jdd}tjj|sPqyt |}PWnt t t fk rzYnXqWd}tdk ry t|}Wntk rd}YnX|sddlm}|j|}|s@xb|D]6}|dkry t|}Wnt k rYnXPqW|d kr.t}n|tjkr@t }|S) NZTZrrrrmr)get_zonefile_instance 0123456789rrrz)rr)renvironKeyErrorTZFILESpathisabsTZPATHSrPisfilerbIOErrorOSErrorr}r3 startswithrr Z WindowsErrorZdateutil.zoneinforr`rr r5r)r.tzfilepathrkrrcrrrgettz:sz                       rcCsZ|dkr |jdkrtd|j}|jdd}|j|djtj|}|jdd}||kS)a Given a datetime and a time zone, determine whether or not a given datetime would fall in a gap. :param dt: A :class:`datetime.datetime` (whose time zone will be ignored if ``tz`` is provided.) :param tz: A :class:`datetime.tzinfo` with support for the ``fold`` attribute. If ``None`` or not provided, the datetime's own time zone will be used. :return: Returns a boolean value whether or not the "wall time" exists in ``tz``. Nz,Datetime is naive and no time zone provided.)r)rr}rZ astimezoner )rrZdt_rtrrrdatetime_existss   rc Cs|dkr |jdkrtd|j}t|dd}|dk rLy |j|SYnX|j|d}t|dd}t|dd}|j|jk}|j|jk}|o| S)a\ Given a datetime and a time zone, determine whether or not a given datetime is ambiguous (i.e if there are two times differentiated only by their DST status). :param dt: A :class:`datetime.datetime` (whose time zone will be ignored if ``tz`` is provided.) :param tz: A :class:`datetime.tzinfo` with support for the ``fold`` attribute. If ``None`` or not provided, the datetime's own time zone will be used. :return: Returns a boolean value whether or not the "wall time" is ambiguous in ``tz``. .. versionadded:: 2.6.0 Nz,Datetime is naive and no time zone provided.r)rr)rAr)rr}rBrrrrr)rrZis_ambiguous_fnZwall_0Zwall_1Z same_offsetZsame_dstrrrdatetime_ambiguouss       rcCst|jddtS)z Convert a :class:`datetime.datetime` object to an epoch timestamp in seconds since January 1, 1970, ignoring the time zone. N)r)rrEPOCH)rrrrr>sr>c@s(eZdZdZddZddZddZdS) rgz^ Class for wrapping contexts so that they are passed through in a with statement. cCs ||_dS)N)context)rrrrrr0sz_ContextWrapper.__init__cCs|jS)N)r)rrrr __enter__sz_ContextWrapper.__enter__cOsdS)Nr)argsrarrr__exit__sz_ContextWrapper.__exit__N)r r"r#r$r0rrrrrrrgsrg)N)N)N)/r$r,r~r5sysrrZsixrZ_commonrrrrrr winr r ImportErrorr-r ZutcfromtimestamprZ toordinalZ EPOCHORDINALrr rr3r&rErVrbrrrrrplatformrrrrrr>rgrrrr s\    8Fv- 5"j RH  J  .tz/__pycache__/tz.cpython-36.pyc000064400000105541147204751220012506 0ustar003 6cY @sdZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z m Z ddl m Z mZddl mZyddlmZmZWnek rdZZYnXejdZejjdZejZGd d d ejZGd d d ejZGd dde ZGdddeZGdddeZ Gddde Z!Gddde Z"Gddde"Z#GdddeZ$Gddde Z%GdddeZ&ej'dkrd d!gZ(d"d#d$d%gZ)ngZ(gZ)d0d&d'Z*d1d(d)Z+d2d*d+Z,d,d-Z-Gd.d/d/eZ.dS)3a{ This module offers timezone implementations subclassing the abstract :py:`datetime.tzinfo` type. There are classes to handle tzfile format files (usually are in :file:`/etc/localtime`, :file:`/usr/share/zoneinfo`, etc), TZ environment string (in all known formats), given ranges (with help from relative deltas), local machine timezone, fixed offset timezone, and UTC timezone. N) string_types)tzname_in_python2_tzinfo_total_seconds) tzrangebaseenfold)_validate_fromutc_inputs)tzwin tzwinlocalc@sbeZdZdZddZddZeddZdd Ze d d Z d d Z dZ ddZ ddZejZdS)tzutczD This is a tzinfo object that represents the UTC time zone. cCstS)N)ZERO)selfdtr/usr/lib/python3.6/tz.py utcoffset$sztzutc.utcoffsetcCstS)N)r )rrrrrdst'sz tzutc.dstcCsdS)NUTCr)rrrrrtzname*sz tzutc.tznamecCsdS)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 Fr)rrrrr is_ambiguous.sztzutc.is_ambiguouscCs|S)z Fast track version of fromutc() returns the original ``dt`` object for any valid :py:class:`datetime.datetime` object. r)rrrrrfromutc>sz tzutc.fromutccCs0t|ttfstSt|tp.t|to.|jtkS)N) isinstancer tzoffsetNotImplemented_offsetr )rotherrrr__eq__Fs z tzutc.__eq__NcCs ||k S)Nr)rrrrr__ne__Osz tzutc.__ne__cCs d|jjS)Nz%s()) __class____name__)rrrr__repr__Rsztzutc.__repr__)r __module__ __qualname____doc__rrrrrr rr__hash__rr!object __reduce__rrrrr s  r c@sjeZdZdZddZddZddZedd Ze d d Z d d Z ddZ dZ ddZddZejZdS)ra1 A simple class for representing a fixed offset from UTC. :param name: The timezone name, to be returned when ``tzname()`` is called. :param offset: The time zone offset in seconds, or (since version 2.6.0, represented as a :py:class:`datetime.timedelta` object. c Cs>||_y t|}Wnttfk r*YnXtj|d|_dS)N)seconds)_namer TypeErrorAttributeErrordatetime timedeltar)rnameoffsetrrr__init__cs  ztzoffset.__init__cCs|jS)N)r)rrrrrrmsztzoffset.utcoffsetcCstS)N)r )rrrrrrpsz tzoffset.dstcCs|jS)N)r))rrrrrrssztzoffset.tznamecCs ||jS)N)r)rrrrrrwsztzoffset.fromutccCsdS)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 Fr)rrrrrr{sztzoffset.is_ambiguouscCst|tstS|j|jkS)N)rrrr)rrrrrrs ztzoffset.__eq__NcCs ||k S)Nr)rrrrrrsztzoffset.__ne__cCs"d|jjt|jtt|jfS)Nz %s(%s, %s))rr reprr)intrr)rrrrr!sztzoffset.__repr__)r r"r#r$r0rrrrr rrrr%rr!r&r'rrrrrXs    rcsxeZdZdZfddZddZddZedd Zd d Z d d Z dddZ ddZ dZ ddZddZejZZS)tzlocalzR A :class:`tzinfo` subclass built around the ``time`` timezone functions. cs`tt|jtjtj d|_tjr:tjtj d|_ n|j|_ |j |j|_ t |j |_ dS)N)r()superr3r0r,r-timetimezone _std_offsetZdaylightZaltzone _dst_offset _dst_savedbool_hasdst)r)rrrr0sztzlocal.__init__cCs,|dkr|jrdS|j|r"|jS|jSdS)N)r;_isdstr8r7)rrrrrrs  ztzlocal.utcoffsetcCs0|dkr|jrdS|j|r(|j|jStSdS)N)r;r<r8r7r )rrrrrrs   z tzlocal.dstcCstj|j|S)N)r5rr<)rrrrrrsztzlocal.tznamecCs$|j|}| o"||j||jkS)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 ) _naive_is_dstr9)rrZ naive_dstrrrrs ztzlocal.is_ambiguouscCst|}tj|tjjS)N)_datetime_to_timestampr5 localtimer6Ztm_isdst)rr timestamprrrr=sztzlocal._naive_is_dstTcCsF|js dS|j|}t|dd}|j|rB|dk r>|j| SdS|S)NFfoldT)r;r=getattrr_fold)rrZ fold_naiveZdstvalrArrrr<s    ztzlocal._isdstcCs&t|tstS|j|jko$|j|jkS)N)rr3rr7r8)rrrrrrs  ztzlocal.__eq__NcCs ||k S)Nr)rrrrrr sztzlocal.__ne__cCs d|jjS)Nz%s())rr )rrrrr!sztzlocal.__repr__)T)r r"r#r$r0rrrrrr=r<rr%rr!r&r' __classcell__rr)rrr3s    (r3c@sReZdZdddddddgZdd Zd d Zd d ZdZddZddZ ddZ dS)_ttinfor/deltaisdstabbrisstdisgmt dstoffsetcCs x|jD]}t||dqWdS)N) __slots__setattr)rattrrrrr0s z_ttinfo.__init__cCsRg}x6|jD],}t||}|dk r |jd|t|fq Wd|jjdj|fS)Nz%s=%sz%s(%s)z, )rLrBappendr1rr join)rlrNvaluerrrr!s   z_ttinfo.__repr__cCsbt|tstS|j|jko`|j|jko`|j|jko`|j|jko`|j|jko`|j|jko`|j |j kS)N) rrErr/rFrGrHrIrJrK)rrrrrr$s       z_ttinfo.__eq__NcCs ||k S)Nr)rrrrrr2sz_ttinfo.__ne__cCs(i}x|jD]}t||d||<q W|S)N)rLrB)rstater.rrr __getstate__5s z_ttinfo.__getstate__cCs,x&|jD]}||krt||||qWdS)N)rLrM)rrSr.rrr __setstate__;s z_ttinfo.__setstate__) r r"r#rLr0r!rr%rrTrUrrrrrEs  rEc@s,eZdZdZdddddddd gZd d Zd S) _tzfilezw Lightweight class for holding the relevant transition and time zone information read from binary tzfiles. trans_listtrans_list_utc trans_idx ttinfo_list ttinfo_std ttinfo_dst ttinfo_before ttinfo_firstcKs(x"|jD]}t|||j|dqWdS)N)attrsrMget)rkwargsrNrrrr0Is z_tzfile.__init__N)r r"r#r$r_r0rrrrrVAs rVcseZdZdZd&fdd ZddZddZd'd d Zd d ZddZ ddZ d(ddZ ddZ ddZ ddZeddZddZdZddZd d!Zd"d#Zd$d%ZZS))tzfilea This is a ``tzinfo`` subclass thant allows one to use the ``tzfile(5)`` format timezone files to extract current and historical zone information. :param fileobj: This can be an opened file stream or a file name that the time zone information can be read from. :param filename: This is an optional parameter specifying the source of the time zone information in the event that ``fileobj`` is a file object. If omitted and ``fileobj`` is a file stream, this parameter will be set either to ``fileobj``'s ``name`` attribute or to ``repr(fileobj)``. See `Sources for Time Zone and Daylight Saving Time Data `_ for more information. Time zone files can be compiled from the `IANA Time Zone database files `_ with the `zic time zone compiler `_ Nc stt|jd}t|tr2||_t|d}d}n.|dk rB||_nt|drV|j|_n t ||_|dk r|stt |}|}|j |}WdQRX|j |dS)NFrbTr.) r4rbr0rr _filenameopenhasattrr.r1_ContextWrapper _read_tzfile _set_tzdata)rfileobjfilenameZfile_opened_hereZ file_streamtzobj)rrrr0ds"     ztzfile.__init__cCs*x$tjD]}t|d|t||qWdS)z= Set the time zone data of this object from a _tzfile object _N)rVr_rMrB)rrlrNrrrri|s ztzfile._set_tzdatacst|jdjdkr td|jdtjd|jd\}}}}}}|rnttjd||j|d_ng_|rtjd||j|_ng_g}x(t |D]} |j tjd |jd qW|j|j} |r|j |d t j |rtjd ||j|} |r"tjd ||j|} g_xt |D]} || \} }}d | dd } t}| |_tjd|_tj| d|_||_| || jd||_|| ko| | dk|_|| ko| | dk|_jj |q2WfddjD_d_d_d_jr؈js$jd__nxt |dddD]V} j| }j r`|j r`|_nj rx|jrx|_jr6jr6Pq6Wjrj rj_x,jD]}|js|_PqWjd_d}g_xltjD]^\} }|js |j}|}n*|dk r*|j||_|j| <|p2d}jj j| |qWd}x~t t t!jD]h} j| }|jr|jp|dks|j||_n|j}t"|jtjstj|jd|_|j| <qhWt#j_t#j_t#j_S)NZTZifzmagic not foundz>6lz>%dlz>%dBz>lbbz>%db<r)r(csg|]}j|qSr)rZ).0idx)outrr sz'tzfile._read_tzfile..rrz)$rVreaddecode ValueErrorstructunpacklistrXrYrangerOseekosSEEK_CURrZrEr/r,r-rKrFrGfindrHrIrJr[r\r]r^rW enumeratereversedlenrtuple)rrjZ ttisgmtcntZ ttisstdcntZleapcntZtimecntZtypecntZcharcntZttinfoirHrIrJZgmtoffrGZabbrindttiZ laststdoffsetr/r)rxrrhs                         ztzfile._read_tzfileFcCs6|js dSt|}|r|jn|j}tj||}|dS)Nr) _trans_listr>Z_trans_list_utcbisectZ bisect_right)rrin_utcr@rWrwrrr_find_last_transition^s  ztzfile._find_last_transitioncCs8|dks|dt|jkr |jS|dkr.|jS|j|S)Nrr)rr _ttinfo_stdZ_ttinfo_before _trans_idx)rrwrrr _get_ttinfoms ztzfile._get_ttinfocCs|j|}|j|S)N)_resolve_ambiguous_timer)rrrwrrr _find_ttinfoxs ztzfile._find_ttinfocCsnt|tjstd|j|k r&td|j|dd}|j|}|tj|jd}|j ||d}t |t |dS)a The ``tzfile`` implementation of :py:func:`datetime.tzinfo.fromutc`. :param dt: A :py:class:`datetime.datetime` object. :raises TypeError: Raised if ``dt`` is not a :py:class:`datetime.datetime` object. :raises ValueError: Raised if this is called with a ``dt`` which does not have this ``tzinfo`` attached. :return: Returns a :py:class:`datetime.datetime` object representing the wall time in ``self``'s time zone. z&fromutc() requires a datetime argumentzdt.tzinfo is not selfT)r)r()rw)rA) rr,r*tzinfor}rrr-r/rrr2)rrrwrZdt_outrArrrr}s   ztzfile.fromutccCsd|dkr|j|}t|}|j|}|dks4|dkr8dS|j|dj|j}|j|}|||kS)a6 Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 NrFr)rr>rr/r)rrrwr@rZodZttrrrrs   ztzfile.is_ambiguouscCsF|j|}|j|}|dks$|dkr(|St| o:|j||}||S)Nr)rrCr2r)rrrwrCZ idx_offsetrrrrs   ztzfile._resolve_ambiguous_timecCs"|dkr dS|jstS|j|jS)N)rr rrF)rrrrrrs ztzfile.utcoffsetcCs0|dkr dS|jstS|j|}|js*tS|jS)N)Z _ttinfo_dstr rrGrK)rrrrrrrs z tzfile.dstcCs |j s|dkrdS|j|jS)N)rrrH)rrrrrrsz tzfile.tznamecCs2t|tstS|j|jko0|j|jko0|j|jkS)N)rrbrrrZ _ttinfo_list)rrrrrrs    z tzfile.__eq__cCs ||k S)Nr)rrrrrrsz tzfile.__ne__cCsd|jjt|jfS)Nz%s(%s))rr r1rd)rrrrr!sztzfile.__repr__cCs |jdS)N) __reduce_ex__)rrrrr'sztzfile.__reduce__cCs|jd|jf|jfS)N)rrd__dict__)rZprotocolrrrrsztzfile.__reduce_ex__)N)F)N)r r"r#r$r0rirhrrrrrrrrrrrr%rr!r'rrDrr)rrrbNs(]  $    rbc@s6eZdZdZd ddZddZddZed d ZdS) tzrangeaQ The ``tzrange`` object is a time zone specified by a set of offsets and abbreviations, equivalent to the way the ``TZ`` variable can be specified in POSIX-like systems, but using Python delta objects to specify DST start, end and offsets. :param stdabbr: The abbreviation for standard time (e.g. ``'EST'``). :param stdoffset: An integer or :class:`datetime.timedelta` object or equivalent specifying the base offset from UTC. If unspecified, +00:00 is used. :param dstabbr: The abbreviation for DST / "Summer" time (e.g. ``'EDT'``). If specified, with no other DST information, DST is assumed to occur and the default behavior or ``dstoffset``, ``start`` and ``end`` is used. If unspecified and no other DST information is specified, it is assumed that this zone has no DST. If this is unspecified and other DST information is *is* specified, DST occurs in the zone but the time zone abbreviation is left unchanged. :param dstoffset: A an integer or :class:`datetime.timedelta` object or equivalent specifying the UTC offset during DST. If unspecified and any other DST information is specified, it is assumed to be the STD offset +1 hour. :param start: A :class:`relativedelta.relativedelta` object or equivalent specifying the time and time of year that daylight savings time starts. To specify, for example, that DST starts at 2AM on the 2nd Sunday in March, pass: ``relativedelta(hours=2, month=3, day=1, weekday=SU(+2))`` If unspecified and any other DST information is specified, the default value is 2 AM on the first Sunday in April. :param end: A :class:`relativedelta.relativedelta` object or equivalent representing the time and time of year that daylight savings time ends, with the same specification method as in ``start``. One note is that this should point to the first time in the *standard* zone, so if a transition occurs at 2AM in the DST zone and the clocks are set back 1 hour to 1AM, set the `hours` parameter to +1. **Examples:** .. testsetup:: tzrange from dateutil.tz import tzrange, tzstr .. doctest:: tzrange >>> tzstr('EST5EDT') == tzrange("EST", -18000, "EDT") True >>> from dateutil.relativedelta import * >>> range1 = tzrange("EST", -18000, "EDT") >>> range2 = tzrange("EST", -18000, "EDT", -14400, ... relativedelta(hours=+2, month=4, day=1, ... weekday=SU(+1)), ... relativedelta(hours=+1, month=10, day=31, ... weekday=SU(-1))) >>> tzstr('EST5EDT') == range1 == range2 True NcCs@ddlma||_||_y t|}Wnttfk r<YnXy t|}Wnttfk rbYnX|dk r|tj|d|_ nt |_ |dk rtj|d|_ n(|r|dk r|j tjd d|_ nt |_ |r|dkrtjd ddtj d d|_ n||_ |r|dkrtjdd d tj dd|_n||_|j |j |_t|j |_dS)Nr) relativedelta)r(r)hoursrn)rmonthdayweekday rrrrrz)dateutilr _std_abbr _dst_abbrrr*r+r,r-r7r r8SU _start_delta _end_delta_dst_base_offset_r:hasdst)rstdabbr stdoffsetdstabbrrKstartendrrrr0Js:     ztzrange.__init__cCs4|js dStj|dd}||j}||j}||fS)a For a given year, get the DST on and off transition times, expressed always on the standard time side. For zones with no transitions, this function returns ``None``. :param year: The year whose transitions you would like to query. :return: Returns a :class:`tuple` of :class:`datetime.datetime` objects, ``(dston, dstoff)`` for zones with an annual DST transition, or ``None`` for fixed offset zones. Nr)rr,rr)rZyearZ base_yearrrrrr transitionsys   ztzrange.transitionscCsVt|tstS|j|jkoT|j|jkoT|j|jkoT|j|jkoT|j|jkoT|j|jkS)N) rrrrrr7r8rr)rrrrrrs      ztzrange.__eq__cCs|jS)N)r)rrrr_dst_base_offsetsztzrange._dst_base_offset)NNNNN) r r"r#r$r0rrpropertyrrrrrrsI - rc@s,eZdZdZd ddZd ddZdd Zd S) tzstra ``tzstr`` objects are time zone objects specified by a time-zone string as it would be passed to a ``TZ`` variable on POSIX-style systems (see the `GNU C Library: TZ Variable`_ for more details). There is one notable exception, which is that POSIX-style time zones use an inverted offset format, so normally ``GMT+3`` would be parsed as an offset 3 hours *behind* GMT. The ``tzstr`` time zone object will parse this as an offset 3 hours *ahead* of GMT. If you would like to maintain the POSIX behavior, pass a ``True`` value to ``posix_offset``. The :class:`tzrange` object provides the same functionality, but is specified using :class:`relativedelta.relativedelta` objects. rather than strings. :param s: A time zone string in ``TZ`` variable format. This can be a :class:`bytes` (2.x: :class:`str`), :class:`str` (2.x: :class:`unicode`) or a stream emitting unicode characters (e.g. :class:`StringIO`). :param posix_offset: Optional. If set to ``True``, interpret strings such as ``GMT+3`` or ``UTC+3`` as being 3 hours *behind* UTC rather than ahead, per the POSIX standard. .. _`GNU C Library: TZ Variable`: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html Fc Csddlma||_tj|}|dkr,td|jd krJ| rJ|jd 9_tj||j|j|j |j ddd|j s~d|_ d|_ n&|j |j|_ |j r|j |jdd |_ t|j |_dS) Nr)parserzunknown string formatGMTrrF)rr)isend)rrrz)rr_sZ_parsetzr}rrrr0rrKrr_deltarrr:r)rsZ posix_offsetresrrrr0s"   ztzstr.__init__rcCs<ddlm}i}|jdk rr|j|d<|jdk r`|j|j|j|d<|jdkrVd|d<qpd|d<q|jr|j|d<n*|jdk r|j|d<n|jdk r|j|d <|s|sd |d<d|d<|jd|d<nd |d<d|d<|jd|d<|j dk r|j |d <nd |d <|r0|j |j }|d |j |j d8<|jf|S)Nr)rrrrrrZyeardayZ nlyeardayrnrr(i iQrrz)rrrrZweekrZydayZjydayrr5r8r7r(Zdays)rxrrrarFrrrrs<               z tzstr._deltacCsd|jjt|jfS)Nz%s(%s))rr r1r)rrrrr!sztzstr.__repr__N)F)r)r r"r#r$r0rr!rrrrrs )rc@seZdZdddZdS)_tzicalvtzcompNcCs@tj|d|_tj|d|_|j|j|_||_||_||_dS)N)r()r,r- tzoffsetfrom tzoffsetto tzoffsetdiffrGrrrule)rrrrGrrrrrr0 s z_tzicalvtzcomp.__init__)NN)r r"r#r0rrrrr srcsZeZdZgffdd ZddZddZddZd d Zed d Z d dZ e j Z Z S) _tzicalvtzcs*tt|j||_||_g|_g|_dS)N)r4rr0_tzid_comps _cachedate _cachecomp)rtzidcomps)rrrr0s z_tzicalvtz.__init__c Cs t|jdkr|jdS|jdd}y|j|jj||j|fStk rTYnXd}d}x4|jD]*}|j||}|rf| s||krf|}|}qfW|sx"|jD]}|j s|}PqW|d}|jj d||j|f|jj d|t|jdkr|jj |jj |S)Nrr)rr) rrreplacerrindexrCr} _find_compdtrGinsertpop)rrZ lastcompdtZlastcompcompcompdtrrr _find_comps4       z_tzicalvtz._find_compcCs2|jtkr|j|r||j8}|jj|dd}|S)NT)Zinc)rr rCrZbefore)rrrrrrrrIs z_tzicalvtz._find_compdtcCs|dkr dS|j|jS)N)rr)rrrrrrQsz_tzicalvtz.utcoffsetcCs|j|}|jr|jStSdS)N)rrGrr )rrrrrrrWs z_tzicalvtz.dstcCs |j|jS)N)rr)rrrrrr^sz_tzicalvtz.tznamecCsdt|jS)Nz)r1r)rrrrr!bsz_tzicalvtz.__repr__)r r"r#r0rrrrrrr!r&r'rDrr)rrrs* rc@sBeZdZdZddZddZdddZd d Zd d Zd dZ dS)tzicala\ This object is designed to parse an iCalendar-style ``VTIMEZONE`` structure as set out in `RFC 2445`_ Section 4.6.5 into one or more `tzinfo` objects. :param `fileobj`: A file or stream in iCalendar format, which should be UTF-8 encoded with CRLF endings. .. _`RFC 2445`: https://www.ietf.org/rfc/rfc2445.txt c Csjddlmat|tr(||_t|d}nt|dt||_t|}i|_ |}|j |j WdQRXdS)Nr)rrr.) rrrrrrerBr1rg_vtz _parse_rfcr{)rrjZfobjrrrr0ss   ztzical.__init__cCst|jjS)z? Retrieves the available time zones as a list. )rrkeys)rrrrrsz tzical.keysNcCsP|dkrDt|jdkr tdnt|jdkr6tdtt|j}|jj|S)a Retrieve a :py:class:`datetime.tzinfo` object by its ``tzid``. :param tzid: If there is exactly one time zone available, omitting ``tzid`` or passing :py:const:`None` value returns it. Otherwise a valid key (which can be retrieved from :func:`keys`) is required. :raises ValueError: Raised if ``tzid`` is not specified but there are either more or fewer than 1 zone defined. :returns: Returns either a :py:class:`datetime.tzinfo` object representing the relevant time zone or :py:const:`None` if the ``tzid`` was not found. Nrzno timezones definedrz more than one timezone available)rrr}nextiterr`)rrrrrr`s z tzical.getcCs|j}|std|dd kr>d|ddk}|dd}nd}t|dkrzt|dddt|ddd |St|d krt|dddt|ddd t|dd|Std |dS)Nz empty offsetr+-rrnrirsrqzinvalid offset: )rrrzr)rzrr)stripr}rr2)rrsignalrrr _parse_offsets  , <ztzical._parse_offsetcCsH|j}|stdd}xh|t|kr||j}|s>||=q|dkrv|ddkrv||d|dd7<||=q|d7}qWd}g}d}d}x|D]}|sq|jdd\} } | jd} | std| dj} | dd} |r$| d kr(| d)krn td | | }d} d} d}g}d}q@| d kr| dkr|rNtd||s\td|sjtdt|||j|<d}n| |kr| std| dkrtd|dkrtdd}|rtj dj |dddd}t | ||d k||}|j |d}n td| q@|r| dkr2|j |d} n| d*krH|j |n| dkrx| rltd| | df|j | } nj| dkr| rtd | d|j | }n>| d!kr| rtd"| d| }n| d#krn td$| n>| d%kr | rtd&| d| }n| d+krn td$| q| d kr| dkrd}g}d}qWdS),Nz empty stringr rF:;zempty property nameZBEGINSTANDARDDAYLIGHTzunknown component: ZENDZ VTIMEZONEzcomponent not closed: zmandatory TZID not foundz at least one component is neededzmandatory DTSTART not foundz mandatory TZOFFSETFROM not found T)Z compatibleZignoretzcachezinvalid component end: ZDTSTARTRRULERDATEEXRULEEXDATEZ TZOFFSETFROMzunsupported %s parm: %s Z TZOFFSETTOzunsupported TZOFFSETTO parm: ZTZNAMEzunsupported TZNAME parm: COMMENTzunsupported property: ZTZIDzunsupported TZID parm: TZURL LAST-MODIFIED)rr)rrrr)rrr) splitlinesr}rrstripsplitupperrrrZrrulestrrPrrOr)rrlinesrlinerrZinvtzZcomptyper.rRZparmsZ founddtstartrrZ rrulelinesrZrrrrrrrs                            ztzical._parse_rfccCsd|jjt|jfS)Nz%s(%s))rr r1r)rrrrr!+sztzical.__repr__)N) r r"r#r$r0rr`rrr!rrrrrhs  vrZwin32z/etc/localtimer?z/usr/share/zoneinfoz/usr/lib/zoneinfoz/usr/share/lib/zoneinfoz /etc/zoneinfocCsDd}|s,ytjd}Wntk r*YnX|dks<|dkrxtD]v}tjj|s|}x*tD] }tjj||}tjj|r\Pq\WqBtjj|rByt |}PWqBt t t fk rYqBXqBWt }nz|jdr|dd }tjj|r tjj|rt |}nd}n6x2tD]l}tjj||}tjj|sP|jdd}tjj|sPqyt |}PWnt t t fk rzYnXqWd}tdk ry t|}Wntk rd}YnX|sddlm}|j|}|s@xb|D]6}|dkry t|}Wnt k rYnXPqW|d kr.t}n|tjkr@t }|S) NZTZrrrrmr)get_zonefile_instance 0123456789rrrz)rr)renvironKeyErrorTZFILESpathisabsTZPATHSrPisfilerbIOErrorOSErrorr}r3 startswithrr Z WindowsErrorZdateutil.zoneinforr`rr r5r)r.tzfilepathrkrrcrrrgettz:sz                       rcCsZ|dkr |jdkrtd|j}|jdd}|j|djtj|}|jdd}||kS)a Given a datetime and a time zone, determine whether or not a given datetime would fall in a gap. :param dt: A :class:`datetime.datetime` (whose time zone will be ignored if ``tz`` is provided.) :param tz: A :class:`datetime.tzinfo` with support for the ``fold`` attribute. If ``None`` or not provided, the datetime's own time zone will be used. :return: Returns a boolean value whether or not the "wall time" exists in ``tz``. Nz,Datetime is naive and no time zone provided.)r)rr}rZ astimezoner )rrZdt_rtrrrdatetime_existss   rc Cs|dkr |jdkrtd|j}t|dd}|dk rLy |j|SYnX|j|d}t|dd}t|dd}|j|jk}|j|jk}|o| S)a\ Given a datetime and a time zone, determine whether or not a given datetime is ambiguous (i.e if there are two times differentiated only by their DST status). :param dt: A :class:`datetime.datetime` (whose time zone will be ignored if ``tz`` is provided.) :param tz: A :class:`datetime.tzinfo` with support for the ``fold`` attribute. If ``None`` or not provided, the datetime's own time zone will be used. :return: Returns a boolean value whether or not the "wall time" is ambiguous in ``tz``. .. versionadded:: 2.6.0 Nz,Datetime is naive and no time zone provided.r)rr)rAr)rr}rBrrrrr)rrZis_ambiguous_fnZwall_0Zwall_1Z same_offsetZsame_dstrrrdatetime_ambiguouss       rcCst|jddtS)z Convert a :class:`datetime.datetime` object to an epoch timestamp in seconds since January 1, 1970, ignoring the time zone. N)r)rrEPOCH)rrrrr>sr>c@s(eZdZdZddZddZddZdS) rgz^ Class for wrapping contexts so that they are passed through in a with statement. cCs ||_dS)N)context)rrrrrr0sz_ContextWrapper.__init__cCs|jS)N)r)rrrr __enter__sz_ContextWrapper.__enter__cOsdS)Nr)argsrarrr__exit__sz_ContextWrapper.__exit__N)r r"r#r$r0rrrrrrrgsrg)N)N)N)/r$r,r~r5sysrrZsixrZ_commonrrrrrr winr r ImportErrorr-r ZutcfromtimestamprZ toordinalZ EPOCHORDINALrr rr3r&rErVrbrrrrrplatformrrrrrr>rgrrrr s\    8Fv- 5"j RH  J  .tz/__pycache__/win.cpython-36.opt-1.pyc000064400000022344147204751220013604 0ustar003 6cY, @sddlZddlZddlmZddlmZyddlZddlmZWnek r\e dYnXddl m Z dd d gZ ej d Zd Zd ZdZddZeZGdd d eZGddde ZGdddeZGdd d eZddZddZdS)N)winreg) text_type)wintypesz#Running tzwin on non-Windows system) tzrangebasetzwin tzwinlocaltzresz7SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zonesz4SOFTWARE\Microsoft\Windows\CurrentVersion\Time Zonesz4SYSTEM\CurrentControlSet\Control\TimeZoneInformationc CsLtjdtj}ytj|tjt}Wntk r>t}YnX|j|S)N)rConnectRegistryHKEY_LOCAL_MACHINEOpenKey TZKEYNAMENTZCloseZ WindowsError TZKEYNAME9X)handle TZKEYNAMEr/usr/lib/python3.6/win.py _settzkeynames rc@s6eZdZdZejejZd ddZ ddZ ddZ d S) r z{ Class for accessing `tzres.dll`, which contains timezone name related resources. .. versionadded:: 2.5.0 tzres.dllcCs@tjd}tjtjtjtjf|j_|j|_tj||_ ||_ dS)Nuser32) ctypesZWinDLLrZ HINSTANCEZUINTLPWSTRZc_int LoadStringWZargtypes_tzres tzres_loc)selfrrrrr__init__1s   ztzres.__init__cCs<|j}tjtj|tj}|j|jj||d}|d|S)a Load a timezone name from a DLL offset (integer). >>> from dateutil.tzwin import tzres >>> tzr = tzres() >>> print(tzr.load_name(112)) 'Eastern Standard Time' :param offset: A positive integer value referring to a string from the tzres dll. ..note: Offsets found in the registry are generally of the form `@tzres.dll,-114`. The offset in this case if 114, not -114. rN) p_wcharrcastZbyrefrrrrZ_handle)roffsetZresourceZlpBufferZncharrrr load_name?sztzres.load_namec CsH|jds|S|jd}yt|d}WntdYnX|j|S)a Parse strings as returned from the Windows registry into the time zone name as defined in the registry. >>> from dateutil.tzwin import tzres >>> tzr = tzres() >>> print(tzr.name_from_string('@tzres.dll,-251')) 'Dateline Daylight Time' >>> print(tzr.name_from_string('Eastern Standard Time')) 'Eastern Standard Time' :param tzname_str: A timezone name string as returned from a Windows registry key. :return: Returns the localized timezone string from tzres.dll if the string is of the form `@tzres.dll,-offset`, else returns the input string. @z,-rzMalformed timezone string.) startswithsplitint ValueErrorr!)rZ tzname_strZ name_spltr rrrname_from_stringUs  ztzres.name_from_stringN)r) __name__ __module__ __qualname____doc__rZPOINTERrZWCHARrrr!r'rrrrr (s   c@sPeZdZdZddZddZeddZdd Zd d Z d d Z e ddZ dS) tzwinbasezBtzinfo class based on win32's timezones available in the registry.cCs tddS)Nz#tzwinbase is an abstract base class)NotImplementedError)rrrrrvsztzwinbase.__init__cCst|tstS|j|jko|j|jko|j|jko|j|jko|j|jko|j|jko|j |j ko|j |j ko|j |j ko|j |j ko|j |j ko|j|jkS)N) isinstancer,NotImplemented _std_offset _dst_offset _stddayofweek _dstdayofweek_stdweeknumber_dstweeknumber_stdhour_dsthour _stdminute _dstminute _std_abbr _dst_abbr)rotherrrr__eq__ys            ztzwinbase.__eq__csVtjdtj>}tj|t&fddttjdD}WdQRXWdQRX|S)z4Return a list of all time zones known to the system.Ncsg|]}tj|qSr)rZEnumKey).0i)tzkeyrr sz"tzwinbase.list..r)rr r r rrange QueryInfoKey)rresultr)r@rlists  *ztzwinbase.listcCs|jS)N)_display)rrrrdisplaysztzwinbase.displaycCsT|js dSt||j|j|j|j|j}t||j|j|j |j |j }||j 8}||fS)a For a given year, get the DST on and off transition times, expressed always on the standard time side. For zones with no transitions, this function returns ``None``. :param year: The year whose transitions you would like to query. :return: Returns a :class:`tuple` of :class:`datetime.datetime` objects, ``(dston, dstoff)`` for zones with an annual DST transition, or ``None`` for fixed offset zones. N) hasdstpicknthweekday _dstmonthr3r7r9r5 _stdmonthr2r6r8r4_dst_base_offset)ryearZdstonZdstoffrrr transitionss   ztzwinbase.transitionscCs |jdkS)Nr)rJ)rrrr _get_hasdstsztzwinbase._get_hasdstcCs|jS)N)_dst_base_offset_)rrrrrLsztzwinbase._dst_base_offsetN) r(r)r*r+rr= staticmethodrErGrNrOpropertyrLrrrrr,ts r,c@s$eZdZddZddZddZdS)rc Cs||_tjdtj8}tdjt|d}tj||}t|}WdQRXWdQRX|d|_ |d|_ |d|_ t j d|d}|d |d }||d }tj|d |_tj|d |_|d d \|_|_|_|_|_|dd\|_|_|_|_|_|j|j|_|j|_dS)Nz {kn}\{name})knnameZStdZDltDisplayz=3l16hZTZIrr)minutes )_namerr r rformatrr valuestodictr:r;rFstructunpackdatetime timedeltar0r1rKr2r4r6r8rJr3r5r7r9rPrOrH) rrTr tzkeynamer@keydicttup stdoffset dstoffsetrrrrs"      ztzwin.__init__cCsdt|jS)Nz tzwin(%s))reprr\)rrrr__repr__sztzwin.__repr__cCs|j|jffS)N) __class__r\)rrrr __reduce__sztzwin.__reduce__N)r(r)r*rrirkrrrrrs&c@s,eZdZddZddZddZddZd S) rc Csntjdtj}tj|t}t|}WdQRX|d|_|d|_yBtdj t |jd}tj||}t|}|d|_ WdQRXWnt k rd|_ YnXWdQRX|d |d}||d}t j|d |_t j|d |_tjd |d } | d d \|_|_|_|_| d|_tjd |d} | d d \|_|_|_|_| d|_|j|j|_|j|_dS)NZ StandardNameZ DaylightNamez {kn}\{sn})rSZsnrUZBiasZ StandardBiasZ DaylightBias)rWz=8hZ StandardStartrr Z DaylightStart) rr r r TZLOCALKEYNAMEr^r:r;rr]rrFOSErrorrarbr0r1r_r`rKr4r6r8r2rJr5r7r9r3rPrOrH) rrZ tzlocalkeyrdrcr@Z_keydictrfrgrerrrrs2       ztzwinlocal.__init__cCsdS)Nz tzwinlocal()r)rrrrrisztzwinlocal.__repr__cCsdt|jS)Nztzwinlocal(%s))rhr:)rrrr__str__sztzwinlocal.__str__cCs |jffS)N)rj)rrrrrk#sztzwinlocal.__reduce__N)r(r)r*rrirorkrrrrrs.c CsTtj||d||}|j||jddd}||dt}|j|krP|t8}|S)z> dayofweek == 0 means Sunday, whichweek 5 means last instance rr )Zday)rareplaceZ isoweekdayONEWEEKmonth) rMrrZ dayofweekZhourZminuteZ whichweekfirstZ weekdayoneZwdrrrrI's  rIcCsi}tj|d}d}xt|D]v}tj||\}}}|tjksJ|tjkr\|d@r|d}n2|tjkr|jdr|pxt}|j |}|j d}|||<q W|S) z0Convert a registry key's values to a dictionary.rN z@tzresll) rrCrBZ EnumValueZ REG_DWORDZREG_DWORD_LITTLE_ENDIANZREG_SZr#r r'rstrip)keyZdoutsizeZtz_resr?Zkey_namevalueZdtyperrrr^5s       r^)rar_Z six.movesrZsixrrrr& ImportErrorZ_commonr__all__rbrqrrrmrrobjectr r,rrrIr^rrrrs,      LJ/:tz/__pycache__/win.cpython-36.pyc000064400000022344147204751220012645 0ustar003 6cY, @sddlZddlZddlmZddlmZyddlZddlmZWnek r\e dYnXddl m Z dd d gZ ej d Zd Zd ZdZddZeZGdd d eZGddde ZGdddeZGdd d eZddZddZdS)N)winreg) text_type)wintypesz#Running tzwin on non-Windows system) tzrangebasetzwin tzwinlocaltzresz7SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zonesz4SOFTWARE\Microsoft\Windows\CurrentVersion\Time Zonesz4SYSTEM\CurrentControlSet\Control\TimeZoneInformationc CsLtjdtj}ytj|tjt}Wntk r>t}YnX|j|S)N)rConnectRegistryHKEY_LOCAL_MACHINEOpenKey TZKEYNAMENTZCloseZ WindowsError TZKEYNAME9X)handle TZKEYNAMEr/usr/lib/python3.6/win.py _settzkeynames rc@s6eZdZdZejejZd ddZ ddZ ddZ d S) r z{ Class for accessing `tzres.dll`, which contains timezone name related resources. .. versionadded:: 2.5.0 tzres.dllcCs@tjd}tjtjtjtjf|j_|j|_tj||_ ||_ dS)Nuser32) ctypesZWinDLLrZ HINSTANCEZUINTLPWSTRZc_int LoadStringWZargtypes_tzres tzres_loc)selfrrrrr__init__1s   ztzres.__init__cCs<|j}tjtj|tj}|j|jj||d}|d|S)a Load a timezone name from a DLL offset (integer). >>> from dateutil.tzwin import tzres >>> tzr = tzres() >>> print(tzr.load_name(112)) 'Eastern Standard Time' :param offset: A positive integer value referring to a string from the tzres dll. ..note: Offsets found in the registry are generally of the form `@tzres.dll,-114`. The offset in this case if 114, not -114. rN) p_wcharrcastZbyrefrrrrZ_handle)roffsetZresourceZlpBufferZncharrrr load_name?sztzres.load_namec CsH|jds|S|jd}yt|d}WntdYnX|j|S)a Parse strings as returned from the Windows registry into the time zone name as defined in the registry. >>> from dateutil.tzwin import tzres >>> tzr = tzres() >>> print(tzr.name_from_string('@tzres.dll,-251')) 'Dateline Daylight Time' >>> print(tzr.name_from_string('Eastern Standard Time')) 'Eastern Standard Time' :param tzname_str: A timezone name string as returned from a Windows registry key. :return: Returns the localized timezone string from tzres.dll if the string is of the form `@tzres.dll,-offset`, else returns the input string. @z,-rzMalformed timezone string.) startswithsplitint ValueErrorr!)rZ tzname_strZ name_spltr rrrname_from_stringUs  ztzres.name_from_stringN)r) __name__ __module__ __qualname____doc__rZPOINTERrZWCHARrrr!r'rrrrr (s   c@sPeZdZdZddZddZeddZdd Zd d Z d d Z e ddZ dS) tzwinbasezBtzinfo class based on win32's timezones available in the registry.cCs tddS)Nz#tzwinbase is an abstract base class)NotImplementedError)rrrrrvsztzwinbase.__init__cCst|tstS|j|jko|j|jko|j|jko|j|jko|j|jko|j|jko|j |j ko|j |j ko|j |j ko|j |j ko|j |j ko|j|jkS)N) isinstancer,NotImplemented _std_offset _dst_offset _stddayofweek _dstdayofweek_stdweeknumber_dstweeknumber_stdhour_dsthour _stdminute _dstminute _std_abbr _dst_abbr)rotherrrr__eq__ys            ztzwinbase.__eq__csVtjdtj>}tj|t&fddttjdD}WdQRXWdQRX|S)z4Return a list of all time zones known to the system.Ncsg|]}tj|qSr)rZEnumKey).0i)tzkeyrr sz"tzwinbase.list..r)rr r r rrange QueryInfoKey)rresultr)r@rlists  *ztzwinbase.listcCs|jS)N)_display)rrrrdisplaysztzwinbase.displaycCsT|js dSt||j|j|j|j|j}t||j|j|j |j |j }||j 8}||fS)a For a given year, get the DST on and off transition times, expressed always on the standard time side. For zones with no transitions, this function returns ``None``. :param year: The year whose transitions you would like to query. :return: Returns a :class:`tuple` of :class:`datetime.datetime` objects, ``(dston, dstoff)`` for zones with an annual DST transition, or ``None`` for fixed offset zones. N) hasdstpicknthweekday _dstmonthr3r7r9r5 _stdmonthr2r6r8r4_dst_base_offset)ryearZdstonZdstoffrrr transitionss   ztzwinbase.transitionscCs |jdkS)Nr)rJ)rrrr _get_hasdstsztzwinbase._get_hasdstcCs|jS)N)_dst_base_offset_)rrrrrLsztzwinbase._dst_base_offsetN) r(r)r*r+rr= staticmethodrErGrNrOpropertyrLrrrrr,ts r,c@s$eZdZddZddZddZdS)rc Cs||_tjdtj8}tdjt|d}tj||}t|}WdQRXWdQRX|d|_ |d|_ |d|_ t j d|d}|d |d }||d }tj|d |_tj|d |_|d d \|_|_|_|_|_|dd\|_|_|_|_|_|j|j|_|j|_dS)Nz {kn}\{name})knnameZStdZDltDisplayz=3l16hZTZIrr)minutes )_namerr r rformatrr valuestodictr:r;rFstructunpackdatetime timedeltar0r1rKr2r4r6r8rJr3r5r7r9rPrOrH) rrTr tzkeynamer@keydicttup stdoffset dstoffsetrrrrs"      ztzwin.__init__cCsdt|jS)Nz tzwin(%s))reprr\)rrrr__repr__sztzwin.__repr__cCs|j|jffS)N) __class__r\)rrrr __reduce__sztzwin.__reduce__N)r(r)r*rrirkrrrrrs&c@s,eZdZddZddZddZddZd S) rc Csntjdtj}tj|t}t|}WdQRX|d|_|d|_yBtdj t |jd}tj||}t|}|d|_ WdQRXWnt k rd|_ YnXWdQRX|d |d}||d}t j|d |_t j|d |_tjd |d } | d d \|_|_|_|_| d|_tjd |d} | d d \|_|_|_|_| d|_|j|j|_|j|_dS)NZ StandardNameZ DaylightNamez {kn}\{sn})rSZsnrUZBiasZ StandardBiasZ DaylightBias)rWz=8hZ StandardStartrr Z DaylightStart) rr r r TZLOCALKEYNAMEr^r:r;rr]rrFOSErrorrarbr0r1r_r`rKr4r6r8r2rJr5r7r9r3rPrOrH) rrZ tzlocalkeyrdrcr@Z_keydictrfrgrerrrrs2       ztzwinlocal.__init__cCsdS)Nz tzwinlocal()r)rrrrrisztzwinlocal.__repr__cCsdt|jS)Nztzwinlocal(%s))rhr:)rrrr__str__sztzwinlocal.__str__cCs |jffS)N)rj)rrrrrk#sztzwinlocal.__reduce__N)r(r)r*rrirorkrrrrrs.c CsTtj||d||}|j||jddd}||dt}|j|krP|t8}|S)z> dayofweek == 0 means Sunday, whichweek 5 means last instance rr )Zday)rareplaceZ isoweekdayONEWEEKmonth) rMrrZ dayofweekZhourZminuteZ whichweekfirstZ weekdayoneZwdrrrrI's  rIcCsi}tj|d}d}xt|D]v}tj||\}}}|tjksJ|tjkr\|d@r|d}n2|tjkr|jdr|pxt}|j |}|j d}|||<q W|S) z0Convert a registry key's values to a dictionary.rN z@tzresll) rrCrBZ EnumValueZ REG_DWORDZREG_DWORD_LITTLE_ENDIANZREG_SZr#r r'rstrip)keyZdoutsizeZtz_resr?Zkey_namevalueZdtyperrrr^5s       r^)rar_Z six.movesrZsixrrrr& ImportErrorZ_commonr__all__rbrqrrrmrrobjectr r,rrrIr^rrrrs,      LJ/:tz/__init__.py000064400000000317147204751220007317 0ustar00from .tz import * __all__ = ["tzutc", "tzoffset", "tzlocal", "tzfile", "tzrange", "tzstr", "tzical", "tzwin", "tzwinlocal", "gettz", "enfold", "datetime_ambiguous", "datetime_exists"] tz/_common.py000064400000027326147204751220007220 0ustar00from six import PY3 from functools import wraps from datetime import datetime, timedelta, tzinfo ZERO = timedelta(0) __all__ = ['tzname_in_python2', 'enfold'] def tzname_in_python2(namefunc): """Change unicode output into bytestrings in Python 2 tzname() API changed in Python 3. It used to return bytes, but was changed to unicode strings """ def adjust_encoding(*args, **kwargs): name = namefunc(*args, **kwargs) if name is not None and not PY3: name = name.encode() return name return adjust_encoding # The following is adapted from Alexander Belopolsky's tz library # https://github.com/abalkin/tz if hasattr(datetime, 'fold'): # This is the pre-python 3.6 fold situation def enfold(dt, fold=1): """ Provides a unified interface for assigning the ``fold`` attribute to datetimes both before and after the implementation of PEP-495. :param fold: The value for the ``fold`` attribute in the returned datetime. This should be either 0 or 1. :return: Returns an object for which ``getattr(dt, 'fold', 0)`` returns ``fold`` for all versions of Python. In versions prior to Python 3.6, this is a ``_DatetimeWithFold`` object, which is a subclass of :py:class:`datetime.datetime` with the ``fold`` attribute added, if ``fold`` is 1. .. versionadded:: 2.6.0 """ return dt.replace(fold=fold) else: class _DatetimeWithFold(datetime): """ This is a class designed to provide a PEP 495-compliant interface for Python versions before 3.6. It is used only for dates in a fold, so the ``fold`` attribute is fixed at ``1``. .. versionadded:: 2.6.0 """ __slots__ = () @property def fold(self): return 1 def enfold(dt, fold=1): """ Provides a unified interface for assigning the ``fold`` attribute to datetimes both before and after the implementation of PEP-495. :param fold: The value for the ``fold`` attribute in the returned datetime. This should be either 0 or 1. :return: Returns an object for which ``getattr(dt, 'fold', 0)`` returns ``fold`` for all versions of Python. In versions prior to Python 3.6, this is a ``_DatetimeWithFold`` object, which is a subclass of :py:class:`datetime.datetime` with the ``fold`` attribute added, if ``fold`` is 1. .. versionadded:: 2.6.0 """ if getattr(dt, 'fold', 0) == fold: return dt args = dt.timetuple()[:6] args += (dt.microsecond, dt.tzinfo) if fold: return _DatetimeWithFold(*args) else: return datetime(*args) def _validate_fromutc_inputs(f): """ The CPython version of ``fromutc`` checks that the input is a ``datetime`` object and that ``self`` is attached as its ``tzinfo``. """ @wraps(f) def fromutc(self, dt): if not isinstance(dt, datetime): raise TypeError("fromutc() requires a datetime argument") if dt.tzinfo is not self: raise ValueError("dt.tzinfo is not self") return f(self, dt) return fromutc class _tzinfo(tzinfo): """ Base class for all ``dateutil`` ``tzinfo`` objects. """ def is_ambiguous(self, dt): """ Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 """ dt = dt.replace(tzinfo=self) wall_0 = enfold(dt, fold=0) wall_1 = enfold(dt, fold=1) same_offset = wall_0.utcoffset() == wall_1.utcoffset() same_dt = wall_0.replace(tzinfo=None) == wall_1.replace(tzinfo=None) return same_dt and not same_offset def _fold_status(self, dt_utc, dt_wall): """ Determine the fold status of a "wall" datetime, given a representation of the same datetime as a (naive) UTC datetime. This is calculated based on the assumption that ``dt.utcoffset() - dt.dst()`` is constant for all datetimes, and that this offset is the actual number of hours separating ``dt_utc`` and ``dt_wall``. :param dt_utc: Representation of the datetime as UTC :param dt_wall: Representation of the datetime as "wall time". This parameter must either have a `fold` attribute or have a fold-naive :class:`datetime.tzinfo` attached, otherwise the calculation may fail. """ if self.is_ambiguous(dt_wall): delta_wall = dt_wall - dt_utc _fold = int(delta_wall == (dt_utc.utcoffset() - dt_utc.dst())) else: _fold = 0 return _fold def _fold(self, dt): return getattr(dt, 'fold', 0) def _fromutc(self, dt): """ Given a timezone-aware datetime in a given timezone, calculates a timezone-aware datetime in a new timezone. Since this is the one time that we *know* we have an unambiguous datetime object, we take this opportunity to determine whether the datetime is ambiguous and in a "fold" state (e.g. if it's the first occurence, chronologically, of the ambiguous datetime). :param dt: A timezone-aware :class:`datetime.datetime` object. """ # Re-implement the algorithm from Python's datetime.py dtoff = dt.utcoffset() if dtoff is None: raise ValueError("fromutc() requires a non-None utcoffset() " "result") # The original datetime.py code assumes that `dst()` defaults to # zero during ambiguous times. PEP 495 inverts this presumption, so # for pre-PEP 495 versions of python, we need to tweak the algorithm. dtdst = dt.dst() if dtdst is None: raise ValueError("fromutc() requires a non-None dst() result") delta = dtoff - dtdst dt += delta # Set fold=1 so we can default to being in the fold for # ambiguous dates. dtdst = enfold(dt, fold=1).dst() if dtdst is None: raise ValueError("fromutc(): dt.dst gave inconsistent " "results; cannot convert") return dt + dtdst @_validate_fromutc_inputs def fromutc(self, dt): """ Given a timezone-aware datetime in a given timezone, calculates a timezone-aware datetime in a new timezone. Since this is the one time that we *know* we have an unambiguous datetime object, we take this opportunity to determine whether the datetime is ambiguous and in a "fold" state (e.g. if it's the first occurance, chronologically, of the ambiguous datetime). :param dt: A timezone-aware :class:`datetime.datetime` object. """ dt_wall = self._fromutc(dt) # Calculate the fold status given the two datetimes. _fold = self._fold_status(dt, dt_wall) # Set the default fold value for ambiguous dates return enfold(dt_wall, fold=_fold) class tzrangebase(_tzinfo): """ This is an abstract base class for time zones represented by an annual transition into and out of DST. Child classes should implement the following methods: * ``__init__(self, *args, **kwargs)`` * ``transitions(self, year)`` - this is expected to return a tuple of datetimes representing the DST on and off transitions in standard time. A fully initialized ``tzrangebase`` subclass should also provide the following attributes: * ``hasdst``: Boolean whether or not the zone uses DST. * ``_dst_offset`` / ``_std_offset``: :class:`datetime.timedelta` objects representing the respective UTC offsets. * ``_dst_abbr`` / ``_std_abbr``: Strings representing the timezone short abbreviations in DST and STD, respectively. * ``_hasdst``: Whether or not the zone has DST. .. versionadded:: 2.6.0 """ def __init__(self): raise NotImplementedError('tzrangebase is an abstract base class') def utcoffset(self, dt): isdst = self._isdst(dt) if isdst is None: return None elif isdst: return self._dst_offset else: return self._std_offset def dst(self, dt): isdst = self._isdst(dt) if isdst is None: return None elif isdst: return self._dst_base_offset else: return ZERO @tzname_in_python2 def tzname(self, dt): if self._isdst(dt): return self._dst_abbr else: return self._std_abbr def fromutc(self, dt): """ Given a datetime in UTC, return local time """ if not isinstance(dt, datetime): raise TypeError("fromutc() requires a datetime argument") if dt.tzinfo is not self: raise ValueError("dt.tzinfo is not self") # Get transitions - if there are none, fixed offset transitions = self.transitions(dt.year) if transitions is None: return dt + self.utcoffset(dt) # Get the transition times in UTC dston, dstoff = transitions dston -= self._std_offset dstoff -= self._std_offset utc_transitions = (dston, dstoff) dt_utc = dt.replace(tzinfo=None) isdst = self._naive_isdst(dt_utc, utc_transitions) if isdst: dt_wall = dt + self._dst_offset else: dt_wall = dt + self._std_offset _fold = int(not isdst and self.is_ambiguous(dt_wall)) return enfold(dt_wall, fold=_fold) def is_ambiguous(self, dt): """ Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 """ if not self.hasdst: return False start, end = self.transitions(dt.year) dt = dt.replace(tzinfo=None) return (end <= dt < end + self._dst_base_offset) def _isdst(self, dt): if not self.hasdst: return False elif dt is None: return None transitions = self.transitions(dt.year) if transitions is None: return False dt = dt.replace(tzinfo=None) isdst = self._naive_isdst(dt, transitions) # Handle ambiguous dates if not isdst and self.is_ambiguous(dt): return not self._fold(dt) else: return isdst def _naive_isdst(self, dt, transitions): dston, dstoff = transitions dt = dt.replace(tzinfo=None) if dston < dstoff: isdst = dston <= dt < dstoff else: isdst = not dstoff <= dt < dston return isdst @property def _dst_base_offset(self): return self._dst_offset - self._std_offset __hash__ = None def __ne__(self, other): return not (self == other) def __repr__(self): return "%s(...)" % self.__class__.__name__ __reduce__ = object.__reduce__ def _total_seconds(td): # Python 2.6 doesn't have a total_seconds() method on timedelta objects return ((td.seconds + td.days * 86400) * 1000000 + td.microseconds) // 1000000 _total_seconds = getattr(timedelta, 'total_seconds', _total_seconds) tz/tz.py000064400000142622147204751220006223 0ustar00# -*- coding: utf-8 -*- """ This module offers timezone implementations subclassing the abstract :py:`datetime.tzinfo` type. There are classes to handle tzfile format files (usually are in :file:`/etc/localtime`, :file:`/usr/share/zoneinfo`, etc), TZ environment string (in all known formats), given ranges (with help from relative deltas), local machine timezone, fixed offset timezone, and UTC timezone. """ import datetime import struct import time import sys import os import bisect from six import string_types from ._common import tzname_in_python2, _tzinfo, _total_seconds from ._common import tzrangebase, enfold from ._common import _validate_fromutc_inputs try: from .win import tzwin, tzwinlocal except ImportError: tzwin = tzwinlocal = None ZERO = datetime.timedelta(0) EPOCH = datetime.datetime.utcfromtimestamp(0) EPOCHORDINAL = EPOCH.toordinal() class tzutc(datetime.tzinfo): """ This is a tzinfo object that represents the UTC time zone. """ def utcoffset(self, dt): return ZERO def dst(self, dt): return ZERO @tzname_in_python2 def tzname(self, dt): return "UTC" def is_ambiguous(self, dt): """ Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 """ return False @_validate_fromutc_inputs def fromutc(self, dt): """ Fast track version of fromutc() returns the original ``dt`` object for any valid :py:class:`datetime.datetime` object. """ return dt def __eq__(self, other): if not isinstance(other, (tzutc, tzoffset)): return NotImplemented return (isinstance(other, tzutc) or (isinstance(other, tzoffset) and other._offset == ZERO)) __hash__ = None def __ne__(self, other): return not (self == other) def __repr__(self): return "%s()" % self.__class__.__name__ __reduce__ = object.__reduce__ class tzoffset(datetime.tzinfo): """ A simple class for representing a fixed offset from UTC. :param name: The timezone name, to be returned when ``tzname()`` is called. :param offset: The time zone offset in seconds, or (since version 2.6.0, represented as a :py:class:`datetime.timedelta` object. """ def __init__(self, name, offset): self._name = name try: # Allow a timedelta offset = _total_seconds(offset) except (TypeError, AttributeError): pass self._offset = datetime.timedelta(seconds=offset) def utcoffset(self, dt): return self._offset def dst(self, dt): return ZERO @tzname_in_python2 def tzname(self, dt): return self._name @_validate_fromutc_inputs def fromutc(self, dt): return dt + self._offset def is_ambiguous(self, dt): """ Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 """ return False def __eq__(self, other): if not isinstance(other, tzoffset): return NotImplemented return self._offset == other._offset __hash__ = None def __ne__(self, other): return not (self == other) def __repr__(self): return "%s(%s, %s)" % (self.__class__.__name__, repr(self._name), int(_total_seconds(self._offset))) __reduce__ = object.__reduce__ class tzlocal(_tzinfo): """ A :class:`tzinfo` subclass built around the ``time`` timezone functions. """ def __init__(self): super(tzlocal, self).__init__() self._std_offset = datetime.timedelta(seconds=-time.timezone) if time.daylight: self._dst_offset = datetime.timedelta(seconds=-time.altzone) else: self._dst_offset = self._std_offset self._dst_saved = self._dst_offset - self._std_offset self._hasdst = bool(self._dst_saved) def utcoffset(self, dt): if dt is None and self._hasdst: return None if self._isdst(dt): return self._dst_offset else: return self._std_offset def dst(self, dt): if dt is None and self._hasdst: return None if self._isdst(dt): return self._dst_offset - self._std_offset else: return ZERO @tzname_in_python2 def tzname(self, dt): return time.tzname[self._isdst(dt)] def is_ambiguous(self, dt): """ Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 """ naive_dst = self._naive_is_dst(dt) return (not naive_dst and (naive_dst != self._naive_is_dst(dt - self._dst_saved))) def _naive_is_dst(self, dt): timestamp = _datetime_to_timestamp(dt) return time.localtime(timestamp + time.timezone).tm_isdst def _isdst(self, dt, fold_naive=True): # We can't use mktime here. It is unstable when deciding if # the hour near to a change is DST or not. # # timestamp = time.mktime((dt.year, dt.month, dt.day, dt.hour, # dt.minute, dt.second, dt.weekday(), 0, -1)) # return time.localtime(timestamp).tm_isdst # # The code above yields the following result: # # >>> import tz, datetime # >>> t = tz.tzlocal() # >>> datetime.datetime(2003,2,15,23,tzinfo=t).tzname() # 'BRDT' # >>> datetime.datetime(2003,2,16,0,tzinfo=t).tzname() # 'BRST' # >>> datetime.datetime(2003,2,15,23,tzinfo=t).tzname() # 'BRST' # >>> datetime.datetime(2003,2,15,22,tzinfo=t).tzname() # 'BRDT' # >>> datetime.datetime(2003,2,15,23,tzinfo=t).tzname() # 'BRDT' # # Here is a more stable implementation: # if not self._hasdst: return False # Check for ambiguous times: dstval = self._naive_is_dst(dt) fold = getattr(dt, 'fold', None) if self.is_ambiguous(dt): if fold is not None: return not self._fold(dt) else: return True return dstval def __eq__(self, other): if not isinstance(other, tzlocal): return NotImplemented return (self._std_offset == other._std_offset and self._dst_offset == other._dst_offset) __hash__ = None def __ne__(self, other): return not (self == other) def __repr__(self): return "%s()" % self.__class__.__name__ __reduce__ = object.__reduce__ class _ttinfo(object): __slots__ = ["offset", "delta", "isdst", "abbr", "isstd", "isgmt", "dstoffset"] def __init__(self): for attr in self.__slots__: setattr(self, attr, None) def __repr__(self): l = [] for attr in self.__slots__: value = getattr(self, attr) if value is not None: l.append("%s=%s" % (attr, repr(value))) return "%s(%s)" % (self.__class__.__name__, ", ".join(l)) def __eq__(self, other): if not isinstance(other, _ttinfo): return NotImplemented return (self.offset == other.offset and self.delta == other.delta and self.isdst == other.isdst and self.abbr == other.abbr and self.isstd == other.isstd and self.isgmt == other.isgmt and self.dstoffset == other.dstoffset) __hash__ = None def __ne__(self, other): return not (self == other) def __getstate__(self): state = {} for name in self.__slots__: state[name] = getattr(self, name, None) return state def __setstate__(self, state): for name in self.__slots__: if name in state: setattr(self, name, state[name]) class _tzfile(object): """ Lightweight class for holding the relevant transition and time zone information read from binary tzfiles. """ attrs = ['trans_list', 'trans_list_utc', 'trans_idx', 'ttinfo_list', 'ttinfo_std', 'ttinfo_dst', 'ttinfo_before', 'ttinfo_first'] def __init__(self, **kwargs): for attr in self.attrs: setattr(self, attr, kwargs.get(attr, None)) class tzfile(_tzinfo): """ This is a ``tzinfo`` subclass thant allows one to use the ``tzfile(5)`` format timezone files to extract current and historical zone information. :param fileobj: This can be an opened file stream or a file name that the time zone information can be read from. :param filename: This is an optional parameter specifying the source of the time zone information in the event that ``fileobj`` is a file object. If omitted and ``fileobj`` is a file stream, this parameter will be set either to ``fileobj``'s ``name`` attribute or to ``repr(fileobj)``. See `Sources for Time Zone and Daylight Saving Time Data `_ for more information. Time zone files can be compiled from the `IANA Time Zone database files `_ with the `zic time zone compiler `_ """ def __init__(self, fileobj, filename=None): super(tzfile, self).__init__() file_opened_here = False if isinstance(fileobj, string_types): self._filename = fileobj fileobj = open(fileobj, 'rb') file_opened_here = True elif filename is not None: self._filename = filename elif hasattr(fileobj, "name"): self._filename = fileobj.name else: self._filename = repr(fileobj) if fileobj is not None: if not file_opened_here: fileobj = _ContextWrapper(fileobj) with fileobj as file_stream: tzobj = self._read_tzfile(file_stream) self._set_tzdata(tzobj) def _set_tzdata(self, tzobj): """ Set the time zone data of this object from a _tzfile object """ # Copy the relevant attributes over as private attributes for attr in _tzfile.attrs: setattr(self, '_' + attr, getattr(tzobj, attr)) def _read_tzfile(self, fileobj): out = _tzfile() # From tzfile(5): # # The time zone information files used by tzset(3) # begin with the magic characters "TZif" to identify # them as time zone information files, followed by # sixteen bytes reserved for future use, followed by # six four-byte values of type long, written in a # ``standard'' byte order (the high-order byte # of the value is written first). if fileobj.read(4).decode() != "TZif": raise ValueError("magic not found") fileobj.read(16) ( # The number of UTC/local indicators stored in the file. ttisgmtcnt, # The number of standard/wall indicators stored in the file. ttisstdcnt, # The number of leap seconds for which data is # stored in the file. leapcnt, # The number of "transition times" for which data # is stored in the file. timecnt, # The number of "local time types" for which data # is stored in the file (must not be zero). typecnt, # The number of characters of "time zone # abbreviation strings" stored in the file. charcnt, ) = struct.unpack(">6l", fileobj.read(24)) # The above header is followed by tzh_timecnt four-byte # values of type long, sorted in ascending order. # These values are written in ``standard'' byte order. # Each is used as a transition time (as returned by # time(2)) at which the rules for computing local time # change. if timecnt: out.trans_list_utc = list(struct.unpack(">%dl" % timecnt, fileobj.read(timecnt*4))) else: out.trans_list_utc = [] # Next come tzh_timecnt one-byte values of type unsigned # char; each one tells which of the different types of # ``local time'' types described in the file is associated # with the same-indexed transition time. These values # serve as indices into an array of ttinfo structures that # appears next in the file. if timecnt: out.trans_idx = struct.unpack(">%dB" % timecnt, fileobj.read(timecnt)) else: out.trans_idx = [] # Each ttinfo structure is written as a four-byte value # for tt_gmtoff of type long, in a standard byte # order, followed by a one-byte value for tt_isdst # and a one-byte value for tt_abbrind. In each # structure, tt_gmtoff gives the number of # seconds to be added to UTC, tt_isdst tells whether # tm_isdst should be set by localtime(3), and # tt_abbrind serves as an index into the array of # time zone abbreviation characters that follow the # ttinfo structure(s) in the file. ttinfo = [] for i in range(typecnt): ttinfo.append(struct.unpack(">lbb", fileobj.read(6))) abbr = fileobj.read(charcnt).decode() # Then there are tzh_leapcnt pairs of four-byte # values, written in standard byte order; the # first value of each pair gives the time (as # returned by time(2)) at which a leap second # occurs; the second gives the total number of # leap seconds to be applied after the given time. # The pairs of values are sorted in ascending order # by time. # Not used, for now (but seek for correct file position) if leapcnt: fileobj.seek(leapcnt * 8, os.SEEK_CUR) # Then there are tzh_ttisstdcnt standard/wall # indicators, each stored as a one-byte value; # they tell whether the transition times associated # with local time types were specified as standard # time or wall clock time, and are used when # a time zone file is used in handling POSIX-style # time zone environment variables. if ttisstdcnt: isstd = struct.unpack(">%db" % ttisstdcnt, fileobj.read(ttisstdcnt)) # Finally, there are tzh_ttisgmtcnt UTC/local # indicators, each stored as a one-byte value; # they tell whether the transition times associated # with local time types were specified as UTC or # local time, and are used when a time zone file # is used in handling POSIX-style time zone envi- # ronment variables. if ttisgmtcnt: isgmt = struct.unpack(">%db" % ttisgmtcnt, fileobj.read(ttisgmtcnt)) # Build ttinfo list out.ttinfo_list = [] for i in range(typecnt): gmtoff, isdst, abbrind = ttinfo[i] # Round to full-minutes if that's not the case. Python's # datetime doesn't accept sub-minute timezones. Check # http://python.org/sf/1447945 for some information. gmtoff = 60 * ((gmtoff + 30) // 60) tti = _ttinfo() tti.offset = gmtoff tti.dstoffset = datetime.timedelta(0) tti.delta = datetime.timedelta(seconds=gmtoff) tti.isdst = isdst tti.abbr = abbr[abbrind:abbr.find('\x00', abbrind)] tti.isstd = (ttisstdcnt > i and isstd[i] != 0) tti.isgmt = (ttisgmtcnt > i and isgmt[i] != 0) out.ttinfo_list.append(tti) # Replace ttinfo indexes for ttinfo objects. out.trans_idx = [out.ttinfo_list[idx] for idx in out.trans_idx] # Set standard, dst, and before ttinfos. before will be # used when a given time is before any transitions, # and will be set to the first non-dst ttinfo, or to # the first dst, if all of them are dst. out.ttinfo_std = None out.ttinfo_dst = None out.ttinfo_before = None if out.ttinfo_list: if not out.trans_list_utc: out.ttinfo_std = out.ttinfo_first = out.ttinfo_list[0] else: for i in range(timecnt-1, -1, -1): tti = out.trans_idx[i] if not out.ttinfo_std and not tti.isdst: out.ttinfo_std = tti elif not out.ttinfo_dst and tti.isdst: out.ttinfo_dst = tti if out.ttinfo_std and out.ttinfo_dst: break else: if out.ttinfo_dst and not out.ttinfo_std: out.ttinfo_std = out.ttinfo_dst for tti in out.ttinfo_list: if not tti.isdst: out.ttinfo_before = tti break else: out.ttinfo_before = out.ttinfo_list[0] # Now fix transition times to become relative to wall time. # # I'm not sure about this. In my tests, the tz source file # is setup to wall time, and in the binary file isstd and # isgmt are off, so it should be in wall time. OTOH, it's # always in gmt time. Let me know if you have comments # about this. laststdoffset = None out.trans_list = [] for i, tti in enumerate(out.trans_idx): if not tti.isdst: offset = tti.offset laststdoffset = offset else: if laststdoffset is not None: # Store the DST offset as well and update it in the list tti.dstoffset = tti.offset - laststdoffset out.trans_idx[i] = tti offset = laststdoffset or 0 out.trans_list.append(out.trans_list_utc[i] + offset) # In case we missed any DST offsets on the way in for some reason, make # a second pass over the list, looking for the /next/ DST offset. laststdoffset = None for i in reversed(range(len(out.trans_idx))): tti = out.trans_idx[i] if tti.isdst: if not (tti.dstoffset or laststdoffset is None): tti.dstoffset = tti.offset - laststdoffset else: laststdoffset = tti.offset if not isinstance(tti.dstoffset, datetime.timedelta): tti.dstoffset = datetime.timedelta(seconds=tti.dstoffset) out.trans_idx[i] = tti out.trans_idx = tuple(out.trans_idx) out.trans_list = tuple(out.trans_list) out.trans_list_utc = tuple(out.trans_list_utc) return out def _find_last_transition(self, dt, in_utc=False): # If there's no list, there are no transitions to find if not self._trans_list: return None timestamp = _datetime_to_timestamp(dt) # Find where the timestamp fits in the transition list - if the # timestamp is a transition time, it's part of the "after" period. trans_list = self._trans_list_utc if in_utc else self._trans_list idx = bisect.bisect_right(trans_list, timestamp) # We want to know when the previous transition was, so subtract off 1 return idx - 1 def _get_ttinfo(self, idx): # For no list or after the last transition, default to _ttinfo_std if idx is None or (idx + 1) >= len(self._trans_list): return self._ttinfo_std # If there is a list and the time is before it, return _ttinfo_before if idx < 0: return self._ttinfo_before return self._trans_idx[idx] def _find_ttinfo(self, dt): idx = self._resolve_ambiguous_time(dt) return self._get_ttinfo(idx) def fromutc(self, dt): """ The ``tzfile`` implementation of :py:func:`datetime.tzinfo.fromutc`. :param dt: A :py:class:`datetime.datetime` object. :raises TypeError: Raised if ``dt`` is not a :py:class:`datetime.datetime` object. :raises ValueError: Raised if this is called with a ``dt`` which does not have this ``tzinfo`` attached. :return: Returns a :py:class:`datetime.datetime` object representing the wall time in ``self``'s time zone. """ # These isinstance checks are in datetime.tzinfo, so we'll preserve # them, even if we don't care about duck typing. if not isinstance(dt, datetime.datetime): raise TypeError("fromutc() requires a datetime argument") if dt.tzinfo is not self: raise ValueError("dt.tzinfo is not self") # First treat UTC as wall time and get the transition we're in. idx = self._find_last_transition(dt, in_utc=True) tti = self._get_ttinfo(idx) dt_out = dt + datetime.timedelta(seconds=tti.offset) fold = self.is_ambiguous(dt_out, idx=idx) return enfold(dt_out, fold=int(fold)) def is_ambiguous(self, dt, idx=None): """ Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0 """ if idx is None: idx = self._find_last_transition(dt) # Calculate the difference in offsets from current to previous timestamp = _datetime_to_timestamp(dt) tti = self._get_ttinfo(idx) if idx is None or idx <= 0: return False od = self._get_ttinfo(idx - 1).offset - tti.offset tt = self._trans_list[idx] # Transition time return timestamp < tt + od def _resolve_ambiguous_time(self, dt): idx = self._find_last_transition(dt) # If we have no transitions, return the index _fold = self._fold(dt) if idx is None or idx == 0: return idx # If it's ambiguous and we're in a fold, shift to a different index. idx_offset = int(not _fold and self.is_ambiguous(dt, idx)) return idx - idx_offset def utcoffset(self, dt): if dt is None: return None if not self._ttinfo_std: return ZERO return self._find_ttinfo(dt).delta def dst(self, dt): if dt is None: return None if not self._ttinfo_dst: return ZERO tti = self._find_ttinfo(dt) if not tti.isdst: return ZERO # The documentation says that utcoffset()-dst() must # be constant for every dt. return tti.dstoffset @tzname_in_python2 def tzname(self, dt): if not self._ttinfo_std or dt is None: return None return self._find_ttinfo(dt).abbr def __eq__(self, other): if not isinstance(other, tzfile): return NotImplemented return (self._trans_list == other._trans_list and self._trans_idx == other._trans_idx and self._ttinfo_list == other._ttinfo_list) __hash__ = None def __ne__(self, other): return not (self == other) def __repr__(self): return "%s(%s)" % (self.__class__.__name__, repr(self._filename)) def __reduce__(self): return self.__reduce_ex__(None) def __reduce_ex__(self, protocol): return (self.__class__, (None, self._filename), self.__dict__) class tzrange(tzrangebase): """ The ``tzrange`` object is a time zone specified by a set of offsets and abbreviations, equivalent to the way the ``TZ`` variable can be specified in POSIX-like systems, but using Python delta objects to specify DST start, end and offsets. :param stdabbr: The abbreviation for standard time (e.g. ``'EST'``). :param stdoffset: An integer or :class:`datetime.timedelta` object or equivalent specifying the base offset from UTC. If unspecified, +00:00 is used. :param dstabbr: The abbreviation for DST / "Summer" time (e.g. ``'EDT'``). If specified, with no other DST information, DST is assumed to occur and the default behavior or ``dstoffset``, ``start`` and ``end`` is used. If unspecified and no other DST information is specified, it is assumed that this zone has no DST. If this is unspecified and other DST information is *is* specified, DST occurs in the zone but the time zone abbreviation is left unchanged. :param dstoffset: A an integer or :class:`datetime.timedelta` object or equivalent specifying the UTC offset during DST. If unspecified and any other DST information is specified, it is assumed to be the STD offset +1 hour. :param start: A :class:`relativedelta.relativedelta` object or equivalent specifying the time and time of year that daylight savings time starts. To specify, for example, that DST starts at 2AM on the 2nd Sunday in March, pass: ``relativedelta(hours=2, month=3, day=1, weekday=SU(+2))`` If unspecified and any other DST information is specified, the default value is 2 AM on the first Sunday in April. :param end: A :class:`relativedelta.relativedelta` object or equivalent representing the time and time of year that daylight savings time ends, with the same specification method as in ``start``. One note is that this should point to the first time in the *standard* zone, so if a transition occurs at 2AM in the DST zone and the clocks are set back 1 hour to 1AM, set the `hours` parameter to +1. **Examples:** .. testsetup:: tzrange from dateutil.tz import tzrange, tzstr .. doctest:: tzrange >>> tzstr('EST5EDT') == tzrange("EST", -18000, "EDT") True >>> from dateutil.relativedelta import * >>> range1 = tzrange("EST", -18000, "EDT") >>> range2 = tzrange("EST", -18000, "EDT", -14400, ... relativedelta(hours=+2, month=4, day=1, ... weekday=SU(+1)), ... relativedelta(hours=+1, month=10, day=31, ... weekday=SU(-1))) >>> tzstr('EST5EDT') == range1 == range2 True """ def __init__(self, stdabbr, stdoffset=None, dstabbr=None, dstoffset=None, start=None, end=None): global relativedelta from dateutil import relativedelta self._std_abbr = stdabbr self._dst_abbr = dstabbr try: stdoffset = _total_seconds(stdoffset) except (TypeError, AttributeError): pass try: dstoffset = _total_seconds(dstoffset) except (TypeError, AttributeError): pass if stdoffset is not None: self._std_offset = datetime.timedelta(seconds=stdoffset) else: self._std_offset = ZERO if dstoffset is not None: self._dst_offset = datetime.timedelta(seconds=dstoffset) elif dstabbr and stdoffset is not None: self._dst_offset = self._std_offset + datetime.timedelta(hours=+1) else: self._dst_offset = ZERO if dstabbr and start is None: self._start_delta = relativedelta.relativedelta( hours=+2, month=4, day=1, weekday=relativedelta.SU(+1)) else: self._start_delta = start if dstabbr and end is None: self._end_delta = relativedelta.relativedelta( hours=+1, month=10, day=31, weekday=relativedelta.SU(-1)) else: self._end_delta = end self._dst_base_offset_ = self._dst_offset - self._std_offset self.hasdst = bool(self._start_delta) def transitions(self, year): """ For a given year, get the DST on and off transition times, expressed always on the standard time side. For zones with no transitions, this function returns ``None``. :param year: The year whose transitions you would like to query. :return: Returns a :class:`tuple` of :class:`datetime.datetime` objects, ``(dston, dstoff)`` for zones with an annual DST transition, or ``None`` for fixed offset zones. """ if not self.hasdst: return None base_year = datetime.datetime(year, 1, 1) start = base_year + self._start_delta end = base_year + self._end_delta return (start, end) def __eq__(self, other): if not isinstance(other, tzrange): return NotImplemented return (self._std_abbr == other._std_abbr and self._dst_abbr == other._dst_abbr and self._std_offset == other._std_offset and self._dst_offset == other._dst_offset and self._start_delta == other._start_delta and self._end_delta == other._end_delta) @property def _dst_base_offset(self): return self._dst_base_offset_ class tzstr(tzrange): """ ``tzstr`` objects are time zone objects specified by a time-zone string as it would be passed to a ``TZ`` variable on POSIX-style systems (see the `GNU C Library: TZ Variable`_ for more details). There is one notable exception, which is that POSIX-style time zones use an inverted offset format, so normally ``GMT+3`` would be parsed as an offset 3 hours *behind* GMT. The ``tzstr`` time zone object will parse this as an offset 3 hours *ahead* of GMT. If you would like to maintain the POSIX behavior, pass a ``True`` value to ``posix_offset``. The :class:`tzrange` object provides the same functionality, but is specified using :class:`relativedelta.relativedelta` objects. rather than strings. :param s: A time zone string in ``TZ`` variable format. This can be a :class:`bytes` (2.x: :class:`str`), :class:`str` (2.x: :class:`unicode`) or a stream emitting unicode characters (e.g. :class:`StringIO`). :param posix_offset: Optional. If set to ``True``, interpret strings such as ``GMT+3`` or ``UTC+3`` as being 3 hours *behind* UTC rather than ahead, per the POSIX standard. .. _`GNU C Library: TZ Variable`: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html """ def __init__(self, s, posix_offset=False): global parser from dateutil import parser self._s = s res = parser._parsetz(s) if res is None: raise ValueError("unknown string format") # Here we break the compatibility with the TZ variable handling. # GMT-3 actually *means* the timezone -3. if res.stdabbr in ("GMT", "UTC") and not posix_offset: res.stdoffset *= -1 # We must initialize it first, since _delta() needs # _std_offset and _dst_offset set. Use False in start/end # to avoid building it two times. tzrange.__init__(self, res.stdabbr, res.stdoffset, res.dstabbr, res.dstoffset, start=False, end=False) if not res.dstabbr: self._start_delta = None self._end_delta = None else: self._start_delta = self._delta(res.start) if self._start_delta: self._end_delta = self._delta(res.end, isend=1) self.hasdst = bool(self._start_delta) def _delta(self, x, isend=0): from dateutil import relativedelta kwargs = {} if x.month is not None: kwargs["month"] = x.month if x.weekday is not None: kwargs["weekday"] = relativedelta.weekday(x.weekday, x.week) if x.week > 0: kwargs["day"] = 1 else: kwargs["day"] = 31 elif x.day: kwargs["day"] = x.day elif x.yday is not None: kwargs["yearday"] = x.yday elif x.jyday is not None: kwargs["nlyearday"] = x.jyday if not kwargs: # Default is to start on first sunday of april, and end # on last sunday of october. if not isend: kwargs["month"] = 4 kwargs["day"] = 1 kwargs["weekday"] = relativedelta.SU(+1) else: kwargs["month"] = 10 kwargs["day"] = 31 kwargs["weekday"] = relativedelta.SU(-1) if x.time is not None: kwargs["seconds"] = x.time else: # Default is 2AM. kwargs["seconds"] = 7200 if isend: # Convert to standard time, to follow the documented way # of working with the extra hour. See the documentation # of the tzinfo class. delta = self._dst_offset - self._std_offset kwargs["seconds"] -= delta.seconds + delta.days * 86400 return relativedelta.relativedelta(**kwargs) def __repr__(self): return "%s(%s)" % (self.__class__.__name__, repr(self._s)) class _tzicalvtzcomp(object): def __init__(self, tzoffsetfrom, tzoffsetto, isdst, tzname=None, rrule=None): self.tzoffsetfrom = datetime.timedelta(seconds=tzoffsetfrom) self.tzoffsetto = datetime.timedelta(seconds=tzoffsetto) self.tzoffsetdiff = self.tzoffsetto - self.tzoffsetfrom self.isdst = isdst self.tzname = tzname self.rrule = rrule class _tzicalvtz(_tzinfo): def __init__(self, tzid, comps=[]): super(_tzicalvtz, self).__init__() self._tzid = tzid self._comps = comps self._cachedate = [] self._cachecomp = [] def _find_comp(self, dt): if len(self._comps) == 1: return self._comps[0] dt = dt.replace(tzinfo=None) try: return self._cachecomp[self._cachedate.index((dt, self._fold(dt)))] except ValueError: pass lastcompdt = None lastcomp = None for comp in self._comps: compdt = self._find_compdt(comp, dt) if compdt and (not lastcompdt or lastcompdt < compdt): lastcompdt = compdt lastcomp = comp if not lastcomp: # RFC says nothing about what to do when a given # time is before the first onset date. We'll look for the # first standard component, or the first component, if # none is found. for comp in self._comps: if not comp.isdst: lastcomp = comp break else: lastcomp = comp[0] self._cachedate.insert(0, (dt, self._fold(dt))) self._cachecomp.insert(0, lastcomp) if len(self._cachedate) > 10: self._cachedate.pop() self._cachecomp.pop() return lastcomp def _find_compdt(self, comp, dt): if comp.tzoffsetdiff < ZERO and self._fold(dt): dt -= comp.tzoffsetdiff compdt = comp.rrule.before(dt, inc=True) return compdt def utcoffset(self, dt): if dt is None: return None return self._find_comp(dt).tzoffsetto def dst(self, dt): comp = self._find_comp(dt) if comp.isdst: return comp.tzoffsetdiff else: return ZERO @tzname_in_python2 def tzname(self, dt): return self._find_comp(dt).tzname def __repr__(self): return "" % repr(self._tzid) __reduce__ = object.__reduce__ class tzical(object): """ This object is designed to parse an iCalendar-style ``VTIMEZONE`` structure as set out in `RFC 2445`_ Section 4.6.5 into one or more `tzinfo` objects. :param `fileobj`: A file or stream in iCalendar format, which should be UTF-8 encoded with CRLF endings. .. _`RFC 2445`: https://www.ietf.org/rfc/rfc2445.txt """ def __init__(self, fileobj): global rrule from dateutil import rrule if isinstance(fileobj, string_types): self._s = fileobj # ical should be encoded in UTF-8 with CRLF fileobj = open(fileobj, 'r') else: self._s = getattr(fileobj, 'name', repr(fileobj)) fileobj = _ContextWrapper(fileobj) self._vtz = {} with fileobj as fobj: self._parse_rfc(fobj.read()) def keys(self): """ Retrieves the available time zones as a list. """ return list(self._vtz.keys()) def get(self, tzid=None): """ Retrieve a :py:class:`datetime.tzinfo` object by its ``tzid``. :param tzid: If there is exactly one time zone available, omitting ``tzid`` or passing :py:const:`None` value returns it. Otherwise a valid key (which can be retrieved from :func:`keys`) is required. :raises ValueError: Raised if ``tzid`` is not specified but there are either more or fewer than 1 zone defined. :returns: Returns either a :py:class:`datetime.tzinfo` object representing the relevant time zone or :py:const:`None` if the ``tzid`` was not found. """ if tzid is None: if len(self._vtz) == 0: raise ValueError("no timezones defined") elif len(self._vtz) > 1: raise ValueError("more than one timezone available") tzid = next(iter(self._vtz)) return self._vtz.get(tzid) def _parse_offset(self, s): s = s.strip() if not s: raise ValueError("empty offset") if s[0] in ('+', '-'): signal = (-1, +1)[s[0] == '+'] s = s[1:] else: signal = +1 if len(s) == 4: return (int(s[:2]) * 3600 + int(s[2:]) * 60) * signal elif len(s) == 6: return (int(s[:2]) * 3600 + int(s[2:4]) * 60 + int(s[4:])) * signal else: raise ValueError("invalid offset: " + s) def _parse_rfc(self, s): lines = s.splitlines() if not lines: raise ValueError("empty string") # Unfold i = 0 while i < len(lines): line = lines[i].rstrip() if not line: del lines[i] elif i > 0 and line[0] == " ": lines[i-1] += line[1:] del lines[i] else: i += 1 tzid = None comps = [] invtz = False comptype = None for line in lines: if not line: continue name, value = line.split(':', 1) parms = name.split(';') if not parms: raise ValueError("empty property name") name = parms[0].upper() parms = parms[1:] if invtz: if name == "BEGIN": if value in ("STANDARD", "DAYLIGHT"): # Process component pass else: raise ValueError("unknown component: "+value) comptype = value founddtstart = False tzoffsetfrom = None tzoffsetto = None rrulelines = [] tzname = None elif name == "END": if value == "VTIMEZONE": if comptype: raise ValueError("component not closed: "+comptype) if not tzid: raise ValueError("mandatory TZID not found") if not comps: raise ValueError( "at least one component is needed") # Process vtimezone self._vtz[tzid] = _tzicalvtz(tzid, comps) invtz = False elif value == comptype: if not founddtstart: raise ValueError("mandatory DTSTART not found") if tzoffsetfrom is None: raise ValueError( "mandatory TZOFFSETFROM not found") if tzoffsetto is None: raise ValueError( "mandatory TZOFFSETFROM not found") # Process component rr = None if rrulelines: rr = rrule.rrulestr("\n".join(rrulelines), compatible=True, ignoretz=True, cache=True) comp = _tzicalvtzcomp(tzoffsetfrom, tzoffsetto, (comptype == "DAYLIGHT"), tzname, rr) comps.append(comp) comptype = None else: raise ValueError("invalid component end: "+value) elif comptype: if name == "DTSTART": rrulelines.append(line) founddtstart = True elif name in ("RRULE", "RDATE", "EXRULE", "EXDATE"): rrulelines.append(line) elif name == "TZOFFSETFROM": if parms: raise ValueError( "unsupported %s parm: %s " % (name, parms[0])) tzoffsetfrom = self._parse_offset(value) elif name == "TZOFFSETTO": if parms: raise ValueError( "unsupported TZOFFSETTO parm: "+parms[0]) tzoffsetto = self._parse_offset(value) elif name == "TZNAME": if parms: raise ValueError( "unsupported TZNAME parm: "+parms[0]) tzname = value elif name == "COMMENT": pass else: raise ValueError("unsupported property: "+name) else: if name == "TZID": if parms: raise ValueError( "unsupported TZID parm: "+parms[0]) tzid = value elif name in ("TZURL", "LAST-MODIFIED", "COMMENT"): pass else: raise ValueError("unsupported property: "+name) elif name == "BEGIN" and value == "VTIMEZONE": tzid = None comps = [] invtz = True def __repr__(self): return "%s(%s)" % (self.__class__.__name__, repr(self._s)) if sys.platform != "win32": TZFILES = ["/etc/localtime", "localtime"] TZPATHS = ["/usr/share/zoneinfo", "/usr/lib/zoneinfo", "/usr/share/lib/zoneinfo", "/etc/zoneinfo"] else: TZFILES = [] TZPATHS = [] def gettz(name=None): tz = None if not name: try: name = os.environ["TZ"] except KeyError: pass if name is None or name == ":": for filepath in TZFILES: if not os.path.isabs(filepath): filename = filepath for path in TZPATHS: filepath = os.path.join(path, filename) if os.path.isfile(filepath): break else: continue if os.path.isfile(filepath): try: tz = tzfile(filepath) break except (IOError, OSError, ValueError): pass else: tz = tzlocal() else: if name.startswith(":"): name = name[:-1] if os.path.isabs(name): if os.path.isfile(name): tz = tzfile(name) else: tz = None else: for path in TZPATHS: filepath = os.path.join(path, name) if not os.path.isfile(filepath): filepath = filepath.replace(' ', '_') if not os.path.isfile(filepath): continue try: tz = tzfile(filepath) break except (IOError, OSError, ValueError): pass else: tz = None if tzwin is not None: try: tz = tzwin(name) except WindowsError: tz = None if not tz: from dateutil.zoneinfo import get_zonefile_instance tz = get_zonefile_instance().get(name) if not tz: for c in name: # name must have at least one offset to be a tzstr if c in "0123456789": try: tz = tzstr(name) except ValueError: pass break else: if name in ("GMT", "UTC"): tz = tzutc() elif name in time.tzname: tz = tzlocal() return tz def datetime_exists(dt, tz=None): """ Given a datetime and a time zone, determine whether or not a given datetime would fall in a gap. :param dt: A :class:`datetime.datetime` (whose time zone will be ignored if ``tz`` is provided.) :param tz: A :class:`datetime.tzinfo` with support for the ``fold`` attribute. If ``None`` or not provided, the datetime's own time zone will be used. :return: Returns a boolean value whether or not the "wall time" exists in ``tz``. """ if tz is None: if dt.tzinfo is None: raise ValueError('Datetime is naive and no time zone provided.') tz = dt.tzinfo dt = dt.replace(tzinfo=None) # This is essentially a test of whether or not the datetime can survive # a round trip to UTC. dt_rt = dt.replace(tzinfo=tz).astimezone(tzutc()).astimezone(tz) dt_rt = dt_rt.replace(tzinfo=None) return dt == dt_rt def datetime_ambiguous(dt, tz=None): """ Given a datetime and a time zone, determine whether or not a given datetime is ambiguous (i.e if there are two times differentiated only by their DST status). :param dt: A :class:`datetime.datetime` (whose time zone will be ignored if ``tz`` is provided.) :param tz: A :class:`datetime.tzinfo` with support for the ``fold`` attribute. If ``None`` or not provided, the datetime's own time zone will be used. :return: Returns a boolean value whether or not the "wall time" is ambiguous in ``tz``. .. versionadded:: 2.6.0 """ if tz is None: if dt.tzinfo is None: raise ValueError('Datetime is naive and no time zone provided.') tz = dt.tzinfo # If a time zone defines its own "is_ambiguous" function, we'll use that. is_ambiguous_fn = getattr(tz, 'is_ambiguous', None) if is_ambiguous_fn is not None: try: return tz.is_ambiguous(dt) except: pass # If it doesn't come out and tell us it's ambiguous, we'll just check if # the fold attribute has any effect on this particular date and time. dt = dt.replace(tzinfo=tz) wall_0 = enfold(dt, fold=0) wall_1 = enfold(dt, fold=1) same_offset = wall_0.utcoffset() == wall_1.utcoffset() same_dst = wall_0.dst() == wall_1.dst() return not (same_offset and same_dst) def _datetime_to_timestamp(dt): """ Convert a :class:`datetime.datetime` object to an epoch timestamp in seconds since January 1, 1970, ignoring the time zone. """ return _total_seconds((dt.replace(tzinfo=None) - EPOCH)) class _ContextWrapper(object): """ Class for wrapping contexts so that they are passed through in a with statement. """ def __init__(self, context): self.context = context def __enter__(self): return self.context def __exit__(*args, **kwargs): pass # vim:ts=4:sw=4:et tz/win.py000064400000026205147204751220006361 0ustar00# This code was originally contributed by Jeffrey Harris. import datetime import struct from six.moves import winreg from six import text_type try: import ctypes from ctypes import wintypes except ValueError: # ValueError is raised on non-Windows systems for some horrible reason. raise ImportError("Running tzwin on non-Windows system") from ._common import tzrangebase __all__ = ["tzwin", "tzwinlocal", "tzres"] ONEWEEK = datetime.timedelta(7) TZKEYNAMENT = r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones" TZKEYNAME9X = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Time Zones" TZLOCALKEYNAME = r"SYSTEM\CurrentControlSet\Control\TimeZoneInformation" def _settzkeyname(): handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) try: winreg.OpenKey(handle, TZKEYNAMENT).Close() TZKEYNAME = TZKEYNAMENT except WindowsError: TZKEYNAME = TZKEYNAME9X handle.Close() return TZKEYNAME TZKEYNAME = _settzkeyname() class tzres(object): """ Class for accessing `tzres.dll`, which contains timezone name related resources. .. versionadded:: 2.5.0 """ p_wchar = ctypes.POINTER(wintypes.WCHAR) # Pointer to a wide char def __init__(self, tzres_loc='tzres.dll'): # Load the user32 DLL so we can load strings from tzres user32 = ctypes.WinDLL('user32') # Specify the LoadStringW function user32.LoadStringW.argtypes = (wintypes.HINSTANCE, wintypes.UINT, wintypes.LPWSTR, ctypes.c_int) self.LoadStringW = user32.LoadStringW self._tzres = ctypes.WinDLL(tzres_loc) self.tzres_loc = tzres_loc def load_name(self, offset): """ Load a timezone name from a DLL offset (integer). >>> from dateutil.tzwin import tzres >>> tzr = tzres() >>> print(tzr.load_name(112)) 'Eastern Standard Time' :param offset: A positive integer value referring to a string from the tzres dll. ..note: Offsets found in the registry are generally of the form `@tzres.dll,-114`. The offset in this case if 114, not -114. """ resource = self.p_wchar() lpBuffer = ctypes.cast(ctypes.byref(resource), wintypes.LPWSTR) nchar = self.LoadStringW(self._tzres._handle, offset, lpBuffer, 0) return resource[:nchar] def name_from_string(self, tzname_str): """ Parse strings as returned from the Windows registry into the time zone name as defined in the registry. >>> from dateutil.tzwin import tzres >>> tzr = tzres() >>> print(tzr.name_from_string('@tzres.dll,-251')) 'Dateline Daylight Time' >>> print(tzr.name_from_string('Eastern Standard Time')) 'Eastern Standard Time' :param tzname_str: A timezone name string as returned from a Windows registry key. :return: Returns the localized timezone string from tzres.dll if the string is of the form `@tzres.dll,-offset`, else returns the input string. """ if not tzname_str.startswith('@'): return tzname_str name_splt = tzname_str.split(',-') try: offset = int(name_splt[1]) except: raise ValueError("Malformed timezone string.") return self.load_name(offset) class tzwinbase(tzrangebase): """tzinfo class based on win32's timezones available in the registry.""" def __init__(self): raise NotImplementedError('tzwinbase is an abstract base class') def __eq__(self, other): # Compare on all relevant dimensions, including name. if not isinstance(other, tzwinbase): return NotImplemented return (self._std_offset == other._std_offset and self._dst_offset == other._dst_offset and self._stddayofweek == other._stddayofweek and self._dstdayofweek == other._dstdayofweek and self._stdweeknumber == other._stdweeknumber and self._dstweeknumber == other._dstweeknumber and self._stdhour == other._stdhour and self._dsthour == other._dsthour and self._stdminute == other._stdminute and self._dstminute == other._dstminute and self._std_abbr == other._std_abbr and self._dst_abbr == other._dst_abbr) @staticmethod def list(): """Return a list of all time zones known to the system.""" with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as handle: with winreg.OpenKey(handle, TZKEYNAME) as tzkey: result = [winreg.EnumKey(tzkey, i) for i in range(winreg.QueryInfoKey(tzkey)[0])] return result def display(self): return self._display def transitions(self, year): """ For a given year, get the DST on and off transition times, expressed always on the standard time side. For zones with no transitions, this function returns ``None``. :param year: The year whose transitions you would like to query. :return: Returns a :class:`tuple` of :class:`datetime.datetime` objects, ``(dston, dstoff)`` for zones with an annual DST transition, or ``None`` for fixed offset zones. """ if not self.hasdst: return None dston = picknthweekday(year, self._dstmonth, self._dstdayofweek, self._dsthour, self._dstminute, self._dstweeknumber) dstoff = picknthweekday(year, self._stdmonth, self._stddayofweek, self._stdhour, self._stdminute, self._stdweeknumber) # Ambiguous dates default to the STD side dstoff -= self._dst_base_offset return dston, dstoff def _get_hasdst(self): return self._dstmonth != 0 @property def _dst_base_offset(self): return self._dst_base_offset_ class tzwin(tzwinbase): def __init__(self, name): self._name = name # multiple contexts only possible in 2.7 and 3.1, we still support 2.6 with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as handle: tzkeyname = text_type("{kn}\\{name}").format(kn=TZKEYNAME, name=name) with winreg.OpenKey(handle, tzkeyname) as tzkey: keydict = valuestodict(tzkey) self._std_abbr = keydict["Std"] self._dst_abbr = keydict["Dlt"] self._display = keydict["Display"] # See http://ww_winreg.jsiinc.com/SUBA/tip0300/rh0398.htm tup = struct.unpack("=3l16h", keydict["TZI"]) stdoffset = -tup[0]-tup[1] # Bias + StandardBias * -1 dstoffset = stdoffset-tup[2] # + DaylightBias * -1 self._std_offset = datetime.timedelta(minutes=stdoffset) self._dst_offset = datetime.timedelta(minutes=dstoffset) # for the meaning see the win32 TIME_ZONE_INFORMATION structure docs # http://msdn.microsoft.com/en-us/library/windows/desktop/ms725481(v=vs.85).aspx (self._stdmonth, self._stddayofweek, # Sunday = 0 self._stdweeknumber, # Last = 5 self._stdhour, self._stdminute) = tup[4:9] (self._dstmonth, self._dstdayofweek, # Sunday = 0 self._dstweeknumber, # Last = 5 self._dsthour, self._dstminute) = tup[12:17] self._dst_base_offset_ = self._dst_offset - self._std_offset self.hasdst = self._get_hasdst() def __repr__(self): return "tzwin(%s)" % repr(self._name) def __reduce__(self): return (self.__class__, (self._name,)) class tzwinlocal(tzwinbase): def __init__(self): with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as handle: with winreg.OpenKey(handle, TZLOCALKEYNAME) as tzlocalkey: keydict = valuestodict(tzlocalkey) self._std_abbr = keydict["StandardName"] self._dst_abbr = keydict["DaylightName"] try: tzkeyname = text_type('{kn}\\{sn}').format(kn=TZKEYNAME, sn=self._std_abbr) with winreg.OpenKey(handle, tzkeyname) as tzkey: _keydict = valuestodict(tzkey) self._display = _keydict["Display"] except OSError: self._display = None stdoffset = -keydict["Bias"]-keydict["StandardBias"] dstoffset = stdoffset-keydict["DaylightBias"] self._std_offset = datetime.timedelta(minutes=stdoffset) self._dst_offset = datetime.timedelta(minutes=dstoffset) # For reasons unclear, in this particular key, the day of week has been # moved to the END of the SYSTEMTIME structure. tup = struct.unpack("=8h", keydict["StandardStart"]) (self._stdmonth, self._stdweeknumber, # Last = 5 self._stdhour, self._stdminute) = tup[1:5] self._stddayofweek = tup[7] tup = struct.unpack("=8h", keydict["DaylightStart"]) (self._dstmonth, self._dstweeknumber, # Last = 5 self._dsthour, self._dstminute) = tup[1:5] self._dstdayofweek = tup[7] self._dst_base_offset_ = self._dst_offset - self._std_offset self.hasdst = self._get_hasdst() def __repr__(self): return "tzwinlocal()" def __str__(self): # str will return the standard name, not the daylight name. return "tzwinlocal(%s)" % repr(self._std_abbr) def __reduce__(self): return (self.__class__, ()) def picknthweekday(year, month, dayofweek, hour, minute, whichweek): """ dayofweek == 0 means Sunday, whichweek 5 means last instance """ first = datetime.datetime(year, month, 1, hour, minute) # This will work if dayofweek is ISO weekday (1-7) or Microsoft-style (0-6), # Because 7 % 7 = 0 weekdayone = first.replace(day=((dayofweek - first.isoweekday()) % 7) + 1) wd = weekdayone + ((whichweek - 1) * ONEWEEK) if (wd.month != month): wd -= ONEWEEK return wd def valuestodict(key): """Convert a registry key's values to a dictionary.""" dout = {} size = winreg.QueryInfoKey(key)[1] tz_res = None for i in range(size): key_name, value, dtype = winreg.EnumValue(key, i) if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN: # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & (1 << 31): value = value - (1 << 32) elif dtype == winreg.REG_SZ: # If it's a reference to the tzres DLL, load the actual string if value.startswith('@tzres'): tz_res = tz_res or tzres() value = tz_res.name_from_string(value) value = value.rstrip('\x00') # Remove trailing nulls dout[key_name] = value return dout zoneinfo/__pycache__/__init__.cpython-36.opt-1.pyc000064400000013255147204751220015741 0ustar003 6cY[@sddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddd d gZ d Z d ZejZeed sxddZGddde Z ddZGdddeZeZdddZddZdd ZdS)N)TarFile)get_data)BytesIO)closing)tzfileget_zonefile_instancegettzgettz_db_metadataZrebuildzdateutil-zoneinfo.tar.gzZMETADATA__exit__cOsttj||S)N)rropen)argskwargsr/usr/lib/python3.6/__init__.pytar_opensrc@seZdZddZdS)rcCs t|jffS)N)rZ _filename)selfrrr __reduce__sztzfile.__reduce__N)__name__ __module__ __qualname__rrrrrrsrcCsJyttttStk rD}ztjdj|j|j dSd}~XnXdS)NzI/O error({0}): {1}) rrr ZONEFILENAMEIOErrorwarningswarnformaterrnostrerror)errrgetzoneinfofile_streams rc@s eZdZdddZdddZdS) ZoneInfoFileNcs|dk rt|ddtfddjD_tfddjD}jj|y.jjt}|jj d}t j |_ Wnt k rd_ YnXWdQRXnt_d_ dS)Nr)Zfileobjmodec3s:|]2}|jr|jtkr|jtj||jdfVqdS))filenameN)isfilename METADATA_FNr extractfile).0Zzf)tfrr /sz(ZoneInfoFile.__init__..c3s0|](}|js|jr|jj|jfVqdS)N)ZislnkZissymr$zonesZlinkname)r'Zzl)rrrr)7szUTF-8)rdictZ getmembersr*updater&Z getmemberr%readdecodejsonloadsmetadataKeyError)rZzonefile_streamZlinksZ metadata_jsonZ metadata_strr)rr(r__init__'s   zZoneInfoFile.__init__cCs|jj||S)ak Wrapper for :func:`ZoneInfoFile.zones.get`. This is a convenience method for retrieving zones from the zone dictionary. :param name: The name of the zone to retrieve. (Generally IANA zone names) :param default: The value to return in the event of a missing key. .. versionadded:: 2.6.0 )r*get)rr$defaultrrrr4FszZoneInfoFile.get)N)N)rrrr3r4rrrrr&s rFcCs2|r d}n ttdd}|dkr.tt}|t_|S)a% This is a convenience function which provides a :class:`ZoneInfoFile` instance using the data provided by the ``dateutil`` package. By default, it caches a single instance of the ZoneInfoFile object and returns that. :param new_instance: If ``True``, a new instance of :class:`ZoneInfoFile` is instantiated and used as the cached instance for the next call. Otherwise, new instances are created only as necessary. :return: Returns a :class:`ZoneInfoFile` object. .. versionadded:: 2.6 N_cached_instance)getattrrrrr6)Z new_instanceZzifrrrr`s  cCs8tjdtttdkr(tjtttdjj |S)a+ This retrieves a time zone from the local zoneinfo tarball that is packaged with dateutil. :param name: An IANA-style time zone name, as found in the zoneinfo file. :return: Returns a :class:`dateutil.tz.tzfile` time zone object. .. warning:: It is generally inadvisable to use this function, and it is only provided for API compatibility with earlier versions. This is *not* equivalent to ``dateutil.tz.gettz()``, which selects an appropriate time zone based on the inputs, favoring system zoneinfo. This is ONLY for accessing the dateutil-specific zoneinfo (which may be out of date compared to the system zoneinfo). .. deprecated:: 2.6 If you need to use a specific zoneinfofile over the system zoneinfo, instantiate a :class:`dateutil.zoneinfo.ZoneInfoFile` object and call :func:`dateutil.zoneinfo.ZoneInfoFile.get(name)` instead. Use :func:`get_zonefile_instance` to retrieve an instance of the dateutil-provided zoneinfo. zzoneinfo.gettz() will be removed in future versions, to use the dateutil-provided zoneinfo files, instantiate a ZoneInfoFile object and use ZoneInfoFile.zones.get() instead. See the documentation for details.r) rrDeprecationWarninglen_CLASS_ZONE_INSTANCEappendrrr*r4)r$rrrr}s  cCs2tjdtttdkr(tjtttdjS)a! Get the zonefile metadata See `zonefile_metadata`_ :returns: A dictionary with the database metadata .. deprecated:: 2.6 See deprecation warning in :func:`zoneinfo.gettz`. To get metadata, query the attribute ``zoneinfo.ZoneInfoFile.metadata``. zzoneinfo.gettz_db_metadata() will be removed in future versions, to use the dateutil-provided zoneinfo files, ZoneInfoFile object and query the 'metadata' attribute instead. See the documentation for details.r) rrr8r9r:r;rrr1rrrrr s  )F)rr/ZtarfilerZpkgutilrior contextlibrZ dateutil.tzr__all__rr%r rhasattrrobjectrlistr:rrr rrrrs&       7 &zoneinfo/__pycache__/__init__.cpython-36.pyc000064400000013255147204751220015002 0ustar003 6cY[@sddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddd d gZ d Z d ZejZeed sxddZGddde Z ddZGdddeZeZdddZddZdd ZdS)N)TarFile)get_data)BytesIO)closing)tzfileget_zonefile_instancegettzgettz_db_metadataZrebuildzdateutil-zoneinfo.tar.gzZMETADATA__exit__cOsttj||S)N)rropen)argskwargsr/usr/lib/python3.6/__init__.pytar_opensrc@seZdZddZdS)rcCs t|jffS)N)rZ _filename)selfrrr __reduce__sztzfile.__reduce__N)__name__ __module__ __qualname__rrrrrrsrcCsJyttttStk rD}ztjdj|j|j dSd}~XnXdS)NzI/O error({0}): {1}) rrr ZONEFILENAMEIOErrorwarningswarnformaterrnostrerror)errrgetzoneinfofile_streams rc@s eZdZdddZdddZdS) ZoneInfoFileNcs|dk rt|ddtfddjD_tfddjD}jj|y.jjt}|jj d}t j |_ Wnt k rd_ YnXWdQRXnt_d_ dS)Nr)Zfileobjmodec3s:|]2}|jr|jtkr|jtj||jdfVqdS))filenameN)isfilename METADATA_FNr extractfile).0Zzf)tfrr /sz(ZoneInfoFile.__init__..c3s0|](}|js|jr|jj|jfVqdS)N)ZislnkZissymr$zonesZlinkname)r'Zzl)rrrr)7szUTF-8)rdictZ getmembersr*updater&Z getmemberr%readdecodejsonloadsmetadataKeyError)rZzonefile_streamZlinksZ metadata_jsonZ metadata_strr)rr(r__init__'s   zZoneInfoFile.__init__cCs|jj||S)ak Wrapper for :func:`ZoneInfoFile.zones.get`. This is a convenience method for retrieving zones from the zone dictionary. :param name: The name of the zone to retrieve. (Generally IANA zone names) :param default: The value to return in the event of a missing key. .. versionadded:: 2.6.0 )r*get)rr$defaultrrrr4FszZoneInfoFile.get)N)N)rrrr3r4rrrrr&s rFcCs2|r d}n ttdd}|dkr.tt}|t_|S)a% This is a convenience function which provides a :class:`ZoneInfoFile` instance using the data provided by the ``dateutil`` package. By default, it caches a single instance of the ZoneInfoFile object and returns that. :param new_instance: If ``True``, a new instance of :class:`ZoneInfoFile` is instantiated and used as the cached instance for the next call. Otherwise, new instances are created only as necessary. :return: Returns a :class:`ZoneInfoFile` object. .. versionadded:: 2.6 N_cached_instance)getattrrrrr6)Z new_instanceZzifrrrr`s  cCs8tjdtttdkr(tjtttdjj |S)a+ This retrieves a time zone from the local zoneinfo tarball that is packaged with dateutil. :param name: An IANA-style time zone name, as found in the zoneinfo file. :return: Returns a :class:`dateutil.tz.tzfile` time zone object. .. warning:: It is generally inadvisable to use this function, and it is only provided for API compatibility with earlier versions. This is *not* equivalent to ``dateutil.tz.gettz()``, which selects an appropriate time zone based on the inputs, favoring system zoneinfo. This is ONLY for accessing the dateutil-specific zoneinfo (which may be out of date compared to the system zoneinfo). .. deprecated:: 2.6 If you need to use a specific zoneinfofile over the system zoneinfo, instantiate a :class:`dateutil.zoneinfo.ZoneInfoFile` object and call :func:`dateutil.zoneinfo.ZoneInfoFile.get(name)` instead. Use :func:`get_zonefile_instance` to retrieve an instance of the dateutil-provided zoneinfo. zzoneinfo.gettz() will be removed in future versions, to use the dateutil-provided zoneinfo files, instantiate a ZoneInfoFile object and use ZoneInfoFile.zones.get() instead. See the documentation for details.r) rrDeprecationWarninglen_CLASS_ZONE_INSTANCEappendrrr*r4)r$rrrr}s  cCs2tjdtttdkr(tjtttdjS)a! Get the zonefile metadata See `zonefile_metadata`_ :returns: A dictionary with the database metadata .. deprecated:: 2.6 See deprecation warning in :func:`zoneinfo.gettz`. To get metadata, query the attribute ``zoneinfo.ZoneInfoFile.metadata``. zzoneinfo.gettz_db_metadata() will be removed in future versions, to use the dateutil-provided zoneinfo files, ZoneInfoFile object and query the 'metadata' attribute instead. See the documentation for details.r) rrr8r9r:r;rrr1rrrrr s  )F)rr/ZtarfilerZpkgutilrior contextlibrZ dateutil.tzr__all__rr%r rhasattrrobjectrlistr:rrr rrrrs&       7 &zoneinfo/__pycache__/rebuild.cpython-36.opt-1.pyc000064400000003405147204751220015624 0ustar003 6cY@sfddlZddlZddlZddlZddlZddlmZddlmZm Z m Z ddgdfddZ ddZ dS) N) check_call)tar_open METADATA_FN ZONEFILENAMEZgzc-sHtjtjjd}tjjt}zt|v}x|D]}|j|q6Wfdd|D} yt dd|g| Wn,t k r} zt | WYdd} ~ XnXWdQRXt tjj|t d} tj|| dd d WdQRXtjj|t} t| d |6}x.tj|D] } tjj|| }|j|| qWWdQRXWdtjXdS) zRebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar* filename is the timezone tarball from ftp.iana.org/tz. Zzoneinfocsg|]}tjj|qS)ospathjoin).0n)tmpdirr/usr/lib/python3.6/rebuild.py szrebuild..Zzicz-dNwT)indentZ sort_keyszw:%s)tempfileZmkdtemprrr dirname__file__rextractrOSError_print_on_nosuchfileopenrjsondumprlistdiraddshutilZrmtree)filenametagformatZ zonegroupsZmetadataZzonedirZ moduledirZtfnameZ filepathseftargetentryZ entrypathr)r r rebuild s*    r&cCs|jdkrtjddS)zdPrint helpful troubleshooting message e is an exception raised by subprocess.check_call() zzCould not find zic. Perhaps you need to install libc-bin or some other package that provides it, or it's not in your PATH?N)errnologgingerror)r"rrr r*s r) r)rrrr subprocessrZdateutil.zoneinforrrr&rrrrr s zoneinfo/__pycache__/rebuild.cpython-36.pyc000064400000003405147204751220014665 0ustar003 6cY@sfddlZddlZddlZddlZddlZddlmZddlmZm Z m Z ddgdfddZ ddZ dS) N) check_call)tar_open METADATA_FN ZONEFILENAMEZgzc-sHtjtjjd}tjjt}zt|v}x|D]}|j|q6Wfdd|D} yt dd|g| Wn,t k r} zt | WYdd} ~ XnXWdQRXt tjj|t d} tj|| dd d WdQRXtjj|t} t| d |6}x.tj|D] } tjj|| }|j|| qWWdQRXWdtjXdS) zRebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar* filename is the timezone tarball from ftp.iana.org/tz. Zzoneinfocsg|]}tjj|qS)ospathjoin).0n)tmpdirr/usr/lib/python3.6/rebuild.py szrebuild..Zzicz-dNwT)indentZ sort_keyszw:%s)tempfileZmkdtemprrr dirname__file__rextractrOSError_print_on_nosuchfileopenrjsondumprlistdiraddshutilZrmtree)filenametagformatZ zonegroupsZmetadataZzonedirZ moduledirZtfnameZ filepathseftargetentryZ entrypathr)r r rebuild s*    r&cCs|jdkrtjddS)zdPrint helpful troubleshooting message e is an exception raised by subprocess.check_call() zzCould not find zic. Perhaps you need to install libc-bin or some other package that provides it, or it's not in your PATH?N)errnologgingerror)r"rrr r*s r) r)rrrr subprocessrZdateutil.zoneinforrrr&rrrrr s zoneinfo/__init__.py000064400000015133147204751220010513 0ustar00# -*- coding: utf-8 -*- import warnings import json from tarfile import TarFile from pkgutil import get_data from io import BytesIO from contextlib import closing from dateutil.tz import tzfile __all__ = ["get_zonefile_instance", "gettz", "gettz_db_metadata", "rebuild"] ZONEFILENAME = "dateutil-zoneinfo.tar.gz" METADATA_FN = 'METADATA' # python2.6 compatability. Note that TarFile.__exit__ != TarFile.close, but # it's close enough for python2.6 tar_open = TarFile.open if not hasattr(TarFile, '__exit__'): def tar_open(*args, **kwargs): return closing(TarFile.open(*args, **kwargs)) class tzfile(tzfile): def __reduce__(self): return (gettz, (self._filename,)) def getzoneinfofile_stream(): try: return BytesIO(get_data(__name__, ZONEFILENAME)) except IOError as e: # TODO switch to FileNotFoundError? warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror)) return None class ZoneInfoFile(object): def __init__(self, zonefile_stream=None): if zonefile_stream is not None: with tar_open(fileobj=zonefile_stream, mode='r') as tf: # dict comprehension does not work on python2.6 # TODO: get back to the nicer syntax when we ditch python2.6 # self.zones = {zf.name: tzfile(tf.extractfile(zf), # filename = zf.name) # for zf in tf.getmembers() if zf.isfile()} self.zones = dict((zf.name, tzfile(tf.extractfile(zf), filename=zf.name)) for zf in tf.getmembers() if zf.isfile() and zf.name != METADATA_FN) # deal with links: They'll point to their parent object. Less # waste of memory # links = {zl.name: self.zones[zl.linkname] # for zl in tf.getmembers() if zl.islnk() or zl.issym()} links = dict((zl.name, self.zones[zl.linkname]) for zl in tf.getmembers() if zl.islnk() or zl.issym()) self.zones.update(links) try: metadata_json = tf.extractfile(tf.getmember(METADATA_FN)) metadata_str = metadata_json.read().decode('UTF-8') self.metadata = json.loads(metadata_str) except KeyError: # no metadata in tar file self.metadata = None else: self.zones = dict() self.metadata = None def get(self, name, default=None): """ Wrapper for :func:`ZoneInfoFile.zones.get`. This is a convenience method for retrieving zones from the zone dictionary. :param name: The name of the zone to retrieve. (Generally IANA zone names) :param default: The value to return in the event of a missing key. .. versionadded:: 2.6.0 """ return self.zones.get(name, default) # The current API has gettz as a module function, although in fact it taps into # a stateful class. So as a workaround for now, without changing the API, we # will create a new "global" class instance the first time a user requests a # timezone. Ugly, but adheres to the api. # # TODO: Remove after deprecation period. _CLASS_ZONE_INSTANCE = list() def get_zonefile_instance(new_instance=False): """ This is a convenience function which provides a :class:`ZoneInfoFile` instance using the data provided by the ``dateutil`` package. By default, it caches a single instance of the ZoneInfoFile object and returns that. :param new_instance: If ``True``, a new instance of :class:`ZoneInfoFile` is instantiated and used as the cached instance for the next call. Otherwise, new instances are created only as necessary. :return: Returns a :class:`ZoneInfoFile` object. .. versionadded:: 2.6 """ if new_instance: zif = None else: zif = getattr(get_zonefile_instance, '_cached_instance', None) if zif is None: zif = ZoneInfoFile(getzoneinfofile_stream()) get_zonefile_instance._cached_instance = zif return zif def gettz(name): """ This retrieves a time zone from the local zoneinfo tarball that is packaged with dateutil. :param name: An IANA-style time zone name, as found in the zoneinfo file. :return: Returns a :class:`dateutil.tz.tzfile` time zone object. .. warning:: It is generally inadvisable to use this function, and it is only provided for API compatibility with earlier versions. This is *not* equivalent to ``dateutil.tz.gettz()``, which selects an appropriate time zone based on the inputs, favoring system zoneinfo. This is ONLY for accessing the dateutil-specific zoneinfo (which may be out of date compared to the system zoneinfo). .. deprecated:: 2.6 If you need to use a specific zoneinfofile over the system zoneinfo, instantiate a :class:`dateutil.zoneinfo.ZoneInfoFile` object and call :func:`dateutil.zoneinfo.ZoneInfoFile.get(name)` instead. Use :func:`get_zonefile_instance` to retrieve an instance of the dateutil-provided zoneinfo. """ warnings.warn("zoneinfo.gettz() will be removed in future versions, " "to use the dateutil-provided zoneinfo files, instantiate a " "ZoneInfoFile object and use ZoneInfoFile.zones.get() " "instead. See the documentation for details.", DeprecationWarning) if len(_CLASS_ZONE_INSTANCE) == 0: _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream())) return _CLASS_ZONE_INSTANCE[0].zones.get(name) def gettz_db_metadata(): """ Get the zonefile metadata See `zonefile_metadata`_ :returns: A dictionary with the database metadata .. deprecated:: 2.6 See deprecation warning in :func:`zoneinfo.gettz`. To get metadata, query the attribute ``zoneinfo.ZoneInfoFile.metadata``. """ warnings.warn("zoneinfo.gettz_db_metadata() will be removed in future " "versions, to use the dateutil-provided zoneinfo files, " "ZoneInfoFile object and query the 'metadata' attribute " "instead. See the documentation for details.", DeprecationWarning) if len(_CLASS_ZONE_INSTANCE) == 0: _CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream())) return _CLASS_ZONE_INSTANCE[0].metadata zoneinfo/dateutil-zoneinfo.tar.gz000064400000417201147204751220013173 0ustar00!8Ydateutil-zoneinfo.tar]`֝jhHoCMB˦o !$.z@B% !GAEA Ei)Aҋ+ D"{4f3IHv;{ʹ hܴqDcLt c7ᵷxM@;c }|MbmЄxEF?O>$~'Qn *NLH2vp\床OS-ёC? +ԡuG%oX:F*&#\'62..Gī2G?߫oh/}hCǭNO~c"}}MAޑ}} 51? 2wT@ k l6 MϽ{sAf>ёf?ST)Ќo /귿[?x:]7>OdGOkvjtw'_3t?|_7O\߄> #&DJ|GI?"[# GGe1R޺8Y?zOxgEt.̯sO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r(r(r(]~?tW zoneinfo/rebuild.py000064400000003231147204751220010376 0ustar00import logging import os import tempfile import shutil import json from subprocess import check_call from dateutil.zoneinfo import tar_open, METADATA_FN, ZONEFILENAME def rebuild(filename, tag=None, format="gz", zonegroups=[], metadata=None): """Rebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar* filename is the timezone tarball from ftp.iana.org/tz. """ tmpdir = tempfile.mkdtemp() zonedir = os.path.join(tmpdir, "zoneinfo") moduledir = os.path.dirname(__file__) try: with tar_open(filename) as tf: for name in zonegroups: tf.extract(name, tmpdir) filepaths = [os.path.join(tmpdir, n) for n in zonegroups] try: check_call(["zic", "-d", zonedir] + filepaths) except OSError as e: _print_on_nosuchfile(e) raise # write metadata file with open(os.path.join(zonedir, METADATA_FN), 'w') as f: json.dump(metadata, f, indent=4, sort_keys=True) target = os.path.join(moduledir, ZONEFILENAME) with tar_open(target, "w:%s" % format) as tf: for entry in os.listdir(zonedir): entrypath = os.path.join(zonedir, entry) tf.add(entrypath, entry) finally: shutil.rmtree(tmpdir) def _print_on_nosuchfile(e): """Print helpful troubleshooting message e is an exception raised by subprocess.check_call() """ if e.errno == 2: logging.error( "Could not find zic. Perhaps you need to install " "libc-bin or some other package that provides it, " "or it's not in your PATH?") __init__.py000064400000000105147204751220006655 0ustar00# -*- coding: utf-8 -*- from ._version import VERSION as __version__ _common.py000064400000001400147204751220006544 0ustar00""" Common code used in multiple modules. """ class weekday(object): __slots__ = ["weekday", "n"] def __init__(self, weekday, n=None): self.weekday = weekday self.n = n def __call__(self, n): if n == self.n: return self else: return self.__class__(self.weekday, n) def __eq__(self, other): try: if self.weekday != other.weekday or self.n != other.n: return False except AttributeError: return False return True __hash__ = None def __repr__(self): s = ("MO", "TU", "WE", "TH", "FR", "SA", "SU")[self.weekday] if not self.n: return s else: return "%s(%+d)" % (s, self.n) _version.py000064400000000333147204751220006745 0ustar00""" Contains information about the dateutil version. """ VERSION_MAJOR = 2 VERSION_MINOR = 6 VERSION_PATCH = 1 VERSION_TUPLE = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) VERSION = '.'.join(map(str, VERSION_TUPLE)) easter.py000064400000005105147204751220006406 0ustar00# -*- coding: utf-8 -*- """ This module offers a generic easter computing method for any given year, using Western, Orthodox or Julian algorithms. """ import datetime __all__ = ["easter", "EASTER_JULIAN", "EASTER_ORTHODOX", "EASTER_WESTERN"] EASTER_JULIAN = 1 EASTER_ORTHODOX = 2 EASTER_WESTERN = 3 def easter(year, method=EASTER_WESTERN): """ This method was ported from the work done by GM Arts, on top of the algorithm by Claus Tondering, which was based in part on the algorithm of Ouding (1940), as quoted in "Explanatory Supplement to the Astronomical Almanac", P. Kenneth Seidelmann, editor. This algorithm implements three different easter calculation methods: 1 - Original calculation in Julian calendar, valid in dates after 326 AD 2 - Original method, with date converted to Gregorian calendar, valid in years 1583 to 4099 3 - Revised method, in Gregorian calendar, valid in years 1583 to 4099 as well These methods are represented by the constants: * ``EASTER_JULIAN = 1`` * ``EASTER_ORTHODOX = 2`` * ``EASTER_WESTERN = 3`` The default method is method 3. More about the algorithm may be found at: http://users.chariot.net.au/~gmarts/eastalg.htm and http://www.tondering.dk/claus/calendar.html """ if not (1 <= method <= 3): raise ValueError("invalid method") # g - Golden year - 1 # c - Century # h - (23 - Epact) mod 30 # i - Number of days from March 21 to Paschal Full Moon # j - Weekday for PFM (0=Sunday, etc) # p - Number of days from March 21 to Sunday on or before PFM # (-6 to 28 methods 1 & 3, to 56 for method 2) # e - Extra days to add for method 2 (converting Julian # date to Gregorian date) y = year g = y % 19 e = 0 if method < 3: # Old method i = (19*g + 15) % 30 j = (y + y//4 + i) % 7 if method == 2: # Extra dates to convert Julian to Gregorian date e = 10 if y > 1600: e = e + y//100 - 16 - (y//100 - 16)//4 else: # New method c = y//100 h = (c - c//4 - (8*c + 13)//25 + 19*g + 15) % 30 i = h - (h//28)*(1 - (h//28)*(29//(h + 1))*((21 - g)//11)) j = (y + y//4 + i + 2 - c + c//4) % 7 # p can be from -6 to 56 corresponding to dates 22 March to 23 May # (later dates apply to method 2, although 23 May never actually occurs) p = i - j + e d = 1 + (p + 27 + (p + 6)//40) % 31 m = 3 + (p + 26)//30 return datetime.date(int(y), int(m), int(d)) parser.py000064400000143373147204751220006431 0ustar00# -*- coding: utf-8 -*- """ This module offers a generic date/time string parser which is able to parse most known formats to represent a date and/or time. This module attempts to be forgiving with regards to unlikely input formats, returning a datetime object even for dates which are ambiguous. If an element of a date/time stamp is omitted, the following rules are applied: - If AM or PM is left unspecified, a 24-hour clock is assumed, however, an hour on a 12-hour clock (``0 <= hour <= 12``) *must* be specified if AM or PM is specified. - If a time zone is omitted, a timezone-naive datetime is returned. If any other elements are missing, they are taken from the :class:`datetime.datetime` object passed to the parameter ``default``. If this results in a day number exceeding the valid number of days per month, the value falls back to the end of the month. Additional resources about date/time string formats can be found below: - `A summary of the international standard date and time notation `_ - `W3C Date and Time Formats `_ - `Time Formats (Planetary Rings Node) `_ - `CPAN ParseDate module `_ - `Java SimpleDateFormat Class `_ """ from __future__ import unicode_literals import datetime import string import time import collections import re from io import StringIO from calendar import monthrange from six import text_type, binary_type, integer_types from . import relativedelta from . import tz __all__ = ["parse", "parserinfo"] class _timelex(object): # Fractional seconds are sometimes split by a comma _split_decimal = re.compile("([.,])") def __init__(self, instream): if isinstance(instream, binary_type): instream = instream.decode() if isinstance(instream, text_type): instream = StringIO(instream) if getattr(instream, 'read', None) is None: raise TypeError('Parser must be a string or character stream, not ' '{itype}'.format(itype=instream.__class__.__name__)) self.instream = instream self.charstack = [] self.tokenstack = [] self.eof = False def get_token(self): """ This function breaks the time string into lexical units (tokens), which can be parsed by the parser. Lexical units are demarcated by changes in the character set, so any continuous string of letters is considered one unit, any continuous string of numbers is considered one unit. The main complication arises from the fact that dots ('.') can be used both as separators (e.g. "Sep.20.2009") or decimal points (e.g. "4:30:21.447"). As such, it is necessary to read the full context of any dot-separated strings before breaking it into tokens; as such, this function maintains a "token stack", for when the ambiguous context demands that multiple tokens be parsed at once. """ if self.tokenstack: return self.tokenstack.pop(0) seenletters = False token = None state = None while not self.eof: # We only realize that we've reached the end of a token when we # find a character that's not part of the current token - since # that character may be part of the next token, it's stored in the # charstack. if self.charstack: nextchar = self.charstack.pop(0) else: nextchar = self.instream.read(1) while nextchar == '\x00': nextchar = self.instream.read(1) if not nextchar: self.eof = True break elif not state: # First character of the token - determines if we're starting # to parse a word, a number or something else. token = nextchar if self.isword(nextchar): state = 'a' elif self.isnum(nextchar): state = '0' elif self.isspace(nextchar): token = ' ' break # emit token else: break # emit token elif state == 'a': # If we've already started reading a word, we keep reading # letters until we find something that's not part of a word. seenletters = True if self.isword(nextchar): token += nextchar elif nextchar == '.': token += nextchar state = 'a.' else: self.charstack.append(nextchar) break # emit token elif state == '0': # If we've already started reading a number, we keep reading # numbers until we find something that doesn't fit. if self.isnum(nextchar): token += nextchar elif nextchar == '.' or (nextchar == ',' and len(token) >= 2): token += nextchar state = '0.' else: self.charstack.append(nextchar) break # emit token elif state == 'a.': # If we've seen some letters and a dot separator, continue # parsing, and the tokens will be broken up later. seenletters = True if nextchar == '.' or self.isword(nextchar): token += nextchar elif self.isnum(nextchar) and token[-1] == '.': token += nextchar state = '0.' else: self.charstack.append(nextchar) break # emit token elif state == '0.': # If we've seen at least one dot separator, keep going, we'll # break up the tokens later. if nextchar == '.' or self.isnum(nextchar): token += nextchar elif self.isword(nextchar) and token[-1] == '.': token += nextchar state = 'a.' else: self.charstack.append(nextchar) break # emit token if (state in ('a.', '0.') and (seenletters or token.count('.') > 1 or token[-1] in '.,')): l = self._split_decimal.split(token) token = l[0] for tok in l[1:]: if tok: self.tokenstack.append(tok) if state == '0.' and token.count('.') == 0: token = token.replace(',', '.') return token def __iter__(self): return self def __next__(self): token = self.get_token() if token is None: raise StopIteration return token def next(self): return self.__next__() # Python 2.x support @classmethod def split(cls, s): return list(cls(s)) @classmethod def isword(cls, nextchar): """ Whether or not the next character is part of a word """ return nextchar.isalpha() @classmethod def isnum(cls, nextchar): """ Whether the next character is part of a number """ return nextchar.isdigit() @classmethod def isspace(cls, nextchar): """ Whether the next character is whitespace """ return nextchar.isspace() class _resultbase(object): def __init__(self): for attr in self.__slots__: setattr(self, attr, None) def _repr(self, classname): l = [] for attr in self.__slots__: value = getattr(self, attr) if value is not None: l.append("%s=%s" % (attr, repr(value))) return "%s(%s)" % (classname, ", ".join(l)) def __len__(self): return (sum(getattr(self, attr) is not None for attr in self.__slots__)) def __repr__(self): return self._repr(self.__class__.__name__) class parserinfo(object): """ Class which handles what inputs are accepted. Subclass this to customize the language and acceptable values for each parameter. :param dayfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the day (``True``) or month (``False``). If ``yearfirst`` is set to ``True``, this distinguishes between YDM and YMD. Default is ``False``. :param yearfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the year. If ``True``, the first number is taken to be the year, otherwise the last number is taken to be the year. Default is ``False``. """ # m from a.m/p.m, t from ISO T separator JUMP = [" ", ".", ",", ";", "-", "/", "'", "at", "on", "and", "ad", "m", "t", "of", "st", "nd", "rd", "th"] WEEKDAYS = [("Mon", "Monday"), ("Tue", "Tuesday"), ("Wed", "Wednesday"), ("Thu", "Thursday"), ("Fri", "Friday"), ("Sat", "Saturday"), ("Sun", "Sunday")] MONTHS = [("Jan", "January"), ("Feb", "February"), ("Mar", "March"), ("Apr", "April"), ("May", "May"), ("Jun", "June"), ("Jul", "July"), ("Aug", "August"), ("Sep", "Sept", "September"), ("Oct", "October"), ("Nov", "November"), ("Dec", "December")] HMS = [("h", "hour", "hours"), ("m", "minute", "minutes"), ("s", "second", "seconds")] AMPM = [("am", "a"), ("pm", "p")] UTCZONE = ["UTC", "GMT", "Z"] PERTAIN = ["of"] TZOFFSET = {} def __init__(self, dayfirst=False, yearfirst=False): self._jump = self._convert(self.JUMP) self._weekdays = self._convert(self.WEEKDAYS) self._months = self._convert(self.MONTHS) self._hms = self._convert(self.HMS) self._ampm = self._convert(self.AMPM) self._utczone = self._convert(self.UTCZONE) self._pertain = self._convert(self.PERTAIN) self.dayfirst = dayfirst self.yearfirst = yearfirst self._year = time.localtime().tm_year self._century = self._year // 100 * 100 def _convert(self, lst): dct = {} for i, v in enumerate(lst): if isinstance(v, tuple): for v in v: dct[v.lower()] = i else: dct[v.lower()] = i return dct def jump(self, name): return name.lower() in self._jump def weekday(self, name): if len(name) >= min(len(n) for n in self._weekdays.keys()): try: return self._weekdays[name.lower()] except KeyError: pass return None def month(self, name): if len(name) >= min(len(n) for n in self._months.keys()): try: return self._months[name.lower()] + 1 except KeyError: pass return None def hms(self, name): try: return self._hms[name.lower()] except KeyError: return None def ampm(self, name): try: return self._ampm[name.lower()] except KeyError: return None def pertain(self, name): return name.lower() in self._pertain def utczone(self, name): return name.lower() in self._utczone def tzoffset(self, name): if name in self._utczone: return 0 return self.TZOFFSET.get(name) def convertyear(self, year, century_specified=False): if year < 100 and not century_specified: year += self._century if abs(year - self._year) >= 50: if year < self._year: year += 100 else: year -= 100 return year def validate(self, res): # move to info if res.year is not None: res.year = self.convertyear(res.year, res.century_specified) if res.tzoffset == 0 and not res.tzname or res.tzname == 'Z': res.tzname = "UTC" res.tzoffset = 0 elif res.tzoffset != 0 and res.tzname and self.utczone(res.tzname): res.tzoffset = 0 return True class _ymd(list): def __init__(self, tzstr, *args, **kwargs): super(self.__class__, self).__init__(*args, **kwargs) self.century_specified = False self.tzstr = tzstr @staticmethod def token_could_be_year(token, year): try: return int(token) == year except ValueError: return False @staticmethod def find_potential_year_tokens(year, tokens): return [token for token in tokens if _ymd.token_could_be_year(token, year)] def find_probable_year_index(self, tokens): """ attempt to deduce if a pre 100 year was lost due to padded zeros being taken off """ for index, token in enumerate(self): potential_year_tokens = _ymd.find_potential_year_tokens(token, tokens) if len(potential_year_tokens) == 1 and len(potential_year_tokens[0]) > 2: return index def append(self, val): if hasattr(val, '__len__'): if val.isdigit() and len(val) > 2: self.century_specified = True elif val > 100: self.century_specified = True super(self.__class__, self).append(int(val)) def resolve_ymd(self, mstridx, yearfirst, dayfirst): len_ymd = len(self) year, month, day = (None, None, None) if len_ymd > 3: raise ValueError("More than three YMD values") elif len_ymd == 1 or (mstridx != -1 and len_ymd == 2): # One member, or two members with a month string if mstridx != -1: month = self[mstridx] del self[mstridx] if len_ymd > 1 or mstridx == -1: if self[0] > 31: year = self[0] else: day = self[0] elif len_ymd == 2: # Two members with numbers if self[0] > 31: # 99-01 year, month = self elif self[1] > 31: # 01-99 month, year = self elif dayfirst and self[1] <= 12: # 13-01 day, month = self else: # 01-13 month, day = self elif len_ymd == 3: # Three members if mstridx == 0: month, day, year = self elif mstridx == 1: if self[0] > 31 or (yearfirst and self[2] <= 31): # 99-Jan-01 year, month, day = self else: # 01-Jan-01 # Give precendence to day-first, since # two-digit years is usually hand-written. day, month, year = self elif mstridx == 2: # WTF!? if self[1] > 31: # 01-99-Jan day, year, month = self else: # 99-01-Jan year, day, month = self else: if self[0] > 31 or \ self.find_probable_year_index(_timelex.split(self.tzstr)) == 0 or \ (yearfirst and self[1] <= 12 and self[2] <= 31): # 99-01-01 if dayfirst and self[2] <= 12: year, day, month = self else: year, month, day = self elif self[0] > 12 or (dayfirst and self[1] <= 12): # 13-01-01 day, month, year = self else: # 01-13-01 month, day, year = self return year, month, day class parser(object): def __init__(self, info=None): self.info = info or parserinfo() def parse(self, timestr, default=None, ignoretz=False, tzinfos=None, **kwargs): """ Parse the date/time string into a :class:`datetime.datetime` object. :param timestr: Any date/time string using the supported formats. :param default: The default datetime object, if this is a datetime object and not ``None``, elements specified in ``timestr`` replace elements in the default object. :param ignoretz: If set ``True``, time zones in parsed strings are ignored and a naive :class:`datetime.datetime` object is returned. :param tzinfos: Additional time zone names / aliases which may be present in the string. This argument maps time zone names (and optionally offsets from those time zones) to time zones. This parameter can be a dictionary with timezone aliases mapping time zone names to time zones or a function taking two parameters (``tzname`` and ``tzoffset``) and returning a time zone. The timezones to which the names are mapped can be an integer offset from UTC in minutes or a :class:`tzinfo` object. .. doctest:: :options: +NORMALIZE_WHITESPACE >>> from dateutil.parser import parse >>> from dateutil.tz import gettz >>> tzinfos = {"BRST": -10800, "CST": gettz("America/Chicago")} >>> parse("2012-01-19 17:21:00 BRST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzoffset(u'BRST', -10800)) >>> parse("2012-01-19 17:21:00 CST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzfile('/usr/share/zoneinfo/America/Chicago')) This parameter is ignored if ``ignoretz`` is set. :param **kwargs: Keyword arguments as passed to ``_parse()``. :return: Returns a :class:`datetime.datetime` object or, if the ``fuzzy_with_tokens`` option is ``True``, returns a tuple, the first element being a :class:`datetime.datetime` object, the second a tuple containing the fuzzy tokens. :raises ValueError: Raised for invalid or unknown string format, if the provided :class:`tzinfo` is not in a valid format, or if an invalid date would be created. :raises TypeError: Raised for non-string or character stream input. :raises OverflowError: Raised if the parsed date exceeds the largest valid C integer on your system. """ if default is None: default = datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) res, skipped_tokens = self._parse(timestr, **kwargs) if res is None: raise ValueError("Unknown string format") if len(res) == 0: raise ValueError("String does not contain a date.") repl = {} for attr in ("year", "month", "day", "hour", "minute", "second", "microsecond"): value = getattr(res, attr) if value is not None: repl[attr] = value if 'day' not in repl: # If the default day exceeds the last day of the month, fall back to # the end of the month. cyear = default.year if res.year is None else res.year cmonth = default.month if res.month is None else res.month cday = default.day if res.day is None else res.day if cday > monthrange(cyear, cmonth)[1]: repl['day'] = monthrange(cyear, cmonth)[1] ret = default.replace(**repl) if res.weekday is not None and not res.day: ret = ret+relativedelta.relativedelta(weekday=res.weekday) if not ignoretz: if (isinstance(tzinfos, collections.Callable) or tzinfos and res.tzname in tzinfos): if isinstance(tzinfos, collections.Callable): tzdata = tzinfos(res.tzname, res.tzoffset) else: tzdata = tzinfos.get(res.tzname) if isinstance(tzdata, datetime.tzinfo): tzinfo = tzdata elif isinstance(tzdata, text_type): tzinfo = tz.tzstr(tzdata) elif isinstance(tzdata, integer_types): tzinfo = tz.tzoffset(res.tzname, tzdata) else: raise ValueError("Offset must be tzinfo subclass, " "tz string, or int offset.") ret = ret.replace(tzinfo=tzinfo) elif res.tzname and res.tzname in time.tzname: ret = ret.replace(tzinfo=tz.tzlocal()) elif res.tzoffset == 0: ret = ret.replace(tzinfo=tz.tzutc()) elif res.tzoffset: ret = ret.replace(tzinfo=tz.tzoffset(res.tzname, res.tzoffset)) if kwargs.get('fuzzy_with_tokens', False): return ret, skipped_tokens else: return ret class _result(_resultbase): __slots__ = ["year", "month", "day", "weekday", "hour", "minute", "second", "microsecond", "tzname", "tzoffset", "ampm"] def _parse(self, timestr, dayfirst=None, yearfirst=None, fuzzy=False, fuzzy_with_tokens=False): """ Private method which performs the heavy lifting of parsing, called from ``parse()``, which passes on its ``kwargs`` to this function. :param timestr: The string to parse. :param dayfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the day (``True``) or month (``False``). If ``yearfirst`` is set to ``True``, this distinguishes between YDM and YMD. If set to ``None``, this value is retrieved from the current :class:`parserinfo` object (which itself defaults to ``False``). :param yearfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the year. If ``True``, the first number is taken to be the year, otherwise the last number is taken to be the year. If this is set to ``None``, the value is retrieved from the current :class:`parserinfo` object (which itself defaults to ``False``). :param fuzzy: Whether to allow fuzzy parsing, allowing for string like "Today is January 1, 2047 at 8:21:00AM". :param fuzzy_with_tokens: If ``True``, ``fuzzy`` is automatically set to True, and the parser will return a tuple where the first element is the parsed :class:`datetime.datetime` datetimestamp and the second element is a tuple containing the portions of the string which were ignored: .. doctest:: >>> from dateutil.parser import parse >>> parse("Today is January 1, 2047 at 8:21:00AM", fuzzy_with_tokens=True) (datetime.datetime(2047, 1, 1, 8, 21), (u'Today is ', u' ', u'at ')) """ if fuzzy_with_tokens: fuzzy = True info = self.info if dayfirst is None: dayfirst = info.dayfirst if yearfirst is None: yearfirst = info.yearfirst res = self._result() l = _timelex.split(timestr) # Splits the timestr into tokens # keep up with the last token skipped so we can recombine # consecutively skipped tokens (-2 for when i begins at 0). last_skipped_token_i = -2 skipped_tokens = list() try: # year/month/day list ymd = _ymd(timestr) # Index of the month string in ymd mstridx = -1 len_l = len(l) i = 0 while i < len_l: # Check if it's a number try: value_repr = l[i] value = float(value_repr) except ValueError: value = None if value is not None: # Token is a number len_li = len(l[i]) i += 1 if (len(ymd) == 3 and len_li in (2, 4) and res.hour is None and (i >= len_l or (l[i] != ':' and info.hms(l[i]) is None))): # 19990101T23[59] s = l[i-1] res.hour = int(s[:2]) if len_li == 4: res.minute = int(s[2:]) elif len_li == 6 or (len_li > 6 and l[i-1].find('.') == 6): # YYMMDD or HHMMSS[.ss] s = l[i-1] if not ymd and l[i-1].find('.') == -1: #ymd.append(info.convertyear(int(s[:2]))) ymd.append(s[:2]) ymd.append(s[2:4]) ymd.append(s[4:]) else: # 19990101T235959[.59] res.hour = int(s[:2]) res.minute = int(s[2:4]) res.second, res.microsecond = _parsems(s[4:]) elif len_li in (8, 12, 14): # YYYYMMDD s = l[i-1] ymd.append(s[:4]) ymd.append(s[4:6]) ymd.append(s[6:8]) if len_li > 8: res.hour = int(s[8:10]) res.minute = int(s[10:12]) if len_li > 12: res.second = int(s[12:]) elif ((i < len_l and info.hms(l[i]) is not None) or (i+1 < len_l and l[i] == ' ' and info.hms(l[i+1]) is not None)): # HH[ ]h or MM[ ]m or SS[.ss][ ]s if l[i] == ' ': i += 1 idx = info.hms(l[i]) while True: if idx == 0: res.hour = int(value) if value % 1: res.minute = int(60*(value % 1)) elif idx == 1: res.minute = int(value) if value % 1: res.second = int(60*(value % 1)) elif idx == 2: res.second, res.microsecond = \ _parsems(value_repr) i += 1 if i >= len_l or idx == 2: break # 12h00 try: value_repr = l[i] value = float(value_repr) except ValueError: break else: i += 1 idx += 1 if i < len_l: newidx = info.hms(l[i]) if newidx is not None: idx = newidx elif (i == len_l and l[i-2] == ' ' and info.hms(l[i-3]) is not None): # X h MM or X m SS idx = info.hms(l[i-3]) if idx == 0: # h res.minute = int(value) sec_remainder = value % 1 if sec_remainder: res.second = int(60 * sec_remainder) elif idx == 1: # m res.second, res.microsecond = \ _parsems(value_repr) # We don't need to advance the tokens here because the # i == len_l call indicates that we're looking at all # the tokens already. elif i+1 < len_l and l[i] == ':': # HH:MM[:SS[.ss]] res.hour = int(value) i += 1 value = float(l[i]) res.minute = int(value) if value % 1: res.second = int(60*(value % 1)) i += 1 if i < len_l and l[i] == ':': res.second, res.microsecond = _parsems(l[i+1]) i += 2 elif i < len_l and l[i] in ('-', '/', '.'): sep = l[i] ymd.append(value_repr) i += 1 if i < len_l and not info.jump(l[i]): try: # 01-01[-01] ymd.append(l[i]) except ValueError: # 01-Jan[-01] value = info.month(l[i]) if value is not None: ymd.append(value) assert mstridx == -1 mstridx = len(ymd)-1 else: return None, None i += 1 if i < len_l and l[i] == sep: # We have three members i += 1 value = info.month(l[i]) if value is not None: ymd.append(value) mstridx = len(ymd)-1 assert mstridx == -1 else: ymd.append(l[i]) i += 1 elif i >= len_l or info.jump(l[i]): if i+1 < len_l and info.ampm(l[i+1]) is not None: # 12 am res.hour = int(value) if res.hour < 12 and info.ampm(l[i+1]) == 1: res.hour += 12 elif res.hour == 12 and info.ampm(l[i+1]) == 0: res.hour = 0 i += 1 else: # Year, month or day ymd.append(value) i += 1 elif info.ampm(l[i]) is not None: # 12am res.hour = int(value) if res.hour < 12 and info.ampm(l[i]) == 1: res.hour += 12 elif res.hour == 12 and info.ampm(l[i]) == 0: res.hour = 0 i += 1 elif not fuzzy: return None, None else: i += 1 continue # Check weekday value = info.weekday(l[i]) if value is not None: res.weekday = value i += 1 continue # Check month name value = info.month(l[i]) if value is not None: ymd.append(value) assert mstridx == -1 mstridx = len(ymd)-1 i += 1 if i < len_l: if l[i] in ('-', '/'): # Jan-01[-99] sep = l[i] i += 1 ymd.append(l[i]) i += 1 if i < len_l and l[i] == sep: # Jan-01-99 i += 1 ymd.append(l[i]) i += 1 elif (i+3 < len_l and l[i] == l[i+2] == ' ' and info.pertain(l[i+1])): # Jan of 01 # In this case, 01 is clearly year try: value = int(l[i+3]) except ValueError: # Wrong guess pass else: # Convert it here to become unambiguous ymd.append(str(info.convertyear(value))) i += 4 continue # Check am/pm value = info.ampm(l[i]) if value is not None: # For fuzzy parsing, 'a' or 'am' (both valid English words) # may erroneously trigger the AM/PM flag. Deal with that # here. val_is_ampm = True # If there's already an AM/PM flag, this one isn't one. if fuzzy and res.ampm is not None: val_is_ampm = False # If AM/PM is found and hour is not, raise a ValueError if res.hour is None: if fuzzy: val_is_ampm = False else: raise ValueError('No hour specified with ' + 'AM or PM flag.') elif not 0 <= res.hour <= 12: # If AM/PM is found, it's a 12 hour clock, so raise # an error for invalid range if fuzzy: val_is_ampm = False else: raise ValueError('Invalid hour specified for ' + '12-hour clock.') if val_is_ampm: if value == 1 and res.hour < 12: res.hour += 12 elif value == 0 and res.hour == 12: res.hour = 0 res.ampm = value elif fuzzy: last_skipped_token_i = self._skip_token(skipped_tokens, last_skipped_token_i, i, l) i += 1 continue # Check for a timezone name if (res.hour is not None and len(l[i]) <= 5 and res.tzname is None and res.tzoffset is None and not [x for x in l[i] if x not in string.ascii_uppercase]): res.tzname = l[i] res.tzoffset = info.tzoffset(res.tzname) i += 1 # Check for something like GMT+3, or BRST+3. Notice # that it doesn't mean "I am 3 hours after GMT", but # "my time +3 is GMT". If found, we reverse the # logic so that timezone parsing code will get it # right. if i < len_l and l[i] in ('+', '-'): l[i] = ('+', '-')[l[i] == '+'] res.tzoffset = None if info.utczone(res.tzname): # With something like GMT+3, the timezone # is *not* GMT. res.tzname = None continue # Check for a numbered timezone if res.hour is not None and l[i] in ('+', '-'): signal = (-1, 1)[l[i] == '+'] i += 1 len_li = len(l[i]) if len_li == 4: # -0300 res.tzoffset = int(l[i][:2])*3600+int(l[i][2:])*60 elif i+1 < len_l and l[i+1] == ':': # -03:00 res.tzoffset = int(l[i])*3600+int(l[i+2])*60 i += 2 elif len_li <= 2: # -[0]3 res.tzoffset = int(l[i][:2])*3600 else: return None, None i += 1 res.tzoffset *= signal # Look for a timezone name between parenthesis if (i+3 < len_l and info.jump(l[i]) and l[i+1] == '(' and l[i+3] == ')' and 3 <= len(l[i+2]) <= 5 and not [x for x in l[i+2] if x not in string.ascii_uppercase]): # -0300 (BRST) res.tzname = l[i+2] i += 4 continue # Check jumps if not (info.jump(l[i]) or fuzzy): return None, None last_skipped_token_i = self._skip_token(skipped_tokens, last_skipped_token_i, i, l) i += 1 # Process year/month/day year, month, day = ymd.resolve_ymd(mstridx, yearfirst, dayfirst) if year is not None: res.year = year res.century_specified = ymd.century_specified if month is not None: res.month = month if day is not None: res.day = day except (IndexError, ValueError, AssertionError): return None, None if not info.validate(res): return None, None if fuzzy_with_tokens: return res, tuple(skipped_tokens) else: return res, None @staticmethod def _skip_token(skipped_tokens, last_skipped_token_i, i, l): if last_skipped_token_i == i - 1: # recombine the tokens skipped_tokens[-1] += l[i] else: # just append skipped_tokens.append(l[i]) last_skipped_token_i = i return last_skipped_token_i DEFAULTPARSER = parser() def parse(timestr, parserinfo=None, **kwargs): """ Parse a string in one of the supported formats, using the ``parserinfo`` parameters. :param timestr: A string containing a date/time stamp. :param parserinfo: A :class:`parserinfo` object containing parameters for the parser. If ``None``, the default arguments to the :class:`parserinfo` constructor are used. The ``**kwargs`` parameter takes the following keyword arguments: :param default: The default datetime object, if this is a datetime object and not ``None``, elements specified in ``timestr`` replace elements in the default object. :param ignoretz: If set ``True``, time zones in parsed strings are ignored and a naive :class:`datetime` object is returned. :param tzinfos: Additional time zone names / aliases which may be present in the string. This argument maps time zone names (and optionally offsets from those time zones) to time zones. This parameter can be a dictionary with timezone aliases mapping time zone names to time zones or a function taking two parameters (``tzname`` and ``tzoffset``) and returning a time zone. The timezones to which the names are mapped can be an integer offset from UTC in minutes or a :class:`tzinfo` object. .. doctest:: :options: +NORMALIZE_WHITESPACE >>> from dateutil.parser import parse >>> from dateutil.tz import gettz >>> tzinfos = {"BRST": -10800, "CST": gettz("America/Chicago")} >>> parse("2012-01-19 17:21:00 BRST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzoffset(u'BRST', -10800)) >>> parse("2012-01-19 17:21:00 CST", tzinfos=tzinfos) datetime.datetime(2012, 1, 19, 17, 21, tzinfo=tzfile('/usr/share/zoneinfo/America/Chicago')) This parameter is ignored if ``ignoretz`` is set. :param dayfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the day (``True``) or month (``False``). If ``yearfirst`` is set to ``True``, this distinguishes between YDM and YMD. If set to ``None``, this value is retrieved from the current :class:`parserinfo` object (which itself defaults to ``False``). :param yearfirst: Whether to interpret the first value in an ambiguous 3-integer date (e.g. 01/05/09) as the year. If ``True``, the first number is taken to be the year, otherwise the last number is taken to be the year. If this is set to ``None``, the value is retrieved from the current :class:`parserinfo` object (which itself defaults to ``False``). :param fuzzy: Whether to allow fuzzy parsing, allowing for string like "Today is January 1, 2047 at 8:21:00AM". :param fuzzy_with_tokens: If ``True``, ``fuzzy`` is automatically set to True, and the parser will return a tuple where the first element is the parsed :class:`datetime.datetime` datetimestamp and the second element is a tuple containing the portions of the string which were ignored: .. doctest:: >>> from dateutil.parser import parse >>> parse("Today is January 1, 2047 at 8:21:00AM", fuzzy_with_tokens=True) (datetime.datetime(2047, 1, 1, 8, 21), (u'Today is ', u' ', u'at ')) :return: Returns a :class:`datetime.datetime` object or, if the ``fuzzy_with_tokens`` option is ``True``, returns a tuple, the first element being a :class:`datetime.datetime` object, the second a tuple containing the fuzzy tokens. :raises ValueError: Raised for invalid or unknown string format, if the provided :class:`tzinfo` is not in a valid format, or if an invalid date would be created. :raises OverflowError: Raised if the parsed date exceeds the largest valid C integer on your system. """ if parserinfo: return parser(parserinfo).parse(timestr, **kwargs) else: return DEFAULTPARSER.parse(timestr, **kwargs) class _tzparser(object): class _result(_resultbase): __slots__ = ["stdabbr", "stdoffset", "dstabbr", "dstoffset", "start", "end"] class _attr(_resultbase): __slots__ = ["month", "week", "weekday", "yday", "jyday", "day", "time"] def __repr__(self): return self._repr("") def __init__(self): _resultbase.__init__(self) self.start = self._attr() self.end = self._attr() def parse(self, tzstr): res = self._result() l = _timelex.split(tzstr) try: len_l = len(l) i = 0 while i < len_l: # BRST+3[BRDT[+2]] j = i while j < len_l and not [x for x in l[j] if x in "0123456789:,-+"]: j += 1 if j != i: if not res.stdabbr: offattr = "stdoffset" res.stdabbr = "".join(l[i:j]) else: offattr = "dstoffset" res.dstabbr = "".join(l[i:j]) i = j if (i < len_l and (l[i] in ('+', '-') or l[i][0] in "0123456789")): if l[i] in ('+', '-'): # Yes, that's right. See the TZ variable # documentation. signal = (1, -1)[l[i] == '+'] i += 1 else: signal = -1 len_li = len(l[i]) if len_li == 4: # -0300 setattr(res, offattr, (int(l[i][:2])*3600 + int(l[i][2:])*60)*signal) elif i+1 < len_l and l[i+1] == ':': # -03:00 setattr(res, offattr, (int(l[i])*3600+int(l[i+2])*60)*signal) i += 2 elif len_li <= 2: # -[0]3 setattr(res, offattr, int(l[i][:2])*3600*signal) else: return None i += 1 if res.dstabbr: break else: break if i < len_l: for j in range(i, len_l): if l[j] == ';': l[j] = ',' assert l[i] == ',' i += 1 if i >= len_l: pass elif (8 <= l.count(',') <= 9 and not [y for x in l[i:] if x != ',' for y in x if y not in "0123456789"]): # GMT0BST,3,0,30,3600,10,0,26,7200[,3600] for x in (res.start, res.end): x.month = int(l[i]) i += 2 if l[i] == '-': value = int(l[i+1])*-1 i += 1 else: value = int(l[i]) i += 2 if value: x.week = value x.weekday = (int(l[i])-1) % 7 else: x.day = int(l[i]) i += 2 x.time = int(l[i]) i += 2 if i < len_l: if l[i] in ('-', '+'): signal = (-1, 1)[l[i] == "+"] i += 1 else: signal = 1 res.dstoffset = (res.stdoffset+int(l[i]))*signal elif (l.count(',') == 2 and l[i:].count('/') <= 2 and not [y for x in l[i:] if x not in (',', '/', 'J', 'M', '.', '-', ':') for y in x if y not in "0123456789"]): for x in (res.start, res.end): if l[i] == 'J': # non-leap year day (1 based) i += 1 x.jyday = int(l[i]) elif l[i] == 'M': # month[-.]week[-.]weekday i += 1 x.month = int(l[i]) i += 1 assert l[i] in ('-', '.') i += 1 x.week = int(l[i]) if x.week == 5: x.week = -1 i += 1 assert l[i] in ('-', '.') i += 1 x.weekday = (int(l[i])-1) % 7 else: # year day (zero based) x.yday = int(l[i])+1 i += 1 if i < len_l and l[i] == '/': i += 1 # start time len_li = len(l[i]) if len_li == 4: # -0300 x.time = (int(l[i][:2])*3600+int(l[i][2:])*60) elif i+1 < len_l and l[i+1] == ':': # -03:00 x.time = int(l[i])*3600+int(l[i+2])*60 i += 2 if i+1 < len_l and l[i+1] == ':': i += 2 x.time += int(l[i]) elif len_li <= 2: # -[0]3 x.time = (int(l[i][:2])*3600) else: return None i += 1 assert i == len_l or l[i] == ',' i += 1 assert i >= len_l except (IndexError, ValueError, AssertionError): return None return res DEFAULTTZPARSER = _tzparser() def _parsetz(tzstr): return DEFAULTTZPARSER.parse(tzstr) def _parsems(value): """Parse a I[.F] seconds value into (seconds, microseconds).""" if "." not in value: return int(value), 0 else: i, f = value.split(".") return int(i), int(f.ljust(6, "0")[:6]) # vim:ts=4:sw=4:et relativedelta.py000064400000055151147204751220007756 0ustar00# -*- coding: utf-8 -*- import datetime import calendar import operator from math import copysign from six import integer_types from warnings import warn from ._common import weekday MO, TU, WE, TH, FR, SA, SU = weekdays = tuple(weekday(x) for x in range(7)) __all__ = ["relativedelta", "MO", "TU", "WE", "TH", "FR", "SA", "SU"] class relativedelta(object): """ The relativedelta type is based on the specification of the excellent work done by M.-A. Lemburg in his `mx.DateTime `_ extension. However, notice that this type does *NOT* implement the same algorithm as his work. Do *NOT* expect it to behave like mx.DateTime's counterpart. There are two different ways to build a relativedelta instance. The first one is passing it two date/datetime classes:: relativedelta(datetime1, datetime2) The second one is passing it any number of the following keyword arguments:: relativedelta(arg1=x,arg2=y,arg3=z...) year, month, day, hour, minute, second, microsecond: Absolute information (argument is singular); adding or subtracting a relativedelta with absolute information does not perform an aritmetic operation, but rather REPLACES the corresponding value in the original datetime with the value(s) in relativedelta. years, months, weeks, days, hours, minutes, seconds, microseconds: Relative information, may be negative (argument is plural); adding or subtracting a relativedelta with relative information performs the corresponding aritmetic operation on the original datetime value with the information in the relativedelta. weekday: One of the weekday instances (MO, TU, etc). These instances may receive a parameter N, specifying the Nth weekday, which could be positive or negative (like MO(+1) or MO(-2). Not specifying it is the same as specifying +1. You can also use an integer, where 0=MO. leapdays: Will add given days to the date found, if year is a leap year, and the date found is post 28 of february. yearday, nlyearday: Set the yearday or the non-leap year day (jump leap days). These are converted to day/month/leapdays information. Here is the behavior of operations with relativedelta: 1. Calculate the absolute year, using the 'year' argument, or the original datetime year, if the argument is not present. 2. Add the relative 'years' argument to the absolute year. 3. Do steps 1 and 2 for month/months. 4. Calculate the absolute day, using the 'day' argument, or the original datetime day, if the argument is not present. Then, subtract from the day until it fits in the year and month found after their operations. 5. Add the relative 'days' argument to the absolute day. Notice that the 'weeks' argument is multiplied by 7 and added to 'days'. 6. Do steps 1 and 2 for hour/hours, minute/minutes, second/seconds, microsecond/microseconds. 7. If the 'weekday' argument is present, calculate the weekday, with the given (wday, nth) tuple. wday is the index of the weekday (0-6, 0=Mon), and nth is the number of weeks to add forward or backward, depending on its signal. Notice that if the calculated date is already Monday, for example, using (0, 1) or (0, -1) won't change the day. """ def __init__(self, dt1=None, dt2=None, years=0, months=0, days=0, leapdays=0, weeks=0, hours=0, minutes=0, seconds=0, microseconds=0, year=None, month=None, day=None, weekday=None, yearday=None, nlyearday=None, hour=None, minute=None, second=None, microsecond=None): # Check for non-integer values in integer-only quantities if any(x is not None and x != int(x) for x in (years, months)): raise ValueError("Non-integer years and months are " "ambiguous and not currently supported.") if dt1 and dt2: # datetime is a subclass of date. So both must be date if not (isinstance(dt1, datetime.date) and isinstance(dt2, datetime.date)): raise TypeError("relativedelta only diffs datetime/date") # We allow two dates, or two datetimes, so we coerce them to be # of the same type if (isinstance(dt1, datetime.datetime) != isinstance(dt2, datetime.datetime)): if not isinstance(dt1, datetime.datetime): dt1 = datetime.datetime.fromordinal(dt1.toordinal()) elif not isinstance(dt2, datetime.datetime): dt2 = datetime.datetime.fromordinal(dt2.toordinal()) self.years = 0 self.months = 0 self.days = 0 self.leapdays = 0 self.hours = 0 self.minutes = 0 self.seconds = 0 self.microseconds = 0 self.year = None self.month = None self.day = None self.weekday = None self.hour = None self.minute = None self.second = None self.microsecond = None self._has_time = 0 # Get year / month delta between the two months = (dt1.year - dt2.year) * 12 + (dt1.month - dt2.month) self._set_months(months) # Remove the year/month delta so the timedelta is just well-defined # time units (seconds, days and microseconds) dtm = self.__radd__(dt2) # If we've overshot our target, make an adjustment if dt1 < dt2: compare = operator.gt increment = 1 else: compare = operator.lt increment = -1 while compare(dt1, dtm): months += increment self._set_months(months) dtm = self.__radd__(dt2) # Get the timedelta between the "months-adjusted" date and dt1 delta = dt1 - dtm self.seconds = delta.seconds + delta.days * 86400 self.microseconds = delta.microseconds else: # Relative information self.years = years self.months = months self.days = days + weeks * 7 self.leapdays = leapdays self.hours = hours self.minutes = minutes self.seconds = seconds self.microseconds = microseconds # Absolute information self.year = year self.month = month self.day = day self.hour = hour self.minute = minute self.second = second self.microsecond = microsecond if any(x is not None and int(x) != x for x in (year, month, day, hour, minute, second, microsecond)): # For now we'll deprecate floats - later it'll be an error. warn("Non-integer value passed as absolute information. " + "This is not a well-defined condition and will raise " + "errors in future versions.", DeprecationWarning) if isinstance(weekday, integer_types): self.weekday = weekdays[weekday] else: self.weekday = weekday yday = 0 if nlyearday: yday = nlyearday elif yearday: yday = yearday if yearday > 59: self.leapdays = -1 if yday: ydayidx = [31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 366] for idx, ydays in enumerate(ydayidx): if yday <= ydays: self.month = idx+1 if idx == 0: self.day = yday else: self.day = yday-ydayidx[idx-1] break else: raise ValueError("invalid year day (%d)" % yday) self._fix() def _fix(self): if abs(self.microseconds) > 999999: s = _sign(self.microseconds) div, mod = divmod(self.microseconds * s, 1000000) self.microseconds = mod * s self.seconds += div * s if abs(self.seconds) > 59: s = _sign(self.seconds) div, mod = divmod(self.seconds * s, 60) self.seconds = mod * s self.minutes += div * s if abs(self.minutes) > 59: s = _sign(self.minutes) div, mod = divmod(self.minutes * s, 60) self.minutes = mod * s self.hours += div * s if abs(self.hours) > 23: s = _sign(self.hours) div, mod = divmod(self.hours * s, 24) self.hours = mod * s self.days += div * s if abs(self.months) > 11: s = _sign(self.months) div, mod = divmod(self.months * s, 12) self.months = mod * s self.years += div * s if (self.hours or self.minutes or self.seconds or self.microseconds or self.hour is not None or self.minute is not None or self.second is not None or self.microsecond is not None): self._has_time = 1 else: self._has_time = 0 @property def weeks(self): return self.days // 7 @weeks.setter def weeks(self, value): self.days = self.days - (self.weeks * 7) + value * 7 def _set_months(self, months): self.months = months if abs(self.months) > 11: s = _sign(self.months) div, mod = divmod(self.months * s, 12) self.months = mod * s self.years = div * s else: self.years = 0 def normalized(self): """ Return a version of this object represented entirely using integer values for the relative attributes. >>> relativedelta(days=1.5, hours=2).normalized() relativedelta(days=1, hours=14) :return: Returns a :class:`dateutil.relativedelta.relativedelta` object. """ # Cascade remainders down (rounding each to roughly nearest microsecond) days = int(self.days) hours_f = round(self.hours + 24 * (self.days - days), 11) hours = int(hours_f) minutes_f = round(self.minutes + 60 * (hours_f - hours), 10) minutes = int(minutes_f) seconds_f = round(self.seconds + 60 * (minutes_f - minutes), 8) seconds = int(seconds_f) microseconds = round(self.microseconds + 1e6 * (seconds_f - seconds)) # Constructor carries overflow back up with call to _fix() return self.__class__(years=self.years, months=self.months, days=days, hours=hours, minutes=minutes, seconds=seconds, microseconds=microseconds, leapdays=self.leapdays, year=self.year, month=self.month, day=self.day, weekday=self.weekday, hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond) def __add__(self, other): if isinstance(other, relativedelta): return self.__class__(years=other.years + self.years, months=other.months + self.months, days=other.days + self.days, hours=other.hours + self.hours, minutes=other.minutes + self.minutes, seconds=other.seconds + self.seconds, microseconds=(other.microseconds + self.microseconds), leapdays=other.leapdays or self.leapdays, year=(other.year if other.year is not None else self.year), month=(other.month if other.month is not None else self.month), day=(other.day if other.day is not None else self.day), weekday=(other.weekday if other.weekday is not None else self.weekday), hour=(other.hour if other.hour is not None else self.hour), minute=(other.minute if other.minute is not None else self.minute), second=(other.second if other.second is not None else self.second), microsecond=(other.microsecond if other.microsecond is not None else self.microsecond)) if isinstance(other, datetime.timedelta): return self.__class__(years=self.years, months=self.months, days=self.days + other.days, hours=self.hours, minutes=self.minutes, seconds=self.seconds + other.seconds, microseconds=self.microseconds + other.microseconds, leapdays=self.leapdays, year=self.year, month=self.month, day=self.day, weekday=self.weekday, hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond) if not isinstance(other, datetime.date): return NotImplemented elif self._has_time and not isinstance(other, datetime.datetime): other = datetime.datetime.fromordinal(other.toordinal()) year = (self.year or other.year)+self.years month = self.month or other.month if self.months: assert 1 <= abs(self.months) <= 12 month += self.months if month > 12: year += 1 month -= 12 elif month < 1: year -= 1 month += 12 day = min(calendar.monthrange(year, month)[1], self.day or other.day) repl = {"year": year, "month": month, "day": day} for attr in ["hour", "minute", "second", "microsecond"]: value = getattr(self, attr) if value is not None: repl[attr] = value days = self.days if self.leapdays and month > 2 and calendar.isleap(year): days += self.leapdays ret = (other.replace(**repl) + datetime.timedelta(days=days, hours=self.hours, minutes=self.minutes, seconds=self.seconds, microseconds=self.microseconds)) if self.weekday: weekday, nth = self.weekday.weekday, self.weekday.n or 1 jumpdays = (abs(nth) - 1) * 7 if nth > 0: jumpdays += (7 - ret.weekday() + weekday) % 7 else: jumpdays += (ret.weekday() - weekday) % 7 jumpdays *= -1 ret += datetime.timedelta(days=jumpdays) return ret def __radd__(self, other): return self.__add__(other) def __rsub__(self, other): return self.__neg__().__radd__(other) def __sub__(self, other): if not isinstance(other, relativedelta): return NotImplemented # In case the other object defines __rsub__ return self.__class__(years=self.years - other.years, months=self.months - other.months, days=self.days - other.days, hours=self.hours - other.hours, minutes=self.minutes - other.minutes, seconds=self.seconds - other.seconds, microseconds=self.microseconds - other.microseconds, leapdays=self.leapdays or other.leapdays, year=(self.year if self.year is not None else other.year), month=(self.month if self.month is not None else other.month), day=(self.day if self.day is not None else other.day), weekday=(self.weekday if self.weekday is not None else other.weekday), hour=(self.hour if self.hour is not None else other.hour), minute=(self.minute if self.minute is not None else other.minute), second=(self.second if self.second is not None else other.second), microsecond=(self.microsecond if self.microsecond is not None else other.microsecond)) def __neg__(self): return self.__class__(years=-self.years, months=-self.months, days=-self.days, hours=-self.hours, minutes=-self.minutes, seconds=-self.seconds, microseconds=-self.microseconds, leapdays=self.leapdays, year=self.year, month=self.month, day=self.day, weekday=self.weekday, hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond) def __bool__(self): return not (not self.years and not self.months and not self.days and not self.hours and not self.minutes and not self.seconds and not self.microseconds and not self.leapdays and self.year is None and self.month is None and self.day is None and self.weekday is None and self.hour is None and self.minute is None and self.second is None and self.microsecond is None) # Compatibility with Python 2.x __nonzero__ = __bool__ def __mul__(self, other): try: f = float(other) except TypeError: return NotImplemented return self.__class__(years=int(self.years * f), months=int(self.months * f), days=int(self.days * f), hours=int(self.hours * f), minutes=int(self.minutes * f), seconds=int(self.seconds * f), microseconds=int(self.microseconds * f), leapdays=self.leapdays, year=self.year, month=self.month, day=self.day, weekday=self.weekday, hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond) __rmul__ = __mul__ def __eq__(self, other): if not isinstance(other, relativedelta): return NotImplemented if self.weekday or other.weekday: if not self.weekday or not other.weekday: return False if self.weekday.weekday != other.weekday.weekday: return False n1, n2 = self.weekday.n, other.weekday.n if n1 != n2 and not ((not n1 or n1 == 1) and (not n2 or n2 == 1)): return False return (self.years == other.years and self.months == other.months and self.days == other.days and self.hours == other.hours and self.minutes == other.minutes and self.seconds == other.seconds and self.microseconds == other.microseconds and self.leapdays == other.leapdays and self.year == other.year and self.month == other.month and self.day == other.day and self.hour == other.hour and self.minute == other.minute and self.second == other.second and self.microsecond == other.microsecond) __hash__ = None def __ne__(self, other): return not self.__eq__(other) def __div__(self, other): try: reciprocal = 1 / float(other) except TypeError: return NotImplemented return self.__mul__(reciprocal) __truediv__ = __div__ def __repr__(self): l = [] for attr in ["years", "months", "days", "leapdays", "hours", "minutes", "seconds", "microseconds"]: value = getattr(self, attr) if value: l.append("{attr}={value:+g}".format(attr=attr, value=value)) for attr in ["year", "month", "day", "weekday", "hour", "minute", "second", "microsecond"]: value = getattr(self, attr) if value is not None: l.append("{attr}={value}".format(attr=attr, value=repr(value))) return "{classname}({attrs})".format(classname=self.__class__.__name__, attrs=", ".join(l)) def _sign(x): return int(copysign(1, x)) # vim:ts=4:sw=4:et rrule.py000064400000170613147204751220006263 0ustar00# -*- coding: utf-8 -*- """ The rrule module offers a small, complete, and very fast, implementation of the recurrence rules documented in the `iCalendar RFC `_, including support for caching of results. """ import itertools import datetime import calendar import sys try: from math import gcd except ImportError: from fractions import gcd from six import advance_iterator, integer_types from six.moves import _thread, range import heapq from ._common import weekday as weekdaybase # For warning about deprecation of until and count from warnings import warn __all__ = ["rrule", "rruleset", "rrulestr", "YEARLY", "MONTHLY", "WEEKLY", "DAILY", "HOURLY", "MINUTELY", "SECONDLY", "MO", "TU", "WE", "TH", "FR", "SA", "SU"] # Every mask is 7 days longer to handle cross-year weekly periods. M366MASK = tuple([1]*31+[2]*29+[3]*31+[4]*30+[5]*31+[6]*30 + [7]*31+[8]*31+[9]*30+[10]*31+[11]*30+[12]*31+[1]*7) M365MASK = list(M366MASK) M29, M30, M31 = list(range(1, 30)), list(range(1, 31)), list(range(1, 32)) MDAY366MASK = tuple(M31+M29+M31+M30+M31+M30+M31+M31+M30+M31+M30+M31+M31[:7]) MDAY365MASK = list(MDAY366MASK) M29, M30, M31 = list(range(-29, 0)), list(range(-30, 0)), list(range(-31, 0)) NMDAY366MASK = tuple(M31+M29+M31+M30+M31+M30+M31+M31+M30+M31+M30+M31+M31[:7]) NMDAY365MASK = list(NMDAY366MASK) M366RANGE = (0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366) M365RANGE = (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365) WDAYMASK = [0, 1, 2, 3, 4, 5, 6]*55 del M29, M30, M31, M365MASK[59], MDAY365MASK[59], NMDAY365MASK[31] MDAY365MASK = tuple(MDAY365MASK) M365MASK = tuple(M365MASK) FREQNAMES = ['YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY', 'HOURLY', 'MINUTELY', 'SECONDLY'] (YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) = list(range(7)) # Imported on demand. easter = None parser = None class weekday(weekdaybase): """ This version of weekday does not allow n = 0. """ def __init__(self, wkday, n=None): if n == 0: raise ValueError("Can't create weekday with n==0") super(weekday, self).__init__(wkday, n) MO, TU, WE, TH, FR, SA, SU = weekdays = tuple(weekday(x) for x in range(7)) def _invalidates_cache(f): """ Decorator for rruleset methods which may invalidate the cached length. """ def inner_func(self, *args, **kwargs): rv = f(self, *args, **kwargs) self._invalidate_cache() return rv return inner_func class rrulebase(object): def __init__(self, cache=False): if cache: self._cache = [] self._cache_lock = _thread.allocate_lock() self._invalidate_cache() else: self._cache = None self._cache_complete = False self._len = None def __iter__(self): if self._cache_complete: return iter(self._cache) elif self._cache is None: return self._iter() else: return self._iter_cached() def _invalidate_cache(self): if self._cache is not None: self._cache = [] self._cache_complete = False self._cache_gen = self._iter() if self._cache_lock.locked(): self._cache_lock.release() self._len = None def _iter_cached(self): i = 0 gen = self._cache_gen cache = self._cache acquire = self._cache_lock.acquire release = self._cache_lock.release while gen: if i == len(cache): acquire() if self._cache_complete: break try: for j in range(10): cache.append(advance_iterator(gen)) except StopIteration: self._cache_gen = gen = None self._cache_complete = True break release() yield cache[i] i += 1 while i < self._len: yield cache[i] i += 1 def __getitem__(self, item): if self._cache_complete: return self._cache[item] elif isinstance(item, slice): if item.step and item.step < 0: return list(iter(self))[item] else: return list(itertools.islice(self, item.start or 0, item.stop or sys.maxsize, item.step or 1)) elif item >= 0: gen = iter(self) try: for i in range(item+1): res = advance_iterator(gen) except StopIteration: raise IndexError return res else: return list(iter(self))[item] def __contains__(self, item): if self._cache_complete: return item in self._cache else: for i in self: if i == item: return True elif i > item: return False return False # __len__() introduces a large performance penality. def count(self): """ Returns the number of recurrences in this set. It will have go trough the whole recurrence, if this hasn't been done before. """ if self._len is None: for x in self: pass return self._len def before(self, dt, inc=False): """ Returns the last recurrence before the given datetime instance. The inc keyword defines what happens if dt is an occurrence. With inc=True, if dt itself is an occurrence, it will be returned. """ if self._cache_complete: gen = self._cache else: gen = self last = None if inc: for i in gen: if i > dt: break last = i else: for i in gen: if i >= dt: break last = i return last def after(self, dt, inc=False): """ Returns the first recurrence after the given datetime instance. The inc keyword defines what happens if dt is an occurrence. With inc=True, if dt itself is an occurrence, it will be returned. """ if self._cache_complete: gen = self._cache else: gen = self if inc: for i in gen: if i >= dt: return i else: for i in gen: if i > dt: return i return None def xafter(self, dt, count=None, inc=False): """ Generator which yields up to `count` recurrences after the given datetime instance, equivalent to `after`. :param dt: The datetime at which to start generating recurrences. :param count: The maximum number of recurrences to generate. If `None` (default), dates are generated until the recurrence rule is exhausted. :param inc: If `dt` is an instance of the rule and `inc` is `True`, it is included in the output. :yields: Yields a sequence of `datetime` objects. """ if self._cache_complete: gen = self._cache else: gen = self # Select the comparison function if inc: comp = lambda dc, dtc: dc >= dtc else: comp = lambda dc, dtc: dc > dtc # Generate dates n = 0 for d in gen: if comp(d, dt): if count is not None: n += 1 if n > count: break yield d def between(self, after, before, inc=False, count=1): """ Returns all the occurrences of the rrule between after and before. The inc keyword defines what happens if after and/or before are themselves occurrences. With inc=True, they will be included in the list, if they are found in the recurrence set. """ if self._cache_complete: gen = self._cache else: gen = self started = False l = [] if inc: for i in gen: if i > before: break elif not started: if i >= after: started = True l.append(i) else: l.append(i) else: for i in gen: if i >= before: break elif not started: if i > after: started = True l.append(i) else: l.append(i) return l class rrule(rrulebase): """ That's the base of the rrule operation. It accepts all the keywords defined in the RFC as its constructor parameters (except byday, which was renamed to byweekday) and more. The constructor prototype is:: rrule(freq) Where freq must be one of YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, or SECONDLY. .. note:: Per RFC section 3.3.10, recurrence instances falling on invalid dates and times are ignored rather than coerced: Recurrence rules may generate recurrence instances with an invalid date (e.g., February 30) or nonexistent local time (e.g., 1:30 AM on a day where the local time is moved forward by an hour at 1:00 AM). Such recurrence instances MUST be ignored and MUST NOT be counted as part of the recurrence set. This can lead to possibly surprising behavior when, for example, the start date occurs at the end of the month: >>> from dateutil.rrule import rrule, MONTHLY >>> from datetime import datetime >>> start_date = datetime(2014, 12, 31) >>> list(rrule(freq=MONTHLY, count=4, dtstart=start_date)) ... # doctest: +NORMALIZE_WHITESPACE [datetime.datetime(2014, 12, 31, 0, 0), datetime.datetime(2015, 1, 31, 0, 0), datetime.datetime(2015, 3, 31, 0, 0), datetime.datetime(2015, 5, 31, 0, 0)] Additionally, it supports the following keyword arguments: :param cache: If given, it must be a boolean value specifying to enable or disable caching of results. If you will use the same rrule instance multiple times, enabling caching will improve the performance considerably. :param dtstart: The recurrence start. Besides being the base for the recurrence, missing parameters in the final recurrence instances will also be extracted from this date. If not given, datetime.now() will be used instead. :param interval: The interval between each freq iteration. For example, when using YEARLY, an interval of 2 means once every two years, but with HOURLY, it means once every two hours. The default interval is 1. :param wkst: The week start day. Must be one of the MO, TU, WE constants, or an integer, specifying the first day of the week. This will affect recurrences based on weekly periods. The default week start is got from calendar.firstweekday(), and may be modified by calendar.setfirstweekday(). :param count: How many occurrences will be generated. .. note:: As of version 2.5.0, the use of the ``until`` keyword together with the ``count`` keyword is deprecated per RFC-2445 Sec. 4.3.10. :param until: If given, this must be a datetime instance, that will specify the limit of the recurrence. The last recurrence in the rule is the greatest datetime that is less than or equal to the value specified in the ``until`` parameter. .. note:: As of version 2.5.0, the use of the ``until`` keyword together with the ``count`` keyword is deprecated per RFC-2445 Sec. 4.3.10. :param bysetpos: If given, it must be either an integer, or a sequence of integers, positive or negative. Each given integer will specify an occurrence number, corresponding to the nth occurrence of the rule inside the frequency period. For example, a bysetpos of -1 if combined with a MONTHLY frequency, and a byweekday of (MO, TU, WE, TH, FR), will result in the last work day of every month. :param bymonth: If given, it must be either an integer, or a sequence of integers, meaning the months to apply the recurrence to. :param bymonthday: If given, it must be either an integer, or a sequence of integers, meaning the month days to apply the recurrence to. :param byyearday: If given, it must be either an integer, or a sequence of integers, meaning the year days to apply the recurrence to. :param byweekno: If given, it must be either an integer, or a sequence of integers, meaning the week numbers to apply the recurrence to. Week numbers have the meaning described in ISO8601, that is, the first week of the year is that containing at least four days of the new year. :param byweekday: If given, it must be either an integer (0 == MO), a sequence of integers, one of the weekday constants (MO, TU, etc), or a sequence of these constants. When given, these variables will define the weekdays where the recurrence will be applied. It's also possible to use an argument n for the weekday instances, which will mean the nth occurrence of this weekday in the period. For example, with MONTHLY, or with YEARLY and BYMONTH, using FR(+1) in byweekday will specify the first friday of the month where the recurrence happens. Notice that in the RFC documentation, this is specified as BYDAY, but was renamed to avoid the ambiguity of that keyword. :param byhour: If given, it must be either an integer, or a sequence of integers, meaning the hours to apply the recurrence to. :param byminute: If given, it must be either an integer, or a sequence of integers, meaning the minutes to apply the recurrence to. :param bysecond: If given, it must be either an integer, or a sequence of integers, meaning the seconds to apply the recurrence to. :param byeaster: If given, it must be either an integer, or a sequence of integers, positive or negative. Each integer will define an offset from the Easter Sunday. Passing the offset 0 to byeaster will yield the Easter Sunday itself. This is an extension to the RFC specification. """ def __init__(self, freq, dtstart=None, interval=1, wkst=None, count=None, until=None, bysetpos=None, bymonth=None, bymonthday=None, byyearday=None, byeaster=None, byweekno=None, byweekday=None, byhour=None, byminute=None, bysecond=None, cache=False): super(rrule, self).__init__(cache) global easter if not dtstart: dtstart = datetime.datetime.now().replace(microsecond=0) elif not isinstance(dtstart, datetime.datetime): dtstart = datetime.datetime.fromordinal(dtstart.toordinal()) else: dtstart = dtstart.replace(microsecond=0) self._dtstart = dtstart self._tzinfo = dtstart.tzinfo self._freq = freq self._interval = interval self._count = count # Cache the original byxxx rules, if they are provided, as the _byxxx # attributes do not necessarily map to the inputs, and this can be # a problem in generating the strings. Only store things if they've # been supplied (the string retrieval will just use .get()) self._original_rule = {} if until and not isinstance(until, datetime.datetime): until = datetime.datetime.fromordinal(until.toordinal()) self._until = until if count is not None and until: warn("Using both 'count' and 'until' is inconsistent with RFC 2445" " and has been deprecated in dateutil. Future versions will " "raise an error.", DeprecationWarning) if wkst is None: self._wkst = calendar.firstweekday() elif isinstance(wkst, integer_types): self._wkst = wkst else: self._wkst = wkst.weekday if bysetpos is None: self._bysetpos = None elif isinstance(bysetpos, integer_types): if bysetpos == 0 or not (-366 <= bysetpos <= 366): raise ValueError("bysetpos must be between 1 and 366, " "or between -366 and -1") self._bysetpos = (bysetpos,) else: self._bysetpos = tuple(bysetpos) for pos in self._bysetpos: if pos == 0 or not (-366 <= pos <= 366): raise ValueError("bysetpos must be between 1 and 366, " "or between -366 and -1") if self._bysetpos: self._original_rule['bysetpos'] = self._bysetpos if (byweekno is None and byyearday is None and bymonthday is None and byweekday is None and byeaster is None): if freq == YEARLY: if bymonth is None: bymonth = dtstart.month self._original_rule['bymonth'] = None bymonthday = dtstart.day self._original_rule['bymonthday'] = None elif freq == MONTHLY: bymonthday = dtstart.day self._original_rule['bymonthday'] = None elif freq == WEEKLY: byweekday = dtstart.weekday() self._original_rule['byweekday'] = None # bymonth if bymonth is None: self._bymonth = None else: if isinstance(bymonth, integer_types): bymonth = (bymonth,) self._bymonth = tuple(sorted(set(bymonth))) if 'bymonth' not in self._original_rule: self._original_rule['bymonth'] = self._bymonth # byyearday if byyearday is None: self._byyearday = None else: if isinstance(byyearday, integer_types): byyearday = (byyearday,) self._byyearday = tuple(sorted(set(byyearday))) self._original_rule['byyearday'] = self._byyearday # byeaster if byeaster is not None: if not easter: from dateutil import easter if isinstance(byeaster, integer_types): self._byeaster = (byeaster,) else: self._byeaster = tuple(sorted(byeaster)) self._original_rule['byeaster'] = self._byeaster else: self._byeaster = None # bymonthday if bymonthday is None: self._bymonthday = () self._bynmonthday = () else: if isinstance(bymonthday, integer_types): bymonthday = (bymonthday,) bymonthday = set(bymonthday) # Ensure it's unique self._bymonthday = tuple(sorted(x for x in bymonthday if x > 0)) self._bynmonthday = tuple(sorted(x for x in bymonthday if x < 0)) # Storing positive numbers first, then negative numbers if 'bymonthday' not in self._original_rule: self._original_rule['bymonthday'] = tuple( itertools.chain(self._bymonthday, self._bynmonthday)) # byweekno if byweekno is None: self._byweekno = None else: if isinstance(byweekno, integer_types): byweekno = (byweekno,) self._byweekno = tuple(sorted(set(byweekno))) self._original_rule['byweekno'] = self._byweekno # byweekday / bynweekday if byweekday is None: self._byweekday = None self._bynweekday = None else: # If it's one of the valid non-sequence types, convert to a # single-element sequence before the iterator that builds the # byweekday set. if isinstance(byweekday, integer_types) or hasattr(byweekday, "n"): byweekday = (byweekday,) self._byweekday = set() self._bynweekday = set() for wday in byweekday: if isinstance(wday, integer_types): self._byweekday.add(wday) elif not wday.n or freq > MONTHLY: self._byweekday.add(wday.weekday) else: self._bynweekday.add((wday.weekday, wday.n)) if not self._byweekday: self._byweekday = None elif not self._bynweekday: self._bynweekday = None if self._byweekday is not None: self._byweekday = tuple(sorted(self._byweekday)) orig_byweekday = [weekday(x) for x in self._byweekday] else: orig_byweekday = tuple() if self._bynweekday is not None: self._bynweekday = tuple(sorted(self._bynweekday)) orig_bynweekday = [weekday(*x) for x in self._bynweekday] else: orig_bynweekday = tuple() if 'byweekday' not in self._original_rule: self._original_rule['byweekday'] = tuple(itertools.chain( orig_byweekday, orig_bynweekday)) # byhour if byhour is None: if freq < HOURLY: self._byhour = set((dtstart.hour,)) else: self._byhour = None else: if isinstance(byhour, integer_types): byhour = (byhour,) if freq == HOURLY: self._byhour = self.__construct_byset(start=dtstart.hour, byxxx=byhour, base=24) else: self._byhour = set(byhour) self._byhour = tuple(sorted(self._byhour)) self._original_rule['byhour'] = self._byhour # byminute if byminute is None: if freq < MINUTELY: self._byminute = set((dtstart.minute,)) else: self._byminute = None else: if isinstance(byminute, integer_types): byminute = (byminute,) if freq == MINUTELY: self._byminute = self.__construct_byset(start=dtstart.minute, byxxx=byminute, base=60) else: self._byminute = set(byminute) self._byminute = tuple(sorted(self._byminute)) self._original_rule['byminute'] = self._byminute # bysecond if bysecond is None: if freq < SECONDLY: self._bysecond = ((dtstart.second,)) else: self._bysecond = None else: if isinstance(bysecond, integer_types): bysecond = (bysecond,) self._bysecond = set(bysecond) if freq == SECONDLY: self._bysecond = self.__construct_byset(start=dtstart.second, byxxx=bysecond, base=60) else: self._bysecond = set(bysecond) self._bysecond = tuple(sorted(self._bysecond)) self._original_rule['bysecond'] = self._bysecond if self._freq >= HOURLY: self._timeset = None else: self._timeset = [] for hour in self._byhour: for minute in self._byminute: for second in self._bysecond: self._timeset.append( datetime.time(hour, minute, second, tzinfo=self._tzinfo)) self._timeset.sort() self._timeset = tuple(self._timeset) def __str__(self): """ Output a string that would generate this RRULE if passed to rrulestr. This is mostly compatible with RFC2445, except for the dateutil-specific extension BYEASTER. """ output = [] h, m, s = [None] * 3 if self._dtstart: output.append(self._dtstart.strftime('DTSTART:%Y%m%dT%H%M%S')) h, m, s = self._dtstart.timetuple()[3:6] parts = ['FREQ=' + FREQNAMES[self._freq]] if self._interval != 1: parts.append('INTERVAL=' + str(self._interval)) if self._wkst: parts.append('WKST=' + repr(weekday(self._wkst))[0:2]) if self._count is not None: parts.append('COUNT=' + str(self._count)) if self._until: parts.append(self._until.strftime('UNTIL=%Y%m%dT%H%M%S')) if self._original_rule.get('byweekday') is not None: # The str() method on weekday objects doesn't generate # RFC2445-compliant strings, so we should modify that. original_rule = dict(self._original_rule) wday_strings = [] for wday in original_rule['byweekday']: if wday.n: wday_strings.append('{n:+d}{wday}'.format( n=wday.n, wday=repr(wday)[0:2])) else: wday_strings.append(repr(wday)) original_rule['byweekday'] = wday_strings else: original_rule = self._original_rule partfmt = '{name}={vals}' for name, key in [('BYSETPOS', 'bysetpos'), ('BYMONTH', 'bymonth'), ('BYMONTHDAY', 'bymonthday'), ('BYYEARDAY', 'byyearday'), ('BYWEEKNO', 'byweekno'), ('BYDAY', 'byweekday'), ('BYHOUR', 'byhour'), ('BYMINUTE', 'byminute'), ('BYSECOND', 'bysecond'), ('BYEASTER', 'byeaster')]: value = original_rule.get(key) if value: parts.append(partfmt.format(name=name, vals=(','.join(str(v) for v in value)))) output.append(';'.join(parts)) return '\n'.join(output) def replace(self, **kwargs): """Return new rrule with same attributes except for those attributes given new values by whichever keyword arguments are specified.""" new_kwargs = {"interval": self._interval, "count": self._count, "dtstart": self._dtstart, "freq": self._freq, "until": self._until, "wkst": self._wkst, "cache": False if self._cache is None else True } new_kwargs.update(self._original_rule) new_kwargs.update(kwargs) return rrule(**new_kwargs) def _iter(self): year, month, day, hour, minute, second, weekday, yearday, _ = \ self._dtstart.timetuple() # Some local variables to speed things up a bit freq = self._freq interval = self._interval wkst = self._wkst until = self._until bymonth = self._bymonth byweekno = self._byweekno byyearday = self._byyearday byweekday = self._byweekday byeaster = self._byeaster bymonthday = self._bymonthday bynmonthday = self._bynmonthday bysetpos = self._bysetpos byhour = self._byhour byminute = self._byminute bysecond = self._bysecond ii = _iterinfo(self) ii.rebuild(year, month) getdayset = {YEARLY: ii.ydayset, MONTHLY: ii.mdayset, WEEKLY: ii.wdayset, DAILY: ii.ddayset, HOURLY: ii.ddayset, MINUTELY: ii.ddayset, SECONDLY: ii.ddayset}[freq] if freq < HOURLY: timeset = self._timeset else: gettimeset = {HOURLY: ii.htimeset, MINUTELY: ii.mtimeset, SECONDLY: ii.stimeset}[freq] if ((freq >= HOURLY and self._byhour and hour not in self._byhour) or (freq >= MINUTELY and self._byminute and minute not in self._byminute) or (freq >= SECONDLY and self._bysecond and second not in self._bysecond)): timeset = () else: timeset = gettimeset(hour, minute, second) total = 0 count = self._count while True: # Get dayset with the right frequency dayset, start, end = getdayset(year, month, day) # Do the "hard" work ;-) filtered = False for i in dayset[start:end]: if ((bymonth and ii.mmask[i] not in bymonth) or (byweekno and not ii.wnomask[i]) or (byweekday and ii.wdaymask[i] not in byweekday) or (ii.nwdaymask and not ii.nwdaymask[i]) or (byeaster and not ii.eastermask[i]) or ((bymonthday or bynmonthday) and ii.mdaymask[i] not in bymonthday and ii.nmdaymask[i] not in bynmonthday) or (byyearday and ((i < ii.yearlen and i+1 not in byyearday and -ii.yearlen+i not in byyearday) or (i >= ii.yearlen and i+1-ii.yearlen not in byyearday and -ii.nextyearlen+i-ii.yearlen not in byyearday)))): dayset[i] = None filtered = True # Output results if bysetpos and timeset: poslist = [] for pos in bysetpos: if pos < 0: daypos, timepos = divmod(pos, len(timeset)) else: daypos, timepos = divmod(pos-1, len(timeset)) try: i = [x for x in dayset[start:end] if x is not None][daypos] time = timeset[timepos] except IndexError: pass else: date = datetime.date.fromordinal(ii.yearordinal+i) res = datetime.datetime.combine(date, time) if res not in poslist: poslist.append(res) poslist.sort() for res in poslist: if until and res > until: self._len = total return elif res >= self._dtstart: if count is not None: count -= 1 if count < 0: self._len = total return total += 1 yield res else: for i in dayset[start:end]: if i is not None: date = datetime.date.fromordinal(ii.yearordinal + i) for time in timeset: res = datetime.datetime.combine(date, time) if until and res > until: self._len = total return elif res >= self._dtstart: if count is not None: count -= 1 if count < 0: self._len = total return total += 1 yield res # Handle frequency and interval fixday = False if freq == YEARLY: year += interval if year > datetime.MAXYEAR: self._len = total return ii.rebuild(year, month) elif freq == MONTHLY: month += interval if month > 12: div, mod = divmod(month, 12) month = mod year += div if month == 0: month = 12 year -= 1 if year > datetime.MAXYEAR: self._len = total return ii.rebuild(year, month) elif freq == WEEKLY: if wkst > weekday: day += -(weekday+1+(6-wkst))+self._interval*7 else: day += -(weekday-wkst)+self._interval*7 weekday = wkst fixday = True elif freq == DAILY: day += interval fixday = True elif freq == HOURLY: if filtered: # Jump to one iteration before next day hour += ((23-hour)//interval)*interval if byhour: ndays, hour = self.__mod_distance(value=hour, byxxx=self._byhour, base=24) else: ndays, hour = divmod(hour+interval, 24) if ndays: day += ndays fixday = True timeset = gettimeset(hour, minute, second) elif freq == MINUTELY: if filtered: # Jump to one iteration before next day minute += ((1439-(hour*60+minute))//interval)*interval valid = False rep_rate = (24*60) for j in range(rep_rate // gcd(interval, rep_rate)): if byminute: nhours, minute = \ self.__mod_distance(value=minute, byxxx=self._byminute, base=60) else: nhours, minute = divmod(minute+interval, 60) div, hour = divmod(hour+nhours, 24) if div: day += div fixday = True filtered = False if not byhour or hour in byhour: valid = True break if not valid: raise ValueError('Invalid combination of interval and ' + 'byhour resulting in empty rule.') timeset = gettimeset(hour, minute, second) elif freq == SECONDLY: if filtered: # Jump to one iteration before next day second += (((86399 - (hour * 3600 + minute * 60 + second)) // interval) * interval) rep_rate = (24 * 3600) valid = False for j in range(0, rep_rate // gcd(interval, rep_rate)): if bysecond: nminutes, second = \ self.__mod_distance(value=second, byxxx=self._bysecond, base=60) else: nminutes, second = divmod(second+interval, 60) div, minute = divmod(minute+nminutes, 60) if div: hour += div div, hour = divmod(hour, 24) if div: day += div fixday = True if ((not byhour or hour in byhour) and (not byminute or minute in byminute) and (not bysecond or second in bysecond)): valid = True break if not valid: raise ValueError('Invalid combination of interval, ' + 'byhour and byminute resulting in empty' + ' rule.') timeset = gettimeset(hour, minute, second) if fixday and day > 28: daysinmonth = calendar.monthrange(year, month)[1] if day > daysinmonth: while day > daysinmonth: day -= daysinmonth month += 1 if month == 13: month = 1 year += 1 if year > datetime.MAXYEAR: self._len = total return daysinmonth = calendar.monthrange(year, month)[1] ii.rebuild(year, month) def __construct_byset(self, start, byxxx, base): """ If a `BYXXX` sequence is passed to the constructor at the same level as `FREQ` (e.g. `FREQ=HOURLY,BYHOUR={2,4,7},INTERVAL=3`), there are some specifications which cannot be reached given some starting conditions. This occurs whenever the interval is not coprime with the base of a given unit and the difference between the starting position and the ending position is not coprime with the greatest common denominator between the interval and the base. For example, with a FREQ of hourly starting at 17:00 and an interval of 4, the only valid values for BYHOUR would be {21, 1, 5, 9, 13, 17}, because 4 and 24 are not coprime. :param start: Specifies the starting position. :param byxxx: An iterable containing the list of allowed values. :param base: The largest allowable value for the specified frequency (e.g. 24 hours, 60 minutes). This does not preserve the type of the iterable, returning a set, since the values should be unique and the order is irrelevant, this will speed up later lookups. In the event of an empty set, raises a :exception:`ValueError`, as this results in an empty rrule. """ cset = set() # Support a single byxxx value. if isinstance(byxxx, integer_types): byxxx = (byxxx, ) for num in byxxx: i_gcd = gcd(self._interval, base) # Use divmod rather than % because we need to wrap negative nums. if i_gcd == 1 or divmod(num - start, i_gcd)[1] == 0: cset.add(num) if len(cset) == 0: raise ValueError("Invalid rrule byxxx generates an empty set.") return cset def __mod_distance(self, value, byxxx, base): """ Calculates the next value in a sequence where the `FREQ` parameter is specified along with a `BYXXX` parameter at the same "level" (e.g. `HOURLY` specified with `BYHOUR`). :param value: The old value of the component. :param byxxx: The `BYXXX` set, which should have been generated by `rrule._construct_byset`, or something else which checks that a valid rule is present. :param base: The largest allowable value for the specified frequency (e.g. 24 hours, 60 minutes). If a valid value is not found after `base` iterations (the maximum number before the sequence would start to repeat), this raises a :exception:`ValueError`, as no valid values were found. This returns a tuple of `divmod(n*interval, base)`, where `n` is the smallest number of `interval` repetitions until the next specified value in `byxxx` is found. """ accumulator = 0 for ii in range(1, base + 1): # Using divmod() over % to account for negative intervals div, value = divmod(value + self._interval, base) accumulator += div if value in byxxx: return (accumulator, value) class _iterinfo(object): __slots__ = ["rrule", "lastyear", "lastmonth", "yearlen", "nextyearlen", "yearordinal", "yearweekday", "mmask", "mrange", "mdaymask", "nmdaymask", "wdaymask", "wnomask", "nwdaymask", "eastermask"] def __init__(self, rrule): for attr in self.__slots__: setattr(self, attr, None) self.rrule = rrule def rebuild(self, year, month): # Every mask is 7 days longer to handle cross-year weekly periods. rr = self.rrule if year != self.lastyear: self.yearlen = 365 + calendar.isleap(year) self.nextyearlen = 365 + calendar.isleap(year + 1) firstyday = datetime.date(year, 1, 1) self.yearordinal = firstyday.toordinal() self.yearweekday = firstyday.weekday() wday = datetime.date(year, 1, 1).weekday() if self.yearlen == 365: self.mmask = M365MASK self.mdaymask = MDAY365MASK self.nmdaymask = NMDAY365MASK self.wdaymask = WDAYMASK[wday:] self.mrange = M365RANGE else: self.mmask = M366MASK self.mdaymask = MDAY366MASK self.nmdaymask = NMDAY366MASK self.wdaymask = WDAYMASK[wday:] self.mrange = M366RANGE if not rr._byweekno: self.wnomask = None else: self.wnomask = [0]*(self.yearlen+7) # no1wkst = firstwkst = self.wdaymask.index(rr._wkst) no1wkst = firstwkst = (7-self.yearweekday+rr._wkst) % 7 if no1wkst >= 4: no1wkst = 0 # Number of days in the year, plus the days we got # from last year. wyearlen = self.yearlen+(self.yearweekday-rr._wkst) % 7 else: # Number of days in the year, minus the days we # left in last year. wyearlen = self.yearlen-no1wkst div, mod = divmod(wyearlen, 7) numweeks = div+mod//4 for n in rr._byweekno: if n < 0: n += numweeks+1 if not (0 < n <= numweeks): continue if n > 1: i = no1wkst+(n-1)*7 if no1wkst != firstwkst: i -= 7-firstwkst else: i = no1wkst for j in range(7): self.wnomask[i] = 1 i += 1 if self.wdaymask[i] == rr._wkst: break if 1 in rr._byweekno: # Check week number 1 of next year as well # TODO: Check -numweeks for next year. i = no1wkst+numweeks*7 if no1wkst != firstwkst: i -= 7-firstwkst if i < self.yearlen: # If week starts in next year, we # don't care about it. for j in range(7): self.wnomask[i] = 1 i += 1 if self.wdaymask[i] == rr._wkst: break if no1wkst: # Check last week number of last year as # well. If no1wkst is 0, either the year # started on week start, or week number 1 # got days from last year, so there are no # days from last year's last week number in # this year. if -1 not in rr._byweekno: lyearweekday = datetime.date(year-1, 1, 1).weekday() lno1wkst = (7-lyearweekday+rr._wkst) % 7 lyearlen = 365+calendar.isleap(year-1) if lno1wkst >= 4: lno1wkst = 0 lnumweeks = 52+(lyearlen + (lyearweekday-rr._wkst) % 7) % 7//4 else: lnumweeks = 52+(self.yearlen-no1wkst) % 7//4 else: lnumweeks = -1 if lnumweeks in rr._byweekno: for i in range(no1wkst): self.wnomask[i] = 1 if (rr._bynweekday and (month != self.lastmonth or year != self.lastyear)): ranges = [] if rr._freq == YEARLY: if rr._bymonth: for month in rr._bymonth: ranges.append(self.mrange[month-1:month+1]) else: ranges = [(0, self.yearlen)] elif rr._freq == MONTHLY: ranges = [self.mrange[month-1:month+1]] if ranges: # Weekly frequency won't get here, so we may not # care about cross-year weekly periods. self.nwdaymask = [0]*self.yearlen for first, last in ranges: last -= 1 for wday, n in rr._bynweekday: if n < 0: i = last+(n+1)*7 i -= (self.wdaymask[i]-wday) % 7 else: i = first+(n-1)*7 i += (7-self.wdaymask[i]+wday) % 7 if first <= i <= last: self.nwdaymask[i] = 1 if rr._byeaster: self.eastermask = [0]*(self.yearlen+7) eyday = easter.easter(year).toordinal()-self.yearordinal for offset in rr._byeaster: self.eastermask[eyday+offset] = 1 self.lastyear = year self.lastmonth = month def ydayset(self, year, month, day): return list(range(self.yearlen)), 0, self.yearlen def mdayset(self, year, month, day): dset = [None]*self.yearlen start, end = self.mrange[month-1:month+1] for i in range(start, end): dset[i] = i return dset, start, end def wdayset(self, year, month, day): # We need to handle cross-year weeks here. dset = [None]*(self.yearlen+7) i = datetime.date(year, month, day).toordinal()-self.yearordinal start = i for j in range(7): dset[i] = i i += 1 # if (not (0 <= i < self.yearlen) or # self.wdaymask[i] == self.rrule._wkst): # This will cross the year boundary, if necessary. if self.wdaymask[i] == self.rrule._wkst: break return dset, start, i def ddayset(self, year, month, day): dset = [None] * self.yearlen i = datetime.date(year, month, day).toordinal() - self.yearordinal dset[i] = i return dset, i, i + 1 def htimeset(self, hour, minute, second): tset = [] rr = self.rrule for minute in rr._byminute: for second in rr._bysecond: tset.append(datetime.time(hour, minute, second, tzinfo=rr._tzinfo)) tset.sort() return tset def mtimeset(self, hour, minute, second): tset = [] rr = self.rrule for second in rr._bysecond: tset.append(datetime.time(hour, minute, second, tzinfo=rr._tzinfo)) tset.sort() return tset def stimeset(self, hour, minute, second): return (datetime.time(hour, minute, second, tzinfo=self.rrule._tzinfo),) class rruleset(rrulebase): """ The rruleset type allows more complex recurrence setups, mixing multiple rules, dates, exclusion rules, and exclusion dates. The type constructor takes the following keyword arguments: :param cache: If True, caching of results will be enabled, improving performance of multiple queries considerably. """ class _genitem(object): def __init__(self, genlist, gen): try: self.dt = advance_iterator(gen) genlist.append(self) except StopIteration: pass self.genlist = genlist self.gen = gen def __next__(self): try: self.dt = advance_iterator(self.gen) except StopIteration: if self.genlist[0] is self: heapq.heappop(self.genlist) else: self.genlist.remove(self) heapq.heapify(self.genlist) next = __next__ def __lt__(self, other): return self.dt < other.dt def __gt__(self, other): return self.dt > other.dt def __eq__(self, other): return self.dt == other.dt def __ne__(self, other): return self.dt != other.dt def __init__(self, cache=False): super(rruleset, self).__init__(cache) self._rrule = [] self._rdate = [] self._exrule = [] self._exdate = [] @_invalidates_cache def rrule(self, rrule): """ Include the given :py:class:`rrule` instance in the recurrence set generation. """ self._rrule.append(rrule) @_invalidates_cache def rdate(self, rdate): """ Include the given :py:class:`datetime` instance in the recurrence set generation. """ self._rdate.append(rdate) @_invalidates_cache def exrule(self, exrule): """ Include the given rrule instance in the recurrence set exclusion list. Dates which are part of the given recurrence rules will not be generated, even if some inclusive rrule or rdate matches them. """ self._exrule.append(exrule) @_invalidates_cache def exdate(self, exdate): """ Include the given datetime instance in the recurrence set exclusion list. Dates included that way will not be generated, even if some inclusive rrule or rdate matches them. """ self._exdate.append(exdate) def _iter(self): rlist = [] self._rdate.sort() self._genitem(rlist, iter(self._rdate)) for gen in [iter(x) for x in self._rrule]: self._genitem(rlist, gen) exlist = [] self._exdate.sort() self._genitem(exlist, iter(self._exdate)) for gen in [iter(x) for x in self._exrule]: self._genitem(exlist, gen) lastdt = None total = 0 heapq.heapify(rlist) heapq.heapify(exlist) while rlist: ritem = rlist[0] if not lastdt or lastdt != ritem.dt: while exlist and exlist[0] < ritem: exitem = exlist[0] advance_iterator(exitem) if exlist and exlist[0] is exitem: heapq.heapreplace(exlist, exitem) if not exlist or ritem != exlist[0]: total += 1 yield ritem.dt lastdt = ritem.dt advance_iterator(ritem) if rlist and rlist[0] is ritem: heapq.heapreplace(rlist, ritem) self._len = total class _rrulestr(object): _freq_map = {"YEARLY": YEARLY, "MONTHLY": MONTHLY, "WEEKLY": WEEKLY, "DAILY": DAILY, "HOURLY": HOURLY, "MINUTELY": MINUTELY, "SECONDLY": SECONDLY} _weekday_map = {"MO": 0, "TU": 1, "WE": 2, "TH": 3, "FR": 4, "SA": 5, "SU": 6} def _handle_int(self, rrkwargs, name, value, **kwargs): rrkwargs[name.lower()] = int(value) def _handle_int_list(self, rrkwargs, name, value, **kwargs): rrkwargs[name.lower()] = [int(x) for x in value.split(',')] _handle_INTERVAL = _handle_int _handle_COUNT = _handle_int _handle_BYSETPOS = _handle_int_list _handle_BYMONTH = _handle_int_list _handle_BYMONTHDAY = _handle_int_list _handle_BYYEARDAY = _handle_int_list _handle_BYEASTER = _handle_int_list _handle_BYWEEKNO = _handle_int_list _handle_BYHOUR = _handle_int_list _handle_BYMINUTE = _handle_int_list _handle_BYSECOND = _handle_int_list def _handle_FREQ(self, rrkwargs, name, value, **kwargs): rrkwargs["freq"] = self._freq_map[value] def _handle_UNTIL(self, rrkwargs, name, value, **kwargs): global parser if not parser: from dateutil import parser try: rrkwargs["until"] = parser.parse(value, ignoretz=kwargs.get("ignoretz"), tzinfos=kwargs.get("tzinfos")) except ValueError: raise ValueError("invalid until date") def _handle_WKST(self, rrkwargs, name, value, **kwargs): rrkwargs["wkst"] = self._weekday_map[value] def _handle_BYWEEKDAY(self, rrkwargs, name, value, **kwargs): """ Two ways to specify this: +1MO or MO(+1) """ l = [] for wday in value.split(','): if '(' in wday: # If it's of the form TH(+1), etc. splt = wday.split('(') w = splt[0] n = int(splt[1][:-1]) elif len(wday): # If it's of the form +1MO for i in range(len(wday)): if wday[i] not in '+-0123456789': break n = wday[:i] or None w = wday[i:] if n: n = int(n) else: raise ValueError("Invalid (empty) BYDAY specification.") l.append(weekdays[self._weekday_map[w]](n)) rrkwargs["byweekday"] = l _handle_BYDAY = _handle_BYWEEKDAY def _parse_rfc_rrule(self, line, dtstart=None, cache=False, ignoretz=False, tzinfos=None): if line.find(':') != -1: name, value = line.split(':') if name != "RRULE": raise ValueError("unknown parameter name") else: value = line rrkwargs = {} for pair in value.split(';'): name, value = pair.split('=') name = name.upper() value = value.upper() try: getattr(self, "_handle_"+name)(rrkwargs, name, value, ignoretz=ignoretz, tzinfos=tzinfos) except AttributeError: raise ValueError("unknown parameter '%s'" % name) except (KeyError, ValueError): raise ValueError("invalid '%s': %s" % (name, value)) return rrule(dtstart=dtstart, cache=cache, **rrkwargs) def _parse_rfc(self, s, dtstart=None, cache=False, unfold=False, forceset=False, compatible=False, ignoretz=False, tzinfos=None): global parser if compatible: forceset = True unfold = True s = s.upper() if not s.strip(): raise ValueError("empty string") if unfold: lines = s.splitlines() i = 0 while i < len(lines): line = lines[i].rstrip() if not line: del lines[i] elif i > 0 and line[0] == " ": lines[i-1] += line[1:] del lines[i] else: i += 1 else: lines = s.split() if (not forceset and len(lines) == 1 and (s.find(':') == -1 or s.startswith('RRULE:'))): return self._parse_rfc_rrule(lines[0], cache=cache, dtstart=dtstart, ignoretz=ignoretz, tzinfos=tzinfos) else: rrulevals = [] rdatevals = [] exrulevals = [] exdatevals = [] for line in lines: if not line: continue if line.find(':') == -1: name = "RRULE" value = line else: name, value = line.split(':', 1) parms = name.split(';') if not parms: raise ValueError("empty property name") name = parms[0] parms = parms[1:] if name == "RRULE": for parm in parms: raise ValueError("unsupported RRULE parm: "+parm) rrulevals.append(value) elif name == "RDATE": for parm in parms: if parm != "VALUE=DATE-TIME": raise ValueError("unsupported RDATE parm: "+parm) rdatevals.append(value) elif name == "EXRULE": for parm in parms: raise ValueError("unsupported EXRULE parm: "+parm) exrulevals.append(value) elif name == "EXDATE": for parm in parms: if parm != "VALUE=DATE-TIME": raise ValueError("unsupported EXDATE parm: "+parm) exdatevals.append(value) elif name == "DTSTART": for parm in parms: raise ValueError("unsupported DTSTART parm: "+parm) if not parser: from dateutil import parser dtstart = parser.parse(value, ignoretz=ignoretz, tzinfos=tzinfos) else: raise ValueError("unsupported property: "+name) if (forceset or len(rrulevals) > 1 or rdatevals or exrulevals or exdatevals): if not parser and (rdatevals or exdatevals): from dateutil import parser rset = rruleset(cache=cache) for value in rrulevals: rset.rrule(self._parse_rfc_rrule(value, dtstart=dtstart, ignoretz=ignoretz, tzinfos=tzinfos)) for value in rdatevals: for datestr in value.split(','): rset.rdate(parser.parse(datestr, ignoretz=ignoretz, tzinfos=tzinfos)) for value in exrulevals: rset.exrule(self._parse_rfc_rrule(value, dtstart=dtstart, ignoretz=ignoretz, tzinfos=tzinfos)) for value in exdatevals: for datestr in value.split(','): rset.exdate(parser.parse(datestr, ignoretz=ignoretz, tzinfos=tzinfos)) if compatible and dtstart: rset.rdate(dtstart) return rset else: return self._parse_rfc_rrule(rrulevals[0], dtstart=dtstart, cache=cache, ignoretz=ignoretz, tzinfos=tzinfos) def __call__(self, s, **kwargs): return self._parse_rfc(s, **kwargs) rrulestr = _rrulestr() # vim:ts=4:sw=4:et tzwin.py000064400000000073147204751220006275 0ustar00# tzwin has moved to dateutil.tz.win from .tz.win import *