query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Returns all numbers below N, that is a multiple of M. | def findMultiples(M, N):
numbers = []
for i in range(N):
if(i + 1 == N):
break
if(((i + 1) % M) == 0):
numbers.append(i+1)
return numbers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sixn(m):\n if m <= 2:\n return ()\n if m > 2:\n yield 2\n if m > 3:\n yield 3\n for n in count(1):\n x = 6 * n - 1\n y = x + 2\n if x < m:\n yield x\n else:\n break\n if y < m:\n yield y\n else:\n ... | [
"0.67994684",
"0.67914283",
"0.6521023",
"0.64013743",
"0.632049",
"0.62614083",
"0.6100065",
"0.6055581",
"0.6036513",
"0.6017747",
"0.60122454",
"0.60112625",
"0.59835833",
"0.59610224",
"0.59551555",
"0.59433913",
"0.5900685",
"0.587324",
"0.5860821",
"0.5820013",
"0.58147... | 0.7943605 | 0 |
auth_state enabled and available | async def test_auth_state(app, auth_state_enabled):
name = 'kiwi'
user = add_user(app.db, app, name=name)
assert user.encrypted_auth_state is None
cookies = await app.login_user(name)
auth_state = await user.get_auth_state()
assert auth_state == app.authenticator.auth_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_auth_state(self):\n raise NotImplementedError()",
"def check_auth():",
"def requires_auth(self):\n return True",
"def get_authorization():\n return True",
"def is_authenticated(self):\n return True #self.authenticated",
"def is_authenticated(self):\n return True",
"de... | [
"0.74882525",
"0.71273947",
"0.6910631",
"0.6909217",
"0.670079",
"0.6680911",
"0.6628001",
"0.65065384",
"0.65065384",
"0.65065384",
"0.65065384",
"0.65065384",
"0.65065384",
"0.65065384",
"0.6505308",
"0.6504012",
"0.64769554",
"0.64769554",
"0.64572227",
"0.64142615",
"0.6... | 0.7185515 | 1 |
auth_state enabled at the Authenticator level, but unavailable due to no crypto keys. | def auth_state_unavailable(auth_state_enabled):
crypto.CryptKeeper.instance().keys = []
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_auth_state(self):\n raise NotImplementedError()",
"async def test_auth_state(app, auth_state_enabled):\n name = 'kiwi'\n user = add_user(app.db, app, name=name)\n assert user.encrypted_auth_state is None\n cookies = await app.login_user(name)\n auth_state = await user.get_auth_state... | [
"0.70946044",
"0.6600317",
"0.5862487",
"0.58282715",
"0.577362",
"0.5701615",
"0.5661563",
"0.5567852",
"0.55177164",
"0.55092674",
"0.55005485",
"0.54370195",
"0.5430303",
"0.53735715",
"0.5352972",
"0.53514665",
"0.5348289",
"0.5340672",
"0.5339704",
"0.5333827",
"0.532115... | 0.6792563 | 1 |
Tests whether ``SoundboardSound.__repr__`` works as intended. | def test__SoundboardSound__repr():
available = False
emoji = BUILTIN_EMOJIS['heart']
name = 'rember'
user_id = 202305240032
volume = 0.69
sound_id = 202305240033
guild_id = 202305240034
sound = SoundboardSound.precreate(
sound_id,
guild_id = guild_id,
av... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_repr(self):\n self.assertEqual(repr(self.deck), \"Deck of 52 cards.\")",
"def test_repr(self):\n self.assertEqual(repr(self.card), \"A of Spades\")",
"def test_repr(self):\n dummy = DummyCryptographicObject()\n repr(dummy)",
"def test_repr_show(self):\n self.assert... | [
"0.6914809",
"0.6808723",
"0.66963106",
"0.6534174",
"0.6505421",
"0.64757746",
"0.6391462",
"0.6254702",
"0.6244902",
"0.6209125",
"0.6178",
"0.6166957",
"0.6156544",
"0.6156544",
"0.6156544",
"0.6156544",
"0.6156544",
"0.6116914",
"0.6116562",
"0.6096828",
"0.60628986",
"... | 0.77653193 | 0 |
Tests whether ``SoundboardSound.__hash__`` works as intended. | def test__SoundboardSound__hash():
available = False
emoji = BUILTIN_EMOJIS['heart']
name = 'rember'
user_id = 202305240035
volume = 0.69
sound_id = 202305240036
guild_id = 202305240037
keyword_parameters = {
'available': available,
'emoji': emoji,
'name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__SoundboardSound__eq():\n available = False\n emoji = BUILTIN_EMOJIS['heart']\n name = 'rember'\n user_id = 202305240038\n volume = 0.69\n \n sound_id = 202305240039\n guild_id = 202305240040\n \n keyword_parameters = {\n 'available': available,\n 'emoji': emoji... | [
"0.64707255",
"0.63552177",
"0.6180331",
"0.61213714",
"0.6096645",
"0.60493755",
"0.60439104",
"0.603657",
"0.603657",
"0.60337245",
"0.6027019",
"0.6023845",
"0.60236806",
"0.59823734",
"0.5976516",
"0.5973415",
"0.59712046",
"0.59241724",
"0.58853847",
"0.5853793",
"0.5851... | 0.78902173 | 0 |
Tests whether ``SoundboardSound.__eq__`` works as intended. | def test__SoundboardSound__eq():
available = False
emoji = BUILTIN_EMOJIS['heart']
name = 'rember'
user_id = 202305240038
volume = 0.69
sound_id = 202305240039
guild_id = 202305240040
keyword_parameters = {
'available': available,
'emoji': emoji,
'name':... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, NhlOddsScoringPlay):\n return False\n\n return self.__dict__ == other.__dict__",
"def __eq__(self, other):\n if not isinstance(other, DiarizeAudio):\n return False\n\n return self.__dict__ == other.__dict__",
... | [
"0.7053136",
"0.69082266",
"0.68528724",
"0.6663054",
"0.6607504",
"0.65843195",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
"0.65642565",
... | 0.7741757 | 0 |
Getter method for usr_ping_count, mapped from YANG variable /mpls_state/statistics_oam/usr_ping_count (uint32) | def _get_usr_ping_count(self):
return self.__usr_ping_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_usr_ping_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"usr-ping-count\", rest_name=\"usr-ping-count\", pa... | [
"0.7919465",
"0.62490904",
"0.5974101",
"0.5872466",
"0.5848729",
"0.5829324",
"0.58061343",
"0.57633376",
"0.5698802",
"0.5670618",
"0.55348474",
"0.54909444",
"0.54774773",
"0.54751647",
"0.54595673",
"0.54140943",
"0.5395396",
"0.5368198",
"0.5319455",
"0.531552",
"0.52972... | 0.6955739 | 1 |
Setter method for usr_ping_count, mapped from YANG variable /mpls_state/statistics_oam/usr_ping_count (uint32) | def _set_usr_ping_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="usr-ping-count", rest_name="usr-ping-count", parent=self, path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_usr_ping_count(self):\n return self.__usr_ping_count",
"def _set_usr_traceroute_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), ... | [
"0.66030264",
"0.6556253",
"0.5894535",
"0.568632",
"0.56651974",
"0.56644946",
"0.5605921",
"0.5584418",
"0.55039364",
"0.55039364",
"0.5503759",
"0.5493639",
"0.54372156",
"0.53541523",
"0.5247895",
"0.5217682",
"0.5213357",
"0.5187056",
"0.516838",
"0.5158767",
"0.51152784... | 0.8726256 | 0 |
Getter method for usr_traceroute_count, mapped from YANG variable /mpls_state/statistics_oam/usr_traceroute_count (uint32) | def _get_usr_traceroute_count(self):
return self.__usr_traceroute_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_usr_traceroute_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"usr-traceroute-count\", rest_name=\"usr-trac... | [
"0.8096988",
"0.58348656",
"0.5540107",
"0.5337788",
"0.5088764",
"0.50769204",
"0.5072222",
"0.50714403",
"0.5059296",
"0.50581366",
"0.50281113",
"0.49717057",
"0.4894099",
"0.48607355",
"0.48384598",
"0.48260984",
"0.48260832",
"0.48071045",
"0.47291836",
"0.47040775",
"0.... | 0.7333012 | 1 |
Setter method for usr_traceroute_count, mapped from YANG variable /mpls_state/statistics_oam/usr_traceroute_count (uint32) | def _set_usr_traceroute_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="usr-traceroute-count", rest_name="usr-traceroute-count",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_usr_traceroute_count(self):\n return self.__usr_traceroute_count",
"def _set_usr_ping_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size... | [
"0.69384295",
"0.67749554",
"0.55161387",
"0.5156745",
"0.5149116",
"0.51029897",
"0.506374",
"0.5044057",
"0.5044057",
"0.4962718",
"0.49115133",
"0.49114674",
"0.48995262",
"0.48913693",
"0.48689324",
"0.4850962",
"0.48443764",
"0.4837305",
"0.48038968",
"0.47544253",
"0.46... | 0.88829786 | 0 |
Getter method for echo_req_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_sent_count (uint32) | def _get_echo_req_sent_count(self):
return self.__echo_req_sent_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_req_sent_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-sent-count\", rest_name=\"echo-req-s... | [
"0.7922508",
"0.6860566",
"0.67645717",
"0.65473276",
"0.64664423",
"0.5968414",
"0.5861087",
"0.5787943",
"0.5689521",
"0.56807286",
"0.5430021",
"0.54220355",
"0.5201689",
"0.5130782",
"0.49798772",
"0.4948916",
"0.48980132",
"0.48834348",
"0.4872083",
"0.48253825",
"0.4824... | 0.7223332 | 1 |
Setter method for echo_req_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_sent_count (uint32) | def _set_echo_req_sent_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-req-sent-count", rest_name="echo-req-sent-count", pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_resp_sent_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-sent-count\", rest_name=\"echo-res... | [
"0.7546443",
"0.74266785",
"0.69616437",
"0.66970843",
"0.6288053",
"0.6279342",
"0.6064423",
"0.57884806",
"0.5556439",
"0.5305215",
"0.52710307",
"0.5181049",
"0.50654066",
"0.50303006",
"0.50086975",
"0.49919927",
"0.48444322",
"0.4777001",
"0.4770685",
"0.4731099",
"0.468... | 0.86451477 | 0 |
Getter method for echo_req_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_received_count (uint32) | def _get_echo_req_received_count(self):
return self.__echo_req_received_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_req_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-received-count\", rest_name=\"ec... | [
"0.77231425",
"0.7023055",
"0.6542562",
"0.62707675",
"0.5976226",
"0.5851045",
"0.58174163",
"0.54856044",
"0.54173255",
"0.5317395",
"0.50623125",
"0.5022893",
"0.5022014",
"0.4883163",
"0.4860375",
"0.48226205",
"0.48192063",
"0.4816786",
"0.4814243",
"0.4797339",
"0.46779... | 0.70718306 | 1 |
Setter method for echo_req_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_received_count (uint32) | def _set_echo_req_received_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-req-received-count", rest_name="echo-req-receive... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_resp_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-received-count\", rest_name=\"... | [
"0.7757586",
"0.7065394",
"0.68073034",
"0.67364514",
"0.66612166",
"0.62458676",
"0.56309354",
"0.5338627",
"0.52505404",
"0.50096846",
"0.48576525",
"0.48448968",
"0.48185655",
"0.47561345",
"0.4739262",
"0.46860245",
"0.46509308",
"0.46177593",
"0.45707104",
"0.45225346",
... | 0.84776396 | 0 |
Getter method for echo_req_timeout_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_timeout_count (uint32) | def _get_echo_req_timeout_count(self):
return self.__echo_req_timeout_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_req_timeout_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-timeout-count\", rest_name=\"echo... | [
"0.80206865",
"0.6734563",
"0.6540391",
"0.6376731",
"0.61047983",
"0.60804176",
"0.60245043",
"0.5819295",
"0.55777395",
"0.49859354",
"0.49369183",
"0.4863983",
"0.48448384",
"0.48247913",
"0.4788822",
"0.4729328",
"0.47008264",
"0.4682831",
"0.46340755",
"0.46337748",
"0.4... | 0.7347358 | 1 |
Setter method for echo_req_timeout_count, mapped from YANG variable /mpls_state/statistics_oam/echo_req_timeout_count (uint32) | def _set_echo_req_timeout_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-req-timeout-count", rest_name="echo-req-timeout-c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_req_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-received-count\", rest_name=\"ec... | [
"0.7362202",
"0.7095978",
"0.6999127",
"0.6642217",
"0.64998084",
"0.60558325",
"0.57168615",
"0.5617509",
"0.52749455",
"0.50046265",
"0.4905859",
"0.49030608",
"0.48003668",
"0.4683387",
"0.4644038",
"0.45746693",
"0.45659736",
"0.4561842",
"0.45596886",
"0.4557894",
"0.448... | 0.87411803 | 0 |
Getter method for echo_resp_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_sent_count (uint32) | def _get_echo_resp_sent_count(self):
return self.__echo_resp_sent_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_resp_sent_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-sent-count\", rest_name=\"echo-res... | [
"0.7885906",
"0.71892625",
"0.7101065",
"0.69950885",
"0.66274446",
"0.6617462",
"0.635762",
"0.5800941",
"0.577533",
"0.55431056",
"0.5397536",
"0.5257677",
"0.5200311",
"0.5128361",
"0.5111158",
"0.51002544",
"0.50733143",
"0.50320685",
"0.50222456",
"0.4920297",
"0.4917206... | 0.7451523 | 1 |
Setter method for echo_resp_sent_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_sent_count (uint32) | def _set_echo_resp_sent_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-resp-sent-count", rest_name="echo-resp-sent-count",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_resp_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-received-count\", rest_name=\"... | [
"0.7872074",
"0.7738624",
"0.7278106",
"0.7268996",
"0.6715367",
"0.65274954",
"0.6379835",
"0.60264504",
"0.5693287",
"0.55500114",
"0.5237852",
"0.515169",
"0.50731426",
"0.5025889",
"0.49551892",
"0.4954932",
"0.4935209",
"0.49100864",
"0.4884356",
"0.48487535",
"0.4827424... | 0.8611856 | 0 |
Getter method for echo_resp_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_received_count (uint32) | def _get_echo_resp_received_count(self):
return self.__echo_resp_received_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_resp_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-resp-received-count\", rest_name=\"... | [
"0.785285",
"0.70278424",
"0.6552268",
"0.64812785",
"0.6124184",
"0.55265635",
"0.5396158",
"0.5115494",
"0.5112692",
"0.50826174",
"0.49409315",
"0.4853131",
"0.4822724",
"0.47961304",
"0.4737998",
"0.47299495",
"0.47204226",
"0.46952853",
"0.46684587",
"0.46589735",
"0.465... | 0.731385 | 1 |
Setter method for echo_resp_received_count, mapped from YANG variable /mpls_state/statistics_oam/echo_resp_received_count (uint32) | def _set_echo_resp_received_count(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="echo-resp-received-count", rest_name="echo-resp-rece... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_echo_req_received_count(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"echo-req-received-count\", rest_name=\"ec... | [
"0.76704717",
"0.73230594",
"0.70944583",
"0.6276271",
"0.618727",
"0.6063231",
"0.60443354",
"0.51781255",
"0.5142111",
"0.50479865",
"0.49492952",
"0.48183542",
"0.47569573",
"0.47515997",
"0.47491166",
"0.4727505",
"0.46277964",
"0.45390615",
"0.45219365",
"0.44867164",
"0... | 0.8556093 | 0 |
Getter method for return_codes, mapped from YANG variable /mpls_state/statistics_oam/return_codes (list) | def _get_return_codes(self):
return self.__return_codes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_return_codes(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=YANGListType(\"number\",return_codes.return_codes, yang_name=\"return-codes\", rest_name=\"return-codes\", parent=self, is_container='list', user_ordered=False, path_helper=se... | [
"0.74746984",
"0.6001439",
"0.5503843",
"0.52020866",
"0.51311105",
"0.5087448",
"0.5053257",
"0.50515985",
"0.49911606",
"0.48414174",
"0.48189038",
"0.46903574",
"0.4685551",
"0.4676945",
"0.46544784",
"0.46471697",
"0.45722067",
"0.45684677",
"0.45653287",
"0.44813254",
"0... | 0.6220025 | 1 |
Setter method for return_codes, mapped from YANG variable /mpls_state/statistics_oam/return_codes (list) | def _set_return_codes(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=YANGListType("number",return_codes.return_codes, yang_name="return-codes", rest_name="return-codes", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_return_codes(self):\n return self.__return_codes",
"def traffic_statuscodes_cachecodes(self, **kwargs):\n url_path = 'traffic/statuscodes/cachecodes'\n self.logger.debug(f\"Get list of cache codes\")\n body = self._make_body(kwargs)\n return self._common_get(request_path=u... | [
"0.6291366",
"0.614847",
"0.55107534",
"0.54416496",
"0.5277496",
"0.5117377",
"0.50821906",
"0.50539535",
"0.49968654",
"0.4987946",
"0.49695534",
"0.47850552",
"0.47627786",
"0.4757852",
"0.4730072",
"0.4728713",
"0.47217613",
"0.46919942",
"0.46385816",
"0.4602432",
"0.459... | 0.8261662 | 0 |
Assumes binary array of 1 and 0 as input. Calculate longest ranges of 1's. | def count_ranges(a):
ranges = []
count = 0
for i, v in enumerate(a):
if v == 1: # same as previous value
count += 1
else:
if count > 1:
ranges.append([i, count]) # [end, length]
count = 0
return ranges | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(N):\n # write your code in Python 3.6\n bin_number = str(bin(N))[2:]\n new_bin_gap = False\n longest_bin_gap = 0\n bin_gap_counter = 0\n for char in bin_number:\n if char == '1':\n if bin_gap_counter > longest_bin_gap:\n longest_bin_gap = bin_gap_coun... | [
"0.6214653",
"0.61803985",
"0.61673665",
"0.6140894",
"0.60812706",
"0.60509235",
"0.60332197",
"0.6032968",
"0.59139353",
"0.5893834",
"0.5799357",
"0.5777712",
"0.57581043",
"0.57554233",
"0.57196367",
"0.56999797",
"0.5694365",
"0.5683879",
"0.56704044",
"0.56537473",
"0.5... | 0.6188714 | 1 |
from range of count_ranges, return the 'howmany' longest ranges | def find_longest_ranges(range, howmany):
range.sort(key=lambda x: x[1]) # sort by length
if howmany > 1:
range = range[-howmany:] # get last few
range.sort(key=lambda x: x[0]) # sorted by starttime
return range
else:
return range[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overlap_len(range1, range2):\n return min(range1[1], range2[1]) - max(range1[0], range2[0])",
"def count_ranges(a):\n ranges = []\n count = 0\n for i, v in enumerate(a):\n if v == 1: # same as previous value\n count += 1\n else:\n if count > 1:\n ... | [
"0.6553023",
"0.63709086",
"0.6276035",
"0.618169",
"0.61786216",
"0.60901237",
"0.60474753",
"0.6026283",
"0.6022194",
"0.6012892",
"0.5978638",
"0.58781105",
"0.58559895",
"0.58521396",
"0.5841774",
"0.58397764",
"0.58287156",
"0.58229816",
"0.5816759",
"0.5807792",
"0.5768... | 0.74052256 | 0 |
Function used to attach form fields to wtforms. Not really a great solution but is approved by wtforms. | def attach_custom_user_fields(form_cls, **kwargs):
new_fields = UserFields.query.filter_by(**kwargs).all()
for field in new_fields:
validators = []
if field.required:
validators.append(InputRequired())
if field.field_type == "text":
input_field = StringField(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_CustomisedFormLayoutFields(request):\n schema = schemaish.Structure()\n schema.add( 'firstName', schemaish.String())\n schema.add( 'surname', schemaish.String())\n schema.add( 'age', schemaish.Integer())\n schema.add( 'sex', schemaish.String())\n\n form = formish.Form(schema, 'form')\n\n... | [
"0.698078",
"0.6600586",
"0.659325",
"0.6585638",
"0.6533927",
"0.6412825",
"0.6412825",
"0.6412825",
"0.629907",
"0.62634355",
"0.62466544",
"0.6142649",
"0.6102095",
"0.60763484",
"0.60400486",
"0.5991732",
"0.5991732",
"0.5946256",
"0.5897828",
"0.5873216",
"0.58706456",
... | 0.6660687 | 1 |
If we have a registration code required, we attach it to the form similar to attach_custom_user_fields | def attach_registration_code_field(form_cls):
if Configs.registration_code:
setattr( # noqa B010
form_cls,
"registration_code",
StringField(
"Registration Code",
description="Registration code required to create account",
v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registration(request, code=None):\n if request.method == \"POST\":\n form = RegistrationForm(request.POST)\n if form.is_valid():\n form.save()\n return redirect(\"confirm.html\")\n else:\n form = RegistrationForm()\n return render(request, 'registration.html'... | [
"0.6838169",
"0.66669655",
"0.6514536",
"0.6208826",
"0.6137646",
"0.6134475",
"0.6013371",
"0.6006505",
"0.6004355",
"0.5999936",
"0.5989894",
"0.5950262",
"0.59496284",
"0.5925366",
"0.59166074",
"0.58668554",
"0.58395535",
"0.5811587",
"0.5776874",
"0.5757824",
"0.57516545... | 0.78658634 | 0 |
Custom init to persist the obj parameter to the rest of the form | def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
obj = kwargs.get("obj")
if obj:
self.obj = obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n\n self._obj = kwargs.get('obj', None)\n super(ModelForm, self).__init__(*args, **kwargs)",
"def __init__(self, obj, attribs):\n self.obj = obj\n self.attribs = attribs\n if self.obj:\n self._save()",
"def __init__(self... | [
"0.81270677",
"0.7214874",
"0.6869673",
"0.66981107",
"0.66653264",
"0.66653264",
"0.6648626",
"0.65440965",
"0.6481102",
"0.6445112",
"0.6415407",
"0.6336561",
"0.6326652",
"0.63131803",
"0.6255758",
"0.6211104",
"0.6211104",
"0.62063265",
"0.6182554",
"0.613536",
"0.6123644... | 0.7258114 | 1 |
Labeled tokens come back from the UI as JSON. This method pulls them from the json and dumps | def get_labels():
json_request = request.json # get the json from the server
keys = sort_keys(json_request.keys()) # sort the keys (i.e. the token ids)
labels = []
for k in keys:
# get the labels that the user input to the UI
val = (json_request[k]['text'], json_request[k]['value'])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokens_json(self):\n token_id, secret = self.decoded_token\n token_row = self.unauthenticated_token_row\n tokens_encoded = Fernet(secret).decrypt(\n token_row.tokens_fernet.encode('ascii'))\n return json.loads(tokens_encoded.decode('ascii'))",
"def tokens():\n pass",... | [
"0.5711956",
"0.55669457",
"0.5513183",
"0.54622537",
"0.52287966",
"0.5219712",
"0.5186664",
"0.51845807",
"0.5176791",
"0.5157778",
"0.5122742",
"0.51104176",
"0.5076709",
"0.5054146",
"0.50533843",
"0.5040823",
"0.5034359",
"0.502462",
"0.50213176",
"0.49873635",
"0.497497... | 0.65568817 | 0 |
Used in ``mezzanine.pages.views.page`` to ensure ``PageMiddleware`` or a subclass has been installed. We cache the result on the ``PageMiddleware._installed`` to only run this once. | def installed(cls):
try:
return cls._installed
except AttributeError:
name = "mezzanine.pages.middleware.PageMiddleware"
installed = middlewares_or_subclasses_installed([name])
setattr(cls, "_installed", installed)
return installed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Install (self):\n if self in sys.meta_path:\n return\n sys.meta_path.insert (0, self)",
"def is_installed(self):\n pass",
"def pre_installation(self):\n pass",
"def autodiscover():\n from django.utils.importlib import import_module\n global LOADED\n if LOAD... | [
"0.5708004",
"0.5457926",
"0.53875947",
"0.5337035",
"0.53081757",
"0.5224973",
"0.52124566",
"0.5208954",
"0.51006395",
"0.5072566",
"0.5057796",
"0.5034346",
"0.5021708",
"0.50119513",
"0.5004418",
"0.5003487",
"0.4994785",
"0.49845058",
"0.49206704",
"0.49062628",
"0.49048... | 0.8444131 | 0 |
Checks if all the arguments it receives are numeric (according to | def are_numeric(*values):
for value in values:
if not is_numeric(value):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_arguments(arguments):\n quit = False\n for argument, value in vars(arguments).items():\n try:\n float(value)\n except:\n print(\"{} must be numeric\".format(argument))\n quit = True\n if quit:\n exit(1)",
"def check_for_float_and_int(check)... | [
"0.79766375",
"0.72621953",
"0.7188788",
"0.7124984",
"0.7036451",
"0.7026137",
"0.6995436",
"0.69920516",
"0.6922569",
"0.6913737",
"0.68856776",
"0.68640095",
"0.68215996",
"0.67944366",
"0.6732328",
"0.6717718",
"0.6717057",
"0.6711378",
"0.664611",
"0.6630572",
"0.6597417... | 0.7544063 | 1 |
return the unitwise definition corresponding to attrname | def _get_wavelength_attrs_with_units(self, attrname, units='AA'):
attr = self._lick[attrname]
if self.wavelength_unit is not None:
if units is None:
return attr * unit[self.wavelength_unit]
else:
return (attr * unit[self.wavelength_unit]).to(units)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_wavelength_attrs_with_units(self, attrname, units='AA'):\n attr = self._lick[attrname]\n if self.wavelength_unit is not None:\n if units is None:\n return attr * Unit(self.wavelength_unit)\n else:\n return (attr * Unit(self.wavelength_unit)... | [
"0.63725454",
"0.60422206",
"0.5772077",
"0.57339555",
"0.5650211",
"0.5626752",
"0.5624979",
"0.55762106",
"0.55762106",
"0.5543511",
"0.55427015",
"0.55405295",
"0.5533721",
"0.5516388",
"0.54795426",
"0.5476638",
"0.5459001",
"0.5459001",
"0.5439841",
"0.54318297",
"0.5421... | 0.6441973 | 0 |
Scan for independent loops and set up dictionaries. | def main(self, verbose=0):
indepdict=self.scan_for_loop(self.indeploop)
pegdict1 = self.scan_for_loop(self.pegloop1)
pegdict2 = self.scan_for_loop(self.pegloop2)
if len(indepdict.keys()) == 0 and len(pegdict1.keys()) == 0 and len(pegdict2.keys()) == 0:
return dict()
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_looped_datasets(self, alldict, allcombs):\n datasets_dict=dict()\n numcombs = len(allcombs)\n combct = 0\n while combct < numcombs:\n newdata = list(self.baseinput.data)\n loopedlines = dict()\n loopedlines = self.prepare_looped_lines(alldict... | [
"0.60553885",
"0.5839073",
"0.5820277",
"0.5816718",
"0.5751431",
"0.5579861",
"0.5559903",
"0.55534524",
"0.5551435",
"0.55467737",
"0.5465791",
"0.5446664",
"0.54339755",
"0.54255664",
"0.53983235",
"0.5374087",
"0.53734773",
"0.53571624",
"0.53484",
"0.53369623",
"0.533300... | 0.59351087 | 1 |
Prepare looped lines from looping dictionary. | def prepare_looped_lines(self, alldict, comblist):
loopline_dict=dict()
for stridx in comblist:
lidx = int(stridx.split('-')[0])
loopidx = int(stridx.split('-')[1])
loopline_dict[lidx] = alldict[lidx]['prepend'] + alldict[lidx]['looplist'][loopidx].strip() + alldict[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_looped_datasets(self, alldict, allcombs):\n datasets_dict=dict()\n numcombs = len(allcombs)\n combct = 0\n while combct < numcombs:\n newdata = list(self.baseinput.data)\n loopedlines = dict()\n loopedlines = self.prepare_looped_lines(alldict... | [
"0.62352186",
"0.5535244",
"0.540953",
"0.538531",
"0.53788745",
"0.5370846",
"0.53634304",
"0.5115916",
"0.510933",
"0.50691956",
"0.5020476",
"0.5014774",
"0.50135577",
"0.50128126",
"0.5011278",
"0.5003016",
"0.49997228",
"0.49952468",
"0.49902463",
"0.49880245",
"0.498213... | 0.7311217 | 0 |
Prepare looped datasets from looping lines. | def prepare_looped_datasets(self, alldict, allcombs):
datasets_dict=dict()
numcombs = len(allcombs)
combct = 0
while combct < numcombs:
newdata = list(self.baseinput.data)
loopedlines = dict()
loopedlines = self.prepare_looped_lines(alldict, allcombs[c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_preprocessing():\n lineid_content = get_lineid_content()\n print('Read movie_lines.txt file complete...')\n convos = get_convos()\n print('Read movie_conversations.txt file complete...')\n print('Building dataset')\n get_data(lineid_content, convos)",
"def _prepare_sets(self):\n\n ... | [
"0.6232418",
"0.6178191",
"0.61240345",
"0.6034664",
"0.5999491",
"0.59856147",
"0.5969796",
"0.5958377",
"0.5950267",
"0.5871935",
"0.58671767",
"0.5818414",
"0.5809877",
"0.5804624",
"0.5801337",
"0.5794393",
"0.5745656",
"0.5720152",
"0.5712723",
"0.5677284",
"0.56412107",... | 0.6497661 | 0 |
Create independently looped input files. | def create_input_files(self, datasets_dict):
ifname = self.keywords['inputfile']
dirstem = os.path.dirname(ifname)
basename = os.path.basename(ifname).split('.')[0]
createdfiles=list()
if dirstem == "":
dirstem = os.getcwd()
dkeys = datasets_dict.keys()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_files(self, dir, num_files=10):\n for i in range(num_files):\n self._make_random_file(dir)",
"def create_input_files(in_dir, R, I):\n def get_filepath(in_volume, infiles_partition):\n _3d_pos = numeric_to_3d_pos(in_volume.index, infiles_partition, order='F')\n i, j, k... | [
"0.6580419",
"0.6510424",
"0.6231249",
"0.6147335",
"0.61276037",
"0.60895264",
"0.60482085",
"0.6024064",
"0.59860575",
"0.5985176",
"0.59534013",
"0.58648974",
"0.58312774",
"0.582473",
"0.5797607",
"0.57878214",
"0.5783304",
"0.5764239",
"0.5764155",
"0.57330567",
"0.57255... | 0.6638289 | 0 |
Extract constant names from sybdb.h to use as python constants | def extract_constants(freetds_include="sybdb.h", constants_file="bcp_constants.py"):
fileno, source_file = mkstemp(suffix=".c", text=True)
write(fileno, "#include <{}>".format(freetds_include).encode())
close(fileno)
fileno, include_directives = mkstemp(suffix=".txt")
close(fileno)
if ON_WINDO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_declarations(self):\n return \"extern const unsigned int %s;\\n\" % self.name",
"def get_calculable_constant_names_latex():\n return r\"t_0\", r\"S_{rr}\", r\"S_{r\\theta}\", r\"S_{rz}\", r\"S_{zz}\" \\\n r\"\\alpha\", r\"\\beta\", r\"\\gamma\", r\"C_{13}\", r\"C_{33}\", \... | [
"0.63279045",
"0.6142163",
"0.594471",
"0.5942139",
"0.59368765",
"0.59215355",
"0.590987",
"0.58534914",
"0.57482266",
"0.57082814",
"0.5656697",
"0.56237125",
"0.55894226",
"0.55852455",
"0.5570691",
"0.5560409",
"0.5546228",
"0.5487835",
"0.5454318",
"0.5445472",
"0.543823... | 0.6312631 | 1 |
Get open accounts Returns array with active account numbers | async def get_open_accounts(self):
result = []
URL = API_HOST + "/api/resources/header"
async with async_timeout.timeout(TIMEOUT):
response = await self.session.get(URL)
json_data = await response.json()
accounts = json_data["data"]["accounts"]["data"]["data"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_accounts(self):\n\n data = {\n 'customerId': self.personal_identity_number,\n 'responseControl': {\n 'filter': {\n 'includes': ['ALL']\n }\n }\n }\n\n headers = {'Content-type': 'application/json',\n ... | [
"0.63580984",
"0.6303217",
"0.62876016",
"0.6213196",
"0.61325455",
"0.61324793",
"0.6089535",
"0.6086548",
"0.6079627",
"0.6079134",
"0.6050323",
"0.6013716",
"0.59957004",
"0.59836334",
"0.59793425",
"0.5972705",
"0.5965284",
"0.59572",
"0.5945932",
"0.59283507",
"0.5911551... | 0.8321022 | 0 |
Get budget billing data | async def __getBBL_async(self, account, projectedBillData) -> dict:
_LOGGER.info("Getting budget billing data")
data = {}
try:
async with async_timeout.timeout(TIMEOUT):
response = await self.session.get(
URL_BUDGET_BILLING_PREMISE_DETAILS.format(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCampaignBudget(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')",
"def budget(self):\n return self._budget",
"def billing_info(self):\r\n r... | [
"0.66888595",
"0.6544355",
"0.64032984",
"0.6293646",
"0.62567914",
"0.625594",
"0.62317514",
"0.6158417",
"0.6107173",
"0.60221004",
"0.59583",
"0.586195",
"0.58142555",
"0.57493407",
"0.56994355",
"0.5688151",
"0.5630534",
"0.5616468",
"0.56075585",
"0.5590992",
"0.5573143"... | 0.7448803 | 0 |
get data from appliance usage | async def __getDataFromApplianceUsage(self, account, lastBilledDate) -> dict:
_LOGGER.info("Getting appliance usage data")
JSON = {"startDate": str(lastBilledDate.strftime("%m%d%Y"))}
data = {}
try:
async with async_timeout.timeout(TIMEOUT):
response = await... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUsageInfo(self):\n return self.jsonRequest(\"/api/v1/usage\", { \"apiKey\": self._apiKey })",
"def get_application_api_usage_get(self, applicationId, end, start):\n # TODO: Assuming first server is good - need to make fallback logic\n return self.session.get_any(\"{base}{request_url}\... | [
"0.6542614",
"0.6461803",
"0.6203412",
"0.6135864",
"0.5930974",
"0.5910394",
"0.5888209",
"0.5844207",
"0.58017164",
"0.5787487",
"0.57435703",
"0.5714978",
"0.5709852",
"0.564539",
"0.5628239",
"0.5616134",
"0.5614402",
"0.56101",
"0.5602017",
"0.55986047",
"0.5594599",
"... | 0.6843256 | 0 |
Return the default form class used for user registration. | def get_form_class(self, request):
return RegistrationForm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_form_class(self, request):\n\t\treturn RegistrationForm",
"def get_form_class(self):\n return self.form_class",
"def get_form_class(self):\n if self.form_class:\n return self.form_class\n else:\n raise ImproperlyConfigured(\n \"在定义类视图%s的时候,你必须明确... | [
"0.8111784",
"0.770102",
"0.74282926",
"0.72233987",
"0.71631217",
"0.7097246",
"0.7082445",
"0.696311",
"0.692484",
"0.6767896",
"0.67418265",
"0.66456175",
"0.66020036",
"0.64767134",
"0.64665145",
"0.64210325",
"0.63494134",
"0.6314577",
"0.62687373",
"0.6240669",
"0.62336... | 0.7956627 | 1 |
Creates the sum tree data structure for the given replay capacity. | def __init__(self, capacity):
assert isinstance(capacity, int)
if capacity <= 0:
raise ValueError(
'Sum tree capacity should be positive. Got: {}'.format(capacity))
self.nodes = []
self.depth = int(np.ceil(np.log2(capacity)))
self.low_idx = (2**self.depth) - 1 # pri_idx + low_idx -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, capacity, tuple, alpha=0.6, beta=0.4):\n self.tree = SumTree(capacity)\n self.capacity = capacity\n self.alpha = alpha\n self.beta = beta\n self.tuple = tuple",
"def __init__(self, memory_size, batch_size, alpha):\n self.tree = sum_tree.SumTree(memory_... | [
"0.6020408",
"0.5820842",
"0.5724238",
"0.55728537",
"0.55458015",
"0.5542693",
"0.5513752",
"0.5476557",
"0.53817534",
"0.53465384",
"0.53336674",
"0.53084284",
"0.5296613",
"0.5293262",
"0.5262831",
"0.5256954",
"0.5208593",
"0.519735",
"0.5179887",
"0.51658785",
"0.5162465... | 0.70326006 | 0 |
Performs stratified sampling using the sum tree. | def stratified_sample(self, batch_size, rng):
if self._total_priority() == 0.0:
raise Exception('Cannot sample from an empty sum tree.')
indices = parallel_stratified_sample(rng, self.nodes, np.arange(batch_size),
batch_size, self.depth)
return np.minimum(indi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample(tree, i, alpha=0.5, beta=0.5, only_tree=True):\n # for n in tree.nodes():\n # lab = tuple(n)\n # if len(n) == 1:\n # lab = \"(\" + str(list(n)[0]) + \")\"\n # tree.node[n] = {\"color\": \"black\", \"label\": lab}\n # print tree.nodes()\n\n if only_tree is True:\n... | [
"0.5792323",
"0.57242346",
"0.5687577",
"0.5676991",
"0.56017643",
"0.55336124",
"0.54666936",
"0.5430783",
"0.53604496",
"0.5358043",
"0.530985",
"0.5304589",
"0.5277224",
"0.5271483",
"0.52695686",
"0.5267166",
"0.5261225",
"0.52445275",
"0.52442276",
"0.5240669",
"0.520557... | 0.76193213 | 0 |
Prints a message only when app is in debug mode | def print_debug(message):
if current_app.debug:
print(message) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug():\n assert current_app.debug == False, \"Don't panic! You're here by request of debug()\"",
"def checkDebug(message):\n if debug == True:\n print(message)",
"def debug(msg):\n if not DEBUG_ON:\n return\n print(\"DEBUG:\" + str(msg))",
"def print_debug(msg):\n if IS_DEB... | [
"0.8137028",
"0.80153483",
"0.77376115",
"0.7687844",
"0.76748055",
"0.767379",
"0.7656623",
"0.7569436",
"0.7528649",
"0.7510831",
"0.7510831",
"0.74950415",
"0.7483869",
"0.74653614",
"0.74565285",
"0.74526405",
"0.7379881",
"0.736538",
"0.734727",
"0.73451245",
"0.734026",... | 0.8150175 | 0 |
This function will optionally print a header guard for `cl_khr_fp64` if a 64bit type is used as the source or destination and return a bool that indicates whether this guard will need closed after the calling function has finished printing functions that use the 64bit source/destination type. | def conditional_guard(src, dst):
int64_count = 0
float64_count = 0
float16_count = 0
if src in int64_types or dst in int64_types:
int64_count = 1
if src in float64_types or dst in float64_types:
float64_count = 1
if src in float16_types or dst in float16_types:
float16_count = 1
if float16_cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_64_windows():\n return struct.calcsize('P') * 8 == 64",
"def have_binary128():\n try:\n ti = type_info(np.longdouble)\n except FloatingError:\n return False\n return (ti['nmant'], ti['maxexp']) == (112, 16384)",
"def is_H(self):\n return True",
"def is_H(self):\n ... | [
"0.4971328",
"0.46334147",
"0.46194386",
"0.46194386",
"0.4604871",
"0.4570718",
"0.45214003",
"0.45135522",
"0.44693208",
"0.44124466",
"0.44066575",
"0.44048572",
"0.43934348",
"0.43365443",
"0.42555895",
"0.4250501",
"0.42504188",
"0.42486706",
"0.42251563",
"0.4212047",
"... | 0.59550357 | 0 |
This helper function returns the correct clc core conversion function name for a given source and destination type, with optional size, mode and saturation arguments. | def clc_core_fn_name(dst, size='', mode='', sat=''):
return "__clc_convert_{DST}{N}{SAT}{MODE}".format(DST=dst, N=size, SAT=sat, MODE=mode) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def src_get_name(converter_type):\n return ffi.string(_lib.src_get_name(converter_type)).decode()",
"def cython_funcname(self, name, argkinds=None):\n if isinstance(name, basestring):\n return name\n if argkinds is None:\n argkinds = [(Arg.NONE, None)] * (len(name) - 1)\n ... | [
"0.58428967",
"0.5695806",
"0.56170404",
"0.5537308",
"0.54060704",
"0.5312154",
"0.52636075",
"0.5209674",
"0.5179819",
"0.5158412",
"0.5142017",
"0.51086265",
"0.50943804",
"0.5006753",
"0.5005477",
"0.5003055",
"0.49839967",
"0.4969238",
"0.49600613",
"0.49500346",
"0.4889... | 0.80150145 | 0 |
Apply weight normalization module from all of the layers. | def apply_weight_norm(self):
def _apply_weight_norm(m):
if isinstance(m, torch.nn.Conv1d) or isinstance(
m, torch.nn.ConvTranspose1d
):
torch.nn.utils.weight_norm(m)
logging.debug(f"Weight norm is applied to {m}.")
self.apply(_app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_weights(self):\n for layer in self.modules():\n if isinstance(layer, (nn.Conv1d, nn.Linear)):\n nn.init.xavier_uniform_(layer.weight)\n if layer.bias is not None:\n nn.init.constant_(layer.bias, 0)\n elif isinstance(layer, nn.B... | [
"0.7143955",
"0.7143955",
"0.7143955",
"0.71335757",
"0.7069364",
"0.7069364",
"0.70534694",
"0.7049442",
"0.70303166",
"0.6807604",
"0.6779128",
"0.6764302",
"0.67596924",
"0.6736109",
"0.6710482",
"0.66960436",
"0.6584008",
"0.6554928",
"0.6526808",
"0.65179425",
"0.6516647... | 0.73184675 | 1 |
Register stats for denormalization as buffer. | def register_stats(self, stats):
assert stats.endswith(".h5") or stats.endswith(".npy")
if stats.endswith(".h5"):
mean = read_hdf5(stats, "mean").reshape(-1)
scale = read_hdf5(stats, "scale").reshape(-1)
else:
mean = np.load(stats)[0].reshape(-1)
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cast_buffers(self,\n dtype: Optional[torch.dtype] = None,\n memo: Optional[Set] = None) -> None:\n if memo is None:\n memo = set()\n for module in self.modules():\n if module is not self and isinstance(module, XlaFullyShardedDataParallel):\n # Allow... | [
"0.51819456",
"0.5043784",
"0.49926385",
"0.4946909",
"0.49447924",
"0.49344134",
"0.4884747",
"0.4879836",
"0.48627967",
"0.48563662",
"0.48147842",
"0.47965068",
"0.478542",
"0.47853506",
"0.47853506",
"0.47853506",
"0.47518125",
"0.4747054",
"0.47394067",
"0.47262183",
"0.... | 0.67643166 | 0 |
Remove weight normalization module from all of the layers. | def remove_weight_norm(self):
def _remove_weight_norm(m):
try:
logging.debug(f"Weight norm is removed from {m}.")
torch.nn.utils.remove_weight_norm(m)
except ValueError: # this module didn't have weight norm
return
self.apply(_re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_norms(module_: \"WN\") -> \"WN\":\n module_.start = torch.nn.utils.remove_weight_norm(module_.start_conv)\n module_.cond_layer = torch.nn.utils.remove_weight_norm(module_.cond_layer)\n for i, layer_ in enumerate(module_.in_layers):\n layer_ = DepthwiseSeparableConv1d.remo... | [
"0.79998016",
"0.76628864",
"0.7629923",
"0.72848314",
"0.7045166",
"0.67848754",
"0.6780856",
"0.6746634",
"0.6591088",
"0.65823525",
"0.6566755",
"0.65617",
"0.65572643",
"0.65561306",
"0.6538293",
"0.6538293",
"0.6538293",
"0.6529808",
"0.6526071",
"0.651576",
"0.64801204"... | 0.7893102 | 1 |
Apply weight normalization module from all of the layers. | def apply_weight_norm(self):
def _apply_weight_norm(m):
if isinstance(m, torch.nn.Conv1d) or isinstance(
m, torch.nn.ConvTranspose1d
):
torch.nn.utils.weight_norm(m)
logging.debug(f"Weight norm is applied to {m}.")
self.apply(_app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_weights(self):\n for layer in self.modules():\n if isinstance(layer, (nn.Conv1d, nn.Linear)):\n nn.init.xavier_uniform_(layer.weight)\n if layer.bias is not None:\n nn.init.constant_(layer.bias, 0)\n elif isinstance(layer, nn.B... | [
"0.71430475",
"0.71430475",
"0.71430475",
"0.713435",
"0.70688635",
"0.70688635",
"0.7052796",
"0.7049518",
"0.70298177",
"0.68070155",
"0.6778134",
"0.676388",
"0.6760103",
"0.67364126",
"0.6710347",
"0.6696243",
"0.65825963",
"0.65547544",
"0.6525561",
"0.6517765",
"0.65163... | 0.73182416 | 0 |
Returns a humanized rstring representing time difference between now() and the input timestamp. The output rounds up to days, hours, minutes, or seconds. 4 days 5 hours returns '4 days' 0 days 4 hours 3 minutes returns '4 hours', etc... | def time_since(timestamp=None):
rstr = ""
if not timestamp or not isinstance(timestamp, datetime.datetime):
return rstr
now = timezone.now()
timediff = now - timestamp
days = timediff.days
weeks = days//7
months = days//30
minutes = timediff.seconds % 3600 // 60
seconds = ti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize_ts(timestamp=False):\n now = datetime.now()\n diff = now - datetime.fromtimestamp(timestamp)\n second_diff = diff.seconds\n day_diff = diff.days\n\n if day_diff < 0:\n return ''\n\n if day_diff == 0:\n if second_diff < 10:\n return \"just now\"\n if se... | [
"0.7199235",
"0.6999816",
"0.6862485",
"0.6823745",
"0.6743255",
"0.6654757",
"0.66247755",
"0.65492713",
"0.64874226",
"0.64806837",
"0.6469421",
"0.64674145",
"0.64304537",
"0.6402844",
"0.6387063",
"0.6360706",
"0.6358006",
"0.6357516",
"0.63572836",
"0.63446885",
"0.63081... | 0.7168039 | 1 |
return elements in the message with given parameters match is the type of elements you want to get (check the parse_type variable to see possibilities) using ! at start of match will reverse the value of positive occurences will create the nth indexes elements to capture None will find everything | def finder(self, match="w", occurences=None, start=None, stop=None, trigger=True, positive=True, reverse=False, keep_prefix=False):
res = []
length = len(self.parse_type)
if occurences != None:
occurences = str(occurences)
index_array = self.indexes(occurences, 1)
is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _any_depth_parse(match):\n markers = [match.p1, match.p2, match.p3, match.p4, match.p5, match.p6]\n for idx in (4, 5):\n if markers[idx]:\n markers[idx] = mtypes.emphasize(markers[idx])\n return [m for m in markers if m]",
"def onNameType(self, match):\n\t\treturn [self.process(mat... | [
"0.5471574",
"0.52397555",
"0.5145322",
"0.5005529",
"0.49990287",
"0.49739963",
"0.49577978",
"0.49357885",
"0.49001318",
"0.48870462",
"0.48827666",
"0.4872868",
"0.48422822",
"0.48398778",
"0.48214757",
"0.4820572",
"0.48020837",
"0.47951323",
"0.4777706",
"0.4765019",
"0.... | 0.5920306 | 0 |
return True if parameters does match the parse_type match is the amount of each parse_type elements you want to search. You can write www to check 3 words in a row ranges follow the same syntax as occurences except it targets indexes | def checker(self, match="xw", ranges="0,1", in_a_row=True, reverse=False):
res = []
length = len(self.parse_type)
if ranges != None:
ranges = str(ranges)
index_array = self.indexes(ranges)
substring = ""
for idx in range(length*reverse-reverse, length*(-reve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _match(self, *token_types):\n for token in token_types:\n if self._check(token):\n self._advance()\n return True\n\n return False",
"def _multiindex_row_in(cls, row, parse_list, start=None, stop=None):\n\n row_sub = r... | [
"0.65751725",
"0.56603086",
"0.557421",
"0.5525039",
"0.54756975",
"0.5400486",
"0.53058875",
"0.52834386",
"0.5266304",
"0.5260166",
"0.5238574",
"0.5214264",
"0.5185073",
"0.51797396",
"0.51623565",
"0.5152065",
"0.5134428",
"0.5108154",
"0.5108154",
"0.51043475",
"0.509991... | 0.62283635 | 1 |
Retrieve which events to capture from the config | def set_capture_events_from_config(self):
event_config = [
{
"config_key": "events_watchlist",
"events": [
"watchlist.hit.process",
"watchlist.hit.binary",
"watchlist.storage.hit.process",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_events(self):\n #Returne the capture events\n raise NotImplementedError",
"def get_events(self):\n #Returne the capture events\n raise NotImplementedError",
"def get_events(self):\n raise NotImplementedError",
"def get_events(self):\n raise NotImplementedErro... | [
"0.7154731",
"0.7154731",
"0.6736886",
"0.6736886",
"0.6634429",
"0.6563874",
"0.6368687",
"0.6339225",
"0.6153467",
"0.6147387",
"0.6090058",
"0.60785455",
"0.6055919",
"0.6055919",
"0.6025618",
"0.60202944",
"0.60145056",
"0.60046005",
"0.59880394",
"0.5945153",
"0.5929929"... | 0.7547521 | 0 |
Compares an image to its reference | def compare(self, reference, image):
if not os.path.isfile(reference):
raise PictureComparatorError("Reference file %s does not exist" % reference)
if not os.path.isfile(image):
raise PictureComparatorError("Image file %s does not exist" % image)
referen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compareTo(self,imagefullpath):\n exc = ExtractColor2(self.k)\n bgrcolor = exc.getColorBGR(imagefullpath)\n\n score = 0\n for i in range(self.k):\n score += np.linalg.norm(bgrcolor[i] - self._ref_BGRcolor[i])/(np.sqrt(255*255*3))\n score /= self.k\n return 1 ... | [
"0.7269888",
"0.69743997",
"0.6905206",
"0.6846669",
"0.67375135",
"0.6730658",
"0.67301905",
"0.67132235",
"0.6670823",
"0.66276044",
"0.65917426",
"0.6564198",
"0.65512747",
"0.6517447",
"0.65027654",
"0.6423081",
"0.64036614",
"0.63828444",
"0.6322787",
"0.6311486",
"0.628... | 0.7576849 | 0 |
From a matrix of difference pixels (for each pixel, we have 0 if pixel is the same, or nonzero if they are different), creates list of pixels which are different a PNG image of the same size as 'step' image, where each different pixel is coloured RED | def _build_list_of_changed_pixels(self, diff, image_width, image_height, min_width, min_height, exclude_zones):
# complete diff "image" to the size of step image
diff = numpy.pad(diff, ((0, max(0, image_height - min_height)), (0, max(0, image_width - min_width))), constant_values=1)
# ignore e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_colors(self):\n colors = self.get_sorted_pixels()\n colors_dict = dict((val[1], Image.new('RGB', self.size, (255,255,255))) \n for val in colors)\n pixel_dict = dict((img, []) for img in colors_dict.keys())\n\n pix = self.image.load()\n for... | [
"0.594339",
"0.5888286",
"0.5828619",
"0.5812646",
"0.5808996",
"0.5784285",
"0.57349354",
"0.57313955",
"0.5709643",
"0.56814396",
"0.566322",
"0.56176597",
"0.55183667",
"0.5507987",
"0.54847234",
"0.54687953",
"0.5410043",
"0.53843975",
"0.53818494",
"0.53818494",
"0.53743... | 0.7071252 | 0 |
Check if two things have the same type. | def same_type(one, two):
return isinstance(one, type(two)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_equal_same_type(self, other):\n return True",
"def is_same(type1, type2):\n nake_type1 = remove_declarated(type1)\n nake_type2 = remove_declarated(type2)\n return nake_type1 == nake_type2",
"def sametype(variable1, variable2):\n\n # Return the result\n return isinstance(variable1,... | [
"0.826196",
"0.7960103",
"0.7685877",
"0.75767535",
"0.73899287",
"0.7386229",
"0.73627245",
"0.72946095",
"0.7151994",
"0.7137583",
"0.7062871",
"0.7059909",
"0.70217156",
"0.69869566",
"0.6975931",
"0.69511235",
"0.6951103",
"0.682518",
"0.6799043",
"0.6766386",
"0.67605907... | 0.8348503 | 0 |
AirInstance constructor name The name of the instance input An object with the YAML description of the IR instance transmit_handler A function to be called to transmit pkts Add support to allow the specification of the MetaIR instance | def __init__(self, name, input, transmit_handler):
local_dir = os.path.dirname(os.path.abspath(__file__))
MetaIRInstance.__init__(self, os.path.join(local_dir, 'air_meta.yml'))
self.transmit_handler = transmit_handler
self.name = name
self.tm_started = False
self.disabl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = None,\n add_on: Optional[pulumi.Input[pulumi.InputType['InstanceAddOnArgs']]] = None,\n availability_zone: Optional[pulumi.Input[str]] = None,\n bl... | [
"0.66051346",
"0.6576527",
"0.6427389",
"0.63597023",
"0.62879163",
"0.6271562",
"0.6235065",
"0.6202321",
"0.6141576",
"0.6116739",
"0.6116739",
"0.6116739",
"0.6116739",
"0.6116739",
"0.6116739",
"0.61087185",
"0.60978323",
"0.6088997",
"0.60772216",
"0.606114",
"0.6051864"... | 0.7563762 | 0 |
Process any table initialization spec from the IR desc The IR specification may provide a set of table initialization operations in a "table_initialization" object. This takes the form of a sequence of table entry specifications. | def process_table_init(self):
logging.debug("Processing table initialization, %d entries",
len(self.table_initialization))
for init_entry in self.table_initialization:
for table_name, entry_desc in init_entry.items():
self.air_table[table_name].add_entr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_tables(self):\n tables = []\n tables.append({'groupname': 'metadata',\n 'tablename': 'sim_info',\n 'description': desc.SimInfoRow,\n 'tabletitle': 'Simulation Information'})\n tables.append({'groupname': 'metadata',\n... | [
"0.52702624",
"0.51661",
"0.51060444",
"0.5094332",
"0.50876445",
"0.50695586",
"0.50232565",
"0.49792466",
"0.49553454",
"0.49386698",
"0.49274278",
"0.49077904",
"0.4889465",
"0.48876804",
"0.48618603",
"0.48576298",
"0.48565733",
"0.48539078",
"0.4839813",
"0.48349887",
"0... | 0.7456325 | 0 |
Enable the switch instance Start the traffic manager threads and allow packets to enter the processor chain | def enable(self):
if not self.tm_started:
for name, tm in self.air_traffic_manager.items():
logging.debug("Starting tm %s" % name)
tm.start()
tm_started = True
logging.debug("Enabling switch %s" % self.name)
self.disabled = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable(self):\n self.switch.enable()\n self._enabled = True",
"def start_sending_to_switch(self):\n self.switch_active = True\n for message in self.internal_switch_buffer:\n self.switch.buffer.append(message)\n self.internal_switch_buffer = []",
"def launch ():... | [
"0.633651",
"0.63337624",
"0.627072",
"0.62615603",
"0.6093382",
"0.6046594",
"0.595381",
"0.5936305",
"0.58609205",
"0.58298725",
"0.5779756",
"0.57681865",
"0.5766365",
"0.5766356",
"0.5763502",
"0.57629",
"0.57612556",
"0.5747415",
"0.5741657",
"0.57210463",
"0.5721009",
... | 0.7502978 | 0 |
Disable the switch instance Packets on ingress are discarded while the switch is disabled. Traffic manager threads are not stopped. | def disable(self):
logging.debug("Disabling switch %s" % self.name)
self.disabled = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_turn_off(self):\n path = \"/ip/firewall/nat\"\n param = \".id\"\n value = None\n for uid in self._ctrl.data[\"nat\"]:\n if (\n self._ctrl.data[\"nat\"][uid][\"name\"]\n == f\"{self._data['protocol']}:{self._data['dst-port']}\"\n ... | [
"0.66462976",
"0.6192181",
"0.6160286",
"0.6113852",
"0.6101358",
"0.6030463",
"0.6019299",
"0.60160685",
"0.6007818",
"0.59888124",
"0.5958932",
"0.59445566",
"0.5917474",
"0.591579",
"0.5867535",
"0.5856679",
"0.5840998",
"0.583786",
"0.58215153",
"0.57709235",
"0.5764594",... | 0.70145595 | 0 |
Transmit handler template for documentation out_port The port number to which the packet is to be sent packet A bytearray object holding the packet to transmit | def dummy_transmit_handler(out_port, packet):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self, out):",
"def _post(self, which_port, msg):\n return _spacegrant_swig.binary_sink_sptr__post(self, which_port, msg)",
"def send_traffic_data(serialport, pack):\n pack[0] = 0x01\n pack[1] = 0x00\n serialport.write(pack)\n logging.debug(\"Traffic Data - Sent.\")\n logging.deb... | [
"0.5656294",
"0.5640042",
"0.5389474",
"0.53658545",
"0.52940327",
"0.52939874",
"0.5285707",
"0.51725745",
"0.51605856",
"0.5146283",
"0.51232743",
"0.5088026",
"0.5069205",
"0.50586265",
"0.50550586",
"0.50533634",
"0.50321823",
"0.5028129",
"0.49887457",
"0.4957033",
"0.49... | 0.655866 | 0 |
take a field from the csv and expand/split on a delimiter and return a list of individual values. If the return_list flag is set to true, then this method will return the data back as a list of new fields instead of a cleaned up string and normalized with semicolon delimiter | def expand_and_normalize_field(field, return_list=False):
if isinstance(field, basestring):
field = field.rstrip(';:,')
data = [_normalize_expanded_field(r) for r in re.split(",|;|:", field)]
if return_list:
return data
else:
return ";".join(data)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv_line(value_parser):\n def convert(string):\n return list(map(value_parser, string.split(',')))\n return convert",
"def parse_and_flatten(df, field_name):\n\n # Parse and flatten the list\n lst = list(df[field_name])\n lst = [x.split('|') for x in lst]\n\n lst_flat = []\n for s... | [
"0.63519025",
"0.63037026",
"0.6226924",
"0.621855",
"0.621855",
"0.605141",
"0.60084903",
"0.5960452",
"0.5954665",
"0.58187693",
"0.58148223",
"0.57171553",
"0.56535655",
"0.5637533",
"0.56276727",
"0.55754817",
"0.55633485",
"0.55611026",
"0.54911935",
"0.54818034",
"0.543... | 0.7508108 | 0 |
Take a row and a field which may have delimited values and convert into a list of new rows with the same data expect for the replaced delimited value. | def expand_rows(row, delimited_fields, expand_row):
# _log.debug('expand_row is {}'.format(expand_row))
# go through the delimited fields and clean up the rows
copy_row = copy.deepcopy(row)
for d in delimited_fields:
if d in copy_row:
copy_row[d] = expand_and_normalize_field(copy_ro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processRow(self, row):\n\t\tif self.delim is not None:\n\t\t\trowArr = row.split(self.delim)\n\t\t\tmsg = \"row does not have expected number of columns found \" + str(len(rowArr)) + \" expected \" + str(self.rowSize)\n\t\t\tassert len(rowArr) == self.rowSize, msg\n\t\telse:\n\t\t\trowArr = row\n\t\t\t\n\t\tne... | [
"0.6390672",
"0.61461806",
"0.61275697",
"0.6075597",
"0.6021947",
"0.60119367",
"0.5930786",
"0.5849591",
"0.5666509",
"0.56609106",
"0.562658",
"0.56255656",
"0.5619078",
"0.5576439",
"0.55647933",
"0.55612415",
"0.5549309",
"0.5546282",
"0.5542975",
"0.5528512",
"0.5520903... | 0.63998896 | 0 |
Apply mapping of row data to model. | def map_row(row, mapping, model_class, extra_data_fields=[], cleaner=None, **kwargs):
initial_data = kwargs.get('initial_data', None)
model = model_class()
# _log.debug("map_row's mappings {}".format(mapping))
# If there are any initial states we need to set prior to mapping.
if initial_data:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applyMapping(self):\n pass",
"def map(self, function=lambda item: item):\n for i, row in enumerate(self):\n for j, item in enumerate(row):\n row[j] = function(item)",
"def map_transfer_to_row(self, transfer):\n pass",
"def _do_mapping(self):\n pass",
... | [
"0.66845304",
"0.62534523",
"0.61838084",
"0.604524",
"0.59644157",
"0.5678246",
"0.56550837",
"0.5597702",
"0.5595955",
"0.5552257",
"0.55398905",
"0.54507",
"0.54413307",
"0.542242",
"0.54172045",
"0.54105145",
"0.5367758",
"0.5321824",
"0.5305091",
"0.5284699",
"0.52551997... | 0.77035165 | 0 |
Updates stats inside mod_stats_map with data gathered from the file. | def get_file_mod_stats_for_upstream_refs(file_name, mod_stats_map):
with open(file_name) as f:
lines = f.readlines()
upstream_ref = None
upstream_start_line = None
for line_number, line in enumerate(lines):
if REGION_START_TAG in line:
tag, ref_name = _extract_tag_and_ref_name_from_line(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_stat_file(self):\n logfile = \"../data/{}_stat.json\".format(self.ID)\n statobj = {\n 'hp': self.hp,\n 'max_hp': MAX_TANK_HP,\n 'ammo': self.ammo,\n 'score': self.score,\n 'age': self.age,\n 'alive': not self.is_dead(),\n ... | [
"0.63213795",
"0.61827755",
"0.57400024",
"0.5537577",
"0.5465735",
"0.5393763",
"0.5373763",
"0.5370881",
"0.53650606",
"0.5338288",
"0.5331641",
"0.52704084",
"0.52475107",
"0.5246663",
"0.51833093",
"0.5156864",
"0.51413554",
"0.51362735",
"0.5133316",
"0.51267594",
"0.512... | 0.63252497 | 0 |
Find the tracking file for the given file. Returns the last path mentioned in the file via a tracking tag or the equivalent thirdparty path given the file's path. If there is no file in the default path and no files mentioned within the file exist, returns None. Normally the thirdparty path must exist. Passing |check_e... | def compute_tracking_path(stats, our_path, our_lines, do_lint_check=False,
check_exist=True, check_uses_tags=False):
tracking_path = staging.get_default_tracking_path(our_path)
base_matcher = re.compile(re.escape(FILE_TRACK_TAG) + r' "([^\"]+)"')
tag_matcher = re.compile(re.escape(REGION... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _findfile(self, path):\n\n # Build list of possible local file paths\n if not self._isurl(path):\n # Valid local paths\n filelist = self._possible_names(path)\n # Paths in self._destpath\n filelist += self._possible_names(self.abspath(path))\n el... | [
"0.54929686",
"0.5405405",
"0.5390188",
"0.538945",
"0.52806234",
"0.52451473",
"0.524215",
"0.5137974",
"0.5047577",
"0.502459",
"0.50199705",
"0.49906838",
"0.4970432",
"0.49497023",
"0.4910103",
"0.4907254",
"0.48910886",
"0.48726743",
"0.48697725",
"0.4835479",
"0.4827484... | 0.718714 | 0 |
Compute the notices object as if the two paths were properly staged. analyze_diffs needs to be independent of staging. Staging might not have been run, or might be out of date from when analyze_diffs is run. So we make a best attempt to reconstruct the notices that would have occurred poststaging. | def _compute_staged_notices(mods_path, third_party_path):
mods_notices = notices.Notices()
if mods_path:
mods_notices.add_sources([mods_path])
third_party_notices = notices.Notices()
if third_party_path:
third_party_notices.add_sources([third_party_path])
# If there are mods and third_party notices, p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_diffs(history):\n\n # First get all possible representations\n mgr = plugins_get_mgr() \n keys = mgr.search('representation')['representation']\n representations = [mgr.get_by_key('representation', k) for k in keys]\n\n for i in range(len(history)):\n if i+1 > len(history) - 1:\n ... | [
"0.5009308",
"0.50050104",
"0.47927547",
"0.47090858",
"0.4646092",
"0.46367276",
"0.4600246",
"0.45939845",
"0.4547362",
"0.45332745",
"0.45131713",
"0.45066488",
"0.44925582",
"0.44843617",
"0.44840214",
"0.4477567",
"0.4472213",
"0.44629148",
"0.4452782",
"0.4435036",
"0.4... | 0.5701247 | 0 |
Update dictionary from a collection of documents. Each document is a list of tokens. | def add_document_lists(self, docs):
for sent in docs:
sent = map(self.process_token, sent)
self._token_count.update(sent) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_documents(self, docs):\n for sent in docs:\n sent = map(self.process_token, sent)\n self._token_count.update(sent)",
"def add_documents(self, docs):\n if 'sentences' in docs:\n for sent in docs.sentences:\n sent = map(self.process_token, [t fo... | [
"0.68998206",
"0.67045903",
"0.63965476",
"0.6270014",
"0.6202376",
"0.61885744",
"0.6151995",
"0.60434496",
"0.60377157",
"0.59981596",
"0.59295934",
"0.58968425",
"0.5878697",
"0.5846581",
"0.5829846",
"0.57702076",
"0.57415456",
"0.5731184",
"0.571159",
"0.56422395",
"0.56... | 0.6872754 | 1 |
Get the list of token_id given doc. | def doc2id(self, doc):
if isinstance(doc, string_types):
raise TypeError("doc2idx expects an array of unicode tokens on input, not a single string")
doc = map(self.process_token, doc)
return [self.token_to_id(token) for token in doc] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doc2id(self, doc):\n doc = map(self.process_token, doc)\n return [self.token_to_id(token) for token in doc]",
"def get_tokens(self, document):\n raise NotImplementedError()",
"def doc2token(self, doc):\n return [self.word2idx[word] if self.word2idx.__contains__(word)\n ... | [
"0.71084183",
"0.6638949",
"0.64065033",
"0.6308615",
"0.6308615",
"0.6248695",
"0.6248695",
"0.616698",
"0.61223453",
"0.60448986",
"0.6016193",
"0.6015829",
"0.6009144",
"0.59384847",
"0.5869318",
"0.5861415",
"0.5859866",
"0.5852833",
"0.58410364",
"0.5834465",
"0.5816366"... | 0.6642477 | 1 |
Get the token_id of given token. | def token_to_id(self, token):
token = self.process_token(token)
return self.token2id.get(token, len(self.token2id) - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_to_id(self, token):\n token = self.process_token(token)\n return self._token2id.get(token, len(self._token2id) - 1)",
"def token_to_id(self, token):\r\n return self.encoder.get(token, self.encoder.get(self.unk_token))",
"def token_id(self) -> Optional[pulumi.Input[int]]:\n ... | [
"0.8310672",
"0.7980398",
"0.79235566",
"0.7840283",
"0.7578476",
"0.730748",
"0.71591955",
"0.7151534",
"0.7099397",
"0.6803577",
"0.66393685",
"0.65554255",
"0.6520694",
"0.64726806",
"0.64626735",
"0.6437027",
"0.6431865",
"0.6408412",
"0.63829017",
"0.6313626",
"0.6299330... | 0.8298625 | 1 |
tokenid to token (string). | def id_to_token(self, idx):
return self._id2token[idx] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_id_to_token(self, id: int):\n return self._id_to_token[id]",
"def token_to_id(self, token):\r\n return self.encoder.get(token, self.encoder.get(self.unk_token))",
"def token_to_id(self, token):\n token = self.process_token(token)\n return self.token2id.get(token, len(self.to... | [
"0.7235237",
"0.69436103",
"0.6893987",
"0.6749872",
"0.67123127",
"0.6693682",
"0.6675571",
"0.6672998",
"0.6606152",
"0.66021",
"0.65837336",
"0.6532288",
"0.6484542",
"0.64636326",
"0.6327243",
"0.62979484",
"0.6255819",
"0.6240919",
"0.6239636",
"0.6181812",
"0.6127101",
... | 0.7267592 | 1 |
Delete the current trigger. | def delete(self):
request = self.triggers_service.delete(path=self._path)
request.execute() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delTrigger(self, message: IRCMessage) -> IRCResponse:\n triggerName = message.parameterList[1]\n if triggerName in self.storage:\n del self.storage[triggerName]\n return IRCResponse(f\"Trigger {triggerName} deleted!\", message.replyTo)\n else:\n return IRC... | [
"0.7167729",
"0.70552254",
"0.6779274",
"0.6583904",
"0.655758",
"0.64790803",
"0.6461914",
"0.6461914",
"0.6461914",
"0.6461914",
"0.645271",
"0.64262265",
"0.62824124",
"0.6266517",
"0.62515134",
"0.62503153",
"0.62478745",
"0.62462974",
"0.6191452",
"0.61563873",
"0.615638... | 0.8082834 | 0 |
Create and return a D > D0 pi Selection object. | def makeDstar2D0Pi( name
, config
, DecayDescriptor
, inputSel
) :
daugCuts = "(TRCHI2DOF < %(Daug_TRCHI2DOF_MAX)s)" % locals()['config']
combCuts = "((AM - AM1) < %(Dstar_AMDiff_MAX)s* MeV)" % locals()['config']
dstarCuts = "(VF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_selection ( self ,\n tag , \n algotype ,\n inputs , \n *args ,\n **kwargs ) :\n sel_tag = '%s_Selection' % tag\n sel_name = 'Sel%sFor%s' % ( tag , se... | [
"0.60390633",
"0.5895539",
"0.55829453",
"0.5348063",
"0.5305103",
"0.5261155",
"0.5167734",
"0.51543236",
"0.5077886",
"0.5058524",
"0.50535107",
"0.50340015",
"0.5013713",
"0.49337313",
"0.49296355",
"0.48771095",
"0.48653218",
"0.48559302",
"0.48356175",
"0.48229763",
"0.4... | 0.6516377 | 0 |
Load all quest handlers here | def load_quests(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_handlers(self):\n\t\tself.handlers = []\n\t\tfor mod in os.listdir('classes/handlers'):\n\t\t\tif mod == '__init__.py' or mod[-3:] != '.py':\n\t\t\t\tcontinue\n\t\t\tlib = __import__(mod[:-3], locals(), globals())\n\t\t\tself.handlers.append(lib)\n\t\t#\n\t\tself.handlers.sort(key=lambda x: x.order, rever... | [
"0.6526081",
"0.6394275",
"0.60561556",
"0.59975696",
"0.596935",
"0.5927591",
"0.59075165",
"0.5878692",
"0.569096",
"0.5556501",
"0.5527142",
"0.5512644",
"0.55046976",
"0.54805523",
"0.54044414",
"0.5394727",
"0.5393246",
"0.5391057",
"0.5354453",
"0.5347178",
"0.53144395"... | 0.71654475 | 0 |
Add a quest handler to the aiohttp app | def add_quest(self, method: str, route: str, handler):
self.aiohttp.router.add_route(method, route, handler) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _response_handler(self):",
"async def startup_handler(app):\n\n spotify_client_id = os.environ.get(SPOTIFY_CLIENT_ID)\n spotify_client_secret = os.environ.get(SPOTIFY_CLIENT_SECRET)\n\n # Save dependencies in the HTTP app.\n http.register_dependency(app, SPOTIFY_CLIENT_ID, s... | [
"0.5878627",
"0.5799518",
"0.57429504",
"0.57207054",
"0.5717911",
"0.5691735",
"0.5681638",
"0.5614569",
"0.55652535",
"0.5559621",
"0.5534234",
"0.5512763",
"0.5455151",
"0.5423512",
"0.5397953",
"0.5394697",
"0.5374808",
"0.5370889",
"0.53686166",
"0.53405356",
"0.5336915"... | 0.6682835 | 0 |
Representation of the linked list | def __repr__(self):
return "LinkedList([{}],{}/{})".format(self.cur_node, self.cur_pos, self.length) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n\n return \"LinkedList created\"",
"def __repr__(self):\r\n return \"ListNode({})\".format(self.data)",
"def __repr__(self):\n return 'LinkedList({!r})'.format(self.items())",
"def __repr__(self):\n return \"{}\".format(self._head)",
"def __init__(se... | [
"0.77007776",
"0.76717454",
"0.7663137",
"0.7242428",
"0.72094405",
"0.7121683",
"0.7095792",
"0.6991777",
"0.6974106",
"0.69680715",
"0.69224",
"0.68925244",
"0.6854505",
"0.6827989",
"0.6827989",
"0.6827989",
"0.6827989",
"0.6827989",
"0.6827928",
"0.67615014",
"0.6742917",... | 0.76858366 | 1 |
Print the linked list | def list_print(self):
node = self.cur_node # cant point to ll!
while node:
print(node.data)
node = node.next | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_list(self) -> None:\n cur_node = self.head\n while cur_node:\n print(cur_node.data)\n cur_node = cur_node.next",
"def print_list(self):\n\n current = self.head\n\n while current is not None:\n print current.data\n current = current... | [
"0.8673001",
"0.86067754",
"0.85906494",
"0.8569578",
"0.85571915",
"0.8512224",
"0.84492445",
"0.8400473",
"0.82561886",
"0.8178204",
"0.8120253",
"0.8110577",
"0.809658",
"0.7893961",
"0.7872987",
"0.7842627",
"0.78114355",
"0.77788997",
"0.77637863",
"0.7760473",
"0.774224... | 0.88183177 | 0 |
Get the data of the next node | def get_next(self):
return self.cur_node.next.data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next(node):\n return node['next']",
"def data(self):\n return self.first_node.data",
"def get_data(node):\n return node['data']",
"def node_data(self):\n return self.node_data_",
"def _next(self):\n node = self.head\n while node != None:\n yield node.dat... | [
"0.7340955",
"0.72560537",
"0.71013474",
"0.70286286",
"0.70277715",
"0.6898941",
"0.67155683",
"0.67155683",
"0.67155683",
"0.6683656",
"0.6547143",
"0.65334487",
"0.65334487",
"0.64254665",
"0.6382568",
"0.63816816",
"0.63672584",
"0.63516414",
"0.630895",
"0.6291807",
"0.6... | 0.8156502 | 0 |
Representation of the spinlock | def __repr__(self):
return "Spinlock({})".format(self.stepforward) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock_control(self):\n raise NotImplementedError('PlatformService: Implementation incomplete')",
"def spinlocks(self):\n return self._spinlocks",
"def lock(self):\n raise NotImplementedError",
"def lock(self):\r\n return self._lock",
"def f_lock(self):\n self._locked = Tru... | [
"0.6281956",
"0.61268324",
"0.60570246",
"0.60079235",
"0.5999252",
"0.5991468",
"0.5932551",
"0.5889748",
"0.57721347",
"0.5762535",
"0.5744118",
"0.57419753",
"0.5740945",
"0.5726452",
"0.57194465",
"0.56717205",
"0.56714046",
"0.56600225",
"0.5617723",
"0.5606084",
"0.5601... | 0.71650106 | 0 |
Given the tile location (x,y) and zoom level z, fetch the corresponding tile from the server and save it to the location specfied in fpath. Note, this saves just one tile; usually, want to use `positive_dataset` instead. | def save_tile(x,y,z,fpath):
UA = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/77.0"
tile_url = f"https://{random.choice('abc')}.tile.openstreetmap.org/{z}/{x}/{y}.png"
# cmd = f"wget --user-agent='please download' -O {fpath} {url}"
if os.path.exists(fpath):
print(f"A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_tile(map_layer, zoom, x, y):\n try:\n tile_url = map_layer.get_tile_url(zoom, x, y)\n tmp_file, headers = urllib.request.urlretrieve(tile_url)\n return (x, y), tmp_file\n except URLError as e:\n app.logger.info(\"Error downloading tile x={}, y={}, z={} for layer {}: {... | [
"0.7046244",
"0.6987471",
"0.6816313",
"0.6353406",
"0.6337127",
"0.63041425",
"0.6291108",
"0.6263484",
"0.6197",
"0.6188584",
"0.6176481",
"0.6158082",
"0.60673577",
"0.60509396",
"0.60040617",
"0.58420604",
"0.5838847",
"0.58381325",
"0.5794229",
"0.5779506",
"0.57553935",... | 0.7838271 | 0 |
Save the tiles whose coordinates are in the input DataFrame, defined by columns x, y, and z | def save_tiles(df,output_dir,namefunc = None):
if not isinstance(df,pd.core.frame.DataFrame):
raise TypeError("df must be a pandas DataFrame!")
if any(e not in df.columns for e in ('z','x','y')):
raise ValueError("df must have columns x, y, and z")
if namefunc is None:
def namefunc(x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_coords(self, coords, output_dir):\n new_rows = []\n for i, (lat, lon) in enumerate(coords):\n row = {\n 'tile_id': i,\n 'lat':lat,\n 'long':lon,\n 'side_length': self.side_len \n }\n\n new_rows.appen... | [
"0.6151705",
"0.60504067",
"0.5954003",
"0.576589",
"0.5702577",
"0.5660171",
"0.56481516",
"0.5625405",
"0.55865616",
"0.5577034",
"0.5532618",
"0.55072516",
"0.5442371",
"0.542948",
"0.5415182",
"0.5410632",
"0.54070646",
"0.53605324",
"0.5332602",
"0.5332529",
"0.5324701",... | 0.7190305 | 0 |
add latitude/longitude values to a dataframe | def add_latlon(df):
LLs = [num2deg(x,y,z) for x,y,z in zip(df['x'],df['y'],df['z'])]
LLdf = pd.DataFrame.from_records(LLs,columns = ['latitude','longitude'])
return pd.concat([df.reset_index(drop=True),LLdf],axis = 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_demo_location_history() -> geopandas.GeoDataFrame:\n np.random.seed(123)\n\n time = pd.date_range(start=datetime.fromtimestamp(1624241116), end=datetime.now(), freq=\"1min\").values\n\n center_point = (-36.875990410695394, 174.76398830024274)\n lat = np.random.normal(loc=center_point[0], sca... | [
"0.63746387",
"0.63202995",
"0.60851926",
"0.6078423",
"0.6073065",
"0.60551715",
"0.60244256",
"0.59730685",
"0.59513515",
"0.5890462",
"0.5884484",
"0.58564293",
"0.58458704",
"0.58379817",
"0.58235085",
"0.5796834",
"0.5791018",
"0.5752113",
"0.5700064",
"0.5698395",
"0.56... | 0.79349303 | 0 |
Infinite sequence of integers. | def integers():
i = 1
while True:
yield i
i = i + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_sequence_infinite(seq):\n while True:\n for item in seq:\n yield item",
"def infinite_increment():\n i = 0\n while 1:\n yield i\n i += 1",
"def int_to_seq(i):\n\ts = []\n\tprime = xprimes()\n\twhile i != 1:\n\t\ts.append(0)\n\t\tp = next(prime)\n\t\twhile i % p == 0:\n\t\t... | [
"0.7470997",
"0.7343358",
"0.6424951",
"0.6344632",
"0.63421345",
"0.62673986",
"0.60785764",
"0.60572314",
"0.60339946",
"0.6026884",
"0.5996939",
"0.59359825",
"0.5839094",
"0.58256906",
"0.58099836",
"0.5782609",
"0.57588905",
"0.5748371",
"0.5706836",
"0.5637029",
"0.5626... | 0.7472032 | 1 |
Returns first n values from the given sequence. | def take(n, seq):
seq = iter(seq)
result = []
try:
for i in range(n):
result.append(next(seq))
except StopIteration:
pass
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take(n, seq):\n return itertools.islice(seq, n)",
"def nth(n, seq):\n try:\n return seq[n]\n except TypeError:\n return next(itertools.islice(seq, n, None))",
"def take(iterable, n):\n return list(itertools.islice(iterable, n))",
"def lookahead(n, iterable):\n for value in is... | [
"0.7429517",
"0.6876003",
"0.6727532",
"0.67118037",
"0.66985476",
"0.66985476",
"0.66961426",
"0.6665714",
"0.6665714",
"0.66652995",
"0.6647308",
"0.64990807",
"0.6490624",
"0.6476307",
"0.6448948",
"0.6416278",
"0.6414325",
"0.64115244",
"0.6388718",
"0.63765794",
"0.63302... | 0.7366886 | 1 |
Report Method to Get Work Order Details. | def get_work_order_detail(self, date_range):
work_order_obj = self.env["task.line"]
start = datetime.strptime(date_range.get("date_from"), "%Y-%m-%d")
end = datetime.strptime(date_range.get("date_to"), "%Y-%m-%d")
step = timedelta(days=1)
workorder_detail = []
while start... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_report():",
"def work_order_receipt_retrieve(self, work_order_id, id=None):\n pass",
"def get_order_detail(orderid): \n data = order_obj.get_order_detail(orderid)\n return data",
"def open_workorders(self, cr, uid, ids, context=None):\n context = context or {}\n models_da... | [
"0.68440074",
"0.6475144",
"0.6159926",
"0.6083596",
"0.608028",
"0.59921384",
"0.5808397",
"0.58080214",
"0.5693121",
"0.5688188",
"0.56651086",
"0.5659879",
"0.5623415",
"0.56180996",
"0.5615256",
"0.5562105",
"0.55497396",
"0.55432594",
"0.55332184",
"0.5496018",
"0.546495... | 0.70237696 | 0 |
Generate xlsx format print report. | def generate_xlsx_report(self, workbook, data, parts_data):
worksheet = workbook.add_worksheet("daily_parts_issuance_wizard")
worksheet.set_column(0, 0, 10)
worksheet.set_column(1, 1, 15)
worksheet.set_column(2, 2, 20)
worksheet.set_column(3, 3, 15)
worksheet.set_column(4... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_xlsx(self):\n if self.date_from and self.date_to:\n if self.date_from > self.date_to:\n raise ValidationError(\"Date From must be less than Date To\")\n\n # active_record = self._context['id']\n # record = self.env['room.accommodation'].browse(active_record)... | [
"0.7330527",
"0.6696778",
"0.64272696",
"0.6423999",
"0.640377",
"0.63337004",
"0.625461",
"0.621144",
"0.61932975",
"0.61916244",
"0.6103704",
"0.59963775",
"0.5941088",
"0.5938474",
"0.5917404",
"0.58896947",
"0.58573407",
"0.5852752",
"0.5852723",
"0.58489084",
"0.5818077"... | 0.69838953 | 1 |
Here we define the configuration settings needed for all ingestion plugins with reasonable defaults. | def vdk_configure(self, config_builder: ConfigurationBuilder) -> None:
# Plugin-related configurations
config_builder.add(
key="INGEST_METHOD_DEFAULT",
default_value=None,
description="Default Ingestion method to be used.",
)
config_builder.add(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configuration():",
"def init_config(self):\n pass",
"def configure(self):",
"def configure(self):",
"def configure(self):",
"def configure(self):",
"def configure(self):\n\n pass",
"def get_default_config(self):\n config = super(SignalfxHandler, self).get_default_config()\n\n... | [
"0.6318215",
"0.6309264",
"0.62523276",
"0.62523276",
"0.62523276",
"0.62523276",
"0.62494737",
"0.62309724",
"0.6225098",
"0.6225098",
"0.6183282",
"0.6180916",
"0.6179421",
"0.6114876",
"0.6098103",
"0.60826004",
"0.60826004",
"0.6071773",
"0.6046305",
"0.60166687",
"0.6011... | 0.6801265 | 0 |
Get a single TW task as an Albert Item. | def get_tw_item(task: taskw.task.Task) -> v0.Item: # type: ignore
field = get_as_subtext_field
task_id = tw_side.get_task_id(task)
actions = [
FuncAction(
"Complete task",
lambda args_list=["done", task_id]: run_tw_action(args_list),
),
FuncAction(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTask():\n\tcontent = requests.get(MANAGER_URL+\"task\", params={\"apiKey\": API_KEY}).text\n\tif content == \"null\":\n\t\treturn None\n\telse:\n\t\treturn json.loads(content)",
"def get_task(task_id):\n return db.task.find_one({'_id': ObjectId(task_id)})",
"def get_item(self):\n return self.i... | [
"0.6219642",
"0.6196074",
"0.6165974",
"0.6165974",
"0.61451584",
"0.61449784",
"0.61061776",
"0.6070151",
"0.6032105",
"0.6015247",
"0.6007213",
"0.59836924",
"0.59652644",
"0.59573513",
"0.59348106",
"0.5902991",
"0.5900254",
"0.58807874",
"0.58392173",
"0.58383256",
"0.583... | 0.676394 | 0 |
Determine whether current query is of a subcommand. If so first returned the corresponding SubcommandQeury object. | def get_subcommand_query(query_str: str) -> Optional[SubcommandQuery]:
if not query_str:
return None
# spilt:
# "subcommand_name rest of query" -> ["subcommand_name", "rest of query""]
query_parts = query_str.strip().split(None, maxsplit=1)
if len(query_parts) < 2:
query_str = ""
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_sub_commands(self) -> bool:\n if self.__dict__.get(\"sub_commands\"):\n return True\n\n return False",
"def _subcommand_for_name(self, name):\n for subcommand in self.subcommands:\n if name == subcommand.name or \\\n name in subcommand.... | [
"0.65202355",
"0.6357731",
"0.63516015",
"0.6259924",
"0.60126",
"0.59781826",
"0.5967946",
"0.5843146",
"0.5827129",
"0.5752442",
"0.5749248",
"0.57485867",
"0.5696898",
"0.5505429",
"0.5458622",
"0.53960603",
"0.5385143",
"0.53838754",
"0.5379334",
"0.53359336",
"0.5302235"... | 0.6729017 | 0 |
Opens and reads the parameters in the [SUBCATCHMENT] and [SUBAREA] headers within the SWMM input file. Adds these parameters (as strings) to a numpy array | def read_initial_parameters(inputfilename):
subc_params = []
subarea_params = []
global subc_names
subc_names = []
subcatchment_parameters = []
inputfile = open(inputfilename, 'r')
for line in inputfile:
if(line.find("[SUBCATCHMENTS]") != -1):
line = inputfile.re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subcatch(ini_file='subcatch.ini'):\n config.read(ini_file)\n print 'Read the file ', ini_file\n\n file_in = config.get('file_in', 'file_in')\n\n file_out = config.get('file_out', 'file_out')\n\n picture_out = config.get('picture_out', 'picture_out')\n\n Xoutlet = config.getfloat('coord_outlet... | [
"0.58298117",
"0.5741129",
"0.5640352",
"0.54980344",
"0.5496068",
"0.5432148",
"0.5394989",
"0.53380096",
"0.53087157",
"0.5273573",
"0.52647877",
"0.5246655",
"0.5224779",
"0.5212376",
"0.52076614",
"0.5198927",
"0.5182285",
"0.5177914",
"0.5172997",
"0.5172781",
"0.516248"... | 0.7251039 | 0 |
Sets parameters for rigs rig_ids_str coma separated string with rig ids "1,2,3,4" miner Miner to set. Leave it null if you do not want to change. "claymore", "claymorez", "ewbf", ... miner2 Second miner to set. Leave it null if you do not want to change. "0" if you want to unset it. id_wal ID of wallet. Leave it null i... | def multiRocket(self, rig_ids_str, miner, miner2, id_wal, id_oc):
if rig_ids_str is not None:
self.log("Rigs ids required")
exit()
params = {
'method': 'multiRocket',
'rig_ids_str': rig_ids_str,
'miner': miner,
'miner2': miner2,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_sids(self, sids):\n self._sids = sids\n # encode sids in RGB\n r = sids // 256**2\n rem = sids % 256**2 # remainder\n g = rem // 256\n b = rem % 256\n self.rgbsids = np.zeros((self.npoints, 3), dtype=np.uint8)\n self.rgbsids[:, 0] = r\n self.rg... | [
"0.50190747",
"0.50190747",
"0.4670787",
"0.45393595",
"0.45045197",
"0.44899312",
"0.44867754",
"0.4224754",
"0.42206508",
"0.4202021",
"0.4202021",
"0.41952497",
"0.41925597",
"0.41226864",
"0.41184327",
"0.40634874",
"0.40553337",
"0.40470064",
"0.40200716",
"0.40155357",
... | 0.6751865 | 0 |
Dump utils image template.py as a Dict. The key is like "simnet/lndbtc" | def _dump_template(self, utils_image) -> Dict[str, str]:
cmd = f"docker run -i --rm --entrypoint python {utils_image}"
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
out, _ = p.communicate(input=SCRIPT.encode())
output = out.decode()
if p.returncode != 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _driver_template_data(self):\n return {\n 'driver_module': self.driver_modulename(),\n 'file': self.driver_relative_path(),\n 'author': self.metadata.author,\n 'driver_name': self.metadata.driver_name,\n 'driver_path': self.metadata.driver_path,\n ... | [
"0.5737873",
"0.55475605",
"0.5534782",
"0.5529993",
"0.55225337",
"0.55086523",
"0.5487717",
"0.54603654",
"0.545359",
"0.54374003",
"0.53441983",
"0.53371257",
"0.5325836",
"0.5310178",
"0.530841",
"0.5289318",
"0.5286247",
"0.52432984",
"0.5220684",
"0.5216042",
"0.5184362... | 0.7714567 | 0 |
Send detection data and return status | def send_detection_data(self, image_width, image_height,
image, detection_result):
if self._send_buffer.full() is True:
log_error("Send detection data failed for buffer is full")
return False
image_data = None
if isinstance(image, AclImage):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_image(self, image_width, image_height, image):\n detection_result = []\n return self.send_detection_data(image_width, image_height, image, detection_result)",
"def test_http_classifier(self):\n \n msg = \"\"\n \n files = 0\n tp = 0\n fp = 0\n ... | [
"0.6287213",
"0.6152359",
"0.60468817",
"0.57658076",
"0.5763883",
"0.56264436",
"0.5618451",
"0.56042737",
"0.5574418",
"0.5567113",
"0.5565702",
"0.55625457",
"0.55605626",
"0.553324",
"0.5526417",
"0.5485286",
"0.5476039",
"0.54632705",
"0.5459137",
"0.54455686",
"0.543737... | 0.6724717 | 0 |
send detection image data | def send_image(self, image_width, image_height, image):
detection_result = []
return self.send_detection_data(image_width, image_height, image, detection_result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_detection_data(self, image_width, image_height,\n image, detection_result):\n if self._send_buffer.full() is True:\n log_error(\"Send detection data failed for buffer is full\")\n return False\n\n image_data = None\n if isinstance(image... | [
"0.7168172",
"0.6857813",
"0.6741724",
"0.65148985",
"0.64819443",
"0.64530796",
"0.64069283",
"0.6382538",
"0.6379917",
"0.633284",
"0.6293329",
"0.6292463",
"0.6283481",
"0.6194607",
"0.6180911",
"0.617084",
"0.61642075",
"0.61596763",
"0.615218",
"0.61351126",
"0.6130977",... | 0.7531366 | 0 |
get channel presenter_server_ip, port, channel_name, content_type | def get_channel_config(config_file):
config = configparser.ConfigParser()
config.read(config_file)
presenter_server_ip = config['baseconf']['presenter_server_ip']
port = int(config['baseconf']['presenter_server_port'])
channel_name = config['baseconf']['channel_name']
content_type = int(config['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getChannel(self):\r\n return self.channel",
"def get_channel(channel_id):\r\n if channel_id[0] == 'C':\r\n type = \"channel\"\r\n elif channel_id[0] == 'G':\r\n type = \"group\"\r\n elif channel_id[0] == 'D':\r\n return False\r\n else:\r\n return False\r\n da... | [
"0.65134233",
"0.643602",
"0.6210229",
"0.619519",
"0.6009834",
"0.5932588",
"0.58862126",
"0.58620787",
"0.5847913",
"0.5847913",
"0.584146",
"0.58371985",
"0.58296996",
"0.5799957",
"0.57254803",
"0.57109845",
"0.57049286",
"0.5669257",
"0.5649315",
"0.5622001",
"0.5602927"... | 0.74030155 | 0 |
Sets the caller of this Dial. | def caller(self, caller):
self._caller = caller | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_scripts_caller(self, caller):\n self._scripts_caller = caller",
"def sender(self, sender):\n\n self._sender = sender",
"def sender(self, sender):\n\n self._sender = sender",
"def sender(self, sender):\n\n self._sender = sender",
"def sender(self, sender):\n\n self... | [
"0.5862553",
"0.55642617",
"0.55642617",
"0.55642617",
"0.55642617",
"0.55642617",
"0.55458647",
"0.52504754",
"0.52443874",
"0.5207483",
"0.5065583",
"0.5034338",
"0.50276506",
"0.50047404",
"0.5002639",
"0.49828595",
"0.49691632",
"0.49691632",
"0.49691632",
"0.49691632",
"... | 0.74337715 | 0 |
Sets the dialstatus of this Dial. | def dialstatus(self, dialstatus):
if dialstatus is None:
raise ValueError("Invalid value for `dialstatus`, must not be `None`") # noqa: E501
self._dialstatus = dialstatus | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def setstatus(self, status):\n with self.lock:\n self.status = status",
"def SetStatus(self, status)... | [
"0.6324947",
"0.6324947",
"0.6324947",
"0.62151617",
"0.6139082",
"0.6040312",
"0.6012847",
"0.60080004",
"0.5966004",
"0.59111637",
"0.5868122",
"0.5861913",
"0.58358765",
"0.58328503",
"0.58328503",
"0.58328503",
"0.58328503",
"0.58328503",
"0.58328503",
"0.58328503",
"0.58... | 0.8169267 | 0 |
Sets the dialstring of this Dial. | def dialstring(self, dialstring):
self._dialstring = dialstring | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_value(self, string_value):\n\n self._string_value = string_value",
"def setString(self, name: unicode, value: unicode) -> None:\n ...",
"def setstring(self):\n self._str = 's '+' '.join([self.src, self.start, self.size,\n self.strand, self.srcSi... | [
"0.5384727",
"0.5367918",
"0.52513164",
"0.5229012",
"0.5229012",
"0.51429296",
"0.4930052",
"0.49152938",
"0.48876902",
"0.48603123",
"0.48325157",
"0.47601306",
"0.47166997",
"0.46935034",
"0.46845663",
"0.46628696",
"0.46405885",
"0.4633442",
"0.4625754",
"0.46073928",
"0.... | 0.8753864 | 0 |
Sets the forward of this Dial. | def forward(self, forward):
self._forward = forward | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward( self ):\n self._has_change = True\n print( \"Forward\" )",
"def fastforward(self):\n self.run_command('fastforward')",
"def forward(self):\n self.cursor.forward()",
"def forward(self):\n pass",
"def forward(self):\n pass",
"def go_forward(self):\n ... | [
"0.6834646",
"0.67426616",
"0.6636892",
"0.64269316",
"0.64269316",
"0.6326287",
"0.62784827",
"0.62357396",
"0.62272525",
"0.62225056",
"0.6159911",
"0.6145522",
"0.6091365",
"0.6059019",
"0.6059019",
"0.6059019",
"0.60449684",
"0.60174173",
"0.5994386",
"0.5994386",
"0.5978... | 0.7644515 | 0 |
Sets the forwarded of this Dial. | def forwarded(self, forwarded):
self._forwarded = forwarded | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, forward):\n\n self._forward = forward",
"def forwarder(self, forwarder: ICNForwarder):\n self._forwarder = forwarder",
"def forward(self):\n pass",
"def forward(self):\n pass",
"def forward( self ):\n self._has_change = True\n print( \"Forward\" )... | [
"0.6887666",
"0.6606515",
"0.6383124",
"0.6383124",
"0.62122256",
"0.60811234",
"0.594021",
"0.5932288",
"0.5932288",
"0.5932288",
"0.581016",
"0.5741199",
"0.57171863",
"0.56688905",
"0.5637646",
"0.5620836",
"0.5603269",
"0.5560376",
"0.5535223",
"0.5532661",
"0.5506793",
... | 0.81721765 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.