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
18,201
[ 0.029453372582793236, -0.004881192930042744, -0.020909899845719337, -0.004257884807884693, 0.04341546818614006, -0.000009966432116925716, -0.028655538335442543, 0.042839255183935165, -0.03124849870800972, -0.00277302716858685, 0.015192089602351189, -0.08346230536699295, 0.023935019969940186,...
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": "erply", "annotation": ...
class ErplyResponse(object): def __init__(self, erply, data, request, page=0, *args, **kwargs): self.request = request self.erply = erply self.error = None # Result pagination setup self.page = page self.per_page = kwargs.get('recordsOnPage', 20) self.kwarg...
18,202
[ 0.011389239691197872, 0.0029275522101670504, -0.011047562584280968, -0.011472070589661598, 0.014971673488616943, 0.014806011691689491, -0.007221813313663006, 0.03021254763007164, -0.01635908894240856, -0.004390034358948469, -0.00408459547907114, -0.07562455534934998, 0.0388890765607357, -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": "erply", "annotation": ...
class ErplyCSVResponse(object): def __init__(self, erply, data): self.erply = erply status = data.get('status', {}) self.url = data.get('records').pop().get('reportLink') self.timestamp = datetime.fromtimestamp(status.get('requestUnixTime')) @property def records(self): ...
18,203
[ 0.07438872754573822, -0.0016067815013229847, -0.02370440401136875, -0.0161944180727005, 0.03103121928870678, -0.01489067543298006, -0.029910648241639137, 0.021840376779437065, -0.024286240339279175, -0.03422053903341293, 0.015817303210496902, -0.046158939599990845, -0.009551797062158585, -...
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": "key", "annotation": null, "type_comment": null}}], "kwarg": null,...
def __getitem__(self, key): if isinstance(key, slice): raise NotImplementedError if self.per_page * key >= self.total: raise IndexError if key not in self.records: self.fetch_records(key) return self.records[key]
18,204
[ 0.011554207652807236, -0.006659187842160463, 0.011717556975781918, -0.003618176793679595, 0.046652428805828094, 0.0037515785079449415, -0.0067898668348789215, 0.04586835578083992, -0.006327045150101185, 0.03833252936601639, 0.009980614297091961, -0.0624210387468338, 0.008407020010054111, -...
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": "erply", "annotation": null, "type_comment": null}}, {"_type": "ar...
def __init__(self, erply, response): if response.status_code != requests.codes.ok: print ('Request failed with error code {}'.format(response.status_code)) raise ValueError self.data = response.json() status = self.data.get('status', {}) if not status: ...
18,205
[ 0.03069595992565155, 0.009145860560238361, -0.021832741796970367, -0.02359258569777012, 0.015795940533280373, 0.009023204445838928, -0.020115559920668602, 0.051835428923368454, -0.01683051697909832, 0.018515700474381447, -0.008169946260750294, -0.07534269243478775, 0.02478714846074581, -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": "erply", "annotation": ...
class ErplyBulkResponse(object): def __init__(self, erply, response): if response.status_code != requests.codes.ok: print ('Request failed with error code {}'.format(response.status_code)) raise ValueError self.data = response.json() status = self.data.get('status', ...
18,206
[ 0.038501638919115067, 0.0021013859659433365, 0.06544793397188187, -0.012089417316019535, 0.04075930267572403, -0.03199568763375282, -0.04894029349088669, 0.020537445321679115, -0.006384572014212608, 0.014165010303258896, -0.00893961451947689, -0.04386662319302559, -0.011142656207084656, -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 records(self): if self._requests is None: raise ValueError for el in self._requests: _status = el.get('status') if _status.get('responseStatus') == 'error': print ('Request failed: requestID: {} errorField: {}'.format( _stat...
18,207
[ 0.013029751367866993, 0.024560289457440376, -0.027717169374227524, -0.04612215235829353, 0.024255571886897087, 0.013176016509532928, -0.01591848023235798, -0.029691744595766068, 0.001317906309850514, -0.007264482788741589, 0.004997379146516323, -0.04570773243904114, 0.050851378589868546, -...
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": "slicc", "annotation": ...
class ObjDeclAST(DeclAST): def __init__(self, slicc, type_ast, ident, pairs, rvalue, pointer): super(ObjDeclAST, self).__init__(slicc, pairs) self.type_ast = type_ast self.ident = ident self.rvalue = rvalue self.pointer = pointer def __repr__(self): return "[Obj...
18,208
[ 0.0065756686963140965, 0.04336797073483467, -0.032330822199583054, -0.015710046514868736, -0.02766876481473446, 0.0087657505646348, -0.014615005813539028, -0.011763561517000198, 0.021293673664331436, 0.027148349210619926, -0.010223998688161373, -0.038640860468149185, 0.027560345828533173, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "obj", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "default", "annotation": null, "type_comment": null}}], "kwarg": nu...
def _cleanup_list(obj, default): if not obj: obj = default elif isinstance(obj, string_types): obj = [obj] elif not isinstance(obj, list): obj = list(obj) return obj
18,209
[ 0.012075388804078102, 0.033563535660505295, -0.025921067222952843, -0.03097286820411682, 0.02757621556520462, 0.01778925023972988, -0.0032293389085680246, -0.01670980453491211, -0.01895505003631115, 0.011571647599339485, 0.0337650328874588, -0.01236324105411768, 0.04525032639503479, -0.013...
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": "parent", "annotation": null, "type_comment": null}}], "kwarg": nu...
def generate(self, parent = None): if "network" in self and not ("virtual_network" in self or "physical_network" in self) : self.error("Network queues require a 'virtual_network' attribute") type = self.type_ast.type if type.isBuffer and "order...
18,210
[ 0.025686101987957954, 0.04885236173868179, -0.022597266361117363, -0.003952489700168371, -0.008595902472734451, -0.01621638424694538, 0.022150197997689247, 0.021540559828281403, -0.02838883176445961, -0.004323353059589863, -0.004264929331839085, 0.009769456461071968, -0.006736505310982466, ...
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}}, {"_type": "arg", "_fields": {"arg": "workflow", "annotation...
class WorkflowContext(dict): def __init__(self, workflow, *args, **kwargs): super(WorkflowContext, self).__init__(*args, **kwargs) self._workflow = workflow def __setitem__(self, key, val): super(WorkflowContext, self).__setitem__(key, val) return self._workflow._trigger_handler...
18,211
[ 0.023428941145539284, -0.010154851712286472, 0.02319788746535778, -0.07458443939685822, -0.03280976042151451, 0.025901226326823235, 0.043415166437625885, 0.009975784458220005, 0.010131746530532837, 0.029667416587471962, -0.007821199484169483, -0.004739508498460054, 0.028558354824781418, -0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "suffix", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "trigger_rule", "annotation": null, "type_comment": null}}, {"_t...
def create_test_pipeline(suffix, trigger_rule, dag): skip_operator = DummySkipOperator(task_id='skip_operator_{}'.format(suffix), dag=dag) always_true = DummyOperator(task_id='always_true_{}'.format(suffix), dag=dag) join = DummyOperator(task_id=trigger_rule, dag=dag, trigger_rule=trigger_rule) join...
18,212
[ 0.03035253845155239, 0.0491851381957531, 0.0076256999745965, -0.018820077180862427, -0.007525526452809572, 0.02206319011747837, 0.045954544097185135, -0.027146989479660988, -0.002623290754854679, 0.015389137901365757, 0.05354268103837967, -0.07302640378475189, 0.019947027787566185, 0.00566...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "mcs", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def __new__(mcs, name, bases, attrs): # Pop Meta for later processing opts = attrs.pop("Meta", None) # Create our new class cls = super(ActionMetaclass, mcs).__new__(mcs, name, bases, attrs) # Process options from Meta cls.name = getattr(opts, "name", name) cls.sl...
18,213
[ 0.02991856448352337, 0.04949038848280907, -0.0019843655172735453, -0.023085596039891243, -0.006901642773300409, 0.027423443272709846, 0.03772440180182457, -0.034267857670784, -0.012475606985390186, -0.01993807964026928, 0.03648828715085983, -0.07709696143865585, 0.01649298146367073, 0.0118...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "mcs", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": nu...
class ActionMetaclass(forms.forms.DeclarativeFieldsMetaclass): def __new__(mcs, name, bases, attrs): # Pop Meta for later processing opts = attrs.pop("Meta", None) # Create our new class cls = super(ActionMetaclass, mcs).__new__(mcs, name, bases, attrs) # Process options from...
18,214
[ 0.007888012565672398, -0.00021566594659816474, -0.0034422457683831453, 0.013937171548604965, 0.0398268960416317, -0.028367692604660988, -0.002340615028515458, -0.007355417590588331, -0.0031226887367665768, 0.04366157948970795, 0.007310567423701286, -0.04092572256922722, -0.005603460595011711...
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": "request", "annotation": null, "type_comment": null}}, {"_type": "...
def __init__(self, request, context, *args, **kwargs): if request.method == "POST": super(Action, self).__init__(request.POST, initial=context) else: super(Action, self).__init__(initial=context) if not hasattr(self, "handle"): raise AttributeError("The actio...
18,215
[ 0.017295198515057564, -0.0018000808777287602, -0.00801924429833889, -0.02826564759016037, -0.006680128630250692, -0.026638107374310493, -0.013968009501695633, -0.010105174966156483, -0.02812143601477146, 0.027462178841233253, 0.004735835362225771, -0.01827378198504448, -0.005959066096693277,...
15
{"_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": "workflow", "annotation": null, "type_comment": null}}], "kwarg": ...
def __init__(self, workflow): super(Step, self).__init__() self.workflow = workflow cls = self.__class__.__name__ if not (self.action_class and issubclass(self.action_class, Action)): raise AttributeError("You must specify an action for %s." % cls) self.slug = self....
18,216
[ 0.0257586520165205, 0.024375194683670998, -0.017589667811989784, -0.011660566553473473, 0.012330334633588791, -0.02641744166612625, -0.005542062688618898, 0.00972811784595251, 0.011237842962145805, -0.037045903503894806, 0.010952368378639221, -0.017644567415118217, -0.0087015051394701, -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 action(self): if not getattr(self, "_action", None): try: # Hook in the action context customization. workflow_context = dict(self.workflow.context) context = self.prepare_action_context(self.workflow.request, ...
18,217
[ 0.013626346364617348, 0.014919615350663662, -0.021139061078429222, 0.016730191186070442, 0.009417345747351646, -0.025254005566239357, 0.006877836771309376, 0.04481763020157814, 0.010551895014941692, 0.0488620325922966, 0.016812490299344063, -0.0022837945725768805, 0.0010919300839304924, -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": "context", "annotation": null, "type_comment": null}}], "kwarg": n...
def _verify_contributions(self, context): for key in self.contributes: # Make sure we don't skip steps based on weird behavior of # POST query dicts. field = self.action.fields.get(key, None) if field and field.required and not context.get(key): co...
18,218
[ -0.00855587050318718, -0.011899680830538273, -0.0014234993141144514, -0.008543970994651318, -0.04069690778851509, 0.024751335382461548, -0.004977041389793158, -0.006651921663433313, -0.030939171090722084, 0.0341520830988884, 0.018277909606695175, -0.04302924498915672, 0.015279190614819527, ...
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 _gather_steps(self): ordered_step_classes = self._order_steps() for default_step in self.default_steps: self.register(default_step) self._registry[default_step] = default_step(self) self._ordered_steps = [self._registry[step_class] for s...
18,219
[ 0.030003931373357773, 0.02797752246260643, -0.007402930874377489, -0.02259555459022522, -0.01280124206095934, -0.024338701739907265, 0.02276986837387085, -0.01639648526906967, -0.03985271602869034, 0.050899915397167206, 0.007844164967536926, 0.0027168593369424343, -0.010437097400426865, -0...
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": "request", "annotation": null, "type_comment": null}}, {"_type": "...
def __init__(self, request=None, context_seed=None, entry_point=None, *args, **kwargs): super(Workflow, self).__init__(*args, **kwargs) if self.slug is None: raise AttributeError("The workflow %s must have a slug." % self.__class__.__name__) ...
18,220
[ -0.011813316494226456, 0.046066638082265854, 0.016591617837548256, 0.016517452895641327, -0.0022116859909147024, -0.005737139843404293, -0.04526142403483391, -0.005021984223276377, 0.01155903935432434, 0.016157226637005806, -0.0005502727581188083, -0.062425170093774796, 0.0074217296205461025...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "actions", "ctx": {"_type": "Store", "_fields": {}}}}], "type_...
class FileBrowserAdmin(admin.ModelAdmin): actions = [] def has_add_permission(self, request): return False def has_delete_permission(self, request, obj=None): return False def get_urls(self): opts = self.model._meta info = opts.app_label, (opts.model_name if hasattr(op...
18,221
[ 0.011853452771902084, -0.015453641302883625, 0.011808167211711407, -0.06652424484491348, -0.06394298374652863, -0.01668766885995865, -0.022586092352867126, -0.027488235384225845, -0.03190356120467186, 0.029299652203917503, 0.015532891266047955, -0.043202269822359085, -0.034348972141742706, ...
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 _order_steps(self): steps = list(copy.copy(self.default_steps)) additional = self._registry.keys() for step in additional: try: min_pos = steps.index(step.after) except ValueError: min_pos = 0 try: max_pos = ...
18,222
[ 0.012556768953800201, 0.06416764855384827, 0.05893993750214577, -0.07175296545028687, -0.010314488783478737, 0.0033057616092264652, -0.005147634539753199, -0.028316795825958252, 0.018168875947594643, 0.05163650959730148, 0.016323799267411232, 0.03682464733719826, -0.014132771641016006, 0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg...
def main(): colorama.init() parser = argparse.ArgumentParser(description=sys.modules[__name__].__doc__) group = parser.add_mutually_exclusive_group(required=True) group.add_argument( '-c', '--check', dest='mode', action='store_const', const='check', default='check', help='Only check the files') gr...
18,223
[ -0.00010230614134343341, 0.018975362181663513, 0.00233596027828753, -0.00331982527859509, -0.01092607993632555, 0.01671995222568512, 0.017778614535927773, 0.01075922604650259, 0.02699587494134903, -0.05256485939025879, 0.04444077983498573, -0.01737586222589016, 0.045844659209251404, 0.0276...
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 MapPyGroupConvert: # pylint:disable = C0111, W0232, R0201 def __init__(self): pass def birth(self, _json): pass def death(self): pass def process(self, data): data = maus_cpp.converter. json_repr(data)...
18,224
[ 0.009520127438008785, 0.022815577685832977, -0.010525321587920189, 0.004473700188100338, 0.00061071413801983, 0.00031868903897702694, 0.01623506098985672, -0.0105428546667099, 0.03120778314769268, -0.06302335858345032, 0.04600518196821213, -0.012354542501270771, 0.04273245483636856, 0.0109...
8
{"_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 MapPyGroupNoConvert: # pylint:disable = C0111, W0232, R0201 def __init__(self): pass def birth(self, _json): pass def death(self): pass def process(self, data): if type(data) != type(""): ...
18,225
[ 0.02495468221604824, 0.01245671696960926, 0.03648333251476288, -0.09495153278112411, -0.018942872062325478, -0.02483093924820423, -0.01337447203695774, -0.017509525641798973, -0.020603081211447716, 0.05968499928712845, 0.015261541120707989, -0.024232853204011917, 0.007223452441394329, 0.03...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value...
def main(): if len(sys.argv) <= 1: print('Usage: %s [ --apply ] filename1.rs filename2.rs ...' % sys.argv[0]) elif sys.argv[1] == '--apply': for filename in sys.argv[2:]: patch(filename) else: for filename in sys.argv[1:]: diff(filename)
18,226
[ 0.062289826571941376, 0.019518518820405006, -0.020878462120890617, -0.010444805026054382, 0.005729593802243471, 0.042269688099622726, 0.0027575064450502396, -0.02760014496743679, 0.02077813819050789, 0.03370874002575874, 0.036807626485824585, 0.002697590971365571, 0.005007821135222912, 0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def diff(filename): rewritten = rewrite_bytes_macros(read(filename)) if rewritten is not None: p = subprocess.Popen(['diff', '-u', filename, '-'], stdin=subprocess.PIPE) p.stdin.write(rewritten) p.stdin.close() p.wait()
18,227
[ -0.011697690933942795, -0.02664368599653244, 0.04229116439819336, -0.03273583948612213, -0.04105251282453537, -0.005396989639848471, -0.03157301992177963, 0.03511203080415726, -0.029019879177212715, 0.04931862652301788, 0.010566472075879574, -0.03622429072856903, 0.03915661200881004, 0.010...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Try", "_fields": {"body": [{"_type": "Expr", "_fields": {"valu...
def main(): try: # As a workaround for #885 in setuptools, don't expose other helpers # in sys.path so as not no confuse it with possible combination of # namespace/ordinary packages sys.path.remove(os.path.dirname(__file__)) except ValueError: pass try: if l...
18,228
[ 0.029342304915189743, 0.021122530102729797, -0.02279268391430378, -0.03803147003054619, 0.03569543734192848, 0.004863094072788954, -0.017291001975536346, -0.015795504674315453, -0.03349040076136589, -0.02055489644408226, -0.017749475315213203, -0.077285535633564, 0.03436368331313133, 0.018...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "score_function"}}, "targets": [{"_type": "Name", "_fields": {"id": "_type_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comme...
class ScoreFunction(DslBase): _type_name = 'score_function' _type_shortcut = staticmethod(SF) _param_defs = { 'query': {'type': 'query'}, 'filter': {'type': 'filter'}, 'weight': {} } name = None def to_dict(self): d = super(ScoreFunction, self).to_dict() ...
18,229
[ 0.020452361553907394, 0.02216624654829502, -0.020223844796419144, -0.029638785868883133, 0.010517541319131851, -0.02252045087516308, -0.03366070240736008, -0.00850658304989338, -0.011505882255733013, 0.017573034390807152, -0.017093148082494736, -0.057815056294202805, 0.0024579968303442, 0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name_or_sf", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "params", "annotation": null, "type_comment": null...
def SF(name_or_sf, **params): # {"script_score": {"script": "_score"}, "filter": {}} if isinstance(name_or_sf, dict): if params: raise ValueError('SF() cannot accept parameters when passing in a dict.') kwargs = {} sf = name_or_sf.copy() for k in ScoreFunction._param_...
18,230
[ 0.010097415186464787, 0.04049929603934288, 0.05670339986681938, 0.003883832134306431, -0.054203715175390244, -0.01600676029920578, 0.010349576361477375, -0.0026518048252910376, -0.05569475516676903, 0.003009490203112364, -0.004980185534805059, 0.027014149352908134, -0.05845756456255913, -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 updateText(self): ## Needed to maintain font size when rendering to image with increased resolution self.textItem.resetTransform() #self.textItem.rotate(self.angle) if self._exportOpts is not False and 'resolutionScale' in self._exportOpts: s = self._exportOpts['...
18,231
[ 0.040406420826911926, 0.003599609015509486, -0.0008309908444061875, -0.0007654574001207948, 0.04687058553099632, 0.004377902951091528, -0.012744561769068241, 0.004653548821806908, -0.005329150706529617, -0.0037509440444409847, 0.019705967977643013, -0.05322664976119995, -0.016225265339016914...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "boost_factor"}}, "targets": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": nul...
class BoostFactor(ScoreFunction): name = 'boost_factor' def to_dict(self): d = super(BoostFactor, self).to_dict() if 'value' in d[self.name]: d[self.name] = d[self.name].pop('value') else: del d[self.name] return d
18,232
[ -0.0004667633620556444, 0.01541421189904213, 0.03733538091182709, -0.023616164922714233, -0.03740363568067551, -0.02402569353580475, -0.003984374459832907, 0.01890658214688301, 0.04254549741744995, 0.05951819568872452, 0.01109140645712614, 0.022762980312108994, 0.04136241599917412, -0.0056...
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": "args", "annotation": null, "type_comment": null}}, {"_type": "arg...
def run_vsctl(self, args, check_error=False): full_args = ["ivs-ctl"] + args try: return utils.execute(full_args, root_helper=self.root_helper) except Exception as e: with excutils.save_and_reraise_exception() as ctxt: LOG.error(_("Unable to execute %(cmd)...
18,233
[ -0.008425850421190262, 0.0352897122502327, 0.038186460733413696, 0.009943192824721336, -0.01611601933836937, -0.005609570071101189, 0.018047181889414787, 0.017541401088237762, -0.06736082583665848, 0.051405731588602066, 0.02153017371892929, 0.04818712919950485, 0.02204745076596737, -0.0270...
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": "p", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def paint(self, p, *args): tr = p.transform() if self.lastTransform is not None: if tr != self.lastTransform: self.viewRangeChanged() self.lastTransform = tr if self.border.style() != QtCore.Qt.NoPen or self.fill.style() != QtCore.Qt.NoBrush: ...
18,234
[ 0.0036340742371976376, 0.00435560941696167, 0.05392156541347504, 0.007285746745765209, -0.013421730138361454, 0.06372975558042526, -0.02333550713956356, -0.0018449012422934175, 0.002177804708480835, 0.015533540397882462, 0.0036780701484531164, -0.05195054039359093, -0.015134642831981182, -...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "1.1"}}, "targets": [{"_type": "Name", "_fields": {"id": "RPC_API_VERSION", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": n...
class RestProxyAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin): RPC_API_VERSION = '1.1' def __init__(self, integ_br, polling_interval, root_helper, vs='ovs'): super(RestProxyAgent, self).__init__() self.polling_interval = polling_interval self._setup_rpc() self.sg_agent = Secu...
18,235
[ 0.006822414230555296, -0.01267923042178154, 0.06106261909008026, 0.028830017894506454, -0.01661059632897377, 0.039382632821798325, 0.0014038539957255125, -0.007069561630487442, 0.021323638036847115, -0.002921223407611251, 0.011650407686829567, -0.044463519006967545, 0.010805509053170681, -...
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": "integ_br", "annotation": null, "type_comment": null}}, {"_type": ...
def __init__(self, integ_br, polling_interval, root_helper, vs='ovs'): super(RestProxyAgent, self).__init__() self.polling_interval = polling_interval self._setup_rpc() self.sg_agent = SecurityGroupAgent(self.context, self.plugin_rpc, ...
18,236
[ -0.036478109657764435, -0.0015997865702956915, 0.031739767640829086, 0.005830664187669754, -0.019751040264964104, 0.006964652333408594, 0.021774955093860626, 0.05809829756617546, 0.047597743570804596, -0.010113627649843693, 0.0028617577627301216, 0.0021757096983492374, 0.015738923102617264, ...
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 _setup_rpc(self): self.topic = topics.AGENT self.plugin_rpc = PluginApi(topics.PLUGIN) self.context = q_context.get_admin_context_without_session() self.dispatcher = dispatcher.RpcDispatcher([self]) consumers = [[topics.PORT, topics.UPDATE], [topics.SECUR...
18,237
[ -0.010397069156169891, -0.007141648791730404, 0.012221907265484333, -0.0003359968541190028, 0.014249504543840885, 0.02728245034813881, -0.017595039680600166, 0.02464657463133335, -0.01779779978096485, 0.04476484656333923, 0.010723737999796867, 0.013078004121780396, -0.040078844875097275, 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": "context", "annotation": null, "type_comment": null}}], "kwarg": {...
def port_update(self, context, **kwargs): LOG.debug(_("Port update received")) port = kwargs.get('port') vif_port = self.int_br.get_vif_port_by_id(port['id']) if not vif_port: LOG.debug(_("Port %s is not present on this host."), port['id']) return LOG.deb...
18,238
[ 0.00008291225822176784, 0.019013509154319763, 0.013955667614936829, -0.028532691299915314, 0.0026407651603221893, 0.041606031358242035, -0.02177233248949051, -0.018702831119298935, 0.046427756547927856, 0.06213565170764923, 0.008904038928449154, -0.015185953117907047, 0.019125353544950485, ...
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": "registered_ports", "annotation": null, "type_comment": null}}], "...
def _update_ports(self, registered_ports): ports = self.int_br.get_vif_port_set() if ports == registered_ports: return added = ports - registered_ports removed = registered_ports - ports return {'current': ports, 'added': added, 'remove...
18,239
[ 0.012751077301800251, 0.005800140090286732, 0.013551096431910992, -0.011532586067914963, 0.0017385034589096904, 0.059176813811063766, -0.02084973454475403, -0.035200849175453186, 0.00016308085469063371, 0.023237483575940132, 0.02208053320646286, -0.05262896418571472, -0.01681271381676197, ...
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 daemon_loop(self): ports = set() while True: start = time.time() try: port_info = self._update_ports(ports) if port_info: LOG.debug(_("Agent loop has new device")) self._process_devices_filter(port_info)...
18,240
[ 0.011588036082684994, 0.013229344971477985, 0.056582313030958176, -0.015107952058315277, -0.023822050541639328, 0.03968144580721855, -0.0018720149528235197, 0.024784423410892487, 0.01647900603711605, 0.017335914075374603, 0.020420782268047333, -0.0032364765647798777, 0.01643945463001728, 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": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg...
def main(): eventlet.monkey_patch() cfg.CONF(project='neutron') config.setup_logging(cfg.CONF) pl_config.register_config() integ_br = cfg.CONF.RESTPROXYAGENT.integration_bridge polling_interval = cfg.CONF.RESTPROXYAGENT.polling_interval root_helper = cfg.CONF.AGENT.root_helper bsnagent ...
18,241
[ -0.007178997155278921, -0.025185687467455864, -0.06014428287744522, -0.030653348192572594, 0.020525258034467697, 0.006554736290127039, -0.06733404099941254, 0.0014072771882638335, -0.02466905675828457, -0.004350988660007715, 0.0069045377895236015, -0.02130020223557949, 0.017468534409999847, ...
13
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "ForumCategory", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "model", "ctx": {"_type": "Store", "_fields": {}}}}...
class ForumCategoryHome(DetailWithListMixin, DetailView): model = ForumCategory def dispatch(self, request, *args, **kwargs): self.list_model = self.get_list_model() self.list_attribute = self.get_list_attribute() return super(ForumCategoryHome, self).dispatch(request, *args, **kwargs) ...
18,242
[ -0.008399931713938713, -0.03788629174232483, -0.03403271362185478, -0.008762557990849018, 0.014050401747226715, -0.00004807668665307574, -0.042995527386665344, 0.017243674024939537, -0.019257059320807457, 0.01597718894481659, -0.014829776249825954, -0.012350930832326412, 0.014645757153630257...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "ForumThread", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "model", "ctx": {"_type": "Store", "_fields": {}}}}],...
class ForumThreadHome(DetailWithListMixin, DetailView): model = ForumThread list_model = ForumPost list_attribute = 'forumpost_set' def get_list_queryset(self): return (self.list_model.objects.filter(thread=self.get_object(), is_thread_starter=False).order_by('created')) de...
18,243
[ -0.00012761499965563416, -0.04775463417172432, -0.060249898582696915, -0.00634986674413085, 0.027103366330266, 0.009496401995420456, -0.02059447020292282, 0.0060829222202301025, -0.0218780729919672, 0.031192725524306297, 0.008661490865051746, 0.0027390189934521914, 0.009996212087571621, 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 get_context_data(self, **kwargs): context = super(ForumCategoryHome, self).get_context_data(**kwargs) if self.list_attribute == 'forumthread_set': context['list_type'] = 'threads' else: context['list_type'] = 'categories' context['extra_title'] = ' - %s' % sel...
18,244
[ 0.014670074917376041, 0.003751168493181467, -0.07152053713798523, -0.010701939463615417, -0.018612070009112358, -0.01868526265025139, 0.0177023783326149, 0.03856253623962402, -0.036638591438531876, 0.030469421297311783, -0.017284128814935684, 0.012306969612836838, 0.019260354340076447, 0.0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "ForumThread", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "model", "ctx": {"_type": "Store", "_fields": {}}}}],...
class ForumThreadCreateView(RequestForFormMixIn, CreateView): model = ForumThread form_class = ThreadCreateUpdateForm def get_form_kwargs(self): kwargs = super(ForumThreadCreateView, self).get_form_kwargs() kwargs.update({'category': ForumCategory.objects.get(slug=self.kwargs['slug'])}) ...
18,245
[ 0.009148107841610909, -0.00002089818190142978, -0.04127572476863861, 0.001405408140271902, 0.007148184813559055, -0.0062070442363619804, 0.0018864821176975965, 0.046608854085206985, -0.012481313198804855, 0.043225228786468506, -0.011058398522436619, -0.014834163710474968, 0.02570209279656410...
14
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "ForumThread", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "model", "ctx": {"_type": "Store", "_fields": {}}}}],...
class ForumThreadReply(RequestForFormMixIn, CreateView): model = ForumThread form_class = ThreadReplyForm template_name = 'thatforum/forumpost_form.html' def get_context_data(self, **kwargs): context = super(ForumThreadReply, self).get_context_data(**kwargs) context['posts'] = ( ...
18,246
[ 0.0012502761092036963, -0.0368947796523571, -0.03646603599190712, 0.014520972967147827, 0.01603286899626255, 0.004817758686840534, -0.030734367668628693, 0.032381657510995865, -0.014509690925478935, 0.0593024380505085, -0.007023547776043415, -0.022678444162011147, -0.021741969510912895, 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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v...
def get_context_data(self, **kwargs): context = super(ForumThreadReply, self).get_context_data(**kwargs) context['posts'] = ( self.get_object().forumpost_set.all().order_by('-created')[:5] ) context['object'] = self.get_object() context['show_cancel'] = self.get_obje...
18,247
[ 0.006832872983068228, -0.0344989188015461, 0.03279779106378555, 0.01800929754972458, 0.00043343380093574524, -0.021978601813316345, -0.011148073710501194, 0.014198767021298409, 0.03944353759288788, -0.02957698330283165, 0.0034419535659253597, -0.03708463907241821, 0.0013764979084953666, -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 TaikoaTestCase(unittest.TestCase): def setUp(self): taikoa.app.config['TESTING'] = True taikoa.mail = Mail(taikoa.app) self.app = taikoa.app.test_client() def tearDown(self): pass def test_contact(self): rv = self.app.post('/contact_form', data={'subject': 'He...
18,248
[ 0.0358850434422493, 0.013013381510972977, -0.020109547302126884, -0.014585317112505436, 0.04603525623679161, -0.05937425419688225, -0.012395835481584072, -0.025914480909705162, 0.006422479636967182, -0.03173064440488815, 0.021771308034658432, -0.03507662191987038, 0.019458318129181862, -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": "attributes", "annotation": null, "type_comment": null}}], "kwarg"...
def _useAttributes(self, attributes): if "body" in attributes: self._body = self._makeStringAttribute(attributes["body"]) if "name" in attributes: self._title = self._makeStringAttribute(attributes["name"]) if "tag_name" in attributes: self._tag_name = self._m...
18,249
[ 0.040804799646139145, 0.0069587514735758305, -0.016132377088069916, -0.022319117560982704, -0.029176708310842514, -0.015802275389432907, -0.006543462630361319, 0.003929272294044495, -0.01909264177083969, 0.008007622323930264, 0.009338676929473877, 0.001215252559632063, -0.030092474073171616,...
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": "name", "annotation": null, "type_comment": null}}, {"_type": "arg...
def update_release(self, name, message, draft=False, prerelease=False): assert isinstance(name, (str, unicode)), name assert isinstance(message, (str, unicode)), message assert isinstance(draft, bool), draft assert isinstance(prerelease, bool), prerelease post_parameters = { ...
18,250
[ -0.019268769770860672, -0.025120940059423447, 0.06497199088335037, -0.03893628343939781, 0.04233734682202339, -0.025613507255911827, -0.013733250088989735, 0.024370361119508743, 0.0028850380331277847, 0.031946517527103424, -0.002493622712790966, -0.042431168258190155, -0.007247778587043285, ...
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_subnet_request_different_versions(self): pools = [netaddr.IPRange('0.0.0.1', '0.0.0.2'), netaddr.IPRange('::1', '::2')] self.assertRaises(ValueError, ipam_req.SubnetRequest, self.tenant_id, self.subne...
18,251
[ -0.03550220653414726, -0.004380329046398401, 0.05951502546668053, -0.0293668732047081, 0.027091974392533302, -0.01033470407128334, -0.012052367441356182, -0.0007719431887380779, 0.03768518939614296, 0.03982221707701683, -0.005655650980770588, -0.0534486286342144, -0.01837152987718582, 0.04...
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 TestIpamSubnetRequests(IpamSubnetRequestTestCase): def test_subnet_request(self): pool = ipam_req.SubnetRequest(self.tenant_id, self.subnet_id) self.assertEqual(self.tenant_id, pool.tenant_id) self.assertEqual(self.subnet_id, pool.subnet_id) s...
18,252
[ -0.008605845272541046, -0.0077283866703510284, 0.08342607319355011, -0.018651623278856277, 0.02947361394762993, -0.02077777311205864, -0.019607827067375183, 0.028123676776885986, -0.02416386269032955, 0.018370386213064194, -0.019922813400626183, -0.03293845057487488, 0.0016860144678503275, ...
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_subnet_request_overlap(self): pools = [netaddr.IPRange('0.0.0.10', '0.0.0.20'), netaddr.IPRange('0.0.0.8', '0.0.0.10')] self.assertRaises(ValueError, ipam_req.SubnetRequest, self.tenant_id, self.subne...
18,253
[ -0.03570275381207466, 0.0003818610857706517, 0.05348502844572067, -0.012933610007166862, 0.032224614173173904, -0.012829956598579884, -0.011033302173018456, 0.010325005277991295, 0.03379092738032341, 0.035449378192424774, -0.004318881314247847, -0.049108561128377914, 0.003679686924442649, ...
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 TestIpamAnySubnetRequest(IpamSubnetRequestTestCase): def test_subnet_request(self): request = ipam_req.AnySubnetRequest(self.tenant_id, self.subnet_id, constants.IPv4, 24, ...
18,254
[ -0.01514333114027977, -0.009437540546059608, 0.04863172397017479, -0.007539215497672558, 0.03645215928554535, -0.028772328048944473, -0.003169282805174589, 0.02197946235537529, 0.03063279576599598, 0.03431046009063721, -0.021406179293990135, -0.05473232641816139, 0.00754462368786335, 0.018...
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_subnet_request(self): request = ipam_req.SpecificSubnetRequest(self.tenant_id, self.subnet_id, '1.2.3.0/24', gateway_ip='1.2.3.1') self.assertEqual(24, request....
18,255
[ -0.020399732515215874, -0.001664373674429953, 0.043265603482723236, -0.017695631831884384, 0.02725733071565628, -0.012244165875017643, 0.0011891280300915241, 0.009383227676153183, 0.039566393941640854, 0.022476481273770332, -0.018355432897806168, -0.04811134934425354, -0.009129042737185955, ...
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 TestIpamSpecificSubnetRequest(IpamSubnetRequestTestCase): def test_subnet_request(self): request = ipam_req.SpecificSubnetRequest(self.tenant_id, self.subnet_id, '1.2.3.0/24', ...
18,256
[ 0.0028791821096092463, -0.02872282639145851, 0.054558511823415756, 0.0054611582309007645, -0.0010641032131388783, -0.03857307881116867, -0.029720589518547058, 0.04462334141135216, 0.012249128893017769, 0.01982787996530533, 0.00987148191779852, -0.004742026329040527, -0.018851345404982567, ...
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_automatic_address_request_eui64(self): subnet_cidr = '2607:f0d0:1002:51::/64' port_mac = 'aa:bb:cc:dd:ee:ff' eui_addr = str(ipv6_utils.get_ipv6_addr_by_EUI64(subnet_cidr, port_mac)) request = ipam_req.AutomaticAddressReque...
18,257
[ -0.02030550129711628, -0.01854647882282734, 0.08278033137321472, -0.006280538626015186, 0.008505879901349545, -0.023504797369241714, -0.03293741121888161, 0.009875320829451084, 0.0027388816233724356, -0.009155184030532837, 0.0033616230357438326, -0.046962372958660126, 0.009113864041864872, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "EUI64", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Automati...
class TestAddressRequest(base.BaseTestCase): # This class doesn't test much. At least running through all of the # constructors may shake out some trivial bugs. EUI64 = ipam_req.AutomaticAddressRequest.EUI64 def setUp(self): super(TestAddressRequest, self).setUp() def test_specific_addr...
18,258
[ 0.0076501634903252125, -0.009600548073649406, 0.04389819875359535, -0.002091568661853671, 0.018316145986318588, -0.016895566135644913, -0.046739354729652405, -0.015533208847045898, 0.03209109604358673, -0.009361844509840012, 0.01851409487426281, -0.022892270237207413, 0.0018266658298671246, ...
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 TestAddressRequestFactory(base.BaseTestCase): def test_specific_address_request_is_loaded(self): for address in ('10.12.0.15', 'fffe::1'): ip = {'ip_address': address} self.assertIsInstance( ipam_req.AddressRequestFactory.get_request(None, None, ip), ...
18,259
[ 0.0015347972512245178, 0.013614146038889885, 0.043065156787633896, -0.034024678170681, 0.024407150223851204, -0.03919677436351776, 0.00019335240358486772, -0.0230820681899786, 0.020528079941868782, 0.0072505478747189045, 0.0004174274508841336, 0.0035558140370994806, -0.03714503347873688, 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 TestIpamDriverLoader(base.BaseTestCase): def setUp(self): super(TestIpamDriverLoader, self).setUp() self.ctx = context.get_admin_context() def _verify_fake_ipam_driver_is_loaded(self, driver_name): mgr = manager.NeutronManager ipam_driver = mgr.load_class_for_provider('ne...
18,260
[ -0.013188349083065987, -0.0011693325359374285, 0.025343667715787888, -0.019581656903028488, 0.02860345132648945, -0.01625300571322441, -0.008092068135738373, 0.001185114961117506, 0.025779835879802704, 0.02851162664592266, 0.011282983236014843, -0.04517784342169762, 0.005274191964417696, 0...
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}}, {"_type": "arg", "_fields": {"arg": "id", "annotation": nul...
class TestSubnetRequestFactory(IpamSubnetRequestTestCase): def _build_subnet_dict(self, id=None, cidr='192.168.1.0/24', prefixlen=8, ip_version=4): subnet = {'cidr': cidr, 'prefixlen': prefixlen, 'ip_version': ip_version, 'ten...
18,261
[ 0.0010883256327360868, -0.0006948709487915039, 0.036915067583322525, -0.00853059533983469, 0.013975157402455807, -0.01949012279510498, -0.006887839641422033, 0.02996855601668358, 0.038769032806158066, 0.04120969772338867, -0.008202044293284416, -0.03184599056839943, 0.005993124563246965, 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_specific_subnet_request_is_loaded(self): addresses = [ '10.12.0.15/24', '10.12.0.0/24', 'fffe::1/64', 'fffe::/64'] for address in addresses: subnet, subnetpool = self._build_subnet_dict(cidr=address) self.assertIsInstance( ...
18,262
[ -0.022756006568670273, -0.026094725355505943, 0.05157442390918732, -0.046522416174411774, 0.010367601178586483, -0.062381330877542496, -0.012651988305151463, 0.022184910252690315, 0.01406874693930149, -0.018901104107499123, 0.0003229579306207597, -0.030070437118411064, -0.011498812586069107,...
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 TestGetRequestFactory(base.BaseTestCase): def setUp(self): super(TestGetRequestFactory, self).setUp() cfg.CONF.set_override('ipam_driver', 'fake') self.driver = driver.Pool.get_instance(None, None) def test_get_subnet_request_factory(self): self.assertEqual( s...
18,263
[ 0.0017674276605248451, -0.014810021035373211, 0.046350933611392975, -0.026073820888996124, 0.024982675909996033, -0.030915776267647743, -0.016389908269047737, 0.023823333904147148, 0.026232946664094925, 0.032006923109292984, -0.018219849094748497, -0.05360250174999237, -0.0060126641765236855...
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_args_are_passed_to_specific_request(self): subnet, subnetpool = self._build_subnet_dict() request = ipam_req.SubnetRequestFactory.get_request(None, subnet, subnetpool) ...
18,264
[ -0.013010877184569836, 0.014997181482613087, -0.012799317948520184, -0.032603587955236435, -0.012787564657628536, 0.02328324131667614, -0.018170565366744995, 0.0026533021591603756, 0.0114006781950593, 0.05147935077548027, 0.022719083353877068, -0.040078673511743546, 0.0034084501676261425, ...
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": "filename", "annotation...
class ParserGenerator(object): def __init__(self, filename, stream=None): close_stream = None if stream is None: stream = open(filename) close_stream = stream.close self.filename = filename self.stream = stream self.generator = tokenize.generate_tokens...
18,265
[ 0.04466845840215683, 0.012507600709795952, -0.024301717057824135, -0.03612826392054558, -0.030939286574721336, -0.01417239848524332, 0.05794359743595123, -0.021782901138067245, 0.018107373267412186, 0.04938178136944771, 0.018593840301036835, -0.027134034782648087, 0.024820614606142044, 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}}, {"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}, {"_type": ...
def __init__(self, filename, stream=None): close_stream = None if stream is None: stream = open(filename) close_stream = stream.close self.filename = filename self.stream = stream self.generator = tokenize.generate_tokens(stream.readline) self.gett...
18,266
[ 0.018615856766700745, 0.010474505834281445, -0.0239364355802536, -0.03249133750796318, -0.016109876334667206, 0.023022925481200218, -0.009215342812240124, 0.010665848851203918, 0.019702192395925522, 0.021442800760269165, 0.01902323216199875, -0.006376054137945175, -0.0002119822020176798, -...
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": "c", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def make_label(self, c, label): # XXX Maybe this should be a method on a subclass of converter? ilabel = len(c.labels) if label[0].isalpha(): # Either a symbol name or a named token if label in c.symbol2number: # A symbol name (a non-terminal) ...
18,267
[ 0.03424927592277527, -0.018582822754979134, 0.018390005454421043, 0.0008970550261437893, -0.025042220950126648, 0.010496523231267929, -0.00512473750859499, 0.014871078543365002, -0.035888224840164185, 0.08300809562206268, 0.004537245724350214, -0.05268748477101326, 0.033140573650598526, -0...
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 make_grammar(self): c = grammar.Grammar() names = list(self.dfas.keys()) names.sort() names.remove(self.startsymbol) names.insert(0, self.startsymbol) for name in names: i = 256 + len(c.symbol2number) c.symbol2number[name] = i c.num...
18,268
[ 0.017596762627363205, 0.01840457133948803, 0.04440254345536232, 0.00044513618922792375, -0.01700437068939209, 0.0021726684644818306, -0.0006130089168436825, -0.025863338261842728, -0.016304269433021545, 0.03204307332634926, 0.05353078246116638, -0.05999324843287468, -0.01937394216656685, -...
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": "name", "annotation": null, "type_comment": null}}], "kwarg": null...
def calcfirst(self, name): dfa = self.dfas[name] self.first[name] = None # dummy to detect left recursion state = dfa[0] totalset = {} overlapcheck = {} for label, next in state.arcs.items(): if label in self.dfas: if label in self.first: ...
18,269
[ 0.003637758083641529, 0.03541838750243187, 0.03567939251661301, -0.025865601375699043, 0.002264218870550394, 0.02252473682165146, 0.0017471025930717587, 0.03155551105737686, 0.031164003536105156, 0.05486326292157173, -0.00021920347353443503, -0.05930034816265106, 0.008919848129153252, -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 parse(self): dfas = {} startsymbol = None # MSTART: (NEWLINE | RULE)* ENDMARKER while self.type != token.ENDMARKER: while self.type == token.NEWLINE: self.gettoken() # RULE: NAME ':' RHS NEWLINE name = self.expect(token.NAME) ...
18,270
[ -0.011623838916420937, 0.023336663842201233, 0.00814224872738123, -0.04858653247356415, -0.007074412889778614, 0.02051134780049324, -0.04002159833908081, 0.011156660504639149, 0.007296878844499588, 0.02030000649392605, 0.05681777000427246, 0.008086632005870342, -0.06540495157241821, -0.046...
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": "name", "annotation": null, "type_comment": null}}, {"_type": "arg...
def dump_nfa(self, name, start, finish): print("Dump of NFA for", name) todo = [start] for i, state in enumerate(todo): print(" State", i, state is finish and "(final)" or "") for label, next in state.arcs: if next in todo: j = todo.in...
18,271
[ 0.0023403542581945658, 0.03266999125480652, 0.023596199229359627, -0.024138890206813812, 0.012905188836157322, 0.006316921673715115, 0.001522247912362218, -0.0029332442209124565, 0.00925830565392971, 0.08452952653169632, 0.01183066051453352, -0.016975369304418564, -0.025354517623782158, -0...
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": "start", "annotation": null, "type_comment": null}}, {"_type": "ar...
def make_dfa(self, start, finish): # To turn an NFA into a DFA, we define the states of the DFA # to correspond to *sets* of states of the NFA. Then do some # state reduction. Let's represent sets as dicts with 1 for # values. assert isinstance(start, NFAState) assert i...
18,272
[ -0.02752419002354145, -0.022750748321413994, -0.00636269012466073, -0.006693071685731411, 0.001798585057258606, 0.02292163483798504, -0.009227894246578217, 0.027319123968482018, 0.013181079179048538, 0.06302310526371002, 0.005593698937445879, -0.022465934976935387, -0.037503987550735474, 0...
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": "dfa", "annotation": null, "type_comment": null}}], "kwarg": null,...
def simplify_dfa(self, dfa): # This is not theoretically optimal, but works well enough. # Algorithm: repeatedly look for two states that have the same # set of arcs (same labels pointing to the same nodes) and # unify them, until things stop changing. # dfa is a list of DFAStat...
18,273
[ -0.011604499071836472, -0.0029851284343749285, 0.054002322256565094, -0.010920469649136066, 0.03758561611175537, 0.012420534156262875, -0.03585754334926605, 0.021600928157567978, -0.011598498560488224, 0.017508752644062042, -0.007926341146230698, -0.02844122238457203, -0.00822635367512703, ...
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 parse_rhs(self): # RHS: ALT ('|' ALT)* a, z = self.parse_alt() if self.value != "|": return a, z else: aa = NFAState() zz = NFAState() aa.addarc(a) z.addarc(zz) while self.value == "|": self.getto...
18,274
[ 0.002184690907597542, -0.004670718684792519, 0.01486192550510168, -0.02854260988533497, 0.03534076735377312, -0.0113182058557868, -0.012788728810846806, 0.01987616717815399, 0.033098820596933365, -0.019683312624692917, -0.006846369244158268, -0.031748831272125244, 0.005948386155068874, -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 parse_alt(self): # ALT: ITEM+ a, b = self.parse_item() while (self.value in ("(", "[") or self.type in (token.NAME, token.STRING)): c, d = self.parse_item() b.addarc(c) b = d return a, b
18,275
[ 0.02514459937810898, 0.022273218259215355, -0.038094412535429, -0.00938060600310564, 0.03155086562037468, -0.00824234914034605, -0.02175842970609665, 0.0033918896224349737, 0.05811399593949318, 0.0003138784959446639, -0.017788831144571304, -0.032420288771390915, 0.018967127427458763, -0.03...
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 parse_item(self): # ITEM: '[' RHS ']' | ATOM ['+' | '*'] if self.value == "[": self.gettoken() a, z = self.parse_rhs() self.expect(token.OP, "]") a.addarc(z) return a, z else: a, z = self.parse_atom() value =...
18,276
[ 0.002517918823286891, 0.020314734429121017, -0.002629318507388234, 0.007723712362349033, 0.010414443910121918, 0.0024393678177148104, 0.0014067782321944833, -0.0040046763606369495, -0.004987278953194618, 0.031329020857810974, 0.00899195484817028, -0.0232853926718235, 0.03169464319944382, 0...
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": "msg", "annotation": null, "type_comment": null}}], "kwarg": null,...
def raise_error(self, msg, *args): if args: try: msg = msg % args except: msg = " ".join([msg] + list(map(str, args))) line = open(self.filename).readlines()[self.begin[0]] raise SyntaxError(msg, (self.filename, self.begin[0], ...
18,277
[ -0.019016781821846962, 0.01599690318107605, -0.02515156753361225, -0.018319886177778244, 0.05165468901395798, 0.0016868022503331304, -0.0580323301255703, 0.0027268650010228157, 0.06664848327636719, 0.03176150843501091, -0.02238510549068451, -0.02240622416138649, 0.021329205483198166, 0.006...
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 parse_atom(self): # ATOM: '(' RHS ')' | NAME | STRING if self.value == "(": self.gettoken() a, z = self.parse_rhs() self.expect(token.OP, ")") return a, z elif self.type in (token.NAME, token.STRING): a = NFAState() z = ...
18,278
[ -0.020066745579242706, -0.0007925991667434573, -0.0036872513592243195, 0.0002862348628696054, 0.024063045158982277, 0.033036068081855774, -0.013320994563400745, -0.04761456325650215, -0.0018702676752582192, 0.08094902336597443, -0.022357957437634468, -0.03015873208642006, -0.0028133941814303...
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 NFAState(object): def __init__(self): self.arcs = [] # list of (label, NFAState) pairs def addarc(self, next, label=None): assert label is None or isinstance(label, str) assert isinstance(next, NFAState) self.arcs.append((label, next))
18,279
[ -0.03799590468406677, 0.019453266635537148, 0.031075142323970795, 0.04457518458366394, -0.03173534572124481, 0.01718808151781559, -0.0013958202907815576, -0.0273188054561615, 0.01428545918315649, 0.0664757639169693, -0.004960070829838514, -0.03558274358510971, -0.0076606483198702335, 0.024...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "base", "annotation": null, "type_comment": null}}], "kwarg": nul...
def addclosure(state, base): assert isinstance(state, NFAState) if state in base: return base[state] = 1 for label, next in state.arcs: if label is None: addclosure(next, base)
18,280
[ -0.003905830206349492, -0.003083550138399005, 0.0016034460859373212, -0.007371153216809034, 0.04445011168718338, 0.028685826808214188, 0.0025945871602743864, -0.02117958478629589, -0.017702514305710793, 0.08232197910547256, 0.00673682289198041, -0.053095798939466476, -0.04816211760044098, ...
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}}, {"_type": "arg", "_fields": {"arg": "nfaset", "annotation":...
class DFAState(object): def __init__(self, nfaset, final): assert isinstance(nfaset, dict) assert isinstance(next(iter(nfaset)), NFAState) assert isinstance(final, NFAState) self.nfaset = nfaset self.isfinal = final in nfaset self.arcs = {} # map from label to DFASta...
18,281
[ -0.009691926650702953, -0.029956866055727005, 0.012866244651377201, -0.00651760958135128, 0.05383062735199928, 0.06382429599761963, -0.01005401648581028, 0.005748169496655464, -0.025491096079349518, 0.0790320485830307, 0.008527206256985664, -0.07869410514831543, -0.022340917959809303, 0.03...
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": "other", "annotation": null, "type_comment": null}}], "kwarg": nul...
def __eq__(self, other): # Equality test -- ignore the nfaset instance variable assert isinstance(other, DFAState) if self.isfinal != other.isfinal: return False # Can't just return self.arcs == other.arcs, because that # would invoke this method recursively, with cyc...
18,282
[ -0.015009124763309956, 0.016781961545348167, 0.022686971351504326, -0.0566774383187294, -0.03910903260111809, -0.013456226326525211, -0.0007177154184319079, -0.02014101855456829, -0.0084243044257164, 0.043214548379182816, 0.014489270746707916, 0.017795009538531303, 0.03324401006102562, 0.0...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["tmpSettingsDir"]}}, {"_type": ...
def main(): global tmpSettingsDir global textChanged sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/text/textselection") qmlFile = os.path.join("qml", "textselection.qml") if not neededFilePresent(os.path.join(sourceExample, qmlFile)): return templateDir = prepareTe...
18,283
[ 0.06262316554784775, 0.0438678041100502, 0.03563518449664116, -0.020196562632918358, 0.005611801519989967, 0.05298883095383644, 0.019712870940566063, -0.024520166218280792, -0.03289097920060158, -0.047066085040569305, -0.007798281963914633, 0.009816951118409634, 0.08307638019323349, -0.005...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "const", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "table", "annotation": null, "type_comment": null}}], "kwarg": nu...
def _constraint_name_for_table(const, table): metadata = table.metadata convention = _get_convention(metadata.naming_convention, type(const)) if isinstance(const.name, conv): return const.name elif convention is not None and ( const.name is None or not isinstance(const.name, conv) and ...
18,284
[ 0.021918581798672676, -0.05376213416457176, 0.04198329895734787, -0.04783880338072777, 0.02889319136738777, 0.004651622846722603, -0.0046261888928711414, -0.020437749102711678, 0.02121772989630699, 0.023331589996814728, -0.03574345260858536, -0.054892539978027344, 0.004456627648323774, 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 TestComposeFunction(TestCase): def test_composes_two_single_arg_functions(self): double = lambda x: 2*x triple = lambda x: 3*x f = compose(double, triple) self.assertEqual(f(2), 2*2*3) def test_composes_three_single_arg_functions(self): double = lambda x: 2*x ...
18,285
[ 0.01867997832596302, 0.0326869823038578, 0.01791704259812832, -0.02043234370648861, 0.033187657594680786, -0.033783700317144394, -0.03948186710476875, -0.03709769621491432, -0.0017821675864979625, -0.006198843941092491, 0.04038785398006439, -0.036620862782001495, -0.012802996672689915, -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 readRawValues(self): raw_axes = {} raw_btns = {} events = [] self._read_all_events() i = 0 for a in self.axes: raw_axes[i] = a i += 1 i = 0 for b in self.buttons: raw_btns[i] = b i += 1 retur...
18,286
[ 0.010805699042975903, 0.008273477666079998, -0.03841507434844971, -0.0074566323310136795, 0.0009736506035551429, 0.04072558134794235, 0.004440138582140207, -0.014143096283078194, -0.04924411326646805, 0.0050644418224692345, -0.01776055432856083, -0.033350635319948196, 0.021272988989949226, ...
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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class EKANSCodeEditorViewController(UIViewController): @objc_method def viewDidLoad(self): send_super(self, 'viewDidLoad') # Create code editor self.codeEditor = CYRTextView.alloc().initWithFrame(self.view.frame) self.codeEditor.alwaysBounceVertical = True self.view.addS...
18,287
[ 0.027116326615214348, -0.0008029394084587693, -0.021811973303556442, 0.011080855503678322, 0.0005307997926138341, 0.025857271626591682, 0.00656341016292572, -0.025810640305280685, -0.049336325377225876, 0.021054208278656006, -0.027349485084414482, 0.0000580619162064977, 0.01282371487468481, ...
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 viewDidLoad(self): send_super(self, 'viewDidLoad') # Create code editor self.codeEditor = CYRTextView.alloc().initWithFrame(self.view.frame) self.codeEditor.alwaysBounceVertical = True self.view.addSubview(self.codeEditor) self.codeEditor.translatesAutoresizingMaskIn...
18,288
[ -0.025603335350751877, 0.007507955189794302, -0.005256498698145151, -0.005544908344745636, 0.03276706114411354, -0.05262080952525139, 0.005209980998188257, 0.007875444367527962, 0.017416222020983696, -0.007531214039772749, 0.02679418958723545, -0.026291798800230026, 0.02511955238878727, -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": "html", "annotation": null, "type_comment": null}}], "kwarg": null...
def _get_html_from_res(self, html): if isinstance(html, paste.fixture.TestResponse): html_str = html.body.decode('utf8') elif isinstance(html, unicode): html_str = html elif isinstance(html, str): html_str = html.decode('utf8') else: raise ...
18,289
[ -0.021485960111021996, 0.019886167719960213, 0.016103874891996384, -0.001226331340149045, -0.0006952742114663124, 0.0009065051563084126, -0.005890627857297659, -0.02246066741645336, 0.004216672386974096, 0.03608539327979088, 0.04699788987636566, -0.029092922806739807, 0.02026757411658764, ...
13
{"_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": "regex_compiled", "annotation": null, "type_comment": null}}, {"_t...
def _check_html(self, regex_compiled, html, html_to_find): html_to_find = [unicode(html_bit) for html_bit in html_to_find] partly_matching_tags = [] html_str = self._get_html_from_res(html) for tag in regex_compiled.finditer(html_str): found_all=True for i, html_b...
18,290
[ 0.01503992360085249, -0.0509788803756237, 0.03503933176398277, -0.026804279536008835, 0.02666587568819523, 0.030264385044574738, 0.021429583430290222, -0.019376588985323906, 0.014590109698474407, 0.021245045587420464, -0.005031569395214319, -0.00044008210534229875, -0.048995088785886765, -...
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_format_string(self): self.assertEqual(nformat('1234', '.'), '1234') self.assertEqual(nformat('1234.2', '.'), '1234.2') self.assertEqual(nformat('1234', '.', decimal_pos=2), '1234.00') self.assertEqual(nformat('1234', '.', grouping=2, thousand_sep=','), '1234') self.asser...
18,291
[ -0.0015901216538622975, -0.06333031505346298, 0.030749978497624397, -0.017582856118679047, 0.04383702203631401, 0.026151210069656372, 0.015489386394619942, -0.004301336128264666, 0.025144513696432114, 0.0358520969748497, -0.009952560067176819, -0.0024695503525435925, -0.05857138708233833, ...
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_format_number(self): self.assertEqual(nformat(1234, '.'), '1234') self.assertEqual(nformat(1234.2, '.'), '1234.2') self.assertEqual(nformat(1234, '.', decimal_pos=2), '1234.00') self.assertEqual(nformat(1234, '.', grouping=2, thousand_sep=','), '1234') self.assertEqual(n...
18,292
[ 0.039126794785261154, -0.032479166984558105, 0.024928610771894455, -0.024575291201472282, -0.006569114048033953, 0.030961202457547188, -0.025399701669812202, 0.013491546735167503, 0.007779558654874563, 0.03355220705270767, 0.033081118017435074, -0.01426361408084631, -0.05872945114970207, -...
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_large_number(self): most_max = ( '{}179769313486231570814527423731704356798070567525844996' '598917476803157260780028538760589558632766878171540458953' '514382464234321326889464182768467546703537516986049910576' '551282076245490090389328944075868508455133...
18,293
[ 0.015294969081878662, -0.05604076758027077, 0.02836299128830433, -0.011306040920317173, 0.027090448886156082, 0.038298603147268295, 0.03582693636417389, 0.008632480166852474, 0.028558766469359398, 0.05809641256928444, 0.008191985078155994, -0.02459431067109108, -0.05403406545519829, -0.002...
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_decimal_numbers(self): self.assertEqual(nformat(Decimal('1234'), '.'), '1234') self.assertEqual(nformat(Decimal('1234.2'), '.'), '1234.2') self.assertEqual(nformat(Decimal('1234'), '.', decimal_pos=2), '1234.00') self.assertEqual(nformat(Decimal('1234'), '.', grouping=2, thousan...
18,294
[ -0.006813559681177139, 0.02662770450115204, 0.05045688897371292, -0.006145256571471691, 0.006855328567326069, 0.002722813282161951, -0.014044808223843575, 0.03076283074915409, 0.006510734558105469, -0.00000813250426290324, -0.038970429450273514, 0.022743191570043564, -0.01730278693139553, ...
10
{"_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 group_add(self, **kwargs): if self.local: command_name = 'lgroupadd' else: command_name = 'groupadd' cmd = [self.module.get_bin_path(command_name, True)] for key in kwargs: if key == 'gid' and kwargs[key] is not None: cmd.append('-g...
18,295
[ 0.008939218707382679, 0.016379117965698242, 0.031851086765527725, -0.031347110867500305, 0.01690828986465931, 0.037823162972927094, -0.0046743485145270824, -0.030389564111828804, 0.012719015590846539, 0.006085472647100687, 0.03888150677084923, -0.04298888519406319, 0.044853586703538895, -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": "pattern", "annotation": null, "type_comment": null}}, {"_type": "...
def _play_ds(self, pattern, async_val, poll): check_raw = context.CLIARGS['module_name'] in ('command', 'win_command', 'shell', 'win_shell', 'script', 'raw') mytask = {'action': {'module': context.CLIARGS['module_name'], 'args': parse_kv(context.CLIARGS['module_args'], check_raw=check_raw)}} #...
18,296
[ -0.016603197902441025, 0.02743341028690338, 0.03733666241168976, 0.0015840507112443447, 0.0035875814501196146, 0.02320927567780018, 0.0007065892568789423, 0.00978004653006792, -0.032572776079177856, 0.006518075242638588, 0.013892711140215397, 0.015957843512296677, 0.0326666459441185, 0.010...
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 group_info(self): if not self.group_exists(): return False try: info = list(grp.getgrnam(self.name)) except KeyError: return False return info
18,297
[ -0.0018818783573806286, 0.0488966666162014, 0.034391436725854874, -0.005158715415745974, -0.011247402988374233, 0.020096763968467712, -0.01087892334908247, 0.03338542953133583, 0.023290254175662994, 0.0022050291299819946, -0.009416703134775162, 0.012890939600765705, -0.0006441083387471735, ...
11
{"_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 group_mod(self, **kwargs): if self.local: command_name = 'lgroupmod' else: command_name = 'groupmod' cmd = [self.module.get_bin_path(command_name, True)] info = self.group_info() for key in kwargs: if key == 'gid': if kwargs...
18,298
[ 0.01020839437842369, 0.020108163356781006, 0.056312356144189835, 0.008279482834041119, -0.018885530531406403, 0.016713278368115425, 0.005009235814213753, 0.033853884786367416, 0.013959386385977268, 0.008321029134094715, -0.00349874934181571, -0.013199691660702229, 0.013080989941954613, 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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v...
def group_mod(self, **kwargs): cmd = [self.module.get_bin_path('chgroup', True)] info = self.group_info() for key in kwargs: if key == 'gid': if kwargs[key] is not None and info[2] != int(kwargs[key]): cmd.append('id=' + kwargs[key]) if len...
18,299
[ 0.005705992691218853, 0.013806957751512527, 0.048561640083789825, 0.0006011572550050914, -0.030461393296718597, 0.005007919389754534, -0.012361145578324795, 0.04851749539375305, 0.015131366439163685, -0.0020735268481075764, -0.0148223377764225, 0.000603226653765887, 0.00043491640826687217, ...
10
{"_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 group_add(self, **kwargs): cmd = [self.module.get_bin_path('mkgroup', True)] for key in kwargs: if key == 'gid' and kwargs[key] is not None: cmd.append('id=' + kwargs[key]) elif key == 'system' and kwargs[key] is True: cmd.append('-a') ...
18,300
[ 0.007569245062768459, 0.026397602632641792, 0.06443333625793457, 0.00857253186404705, -0.018036875873804092, 0.019731316715478897, 0.0002900127146858722, 0.05440046265721321, -0.01037287525832653, -0.006025297101587057, 0.01472602691501379, -0.023989712819457054, 0.01911819539964199, -0.00...
10
{"_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 group_add(self, **kwargs): cmd = [self.module.get_bin_path('dseditgroup', True)] cmd += ['-o', 'create'] if self.gid is not None: cmd += ['-i', self.gid] elif 'system' in kwargs and kwargs['system'] is True: gid = self.get_lowest_available_system_gid() ...