/var/opt/nydus/ops/asn1crypto/__pycache__
NameSizeModeActions
algos.cpython-312.pyc332150644editdlrm
cms.cpython-312.pyc333320644editdlrm
core.cpython-312.pyc1752560644editdlrm
crl.cpython-312.pyc187590644editdlrm
csr.cpython-312.pyc45550644editdlrm
keys.cpython-312.pyc411450644editdlrm
ocsp.cpython-312.pyc233820644editdlrm
parser.cpython-312.pyc94080644editdlrm
pdf.cpython-312.pyc34580644editdlrm
pem.cpython-312.pyc71120644editdlrm
pkcs12.cpython-312.pyc64300644editdlrm
tsp.cpython-312.pyc111320644editdlrm
util.cpython-312.pyc276150644editdlrm
version.cpython-312.pyc3670644editdlrm
x509.cpython-312.pyc1065730644editdlrm
_errors.cpython-312.pyc15000644editdlrm
_inet.cpython-312.pyc55890644editdlrm
_int.cpython-312.pyc7960644editdlrm
_iri.cpython-312.pyc97750644editdlrm
_ordereddict.cpython-312.pyc55550644editdlrm
_teletex_codec.cpython-312.pyc37660644editdlrm
_types.cpython-312.pyc15680644editdlrm
__init__.cpython-312.pyc12440644editdlrm
Edit: /var/opt/nydus/ops/asn1crypto/__pycache__/util.cpython-312.pyc (27615B)
M jqUdZddlmZmZmZmZddlZddlZddlmZm Z m Z m Z ddl m Z ddlmZmZddlmZdd lmZej*d k(r dd lmZmZndd lmZmZej4d kr'dd ZddZGdde Zee de_nddlmZddZddZdZGdde Z e Z!iZ"dZ#Gdde$Z%Gdde$Z&y)a5 Miscellaneous data helpers, including functions for converting integers to and from bytes and UTC timezone. Exports the following items: - OrderedDict() - int_from_bytes() - int_to_bytes() - timezone.utc - utc_with_dst - create_timezone() - inet_ntop() - inet_pton() - uri_to_iri() - iri_to_uri() )unicode_literalsdivisionabsolute_importprint_functionN)datetimedate timedeltatzinfo)unwrap) iri_to_uri uri_to_iri) OrderedDict) type_namewin32) inet_ntop inet_pton)c |dk(r|dk(ryd}|rN|dkrId}ttjtdt |zdz dz}|d|zzd|zz}d|z}t|dzrd |z}|j d }|r|st |ddd zrd |z}|6t||kDr td |rd}nd }||t|z z|z}|S|rt |ddd zdk(rd|z}|S) Converts an integer to a byte string :param value: The integer to convert :param signed: If the byte string should be encoded using two's complement :param width: If None, the minimal possible size (but at least 1), otherwise an integer of the byte width for the return value :return: A byte string rFTz%xg@r 0hexzint too big to convert)intmathceillenabsdecodeord OverflowError)valuesignedwidthis_negbitshex_stroutputpad_chars @/opt/nydus/tmp/pip-target-a90h98xg/lib/python/asn1crypto/util.py int_to_bytesr/'s-$ A:%1* eaiFtyyTCJ%6!7#!=>BCDa4i(Q$Y7E, w??!DL! " "^F%;; rcZt|tk7ry|j|jk(S)z Compare two timezones :param other: The other timezone to compare to :return: A boolean F)typer9rBrEothers r.__eq__ztimezone.__eq__s&E{h&<<5==0 0rc2|j|jfS)z Called by tzinfo.__reduce__ to support pickle and copy. :return: offset and name, to be used for __init__ )rBrCrEs r.__getinitargs__ztimezone.__getinitargs__s<<+ +rc|jS)z :param dt: A datetime object; ignored. :return: Name of this timezone )rCrEdts r.tznameztimezone.tznames:: rc|jS)z :param dt: A datetime object; ignored. :return: A timedelta object with the offset from UTC )rBrRs r. utcoffsetztimezone.utcoffsets<< rctdS)z :param dt: A datetime object; ignored. :return: Zero timedelta rr rRs r.dstz timezone.dstsQ< rN) __name__ __module__ __qualname____doc__rHrMrPrTrVrYrr.r9r9vs%  <0 1 ,   rr9)r9c |n|r@|dkrt|dzj}n|j}|dzdk(r|dz }n|j}tj|dz xsd}|j |d|S)rrr rbig) byteorderr')r" bit_lengthrr to_bytes)r&r'r( bits_requireds r.r/r/s$ =19$' N$=$=$?M$)$4$4$6M 1$)!Q&M % 0 0 2 IIma/05AE~~euV~DDrc2tj|d|S)r1ra)r')r from_bytes)r&r's r.r7r7s~~eU6~::rc|y|jdzdz|jdzz}|dkrdnd}|dtt|dzzS)zC Format a timedelta into "[+-]HH:MM" format or "" for None r<r=r-+z %02d:%02d)daysr@divmodr")offminssigns r.rDrDsT  { 88b=2  r 1 1D(3D +s4y" 55 55rc"eZdZdZdZdZdZy) _UtcWithDstzK Utc class where dst does not return None; required for astimezone cy)Nr>r_rRs r.rTz_UtcWithDst.tznamesrctdSNrrXrRs r.rVz_UtcWithDst.utcoffset |rctdSrurXrRs r.rYz_UtcWithDst.dstrvrN)r[r\r]r^rTrVrYr_rr.rrrrsrrrcb t|}|S#t$rt|x}t|<Y|SwxYw)a Returns a new datetime.timezone object with the given offset. Uses cached objects if possible. :param offset: A datetime.timedelta object; It needs to be in full minutes and between -23:59 and +23:59. :return: A datetime.timezone object )_timezone_cacheKeyErrorr9)rFtzs r.create_timezoner|&sB8 V $ I 8'/'77_V $ I8s ..ceZdZdZdZedZedZedZdZ dZ dd Z d Z d Z d Zd ZdZdZdZdZdZy) extended_dateB A datetime.datetime-like object that represents the year 0. This is just to handle 0000-01-01 found in some certificates. Python's datetime does not support year 0. The proleptic gregorian calendar repeats itself every 400 years. Therefore, the simplest way to format is to substitute year 2000. cH|dk7r tdtd|||_y)z :param year: The integer 0 :param month: An integer from 1 to 12 :param day: An integer from 1 to 31 ryear must be 0N)r?r_y2k)rEyearmonthdays r.rHzextended_date.__init__Cs' 19-. .uc* rcyz4 :return: The integer 0 rr_rOs r.rzextended_date.yearTrc.|jjSz> :return: An integer from 1 to 12 rrrOs r.rzextended_date.month]yyrc.|jjSz> :return: An integer from 1 to 31 rrrOs r.rzextended_date.dayfyy}}rc|jj|}|jjdj|}djdt ||DS)z Formats the date using strftime() :param format: A strftime() format string :return: A str, the formatted date as a unicode string in Python 3 and a byte string in Python 2 rric38K|]\}}||fdk(rdn|yw)24rNr_.0c2c4s r. z)extended_date.strftime..%Y=Rr2h*4s"<=rstrftimereplacejoinziprEformaty2ky4ks r.rzextended_date.strftimeosVii  (iiT*33F;wwY3sTW=YYYrc$|jdS)z Formats the date as %Y-%m-%d :return: The date formatted to %Y-%m-%d as a unicode string in Python 3 and a byte string in Python 2 z 0000-%m-%drrOs r. isoformatzextended_date.isoformats}}\**rNc| |j}| |j}| |j}|dkDrt}nt}||||S)z Returns a new datetime.date or asn1crypto.util.extended_date object with the specified components replaced :return: A datetime.date or asn1crypto.util.extended_date object r)rrrrr~)rErrrclss r.rzextended_date.replacesU <99D =JJE ;((C !8CC     rc$|jdS)z_ :return: A str representing this extended_date, e.g. "0000-01-01" z%Y-%m-%drrOs r.__str__zextended_date.__str__s }}Z((rcXt||jsy|j|dk(S) Compare two extended_date objects :param other: The other extended_date to compare to :return: A boolean Fr) isinstance __class____cmp__rKs r.rMzextended_date.__eq__s)%0||E"a''rc&|j| S)rrMrKs r.__ne__zextended_date.__ne__;;u%%%rc>ttdt|)Nz An asn1crypto.util.extended_date object can only be compared to an asn1crypto.util.extended_date or datetime.date object, not %s  TypeErrorr rrKs r._comparison_errorzextended_date._comparison_errors%  e     rct|tryt||js|j||j|jkry|j|jkDryy)z Compare two extended_date or datetime.date objects :param other: The other extended_date object to compare to :return: An integer smaller than, equal to, or larger than 0 r r)rrrrrrKs r.rzextended_date.__cmp__sV eT "%0  " "5 ) 99uzz ! 99uzz !rc*|j|dkSrurrKs r.__lt__zextended_date.__lt__||E"Q&&rc*|j|dkSrurrKs r.__le__zextended_date.__le__||E"a''rc*|j|dkDSrurrKs r.__gt__zextended_date.__gt__rrc*|j|dk\SrurrKs r.__ge__zextended_date.__ge__rr)NNN)r[r\r]r^rHpropertyrrrrrrrrMrrrrrrrr_rr.r~r~9s+"Z$ + 6)( & 0'('(rr~c0eZdZdZdZdezZdZedZedZ edZ edZ ed Z ed Z ed Zed Zd ZdZdZdZd#dZd$dZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#e$d"Z%y)%extended_datetimeri:cL|dk7r tdtdg|i||_y)z :param year: The integer 0 :param args: Other positional arguments; see datetime.datetime. :param kwargs: Other keyword arguments; see datetime.datetime. rrrN)r?rrrErargskwargss r.rHzextended_datetime.__init__s- 19-. .T3D3F3 rcyrr_rOs r.rzextended_datetime.yearrrc.|jjSrrrOs r.rzextended_datetime.month"rrc.|jjSrrrOs r.rzextended_datetime.day+rrc.|jjS)z> :return: An integer from 1 to 24 )rhourrOs r.rzextended_datetime.hour4syy~~rc.|jjSz> :return: An integer from 1 to 60 )rminuterOs r.rzextended_datetime.minute=yyrc.|jjSr)rsecondrOs r.rzextended_datetime.secondFrrc.|jjS)zB :return: An integer from 0 to 999999 )r microsecondrOs r.rzextended_datetime.microsecondOsyy$$$rc.|jjS)zh :return: If object is timezone aware, a datetime.tzinfo object, else None. )rr rOs r.r zextended_datetime.tzinfoXrrc6|jjS)zk :return: If object is timezone aware, a datetime.timedelta object, else None. )rrVrOs r.rVzextended_datetime.utcoffsetas yy""$$rc6|jjS)z= :return: A datetime.time object )rtimerOs r.rzextended_datetime.timeis yy~~rcDtd|j|jS)zS :return: An asn1crypto.util.extended_date of the date r)r~rrrOs r.rzextended_datetime.dateqs Q DHH55rc|jj|}|jjdj|}djdt ||DS)z Performs strftime(), always returning a str :param format: A strftime() format string :return: A str of the formatted datetime rrric38K|]\}}||fdk(rdn|ywrr_rs r.rz-extended_datetime.strftime..rrrrs r.rzextended_datetime.strftimeysVii  (iiT*33F;wwY3sTW=YYYrcd|j|j||j|j|jfz}|j r|d|j zz }|t |jzS)aj Formats the date as "%Y-%m-%d %H:%M:%S" with the sep param between the date and time portions :param set: A single character of the separator to place between the date and time :return: The formatted datetime as a unicode string in Python 3 and a byte string in Python 2 z0000-%02d-%02d%c%02d:%02d:%02dz.%06d)rrrrrrrDrV)rEsepss r.rzextended_datetime.isoformatsj - DHHc499VZVaVacgcncn/o o    4+++ +A>$.."2333rNc|r |jj|g|i|Stj|jjdg|i|S)a Returns a new datetime.datetime or asn1crypto.util.extended_datetime object with the specified components replaced :param year: The new year to substitute. None to keep it. :param args: Other positional arguments; see datetime.datetime.replace. :param kwargs: Other keyword arguments; see datetime.datetime.replace. :return: A datetime.datetime or asn1crypto.util.extended_datetime object r)rrrfrom_y2krs r.rzextended_datetime.replacesU$ $499$$T;D;F; ; ))*;$))*;*;D*R4*R6*RSSrc^tj|jj|S)z Convert this extended_datetime to another timezone. :param tz: A datetime.tzinfo object. :return: A new extended_datetime or datetime.datetime object )rrr astimezone)rEr{s r.rzextended_datetime.astimezones$!))$))*>*>r*BCCrcV|jj|jdzz S)z Return POSIX timestamp. Only supported in python >= 3.3 :return: A float representing the seconds since 1970-01-01 UTC. This will be a negative value. iQ)r timestampDAYS_IN_2000_YEARSrOs r.rzextended_datetime.timestamps'yy""$t'>'>'FFFrc&|jdS)zy :return: A str representing this extended_datetime, e.g. "0000-01-01 00:00:00.000001-10:00"  )r)rrOs r.rzextended_datetime.__str__s ~~#~&&rct||jtfsy|jdu|jduk7ry|j |dk(S) Compare two extended_datetime objects :param other: The other extended_datetime to compare to :return: A boolean FNr)rrrr rrKs r.rMzextended_datetime.__eq__sM%$..(!;< KK4 U\\T%9 :||E"a''rc&|j| S)rrrKs r.rzextended_datetime.__ne__rrc>ttdt|)z Raises a TypeError about the other object not being suitable for comparison :param other: The object being compared to z An asn1crypto.util.extended_datetime object can only be compared to an asn1crypto.util.extended_datetime or datetime.datetime object, not %s rrKs r.rz#extended_datetime._comparison_errors'  e     rct||jtfs|j||jdu|jduk7r t d||z }t d}||kry||kDryy)a Compare two extended_datetime or datetime.datetime objects :param other: The other extended_datetime or datetime.datetime object to compare to :return: An integer smaller than, equal to, or larger than 0 Nz5can't compare offset-naive and offset-aware datetimesrrr )rrrrr rr )rErLdiffzeros r.rzextended_datetime.__cmp__st%$..(!;<  " "5 ) KK4 U\\T%9 :ST Te|| $; $;rc*|j|dkSrurrKs r.rzextended_datetime.__lt__ rrc*|j|dkSrurrKs r.rzextended_datetime.__le__#rrc*|j|dkDSrurrKs r.rzextended_datetime.__gt__&rrc*|j|dk\SrurrKs r.rzextended_datetime.__ge__)rrcFtj|j|zS)z Adds a timedelta :param other: A datetime.timedelta object to add. :return: A new extended_datetime or datetime.datetime object. )rrrrKs r.__add__zextended_datetime.__add__,s!))$))e*;<rs SR 66(%<<7+++t0d:W 6W rIaL)HL "E>;" 6 & } &~(F~(Bt t r