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 |
|---|---|---|---|---|---|---|
Returns a dictionary of cluster metadata. | def GetResourceMetadata(self):
nodepools = {}
for name, nodepool in six.iteritems(self.nodepools):
nodepool_metadata = {
'size': nodepool.num_nodes,
'machine_type': nodepool.vm_config.machine_type,
'name': name,
}
if nodepool.sandbox_config is not None:
no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cluster_info(self) -> Dict[str, Any]:\n pass",
"def describe(self) -> None:\n return {\n 'cluster_metadata': self.cluster_metadata,\n 'master_url': self.master_url\n }",
"def get_cluster_entry(self):\n\n cert_data = self.cluster_description.get(\"certificateAuthority\"... | [
"0.81325597",
"0.7839424",
"0.73050076",
"0.71083295",
"0.6874517",
"0.68563604",
"0.6847371",
"0.67545813",
"0.6663398",
"0.6637318",
"0.65861917",
"0.65801597",
"0.656879",
"0.6559226",
"0.65378773",
"0.6527035",
"0.65085137",
"0.6489346",
"0.647957",
"0.6451353",
"0.644067... | 0.6089916 | 53 |
Gets a representation of the POD and returns it. | def _GetPod(self) -> Dict[str, Any]:
stdout, _, _ = RunKubectlCommand(['get', 'pod', self.name, '-o', 'yaml'])
pod = yaml.safe_load(stdout)
self.ip_address = pod.get('status', {}).get('podIP')
return pod | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_info(self):\n return {'q_ref': self.q_ref, 'v_ref': self.v_ref, 'U': self.U, 'type': 'POD'}",
"def __repr__(self):\n return self._metadata.__str__()",
"def pprint(self):\n return pformat(repr(self))",
"def to_representation(self) -> str:\n raise NotImplementedError()",
"... | [
"0.61870676",
"0.586387",
"0.5841823",
"0.5794994",
"0.57675374",
"0.5748594",
"0.5739726",
"0.5723545",
"0.57127905",
"0.570913",
"0.5693798",
"0.5668779",
"0.564856",
"0.564285",
"0.56414706",
"0.5639134",
"0.56381875",
"0.5636024",
"0.56328017",
"0.5618493",
"0.56011516",
... | 0.60387766 | 1 |
Returns a dict containing metadata about the cluster. | def GetResourceMetadata(self):
result = super().GetResourceMetadata()
if self.created:
result['container_cluster_version'] = self.k8s_version
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cluster_info(self) -> Dict[str, Any]:\n pass",
"def describe(self) -> None:\n return {\n 'cluster_metadata': self.cluster_metadata,\n 'master_url': self.master_url\n }",
"def cluster_info(self) -> ClusterInfoResult:\n if not self.connected:\n raise RuntimeEr... | [
"0.8303734",
"0.79775727",
"0.7342219",
"0.72751063",
"0.7238488",
"0.721263",
"0.68785936",
"0.6858144",
"0.67896956",
"0.6607303",
"0.65654665",
"0.6537858",
"0.653537",
"0.65257984",
"0.6460807",
"0.6460807",
"0.6456177",
"0.6430657",
"0.6426135",
"0.63857013",
"0.63801485... | 0.64438313 | 17 |
Get the default storage class for the provider. | def GetDefaultStorageClass(self) -> str:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_storage_class(self) -> Type[Storage]:\n if self.storage_class is None:\n return _get_storage_class()\n return self.storage_class",
"def storage_class(self) -> Optional[Sequence['outputs.CSIPowerStoreSpecDriverStorageClass']]:\n return pulumi.get(self, \"storage_class\")",
... | [
"0.815699",
"0.76269335",
"0.75897956",
"0.75897956",
"0.7513054",
"0.7462901",
"0.74106675",
"0.723247",
"0.7136937",
"0.7058349",
"0.7011032",
"0.69600445",
"0.694703",
"0.67005825",
"0.67005825",
"0.66840947",
"0.66700035",
"0.66671276",
"0.65681016",
"0.65066296",
"0.6465... | 0.7365023 | 7 |
This method overrides the object.__eq__ method to allow boolean equality comparison for state objects. True If two objects are of the same class. | def __eq__(self, other):
return isinstance(other, self.__class__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\r\n if other:\r\n if self.state == other.state:\r\n return True",
"def __eq__(self, other):\n if not isinstance(other, StateDetails):\n return False\n\n return self.__dict__ == other.__dict__",
"def __eq__(self, other):\n ... | [
"0.8167679",
"0.7685626",
"0.75331914",
"0.75188535",
"0.7482472",
"0.74681747",
"0.7453216",
"0.7427484",
"0.74079365",
"0.74079365",
"0.7385727",
"0.7376442",
"0.73703504",
"0.73703504",
"0.73642594",
"0.7347785",
"0.7335649",
"0.7296151",
"0.72672987",
"0.7262653",
"0.7254... | 0.73834085 | 11 |
This method overrides the object.__ne__ method to allow boolean equality comparison for state objects. True if two objects are not of the same class. | def __ne__(self, other):
return not isinstance(other, self.__class__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, obj):\n return not self.__eq__(obj)",
"def __ne__(self, other):\n return... | [
"0.82297313",
"0.8223855",
"0.8211094",
"0.7998084",
"0.7978757",
"0.7975379",
"0.79753304",
"0.7972158",
"0.7972158",
"0.7962451",
"0.7960457",
"0.7960457",
"0.7960457",
"0.7960106",
"0.79562646",
"0.79562646",
"0.79375225",
"0.79360884",
"0.79360884",
"0.79360884",
"0.79360... | 0.0 | -1 |
Return the 'index'th row of 'dataframe' as a json formated string. If 'index' is not set or out of bounds, and random row is extracted. | def get_data(dataframe,index=None):
dflen = len(dataframe)
if index==None or index <0 or index >= dflen:
index = randint(0,dflen)
return dataframe.iloc[index].to_json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row(self, index):\n return self.data[index]",
"def getFullRow(self, index):\n try:\n if len(self.data[index]) < self._numAttributes:\n for _ in range(self._numAttributes - len(self.data[index])):\n self.data[index].append(\"?\")\n return s... | [
"0.6068886",
"0.60570145",
"0.5906256",
"0.5666757",
"0.5661534",
"0.5657486",
"0.5640169",
"0.5581918",
"0.5570035",
"0.55100304",
"0.54547685",
"0.5436924",
"0.5345558",
"0.530197",
"0.52809733",
"0.52729195",
"0.5257552",
"0.52377063",
"0.5232783",
"0.51719755",
"0.5161334... | 0.813588 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.7448925 | 83 |
Given a model instance delete it from the database. | def delete_model(self, request, obj):
obj.post.comNumDrease()
obj.delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_model(self, request, instance):\n pass",
"def _delete_from_db(self, instance: DBModelInstance) -> None:\n self.db.session.delete(instance)\n self.db.session.commit()",
"def delete(self, model):\n self._isinstance(model)\n db.session.delete(model)\n db.sessio... | [
"0.8424874",
"0.83441657",
"0.8252974",
"0.8118797",
"0.8043283",
"0.787151",
"0.7687338",
"0.7529402",
"0.7498953",
"0.74603105",
"0.7428436",
"0.7338939",
"0.72842306",
"0.72842306",
"0.72652024",
"0.7239413",
"0.7220205",
"0.72134465",
"0.7184516",
"0.71829504",
"0.7182950... | 0.6595672 | 79 |
Given a model instance delete it from the database. | def delete_model(self, request, obj):
obj.post.likeNumDreacase()
obj.delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_model(self, request, instance):\n pass",
"def _delete_from_db(self, instance: DBModelInstance) -> None:\n self.db.session.delete(instance)\n self.db.session.commit()",
"def delete(self, model):\n self._isinstance(model)\n db.session.delete(model)\n db.sessio... | [
"0.8424871",
"0.8344998",
"0.82534933",
"0.81192255",
"0.80443126",
"0.7871308",
"0.76889795",
"0.7527976",
"0.7499553",
"0.7461434",
"0.74297374",
"0.7339605",
"0.7284532",
"0.7284532",
"0.72660923",
"0.7239188",
"0.72197944",
"0.721441",
"0.7184722",
"0.7183686",
"0.7183686... | 0.660896 | 77 |
Given a model instance delete it from the database. | def delete_model(self, request, obj):
From = User.objects.get(id=obj.From.id)
To = User.objects.get(id=obj.To.id)
From.following_numDe()
To.followed_numDe()
obj.delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_model(self, request, instance):\n pass",
"def _delete_from_db(self, instance: DBModelInstance) -> None:\n self.db.session.delete(instance)\n self.db.session.commit()",
"def delete(self, model):\n self._isinstance(model)\n db.session.delete(model)\n db.sessio... | [
"0.8424874",
"0.83441657",
"0.8252974",
"0.8118797",
"0.8043283",
"0.787151",
"0.7687338",
"0.7529402",
"0.7498953",
"0.74603105",
"0.7428436",
"0.7338939",
"0.72842306",
"0.72842306",
"0.72652024",
"0.7239413",
"0.7220205",
"0.72134465",
"0.7184516",
"0.71829504",
"0.7182950... | 0.0 | -1 |
returns all the lines of a text file as a list | def get_file_contents(file_name):
f = open(file_name)
lines = f.readlines()
f.close()
return lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_lines_from_file(fname):\n return []",
"def _fileLinesToList(filename) :\n o = []\n with open(filename, \"r\") as fi :\n for l in fi :\n if l.strip() != \"\" :\n o.append(l.strip())\n return o",
"def read_file_in_lines(filename):\r\n\twith open(filename) as ... | [
"0.81344944",
"0.8125869",
"0.81041867",
"0.80859476",
"0.8046068",
"0.80173784",
"0.7991323",
"0.7988973",
"0.7985511",
"0.797734",
"0.7971292",
"0.79502463",
"0.79288256",
"0.7900058",
"0.7878346",
"0.7857038",
"0.78480804",
"0.7839822",
"0.7824458",
"0.77895236",
"0.778639... | 0.70042753 | 87 |
Evaluate actions according to the current policy, given the observations. | def evaluate_actions(self, obs: torch.Tensor, actions: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
latent_pi, latent_vf = self._get_latent(obs, pi=True, vf=True)
distribution = self._get_action_dist_from_latent(latent_pi)
log_prob = distribution.log_prob(actions)
va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action(self, observations):\n observations = observations.float()\n policy_hidden = self.policy_backbone(observations)\n action = self.action_head(policy_hidden)\n return action",
"def evaluate_actions(self, obs: th.Tensor, actions: th.Tensor) -> Tuple[th.Tensor, th.Tensor, th.Ten... | [
"0.7381368",
"0.7084493",
"0.6731675",
"0.66074604",
"0.64472556",
"0.63976586",
"0.6342905",
"0.633592",
"0.6265865",
"0.62473273",
"0.619438",
"0.6188267",
"0.6177999",
"0.61156034",
"0.60967404",
"0.606553",
"0.606553",
"0.606553",
"0.6050775",
"0.6008436",
"0.5990702",
... | 0.69094974 | 2 |
Return ``g1 == g2`` for elements ``g1, g2`` of the monster. If ``mode == 0`` (default) we first try to check equality inside in the subgroup ``N_0`` of the monster, which may be considerbly faster. If ``mode != 0`` or this is not possible we check if ``v g1 g2(1) == v`` holds for the ORDER_VECTOR ``v``. We just check t... | def check_mm_equal(g1, g2, mode = 0):
assert isinstance(g1, (MM, MM0))
assert isinstance(g2, (MM, MM0))
g3 = np.zeros(2 * (g1.length + g2.length) + 1, dtype = np.uint32)
status = mm_group_words_equ(g1._data, g1.length,
g2._data, g2.length, g3)
if status < 2:
return not status
v ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_match(n1, n2):\r\n return n1['name'] == n2['name'] and n1['modes'] == n2['modes']",
"def are_same(self, value1, value2):\n (group_1, val_1) = self.get_val_tuple(value1)\n (group_2, val_2) = self.get_val_tuple(value2)\n f_aresame = Or(*[ And(self.X[group_1, val_1, idx], self.X... | [
"0.58660734",
"0.5732941",
"0.5382623",
"0.5361553",
"0.5015167",
"0.5008704",
"0.50012624",
"0.49450102",
"0.49424455",
"0.49338236",
"0.49311075",
"0.49178842",
"0.48852837",
"0.48629686",
"0.4853434",
"0.48532036",
"0.48286387",
"0.48214853",
"0.48145497",
"0.48128924",
"0... | 0.70979625 | 0 |
set mac address at (row, 1) | def set_mac_at(self, row, mac):
self.__hh_table.item(row, 1).setText(mac) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_macaddr(self):\n if not self.macaddr:\n return\n try:\n cmd = [rcEnv.syspaths.nsenter, \"--net=\"+self.netns, \"ip\", \"link\", \"set\", self.final_guest_dev, \"address\", self.macaddr]\n ret, out, err = self.vcall(cmd)\n except ex.excError:\n ... | [
"0.6857622",
"0.65099883",
"0.65041757",
"0.63588583",
"0.6256582",
"0.6164309",
"0.6143647",
"0.6119342",
"0.6042654",
"0.60135406",
"0.59927195",
"0.59927195",
"0.5981977",
"0.59596914",
"0.5922506",
"0.5915336",
"0.59116685",
"0.58847374",
"0.5857707",
"0.5847008",
"0.5845... | 0.81970847 | 0 |
Return string representation of the order object | def __str__(self):
return f'{self.order_id}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return self.order_id",
"def __str__(self):\n return f'Order: {self.size} {self.drink_name} from {self.shop}\\n' \\\n f'Details: {self.details}\\n' \\\n f'Location: {self.location}\\n' \\\n f'Contact Info: {self.customer_name}, {self.cus... | [
"0.722646",
"0.72201663",
"0.7207535",
"0.7179147",
"0.71155256",
"0.70440394",
"0.70284915",
"0.6983926",
"0.6921129",
"0.68726534",
"0.6865996",
"0.6814752",
"0.6796412",
"0.6796412",
"0.6796412",
"0.6796412",
"0.6796412",
"0.6796412",
"0.6796412",
"0.6796412",
"0.6796412",... | 0.73897535 | 0 |
Return string representation of the OrderItem object | def __str__(self):
return str(self.cost) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_item(self, order):\n return unicode(order)",
"def __str__(self):\n return f\"Order Number: {self._order_number} \" \\\n f\"Product ID: {self._product_id} \" \\\n f\"Item: {self._item_type} \" \\\n f\"Name: {self._name} \" \\\n f\"Quan... | [
"0.7825356",
"0.7621042",
"0.74094075",
"0.73542184",
"0.719905",
"0.71791834",
"0.71791834",
"0.7125467",
"0.693799",
"0.68853915",
"0.6876146",
"0.68363357",
"0.68020844",
"0.6735689",
"0.67349124",
"0.66984046",
"0.66647446",
"0.6656859",
"0.65613115",
"0.6560528",
"0.6543... | 0.0 | -1 |
Return string representation of the Tracking object | def __str__(self):
return f'{self.location}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_string(self):\n return \"{name} {status} ({tags}) {mtime}\".format(\n name=self.name, status=self.status, tags=\",\".join(self.tags),\n mtime=self.mtime\n )",
"def __str__(self):\n return str(self.serialize())",
"def __str__(self):\n struct_repr = \", \"... | [
"0.7124067",
"0.7034781",
"0.7028054",
"0.70272475",
"0.6974781",
"0.69585776",
"0.69516104",
"0.69109684",
"0.6890974",
"0.6890974",
"0.6890974",
"0.6890974",
"0.6890974",
"0.68829376",
"0.68808955",
"0.68808955",
"0.6853564",
"0.68514484",
"0.6832319",
"0.68317366",
"0.6798... | 0.0 | -1 |
Renders the about page. | def fingerprint():
conn = pymssql.connect(server, user, password, "database")
cursor = conn.cursor()
cursor.execute('SELECT COUNT(*) FROM Camera')
num=cursor.fetchone()[0]
cursor.execute('SELECT Fingerprint.Fingerprint_Id, Fingerprint.Technology, Fingerprint.SensorLocation, Company.Name, Component... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85651284",
"0.85034347",
"0.844895",
"0.84050864",
"0.8394327",
"0.82936406",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.82678735",
"0.82434386",
"0.823932... | 0.0 | -1 |
Renders the about page. | def processor():
conn = pymssql.connect(server, user, password, "database")
cursor = conn.cursor()
cursor.execute('SELECT COUNT(*) FROM Processor')
num=cursor.fetchone()[0]
cursor.execute('SELECT Processor.Processor_Id, Processor.Name, Processor.CoreCount, Processor.Architecture_nm, Company.Name, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def usb():
conn = pymssql.connect(server, user, password, "database")
cursor = conn.cursor()
cursor.execute('SELECT COUNT(*) FROM USBConnector')
num=cursor.fetchone()[0]
cursor.execute('SELECT USBConnector.USBConnector_Id, USBConnector.FormStandart, USBConnector.SpeedStandart, USBConnector.Chargin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def screen():
conn = pymssql.connect(server, user, password, "database")
cursor = conn.cursor()
cursor.execute('SELECT COUNT(*) FROM Screen')
num=cursor.fetchone()[0]
cursor.execute('SELECT Screen.Screen_Id, Screen.Resolution, Screen.Diagonal, Screen.Ratio, Screen.DisplayType, Screen.GlassType, Co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Create a new InputExample. | def __init__(self, guid, text_a, text_b=None, label=None, logits=None, meta: Optional[Dict] = None, idx=-1):
self.guid = guid
self.text_a = text_a
self.text_b = text_b
self.label = label
self.logits = logits
self.idx = idx
self.meta = meta if meta else {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_example(self, content, set_type):\n return InputExample(content=content, processor=self)",
"def create_input(self, name, service, input_format=None, description=None):\n\n if not description: description = name\n\n # Note: Format is only relevant for HTTP sources.\n # ... | [
"0.748511",
"0.66674155",
"0.650948",
"0.65067023",
"0.6451835",
"0.64472896",
"0.62072486",
"0.617486",
"0.61218333",
"0.61064744",
"0.60964704",
"0.5946348",
"0.5892325",
"0.58335555",
"0.572454",
"0.5700276",
"0.5672969",
"0.5669564",
"0.56506574",
"0.56348044",
"0.5628222... | 0.0 | -1 |
Serialize this instance to a Python dictionary. | def to_dict(self):
output = copy.deepcopy(self.__dict__)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data",
"def to_dict(self):\n return to_dict(self.__dict__)",
"def to_dict(self):\n return dumpd(self)",
"def to_dict(self):\r\n return self.__dict__",
"def to_dict(self):\n return s... | [
"0.85705614",
"0.8489506",
"0.8483257",
"0.8405309",
"0.83966506",
"0.83966506",
"0.83966506",
"0.83966506",
"0.83966506",
"0.83966506",
"0.8390355",
"0.8388496",
"0.83509785",
"0.83370554",
"0.831165",
"0.8303297",
"0.8290091",
"0.82854676",
"0.82784045",
"0.82483166",
"0.82... | 0.0 | -1 |
Serialize this instance to a JSON string. | def to_json_string(self):
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self) -> str:\n return json.dumps(self.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> st... | [
"0.906579",
"0.89350706",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.88283694",
"0.8805552",
"0.8763156",
"0.8707908",
"0.86420715",
"0.863601",
"0.863601",
"0.8541049",
"0.85313785",
"0.852... | 0.0 | -1 |
Serialize this instance to a Python dictionary. | def to_dict(self):
output = copy.deepcopy(self.__dict__)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data",
"def to_dict(self):\n return to_dict(self.__dict__)",
"def to_dict(self):\n return dumpd(self)",
"def to_dict(self):\r\n return self.__dict__",
"def to_dict(self):\n return s... | [
"0.85705614",
"0.8489506",
"0.8483257",
"0.8405309",
"0.83966506",
"0.83966506",
"0.83966506",
"0.83966506",
"0.83966506",
"0.83966506",
"0.8390355",
"0.8388496",
"0.83509785",
"0.83370554",
"0.831165",
"0.8303297",
"0.8290091",
"0.82854676",
"0.82784045",
"0.82483166",
"0.82... | 0.0 | -1 |
Serialize this instance to a JSON string. | def to_json_string(self):
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self) -> str:\n return json.dumps(self.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> st... | [
"0.906579",
"0.89350706",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.89004624",
"0.88283694",
"0.8805552",
"0.8763156",
"0.8707908",
"0.86420715",
"0.863601",
"0.863601",
"0.8541049",
"0.85313785",
"0.852... | 0.0 | -1 |
returns a string that includes the name of the model as well as the sizes of the dictionaries for each feature of the text | def __repr__(self):
printer = 'text model name: ' + str(self.name) + '\n'
printer += ' number of words: ' + str(len(self.words)) +'\n'
printer += ' number of word lengths: ' + str(len(self.word_lengths)) + '\n'
printer += ' number of stems: ' + str(len(self.stems)) + '\n'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n s= 'text model name: ' + self.name + '\\n'\n s+= 'number of words: ' + str(len(self.words)) + '\\n'\n s+='number of word lengths: ' + str(len(self.word_lengths))+'\\n'\n s+='number of word stems: ' + str(len(self.stems)) + '\\n'\n s+='number of sentence leng... | [
"0.66683024",
"0.6620088",
"0.6487179",
"0.6437745",
"0.64289606",
"0.6009378",
"0.5992558",
"0.5914708",
"0.58534557",
"0.5833552",
"0.5801162",
"0.5781872",
"0.5741748",
"0.5740339",
"0.57244414",
"0.5698094",
"0.56868947",
"0.56865036",
"0.5677728",
"0.56711304",
"0.562563... | 0.614236 | 5 |
Set the user ID for later use in logging. | def set_user_id(uid):
local.user_id = uid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_userId(self, userId):\n self.authentication.userId = userId",
"def id_user(self, id_user):\n\n self._id_user = id_user",
"def user(self, user):\n self.user_id = user.get_id()",
"def user_id(self, user_id):\n\n self._user_id = user_id",
"def user_id(self, user_id):\n\n ... | [
"0.8000985",
"0.7696615",
"0.7558133",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7510105",
"0.7469039",
"0.7024879",
"0.6970846",
"0.6925725",
"... | 0.8480165 | 0 |
Constructs an iterable that produces ndarrays of length chunksize along axis during iteration. This constructor returns an object that is capable of producing ndarrays or masked ndarrays during iteration from a single ndarray, a sequence of ndarrays, a file Reader instance (see io.bases.Reader), an ndarray generating f... | def producer(data: Union[npt.NDArray, Iterable[npt.NDArray], Reader,
Callable, 'Producer'],
chunksize: int,
axis: int,
shape: Optional[Sequence[int]] = None,
mask: Optional[npt.NDArray[np.bool_]] = None,
**kwargs,
) -> 'Producer':... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n\n starts = range(0, self.data.shape[self.axis], self.chunksize)\n\n for t in zip_longest(starts, starts[1:], fillvalue=None):\n yield self.data[self._slice(*t)]",
"def chunked(self, length, overlap):\n def new_gen():\n buffer = self.read(length)\n ... | [
"0.6789393",
"0.6332963",
"0.63003314",
"0.62977606",
"0.6274974",
"0.62420475",
"0.62190837",
"0.6187168",
"0.6121597",
"0.60739815",
"0.60720617",
"0.60654736",
"0.59876305",
"0.59682846",
"0.596393",
"0.5900003",
"0.5893279",
"0.5889684",
"0.5889684",
"0.5889684",
"0.58753... | 0.0 | -1 |
Pads the edges of a producer along its axis. | def pad_producer(pro, pad, value):
#convert int pad to seq. of pads & place along axis of pads
pads = [pad, pad] if isinstance(pad, int) else pad
def genfunc():
left_shape, right_shape = list(pro.shape), list(pro.shape)
left_shape[pro.axis] = pads[0]
right_shape[pro.axis] = pads[1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_edges(self, pad):\n weights=[]\n for dim, xy in zip([0, 1], [self.x, self.y]):\n xy0 = np.mean(xy)\n W = xy[-1]-xy[0]\n dist = np.abs(xy-xy0)\n wt=np.ones_like(dist)\n wt[ dist >= W/2 - pad] = 0\n weights += [wt]\n self.... | [
"0.60306835",
"0.5613865",
"0.5581342",
"0.5507449",
"0.5410015",
"0.5379686",
"0.52002054",
"0.51807445",
"0.51807445",
"0.51807445",
"0.51533556",
"0.51392597",
"0.5128504",
"0.51269317",
"0.5001935",
"0.4997942",
"0.4984185",
"0.49738342",
"0.49708384",
"0.49404427",
"0.49... | 0.6184286 | 0 |
Return the summed shape of all arrays in this Reader. | def shape(self):
s = list(self.data.shape)
s[self.axis] = self.stop - self.start
return tuple(s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape(self,squeeze=True):\n return np.shape(self.getData(squeeze=squeeze))",
"def shape(self):\n return self.array.shape",
"def shape(self):\n return self.to_array().shape",
"def flat_dim(self):\n return np.sum([c.flat_dim for c in self.spaces])",
"def shape(self):\n ... | [
"0.665812",
"0.6547979",
"0.6491248",
"0.643544",
"0.6197677",
"0.61951464",
"0.61946195",
"0.61946195",
"0.61946195",
"0.61946195",
"0.61946195",
"0.61823606",
"0.6180591",
"0.6180591",
"0.6180591",
"0.6150183",
"0.6113065",
"0.6109417",
"0.61081374",
"0.6087976",
"0.6070234... | 0.0 | -1 |
Builds an iterator yielding channels x chunksize shape arrays. | def __iter__(self):
# Open the data reader
self.data.open()
starts = np.arange(self.start, self.stop, self.chunksize)
for a, b in zip_longest(starts, starts[1:], fillvalue=self.stop):
yield self.data.read(a, b, **self.kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_batch(iterator, batch_size):\n while True:\n center_batch = np.zeros(batch_size, dtype = np.uint32)\n target_batch = np.zeros((batch_size, 1), dtype = np.uint32)\n for index in range(batch_size):\n center_batch[index], target_batch[index] = next(iterator)\n\n yield... | [
"0.67250186",
"0.6707856",
"0.66859204",
"0.6675714",
"0.6631963",
"0.6523324",
"0.646521",
"0.6427537",
"0.6418558",
"0.6413535",
"0.64072627",
"0.63933897",
"0.6373873",
"0.63687015",
"0.6358571",
"0.61694705",
"0.6151814",
"0.6146733",
"0.6145469",
"0.6140955",
"0.6090184"... | 0.6007306 | 26 |
The cumulative shape of this Producers data array. | def shape(self):
return self.data.shape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape(self):\n return self.data.shape",
"def shape(self):\n return self.data.shape",
"def shape(self):\n return self.data.shape",
"def shape(self):\n return self.data.shape",
"def shape(self):\n return self.data.shape",
"def shape(self):\n return self.to_arra... | [
"0.7243002",
"0.7243002",
"0.7243002",
"0.7243002",
"0.7243002",
"0.72139275",
"0.7188304",
"0.7188304",
"0.7188304",
"0.707229",
"0.69159615",
"0.68996036",
"0.6856044",
"0.68528366",
"0.6843658",
"0.6838505",
"0.68095094",
"0.68059075",
"0.67330855",
"0.67330855",
"0.671081... | 0.7160669 | 9 |
Returns an iterator yielding ndarrays of chunksize along axis. | def __iter__(self):
starts = range(0, self.data.shape[self.axis], self.chunksize)
for t in zip_longest(starts, starts[1:], fillvalue=None):
yield self.data[self._slice(*t)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate_array_in_chunks(arr, size: int):\n for i in range(0, len(arr), size):\n yield arr[i:i+size]",
"def yield_chunks(arr, chunk_size):\r\n larr = len(arr)\r\n if larr < chunk_size:\r\n raise ValueError(\"The array length (%d) must be larger than the chunk size (%d)\" % (len(arr), ch... | [
"0.73318124",
"0.7075843",
"0.7073167",
"0.7024158",
"0.69815487",
"0.6875267",
"0.6709818",
"0.6670601",
"0.6641019",
"0.6580787",
"0.65085125",
"0.64978844",
"0.64842916",
"0.6466276",
"0.6465442",
"0.64632857",
"0.64310956",
"0.64310956",
"0.64310956",
"0.6417277",
"0.6394... | 0.70312315 | 3 |
Returns the summed shape of arrays in this Producer. | def shape(self):
return self._shape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape(self):\n return self.to_array().shape",
"def shape(self):\n return self.array.shape",
"def shape(self,squeeze=True):\n return np.shape(self.getData(squeeze=squeeze))",
"def sizes(self) -> np.ndarray:\n\n return self.shape.prod(axis=0)",
"def shape(self):\n\n sel... | [
"0.7142792",
"0.711804",
"0.6929528",
"0.6776699",
"0.6746011",
"0.67028475",
"0.67023444",
"0.66889",
"0.6651087",
"0.6635456",
"0.6624297",
"0.6624297",
"0.6624297",
"0.6624297",
"0.6624297",
"0.66183615",
"0.6609032",
"0.6609032",
"0.66041833",
"0.6583735",
"0.6567385",
... | 0.60854274 | 74 |
Returns an iterator yielding ndarrays of chunksize along axis. Since the shape of the arrays yielded from the generating function (i.e. data) may be very small compared to chunksize, we store generated arrays to a temporary array to reduce the number of fifo 'put' calls (see note in FIFOArray.put). | def __iter__(self):
# collector will fetch chunksize array for each 'get' call
collector = FIFOArray(self.chunksize, self.axis)
# make tmp array to hold generated subarrs
tmp = []
tmp_size = 0
for subarr in self.data(**self.kwargs):
tmp.append(subarr)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate_array_in_chunks(arr, size: int):\n for i in range(0, len(arr), size):\n yield arr[i:i+size]",
"def chunks(array, size: int):\r\n for i in range(0, len(array), size):\r\n yield array[i:i + size]",
"def yield_chunks(arr, chunk_size):\r\n larr = len(arr)\r\n if larr < chunk_s... | [
"0.6992089",
"0.6900754",
"0.6792408",
"0.6608984",
"0.65759915",
"0.6569415",
"0.6560407",
"0.655808",
"0.65408766",
"0.65207744",
"0.6476222",
"0.6457231",
"0.643329",
"0.6414242",
"0.63855255",
"0.6358552",
"0.6290567",
"0.6253341",
"0.6250967",
"0.62419",
"0.62262493",
... | 0.7121666 | 0 |
Sets face tracker to just head and starts. | def trackFace():
# start face tracker
self.track.setWholeBodyOn(False)
self.track.startTracker() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trackFace(self):\n\n\t\t# start face tracker\n\t\tself.track.setWholeBodyOn(False)\n\t\tself.track.startTracker()",
"def faceTrackingStarted(faceSize):\n\n\t# First, wake up\n\t#motionProxy.wakeUp()\n\t#motionProxy.rest()\n\n\t# Add target to track\n\ttargetName = \"Face\"\n\tfaceWidth = faceSize\n\ttracker.... | [
"0.7231593",
"0.6692019",
"0.6471274",
"0.6158261",
"0.60427535",
"0.59131914",
"0.5786792",
"0.57801205",
"0.57416546",
"0.5665318",
"0.5646576",
"0.55611765",
"0.5511766",
"0.5511766",
"0.55116904",
"0.5502947",
"0.5489433",
"0.5488704",
"0.5476716",
"0.5412752",
"0.5361020... | 0.7319472 | 0 |
Flushes data from ORM Session into DB, but does not commit transaction | def flush(self):
if not self.is_active:
return
# XXX: investigate if there is db transaction flush
self._orm_session.flush() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit(self):\n self.session.commit()",
"def _commit(self):\n if self.__session is not None:\n self.__session.commit()",
"def commit(self):\n try:\n self.session.commit()\n except:\n self.session.rollback()\n raise\n finally:\n ... | [
"0.7524094",
"0.75122565",
"0.7408665",
"0.73853624",
"0.7330973",
"0.7265482",
"0.7238094",
"0.7169909",
"0.7111744",
"0.70777774",
"0.6964285",
"0.6961208",
"0.6935387",
"0.6935387",
"0.6935387",
"0.6935387",
"0.6935387",
"0.6935387",
"0.6935387",
"0.6935387",
"0.6924248",
... | 0.7542106 | 0 |
Rolls transaction back, closes the connection, deletes session Executes deferred queries | def _cleanup(self):
self._orm_session.close()
self._db_transaction.rollback()
self._db_connection.close()
self._db_engine = None
self._db_connection = None
self._db_transaction = None
self._orm_session = None
self._orm_session_proxy = None
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _close(self):\n if self.__session is not None:\n self._rollback()\n self.__session.close()",
"def close_session(self):\n self.session.execute(QUERY_DROP_TABLE_1)\n self.session.execute(QUERY_DROP_TABLE_2)\n self.session.execute(QUERY_DROP_TABLE_3)\n se... | [
"0.7965251",
"0.7370838",
"0.7351586",
"0.7351586",
"0.73511994",
"0.7346281",
"0.73079467",
"0.7303325",
"0.72930247",
"0.7269267",
"0.7266709",
"0.71805906",
"0.71805906",
"0.71805906",
"0.71805906",
"0.71805906",
"0.71805906",
"0.7158354",
"0.7158354",
"0.7158354",
"0.7158... | 0.7155602 | 25 |
Add a new experience to memory. | def add(self, state, action, reward, next_state, done):
e = self.experience(state, action, reward, next_state, done)
self.memory.append(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)",
"def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st... | [
"0.79568833",
"0.79042006",
"0.78795445",
"0.7577913",
"0.7570969",
"0.74478436",
"0.7361023",
"0.72697705",
"0.721816",
"0.71451885",
"0.7106998",
"0.7101183",
"0.69837016",
"0.68905056",
"0.68842727",
"0.6755663",
"0.6712557",
"0.6677425",
"0.64961654",
"0.6488678",
"0.6486... | 0.71984994 | 17 |
Return the current size of internal memory. | def __len__(self):
return len(self.memory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSize(self) -> int:\n return len(self.mem)",
"def getSize(self):\n return self.bf.memory()",
"def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024",
"def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ... | [
"0.8571074",
"0.8215767",
"0.8198132",
"0.80832005",
"0.8020808",
"0.7889389",
"0.78188926",
"0.7797308",
"0.778622",
"0.775998",
"0.77557904",
"0.7751391",
"0.7751391",
"0.7750454",
"0.77327937",
"0.77303255",
"0.7716953",
"0.77102315",
"0.770489",
"0.77028936",
"0.7694357",... | 0.7512535 | 58 |
Initialize a new linked list containing the given items. The first node in the linked list contains the first item in . | def __init__(self, items):
if len(items) == 0:
self._first = None
self._rest = None
else:
self._first = items[0]
self._rest = LinkedListRec(items[1:]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, items):\r\n if len(items) == 0: # No items, and an empty list!\r\n self._first = None\r\n else:\r\n self._first = _Node(items[0])\r\n curr = self._first\r\n for item in items[1:]:\r\n curr.next = _Node(item)\r\n ... | [
"0.83739454",
"0.7514045",
"0.74844074",
"0.7438117",
"0.70560646",
"0.6919856",
"0.67227983",
"0.6710322",
"0.6697007",
"0.66781634",
"0.6622026",
"0.65524465",
"0.65173554",
"0.6469273",
"0.6463215",
"0.64528155",
"0.64364386",
"0.64092153",
"0.6385144",
"0.63465625",
"0.63... | 0.77780277 | 1 |
Return a string representation of this list.. | def __str__(self):
if self.is_empty():
return ''
elif self._rest.is_empty():
return str(self._first)
else:
return str(self._first) + ' -> ' + str(self._rest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return list.__str__(self)",
"def __str__(self):\n return str(self.list)",
"def __str__(self):\n list_string = \"\"\n for item in self._data:\n list_string += item + \", \"\n return list_string",
"def __str__(self):\r\n return str(self.... | [
"0.86202544",
"0.8610948",
"0.8468983",
"0.81464577",
"0.81464577",
"0.81375015",
"0.81356204",
"0.80702037",
"0.8061988",
"0.80578315",
"0.8041885",
"0.8037674",
"0.8032055",
"0.80208266",
"0.79895604",
"0.7986561",
"0.79465926",
"0.793586",
"0.7931003",
"0.7913355",
"0.7861... | 0.0 | -1 |
Return the number of elements in this list. | def __len__(self):
# TODO: complete this function!
if self.is_empty():
return 0
else:
return 1 + len(self._rest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self):\n return len(self._elements)",
"def elements_count(self):\n return self.__elements_count",
"def size(self):\n return len(self.__list)",
"def length(self):\n return self.list.length",
"def length(self):\n return self.list.length",
"def length(self):\n ... | [
"0.8620139",
"0.85498166",
"0.8404856",
"0.8353044",
"0.8353044",
"0.8343641",
"0.83196473",
"0.83028656",
"0.82684606",
"0.823719",
"0.82363766",
"0.8168629",
"0.8153449",
"0.81066203",
"0.80099356",
"0.80092716",
"0.798027",
"0.795783",
"0.79575956",
"0.79537654",
"0.792667... | 0.0 | -1 |
Return the item at position in this list. Raise IndexError if is >= the length of this list. | def __getitem__(self, index):
if self.is_empty():
raise IndexError
elif index == 0:
return self._first
else:
return self._rest.__getitem__(index - 1)
# Equivalently, return self._rest[index - 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, index):\n if index >= self.size:\n raise KeyError\n else:\n return self._get_item(index)",
"def index(self, pos):\n for i, n in enumerate(self):\n if i == pos: return n\n raise Exception('Index out of bounds.')",
"def __getitem_... | [
"0.73907965",
"0.7234179",
"0.72274953",
"0.7205998",
"0.7055814",
"0.6988862",
"0.6963134",
"0.6923716",
"0.6890209",
"0.67586404",
"0.67405874",
"0.6735674",
"0.67258435",
"0.67128664",
"0.6694371",
"0.6689126",
"0.66620046",
"0.6611584",
"0.66048783",
"0.65747166",
"0.6573... | 0.6776045 | 9 |
Insert item at the front of the list. This should work even if the list is empty. | def insert_first(self, item):
if self.is_empty():
self._first = item
self._rest = LinkedListRec([None])
else:
new_list = LinkedListRec([self._first])
new_list._rest = self._rest
self._first = item
self._rest = new_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insertFront(self, item):\n self.sentinel.insertAfter(item)\n self.N += 1",
"def add_front(self, item):\n\n self.items.insert(0, item)",
"def prepend(self, item: Any):\n self.insert(0, item)",
"def push(self, item):\n self.list.prepend(item)",
"def push(self, item):\n ... | [
"0.7911474",
"0.78546184",
"0.7721473",
"0.7700689",
"0.74843067",
"0.74464387",
"0.73828757",
"0.7262133",
"0.7105635",
"0.6873347",
"0.6840967",
"0.6835015",
"0.6774851",
"0.6744693",
"0.67113084",
"0.66966283",
"0.6675408",
"0.66508096",
"0.6615109",
"0.6572021",
"0.654042... | 0.7611948 | 4 |
Insert item in to the list at position . Raise an IndexError if index is > the length of the list. Note that it is possible to add to the end of the list (when index == len(self)). | def insert(self, index, item):
if index > len(self):
raise IndexError
elif index == 0:
self.insert_first(item)
else:
self._rest.insert(index-1, item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, index, item):\n\n # Check if -len(self) <= index <= len(self)\n valid_index = (index <= len(self)) and (index >= -len(self))\n\n try:\n if not valid_index:\n raise IndexError\n\n if self.count == self.capacity:\n self._resize... | [
"0.8071151",
"0.80658376",
"0.8052258",
"0.80156034",
"0.7884237",
"0.7812524",
"0.7785804",
"0.76542145",
"0.7635252",
"0.76222324",
"0.7612091",
"0.74901724",
"0.74399555",
"0.7413813",
"0.7359655",
"0.73120105",
"0.72784495",
"0.7094499",
"0.7009153",
"0.6994207",
"0.69889... | 0.8356974 | 0 |
Calculate the DamerauLevenshtein distance between sequences. This distance is the number of additions, deletions, substitutions, and transpositions needed to transform the first sequence into the second. Although generally used with strings, any sequences of comparable objects will work. Transpositions are exchanges of... | def dameraulevenshtein(seq1, seq2):
# Conceptually, this is based on a len(seq1) + 1 * len(seq2) + 1 matrix.
# However, only the current and two previous rows are needed at once,
# so we only store those.
oneago = None
thisrow = list(range(1, len(seq2) + 1)) + [0]
for x in range(len(seq1)):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def damerau_levenshtein_distance(s1, s2):\n\n utils.check_for_none(s1, s2)\n utils.check_for_type(str, s1, s2)\n\n # s1 = utils.unicode_normalize(s1)\n # s2 = utils.unicode_normalize(s2)\n\n n1, n2 = len(s1), len(s2)\n infinite = n1 + n2\n\n char_arr = defaultdict(int)\n dp = [[0] * (n2 + 2... | [
"0.7603492",
"0.74501896",
"0.7320772",
"0.73012006",
"0.72565913",
"0.72565764",
"0.7233742",
"0.71123683",
"0.71123683",
"0.7071723",
"0.7062248",
"0.6847205",
"0.6774567",
"0.6754094",
"0.67290765",
"0.6726821",
"0.668258",
"0.6673137",
"0.6654019",
"0.66037554",
"0.653116... | 0.7130786 | 7 |
Convert pydantic object to pandas dataframe with 1 row. | def to_df(self):
return pd.DataFrame([dict(self)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_df(self):\r\n return pd.DataFrame([dict(self)])",
"def to_df(self):\n from ..df import DataFrame\n\n return DataFrame(self)",
"def pandas_convert(self):\n data = {}\n\n for names in self.data[0]:\n col_values = []\n\n if names in objects:\n ... | [
"0.75817996",
"0.7210344",
"0.7195528",
"0.7187567",
"0.71487796",
"0.7104129",
"0.71013093",
"0.7047505",
"0.69818395",
"0.6981776",
"0.6981776",
"0.69500226",
"0.6906501",
"0.68661636",
"0.68262136",
"0.681778",
"0.67798555",
"0.67733806",
"0.6754019",
"0.673979",
"0.672651... | 0.75378114 | 5 |
creates a hot vector of an atom type | def atom_to_hot_vector(self, elem: str):
hot_vector = np.zeros(22)
idx = self.dict_atoms_simple[elem]
hot_vector[idx] = 1
return hot_vector | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_one_hot(ind, n):\n vec = np.zeros(n)\n vec[ind] = 1\n return vec",
"def to_one_hot(v):\n n = len(v)\n m = max(v) + 1\n out = np.zeros((n, m))\n out[np.arange(n), v] = 1\n return out",
"def vec_to_onehot(vec, m=0):\r\n\r\n n = vec.shape[0]\r\n if m == 0:\r\n m = len(n... | [
"0.65515584",
"0.64342755",
"0.6431607",
"0.6298604",
"0.62674636",
"0.62252426",
"0.6173745",
"0.6168766",
"0.6096443",
"0.60652435",
"0.6063281",
"0.6023734",
"0.6019546",
"0.59940034",
"0.598831",
"0.59744394",
"0.5963999",
"0.5954198",
"0.594281",
"0.59369165",
"0.5905558... | 0.77975243 | 0 |
Make the polyline from a list of pairs with point coordinates | def __init__(self, coords, name=None):
self.points = [
Point(c[0], c[1], None if name is None else "{}[{}]".format(name, i))
for i, c in enumerate(coords)
]
self.line_segments = [
LineSegment(p1, p2) for p1, p2 in zip(self.points[:-1], self.points[1:])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polyline(self, pointlist, cls=None, style=None, attrs=None):\n payload = self._meta.make_payload(cls, style, attrs)\n pts_str = ' '.join('%s,%s' % (x, y) for x, y in pointlist)\n self.elements.append(\"\"\"<polyline points=\"%s\" %s/>\"\"\" % (pts_str, payload))\n return self",
"d... | [
"0.7450342",
"0.7450342",
"0.67984396",
"0.65841687",
"0.6323785",
"0.6168418",
"0.616385",
"0.6136686",
"0.60994154",
"0.6071925",
"0.602593",
"0.5994542",
"0.5985137",
"0.5977755",
"0.5938596",
"0.5903141",
"0.57944757",
"0.5788209",
"0.5778316",
"0.5760798",
"0.5733045",
... | 0.0 | -1 |
Gets and sets the displayName | def display_name(self):
if "displayName" in self._prop_dict:
return self._prop_dict["displayName"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_name(self):\n return self.properties.get(\"displayName\", None)",
"def display_name(self):\n return self.settings['displayName']",
"def displayName( self ):\n if ( not self._displayName ):\n return projex.text.pretty(self.objectName())\n return self._displayNa... | [
"0.8024549",
"0.79686785",
"0.770907",
"0.7293372",
"0.7293372",
"0.7293372",
"0.72066224",
"0.71439695",
"0.7096268",
"0.70412254",
"0.70148575",
"0.69626147",
"0.69534314",
"0.69334805",
"0.69321233",
"0.69321233",
"0.69321233",
"0.69321233",
"0.69321233",
"0.69321233",
"0.... | 0.80308217 | 4 |
Gets and sets the onPremisesLastSyncDateTime | def on_premises_last_sync_date_time(self):
if "onPremisesLastSyncDateTime" in self._prop_dict:
return datetime.strptime(self._prop_dict["onPremisesLastSyncDateTime"].replace("Z", ""), "%Y-%m-%dT%H:%M:%S.%f")
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_sync(self):\n return self.app.sync_thread.last_sync.strftime('%H:%M')",
"def sync_time(self):\n return self.get_sync_time()",
"def on_premises_sync_enabled(self):\n if \"onPremisesSyncEnabled\" in self._prop_dict:\n return self._prop_dict[\"onPremisesSyncEnabled\"]\... | [
"0.6325699",
"0.587589",
"0.5858154",
"0.5858154",
"0.5850004",
"0.57757026",
"0.57757026",
"0.5724789",
"0.5687654",
"0.5652039",
"0.5625669",
"0.55714643",
"0.55631775",
"0.554318",
"0.5526351",
"0.5519201",
"0.5501846",
"0.5501846",
"0.5501846",
"0.5501846",
"0.5501846",
... | 0.80928105 | 1 |
Gets and sets the postalCode | def postal_code(self):
if "postalCode" in self._prop_dict:
return self._prop_dict["postalCode"]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postal_code(self):\n return self._postal_code",
"def postal_code(self, postal_code):\n\n self._postal_code = postal_code",
"def postal_code(self, postal_code):\n\n self._postal_code = postal_code",
"def postal_code(self, postal_code):\n\n self._postal_code = postal_code",
"d... | [
"0.8068069",
"0.7782636",
"0.7782636",
"0.7782636",
"0.7749391",
"0.7616022",
"0.7616022",
"0.7616022",
"0.7592657",
"0.750524",
"0.73879284",
"0.71881807",
"0.71881807",
"0.6699865",
"0.66058904",
"0.66058904",
"0.66058904",
"0.6463677",
"0.6463677",
"0.64158225",
"0.6307012... | 0.783056 | 2 |
Gets and sets the privacyProfile | def privacy_profile(self):
if "privacyProfile" in self._prop_dict:
if isinstance(self._prop_dict["privacyProfile"], OneDriveObjectBase):
return self._prop_dict["privacyProfile"]
else :
self._prop_dict["privacyProfile"] = PrivacyProfile(self._prop_dict["pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile(self):\n endpoint = '/profile'\n return self.get_request(endpoint)",
"def get_user_profile(self):\n return self.user.profile",
"def getProfile(self):\n self.profile = LineContact(self, self._getProfile())\n\n return self.profile",
"def profile(self) -> Profi... | [
"0.5970012",
"0.5945452",
"0.57073313",
"0.5657435",
"0.5657435",
"0.56528354",
"0.5645841",
"0.5632789",
"0.56322527",
"0.55798125",
"0.555526",
"0.5460383",
"0.54457045",
"0.54457045",
"0.5418339",
"0.53700995",
"0.536092",
"0.53463423",
"0.53403723",
"0.5308688",
"0.530533... | 0.7585365 | 0 |
Gets and sets the mobileDeviceManagementAuthority | def mobile_device_management_authority(self):
if "mobileDeviceManagementAuthority" in self._prop_dict:
if isinstance(self._prop_dict["mobileDeviceManagementAuthority"], OneDriveObjectBase):
return self._prop_dict["mobileDeviceManagementAuthority"]
else :
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phone_mobile(self, instance):\r\n return instance.user.profile.phone_mobile",
"def mobile_phone(self):\n if \"mobilePhone\" in self._prop_dict:\n return self._prop_dict[\"mobilePhone\"]\n else:\n return None",
"def mobile_phone(self):\n if \"mobilePhone\" i... | [
"0.4749059",
"0.4726899",
"0.4726899",
"0.4723475",
"0.4704215",
"0.46767765",
"0.4548445",
"0.4494811",
"0.44466412",
"0.44466412",
"0.44455937",
"0.4413021",
"0.43985566",
"0.43943882",
"0.43872052",
"0.437152",
"0.4362718",
"0.43555802",
"0.43432292",
"0.43409374",
"0.4315... | 0.8321553 | 0 |
Funcion que devuelve la fecha del primer dia del mes actual. Devuelve el dia en formato "DDMMAAAA" | def first_month_day():
return datetime.now().replace(day=1).strftime('%d-%m-%Y') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fecha_cadena(anno, mes, dia):\n dia_ = str(dia).strip()\n mes_ = str(mes).strip()\n anno_ = str(anno).strip()\n # día\n if len(dia_) < 2:\n dia_ = \"0\" + dia_\n # mes\n if len(mes_) < 2:\n mes_ = \"0\" + mes_\n # año\n for i ... | [
"0.6496175",
"0.64490044",
"0.63400143",
"0.6004199",
"0.59996355",
"0.5952692",
"0.59268695",
"0.58738315",
"0.58698136",
"0.5854765",
"0.57998514",
"0.5763149",
"0.56906253",
"0.5683145",
"0.5677522",
"0.5669117",
"0.56245005",
"0.56225246",
"0.5615562",
"0.556611",
"0.5554... | 0.5929421 | 6 |
Appends the value to the end of the list. TC O(n) | def append(self, value):
node = Node(value)
if self._head is None:
self._head = node
else:
current = self._head
while current.next:
current = current.next
current.next = node
self._size += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, value):\n if len(self.data) >= n:\n self.data.pop(0)\n self.data.append(value)",
"def append(self, value):\n self[self._end] = value\n self._end = (self._end + 1) % self._capacity\n\n if self.full:\n self._begin = (self._begin ... | [
"0.7441601",
"0.7363866",
"0.7253847",
"0.72339904",
"0.72152793",
"0.71948224",
"0.7186598",
"0.7166907",
"0.71407425",
"0.71220237",
"0.70733374",
"0.7057021",
"0.7005724",
"0.69752955",
"0.69504946",
"0.6940135",
"0.687311",
"0.68321306",
"0.68263435",
"0.6825064",
"0.6819... | 0.6793736 | 22 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in xrange(0, len(l), n):
yield l[i:i+n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.80384505",
"0.7923974",
"0.7922437",
"0.78840655",
"0.7876414",
"0.78148615",
"0.77646214",
"0.77549404",
"0.7743152",
"0.77308774",
"0.7727943",
"0.7724056",
"0.77018046",
"0.7688052",
"0.7688052",
"0.76631814",
"0.7656124",
"0.76548743",
"0.76548743",
"0.76449037",
"0.76... | 0.0 | -1 |
Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal. | def sort_012(input_list):
# Positions 0's to the start of the array and 2's to the end.
# All remaining are 1's.
next_0_index = 0
next_2_index = len(input_list) - 1
i = 0
# Traverse the array once.
# Last index to be checked is next_2_index because it is
# one po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(array):\n\n for i in range(0, len(array)):\n for j in range(len(array)-1, i, -1):\n if array[j] < array[j-1]:\n ## Move the lighter bubble up\n _temp = array[j]\n array[j] = array[j-1]\n array[j-1] = _temp\n \n ... | [
"0.6792707",
"0.6758305",
"0.6685668",
"0.66711134",
"0.6660409",
"0.6644065",
"0.66035944",
"0.659015",
"0.6552274",
"0.65011084",
"0.64874375",
"0.6465411",
"0.6446616",
"0.64315027",
"0.64290977",
"0.6422456",
"0.6421703",
"0.6418894",
"0.64047986",
"0.638907",
"0.63790894... | 0.65542775 | 8 |
resize image and mask while keeping ratio | def _testval_sync_transform(self, img, mask, padding=True):
if padding:
# padding and resize
img, mask, keep_size = self._sync_pad(img, mask)
img = img.resize((self.crop_size, self.crop_size), Image.BILINEAR)
mask = mask.resize(img.size, Image.NEAREST)
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _resize_masks(self, results):\n for key in results.get('mask_fields', []):\n if results[key] is None:\n continue\n if self.keep_ratio:\n results[key] = results[key].rescale(results['scale'])\n else:\n results[key] = results[ke... | [
"0.7228453",
"0.7228453",
"0.6988797",
"0.6792816",
"0.6747983",
"0.6747866",
"0.67196244",
"0.6715727",
"0.661352",
"0.6576234",
"0.6520901",
"0.65093374",
"0.650917",
"0.6496266",
"0.6485965",
"0.6485366",
"0.6484305",
"0.6484305",
"0.6450831",
"0.6442192",
"0.64212555",
... | 0.0 | -1 |
Creates an Object from a JSON file | def load_from_json_file(filename):
with open(filename, mode="r", encoding="utf-8") as a_file:
return json.loads(a_file.read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json_file(cls, json_file):\n with open(json_file, \"r\") as reader:\n return cls.from_dict(json.load(reader))",
"def from_json(cls, fname):\n d = read_json(fname)\n return cls.from_dict(d)",
"def from_JSON(cls, filename):\n with open(os.path.expanduser(filename),... | [
"0.8077227",
"0.8059218",
"0.8014333",
"0.79221255",
"0.78821206",
"0.7876112",
"0.7876112",
"0.7876112",
"0.7867695",
"0.7866958",
"0.7861238",
"0.7850167",
"0.7850008",
"0.78406227",
"0.7798315",
"0.7744038",
"0.76990694",
"0.76728964",
"0.76430357",
"0.762453",
"0.7616646"... | 0.690002 | 65 |
Converts tensor to PIL image | def to_image(tensor):
# Converts to PIL image
unloader = transforms.ToPILImage()
# Clone the tensor to CPU
image = tensor.cpu().clone()
# Remove fake batch dimension
image = image.squeeze(0)
# Convert to PIL image
image = unloader(image)
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_to_image(img):\n t = transforms.ToPILImage()\n return t(img)",
"def tensor_to_image(tensor, save=None):\n img = transforms.ToPILImage(mode='RGB')(tensor)\n img.show()\n if save:\n img.save(save)",
"def tensor_to_image(tensor):\n tensor = tensor * 255\n tensor = np.array(t... | [
"0.8296058",
"0.82779026",
"0.7985139",
"0.7632141",
"0.748137",
"0.7424022",
"0.729799",
"0.72568226",
"0.7246636",
"0.7042401",
"0.7025167",
"0.70214564",
"0.69849557",
"0.67178136",
"0.66645557",
"0.6658022",
"0.65831333",
"0.65752023",
"0.65752023",
"0.65713704",
"0.65685... | 0.8200484 | 2 |
cast(itkLightObject obj) > itkMapContainerULLQEMPF2GQEULLULLBBT | def cast(obj: 'itkLightObject') -> "itkMapContainerULLQEMPF2GQEULLULLBBT *":
return _itkQuadEdgeCellTraitsInfoPython.itkMapContainerULLQEMPF2GQEULLULLBBT_cast(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(obj: 'itkLightObject') -> \"itkMapContainerULLQEMPF3GQEULLULLBBT *\":\n return _itkQuadEdgeCellTraitsInfoPython.itkMapContainerULLQEMPF3GQEULLULLBBT_cast(obj)",
"def itkMapContainerULLQEMPF2GQEULLULLBBT_cast(obj: 'itkLightObject') -> \"itkMapContainerULLQEMPF2GQEULLULLBBT *\":\n return _itkQua... | [
"0.8084822",
"0.80788255",
"0.80115074",
"0.6254341",
"0.6229861",
"0.62290967",
"0.621282",
"0.62121254",
"0.61977196",
"0.6187826",
"0.61861074",
"0.617687",
"0.61671036",
"0.61638296",
"0.615326",
"0.6134305",
"0.6129836",
"0.6122671",
"0.6109205",
"0.6106327",
"0.6104756"... | 0.81593674 | 0 |
itkMapContainerULLQEMPF2GQEULLULLBBT_cast(itkLightObject obj) > itkMapContainerULLQEMPF2GQEULLULLBBT | def itkMapContainerULLQEMPF2GQEULLULLBBT_cast(obj: 'itkLightObject') -> "itkMapContainerULLQEMPF2GQEULLULLBBT *":
return _itkQuadEdgeCellTraitsInfoPython.itkMapContainerULLQEMPF2GQEULLULLBBT_cast(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkMapContainerULLQEMPF3GQEULLULLBBT_cast(obj: 'itkLightObject') -> \"itkMapContainerULLQEMPF3GQEULLULLBBT *\":\n return _itkQuadEdgeCellTraitsInfoPython.itkMapContainerULLQEMPF3GQEULLULLBBT_cast(obj)",
"def cast(obj: 'itkLightObject') -> \"itkMapContainerULLQEMPF2GQEULLULLBBT *\":\n return _itkQua... | [
"0.86143035",
"0.85710466",
"0.85231453",
"0.6663533",
"0.6580079",
"0.65773124",
"0.6542718",
"0.65136206",
"0.6509441",
"0.65042865",
"0.65000635",
"0.6490363",
"0.6483853",
"0.6468999",
"0.6454448",
"0.6448948",
"0.64392745",
"0.6436383",
"0.64240533",
"0.64200103",
"0.641... | 0.8653909 | 0 |
cast(itkLightObject obj) > itkMapContainerULLQEMPF3GQEULLULLBBT | def cast(obj: 'itkLightObject') -> "itkMapContainerULLQEMPF3GQEULLULLBBT *":
return _itkQuadEdgeCellTraitsInfoPython.itkMapContainerULLQEMPF3GQEULLULLBBT_cast(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(obj: 'itkLightObject') -> \"itkMapContainerULLQEMPF2GQEULLULLBBT *\":\n return _itkQuadEdgeCellTraitsInfoPython.itkMapContainerULLQEMPF2GQEULLULLBBT_cast(obj)",
"def itkMapContainerULLQEMPF2GQEULLULLBBT_cast(obj: 'itkLightObject') -> \"itkMapContainerULLQEMPF2GQEULLULLBBT *\":\n return _itkQua... | [
"0.80768454",
"0.79894507",
"0.79848903",
"0.6210267",
"0.61941546",
"0.61825395",
"0.61637414",
"0.6140377",
"0.61170834",
"0.610773",
"0.6096567",
"0.60962915",
"0.60895133",
"0.6082656",
"0.60760105",
"0.60720843",
"0.60708916",
"0.60685796",
"0.6065972",
"0.60581446",
"0.... | 0.80651575 | 1 |
itkMapContainerULLQEMPF3GQEULLULLBBT_cast(itkLightObject obj) > itkMapContainerULLQEMPF3GQEULLULLBBT | def itkMapContainerULLQEMPF3GQEULLULLBBT_cast(obj: 'itkLightObject') -> "itkMapContainerULLQEMPF3GQEULLULLBBT *":
return _itkQuadEdgeCellTraitsInfoPython.itkMapContainerULLQEMPF3GQEULLULLBBT_cast(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkMapContainerULLQEMPF2GQEULLULLBBT_cast(obj: 'itkLightObject') -> \"itkMapContainerULLQEMPF2GQEULLULLBBT *\":\n return _itkQuadEdgeCellTraitsInfoPython.itkMapContainerULLQEMPF2GQEULLULLBBT_cast(obj)",
"def cast(obj: 'itkLightObject') -> \"itkMapContainerULLQEMPF3GQEULLULLBBT *\":\n return _itkQua... | [
"0.85524213",
"0.8530879",
"0.85012054",
"0.6676029",
"0.6610047",
"0.6598924",
"0.6585296",
"0.6577539",
"0.65381795",
"0.6525559",
"0.6516219",
"0.64921415",
"0.6490924",
"0.6486386",
"0.648307",
"0.6478202",
"0.64740264",
"0.6462398",
"0.64555895",
"0.645374",
"0.645341",
... | 0.86029065 | 0 |
__init__(itkQuadEdgeMeshCellTraitsInfo2FFULLULLUCQEMPGQEULLQEMPF2GQEULLULLBBTGQE self) > itkQuadEdgeMeshCellTraitsInfo2FFULLULLUCQEMPGQEULLQEMPF2GQEULLULLBBTGQE __init__(itkQuadEdgeMeshCellTraitsInfo2FFULLULLUCQEMPGQEULLQEMPF2GQEULLULLBBTGQE self, itkQuadEdgeMeshCellTraitsInfo2FFULLULLUCQEMPGQEULLQEMPF2GQEULLULLBBTGQE ... | def __init__(self, *args):
_itkQuadEdgeCellTraitsInfoPython.itkQuadEdgeMeshCellTraitsInfo2FFULLULLUCQEMPGQEULLQEMPF2GQEULLULLBBTGQE_swiginit(self, _itkQuadEdgeCellTraitsInfoPython.new_itkQuadEdgeMeshCellTraitsInfo2FFULLULLUCQEMPGQEULLQEMPF2GQEULLULLBBTGQE(*args)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args):\n _itkQuadEdgeCellTraitsInfoPython.itkQuadEdgeMeshCellTraitsInfo3FFULLULLUCQEMPGQEULLQEMPF3GQEULLULLBBTGQE_swiginit(self, _itkQuadEdgeCellTraitsInfoPython.new_itkQuadEdgeMeshCellTraitsInfo3FFULLULLUCQEMPGQEULLQEMPF3GQEULLULLBBTGQE(*args))",
"def __init__(self, *args):\n _... | [
"0.83134043",
"0.7966901",
"0.7925769",
"0.65841705",
"0.6542171",
"0.6529784",
"0.6213722",
"0.62116086",
"0.61951244",
"0.6168665",
"0.61404574",
"0.6118812",
"0.6111736",
"0.61094785",
"0.61048365",
"0.6103951",
"0.6078004",
"0.6064472",
"0.6063994",
"0.60592335",
"0.60496... | 0.8636811 | 0 |
Ensure the user requesting the view is the author/creator | def test_func(self):
taxonomy = self.get_object()
return self.request.user == taxonomy.author | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_func(self):\n post = self.get_object()\n\n return self.request.user == post.author",
"def test_func(self):\n post = self.get_object()\n\n return self.request.user == post.author",
"def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == p... | [
"0.7107664",
"0.7107664",
"0.71071845",
"0.71071845",
"0.71071845",
"0.7067593",
"0.70492923",
"0.69335514",
"0.68877685",
"0.6780535",
"0.67526037",
"0.6700188",
"0.66741073",
"0.66181153",
"0.66019505",
"0.6583256",
"0.658223",
"0.65533376",
"0.65518564",
"0.6551672",
"0.65... | 0.68910533 | 8 |
Ensure the user requesting the view is the author/creator | def test_func(self):
taxonomy = self.get_object()
return self.request.user == taxonomy.author | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_func(self):\n post = self.get_object()\n\n return self.request.user == post.author",
"def test_func(self):\n post = self.get_object()\n\n return self.request.user == post.author",
"def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == p... | [
"0.7107664",
"0.7107664",
"0.71071845",
"0.71071845",
"0.71071845",
"0.7067593",
"0.70492923",
"0.69335514",
"0.68877685",
"0.6780535",
"0.67526037",
"0.6700188",
"0.66741073",
"0.66181153",
"0.66019505",
"0.6583256",
"0.658223",
"0.65533376",
"0.65518564",
"0.6551672",
"0.65... | 0.68910533 | 9 |
Returns a file name from target image name | def mosaic_art_file_name(target_im):
target_file_name = extract_file_name(target_im)
now_dt = now_datetime()
return '{0}_mosaic_{1}.png'.format(target_file_name, now_dt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _image_filename(image_name):\n return '{}.tar'.format(image_name.replace(':', '_').replace('/', '_'))",
"def generate_image_name(self, image):\n return image.replace('shub://', '').replace('/', '-') + '.simg'",
"def path_to_name(img):\n\n return os.path.dirname(img) + '_' + os.path.basenam... | [
"0.77304953",
"0.74776137",
"0.73677826",
"0.7286633",
"0.72363406",
"0.72130257",
"0.72003156",
"0.7189527",
"0.7159272",
"0.70661277",
"0.7058133",
"0.69950867",
"0.6981204",
"0.6977083",
"0.6950831",
"0.6922403",
"0.69051975",
"0.6898672",
"0.68976134",
"0.68419594",
"0.68... | 0.6951013 | 14 |
Extracts file name from file path (not including extension) | def extract_file_name(file_path):
# ファイルパスからファイル名(拡張子含む)を取り出す
file_name = file_path.split('/')[-1]
# 拡張子を取り除く
return file_name.split('.')[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_name(path: str) -> str:\n return os.path.splitext(os.path.basename(path))[0]",
"def getfilename(path):\r\n return path.split('\\\\').pop().split('/').pop().rsplit('.', 1)[0]",
"def file_name(path):\n return os.path.basename(path).split('.')[0]",
"def get_file_name(file_path):\n full_... | [
"0.8715548",
"0.86639875",
"0.86091185",
"0.8563638",
"0.85208607",
"0.8497839",
"0.8352039",
"0.8335342",
"0.8314756",
"0.8260435",
"0.8197826",
"0.81866497",
"0.8095197",
"0.8033655",
"0.8029191",
"0.7977432",
"0.79481006",
"0.7930753",
"0.79278266",
"0.7901418",
"0.7837515... | 0.8845883 | 0 |
Returns current time as '%Y%m%d%H%M%S' string | def now_datetime():
now = datetime.datetime.now()
return now.strftime('%Y%m%d%H%M%S') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_current_time():\n return strftime(\"%Y_%m_%d_%H_%M_%S_%Z\", gmtime())",
"def get_current_time():\n return time.strftime(\"%Y-%m-%d-%H-%M-%S\", time.localtime())",
"def time_now():\n cur_time = str(datetime.now().strftime(\"%d-%m-%Y %H:%M:%S\"))\n return cur_time",
"def current_time():\n ... | [
"0.8493195",
"0.8434943",
"0.8412798",
"0.84043145",
"0.8325539",
"0.82955456",
"0.8203032",
"0.81751466",
"0.8141215",
"0.81292236",
"0.8083702",
"0.8069793",
"0.8033297",
"0.79770666",
"0.7951352",
"0.7935939",
"0.7892529",
"0.7859924",
"0.7855944",
"0.78430516",
"0.7841576... | 0.84515804 | 1 |
Get all documents to be indexed conforming to the schema | def get_items_to_index(self):
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_documents(\n self, index: str, query: Dict[str, Any] = None\n ) -> Iterable[Dict[str, Any]]:\n return es_scan(self.__client__, query=query or {}, index=index)",
"def bulk_get_documents():\n ids = flask.request.json\n if not ids:\n raise UserError(\"No ids provided\")\n i... | [
"0.689363",
"0.68376887",
"0.6788542",
"0.67389685",
"0.66998225",
"0.66399837",
"0.65739137",
"0.6378266",
"0.63479394",
"0.6343179",
"0.6341851",
"0.63180757",
"0.62861663",
"0.6283073",
"0.6260351",
"0.62475955",
"0.62401104",
"0.61905485",
"0.6179511",
"0.61615217",
"0.61... | 0.0 | -1 |
sets up the environment before its testing begun | def setUpClass(cls):
# use cls.__something if you wish to add some static objects into it
handler = logging.StreamHandler(stream=sys.stderr)
handler.setLevel(logging.DEBUG)
logging.getLogger().addHandler(handler)
logging.getLogger().setLevel(logging.DEBUG) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def SetupEnvironment(self):\n pass",
"def setup_environment():\n global _ENV_SETUP_DONE\n if _ENV_SETUP_DONE:\n return\n _ENV_SETUP_DONE = True\n\n _configure_libraries()\n\n custom_module_path = os.environ.get(\"DETECTRON2_ENV_MODULE\")\n\... | [
"0.85461134",
"0.8049342",
"0.7556871",
"0.7501226",
"0.7498831",
"0.74953127",
"0.74777406",
"0.74777406",
"0.7453637",
"0.73980796",
"0.73111117",
"0.7296043",
"0.722044",
"0.7185756",
"0.71791804",
"0.7172264",
"0.71720064",
"0.7166148",
"0.71606356",
"0.71355957",
"0.7060... | 0.0 | -1 |
Return a time stamp in date time format | def fixture_second_timestamp(timestamp) -> datetime.datetime:
return timestamp + datetime.timedelta(days=10) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timestamp():\n return time.strftime('%Y-%m-%d %H:%M:%S')",
"def timestamp():\n my_date_object = datetime.utcnow()\n my_date_string = my_date_object.strftime('%d-%m-%Y %H:%M:%S')\n return my_date_string",
"def time_stamp():\n \n today = datetime.datetime.now()\n return today.str... | [
"0.8024783",
"0.7883266",
"0.78595704",
"0.77234113",
"0.7721484",
"0.7717472",
"0.76698935",
"0.7659639",
"0.76376826",
"0.7617638",
"0.7597528",
"0.7595086",
"0.75727594",
"0.75496215",
"0.7479271",
"0.74275947",
"0.74023354",
"0.7389078",
"0.7359437",
"0.73397434",
"0.7325... | 0.0 | -1 |
Function to set the name of a hexagon to the correct name (number). | def set_name(api_key, tygron_id, hex_id,
api_endpoint=("https://engine.tygron.com/api/session/event/"
"EditorBuildingEventType/SET_NAME/?")):
r = requests.post(url=api_endpoint+api_key, json=[tygron_id, str(hex_id)])
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_name(name_idx):\n return \"explored%s.set_%05d.xa_%08d\" % (\n ArrayParameter.IDENTIFIER,\n name_idx // 1000,\n name_idx,\n )",
"def update_hexagons_tygron_id(api_key, hexagons):\n buildings_json = get_buildings(api_key)\n building_indices = {}\n ... | [
"0.5881488",
"0.5826369",
"0.5683673",
"0.5620663",
"0.5558112",
"0.5516085",
"0.5431137",
"0.5402292",
"0.53735334",
"0.5367253",
"0.5364026",
"0.5355493",
"0.5334124",
"0.5283778",
"0.52785116",
"0.5265447",
"0.52545244",
"0.52326155",
"0.52306306",
"0.52300334",
"0.5227822... | 0.60160667 | 0 |
Returns the plate's local end force vector | def f(self, combo_name='Combo 1'):
# Calculate and return the plate's local end force vector
return add(matmul(self.k(), self.d(combo_name)), self.fer(combo_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_effectors_pos(self):\n def relative_pos_in_egocentric_frame(physics):\n end_effector = physics.bind(self._entity.end_effectors).xpos\n torso = physics.bind(self._entity.root_body).xpos\n xmat = np.reshape(physics.bind(self._entity.root_body).xmat, (3, 3))\n return np.reshape(np.dot(e... | [
"0.6467782",
"0.6414848",
"0.62456554",
"0.5817251",
"0.5693018",
"0.5637133",
"0.5628126",
"0.55882394",
"0.5588016",
"0.5581251",
"0.55777365",
"0.5494832",
"0.54618824",
"0.5449381",
"0.5437008",
"0.54288536",
"0.5414165",
"0.5408133",
"0.537844",
"0.53745925",
"0.5361922"... | 0.63448447 | 2 |
Returns the rectangle's local fixed end reaction vector. | def fer(self, combo_name='Combo 1'):
# Initialize the fixed end reaction vector
fer = zeros((12, 1))
# Get the requested load combination
combo = self.model.LoadCombos[combo_name]
# Initialize the element's surface pressure to zero
p = 0
# Loop... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_effectors_pos(self):\n def relative_pos_in_egocentric_frame(physics):\n end_effector = physics.bind(self._entity.end_effectors).xpos\n torso = physics.bind(self._entity.root_body).xpos\n xmat = np.reshape(physics.bind(self._entity.root_body).xmat, (3, 3))\n return np.reshape(np.dot(e... | [
"0.635611",
"0.61520875",
"0.6093797",
"0.59142333",
"0.5863026",
"0.58372337",
"0.5779902",
"0.5776772",
"0.56388843",
"0.5606299",
"0.55939883",
"0.55901825",
"0.5575811",
"0.5536565",
"0.5504254",
"0.5494207",
"0.54929674",
"0.54815066",
"0.54595745",
"0.54466003",
"0.5437... | 0.0 | -1 |
Returns the plate's local displacement vector | def d(self, combo_name='Combo 1'):
# Calculate and return the local displacement vector
return matmul(self.T(), self.D(combo_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displacement(self):\n return np.array(self.get_current_cartesian_position().position) - self.initial_position",
"def getOriginVector(self):\n return self.dest - self.orig",
"def vector(self) -> Vector:\n return self._normal * self._distance_from_origin",
"def GravityVector(self):\n ... | [
"0.7053816",
"0.63343763",
"0.6284261",
"0.61883146",
"0.59812814",
"0.5961065",
"0.590632",
"0.5817088",
"0.58114207",
"0.57960117",
"0.5783343",
"0.5746658",
"0.57226366",
"0.5709794",
"0.5676317",
"0.5669916",
"0.56689715",
"0.56669223",
"0.56544334",
"0.564324",
"0.564256... | 0.5859905 | 7 |
Returns the plate's global nodal force vector | def F(self, combo_name='Combo 1'):
# Calculate and return the global force vector
return matmul(inv(self.T()), self.f(combo_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_force_vector(self) -> NDArray:\n\n forces = flatten(\n [[node.force.fx, node.force.fy] for node in self.nodes]\n )\n return np.array(forces, dtype=np.float64).reshape(\n self.get_number_of_dofs(), 1\n )",
"def get_force(self):\n displ = self.get_di... | [
"0.68591774",
"0.66163063",
"0.6526741",
"0.6185808",
"0.5984102",
"0.5963688",
"0.5877415",
"0.5841482",
"0.5741223",
"0.57373834",
"0.5713077",
"0.57008344",
"0.56954217",
"0.5684319",
"0.5650184",
"0.5620997",
"0.5598612",
"0.5582241",
"0.5573736",
"0.55695486",
"0.5544257... | 0.5192745 | 67 |
Returns the plate's global displacement vector for the given load combination. | def D(self, combo_name='Combo 1'):
# Initialize the displacement vector
D = zeros((24, 1))
# Read in the global displacements from the nodes
D.itemset((0, 0), self.i_node.DX[combo_name])
D.itemset((1, 0), self.i_node.DY[combo_name])
D.itemset((2, 0), sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def d(self, combo_name='Combo 1'):\n\n # Calculate and return the local displacement vector\n return matmul(self.T(), self.D(combo_name))",
"def displacement(self):\n return np.array(self.get_current_cartesian_position().position) - self.initial_position",
"def displacement_from_surface_load... | [
"0.5946909",
"0.54665965",
"0.5231496",
"0.5175889",
"0.51203185",
"0.50840205",
"0.50371945",
"0.5032711",
"0.49216226",
"0.49163213",
"0.4861059",
"0.48333216",
"0.4832876",
"0.48002887",
"0.4759573",
"0.47336084",
"0.4728652",
"0.47230038",
"0.47207555",
"0.47160384",
"0.4... | 0.46991676 | 22 |
Returns the plate's transformation matrix | def T(self):
# Calculate the direction cosines for the local x-axis
# The local x-axis will run from the i-node to the j-node
xi = self.i_node.X
xj = self.j_node.X
yi = self.i_node.Y
yj = self.j_node.Y
zi = self.i_node.Z
zj = self.j_node.Z
x = [(x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transformation_matrix(self):\n t = np.array([[0.0], [0.0], [0.0]])\n Rt = np.hstack([self.rotation_matrix, t])\n return np.vstack([Rt, np.array([0.0, 0.0, 0.0, 1.0])])",
"def get_transformation_matrix(self):\n\n s = self.sin()\n c = self.cos()\n return np.array(\n ... | [
"0.7521351",
"0.7355739",
"0.7244954",
"0.7208509",
"0.7193422",
"0.7193422",
"0.71591365",
"0.71137446",
"0.7048217",
"0.69682175",
"0.6917635",
"0.68684006",
"0.6840496",
"0.67807406",
"0.67593294",
"0.6758699",
"0.6709253",
"0.6696803",
"0.66954464",
"0.65536743",
"0.65514... | 0.69805884 | 9 |
Returns the plate's displacement coefficient matrix [C] | def _C(self):
# Find the local x and y coordinates at each node
xi = 0
yi = 0
xj = self.width()
yj = 0
xm = xj
ym = self.height()
xn = 0
yn = ym
# Calculate the [C] coefficient matrix
C = array([[1, xi, yi, xi**2, xi*yi, yi**2, xi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def m_c(self) -> np.ndarray:\n assert self._k is not None, \"camera must be calibrated\"\n return forge_projective_matrix(self._k)",
"def c_coefficients(x1,x2,x3,y1,y2,y3,initial_slope,final_slope):\n\tC = c_matrix(x1,x2,x3)\n\ty = y_vector(x1,x2,x3,y1,y2,y3,initial_slope,final_slope)\n\tCCoefficie... | [
"0.63772506",
"0.6143459",
"0.6094555",
"0.6072907",
"0.6006293",
"0.5974486",
"0.5959939",
"0.59011567",
"0.5864534",
"0.5793513",
"0.57648194",
"0.56787795",
"0.5678773",
"0.5678146",
"0.56597847",
"0.55940014",
"0.5590818",
"0.55762076",
"0.5556221",
"0.55486333",
"0.55423... | 0.6193459 | 1 |
Return deep copy of this board. This clone of the board can be passed safely to any player without taking the risk of lunatic players damaging the original board. | def deepCopy(self):
clone = Connect_N_Board(self.getWidth(), self.getHeight())
import copy
clone.cell = copy.deepcopy(self.cell)
return clone | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\r\n\t\tnewBoard = BoardClass()\r\n\r\n\t\tfor row in self.board:\r\n\t\t\tnewBoard.board.append(row[:])\r\n\t\tnewBoard.x = self.x\r\n\t\tnewBoard.y = self.y\r\n\t\tnewBoard.heuristic = self.heuristic\r\n\t\tnewBoard.n = self.n\r\n\t\tnewBoard.hType = self.hType\r\n\t\tnewBoard.steps = self.steps\r... | [
"0.8394391",
"0.83269477",
"0.8312972",
"0.81450045",
"0.80880094",
"0.8018189",
"0.80172944",
"0.7986561",
"0.79701126",
"0.7933263",
"0.77827954",
"0.76440704",
"0.7575607",
"0.75439066",
"0.74951863",
"0.7493786",
"0.74502647",
"0.74459124",
"0.7373089",
"0.7325345",
"0.72... | 0.8111755 | 4 |
Records the player's colour, either black or for white. Should also set the name of the player. | def __init__(self, colour):
self.colour = colour
self.name = "Player" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updatePlayer(self, _player):\n if _player.color == 'black': self.players['black'] = _player\n else: self.players['white'] = _player",
"def player(self):\n return self._color",
"def switch_player(self):\n if self.playerOne:\n # sets the chip color to blue\n ... | [
"0.75764513",
"0.6954662",
"0.6630727",
"0.6328392",
"0.6285385",
"0.6149251",
"0.6125379",
"0.60314083",
"0.60195285",
"0.58754647",
"0.58627224",
"0.5834706",
"0.5774131",
"0.57675064",
"0.5767079",
"0.57331955",
"0.5710875",
"0.5673335",
"0.5668842",
"0.56438184",
"0.56277... | 0.71703076 | 1 |
NN constructor which we pass a dict of parameters | def init_params(self, parameters):
max_epoch = parameters['num_epoch']
momentum_rate = parameters['momentum']
loss = parameters['loss_function']
accuracy = parameters['accuracy']
regularization = parameters['regularization']
batch_size = parameters['batch_size']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, num_labels):\n super().__init__()\n self.a = torch.nn.Parameter(torch.randn(num_labels))",
"def __init__(self, input_size, neurons):\n super().__init__()\n self.input_size = input_size\n self.neurons = neurons\n self.params[\"w\"] = np.random.randn(inp... | [
"0.67972517",
"0.67953134",
"0.6721277",
"0.66650045",
"0.6640788",
"0.66400546",
"0.66311556",
"0.66311556",
"0.66311556",
"0.6566211",
"0.6543916",
"0.65327525",
"0.6497855",
"0.6437372",
"0.63905233",
"0.636781",
"0.631781",
"0.62985086",
"0.629422",
"0.62932986",
"0.62742... | 0.0 | -1 |
Convert to array of [x, y, blocksize, blocksize, 3] i.e. a coordinate system that allows for an X/Y indexing with blocks. | def toXY(im, blocksize):
blocks = img.reshape(
img.shape[0]//blocksize,
blocksize,
img.shape[1]//blocksize,
blocksize, 3).swapaxes(1, 2)
return blocks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunk_coords_to_block_coords(\n x: int, z: int, chunk_x_size: int = 16, chunk_z_size: int = 16\n) -> ChunkCoordinates:\n return x * chunk_x_size, z * chunk_z_size",
"def _block(self, x, y):\n\n cells = []\n\n ix = x - (x%3)\n iy = y - (y%3)\n\n for y in range(iy, iy+3):\n ... | [
"0.6671259",
"0.64263934",
"0.63331187",
"0.6333016",
"0.6325375",
"0.61881614",
"0.6173598",
"0.61610925",
"0.6149343",
"0.6100957",
"0.6100957",
"0.6100957",
"0.6012429",
"0.601241",
"0.59837717",
"0.5964142",
"0.5961271",
"0.5925309",
"0.59243315",
"0.59138536",
"0.5880371... | 0.6979222 | 0 |
given an image, blur it by sigma, and return it. | def blur2D(image2D,sigmaFrac=10):
#NOTE: sigma may not be number of pixels
ftimage = np.fft.fftshift(np.fft.fft2(image2D))
ncols, nrows = image2D.shape
cy, cx = nrows/2, ncols/2
sigmax,sigmay=ncols/sigmaFrac,nrows/sigmaFrac
x = np.linspace(0, nrows, nrows)
y = np.linspace(0, ncols, ncols)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blur(image, kernel_size=(7, 7)):\n image = cv2.blur(image, kernel_size)\n return image",
"def blur(image, kernel_size=(7, 7)):\n image = cv2.blur(image, kernel_size)\n return image",
"def blur_image(im, n, ny=None) :\n g = gauss_kern(n, sizey=ny)\n improc = signal.convolve(im,g, mode='sam... | [
"0.8163476",
"0.8163476",
"0.7801661",
"0.77766097",
"0.7752083",
"0.77352905",
"0.77145207",
"0.7708557",
"0.7681655",
"0.7650684",
"0.7605923",
"0.75963664",
"0.75580513",
"0.75147927",
"0.747618",
"0.7467116",
"0.74622226",
"0.74622226",
"0.74622226",
"0.74622226",
"0.7462... | 0.72938246 | 39 |
Given a list of images, create a 3D numpy array to represent them and save it as a given filename (ending in .npy). All images must be identical dimensions. Saves the data, and also returns it. Alternatively, if the save path already exists, just load and return it. | def images_to_numpy(imageList,saveAs):
saveAs=os.path.abspath(saveAs)
if os.path.exists(saveAs):
print("loading data from %s ..."%(os.path.basename(saveAs)))
data=np.load(saveAs)
if len(data)==len(imageList):
print(" loaded %.02f MB array"%(data.nbytes/2**20),data.shape)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maybe_save_images(images, filenames):\n\n if FLAGS.output_dir is not None:\n batch_size = images.shape[0]\n for i in xrange(batch_size):\n image_array = images[i, :, :]\n file_path = os.path.join(FLAGS.output_dir, filenames[i])\n image = Image.fromarray(np.uint... | [
"0.6884683",
"0.64679337",
"0.62741685",
"0.61704886",
"0.61682105",
"0.61396915",
"0.60557383",
"0.6034646",
"0.6021969",
"0.599016",
"0.59869087",
"0.59666246",
"0.5923276",
"0.59129447",
"0.59066796",
"0.58843315",
"0.58667195",
"0.58599645",
"0.58546424",
"0.5854446",
"0.... | 0.7248182 | 0 |
return total number od edges in the graph | def num_of_edge(self):
try:
return self.edges
except:
print("ERROR: No graph exists") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edge_count(self):\r\n return int(sum(self.degree(node) for node in range(self.size))/2)",
"def return_num_edges(self):\n return sum(map(lambda x: len(x),self.__adj))",
"def num_edges(self):\n return sum(1 for _ in self.iteredges())",
"def num_edges(self):\n return sum(len(v.ad... | [
"0.8688742",
"0.8679134",
"0.8618837",
"0.8593283",
"0.8531312",
"0.84645194",
"0.843575",
"0.8365236",
"0.83262277",
"0.8287084",
"0.827881",
"0.8266862",
"0.8233163",
"0.82308143",
"0.8182939",
"0.81733197",
"0.81395024",
"0.81287533",
"0.8078853",
"0.80309623",
"0.8011414"... | 0.83777636 | 7 |
return the number of directed edges towards the node | def in_degree(self, node):
try:
return len(self.prefix[node])
except:
print("ERROR: The node does not exist.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edge_count(self):\n total = sum(len(self._outgoing[v]) for v in self._outgoing)\n # for undirected graphs, make sure not to double-count edges\n return total if self.is_directed() else total // 2",
"def return_num_edges(self):\n return sum(map(lambda x: len(x),self.__adj))",
"de... | [
"0.78448033",
"0.7772245",
"0.7695838",
"0.7562893",
"0.7534973",
"0.7467137",
"0.7451937",
"0.7396427",
"0.7373336",
"0.73292255",
"0.732624",
"0.7317787",
"0.72837895",
"0.72651726",
"0.7249782",
"0.7246866",
"0.7079935",
"0.7069049",
"0.7059385",
"0.7043632",
"0.70170116",... | 0.0 | -1 |
return the number of subgraphs in the graph | def num_of_subgraphs(self):
G = self.to_undirected_graph()
count = G.num_subgraph()
print('The number of disconnected components in the graph is ', count) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ngraphs(self):\n return len(self.__graph_list)",
"def __len__(self):\n return len(self.subgraph_list)",
"def graph_count(self) -> int:\n return int(self.graph_tuple_stats.graph_count)",
"def __len__(self) -> int:\n return len(self.graphs)",
"def Nedges(self):\n return len... | [
"0.8073201",
"0.79633546",
"0.7285349",
"0.72463423",
"0.7187033",
"0.71759033",
"0.7161565",
"0.71102256",
"0.70808554",
"0.7021192",
"0.69902027",
"0.695379",
"0.6935887",
"0.6914862",
"0.68882954",
"0.68802977",
"0.68694854",
"0.6839879",
"0.6822821",
"0.679994",
"0.679574... | 0.86686105 | 0 |
Return the deep copy of the graph | def copy(self):
G = DiGraph()
G.node_set = copy.deepcopy(self.node_set)
G.prefix = copy.deepcopy(self.prefix)
G.suffix = copy.deepcopy(self.suffix)
G.num_node = copy.deepcopy(self.num_node)
G.edges = copy.deepcopy(self.edges)
return G | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_copy_of_graph(self):\r\n return deepcopy(self)",
"def copy_graph(g):\n return copy.deepcopy(g)",
"def copy(self):\n cls = self.__class__\n new_graph = cls.__new__(cls)\n new_graph._nodes = self._nodes[:]\n new_graph._node_wip = self._node_wip[:]\n new_graph.... | [
"0.91176546",
"0.8802937",
"0.82550997",
"0.8243993",
"0.8026738",
"0.80088556",
"0.7968061",
"0.77141285",
"0.7699701",
"0.7615446",
"0.76087004",
"0.75499827",
"0.74691683",
"0.7404277",
"0.7394699",
"0.7377999",
"0.73346615",
"0.7324835",
"0.73133886",
"0.7299594",
"0.7248... | 0.80551386 | 4 |
return whether the graph has cycle | def is_cyclic(self):
visited = set()
path = []
for node in self.node_set:
if node not in visited:
if self.is_cyclic_helper(node, visited, path) is True:
return True
visited.clear()
path.cle... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_cycle(self):\n traversed = dict()\n for i in self.adj_list:\n traversed[i] = False\n\n for i in self.adj_list:\n if not traversed[i]:\n if self.has_cycle_helper(i, traversed, -1):\n return True\n return False",
"def has_c... | [
"0.8378776",
"0.7984986",
"0.7911707",
"0.7880922",
"0.78286994",
"0.7662443",
"0.76118547",
"0.7569022",
"0.74262905",
"0.7295127",
"0.7267389",
"0.71993303",
"0.71563673",
"0.7154375",
"0.7140454",
"0.711544",
"0.7092382",
"0.7090839",
"0.7086551",
"0.7086194",
"0.70694536"... | 0.7653314 | 6 |
Lookup a symbol. If implicit_extrn is True and this is the first fetch of this variable, declare it as an extrn. Otherwise, it must be a label. | def fetch(self, name, implicit_extrn=False):
if name not in self.symbols:
if implicit_extrn:
self.extrn(name)
else:
self.label(name, None)
return self.symbols[name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extrn(self, name):\n if name in self.symbols:\n raise Redeclaration(name)\n self.symbols[name] = Symbol(name, 'extrn', None)",
"def resolve_symbol(self, symbol):\n if symbol in self.labels:\n return self.labels[symbol]\n if symbol in PREDEFINED_MEM:\n ... | [
"0.6169494",
"0.5972883",
"0.5459213",
"0.5338175",
"0.5249722",
"0.52001464",
"0.5198688",
"0.51028335",
"0.5051382",
"0.5046638",
"0.5035687",
"0.49785256",
"0.49657345",
"0.49439415",
"0.49278852",
"0.48954237",
"0.48881257",
"0.48838553",
"0.48028132",
"0.47846344",
"0.47... | 0.7447887 | 0 |
Initialises the Time Series object and takes care of the preprocessing. | def __init__(self, pandas_dataframe, dates_column, target_column, regressors=None, train_test_split=0.66, seed=7,
look_back=1, look_forward=1, interval=0):
data = pd.DataFrame(index=pandas_dataframe[dates_column].values, data=pandas_dataframe[target_column].values)
# Calculate the train... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, ts_df, time_format=\"%Y-%m-%d %H:%M:%S\", freq='D',\n fill_method='ffill',\n n_test=0, n_val=0,\n hyper_params=None,\n test='adf',\n trend=None,\n seasonal=False,\n seasonal_periods=1,... | [
"0.67759717",
"0.64579755",
"0.62661517",
"0.626543",
"0.6141596",
"0.6094404",
"0.60800564",
"0.6037951",
"0.6028122",
"0.60011363",
"0.5991543",
"0.5987348",
"0.5983617",
"0.59743816",
"0.5939063",
"0.5937174",
"0.59082216",
"0.5873293",
"0.58130807",
"0.580144",
"0.5794228... | 0.5797429 | 20 |
plots a graph of training history accross epoch. Will plot val_accuracy and val_loss if available. | def show_training_history(self):
hist = [i.history["loss"][0] for i in self.history]
plt.plot(hist) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_training_history(history, metric):\n \n val_metric = 'val_'+metric\n acc = history.history[metric]\n val_acc = history.history[val_metric]\n \n loss = history.history['loss']\n val_loss = history.history['val_loss']\n \n epochs_range = history.epoch\n \n plt.figure(figsize... | [
"0.8660942",
"0.85116714",
"0.848824",
"0.8419464",
"0.83680147",
"0.83555114",
"0.83237",
"0.8210739",
"0.81741",
"0.80971825",
"0.8090667",
"0.80894804",
"0.8087157",
"0.8082884",
"0.80086863",
"0.79302275",
"0.7922569",
"0.7915268",
"0.7892611",
"0.78382677",
"0.7768835",
... | 0.7895779 | 18 |
Reshape data to add a 3rd dimension for regressors (=> order 2 tensor) | def add_regressors(x_train, x_test, regressors, pandas_dataframe, dates_column, look_forward, look_back):
nb_regressors = len(regressors)
train_size = x_train.shape[0]
x_train = x_train.reshape([x_train.shape[0], x_train.shape[1], 1])
x_test = x_test.reshape([x_test.shape[0], x_test.shape[1], 1])
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reshape(data):\n return K.reshape(x=data, shape=(K.shape(data)[0], 1, reshape_size))",
"def flatten_layers(data):\n return data.reshape((data.shape[0], data.shape[1], -1))",
"def _data_reshape(self, data):\n data_offset = [int(size / 2) for size in data.shape[1:]]\n data_diff = ... | [
"0.76164657",
"0.671869",
"0.65869874",
"0.6584175",
"0.65416545",
"0.6345288",
"0.6294165",
"0.62597686",
"0.6141166",
"0.61180943",
"0.61121535",
"0.6090363",
"0.6082886",
"0.6051846",
"0.6028656",
"0.60019135",
"0.59782827",
"0.5966563",
"0.59192854",
"0.5912304",
"0.59122... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.