index int64 0 731k | package stringlengths 2 98 ⌀ | name stringlengths 1 76 | docstring stringlengths 0 281k ⌀ | code stringlengths 4 8.19k | signature stringlengths 2 42.8k ⌀ | embed_func_code listlengths 768 768 |
|---|---|---|---|---|---|---|
446 | bitmath | to_MiB | null | def to_MiB(self):
return MiB(bits=self._bit_value)
| (self) | [
0.06548148393630981,
0.010719639249145985,
0.04788576066493988,
0.002664482919499278,
0.008546620607376099,
-0.06304840743541718,
0.006849638186395168,
-0.0019305930472910404,
-0.06622198224067688,
-0.03164761886000633,
-0.0005506928428076208,
0.059345901012420654,
0.025212310254573822,
0.... |
447 | bitmath | to_Mib | null | def to_Mib(self):
return Mib(bits=self._bit_value)
| (self) | [
0.07003086805343628,
0.014620665460824966,
0.045062728226184845,
-0.042908474802970886,
-0.0017061857506632805,
-0.06053096801042557,
-0.002306551206856966,
-0.016289329156279564,
-0.05403289571404457,
-0.0020836214534938335,
-0.03432678058743477,
0.06469821184873581,
0.012969660572707653,
... |
448 | bitmath | to_PB | null | def to_PB(self):
return PB(bits=self._bit_value)
| (self) | [
0.05770783871412277,
-0.04247986152768135,
-0.046855319291353226,
-0.01303163543343544,
-0.027458595111966133,
-0.03748425468802452,
0.001583735691383481,
-0.018535412847995758,
-0.019103879109025,
-0.014254697598516941,
0.007545084692537785,
0.011972223408520222,
0.007682894356548786,
0.0... |
449 | bitmath | to_Pb | null | def to_Pb(self):
return Pb(bits=self._bit_value)
| (self) | [
0.032697249203920364,
-0.039976753294467926,
-0.005481241270899773,
-0.019486937671899796,
-0.006436568219214678,
-0.045164044946432114,
0.017705965787172318,
-0.030933568254113197,
-0.0052434904500842094,
-0.012025878764688969,
0.005861643236130476,
-0.0032074772752821445,
0.015639694407582... |
450 | bitmath | to_PiB | null | def to_PiB(self):
return PiB(bits=self._bit_value)
| (self) | [
0.04417162388563156,
-0.04915596917271614,
-0.013500704430043697,
-0.005272235721349716,
0.017943648621439934,
-0.019146766513586044,
0.02827327698469162,
-0.03483886644244194,
-0.030937325209379196,
0.010836657136678696,
0.03798415884375572,
-0.03062795102596283,
0.03657479211688042,
0.05... |
451 | bitmath | to_Pib | null | def to_Pib(self):
return Pib(bits=self._bit_value)
| (self) | [
0.050503771752119064,
-0.037031494081020355,
-0.015838563442230225,
-0.03305890038609505,
0.0037761242128908634,
-0.02977718971669674,
0.030381716787815094,
-0.03678968548774719,
-0.013757268898189068,
0.0010001655900850892,
0.0056004952639341354,
-0.000796138250734657,
0.006986585445702076,... |
452 | bitmath | to_TB | null | def to_TB(self):
return TB(bits=self._bit_value)
| (self) | [
0.060398757457733154,
-0.0022778224665671587,
0.023095661774277687,
-0.049588754773139954,
-0.048696499317884445,
-0.030559713020920753,
-0.027848631143569946,
-0.025995489209890366,
-0.03119458630681038,
-0.04200459271669388,
-0.0049931928515434265,
0.05168211832642555,
0.010818584822118282... |
453 | bitmath | to_Tb | null | def to_Tb(self):
return Tb(bits=self._bit_value)
| (self) | [
0.04810361564159393,
0.00706289941444993,
0.026936000213027,
-0.04830601438879967,
-0.03977150097489357,
-0.04678801819682121,
-0.02192661352455616,
-0.03771377354860306,
-0.04010883346199989,
-0.02214587852358818,
-0.01652929186820984,
0.030916523188352585,
0.005241303704679012,
0.0055955... |
454 | bitmath | to_TiB | null | def to_TiB(self):
return TiB(bits=self._bit_value)
| (self) | [
0.03372601419687271,
-0.031034832820296288,
0.016095329076051712,
-0.013464528135955334,
-0.027981378138065338,
-0.043576423078775406,
-0.036882974207401276,
-0.01401656586676836,
-0.0719718262553215,
-0.028947442770004272,
0.0199595894664526,
0.04737167805433273,
0.019442053511738777,
0.0... |
455 | bitmath | to_Tib | null | def to_Tib(self):
return Tib(bits=self._bit_value)
| (self) | [
0.05512130260467529,
-0.020002564415335655,
0.04633283242583275,
-0.050023991614580154,
-0.00709229800850153,
-0.027121229097247124,
-0.016364136710762978,
-0.036876432597637177,
-0.029142577201128006,
-0.013657287694513798,
0.005005035549402237,
0.05097314342856407,
0.012444478459656239,
... |
456 | bitmath | to_YB | null | def to_YB(self):
return YB(bits=self._bit_value)
| (self) | [
0.03278472647070885,
-0.014229301363229752,
0.006102615501731634,
-0.004630169365555048,
-0.029900643974542618,
-0.05316442251205444,
-0.05768166109919548,
0.012735137715935707,
-0.03707610443234444,
0.005125328432768583,
0.027311919257044792,
-0.0036832867190241814,
0.051635511219501495,
... |
457 | bitmath | to_Yb | null | def to_Yb(self):
return Yb(bits=self._bit_value)
| (self) | [
0.0378369502723217,
-0.007529763039201498,
0.011349334381520748,
0.0009434079402126372,
-0.02532380446791649,
-0.04609737545251846,
-0.05089262127876282,
0.022278647869825363,
-0.05113763362169266,
-0.0008963742875494063,
0.023993736132979393,
-0.003423613728955388,
0.04592236503958702,
0.... |
458 | bitmath | to_ZB | null | def to_ZB(self):
return ZB(bits=self._bit_value)
| (self) | [
0.018321458250284195,
-0.014503027312457561,
0.014599364250898361,
-0.026221053674817085,
0.01189318299293518,
-0.040706563740968704,
-0.05289751663804054,
0.00913445558398962,
-0.029811779037117958,
-0.005289751570671797,
0.005657582078129053,
0.05048034340143204,
-0.003415568033233285,
0... |
459 | bitmath | to_Zb | null | def to_Zb(self):
return Zb(bits=self._bit_value)
| (self) | [
0.0320671908557415,
-0.004727968480437994,
0.034398067742586136,
-0.020571738481521606,
0.02458013780415058,
-0.036622993648052216,
-0.04057841747999191,
0.008016797713935375,
-0.04064904898405075,
-0.007707780227065086,
0.0007041185162961483,
0.05011381581425667,
-0.0036883449647575617,
0... |
460 | bitmath | to_kB | null | def to_kB(self):
return kB(bits=self._bit_value)
| (self) | [
0.03797907382249832,
-0.03156837075948715,
-0.0016828090883791447,
0.01995980367064476,
0.01376568153500557,
-0.008862361311912537,
-0.007285675033926964,
-0.004121474456042051,
-0.012812739238142967,
-0.03479104861617088,
0.025157669559121132,
-0.004435512237250805,
0.020427612587809563,
... |
461 | bitmath | to_kb | null | def to_kb(self):
return kb(bits=self._bit_value)
| (self) | [
0.03725520893931389,
-0.031375452876091,
0.003612030064687133,
-0.021073315292596817,
0.0021672178991138935,
-0.0203195009380579,
-0.029616551473736763,
-0.022748460993170738,
0.01313313189893961,
-0.02532818354666233,
-0.0005847300635650754,
0.011717635206878185,
0.03295008838176727,
0.01... |
462 | bitmath | Bitmath | The base class for all the other prefix classes | class Bitmath(object):
"""The base class for all the other prefix classes"""
# All the allowed input types
valid_types = (int, float, long)
def __init__(self, value=0, bytes=None, bits=None):
"""Instantiate with `value` by the unit, in plain bytes, or
bits. Don't supply more than one keyword.
... | (value=0, bytes=None, bits=None) | [
0.05471950024366379,
-0.03187185525894165,
0.038106758147478104,
0.01652044989168644,
0.018325289711356163,
-0.04042433947324753,
-0.07707492262125015,
-0.012254460714757442,
0.012213442474603653,
-0.062184982001781464,
0.00819356832653284,
0.09057021141052246,
0.06345657259225845,
0.04023... |
494 | bitmath | _norm | Normalize the input value into the fundamental unit for this prefix
type.
:param number value: The input value to be normalized
:raises ValueError: if the input value is not a type of real number
| def _norm(self, value):
"""Normalize the input value into the fundamental unit for this prefix
type.
:param number value: The input value to be normalized
:raises ValueError: if the input value is not a type of real number
"""
if isinstance(value, self.valid_types):
self._byte_value = value * self._unit... | (self, value) | [
-0.017829369753599167,
0.08716971427202225,
0.012170368805527687,
0.01369935367256403,
0.0439363494515419,
-0.009428740479052067,
-0.02309294417500496,
-0.017513027414679527,
0.0023286263458430767,
-0.020983999595046043,
0.012811838649213314,
0.03655504062771797,
0.029788844287395477,
0.00... |
495 | bitmath | _set_prefix_value | null | def _set_prefix_value(self):
self.prefix_value = self._to_prefix_value(self._byte_value)
| (self) | [
-0.03636087477207184,
0.04066053032875061,
-0.028150899335741997,
0.009961999021470547,
0.0033940200228244066,
0.04990309849381447,
0.01059679128229618,
0.05108804255723953,
0.08592541515827179,
-0.06781268864870071,
0.005620023235678673,
-0.002384701045230031,
0.053187087178230286,
0.0006... |
496 | bitmath | _setup | null | def _setup(self):
raise NotImplementedError("The base 'bitmath.Bitmath' class can not be used directly")
| (self) | [
-0.0008905993308871984,
-0.05472268909215927,
0.05262481048703194,
0.07459922134876251,
-0.020605457946658134,
-0.0058802892453968525,
-0.07065236568450928,
0.0020189881324768066,
-0.04128202795982361,
-0.004469108767807484,
0.03815298527479172,
0.0686611533164978,
0.05600275471806526,
0.0... |
530 | bitmath | Byte | Byte based types fundamentally operate on self._bit_value | class Byte(Bitmath):
"""Byte based types fundamentally operate on self._bit_value"""
def _setup(self):
return (2, 0, 'Byte', 'Bytes')
| (value=0, bytes=None, bits=None) | [
0.021111780777573586,
-0.05717388167977333,
0.023609668016433716,
0.040114231407642365,
0.017651742324233055,
-0.036062102764844894,
-0.046368204057216644,
0.009908289648592472,
-0.018595388159155846,
-0.06228067725896835,
0.05846908316016197,
0.08533525466918945,
0.03693173825740814,
0.05... |
564 | bitmath | _setup | null | def _setup(self):
return (2, 0, 'Byte', 'Bytes')
| (self) | [
0.004289998672902584,
-0.018169406801462173,
-0.018064985051751137,
-0.019109204411506653,
0.03839244320988655,
-0.015611071139574051,
0.0011780093191191554,
0.05516956001520157,
0.007413953542709351,
-0.04117702692747116,
0.049113091081380844,
0.05941604822874069,
0.005969450809061527,
0.... |
598 | bitmath | EB | null | class EB(Byte):
def _setup(self):
return (10, 18, 'EB', 'EBs')
| (value=0, bytes=None, bits=None) | [
0.03309404477477074,
-0.0699540302157402,
-0.02668129839003086,
0.015463428571820259,
-0.008677639067173004,
-0.061782658100128174,
-0.010018809698522091,
0.00700339674949646,
0.003803683677688241,
-0.07183699309825897,
0.03847649320960045,
0.0713040828704834,
0.03096238523721695,
0.056524... |
632 | bitmath | _setup | null | def _setup(self):
return (10, 18, 'EB', 'EBs')
| (self) | [
0.020501358434557915,
-0.025333447381854057,
-0.009270256385207176,
-0.018575526773929596,
0.02113163098692894,
0.00038270442746579647,
0.0026348885148763657,
0.009156457148492336,
0.005501752253621817,
-0.03277416154742241,
0.017376258969306946,
0.050246711820364,
0.03424479812383652,
0.0... |
666 | bitmath | Eb | null | class Eb(Bit):
def _setup(self):
return (10, 18, 'Eb', 'Ebs')
| (value=0, bytes=None, bits=None) | [
0.0380309596657753,
-0.07736244052648544,
0.02032529003918171,
0.0018497592536732554,
-0.016953224316239357,
-0.03405508026480675,
-0.027292368933558464,
-0.004605238791555166,
-0.011212351731956005,
-0.07576465606689453,
0.013432526960968971,
0.08353062719106674,
0.024951430037617683,
0.0... |
700 | bitmath | _setup | null | def _setup(self):
return (10, 18, 'Eb', 'Ebs')
| (self) | [
0.033068232238292694,
-0.03508847951889038,
0.008785410784184933,
-0.03106570988893509,
0.020610051229596138,
0.007912629283964634,
0.0018718285718932748,
0.01825309731066227,
0.015710068866610527,
-0.02018473669886589,
0.00024823882267810404,
0.03976694494485855,
0.02842521294951439,
0.08... |
734 | bitmath | EiB | null | class EiB(Byte):
def _setup(self):
return (2, 60, 'EiB', 'EiBs')
| (value=0, bytes=None, bits=None) | [
0.03181125596165657,
-0.0624844916164875,
-0.02715248242020607,
0.015469979494810104,
0.011371323838829994,
-0.06131090968847275,
-0.010864549316465855,
0.00047454607556574047,
-0.025641046464443207,
-0.06717883050441742,
0.07020170241594315,
0.04633881151676178,
0.018146108835935593,
0.05... |
768 | bitmath | _setup | null | def _setup(self):
return (2, 60, 'EiB', 'EiBs')
| (self) | [
0.02825647033751011,
-0.024839894846081734,
-0.010206146165728569,
-0.016699383035302162,
0.043020956218242645,
0.0008307201787829399,
-0.019401265308260918,
-0.02292243018746376,
-0.03271893784403801,
-0.027803251519799232,
0.05902307853102684,
0.030662018805742264,
0.017849862575531006,
... |
802 | bitmath | Eib | null | class Eib(Bit):
def _setup(self):
return (2, 60, 'Eib', 'Eibs')
| (value=0, bytes=None, bits=None) | [
0.03637517988681793,
-0.0623522587120533,
0.0217233095318079,
0.002079166006296873,
-0.011188867501914501,
-0.045446254312992096,
-0.03890199214220047,
-0.020778026431798935,
-0.007425917778164148,
-0.0653335303068161,
0.03835663944482803,
0.07398650050163269,
0.008353020995855331,
0.08078... |
836 | bitmath | _setup | null | def _setup(self):
return (2, 60, 'Eib', 'Eibs')
| (self) | [
0.014622620306909084,
-0.01586483232676983,
0.004398764576762915,
-0.029830854386091232,
0.02131282351911068,
-0.001139064785093069,
-0.00846035685390234,
0.007502078544348478,
-0.006907590664923191,
-0.005416935309767723,
0.015190488658845425,
0.043229006230831146,
0.010762887075543404,
0... |
1,006 | bitmath | GB | null | class GB(Byte):
def _setup(self):
return (10, 9, 'GB', 'GBs')
| (value=0, bytes=None, bits=None) | [
0.026296066120266914,
-0.0540040023624897,
-0.07136999070644379,
0.025943098589777946,
-0.006071038078516722,
-0.04923894256353378,
-0.014277528040111065,
0.019660279154777527,
0.005457757040858269,
-0.09395990520715714,
0.06448712944984436,
0.050015468150377274,
0.0203485656529665,
0.0298... |
1,040 | bitmath | _setup | null | def _setup(self):
return (10, 9, 'GB', 'GBs')
| (self) | [
0.015338709577918053,
-0.024738159030675888,
-0.04222306236624718,
-0.01707318425178528,
0.021321769803762436,
0.00998636707663536,
-0.0016676795203238726,
-0.0024637419264763594,
0.007752574514597654,
-0.05855164676904678,
0.04358961805701256,
0.03281485289335251,
0.020253052935004234,
0.... |
1,074 | bitmath | Gb | null | class Gb(Bit):
def _setup(self):
return (10, 9, 'Gb', 'Gbs')
| (value=0, bytes=None, bits=None) | [
0.03397443890571594,
-0.05886400490999222,
-0.017099842429161072,
0.02263711392879486,
-0.004455626010894775,
-0.02950708381831646,
-0.03352395072579384,
0.0012904655886813998,
0.008953484706580639,
-0.0842415988445282,
0.029206756502389908,
0.0697883814573288,
0.025584068149328232,
0.0831... |
1,108 | bitmath | _setup | null | def _setup(self):
return (10, 9, 'Gb', 'Gbs')
| (self) | [
0.03237910196185112,
-0.013226641342043877,
-0.021308111026883125,
-0.018806491047143936,
0.030267806723713875,
0.018611330538988113,
-0.003681459464132786,
0.006994773168116808,
0.014344385825097561,
-0.03323071449995041,
0.026790380477905273,
0.03395813703536987,
0.014699225313961506,
0.... |
1,142 | bitmath | GiB | null | class GiB(Byte):
def _setup(self):
return (2, 30, 'GiB', 'GiBs')
| (value=0, bytes=None, bits=None) | [
0.032967641949653625,
-0.0708371251821518,
-0.05532076954841614,
0.024785621091723442,
0.012954863719642162,
-0.047028183937072754,
-0.010946215130388737,
0.026149291545152664,
-0.014097398146986961,
-0.07419101148843765,
0.06037003546953201,
0.04839185252785683,
0.013074645772576332,
0.04... |
1,176 | bitmath | _setup | null | def _setup(self):
return (2, 30, 'GiB', 'GiBs')
| (self) | [
0.019412219524383545,
-0.04368196055293083,
-0.03989595174789429,
-0.016153039410710335,
0.040431708097457886,
0.012536686845123768,
-0.010991924442350864,
0.0043217637576162815,
-0.020197995007038116,
-0.042181842029094696,
0.05514713376760483,
0.026662781834602356,
0.004413288552314043,
... |
1,210 | bitmath | Gib | null | class Gib(Bit):
def _setup(self):
return (2, 30, 'Gib', 'Gibs')
| (value=0, bytes=None, bits=None) | [
0.02762150764465332,
-0.07536488771438599,
0.0036738079506903887,
-0.000947243592236191,
-0.02316226437687874,
-0.02592625841498375,
-0.0341813862323761,
0.007780641317367554,
-0.0006714200717397034,
-0.06456688791513443,
0.019495366141200066,
0.07167956233024597,
0.015257243998348713,
0.0... |
1,244 | bitmath | _setup | null | def _setup(self):
return (2, 30, 'Gib', 'Gibs')
| (self) | [
0.015951208770275116,
-0.03526900336146355,
-0.012219462543725967,
-0.03357680141925812,
0.013635566458106041,
0.015024951659142971,
-0.0008611291996203363,
0.030833657830953598,
0.0009373895009048283,
-0.011854304000735283,
0.006180981639772654,
0.04054154083132744,
0.007209660951048136,
... |
1,414 | bitmath | KiB | null | class KiB(Byte):
def _setup(self):
return (2, 10, 'KiB', 'KiBs')
| (value=0, bytes=None, bits=None) | [
0.015430240891873837,
-0.06247938424348831,
-0.0631655752658844,
0.014771138317883015,
0.009186817333102226,
-0.045974716544151306,
-0.01023867353796959,
0.03261207044124603,
-0.0016105144750326872,
-0.06670486927032471,
0.057025983929634094,
0.04723874852061272,
0.018834102898836136,
0.03... |
1,448 | bitmath | _setup | null | def _setup(self):
return (2, 10, 'KiB', 'KiBs')
| (self) | [
0.004417003598064184,
-0.03171496093273163,
-0.039604343473911285,
-0.021673930808901787,
0.044817280024290085,
0.009402533061802387,
-0.015638817101716995,
0.01121306698769331,
-0.014108172617852688,
-0.04569193348288536,
0.058391913771629333,
0.02475271373987198,
0.009603703394532204,
0.... |
1,482 | bitmath | Kib | null | class Kib(Bit):
def _setup(self):
return (2, 10, 'Kib', 'Kibs')
| (value=0, bytes=None, bits=None) | [
0.015155479311943054,
-0.0715842917561531,
-0.017850395292043686,
-0.0037135034799575806,
-0.01616036333143711,
-0.024409549310803413,
-0.04403219372034073,
0.010907560586929321,
0.04125506058335304,
-0.04896526038646698,
0.02234496921300888,
0.07987914979457855,
0.013081763871014118,
0.05... |
1,516 | bitmath | _setup | null | def _setup(self):
return (2, 10, 'Kib', 'Kibs')
| (self) | [
0.0008744703372940421,
-0.028071604669094086,
-0.025857755914330482,
-0.030303165316581726,
0.031294967979192734,
0.017613383010029793,
-0.013823272660374641,
0.030250031501054764,
0.0354924276471138,
-0.0053796530701220036,
0.007230430841445923,
0.04310806840658188,
0.0052202558144927025,
... |
1,618 | bitmath | MB | null | class MB(Byte):
def _setup(self):
return (10, 6, 'MB', 'MBs')
| (value=0, bytes=None, bits=None) | [
0.04124375432729721,
-0.023392504081130028,
-0.04205039143562317,
0.024883029982447624,
-0.0061769187450408936,
-0.03826269879937172,
-0.009863780811429024,
0.017807411029934883,
-0.021183015778660774,
-0.06039264053106308,
0.04881913587450981,
0.07301828265190125,
0.017702197656035423,
0.... |
1,652 | bitmath | _setup | null | def _setup(self):
return (10, 6, 'MB', 'MBs')
| (self) | [
0.02504759468138218,
0.00878580566495657,
-0.033315565437078476,
-0.030809063464403152,
0.03521284461021423,
0.034969158470630646,
-0.012750078924000263,
-0.004973836243152618,
-0.024612439796328545,
-0.03482990711927414,
0.04647469148039818,
0.05761469155550003,
0.013455032370984554,
0.05... |
1,686 | bitmath | Mb | null | class Mb(Bit):
def _setup(self):
return (10, 6, 'Mb', 'Mbs')
| (value=0, bytes=None, bits=None) | [
0.0497799888253212,
-0.021247105672955513,
0.014553065411746502,
0.009282895363867283,
-0.012648407369852066,
-0.03729800879955292,
-0.027959637343883514,
0.003906398080289364,
-0.02579609490931034,
-0.050963468849658966,
0.011649848893284798,
0.09519591182470322,
0.030936822295188904,
0.0... |
1,720 | bitmath | _setup | null | def _setup(self):
return (10, 6, 'Mb', 'Mbs')
| (self) | [
0.0348254069685936,
0.014176403172314167,
-0.022407863289117813,
-0.03574001416563988,
0.030797619372606277,
0.02610146626830101,
-0.01675313152372837,
-0.0036562280729413033,
-0.006951889954507351,
-0.009629752486944199,
0.02042035199701786,
0.04717259481549263,
0.016357388347387314,
0.08... |
1,754 | bitmath | MiB | null | class MiB(Byte):
def _setup(self):
return (2, 20, 'MiB', 'MiBs')
| (value=0, bytes=None, bits=None) | [
0.0511125810444355,
-0.03551188111305237,
-0.02418559417128563,
0.019352082163095474,
0.0036025892477482557,
-0.06355707347393036,
-0.005257345736026764,
0.019604578614234924,
-0.04692834988236427,
-0.06038282439112663,
0.04083235189318657,
0.07820188999176025,
0.017142733559012413,
0.0627... |
1,788 | bitmath | _setup | null | def _setup(self):
return (2, 20, 'MiB', 'MiBs')
| (self) | [
0.03780471533536911,
-0.004038628656417131,
-0.011008872650563717,
-0.019147388637065887,
0.0379447340965271,
-0.004051755182445049,
-0.008401047438383102,
0.006939615588635206,
-0.026883352547883987,
-0.021370165050029755,
0.017029624432325363,
0.06885358691215515,
0.019794968888163567,
0... |
1,822 | bitmath | Mib | null | class Mib(Bit):
def _setup(self):
return (2, 20, 'Mib', 'Mibs')
| (value=0, bytes=None, bits=None) | [
0.042649734765291214,
-0.0274516511708498,
0.024141358211636543,
-0.009455366060137749,
-0.01389042567461729,
-0.03535246104001999,
-0.03588283807039261,
0.0009350204491056502,
-0.022074712440371513,
-0.0360291488468647,
0.010040611028671265,
0.10022322088479996,
0.0188924428075552,
0.0863... |
1,856 | bitmath | _setup | null | def _setup(self):
return (2, 20, 'Mib', 'Mibs')
| (self) | [
0.024356380105018616,
0.000456793000921607,
0.0017418005736544728,
-0.042255569249391556,
0.026485124602913857,
0.007503822911530733,
-0.008483932353556156,
0.015353566966950893,
-0.01572609692811966,
0.00792513694614172,
0.0027030615601688623,
0.05900169163942337,
0.015832534059882164,
0.... |
2,026 | bitmath | PB | null | class PB(Byte):
def _setup(self):
return (10, 15, 'PB', 'PBs')
| (value=0, bytes=None, bits=None) | [
0.01953181065618992,
-0.06065423786640167,
-0.06770788878202438,
0.022253016009926796,
-0.021501103416085243,
-0.05138065665960312,
-0.00992702879011631,
0.04063905403017998,
-0.0003309196326881647,
-0.05392283573746681,
0.05463894084095955,
0.05821947380900383,
0.011466658674180508,
0.053... |
2,060 | bitmath | _setup | null | def _setup(self):
return (10, 15, 'PB', 'PBs')
| (self) | [
0.01104342844337225,
-0.026289690285921097,
-0.04072703793644905,
-0.01676737144589424,
0.008638668805360794,
0.015765022486448288,
-0.018376406282186508,
0.012819521129131317,
-0.0012210637796670198,
-0.01900946907699108,
0.036436278373003006,
0.04547500982880592,
0.030000140890479088,
0.... |
2,094 | bitmath | Pb | null | class Pb(Bit):
def _setup(self):
return (10, 15, 'Pb', 'Pbs')
| (value=0, bytes=None, bits=None) | [
0.015043783001601696,
-0.07284747809171677,
-0.0029457653872668743,
0.005474677309393883,
-0.023102952167391777,
-0.03444137051701546,
-0.021824602037668228,
0.0010670294286683202,
0.006919769570231438,
-0.04576126113533974,
0.026678629219532013,
0.07473722100257874,
0.034144941717386246,
... |
2,128 | bitmath | _setup | null | def _setup(self):
return (10, 15, 'Pb', 'Pbs')
| (self) | [
0.016958540305495262,
-0.03443017229437828,
-0.00881985668092966,
-0.03386400267481804,
0.009748728014528751,
0.016693148761987686,
-0.011084533296525478,
0.010279511101543903,
0.018948979675769806,
0.0101114297285676,
0.024132966995239258,
0.03750871866941452,
0.04030417650938034,
0.07551... |
2,162 | bitmath | PiB | null | class PiB(Byte):
def _setup(self):
return (2, 50, 'PiB', 'PiBs')
| (value=0, bytes=None, bits=None) | [
0.019207993522286415,
-0.07481765002012253,
-0.03895553573966026,
0.017922064289450645,
-0.005732722580432892,
-0.04571790248155594,
-0.006411657202988863,
0.010539216920733452,
-0.01983746886253357,
-0.04902714490890503,
0.05413488671183586,
0.0528399683535099,
0.019693588837981224,
0.080... |
2,196 | bitmath | _setup | null | def _setup(self):
return (2, 50, 'PiB', 'PiBs')
| (self) | [
0.0026655583642423153,
-0.03670201078057289,
-0.013609303161501884,
-0.01910756714642048,
0.02169395051896572,
0.02185230143368244,
-0.0037718091625720263,
0.006285615265369415,
-0.01005522534251213,
0.0021300273947417736,
0.020779039710760117,
0.030983816832304,
0.01768241636455059,
0.087... |
2,230 | bitmath | Pib | null | class Pib(Bit):
def _setup(self):
return (2, 50, 'Pib', 'Pibs')
| (value=0, bytes=None, bits=None) | [
0.013114548288285732,
-0.06366076320409775,
-0.011112806387245655,
-0.0005335359019227326,
-0.01687566749751568,
-0.026767680421471596,
-0.02820390835404396,
-0.018904337659478188,
0.0013296320103108883,
-0.04700053110718727,
0.02822186052799225,
0.07199087738990784,
0.011507769115269184,
... |
2,264 | bitmath | _setup | null | def _setup(self):
return (2, 50, 'Pib', 'Pibs')
| (self) | [
-0.00033637724118307233,
-0.02393578179180622,
-0.02080761082470417,
-0.035429175943136215,
0.016835886985063553,
0.01991133578121662,
-0.009551466442644596,
-0.0029919727239757776,
0.005118425935506821,
0.0031435482669621706,
0.01487638708204031,
0.040139004588127136,
0.00928785651922226,
... |
2,434 | bitmath | TB | null | class TB(Byte):
def _setup(self):
return (10, 12, 'TB', 'TBs')
| (value=0, bytes=None, bits=None) | [
0.024414101615548134,
-0.03445553034543991,
-0.03286445885896683,
0.009546427056193352,
-0.016273122280836105,
-0.05225784704089165,
-0.02033035270869732,
0.032422494143247604,
-0.000940278812777251,
-0.06986570358276367,
0.04165070503950119,
0.06767355650663376,
0.013621336780488491,
0.04... |
2,468 | bitmath | _setup | null | def _setup(self):
return (10, 12, 'TB', 'TBs')
| (self) | [
0.028018256649374962,
0.019586756825447083,
-0.014772473834455013,
-0.03365660458803177,
0.0274977944791317,
0.017955971881747246,
-0.010816955007612705,
0.013879012316465378,
-0.013566735200583935,
-0.028885694220662117,
0.038826536387205124,
0.04916640371084213,
0.018216203898191452,
0.0... |
2,502 | bitmath | Tb | null | class Tb(Bit):
def _setup(self):
return (10, 12, 'Tb', 'Tbs')
| (value=0, bytes=None, bits=None) | [
0.033326707780361176,
-0.04014231264591217,
0.018997833132743835,
-0.012674165889620781,
-0.02073303982615471,
-0.034113809466362,
-0.0480133555829525,
0.0028935023583471775,
-0.008653674274682999,
-0.05126910284161568,
0.019337719306349754,
0.08436325937509537,
0.022128360345959663,
0.064... |
2,536 | bitmath | _setup | null | def _setup(self):
return (10, 12, 'Tb', 'Tbs')
| (self) | [
0.033065084367990494,
0.015391466207802296,
0.005831684917211533,
-0.05118294060230255,
0.02064390294253826,
0.003760761581361294,
-0.017081305384635925,
0.01371033862233162,
-0.01064424030482769,
-0.004947568289935589,
0.0190585907548666,
0.03395355865359306,
0.024372000247240067,
0.04954... |
2,570 | bitmath | TiB | null | class TiB(Byte):
def _setup(self):
return (2, 40, 'TiB', 'TiBs')
| (value=0, bytes=None, bits=None) | [
0.018408367410302162,
-0.0607745535671711,
-0.027280302718281746,
0.01919858157634735,
-0.018552042543888092,
-0.06547991186380386,
-0.03782246261835098,
0.028250109404325485,
-0.04119882360100746,
-0.06106190383434296,
0.049388304352760315,
0.07909312099218369,
0.010757670737802982,
0.061... |
2,604 | bitmath | _setup | null | def _setup(self):
return (2, 40, 'TiB', 'TiBs')
| (self) | [
0.004817542620003223,
-0.02148693986237049,
0.003994982223957777,
-0.023302245885133743,
0.018100695684552193,
0.0055768294259905815,
-0.01641630008816719,
0.020038185641169548,
-0.029359083622694016,
-0.011389299295842648,
0.02216767892241478,
0.0512474849820137,
0.012776961550116539,
0.0... |
2,638 | bitmath | Tib | null | class Tib(Bit):
def _setup(self):
return (2, 40, 'Tib', 'Tibs')
| (value=0, bytes=None, bits=None) | [
0.027733033522963524,
-0.04362703114748001,
0.031353533267974854,
-0.020799776539206505,
-0.01936967857182026,
-0.03193281590938568,
-0.051374901086091995,
-0.007693563587963581,
-0.007245526649057865,
-0.05691426992416382,
0.0327836312353611,
0.09362614154815674,
0.008965264074504375,
0.0... |
2,672 | bitmath | _setup | null | def _setup(self):
return (2, 40, 'Tib', 'Tibs')
| (self) | [
0.004996114876121283,
-0.010283009149134159,
0.014706376940011978,
-0.047899261116981506,
0.02412586100399494,
0.012732603587210178,
-0.016248388215899467,
0.017244087532162666,
-0.007168147247284651,
-0.002689707325771451,
0.018838966265320778,
0.04747631028294563,
0.011023174040019512,
0... |
2,842 | bitmath | YB | null | class YB(Byte):
def _setup(self):
return (10, 24, 'YB', 'YBs')
| (value=0, bytes=None, bits=None) | [
0.025829292833805084,
-0.03395615518093109,
-0.03233078494668007,
0.020476162433624268,
-0.026641977950930595,
-0.07073904573917389,
-0.04922052472829819,
0.06194083392620087,
-0.009257557801902294,
-0.03448616713285446,
0.05480332672595978,
0.06197616830468178,
0.032843127846717834,
0.069... |
2,876 | bitmath | _setup | null | def _setup(self):
return (10, 24, 'YB', 'YBs')
| (self) | [
0.024345573037862778,
-0.005677998531609774,
-0.006718745455145836,
-0.016239164397120476,
0.006872442550957203,
-0.009704855270683765,
-0.027999164536595345,
0.05086924880743027,
0.0017773936269804835,
0.002196766436100006,
0.02062171883881092,
0.0453537292778492,
0.03987333923578262,
0.0... |
2,910 | bitmath | Yb | null | class Yb(Bit):
def _setup(self):
return (10, 24, 'Yb', 'Ybs')
| (value=0, bytes=None, bits=None) | [
0.03410280495882034,
-0.04600915685296059,
0.016297154128551483,
0.016638362780213356,
-0.03241472691297531,
-0.04173508286476135,
-0.06389562040567398,
0.04687115550041199,
-0.016377966850996017,
-0.03710184246301651,
0.04406966269016266,
0.07894467562437057,
0.037748340517282486,
0.07944... |
2,944 | bitmath | _setup | null | def _setup(self):
return (10, 24, 'Yb', 'Ybs')
| (self) | [
0.024925023317337036,
-0.014480839483439922,
0.001995191676542163,
-0.020289039239287376,
0.004583101719617844,
-0.0014289142563939095,
-0.033280372619628906,
0.059404052793979645,
-0.004389201290905476,
0.009033999405801296,
0.025771135464310646,
0.045161180198192596,
0.03687634319067001,
... |
3,046 | bitmath | ZB | null | class ZB(Byte):
def _setup(self):
return (10, 21, 'ZB', 'ZBs')
| (value=0, bytes=None, bits=None) | [
-0.00055404455633834,
-0.03778640553355217,
-0.04000485688447952,
0.015920115634799004,
-0.0006921294843778014,
-0.068881094455719,
-0.0414595790207386,
0.054333873093128204,
-0.003084465628489852,
-0.06328041106462479,
0.041423212736845016,
0.08568312972784042,
0.008419204503297806,
0.061... |
3,080 | bitmath | _setup | null | def _setup(self):
return (10, 21, 'ZB', 'ZBs')
| (self) | [
-0.009080829098820686,
0.0025729015469551086,
-0.0156523659825325,
-0.014669707044959068,
0.029620174318552017,
-0.0024522626772522926,
-0.022074749693274498,
0.04607972502708435,
0.016599930822849274,
-0.03853430226445198,
0.008098169229924679,
0.06285513192415237,
0.00947564747184515,
0.... |
3,114 | bitmath | Zb | null | class Zb(Bit):
def _setup(self):
return (10, 21, 'Zb', 'Zbs')
| (value=0, bytes=None, bits=None) | [
0.008932096883654594,
-0.04635939747095108,
0.012315960600972176,
0.008950714953243732,
-0.004812812898308039,
-0.046694524586200714,
-0.058498483151197433,
0.03846526890993118,
-0.014745639637112617,
-0.06710010766983032,
0.02280733361840248,
0.10575155913829803,
0.01017486397176981,
0.07... |
3,148 | bitmath | _setup | null | def _setup(self):
return (10, 21, 'Zb', 'Zbs')
| (self) | [
-0.002338481368497014,
-0.006187506951391697,
-0.004668154753744602,
-0.02355216071009636,
0.026176897808909416,
-0.00038066378328949213,
-0.033117473125457764,
0.0543619841337204,
0.005218644626438618,
-0.029065867885947227,
0.013863538391888142,
0.0627470463514328,
0.005663440562784672,
... |
3,251 | bitmath | best_prefix | Return a bitmath instance representing the best human-readable
representation of the number of bytes given by ``bytes``. In addition
to a numeric type, the ``bytes`` parameter may also be a bitmath type.
Optionally select a preferred unit system by specifying the ``system``
keyword. Choices for ``system`` are ``bitmat... | def best_prefix(bytes, system=NIST):
"""Return a bitmath instance representing the best human-readable
representation of the number of bytes given by ``bytes``. In addition
to a numeric type, the ``bytes`` parameter may also be a bitmath type.
Optionally select a preferred unit system by specifying the ``system``
... | (bytes, system=2) | [
0.017660262063145638,
-0.014514555223286152,
-0.0032586860470473766,
0.008103516884148121,
0.03213050961494446,
-0.008608601987361908,
-0.02364153414964676,
-0.016419701278209686,
0.02938355691730976,
-0.07025115936994553,
0.05337953567504883,
0.04097393527626991,
-0.02573276497423649,
-0.... |
3,252 | bitmath | capitalize_first | Capitalize ONLY the first letter of the input `s`
* returns a copy of input `s` with the first letter capitalized
| def capitalize_first(s):
"""Capitalize ONLY the first letter of the input `s`
* returns a copy of input `s` with the first letter capitalized
"""
pfx = s[0].upper()
_s = s[1:]
return pfx + _s
| (s) | [
-0.08032679557800293,
-0.001292782835662365,
0.002319473773241043,
0.014637410640716553,
-0.03477562218904495,
-0.08658113330602646,
0.06435185670852661,
0.023114675655961037,
0.07316821068525314,
-0.08062820881605148,
-0.011086378246545792,
0.03311784565448761,
-0.03245850279927254,
0.020... |
3,253 | bitmath | cli_script | null | def cli_script(): # pragma: no cover
# Wrapper around cli_script_main so we can unittest the command
# line functionality
for result in cli_script_main(sys.argv[1:]):
print(result)
| () | [
0.0005570163484662771,
0.009264543652534485,
-0.050874922424554825,
-0.007320133037865162,
0.05058211833238602,
-0.023332923650741577,
-0.005041741766035557,
0.013935702852904797,
-0.009076965041458607,
-0.015070323832333088,
-0.010906998068094254,
0.01917874813079834,
-0.0025574713945388794... |
3,254 | bitmath | cli_script_main |
A command line interface to basic bitmath operations.
| def cli_script_main(cli_args):
"""
A command line interface to basic bitmath operations.
"""
choices = ALL_UNIT_TYPES
parser = argparse.ArgumentParser(
description='Converts from one type of size to another.')
parser.add_argument('--from-stdin', default=False, action='store_true',
... | (cli_args) | [
0.012115822173655033,
-0.019916677847504616,
-0.029507586732506752,
-0.024288173764944077,
0.010994684882462025,
0.001785340835340321,
-0.03619672730565071,
-0.04789800941944122,
-0.01901223137974739,
-0.05611340329051018,
0.024608498439192772,
0.07503142207860947,
-0.02387363463640213,
0.... |
3,258 | bitmath | format | Context manager for printing bitmath instances.
``fmt_str`` - a formatting mini-language compat formatting string. See
the @properties (above) for a list of available items.
``plural`` - True enables printing instances with 's's if they're
plural. False (default) prints them as singular (no trailing 's').
``bestpref... | binary = property(lambda s: bin(int(s.bits)))
| (fmt_str=None, plural=False, bestprefix=False) | [
0.03830193355679512,
-0.02601901814341545,
0.04148511216044426,
0.018095673993229866,
0.034132663160562515,
-0.033181168138980865,
-0.035291753709316254,
0.00422982033342123,
0.014635697938501835,
-0.0460868775844574,
0.029444394633173943,
0.10379927605390549,
0.051761239767074585,
0.01894... |
3,259 | bitmath | getsize | Return a bitmath instance in the best human-readable representation
of the file size at `path`. Optionally, provide a preferred unit
system by setting `system` to either `bitmath.NIST` (default) or
`bitmath.SI`.
Optionally, set ``bestprefix`` to ``False`` to get ``bitmath.Byte``
instances back.
| def getsize(path, bestprefix=True, system=NIST):
"""Return a bitmath instance in the best human-readable representation
of the file size at `path`. Optionally, provide a preferred unit
system by setting `system` to either `bitmath.NIST` (default) or
`bitmath.SI`.
Optionally, set ``bestprefix`` to ``False`` to get ... | (path, bestprefix=True, system=2) | [
0.05021192505955696,
-0.024676188826560974,
-0.010923421941697598,
-0.012929033488035202,
0.034489359706640244,
-0.009275955148041248,
-0.02191847190260887,
-0.0021757306531071663,
0.006549576297402382,
-0.045412782579660416,
0.08616968244314194,
0.028938112780451775,
-0.037605222314596176,
... |
3,260 | bitmath | kB | null | class kB(Byte):
def _setup(self):
return (10, 3, 'kB', 'kBs')
| (value=0, bytes=None, bits=None) | [
0.01498720794916153,
-0.05745244771242142,
-0.04846547544002533,
0.03136525675654411,
-0.00275047798641026,
-0.03605489060282707,
-0.020880453288555145,
0.02795947901904583,
-0.00552770309150219,
-0.056382570415735245,
0.05509871616959572,
0.05599028244614601,
0.00908058974891901,
0.049464... |
3,294 | bitmath | _setup | null | def _setup(self):
return (10, 3, 'kB', 'kBs')
| (self) | [
0.004315015394240618,
-0.014622745104134083,
-0.03655686229467392,
-0.018591776490211487,
0.03575609251856804,
0.02616426907479763,
-0.023135272786021233,
-0.0016635549254715443,
-0.00866484735161066,
-0.03888953849673271,
0.050378840416669846,
0.04776763543486595,
0.0074636926874518394,
0... |
3,328 | bitmath | kb | null | class kb(Bit):
def _setup(self):
return (10, 3, 'kb', 'kbs')
| (value=0, bytes=None, bits=None) | [
0.021535828709602356,
-0.06113624945282936,
-0.0109538733959198,
0.013929218053817749,
-0.009820408187806606,
0.0038741466123610735,
-0.03921079263091087,
0.008855191990733147,
0.026919785887002945,
-0.04852645471692085,
0.04045052081346512,
0.07133743166923523,
0.014823592267930508,
0.068... |
3,362 | bitmath | _setup | null | def _setup(self):
return (10, 3, 'kb', 'kbs')
| (self) | [
0.009034465998411179,
-0.006791066378355026,
-0.03151194006204605,
-0.02340787462890148,
0.04083335027098656,
0.04848525673151016,
-0.024833912029862404,
0.0012216962641105056,
0.005282423458993435,
-0.0244339257478714,
0.03985947370529175,
0.04615490511059761,
0.008608394302427769,
0.0643... |
3,464 | bitmath | listdir | This is a generator which recurses the directory tree
`search_base`, yielding 2-tuples of:
* The absolute/relative path to a discovered file
* A bitmath instance representing the "apparent size" of the file.
- `search_base` - The directory to begin walking down.
- `followlinks` - Whether or not to follow symb... | def listdir(search_base, followlinks=False, filter='*',
relpath=False, bestprefix=False, system=NIST):
"""This is a generator which recurses the directory tree
`search_base`, yielding 2-tuples of:
* The absolute/relative path to a discovered file
* A bitmath instance representing the "apparent size" of... | (search_base, followlinks=False, filter='*', relpath=False, bestprefix=False, system=2) | [
-0.005450418218970299,
-0.05688571184873581,
-0.028016891330480576,
-0.01851012371480465,
0.04224799945950508,
0.03973093256354332,
-0.013911635614931583,
-0.029139891266822815,
-0.012604696676135063,
-0.027939442545175552,
0.011965748853981495,
0.016583599150180817,
0.022982757538557053,
... |
3,465 | builtins | int | int([x]) -> integer
int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments
are given. If x is a number, return x.__int__(). For floating point
numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string,
bytes, or bytearray instan... | from builtins import int
| null | [
-0.009293523617088795,
-0.013936184346675873,
-0.005179929547011852,
0.0383552685379982,
0.04409707337617874,
0.036649130284786224,
0.014854873530566692,
0.021933700889348984,
-0.06447228044271469,
-0.058107081800699234,
0.0021839370019733906,
0.032531436532735825,
0.014699024148285389,
0.... |
3,469 | bitmath | os_name | null | def os_name():
# makes unittesting platform specific code easier
return os.name
| () | [
0.0762120932340622,
-0.00762034859508276,
0.00012337080261204392,
-0.010731309652328491,
0.04099756106734276,
-0.06461160629987717,
0.006213316693902016,
0.02728007361292839,
0.019982438534498215,
-0.017624476924538612,
0.036970093846321106,
-0.009844922460615635,
-0.01388960238546133,
-0.... |
3,470 | bitmath | parse_string | Parse a string with units and try to make a bitmath object out of
it.
String inputs may include whitespace characters between the value and
the unit.
| def parse_string(s):
"""Parse a string with units and try to make a bitmath object out of
it.
String inputs may include whitespace characters between the value and
the unit.
"""
# Strings only please
if not isinstance(s, (str, unicode)):
raise ValueError("parse_string only accepts string inputs... | (s) | [
0.026352377608418465,
0.022509321570396423,
0.010248146951198578,
-0.00036285986425355077,
-0.014667659997940063,
-0.022216517478227615,
-0.03111044503748417,
0.01428335439413786,
-0.03511820361018181,
-0.056694209575653076,
0.02055119350552559,
0.11748767644166946,
-0.03330647572875023,
0... |
3,471 | bitmath | parse_string_unsafe | Attempt to parse a string with ambiguous units and try to make a
bitmath object out of it.
This may produce inaccurate results if parsing shell output. For
example `ls` may say a 2730 Byte file is '2.7K'. 2730 Bytes == 2.73 kB
~= 2.666 KiB. See the documentation for all of the important details.
Note the following ca... | def parse_string_unsafe(s, system=SI):
"""Attempt to parse a string with ambiguous units and try to make a
bitmath object out of it.
This may produce inaccurate results if parsing shell output. For
example `ls` may say a 2730 Byte file is '2.7K'. 2730 Bytes == 2.73 kB
~= 2.666 KiB. See the documentation for all of... | (s, system=10) | [
0.047001346945762634,
0.017254646867513657,
-0.01515637245029211,
0.02734588272869587,
-0.008002720773220062,
-0.020670443773269653,
-0.039759859442710876,
-0.012911707162857056,
-0.03648069500923157,
-0.06655921787023544,
0.04454197362065315,
0.11032043397426605,
-0.02701406367123127,
0.0... |
3,473 | bitmath | query_device_capacity | Create bitmath instances of the capacity of a system block device
Make one or more ioctl request to query the capacity of a block
device. Perform any processing required to compute the final capacity
value. Return the device capacity in bytes as a :class:`bitmath.Byte`
instance.
Thanks to the following resources for ... | def query_device_capacity(device_fd):
"""Create bitmath instances of the capacity of a system block device
Make one or more ioctl request to query the capacity of a block
device. Perform any processing required to compute the final capacity
value. Return the device capacity in bytes as a :class:`bitmath.Byte`
inst... | (device_fd) | [
0.10224379599094391,
-0.06142742186784744,
-0.06244174391031265,
-0.01960686966776848,
0.017415931448340416,
0.0056548528373241425,
-0.021828237920999527,
-0.036454781889915466,
-0.06438924372196198,
-0.061630286276340485,
0.014829407446086407,
0.011147413402795792,
-0.02440462075173855,
0... |
3,478 | xml_python | Builder | A builder for returning python objects from xml ``Element`` instances.
Given a single node and a input object, a builder can transform the input
object according to the data found in the provided element.
To parse a tag, use the :meth:`~Builder.parse_element` method.
:ivar ~Builder.maker: The method ... | class Builder(Generic[InputObjectType, OutputObjectType]):
"""A builder for returning python objects from xml ``Element`` instances.
Given a single node and a input object, a builder can transform the input
object according to the data found in the provided element.
To parse a tag, use the :meth:`~Bui... | (maker: Callable[[Optional[~InputObjectType], xml.etree.ElementTree.Element], ~OutputObjectType], name: Optional[str] = None, parsers: Dict[str, Callable[[~OutputObjectType, xml.etree.ElementTree.Element], NoneType]] = NOTHING, builders: Dict[str, xml_python.Builder] = NOTHING) -> None | [
0.04280031472444534,
-0.01911519281566143,
-0.047269586473703384,
-0.030922522768378258,
-0.007680301088839769,
0.00950726680457592,
-0.028587227687239647,
0.005219182465225458,
-0.00471588596701622,
-0.014947899617254734,
0.005571489688009024,
0.009351245127618313,
0.01861189678311348,
0.... |
3,479 | xml_python | __eq__ | Method generated by attrs for class Builder. | """The xml_python library.
A library for converting XML into python objects.
Provides the Builder class.
"""
from typing import IO, Any, Callable, Dict, Generic, List, Optional, TypeVar
from xml.etree.ElementTree import Element, ElementTree, fromstring, parse
from attr import Factory, attrib, attrs
__all__: List[s... | (self, other) | [
0.024106213822960854,
-0.009396032430231571,
-0.02206527255475521,
-0.03454197198152542,
0.016298649832606316,
0.005511504597961903,
-0.011446600779891014,
0.01268849428743124,
-0.01411330234259367,
-0.04655656963586807,
0.012332292273640633,
0.02060195617377758,
0.02481861785054207,
0.047... |
3,487 | xml_python | add_builder | Add a sub builder to this builder.
In the same way that parsers know how to handle a single tag, sub
builders can handle many tags recursively.
:param tag: The name of the top level tag this sub builder knows how to
handle.
:param builder: The builder to add.
| def add_builder(self, tag: str, builder: 'Builder') -> None:
"""Add a sub builder to this builder.
In the same way that parsers know how to handle a single tag, sub
builders can handle many tags recursively.
:param tag: The name of the top level tag this sub builder knows how to
handle.
:par... | (self, tag: str, builder: xml_python.Builder) -> NoneType | [
0.015942346304655075,
0.0010037942556664348,
-0.03355995938181877,
0.03321398049592972,
-0.02013961784541607,
0.03210320696234703,
0.012919583357870579,
0.017817916348576546,
-0.04308348521590233,
-0.026239773258566856,
0.022688936442136765,
-0.0013008353998884559,
-0.0047981818206608295,
... |
3,488 | xml_python | add_parser | Add a parser to this builder.
:param tag: The name of the tag that this parser knows how to handle.
:param func: The function which will do the actual parsing.
| def add_parser(self, tag: str, func: ParserType) -> None:
"""Add a parser to this builder.
:param tag: The name of the tag that this parser knows how to handle.
:param func: The function which will do the actual parsing.
"""
self.parsers[tag] = func
| (self, tag: str, func: Callable[[~OutputObjectType, xml.etree.ElementTree.Element], NoneType]) -> NoneType | [
0.025730567052960396,
0.003823657985776663,
-0.039382822811603546,
-0.014233930967748165,
0.013369971886277199,
0.05693572387099266,
0.019007088616490364,
0.024721190333366394,
-0.06466858088970184,
-0.012523122131824493,
0.047320976853370667,
0.0031714122742414474,
-0.014661633409559727,
... |
3,489 | xml_python | build | Make the initial object, then handle the element.
If you are looking to build an object from an xml element, this is
likely the method you want.
:param input_object: An optional input object for the provided elements
to work on.
:param element: The element to handle.
... | def build(
self, input_object: Optional[InputObjectType], element: Element
) -> OutputObjectType:
"""Make the initial object, then handle the element.
If you are looking to build an object from an xml element, this is
likely the method you want.
:param input_object: An optional input object for the ... | (self, input_object: Optional[~InputObjectType], element: xml.etree.ElementTree.Element) -> ~OutputObjectType | [
-0.0011458528460934758,
0.007095050532370806,
-0.026075299829244614,
-0.05894214287400246,
-0.003459551837295294,
-0.02830982394516468,
-0.039693575352430344,
0.035242125391960144,
-0.001095268176868558,
-0.025424297899007797,
0.021307144314050674,
0.03958800807595253,
0.004732965957373381,
... |
3,490 | xml_python | handle_elements | Handle each of the given elements.
This method is usually called by the :meth:`~Builder.make_and_handle`
method.
:param subject: The object to maniplate with the given elements.
:param elements: The elements to work through.
| def handle_elements(
self, subject: OutputObjectType, elements: List[Element]
) -> None:
"""Handle each of the given elements.
This method is usually called by the :meth:`~Builder.make_and_handle`
method.
:param subject: The object to maniplate with the given elements.
:param elements: The eleme... | (self, subject: ~OutputObjectType, elements: List[xml.etree.ElementTree.Element]) -> NoneType | [
0.0006493363180197775,
0.025495629757642746,
-0.08472825586795807,
-0.061196524649858475,
-0.028494084253907204,
-0.013238789513707161,
-0.03969883546233177,
-0.02141001634299755,
0.01749098300933838,
0.06736878305673599,
-0.016465196385979652,
-0.022269222885370255,
0.031667884439229965,
... |
3,491 | xml_python | handle_file | Handle a file-like object.
:param fileobj: The file-like object to read XML from.
| def handle_file(self, fileobj: IO[str]) -> OutputObjectType:
"""Handle a file-like object.
:param fileobj: The file-like object to read XML from.
"""
return self.handle_string(fileobj.read())
| (self, fileobj: IO[str]) -> ~OutputObjectType | [
0.005389665253460407,
-0.03738250583410263,
-0.03943571075797081,
-0.03564789891242981,
0.03396639600396156,
-0.03529389947652817,
0.0023319816682487726,
0.09168625622987747,
0.022195862606167793,
-0.04998493939638138,
0.03865690901875496,
0.008000422269105911,
-0.005079914350062609,
-0.00... |
3,492 | xml_python | handle_filename | Return an element made from a file with the given name.
:param filename: The name of the file to load.
| def handle_filename(self, filename: str) -> OutputObjectType:
"""Return an element made from a file with the given name.
:param filename: The name of the file to load.
"""
root: ElementTree = parse((filename))
e: Element = root.getroot()
return self.build(None, e)
| (self, filename: str) -> ~OutputObjectType | [
0.0286564938724041,
-0.019566817209124565,
-0.04447003826498985,
-0.0449325293302536,
0.035771701484918594,
-0.006434814538806677,
-0.02426285296678543,
0.05588994547724724,
0.012238155119121075,
0.005038455594331026,
0.026877691969275475,
-0.0026103912387043238,
-0.01749451272189617,
0.03... |
3,493 | xml_python | handle_string | Parse and handle an element from a string.
:param xml: The xml string to parse.
| def handle_string(self, xml: str) -> OutputObjectType:
"""Parse and handle an element from a string.
:param xml: The xml string to parse.
"""
element: Element = fromstring(xml)
return self.build(None, element)
| (self, xml: str) -> ~OutputObjectType | [
0.013195034116506577,
0.010092418640851974,
0.0008525507873855531,
-0.07239437848329544,
0.025855135172605515,
-0.0033968298230320215,
-0.015290191397070885,
0.10677278786897659,
0.009593146853148937,
-0.035198647528886795,
0.016226325184106827,
0.047074176371097565,
-0.020933743566274643,
... |
3,494 | xml_python | parser | Add a new parser to this builder.
Parsers work on the name on a tag. So if you wish to work on the XML
``<title>Hello, title</title>``, you need a parser that knows how to
handle the ``title`` tag.
:param tag: The tag name this parser will handle.
| def parser(self, tag: str) -> Callable[[ParserType], ParserType]:
"""Add a new parser to this builder.
Parsers work on the name on a tag. So if you wish to work on the XML
``<title>Hello, title</title>``, you need a parser that knows how to
handle the ``title`` tag.
:param tag: The tag name this par... | (self, tag: str) -> Callable[[Callable[[~OutputObjectType, xml.etree.ElementTree.Element], NoneType]], Callable[[~OutputObjectType, xml.etree.ElementTree.Element], NoneType]] | [
0.037689536809921265,
0.007980811409652233,
-0.04563715308904648,
-0.04571302607655525,
0.0012026935582980514,
0.05591784045100212,
0.010005651973187923,
-0.0044195582158863544,
-0.03366830572485924,
-0.013685455545783043,
0.04457494243979454,
-0.005301572848111391,
-0.006069779396057129,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.