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 |
|---|---|---|---|---|---|
20,301 | [
-0.010467876680195332,
0.02086273394525051,
0.028248142451047897,
0.02332453615963459,
0.0408492349088192,
-0.05161440372467041,
0.020320303738117218,
0.025932379066944122,
-0.031335826963186264,
0.06358961760997772,
0.002019773470237851,
0.0021514694672077894,
0.017284775152802467,
0.0207... | 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": "X", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def _fit_transform(self, X):
self.nbrs_ = NearestNeighbors(self.n_neighbors,
algorithm=self.neighbors_algorithm)
random_state = check_random_state(self.random_state)
X = check_array(X)
self.nbrs_.fit(X)
self.embedding_, self.reconstruction_e... | |
20,302 | [
0.004970574751496315,
-0.004645642824470997,
0.051052309572696686,
-0.008237454108893871,
-0.040982358157634735,
-0.019659822806715965,
0.004136290866881609,
-0.014777067117393017,
0.03306690976023674,
0.061309609562158585,
-0.008781934157013893,
0.013582724146544933,
0.028547139838337898,
... | 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": "List", "_fields": {"c... | def list_addresses():
addresses = []
for line in list_lo0_aliases().split('\n'):
m = RE_LOOPBACK_ADDRESS.match(line)
if m:
addresses.append(m.group(1))
return addresses | |
20,303 | [
0.007617879658937454,
-0.002783573232591152,
0.018928907811641693,
-0.03254358097910881,
-0.014382557012140751,
-0.004720038268715143,
-0.047852471470832825,
0.00322083942592144,
0.062210652977228165,
0.02913077175617218,
0.03927169367671013,
-0.009129267185926437,
0.021049724891781807,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "address", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def remove(address):
if address in list_addresses():
remove_lo0_alias(address)
logging.debug("Removed loopback address '%s'", address)
else:
logging.debug("Loopback address '%s' does not exist", address)
launchd.remove_run_once(address)
return 0 | |
20,304 | [
0.007302022073417902,
0.00035402728826738894,
0.024578701704740524,
-0.011328873224556446,
-0.012360939756035805,
-0.02346908114850521,
-0.017205091193318367,
-0.011829991824924946,
0.051782313734292984,
0.02748996578156948,
0.002724835416302085,
0.01529606617987156,
0.0035794225987046957,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "address", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "survive_reboot", "annotation": null, "type_comment": null}}], ... | def add(address, survive_reboot=True):
if address not in list_addresses():
add_lo0_alias(address)
logging.debug("Added loopback address '%s'", address)
else:
logging.debug("Loopback address '%s' already exists", address)
if survive_reboot:
launchd.add_run_once(address, ['/sb... | |
20,305 | [
0.01708212122321129,
0.03736443817615509,
0.02938557229936123,
-0.051678821444511414,
-0.02841254137456417,
0.010562805458903313,
-0.03245602920651436,
-0.003354258369654417,
0.0017203750321641564,
0.02579616568982601,
0.009535715915262699,
-0.0692366510629654,
-0.0077572292648255825,
-0.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 Extension(extensions.Extension):
def handle_model(self):
self.model.add_to_class('meta_keywords', models.TextField(
_('meta keywords'),
blank=True,
help_text=_('Keywords are ignored by most search engines.')))
self.model.add_to_class('meta_description', mode... | |
20,306 | [
0.056154776364564896,
-0.008825919590890408,
0.01424004603177309,
-0.010587748140096664,
0.027585193514823914,
0.010129113681614399,
0.008350505493581295,
-0.004261946305632591,
0.0024945249315351248,
0.005612681154161692,
0.02572828345000744,
-0.008686092682182789,
-0.027294352650642395,
... | 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": "input_charset", "annotation": null, "type_comment": null}}], "kwa... | def __init__(self, input_charset=DEFAULT_CHARSET):
# RFC 2046, $4.1.2 says charsets are not case sensitive. We coerce to
# unicode because its .lower() is locale insensitive. If the argument
# is already a unicode, we leave it at that, but ensure that the
# charset is ASCII, as the... | |
20,307 | [
0.01762162335216999,
0.053679607808589935,
0.034288838505744934,
-0.037850409746170044,
-0.04022478684782982,
-0.01787768304347992,
-0.051212113350629807,
0.008659502491354942,
0.00482150400057435,
0.03854875639081001,
0.01295433659106493,
-0.0554487518966198,
0.010760363191366196,
-0.0138... | 7 | {"_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": "modeladmin", "annotation": null, "type_comment": null}}], "kwarg"... | def handle_modeladmin(self, modeladmin):
modeladmin.extend_list(
'search_fields',
['meta_keywords', 'meta_description'],
)
modeladmin.add_extension_options(_('Search engine optimization'), {
'fields': ('meta_keywords', 'meta_description'),
'classe... | |
20,308 | [
0.018658259883522987,
0.04497838392853737,
-0.00790467020124197,
-0.033884868025779724,
-0.02192804217338562,
-0.006205031648278236,
-0.03554673492908478,
0.019402863457798958,
0.009048554114997387,
0.03349637985229492,
-0.003517983015626669,
-0.0682445541024208,
-0.03377695381641388,
-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 handle_model(self):
self.model.add_to_class('meta_keywords', models.TextField(
_('meta keywords'),
blank=True,
help_text=_('Keywords are ignored by most search engines.')))
self.model.add_to_class('meta_description', models.TextField(
_('meta descripti... | |
20,309 | [
-0.01564090885221958,
-0.008956863544881344,
0.07497860491275787,
0.002550812205299735,
-0.030499771237373352,
-0.03470326587557793,
0.034018974751234055,
-0.024365602061152458,
-0.030890794470906258,
-0.0010264345910400152,
0.002659259829670191,
0.018683554604649544,
0.007276688236743212,
... | 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 setUp(self):
self.iface = get_iface()
lines_shp = os.path.join(TEST_DATA_DIR, 'lines.shp')
self.lines_layer = QgsVectorLayer(lines_shp, 'Lines', 'ogr')
QgsProject.instance().addMapLayer(self.lines_layer)
# Create style
sym2 = QgsLineSymbol.createSimple({'color': '#f... | |
20,310 | [
0.0018896543188020587,
0.013722988776862621,
0.036766767501831055,
-0.03477867692708969,
-0.009159417822957039,
-0.010740852914750576,
0.00571898790076375,
-0.08050476014614105,
0.004037502221763134,
0.047533437609672546,
-0.018912680447101593,
-0.03508850932121277,
-0.0037276698276400566,
... | 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_1(self):
sym = self.lines_layer.renderer().symbol()
sym_layer = QgsArrowSymbolLayer.create({'head_length': '6.5', 'head_thickness': '6.5'})
dd = QgsProperty.fromExpression("(@geometry_point_num % 4) * 2")
sym_layer.setDataDefinedProperty(QgsSymbolLayer.PropertyArrowWidth, dd)
... | |
20,311 | [
-0.005462674889713526,
0.010179417207837105,
0.03444153815507889,
-0.044010061770677567,
-0.010661701671779156,
-0.016101868823170662,
0.008674689568579197,
-0.07449043542146683,
0.01530449278652668,
0.04429300129413605,
-0.01283519621938467,
-0.028113966807723045,
-0.0018857321701943874,
... | 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_3(self):
sym = self.lines_layer.renderer().symbol()
# double headed
sym_layer = QgsArrowSymbolLayer.create({'arrow_width': '7', 'head_length': '6', 'head_thickness': '8', 'head_type': '0', 'arrow_type': '1', 'is_curved': '0'})
fill_sym = QgsFillSymbol.createSimple({'color': '#8b... | |
20,312 | [
-0.0013000689214095473,
0.00866925623267889,
0.02563084475696087,
-0.050648387521505356,
-0.012917638756334782,
-0.00282213999889791,
0.009435881860554218,
-0.07170503586530685,
0.011537712998688221,
0.05816131830215454,
-0.012010465376079082,
-0.03268379718065262,
0.00005285523002385162,
... | 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_2(self):
sym = self.lines_layer.renderer().symbol()
# double headed
sym_layer = QgsArrowSymbolLayer.create({'arrow_width': '5', 'head_length': '4', 'head_thickness': '6', 'head_type': '2'})
fill_sym = QgsFillSymbol.createSimple({'color': '#8bcfff', 'outline_color': '#000000', 'o... | |
20,313 | [
0.00985573511570692,
0.008088454604148865,
0.0373842790722847,
-0.028726588934659958,
-0.03084467723965645,
0.02020127885043621,
0.021048514172434807,
-0.06656096130609512,
-0.0018897330155596137,
0.07201503962278366,
-0.025430312380194664,
-0.048451296985149384,
0.01724919117987156,
0.005... | 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_unrepeated(self):
sym = self.lines_layer.renderer().symbol()
# double headed
sym_layer = QgsArrowSymbolLayer.create({'arrow_width': '7', 'head_length': '6', 'head_thickness': '8', 'head_type': '0', 'arrow_type': '0'})
# no repetition
sym_layer.setIsRepeated(False)
... | |
20,314 | [
0.008678416721522808,
-0.01466291956603527,
0.025379493832588196,
-0.02351265959441662,
-0.005966780241578817,
0.013162363320589066,
-0.04319712892174721,
-0.0003688622382469475,
-0.03485545143485069,
0.017226863652467728,
0.031807076185941696,
-0.0033112678211182356,
0.008707954548299313,
... | 17 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "owner"}}, {"_type": "Constant", "_fields": {"kind": null... | class BitbucketPullrequestPoller(base.ReconfigurablePollingChangeSource, PullRequestMixin):
compare_attrs = ("owner", "slug", "branch",
"pollInterval", "useTimestamps",
"category", "project", "pollAtLaunch")
db_class_name = 'BitbucketPullrequestPoller'
property_ba... | |
20,315 | [
0.040842145681381226,
0.019031884148716927,
0.017415372654795647,
0.0039528729394078255,
0.00910549983382225,
0.014940091408789158,
-0.02914770133793354,
-0.013462500646710396,
-0.004868474323302507,
0.01554628275334835,
0.03238072246313095,
-0.009004468098282814,
-0.04526228830218315,
0.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 poll(self):
response = yield self._getChanges()
if response.code != 200:
log.err(f"{self.__class__.__name__}: error {response.code} "
f"while loading {response.url}")
return
json_result = yield response.json()
yield self._processChanges(js... | |
20,316 | [
0.021868839859962463,
-0.019231390208005905,
0.05748659744858742,
-0.01779056340456009,
-0.03177148103713989,
0.0070515102706849575,
-0.030696963891386986,
-0.016948044300079346,
-0.041930537670850754,
0.03995245322585106,
0.015739215537905693,
0.0021566632203757763,
0.025519751012325287,
... | 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": "owner", "annotation": null, "type_comment": null}}, {"_type": "ar... | def reconfigService(self, owner, slug,
branch=None, pollInterval=10 * 60, useTimestamps=True,
category=None, project='', pullrequest_filter=True,
pollAtLaunch=False, auth=None, bitbucket_property_whitelist=None):
self.owner = owner
... | |
20,317 | [
-0.00780208595097065,
-0.029504135251045227,
0.00925332773476839,
-0.004167325794696808,
0.012821516953408718,
0.014592297375202179,
-0.022700609639286995,
-0.04675925895571709,
0.05714428797364235,
0.010831053368747234,
0.016722559928894043,
-0.06183086708188057,
-0.037705644965171814,
-0... | 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 test_ua(unittest.TestCase):
def setUp(self):
self.ua_l2 = Ua()
self.ua532 = self.ua_l2(532.*10 ** -9) / 100.
self.ua800 = self.ua_l2(800.*10 ** -9) / 100.
def test_uA532(self):
self.assertTrue(3. < self.ua532 < 4., "test if calculated ua_l2 takes " +
... | |
20,318 | [
0.005024510435760021,
0.022053010761737823,
0.02221989817917347,
-0.041268929839134216,
0.014316575601696968,
0.02013380266726017,
-0.006082458887249231,
0.027059640735387802,
-0.027441097423434258,
0.06747028976678848,
0.05159212276339531,
0.0070808045566082,
-0.02283976599574089,
0.02756... | 16 | {"_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": "result", "annotation": null, "type_comment": null}}], "kwarg": nu... | def _processChanges(self, result):
for pr in result['values']:
branch = pr['source']['branch']['name']
nr = int(pr['id'])
# Note that this is a short hash. The full length hash can be accessed via the
# commit api resource but we want to avoid requesting multiple ... | |
20,319 | [
-0.023674290627241135,
-0.041093356907367706,
-0.015869738534092903,
0.011851625517010689,
0.023587413132190704,
0.01568150334060192,
-0.01206882018595934,
-0.006609978154301643,
0.05560200661420822,
0.007301383186131716,
-0.0027565706986933947,
-0.029828159138560295,
-0.0406879261136055,
... | 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_uA800(self):
self.assertTrue(0.05 < self.ua800 < 0.15, "test if calculated ua_l2 " +
"takes reasonable values " +
"(according to \"Differences in" +
" optical properties between healthy and " +
"pathological... | |
20,320 | [
-0.021870266646146774,
-0.015558367595076561,
-0.021952640265226364,
0.04211365059018135,
0.029469257220625877,
-0.0029731823597103357,
-0.012170741334557533,
0.050824686884880066,
0.029386883601546288,
-0.02117008902132511,
0.028748486191034317,
-0.06482824683189392,
-0.0010818007867783308,... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "e", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},... | def handle_http_error(e):
if not isinstance(e, HTTPException):
e = InternalServerError()
data = getattr(e, 'data', None)
if data:
message = data['message']
else:
message = e.description
return jsonify(message=message), e.code | |
20,321 | [
-0.01712612248957157,
-0.030278891324996948,
0.0365261547267437,
-0.06639813631772995,
-0.03317513316869736,
-0.059169501066207886,
0.014971894212067127,
-0.0023038287181407213,
0.0018325909040868282,
0.018394725397229195,
0.05356850475072861,
-0.06965341418981552,
0.01770058460533619,
-0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "client", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "campaign_id", "annotation": null, "type_comment": null}}], "kwa... | def main(client, campaign_id):
# Initialize appropriate services.
campaign_extension_setting_service = client.GetService(
'CampaignExtensionSettingService', version='v201506')
customer_service = client.GetService('CustomerService', version='v201506')
customer_tz = timezone(customer_service.get()['dateTim... | |
20,322 | [
0.001854248228482902,
-0.015496216714382172,
-0.002079131081700325,
0.013034923002123833,
0.01205261331051588,
-0.006854095961898565,
-0.04684184119105339,
-0.004757029470056295,
0.012151948176324368,
0.03540731221437454,
0.020672660320997238,
-0.051830653101205826,
0.010358404368162155,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "err", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def handle_bad_request(err):
# webargs attaches additional metadata to the `data` attribute
data = getattr(err, 'data')
if data:
# Get validations from the ValidationError object
messages = data['exc'].messages
else:
messages = ['Invalid request']
... | |
20,323 | [
0.059997040778398514,
-0.03131532669067383,
0.025842346251010895,
0.0018273275345563889,
0.004788858350366354,
-0.00025590299628674984,
-0.0003726024879142642,
-0.016809869557619095,
-0.008775287307798862,
-0.004845439922064543,
-0.0069235265254974365,
-0.07950224727392197,
0.038742944598197... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AutoField", "value": {"_type": "Name", "_fields": {"id": "mo... | class Company(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100)
owner = models.CharField(max_length=256)
creation_date = models.DateField()
office_location = models.CharField(max_length=256)
phone = models.CharField(max_length=256)
email = model... | |
20,324 | [
0.006565611809492111,
-0.018288837745785713,
-0.012525632977485657,
-0.02010560967028141,
-0.02448604814708233,
0.008104821667075157,
-0.012051253579556942,
-0.0015240698121488094,
-0.0032727126963436604,
0.02474847063422203,
-0.011263986118137836,
-0.08978890627622604,
0.02931058779358864,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AutoField", "value": {"_type": "Name", "_fields": {"id": "mo... | class Route(models.Model):
id = models.AutoField(primary_key=True)
company_id = models.ForeignKey(Company)
name = models.CharField(max_length=256)
frequency = models.IntegerField()
start_time = models.TimeField()
end_time = models.TimeField()
start_point = models.CharField(max_length=100)
... | |
20,325 | [
0.010670814663171768,
-0.03815239667892456,
0.00580648984760046,
-0.01577332802116871,
-0.012915072962641716,
-0.029641151428222656,
-0.014672370627522469,
-0.01208935584872961,
0.0028767797630280256,
0.02752392739057541,
-0.028646055608987808,
-0.05462440848350525,
0.027418065816164017,
-... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AutoField", "value": {"_type": "Name", "_fields": {"id": "mo... | class Bus(models.Model):
id = models.AutoField(primary_key=True)
company_id = models.ForeignKey(Company)
route_id = models.ForeignKey(Route)
official_number = models.CharField(max_length=32)
first_day_of_use = models.DateField()
bus_type = models.CharField(max_length=100)
def __unicode__(... | |
20,326 | [
0.03639091178774834,
-0.036967188119888306,
-0.003748477203771472,
-0.027874797582626343,
0.03271980211138725,
-0.03218621388077736,
-0.01455636415630579,
-0.01020759716629982,
-0.021226251497864723,
0.027234487235546112,
-0.012752826325595379,
-0.04490702226758003,
0.021066175773739815,
-... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AutoField", "value": {"_type": "Name", "_fields": {"id": "mo... | class Driver(models.Model):
id = models.AutoField(primary_key=True)
company_id = models.ForeignKey(Company)
bus_id = models.ForeignKey(Bus)
user_id = models.ForeignKey(User)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
age = models.IntegerField... | |
20,327 | [
0.03549810126423836,
-0.019296033307909966,
-0.036343783140182495,
-0.011973647400736809,
0.009833654388785362,
0.0011183397145941854,
0.0063271597027778625,
0.0004405678191687912,
-0.015294503420591354,
0.010194617323577404,
0.012860584072768688,
-0.04818335920572281,
0.008188695646822453,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AutoField", "value": {"_type": "Name", "_fields": {"id": "mo... | class Comment(models.Model):
id = models.AutoField(primary_key=True)
feedback_id = models.ForeignKey(Feedback)
author = models.ForeignKey(User)
content = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return 'Comment #{}: {}'.format(sel... | |
20,328 | [
0.028531530871987343,
-0.029467688873410225,
0.007840319536626339,
-0.01157431211322546,
0.012478555552661419,
-0.025254979729652405,
0.0058297086507081985,
0.008696691133081913,
0.0013962577795609832,
0.056594982743263245,
0.019989091902971268,
-0.0636587142944336,
-0.002768579637631774,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AutoField", "value": {"_type": "Name", "_fields": {"id": "mo... | class Feedback(models.Model):
id = models.AutoField(primary_key=True)
author = models.ForeignKey(User)
company_id = models.ForeignKey(Company)
bus_id = models.ForeignKey(Bus)
driver_id = models.ForeignKey(Driver)
title = models.CharField(max_length=100)
created_at = models.DateTimeField(au... | |
20,329 | [
-0.0034101742785423994,
-0.013118105940520763,
-0.003930099308490753,
-0.028881162405014038,
0.010697121731936932,
-0.025873595848679543,
0.00038294470869004726,
-0.010265184566378593,
0.009593280963599682,
-0.007993511855602264,
0.02105296030640602,
-0.022460756823420525,
0.0568664558231830... | 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 to_dict(self):
out = {}
attrs = ['jobs', 'resources', 'resource_types', 'var_sources', 'groups']
for attr in attrs:
items = getattr(self, attr)
if not len(items):
continue
out[attr] = [v if isinstance(v, dict) else v.to_dict() for v in item... | |
20,330 | [
-0.009027010761201382,
0.04080703482031822,
0.026586400344967842,
-0.021598873659968376,
-0.0017943244893103838,
-0.002229702426120639,
0.031532708555459976,
-0.007373088970780373,
-0.021248510107398033,
-0.03264562785625458,
-0.03532487526535988,
-0.01498318836092949,
0.0424145832657814,
... | 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": "docker_user", "annotation": null, "type_comment": null}}, {"_type... | def add_rsync_resource_type(self, docker_user=None, docker_pass=None):
_source = {
'repository': 'public.ecr.aws/y0o4y9o3/concourse-rsync-resource',
'tag': 'master'
}
if docker_user and docker_pass:
_source.update({'username': docker_user, 'pa... | |
20,331 | [
0.015208279713988304,
0.018348997458815575,
0.04849538952112198,
-0.04610889405012131,
-0.009799265302717686,
-0.016491584479808807,
0.037395935505628586,
-0.004863047506660223,
-0.02182742767035961,
-0.01546719204634428,
0.010221404954791069,
-0.011876191943883896,
0.0225366223603487,
-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": "all_rsync", "annotation": null, "type_comment": null}}, {"_type":... | def add_anaconda_upload(self, all_rsync, config_vars):
self.add_jobs(
name='anaconda_upload',
plan=all_rsync + [{'put': 'anaconda_upload_resource'}]
)
_source = {
'repository': 'conda/concourse-anaconda_org-resource',
'tag': 'latest'
... | |
20,332 | [
0.0032121033873409033,
0.029377134516835213,
0.03135883808135986,
-0.030618421733379364,
-0.040701162070035934,
-0.0029643902089446783,
0.027722084894776344,
-0.011596237309277058,
-0.033296991139650345,
-0.02994333580136299,
-0.008547461591660976,
-0.006914188619703054,
0.020797008648514748... | 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": "all_rsync", "annotation": null, "type_comment": null}}, {"_type":... | def add_repo_v6_upload(self, all_rsync, config_vars):
self.add_job(
name='repo_v6_upload',
plan=all_rsync + [{'put': 'repo_resource'}]
)
_source = {
'repository': 'condatest/repo_cli',
'tag': 'latest'}
if config_vars.get('docker-use... | |
20,333 | [
0.022458167746663094,
0.008712595328688622,
0.01787087507545948,
-0.03619830310344696,
-0.03537215664982796,
0.012479175813496113,
0.04543811082839966,
0.0050601535476744175,
0.013229230418801308,
-0.007859271951019764,
-0.002513771178200841,
0.020544983446598053,
0.03282849118113518,
-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": "inputs", "annotation": null, "type_comment": null}}, {"_type": "a... | def add_consolidate_task(self, inputs, subdir, docker_user=None, docker_pass=None):
_source = {
'repository': 'public.ecr.aws/y0o4y9o3/anaconda-pkg-build',
'tag': 'master-amd64',
}
if docker_user and docker_pass:
_source.update({
... | |
20,334 | [
-0.01722325198352337,
0.01875721663236618,
0.03020554780960083,
-0.08139029890298843,
0.005521140992641449,
0.008950000628829002,
0.023460619151592255,
0.02250189147889614,
0.021565722301602364,
0.03097252920269966,
0.03176207095384598,
0.0035444709938019514,
0.0164337120950222,
-0.0293483... | 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": "config_vars", "annotation": null, "type_comment": null}}, {"_type... | def add_push_branch_job(
self,
config_vars,
folders,
branches,
pr_num,
pr_merged_resource,
stage_job_name):
plan = []
if pr_merged_resource:
# The branch push causes a version change in the pull-recipes-<bran... | |
20,335 | [
0.0013943382073193789,
-0.013461613096296787,
0.01257906761020422,
-0.04531145468354225,
-0.040574755519628525,
-0.004421106539666653,
0.019985748454928398,
0.03313456103205681,
0.05576794594526291,
-0.002262221183627844,
0.016433222219347954,
0.005982318427413702,
0.02891174703836441,
-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": "subdir", "annotation": null, "type_comment": null}}, {"_type": "a... | def add_convert_task(self, subdir, docker_user=None, docker_pass=None):
inputs = [{'name': 'output-artifacts'}]
outputs = [{'name': 'converted-artifacts'}]
_source = {
'repository': 'public.ecr.aws/y0o4y9o3/anaconda-pkg-build',
'tag': 'master-amd64',
... | |
20,336 | [
0.058399494737386703,
-0.021087585017085075,
0.04110565781593323,
-0.014519155956804752,
-0.03985452651977539,
-0.0071334559470415115,
0.05291067063808441,
0.0025300057604908943,
-0.038341064006090164,
0.0056906212121248245,
-0.009756792336702347,
0.02250015176832676,
0.019301699474453926,
... | 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": "recipe_path", "annotation": null, "type_comment": null}}, {"_type... | def add_autobuild_cmds(self, recipe_path, cbc_path):
# combine the recipe from recipe_path with the conda_build_config.yaml
# file in the cbc_path directory into a combined_recipe directory
if self.platform == 'win':
win_cbc_path = cbc_path.replace("/", "\\")
win_recipe_p... | |
20,337 | [
0.0008761898498050869,
0.019031431525945663,
-0.004920089151710272,
-0.05263013020157814,
0.0014768658438697457,
-0.007988502271473408,
0.008178704418241978,
0.013135155662894249,
-0.006875258404761553,
0.0025705299340188503,
0.024413039907813072,
-0.046364638954401016,
0.037257298827171326,... | 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():
bibframe_graph = Graph()
bibframe_graph.parse(BIBFRAME_URL)
for uri in bibframe_graph.subjects(None, CLASS_URI):
class_name = uri.split("/")[-1]
class_properties = __get_properties__(bibframe_graph, uri)
new_class = type(str(class_name),
(Bibframe... | |
20,338 | [
-0.011324099265038967,
0.0015186028322204947,
-0.0008134900708682835,
-0.011398112401366234,
0.0013348902575671673,
-0.029076818376779556,
0.0034839315339922905,
0.034934476017951965,
-0.00891865324229002,
0.004565060138702393,
-0.00901381392031908,
0.01026147324591875,
0.0284001212567091,
... | 7 | {"_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": "github_user", "annotation": null, "type_comment": null}}, {"_type... | def add_repo_access(self, github_user, github_token):
self.config['params'] = {
'GITHUB_USER': github_user,
'GITHUB_TOKEN': github_token,
}
if self.platform == 'win':
creds_cmds = [
'(echo machine github.com '
'login %GITHUB_USE... | |
20,339 | [
-0.026411645114421844,
0.021374618634581566,
0.06663641333580017,
-0.050536978989839554,
0.00608194200322032,
-0.0010664982255548239,
-0.026149671524763107,
-0.005575858056545258,
0.027054669335484505,
0.025339936837553978,
0.04796488210558891,
-0.06334984302520752,
-0.02189856395125389,
0... | 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": "command", "annotation"... | class IntegerLinearProgram:
# this class handles a basic ILP for glpsol from the Gnu linear programming toolkit, in cpxlp format
# note that:
# - only binary and integer variables are supported
# - the behavior is not defined if no solution is found
# - the solver might run for a long time
# def ... | |
20,340 | [
0.07290837913751602,
0.024850498884916306,
0.029677940532565117,
-0.028327785432338715,
-0.023067275062203407,
0.013679874129593372,
0.004321133717894554,
-0.03584279865026474,
0.005362408701330423,
0.03599564731121063,
0.023882461711764336,
-0.029041074216365814,
-0.043867308646440506,
-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 __str__(self):
output = ''
if len(self.objective) > 0:
output += "Maximize\n"
for function in sorted(self.objective.keys()):
output += function + ": " + self.objective[function] + "\n"
if self.constraints > 0:
output += "\nSubject To\n"
... | |
20,341 | [
0.03430721163749695,
-0.0015207889955490828,
0.02174951881170273,
-0.03808681666851044,
-0.021906070411205292,
-0.0023412881419062614,
-0.015084885060787201,
-0.03690149635076523,
-0.006731727626174688,
-0.018640847876667976,
-0.022644100710749626,
0.018271831795573235,
-0.020217547193169594... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},... | def transstyle(x):
# the part of latex specifying width or height for example
x = x.group()
# split it up to get measurement name and value
parts = re.split(r'[\[\]\=]', x)
if re.search(p, x):
# make an img-tag compatible string with meas... | |
20,342 | [
0.006454458925873041,
0.044535767287015915,
0.06676492094993591,
-0.05772868171334267,
-0.009546144865453243,
-0.02930324338376522,
-0.04435504227876663,
-0.011708388105034828,
0.022190429270267487,
-0.007906711660325527,
0.04247033968567848,
-0.012547467835247517,
-0.03795221820473671,
-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 run(self):
input = open(self.tmp + ".ilp", "w")
input.write(str(self))
input.close()
if self.debug:
os.system("%s --tmlim %d --cpxlp %s.ilp -o %s.sol >&2" % (self.command, self.time_limit, self.tmp, self.tmp))
else:
output = os.popen("%s --tmlim %d --... | |
20,343 | [
-0.005933879408985376,
0.039326924830675125,
-0.02199346199631691,
-0.01210729219019413,
0.02152528427541256,
-0.03688804432749748,
-0.0022551463916897774,
0.027328509837388992,
-0.019696125760674477,
0.04261505603790283,
-0.03375234454870224,
-0.0032500240486115217,
-0.011835095472633839,
... | 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 __init__(self):
# raise exception if R or knitr not installed
cmd = ['Rscript', '-e', 'require(knitr)']
try:
p = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
except OSError... | |
20,344 | [
0.03305303677916527,
0.02068048156797886,
0.06990271061658859,
-0.05355485528707504,
-0.01181422732770443,
-0.056458164006471634,
0.007096353452652693,
-0.007029353640973568,
0.011227983050048351,
-0.019463326781988144,
-0.02382945455610752,
0.028028082102537155,
-0.034973688423633575,
-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": "notebook", "annotation": null, "type_comment": null}}], "kwarg": ... | def writes(self, notebook):
body, resources = self.exporter.from_notebook_node(notebook)
self.resources = resources
if self.write_outputs:
self.write_resources(resources)
# remove any blank lines added at start and end by template
text = re.sub(r'\A\s*\n|^\s... | |
20,345 | [
0.06335834413766861,
-0.006148700136691332,
-0.03793926164507866,
0.007440818473696709,
0.015405167825520039,
-0.02631019987165928,
-0.0072570256888866425,
-0.04709548130631447,
0.061754338443279266,
0.007780556567013264,
0.029963774606585503,
-0.02032858319580555,
0.01759953983128071,
-0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CharBlock", "value": {"_type": "Name", "_fields": {"id": "bl... | class FooStreamBlock(blocks.StreamBlock):
text = blocks.CharBlock()
error = 'At least one block must say "foo"'
def clean(self, value):
value = super().clean(value)
if not any(block.value == 'foo' for block in value):
raise blocks.StreamBlockValidationError(non_block_errors=Erro... | |
20,346 | [
0.028739575296640396,
-0.016932111233472824,
0.0004483344964683056,
-0.005698861554265022,
0.007865872234106064,
-0.006192282307893038,
-0.018374862149357796,
-0.0031394234392791986,
0.04769153892993927,
0.047599200159311295,
0.023210959509015083,
0.012650029733777046,
-0.03271002322435379,
... | 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_charfield_with_validator(self):
def validate_is_foo(value):
if value != 'foo':
raise ValidationError("Value must be 'foo'")
block = blocks.CharBlock(validators=[validate_is_foo])
with self.assertRaises(ValidationError):
block.clean("bar") | |
20,347 | [
0.03092881105840206,
-0.045776404440402985,
0.03729521110653877,
-0.0046013216488063335,
0.012490482069551945,
-0.054764263331890106,
0.01246845256537199,
-0.015453391708433628,
0.005947848316282034,
0.006250747945159674,
0.011455115862190723,
-0.013404687866568565,
-0.017810501158237457,
... | 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... | |
20,348 | [
0.02202453836798668,
-0.04744076728820801,
0.03664316236972809,
-0.00820016860961914,
0.03252161294221878,
-0.04325481876730919,
-0.000059577676438493654,
-0.023484254255890846,
0.011527462862432003,
0.011162533424794674,
0.009616952389478683,
-0.01320184301584959,
-0.016164207831025124,
-... | 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... | |
20,349 | [
0.011654396541416645,
0.016252001747488976,
0.021617496386170387,
0.00717829167842865,
-0.01814742013812065,
-0.04832832142710686,
0.009122311137616634,
-0.09152442961931229,
0.009827017784118652,
0.03748069331049919,
0.02027612179517746,
-0.014307982288300991,
-0.035556115210056305,
-0.02... | 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}}, {"_type": "arg", "_fields": {"arg": "required", "annotation... | class CalenderBlock(blocks.FieldBlock):
def __init__(self, required=True, help_text=None, max_length=None, min_length=None, **kwargs):
# Set widget to CalenderWidget
self.field = forms.CharField(
required=required,
help_text=help_text,
... | |
20,350 | [
0.0035538210067898035,
0.013853877782821655,
0.03353404998779297,
0.013667699880897999,
-0.012583483010530472,
-0.05852578952908516,
-0.007616895250976086,
-0.063300721347332,
0.04212016984820366,
0.01853024587035179,
0.013634844683110714,
0.01577042229473591,
-0.01736936904489994,
-0.0481... | 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_widget_media(self):
class CalendarWidget(forms.TextInput):
@property
def media(self):
return forms.Media(
css={'all': ('pretty.css',)},
js=('animations.js', 'actions.js')
)
class CalenderBlock(block... | |
20,351 | [
0.011126172728836536,
0.014430676586925983,
0.021241793408989906,
0.01115648914128542,
-0.009797297418117523,
-0.05444851890206337,
0.018432460725307465,
-0.08504801988601685,
0.008271364495158195,
0.05372092127799988,
0.009761928580701351,
0.0007459133630618453,
-0.04098797217011452,
-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}}, {"_type": "arg", "_fields": {"arg": "required", "annotation": null, "type_comment": null}}, {"_type": ... | def __init__(self, required=True, help_text=None, max_length=None, min_length=None, **kwargs):
# Set widget to CalenderWidget
self.field = forms.CharField(
required=required,
help_text=help_text,
max_length=max_length,
... | |
20,352 | [
0.023705821484327316,
-0.06898519396781921,
-0.0029867454431951046,
0.018490122631192207,
0.04519575461745262,
0.022096166387200356,
0.020946413278579712,
0.03764919191598892,
-0.005184341687709093,
0.041098453104496,
-0.006302738096565008,
-0.03980236500501633,
0.021949835121631622,
-0.03... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "http://example.com/"}}, "targets": [{"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comm... | class PrefixWrapper:
prefix = 'http://example.com/'
def __init__(self, value):
self.value = value
def with_prefix(self):
return self.prefix + self.value
@classmethod
def from_prefixed(cls, value):
if not value... | |
20,353 | [
-0.005473173223435879,
-0.028935827314853668,
0.023477109149098396,
-0.015231208875775337,
0.01150147058069706,
-0.030647458508610725,
-0.008835719898343086,
-0.014363827183842659,
0.057362791150808334,
0.01353114191442728,
0.015659116208553314,
-0.04172680526971817,
-0.0119929863139987,
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 TestIntegerBlock(unittest.TestCase):
def test_type(self):
block = blocks.IntegerBlock()
digit = block.value_from_form(1234)
self.assertEqual(type(digit), int)
def test_render(self):
block = blocks.IntegerBlock()
digit = block.value_from_form(1234)
self.as... | |
20,354 | [
0.04281080514192581,
-0.013479182496666908,
0.046197883784770966,
0.011958454735577106,
0.02428556978702545,
-0.006883599795401096,
-0.0032085063867270947,
-0.014516042545437813,
0.050414446741342545,
0.025391554459929466,
0.015391613356769085,
-0.012315594591200352,
-0.04034538194537163,
... | 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_with_validator(self):
def validate_is_even(value):
if value % 2 > 0:
raise ValidationError("Value must be even")
block = blocks.IntegerBlock(validators=[validate_is_even])
with self.assertRaises(ValidationError):
block.clean(3) | |
20,355 | [
0.0525304451584816,
-0.018560608848929405,
0.02931566722691059,
0.015151288360357285,
0.012403645552694798,
-0.04062025621533394,
-0.018930699676275253,
0.0038102518301457167,
0.050691209733486176,
0.05997712165117264,
0.02996613085269928,
0.01373821496963501,
-0.03837728127837181,
-0.0187... | 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_render_with_validator(self):
def validate_is_example_domain(value):
if not value.endswith('@example.com'):
raise ValidationError("E-mail address must end in @example.com")
block = blocks.EmailBlock(validators=[validate_is_example_domain])
with self.assertRa... | |
20,356 | [
0.02727380208671093,
-0.027514388784766197,
0.036634817719459534,
0.005536231677979231,
0.038165826350450516,
-0.06508968025445938,
-0.02456173114478588,
-0.006107625551521778,
0.05511626601219177,
0.025808408856391907,
0.016895759850740433,
0.002922583604231477,
-0.03930314630270004,
-0.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 TestEmailBlock(unittest.TestCase):
def test_render(self):
block = blocks.EmailBlock()
email = block.render("example@email.com")
self.assertEqual(email, "example@email.com")
def test_render_required_error(self):
block = blocks.EmailBlock()
with self.assertRaises(V... | |
20,357 | [
0.06532387435436249,
-0.013571962714195251,
0.002004682319238782,
-0.011623048223555088,
-0.00031332331127487123,
-0.01570872589945793,
-0.00705014169216156,
-0.028834551572799683,
0.0324740894138813,
0.03921310976147652,
0.013548482209444046,
-0.003941856790333986,
-0.03630147874355316,
-... | 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_render_with_validator(self):
def validate_is_proper_story(value):
if not value.startswith('Once upon a time'):
raise ValidationError("Value must be a proper story")
block = blocks.BlockQuoteBlock(validators=[validate_is_proper_story])
with self.assertRaises... | |
20,358 | [
0.018022116273641586,
-0.020411493256688118,
0.0007486892864108086,
-0.012804060243070126,
0.0018911435035988688,
-0.014625557698309422,
-0.035229913890361786,
-0.03173692524433136,
0.03415844589471817,
0.006246666889637709,
0.019811470061540604,
0.013693379238247871,
-0.034029871225357056,
... | 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 TestBlockQuoteBlock(unittest.TestCase):
def test_render(self):
block = blocks.BlockQuoteBlock()
quote = block.render("Now is the time...")
self.assertEqual(quote, "<blockquote>Now is the time...</blockquote>")
def test_render_with_validator(self):
def validate_is_proper_s... | |
20,359 | [
0.044993236660957336,
-0.017094075679779053,
0.0512702502310276,
0.000004647138666769024,
0.021945582702755928,
-0.01373994816094637,
-0.006738204509019852,
-0.024521075189113617,
0.05491187423467636,
0.03816518932580948,
0.018723225221037865,
-0.00017856241902336478,
-0.04504115507006645,
... | 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_with_validator(self):
def validate_is_even(value):
if value % 2 > 0:
raise ValidationError("Value must be even")
block = blocks.FloatBlock(validators=[validate_is_even])
with self.assertRaises(ValidationError):
block.clean('3.0') | |
20,360 | [
0.01754346676170826,
-0.013659261167049408,
0.03377263993024826,
-0.022401658818125725,
0.02300013042986393,
-0.03696449473500252,
-0.022824108600616455,
-0.04294922575354576,
0.05829828977584839,
0.0364481657743454,
0.020089909434318542,
-0.009035766124725342,
-0.025300143286585808,
0.010... | 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 TestFloatBlock(TestCase):
def test_type(self):
block = blocks.FloatBlock()
block_val = block.value_from_form(float(1.63))
self.assertEqual(type(block_val), float)
def test_render(self):
block = blocks.FloatBlock()
test_val = float(1.63)
block_val = block.va... | |
20,361 | [
0.04338926076889038,
-0.024321388453245163,
0.04661300778388977,
0.0070982156321406364,
0.0158560648560524,
0.004984869621694088,
0.0005917667294852436,
-0.016787368804216385,
0.04923976585268974,
0.036297015845775604,
0.018315663561224937,
-0.004952034913003445,
-0.054015688598155975,
-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_with_validator(self):
def validate_is_even(value):
if value % 2 > 0:
raise ValidationError("Value must be even")
block = blocks.DecimalBlock(validators=[validate_is_even])
with self.assertRaises(ValidationError):
block.clean('3.0') | |
20,362 | [
0.019622966647148132,
-0.019326340407133102,
0.019611557945609093,
0.004800211172550917,
0.008157221600413322,
-0.009834300726652145,
-0.008659204468131065,
-0.03256043419241905,
0.0545792318880558,
0.02503069117665291,
0.014409190975129604,
-0.013576355762779713,
-0.03728363662958145,
-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 TestDecimalBlock(TestCase):
def test_type(self):
block = blocks.DecimalBlock()
block_val = block.value_from_form(Decimal('1.63'))
self.assertEqual(type(block_val), Decimal)
def test_render(self):
block = blocks.DecimalBlock()
test_val = Decimal(1.63)
block_... | |
20,363 | [
0.016429873183369637,
-0.0015629138797521591,
0.028802692890167236,
-0.0030961709562689066,
0.014567424543201923,
-0.018339771777391434,
-0.021874861791729927,
-0.026857206597924232,
0.033974841237068176,
0.044319137930870056,
0.00979267805814743,
-0.01479281671345234,
-0.003594405250623822,... | 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 TestRegexBlock(TestCase):
def test_render(self):
block = blocks.RegexBlock(regex=r'^[0-9]{3}$')
test_val = '123'
block_val = block.value_from_form(test_val)
self.assertEqual(block_val, test_val)
def test_raises_required_error(self):
block = blocks.RegexBlock(rege... | |
20,364 | [
0.02873602882027626,
-0.010027806274592876,
0.022762810811400414,
0.01351114921271801,
0.010555585846304893,
-0.013995464891195297,
0.006581718102097511,
0.01533664483577013,
0.03653474524617195,
0.012039576657116413,
0.019484369084239006,
-0.005575832910835743,
-0.0056658657267689705,
-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_raises_custom_required_error(self):
test_message = 'Oops, you missed a bit.'
block = blocks.RegexBlock(regex=r'^[0-9]{3}$', error_messages={
'required': test_message,
})
with self.assertRaises(ValidationError) as context:
block.clean("")
self.as... | |
20,365 | [
0.021455740556120872,
-0.006039310712367296,
-0.015795979648828506,
-0.004897870123386383,
0.01053251326084137,
-0.026479195803403854,
-0.021455740556120872,
-0.009053384885191917,
0.06019217148423195,
0.02817600779235363,
0.02026127465069294,
-0.009444097988307476,
-0.02900208719074726,
-... | 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_with_validator(self):
def validate_is_foo(value):
if value != 'foo':
raise ValidationError("Value must be 'foo'")
block = blocks.RegexBlock(regex=r'^.*$', validators=[validate_is_foo])
with self.assertRaises(ValidationError):
block.clean(... | |
20,366 | [
-0.0003173445875290781,
-0.05012481287121773,
0.03489227220416069,
0.031390540301799774,
0.020184991881251335,
-0.0326661691069603,
-0.03794378414750099,
0.006647040601819754,
0.03161565214395523,
-0.008179049007594585,
0.009173290804028511,
-0.02731352113187313,
-0.03446706011891365,
0.01... | 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_raises_custom_error_message(self):
test_message = 'Not a valid library card number.'
block = blocks.RegexBlock(regex=r'^[0-9]{3}$', error_messages={
'invalid': test_message
})
with self.assertRaises(ValidationError) as context:
block.clean("[/]")
... | |
20,367 | [
0.006194917485117912,
-0.05324476957321167,
0.006582857575267553,
0.0012797474628314376,
0.02979864366352558,
-0.06885935366153717,
0.013371807523071766,
-0.011753370985388756,
0.04565569385886192,
0.024088650941848755,
0.025991981849074364,
-0.01932426355779171,
-0.03561774268746376,
0.02... | 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.assertTagInHTML('<select id="beverage" name="beverage" placeholder="">', html)
# blank option should still be... | |
20,368 | [
0.019517378881573677,
0.0009127883822657168,
-0.0071073560975492,
-0.0053305174224078655,
0.01791321113705635,
-0.028139783069491386,
-0.014326113276183605,
-0.011296018026769161,
0.04489443078637123,
0.020720506086945534,
0.016119662672281265,
0.011396278627216816,
-0.02671385556459427,
-... | 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_with_validator(self):
def validate_contains_foo(value):
if 'foo' not in value:
raise ValidationError("Value must contain 'foo'")
block = blocks.RichTextBlock(validators=[validate_contains_foo])
with self.assertRaises(ValidationError):
blo... | |
20,369 | [
0.010369094088673592,
-0.05346564203500748,
0.024834906682372093,
-0.008534829132258892,
0.03953217342495918,
-0.04705439507961273,
-0.00936227384954691,
-0.01620171032845974,
0.04224017262458801,
0.020437300205230713,
0.01796075329184532,
-0.04740157350897789,
-0.02065717987716198,
0.0150... | 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_with_callable_choices(self):
def callable_choices():
return [('tea', 'Tea'), ('coffee', 'Coffee')]
block = blocks.ChoiceBlock(choices=callable_choices)
html = block.render_form('coffee', prefix='beverage')
self.assertTagInHTML('<select i... | |
20,370 | [
-0.010675594210624695,
-0.04903734475374222,
0.005349528510123491,
0.006076876539736986,
0.02700573392212391,
-0.053823765367269516,
0.015884345397353172,
-0.018887590616941452,
0.045588307082653046,
0.01514526642858982,
0.015098340809345245,
-0.022172387689352036,
-0.03925333917140961,
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_required_choice_block_with_default(self):
block = blocks.ChoiceBlock(choices=[('tea', 'Tea'), ('coffee', 'Coffee')], default='tea')
html = block.render_form('coffee', prefix='beverage')
self.assertTagInHTML('<select id="beverage" name="beverage" placeholder="">', html)
# ... | |
20,371 | [
0.011253834702074528,
-0.03424926847219467,
0.01480922382324934,
-0.003796332748606801,
0.017312688753008842,
-0.04358142986893654,
0.0033526436891406775,
-0.02458801306784153,
0.04299376159906387,
0.05345424637198448,
0.031122876331210136,
0.0014243593905121088,
-0.06172860413789749,
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)... | |
20,372 | [
0.004776587709784508,
-0.05280976742506027,
0.02621893398463726,
-0.011464972980320454,
0.03902623429894447,
-0.04713829606771469,
-0.017235230654478073,
-0.01627061516046524,
0.03602778911590576,
0.014934100210666656,
0.008664102293550968,
-0.05657525360584259,
-0.00878613255918026,
0.021... | 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_non_required_choice_block_with_callable_choices(self):
def callable_choices():
return [('tea', 'Tea'), ('coffee', 'Coffee')]
block = blocks.ChoiceBlock(choices=callable_choices, required=False)
html = block.render_form('coffee', prefix='beverage')
self.assert... | |
20,373 | [
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... | |
20,374 | [
0.005386827513575554,
-0.05665963143110275,
0.0021960504818707705,
0.003770779352635145,
0.026126114651560783,
-0.057785969227552414,
0.031023230403661728,
-0.007119182497262955,
0.03986252471804619,
0.017801016569137573,
0.007492587435990572,
-0.026248542591929436,
-0.02394689805805683,
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.assertTagInHTML('<select id="beverage" name... | |
20,375 | [
-0.007742402609437704,
-0.04511015862226486,
0.02333061210811138,
-0.0028888597153127193,
0.012156477198004723,
-0.02704024501144886,
0.005293011665344238,
-0.027091946452856064,
0.04278356209397316,
0.01888422481715679,
0.015290922485291958,
-0.021172046661376953,
-0.03241727128624916,
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'),
... | |
20,376 | [
0.013426737859845161,
-0.04985058680176735,
0.01749473437666893,
-0.0117395780980587,
0.03520109876990318,
-0.04317248985171318,
0.008700338192284107,
-0.012450889684259892,
0.040938619524240494,
0.0117395780980587,
0.0058227600529789925,
-0.05398912727832794,
-0.012627247720956802,
0.0208... | 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_and_with_callable_choices(self):
def callable_choices():
return [('tea', 'Tea'), ('coffee', 'Coffee'), ('', 'No thanks')]
block = blocks.ChoiceBlock(
choices=callable_choices,
required=False)
html = bloc... | |
20,377 | [
-0.011809595860540867,
-0.041257504373788834,
0.019636347889900208,
-0.005521068815141916,
0.020681679248809814,
-0.02818424627184868,
0.003724819514900446,
-0.01450231671333313,
0.04456551373004913,
0.02540551871061325,
0.016672370955348015,
-0.030433693900704384,
-0.036626286804676056,
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_with_blank_option(self):
block = blocks.ChoiceBlock(
choices=[
('Alcoholic', [
('gin', 'Gin'),
('whisky', 'Whisky'),
]),
('Non-alcoholic', [
('tea', 'Tea'),
... | |
20,378 | [
-0.004510133061558008,
-0.03329390287399292,
0.03711991757154465,
0.012529555708169937,
0.017242390662431717,
-0.0197254978120327,
0.004054052289575338,
0.00533677963539958,
0.018319249153137207,
0.013568405993282795,
0.043657075613737106,
-0.038994915783405304,
-0.03093748725950718,
0.027... | 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... | |
20,379 | [
0.03443288803100586,
-0.048191532492637634,
0.020879773423075676,
-0.008039982058107853,
0.0017893494805321097,
-0.007012315560132265,
-0.022270146757364273,
-0.0031797222327440977,
0.028000900521874428,
-0.0064138504676520824,
0.0374312549829483,
-0.027614014223217964,
-0.007653095759451389... | 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_optgroup_searchable_content(self):
block = blocks.ChoiceBlock(choices=[
('Section 1', [
('1-1', "Block 1"),
('1-2', "Block 2"),
]),
('Section 2', [
('2-1', "Block 1"),
('2-2', "Block 2"),
]),... | |
20,380 | [
0.042237915098667145,
-0.04860195890069008,
0.02339783124625683,
-0.024679040536284447,
0.02749350294470787,
-0.02348184585571289,
-0.03274436295032501,
-0.0067578568123281,
0.044275250285863876,
0.0012175431475043297,
0.016666229814291,
-0.05066029727458954,
0.014166819863021374,
-0.01165... | 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_with_callable_choices(self):
def callable_choices():
return [
('choice-1', "Choice 1"),
('choice-2', "Choice 2"),
]
block = blocks.ChoiceBlock(choices=callable_choices)
self.assertEqual(block.get_searchable_cont... | |
20,381 | [
0.047900378704071045,
-0.03834419324994087,
-0.01448956597596407,
-0.03239546716213226,
0.021823937073349953,
-0.01158090215176344,
-0.00028967185062356293,
-0.021166950464248657,
0.021847829222679138,
-0.021178895607590675,
0.0191482063382864,
-0.025730028748512268,
-0.0013856468722224236,
... | 12 | {"_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_optgroup_searchable_content_with_lazy_translation(self):
block = blocks.ChoiceBlock(choices=[
(__('Section 1'), [
('1-1', __("Block 1")),
('1-2', __("Block 2")),
]),
(__('Section 2'), [
('2-1', __("Block 1")),
... | |
20,382 | [
0.043401848524808884,
-0.031229855492711067,
-0.038254834711551666,
-0.025248190388083458,
0.05007905513048172,
-0.04103700444102287,
0.0009737593936733902,
-0.01995047554373741,
0.03918222337961197,
-0.018153658136725426,
0.015858367085456848,
-0.014200657606124878,
0.0064395638182759285,
... | 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_searchable_content_with_lazy_translation(self):
block = blocks.ChoiceBlock(choices=[
('choice-1', __("Choice 1")),
('choice-2', __("Choice 2")),
])
result = block.get_searchable_content("choice-1")
# result must survive JSON (de)serialisation, which is no... | |
20,383 | [
0.0074869622476398945,
-0.04719408228993416,
0.041530791670084,
-0.026824884116649628,
0.014298059046268463,
-0.039223525673151016,
-0.006333329249173403,
-0.000758164213038981,
0.014298059046268463,
0.045376237481832504,
0.013144426047801971,
-0.016943257302045822,
-0.03754551336169243,
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_with_validator(self):
choices = [
('tea', 'Tea'),
('coffee', 'Coffee'),
]
def validate_tea_is_selected(value):
raise ValidationError("You must select 'tea'")
block = blocks.ChoiceBlock(choices=choices, validators=[validate_tea_is_sele... | |
20,384 | [
0.0007171647739596665,
-0.04637615755200386,
0.02813136763870716,
-0.015211952850222588,
0.04530153051018715,
-0.020943300798535347,
-0.02903882972896099,
-0.0027477634139358997,
0.03154629468917847,
0.021946286782622337,
0.027773156762123108,
-0.06199408322572708,
-0.010465680621564388,
-... | 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_deconstruct_with_callable_choices(self):
def callable_choices():
return [
('tea', 'Tea'),
('coffee', 'Coffee'),
]
block = blocks.ChoiceBlock(choices=callable_choices, required=False)
html = block.render_form('tea', prefix='beverag... | |
20,385 | [
0.01937391795217991,
0.00468915281817317,
0.020881570875644684,
-0.00724147679284215,
0.041098348796367645,
-0.01753387041389942,
-0.028562283143401146,
-0.03872409462928772,
0.06078092008829117,
0.007407674565911293,
0.049574438482522964,
-0.0021857982501387596,
-0.023873131722211838,
0.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 =... | |
20,386 | [
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... | |
20,387 | [
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... | |
20,388 | [
0.02175210602581501,
0.001648675766773522,
-0.0009415131062269211,
-0.007427949458360672,
0.02260727807879448,
-0.01784900575876236,
-0.018320446833968163,
-0.01566721685230732,
0.06003756448626518,
0.022519567981362343,
0.027519043534994125,
0.006227417383342981,
-0.024273769930005074,
-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_with_validator(self):
def validate_contains_foo(value):
if 'foo' not in value:
raise ValidationError("Value must contain 'foo'")
block = blocks.RawHTMLBlock(validators=[validate_contains_foo])
with self.assertRaises(ValidationError):
bloc... | |
20,389 | [
-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']) | |
20,390 | [
0.003732702462002635,
-0.012415114790201187,
0.002711722394451499,
-0.013950669206678867,
-0.004233662970364094,
0.0010679449187591672,
0.013417036272585392,
-0.04486866295337677,
0.0238500889390707,
0.026681607589125633,
0.020768091082572937,
-0.0031418954022228718,
-0.020800763741135597,
... | 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())... | |
20,391 | [
-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... | |
20,392 | [
-0.017234500497579575,
-0.04174630343914032,
0.007161789573729038,
0.018008435145020485,
-0.00020359120389912277,
-0.06246928870677948,
-0.010991036891937256,
-0.02242102287709713,
0.020180074498057365,
0.022039830684661865,
0.03846574202179909,
-0.007860641926527023,
-0.016610732302069664,
... | 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(block.to_python({
'title': "Wagtail site",
'link': 'http://www.wagtail.io',
}))
... | |
20,393 | [
0.04105254262685776,
-0.002197031630203128,
0.0006294826162047684,
0.009266659617424011,
0.011991485953330994,
-0.02515397034585476,
0.014344744384288788,
-0.01890488713979721,
0.032923102378845215,
-0.022350328043103218,
0.011968966573476791,
-0.00039936433313414454,
-0.004799409303814173,
... | 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_bound_block(self):
# the string representation of a bound block should be the value as rendered by
# the associated block
class SectionBlock(blocks.StructBlock):
title = blocks.CharBlock()
body = blocks.RichTextBlock()
block = SectionBlock()
... | |
20,394 | [
-0.009951704181730747,
-0.025069460272789,
-0.009497680701315403,
0.010270748287439346,
-0.018529066815972328,
-0.06748998165130615,
-0.01256540697067976,
-0.04093573987483978,
0.004942107014358044,
0.0007094117463566363,
0.011675766669213772,
-0.0028990013524889946,
-0.0023007947020232677,
... | 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(block.to_python({
'title': "Wagtail site",
'link': 'http://www.wagtail.io',
... | |
20,395 | [
-0.003967020660638809,
-0.02446880005300045,
0.0017958200769498944,
0.006036117672920227,
-0.010204342193901539,
-0.060973796993494034,
-0.009117240086197853,
-0.015868082642555237,
0.00862474087625742,
0.025730077177286148,
0.02894934080541134,
0.002310842042788863,
-0.0027192558627575636,
... | 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(required=False)
link = blocks.URLBlock(required=False)
block = LinkBlock()
html = block.render_form(block.to_python({
'title': "Wagtail site",
'link': 'http:... | |
20,396 | [
-0.007992147468030453,
-0.034353937953710556,
-0.006289205513894558,
0.012824323028326035,
-0.033640794456005096,
-0.027247074991464615,
-0.0030631443951278925,
0.004921318497508764,
0.006418309174478054,
0.037968847900629044,
0.03934595733880997,
0.02059515006840229,
0.02486172690987587,
... | 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_get_form_context(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
link = blocks.URLBlock()
block = LinkBlock()
context = block.get_form_context(block.to_python({
'title': "Wagtail site",
'link': 'http://www.wagtail.i... | |
20,397 | [
-0.011562129482626915,
-0.04205022752285004,
-0.0028793069068342447,
0.01635536178946495,
0.00753783481195569,
-0.05828211084008217,
-0.01764627918601036,
-0.013605146668851376,
0.009395632892847061,
0.024314148351550102,
0.018667787313461304,
-0.0028007293585687876,
0.003272194880992174,
... | 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_custom_render_form_template_jinja(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock(required=False)
link = blocks.URLBlock(required=False)
class Meta:
form_template = 'tests/jinja2/struct_block_form_template.html'
block = ... | |
20,398 | [
0.0074489233084023,
-0.03759501874446869,
0.004057911224663258,
0.02042519673705101,
-0.00065065041417256,
-0.055341318249702454,
0.0012596197193488479,
-0.023420589044690132,
0.010653429664671421,
0.029592230916023254,
0.012060699053108692,
-0.0004478961636777967,
0.009313980117440224,
-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_custom_render_form_template(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock(required=False)
link = blocks.URLBlock(required=False)
class Meta:
form_template = 'tests/block_forms/struct_block_form_template.html'
block = L... | |
20,399 | [
0.0015061238082125783,
0.013570968061685562,
-0.0261272843927145,
0.015461910516023636,
-0.007892376743257046,
-0.042684558779001236,
0.0009123219060711563,
-0.035236090421676636,
0.015980767086148262,
0.050870951265096664,
0.03355269134044647,
0.00725245475769043,
-0.00790967233479023,
-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_required_field_indicator(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
link = blocks.URLBlock(required=True)
block = LinkBlock()
html = block.render_form(block.to_python({
'title': "Wagtail site",
'link': '... | |
20,400 | [
0.00014498725067824125,
-0.013690209947526455,
-0.027356673032045364,
0.011362993158400059,
-0.023367159068584442,
-0.06368975341320038,
-0.0010448729153722525,
-0.02830655872821808,
0.007480340544134378,
0.003648150246590376,
0.009433540515601635,
-0.0052065541967749596,
-0.0002189186925534... | 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(block.to_python({
'title': "Wagtail site",
'link': 'http://www.wagtail.... |