Search is not available for this dataset
id
int64
0
10.8M
vector
listlengths
1.54k
1.54k
ast_depth
int64
3
164
ast_data
stringlengths
297
510k
full_path
stringlengths
0
319
code
stringlengths
60
56.5k
19,001
[ 0.017796598374843597, 0.03369368612766266, -0.007858091033995152, -0.04040981084108353, -0.01589708775281906, 0.01024943869560957, 0.004652668721973896, 0.0036633405834436417, 0.0017468706937506795, 0.04113343358039856, -0.0031093168072402477, -0.03593239560723305, 0.02973637543618679, -0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "command", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type":...
def execute_show_command(command, module, command_type='cli_show_ascii'): cmds = [command] if module.params['transport'] == 'cli': body = run_commands(module, cmds) elif module.params['transport'] == 'nxapi': body = run_commands(module, cmds) return body
19,002
[ 0.007371623069047928, 0.0379076786339283, 0.028054149821400642, -0.024547381326556206, -0.05857785791158676, 0.03240056708455086, -0.019497141242027283, -0.010310393758118153, 0.02294217050075531, 0.06677678227424622, 0.011471085250377655, -0.019707052037119865, 0.05694795027375221, 0.0197...
19
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type": "...
def get_commands(module, state, mode): commands = list() system_mode = '' if module.params['system_mode_maintenance'] is True and mode == 'normal': commands.append('system mode maintenance') elif (module.params['system_mode_maintenance'] is False and mode == 'maintenance'): com...
19,003
[ 0.019227949902415276, 0.07309183478355408, -0.00737789599224925, -0.02648356184363365, -0.03747761622071266, 0.06643018126487732, 0.000992114539258182, 0.02639039047062397, 0.04148392379283905, 0.026972703635692596, -0.013451413251459599, -0.0062074484303593636, -0.009375227615237236, 0.00...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ...
def get_system_mode(module): command = 'show system mode' body = execute_show_command(command, module)[0] if 'normal' in body.lower(): mode = 'normal' else: mode = 'maintenance' return mode
19,004
[ 0.008200086653232574, 0.05017981678247452, -0.026577452197670937, -0.036841508001089096, -0.05900591239333153, 0.07254256308078766, 0.012520162388682365, -0.02241232991218567, 0.04346107691526413, 0.08444291353225708, 0.017032379284501076, -0.045320507138967514, 0.01980912685394287, 0.0253...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def main(): argument_spec = dict( system_mode_maintenance=dict(required=False, type='bool'), system_mode_maintenance_dont_generate_profile=dict(required=False, type='bool'), system_mode_maintenance_timeout=dict(required=False, ty...
19,005
[ -0.003066279226914048, -0.01589675061404705, 0.040215324610471725, 0.024775313213467598, -0.012387656606733799, 0.03152614086866379, -0.005893048830330372, 0.009235043078660965, 0.047946471720933914, 0.04919414967298508, 0.05534341558814049, -0.050931986421346664, -0.00034272842458449304, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation":...
class AnsibleCloudStackVPCOffering(AnsibleCloudStack): def __init__(self, module): super(AnsibleCloudStackVPCOffering, self).__init__(module) self.returns = { 'serviceofferingid': 'service_offering_id', 'isdefault': 'is_default', 'distributedvpcrouter': 'distribu...
19,006
[ -0.01487034186720848, -0.013791217468678951, 0.0018736307974904776, 0.0014999837148934603, -0.03567587211728096, 0.0012288535945117474, -0.03476940840482712, 0.022014150395989418, 0.049467090517282486, -0.017406286671757698, 0.04558223858475685, -0.07804232090711594, 0.028165161609649658, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def get_service_offering_id(self): service_offering = self.module.params.get('service_offering') if not service_offering: return None args = { 'issystem': True } service_offerings = self.query_api('listServiceOfferings', **args) if service_offeri...
19,007
[ -0.022326244041323662, -0.003705138573423028, 0.022517066448926926, 0.02040741592645645, -0.008767237886786461, 0.017555678263306618, -0.04221419617533684, 0.03701958432793617, 0.06568537652492523, 0.023047128692269325, 0.036701545119285583, -0.04673033207654953, 0.012117234990000725, -0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def get_vpc_offering(self): if self.vpc_offering: return self.vpc_offering args = { 'name': self.module.params.get('name'), } vo = self.query_api('listVPCOfferings', **args) if vo: for vpc_offer in vo['vpcoffering']: if args['...
19,008
[ -0.008151056244969368, 0.008875207975506783, 0.03411046043038368, 0.050887614488601685, -0.026138994842767715, 0.0044955359771847725, -0.015004430897533894, 0.0441906563937664, 0.07878774404525757, 0.06386442482471466, 0.06984302401542664, -0.027089081704616547, 0.02889656461775303, -0.036...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def create_vpc_offering(self): vpc_offering = None self.result['changed'] = True args = { 'name': self.module.params.get('name'), 'state': self.module.params.get('state'), 'displaytext': self.module.params.get('display_text'), 'supportedservices': ...
19,009
[ -0.0019702690187841654, 0.015029840171337128, 0.020016537979245186, 0.04393874481320381, -0.02138817124068737, 0.04765842482447624, -0.026990942656993866, 0.05942191928625107, 0.08229796588420868, 0.04956476390361786, 0.10126834362745285, -0.039289142936468124, 0.0017973619978874922, -0.01...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def delete_vpc_offering(self): vpc_offering = self.get_vpc_offering() if vpc_offering: self.result['changed'] = True args = { 'id': vpc_offering['id'], } if not self.module.check_mode: res = self.query_api('deleteVPCOffer...
19,010
[ -0.015773793682456017, 0.005922352895140648, 0.014372188597917557, 0.06010814756155014, -0.0010928492993116379, 0.04439179599285126, 0.0011940922122448683, 0.023172425106167793, 0.06318707764148712, 0.06622005999088287, 0.0723319724202156, -0.030375752598047256, 0.015808258205652237, 0.001...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "vpc_offering", "annotation": null, "type_comment": null}}], "kwar...
def update_vpc_offering(self, vpc_offering): if not vpc_offering: return vpc_offering args = { 'id': vpc_offering['id'], 'state': self.module.params.get('state'), 'name': self.module.params.get('name'), 'displaytext': self.module.params.get('d...
19,011
[ 0.007897435687482357, 0.004476373083889484, 0.020595954731106758, 0.008628034964203835, -0.019076772034168243, 0.04810361564159393, -0.02049158327281475, -0.007682894356548786, 0.06763266026973724, 0.0777914822101593, 0.04963439702987671, -0.09936156868934631, 0.0409831665456295, 0.0076944...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def main(): argument_spec = cs_argument_spec() argument_spec.update(dict( name=dict(required=True), display_text=dict(), state=dict(choices=['enabled', 'present', 'disabled', 'absent'], default='present'), service_capabilities=dict(type='list', aliases=['service_capability']), ...
19,012
[ 0.01200312189757824, 0.011529314331710339, 0.0038615306839346886, 0.014572211541235447, 0.04011569917201996, 0.03813623636960983, 0.006949176080524921, 0.00017915845091920346, -0.01568829081952572, 0.02156350389122963, 0.013308725319802761, 0.049697138369083405, -0.029607702046632767, 0.04...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "input", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ch_out", "annotation": null, "type_comment": null}}, {"_type": "...
def conv_bn_layer(input, ch_out, filter_size, stride, padding, active_type=paddle.activation.Relu(), ch_in=None): tmp = paddle.layer.img_conv( input=input, filter_size=filter_size, num...
19,013
[ 0.039202965795993805, -0.031117942184209824, 0.0453607477247715, 0.002008035546168685, 0.014912638813257217, 0.02721644751727581, 0.017204180359840393, 0.0018846449675038457, 0.0002801995724439621, -0.006093146745115519, 0.01968374289572239, 0.03003680519759655, -0.02869713492691517, 0.024...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "input", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ch_out", "annotation": null, "type_comment": null}}, {"_type": "...
def bottleneck(input, ch_out, stride): short = shortcut(input, ch_out * 4, stride) conv1 = conv_bn_layer(input, ch_out, 1, stride, 0) conv2 = conv_bn_layer(conv1, ch_out, 3, 1, 1) conv3 = conv_bn_layer(conv2, ch_out * 4, 1, 1, 0, paddle.activation.Linear()) return paddle.la...
19,014
[ 0.010799729265272617, -0.02455054596066475, 0.049561548978090286, -0.022373856976628304, 0.024404039606451988, -0.012903165072202682, 0.013415942899882793, 0.01564495638012886, -0.03625025227665901, -0.0026816187892109156, 0.01776932179927826, -0.011040420271456242, -0.048389483243227005, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "input", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "class_dim", "annotation": null, "type_comment": null}}, {"_type"...
def resnet_cifar10(input, class_dim, depth=32): # depth should be one of 20, 32, 44, 56, 110, 1202 assert (depth - 2) % 6 == 0 n = (depth - 2) / 6 nStages = {16, 64, 128} conv1 = conv_bn_layer( input, ch_in=3, ch_out=16, filter_size=3, stride=1, padding=1) res1 = layer_warp(basicblock, c...
19,015
[ 0.003736391430720687, -0.0266343355178833, 0.01860388182103634, -0.019038865342736244, 0.010651503689587116, -0.010166330263018608, 0.008314864709973335, 0.015927065163850784, -0.036761630326509476, 0.007952379062771797, 0.035177845507860184, -0.002569466130807996, -0.04450209438800812, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "input", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "class_dim", "annotation": null, "type_comment": null}}, {"_type"...
def resnet_imagenet(input, class_dim, depth=50): cfg = { 18: ([2, 2, 2, 1], basicblock), 34: ([3, 4, 6, 3], basicblock), 50: ([3, 4, 6, 3], bottleneck), 101: ([3, 4, 23, 3], bottleneck), 152: ([3, 8, 36, 3], bottleneck) } stages, block_func = cfg[depth] conv1 = co...
19,016
[ -0.0019218208035454154, -0.0007937955670058727, -0.013161735609173775, -0.02685362845659256, -0.030380329117178917, 0.01750672236084938, -0.02609296888113022, -0.0359124056994915, 0.03176334872841835, -0.020872069522738457, 0.033907029777765274, 0.0013261140557006001, 0.021229349076747894, ...
14
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 0}}, "targets": [{"_type": "Name", "_fields": {"id": "NAME", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type"...
class ServiceName(Converter, object): NAME = 0 PROVIDER = 1 REFERENCE = 2 EDITREFERENCE = 3 NUMBER = 4 def __init__(self, type): Converter.__init__(self, type) if type == "Provider": self.type = self.PROVIDER elif type == "Reference": self.type = self.REFERENCE elif type == "EditReference": sel...
19,017
[ -0.021519673988223076, -0.0250568650662899, -0.029144756495952606, -0.012020094320178032, -0.013343892991542816, 0.011321128346025944, 0.028763502836227417, -0.005861781537532806, 0.0073391408659517765, -0.0003241652448195964, 0.015440789982676506, -0.011554116383194923, 0.02997080609202385,...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "type", "annotation": null, "type_comment": null}}], "kwarg": null...
def __init__(self, type): Converter.__init__(self, type) if type == "Provider": self.type = self.PROVIDER elif type == "Reference": self.type = self.REFERENCE elif type == "EditReference": self.type = self.EDITREFERENCE elif type == "Number": self.type = self.NUMBER else: self.type = self.NA...
19,018
[ -0.0038544035051018, -0.000047584664571331814, -0.011349240317940712, -0.027271004393696785, -0.039628542959690094, 0.0011130872881039977, -0.025230955332517624, 0.004897877108305693, 0.027857225388288498, -0.007362936623394489, 0.028208957985043526, -0.011237857863307, 0.013459635898470879,...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def getText(self): service = self.source.service if isinstance(service, iPlayableServicePtr): info = service and service.info() ref = None else: # reference info = service and self.source.info ref = service if not info: return "" if self.type == self.NAME: name = ref and info.getName(ref) ...
19,019
[ 0.003131101606413722, 0.057773638516664505, 0.031576331704854965, -0.037973012775182724, -0.03375701978802681, 0.017256494611501694, -0.026051927357912064, -0.03916512057185173, 0.00873001292347908, 0.02718588523566723, 0.04044445604085922, -0.03523988649249077, 0.020978199318051338, 0.024...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_agenttools_InspectionAgent_get_indicators_01(): staff = Staff("c'8 d'8 e'8 f'8") slur = Slur() attach(slur, staff.select_leaves()) command_1 = indicatortools.LilyPondCommand('slurDotted') attach(command_1, staff[0]) command_2 = indicatortools.LilyPondCommand('slurUp') attach(comman...
19,020
[ 0.012375119142234325, 0.05234760046005249, 0.031290166079998016, -0.033686257898807526, -0.029063206166028976, 0.022650131955742836, -0.02272060513496399, -0.017294159159064293, 0.01990167237818241, 0.017773376777768135, 0.04851384833455086, -0.04172021895647049, 0.024468345567584038, 0.00...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_agenttools_InspectionAgent_get_indicators_03(): staff = Staff("c'8 d'8 e'8 f'8") clef = Clef('treble') attach(clef, staff) dynamic = Dynamic('p') attach(dynamic, staff[0]) assert systemtools.TestManager.compare( staff, r''' \new Staff { \clef "trebl...
19,021
[ 0.00733468821272254, 0.05956655740737915, 0.018121866509318352, -0.041014984250068665, -0.033665478229522705, 0.01702536642551422, -0.02865714579820633, -0.03796256706118584, 0.009705496951937675, 0.012669007293879986, 0.035502854734659195, -0.02619743160903454, 0.025071298703551292, 0.024...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_agenttools_InspectionAgent_get_indicators_02(): staff = Staff("c'8 d'8 e'8 f'8") slur = Slur() attach(slur, staff.select_leaves()) comment = indicatortools.LilyPondComment('beginning of note content') attach(comment, staff[0]) command = indicatortools.LilyPondCommand('slurDotted') ...
19,022
[ 0.019963687285780907, 0.05100714787840843, 0.03059854917228222, -0.023149840533733368, -0.024183187633752823, 0.03519120067358017, -0.031230038031935692, -0.014696488156914711, 0.013519621454179287, 0.014997881837189198, 0.051409006118774414, -0.04736173152923584, 0.018801171332597733, 0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_agenttools_InspectionAgent_get_indicators_04(): staff = Staff("c'8 d'8 e'8 f'8") clef = Clef('treble') attach(clef, staff) dynamic = Dynamic('p') attach(dynamic, staff[0]) assert systemtools.TestManager.compare( staff, r''' \new Staff { \clef "trebl...
19,023
[ 0.01814562827348709, 0.06356934458017349, 0.035655032843351364, -0.052037790417671204, -0.05842653661966324, 0.008595646359026432, -0.00400290684774518, -0.05482126772403717, 0.011418888345360756, -0.011193559505045414, 0.036900971084833145, -0.01784077100455761, 0.03350777551531792, -0.00...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_agenttools_InspectionAgent_get_indicators_05(): staff = Staff("c'8 d'8 e'8 f'8") annotation_1 = indicatortools.Annotation('annotation 1') attach(annotation_1, staff[0]) annotation_2 = indicatortools.Annotation('annotation 2') attach(annotation_2, staff[0]) assert systemtools.TestManag...
19,024
[ 0.009551738388836384, 0.036285463720560074, 0.0188946183770895, -0.03887529671192169, -0.023057838901877403, 0.012447891756892204, -0.022013554349541664, -0.03455891087651253, 0.03127289190888405, 0.010707414709031582, 0.035589274019002914, -0.024283135309815407, 0.020217381417751312, 0.00...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_agenttools_InspectionAgent_get_indicators_06(): staff = Staff("c'8 d'8 e'8 f'8") comment_1 = indicatortools.LilyPondComment('comment 1') attach(comment_1, staff[0]) comment_2 = indicatortools.LilyPondComment('comment 2') attach(comment_2, staff[0]) assert systemtools.TestManager.compa...
19,025
[ -0.009368506260216236, 0.038969893008470535, 0.012192598544061184, -0.01388834323734045, -0.05421224981546402, 0.038144584745168686, -0.01835015043616295, -0.038789354264736176, 0.016132142394781113, -0.0040040211752057076, 0.031619515269994736, -0.025765003636479378, 0.009394297376275063, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_agenttools_InspectionAgent_get_indicators_07(): note = Note("c'4") stem_tremolo = indicatortools.StemTremolo(16) attach(stem_tremolo, note) stem_tremolos = inspect_(note).get_indicators(indicatortools.StemTremolo) assert stem_tremolos[0] is stem_tremolo
19,026
[ 0.08702827990055084, 0.010530642233788967, 0.0075873639434576035, 0.03841172158718109, -0.059373605996370316, -0.029333390295505524, -0.02778720110654831, 0.0035479485522955656, 0.013175727799534798, 0.027544230222702026, 0.01770384982228279, -0.07532142847776413, -0.021381566300988197, 0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "apps", "annotation": {"_type": "Name", "_fields": {"id": "StateApps", "ctx": {"_type": "Load", "_fields": {}}}}, "type_comment": null}}, {"_type": "arg",...
def remove_name_illegal_chars(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") for user in UserProfile.objects.all(): stripped = [] for char in user.full_name: if (char not in NAME_INVALID_CHARS) and (category(char)[...
19,027
[ 0.020373573526740074, 0.013690007850527763, 0.05764440447092056, -0.042340006679296494, -0.0013116899644955993, -0.0030834805220365524, 0.0053032636642456055, 0.009384973905980587, -0.03848700225353241, -0.008647737093269825, -0.04920653626322746, 0.0005182857275940478, -0.06255213916301727,...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class DetermineKeysize(unittest.TestCase): def runTest(self): with open("../data/6.txt") as f: b64 = f.read() b = base64.b64decode(b64) keysize, _ = crypto.determine_keysize(b) self.assertEqual(29, keysize)
19,028
[ -0.03256021440029144, 0.01687411032617092, 0.04549629986286163, -0.041404273360967636, -0.0025836420245468616, 0.01859012246131897, 0.01339808851480484, 0.03680624067783356, 0.039050258696079254, 0.012144080363214016, -0.013057085685431957, 0.040700268000364304, -0.013486089184880257, -0.0...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_vnc(self): (status, output) = self.target.run('x11vnc -display :0 -bg -o x11vnc.log') self.assertEqual(status, 0, msg="x11vnc server failed to start: %s" % output) port = re.search('PORT=[0-9]*', output) self.assertTrue(port, msg="Listening port not specified in command output: ...
19,029
[ -0.007637550588697195, 0.0052805072627961636, 0.04560604318976402, -0.050965726375579834, 0.019039060920476913, 0.028406327590346336, 0.01147459726780653, -0.002244367962703109, 0.011255337856709957, -0.0030498432461172342, -0.0001815745490603149, 0.019039060920476913, -0.0002811169833876192...
14
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class VNCTest(oeRuntimeTest): @testcase(213) @skipUnlessPassed('test_ssh') def test_vnc(self): (status, output) = self.target.run('x11vnc -display :0 -bg -o x11vnc.log') self.assertEqual(status, 0, msg="x11vnc server failed to start: %s" % output) port = re.search('PORT=[0-9]*', out...
19,030
[ 0.0381765253841877, 0.022614119574427605, 0.07207338511943817, -0.06531346589326859, -0.0381765253841877, 0.007094268221408129, -0.01857762038707733, 0.003592727007344365, -0.017726551741361618, 0.0028769171331077814, 0.05174499377608299, -0.016316208988428116, 0.016109520569443703, -0.033...
13
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "target", "annotation":...
class MachCommands(CommandBase): @Command('build', description='Build Servo', category='build') @CommandArgument('--target', '-t', default=None, help='Cross compile for given target platform') @CommandArgument('--release', '-r', ...
19,031
[ 0.04175281152129173, 0.0405658558011055, 0.05897526070475578, -0.05590314790606499, -0.054553281515836716, -0.015279107727110386, 0.025042377412319183, 0.019165797159075737, -0.029813461005687714, 0.016838438808918, 0.004939818289130926, -0.012963386252522469, -0.01235827337950468, -0.0534...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "target", "annotation": null, "type_comment": null}}, {"_type": "a...
def build(self, target=None, release=False, dev=False, jobs=None, features=None, android=None, verbose=False, debug_mozjs=False, params=None): if android is None: android = self.config["build"]["android"] features = features or [] opts = params or [] base_path...
19,032
[ 0.049053218215703964, 0.028507493436336517, 0.06403295695781708, 0.007435422390699387, -0.04440683498978615, -0.002056992379948497, 0.03368627279996872, 0.039712052792310715, -0.017351334914565086, 0.035259269177913666, 0.03806645795702934, 0.011694606393575668, -0.015330642461776733, -0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "jobs", "annotation": null, "type_comment": null}}, {"_type": "arg...
def build_cef(self, jobs=None, verbose=False, release=False): self.ensure_bootstrapped() ret = None opts = [] if jobs is not None: opts += ["-j", jobs] if verbose: opts += ["-v"] if release: opts += ["--release"] build_start =...
19,033
[ -0.00220227288082242, 0.047754235565662384, 0.0676538273692131, 0.0008129747002385557, -0.03898695111274719, -0.013091206550598145, 0.005345177836716175, 0.027974093332886696, -0.007268247194588184, 0.002221682807430625, 0.01688956841826439, 0.013963157311081886, -0.011114386841654778, -0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "jobs", "annotation": null, "type_comment": null}}, {"_type": "arg...
def build_gonk(self, jobs=None, verbose=False, release=False): self.ensure_bootstrapped() ret = None opts = [] if jobs is not None: opts += ["-j", jobs] if verbose: opts += ["-v"] if release: opts += ["--release"] opts += ["--...
19,034
[ 0.024176737293601036, 0.027209818363189697, 0.07354123890399933, -0.04470498487353325, -0.03573761507868767, -0.02936374582350254, 0.012231231667101383, 0.011110309511423111, 0.0000911778915906325, 0.028770318254828453, 0.029187915846705437, 0.020846940577030182, -0.0019355126423761249, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "jobs", "annotation": null, "type_comment": null}}, {"_type": "arg...
def build_tests(self, jobs=None, verbose=False, release=False): self.ensure_bootstrapped() args = ["cargo", "test", "--no-run"] if is_headless_build(): args += ["--no-default-features", "--features", "headless"] if release: args += ["--release"] return cal...
19,035
[ 0.032178353518247604, 0.049889277666807175, 0.03367176279425621, -0.019951045513153076, -0.032995060086250305, -0.011282257735729218, 0.031104961410164833, 0.03145498037338257, 0.00818459503352642, 0.016089176759123802, 0.021281113848090172, 0.00869212206453085, -0.0012826713500544429, -0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "manifest_path", "annotation": null, "type_comment": null}}, {"_ty...
def clean(self, manifest_path, params, verbose=False): self.ensure_bootstrapped() opts = [] if manifest_path: opts += ["--manifest-path", manifest_path] if verbose: opts += ["-v"] opts += params return call(["cargo", "clean"] + opts, ...
19,036
[ 0.03419891744852066, 0.055640168488025665, 0.05135657638311386, -0.03263912722468376, -0.03592166677117348, -0.006530153565108776, -0.0006183857913129032, -0.0033727488480508327, -0.004789943341165781, 0.054802075028419495, -0.004385446198284626, -0.033547066152095795, 0.007653433363884687, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}, {"_type": "arg...
def load_model(self, path, postprocess = None): logger.info("Loading model:" + path + "...") if postprocess: self.scene = pyassimp.load(path, processing=postprocess) else: self.scene = pyassimp.load(path) logger.info("Done.") scene = self.scene #...
19,037
[ 0.0594710148870945, -0.024661414325237274, 0.018213551491498947, -0.05043071135878563, -0.028494680300354958, 0.017415877431631088, 0.001737987156957388, 0.016152894124388695, 0.00002514368861739058, -0.027497587725520134, 0.022888805717229843, -0.030887702479958534, -0.030511023476719856, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def cycle_cameras(self): self.current_cam_index if not self.scene.cameras: return None self.current_cam_index = (self.current_cam_index + 1) % len(self.scene.cameras) cam = self.scene.cameras[self.current_cam_index] logger.info("Switched to camera " + str(cam)) ...
19,038
[ -0.02180752530694008, -0.012720162980258465, 0.05006621778011322, 0.009542801417410374, -0.027176355943083763, -0.02934103272855282, 0.03499920293688774, -0.01408112421631813, 0.011937878094613552, 0.003614048007875681, -0.03148427978157997, -0.03594223037362099, 0.015356355346739292, -0.0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def set_default_camera(self): if not self.using_fixed_cam: glLoadIdentity() gluLookAt(0.,0.,3., 0.,0.,-5., 0.,1.,0.)
19,039
[ -0.018507719039916992, -0.00021152569388505071, 0.0671679675579071, -0.012375377118587494, -0.032344233244657516, -0.04465319588780403, 0.030063975602388382, -0.0186405498534441, -0.012652107514441013, 0.008169077336788177, -0.0033456687815487385, -0.030506744980812073, 0.029311269521713257,...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "camera", "annotation": null, "type_comment": null}}], "kwarg": nu...
def set_camera(self, camera): if not camera: return self.using_fixed_cam = True znear = camera.clipplanenear zfar = camera.clipplanefar aspect = camera.aspect fov = camera.horizontalfov glMatrixMode(GL_PROJECTION) glLoadIdentity() ...
19,040
[ -0.0012386961607262492, 0.001369370031170547, 0.06091725081205368, -0.041815660893917084, 0.007738371379673481, -0.04609619826078415, 0.0010925577953457832, -0.021674862131476402, 0.01806238666176796, 0.030854513868689537, 0.002045936416834593, -0.03300715610384941, -0.0041877515614032745, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class IpRange(object): def __init__(self): self.default_range_file = os.path.join(current_path, "ip_range.txt") self.user_range_file = os.path.join(config.DATA_PATH, "ip_range.txt") self.load_ip_range() def load_range_content(self): if os.path.isfile(self.user_range_fil...
19,041
[ -0.010092013515532017, 0.03821980953216553, 0.020030580461025238, 0.006663089152425528, 0.011059901677072048, 0.03935294970870018, 0.006338492501527071, -0.00004412489215610549, -0.0009619871852919459, 0.015533437952399254, 0.027218926697969437, -0.02929634600877762, -0.01926335133612156, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def do_motion(self): gl_time = glutGet(GLUT_ELAPSED_TIME) self.angle = (gl_time - self.prev_time) * 0.1 self.prev_time = gl_time # Compute FPS self.frames += 1 if gl_time - self.prev_fps_time >= 1000: current_fps = self.frames * 1000 / (gl_time - self.prev...
19,042
[ 0.014032267965376377, -0.02443651109933853, 0.059733692556619644, -0.032394763082265854, -0.02745596505701542, -0.05589500814676285, -0.02218947559595108, -0.006758661475032568, 0.013751388527452946, 0.03592916205525398, 0.013213036581873894, -0.02773684449493885, -0.0025761909782886505, -...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def load_ip_range(self): self.ip_range_map = {} self.ip_range_list = [] self.ip_range_index = [] self.candidate_amount_ip = 0 content = self.load_range_content() lines = content.splitlines() for line in lines: if len(line) == 0 or line[0] == '#': ...
19,043
[ 0.022879451513290405, 0.015300771221518517, 0.02336484007537365, -0.021158529445528984, 0.0160509180277586, -0.046641428023576736, 0.0012775923823937774, -0.024490060284733772, 0.027336202561855316, 0.007120870985090733, 0.009012782946228981, 0.007242218125611544, 0.01944863796234131, -0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def load_range_content(self): if os.path.isfile(self.user_range_file): self.range_file = self.user_range_file else: self.range_file = self.default_range_file xlog.info("load ip range file:%s", self.range_file) fd = open(self.range_file, "r") if n...
19,044
[ 0.005378759000450373, -0.041315268725156784, 0.041040901094675064, 0.01166064664721489, 0.013638383708894253, -0.04565943405032158, -0.018062569200992584, 0.027802638709545135, 0.028557151556015015, -0.0018191179260611534, -0.004364168271422386, 0.008373944088816643, -0.028099870309233665, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def get_ip(self): #return self.get_real_random_ip() while True: index = random.randint(0, len(self.ip_range_list) - 1) ip_range = self.ip_range_list[index] #logging.debug("random.randint %d - %d", ip_range[0], ip_range[1]) if ip_range[1] == ip_range[0]: ...
19,045
[ 0.024646930396556854, -0.04200916737318039, 0.013766438700258732, 0.04261428490281105, 0.0178277138620615, -0.037470780313014984, 0.015127955004572868, 0.027951804921030998, 0.02076020836830139, 0.01899140141904354, 0.0038779929745942354, -0.003898357506841421, -0.04582606628537178, -0.030...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def get_real_random_ip(self): while True: ip_int = random.randint(0, 4294967294) add_last_byte = ip_int % 255 if add_last_byte == 0 or add_last_byte == 255: continue return ip_int
19,046
[ 0.031224453821778297, -0.04356951639056206, 0.03859202191233635, -0.008063758723437786, 0.011402187868952751, -0.05679166689515114, 0.01117195188999176, -0.013529134914278984, 0.0011340518249198794, 0.00837074127048254, 0.011122615076601505, -0.013331789523363113, -0.01953721046447754, -0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_choicefield_render_form(self): class ChoiceBlock(blocks.FieldBlock): field = forms.ChoiceField(choices=( ('choice-1', "Choice 1"), ('choice-2', "Choice 2"), )) block = ChoiceBlock() html = block.render_form('choice-2') se...
19,047
[ 0.02196883037686348, -0.04743636026978493, 0.03668268769979477, -0.008226237259805202, 0.03258298337459564, -0.04325079917907715, -0.000023309014068217948, -0.023524999618530273, 0.01153712347149849, 0.011150764301419258, 0.009610692039132118, -0.013136222958564758, -0.0161090437322855, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_choicefield_render(self): class ChoiceBlock(blocks.FieldBlock): field = forms.ChoiceField(choices=( ('choice-1', "Choice 1"), ('choice-2', "Choice 2"), )) block = ChoiceBlock() html = block.render('choice-2') self.assertE...
19,048
[ 0.043133992701768875, -0.03916739672422409, 0.01624569110572338, -0.004324236884713173, 0.023907935246825218, -0.04612519219517708, -0.0034328370820730925, -0.00109731568954885, 0.01620234176516533, 0.01075640320777893, 0.020840870216488838, -0.014663389883935452, 0.0011020571691915393, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_choicefield_searchable_content(self): class ChoiceBlock(blocks.FieldBlock): field = forms.ChoiceField(choices=( ('choice-1', "Choice 1"), ('choice-2', "Choice 2"), )) block = ChoiceBlock() content = block.get_searchable_content("c...
19,049
[ 0.005878324154764414, -0.05126629397273064, 0.011951576918363571, -0.00608238996937871, 0.031992703676223755, -0.06598342210054398, 0.011714007705450058, -0.011220593936741352, 0.036061841994524, 0.027168212458491325, 0.01792127452790737, -0.017202474176883698, -0.03486790508031845, 0.0228...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_render_required_choice_block(self): block = blocks.ChoiceBlock(choices=[('tea', 'Tea'), ('coffee', 'Coffee')]) html = block.render_form('coffee', prefix='beverage') self.assertIn('<select id="beverage" name="beverage" placeholder="">', html) # blank option should still be render...
19,050
[ 0.015203004702925682, -0.031391389667987823, -0.0009912452660501003, -0.005308147985488176, 0.019050678238272667, -0.04307518154382706, 0.0010630959877744317, -0.015332043170928955, 0.04485825076699257, 0.0542428195476532, 0.024611037224531174, -0.003032389562577009, -0.0433332584798336, 0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_validate_non_required_choice_block(self): block = blocks.ChoiceBlock(choices=[('tea', 'Tea'), ('coffee', 'Coffee')], required=False) self.assertEqual(block.clean('coffee'), 'coffee') with self.assertRaises(ValidationError): block.clean('whisky') self.assertEqual(bl...
19,051
[ 0.011234620586037636, -0.034197431057691574, 0.01479538343846798, -0.003810486989095807, 0.0173219982534647, -0.04355178028345108, 0.0033139779698103666, -0.024561041966080666, 0.042987700551748276, 0.0533997006714344, 0.031071480363607407, 0.0014219550648704171, -0.06176690757274628, 0.04...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_validate_required_choice_block(self): block = blocks.ChoiceBlock(choices=[('tea', 'Tea'), ('coffee', 'Coffee')]) self.assertEqual(block.clean('coffee'), 'coffee') with self.assertRaises(ValidationError): block.clean('whisky') with self.assertRaises(ValidationError)...
19,052
[ -0.005417841952294111, -0.04486670717597008, 0.026940688490867615, -0.0076392218470573425, 0.010280339047312737, -0.028722958639264107, 0.00504653574898839, -0.02584291249513626, 0.03631697595119476, 0.021051447838544846, 0.011810766533017159, -0.02169719897210598, -0.03295907750725746, 0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_named_groups_without_blank_option(self): block = blocks.ChoiceBlock( choices=[ ('Alcoholic', [ ('gin', 'Gin'), ('whisky', 'Whisky'), ]), ('Non-alcoholic', [ ('tea', 'Tea'), ...
19,053
[ 0.006232089828699827, -0.057692743837833405, 0.007780929561704397, -0.0022620405070483685, 0.025981325656175613, -0.05504808574914932, 0.03046255372464657, -0.004863846115767956, 0.03516416996717453, 0.02026347443461418, 0.00389658659696579, -0.02688736654818058, -0.022577552124857903, 0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_render_choice_block_with_existing_blank_choice(self): block = blocks.ChoiceBlock( choices=[('tea', 'Tea'), ('coffee', 'Coffee'), ('', 'No thanks')], required=False) html = block.render_form(None, prefix='beverage') self.assertIn('<select id="beverage" name="bever...
19,054
[ -0.004679515026509762, -0.033547643572092056, 0.040765468031167984, 0.008507631719112396, 0.01894679293036461, -0.019264480099081993, 0.004018728155642748, 0.006461733486503363, 0.013990892097353935, 0.0155411995947361, 0.041858308017253876, -0.03898642584681511, -0.031743187457323074, 0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_subclassing(self): class BeverageChoiceBlock(blocks.ChoiceBlock): choices = [ ('tea', 'Tea'), ('coffee', 'Coffee'), ] block = BeverageChoiceBlock(required=False) html = block.render_form('tea', prefix='beverage') self.asse...
19,055
[ -0.007854429073631763, -0.03974657133221626, 0.02244310826063156, -0.007973035797476768, 0.018344571813941002, -0.02735871449112892, 0.0033770089503377676, -0.01614375039935112, 0.03932485729455948, 0.02701607160270214, 0.011425822041928768, -0.03170764446258545, -0.0378752164542675, 0.018...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_named_groups_with_blank_option(self): block = blocks.ChoiceBlock( choices=[ ('Alcoholic', [ ('gin', 'Gin'), ('whisky', 'Whisky'), ]), ('Non-alcoholic', [ ('tea', 'Tea'), ...
19,056
[ 0.01892431639134884, -0.001737732789479196, 0.030615337193012238, -0.007581742014735937, 0.040155597031116486, -0.020726632326841354, -0.02922154776751995, -0.046091221272945404, 0.062432218343019485, 0.00412429915741086, 0.03996334969997406, -0.007695888634771109, -0.024439401924610138, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class TestRawHTMLBlock(unittest.TestCase): def test_get_default_with_fallback_value(self): default_value = blocks.RawHTMLBlock().get_default() self.assertEqual(default_value, '') self.assertIsInstance(default_value, SafeData) def test_get_default_with_none(self): default_value =...
19,057
[ 0.04741129279136658, 0.006746636237949133, -0.01120588555932045, 0.011390725150704384, 0.022296246141195297, -0.02506883628666401, -0.009796485304832458, -0.026801705360412598, 0.01650846377015114, 0.04304446280002594, 0.05415792763233185, 0.009057127870619297, -0.04036429151892662, 0.0074...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_clean_required_field(self): block = blocks.RawHTMLBlock() result = block.clean(mark_safe('<blink>BÖÖM</blink>')) self.assertEqual(result, '<blink>BÖÖM</blink>') self.assertIsInstance(result, SafeData) with self.assertRaises(ValidationError): block.clean(mark...
19,058
[ 0.012278675101697445, -0.00887528620660305, 0.0470406748354435, -0.05635172501206398, 0.007016385439783335, -0.004343871027231216, 0.029698286205530167, -0.03183850273489952, 0.004898231476545334, 0.027536004781723022, 0.01498152781277895, -0.025131016969680786, 0.0017954666400328279, -0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class TestMeta(unittest.TestCase): def test_set_template_with_meta(self): class HeadingBlock(blocks.CharBlock): class Meta: template = 'heading.html' block = HeadingBlock() self.assertEqual(block.meta.template, 'heading.html') def test_set_template_with_cons...
19,059
[ 0.03517903760075569, 0.011097431182861328, -0.013092678040266037, 0.011573637835681438, 0.02727038413286209, -0.024244360625743866, -0.012996231205761433, -0.03286430984735489, 0.028138406574726105, 0.04938085377216339, 0.054010309278964996, 0.0006713613984175026, -0.030549582093954086, 0....
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_clean_nonrequired_field(self): block = blocks.RawHTMLBlock(required=False) result = block.clean(mark_safe('<blink>BÖÖM</blink>')) self.assertEqual(result, '<blink>BÖÖM</blink>') self.assertIsInstance(result, SafeData) result = block.clean(mark_safe('')) self.ass...
19,060
[ 0.027899857610464096, 0.012395069934427738, 0.056894686073064804, -0.01891014724969864, 0.010692390613257885, -0.015241994522511959, 0.025293827056884766, -0.03543325513601303, 0.013336745090782642, 0.010730714537203312, 0.04430251941084862, -0.019950369372963905, -0.009060883894562721, -0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_meta_multiple_inheritance(self): class HeadingBlock(blocks.CharBlock): class Meta: template = 'heading.html' test = 'Foo' class SubHeadingBlock(HeadingBlock): class Meta: template = 'subheading.html' block = SubHe...
19,061
[ -0.004079513717442751, -0.009967920370399952, -0.010684958659112453, -0.0202726311981678, -0.005342479329556227, -0.015351139940321445, 0.012167924083769321, -0.038828715682029724, 0.028029682114720345, 0.024357575923204422, 0.030376354232430458, 0.001529138651676476, -0.009603968821465969, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_initialisation_from_subclass(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = LinkBlock() self.assertEqual(list(block.child_blocks.keys()), ['title', 'link'])
19,062
[ 0.003972984384745359, -0.012724434956908226, 0.0023565783631056547, -0.013606110587716103, -0.0038695780094712973, 0.0015715057961642742, 0.012963902205228806, -0.045237597078084946, 0.024229763075709343, 0.026994524523615837, 0.020518016070127487, -0.0022395658306777477, -0.0209534112364053...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_initialisation_from_subclass_with_extra(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = LinkBlock([ ('classname', blocks.CharBlock()) ]) self.assertEqual(list(block.child_blocks.keys())...
19,063
[ -0.00014110284973867238, -0.010195461101830006, 0.018970880657434464, -0.02997620962560177, -0.01743989624083042, 0.008253997191786766, 0.013235239312052727, -0.03945055603981018, 0.011859573423862457, 0.030486537143588066, 0.0286005437374115, -0.02405196987092495, -0.01994716003537178, 0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_initialisation_with_multiple_subclassses(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() class StyledLinkBlock(LinkBlock): classname = blocks.CharBlock() block = StyledLinkBlock() self.assertE...
19,064
[ -0.012716695666313171, -0.04271150752902031, 0.006807578727602959, 0.0072798472829163074, 0.0011518745450302958, -0.05386165529489517, -0.015481194481253624, -0.023751653730869293, 0.016840405762195587, 0.017543049529194832, 0.033796001225709915, 0.00034142282675020397, -0.011622413992881775...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_render(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = LinkBlock() html = block.render({ 'title': "Wagtail site", 'link': 'http://www.wagtail.io', }) self.assertIn('...
19,065
[ 0.003994121216237545, -0.012581761926412582, -0.01366852130740881, -0.030653338879346848, 0.008425187319517136, -0.03163926675915718, 0.02375185675919056, -0.013679725117981434, 0.014027039520442486, 0.03255796805024147, 0.0156851876527071, -0.009864863008260727, -0.031572043895721436, -0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_initialisation_with_mixins(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() class StylingMixin(blocks.StructBlock): classname = blocks.CharBlock() class StyledLinkBlock(LinkBlock, StylingMixin): ...
19,066
[ -0.008269846439361572, -0.02502378448843956, -0.010853026062250137, 0.010381687432527542, -0.01893923431634903, -0.0663546547293663, -0.010975451208651066, -0.04003315791487694, 0.004496078472584486, 0.0024745266418904066, 0.010277626104652882, -0.004287955351173878, -0.0045205638743937016, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_render_unknown_field(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = LinkBlock() html = block.render({ 'title': "Wagtail site", 'link': 'http://www.wagtail.io', 'image': ...
19,067
[ -0.0011853150790557265, -0.034382160753011703, -0.001415083883330226, 0.0057420311495661736, -0.009243269450962543, -0.06185521185398102, -0.004192732740193605, -0.01800803653895855, 0.010713789612054825, 0.017797961831092834, 0.027122925966978073, 0.005727442447096109, -0.003238645615056157...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_render_form(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = LinkBlock() html = block.render_form({ 'title': "Wagtail site", 'link': 'http://www.wagtail.io', }, prefix='mylink...
19,068
[ -0.0016503537772223353, -0.026545992121100426, -0.02568061649799347, 0.01568201556801796, 0.02535317651927471, -0.058190684765577316, 0.0012688282877206802, -0.0221138633787632, 0.03110675700008869, 0.0042596375569701195, 0.007455096580088139, 0.0224646907299757, -0.004905745852738619, 0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_render_form_uses_default_value(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock(default="Torchbox") link = blocks.URLBlock(default="http://www.torchbox.com") block = LinkBlock() html = block.render_form({}, prefix='mylink') self.asse...
19,069
[ 0.006193564739078283, -0.015859821811318398, -0.02496519684791565, 0.010978958569467068, -0.022817140445113182, -0.06305740773677826, 0.0026641874574124813, -0.024607187137007713, 0.00719599099829793, 0.006569474469870329, 0.00868173036724329, -0.005417877342551947, -0.0014536677626892924, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_render_form_unknown_field(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = LinkBlock() html = block.render_form({ 'title': "Wagtail site", 'link': 'http://www.wagtail.io', ...
19,070
[ 0.008314496837556362, -0.007651232182979584, -0.026625340804457664, 0.006372078787535429, 0.021591635420918465, -0.03375543653964996, -0.01813318394124508, -0.023474832996726036, 0.005916084628552198, -0.02923102304339409, 0.02719385363161564, 0.024256538599729538, 0.030889185145497322, -0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_media_inheritance(self): class ScriptedCharBlock(blocks.CharBlock): media = forms.Media(js=['scripted_char_block.js']) class LinkBlock(blocks.StructBlock): title = ScriptedCharBlock(default="Torchbox") link = blocks.URLBlock(default="http://www.torchbox.com"...
19,071
[ 0.011963666416704655, -0.014552817679941654, 0.02761017717421055, 0.034819625318050385, 0.03539995104074478, -0.014441216364502907, -0.029775243252515793, -0.007800935301929712, 0.015099664218723774, 0.0009702343377284706, 0.033078644424676895, -0.002195756882429123, 0.007047626189887524, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_html_declaration_inheritance(self): class CharBlockWithDeclarations(blocks.CharBlock): def html_declarations(self): return '<script type="text/x-html-template">hello world</script>' class LinkBlock(blocks.StructBlock): title = CharBlockWithDeclarations(d...
19,072
[ 0.01841084472835064, -0.047589633613824844, -0.028488237410783768, 0.008093515411019325, 0.023549027740955353, -0.006794339045882225, -0.013190732337534428, -0.036072615534067154, 0.04330586642026901, -0.015168757177889347, 0.05112433061003685, 0.009708707220852375, 0.02713053859770298, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_value_from_datadict(self): block = blocks.StructBlock([ ('title', blocks.CharBlock()), ('link', blocks.URLBlock()), ]) struct_val = block.value_from_datadict({ 'mylink-title': "Torchbox", 'mylink-link': "http://www.torchbox.com" }...
19,073
[ 0.007974796928465366, -0.031190810725092888, -0.031080124899744987, 0.00013169691374059767, -0.005445662885904312, -0.04190504178404808, -0.01900447905063629, -0.004903310444205999, 0.031102262437343597, -0.0006181021453812718, 0.04626600071787834, -0.0007408924284391105, 0.00495035108178854...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_searchable_content(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = LinkBlock() content = block.get_searchable_content({ 'title': "Wagtail site", 'link': 'http://www.wagtail.io', ...
19,074
[ 0.011437725275754929, -0.04444724693894386, -0.03736323490738869, -0.008516800589859486, 0.024904724210500717, -0.025113800540566444, -0.014905938878655434, -0.012606094591319561, 0.07275868952274323, 0.031312309205532074, 0.05755758285522461, -0.007871123030781746, -0.020600203424692154, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_clean(self): block = blocks.StructBlock([ ('title', blocks.CharBlock()), ('link', blocks.URLBlock()), ]) value = block.to_python({'title': 'Torchbox', 'link': 'http://www.torchbox.com/'}) clean_value = block.clean(value) self.assertTrue(isinstanc...
19,075
[ -0.009903181344270706, -0.0382169745862484, -0.01474399771541357, 0.006618736777454615, -0.005286681465804577, -0.06894563883543015, -0.019773129373788834, -0.023528363555669785, -0.0012323589762672782, 0.021157803013920784, 0.01568557508289814, 0.003353677922859788, -0.006890132557600737, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def render(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = blocks.ListBlock(LinkBlock()) return block.render([ { 'title': "Wagtail", 'link': 'http://www.wagtail.io', ...
19,076
[ -0.024895908311009407, -0.018440578132867813, 0.013226657174527645, 0.01323794201016426, 0.021950380876660347, -0.035165753215551376, -0.012933232821524143, -0.019162852317094803, 0.039792824536561966, 0.020471975207328796, 0.043471913784742355, -0.0011842766543850303, 0.0020694865379482508,...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_html_declarations(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = blocks.ListBlock(LinkBlock) html = block.html_declarations() self.assertIn('<input id="__PREFIX__-value-title" name="__PREFIX__-val...
19,077
[ -0.00745507562533021, -0.03295121341943741, -0.009036952629685402, 0.016585079953074455, -0.0038534309715032578, -0.06690957397222519, 0.00006936107820365578, -0.005109627731144428, -0.003147333627566695, 0.028681788593530655, 0.009053373709321022, 0.005982670467346907, 0.0077013885602355, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def render_form(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = blocks.ListBlock(LinkBlock) html = block.render_form([ { 'title': "Wagtail", 'link': 'http://www.wagtail.i...
19,078
[ -0.03237827867269516, -0.017291080206632614, 0.015661615878343582, 0.024875709787011147, 0.037489403039216995, -0.04435894638299942, -0.014477615244686604, -0.027103034779429436, 0.04637525975704193, 0.014489338733255863, 0.02431301586329937, -0.002261028392240405, -0.0019767514895647764, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_html_declarations_uses_default(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock(default="Github") link = blocks.URLBlock(default="http://www.github.com") block = blocks.ListBlock(LinkBlock) html = block.html_declarations() self.asser...
19,079
[ 0.008428603410720825, -0.03478330001235008, -0.027056150138378143, -0.007949831895530224, -0.002690305467694998, -0.0435570627450943, -0.01859414577484131, -0.00311479764059186, 0.035250935703516006, 0.0035573828499764204, 0.046496495604515076, -0.007793952710926533, 0.002043129177764058, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_searchable_content(self): class LinkBlock(blocks.StructBlock): title = blocks.CharBlock() link = blocks.URLBlock() block = blocks.ListBlock(LinkBlock()) content = block.get_searchable_content([ { 'title': "Wagtail", 'l...
19,080
[ 0.015032010152935982, -0.01292017288506031, -0.01882857084274292, -0.019777711480855942, -0.0021340828388929367, -0.03492836654186249, -0.014154055155813694, -0.023787830024957657, 0.004790192935615778, 0.021960735321044922, 0.02731151320040226, -0.006080430466681719, -0.005626622587442398, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_ordering_in_form_submission_uses_order_field(self): block = blocks.ListBlock(blocks.CharBlock()) # check that items are ordered by the 'order' field, not the order they appear in the form post_data = {'shoppinglist-count': '3'} for i in range(0, 3): post_data.update...
19,081
[ 0.020321909338235855, -0.023792698979377747, -0.01628696173429489, 0.005899117793887854, 0.015894504263997078, -0.009872743859887123, -0.01676526851952076, -0.030047481879591942, 0.006622710265219212, 0.016507718712091446, 0.03144560754299164, -0.012546356767416, -0.02698141150176525, 0.01...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_ordering_in_form_submission_is_numeric(self): block = blocks.ListBlock(blocks.CharBlock()) # check that items are ordered by 'order' numerically, not alphabetically post_data = {'shoppinglist-count': '12'} for i in range(0, 12): post_data.update({ 's...
19,082
[ 0.046996474266052246, -0.007574853021651506, 0.008678394369781017, 0.023522228002548218, 0.041550736874341965, -0.06285388767719269, 0.014202100224792957, 0.0020991279743611813, 0.011611176654696465, 0.012618757784366608, 0.011053407564759254, -0.022382700815796852, -0.031810782849788666, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_form_render(self): block = blocks.PageChooserBlock() empty_form_html = block.render_form(None, 'page') self.assertIn('<input id="page" name="page" placeholder="" type="hidden" />', empty_form_html) christmas_page = Page.objects.get(slug='christmas') christmas_form_html...
19,083
[ 0.0107355285435915, -0.0187202300876379, 0.007929928600788116, 0.002963833510875702, 0.02305339090526104, -0.04506000876426697, -0.017064865678548813, -0.036271966993808746, 0.034470539540052414, -0.004570511169731617, 0.008483745157718658, -0.004053209908306599, -0.011076339520514011, -0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_can_specify_default(self): class ShoppingListBlock(blocks.StructBlock): shop = blocks.CharBlock() items = blocks.ListBlock(blocks.CharBlock(), default=['peas', 'beans', 'carrots']) block = ShoppingListBlock() # the value here does not specify an 'items' field, s...
19,084
[ 0.050095461308956146, 0.007290294393897057, 0.0021184254437685013, -0.004594404250383377, 0.01893451437354088, -0.03333790972828865, -0.001971290446817875, -0.021946823224425316, 0.03599582985043526, 0.06277753412723541, 0.05649977922439575, -0.022351840510964394, -0.05133582279086113, 0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_clean(self): required_block = blocks.PageChooserBlock() nonrequired_block = blocks.PageChooserBlock(required=False) christmas_page = Page.objects.get(slug='christmas') self.assertEqual(required_block.clean(christmas_page), christmas_page) with self.assertRaises(Validati...
19,085
[ 0.022409504279494286, -0.022397279739379883, -0.014817413873970509, 0.012164461426436901, 0.04281401261687279, -0.04875564947724342, 0.003187822410836816, 0.015392016619443893, 0.03494073450565338, 0.017018020153045654, 0.030270559713244438, -0.029512573033571243, -0.031126350164413452, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_form_response(self): block = blocks.PageChooserBlock() christmas_page = Page.objects.get(slug='christmas') value = block.value_from_datadict({'page': str(christmas_page.id)}, {}, 'page') self.assertEqual(value, christmas_page) empty_value = block.value_from_datadict({'...
19,086
[ 0.006219330243766308, 0.02596450410783291, -0.009853934869170189, -0.043124955147504807, -0.00465783616527915, -0.009049205109477043, 0.01996367797255516, 0.010674651712179184, -0.054657626897096634, 0.06079701706767082, -0.03246628865599632, 0.03295658901333809, -0.01237470842897892, -0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v...
def __init__(self, **kwargs): self._trigger_layout = Clock.create_trigger(self._do_layout, -1) super(TreeView, self).__init__(**kwargs) tvlabel = TreeViewLabel(text='Root', is_open=True, level=0) for key, value in self.root_options.items(): setattr(tvlabel, key, value) ...
19,087
[ 0.03835802525281906, 0.0491427481174469, -0.019846109673380852, -0.006531982682645321, 0.015732349827885628, -0.004491780418902636, 0.0012605336960405111, -0.02131372131407261, -0.0021249791607260704, 0.03818013519048691, 0.02643924206495285, 0.029796959832310677, -0.01496518962085247, -0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null...
def _do_node_load(self, node): gen = self.load_func(self, node) if node: node.is_loaded = True if not gen: return for cnode in gen: self.add_node(cnode, node)
19,088
[ 0.005485559813678265, 0.010523206554353237, 0.02829044871032238, 0.013415290974080563, 0.010572974570095539, 0.007144499570131302, 0.006248672027140856, 0.011678934097290039, -0.00963290873914957, 0.053351495414972305, -0.02802501805126667, 0.007808075286448002, -0.028157733380794525, -0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null...
def _do_open_node(self, node): if self.hide_root and node is self.root: height = 0 else: self.add_widget(node) height = node.height if not node.is_open: return height for cnode in node.nodes: height += self._do_open_node...
19,089
[ -0.008888526819646358, 0.011478003114461899, 0.04687553644180298, -0.025220291689038277, 0.003033601213246584, -0.026882372796535492, -0.008111683651804924, -0.013971125707030296, -0.05164498835802078, 0.058148790150880814, -0.01634380780160427, -0.002727982820942998, -0.04061261937022209, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": {"_type": "arg", "_fields": {"arg": "largs", "annotation": null, "type_comme...
def _do_layout(self, *largs): self.clear_widgets() # display only the one who are is_open self._do_open_node(self.root) # now do layout self._do_layout_node(self.root, 0, self.top) # now iterate for calculating minimum size min_width = min_height = 0 count...
19,090
[ -0.008340339176356792, 0.03752881661057472, 0.01193802710622549, -0.010082205757498741, 0.01866673305630684, 0.01659385673701763, -0.014043460600078106, -0.002272294834256172, -0.06246843934059143, 0.0677211731672287, -0.007119405083358288, 0.03229779005050659, -0.019502393901348114, 0.002...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "arg...
def _do_layout_node(self, node, level, y): if self.hide_root and node is self.root: level -= 1 else: node.x = self.x + self.indent_start + level * self.indent_level node.top = y if node.size_hint_x: node.width = (self.width - (node.x - self...
19,091
[ 0.0388592891395092, 0.00911632925271988, -0.0009758907835930586, 0.014673763886094093, -0.006717014126479626, 0.03623019531369209, 0.03332323208451271, 0.008266683667898178, -0.007160540204495192, -0.0016645584255456924, 0.02558557130396366, 0.028236040845513344, -0.0004555493069346994, 0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "touch", "annotation": null, "type_comment": null}}], "kwarg": nul...
def on_touch_down(self, touch): node = self.get_node_at_pos(touch.pos) if not node: return if node.disabled: return # toggle node or selection ? if node.x - self.indent_start <= touch.x < node.x: self.toggle_node(node) elif node.x <= to...
19,092
[ -0.014589415863156319, -0.015738189220428467, 0.019666992127895355, -0.018322927877306938, 0.026973187923431396, -0.02825981378555298, -0.020608985796570778, -0.04583603888750076, -0.05105146765708923, 0.04778895154595375, -0.0005018701776862144, -0.019816333428025246, -0.007840375415980816,...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class TestApp(App): def build(self): tv = TreeView(hide_root=True) add = tv.add_node root = add(TreeViewLabel(text='Level 1, entry 1', is_open=True)) for x in range(5): add(TreeViewLabel(text='Element %d' % x), root) root2 = add(TreeVi...
19,093
[ -0.006901092361658812, 0.011120001785457134, 0.004811484832316637, -0.04266542196273804, -0.003113146871328354, -0.009883816353976727, -0.009277064353227615, -0.017136484384536743, -0.05584384500980377, 0.0626031756401062, 0.02168428711593151, 0.02349887229502201, -0.008228007704019547, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def build(self): tv = TreeView(hide_root=True) add = tv.add_node root = add(TreeViewLabel(text='Level 1, entry 1', is_open=True)) for x in range(5): add(TreeViewLabel(text='Element %d' % x), root) root2 = add(TreeViewLabel(text='Level 1, entry ...
19,094
[ -0.06676699221134186, -0.014874369837343693, 0.030938688665628433, -0.05006442591547966, 0.0029586474411189556, -0.003028962528333068, 0.021689536049962044, -0.04225402697920799, -0.0025299950502812862, 0.0010506714461371303, -0.01775188371539116, -0.02511875331401825, 0.021895073354244232, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "date_type", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "timestr", "annotation": null, "type_comment": null}}], "kwar...
def _parse_iso8601_with_reso(date_type, timestr): default = date_type(1, 1, 1) result = parse_iso8601(timestr) replace = {} for attr in ['year', 'month', 'day', 'hour', 'minute', 'second']: value = result.get(attr, None) if value is not None: # Note ISO8601 conventions allow...
19,095
[ 0.009909635409712791, 0.0171930231153965, 0.06472144275903702, -0.04003915563225746, -0.020854191854596138, 0.01531236246228218, 0.03447507321834564, -0.011222760193049908, -0.011155990883708, 0.018739838153123856, -0.005308137275278568, -0.032739076763391495, 0.035788197070360184, -0.0791...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "date_sep", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "datetime_sep", "annotation": null, "type_comment": null}}, {"...
def build_pattern(date_sep=r'\-', datetime_sep=r'T', time_sep=r'\:'): pieces = [(None, 'year', r'\d{4}'), (date_sep, 'month', r'\d{2}'), (date_sep, 'day', r'\d{2}'), (datetime_sep, 'hour', r'\d{2}'), (time_sep, 'minute', r'\d{2}'), (time_sep, 'se...
19,096
[ 0.007623587269335985, 0.011485432274639606, 0.008851158432662487, 0.0032006422989070415, 0.01957792043685913, 0.007133612409234047, 0.01038430631160736, -0.02952493727207184, -0.013898426666855812, 0.0008027948206290603, 0.036479417234659195, 0.01223356556147337, 0.013213515281677246, -0.0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def __new__(cls, data, name=None): assert_all_valid_date_type(data) if name is None and hasattr(data, 'name'): name = data.name result = object.__new__(cls) result._data = np.array(data, dtype='O') result.name = name return result
19,097
[ 0.02377924509346485, 0.036833133548498154, -0.033963631838560104, -0.006644546985626221, -0.01453568134456873, 0.015182496048510075, -0.027871817350387573, -0.010819438844919205, 0.010102063417434692, 0.0479818619787693, 0.06472846865653992, -0.032881688326597214, 0.006033013574779034, -0....
14
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "block", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [...
def filter(block): lines = block.filtered.splitlines() for index, line in enumerate(lines): if line.startswith(DOXYGEN_ENTITY_DIRECTIVE): # Remove next lines from the original block. if index > 0: block.filtered = "\n".join(lines[:index-1]) else: ...
19,098
[ 0.003840140998363495, -0.012192989699542522, -0.02203199453651905, -0.03332461416721344, 0.027184726670384407, -0.02638198435306549, -0.013527275994420052, 0.0067473663948476315, 0.05931607633829117, 0.029180731624364853, 0.004659153986722231, -0.031523868441581726, 0.00391065189614892, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment"...
def wrapped(*args, **kwargs): # invoke the wrapped function rv = f(*args, **kwargs) # the wrapped function can return the dictionary alone, # or can also include a status code and/or headers. # here we separate all these items status = None headers = None ...
19,099
[ 0.007263629697263241, 0.03235025703907013, -0.03172146528959274, -0.010044408030807972, 0.005550714209675789, -0.014267070218920708, 0.025758782401680946, 0.0008429063018411398, 0.023005107417702675, 0.016543729230761528, -0.010732825845479965, 0.022896695882081985, 0.01330219954252243, -0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "token", "annotation": null, "type_comment": null}}], "kwarg": n...
def do_incr(parser, token): args = token.split_contents() if len(args) < 2: raise TemplateSyntaxError("'incr' tag requires at least one argument") name = args[1] if not hasattr(parser, '_namedIncrNodes'): parser._namedIncrNodes = {} if not name in parser._namedIncrNodes: pars...
19,100
[ -0.01954268105328083, 0.06125922501087189, -0.047855958342552185, -0.04902536794543266, -0.051274240016937256, 0.04171654209494591, -0.016011955216526985, -0.03290097042918205, -0.01722634583711624, 0.01844073459506035, -0.011637902818620205, -0.03618432208895683, 0.05662655085325241, -0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "model", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [...
def register_snippet(model): if model not in SNIPPET_MODELS: model.get_usage = get_object_usage model.usage_url = get_snippet_usage_url SNIPPET_MODELS.append(model) SNIPPET_MODELS.sort(key=lambda x: x._meta.verbose_name) url_finder_class = type('_SnippetAdminURLFinder', (Sni...