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
3,495
xml_python
BuilderError
Base exception.
class BuilderError(Exception): """Base exception."""
null
[ -0.016460761427879333, -0.03584127500653267, -0.031680189073085785, 0.03028150647878647, -0.02003614790737629, -0.0686054453253746, -0.014747373759746552, 0.02099774219095707, 0.013619684614241123, -0.038918379694223404, 0.03979255631566048, 0.027693942189216614, 0.02183695323765278, 0.009...
3,496
xml.etree.ElementTree
Element
null
class Element: """An XML element. This class is the reference implementation of the Element interface. An element's length is its number of subelements. That means if you want to check if an element is truly empty, you should check BOTH its length AND its text attribute. The element tag, att...
null
[ 0.04049646854400635, -0.04016822949051857, -0.005226178094744682, -0.012503848411142826, -0.00044042986701242626, 0.011375527828931808, -0.026259107515215874, 0.020873939618468285, 0.0472663938999176, -0.020535442978143692, -0.016760695725679398, -0.01726331189274788, 0.07898247241973877, ...
3,497
xml.etree.ElementTree
ElementTree
An XML element hierarchy. This class also provides support for serialization to and from standard XML. *element* is an optional root element node, *file* is an optional file handle or file name of an XML file whose contents will be used to initialize the tree with.
class ElementTree: """An XML element hierarchy. This class also provides support for serialization to and from standard XML. *element* is an optional root element node, *file* is an optional file handle or file name of an XML file whose contents will be used to initialize the tree with. "...
(element=None, file=None)
[ 0.024265656247735023, -0.05430077016353607, -0.01376609317958355, -0.0035528824664652348, 0.02886849455535412, -0.0008915348444133997, -0.04320729151368141, 0.001999159110710025, 0.04912522807717323, -0.02460503578186035, -0.007667862344533205, -0.049676720052957535, 0.013702459633350372, ...
3,498
xml.etree.ElementTree
__init__
null
def __init__(self, element=None, file=None): # assert element is None or iselement(element) self._root = element # first node if file: self.parse(file)
(self, element=None, file=None)
[ 0.0006033362587913871, 0.027025962248444557, 0.013399206101894379, 0.008152423426508904, -0.0212146807461977, 0.0012679359642788768, -0.012646540068089962, 0.03516525775194168, -0.02287754788994789, 0.04102905094623566, 0.018081489950418472, 0.02028697542846203, -0.005579356104135513, 0.03...
3,499
xml.etree.ElementTree
_setroot
Replace root element of this tree. This will discard the current contents of the tree and replace it with the given element. Use with care!
def _setroot(self, element): """Replace root element of this tree. This will discard the current contents of the tree and replace it with the given element. Use with care! """ # assert iselement(element) self._root = element
(self, element)
[ -0.005382678937166929, 0.040966734290122986, 0.05367226153612137, 0.03550679236650467, -0.010447719134390354, 0.016766143962740898, -0.033978696912527084, 0.06359630823135376, 0.06404271721839905, 0.026973487809300423, -0.0146714486181736, -0.07506562024354935, 0.017616039142012596, 0.0050...
3,500
xml.etree.ElementTree
find
Find first matching element by tag name or path. Same as getroot().find(path), which is Element.find() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return the first matching element, or None if no ...
def find(self, path, namespaces=None): """Find first matching element by tag name or path. Same as getroot().find(path), which is Element.find() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return the first match...
(self, path, namespaces=None)
[ 0.030871527269482613, -0.0440569743514061, 0.010337390936911106, 0.002905193716287613, 0.01783551461994648, -0.0009625376551412046, 0.013220609165728092, -0.02969362773001194, 0.017615757882595062, 0.020041881129145622, 0.013176657259464264, -0.008214534260332584, 0.005195066332817078, -0....
3,501
xml.etree.ElementTree
findall
Find all matching subelements by tag name or path. Same as getroot().findall(path), which is Element.findall(). *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return list containing all matching elem...
def findall(self, path, namespaces=None): """Find all matching subelements by tag name or path. Same as getroot().findall(path), which is Element.findall(). *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return lis...
(self, path, namespaces=None)
[ -0.026215877383947372, -0.04695485159754753, -0.038931362330913544, -0.00770952645689249, -0.0071775340475142, 0.03561731427907944, -0.03050670027732849, -0.07493241131305695, 0.04029186815023422, 0.016134189441800117, 0.015358003787696362, -0.01868077553808689, 0.013177708722651005, 0.011...
3,502
xml.etree.ElementTree
findtext
Find first matching element by tag name or path. Same as getroot().findtext(path), which is Element.findtext() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return the first matching element, or No...
def findtext(self, path, default=None, namespaces=None): """Find first matching element by tag name or path. Same as getroot().findtext(path), which is Element.findtext() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name....
(self, path, default=None, namespaces=None)
[ 0.041296038776636124, -0.0501151941716671, 0.06638863682746887, 0.016124704852700233, 0.025757530704140663, -0.024777624756097794, 0.01639592833817005, -0.013744932599365711, 0.06540872901678085, 0.016010964289307594, 0.03543410077691078, -0.013386216945946217, -0.010411501862108707, -0.02...
3,503
xml.etree.ElementTree
getroot
Return root element of this tree.
def getroot(self): """Return root element of this tree.""" return self._root
(self)
[ 0.0029366135131567717, 0.0165147315710783, 0.07316459715366364, 0.029170643538236618, 0.04810776188969612, 0.015860261395573616, -0.0011538213584572077, 0.030207594856619835, 0.09063978493213654, 0.011134481988847256, 0.011695455759763718, -0.07595247030258179, 0.0007442466448992491, 0.000...
3,504
xml.etree.ElementTree
iter
Create and return tree iterator for the root element. The iterator loops over all elements in this tree, in document order. *tag* is a string with the tag name to iterate over (default is to return all elements).
def iter(self, tag=None): """Create and return tree iterator for the root element. The iterator loops over all elements in this tree, in document order. *tag* is a string with the tag name to iterate over (default is to return all elements). """ # assert self._root is not None return self._r...
(self, tag=None)
[ 0.006530795246362686, -0.031095780432224274, -0.03542126342654228, -0.035216908901929855, 0.013691679574549198, 0.027281183749437332, -0.05752549320459366, 0.009281051345169544, 0.08862127363681793, 0.02540794387459755, 0.02510141395032406, -0.02988668903708458, -0.022921644151210785, 0.02...
3,505
xml.etree.ElementTree
iterfind
Find all matching subelements by tag name or path. Same as getroot().iterfind(path), which is element.iterfind() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return an iterable yielding all matchin...
def iterfind(self, path, namespaces=None): """Find all matching subelements by tag name or path. Same as getroot().iterfind(path), which is element.iterfind() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return a...
(self, path, namespaces=None)
[ 0.005176476202905178, -0.06669145077466965, -0.03999359905719757, 0.0058988784439861774, -0.01446576975286007, 0.010964557528495789, -0.012365042231976986, -0.023967795073986053, 0.055168475955724716, 0.00549114216119051, 0.015343288891017437, -0.023755062371492386, -0.0040219626389443874, ...
3,506
xml.etree.ElementTree
parse
Load external XML document into element tree. *source* is a file name or file object, *parser* is an optional parser instance that defaults to XMLParser. ParseError is raised if the parser fails to parse the document. Returns the root element of the given source document.
def parse(self, source, parser=None): """Load external XML document into element tree. *source* is a file name or file object, *parser* is an optional parser instance that defaults to XMLParser. ParseError is raised if the parser fails to parse the document. Returns the root element of the given sou...
(self, source, parser=None)
[ -0.02432069554924965, -0.021567407995462418, -0.04845783859491348, 0.0012320955283939838, 0.015051297843456268, 0.009636501781642437, -0.029607003554701805, 0.025935955345630646, 0.006773083936423063, -0.006208660546690226, 0.014050937257707119, -0.058810193091630936, -0.011398605071008205, ...
3,507
xml.etree.ElementTree
write
Write element tree to a file as XML. Arguments: *file_or_filename* -- file name or a file object opened for writing *encoding* -- the output encoding (default: US-ASCII) *xml_declaration* -- bool indicating if an XML declaration should be added to ...
def write(self, file_or_filename, encoding=None, xml_declaration=None, default_namespace=None, method=None, *, short_empty_elements=True): """Write element tree to a file as XML. Arguments: *file_or_filename* -- file name or a file object opened for writin...
(self, file_or_filename, encoding=None, xml_declaration=None, default_namespace=None, method=None, *, short_empty_elements=True)
[ -0.0019307233160361648, 0.00012117936421418563, 0.03420604020357132, 0.015194408595561981, 0.052547331899404526, -0.04830183461308479, -0.07265757769346237, -0.025081947445869446, -0.010250640101730824, -0.012568904086947441, 0.029178479686379433, -0.04852528125047684, 0.024244019761681557, ...
3,508
xml.etree.ElementTree
write_c14n
null
def write_c14n(self, file): # lxml.etree compatibility. use output method instead return self.write(file, method="c14n")
(self, file)
[ -0.03889735788106918, 0.013860936276614666, 0.08740229159593582, 0.050773393362760544, 0.04049862176179886, -0.03699585795402527, -0.06341670453548431, 0.001283304183743894, 0.04353434965014458, -0.033976808190345764, 0.02872266247868538, -0.00791457761079073, 0.045402489602565765, -0.0034...
3,509
attr._make
Factory
Stores a factory callable. If passed as the default value to `attrs.field`, the factory is used to generate a new value. :param callable factory: A callable that takes either none or exactly one mandatory positional argument depending on *takes_self*. :param bool takes_self: Pass the part...
class Factory: """ Stores a factory callable. If passed as the default value to `attrs.field`, the factory is used to generate a new value. :param callable factory: A callable that takes either none or exactly one mandatory positional argument depending on *takes_self*. :param bool tak...
(factory, takes_self=False)
[ 0.0709899440407753, -0.01805315725505352, 0.03740310296416283, 0.014246155507862568, -0.028918398544192314, 0.02384239435195923, 0.008702381514012814, -0.017664121463894844, 0.01404237374663353, -0.020007604733109474, 0.008720907382667065, 0.08973781019449234, -0.007669581566005945, 0.0539...
3,510
null
__eq__
null
def __eq__(self, other): if other.__class__ is not self.__class__: return NotImplemented return ( self.factory, self.takes_self, ) == ( other.factory, other.takes_self, )
(self, other)
[ 0.041313935071229935, -0.032488249242305756, 0.02675502933561802, 0.03804773464798927, -0.0594865046441555, -0.05900004878640175, -0.01645260490477085, 0.027015630155801773, 0.03227976709604263, 0.02800591289997101, 0.013846595771610737, -0.03377388045191765, 0.038603685796260834, 0.079431...
3,511
attr._make
__getstate__
Play nice with pickle.
def __getstate__(self): """ Play nice with pickle. """ return tuple(getattr(self, name) for name in self.__slots__)
(self)
[ 0.03660581260919571, -0.023657388985157013, -0.023236440494656563, -0.005489187780767679, -0.01346198096871376, -0.018808046355843544, 0.006326878443360329, 0.008882044814527035, 0.023320630192756653, -0.061896488070487976, -0.028792979195713997, 0.04701169580221176, -0.03808755427598953, ...
3,512
null
__hash__
null
def __hash__(self): return hash(( 6612536052319191824, self.factory, self.takes_self, ))
(self)
[ 0.04918321594595909, -0.03839196264743805, 0.038945358246564865, 0.037803977727890015, 0.00575014716014266, -0.04517108201980591, -0.03728516399860382, -0.03092109225690365, -0.025663815438747406, 0.0010181651450693607, 0.0030696275644004345, 0.0021400924306362867, 0.0032533728517591953, 0...
3,513
attr._make
__init__
null
def __init__(self, factory, takes_self=False): self.factory = factory self.takes_self = takes_self
(self, factory, takes_self=False)
[ 0.017316289246082306, -0.023112349212169647, 0.032817378640174866, 0.001064295880496502, -0.045613642781972885, 0.022609125822782516, 0.027443667873740196, 0.04859703779220581, 0.014117224141955376, 0.033446408808231354, 0.0012883876916021109, 0.05348549783229828, -0.013002943247556686, 0....
3,514
attr._make
__ne__
Check equality and either forward a NotImplemented or return the result negated.
def _make_ne(): """ Create __ne__ method. """ def __ne__(self, other): """ Check equality and either forward a NotImplemented or return the result negated. """ result = self.__eq__(other) if result is NotImplemented: return NotImplemented ...
(self, other)
[ -0.0017222054302692413, -0.026301970705389977, 0.05129767209291458, 0.017096281051635742, -0.10083010792732239, -0.06541953235864639, -0.06404265016317368, 0.004594018682837486, 0.026266666129231453, -0.020865052938461304, 0.008234811946749687, -0.037105198949575424, 0.027784766629338264, ...
3,515
null
__repr__
null
def __repr__(self): try: already_repring = _compat.repr_context.already_repring except AttributeError: already_repring = {id(self),} _compat.repr_context.already_repring = already_repring else: if id(self) in already_repring: return '...' else: already_repring.add(id(self)) try: ...
(self)
[ 0.036234673112630844, -0.05183497071266174, 0.07001456618309021, 0.035416413098573685, 0.030151089653372765, -0.04450621083378792, 0.04699656367301941, -0.017912771552801132, 0.0365726500749588, -0.02364058792591095, -0.005616641137748957, 0.0091431625187397, -0.011090976186096668, 0.05176...
3,516
attr._make
__setstate__
Play nice with pickle.
def __setstate__(self, state): """ Play nice with pickle. """ for name, value in zip(self.__slots__, state): setattr(self, name, value)
(self, state)
[ 0.01651332527399063, -0.0031254636123776436, -0.007258044555783272, -0.00164134637452662, -0.05745243653655052, -0.020669279620051384, -0.035083379596471786, 0.01742270588874817, -0.0051078274846076965, -0.03224475681781769, -0.05286303907632828, 0.06384359300136566, -0.010547111742198467, ...
3,517
typing
Generic
Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ...
class Generic: """Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key...
()
[ 0.01844821311533451, -0.0015865765744820237, -0.06139306724071503, 0.04160188138484955, -0.004904882051050663, 0.0255871769040823, -0.0520225465297699, -0.04822586849331856, 0.0623624324798584, -0.05028576776385307, -0.006846134550869465, 0.009587617591023445, 0.0011107298778370023, 0.0100...
3,518
typing
IO
Generic base class for TextIO and BinaryIO. This is an abstract, generic version of the return of open(). NOTE: This does not distinguish between the different possible classes (text vs. binary, read vs. write vs. read/write, append-only, unbuffered). The TextIO and BinaryIO subclasses below capt...
class IO(Generic[AnyStr]): """Generic base class for TextIO and BinaryIO. This is an abstract, generic version of the return of open(). NOTE: This does not distinguish between the different possible classes (text vs. binary, read vs. write vs. read/write, append-only, unbuffered). The TextIO and ...
()
[ -0.006901133339852095, -0.03947073593735695, -0.036026861518621445, -0.0045814248733222485, 0.02358965389430523, -0.01984243094921112, -0.0036111618392169476, 0.04375327378511429, 0.023286307230591774, -0.0875779241323471, 0.037365153431892395, 0.03297555074095726, -0.033082615584135056, 0...
3,519
typing
__enter__
null
@abstractmethod def __enter__(self) -> 'IO[AnyStr]': pass
(self) -> IO[~AnyStr]
[ 0.010375001467764378, -0.04293333739042282, -0.004979167133569717, 0.013758335262537003, 0.012591668404638767, -0.017366668209433556, -0.0006770834443159401, 0.004808334168046713, 0.018433336168527603, -0.07406667619943619, 0.05663334205746651, -0.021150002256035805, -0.0071291676722466946, ...
3,520
typing
__exit__
null
@abstractmethod def __exit__(self, type, value, traceback) -> None: pass
(self, type, value, traceback) -> NoneType
[ 0.01878287084400654, -0.016830196604132652, -0.002478882437571883, 0.018985746428370476, -0.060355398803949356, -0.05491157993674278, -0.01634836755692959, 0.018106620758771896, 0.006390571594238281, -0.031124452129006386, 0.03469167649745941, 0.015300178900361061, 0.037024740129709244, 0....
3,521
typing
close
null
@abstractmethod def close(self) -> None: pass
(self) -> NoneType
[ -0.002144167199730873, -0.06992276757955551, -0.006583902984857559, 0.027023054659366608, -0.04019904509186745, -0.07502948492765427, -0.032162509858608246, 0.07542230933904648, 0.018986519426107407, -0.01155558880418539, 0.02672843635082245, -0.03712191805243492, 0.04749903455376625, 0.05...
3,522
typing
fileno
null
@abstractmethod def fileno(self) -> int: pass
(self) -> int
[ -0.030826488509774208, -0.03613227978348732, 0.00510744471102953, 0.04657857492566109, -0.012553735636174679, -0.008595053106546402, -0.002845045179128647, 0.013396712020039558, -0.01470249891281128, -0.04244633764028549, 0.03388434275984764, -0.02461160346865654, 0.013603324070572853, 0.0...
3,523
typing
flush
null
@abstractmethod def flush(self) -> None: pass
(self) -> NoneType
[ -0.052099477499723434, -0.01987711898982525, -0.08002019673585892, 0.0417051687836647, -0.021556198596954346, -0.05747253820300102, -0.09850607067346573, 0.040233973413705826, 0.017702309414744377, -0.03518074005842209, 0.02628960832953453, -0.07381559163331985, 0.01404031366109848, 0.0522...
3,524
typing
isatty
null
@abstractmethod def isatty(self) -> bool: pass
(self) -> bool
[ 0.02478852868080139, -0.04954402893781662, 0.08561208099126816, -0.003841726342216134, 0.011056574992835522, -0.02577940933406353, -0.004223628435283899, 0.015647655352950096, 0.00599482748657465, -0.005499387159943581, 0.037389226257801056, 0.003100630361586809, 0.014136562123894691, 0.03...
3,525
typing
read
null
@abstractmethod def read(self, n: int = -1) -> AnyStr: pass
(self, n: int = -1) -> ~AnyStr
[ -0.04603058099746704, -0.03405096009373665, -0.0054191481322050095, 0.012623226270079613, -0.009619738906621933, -0.008010728284716606, -0.017016898840665817, 0.0028125508688390255, 0.04204881563782692, -0.10112310945987701, 0.054920900613069534, 0.06041299179196358, -0.01978868804872036, ...
3,526
typing
readable
null
@abstractmethod def readable(self) -> bool: pass
(self) -> bool
[ -0.00987829826772213, -0.04116768389940262, -0.027153154835104942, 0.016626035794615746, 0.004943204112350941, -0.0366259403526783, 0.01081908866763115, 0.029294263571500778, 0.013187284581363201, -0.04068106785416603, 0.05622033029794693, 0.041265007108449936, 0.031224504113197327, 0.0718...
3,527
typing
readline
null
@abstractmethod def readline(self, limit: int = -1) -> AnyStr: pass
(self, limit: int = -1) -> ~AnyStr
[ -0.045266833156347275, -0.037386927753686905, -0.017755378037691116, 0.02476542815566063, -0.04461870342493057, -0.012826171703636646, 0.004643517546355724, 0.0045667653903365135, 0.040047675371170044, -0.08289254456758499, 0.022991595789790154, 0.03592010214924812, -0.02783552184700966, 0...
3,528
typing
readlines
null
@abstractmethod def readlines(self, hint: int = -1) -> List[AnyStr]: pass
(self, hint: int = -1) -> List[~AnyStr]
[ -0.04905228316783905, -0.04048868641257286, -0.002374257193878293, -0.0005544929299503565, -0.04230416938662529, 0.009163049049675465, 0.010096481069922447, 0.023310111835598946, 0.09084263443946838, -0.06474079191684723, 0.02531399205327034, 0.041036758571863174, -0.04603789746761322, 0.0...
3,529
typing
seek
null
@abstractmethod def seek(self, offset: int, whence: int = 0) -> int: pass
(self, offset: int, whence: int = 0) -> int
[ -0.013837081380188465, -0.022762369364500046, -0.07127044349908829, 0.03847021982073784, -0.00719462288543582, -0.008439053781330585, -0.004077365156263113, 0.06184244155883789, -0.007462464272975922, -0.054392337799072266, 0.03912951797246933, -0.047205958515405655, 0.04878827929496765, 0...
3,530
typing
seekable
null
@abstractmethod def seekable(self) -> bool: pass
(self) -> bool
[ 0.0032738985028117895, -0.029900532215833664, -0.09373348951339722, 0.03444850817322731, 0.015458284877240658, -0.010829669423401356, -0.00809201318770647, 0.053414542227983475, -0.024949364364147186, -0.03857716917991638, 0.0724450871348381, -0.00901531707495451, 0.05064059793949127, 0.07...
3,531
typing
tell
null
@abstractmethod def tell(self) -> int: pass
(self) -> int
[ -0.006768697407096624, -0.037291381508111954, -0.013217613101005554, 0.03634023666381836, -0.013955569826066494, -0.046999603509902954, -0.02830471657216549, 0.03358520194888115, -0.0023163622245192528, -0.06520251929759979, 0.019318049773573875, -0.02600885182619095, 0.01383257657289505, ...
3,532
typing
truncate
null
@abstractmethod def truncate(self, size: int = None) -> int: pass
(self, size: Optional[int] = None) -> int
[ -0.045647308230400085, -0.004074775148183107, -0.0017682600300759077, 0.007834374904632568, -0.01913977786898613, -0.025263197720050812, -0.008767622523009777, 0.013957793824374676, 0.02210325188934803, -0.051377780735492706, 0.031795937567949295, -0.0325327105820179, 0.04423924908041954, ...
3,533
typing
writable
null
@abstractmethod def writable(self) -> bool: pass
(self) -> bool
[ -0.010410293005406857, -0.026344744488596916, -0.010709114372730255, 0.02994675375521183, -0.007656289730221033, -0.04894210398197174, -0.030705921351909637, 0.03505094721913338, -0.0017949476605281234, -0.026441657915711403, 0.04551777243614197, 0.010919096879661083, 0.05908588320016861, ...
3,534
typing
write
null
@abstractmethod def write(self, s: AnyStr) -> int: pass
(self, s: ~AnyStr) -> int
[ -0.058223187923431396, -0.029213324189186096, 0.0015736282803118229, 0.04394714906811714, -0.00434893649071455, -0.05150904133915901, -0.05734153091907501, 0.04682948440313339, 0.021922709420323372, -0.07622931152582169, 0.04367586970329285, 0.04693121463060379, 0.00296711060218513, 0.0460...
3,535
typing
writelines
null
@abstractmethod def writelines(self, lines: List[AnyStr]) -> None: pass
(self, lines: List[~AnyStr]) -> NoneType
[ -0.07261426001787186, -0.03552229702472687, -0.025882480666041374, 0.03444741666316986, -0.05149197578430176, -0.04002656415104866, -0.04026542976498604, 0.045418038964271545, 0.016072047874331474, 0.002258532214909792, 0.023613285273313522, 0.006773463916033506, -0.0015248825075104833, 0....
3,536
builtins
NoneType
null
from types import NoneType
null
[ 0.010729772038757801, -0.004843179136514664, 0.03258929029107094, 0.01124278362840414, -0.018155399709939957, -0.02210298366844654, 0.0042258258908987045, 0.0042562587186694145, 0.019337935373187065, -0.023111617192626, -0.008373395539820194, -0.009382029063999653, 0.01594684086740017, -0....
3,537
typing
TypeVar
Type variable. Usage:: T = TypeVar('T') # Can be anything A = TypeVar('A', str, bytes) # Must be str or bytes Type variables exist primarily for the benefit of static type checkers. They serve as the parameters for generic types as well as for generic function definitions. See class G...
class TypeVar( _Final, _Immutable, _TypeVarLike, _root=True): """Type variable. Usage:: T = TypeVar('T') # Can be anything A = TypeVar('A', str, bytes) # Must be str or bytes Type variables exist primarily for the benefit of static type checkers. They serve as the parameters for generi...
(name, *constraints, bound=None, covariant=False, contravariant=False)
[ 0.00893461424857378, 0.0274630356580019, -0.014045903459191322, -0.01775767281651497, 0.017423003911972046, 0.05946943908929825, -0.03886202350258827, -0.03302054852247238, 0.012504403479397297, -0.05918547883629799, -0.012798504903912544, 0.008290632627904415, 0.018487855792045593, -0.017...
3,538
typing
__copy__
null
def __copy__(self): return self
(self)
[ -0.01317558716982603, -0.023472189903259277, 0.016046103090047836, 0.01696060411632061, -0.0975467637181282, -0.0014627780765295029, -0.01905210316181183, 0.026656007394194603, 0.09070494025945663, -0.008416795171797276, -0.018984360620379448, -0.04328637570142746, -0.018984360620379448, 0...
3,539
typing
__deepcopy__
null
def __deepcopy__(self, memo): return self
(self, memo)
[ -0.02706795185804367, -0.027822166681289673, 0.03435869887471199, 0.02691710740327835, -0.10438340902328491, 0.0045839534141123295, -0.031727325171232224, 0.014631778001785278, 0.036403462290763855, -0.013584256172180176, -0.022157171741127968, 0.0270009096711874, -0.015595497563481331, 0....
3,540
typing
__init__
null
def __init__(self, name, *constraints, bound=None, covariant=False, contravariant=False): self.__name__ = name super().__init__(bound, covariant, contravariant) if constraints and bound is not None: raise TypeError("Constraints cannot be combined with bound=...") if constraints and ...
(self, name, *constraints, bound=None, covariant=False, contravariant=False)
[ -0.013843181543052197, 0.017865825444459915, -0.01043432205915451, -0.028498446568846703, -0.029499385505914688, 0.037242501974105835, -0.030235927551984787, -0.021794041618704796, 0.020736444741487503, -0.05287982150912285, -0.011066990904510021, 0.036959219723939896, -0.004948040470480919,...
3,541
typing
__or__
null
def __or__(self, right): return Union[self, right]
(self, right)
[ -0.027943870052695274, -0.023510154336690903, 0.04796922206878662, 0.02709311991930008, -0.033539190888404846, -0.04999793320894241, -0.014994471333920956, 0.008057585917413235, 0.03155956044793129, -0.0033293780870735645, 0.0674055889248848, 0.01848745532333851, 0.018225686624646187, 0.02...
3,542
typing
__reduce__
null
def __reduce__(self): return self.__name__
(self)
[ 0.021763719618320465, -0.017047692090272903, -0.008557174354791641, 0.01961401104927063, -0.0052617876790463924, -0.04296084865927696, 0.010398591868579388, -0.04869340732693672, 0.05059314891695976, -0.03742826357483864, -0.007419828791171312, -0.008873797953128815, 0.051959630101919174, ...
3,543
typing
__repr__
null
def __repr__(self): if self.__covariant__: prefix = '+' elif self.__contravariant__: prefix = '-' else: prefix = '~' return prefix + self.__name__
(self)
[ -0.013414140790700912, -0.06113161891698837, 0.0925678089261055, 0.015317036770284176, 0.02621389366686344, -0.05775248259305954, -0.010470197536051273, -0.0050089699216187, 0.056899167597293854, -0.048331864178180695, -0.010555529035627842, -0.006754002533853054, 0.01672500930726528, 0.02...
3,544
typing
__ror__
null
def __ror__(self, left): return Union[left, self]
(self, left)
[ -0.0644306167960167, -0.007512255106121302, 0.05763635411858559, 0.03390566632151604, -0.016731280833482742, -0.024616893380880356, -0.033265627920627594, -0.003534575691446662, 0.03715509921312332, -0.03026236779987812, 0.06393827497959137, 0.012226390652358532, 0.04431040957570076, 0.050...
3,545
xml_python
UnhandledElement
No such parser has been defined.
class UnhandledElement(BuilderError): """No such parser has been defined."""
null
[ -0.017814960330724716, -0.024188490584492683, -0.024222848936915398, 0.021542873233556747, -0.036901190876960754, -0.00031513324938714504, 0.04848005622625351, 0.033327892422676086, -0.04078371822834015, -0.013571666553616524, 0.050266705453395844, 0.005256873555481434, 0.00545443594455719, ...
3,546
attr._make
attrib
Create a new attribute on a class. .. warning:: Does *not* do anything unless the class is also decorated with `attr.s` / `attrs.define` / and so on! Please consider using `attrs.field` in new code (``attr.ib`` will *never* go away, though). :param default: A value that is used...
def attrib( default=NOTHING, validator=None, repr=True, cmp=None, hash=None, init=True, metadata=None, type=None, converter=None, factory=None, kw_only=False, eq=None, order=None, on_setattr=None, alias=None, ): """ Create a new attribute on a class. ...
(default=NOTHING, validator=None, repr=True, cmp=None, hash=None, init=True, metadata=None, type=None, converter=None, factory=None, kw_only=False, eq=None, order=None, on_setattr=None, alias=None)
[ 0.07320936024188995, 0.008405239321291447, 0.08449562638998032, -0.002629677765071392, 0.055004317313432693, -0.01830234006047249, 0.02732918970286846, -0.04860444366931915, -0.0009783590212464333, -0.050507109612226486, -0.011805172078311443, 0.04929632321000099, 0.09452786296606064, 0.04...
3,547
attr._make
attrs
A class decorator that adds :term:`dunder methods` according to the specified attributes using `attr.ib` or the *these* argument. Please consider using `attrs.define` / `attrs.frozen` in new code (``attr.s`` will *never* go away, though). :param these: A dictionary of name to `attr.ib` mappings. ...
def attrs( maybe_cls=None, these=None, repr_ns=None, repr=None, cmp=None, hash=None, init=None, slots=False, frozen=False, weakref_slot=True, str=False, auto_attribs=False, kw_only=False, cache_hash=False, auto_exc=False, eq=None, order=None, auto_...
(maybe_cls=None, these=None, repr_ns=None, repr=None, cmp=None, hash=None, init=None, slots=False, frozen=False, weakref_slot=True, str=False, auto_attribs=False, kw_only=False, cache_hash=False, auto_exc=False, eq=None, order=None, auto_detect=False, collect_by_mro=False, getstate_setstate=None, on_setattr=None, field...
[ 0.05744631960988045, 0.0027480735443532467, 0.014782740734517574, -0.03447200357913971, -0.005538262892514467, -0.024006159976124763, -0.014340521767735481, 0.0017596620600670576, -0.009386618621647358, -0.015414481051266193, -0.023142779245972633, 0.04936003312468529, 0.06995479017496109, ...
3,548
xml.etree.ElementTree
XML
Parse XML document from string constant. This function can be used to embed "XML Literals" in Python code. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance.
def XML(text, parser=None): """Parse XML document from string constant. This function can be used to embed "XML Literals" in Python code. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance. """ ...
(text, parser=None)
[ 0.030364990234375, -0.008604630827903748, 0.019135603681206703, -0.052988093346357346, 0.03160661458969116, -0.010133836418390274, -0.00975952297449112, 0.0276808924973011, 0.00008031179459067062, -0.013813057914376259, 0.031643129885196686, 0.012324935756623745, -0.028776442632079124, 0.0...
3,549
xml.etree.ElementTree
parse
Parse XML document into element tree. *source* is a filename or file object containing XML data, *parser* is an optional parser instance defaulting to XMLParser. Return an ElementTree instance.
def parse(source, parser=None): """Parse XML document into element tree. *source* is a filename or file object containing XML data, *parser* is an optional parser instance defaulting to XMLParser. Return an ElementTree instance. """ tree = ElementTree() tree.parse(source, parser) retu...
(source, parser=None)
[ -0.06527885794639587, -0.0047942595556378365, -0.02338975854218006, -0.049600210040807724, 0.013270070776343346, -0.012226048856973648, -0.0327676422894001, 0.04278659075498581, 0.025148112326860428, -0.009034454822540283, 0.017601847648620605, -0.07451020926237106, -0.027052994817495346, ...
3,550
mcwiki.extractor
Extractor
Extractor(selector: str)
class Extractor(Generic[T]): selector: str def scan( self: ExtractorType, html: BeautifulSoup, limit: Optional[int] = None, ) -> ScanResult[ExtractorType, T]: return ScanResult[ExtractorType, T]( self, html.select(self.selector, limit=limit) # type: ignore ...
(selector: str) -> None
[ 0.02298947237432003, -0.05732954293489456, -0.053437910974025726, -0.02398039773106575, -0.00978313758969307, 0.035835471004247665, 0.028682788833975792, -0.0856880322098732, -0.03253839164972305, -0.007251773029565811, 0.06316699832677841, 0.023439891636371613, 0.013008149340748787, 0.001...
3,551
mcwiki.extractor
__delattr__
null
__all__ = [ "Extractor", "ScanResult", ] from dataclasses import dataclass, field from typing import Any, Generic, List, Optional, Sequence, TypeVar, Union, overload from bs4 import BeautifulSoup, Tag T = TypeVar("T") ExtractorType = TypeVar("ExtractorType", bound="Extractor[Any]") @dataclass(frozen=True)...
(self, name)
[ 0.031688086688518524, -0.019609155133366585, -0.0734674409031868, -0.035892780870199203, 0.01511777937412262, 0.02390940859913826, 0.011075541377067566, -0.07312341779470444, 0.015652921050786972, -0.008242151699960232, 0.03021644614636898, 0.026221988722682, 0.03784222900867462, -0.013464...
3,557
mcwiki.extractor
process
null
def process(self, element: Tag) -> T: raise NotImplementedError()
(self, element: bs4.element.Tag) -> ~T
[ 0.054162800312042236, -0.008716044947504997, -0.04206366464495659, 0.017782064154744148, -0.0034080902114510536, -0.004882984794676304, -0.01085755880922079, -0.009316002018749714, 0.04769659787416458, 0.015982192009687424, 0.04456348717212677, -0.032647669315338135, 0.055029407143592834, ...
3,558
mcwiki.extractor
scan
null
def scan( self: ExtractorType, html: BeautifulSoup, limit: Optional[int] = None, ) -> ScanResult[ExtractorType, T]: return ScanResult[ExtractorType, T]( self, html.select(self.selector, limit=limit) # type: ignore )
(self: ~ExtractorType, html: bs4.BeautifulSoup, limit: Optional[int] = None) -> mcwiki.extractor.ScanResult[~ExtractorType, ~T]
[ -0.023117277771234512, -0.05154646188020706, -0.022872650995850563, -0.0221562422811985, -0.01791021227836609, 0.061925649642944336, 0.06283426284790039, -0.10148537158966064, -0.06168102100491524, -0.037358079105615616, 0.034509919583797455, 0.03139965981245041, 0.020216697826981544, 0.02...
3,559
mcwiki.page
PageSection
null
class PageSection(Mapping[str, "PageSection"]): html: BeautifulSoup subsections: Dict[str, Union[Tag, "PageSection"]] def __init__(self, html: BeautifulSoup) -> None: self.html = html self.subsections = { heading.text.lower(): heading.parent for heading in html.find_...
(html: bs4.BeautifulSoup) -> None
[ 0.009678284637629986, -0.04815719649195671, -0.0676824077963829, -0.02760138176381588, -0.05647696182131767, 0.021736321970820427, 0.0018679652130231261, -0.010128001682460308, -0.028931794688105583, -0.011477152816951275, 0.02645835094153881, 0.030918044969439507, 0.040849294513463974, 0....
3,562
mcwiki.page
__getitem__
null
def __getitem__(self, heading: str) -> "PageSection": heading = heading.lower() section = self.subsections[heading] if not isinstance(section, PageSection): content = BeautifulSoup(features="html.parser") content.extend(map(copy, collect_elements(section))) section = PageSection(cont...
(self, heading: str) -> mcwiki.page.PageSection
[ -0.01744314655661583, -0.029032887890934944, -0.0644414871931076, -0.05720127373933792, -0.03771393746137619, 0.02465634234249592, 0.012652359902858734, 0.03234681487083435, -0.04877237230539322, -0.024836447089910507, 0.029825350269675255, -0.008311835117638111, 0.0385063998401165, -0.018...
3,563
mcwiki.page
__init__
null
def __init__(self, html: BeautifulSoup) -> None: self.html = html self.subsections = { heading.text.lower(): heading.parent for heading in html.find_all("span", "mw-headline") }
(self, html: bs4.BeautifulSoup) -> NoneType
[ -0.03048986941576004, -0.04908214136958122, -0.024777567014098167, -0.025014063343405724, -0.07502400130033493, 0.01882876828312874, 0.020738933235406876, 0.017064139246940613, 0.0007566754356957972, 0.0420600101351738, -0.0078089358285069466, 0.010796979069709778, 0.049555134028196335, -0...
3,564
mcwiki.page
__iter__
null
def __iter__(self) -> Iterator[str]: return iter(self.subsections)
(self) -> Iterator[str]
[ 0.017839113250374794, -0.016959838569164276, -0.046500056982040405, -0.04450478404760361, -0.04115677997469902, 0.007579509634524584, 0.0017648885259404778, 0.026412032544612885, 0.08867138624191284, 0.0000380455021513626, 0.015996020287275314, 0.0035086406860500574, 0.008370010182261467, ...
3,565
mcwiki.page
__len__
null
def __len__(self) -> int: return len(self.subsections)
(self) -> int
[ -0.024211335927248, 0.0015757039654999971, -0.003632929874584079, 0.03399750217795372, -0.02637511119246483, 0.035341665148735046, -0.015933256596326828, -0.013621950522065163, -0.004925867542624474, -0.016457807272672653, -0.00162488070782274, -0.02219509147107601, 0.027227507904171944, -...
3,566
mcwiki.page
__repr__
null
def __repr__(self) -> str: return f"<{self.__class__.__name__} {list(self)}>"
(self) -> str
[ 0.01744520291686058, -0.045799028128385544, 0.044802650809288025, 0.0010060410713776946, 0.003596838330850005, -0.05026554688811302, 0.006588119547814131, -0.022693365812301636, 0.05713712051510811, -0.01482541672885418, -0.030784642323851585, -0.006038393825292587, -0.012489082291722298, ...
3,567
mcwiki.page
extract
null
def extract(self, extractor: Extractor[T], index: int = 0) -> Optional[T]: items = self.extract_all(extractor, limit=index + 1) return items[index] if index < len(items) else None
(self, extractor: mcwiki.extractor.Extractor[~T], index: int = 0) -> Optional[~T]
[ 0.04047693312168121, -0.012424452230334282, -0.04691798612475395, -0.006076624616980553, 0.025967612862586975, -0.01764509454369545, 0.09200535714626312, -0.017780695110559464, -0.0024916704278439283, 0.03583259508013725, 0.024357350543141365, 0.019797762855887413, -0.05115551874041557, -0...
3,568
mcwiki.page
extract_all
null
def extract_all( self, extractor: Extractor[T], limit: Optional[int] = None, ) -> ScanResult[Extractor[T], T]: return extractor.scan(self.html, limit=limit)
(self, extractor: mcwiki.extractor.Extractor[~T], limit: Optional[int] = None) -> mcwiki.extractor.ScanResult[mcwiki.extractor.Extractor[~T], ~T]
[ -0.011374789290130138, -0.020509090274572372, -0.036123573780059814, -0.03448629379272461, -0.0072212680242955685, 0.05890762433409691, 0.03622698038816452, -0.09975346177816391, -0.09609974175691605, 0.06294050067663193, 0.020026523619890213, 0.0272133219987154, -0.005743407178670168, 0.0...
3,573
mcwiki.extractor
ScanResult
ScanResult(extractor: ~ExtractorType, elements: List[Union[bs4.element.Tag, ~T]])
class ScanResult(Generic[ExtractorType, T], Sequence[T]): extractor: ExtractorType elements: List[Union[Tag, T]] = field(repr=False) @overload def __getitem__(self, index: int) -> T: ... @overload def __getitem__(self, index: slice) -> Sequence[T]: ... def __getitem__(self...
(extractor: ~ExtractorType, elements: List[Union[bs4.element.Tag, ~T]]) -> None
[ 0.0024098374415189028, -0.034928686916828156, -0.06717771291732788, -0.01127692312002182, 0.024358898401260376, 0.026629170402884483, 0.02084183879196644, -0.07346747815608978, 0.03290032967925072, -0.02884361520409584, 0.033086419105529785, 0.026368647813796997, 0.039860013872385025, -0.0...
3,577
mcwiki.extractor
__getitem__
null
def __getitem__(self, index: Union[int, slice]) -> Union[T, Sequence[T]]: # type: ignore index_slice = ( slice(index % len(self), (index % len(self)) + 1) if isinstance(index, int) else index ) self.elements[index_slice] = [ self.extractor.process(item) if isinstance(item, T...
(self, index: Union[int, slice]) -> Union[~T, Sequence[~T]]
[ 0.015172073617577553, -0.04648163542151451, -0.06369967758655548, -0.02502993494272232, -0.00042043160647153854, 0.008551451377570629, 0.010982703417539597, -0.01809488981962204, 0.06904932111501694, 0.004377581644803286, 0.034489233046770096, 0.005504637490957975, 0.01770518161356449, -0....
3,581
mcwiki.extractor
__len__
null
def __len__(self) -> int: return len(self.elements)
(self) -> int
[ -0.01281607337296009, -0.019899718463420868, -0.022127175703644753, 0.036753058433532715, 0.005990388337522745, 0.03367392718791962, -0.010424831882119179, -0.0228642039000988, 0.024665823206305504, 0.022323716431856155, -0.00535163190215826, -0.05702948197722435, 0.03052927926182747, -0.0...
3,587
mcwiki.text
TextExtractor
TextExtractor(selector: str)
class TextExtractor(Extractor[str]): def process(self, element: Tag) -> str: return normalize_string(element.text)
(selector: str) -> None
[ 0.02767794579267502, -0.040699828416109085, 0.025441691279411316, 0.0028533744625747204, 0.017244961112737656, -0.04128469154238701, 0.02607816457748413, -0.0353328175842762, 0.07555098831653595, 0.042282406240701675, 0.04083744063973427, -0.001043406082317233, -0.008020412176847458, 0.001...
3,588
mcwiki.text
__delattr__
null
__all__ = [ "TextExtractor", ] from dataclasses import dataclass from bs4 import Tag from .extractor import Extractor from .utils import normalize_string @dataclass(frozen=True) class TextExtractor(Extractor[str]): def process(self, element: Tag) -> str: return normalize_string(element.text)
(self, name)
[ 0.07069898396730423, -0.019450416788458824, -0.028647474944591522, -0.042725350707769394, -0.000023102917111827992, -0.042215414345264435, 0.014660660177469254, -0.01724676415324211, 0.03791738301515579, 0.043526679277420044, 0.031670667231082916, -0.013995922170579433, -0.008117998950183392...
3,594
mcwiki.text
process
null
def process(self, element: Tag) -> str: return normalize_string(element.text)
(self, element: bs4.element.Tag) -> str
[ 0.03257647529244423, 0.012833934277296066, 0.027566025033593178, 0.024282727390527725, 0.042888082563877106, -0.05294318497180939, -0.010516814887523651, -0.027224015444517136, 0.09227436035871506, 0.013244346715509892, -0.009661789052188396, -0.06221166253089905, 0.0012675754260271788, 0....
3,596
mcwiki.tree
Tree
Tree(extractor, entries)
class Tree(NamedTuple): extractor: "TreeExtractor" entries: Tuple[TreeEntry[int], ...] @property def children(self) -> Iterator[Tuple[str, "TreeNode"]]: for key, ref in self.entries: if isinstance(ref, str): if not (tree := self.extractor.templates.get(ref)): ...
(extractor: mcwiki.tree.TreeExtractor, entries: Tuple[Union[Tuple[str, int], Tuple[NoneType, str]], ...])
[ 0.029887648299336433, -0.030894670635461807, 0.023731514811515808, -0.033896736800670624, 0.005229863338172436, 0.030438659712672234, -0.005101610440760851, 0.01734737679362297, 0.025707557797431946, 0.008003924041986465, 0.05130111426115036, 0.02639157325029373, -0.008455183357000351, 0.0...
3,597
collections
__getnewargs__
Return self as a plain tuple. Used by copy and pickle.
def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None): """Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) #...
(self)
[ 0.05422765016555786, 0.0014280600007623434, -0.015411201864480972, -0.03572596609592438, -0.032882723957300186, -0.03333599492907524, 0.002827790565788746, 0.02155095897614956, 0.021025575697422028, -0.046151190996170044, -0.04219537600874901, 0.05711209774017334, 0.004519829526543617, 0.0...
3,598
namedtuple_Tree
__new__
Create new instance of Tree(extractor, entries)
from builtins import function
(_cls, extractor: ForwardRef('TreeExtractor'), entries: Tuple[Union[Tuple[str, int], Tuple[NoneType, str]], ...])
[ 0.009955772198736668, -0.03445916250348091, 0.01939140446484089, 0.011548695154488087, 0.012475191615521908, 0.06147384271025658, -0.0008142399019561708, 0.00590031873434782, -0.012475191615521908, -0.024787839502096176, -0.015157154761254787, 0.03679978474974632, 0.006826814729720354, 0.0...
3,599
collections
__repr__
Return a nicely formatted representation string
def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None): """Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) #...
(self)
[ 0.05422765016555786, 0.0014280600007623434, -0.015411201864480972, -0.03572596609592438, -0.032882723957300186, -0.03333599492907524, 0.002827790565788746, 0.02155095897614956, 0.021025575697422028, -0.046151190996170044, -0.04219537600874901, 0.05711209774017334, 0.004519829526543617, 0.0...
3,600
mcwiki.tree
__str__
null
def __str__(self): return "\n".join(self.format())
(self)
[ -0.00692378543317318, -0.027305785566568375, 0.018147427588701248, -0.0037348659243434668, -0.014567035250365734, -0.05230928584933281, -0.004447982180863619, -0.029134070500731468, 0.07252199947834015, -0.022650428116321564, -0.018452143296599388, -0.018722999840974808, 0.007550142705440521...
3,601
collections
_asdict
Return a new dict which maps field names to their values.
def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None): """Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) #...
(self)
[ 0.05422765016555786, 0.0014280600007623434, -0.015411201864480972, -0.03572596609592438, -0.032882723957300186, -0.03333599492907524, 0.002827790565788746, 0.02155095897614956, 0.021025575697422028, -0.046151190996170044, -0.04219537600874901, 0.05711209774017334, 0.004519829526543617, 0.0...
3,602
collections
_replace
Return a new Tree object replacing specified fields with new values
def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None): """Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) #...
(self, /, **kwds)
[ 0.05422765016555786, 0.0014280600007623434, -0.015411201864480972, -0.03572596609592438, -0.032882723957300186, -0.03333599492907524, 0.002827790565788746, 0.02155095897614956, 0.021025575697422028, -0.046151190996170044, -0.04219537600874901, 0.05711209774017334, 0.004519829526543617, 0.0...
3,603
mcwiki.tree
as_dict
null
def as_dict(self) -> Dict[str, "TreeNode"]: return dict(self.children)
(self) -> Dict[str, mcwiki.tree.TreeNode]
[ 0.02465047314763069, -0.001596615999005735, 0.049337491393089294, -0.04239369556307793, -0.028999481350183487, 0.06443110853433609, 0.0059159304946660995, 0.07400623708963394, 0.04016437381505966, -0.01587936282157898, 0.054271239787340164, -0.007473716512322426, 0.03280029445886612, 0.003...
3,604
mcwiki.tree
format
null
def format( self, prefix: str = "", parents: Optional[Set["Tree"]] = None, ) -> Iterator[str]: parents = parents or set() if self in parents: yield f"{prefix}└─ <...>" return children = list(self.children) if not parents and len(children) == 1: indents = [""] else...
(self, prefix: str = '', parents: Optional[Set[mcwiki.tree.Tree]] = None) -> Iterator[str]
[ 0.0029281608294695616, -0.03443021699786186, 0.030449332669377327, -0.047098271548748016, -0.012278812937438488, -0.013154607266187668, -0.026769228279590607, 0.0039853062480688095, 0.09617813676595688, 0.0074486746452748775, 0.006705576553940773, 0.0228591151535511, 0.03694259747862816, 0...
3,605
mcwiki.tree
TreeExtractor
TreeExtractor(selector: str = '.treeview > ul', nodes: List[mcwiki.tree.TreeNode] = <factory>, references: Dict[mcwiki.tree.TreeNode, int] = <factory>, templates: Dict[str, mcwiki.tree.Tree] = <factory>)
class TreeExtractor(Extractor[Tree]): selector: str = ".treeview > ul" nodes: List[TreeNode] = field(default_factory=list, repr=False) references: Dict[TreeNode, int] = field(default_factory=dict, repr=False) templates: Dict[str, Tree] = field(default_factory=dict, repr=False) def __post_init__(se...
(selector: str = '.treeview > ul', nodes: List[mcwiki.tree.TreeNode] = <factory>, references: Dict[mcwiki.tree.TreeNode, int] = <factory>, templates: Dict[str, mcwiki.tree.Tree] = <factory>) -> None
[ 0.030750058591365814, -0.03964470326900482, 0.010458538308739662, -0.012129949405789375, -0.005889036692678928, 0.044336382299661636, 0.003579850308597088, 0.022832846269011497, 0.00886532198637724, 0.028423765674233437, 0.03436656296253204, 0.03792442008852959, 0.0033574840053915977, 0.01...
3,606
mcwiki.tree
__delattr__
null
__all__ = [ "Tree", "TreeEntry", "TreeNode", "TreeExtractor", ] import re import textwrap from dataclasses import dataclass, field from typing import ( Dict, Iterator, List, NamedTuple, Optional, Set, Tuple, TypeVar, Union, ) from bs4 import Tag from .extractor im...
(self, name)
[ 0.033440154045820236, -0.022741641849279404, 0.006002078764140606, -0.041585832834243774, -0.00211924035102129, 0.017002642154693604, -0.0032738610170781612, -0.007210289593786001, 0.01401134580373764, 0.004050916060805321, 0.040416594594717026, 0.018434956669807434, -0.003972966689616442, ...
3,608
mcwiki.tree
__hash__
null
def __hash__(self): return hash(id(self))
(self)
[ 0.03117971308529377, -0.0228425282984972, 0.03023076429963112, 0.05171765387058258, -0.03028160147368908, -0.036297254264354706, -0.018284190446138382, -0.0008112656068988144, -0.01481036376208067, -0.0007201835978776217, -0.04202483221888542, -0.04907415807247162, 0.006909525953233242, 0....
3,610
mcwiki.tree
__post_init__
null
def __post_init__(self): if not self.nodes: self.nodes.append(TreeNode("", (), Tree(self, ())))
(self)
[ -0.02608998864889145, 0.05203412100672722, 0.04415789991617203, 0.01743890531361103, -0.0652705505490303, 0.04740319401025772, -0.0021536548156291246, 0.04455900192260742, 0.03639106824994087, 0.0037694654893130064, 0.03321870043873787, 0.04678330570459366, -0.017256585881114006, 0.0171289...
3,613
mcwiki.tree
collect_children
null
def collect_children(self, element: Tag) -> Iterator[TreeEntry[TreeNode]]: for list_item in element.children: if not list_item.name: continue if "nbttree-inherited" in list_item.get("class", ""): yield None, list_item.get("data-page") continue text = "" ...
(self, element: bs4.element.Tag) -> Iterator[Union[Tuple[str, mcwiki.tree.TreeNode], Tuple[NoneType, str]]]
[ -0.017208009958267212, -0.044454824179410934, 0.0179470032453537, -0.01961693912744522, -0.00539369834586978, 0.01637304201722145, -0.005715209059417248, 0.003658981528133154, 0.05589484050869942, 0.004481952171772718, 0.010806591250002384, 0.04675818234682083, 0.020403919741511345, -0.003...
3,614
mcwiki.tree
process
null
def process(self, element: Tag) -> Tree: nodes: Dict[str, TreeNode] = {} inherit: Dict[None, str] = {} for key, node in self.collect_children(element): if isinstance(node, str): inherit[None] = node continue if not isinstance(key, str): continue if...
(self, element: bs4.element.Tag) -> mcwiki.tree.Tree
[ -0.008976249024271965, -0.028050187975168228, -0.02169063128530979, 0.009236498735845089, -0.01367493998259306, 0.04765881970524788, -0.012094514444470406, 0.02464328147470951, 0.05314772576093674, 0.003193973796442151, 0.017157554626464844, 0.0058295936323702335, 0.025154318660497665, 0.0...
3,616
mcwiki.tree
TreeNode
TreeNode(text, icons, content)
class TreeNode(NamedTuple): text: str icons: Tuple[str, ...] content: Tree
(text: str, icons: Tuple[str, ...], content: mcwiki.tree.Tree)
[ 0.03148620203137398, -0.027298469096422195, 0.02724633924663067, -0.016316525638103485, 0.009279046207666397, 0.0034144807141274214, -0.006172998808324337, 0.056230328977108, 0.05768995359539986, -0.0019374788971617818, 0.08618739992380142, 0.04517887905240059, 0.01142504345625639, 0.00132...
3,618
namedtuple_TreeNode
__new__
Create new instance of TreeNode(text, icons, content)
from builtins import function
(_cls, text: str, icons: Tuple[str, ...], content: mcwiki.tree.Tree)
[ 0.009955772198736668, -0.03445916250348091, 0.01939140446484089, 0.011548695154488087, 0.012475191615521908, 0.06147384271025658, -0.0008142399019561708, 0.00590031873434782, -0.012475191615521908, -0.024787839502096176, -0.015157154761254787, 0.03679978474974632, 0.006826814729720354, 0.0...
3,621
collections
_replace
Return a new TreeNode object replacing specified fields with new values
def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None): """Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) #...
(self, /, **kwds)
[ 0.05418515205383301, 0.0013507658150047064, -0.015379929915070534, -0.035642705857753754, -0.032799530774354935, -0.03329399600625038, 0.00279939454048872, 0.021509239450097084, 0.02094266377389431, -0.046150092035532, -0.04213256016373634, 0.0571107380092144, 0.004519721493124962, 0.06320...
3,622
mcwiki.page
collect_elements
null
def collect_elements(start: Tag) -> Iterator[PageElement]: for sibling in start.next_siblings: tag = sibling.name if tag and tag.startswith("h") and tag <= start.name: break yield sibling
(start: bs4.element.Tag) -> Iterator[bs4.element.PageElement]
[ -0.028107840567827225, -0.03890210762619972, -0.07402800023555756, -0.037726495414972305, -0.035197146236896515, 0.04036271572113037, -0.0069067273288965225, 0.001265787985175848, -0.022283213213086128, 0.038225237280130386, 0.010553799569606781, -0.0033999267034232616, 0.06665369868278503, ...
3,624
mcwiki.page
from_markup
null
def from_markup(markup: str) -> "PageSection": html = BeautifulSoup(markup, "html.parser") content = html.find("div", "mw-parser-output").extract() return PageSection(content)
(markup: str) -> mcwiki.page.PageSection
[ -0.0014990218915045261, -0.020262034609913826, 0.021455984562635422, -0.05014590546488762, -0.03638036176562309, 0.07774721831083298, 0.009314566850662231, 0.03613454848527908, -0.054465193301439285, 0.031973280012607574, 0.03736361488699913, 0.0601188987493515, -0.031990837305784225, 0.05...
3,625
mcwiki.page
load
null
def load(page: str) -> "PageSection": if not page.startswith("http"): page = BASE_URL + re.sub(r"[\s_]+", "_", page) return from_markup(requests.get(page).text)
(page: str) -> mcwiki.page.PageSection
[ -0.03646690770983696, -0.011415425688028336, -0.015119367279112339, 0.010348482988774776, -0.013575335964560509, 0.06984575092792511, 0.038548748940229416, 0.011892514303326607, -0.10888026654720306, -0.018389591947197914, 0.0428859144449234, 0.06415538489818573, -0.02664756029844284, 0.03...
3,626
mcwiki.page
load_file
null
def load_file(filepath: Union[str, Path]) -> "PageSection": return from_markup(Path(filepath).read_text())
(filepath: Union[str, pathlib.Path]) -> mcwiki.page.PageSection
[ -0.01586270146071911, -0.03892859071493149, -0.0269290953874588, -0.009296119213104248, -0.028045328333973885, 0.039661116898059845, 0.048416562378406525, 0.057695239782333374, -0.08204304426908493, 0.005973584949970245, 0.04918396845459938, 0.05497442185878754, -0.037637945264577866, 0.03...
3,631
meshio._mesh
CellBlock
null
class CellBlock: def __init__( self, cell_type: str, data: list | np.ndarray, tags: list[str] | None = None, ): self.type = cell_type self.data = data if cell_type.startswith("polyhedron"): self.dim = 3 else: self.data = np...
(cell_type: 'str', data: 'list | np.ndarray', tags: 'list[str] | None' = None)
[ 0.06531939655542374, -0.030510548502206802, -0.010580419562757015, -0.015622650273144245, -0.06407031416893005, -0.03256785124540329, -0.054114434868097305, 0.008311874233186245, -0.04166040197014809, -0.016320664435625076, 0.031318776309490204, -0.0060065919533371925, -0.0988975316286087, ...
3,632
meshio._mesh
__init__
null
def __init__( self, cell_type: str, data: list | np.ndarray, tags: list[str] | None = None, ): self.type = cell_type self.data = data if cell_type.startswith("polyhedron"): self.dim = 3 else: self.data = np.asarray(self.data) self.dim = topological_dimension[cell_...
(self, cell_type: str, data: list | numpy.ndarray, tags: Optional[list[str]] = None)
[ 0.0391361266374588, 0.022823242470622063, -0.018689535558223724, -0.022823242470622063, -0.05633678659796715, -0.012058957479894161, -0.037305086851119995, 0.0010525000980123878, -0.0264483280479908, 0.011846261098980904, 0.02870475873351097, 0.02809441275894642, -0.08211927860975266, 0.00...
3,633
meshio._mesh
__len__
null
def __len__(self): return len(self.data)
(self)
[ -0.0064119091257452965, -0.013842608779668808, -0.006250196602195501, 0.041139714419841766, 0.019001243636012077, 0.018047139048576355, -0.019728951156139374, -0.007285158149898052, 0.05071311071515083, -0.03331281989812851, 0.005061608273535967, -0.03609427809715271, 0.0071800448931753635, ...
3,634
meshio._mesh
__repr__
null
def __repr__(self): items = [ "meshio CellBlock", f"type: {self.type}", f"num cells: {len(self.data)}", f"tags: {self.tags}", ] return "<" + ", ".join(items) + ">"
(self)
[ 0.06029416620731354, -0.04643508046865463, 0.023449717089533806, -0.032861750572919846, -0.0206814706325531, -0.04486343264579773, -0.022378137335181236, -0.017966805025935173, -0.009474542923271656, -0.023235401138663292, 0.020181400701403618, -0.0037594556342810392, -0.06447332352399826, ...
3,635
meshio._mesh
Mesh
null
class Mesh: def __init__( self, points: ArrayLike, cells: dict[str, ArrayLike] | list[tuple[str, ArrayLike] | CellBlock], point_data: dict[str, ArrayLike] | None = None, cell_data: dict[str, list[ArrayLike]] | None = None, field_data=None, point_sets: dict[str...
(points: 'ArrayLike', cells: 'dict[str, ArrayLike] | list[tuple[str, ArrayLike] | CellBlock]', point_data: 'dict[str, ArrayLike] | None' = None, cell_data: 'dict[str, list[ArrayLike]] | None' = None, field_data=None, point_sets: 'dict[str, ArrayLike] | None' = None, cell_sets: 'dict[str, list[ArrayLike]] | None' = None...
[ 0.05950275808572769, -0.029751379042863846, -0.02733689360320568, 0.043337978422641754, -0.06465911865234375, -0.03208401799201965, -0.05978922173380852, 0.00832793116569519, -0.05074512958526611, -0.012450972571969032, -0.0029848571866750717, -0.009836984798312187, -0.07333490252494812, 0...