B ¨#ayã@sZdZddlZddlmZddlmZmZmZdZe  e¡Z ddd„Z d d „Z dd d „Z dS)zŒ This module provides an ISO 8601:2004 time zone info parser. It offers a function to parse the time zone offset as specified by ISO 8601. éN)Ú ISO8601Error)ÚUTCÚ FixedOffsetÚZEROzM(?P(Z|(?P[+-])(?P[0-9]{2})(:?(?P[0-9]{2}))?)?)ú+cCsD|dks|dkrdS|dkr tS|dkr,dp.d}t|||||ƒS)z´ create a tzinfo instance according to given parameters. tzname: 'Z' ... return UTC '' | None ... return None other ... return FixedOffset NÚÚZú-éÿÿÿÿé)rr)ÚtznameÚtzsignÚtzhourÚtzmin©rú8/tmp/pip-target-jgxl_w8r/lib/python/isodate/isotzinfo.pyÚ build_tzinfo+s rcCsTt |¡}|rD| ¡}t|d|dt|dp0dƒt|dp>dƒƒStd|ƒ‚dS)a( Parses ISO 8601 time zone designators to tzinfo objecs. A time zone designator can be in the following format: no designator indicates local time zone Z UTC +-hhmm basic hours and minutes +-hh:mm extended hours and minutes +-hh hours r r rrrz%s not a valid time zone infoN)ÚTZ_REÚmatchÚ groupdictrÚintr)ZtzstringrÚgroupsrrrÚ parse_tzinfo<s rú%ZcCsö|j}|dks| |¡dkr dS| |¡tkr@| |¡tkr@dS| |¡}|jddd|j}|dkrndppd}t|ƒ}t|dƒ\}}t|dƒ\}}|d kr¦td ƒ‚|d kr¼d |||fS|d krÒd|||fS|dkræd||fSt d|ƒ‚dS)a? return time zone offset ISO 8601 formatted. The various ISO formats can be chosen with the format parameter. if tzinfo is None returns '' if tzinfo is UTC returns 'Z' else the offset is rendered to the given format. format: %h ... +-HH %z ... +-HHMM %Z ... +-HH:MM Nrréé<rr récz%can not handle differences > 99 hoursz%Zz %s%02d:%02dz%zz %s%02d%02dz%hz%s%02dzunknown format string "%s") ÚtzinfoÚ utcoffsetrÚdstÚdaysÚsecondsÚabsÚdivmodÚ OverflowErrorÚ ValueError)ÚdtÚformatrZtdeltar!ÚsignÚminutesÚhoursrrrÚ tz_isoformatPs(   r+)rrr)r)Ú__doc__ÚreZisodate.isoerrorrZisodate.tzinforrrZTZ_REGEXÚcompilerrrr+rrrrÚs