query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Integration test for the DiscussionTopicsAPI.delete_entry_groups method. | def test_delete_entry_groups(self):
group_id = None # Change me!!
topic_id = None # Change me!!
id = None # Change me!!
r = self.client.delete_entry_groups(id, group_id, topic_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_groups(self):\n pass",
"def test_delete_topic_groups(self):\r\n group_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n\r\n r = self.client.delete_topic_groups(group_id, topic_id)",
"def test_delete_group(self):\n pass",
"def test_delete_group(... | [
"0.76578254",
"0.7600189",
"0.7435211",
"0.7435211",
"0.72932094",
"0.7265121",
"0.70612144",
"0.70415974",
"0.70415974",
"0.70378006",
"0.70118916",
"0.70099443",
"0.7007985",
"0.6989688",
"0.6985162",
"0.6925002",
"0.6863324",
"0.68205917",
"0.6814401",
"0.6701882",
"0.6681... | 0.8978564 | 0 |
Integration test for the DiscussionTopicsAPI.get_single_topic_courses method. | def test_get_single_topic_courses(self):
course_id = None # Change me!!
topic_id = None # Change me!!
r = self.client.get_single_topic_courses(topic_id, course_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_full_topic_courses(self):\r\n course_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n\r\n r = self.client.get_full_topic_courses(topic_id, course_id)",
"def test_list_discussion_topics_courses(self):\r\n course_id = None # Change me!!\r\n\r\n r = se... | [
"0.81595004",
"0.7692519",
"0.7598984",
"0.73130697",
"0.7138145",
"0.70979893",
"0.70466477",
"0.69214684",
"0.67485386",
"0.6709567",
"0.67050236",
"0.6659273",
"0.65691006",
"0.654654",
"0.64776987",
"0.64760184",
"0.64063543",
"0.63685286",
"0.63633716",
"0.63421565",
"0.... | 0.9059608 | 0 |
Integration test for the DiscussionTopicsAPI.get_full_topic_courses method. | def test_get_full_topic_courses(self):
course_id = None # Change me!!
topic_id = None # Change me!!
r = self.client.get_full_topic_courses(topic_id, course_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_single_topic_courses(self):\r\n course_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n\r\n r = self.client.get_single_topic_courses(topic_id, course_id)",
"def test_list_discussion_topics_courses(self):\r\n course_id = None # Change me!!\r\n\r\n r ... | [
"0.849311",
"0.8047771",
"0.7659494",
"0.7187263",
"0.7168567",
"0.70057434",
"0.6860486",
"0.6717968",
"0.66604745",
"0.66028625",
"0.65819085",
"0.6570425",
"0.642783",
"0.63997245",
"0.6357234",
"0.6349419",
"0.63241094",
"0.6319242",
"0.63122284",
"0.6302673",
"0.6287685"... | 0.9097581 | 0 |
Integration test for the DiscussionTopicsAPI.list_topic_entries_courses method. | def test_list_topic_entries_courses(self):
course_id = None # Change me!!
topic_id = None # Change me!!
r = self.client.list_topic_entries_courses(topic_id, course_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_entries_courses(self):\r\n course_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n\r\n r = self.client.list_entries_courses(topic_id, course_id, ids=None)",
"def test_list_discussion_topics_courses(self):\r\n course_id = None # Change me!!\r\n\r\n ... | [
"0.8711898",
"0.77148014",
"0.7492011",
"0.7149536",
"0.69947386",
"0.6984957",
"0.6556723",
"0.6468053",
"0.6445097",
"0.63955855",
"0.62576675",
"0.62175673",
"0.6210969",
"0.61720246",
"0.614337",
"0.60539615",
"0.6012576",
"0.60000706",
"0.5904092",
"0.58802265",
"0.58172... | 0.9037239 | 0 |
Integration test for the DiscussionTopicsAPI.list_entries_courses method. | def test_list_entries_courses(self):
course_id = None # Change me!!
topic_id = None # Change me!!
r = self.client.list_entries_courses(topic_id, course_id, ids=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_topic_entries_courses(self):\r\n course_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n\r\n r = self.client.list_topic_entries_courses(topic_id, course_id)",
"def test_list_entry_replies_courses(self):\r\n course_id = None # Change me!!\r\n topic_... | [
"0.8688404",
"0.76053154",
"0.7460015",
"0.7127526",
"0.66331327",
"0.6537723",
"0.6466119",
"0.63106817",
"0.630265",
"0.6246864",
"0.6188591",
"0.6148257",
"0.6127998",
"0.6075057",
"0.60614413",
"0.60080343",
"0.5954046",
"0.59236485",
"0.58408",
"0.5834587",
"0.58322257",... | 0.8798643 | 0 |
Integration test for the DiscussionTopicsAPI.mark_topic_as_read_courses method. | def test_mark_topic_as_read_courses(self):
# This method utilises the PUT request method and will make changes to the Canvas instance. This needs consideration.
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mark_topic_as_unread_courses(self):\r\n course_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n\r\n r = self.client.mark_topic_as_unread_courses(topic_id, course_id)",
"def test_mark_entry_as_read_courses(self):\r\n # This method utilises the PUT request method... | [
"0.84797263",
"0.74792504",
"0.7370845",
"0.7319496",
"0.7217598",
"0.7170252",
"0.715108",
"0.7043204",
"0.70028114",
"0.6925516",
"0.66840994",
"0.66387165",
"0.66321677",
"0.6576418",
"0.64009094",
"0.63937414",
"0.63631177",
"0.62501085",
"0.6233803",
"0.613962",
"0.60898... | 0.8756173 | 0 |
Integration test for the DiscussionTopicsAPI.mark_topic_as_unread_courses method. | def test_mark_topic_as_unread_courses(self):
course_id = None # Change me!!
topic_id = None # Change me!!
r = self.client.mark_topic_as_unread_courses(topic_id, course_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mark_entry_as_unread_courses(self):\r\n course_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n entry_id = None # Change me!!\r\n\r\n r = self.client.mark_entry_as_unread_courses(topic_id, entry_id, course_id, forced_read_state=None)",
"def test_mark_all_entri... | [
"0.8028983",
"0.798482",
"0.77743226",
"0.7306841",
"0.6823321",
"0.681717",
"0.6652212",
"0.65939283",
"0.65537614",
"0.65511787",
"0.6514427",
"0.6509948",
"0.649078",
"0.6465742",
"0.63828945",
"0.6329785",
"0.6312071",
"0.6273402",
"0.62147015",
"0.6145552",
"0.60995615",... | 0.9242412 | 0 |
Integration test for the DiscussionTopicsAPI.mark_all_entries_as_read_courses method. | def test_mark_all_entries_as_read_courses(self):
# This method utilises the PUT request method and will make changes to the Canvas instance. This needs consideration.
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mark_all_entries_as_unread_courses(self):\r\n course_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n\r\n r = self.client.mark_all_entries_as_unread_courses(topic_id, course_id, forced_read_state=None)",
"def test_mark_entry_as_unread_courses(self):\r\n course_... | [
"0.85600483",
"0.78248924",
"0.7588418",
"0.7548148",
"0.7500224",
"0.7235169",
"0.713777",
"0.6930601",
"0.6849349",
"0.6438172",
"0.6412609",
"0.62521917",
"0.61973155",
"0.61016065",
"0.6056508",
"0.5999073",
"0.59875137",
"0.5982887",
"0.59408444",
"0.59357023",
"0.581803... | 0.8506112 | 1 |
Integration test for the DiscussionTopicsAPI.mark_all_entries_as_unread_courses method. | def test_mark_all_entries_as_unread_courses(self):
course_id = None # Change me!!
topic_id = None # Change me!!
r = self.client.mark_all_entries_as_unread_courses(topic_id, course_id, forced_read_state=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mark_entry_as_unread_courses(self):\r\n course_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n entry_id = None # Change me!!\r\n\r\n r = self.client.mark_entry_as_unread_courses(topic_id, entry_id, course_id, forced_read_state=None)",
"def test_mark_topic_as_... | [
"0.8256725",
"0.80525535",
"0.7584382",
"0.70678365",
"0.6765781",
"0.66685164",
"0.6636249",
"0.6601663",
"0.6549853",
"0.63825047",
"0.63225037",
"0.6306156",
"0.6274371",
"0.6108556",
"0.61019504",
"0.6087966",
"0.5968118",
"0.58681417",
"0.5855319",
"0.5838787",
"0.583203... | 0.9055184 | 0 |
Integration test for the DiscussionTopicsAPI.mark_entry_as_read_courses method. | def test_mark_entry_as_read_courses(self):
# This method utilises the PUT request method and will make changes to the Canvas instance. This needs consideration.
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mark_entry_as_unread_courses(self):\r\n course_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n entry_id = None # Change me!!\r\n\r\n r = self.client.mark_entry_as_unread_courses(topic_id, entry_id, course_id, forced_read_state=None)",
"def test_mark_topic_as_... | [
"0.83578545",
"0.8254802",
"0.7952035",
"0.7842064",
"0.75980824",
"0.679684",
"0.6582543",
"0.6566872",
"0.6525765",
"0.64462495",
"0.64425147",
"0.64041007",
"0.63296753",
"0.6310714",
"0.6240177",
"0.6230842",
"0.6205487",
"0.6161535",
"0.6117921",
"0.6112708",
"0.5960941"... | 0.83545965 | 1 |
Integration test for the DiscussionTopicsAPI.mark_entry_as_unread_courses method. | def test_mark_entry_as_unread_courses(self):
course_id = None # Change me!!
topic_id = None # Change me!!
entry_id = None # Change me!!
r = self.client.mark_entry_as_unread_courses(topic_id, entry_id, course_id, forced_read_state=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mark_topic_as_unread_courses(self):\r\n course_id = None # Change me!!\r\n topic_id = None # Change me!!\r\n\r\n r = self.client.mark_topic_as_unread_courses(topic_id, course_id)",
"def test_mark_all_entries_as_unread_courses(self):\r\n course_id = None # Change me!!\r\n ... | [
"0.8542525",
"0.8294718",
"0.72794926",
"0.7241869",
"0.7055495",
"0.65690684",
"0.6485424",
"0.6372802",
"0.62973094",
"0.6222935",
"0.62037224",
"0.6199933",
"0.61768305",
"0.61308527",
"0.611844",
"0.61136174",
"0.610751",
"0.60747635",
"0.6014305",
"0.6014045",
"0.5989256... | 0.8960654 | 0 |
Computes the probability density function of the examples X under the multivariate gaussian distribution with parameters mu and Sigma2. If Sigma2 is a matrix, it is treated as the covariance matrix. If Sigma2 is a vector, it is treated as the \sigma^2 values of the variances in each dimension (a diagonal covariance mat... | def multivariateGaussian(X, mu, sigma2):
k = len(mu)
if sigma2.ndim == 1:
# convert sigma2 to a diagonal matrix
sigma2 = np.diag(sigma2)
# vectorized version of Multivariate Gaussian Distribution
X = X - mu
# p is a vector contains all probabilities of each examples
p = (2 * np.pi) ** (- k / 2.0) * np.linal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multivariateGaussian(X, mu, Sigma2):\n k = mu.shape[0]\n\n if Sigma2.shape[1] == 1 or Sigma2.shape[0] == 1:\n Sigma2 = np.diag(Sigma2[:, 0])\n\n X = (X-mu.T).copy()\n p = (2*np.pi)**(-k/2)*np.linalg.det(Sigma2)**-0.5\n p = p*np.exp(-0.5*(X.dot(np.linalg.pinv(Sigma2))*X).sum(1, keepdims=Tr... | [
"0.82991713",
"0.710045",
"0.67407614",
"0.66310567",
"0.6471967",
"0.645041",
"0.6364048",
"0.63447404",
"0.6319687",
"0.6266993",
"0.6264822",
"0.62624025",
"0.62510884",
"0.62360764",
"0.6222403",
"0.62121284",
"0.61792594",
"0.6119142",
"0.61120737",
"0.6104805",
"0.60850... | 0.7970556 | 1 |
Hash a plaintext string using PBKDF2. This is good enough according to the NIST (National Institute of Standards and Technology). In other words while bcrypt might be superior in practice, if you use PBKDF2 properly (which we are), then your passwords are safe. | def encrypt_password(cls, plaintext_password):
if plaintext_password:
return generate_password_hash(plaintext_password)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_string(password):\n return hash(password)",
"def hash_password(self, password):\n salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')\n pwdhash = hashlib.pbkdf2_hmac('sha256', password.encode('utf-8'), \n salt, 100000)\n pwdhash = ... | [
"0.70155036",
"0.69982934",
"0.68606645",
"0.6840191",
"0.6838096",
"0.6836684",
"0.6814522",
"0.6791693",
"0.67773384",
"0.67679286",
"0.6760161",
"0.6748342",
"0.67142636",
"0.6702792",
"0.6702792",
"0.6702792",
"0.6696023",
"0.66926724",
"0.6692187",
"0.66517323",
"0.66433... | 0.0 | -1 |
Obtiene el nombre del tipo de producto, de la lista de productos de la clase Product. | def product_type_name() -> str:
return Product.ListProducts.DRINK.label | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_type_name() -> str:\n\t\treturn Product.ListProducts.COMBO.label",
"def product_type(self):\r\n return self.__class__.__name__",
"def product_type(self):\n return self.__class__.__name__",
"def product_type(self):\n pass",
"def product_type(self) -> str:\n return get_require... | [
"0.7703635",
"0.7259657",
"0.72455573",
"0.71520764",
"0.67347634",
"0.6275624",
"0.6246975",
"0.6060544",
"0.6046281",
"0.5990568",
"0.597309",
"0.59283996",
"0.58424395",
"0.5812135",
"0.5790578",
"0.57759064",
"0.5707198",
"0.5685941",
"0.56742114",
"0.56650776",
"0.563559... | 0.72087884 | 3 |
Obtiene el nombre del tipo de producto, de la lista de productos de la clase Product. | def product_type_name() -> str:
return Product.ListProducts.COMBO.label | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_type(self):\r\n return self.__class__.__name__",
"def product_type(self):\n return self.__class__.__name__",
"def product_type_name() -> str:\n\t\treturn Product.ListProducts.DRINK.label",
"def product_type(self):\n pass",
"def product_type(self) -> str:\n return get_require... | [
"0.7259657",
"0.72455573",
"0.72087884",
"0.71520764",
"0.67347634",
"0.6275624",
"0.6246975",
"0.6060544",
"0.6046281",
"0.5990568",
"0.597309",
"0.59283996",
"0.58424395",
"0.5812135",
"0.5790578",
"0.57759064",
"0.5707198",
"0.5685941",
"0.56742114",
"0.56650776",
"0.56355... | 0.7703635 | 0 |
Test setup of climate entity. | async def test_climate_device(hass: HomeAssistant, nefit_wrapper):
entity_registry = er.async_get(hass)
entry = entity_registry.async_get("climate.nefit")
assert entry
thermostat = hass.states.get("climate.nefit")
assert thermostat
assert thermostat.state == HVAC_MODE_HEAT
assert thermosta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.my_city = City()",
"def setUp(self):\n self.hass = get_test_home_assistant()\n self.key = \"foo\"\n self.lat = self.hass.config.latitude = 37.8267\n self.lon = self.hass.config.longitude = -122.423\n self.entities = []\n self.addCleanup(sel... | [
"0.6801981",
"0.6722138",
"0.6624104",
"0.6445561",
"0.64424753",
"0.6382145",
"0.63657916",
"0.63597894",
"0.63581264",
"0.6344738",
"0.63288194",
"0.6327991",
"0.6327874",
"0.63244987",
"0.63174534",
"0.6313084",
"0.6304715",
"0.6304715",
"0.6304715",
"0.6304715",
"0.630471... | 0.0 | -1 |
Returns a list of legal moves for given player for this board state | def get_legal_moves(self, player):
move_list = []
if self._phase == GamePhase.SETUP:
return self._setup_legal_moves(player)
elif self._phase == GamePhase.MOVE:
return self._move_legal_moves(player)
elif self._phase == GamePhase.BUILD:
return sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legal_moves(player, board):\n return [sq for sq in Othello.squares() if Othello.is_legal(sq, player, board)]",
"def get_all_moves(self, board, player):\n result = []\n for startx in range(8):\n for starty in range(8):\n for destx in range(8):\n ... | [
"0.8106928",
"0.80186784",
"0.7726833",
"0.77174383",
"0.76549083",
"0.7651044",
"0.76078165",
"0.7506762",
"0.7479256",
"0.74748063",
"0.7456715",
"0.74477845",
"0.74129575",
"0.7395929",
"0.7357694",
"0.7300387",
"0.72360456",
"0.7165167",
"0.7134126",
"0.7074318",
"0.69609... | 0.8113886 | 0 |
Convert a dictionary description into a string description. | def _group2formula(self, elem_dict):
formula = ""
for key, value in elem_dict:
formula += "{}{}".format(key, value)
return formula | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dict_to_string(self, dictionary):\n st = ''\n for i in range(len(dictionary)):\n st = st + dictionary[i]\n return st",
"def get_dict_str(d: dict) -> str:\n\treturn str({str(u): str(v) for u, v in d.items()})",
"def dict_2_string(d):\n buff = io.StringIO()\n print_dict... | [
"0.72995955",
"0.71300334",
"0.6915584",
"0.68222785",
"0.65633756",
"0.65453",
"0.6486446",
"0.64831805",
"0.6467014",
"0.6361345",
"0.6260924",
"0.6232177",
"0.62230504",
"0.6210709",
"0.62034166",
"0.6191931",
"0.6183075",
"0.6173892",
"0.6167152",
"0.6162377",
"0.6123867"... | 0.0 | -1 |
Check that a field is valid for a root field. For operations, the fields arguments should be fields of root GraphQL types (Query, Mutation or Subscription) and correspond to the operation_type of this operation. | def is_valid_field(self, field: "DSLSelectable") -> bool:
assert isinstance(self, DSLOperation)
operation_name = self.operation_type.name
if isinstance(field, DSLMetaField):
if field.name in ["__schema", "__type"]:
return operation_name == "QUERY"
if fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_fields(self, tree):\n # Check fields\n fields = list(tree.keys())\n for k in self.fields:\n assert (k in fields)",
"def is_valid_field(self, field: DSLSelectable) -> bool:\n\n assert isinstance(self, DSLField)\n\n if isinstance(field, (DSLFragment, DSLIn... | [
"0.6356207",
"0.595336",
"0.58063596",
"0.5802096",
"0.5688165",
"0.5641144",
"0.5518633",
"0.547225",
"0.54365087",
"0.5412824",
"0.53349394",
"0.53085905",
"0.52445227",
"0.5230487",
"0.5203682",
"0.5185473",
"0.51495177",
"0.513861",
"0.5135999",
"0.5110452",
"0.51019615",... | 0.65455306 | 0 |
Initialize the DSLType with the GraphQL type. | def __init__(
self,
graphql_type: Union[GraphQLObjectType, GraphQLInterfaceType],
dsl_schema: DSLSchema,
):
self._type: Union[GraphQLObjectType, GraphQLInterfaceType] = graphql_type
self._dsl_schema = dsl_schema
log.debug(f"Creating {self!r})") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, schema: GraphQLSchema):\n\n if not isinstance(schema, GraphQLSchema):\n raise TypeError(\n f\"DSLSchema needs a schema as parameter. Received: {type(schema)}\"\n )\n\n self._schema: GraphQLSchema = schema",
"def __init__(self, raw_type: Dict):... | [
"0.6431991",
"0.61159176",
"0.5808697",
"0.57958376",
"0.57958376",
"0.5740455",
"0.5583517",
"0.553028",
"0.5508032",
"0.5496482",
"0.54931897",
"0.5481096",
"0.5452243",
"0.53910226",
"0.5324876",
"0.5284298",
"0.5231655",
"0.52189404",
"0.5208012",
"0.5193446",
"0.5184315"... | 0.75354 | 0 |
Remove redundant whitespace from a string. | def normalize_whitespace(text):
text = text.replace('"', '').replace("'", '')
return ' '.join(text.split()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _clean(s):\n return re.sub(r'\\s+', ' ', s.strip())",
"def _clean(self, string):\n return re.sub('\\s+', ' ', string).strip()",
"def strip_space(string):\n return string.replace(' ', '')",
"def remove_white_spaces(input_string):\n return re.sub(r'\\s+', ' ', input_string).strip()",
"def... | [
"0.81597906",
"0.8144986",
"0.80256945",
"0.79367214",
"0.78921837",
"0.7813043",
"0.77286696",
"0.7663373",
"0.76455605",
"0.74935627",
"0.74935627",
"0.7441288",
"0.7405228",
"0.74015",
"0.7362462",
"0.7356386",
"0.7338979",
"0.7296107",
"0.7291078",
"0.72806317",
"0.724966... | 0.0 | -1 |
Returns a psudo random string of lenght n. | def generate_password(n):
import os
import math
from base64 import b64encode
return b64encode(os.urandom(int(math.ceil(0.75*n))),'-_')[:n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randstr(n):\n alphabets = string.digits + string.letters\n return ''.join(random.choice(alphabets) for i in xrange(n))",
"def generate_random_string(N):\n return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(N))",
"def gen_rand_str(n):\n return \"\".join(rando... | [
"0.8135958",
"0.81020355",
"0.8056466",
"0.79031897",
"0.78109026",
"0.77648187",
"0.7722502",
"0.76222193",
"0.7566458",
"0.75120693",
"0.7486509",
"0.74702466",
"0.7469825",
"0.74648756",
"0.74576503",
"0.743425",
"0.7428508",
"0.7426203",
"0.74185514",
"0.741022",
"0.73827... | 0.7602529 | 8 |
Initialise 'Ball' object as subclass of 'Turtle' object | def __init__(self, pos=(0, 0)):
super().__init__() # Call 'turtle' initiation
self.penup() # Stop displaying trail
self.shapesize(stretch_wid=1, stretch_len=1) # Set dimensions of ball object to same height and width
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n super(Ball, self).__init__(*args, **kwargs)\n self.speed = kwargs.get('speed', 5)\n self.ball_image = pyglet.image.load(os.path.join(config.ASSETS_DIR, 'ball.png'))\n self.width = self.ball_image.width\n self.height = self.ball_image.height\... | [
"0.69437927",
"0.68377686",
"0.68367285",
"0.68143",
"0.62883264",
"0.6229259",
"0.62049294",
"0.618896",
"0.617339",
"0.6171533",
"0.61532545",
"0.6134507",
"0.6048627",
"0.6006973",
"0.59645",
"0.5958097",
"0.5938208",
"0.5937411",
"0.59171826",
"0.58550733",
"0.5844965",
... | 0.7152998 | 0 |
Returns val of f(3, b, R) % (2 15) | def f3(b, R):
term1 = pow(R + 1, b, MOD) * (R * R + 3 * R + 1)
term2 = 0
for _ in range(b):
term2 = ((R + 1) * term2 + 1) % MOD
term2 *= 2 * R + 1
return (term1 + term2) % MOD | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f41(R):\n return f3(f3(R, R), R) % MOD",
"def f_2(c):\n Di = calc_R(*c)\n return Di",
"def romberg(f, a, b, n=20):\n R = [[0.5 * (b - a) * (f(a) + f(b))]] # R[0][0]\n for n in range (1,n+1):\n h = float(b-a)/2**n\n R.append((n+1)*[None]) # Add an empty row.\n ... | [
"0.7662301",
"0.65716714",
"0.6403492",
"0.6383141",
"0.634109",
"0.62951726",
"0.6269045",
"0.62373114",
"0.6217888",
"0.61755997",
"0.6151459",
"0.6144782",
"0.6144782",
"0.6114495",
"0.6113371",
"0.6082682",
"0.60682577",
"0.60436654",
"0.6031693",
"0.5956826",
"0.59420836... | 0.806427 | 0 |
Get real path relative to project root dir. | def expand_path(self, original_path):
path = self.fix_dir_separator(original_path)
path = os.path.expanduser(path)
return os.path.join(self.config['work_dir'], path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_project_path():\n file_path = os.path.abspath(__file__)\n root_dir = os.path.join(os.path.dirname(file_path), \"..\")\n return os.path.abspath(root_dir)",
"def project_root() -> Path:\n return PROJECT_ROOT",
"def get_project_root() -> Path:\n return Path(__file__).parent.parent",
"def ... | [
"0.8313039",
"0.8095335",
"0.8050155",
"0.8050155",
"0.8050155",
"0.8050155",
"0.8028386",
"0.8028386",
"0.80270785",
"0.79882187",
"0.7959134",
"0.79108584",
"0.79021835",
"0.78731334",
"0.78135735",
"0.77643764",
"0.7722912",
"0.7720147",
"0.76961726",
"0.76672226",
"0.7658... | 0.0 | -1 |
Get a random element from the set. | def getRandom(self) -> int:
from random import choice
return choice(self.list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()",
"... | [
"0.7703242",
"0.73851275",
"0.72931343",
"0.7218611",
"0.6870737",
"0.68438596",
"0.6831954",
"0.6775109",
"0.67205936",
"0.6701239",
"0.66633993",
"0.6633367",
"0.66202724",
"0.66111916",
"0.6597498",
"0.6564292",
"0.64615905",
"0.64409477",
"0.64128685",
"0.63991153",
"0.63... | 0.6475166 | 16 |
Gets the planned of this DutyWhen. | def planned(self):
return self._planned | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def planned(self, planned):\n\n self._planned = planned",
"def scheduled_plan(self):\n return self._scheduled_plan",
"def precipitation_now(self) -> Optional[float]:\n for precip in self.precipitation_from_now:\n return precip.value\n return None",
"def planned_terminat... | [
"0.5889865",
"0.58095217",
"0.5580369",
"0.5358955",
"0.53575295",
"0.53575295",
"0.5218377",
"0.51932245",
"0.51553196",
"0.51298493",
"0.511351",
"0.5085398",
"0.5085398",
"0.50519526",
"0.5033431",
"0.5027954",
"0.50092185",
"0.49888262",
"0.49586284",
"0.49165368",
"0.491... | 0.7580546 | 0 |
Sets the planned of this DutyWhen. | def planned(self, planned):
self._planned = planned | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def planned_purge_date(self, planned_purge_date):\n\n self._planned_purge_date = planned_purge_date",
"def planned_purge_date(self, planned_purge_date):\n\n self._planned_purge_date = planned_purge_date",
"def planned_termination_date(self, planned_termination_date):\n\n self._planned_term... | [
"0.5820681",
"0.5820681",
"0.5820304",
"0.5806155",
"0.5530222",
"0.5222441",
"0.5126386",
"0.49399158",
"0.4876175",
"0.48492387",
"0.48042274",
"0.47785053",
"0.47643608",
"0.47625494",
"0.47235534",
"0.47124302",
"0.4707486",
"0.4705979",
"0.46918368",
"0.46284556",
"0.458... | 0.7941171 | 0 |
Gets the actual of this DutyWhen. | def actual(self):
return self._actual | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actual_value(self):\n return self.__actualValue",
"def get(self):\n now = datetime.datetime.utcnow()\n if now > self.time_of_next_update:\n self._update_value()\n return self.value",
"def when(self):\n\n # current UTC time\n now = datetime.datetime.utcno... | [
"0.6535892",
"0.6232577",
"0.59493977",
"0.5922169",
"0.58857054",
"0.58587486",
"0.57750434",
"0.57476115",
"0.573744",
"0.56969386",
"0.5685835",
"0.5685353",
"0.56464565",
"0.5630309",
"0.5628153",
"0.56225216",
"0.559612",
"0.5590993",
"0.55838543",
"0.55783683",
"0.55709... | 0.68847036 | 0 |
Sets the actual of this DutyWhen. | def actual(self, actual):
self._actual = actual | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actual_reported_desc(self, actual_reported_desc):\n\n self._actual_reported_desc = actual_reported_desc",
"async def set_duty(self, duty: int, force: bool = False) -> None:\n assert 0 <= duty <= 100\n if not force and duty == self._last_duty:\n logger.debug(\"[%s] %sDuty is al... | [
"0.5459379",
"0.5418262",
"0.538786",
"0.53128433",
"0.5309682",
"0.53036124",
"0.52766037",
"0.5232243",
"0.512582",
"0.50941354",
"0.5065637",
"0.5045214",
"0.5041858",
"0.50392294",
"0.49751788",
"0.49705547",
"0.4969758",
"0.4961411",
"0.49601275",
"0.49380302",
"0.489282... | 0.71314955 | 1 |
Gets the shift_type of this DutyWhen. Night, Day, etc | def shift_type(self):
return self._shift_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_type(self):\n return self._schedule_type",
"def shift_type(self, shift_type):\n\n self._shift_type = shift_type",
"def get_type(self):\n return self.event_type",
"def weather_type(self):\n return self._weather_type",
"def get_power_type(self) -> str:\n return... | [
"0.6029102",
"0.5720019",
"0.57115793",
"0.56324524",
"0.5534602",
"0.54518294",
"0.5426972",
"0.53180003",
"0.525643",
"0.5256416",
"0.52439976",
"0.5235749",
"0.52118474",
"0.52056783",
"0.5097",
"0.5097",
"0.5092173",
"0.5089316",
"0.5089316",
"0.50772345",
"0.50545603",
... | 0.71291775 | 0 |
Returns the Path to the XMLResources folder. | def getPath(self):
return self.__folder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def get_resource_dir(cls) -> str:\n return os.path.join(\n os.path.realpath(os.path.dirname(__file__)),\n os.pardir,\n os.pardir,\n os.pardir,\n ... | [
"0.7487251",
"0.7481995",
"0.73212004",
"0.714729",
"0.69379973",
"0.68889636",
"0.67238545",
"0.66834676",
"0.6566716",
"0.65666693",
"0.64880276",
"0.6471511",
"0.6465292",
"0.6425344",
"0.6405657",
"0.63518333",
"0.6334732",
"0.63217753",
"0.6304032",
"0.62696975",
"0.6269... | 0.6434908 | 13 |
Get absolute path to resource, works for dev and for PyInstaller | def resource_path(relative_path):
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
return os.path.join(base_path, relative_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa... | [
"0.83703053",
"0.8280665",
"0.8248955",
"0.8139455",
"0.81142074",
"0.8098781",
"0.80942494",
"0.80799556",
"0.8067926",
"0.80675894",
"0.80627203",
"0.80627203",
"0.80627203",
"0.80627203",
"0.80627203",
"0.80627203",
"0.80627203",
"0.80571795",
"0.8054659",
"0.8045055",
"0.... | 0.7816395 | 52 |
Create a Flask app from the configured instance | def create_app(self):
app = Flask(__name__)
app.config["auth_func"] = self.auth_func
app.config["hydrator_func"] = self.hydrator_func
app.config["request_hydrator_func"] = self.request_hydrator_func
app.config["database_uri"] = self.database_uri
app.config["hmac_secret"]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app():\n app = create_app()\n return app",
"def app():\n return create_app()",
"def create_app():\n app = Flask(__name__)\n app.config.from_object('app.configs.config')\n app.config.from_object('app.configs.settings')\n return app",
"def create_app(config):\n\n # Initialize app. F... | [
"0.84124756",
"0.8374379",
"0.8316893",
"0.8181684",
"0.8147052",
"0.8143248",
"0.81384313",
"0.81232053",
"0.80776966",
"0.8063406",
"0.8059791",
"0.80469334",
"0.80322665",
"0.80181986",
"0.80166453",
"0.8016637",
"0.80130905",
"0.8007616",
"0.797332",
"0.79724306",
"0.7968... | 0.7456587 | 93 |
Linearly transforms a worldframe vector into walker's egocentric frame. Note that this function does not perform an affine transformation of the vector. In other words, the input vector is assumed to be specified with respect to the same origin as this walker's egocentric frame. This function can also be applied to mat... | def transform_vec_to_egocentric_frame(self, physics, vec_in_world_frame):
vec_in_world_frame = np.asarray(vec_in_world_frame)
xmat = np.reshape(physics.bind(self.root_body).xmat, (3, 3))
# The ordering of the np.dot is such that the transformation holds for any
# matrix whose final dimensions are (2,) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(self, vector):\n \n matrix = wf.translationMatrix(*vector)\n for wireframe in self.wireframes.values():\n wireframe.transform(matrix)",
"def body_2_world(orientation, vector):\n\n vector = np.append(vector, 0)\n orientation_inv = quaternion_inverse(orientation)\n ... | [
"0.5760716",
"0.57301503",
"0.55941814",
"0.5522612",
"0.55047274",
"0.52455044",
"0.5173822",
"0.5170467",
"0.51543146",
"0.50848025",
"0.50778526",
"0.5053133",
"0.49891606",
"0.49164003",
"0.4906255",
"0.4901422",
"0.48983097",
"0.489521",
"0.48736635",
"0.48316976",
"0.48... | 0.7553541 | 0 |
The world's zvector in this Walker's torso frame. | def world_zaxis(self):
return observable.MJCFFeature('xmat', self._entity.root_body)[6:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def z(self):\r\n return self.position.z",
"def getVelZ(self):\n return self.posvel.getZ()",
"def get_z(self):\n return self.coords[2]",
"def z(self):\n return self.coords[2]",
"def z(self):\n return self._coords[2]",
"def getZ(self):\n\t\treturn self.coords.z",
"def origi... | [
"0.7276288",
"0.72531605",
"0.72372526",
"0.7229726",
"0.7179669",
"0.7166061",
"0.7129036",
"0.69708365",
"0.6947133",
"0.6865385",
"0.6828666",
"0.6809708",
"0.6809708",
"0.6809708",
"0.6685378",
"0.6607886",
"0.65415907",
"0.6501922",
"0.6494525",
"0.64669776",
"0.6447056"... | 0.7173227 | 5 |
get the reference primal bound for this instance | def getReferencePb(self, problemname : str) -> float:
reference = self.referencedict.get(problemname, (None, None))
if self.isUnkn(reference) or self.isInf(reference) or self.isFeas(reference):
return None
else:
return reference[self.__primalidx__] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lower_bound(self):\n return self._lower_bound",
"def get_lower_bound(self):\n return self._lower_bound",
"def get_upper_bound(self):\n return self._upper_bound",
"def lower_bound(self) -> float:\n ...",
"def get_refrange(self):\n if np.all(np.isnan(self.par)):\n pr... | [
"0.68506634",
"0.68506634",
"0.6626328",
"0.64435357",
"0.62474287",
"0.61056566",
"0.6103773",
"0.6017692",
"0.5874583",
"0.58675593",
"0.58498615",
"0.57486856",
"0.56695074",
"0.5652659",
"0.563817",
"0.5631898",
"0.5628739",
"0.56128496",
"0.5560667",
"0.55418456",
"0.553... | 0.5608498 | 18 |
get the reference primal bound for this instance | def getReferenceDb(self, problemname : str) -> float:
reference = self.referencedict.get(problemname, (None, None))
if self.isUnkn(reference) or self.isInf(reference) or self.isFeas(reference):
return None
else:
return reference[self.__dualidx__] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lower_bound(self):\n return self._lower_bound",
"def get_lower_bound(self):\n return self._lower_bound",
"def get_upper_bound(self):\n return self._upper_bound",
"def lower_bound(self) -> float:\n ...",
"def get_refrange(self):\n if np.all(np.isnan(self.par)):\n pr... | [
"0.68506634",
"0.68506634",
"0.6626328",
"0.64435357",
"0.62474287",
"0.61056566",
"0.6103773",
"0.6017692",
"0.5874583",
"0.58675593",
"0.58498615",
"0.57486856",
"0.56695074",
"0.5652659",
"0.563817",
"0.5631898",
"0.5628739",
"0.56128496",
"0.5608498",
"0.5560667",
"0.5541... | 0.5217262 | 83 |
Return an opened file to read, or sys.stdin if filepath is None. Raises an OSError if filepath is nonNone but doesn't exist. | def _get_infile(filepath):
# type: (Text) -> BinaryIO
if filepath is None:
return sys.stdin
else:
if not os.path.exists(filepath):
raise OSError('File does not exist: {}'.format(filepath))
return open(filepath, 'r') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_infile(infilename):\n if not infilename or infilename == \"-\":\n return sys.stdin\n else:\n return open(infilename, \"r\")",
"def open_file(filename=\"default.txt\", filepath=\"default_path\"):\n\n if filepath == \"default_path\":\n filepath = \"\"\n\n try:\n fp = open(filep... | [
"0.7320987",
"0.6783902",
"0.6772613",
"0.6754688",
"0.6565494",
"0.64450634",
"0.6425217",
"0.6257662",
"0.6083197",
"0.6036446",
"0.59137225",
"0.5900512",
"0.589459",
"0.585727",
"0.5826796",
"0.5817996",
"0.57280827",
"0.5711713",
"0.5632567",
"0.5630372",
"0.5619179",
... | 0.834832 | 0 |
Returns mid (or p) coordinates of given two coordinates c1 and c2. | def midcoords(p, c1, c2):
return make_coords(pos=midpoint(p, c1.worldpos(), c2.worldpos()),
rot=midrot(p, c1.worldrot(), c2.worldrot())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mid(pt1, pt2):\n (x0, y0), (x1, y1) = pt1, pt2\n return 0.5 * (x0 + x1), 0.5 * (y0 + y1)",
"def _middle_point(p1, p2):\n x = int((p1.x + p2.x) / 2)\n y = int((p1.y + p2.y) / 2)\n return (x, y)",
"def intersect_point(self,m1,c1,m2,c2):\n\n x = (c2 - c1)/(m1 - m2)\n ... | [
"0.7823058",
"0.74225706",
"0.74220765",
"0.7374923",
"0.73042697",
"0.72671145",
"0.7263712",
"0.72246087",
"0.7097989",
"0.706812",
"0.7004969",
"0.6769184",
"0.6725844",
"0.6702754",
"0.6527052",
"0.64762515",
"0.64420694",
"0.6297795",
"0.6200092",
"0.6166417",
"0.6097244... | 0.859501 | 0 |
Orient axis to the direction Orient axis in target_coords to the direction specified by v. | def orient_coords_to_axis(target_coords, v, axis='z', eps=0.005):
v = np.array(v, 'f')
if np.linalg.norm(v) == 0.0:
v = np.array([0, 0, 1], 'f')
nv = normalize_vector(v)
axis = _wrap_axis(axis)
ax = target_coords.rotate_vector(axis)
rot_axis = np.cross(ax, nv)
rot_angle_cos = np.clip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjustOrient(joint, target):\n\n inv_x = target.translateX.get() < 0\n x_axis = {\n False: (1, 0, 0),\n True: (-1, 0, 0)\n }\n\n orientJoint(joint, target.getTranslation(ws=True), aim_axis=x_axis[inv_x],\n world_up=joint.getMatrix(ws=True)[1][:3])",
"def vector_to(sel... | [
"0.6794328",
"0.5677264",
"0.5652536",
"0.56377286",
"0.55048573",
"0.5458771",
"0.540039",
"0.5387523",
"0.5377008",
"0.5367707",
"0.5323419",
"0.53034467",
"0.52786803",
"0.5269253",
"0.5230898",
"0.5228839",
"0.521811",
"0.52100116",
"0.51731056",
"0.51682615",
"0.5161305"... | 0.75997716 | 0 |
Simplified sum when all coefficients are 1. | def ref_main(l, k):
S = sum(binomial(k, z)*(2*z-k)**l for z in range(k+1))
return S / 2**k | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_array_sum_equals_one(self):\n plugin = NonLinearWeights(0.85)\n result = plugin.process(self.cube, self.coord_name)\n self.assertAlmostEqual(result.data.sum(), 1.0)",
"def sum(self):\n return np.dot(self.data.T, self.weights)",
"def fsum(iterable):\n return 0.0",
"... | [
"0.6582552",
"0.6308019",
"0.6042821",
"0.6032452",
"0.59876615",
"0.59769136",
"0.5965029",
"0.596077",
"0.5951748",
"0.59369844",
"0.58897465",
"0.5862015",
"0.5859922",
"0.58584654",
"0.58034855",
"0.57936305",
"0.5792527",
"0.5770018",
"0.57686013",
"0.5746807",
"0.574166... | 0.0 | -1 |
Simplified sum when all coefficients are 1. | def ref_main(l, k):
S = sum(binomial(k, z)*(2*z-k)**l for z in range(k+1))
return S / 2**k | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_array_sum_equals_one(self):\n plugin = NonLinearWeights(0.85)\n result = plugin.process(self.cube, self.coord_name)\n self.assertAlmostEqual(result.data.sum(), 1.0)",
"def sum(self):\n return np.dot(self.data.T, self.weights)",
"def fsum(iterable):\n return 0.0",
"... | [
"0.65828204",
"0.63081217",
"0.6042275",
"0.60315937",
"0.59871984",
"0.5976309",
"0.5965428",
"0.59609747",
"0.59508646",
"0.59363776",
"0.5888739",
"0.58617467",
"0.5860306",
"0.5857673",
"0.5802599",
"0.5792828",
"0.5792013",
"0.57691973",
"0.5768277",
"0.5744906",
"0.5741... | 0.0 | -1 |
Returns a new fraction in reduced form that results from adding this fraction with the m fraction | def add(self, m):
f_num = self.num * m.den + m.num * self.den
f_den = self.den * m.den
f = Fraction(f_num, f_den)
return f.reduce() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce(self):\n import math\n g = math.gcd(self.num, self.den)\n return Fraction(self.num//g, self.den//g)",
"def __mul__(self, frac):\n numerator = self.numerator * frac.numerator\n denominator = self.denominator * frac.denominator\n gcd = math.gcd(numerator, denomi... | [
"0.6905592",
"0.6379596",
"0.6354649",
"0.6292354",
"0.6280963",
"0.61754555",
"0.6083864",
"0.60582584",
"0.6035809",
"0.60337204",
"0.60013974",
"0.5990907",
"0.5974897",
"0.59611386",
"0.59048396",
"0.583647",
"0.5829053",
"0.5806098",
"0.5804881",
"0.58011913",
"0.5800554... | 0.7592518 | 0 |
Returns a new fraction in reduced form that results from subtracting this fraction with the m fraction | def subtract(self, m):
f = m.negate()
return self.add(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __sub__(self, frac):\n numerator = ((self.numerator * frac.denominator) - (self.denominator * frac.numerator))\n denominator = (self.denominator * frac.denominator)\n return Fraction(numerator, denominator)",
"def __sub__ (self,other):\n if (self.debug): print(f'enter fraction.__sub... | [
"0.6613027",
"0.6585863",
"0.6472576",
"0.63958466",
"0.63713145",
"0.62810725",
"0.619459",
"0.6163163",
"0.6145009",
"0.6118841",
"0.6108367",
"0.6103947",
"0.60570896",
"0.60516423",
"0.60435724",
"0.5941821",
"0.5940781",
"0.5922248",
"0.5916122",
"0.59106106",
"0.5882872... | 0.68500614 | 0 |
Post new data to categories table. Retrieve data from user input located in JSON, validate the data, then post the data to users tables. | def post(self):
parser = reqparse.RequestParser()
parser.add_argument('name', location='json', required=True)
parser.add_argument('details', location='json', required=False)
args = parser.parse_args()
new_category = {
'name': args['name'],
'details': arg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self):\n all_categories = Categories().get_all_categories()\n data = request.get_json(force=True)\n category_id = len(all_categories) + 1\n category_name = data[\"category_name\"]\n if request.json['category_name'] in [category['category_name']\n ... | [
"0.65297997",
"0.62781477",
"0.6252488",
"0.6211614",
"0.61919737",
"0.6171787",
"0.61483216",
"0.6061219",
"0.59647137",
"0.59392715",
"0.5893719",
"0.58674616",
"0.58262545",
"0.5818726",
"0.57982254",
"0.57482886",
"0.5736542",
"0.5713404",
"0.5684614",
"0.5674092",
"0.565... | 0.6142305 | 7 |
This funtion has two arguments, the coordinates of two atoms. It returns the distance between atoms. | def calculate_distance(coords1, coords2):# 3 sets of double quotes allows to give a description for help
distance_x = coords1[0] - coords2[0]
distance_y = coords1[1] - coords2[1]
distance_z = coords1[2] - coords2[2]
distance = numpy.sqrt(distance_x**2 + distance_y**2 + distance_z**2)
return distance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_distance(atom1,atom2): #dot string to show when you go into the help doc of this function\n x_distance = atom1[0]-atom2[0]\n y_distance = atom1[1]-atom2[1]\n z_distance = atom1[2]-atom2[2]\n distance = numpy.sqrt(x_distance**2+ y_distance**2+z_distance**2)\n return distance",
"def di... | [
"0.803143",
"0.78964996",
"0.78562033",
"0.77197564",
"0.76711273",
"0.76641166",
"0.76057345",
"0.7593217",
"0.7578832",
"0.7575637",
"0.7573873",
"0.7548038",
"0.75305426",
"0.75211143",
"0.7512857",
"0.74541515",
"0.74271315",
"0.7418634",
"0.7410189",
"0.74052733",
"0.739... | 0.75453234 | 12 |
This function prints and plots the confusion matrix. | def plot_confusion_matrix(confusion_mat, classes, figure_axis, title=None, cmap=plt.cm.Blues):
# Compute confusion matrix
cm = confusion_mat
ax = figure_axis
im = ax.imshow(cm, interpolation='nearest', cmap=cmap)
plt.grid(False)
ax.figure.colorbar(im, ax=ax)
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()",
"def showConfusionMatrix(self): \r\n sn.heatmap(self.conf_matrix, annot=True)\r\n plt.plot( label=\"Accuracy\")\r\n plt.plot( label=\"Error\"... | [
"0.8091066",
"0.8078287",
"0.7998978",
"0.79478645",
"0.79230374",
"0.7846215",
"0.7833585",
"0.77821517",
"0.7777263",
"0.7758042",
"0.7707276",
"0.7703438",
"0.7693389",
"0.768003",
"0.76597446",
"0.7642738",
"0.762416",
"0.7612622",
"0.7612469",
"0.75994796",
"0.7588916",
... | 0.7514897 | 31 |
Recall is also known as Sensitivity and True Positive Rate | def recall(self):
self.overall_recall = recall_score(
self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)
self.classes_recall = recall_score(
self.y_true, self.y_pred, average = None).round(self.digits_count_fp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred):\n tp = true_positive(y_true, y_pred)\n fn = false_negative(y_true, y_pred)\n recall = tp / (tp + fn)\n return recall",
"def recall(y_true, y_pred):\n true_positives = bk.sum(bk.round(bk.clip(y_true * y_pred, 0, 1)))\n possible_positives = bk.sum(bk.ro... | [
"0.7992816",
"0.7733845",
"0.7713985",
"0.76696116",
"0.7619021",
"0.75689435",
"0.75689435",
"0.75689435",
"0.75689435",
"0.75689435",
"0.75689435",
"0.754303",
"0.754303",
"0.754303",
"0.754303",
"0.754303",
"0.754303",
"0.754303",
"0.754303",
"0.754303",
"0.7519639",
"0.... | 0.7383333 | 44 |
Precision or Positive Predictive Value | def precision(self):
self.overall_precision = precision_score(
self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)
self.classes_precision = precision_score(
self.y_true, self.y_pred, average = None).round(self.digits_count_fp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(y_true, y_pred):\n tp = true_positive(y_true, y_pred)\n fp = false_positive(y_true, y_pred)\n precision = tp / (tp + fp)\n return precision",
"def precision(y_true, y_pred):\n true_positives = bk.sum(bk.round(bk.clip(y_true * y_pred, 0, 1)))\n predicted_positives =... | [
"0.75551665",
"0.7410151",
"0.7328772",
"0.72977275",
"0.7292548",
"0.72893834",
"0.72500587",
"0.72344077",
"0.72344077",
"0.72344077",
"0.72344077",
"0.72344077",
"0.72344077",
"0.72170174",
"0.7208128",
"0.7208128",
"0.7208128",
"0.7208128",
"0.7208128",
"0.7208128",
"0.72... | 0.6737913 | 52 |
Get the training labels for the given window in the given scene. | def get_train_labels(self, window: Box, scene: Scene) -> np.ndarray:
label_store = scene.ground_truth_label_source
return label_store.get_labels(window) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_labels(self, window, scene):\n pass",
"def get_train_labels(self, window: Box, scene: Scene) -> Labels:\n raise NotImplementedError()",
"def _get_window_labels(self, window):\n\n # Get summary stats, if they have not yet been triggered\n if not self.summary_info:\n ... | [
"0.8270742",
"0.7911325",
"0.6626631",
"0.6384677",
"0.58935905",
"0.5731578",
"0.5731578",
"0.56759876",
"0.5642322",
"0.55750597",
"0.55562645",
"0.5517664",
"0.55125296",
"0.5480872",
"0.5461054",
"0.5382931",
"0.53742236",
"0.53631645",
"0.5344885",
"0.53376037",
"0.53322... | 0.8038811 | 1 |
Get windows overwhich predictions will be calculated. | def get_predict_windows(self, extent: Box) -> List[Box]:
chip_size = self.config.chip_size
return extent.get_windows(chip_size, chip_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_by_windows(net, windows):\n prediction, inputs = [], []\n for input in windows:\n _, pred = tr.max(net(Variable(tr.LongTensor(input))).data, 1)\n prediction.append(pred)\n inputs.append(input[2])\n return prediction, inputs",
"def get_predict_windows(self, extent):\n ... | [
"0.70999604",
"0.70232415",
"0.68000615",
"0.66920525",
"0.655708",
"0.6514384",
"0.6353548",
"0.6333093",
"0.625262",
"0.625046",
"0.6247006",
"0.62258714",
"0.62034065",
"0.6122067",
"0.608243",
"0.6060066",
"0.60524786",
"0.6003902",
"0.5959996",
"0.593741",
"0.59316635",
... | 0.62083095 | 12 |
Answers True if logins exists in system | def user_exists(self, login):
if login in self.users_by_name and isinstance(self.users_by_name[login], VDOM_user):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_in_session():\n return 'user_id' in login_session",
"def logged():\n if session.login==1:\n return True\n else:\n return False",
"def logged_in(self):\n return self.auth.get_user_by_session() is not None",
"def is_registered(self):\n if self.user == getpass.getuser()... | [
"0.72944564",
"0.7292205",
"0.72026753",
"0.72014725",
"0.71721643",
"0.7147398",
"0.7076088",
"0.7072131",
"0.7066283",
"0.7010786",
"0.6903183",
"0.6843802",
"0.6829616",
"0.6803901",
"0.67946684",
"0.6761969",
"0.6728989",
"0.67041194",
"0.66909474",
"0.66799563",
"0.66606... | 0.7260613 | 2 |
Answers True if logins exists in system | def name_exists(self, login):
return login in self.users_by_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_in_session():\n return 'user_id' in login_session",
"def logged():\n if session.login==1:\n return True\n else:\n return False",
"def user_exists(self, login):\n\t\tif login in self.users_by_name and isinstance(self.users_by_name[login], VDOM_user):\n\t\t\treturn True\n\t\tretur... | [
"0.7295532",
"0.72931576",
"0.72604144",
"0.7203268",
"0.7201924",
"0.7148659",
"0.7077942",
"0.707348",
"0.706723",
"0.70115465",
"0.6904852",
"0.6843363",
"0.68297595",
"0.6805096",
"0.6795955",
"0.6763974",
"0.6730125",
"0.6704522",
"0.669207",
"0.6681345",
"0.6661872",
... | 0.71723604 | 5 |
test that exception is raised for invalid passwords | def test_password_is_valid():
with pytest.raises(Exception):
assert password_is_valid('qqqqqqqq') == Exception('Password has to be longer than 8 characters')
assert password_is_valid('') == Exception('Password cannot be empty')
assert password_is_valid('QQQQQQQQQ') == Exception('Password has to contain lowercase... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_password(self):\n pass",
"def test_invalid_password():\r\n auth_register_v1(email='harrypotter@gmail.com',\r\n password='qw3rtyAppl3s@99',\r\n name_first='Harry',\r\n name_last='Potter')\r\n\r\n invalid_password = ... | [
"0.88232267",
"0.831937",
"0.8280921",
"0.82121056",
"0.8041127",
"0.8019596",
"0.80050004",
"0.79710513",
"0.78048694",
"0.7669164",
"0.7652721",
"0.76468986",
"0.7587052",
"0.7511681",
"0.74918467",
"0.7471766",
"0.74646795",
"0.7413386",
"0.73923916",
"0.73650175",
"0.7354... | 0.8220501 | 3 |
test that exception is raised for invalid passwords | def test_password_is_okay():
with pytest.raises(Exception):
assert password_is_ok('qqqqqqqq') == Exception('Password either has to contain a digit \n or password has to contain uppercase \n or password has to contain lowercase')
with pytest.raises(Exception):
assert password_is_ok('') == Exception('Password ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_password(self):\n pass",
"def test_invalid_password():\r\n auth_register_v1(email='harrypotter@gmail.com',\r\n password='qw3rtyAppl3s@99',\r\n name_first='Harry',\r\n name_last='Potter')\r\n\r\n invalid_password = ... | [
"0.88255596",
"0.8320438",
"0.82825905",
"0.8221355",
"0.8043196",
"0.80208987",
"0.8005949",
"0.7972175",
"0.78061515",
"0.76710176",
"0.76533204",
"0.7648111",
"0.75885373",
"0.7512765",
"0.74929255",
"0.7473432",
"0.7466634",
"0.7416775",
"0.7393666",
"0.7365146",
"0.73568... | 0.82131004 | 4 |
Returns True if file_name concatenated with file extension length is > 255. Returns False otherwise. | def is_too_long(file_name: str) -> bool:
return len(file_name + REPORT_FILE_EXT) > 255 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_filename(basename):\n return len(basename) <= MAXIMUM_FILENAME_LENGTH",
"def is_good_file(filename):\n for e in extensions:\n if filename.endswith(e):\n return True\n return False",
"def check_file_size(self, file_name:str)->bool:\n try:\n size ... | [
"0.7472104",
"0.7006495",
"0.6888953",
"0.6828483",
"0.67831105",
"0.67661947",
"0.67036813",
"0.6685214",
"0.66694236",
"0.66443413",
"0.6635888",
"0.6604742",
"0.6592866",
"0.6567582",
"0.6567582",
"0.6567582",
"0.6567582",
"0.6567582",
"0.6567582",
"0.65126604",
"0.6511347... | 0.7950595 | 0 |
[summary] Given a list of coinbase dictionary candle data, converts to 4x1 array for input and a 1x1 array for output. | def setup_transposed_data(self, data: List[Dict[str, Any]]):
output = []
open = []
low = []
high = []
volume = []
for dat in data:
open.append(dat["open"])
low.append(dat["low"])
high.append(dat["high"])
volume.append(dat["v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_multicsv(self,input_data):\n reformatted_data = []\n for (i,row) in enumerate(input_data):\n if i==0:\n headers = row\n else:\n data_row = {}\n for (j,h) in enumerate(headers):\n if j<len(row):\n ... | [
"0.58059704",
"0.57785",
"0.5694167",
"0.56354016",
"0.55750906",
"0.55199426",
"0.5497732",
"0.5488839",
"0.5465267",
"0.5434205",
"0.54116774",
"0.54018825",
"0.54008144",
"0.5378888",
"0.5370717",
"0.53697145",
"0.53674084",
"0.5354261",
"0.5333443",
"0.53277147",
"0.53268... | 0.55579764 | 5 |
Get element by index, relative to the current index | def __getitem__(self, key):
if len(self._data) == self.size:
return(self._data[(key + self.index) % self.size])
else:
return(self._data[key]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_item_by_idx(self, iterator, idx):\r\n size = len(self)\r\n idx = operator.index(idx)\r\n if not -size <= idx < size:\r\n raise IndexError('index {} is out of range'.format(idx))\r\n idx %= size\r\n return next(itertools.islice(iterator, idx, None))",
"def ge... | [
"0.77579355",
"0.77523184",
"0.77194536",
"0.76787007",
"0.76635027",
"0.7599006",
"0.7548684",
"0.74594766",
"0.74524945",
"0.74522036",
"0.7418386",
"0.7385101",
"0.7382353",
"0.7366277",
"0.7342239",
"0.732854",
"0.7314729",
"0.73143077",
"0.73143077",
"0.7313697",
"0.7308... | 0.0 | -1 |
Closes the websocket connection for this shard. | async def close(self):
if self.ws is not None and not self.ws.closed:
await self.ws.close()
self.connected.clear() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self) -> None:\n if self.websocket:\n self.websocket.stop()",
"async def close(self) -> None:\n await self._ws.close()\n await self._session.close()\n await sleep(0.25)",
"async def close(self):\n await self._ws.close()\n print(c[3] + '\\nTokenAnal... | [
"0.7552032",
"0.71232224",
"0.7086131",
"0.7018632",
"0.69014853",
"0.6846583",
"0.67982554",
"0.67979115",
"0.67849684",
"0.6765683",
"0.6708299",
"0.6700032",
"0.6700032",
"0.6700032",
"0.6700032",
"0.6700032",
"0.6700032",
"0.6685908",
"0.6650046",
"0.6640886",
"0.66303647... | 0.73543817 | 1 |
Extracts the short journal name from an article and tries to make it as short as possible, e.g. by removing periods as well as using some acronyms like "NMR". Returns A string with the shortest possible form. | def format_short_journalname(self):
abbrevs = {
"Nucl Magn Reson": "NMR",
}
name = self.journal_short.replace(".", "")
for long, short in abbrevs.items():
name = name.replace(long, short)
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_short_name(self):\n split = self.name.split(' - ')\n # author, year, and first couple of words of paper title\n return \"{} ({}), {}\".format(split[0], split[1], \" \".join(split[2].split(' ')[:3]))",
"def shorten(name):\r\n nameSplit = name.split()\r\n if len(nameSplit)<=2:\r\... | [
"0.6859404",
"0.67450255",
"0.6420121",
"0.6292563",
"0.6213997",
"0.6177971",
"0.6154647",
"0.6140014",
"0.61316615",
"0.6029689",
"0.59775734",
"0.59212947",
"0.5920908",
"0.59196657",
"0.58914906",
"0.58914906",
"0.58914906",
"0.58914906",
"0.58914906",
"0.58914906",
"0.58... | 0.751069 | 0 |
Cross product of vectors x and y (x X y). | def cross(x, y):
x = x.reshape(3)
y = y.reshape(3)
z = np.cross(x, y)
z = z.reshape((3, 1))
return z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vector_cross(x, y):\n\n if(len(x) != len(y)):\n raise ValueError(\"vector lengths differ\")\n elif(len(x) > 3):\n raise ValueError(\"vector is more than 3D\")\n else:\n s = [x[1] * y[2] - x[2] * y[1],\n x[2] * y[0] - x[0] * y[2],\n x[0] * y[1] - x[1] * y[0]... | [
"0.8253104",
"0.7644323",
"0.7577485",
"0.7486007",
"0.742213",
"0.74136347",
"0.7330385",
"0.72719",
"0.7266536",
"0.72530705",
"0.7178448",
"0.71754926",
"0.7161348",
"0.71606016",
"0.7155566",
"0.71348256",
"0.71159345",
"0.7083621",
"0.69807464",
"0.6967848",
"0.6873497",... | 0.77539825 | 1 |
This chomp cleans up all whitespace, not just at the ends | def chomp(string):
string = str(string)
response = string.replace("\n", " ") # Convert line ends to spaces
response = re.sub(
" [ ]*", " ", response
) # Truncate multiple spaces to single space
response = re.sub("^[ ]*", "", response) # Clean start
return re.sub("[ ]*$", "", response)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chomp(s):\n if s[-2:] == b'\\r\\n':\n return s[:-2]\n if s[-1:] == b'\\r' or s[-1:] == b'\\n':\n return s[:-1]\n return s",
"def chomp(text: str) -> str:\n return \"\\n\".join([x.rstrip() for x in text.splitlines()])",
"def chomp(string):\n if string.endswith(\"\\r\\n\"):\n ... | [
"0.75850135",
"0.7417964",
"0.72117174",
"0.7027501",
"0.6091694",
"0.5949969",
"0.5903258",
"0.58799934",
"0.58745813",
"0.58224577",
"0.5772715",
"0.57716656",
"0.5763179",
"0.5708482",
"0.5680492",
"0.56752133",
"0.56725",
"0.566395",
"0.5644338",
"0.56439286",
"0.564118",... | 0.6967529 | 4 |
Creates a new instance of ThreeCardPokerHand hand and initializes it with 3 cards from the deck. An optional name argument can be used to specify the name of the player. Returns the instance of ThreeCardPokerHand thus created | def deal_hand(self, name=""):
hand = ThreeCardPokerHand(self.pop_cards(3), name)
return hand | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hand():\n return PokerHand()",
"def __init__(self, *names):\n deck = Deck.create(shuffle=True)\n self.names = (list(names) + \"P1 P2 P3 P4 \".split())[:4]\n self.hands = {\n n: Player(n, h) for n, h in zip(self.names, deck.deal(4))\n }",
"def new_hand(self):\n ... | [
"0.62812114",
"0.6159548",
"0.5867741",
"0.585162",
"0.565696",
"0.56469536",
"0.55431014",
"0.539126",
"0.5367867",
"0.5353292",
"0.5316438",
"0.5298214",
"0.52830684",
"0.5240952",
"0.51910734",
"0.5190784",
"0.51556116",
"0.5137263",
"0.50671476",
"0.5057475",
"0.50037706"... | 0.76750696 | 0 |
self, this instance of ThreeCardPokerHand Returns a string representation of self. | def get_label(self):
return ThreeCardPokerHand.all_labels[self.rank] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n string = \"Hand contains \"\n h = self.hand\n \n for i in range(len(h)):\n string += str(h[i].get_suit()) + str(h[i].get_rank()) + \" \"\n \n return string",
"def __str__(self):\n return Hand.__str__(self) + '\\nHand Rank: ' + self.... | [
"0.80102044",
"0.79516315",
"0.7828795",
"0.7692815",
"0.7673958",
"0.75138146",
"0.74803424",
"0.74427634",
"0.742884",
"0.73725396",
"0.7356676",
"0.7356676",
"0.73255235",
"0.729841",
"0.7232768",
"0.721787",
"0.7214845",
"0.71724916",
"0.7165149",
"0.7148201",
"0.7145725"... | 0.0 | -1 |
Frees any resources used by the environment. Implment this method for an environment backed by an external process. This method can be used directly ```python env = Env(...) Use env env.close() ``` or via a context manager ```python | def close(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_env(self):\n self.env.close()",
"def close(self): \n\t\tself.env.close()",
"def terminate(self):\n super(ReacherEnv, self).close()",
"def close(self):\n if self.__env:\n self.__env.close()\n self.__env = None\n super(DiskCache, self).close()",
"de... | [
"0.77267617",
"0.71810836",
"0.71335083",
"0.7130488",
"0.6724193",
"0.6541249",
"0.64747053",
"0.6434013",
"0.63926244",
"0.6368741",
"0.63595897",
"0.6322921",
"0.6322921",
"0.6287656",
"0.6266001",
"0.61428523",
"0.6134034",
"0.60737187",
"0.6032879",
"0.5990569",
"0.59668... | 0.0 | -1 |
Gather LEAPP_DEVEL environment variables and respective mappings to provide them as messages to be available after reboot. | def get_env_vars():
env_vars = []
leapp_vars = {k: v for (k, v) in os.environ.items() if k.startswith('LEAPP_') and k not in ENV_IGNORE}
for k, v in leapp_vars.items():
if k in ENV_MAPPING:
env_vars.append(EnvVar(name=ENV_MAPPING.get(k), value=v))
continue
env_vars.ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_env(request):\n env = {\"LOGIN_URL\": django_settings.LOGIN_URL,\n \"REDIRECT_FIELD_NAME\": getattr(django_settings, \"REDIRECT_FIELD_NAME\", \"next\"),\n \"LOGOUT_URL\": django_settings.LOGOUT_URL}\n # if hasattr(settings, \"SERVER_MAINTENANCE_MESSAGE\"):\n # env[\"SERVER... | [
"0.6153674",
"0.6125907",
"0.5958238",
"0.5866157",
"0.5827407",
"0.56990135",
"0.564663",
"0.55449957",
"0.54862857",
"0.5481874",
"0.54789394",
"0.54558414",
"0.53889513",
"0.5388586",
"0.5385009",
"0.5318291",
"0.5299448",
"0.52980053",
"0.5294099",
"0.5288364",
"0.5280595... | 0.633242 | 0 |
Get version and release of the currently used kernel in one string. | def get_booted_kernel():
try:
return run(['/usr/bin/uname', '-r'])['stdout'].strip()
except CalledProcessError as e:
raise StopActorExecutionError(
message='Unable to obtain release of the booted kernel.',
details={'details': str(e), 'stderr': e.stderr}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rhel_kernel(packages, kernel_version, current_version):\n return _rhel_kernel_info(packages, kernel_version, current_version)[\"version\"]",
"def getLibVersion():\n return \"Software Development Library for Linux 1.999.1\"",
"def systemversionstr():\n return platform.uname().system",
"def get_os... | [
"0.68217486",
"0.675402",
"0.67496544",
"0.6712842",
"0.6708168",
"0.6561247",
"0.65611356",
"0.65565073",
"0.65048045",
"0.65045476",
"0.6502208",
"0.64824873",
"0.6469865",
"0.6450935",
"0.63436705",
"0.6333805",
"0.63116515",
"0.6310959",
"0.62606496",
"0.6253956",
"0.6238... | 0.62603086 | 19 |
Returns the target version for the given `flavour` of upgrade. The default value for `flavour` is `default`. In case the environment variable `LEAPP_DEVEL_TARGET_RELEASE` is set, the value of it will be returned. | def get_target_version(flavour=LEAPP_UPGRADE_FLAVOUR_DEFAULT):
current_target_version = CURRENT_TARGET_VERSION
if flavour == LEAPP_UPGRADE_FLAVOUR_SAP_HANA:
current_target_version = CURRENT_SAP_HANA_TARGET_VERSION
return os.getenv('LEAPP_DEVEL_TARGET_RELEASE', None) or current_target_version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_upgrade_flavour():\n if detect_sap_hana():\n return LEAPP_UPGRADE_FLAVOUR_SAP_HANA\n return LEAPP_UPGRADE_FLAVOUR_DEFAULT",
"def get_upgrade_flavour():\n if detect_sap_hana():\n return LEAPP_UPGRADE_FLAVOUR_SAP_HANA\n return LEAPP_UPGRADE_FLAVOUR_DEFAULT",
"def get_supported_t... | [
"0.65795887",
"0.65795887",
"0.61892074",
"0.5829777",
"0.54041076",
"0.5268127",
"0.51651967",
"0.514662",
"0.51346916",
"0.50944763",
"0.5078364",
"0.50449115",
"0.5015853",
"0.49779087",
"0.49453533",
"0.49376157",
"0.4934938",
"0.48960614",
"0.48958802",
"0.4847216",
"0.4... | 0.8691227 | 0 |
Returns True if work in (value, work) tuple subInfo1 is LESS than than work in (value, work) tuple in subInfo2 | def cmpWork(subInfo1, subInfo2):
work1 = subInfo1[WORK]
work2 = subInfo2[WORK]
return work1 < work2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmpValue(subInfo1, subInfo2):\n val1 = subInfo1[VALUE]\n val2 = subInfo2[VALUE]\n return val1 > val2",
"def cmpValue(subInfo1, subInfo2):\n val1 = subInfo1[VALUE]\n val2 = subInfo2[VALUE]\n return val1 > val2",
"def cmpRatio(subInfo1, subInfo2):\n val1 = subInfo1[VALUE]\n val2 = s... | [
"0.6941326",
"0.6941326",
"0.6516656",
"0.6516656",
"0.59197474",
"0.5916753",
"0.5853075",
"0.5806229",
"0.5785417",
"0.575454",
"0.5725809",
"0.5662219",
"0.5658478",
"0.56561846",
"0.5650557",
"0.5640676",
"0.561755",
"0.5607638",
"0.5585275",
"0.5560231",
"0.5559235",
"... | 0.7840667 | 1 |
Returns True if value/work in (value, work) tuple subInfo1 is GREATER than value/work in (value, work) tuple in subInfo2 | def cmpRatio(subInfo1, subInfo2):
val1 = subInfo1[VALUE]
val2 = subInfo2[VALUE]
work1 = subInfo1[WORK]
work2 = subInfo2[WORK]
return float(val1) / work1 > float(val2) / work2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmpWork(subInfo1, subInfo2):\n work1 = subInfo1[WORK]\n work2 = subInfo2[WORK]\n return work1 < work2",
"def cmpWork(subInfo1, subInfo2):\n work1 = subInfo1[WORK]\n work2 = subInfo2[WORK]\n return work1 < work2",
"def cmpValue(subInfo1, subInfo2):\n val1 = subInfo1[VALUE]\n val2 =... | [
"0.7639086",
"0.7639086",
"0.7572213",
"0.7572213",
"0.62580526",
"0.60452",
"0.60010815",
"0.59631205",
"0.5930433",
"0.5889936",
"0.5856163",
"0.58300894",
"0.5827596",
"0.58262455",
"0.5824282",
"0.5822037",
"0.58161736",
"0.58103704",
"0.57853055",
"0.57611984",
"0.576002... | 0.6505479 | 5 |
Perform tile shift to the left. | def shiftLeft(board):
# remove 0's in between numbers
for i in range(4):
nums, count = [], 0
for j in range(4):
if board[i][j] != 0:
nums.append(board[i][j])
count += 1
board[i] = nums
for x in range(4 - count):
board[i].append(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_left(self):\n self.pointer = (self.pointer - 1) % len(self.data)",
"def left_shift_quirk(self):\n register = self.return_middle_registers(self.opcode)\n bits = self.registers[register[1]]\n self.registers[0xF] = bits & 0x80\n self.registers[register[0]] = self.registe... | [
"0.7490282",
"0.71976835",
"0.70823294",
"0.6930971",
"0.6926509",
"0.67835623",
"0.67789805",
"0.6762947",
"0.6739872",
"0.67125225",
"0.6688423",
"0.6674855",
"0.6672681",
"0.6639136",
"0.6589616",
"0.654085",
"0.6517519",
"0.6503294",
"0.6499925",
"0.649521",
"0.64898837",... | 0.61685944 | 48 |
Perform tile shift to the right. | def shiftRight(board):
# remove 0's in between numbers
for i in range(4):
nums, count = [], 0
for j in range(4):
if board[i][j] != 0:
nums.append(board[i][j])
count += 1
board[i] = [0] * (4 - count)
for x in range(4 - count):
board[i] = [0] + board[i] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_right(self):\n self.pointer = (self.pointer + 1) % len(self.data)",
"def right(self):\n self.move(1,0)",
"def right_shift_quirk(self):\n register = self.return_middle_registers(self.opcode)\n bits = self.registers[register[1]]\n self.registers[0xF] = bits & 0b1\n ... | [
"0.75004125",
"0.70475173",
"0.70084214",
"0.68790865",
"0.681056",
"0.6781113",
"0.6772117",
"0.675851",
"0.67558837",
"0.6696607",
"0.66867423",
"0.6666849",
"0.664968",
"0.6629139",
"0.6627178",
"0.6624465",
"0.6612671",
"0.66085684",
"0.65902627",
"0.6574431",
"0.6572077"... | 0.6165581 | 47 |
The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lowercase letters only. | def account_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "account_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_account_name(self) -> str:\n return pulumi.get(self, \"storage_account_name\")",
"def get_azure_storage_account_name(self):\n try:\n account = self.instance_metadata.get_tags()['bkp_storage_account']\n logging.debug(\"Using storage account name from instance metada... | [
"0.76040643",
"0.70352215",
"0.6905831",
"0.65804124",
"0.65323865",
"0.65323865",
"0.64580536",
"0.6436745",
"0.6312828",
"0.6281443",
"0.62698007",
"0.62089103",
"0.62089103",
"0.62089103",
"0.62089103",
"0.62089103",
"0.62089103",
"0.62089103",
"0.62089103",
"0.62089103",
... | 0.59701735 | 67 |
The name of the resource group within the user's subscription. The name is case insensitive. | def resource_group_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def resource_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_gr... | [
"0.82611394",
"0.7919444",
"0.78968805",
"0.78968805",
"0.78968805",
"0.78968805",
"0.78968805",
"0.78968805",
"0.78968805",
"0.78968805",
"0.78968805",
"0.78968805",
"0.78968805",
"0.78968805",
"0.78594595",
"0.7789009",
"0.7789009",
"0.7789009",
"0.7789009",
"0.7789009",
"0... | 0.77774495 | 55 |
The blob service properties for container soft delete. | def container_delete_retention_policy(self) -> Optional[pulumi.Input['DeleteRetentionPolicyArgs']]:
return pulumi.get(self, "container_delete_retention_policy") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def soft_delete_settings(self) -> Optional[pulumi.Input['SoftDeleteSettingsArgs']]:\n return pulumi.get(self, \"soft_delete_settings\")",
"def soft_delete_settings(self) -> Optional['outputs.SoftDeleteSettingsResponse']:\n return pulumi.get(self, \"soft_delete_settings\")",
"def json_properties(s... | [
"0.58729863",
"0.5822713",
"0.5810114",
"0.5571163",
"0.5416586",
"0.53833646",
"0.5285164",
"0.51845956",
"0.51393545",
"0.5137164",
"0.51287633",
"0.5026035",
"0.4942347",
"0.49041036",
"0.48868552",
"0.48839828",
"0.48491764",
"0.48159507",
"0.47983056",
"0.4794265",
"0.47... | 0.0 | -1 |
The blob service properties for blob soft delete. | def delete_retention_policy(self) -> Optional[pulumi.Input['DeleteRetentionPolicyArgs']]:
return pulumi.get(self, "delete_retention_policy") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_properties(self):\n properties = Jsonifiable.json_properties(self)\n properties.remove('image_blob_key')\n return properties",
"def delete(self):\n if \"delete\" in self._prop_dict:\n return self._prop_dict[\"delete\"]\n else:\n return None",
"def soft_dele... | [
"0.58196825",
"0.57607853",
"0.5686614",
"0.5665609",
"0.5436184",
"0.5285105",
"0.51866484",
"0.5074914",
"0.50614053",
"0.5045784",
"0.50319624",
"0.5020171",
"0.5007856",
"0.50070876",
"0.5004452",
"0.4973736",
"0.4891429",
"0.48835954",
"0.48723358",
"0.4860802",
"0.48394... | 0.0 | -1 |
The blob service properties for container soft delete. | def container_delete_retention_policy(self) -> pulumi.Output[Optional['outputs.DeleteRetentionPolicyResponse']]:
return pulumi.get(self, "container_delete_retention_policy") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def soft_delete_settings(self) -> Optional[pulumi.Input['SoftDeleteSettingsArgs']]:\n return pulumi.get(self, \"soft_delete_settings\")",
"def soft_delete_settings(self) -> Optional['outputs.SoftDeleteSettingsResponse']:\n return pulumi.get(self, \"soft_delete_settings\")",
"def json_properties(s... | [
"0.5871011",
"0.58212394",
"0.58114505",
"0.557274",
"0.5416567",
"0.53833884",
"0.52842855",
"0.518384",
"0.51390135",
"0.5136513",
"0.51291025",
"0.50259143",
"0.4942759",
"0.49040335",
"0.48885664",
"0.48851335",
"0.48477927",
"0.48152062",
"0.47982684",
"0.47930747",
"0.4... | 0.43915412 | 88 |
The blob service properties for blob soft delete. | def delete_retention_policy(self) -> pulumi.Output[Optional['outputs.DeleteRetentionPolicyResponse']]:
return pulumi.get(self, "delete_retention_policy") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_properties(self):\n properties = Jsonifiable.json_properties(self)\n properties.remove('image_blob_key')\n return properties",
"def delete(self):\n if \"delete\" in self._prop_dict:\n return self._prop_dict[\"delete\"]\n else:\n return None",
"def soft_dele... | [
"0.58196825",
"0.57607853",
"0.5686614",
"0.5665609",
"0.5436184",
"0.5285105",
"0.51866484",
"0.5074914",
"0.50614053",
"0.5045784",
"0.50319624",
"0.5020171",
"0.5007856",
"0.50070876",
"0.5004452",
"0.4973736",
"0.4891429",
"0.48835954",
"0.48723358",
"0.4860802",
"0.48394... | 0.0 | -1 |
Sku name and tier. | def sku(self) -> pulumi.Output['outputs.SkuResponse']:
return pulumi.get(self, "sku") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")",
"def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")",
"def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")",
"def name(self) -> pulumi.Input['SkuName']:\n return pulumi.get(self, \"... | [
"0.74665993",
"0.74665993",
"0.74665993",
"0.7337159",
"0.71235085",
"0.70850027",
"0.69840217",
"0.69840217",
"0.6977929",
"0.69692177",
"0.6931419",
"0.6931419",
"0.6878652",
"0.68505",
"0.6830299",
"0.67964286",
"0.67964286",
"0.6738833",
"0.66704595",
"0.66463995",
"0.664... | 0.6767385 | 17 |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | def type(self) -> pulumi.Output[str]:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")",
"def ... | [
"0.7919224",
"0.7919224",
"0.7866745",
"0.7866745",
"0.7866745",
"0.7866745",
"0.7866745",
"0.77080005",
"0.75534594",
"0.72829205",
"0.7059116",
"0.69795716",
"0.6921357",
"0.6870514",
"0.67292506",
"0.6704277",
"0.66535586",
"0.66464674",
"0.66392237",
"0.66392237",
"0.6639... | 0.0 | -1 |
Return a string representation of the given key, in the current namespace | def _dumpKey(self, key):
return self.serializer.dumpKey((self.path, self._internalNs, key)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_to_string(cls, key):\n return '_'.join(map(str, key))",
"def get_namespace(key):\n\tif key not in REGISTRY:\n\t\traise KeyError(\"key:{0} does not exist\".format(key))\n\n\treturn REGISTRY[key]",
"def serialize_key(key) -> str:\n if not isinstance(key, str):\n key = repr(key)\n retu... | [
"0.7482419",
"0.69254124",
"0.6781267",
"0.67623127",
"0.67007834",
"0.6659845",
"0.6607625",
"0.6604661",
"0.6589089",
"0.6528582",
"0.6495888",
"0.6462549",
"0.64370334",
"0.6391658",
"0.638791",
"0.6318776",
"0.6318776",
"0.6309116",
"0.63026375",
"0.6299322",
"0.6299322",... | 0.6442385 | 12 |
Delete the 'n' oldest items from the RingBuffer. This does not return the items first, this should be done with the iterators and other functions below. | def pop(self, n):
try:
self._load(False)
except KeyError:
return
# Delete the items we no longer need,
# and most importantly decrease self.count
key = (self.head - self.count) % self.size
while n > 0 and self.count > 0:
del self.db[ke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop(iterable, n, islice=islice):\n return islice(iterable, n, None)",
"def _popN(self, n):\n for _ in range(n):\n self._buffer.popleft()",
"def _remove_old_items(self):\n if self.size_limit is not None:\n while len(self) > self.size_limit:\n self.popit... | [
"0.69509923",
"0.67833996",
"0.6569394",
"0.6516168",
"0.6512111",
"0.6430666",
"0.63899845",
"0.6302182",
"0.62365097",
"0.6152814",
"0.61250967",
"0.6109891",
"0.5985351",
"0.5985351",
"0.59616077",
"0.59616077",
"0.5951178",
"0.5924924",
"0.5835084",
"0.58158106",
"0.58041... | 0.66903204 | 2 |
Compute the fitting residual. | def fitting_residual(x: np.ndarray, y: np.ndarray, func, args, mask_min: float = None,
standardized: bool = False) -> np.ndarray:
y_predict = func(x, *args)
res = np.subtract(y, y_predict)
norm = np.std(res)
if mask_min is not None:
res[np.where(abs(res) < mask_min)] = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _residual_edp(self, params):\n data = self.F**2\n model = np.absolute(self._model())**2\n sigma = self.sigma\n return (data[self.mask]-model[self.mask]) / sigma[self.mask] \n \n # The following three lines do not reproduce Sun's results, which proves\n # that the fits were done through... | [
"0.77149254",
"0.76598066",
"0.7580847",
"0.75157326",
"0.74911386",
"0.74642974",
"0.73828006",
"0.73809963",
"0.73585844",
"0.72532415",
"0.7250003",
"0.7231905",
"0.7171786",
"0.71519005",
"0.71165246",
"0.7074422",
"0.7045101",
"0.7018788",
"0.6997359",
"0.69888496",
"0.6... | 0.6364999 | 55 |
Returns True if and only if the other vector clock contains a single component for which the value is 1 more, with all other components being equal. | def isImmediatelyFollowedBy(self, other):
self._mergeKeys(other)
self._binaryOperationCheck(other)
offsetsOfOne = 0
equalities = 0
for id in self.clock.keys():
if (self.clock[id] + 1) == other.clock[id]:
offsetsOfOne += 1
elif self.clock[id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n s = len(self)\n r = len(other)\n\n if s != r:\n raise(VetorError, \"Vetor dimensions are not equal\")\n\n # Two vectors are numericaly the same if the difference\n # between both of them are smaller than given precisao\n for i in range... | [
"0.686257",
"0.68200177",
"0.67759395",
"0.66619694",
"0.6591493",
"0.65701526",
"0.6543006",
"0.6517859",
"0.6505405",
"0.6493156",
"0.6490717",
"0.6475473",
"0.64457166",
"0.6434424",
"0.6417604",
"0.64114386",
"0.6408446",
"0.6378051",
"0.6377402",
"0.63550943",
"0.6353196... | 0.6106351 | 55 |
Returns True if and only if the other vector clock contains a single component for which the value is 1 more, another single component for which the value is 1 less and with all other components being equal. | def _isImmediatelyConcurrentWithHelper(self, other):
self._mergeKeys(other)
self._binaryOperationCheck(other)
offsetsOfPlusOne = 0
offsetsOfMinusOne = 0
equalities = 0
for id in self.clock.keys():
if (self.clock[id] + 1) == other.clock[id]:
off... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n s = len(self)\n r = len(other)\n\n if s != r:\n raise(VetorError, \"Vetor dimensions are not equal\")\n\n # Two vectors are numericaly the same if the difference\n # between both of them are smaller than given precisao\n for i in range... | [
"0.6749273",
"0.66650057",
"0.6543656",
"0.64863086",
"0.63923055",
"0.6372751",
"0.63635236",
"0.6329362",
"0.63267475",
"0.6288266",
"0.6283633",
"0.62700045",
"0.6269411",
"0.6268359",
"0.6265669",
"0.62650687",
"0.62427324",
"0.62272274",
"0.6222528",
"0.6222438",
"0.6216... | 0.6288044 | 10 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(tipCoords, self).__init__(*args, **kwds)
# message fields cannot be None, assign default values for those that are
if self.thumb is None:
self.thumb = [0.] * 3
if self.index is None:
self.index = [0.] * 3
if self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.77944714",
"0.77215654",
"0.77215654",
"0.76878554",
"0.762691",
"0.7565032",
"0.744052",
"0.7418174",
"0.73521847",
"0.7309203",
"0.72811013",
"0.7238687",
"0.7227824",
"0.7225277",
"0.7225277",
"0.7219933",
"0.72126967",
"0.72126967",
"0.72126967",
"0.72126967",
"0.72126... | 0.0 | -1 |
Get vocab for caption text encoder. | def get_vocab():
if data_dir is not None and vocab_filename is not None:
vocab_filepath = os.path.join(data_dir, vocab_filename)
if tf.gfile.Exists(vocab_filepath):
tf.logging.info("Found vocab file: %s", vocab_filepath)
vocab_symbolizer = text_encoder.SubwordTextEncoder(vocab_filepath)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vocab(self) -> Vocabulary:\n return self._model.vocab",
"def vocab():\n symbols = DEFAULT_SPECIAL_SYMBOLS + [\"mouse\", \"dog\", \"tree\"]\n return Vocabulary(symbols)",
"def vocab(self: TokenMatcher) -> Vocab:\n return self._searcher.vocab",
"def _create_vocab(captions):\n print(\"C... | [
"0.6867589",
"0.67518795",
"0.66784275",
"0.6568083",
"0.63018495",
"0.6248969",
"0.6220727",
"0.61795735",
"0.61184263",
"0.6021287",
"0.5983408",
"0.5925993",
"0.58869845",
"0.5864438",
"0.5803492",
"0.5800871",
"0.578662",
"0.57644427",
"0.5713604",
"0.5666052",
"0.5662668... | 0.6642546 | 3 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def lr_setter(optimizer, epoch, args, bl=False):
lr = args.lr
if bl:
lr = args.lrbl * (0.1 ** (epoch // (args.epochb * 0.5)))
else:
if args.cos:
lr *= ((0.01 + math.cos(0.5 * (math.pi * epoch / args.epochs))) / 1.01)
else:
if epoch >= args.epochs_decay[0]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.7913536",
"0.7906521",
"0.7849834",
"0.777524",
"0.77338326",
"0.77306354",
"0.7722718",
"0.77224237",
"0.771982",
"0.77092624",
"0.7693604",
"0.76742035",
"0.7665748",
"0.7665748",
"0.7665748",
"0.7655329",
"0.76419765",
"0.76399755",
"0.7637868",
"0.7626077",
"0.76247585... | 0.0 | -1 |
Test if the Login views return a 200 response | def test_if_get_redirect_return_username_name_of_user(client, user):
user = user
url = reverse("users:detail", kwargs={"username": user.username})
assert url == reverse("users:detail", kwargs={"username": user.username}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_login_route_is_status_ok(self):\n response = self.client.get(\"/login/\")\n self.assertTrue(response.status_code == 200)",
"def test_if_login_views_is_successful(client):\n\n url = reverse(\"users:login\")\n response = client.get(url)\n assert response.status_code == 200",
"def ... | [
"0.79660004",
"0.775815",
"0.7656775",
"0.75793016",
"0.7578524",
"0.7562713",
"0.75212336",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
"0.7455541",
... | 0.0 | -1 |
Test if the Login views return a 200 response | def test_if_login_views_is_successful(client):
url = reverse("users:login")
response = client.get(url)
assert response.status_code == 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_login_route_is_status_ok(self):\n response = self.client.get(\"/login/\")\n self.assertTrue(response.status_code == 200)",
"def test_login_response(self):\n response = self.client.get(reverse('cookbook:login'))\n self.assertEqual(response.status_code, 200)",
"def test_login... | [
"0.796571",
"0.76565546",
"0.75780493",
"0.7577545",
"0.7561448",
"0.75198495",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
"0.745522",
... | 0.7757447 | 1 |
Test if views related to an authenticated user return 200 response | def test_if_views_with_authenticated_client_is_successful(
client,
django_user_model,
path_to_test,
user,
):
user = django
client.force_login(user)
url = reverse(path_to_test)
response = client.get(url)
assert response.status_code == 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_auth_user_calls_auth_route_ok(self):\n response = self.client.get(reverse('reservation'))\n self.assertEquals(response.status_code, HTTPStatus.OK)",
"def test_view(self):\n self.assertEqual(status.HTTP_200_OK, self.response.status_code)",
"def test_home_view_is_status_ok(self):\n ... | [
"0.68311995",
"0.6767263",
"0.67593616",
"0.6728728",
"0.67193824",
"0.669967",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
"0.6675807",
... | 0.6811474 | 1 |
Test if the home return a 200 response | def test_if_home_is_successful(client):
url = reverse("home")
response = client.get(url)
assert response.status_code == 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_status(response):\n if response.status_code == 200:\n return True",
"def is_ok(r) -> bool:\n\tif r.status_code == 200:\n\t\treturn True",
"def test_status_home(self):\n self.assertEqual(200, self.response.status_code)",
"def test_home_status_code(self):\n result = self.app.g... | [
"0.81846404",
"0.8149933",
"0.81347984",
"0.7962525",
"0.7960379",
"0.79017437",
"0.7895553",
"0.77496475",
"0.7724115",
"0.767836",
"0.7669173",
"0.75683975",
"0.7501012",
"0.74826205",
"0.7463279",
"0.74566317",
"0.7428604",
"0.7426436",
"0.7426436",
"0.7426436",
"0.7426436... | 0.70674056 | 67 |
returns the player object for the player who has the highest average poison value | def get_best_player_to_poison(self, players_not_to_poison):
best_player = self.dict_of_players[0]
for each_key in self.dict_of_players.keys():
if self.dict_of_players[each_key] in players_not_to_poison:
pass
else:
if self.dict_of_players[each_key]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player_best_score(self, player):\n return self.get_highscores().filter(player=player).first()",
"def winner(self) -> Player:\n return max(self.players, key=lambda player: player.score)",
"def max_score(self):\n return self.points",
"def getNextHighest(self):\r\n maxScore =... | [
"0.743164",
"0.7237361",
"0.67165524",
"0.66547155",
"0.66533244",
"0.664595",
"0.6641614",
"0.66404027",
"0.6578087",
"0.6531178",
"0.64345986",
"0.6402244",
"0.6389983",
"0.6341968",
"0.6307974",
"0.62771",
"0.6272302",
"0.62068164",
"0.61850226",
"0.61714745",
"0.61700684"... | 0.0 | -1 |
Formats a date according to the current locale. Wraps around babel.dates.format_date. | def l10n_format_date(ctx, date, format='long'):
lang = get_locale(ctx['LANG'])
if date:
return format_date(date, locale=lang, format=format)
else:
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_date(d, fmt):\n return babel_format_date(\n d, fmt, locale=to_locale(translation.get_language()))",
"def format_date(date, date_format_override=None):\n\n global date_format\n\n return datetime.datetime.strptime(date, '%Y-%m-%d').strftime(date_format_override or date_format)",
"def f... | [
"0.789891",
"0.698472",
"0.695882",
"0.65176207",
"0.64377284",
"0.64266753",
"0.6380313",
"0.63566047",
"0.63497263",
"0.6295721",
"0.6237961",
"0.6223037",
"0.61959803",
"0.6183764",
"0.6115179",
"0.609781",
"0.60962766",
"0.609245",
"0.6088271",
"0.6084785",
"0.6082809",
... | 0.7758324 | 1 |
Iterate sequences by pairs. | def pairwise(iterable: Iterable[Any]) -> Iterable[Any]:
a, b = tee(iterable)
next(b, None)
return zip(a, b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairs(lst):\r\n\tfor i in range(1, len(lst), 2):\r\n\t\tyield lst[i-1], lst[i]",
"def pairs(lst):\n i = iter(lst)\n prev = next(i)\n for item in i:\n yield prev, item\n prev = item",
"def iter_over_pairs(pairs):\r\n if isinstance(pairs, dict):\r\n return pairs.iteritems()\r... | [
"0.7101228",
"0.6777809",
"0.66968924",
"0.6677832",
"0.66705245",
"0.6626198",
"0.6602611",
"0.659599",
"0.6417929",
"0.64155847",
"0.6389326",
"0.6385976",
"0.6333147",
"0.61668384",
"0.6162052",
"0.6101216",
"0.6063804",
"0.59910125",
"0.59837884",
"0.5979951",
"0.5965963"... | 0.57549036 | 40 |
On Unix we only have to "open url" dialog | def openfile_callback(self):
self.open_callback() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(url):\r\n webbrowser.open(url)",
"def openurl(url):\n\n # Open the URL\n webbrowser.open(url)",
"def browser_open(url):\n FNULL = open(os.devnull, 'w')\n subprocess.Popen([udata.browser, url], stdout=FNULL, stderr=subprocess.STDOUT )",
"def open(self, event=None, url=None):\n ... | [
"0.73839885",
"0.7136563",
"0.71100205",
"0.70496947",
"0.7008425",
"0.69019234",
"0.68413824",
"0.6820067",
"0.67915493",
"0.67227334",
"0.6708889",
"0.6701866",
"0.6680681",
"0.66749835",
"0.6673651",
"0.6611418",
"0.65915626",
"0.65760857",
"0.6561634",
"0.6537319",
"0.651... | 0.0 | -1 |
Gets `max_grains` input of GrainSin. | def max_grains(self):
index = self._ordered_input_names.index('max_grains')
return self._inputs[index] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_surge(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max_surge\")",
"def max_in_gbps(self):\n return self._max_in_gbps",
"def max_in_gbps(self, max_in_gbps):\n self._max_in_gbps = max_in_gbps",
"def max_surge(self) -> Optional[pulumi.Input[str]]:\n retur... | [
"0.61167717",
"0.6091716",
"0.5798701",
"0.5790639",
"0.5752137",
"0.5733255",
"0.5707946",
"0.57055986",
"0.56940657",
"0.56934345",
"0.5688155",
"0.5688155",
"0.55956244",
"0.5591844",
"0.55832785",
"0.5568565",
"0.55685604",
"0.54790264",
"0.5476801",
"0.5456345",
"0.54497... | 0.80358887 | 0 |
Gets `pan` input of GrainSin. | def pan(self):
index = self._ordered_input_names.index('pan')
return self._inputs[index] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pans(self):\n return self.pan",
"def pan(self):\n return self._pan",
"def partial_pan(self):\n return self.__partial_pan",
"def get_position(self, is_radian=None):\r\n return self._arm.get_position(is_radian=is_radian)",
"def _psi_ ( self ) :\n return psis",
"def ps... | [
"0.66379076",
"0.62576336",
"0.5501979",
"0.51387596",
"0.5085432",
"0.5059569",
"0.4969411",
"0.49051702",
"0.49020115",
"0.48475397",
"0.48322684",
"0.48160127",
"0.4788551",
"0.47740322",
"0.47661543",
"0.47650158",
"0.47550225",
"0.47143513",
"0.4696721",
"0.4683401",
"0.... | 0.6967334 | 0 |
Creates a recurrent model with a partially reconstructed embedding layer. Constructs a recurrent model for next word prediction, with the embedding | def create_recurrent_reconstruction_model(
vocab_size: int = 10000,
num_oov_buckets: int = 1,
embedding_size: int = 96,
latent_size: int = 670,
num_layers: int = 1,
input_spec=None,
global_variables_only: bool = False,
name: str = 'rnn_recon_embeddings',
) -> reconstruction_model.Reconst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_model(vocab_size, embedding_dim, rnn_units, batch_size):\n model=tf.keras.Sequential([\n \n tf.keras.layers.Embedding(vocab_size, embedding_dim, batch_input_shape=[batch_size, None]),\n rnn(rnn_units, return_sequences=True, recurrent_initializer='glorot_uniform', stateful=True),\n ... | [
"0.6580897",
"0.6423092",
"0.6302507",
"0.62778175",
"0.6267168",
"0.62431806",
"0.6228994",
"0.6196669",
"0.61569715",
"0.6064202",
"0.60625964",
"0.6050542",
"0.60193497",
"0.59787875",
"0.59544855",
"0.5951478",
"0.5941502",
"0.5917446",
"0.5913576",
"0.5897047",
"0.589321... | 0.73125225 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.