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
5,496
meld3
__init__
null
def __init__(self): TreeBuilder.__init__(self, element_factory=_MeldElementInterface) self.meldids = {}
(self)
[ 0.04401411488652229, 0.00919718574732542, 0.03794700652360916, -0.004228590987622738, -0.06287731230258942, 0.032413069158792496, 0.007524134125560522, 0.032174061983823776, -0.005690212827175856, 0.04294777661561966, -0.02127165161073208, 0.02686074562370777, -0.0014995411038398743, 0.070...
5,497
meld3
comment
null
def comment(self, data): self.start(Comment, {}) self.data(data) self.end(Comment)
(self, data)
[ -0.015801165252923965, 0.01813882403075695, 0.01047552190721035, 0.031742941588163376, -0.00963185541331768, -0.02956346981227398, -0.012909851036965847, 0.04657740518450737, 0.014948710799217224, -0.017954271286725998, -0.026891861110925674, -0.048967793583869934, 0.008612425997853279, 0....
5,498
meld3
doctype
null
def doctype(self, name, pubid, system): pass
(self, name, pubid, system)
[ 0.008668932132422924, 0.0737910270690918, 0.03232141211628914, -0.06723257154226303, 0.02371133863925934, -0.011477296240627766, 0.017775095999240875, -0.0148237906396389, -0.00568819884210825, 0.027041016146540642, -0.0296475812792778, 0.009602251462638378, -0.01458835881203413, 0.0088455...
5,499
meld3
start
null
def start(self, tag, attrs): elem = TreeBuilder.start(self, tag, attrs) for key, value in attrs.items(): if key == _MELD_ID: if value in self.meldids: raise ValueError('Repeated meld id "%s" in source' % value) self.meldids[value] ...
(self, tag, attrs)
[ 0.030505511909723282, 0.05089230462908745, -0.01075347326695919, -0.016932986676692963, -0.008191121742129326, 0.03420201689004898, 0.04820393770933151, 0.013497848995029926, 0.028003836050629616, 0.01633557118475437, -0.054663486778736115, 0.05171374976634979, 0.02051747776567936, 0.08707...
5,500
xml.etree.ElementTree
ProcessingInstruction
Processing Instruction element factory. This function creates a special element which the standard serializer serializes as an XML comment. *target* is a string containing the processing instruction, *text* is a string containing the processing instruction contents, if any.
def ProcessingInstruction(target, text=None): """Processing Instruction element factory. This function creates a special element which the standard serializer serializes as an XML comment. *target* is a string containing the processing instruction, *text* is a string containing the processing inst...
(target, text=None)
[ 0.06485585123300552, -0.01080635841935873, 0.04655319079756737, -0.034003302454948425, -0.011036469601094723, -0.038269203156232834, -0.0006787163438275456, 0.03331296890974045, 0.00471284706145525, -0.0073281447403132915, 0.04850028455257416, 0.010753256268799305, 0.05919158458709717, -0....
5,501
meld3
PyHelper
null
class PyHelper: def findmeld(self, node, name, default=None): iterator = self.getiterator(node) for element in iterator: val = element.attrib.get(_MELD_ID) if val == name: return element return default def clone(self, node, parent=None): e...
()
[ 0.08458776026964188, -0.06489857286214828, 0.03474004939198494, 0.007766814436763525, -0.0615665577352047, 0.008756007067859173, -0.0015855471137911081, 0.049790915101766586, 0.05073750764131546, 0.012627581134438515, -0.04998023062944412, 0.002121556783095002, 0.005362462252378464, 0.0737...
5,502
meld3
_bfclone
null
def _bfclone(self, nodes, parent): L = [] for node in nodes: element = _MeldElementInterface(node.tag, node.attrib.copy()) element.parent = parent element.text = node.text element.tail = node.tail element.structure = node.structure if node._children: s...
(self, nodes, parent)
[ -0.01705591008067131, -0.035674192011356354, -0.0004629577451851219, -0.03321903571486473, -0.12990018725395203, 0.01943666860461235, -0.01671181619167328, 0.02780652604997158, 0.05349269136786461, 0.05468307062983513, -0.04463924095034599, -0.03022448532283306, -0.001460075145587325, 0.05...
5,503
meld3
bfclone
null
def bfclone(self, node, parent=None): element = _MeldElementInterface(node.tag, node.attrib.copy()) element.text = node.text element.tail = node.tail element.structure = node.structure element.parent = parent if parent is not None: parent._children.append(element) if node._children: ...
(self, node, parent=None)
[ 0.021652620285749435, -0.0292037446051836, 0.04417862370610237, -0.02227126620709896, -0.08180687576532364, -0.00812883023172617, -0.018741343170404434, 0.04785411059856415, 0.07794943451881409, 0.01186345238238573, -0.02776630036532879, -0.021961942315101624, -0.014592774212360382, 0.0673...
5,504
meld3
clone
null
def clone(self, node, parent=None): element = _MeldElementInterface(node.tag, node.attrib.copy()) element.text = node.text element.tail = node.tail element.structure = node.structure if parent is not None: # avoid calling self.append to reduce function call overhead parent._children....
(self, node, parent=None)
[ -0.0011842119274660945, -0.006874347571283579, 0.054920513182878494, -0.027274589985609055, -0.07018239796161652, 0.0201078150421381, -0.005180129781365395, 0.05336090549826622, 0.07931725680828094, 0.0472710020840168, -0.01882670819759369, -0.011037946678698063, 0.0038804556243121624, 0.0...
5,505
meld3
content
null
def content(self, node, text, structure=False): node.text = None replacenode = Replace(text, structure) replacenode.parent = node replacenode.text = text replacenode.structure = structure node._children = [replacenode]
(self, node, text, structure=False)
[ 0.04719386249780655, -0.056143827736377716, 0.0808250829577446, 0.03628178685903549, -0.030429884791374207, -0.006789926439523697, -0.04619559645652771, 0.041169844567775726, 0.11352688074111938, -0.01682421565055847, -0.0030206136871129274, -0.005417311564087868, -0.005744329188019037, 0....
5,506
meld3
findmeld
null
def findmeld(self, node, name, default=None): iterator = self.getiterator(node) for element in iterator: val = element.attrib.get(_MELD_ID) if val == name: return element return default
(self, node, name, default=None)
[ 0.10125335305929184, -0.015994692221283913, 0.05813722684979439, 0.040890779346227646, -0.008784041740000248, -0.00006988170207478106, 0.03103317879140377, 0.00589804258197546, 0.053304050117731094, 0.036161910742521286, -0.04057783633470535, 0.015803450718522072, 0.0023057565558701754, 0....
5,507
meld3
getiterator
null
def getiterator(self, node, tag=None): nodes = [] if tag == "*": tag = None if tag is None or node.tag == tag: nodes.append(node) for element in node._children: nodes.extend(self.getiterator(element, tag)) return nodes
(self, node, tag=None)
[ -0.005492083728313446, -0.03651737794280052, -0.0025515116285532713, -0.046940576285123825, -0.01391569059342146, 0.08034547418355942, -0.03103434294462204, 0.010043184272944927, 0.1099502444267273, 0.01222373079508543, 0.0539979487657547, -0.00463253166526556, -0.03061813861131668, 0.0072...
5,508
meld3
Replace
null
def Replace(text, structure=False): element = _MeldElementInterface(Replace, {}) element.text = text element.structure = structure return element
(text, structure=False)
[ 0.09803439676761627, -0.07290269434452057, 0.06732941418886185, -0.036451347172260284, -0.015395761467516422, -0.04541706293821335, -0.02374703250825405, 0.013206257484853268, 0.05372506380081177, 0.03416664898395538, -0.01734294928610325, -0.024491289630532265, -0.02286430634558201, 0.049...
5,509
_io
StringIO
Text I/O implementation using an in-memory buffer. The initial_value argument sets the value of object. The newline argument is like the one of TextIOWrapper's constructor.
from _io import StringIO
(initial_value='', newline='\n')
[ -0.016385382041335106, 0.0013824369525536895, -0.06109054759144783, 0.04430593550205231, -0.0012805061414837837, -0.017251793295145035, -0.0069312965497374535, 0.09989221394062042, 0.030698169022798538, -0.04240322485566139, 0.040500517934560776, 0.04834919050335884, -0.043864235281944275, ...
5,510
xml.etree.ElementTree
TreeBuilder
null
class TreeBuilder: """Generic element structure builder. This builder converts a sequence of start, data, and end method calls to a well-formed element structure. You can use this class to build an element structure using a custom XML parser, or a parser for some other XML-like format. *eleme...
null
[ 0.026551181450486183, -0.026119302958250046, -0.006290414370596409, -0.023847242817282677, -0.013904632069170475, 0.00693353870883584, -0.029424117878079414, -0.004598105326294899, -0.005191938951611519, 0.0017662451136857271, 0.013482142239809036, -0.02615685760974884, 0.01809198223054409, ...
5,512
meld3
_MeldElementInterface
null
class _MeldElementInterface: parent = None attrib = None text = None tail = None structure = None # overrides to reduce MRU lookups def __init__(self, tag, attrib): self.tag = tag self.attrib = attrib self._children = [] def __repr__(self): return "<...
(tag, attrib)
[ 0.08321980386972427, -0.019210658967494965, 0.003929195925593376, -0.012788261286914349, -0.02195826917886734, 0.022410551086068153, -0.011357920244336128, -0.020635345950722694, 0.026141874492168427, 0.006999057251960039, -0.026548927649855614, 0.013579754158854485, 0.049931883811950684, ...
5,513
meld3
__delitem__
null
def __delitem__(self, index): if isinstance(index, slice): for ob in self._children[index]: ob.parent = None else: self._children[index].parent = None ob = self._children[index] del self._children[index]
(self, index)
[ 0.008778586983680725, 0.03963401913642883, -0.05100272223353386, -0.025536129251122475, -0.08010243624448776, -0.0027965449262410402, -0.04269348457455635, 0.07641717046499252, 0.03987738490104675, 0.0031181368976831436, -0.0068533821031451225, 0.019921308383345604, 0.02223329432308674, -0...
5,514
meld3
__delslice__
null
def __delslice__(self, start, stop): obs = self._children[start:stop] for ob in obs: ob.parent = None del self._children[start:stop]
(self, start, stop)
[ 0.007707229349762201, 0.04681233689188957, -0.07681845128536224, -0.03513551130890846, -0.11316190659999847, 0.02113032527267933, -0.02555946633219719, 0.0730370506644249, 0.03380502015352249, -0.02121785841882229, -0.038514263927936554, -0.015291913412511349, 0.02106029912829399, -0.00477...
5,515
meld3
__getitem__
null
def __getitem__(self, index): return self._children[index]
(self, index)
[ 0.02922777459025383, -0.027707062661647797, -0.048930201679468155, -0.007448988500982523, -0.0060285418294370174, 0.039204321801662445, 0.0013076462782919407, 0.041109390556812286, 0.06737929582595825, -0.00836392305791378, 0.01000996958464384, 0.01112961582839489, 0.02685479447245598, -0....
5,516
meld3
__getslice__
null
def __getslice__(self, start, stop): return self._children[start:stop]
(self, start, stop)
[ 0.019052905961871147, -0.00184893817640841, -0.05893567577004433, -0.022310657426714897, -0.04419352859258652, 0.026012646034359932, 0.02907295897603035, 0.026029100641608238, 0.04346958547830582, -0.04893207550048828, 0.022442283108830452, 0.0015178157482296228, 0.02632525935769081, -0.02...
5,517
meld3
__init__
null
def __init__(self, tag, attrib): self.tag = tag self.attrib = attrib self._children = []
(self, tag, attrib)
[ 0.018616408109664917, 0.02683733031153679, 0.014284955337643623, -0.02749146707355976, -0.03804606944322586, 0.05031557381153107, -0.0016585487173870206, 0.030108019709587097, 0.005498293787240982, 0.010209853760898113, 0.00981206726282835, 0.06014532223343849, 0.04550677537918091, 0.01106...
5,518
meld3
__len__
null
def __len__(self): return len(self._children)
(self)
[ -0.0031593688763678074, -0.010532589629292488, -0.007314071524888277, 0.026237651705741882, -0.007497637532651424, 0.0709460899233818, -0.00001980660636036191, 0.0046258545480668545, 0.038475360721349716, -0.003538738004863262, 0.0159906093031168, -0.023985913023352623, 0.03867116570472717, ...
5,519
meld3
__mod__
Fill in the text values of meld nodes in tree; only support dictionarylike operand (sequence operand doesn't seem to make sense here)
def __mod__(self, other): """ Fill in the text values of meld nodes in tree; only support dictionarylike operand (sequence operand doesn't seem to make sense here)""" return self.fillmelds(**other)
(self, other)
[ 0.06547894328832626, 0.0008111225324682891, 0.0772281214594841, 0.033210787922143936, -0.04740069434046745, -0.0256865993142128, -0.029844259843230247, 0.006543686147779226, 0.0855097770690918, -0.005504271015524864, 0.01498945988714695, -0.00985550694167614, 0.06456997990608215, 0.0709663...
5,520
meld3
__repr__
null
def __repr__(self): return "<MeldElement %s at %x>" % (self.tag, id(self))
(self)
[ 0.058950431644916534, -0.014682753011584282, 0.07584565132856369, 0.01709635555744171, 0.008219050243496895, -0.031212277710437775, 0.0289266686886549, -0.0075105116702616215, 0.020003650337457657, 0.026677630841732025, -0.047065261751413345, -0.022984085604548454, 0.026750769466161728, 0....
5,521
meld3
__setitem__
null
def __setitem__(self, index, element): if isinstance(index, slice): for e in element: e.parent = self else: element.parent = self self._children[index] = element
(self, index, element)
[ -0.01820741780102253, 0.02756137028336525, -0.04973817616701126, 0.018880488350987434, -0.07096578180789948, 0.025007154792547226, -0.027267981320619583, 0.05149851366877556, 0.038244206458330154, 0.006937802769243717, -0.007986239157617092, -0.03322206437587738, 0.05602016672492027, -0.00...
5,522
meld3
__setslice__
null
def __setslice__(self, start, stop, elements): for element in elements: element.parent = self self._children[start:stop] = list(elements)
(self, start, stop, elements)
[ -0.029270140454173088, 0.011783063411712646, -0.09035716950893402, -0.01567295752465725, -0.09007807075977325, 0.05843561887741089, -0.010186986066401005, 0.03788721561431885, 0.010902168229222298, 0.0046007148921489716, -0.023723118007183075, -0.03718947619199753, 0.04015486687421799, 0.0...
5,523
meld3
append
null
def append(self, element): self._children.append(element) element.parent = self
(self, element)
[ -0.03674635291099548, 0.03498847782611847, -0.013158709742128849, 0.04181714355945587, 0.010116233490407467, 0.04005926847457886, -0.0385042279958725, 0.04648227617144585, -0.0007537523633800447, 0.031388211995363235, 0.0015265202382579446, -0.06385819613933563, 0.04445395991206169, 0.0181...
5,524
meld3
attributes
Set attributes on this node.
def attributes(self, **kw): """ Set attributes on this node. """ for k, v in kw.items(): # prevent this from getting to the parser if possible if not isinstance(k, StringTypes): raise ValueError('do not set non-stringtype as key: %s' % k) if not isinstance(v, StringTypes): ...
(self, **kw)
[ 0.001921763294376433, 0.019162945449352264, 0.09359217435121536, 0.0023822428192943335, -0.03661084920167923, 0.021262994036078453, 0.035263318568468094, 0.010789000429213047, 0.05397125333547592, 0.008667076006531715, -0.032428253442049026, 0.03839588910341263, 0.07749179750680923, 0.0794...
5,525
meld3
clear
null
def clear(self): self.attrib.clear() self._children = [] self.text = self.tail = None
(self)
[ 0.010741735808551311, 0.049051061272621155, 0.029234707355499268, -0.03005967289209366, -0.046198055148124695, 0.03002529963850975, -0.054619576781988144, 0.024164607748389244, 0.05987873300909996, 0.0444793775677681, -0.03421887382864952, 0.0038262063171714544, 0.0661003440618515, 0.02825...
5,526
meld3
clone
Create a clone of an element. If parent is not None, append the element to the parent. Recurse as necessary to create a deep clone of the element.
def clone(self, parent=None): """ Create a clone of an element. If parent is not None, append the element to the parent. Recurse as necessary to create a deep clone of the element. """ return helper.bfclone(self, parent)
(self, parent=None)
[ -0.007348504848778248, -0.023664388805627823, 0.044345300644636154, 0.0035301640164107084, -0.10347236692905426, -0.004462500102818012, -0.02624102681875229, 0.05563504621386528, 0.08780912309885025, 0.04102279245853424, -0.035021938383579254, -0.046209972351789474, -0.0001278651470784098, ...
5,527
meld3
content
Delete this node's children and append a Replace node that contains text. Always return None. Pass the 'structure' flag to the replace node so it can do the right thing at render time.
def content(self, text, structure=False): """ Delete this node's children and append a Replace node that contains text. Always return None. Pass the 'structure' flag to the replace node so it can do the right thing at render time.""" helper.content(self, text, structure)
(self, text, structure=False)
[ 0.04321117699146271, -0.08197315037250519, 0.05932267755270004, 0.007263657171279192, 0.0007067740662023425, 0.01588398404419422, -0.04705366864800453, 0.07900702208280563, 0.06791772693395615, 0.005047483369708061, 0.008426516316831112, -0.01929672248661518, 0.002062389859929681, 0.001193...
5,528
meld3
deparent
Remove ourselves from our parent node (de-parent) and return the index of the parent which was deleted.
def deparent(self): """ Remove ourselves from our parent node (de-parent) and return the index of the parent which was deleted. """ i = self.parentindex() if i is not None: del self.parent[i] return i
(self)
[ 0.010541729629039764, 0.024110466241836548, 0.008627851493656635, 0.0034339814446866512, -0.04579228535294533, 0.014906251803040504, -0.0031128020491451025, 0.0813068300485611, 0.06416551768779755, 0.00969698280096054, -0.03123801201581955, -0.0613848939538002, 0.030481260269880295, -0.013...
5,529
meld3
diffmeld
Compute the meld element differences from this node (the source) to 'other' (the target). Return a dictionary of sequences in the form {'unreduced: {'added':[], 'removed':[], 'moved':[]}, 'reduced': {'added':[], 'removed':[], 'moved':[]},} ...
def diffmeld(self, other): """ Compute the meld element differences from this node (the source) to 'other' (the target). Return a dictionary of sequences in the form {'unreduced: {'added':[], 'removed':[], 'moved':[]}, 'reduced': {'added':[], 'removed':[], '...
(self, other)
[ 0.021216602995991707, 0.012887254357337952, -0.007399893831461668, 0.04114626720547676, -0.038751132786273956, -0.045436061918735504, -0.02261078543961048, 0.01669444516301155, 0.027740664780139923, -0.009973770007491112, -0.06166578084230423, -0.011591379530727863, 0.03201258182525635, 0....
5,530
meld3
fillmeldhtmlform
Perform magic to 'fill in' HTML form element values from a dictionary. Unlike 'fillmelds', the type of element being 'filled' is taken into consideration. Perform a 'findmeld' on each key in the dictionary and use the value that corresponds to the key to perform mutation of the ...
def fillmeldhtmlform(self, **kw): """ Perform magic to 'fill in' HTML form element values from a dictionary. Unlike 'fillmelds', the type of element being 'filled' is taken into consideration. Perform a 'findmeld' on each key in the dictionary and use the value that corresponds to the key to perfor...
(self, **kw)
[ 0.0850997269153595, 0.008538615889847279, 0.0003895218833349645, -0.011891838163137436, -0.024099737405776978, 0.021176163107156754, -0.004328569862991571, -0.05124157294631004, 0.01665252447128296, -0.008227492682635784, -0.023309582844376564, 0.03887564316391945, 0.061671625822782516, 0....
5,531
meld3
fillmelds
Fill in the text values of meld nodes in tree using the keyword arguments passed in; use the keyword keys as meld ids and the keyword values as text that should fill in the node text on which that meld id is found. Return a list of keys from **kw that were not able to be found anywhere...
def fillmelds(self, **kw): """ Fill in the text values of meld nodes in tree using the keyword arguments passed in; use the keyword keys as meld ids and the keyword values as text that should fill in the node text on which that meld id is found. Return a list of keys from **kw that were not able to...
(self, **kw)
[ 0.04628439247608185, 0.003862994257360697, 0.036913055926561356, 0.017875289544463158, -0.04964663088321686, 0.036877285689115524, 0.035750579088926315, -0.02069205604493618, 0.08591585606336594, 0.011240240186452866, -0.03330044075846672, 0.04134834557771683, 0.028203435242176056, 0.03449...
5,532
meld3
find
null
def find(self, path): return ElementPath.find(self, path)
(self, path)
[ 0.07799282670021057, -0.04008055850863457, -0.007523317821323872, 0.0396534726023674, -0.004221600014716387, -0.017625590786337852, 0.034068476408720016, -0.0004963870742358267, 0.03280363604426384, 0.08101529628038406, 0.04832664132118225, -0.038700737059116364, 0.03038894757628441, 0.014...
5,533
meld3
findall
null
def findall(self, path): return ElementPath.findall(self, path)
(self, path)
[ 0.005395812448114157, -0.04102465137839317, -0.029475141316652298, -0.0009931796230375767, -0.013254751451313496, 0.03601601719856262, -0.009638321585953236, -0.07315239310264587, 0.07321829348802567, 0.07249335944652557, 0.05094306170940399, -0.022736553102731705, 0.03260553628206253, 0.0...
5,534
meld3
findmeld
Find a node in the tree that has a 'meld id' corresponding to 'name'. Iterate over all subnodes recursively looking for a node which matches. If we can't find the node, return None.
def findmeld(self, name, default=None): """ Find a node in the tree that has a 'meld id' corresponding to 'name'. Iterate over all subnodes recursively looking for a node which matches. If we can't find the node, return None.""" # this could be faster if we indexed all the meld nodes in the # tree;...
(self, name, default=None)
[ 0.07634185999631882, -0.014574198983609676, 0.0614691786468029, 0.06518734991550446, -0.04516381397843361, -0.003219286212697625, 0.0025306574534624815, 0.01964830607175827, 0.04666472598910332, 0.005688116420060396, -0.024611549451947212, 0.011683237738907337, -0.0035326869692653418, 0.02...
5,535
meld3
findmelds
Find all nodes that have a meld id attribute and return the found nodes in a list
def findmelds(self): """ Find all nodes that have a meld id attribute and return the found nodes in a list""" return self.findwithattrib(_MELD_ID)
(self)
[ 0.037685178220272064, 0.03881115838885307, 0.0387759730219841, 0.030577421188354492, 0.014074762351810932, 0.07125348597764969, 0.008541621267795563, -0.024437306448817253, 0.023856723681092262, 0.04553185775876045, -0.06520133465528488, 0.006659122183918953, 0.02920513227581978, 0.0650605...
5,536
meld3
findtext
null
def findtext(self, path, default=None): return ElementPath.findtext(self, path, default)
(self, path, default=None)
[ 0.07202442735433578, -0.05627329275012016, 0.09174700826406479, 0.05307594686746597, 0.02090054750442505, -0.03091328963637352, 0.03042527288198471, 0.0015176876913756132, 0.11584489792585373, 0.038536436855793, 0.055398229509592056, -0.027362551540136337, -0.010071640834212303, -0.0302401...
5,537
meld3
findwithattrib
Find all nodes that have an attribute named 'attrib'. If 'value' is not None, omit nodes on which the attribute value does not compare equally to 'value'. Return the found nodes in a list.
def findwithattrib(self, attrib, value=None): """ Find all nodes that have an attribute named 'attrib'. If 'value' is not None, omit nodes on which the attribute value does not compare equally to 'value'. Return the found nodes in a list.""" iterator = helper.getiterator(self) elements = [] ...
(self, attrib, value=None)
[ 0.03603638708591461, -0.02248859964311123, 0.023599373176693916, -0.009742025285959244, 0.015040958300232887, 0.042063694447278976, -0.02270711213350296, -0.010133527219295502, 0.02343548834323883, -0.016342928633093834, -0.015223052352666855, 0.02259785495698452, 0.03691043704748154, 0.00...
5,538
meld3
get
null
def get(self, key, default=None): return self.attrib.get(key, default)
(self, key, default=None)
[ 0.07682198286056519, -0.03927299752831459, 0.06861568242311478, 0.010214772075414658, 0.022446637973189354, -0.009982030838727951, 0.06430565565824509, 0.006559866480529308, 0.07096034288406372, 0.010852656327188015, -0.01941237784922123, 0.0110336784273386, 0.040031563490629196, 0.0325321...
5,539
meld3
getchildren
null
def getchildren(self): return self._children
(self)
[ 0.006488509010523558, -0.014570537954568863, -0.025852322578430176, -0.006437651813030243, -0.007653982378542423, 0.07357316464185715, 0.011561497114598751, 0.026682985946536064, 0.08510075509548187, 0.007552268449217081, 0.029530979692935944, -0.024241849780082703, 0.037023916840553284, 0...
5,540
meld3
getiterator
null
def getiterator(self, *ignored_args, **ignored_kw): # we ignore any tag= passed in to us, originally because it was too # painfail to support in the old C extension, now for b/w compat return helper.getiterator(self)
(self, *ignored_args, **ignored_kw)
[ -0.012798034586012363, -0.08402150869369507, -0.059119973331689835, -0.004552576690912247, -0.022631600499153137, 0.04451784864068031, 0.011857873760163784, 0.04411129280924797, 0.10353618115186691, -0.0479058101773262, 0.029272008687257767, -0.00478973425924778, -0.054986655712127686, 0.0...
5,541
meld3
insert
null
def insert(self, index, element): self._children.insert(index, element) element.parent = self
(self, index, element)
[ -0.032433927059173584, 0.02388518489897251, -0.01716587506234646, -0.0057020108215510845, 0.013934449292719364, 0.05385707691311836, -0.009831053204834461, 0.049001388251781464, -0.008672699332237244, 0.0371699295938015, -0.021371854469180107, -0.03501564636826515, 0.030416425317525864, -0...
5,542
meld3
items
null
def items(self): return list(self.attrib.items())
(self)
[ 0.02630385011434555, -0.007371752057224512, -0.003247336018830538, -0.062088724225759506, 0.02741624414920807, 0.04244212433695793, 0.017866766080260277, -0.04870576038956642, 0.10234028846025467, 0.05640695244073868, 0.00795362051576376, -0.009267101064324379, 0.051170144230127335, 0.0291...
5,543
meld3
keys
null
def keys(self): return list(self.attrib.keys())
(self)
[ 0.0021476936526596546, -0.009935795329511166, -0.0002715802111197263, -0.03585563600063324, 0.03337385877966881, 0.030909433960914612, 0.023481450974941254, -0.029104502871632576, 0.10565785318613052, 0.04397782310843468, -0.014691092073917389, -0.03462342545390129, 0.06414444744586945, 0....
5,544
meld3
lineage
null
def lineage(self): L = [] parent = self while parent is not None: L.append(parent) parent = parent.parent return L
(self)
[ -0.04052786901593208, 0.014837976545095444, -0.032239675521850586, 0.02537381835281849, -0.054997093975543976, 0.02642740309238434, 0.017480717971920967, 0.0027722432278096676, 0.060932282358407974, 0.018560640513896942, -0.028025338426232338, -0.06950143724679947, 0.01181770209223032, 0.0...
5,545
meld3
makeelement
null
def makeelement(self, tag, attrib): return self.__class__(tag, attrib)
(self, tag, attrib)
[ 0.049491893500089645, -0.0071764918975532055, 0.03395257517695427, -0.01663375459611416, -0.010426381602883339, 0.035757143050432205, -0.010200810618698597, 0.03286649286746979, -0.042240213602781296, 0.014378046616911888, 0.02645025961101055, 0.05667674168944359, 0.041839197278022766, 0.0...
5,546
meld3
meldid
null
def meldid(self): return self.attrib.get(_MELD_ID)
(self)
[ 0.07406280189752579, 0.06361987441778183, 0.09102810174226761, 0.05877264589071274, 0.05207206681370735, -0.011806209571659565, 0.06739786267280579, 0.007596070412546396, -0.0048605939373373985, 0.02060072124004364, -0.08012183755636215, 0.012002237141132355, 0.021652143448591232, 0.074062...
5,547
meld3
parentindex
Return the parent node index in which we live
def parentindex(self): """ Return the parent node index in which we live """ parent = self.parent if parent is not None: return parent._children.index(self)
(self)
[ 0.003009428270161152, -0.010922949761152267, 0.0060447813011705875, 0.042067185044288635, -0.026425933465361595, 0.04790888726711273, 0.034065086394548416, 0.06612532585859299, 0.06391308456659317, 0.009687204845249653, -0.028292514383792877, -0.07805069535970688, 0.015494342893362045, -0....
5,548
meld3
remove
null
def remove(self, element): self._children.remove(element) element.parent = None
(self, element)
[ 0.011926725506782532, 0.05692023038864136, 0.00015445523604284972, 0.012179743498563766, -0.021916557103395462, -0.0028573537711054087, -0.06187588721513748, 0.09345946460962296, 0.023731304332613945, 0.031129887327551842, -0.029297690838575363, -0.019421281293034554, 0.03821438178420067, ...
5,549
meld3
repeat
repeats an element with values from an iterable. If 'childname' is not None, repeat the element on which the repeat is called, otherwise find the child element with a 'meld:id' matching 'childname' and repeat that. The element is repeated within its parent element (nodes that are creat...
def repeat(self, iterable, childname=None): """repeats an element with values from an iterable. If 'childname' is not None, repeat the element on which the repeat is called, otherwise find the child element with a 'meld:id' matching 'childname' and repeat that. The element is repeated within its p...
(self, iterable, childname=None)
[ 0.04631105437874794, -0.031701020896434784, -0.009528683498501778, -0.03533974662423134, -0.059836823493242264, 0.04087134450674057, -0.014003581367433071, 0.016760190948843956, 0.0677391067147255, 0.021189145743846893, -0.026739122346043587, 0.0033194185234606266, 0.01100806426256895, 0.0...
5,550
meld3
replace
Replace this element with a Replace node in our parent with the text 'text' and return the index of our position in our parent. If we have no parent, do nothing, and return None. Pass the 'structure' flag to the replace node so it can do the right thing at render time.
def replace(self, text, structure=False): """ Replace this element with a Replace node in our parent with the text 'text' and return the index of our position in our parent. If we have no parent, do nothing, and return None. Pass the 'structure' flag to the replace node so it can do the right thing...
(self, text, structure=False)
[ 0.0635446235537529, -0.07554401457309723, 0.03217229247093201, 0.009034327231347561, -0.01679045706987381, -0.0009325616993010044, -0.004284566733986139, 0.05533634126186371, 0.044136904180049896, 0.0010863583302125335, -0.027755122631788254, -0.04125009477138519, 0.0003510692622512579, -0...
5,551
meld3
set
null
def set(self, key, value): self.attrib[key] = value
(self, key, value)
[ 0.049710407853126526, -0.015508611686527729, 0.01929730363190174, 0.02936020866036415, -0.017105212435126305, 0.0037110198754817247, 0.006964635103940964, 0.041218213737010956, 0.019314564764499664, 0.014265851117670536, -0.0535077303647995, -0.008224655874073505, 0.09693529456853867, 0.06...
5,552
meld3
shortrepr
null
def shortrepr(self, encoding=None): data = [] _write_html(data.append, self, encoding, {}, maxdepth=2) return _BLANK.join(data)
(self, encoding=None)
[ -0.00826665572822094, -0.014712808653712273, 0.036585092544555664, 0.024366721510887146, 0.040401145815849304, 0.00583348423242569, -0.025101924315094948, -0.07590093463659286, 0.04561758413910866, -0.00969767477363348, -0.04365704208612442, -0.03206884488463402, 0.012358409352600574, 0.02...
5,553
meld3
write_html
Write HTML to 'file' (which can be a filename or filelike object) encoding - encoding string (if None, 'utf-8' encoding is assumed). Unlike XML output, this is not used in a declaration, but it is used to do actual character encoding during ...
def write_html(self, file, encoding=None, doctype=doctype.html, fragment=False): """ Write HTML to 'file' (which can be a filename or filelike object) encoding - encoding string (if None, 'utf-8' encoding is assumed). Unlike XML output, this is not used in a declaration, ...
(self, file, encoding=None, doctype=('HTML', '-//W3C//DTD HTML 4.01 Transitional//EN', 'http://www.w3.org/TR/html4/loose.dtd'), fragment=False)
[ -0.01022339891642332, -0.020715128630399704, 0.01735205203294754, 0.012110658921301365, 0.06540113687515259, -0.018586372956633568, -0.05699343979358673, -0.0364929735660553, -0.09137554466724396, 0.007951532490551472, 0.01723577454686165, -0.05062505602836609, 0.0013707226607948542, 0.047...
5,554
meld3
write_htmlstring
null
def write_htmlstring(self, encoding=None, doctype=doctype.html, fragment=False): data = [] write = data.append if encoding is None: encoding = 'utf8' if not fragment: if doctype: _write_doctype(write, doctype) _write_html(write, self, encoding, {}) ...
(self, encoding=None, doctype=('HTML', '-//W3C//DTD HTML 4.01 Transitional//EN', 'http://www.w3.org/TR/html4/loose.dtd'), fragment=False)
[ -0.016301916912198067, -0.006139387376606464, -0.000504314957652241, -0.011259336024522781, 0.020789267495274544, -0.011031783185899258, -0.04110522195696831, -0.023519907146692276, -0.03662697598338127, 0.004478248301893473, 0.006940375082194805, -0.03347763791680336, -0.016156282275915146,...
5,555
meld3
write_xhtml
Write XHTML to 'file' (which can be a filename or filelike object) encoding - encoding string (if None, 'utf-8' encoding is assumed) Must be a recognizable Python encoding type. doctype - 3-tuple indicating name, pubid, system of doctype. The default ...
def write_xhtml(self, file, encoding=None, doctype=doctype.xhtml, fragment=False, declaration=False, pipeline=False): """ Write XHTML to 'file' (which can be a filename or filelike object) encoding - encoding string (if None, 'utf-8' encoding is assumed) Must be a recognizab...
(self, file, encoding=None, doctype=('html', '-//W3C//DTD XHTML 1.0 Transitional//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'), fragment=False, declaration=False, pipeline=False)
[ 0.009635567665100098, -0.03327213600277901, 0.039490897208452225, 0.01935897208750248, 0.07652239501476288, -0.014835436828434467, -0.06218762323260307, -0.03973683714866638, -0.07030363380908966, -0.008392693474888802, 0.022081876173615456, -0.07093604654073715, -0.031796496361494064, 0.0...
5,556
meld3
write_xhtmlstring
null
def write_xhtmlstring(self, encoding=None, doctype=doctype.xhtml, fragment=False, declaration=False, pipeline=False): data = [] write = data.append if not fragment: if declaration: _write_declaration(write, encoding) if doctype: _write_doctype(wr...
(self, encoding=None, doctype=('html', '-//W3C//DTD XHTML 1.0 Transitional//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'), fragment=False, declaration=False, pipeline=False)
[ 0.0029078039806336164, -0.02549477480351925, 0.024396320804953575, -0.03631986677646637, 0.052902985364198685, -0.01157806534320116, -0.04167040437459946, -0.016831157729029655, -0.026486927643418312, -0.012800538912415504, 0.028985025361180305, -0.05233604460954666, -0.03670964017510414, ...
5,557
meld3
write_xml
Write XML to 'file' (which can be a filename or filelike object) encoding - encoding string (if None, 'utf-8' encoding is assumed) Must be a recognizable Python encoding type. doctype - 3-tuple indicating name, pubid, system of doctype. The default is...
def write_xml(self, file, encoding=None, doctype=None, fragment=False, declaration=True, pipeline=False): """ Write XML to 'file' (which can be a filename or filelike object) encoding - encoding string (if None, 'utf-8' encoding is assumed) Must be a recognizable Python encodi...
(self, file, encoding=None, doctype=None, fragment=False, declaration=True, pipeline=False)
[ -0.005795566830784082, -0.0040810080245137215, 0.026736406609416008, 0.009046085178852081, 0.06461744755506516, -0.026807846501469612, -0.05332993343472481, -0.03711305931210518, -0.012680593878030777, -0.04429277777671814, -0.01210907381027937, -0.07265444099903107, -0.015145272016525269, ...
5,558
meld3
write_xmlstring
null
def write_xmlstring(self, encoding=None, doctype=None, fragment=False, declaration=True, pipeline=False): data = [] write = data.append if not fragment: if declaration: _write_declaration(write, encoding) if doctype: _write_doctype(write, doctype) ...
(self, encoding=None, doctype=None, fragment=False, declaration=True, pipeline=False)
[ -0.017335956916213036, 0.008596857078373432, 0.017949383705854416, -0.05547506362199783, 0.04807838797569275, -0.012037377804517746, -0.04167741909623146, -0.012561901472508907, 0.022652318701148033, -0.02565721794962883, 0.006134261842817068, -0.04654926806688309, -0.021549928933382034, 0...
5,559
meld3._compat
_b
null
def _b(x, encoding='latin1'): # x should be a str literal return bytes(x, encoding)
(x, encoding='latin1')
[ -0.010914741083979607, -0.017733214423060417, -0.000023950939066708088, 0.053476184606552124, -0.018389999866485596, -0.0691007673740387, -0.06194526329636574, 0.027515863999724388, 0.0433824248611927, -0.07729330658912659, 0.05485888943076134, 0.06305142492055893, -0.014043116010725498, 0...
5,560
meld3
_both_case
null
def _both_case(mapping): # Add equivalent upper-case keys to mapping. lc_keys = list(mapping.keys()) for k in lc_keys: mapping[k.upper()] = mapping[k]
(mapping)
[ 0.009433852508664131, -0.014864440076053143, -0.010050388984382153, 0.014509720727801323, -0.043917663395404816, -0.07060609012842178, 0.0065369755029678345, 0.002362685976549983, 0.08432191610336304, -0.046822987496852875, -0.03807323798537254, 0.009982822462916374, 0.023783104494214058, ...
5,562
meld3
_encode_attrib
null
def _encode_attrib(k, v, encoding): return _BLANK.join((_SPACE, encode(k, encoding), _EQUAL, _QUOTE, _escape_attrib(v, encoding), _QUOTE, ))
(k, v, encoding)
[ 0.009809045121073723, -0.012764175422489643, 0.04049438610672951, 0.06966491043567657, 0.03324314206838608, -0.030395623296499252, -0.026803111657500267, -0.03764686733484268, 0.03880574181675911, -0.008178343065083027, -0.008948166854679585, -0.010115318931639194, 0.059764813631772995, 0....
5,563
meld3._compat
_encode_entity
null
def _encode_entity(text): # map reserved and non-ascii characters to numerical entities global _pattern if _pattern is None: _ptxt = r'[&<>\"' + _NON_ASCII_MIN + '-' + _NON_ASCII_MAX + ']+' #_pattern = re.compile(eval(r'u"[&<>\"\u0080-\uffff]+"')) _pattern = re.compile(_ptxt) de...
(text)
[ 0.02029469981789589, -0.06386394798755646, 0.01487278938293457, 0.05952642112970352, -0.002028808929026127, -0.05067503824830055, -0.0599495954811573, -0.03889670595526695, 0.056881584227085114, -0.022675052285194397, 0.03512340784072876, -0.01488160528242588, -0.039637260138988495, 0.0381...
5,564
meld3
_escape_attrib
null
def _escape_attrib(text, encoding): # Return escaped attribute value as bytes. try: if encoding: try: encoded = encode(text, encoding) except UnicodeError: return _encode_entity(text) else: encoded = _b(text) # don't req...
(text, encoding)
[ 0.015631234273314476, -0.0034526558592915535, 0.08593276888132095, 0.08357464522123337, 0.01647218130528927, -0.04203006997704506, -0.03148787468671799, -0.06325317919254303, 0.033689945936203, -0.024968359619379044, 0.04591403901576996, 0.0004974165349267423, 0.018795626237988472, 0.03377...
5,565
meld3
_escape_cdata
null
def _escape_cdata(text, encoding=None): # Return escaped character data as bytes. try: if encoding: try: encoded = encode(text, encoding) except UnicodeError: return _encode_entity(text) else: encoded = _b(text) encoded ...
(text, encoding=None)
[ 0.00024076215049717575, -0.03536183759570122, 0.0669977143406868, 0.05042239651083946, -0.0054801274091005325, -0.03048674575984478, -0.05818772315979004, -0.04001058638095856, 0.07890687137842178, -0.036458734422922134, 0.06372443586587906, -0.025385307148098946, -0.010960254818201065, -0...
5,566
meld3._compat
_raise_serialization_error
null
def _raise_serialization_error(text): raise TypeError( "cannot serialize %r (type %s)" % (text, type(text).__name__) )
(text)
[ 0.0032704018522053957, 0.006770378910005093, 0.035963986068964005, 0.04748448356986046, -0.022339746356010437, -0.035496488213539124, -0.021271178498864174, 0.08167865127325058, 0.03364318981766701, -0.03175650164484978, 0.062143899500370026, 0.047083768993616104, 0.034828633069992065, -0....
5,567
meld3._compat
_u
null
def _u(x, encoding='latin1'): # x should be a str literal if isinstance(x, str): return x return str(x, encoding)
(x, encoding='latin1')
[ -0.06524259597063065, -0.0022025087382644415, 0.03930022567510605, 0.057052116841077805, -0.011863887310028076, -0.03031882271170616, -0.00785213615745306, 0.0028693031053990126, 0.06626200675964355, -0.06035642698407173, 0.041796036064624786, 0.022550174966454506, -0.022163499146699905, 0...
5,568
meld3
_write_declaration
null
def _write_declaration(write, encoding): # Write as bytes. if not encoding: write(_XML_PROLOG_BEGIN + _XML_PROLOG_END) else: write(_XML_PROLOG_BEGIN + _SPACE + _ENCODING + _EQUAL + _QUOTE + _b(encoding) + _QU...
(write, encoding)
[ -0.03901856765151024, 0.015788789838552475, 0.024831537157297134, 0.0062926337122917175, 0.02601802721619606, -0.01837364211678505, -0.06874861568212509, 0.02252635732293129, -0.03532349690794945, -0.03556079417467117, 0.04112034663558006, -0.012551367282867432, 0.0160345621407032, 0.00979...
5,569
meld3
_write_doctype
null
def _write_doctype(write, doctype): # Write as bytes. try: name, pubid, system = doctype except (ValueError, TypeError): raise ValueError("doctype must be supplied as a 3-tuple in the form " "(name, pubid, system) e.g. '%s'" % doctype.xhtml) write(_DOCTYPE_BEGIN ...
(write, doctype)
[ -0.010782338678836823, 0.020233096554875374, 0.01603948511183262, -0.037457168102264404, 0.030885735526680946, -0.021910540759563446, -0.019783472642302513, 0.004850755445659161, -0.05730981379747391, -0.015045123174786568, 0.006208274979144335, -0.0024750956799834967, -0.015563920140266418,...
5,570
meld3
_write_html
Walk 'node', calling 'write' with bytes(?).
def _write_html(write, node, encoding, namespaces, depth=-1, maxdepth=None): """ Walk 'node', calling 'write' with bytes(?). """ if encoding is None: encoding = 'utf-8' tag = node.tag tail = node.tail text = node.text tail = node.tail to_write = _BLANK if tag is Replace: ...
(write, node, encoding, namespaces, depth=-1, maxdepth=None)
[ 0.0012241258518770337, -0.03710423782467842, 0.01661960780620575, 0.002978484844788909, 0.017382949590682983, 0.006266171578317881, -0.09036428481340408, -0.002293650759384036, -0.0009203590452671051, -0.02519996277987957, 0.038920801132917404, 0.003708008211106062, 0.029876641929149628, 0...
5,571
meld3
_write_xml
Write XML to a file
def _write_xml(write, node, encoding, namespaces, pipeline, xhtml=False): """ Write XML to a file """ if encoding is None: encoding = 'utf-8' tag = node.tag if tag is Comment: write(_COMMENT_START + _escape_cdata(node.text, encoding) + _COMMENT_END) elif t...
(write, node, encoding, namespaces, pipeline, xhtml=False)
[ 0.009959531016647816, -0.017790380865335464, 0.0038600408006459475, 0.004878628998994827, 0.038219939917325974, -0.0023550342302769423, -0.08075504004955292, 0.023174691945314407, 0.047697871923446655, -0.05833164602518082, 0.019630100578069687, -0.008269107900559902, 0.023617766797542572, ...
5,572
builtins
bytes
bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object Construct an immutable array of bytes from: - an iterable yieldin...
from builtins import bytes
null
[ -0.007402974646538496, -0.04078245908021927, -0.01056741550564766, 0.0420052707195282, -0.005275445524603128, -0.005754656158387661, -0.005325018893927336, 0.05829842388629913, 0.01683020032942295, -0.05274619534611702, 0.06031441316008568, 0.03913000971078873, -0.00515151210129261, 0.0343...
5,573
meld3
diffreduce
null
def diffreduce(elements): # each element in 'elements' should all have non-None meldids, and should # be preordered in depth-first traversal order reduced = [] for element in elements: parent = element.parent if parent is None: reduced.append(element) continue ...
(elements)
[ -0.03685678541660309, 0.013790014199912548, 0.0016042174538597465, 0.011403796263039112, -0.0082623902708292, -0.0474383644759655, 0.023111455142498016, -0.01111780758947134, 0.09480522572994232, 0.03455100208520889, -0.001688003190793097, -0.019858334213495255, 0.011403796263039112, -0.00...
5,574
meld3
do_parse
null
def do_parse(source, parser): root = et_parse(source, parser=parser).getroot() iterator = root.getiterator() for p in iterator: for c in p: c.parent = p return root
(source, parser)
[ -0.06179649755358696, 0.008312202990055084, -0.04582701995968819, 0.00969831831753254, -0.06635408103466034, 0.03965454921126366, 0.028978323563933372, 0.0720241442322731, 0.07471562922000885, 0.0029000751674175262, -0.007145893294364214, -0.08031391352415085, -0.024420741945505142, 0.0553...
5,575
meld3
doctype
null
class doctype: # lookup table for ease of use in external code html_strict = ('HTML', '-//W3C//DTD HTML 4.01//EN', 'http://www.w3.org/TR/html4/strict.dtd') html = ('HTML', '-//W3C//DTD HTML 4.01 Transitional//EN', 'http://www.w3.org/TR/html4/loose.dtd') xh...
()
[ 0.04842295125126839, 0.02474912256002426, 0.03258837014436722, -0.07145506888628006, 0.03621315211057663, -0.012643384747207165, -0.022997433319687843, -0.031010113656520844, -0.02065606601536274, 0.028495311737060547, 0.00888852495700121, -0.020239822566509247, -0.042734295129776, 0.06389...
5,577
meld3
encode
null
def encode(text, encoding): if not isinstance(text, bytes): text = text.encode(encoding) return text
(text, encoding)
[ -0.007105630822479725, -0.038600169122219086, 0.019640473648905754, 0.08462083339691162, -0.02597171813249588, -0.0420040637254715, -0.07059678435325623, -0.03383471816778183, 0.09816833585500717, -0.022091278806328773, 0.07488568872213364, -0.026499323546886444, -0.010705249384045601, 0.0...
5,579
meld3._compat
fixtag
null
def fixtag(tag, namespaces): # given a decorated tag (of the form {uri}tag), return prefixed # tag and namespace declaration, if any if isinstance(tag, QName): tag = tag.text namespace_uri, tag = tag[1:].split("}", 1) prefix = namespaces.get(namespace_uri) if prefix is None: pref...
(tag, namespaces)
[ -0.0013508035335689783, 0.030174383893609047, 0.028629310429096222, -0.044643547385931015, -0.017104877158999443, -0.00010075642785523087, -0.002887924900278449, 0.040135566145181656, 0.042789459228515625, -0.019086206331849098, -0.011406281031668186, 0.010815517045557499, -0.017023079097270...
5,581
meld3
insert_doctype
null
def insert_doctype(data, doctype=doctype.xhtml): # jam an html doctype declaration into 'data' if it # doesn't already contain a doctype declaration match = _XML_DECL_RE.search(data) dt_string = '<!DOCTYPE %s PUBLIC "%s" "%s">' % doctype if match is not None: start, end = match.span(0) ...
(data, doctype=('html', '-//W3C//DTD XHTML 1.0 Transitional//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'))
[ -0.001388859236612916, 0.024874825030565262, 0.028186719864606857, -0.07093865424394608, 0.04839640110731125, 0.004700754303485155, 0.01641702838242054, -0.03023439645767212, -0.018660569563508034, -0.016977913677692413, 0.015179519541561604, -0.0629972293972969, -0.04145210608839989, -0.0...
5,582
meld3
insert_meld_ns_decl
null
def insert_meld_ns_decl(data): match = _BEGIN_TAG_RE.search(data) if match is not None: start, end = match.span(0) before = data[:start] tag = data[start:end] + ' xmlns:meld="%s"' % _MELD_NS_URL after = data[end:] data = before + tag + after return data
(data)
[ -0.003614381654188037, 0.06710243970155716, 0.03928542882204056, -0.002099130069836974, 0.03816996142268181, 0.007289765402674675, 0.009655780158936977, 0.005416125524789095, 0.011869288980960846, -0.00332026369869709, -0.008535953238606453, -0.005350766237825155, 0.01762964203953743, -0.0...
5,583
meld3
intersection
null
def intersection(S1, S2): L = [] for element in S1: if element in S2: L.append(element) return L
(S1, S2)
[ -0.0228424072265625, -0.02335808053612709, -0.03029101900756359, -0.004669706337153912, -0.0016496763564646244, 0.02498149685561657, 0.02352997101843357, -0.009874184615910053, 0.07540286332368851, 0.013693985529243946, 0.006231049541383982, -0.02545897103846073, -0.012443000450730324, -0....
5,584
meld3
melditerator
null
def melditerator(element, meldid=None, _MELD_ID=_MELD_ID): nodeid = element.attrib.get(_MELD_ID) if nodeid is not None: if meldid is None or nodeid == meldid: yield element for child in element._children: for el2 in melditerator(child, meldid): nodeid = el2.attrib.get...
(element, meldid=None, _MELD_ID='{http://www.plope.com/software/meld3}id')
[ 0.0414704903960228, -0.010258776135742664, 0.015519686974585056, 0.00648996839299798, 0.00030726438853889704, 0.013760003261268139, -0.007374345790594816, 0.0187397263944149, 0.05061358958482742, 0.04785614833235741, -0.054786037653684616, 0.023111725226044655, 0.010267846286296844, 0.0781...
5,585
meld3
parse_html
null
def parse_html(source, encoding=None): builder = MeldTreeBuilder() parser = HTMLMeldParser(builder, encoding) return do_parse(source, parser)
(source, encoding=None)
[ -0.04725400730967522, -0.032403748482465744, 0.016482731327414513, -0.021081745624542236, -0.017632484436035156, 0.009900170378386974, -0.06866926699876785, -0.022187616676092148, -0.024978622794151306, 0.042725205421447754, -0.007793751545250416, -0.05704885721206665, -0.0036906220484524965...
5,586
meld3
parse_htmlstring
null
def parse_htmlstring(text, encoding=None): source = StringIO(text) return parse_html(source, encoding)
(text, encoding=None)
[ -0.0351436585187912, -0.02304989844560623, -0.020634647458791733, -0.010046045295894146, -0.01737055741250515, 0.043369513005018234, -0.055795807391405106, -0.01174372248351574, -0.004281383007764816, 0.002955620177090168, -0.0015489112120121717, 0.005657463800162077, -0.04616980627179146, ...
5,587
meld3
parse_xml
Parse source (a filelike object) into an element tree. If html is true, use a parser that can resolve somewhat ambiguous HTML into XHTML. Otherwise use a 'normal' parser only.
def parse_xml(source): """ Parse source (a filelike object) into an element tree. If html is true, use a parser that can resolve somewhat ambiguous HTML into XHTML. Otherwise use a 'normal' parser only.""" builder = MeldTreeBuilder() parser = MeldParser(target=builder) return do_parse(source, ...
(source)
[ -0.01661026105284691, -0.026392661035060883, 0.04399377480149269, -0.05044331029057503, 0.0242127887904644, -0.01749301888048649, -0.029635444283485413, 0.03361686319112778, 0.03239181265234947, -0.004229131154716015, 0.027131294831633568, -0.06463950127363205, -0.0016821942990645766, 0.06...
5,588
meld3
parse_xmlstring
null
def parse_xmlstring(text): source = StringIO(text) return parse_xml(source)
(text)
[ -0.01050106342881918, -0.009629717096686363, 0.026805108413100243, -0.020193660631775856, -0.01740894839167595, 0.02303227223455906, -0.043369658291339874, 0.055406805127859116, 0.0660785436630249, -0.024649202823638916, 0.01732810214161873, 0.02872745878994465, -0.027541710063815117, 0.03...
5,589
meld3
prefeed
null
def prefeed(data, doctype=doctype.xhtml): if data.find('<!DOCTYPE') == -1: data = insert_doctype(data, doctype) if data.find('xmlns:meld') == -1: data = insert_meld_ns_decl(data) return data
(data, doctype=('html', '-//W3C//DTD XHTML 1.0 Transitional//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'))
[ 0.016737496480345726, 0.028481386601924896, 0.018850861117243767, -0.06099332869052887, 0.035418931394815445, 0.023826632648706436, 0.025752738118171692, -0.028855906799435616, -0.007361109834164381, 0.008796771988272667, 0.009996128268539906, -0.03190557286143303, -0.03677434101700783, 0....
5,591
meld3
sharedlineage
null
def sharedlineage(srcelement, tgtelement): srcparent = srcelement.parent tgtparent = tgtelement.parent srcparenttag = getattr(srcparent, 'tag', None) tgtparenttag = getattr(tgtparent, 'tag', None) if srcparenttag != tgtparenttag: return False elif tgtparenttag is None and srcparenttag is...
(srcelement, tgtelement)
[ 0.007077591959387064, -0.012669931165874004, -0.03338196128606796, 0.07270493358373642, -0.03512079641222954, -0.0011784665985032916, -0.011311467736959457, 0.04749186336994171, 0.027640191838145256, 0.0005462152766995132, 0.018982255831360817, -0.020141476765275, 0.038978829979896545, 0.0...
5,593
gptfunction.GPTFunction
GPTFunction
A class representing a GPT callable function. GPT functions are defined using a JSON schema which GPT uses to make a call. GPT functions created using this wrapper must follow a strict definition. 1. Parameters should use type hinting, and can only be of the following types: 1. str 2. ...
class GPTFunction: """ A class representing a GPT callable function. GPT functions are defined using a JSON schema which GPT uses to make a call. GPT functions created using this wrapper must follow a strict definition. 1. Parameters should use type hinting, and can only be of the following types: ...
(func: Callable[..., Any]) -> None
[ 0.02966480888426304, -0.016793880611658096, -0.030898313969373703, -0.015378382056951523, 0.019665321335196495, 0.002810776000842452, -0.026530489325523376, -0.013811223208904266, -0.0010559367947280407, -0.0385824516415596, -0.019099121913313866, 0.021535802632570267, -0.003978562541306019,...
5,594
gptfunction.GPTFunction
__call__
null
@no_type_check def __call__(self, *args, **kwargs) -> Optional[str]: result = self.func(*args, **kwargs) # GPT expects function calls to return a string. if isinstance(result, str): return result if getattr(result, "__str__"): return str(result) return ""
(self, *args, **kwargs) -> Optional[str]
[ 0.010796239599585533, -0.07325396686792374, 0.009505574591457844, -0.004717904608696699, -0.003736824495717883, -0.04677789285778999, 0.0056641013361513615, -0.0101683484390378, 0.09871844202280045, -0.08113749325275421, 0.05152195692062378, 0.011816563084721565, -0.00715534295886755, -0.0...
5,595
gptfunction.GPTFunction
__init__
null
def __init__(self, func: Callable[..., Any]) -> None: self.func = func
(self, func: Callable[..., Any]) -> NoneType
[ -0.007873441092669964, -0.02317778766155243, 0.0129902558401227, 0.020891355350613594, -0.041561443358659744, 0.05384179949760437, -0.014815714210271835, 0.01710214652121067, 0.02950235642492771, -0.022956520318984985, 0.0010394970886409283, 0.04650308936834335, -0.0014393923338502645, -0....
5,596
gptfunction.GPTFunction
_create_function_params
Combines annotation data with param documentation into a unified data storing the GPT function's parameters in order. :param annotations: The type annotation of the function. :param docstring_params: The docstring of the parameters of the function. :return: An list of the unifi...
@staticmethod def _create_function_params( annotations: Dict[str, type], docstring_params: List[DocstringParam] ) -> List[_FunctionParam]: """ Combines annotation data with param documentation into a unified data storing the GPT function's parameters in order. :param annotations: The type annotation...
(annotations: Dict[str, type], docstring_params: List[docstring_parser.common.DocstringParam]) -> List[gptfunction.GPTFunction.GPTFunction._FunctionParam]
[ -0.0016690753400325775, -0.012920324690639973, -0.03417881950736046, -0.013698425143957138, -0.007041336502879858, 0.017348777502775192, -0.024361295625567436, -0.005701273214071989, -0.002790597965940833, 0.010201772674918175, -0.03139302507042885, 0.021018341183662415, 0.000086755891970824...
5,597
gptfunction.GPTFunction
_parse_param_type
Converts a `typing` hint into a param object used by the function calling schema. :param param_type: The type of the parameter. :return: The parameter part of the function calling schema. Example1 ```python def my_func(a: int, b: str) -> None: pass ...
@staticmethod def _parse_param_type( param_type: Union[type, object], ) -> Dict[str, Union[str, List[str]]]: """ Converts a `typing` hint into a param object used by the function calling schema. :param param_type: The type of the parameter. :return: The parameter part of the function calling schema....
(param_type: Union[type, object]) -> Dict[str, Union[str, List[str]]]
[ 0.0173092782497406, 0.01316494308412075, -0.002559300512075424, 0.003662148956209421, 0.0022539154160767794, 0.01930726319551468, 0.01802143268287182, -0.01646854169666767, -0.06579504162073135, -0.03390640392899513, -0.013273743912577629, 0.013293526135385036, 0.019000642001628876, -0.000...
5,598
gptfunction.GPTFunction
_parse_params
Converts a function's params into a 'parameters' object used by the function calling schema. :param params: The function parameters to parse into the schema. :return: The parameters part of the function calling schema.
@staticmethod def _parse_params(params: List[_FunctionParam]) -> Dict[str, Any]: """ Converts a function's params into a 'parameters' object used by the function calling schema. :param params: The function parameters to parse into the schema. :return: The parameters part of the function calling schema. ...
(params: List[gptfunction.GPTFunction.GPTFunction._FunctionParam]) -> Dict[str, Any]
[ 0.011703683994710445, 0.009037686511874199, -0.03016059473156929, -0.022796908393502235, -0.02403690665960312, 0.015995988622307777, -0.01252399105578661, -0.008303225040435791, -0.013220299035310745, -0.004387689288705587, -0.022205524146556854, 0.021366139873862267, -0.03296490013599396, ...
5,599
gptfunction.GPTFunction
description
Get the description of this function. :return: The function description
def description(self) -> str: """ Get the description of this function. :return: The function description """ return docstring_parser.parse(self.func.__doc__).short_description
(self) -> str
[ 0.01653946004807949, -0.03221386671066284, 0.0511886402964592, -0.016915570944547653, 0.04742753505706787, -0.04449387267231941, 0.021381882950663567, -0.023412879556417465, 0.01684975065290928, -0.047577980905771255, -0.051978472620248795, 0.00031293570646084845, -0.007019162643700838, -0...
5,600
gptfunction.GPTFunction
name
Get the name of this function. :return: The function name.
def name(self) -> str: """ Get the name of this function. :return: The function name. """ return self.func.__name__
(self) -> str
[ 0.000046129429392749444, -0.032262157648801804, 0.03301536291837692, 0.014804009348154068, -0.003604610450565815, -0.026918010786175728, 0.0013248288305476308, -0.0032168009784072638, 0.01974465698003769, -0.04268145561218262, -0.05842696875333786, -0.011961567215621471, 0.03488043323159218,...
5,601
gptfunction.GPTFunction
schema
Generates the schema required for passing a function to GPT.
def schema(self) -> object: """ Generates the schema required for passing a function to GPT. """ docstring = docstring_parser.parse(self.func.__doc__) return { "type": "function", "function": { "name": self.func.__name__, "description": docstring.short_descrip...
(self) -> object
[ 0.013264935463666916, 0.0017951607005670667, -0.00010051767458207905, -0.04740583524107933, 0.015512000769376755, 0.01685299165546894, -0.020422926172614098, -0.0024894406087696552, -0.006559981498867273, -0.020060496404767036, -0.028577599674463272, 0.015539182350039482, -0.0318938344717025...
5,602
gptfunction.GPTFunction
gptfunction
null
def gptfunction(func: Callable[..., Any]) -> GPTFunction: return GPTFunction(func)
(func: Callable[..., Any]) -> gptfunction.GPTFunction.GPTFunction
[ 0.0049864500761032104, -0.025753704831004143, -0.04465159773826599, 0.0004443069046828896, -0.05047726258635521, 0.04365697130560875, -0.03063802793622017, -0.016961922869086266, 0.05079696327447891, -0.05186263471841812, 0.004378129728138447, -0.004364809021353722, -0.04358592629432678, -...