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
12,401
[ 0.007253828924149275, 0.046880219131708145, -0.014859138056635857, 0.007017488591372967, 0.011865494772791862, 0.0056903469376266, 0.011798834428191185, -0.029597077518701553, 0.015392418950796127, 0.06273319572210312, 0.043753255158662796, 0.012568455189466476, 0.018761783838272095, 0.040...
9
{"_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": "email", "annotation": null, "type_comment": null}}, {"_type": "a...
def _system_state_change(state, email, description, ttl, masters, zone): if state == 'present': if not zone: return True if email is not None and zone.email != email: return True if description is not None and zone.description != description: return True ...
12,402
[ -0.005913820117712021, 0.008043825626373291, 0.0391509048640728, -0.061673615127801895, -0.04826295003294945, 0.040875501930713654, 0.00821757223457098, 0.0011615284020081162, -0.0035682409070432186, 0.04725908115506172, -0.004311490338295698, -0.07150638848543167, 0.006341751664876938, 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": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def main(): spec = dict( gather_subset=dict(default=['!config'], type='list') ) spec.update(iosxr_argument_spec) module = AnsibleModule(argument_spec=spec, supports_check_mode=True) warnings = list() gather_subset = module.params['gather_subset'] runab...
12,403
[ 0.014585097320377827, 0.023015577346086502, -0.023859849199652672, -0.025181317701935768, 0.02354171685874462, 0.041038937866687775, -0.01105506345629692, 0.002883065026253462, 0.03773526847362518, 0.050754182040691376, 0.04015795886516571, -0.022342607378959656, -0.004912681877613068, 0.0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def main(): argument_spec = openstack_full_argument_spec( name=dict(required=True), zone_type=dict(required=False, choice=['primary', 'secondary']), email=dict(required=False, default=None), description=dict(required=False, default=None), ttl=dict(required=False, default=None...
12,404
[ 0.06364712119102478, -0.01580648124217987, -0.03900726139545441, 0.002530090045183897, -0.029155997559428215, 0.06308552622795105, -0.021597901359200478, -0.011775887571275234, 0.03268934786319733, -0.0025710396002978086, 0.02274448610842228, 0.016836067661643028, -0.003302279394119978, 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 disconnect(self): self.block = True try: self.signal.disconnect(self.signalReceived) except: pass try: self.sigDelayed.disconnect(self.slot()) except: pass
12,405
[ 0.020168155431747437, 0.016869043931365013, -0.010594506748020649, 0.010189898312091827, -0.03565530851483345, -0.04720842465758324, 0.006009985692799091, 0.01608472689986229, 0.03612838685512543, 0.03612838685512543, -0.05149104446172714, -0.033837683498859406, -0.0019250006880611181, 0.0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "param", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [...
def unBined(param): newparam = XParam() newparam.mix(param) newparam.QX = param.QX/2 newparam.QY = param.QY/2 newparam.NX = param.NX*2 newparam.NY = param.NY*2 return newparam
12,406
[ 0.00997761357575655, -0.0488666333258152, 0.05295237898826599, -0.016843564808368683, -0.009429690428078175, -0.003128573764115572, 0.0163835808634758, 0.019901111721992493, -0.0077318050898611546, 0.02494741603732109, 0.05530641973018646, 0.03409299999475479, -0.03650115430355072, -0.0240...
15
{"_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 MempoolPackagesTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 2 self.extra_args = [ ["-maxorphantx=1000"], ["-maxorphantx=1000", "-limitancestorcount={}".format(MAX_ANCESTORS_CUSTOM)], ] def skip_test_if_missing_module(self): ...
12,407
[ 0.017448043450713158, -0.04887619614601135, 0.049878645688295364, -0.00823634397238493, -0.006431256886571646, -0.006177257746458054, 0.012848966754972935, 0.020048994570970535, -0.004981768783181906, 0.024234898388385773, 0.057383473962545395, 0.043240804225206375, -0.03847239539027214, -...
14
{"_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_test(self): # Mine some blocks and have them mature. self.nodes[0].generate(101) utxo = self.nodes[0].listunspent(10) txid = utxo[0]['txid'] vout = utxo[0]['vout'] value = utxo[0]['amount'] fee = Decimal("0.0001") # MAX_ANCESTORS transactions off ...
12,408
[ 0.040856875479221344, -0.04059455171227455, -0.024898866191506386, -0.01693079248070717, 0.009307016618549824, -0.028636975213885307, -0.00006801452400395647, 0.006536225788295269, 0.02094215527176857, -0.02819976955652237, 0.06475017219781876, 0.06746084243059158, -0.04949168860912323, -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": "node", "annotation": null, "type_comment": null}}, {"_type": "arg...
def chain_transaction(self, node, parent_txid, vout, value, fee, num_outputs): send_value = satoshi_round((value - fee)/num_outputs) inputs = [ {'txid' : parent_txid, 'vout' : vout} ] outputs = {} for i in range(num_outputs): outputs[node.getnewaddress()] = send_value ...
12,409
[ 0.02490566298365593, -0.014275196939706802, -0.009985044598579407, -0.028398530557751656, 0.031544279307127, -0.057795025408267975, -0.005640655290335417, 0.023820921778678894, 0.00035626976750791073, 0.03299783542752266, 0.01712806709110737, -0.038573406636714935, 0.003915916662663221, -0...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def server(self): def app(environ, start_response): uri = environ['PATH_INFO'] method = environ['REQUEST_METHOD'] headers = [('Content-type', 'text/json')] content_len_str = environ['CONTENT_LENGTH'] content_len = 0 request_data = None ...
12,410
[ 0.04409835860133171, 0.038248077034950256, 0.0219016931951046, -0.0190625861287117, -0.02861231379210949, -0.015400012955069542, -0.012001685798168182, 0.0010915511520579457, 0.03999332711100578, 0.044860370457172394, 0.016002247110009193, -0.04476204887032509, 0.005807267501950264, -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}}, {"_type": "arg", "_fields": {"arg": "method", "annotation": null, "type_comment": null}}, {"_type": "a...
def request_handler(self, method, uri, body): retstatus = self.default_status retbody = self.default_response for i in moves.xrange(len(self.matches)): (unused_prior, method_regexp, uri_regexp, handler, data, multi) = self.matches[i] if re.match(method_regexp...
12,411
[ 0.024434920400381088, -0.017055943608283997, 0.003016835078597069, -0.013014251366257668, 0.05930895730853081, -0.07210380584001541, -0.0009259807411581278, 0.01976965181529522, 0.020220013335347176, 0.02912328392267227, 0.0077485027723014355, -0.06406660377979279, -0.010987631045281887, -...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "environ", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "start_response", "annotation": null, "type_comment": null}}], ...
def app(environ, start_response): uri = environ['PATH_INFO'] method = environ['REQUEST_METHOD'] headers = [('Content-type', 'text/json')] content_len_str = environ['CONTENT_LENGTH'] content_len = 0 request_data = None if content_len_st...
12,412
[ 0.06884927302598953, 0.02224697917699814, 0.01040342915803194, 0.0018217521719634533, -0.00561646930873394, -0.014643142931163311, 0.039194315671920776, -0.022062642499804497, -0.0227423794567585, -0.02790377102792263, 0.016924293711781502, 0.02289215289056301, -0.038756515830755234, -0.00...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "map_value", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs...
def FieldSize(map_value): total = 0 for key in map_value: value = map_value[key] # It's wasteful to create the messages and throw them away one second # later since we'll do the same for the actual encode. But there's not an # obvious way to avoid this within the current design without ...
12,413
[ 0.053631335496902466, -0.00019357488781679422, -0.049097176641225815, -0.04339512437582016, -0.00559041416272521, -0.020495323464274406, 0.019877027720212936, -0.009096946567296982, 0.020106026902794838, -0.02174336276948452, 0.041792139410972595, 0.025739377364516258, -0.01465587317943573, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "write", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}, {"_type": "a...
def EncodeVarint(write, value, unused_deterministic=None): bits = value & 0x7f value >>= 7 while value: write(six.int2byte(0x80|bits)) bits = value & 0x7f value >>= 7 return write(six.int2byte(bits))
12,414
[ 0.08520840853452682, 0.0016644104616716504, -0.042110174894332886, -0.04754450172185898, -0.01286830473691225, -0.021490303799510002, 0.008339696563780308, -0.03502907603979111, 0.018102670088410378, -0.02279595471918583, 0.04034578055143356, 0.02677171863615513, -0.03150029107928276, 0.01...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "write", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}, {"_type": "a...
def EncodeSignedVarint(write, value, unused_deterministic=None): if value < 0: value += (1 << 64) bits = value & 0x7f value >>= 7 while value: write(six.int2byte(0x80|bits)) bits = value & 0x7f value >>= 7 return write(six.int2byte(bits))
12,415
[ 0.09333178400993347, 0.006952633149921894, -0.04221080616116524, 0.004165392369031906, 0.02623550221323967, -0.021701665595173836, 0.025132980197668076, -0.032198116183280945, -0.018619107082486153, -0.020812898874282837, 0.0474759079515934, 0.051795993000268936, -0.004528211895376444, -0....
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "write", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}, {"_type": "a...
def EncodePackedField(write, value, deterministic): write(tag_bytes) size = 0 for element in value: size += compute_value_size(element) local_EncodeVarint(write, size, deterministic) for element in value: encode_value(write, element, deterministic)
12,416
[ 0.07590483129024506, -0.023533713072538376, -0.04789397493004799, -0.01010227669030428, -0.007180652115494013, 0.011129723861813545, 0.041717808693647385, -0.03221248462796211, -0.0052893455140292645, -0.014487583190202713, 0.03795241564512253, 0.031431857496500015, 0.04311835393309593, 0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "field_number", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "is_repeated", "annotation": null, "type_comment": null}},...
def SpecificEncoder(field_number, is_repeated, is_packed): if is_packed: tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) local_EncodeVarint = _EncodeVarint def EncodePackedField(write, value, deterministic): write(tag_bytes) size = 0 for element in...
12,417
[ 0.09909704327583313, 0.015509553253650665, -0.039269596338272095, -0.0005245584761723876, 0.03063165210187435, -0.014016715809702873, 0.02523008920252323, -0.027714351192116737, -0.016466792672872543, -0.016717497259378433, 0.05137183517217636, 0.04854569956660271, -0.009971240535378456, -...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "write", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}, {"_type": "a...
def EncodePackedField(write, value, deterministic): write(tag_bytes) size = 0 for element in value: size += compute_value_size(modify_value(element)) local_EncodeVarint(write, size, deterministic) for element in value: encode_value(write, modify_value(element)...
12,418
[ 0.07739327102899551, -0.021966369822621346, -0.04864063858985901, -0.010696117766201496, -0.00674033397808671, 0.014043319039046764, 0.04345046728849411, -0.03249599039554596, -0.004501210991293192, -0.01391701027750969, 0.039316702634096146, 0.030589863657951355, 0.04317488148808479, 0.01...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "field_number", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "is_repeated", "annotation": null, "type_comment": null}},...
def SpecificEncoder(field_number, is_repeated, is_packed): if is_packed: tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) local_EncodeVarint = _EncodeVarint def EncodePackedField(write, value, deterministic): write(tag_bytes) size = 0 for element in...
12,419
[ 0.06874609738588333, -0.01666536182165146, -0.04408562555909157, -0.011968974955379963, -0.0003116612206213176, 0.014000325463712215, 0.04470154643058777, -0.03944253921508789, -0.0030529473442584276, -0.006994240451604128, 0.034017711877822876, 0.02287193574011326, 0.04654930531978607, 0....
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "field_number", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "is_repeated", "annotation": null, "type_comment": null}},...
def SpecificEncoder(field_number, is_repeated, is_packed): local_struct_pack = struct.pack if is_packed: tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) local_EncodeVarint = _EncodeVarint def EncodePackedField(write, value, deterministic): write(tag_bytes) ...
12,420
[ 0.0674828290939331, -0.022652631625533104, -0.04078632593154907, -0.012861596420407295, -0.005677641835063696, 0.010602126829326153, 0.048897240310907364, -0.03714799880981445, -0.0004957073833793402, -0.007120226044207811, 0.03028848022222519, 0.02852725237607956, 0.04959246143698692, 0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "field_number", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "is_repeated", "annotation": null, "type_comment": null}},...
def SpecificEncoder(field_number, is_repeated, is_packed): local_struct_pack = struct.pack if is_packed: tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) local_EncodeVarint = _EncodeVarint def EncodePackedField(write, value, deterministic): write(tag_bytes) ...
12,421
[ 0.018043557181954384, -0.004134479910135269, 0.001990452641621232, -0.01579112373292446, 0.023933611810207367, 0.002083802130073309, 0.00479093799367547, 0.0004979895311407745, 0.023415671661496162, 0.008016013540327549, -0.004809005651623011, -0.04331417381763458, 0.003170872339978814, 0....
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": "module", "annotation":...
class AnsibleCloudStackUser(AnsibleCloudStack): def __init__(self, module): super(AnsibleCloudStackUser, self).__init__(module) self.returns = { 'username': 'username', 'firstname': 'first_name', 'lastname': 'last_name', 'email': 'em...
12,422
[ 0.09405210614204407, 0.008095315657556057, -0.04493394121527672, 0.0041406406089663506, 0.029708005487918854, -0.019386915490031242, 0.03489179536700249, -0.041702788323163986, -0.014296106062829494, -0.026779048144817352, 0.050443172454833984, 0.05165194720029831, 0.009646966122090816, 0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "write", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}, {"_type": "a...
def EncodePackedField(write, value, deterministic): write(tag_bytes) local_EncodeVarint(write, len(value), deterministic) for element in value: if element: write(true_byte) else: write(false_byte)
12,423
[ -0.00010240249685011804, -0.00718584842979908, -0.022932615131139755, 0.033600494265556335, 0.02339836396276951, -0.0330682098865509, 0.0007852591224946082, 0.07256820052862167, -0.013351484201848507, 0.03104996308684349, -0.0036095581017434597, -0.020770207047462463, 0.026503361761569977, ...
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 get_user(self): if not self.user: args = {} args['domainid'] = self.get_domain('id') users = self.cs.listUsers(**args) if users: user_name = self.module.params.get('username') for u in users['user']: ...
12,424
[ 0.02653835341334343, 0.02723918855190277, -0.03146757185459137, 0.050366804003715515, 0.024365758523344994, -0.013759762048721313, 0.0333598293364048, 0.04749337211251259, 0.027355995029211044, -0.005945431999862194, 0.01018549408763647, 0.040555089712142944, 0.021889468654990196, 0.040228...
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 enable_user(self): user = self.get_user() if not user: user = self.present_user() if user['state'].lower() != 'enabled': self.result['changed'] = True args = {} args['id'] = user['id'] if not self.module.check_mode: ...
12,425
[ 0.03337562084197998, 0.023028936237096786, -0.01752280630171299, 0.06123301386833191, 0.0008077675011008978, 0.017631718888878822, 0.027881592512130737, 0.03862762451171875, 0.028365647420287132, -0.019749460741877556, -0.006970398128032684, 0.02311364747583866, 0.0384582057595253, 0.04751...
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 disable_user(self): user = self.get_user() if not user: user = self.present_user() if user['state'].lower() != 'disabled': self.result['changed'] = True args = {} args['id'] = user['id'] if not self.module.check_mode: ...
12,426
[ 0.022674372419714928, 0.03373162820935249, -0.027083277702331543, 0.03333505988121033, 0.019898394122719765, -0.0032891836017370224, 0.04740156605839729, 0.04782146215438843, 0.0174956563860178, -0.0358077771961689, 0.0005478327511809766, 0.040403302758932114, 0.021006451919674873, 0.01313...
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 lock_user(self): user = self.get_user() if not user: user = self.present_user() # we need to enable the user to lock it. if user['state'].lower() == 'disabled': user = self.enable_user() if user['state'].lower() != 'locked': self.result['...
12,427
[ 0.017541347071528435, 0.03989620879292488, -0.018638379871845245, -0.0020303521305322647, 0.056956201791763306, -0.02312726341187954, 0.028590044006705284, 0.05637410283088684, 0.02496311627328396, 0.06662800908088684, -0.000560060958378017, -0.03369460999965668, 0.036873769015073776, -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 present_user(self): missing_params = [] for required_params in [ 'account', 'email', 'password', 'first_name', 'last_name', ]: if not self.module.params.get(required_params): missing_params.append(require...
12,428
[ 0.04410603642463684, 0.028032340109348297, -0.01796070486307144, 0.043651334941387177, 0.03307952731847763, -0.033966194838285446, 0.05506433919072151, 0.03392072394490242, 0.04815287888050079, 0.02315566875040531, 0.01505061611533165, -0.00006789437611587346, 0.01543711218982935, 0.023667...
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": "user", "annotation": null, "type_comment": null}}], "kwarg": null...
def _create_user(self, user): self.result['changed'] = True args = {} args['account'] = self.get_account(key='name') args['domainid'] = self.get_domain('id') args['username'] = self.module.params.get('username') args['password'] = self.module....
12,429
[ 0.008763336576521397, 0.02003210224211216, -0.034758590161800385, 0.035892266780138016, 0.008944724686443806, 0.0033131761010736227, 0.06743121147155762, 0.03843170776963234, 0.023331107571721077, 0.03616435080766678, 0.009789315983653069, -0.019476599991321564, 0.0131846833974123, 0.03614...
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": "user", "annotation": null, "type_comment": null}}], "kwarg": null...
def _update_user(self, user): args = {} args['id'] = user['id'] args['firstname'] = self.module.params.get('first_name') args['lastname'] = self.module.params.get('last_name') args['email'] = self.module.params.get('email') args['timezon...
12,430
[ 0.0047610425390303135, 0.04005371034145355, -0.03301321342587471, 0.023149054497480392, 0.03114735707640648, 0.026370765641331673, 0.02216636948287487, 0.04475566744804382, 0.02893320843577385, 0.01915612258017063, 0.032938577234745026, -0.003563784994184971, 0.03689419478178024, 0.0356005...
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 absent_user(self): user = self.get_user() if user: self.result['changed'] = True if not self.module.check_mode: res = self.cs.deleteUser(id=user['id']) if 'errortext' in res: self.module.fail_json(msg="Failed: '%s'" % res[...
12,431
[ 0.017656194046139717, 0.010032194666564465, 0.0002542189322412014, 0.005577031057327986, -0.002649016445502639, 0.038977544754743576, -0.013544637709856033, -0.012534369714558125, 0.04428732395172119, 0.053990595042705536, 0.018642965704202652, -0.08171422779560089, 0.02690131962299347, 0....
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def main(): argument_spec = cs_argument_spec() argument_spec.update(dict( username = dict(required=True), account = dict(default=None), state = dict(choices=['present', 'absent', 'enabled', 'disabled', 'locked', 'unlocked'], default='present'), domain = dict(default='ROOT'), ...
12,432
[ 0.013805931434035301, -0.014969352632761002, -0.015600924380123615, -0.01986680179834366, 0.00905806478112936, -0.01988896168768406, 0.00855945609509945, 0.0019016396254301071, 0.011296265758574009, -0.012077420018613338, -0.0020567625761032104, -0.030470555648207664, -0.0037506483495235443,...
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": "user", "annotation": null, "type_comment": null}}], "kwarg": null...
def get_result(self, user): super(AnsibleCloudStackUser, self).get_result(user) if user: if 'accounttype' in user: for key,value in self.account_types.items(): if value == user['accounttype']: self.result['account_type'] = key ...
12,433
[ -0.005598732735961676, -0.003582294099032879, 0.02684323862195015, 0.02130841836333275, 0.009682739153504372, 0.017396975308656693, -0.003406534669920802, 0.01578638143837452, -0.0003297484072390944, 0.023161880671977997, 0.03550976887345314, -0.05256161838769913, 0.013907354325056076, 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}}, {"_type": "arg", "_fields": {"arg": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def _check_company_id(self, cr, uid, ids, context=None): for wiz in self.browse(cr, uid, ids, context=context): company_id = wiz.company_id.id if wiz.fiscalyear_id and company_id != wiz.fiscalyear_id.company_id.id: return False if wiz.period_from and company_i...
12,434
[ 0.005233844742178917, 0.051660045981407166, 0.06725696474313736, -0.036849312484264374, 0.005820314399898052, 0.011095371097326279, -0.01943909004330635, -0.006834748201072216, -0.0017261226894333959, 0.013631455600261688, 0.004897813778370619, -0.04557344317436218, 0.016078777611255646, 0...
14
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "account.common.report"}}, "targets": [{"_type": "Name", "_fields": {"id": "_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_com...
class account_common_report(osv.osv_memory): _name = "account.common.report" _description = "Account Common Report" def onchange_chart_id(self, cr, uid, ids, chart_account_id=False, context=None): if chart_account_id: company_id = self.pool.get('account.account').browse(cr, uid, chart_a...
12,435
[ -0.015335659496486187, 0.014398678205907345, 0.007359455805271864, -0.02079150080680847, 0.018798932433128357, 0.001968847122043371, -0.0018858235562220216, 0.025737339630723, -0.011552151292562485, 0.047703031450510025, 0.04962443932890892, -0.060204025357961655, 0.005962878931313753, 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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None): res = {'value': {}} if filter == 'filter_no': res['value'] = {'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False} if filter == 'filter_date': res['v...
12,436
[ 0.05854756385087967, 0.04713369533419609, 0.015109439380466938, -0.019592592492699623, 0.04364410787820816, -0.010329428128898144, 0.0028761853463947773, -0.004516474436968565, -0.021991686895489693, 0.024293847382068634, 0.026826223358511925, -0.03218177333474159, 0.020949656143784523, 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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(account_common_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) if context.get('active_model', False) =...
12,437
[ -0.025172723457217216, 0.008633475750684738, 0.05365213006734848, -0.016533425077795982, -0.006520224269479513, 0.005029887426644564, 0.003033068496733904, -0.0003538458840921521, -0.022389983758330345, -0.004703876096755266, 0.018431276082992554, -0.02233176864683628, 0.02927115000784397, ...
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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def _build_contexts(self, cr, uid, ids, data, context=None): if context is None: context = {} result = {} result['fiscalyear'] = 'fiscalyear_id' in data['form'] and data['form']['fiscalyear_id'] or False result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['...
12,438
[ -0.02130899764597416, 0.04231909662485123, 0.04717620462179184, -0.022442322224378586, 0.006862219888716936, 0.002693203277885914, -0.012479027733206749, 0.02038739249110222, 0.002587343333289027, 0.03477190062403679, -0.011594785377383232, -0.03581804782152176, 0.00990725215524435, 0.0109...
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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def check_report(self, cr, uid, ids, context=None): if context is None: context = {} data = {} data['ids'] = context.get('active_ids', []) data['model'] = context.get('active_model', 'ir.ui.menu') data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to', 'fisc...
12,439
[ 0.058368582278490067, -0.019818410277366638, 0.054849907755851746, -0.00595069769769907, 0.025303401052951813, 0.009365880861878395, -0.0034572260919958353, 0.001162649947218597, -0.003664206713438034, 0.011881991289556026, -0.0018757634097710252, -0.037282414734363556, 0.001164266956038773,...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "IfExp", "_fields": {"body": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Lt", "_fields": {}}], "left": {"_t...
class StrTest(unittest.TestCase): unicodesize = 2 if sys.maxunicode < 65536 else 4 @bigaddrspacetest def test_concat(self): try: # Create a string that would fill almost the address space x = "x" * int(MAX_Py_ssize_t // (1.1 * self.unicodesize)) # Unicode object...
12,440
[ 0.07401026785373688, -0.03302714601159096, 0.04088490456342697, 0.02171933837234974, 0.014487743377685547, -0.04294756427407265, 0.01437724381685257, 0.023155834525823593, 0.0041222539730370045, -0.008023508824408054, -0.009447727352380753, -0.003318061586469412, -0.028729932382702827, -0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_concat(self): try: # Create a string that would fill almost the address space x = "x" * int(MAX_Py_ssize_t // (1.1 * self.unicodesize)) # Unicode objects trigger MemoryError in case an operation that's # going to cause a size overflow is executed ...
12,441
[ -0.04601498320698738, -0.012094241566956043, 0.003072768449783325, -0.028146997094154358, -0.011285043321549892, -0.007785805035382509, 0.0299184862524271, 0.005822950974106789, 0.012794089503586292, 0.043303072452545166, 0.047764599323272705, 0.024910202249884605, 0.04225330054759979, 0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "create_window", "annotation": null, "type_comment": null}}], "...
def test_get_current_url_no_browsing_context(session, create_window): # 7.2 step 1 session.window_handle = create_window() session.close() result = session.transport.send("GET", "session/%s/url" % session.session_id) assert_error(result, "no such window")
12,442
[ 0.11281681805849075, -0.024507783353328705, 0.026026859879493713, 0.01615285687148571, 0.025355935096740723, 0.007513104006648064, 0.02267223224043846, 0.011918428353965282, 0.037799712270498276, -0.00466166902333498, 0.007962497882544994, -0.02764721028506756, -0.028938425704836845, -0.00...
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_optimized_concat(self): try: x = "x" * int(MAX_Py_ssize_t // (1.1 * self.unicodesize)) with self.assertRaises(MemoryError) as cm: # this statement uses a fast path in ceval.c x = x + x with self.assertRaises(MemoryError) as cm: ...
12,443
[ -0.001960386522114277, -0.011007352732121944, 0.035721976310014725, -0.027459444478154182, 0.0335216261446476, 0.00410600658506155, -0.003317361231893301, 0.016772039234638214, 0.010333777405321598, 0.028290187940001488, 0.030288463458418846, 0.023081200197339058, 0.02788604237139225, 0.00...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def test_get_current_url_file_protocol(session): # tests that the browsing context remains the same # when navigated privileged documents session.url = "file:///" result = session.transport.send("GET", "session/%s/url" % session.session_id) assert_success(result, "file:///")
12,444
[ -0.00357795343734324, -0.024312205612659454, -0.01012132316827774, -0.03211482614278793, 0.010084518231451511, 0.021620197221636772, -0.002818196779116988, 0.02496417611837387, 0.05426080524921417, 0.01923314295709133, 0.05114816874265671, -0.008591294288635254, -0.012334869243204594, -0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def test_get_current_url_payload(session): # 7.2 step 4-5 session.start() result = session.transport.send("GET", "session/%s/url" % session.session_id) assert result.status == 200 assert isinstance(result.body["value"], basestring)
12,445
[ -0.03612736240029335, -0.01861497573554516, 0.029535293579101562, -0.031247824430465698, 0.03286651894450188, 0.03183430805802345, 0.023154355585575104, 0.0337345115840435, 0.01386446226388216, 0.01861497573554516, 0.05353418365120888, -0.020116372033953667, 0.005759264808148146, -0.008621...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def test_get_current_url_nested_browsing_contexts(session): session.url = two_frames_doc top_level_url = session.url outer_frame = session.find.css("iframe", all=False) session.switch_frame(outer_frame) inner_frame = session.find.css("iframe", all=False) session.switch_frame(inner_frame) ...
12,446
[ -0.0118094552308321, -0.025548208504915237, -0.010832823812961578, -0.03904130682349205, 0.0044907089322805405, 0.03614136949181557, 0.022696204483509064, -0.016620716080069542, 0.05847807601094246, 0.034343887120485306, 0.044242020696401596, 0.007519465871155262, -0.03650086373090744, -0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def test_get_current_url_after_modified_location(session): start = session.transport.send("GET", "session/%s/url" % session.session_id) session.execute_script("window.location.href = 'about:blank#wd_test_modification'") wait(session, lambda s: s.transport.send("GET", "session/%s/url" % session.sess...
12,447
[ 0.007047224789857864, 0.026369433850049973, 0.014709480106830597, 0.019130012020468712, -0.024614034220576286, 0.022487053647637367, 0.00726504810154438, -0.0017345782835036516, 0.04110454022884369, 0.03846503421664238, 0.019898800179362297, -0.04528162255883217, 0.012294203974306583, 0.00...
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": "Constant", "_fields":...
def test_error(): # Test for appropriate exception on errors msg = "Penalty term must be positive" assert_raise_message(ValueError, msg, LogisticRegression(C=-1).fit, X, Y1) assert_raise_message(ValueError, msg, LogisticRegression(C="test").fit, X, Y1) ...
12,448
[ 0.028281565755605698, -0.033327747136354446, -0.0048856232315301895, -0.02901555597782135, -0.011250695213675499, 0.04835161194205284, 0.018544724211096764, -0.01696205697953701, 0.043947670608758926, 0.04876448214054108, 0.01260398980230093, -0.058489855378866196, -0.0012966684298589826, ...
7
{"_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 test_predict_2_classes(): # Simple sanity check on a 2 classes dataset # Make sure it predicts the correct result on simple datasets. check_predictions(LogisticRegression(random_state=0), X, Y1) check_predictions(LogisticRegression(random_state=0), X_sp, Y1) check_predictions(LogisticRegression...
12,449
[ 0.014756736345589161, 0.015922700986266136, 0.02119383029639721, -0.031286709010601044, -0.015922700986266136, 0.027934562414884567, 0.0037013294640928507, -0.03818533197045326, 0.0029938563238829374, 0.042023297399282455, -0.005914839915931225, -0.023440741002559662, -0.023829394951462746, ...
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": "Tuple", "_fields": {"...
def test_check_solver_option(): X, y = iris.data, iris.target for LR in [LogisticRegression, LogisticRegressionCV]: msg = ("Logistic Regression supports only liblinear, newton-cg, lbfgs" " and sag solvers, got wrong_name") lr = LR(solver="wrong_name") assert_raise_message...
12,450
[ 0.03920676186680794, 0.003694229293614626, 0.009416014887392521, -0.00007515525066992268, 0.016517970710992813, 0.017498690634965897, 0.020319638773798943, 0.019482169300317764, 0.0050165485590696335, 0.05597817897796631, -0.005245199427008629, -0.024837560951709747, 0.011283790692687035, ...
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": "Attribute", "_fields"...
def test_predict_iris(): # Test logistic regression with the iris dataset n_samples, n_features = iris.data.shape target = iris.target_names[iris.target] # Test that both multinomial and OvR solvers handle # multiclass data correctly and give good accuracy # score (>0.95) for the training data...
12,451
[ 0.023476622998714447, 0.015336195006966591, 0.028596464544534683, 0.0054697152227163315, -0.010432111099362373, -0.009691542014479637, 0.04196169599890709, 0.03482424095273018, 0.007370703388005495, 0.09637894481420517, -0.019802935421466827, -0.029809365049004555, 0.011977393180131912, 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": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_multinomial_binary(): # Test multinomial LR on a binary problem. target = (iris.target > 0).astype(np.intp) target = np.array(["setosa", "not-setosa"])[target] for solver in ['lbfgs', 'newton-cg']: clf = LogisticRegression(solver=solver, multi_class='multinomial') clf.fit(iris....
12,452
[ 0.006460521835833788, -0.029766255989670753, -0.0007638221140950918, 0.03266152739524841, 0.009475432336330414, 0.024370525032281876, -0.01353120431303978, -0.008817415684461594, 0.023712508380413055, 0.03936132788658142, 0.0023539031390100718, -0.04007916525006294, 0.008990893140435219, 0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields"...
def test_sparsify(): # Test sparsify and densify members. n_samples, n_features = iris.data.shape target = iris.target_names[iris.target] clf = LogisticRegression(random_state=0).fit(iris.data, target) pred_d_d = clf.decision_function(iris.data) clf.sparsify() assert_true(sp.issparse(clf.c...
12,453
[ 0.044335201382637024, 0.023501362651586533, 0.007113391533493996, 0.005146711599081755, -0.00870032049715519, 0.03583864867687225, 0.030997592955827713, -0.02830537036061287, 0.04087730124592781, 0.06644105166196823, 0.007372734136879444, 0.0020407778210937977, -0.019771771505475044, 0.011...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_consistency_path(): # Test that the path algorithm is consistent rng = np.random.RandomState(0) X = np.concatenate((rng.randn(100, 2) + [1, 1], rng.randn(100, 2))) y = [1] * 100 + [-1] * 100 Cs = np.logspace(0, 4, 10) f = ignore_warnings # can't test with fit_intercept=True since L...
12,454
[ -0.004707993473857641, 0.022536233067512512, 0.01807917281985283, 0.02291860803961754, 0.01991935446858406, 0.009666920639574528, 0.029084406793117523, -0.013072449713945389, 0.017290525138378143, 0.026479477062821388, 0.027196429669857025, -0.017756544053554535, -0.030040346086025238, 0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_inconsistent_input(): # Test that an exception is raised on inconsistent input rng = np.random.RandomState(0) X_ = rng.random_sample((5, 10)) y_ = np.ones(X_.shape[0]) y_[0] = 0 clf = LogisticRegression(random_state=0) # Wrong dimensions for training data y_wrong = y_[:-1] ...
12,455
[ 0.02785031497478485, -0.014985047280788422, 0.0014221137389540672, -0.03281150385737419, 0.028368983417749405, 0.014353623613715172, 0.0030781927052885294, 0.00034601480001583695, 0.0023368331603705883, 0.028323883190751076, -0.0016588977305218577, -0.01580815389752388, -0.016326824203133583...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_logistic_loss_and_grad(): X_ref, y = make_classification(n_samples=20) n_features = X_ref.shape[1] X_sp = X_ref.copy() X_sp[X_sp < .1] = 0 X_sp = sp.csr_matrix(X_sp) for X in (X_ref, X_sp): w = np.zeros(n_features) # First check that our derivation of the grad is corre...
12,456
[ 0.0031522619538009167, -0.029903162270784378, -0.0013990963343530893, 0.028325539082288742, 0.014114961959421635, 0.02655668556690216, -0.005124293267726898, -0.0462769977748394, 0.002707060892134905, 0.04646822437644005, -0.00290874601341784, -0.023879503831267357, -0.014114961959421635, ...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_liblinear_dual_random_state(): # random_state is relevant for liblinear solver only if dual=True X, y = make_classification(n_samples=20) lr1 = LogisticRegression(random_state=0, dual=True, max_iter=1, tol=1e-15) lr1.fit(X, y) lr2 = LogisticRegression(random_state=0, dual=True, max_iter=1, ...
12,457
[ 0.014155206270515919, 0.02574499323964119, -0.012350331991910934, -0.01914982497692108, -0.015256292186677456, 0.010312754660844803, 0.02213524654507637, -0.023928768932819366, 0.005794893950223923, 0.05666622892022133, -0.0030194746796041727, -0.04579158127307892, -0.0035785313230007887, ...
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": "Tuple", "_fields": {"...
def test_logistic_cv(): # test for LogisticRegressionCV object n_samples, n_features = 50, 5 rng = np.random.RandomState(0) X_ref = rng.randn(n_samples, n_features) y = np.sign(X_ref.dot(5 * rng.randn(n_features))) X_ref -= X_ref.mean() X_ref /= X_ref.std() lr_cv = LogisticRegressionCV(C...
12,458
[ 0.0067006731405854225, -0.001028705621138215, 0.0215152520686388, -0.003731056582182646, 0.040204040706157684, -0.006852961145341396, 0.02160053327679634, -0.0042762476950883865, 0.041251782327890396, 0.025048334151506424, 0.011726178228855133, -0.0013584091793745756, -0.033941954374313354, ...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_logistic_grad_hess(): rng = np.random.RandomState(0) n_samples, n_features = 50, 5 X_ref = rng.randn(n_samples, n_features) y = np.sign(X_ref.dot(5 * rng.randn(n_features))) X_ref -= X_ref.mean() X_ref /= X_ref.std() X_sp = X_ref.copy() X_sp[X_sp < .1] = 0 X_sp = sp.csr_matr...
12,459
[ 0.009298821911215782, -0.006887384690344334, -0.02725379541516304, 0.0015938807046040893, 0.019109506160020828, 0.011579451151192188, 0.015594721771776676, -0.03551183268427849, 0.0033726003021001816, 0.053461119532585144, -0.016288578510284424, -0.04483909159898758, -0.0001410285767633468, ...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_logistic_cv_sparse(): X, y = make_classification(n_samples=50, n_features=5, random_state=0) X[X < 1.0] = 0.0 csr = sp.csr_matrix(X) clf = LogisticRegressionCV(fit_intercept=True) clf.fit(X, y) clfs = LogisticRegressionCV(fit_intercept=True) clfs.fit(...
12,460
[ 0.0018387503223493695, 0.0006992780254222453, 0.0016133368480950594, -0.008018482476472855, 0.03785812482237816, -0.015209031291306019, -0.006436334922909737, 0.018509425222873688, 0.013156209141016006, 0.028762195259332657, -0.008131898008286953, -0.01951882429420948, 0.0004387765657156706,...
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": "Tuple", "_fields": {"...
def test_intercept_logistic_helper(): n_samples, n_features = 10, 5 X, y = make_classification(n_samples=n_samples, n_features=n_features, random_state=0) # Fit intercept case. alpha = 1. w = np.ones(n_features + 1) grad_interp, hess_interp = _logistic_grad_hess(w...
12,461
[ 0.027665914967656136, 0.011744963936507702, 0.0037390971556305885, 0.002919219434261322, -0.01326556783169508, 0.015376257710158825, -0.021515412256121635, -0.02274097315967083, 0.005052604246884584, 0.03184190392494202, -0.0005918582319281995, -0.038627881556749344, -0.033748332411050797, ...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_logistic_regression_solvers(): X, y = make_classification(n_features=10, n_informative=5, random_state=0) ncg = LogisticRegression(solver='newton-cg', fit_intercept=False) lbf = LogisticRegression(solver='lbfgs', fit_intercept=False) lib = LogisticRegression(fit_intercept=False) sag = Logi...
12,462
[ -0.004817030392587185, 0.03164103999733925, 0.035581156611442566, -0.012925497256219387, 0.007928279228508472, 0.001524091581813991, 0.04773785173892975, 0.004279468674212694, -0.018631456419825554, 0.05929391831159592, 0.006919225212186575, -0.020673587918281555, 0.017598377540707588, 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": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"...
def test_ovr_multinomial_iris(): # Test that OvR and multinomial are correct using the iris dataset. train, target = iris.data, iris.target n_samples, n_features = train.shape # Use pre-defined fold as folds generated for different y cv = StratifiedKFold(target, 3) clf = LogisticRegressionCV(cv...
12,463
[ 0.030976366251707077, 0.007540605962276459, 0.009784764610230923, -0.004418550990521908, -0.0055028400383889675, 0.021383460611104965, -0.01936022937297821, -0.012871935963630676, -0.005366213619709015, 0.042255301028490067, 0.006168529391288757, -0.03639490529894829, -0.017092814669013023, ...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_logistic_regression_solvers_multiclass(): X, y = make_classification(n_samples=20, n_features=20, n_informative=10, n_classes=3, random_state=0) tol = 1e-6 ncg = LogisticRegression(solver='newton-cg', fit_intercept=False, tol=tol) lbf = LogisticRegression(solver='...
12,464
[ 0.03492499887943268, 0.014966306276619434, -0.0017012099269777536, -0.049576565623283386, 0.015910517424345016, 0.015378720127046108, 0.008801794610917568, -0.026372823864221573, -0.004672222305089235, 0.050705280154943466, 0.0006267615244723856, -0.03153885900974274, -0.029541904106736183, ...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_logistic_regressioncv_class_weights(): X, y = make_classification(n_samples=20, n_features=20, n_informative=10, n_classes=3, random_state=0) # Test the liblinear fails when class_weight of type dict is # provided, when it is multiclass. However it can handle # b...
12,465
[ 0.043848007917404175, -0.00678600138053298, -0.011211655102670193, -0.03749322518706322, 0.016306830570101738, -0.006139175035059452, 0.013935133814811707, -0.03862800821661949, -0.008652719669044018, 0.053153228014707565, -0.0033646312076598406, -0.02040339633822441, -0.025691483169794083, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_logistic_regression_sample_weights(): X, y = make_classification(n_samples=20, n_features=5, n_informative=3, n_classes=2, random_state=0) for LR in [LogisticRegression, LogisticRegressionCV]: # Test that liblinear fails when sample weights are provided c...
12,466
[ 0.017341572791337967, 0.01757182367146015, 0.009761450812220573, -0.01307586021721363, -0.013912037014961243, -0.005789612885564566, 0.03965172916650772, -0.005507858004420996, 0.01834740862250328, 0.0766373872756958, -0.016432685777544975, -0.03131420165300369, -0.017184032127261162, 0.05...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"...
def test_logistic_regression_multinomial(): # Tests for the multinomial option in logistic regression # Some basic attributes of Logistic Regression n_samples, n_features, n_classes = 50, 20, 3 X, y = make_classification(n_samples=n_samples, n_features=n_features, ...
12,467
[ -0.012229052372276783, -0.03834414854645729, -0.039230987429618835, 0.000280236970866099, 0.035076845437288284, -0.007526468485593796, -0.029149020090699196, -0.008617514744400978, 0.0399077869951725, 0.05134335160255432, 0.0025817537680268288, -0.06716644018888474, -0.0389275960624218, 0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_liblinear_decision_function_zero(): # Test negative prediction when decision_function values are zero. # Liblinear predicts the positive class when decision_function values # are zero. This is a test to verify that we do not do the same. # See Issue: https://github.com/scikit-learn/scikit-learn...
12,468
[ -0.030345868319272995, -0.00956326350569725, 0.05196817219257355, -0.002565753646194935, 0.03342477232217789, -0.04851606860756874, 0.020689303055405617, 0.02079426683485508, 0.0069975098595023155, 0.03498755022883415, 0.006665128283202648, -0.0004504646931309253, -0.011534228920936584, 0....
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_multinomial_grad_hess(): rng = np.random.RandomState(0) n_samples, n_features, n_classes = 100, 5, 3 X = rng.randn(n_samples, n_features) w = rng.rand(n_classes, n_features) Y = np.zeros((n_samples, n_classes)) ind = np.argmax(np.dot(X, w.T), axis=1) Y[range(0, n_samples), ind] = 1 ...
12,469
[ 0.04063042253255844, 0.022300641983747482, -0.005031530745327473, -0.01211349107325077, -0.004384492989629507, 0.017490699887275696, -0.01231439784169197, -0.004567672498524189, 0.03339778259396553, 0.053984805941581726, 0.03259415552020073, -0.00928307045251131, 0.00473312521353364, 0.034...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_logreg_cv_penalty(): # Test that the correct penalty is passed to the final fit. X, y = make_classification(n_samples=50, n_features=20, random_state=0) lr_cv = LogisticRegressionCV(penalty="l1", Cs=[1.0], solver='liblinear') lr_cv.fit(X, y) lr = LogisticRegression(penalty="l1", C=1.0, solv...
12,470
[ 0.009968269616365433, 0.029481912031769753, 0.007829622365534306, -0.003304632380604744, 0.016734609380364418, 0.020129863172769547, 0.010983220301568508, -0.011992130428552628, 0.019126994535326958, 0.031342655420303345, -0.0009439649293199182, -0.026388728991150856, -0.0473160520195961, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "For", "_fields": {"body": [{"_type": "Assign", "_fields": {"va...
def test_logreg_intercept_scaling(): # Test that the right error message is thrown when intercept_scaling <= 0 for i in [-1, 0]: clf = LogisticRegression(intercept_scaling=i) msg = ('Intercept scaling is %r but needs to be greater than 0.' ' To disable fitting an intercept,' ...
12,471
[ 0.042305465787649155, 0.038042835891246796, 0.027982110157608986, -0.02692791074514389, -0.040861669927835464, 0.01652342453598976, 0.014506695792078972, 0.007144490256905556, 0.009774258360266685, 0.036484453827142715, 0.01609945297241211, -0.02974674664437771, -0.06513116508722305, -0.02...
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": "Tuple", "_fields": {"...
def test_max_iter(): # Test that the maximum number of iteration is reached X, y_bin = iris.data, iris.target.copy() y_bin[y_bin == 2] = 0 solvers = ['newton-cg', 'liblinear', 'sag'] # old scipy doesn't have maxiter if sp_version >= (0, 12): solvers.append('lbfgs') for max_iter in ...
12,472
[ 0.01174378115683794, -0.014054900035262108, 0.03396698832511902, 0.000843146990519017, 0.024110917001962662, 0.009520871564745903, 0.03467267379164696, 0.016995256766676903, -0.00793307926505804, 0.05382027104496956, -0.015666214749217033, -0.019653337076306343, 0.006262957584112883, 0.033...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_logreg_predict_proba_multinomial(): X, y = make_classification(n_samples=10, n_features=20, random_state=0, n_classes=3, n_informative=10) # Predicted probabilites using the true-entropy loss should give a # smaller loss than those using the ovr method. clf_multi...
12,473
[ 0.006161173339933157, 0.015159145928919315, 0.0031407419592142105, 0.0009616939350962639, 0.012455320917069912, 0.020351501181721687, 0.03753693029284477, -0.0047554378397762775, -0.019667629152536392, 0.05886358395218849, 0.020338837057352066, -0.04293191432952881, -0.018971094861626625, ...
11
{"_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": "Tuple", "_fields": {"...
def test_n_iter(): # Test that self.n_iter_ has the correct format. X, y = iris.data, iris.target y_bin = y.copy() y_bin[y_bin == 2] = 0 n_Cs = 4 n_cv_fold = 2 for solver in ['newton-cg', 'liblinear', 'sag', 'lbfgs']: # OvR case n_classes = 1 if solver == 'liblinear' else n...
12,474
[ 0.014282152988016605, 0.023356515914201736, 0.015115882270038128, -0.022534869611263275, -0.009744971059262753, 0.02723517082631588, 0.01901870407164097, -0.002853107638657093, 0.010596825741231441, 0.06312179565429688, 0.001960473135113716, -0.013339675962924957, -0.0757848247885704, -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": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"...
def test_warm_start(): # A 1-iteration second fit on same data should give almost same result # with warm starting, and quite different result without warm starting. # Warm starting does not work with liblinear solver. X, y = iris.data, iris.target solvers = ['newton-cg', 'sag'] # old scipy doe...
12,475
[ 0.03026898205280304, 0.012178190983831882, -0.012685615569353104, -0.03887313976883888, 0.006033940706402063, 0.04694780707359314, 0.040285103023052216, 0.04467542842030525, 0.02076028473675251, -0.0044206613674759865, 0.052507415413856506, -0.022745860740542412, -0.015432327054440975, 0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s3", "annotation": null, "type_comment": null}}, {"_type": "arg...
def key_check(module, s3, bucket, obj, version=None, validate=True): try: bucket = s3.lookup(bucket, validate=validate) key_check = bucket.get_key(obj, version_id=version) except s3.provider.storage_response_error as e: if version is not None and e.status == 400: # If a specified version...
12,476
[ 0.03159429877996445, 0.008469055406749249, -0.023379364982247353, -0.018006468191742897, -0.023005958646535873, 0.02474852092564106, 0.04435233399271965, 0.0513225793838501, 0.018182797357439995, 0.013089954853057861, 0.02038174495100975, -0.024935223162174225, -0.033004943281412125, -0.00...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s3", "annotation": null, "type_comment": null}}, {"_type": "arg...
def keysum(module, s3, bucket, obj, version=None, validate=True): bucket = s3.lookup(bucket, validate=validate) key_check = bucket.get_key(obj, version_id=version) if not key_check: return None md5_remote = key_check.etag[1:-1] etag_multipart = '-' in md5_remote # Check for multipart, etag i...
12,477
[ 0.027453288435935974, 0.022761503234505653, -0.0005432142643257976, -0.04590342193841934, -0.016273312270641327, 0.04140184447169304, 0.046114761382341385, 0.07942222058773041, 0.028636803850531578, 0.0009787763701751828, 0.05008798837661743, -0.03273683413863182, 0.004179282579571009, -0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s3", "annotation": null, "type_comment": null}}, {"_type": "arg...
def delete_bucket(module, s3, bucket): if module.check_mode: module.exit_json(msg="DELETE operation skipped - running in check mode", changed=True) try: bucket = s3.lookup(bucket) bucket_contents = bucket.list() bucket.delete_keys([key.name for key in bucket_contents]) bu...
12,478
[ -0.0005481500993482769, 0.017190834507346153, 0.03834797069430351, 0.00004235818050801754, -0.023097865283489227, 0.014306253753602505, 0.04848642647266388, 0.04555942490696907, 0.021973727270960808, 0.007025865837931633, 0.03260001540184021, -0.003966299816966057, 0.02039356902241707, -0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s3", "annotation": null, "type_comment": null}}, {"_type": "arg...
def create_bucket(module, s3, bucket, location=None): if module.check_mode: module.exit_json(msg="PUT operation skipped - running in check mode", changed=True) if location is None: location = Location.DEFAULT try: bucket = s3.create_bucket(bucket, location=location) for acl i...
12,479
[ 0.03365779295563698, 0.028569500893354416, 0.0019107157131657004, -0.03411657363176346, -0.013429750688374043, 0.010906459763646126, 0.047713153064250946, 0.060392171144485474, 0.028006453067064285, -0.015285725705325603, 0.05542900413274765, -0.0004652970819734037, -0.009149539284408092, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s3", "annotation": null, "type_comment": null}}, {"_type": "arg...
def create_dirkey(module, s3, bucket, obj, validate=True): if module.check_mode: module.exit_json(msg="PUT operation skipped - running in check mode", changed=True) try: bucket = s3.lookup(bucket, validate=validate) key = bucket.new_key(obj) key.set_contents_from_string('') ...
12,480
[ 0.06336861103773117, 0.06445012241601944, 0.000348925415892154, -0.05944312363862991, -0.022110918536782265, 0.058802228420972824, 0.03719200938940048, 0.08175431936979294, 0.040096066892147064, -0.0077057755552232265, 0.05507701635360718, -0.042579542845487595, -0.022110918536782265, -0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s3", "annotation": null, "type_comment": null}}, {"_type": "arg...
def delete_key(module, s3, bucket, obj, validate=True): if module.check_mode: module.exit_json(msg="DELETE operation skipped - running in check mode", changed=True) try: bucket = s3.lookup(bucket, validate=validate) bucket.delete_key(obj) module.exit_json(msg="Object deleted from...
12,481
[ 0.03259759023785591, 0.023985743522644043, 0.0016673894133418798, -0.07090900838375092, -0.013030814938247204, 0.03099443018436432, 0.0488758310675621, 0.031179411336779594, 0.01659681834280491, -0.006032404024153948, 0.022855309769511223, -0.03711932525038719, -0.016257688403129578, -0.02...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s3", "annotation": null, "type_comment": null}}, {"_type": "arg...
def download_s3file(module, s3, bucket, obj, dest, retries, version=None, validate=True): if module.check_mode: module.exit_json(msg="GET operation skipped - running in check mode", changed=True) # retries is the number of loops; range/xrange needs to be one # more to get that count of loops. bu...
12,482
[ 0.031084394082427025, 0.03919336572289467, 0.012758520431816578, -0.07766056060791016, -0.01358555443584919, 0.024024343118071556, 0.055552512407302856, 0.046475306153297424, 0.021422211080789566, 0.001725930254906416, 0.047483883798122406, -0.02382262796163559, -0.0006788995233364403, -0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s3", "annotation": null, "type_comment": null}}, {"_type": "arg...
def upload_s3file(module, s3, bucket, obj, src, expiry, metadata, encrypt, headers, validate=True): if module.check_mode: module.exit_json(msg="PUT operation skipped - running in check mode", changed=True) try: bucket = s3.lookup(bucket, validate=validate) key = bucket.new_key(obj) ...
12,483
[ -0.004529234487563372, -0.005329969804733992, -0.004878781735897064, -0.03278303146362305, -0.00976747926324606, 0.0067876544781029224, 0.02679363265633583, 0.02110172249376774, 0.02629782259464264, 0.011492902413010597, 0.04450400546193123, -0.05132636800408363, -0.023144463077187538, -0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s3", "annotation": null, "type_comment": null}}, {"_type": "arg...
def get_download_url(module, s3, bucket, obj, expiry, changed=True, validate=True): try: bucket = s3.lookup(bucket, validate=validate) key = bucket.lookup(obj) url = key.generate_url(expiry) module.exit_json(msg="Download url:", url=url, expiry=expiry, changed=changed) except s3....
12,484
[ 0.04086196422576904, 0.04378223046660423, 0.007927220314741135, -0.08006765693426132, 0.003282577730715275, 0.023994144052267075, 0.052695587277412415, 0.03750583529472351, 0.02021305076777935, -0.011986175552010536, 0.03000902570784092, -0.034498393535614014, -0.014132791198790073, -0.000...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s3", "annotation": null, "type_comment": null}}, {"_type": "arg...
def download_s3str(module, s3, bucket, obj, version=None, validate=True): if module.check_mode: module.exit_json(msg="GET operation skipped - running in check mode", changed=True) try: bucket = s3.lookup(bucket, validate=validate) key = bucket.get_key(obj, version_id=version) con...
12,485
[ 0.0005526038585230708, 0.022677041590213776, 0.02533947303891182, -0.04506267234683037, -0.014226133935153484, 0.05897090211510658, 0.03674422204494476, 0.02284923754632473, 0.011702783405780792, 0.07068031281232834, 0.042386993765830994, -0.059500738978385925, -0.0027236954774707556, -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": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( bucket = dict(required=True), dest = dict(default=None), encrypt = dict(default=True, type='bool'), expiry ...
12,486
[ -0.013562027364969254, -0.034987084567546844, 0.041422534734010696, -0.015397490002214909, 0.019544275477528572, -0.018751174211502075, 0.0006273995386436582, 0.02179894782602787, 0.00045709527330473065, 0.011477304622530937, -0.012553656473755836, -0.042759474366903305, 0.001158494036644697...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "aws_connect_kwargs", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "location", "annotation": null, "type_comment": null...
def get_s3_connection(aws_connect_kwargs, location, rgw, s3_url): if s3_url and rgw: rgw = urlparse(s3_url) # ensure none of the named arguments we will pass to boto.connect_s3 # are already present in aws_connect_kwargs for kw in ['is_secure', 'host', 'port', 'calling_format']: ...
12,487
[ 0.0035573539789766073, 0.024678554385900497, 0.04614198952913284, -0.053702544420957565, -0.00340978498570621, -0.0418216735124588, -0.004797561094164848, -0.014555951580405235, -0.02107410319149494, 0.022129064425826073, -0.002714327070862055, 0.030719462782144547, -0.03943544998764992, 0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "targets": [{"_type": "Name", "_fields": {"id": "baseLevel", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_...
class TexiSpitter(latex.BaseLatexSpitter): baseLevel = 1 def writeNodeData(self, node): buf = StringIO() latex.getLatexText(node, self.writer, texiEscape, entities) def visitNode_title(self, node): self.writer('@node ') self.visitNodeDefault(node) self.writer('\n')...
12,488
[ 0.010903277434408665, 0.01951298490166664, 0.009780016727745533, -0.017266463488340378, 0.007962803356349468, -0.0219594594091177, -0.01467884611338377, 0.002837557578459382, -0.029781121760606766, -0.026134934276342392, 0.07621708512306213, -0.03864959254860878, 0.004107842221856117, 0.00...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def _get_data(): raw = io.read_raw_fif(raw_fname, add_eeg_ref=False, verbose=False, preload=True) events = read_events(event_name) picks = pick_types(raw.info, meg=False, eeg=True, stim=False, ecg=False, eog=False, exclude='bads')[::8] ...
12,489
[ 0.02891906537115574, 0.035930462181568146, 0.03470287844538689, -0.04579835757613182, -0.0012231584405526519, -0.007536662742495537, -0.014719214290380478, -0.008687523193657398, -0.009289512410759926, 0.03859810158610344, 0.011154497042298317, 0.04882010444998741, -0.04858402907848358, -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": "node", "annotation": null, "type_comment": null}}], "kwarg": null...
def visitNodeHeader(self, node): self.writer('\n\n@node ') self.visitNodeDefault(node) self.writer('\n') level = (int(node.tagName[1])-2)+self.baseLevel self.writer('\n\n@'+level*'sub'+'section ') self.visitNodeDefault(node) self.writer('\n')
12,490
[ 0.009107964113354683, 0.027202453464269638, 0.017683908343315125, -0.052138034254312515, -0.004880712367594242, -0.008043922483921051, -0.01232900284230709, 0.014653702266514301, 0.015613652765750885, 0.030278921127319336, 0.01656203716993332, 0.04480540007352829, -0.02099168859422207, -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": "node", "annotation": null, "type_comment": null}}], "kwarg": null...
def visitNode_title(self, node): self.writer('@node ') self.visitNodeDefault(node) self.writer('\n') self.writer('@section ') self.visitNodeDefault(node) self.writer('\n') headers = tree.getHeaders(domhelpers.getParents(node)[-1]) if not headers: ...
12,491
[ 0.030627908185124397, -0.0018426836468279362, 0.026548957452178, -0.06678982824087143, 0.03950141370296478, -0.07084492594003677, 0.0331086739897728, -0.01074004266411066, 0.04754004627466202, 0.021503940224647522, 0.0546722449362278, 0.0012642360525205731, 0.018856199458241463, -0.0044456...
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_file_content(self): with use_temp_dir() as iso_directory: os.mkdir(os.path.join(iso_directory, 'isolinux')) filename = os.path.join(iso_directory, 'isolinux', 'isolinux.cfg') sample_content = """ some options and somewhere timeout 0 or timeout 0 or timeout 0 #...
12,492
[ 0.022473031654953957, -0.002674693940207362, 0.007321099750697613, -0.056910768151283264, 0.025699468329548836, -0.04884467273950577, 0.047858819365501404, -0.016737142577767372, 0.04478922113776207, 0.003268448170274496, 0.03784342110157013, -0.016457069665193558, 0.00339728151448071, -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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class ToggleBootLoaderTestCase(TestCase): def test_file_content(self): with use_temp_dir() as iso_directory: os.mkdir(os.path.join(iso_directory, 'isolinux')) filename = os.path.join(iso_directory, 'isolinux', 'isolinux.cfg') sample_content = """ some options and somewhe...
12,493
[ 0.017832115292549133, 0.008042166009545326, 0.08474387973546982, -0.024374494329094887, 0.028625858947634697, 0.04041158780455589, 0.01708812639117241, 0.0006646448746323586, 0.0006583711365237832, -0.004782786127179861, 0.008679870516061783, 0.003339093178510666, 0.022874707356095314, 0.0...
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 Test1(Module): def register(self): self.rhook("core.dbstruct", self.cassandra_struct) self.rhook("grp1.test1", self.test1) self.rhook("grp1.test2", self.test2) self.rhook("grp2.test3", self.test3) def cassandra_struct(self, dbstruct): dbstruct["TestFamily"] = CfDef...
12,494
[ 0.031205294653773308, 0.025290854275226593, 0.01663988083600998, 0.058394063264131546, 0.07185603678226471, 0.04987550526857376, -0.020744679495692253, 0.02740945853292942, -0.0036165257915854454, -0.000712408684194088, 0.021528121083974838, -0.008204079233109951, 0.028755655512213707, 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": "request", "annotation": null, "type_comment": null}}, {"_type": "...
def is_admin(self, request=None, dc=None): if self.is_staff: return True if self.is_dc_owner(dc or request.dc): return True return AdminPermission.name in self._get_dc_permissions(request, dc or request.dc)
12,495
[ -0.022044600918889046, 0.014180238358676434, 0.059110745787620544, -0.045113399624824524, 0.01775273121893406, 0.03830980882048607, 0.02191047929227352, 0.04977105185389519, -0.019057363271713257, 0.03023817017674446, -0.011540494859218597, -0.03487143665552139, 0.005956187844276428, 0.033...
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 TestJoin(Module): def register(self): self.rhook("join.empty", self.empty) self.rhook("join.single", self.single) self.rhook("join.prio1", self.prio1) self.rhook("join.prio1", self.prio2) self.rhook("join.prio2", self.prio2) self.rhook("join.prio2", self.prio1) ...
12,496
[ -0.013601917773485184, 0.005694226361811161, 0.06693153083324432, -0.05486642196774483, 0.001989825163036585, 0.0485815554857254, 0.008991487324237823, 0.013991855084896088, 0.019450971856713295, -0.0029245270416140556, 0.001945383963175118, 0.00096552399918437, 0.02021937631070614, 0.0326...
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 Test2(Module): def register(self): self.rhook("grp1.test1", self.test1) self.rhook("grp1.test2", self.test2) self.rhook("grp2.test3", self.test3) def test1(self): pass def test2(self): pass def test3(self): pass
12,497
[ -0.01010655052959919, 0.015173669904470444, 0.10926149785518646, -0.034971434623003006, 0.008687480352818966, 0.02134835720062256, 0.03247940540313721, 0.03857102617621422, -0.013740754686295986, 0.01878710836172104, 0.007282254286110401, -0.020545370876789093, 0.011670988984405994, 0.0181...
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 register(self): self.rhook("join.empty", self.empty) self.rhook("join.single", self.single) self.rhook("join.prio1", self.prio1) self.rhook("join.prio1", self.prio2) self.rhook("join.prio2", self.prio2) self.rhook("join.prio2", self.prio1) self.rhook("join.pri...
12,498
[ -0.0013988238060846925, -0.009366937913000584, 0.09947191178798676, -0.059572622179985046, 0.04255187511444092, 0.029703417792916298, 0.007004480343312025, 0.021123966202139854, 0.011459993198513985, -0.010085346177220345, 0.011591240763664246, -0.034511227160692215, -0.010043899528682232, ...
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 TestCore(unittest.TestCase): def setUp(self): self.inst = Instance("test", "test") self.inst._dbpool = CassandraPool((("localhost", 9160),)) self.inst._mcpool = MemcachedPool() def test00(self): conn = self.inst.dbpool.cget() try: conn.cass.set_keyspace...
12,499
[ 0.037149447947740555, -0.03893916681408882, 0.0751681923866272, -0.03267515078186989, 0.016056334599852562, 0.017283570021390915, 0.02182178571820259, 0.06570824980735779, 0.030962135642766953, -0.06330490857362747, 0.04824570566415787, -0.02960706315934658, -0.018574723973870277, 0.014675...
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 test00(self): conn = self.inst.dbpool.cget() try: conn.cass.set_keyspace("system") conn.cass.system_drop_keyspace("mgtest") except Exception as e: pass self.inst.dbpool.success(conn) mc = Memcached(self.inst.mcpool, "mgtest-") mc.de...
12,500
[ 0.012589993886649609, 0.0077588725835084915, 0.044253330677747726, -0.04932898283004761, 0.013046009466052055, -0.004242926836013794, -0.007639911957085133, 0.01609933003783226, -0.004976517055183649, 0.021148545667529106, 0.026990830898284912, -0.031220540404319763, -0.010164519771933556, ...
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 test01(self): app = Application(self.inst, "mgtest") list = [] app.hooks.call("core.loaded_modules", list) self.assertEqual(len(list), 0) app.modules.load(["mg.test.testcore.Test1"]) list = [] app.hooks.call("core.loaded_modules", list) self.assertEqu...