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 |
|---|---|---|---|---|---|---|
Gets or sets the Snapshot Resource Group Uri. | def resource_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "resource_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_uri(self):\n if self._uri is None:\n self._uri = \"{0}{1}/{2}\".format(\n self.session.resource_prefix,\n self.base_uri,\n self.ip_or_ifname_or_group_name,\n )\n\n return self._uri",
"def getSourceGroupUri(self, sourceGroupN... | [
"0.6672572",
"0.6584541",
"0.6555394",
"0.62171316",
"0.6185841",
"0.60799724",
"0.60523444",
"0.60163105",
"0.60163105",
"0.60163105",
"0.60163105",
"0.60163105",
"0.60163105",
"0.5857674",
"0.5845869",
"0.5804673",
"0.5778218",
"0.5741504",
"0.5653732",
"0.56422544",
"0.563... | 0.0 | -1 |
Gets or sets the Backup Instance friendly name. | def friendly_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "friendly_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getname(self):\n if self.instance is not None:\n return '%s_%s' % (self.name,self.instance)\n else:\n return self.name",
"def base_instance_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"base_instance_name\")",
"def recovery_basebackup_name(self) ->... | [
"0.6856098",
"0.6756638",
"0.66634184",
"0.66634184",
"0.6636592",
"0.6622414",
"0.6599539",
"0.6565111",
"0.64920545",
"0.6442701",
"0.6422962",
"0.6302145",
"0.6264109",
"0.6263948",
"0.62619346",
"0.6215663",
"0.62055",
"0.62055",
"0.6185765",
"0.6179922",
"0.6179922",
"... | 0.0 | -1 |
DatasourceType of the resource. | def datasource_type(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "datasource_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datasource_type(self) -> Optional[str]:\n return pulumi.get(self, \"datasource_type\")",
"def datasource_type(self) -> Optional[str]:\n return pulumi.get(self, \"datasource_type\")",
"def resource_type(cls):\n pass",
"def datasource_types(self) -> Sequence[str]:\n return pulum... | [
"0.8332458",
"0.8332458",
"0.6924982",
"0.6771135",
"0.6762105",
"0.6757145",
"0.6757145",
"0.6676432",
"0.6616782",
"0.65630734",
"0.6558074",
"0.6558074",
"0.6558074",
"0.6558074",
"0.6558074",
"0.65022177",
"0.6381401",
"0.63401395",
"0.63123864",
"0.61606944",
"0.6122727"... | 0.8126562 | 4 |
Resource Type of Datasource. | def resource_type(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "resource_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(cls):\n pass",
"def resource_type(self) -> str:\n return 'TABLE'",
"def datasource_type(self) -> Optional[str]:\n return pulumi.get(self, \"datasource_type\")",
"def datasource_type(self) -> Optional[str]:\n return pulumi.get(self, \"datasource_type\")",
"def d... | [
"0.7715713",
"0.7293414",
"0.7189991",
"0.7189991",
"0.7006099",
"0.7006099",
"0.7006099",
"0.7006099",
"0.69505984",
"0.69505984",
"0.6874316",
"0.6779358",
"0.663781",
"0.6331858",
"0.6200698",
"0.6200294",
"0.609024",
"0.609024",
"0.609024",
"0.609024",
"0.6067112",
"0.6... | 0.67527145 | 15 |
DatasourceType of the resource. | def datasource_type(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "datasource_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datasource_type(self) -> Optional[str]:\n return pulumi.get(self, \"datasource_type\")",
"def datasource_type(self) -> Optional[str]:\n return pulumi.get(self, \"datasource_type\")",
"def resource_type(cls):\n pass",
"def datasource_types(self) -> Sequence[str]:\n return pulum... | [
"0.8332458",
"0.8332458",
"0.6924982",
"0.6771135",
"0.6762105",
"0.6757145",
"0.6757145",
"0.6676432",
"0.6616782",
"0.65630734",
"0.6558074",
"0.6558074",
"0.6558074",
"0.6558074",
"0.6558074",
"0.65022177",
"0.6381401",
"0.63401395",
"0.63123864",
"0.61606944",
"0.6122727"... | 0.8126562 | 5 |
Resource Type of Datasource. | def resource_type(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "resource_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(cls):\n pass",
"def resource_type(self) -> str:\n return 'TABLE'",
"def datasource_type(self) -> Optional[str]:\n return pulumi.get(self, \"datasource_type\")",
"def datasource_type(self) -> Optional[str]:\n return pulumi.get(self, \"datasource_type\")",
"def d... | [
"0.7715713",
"0.7293414",
"0.7189991",
"0.7189991",
"0.7006099",
"0.7006099",
"0.7006099",
"0.7006099",
"0.69505984",
"0.69505984",
"0.6874316",
"0.6779358",
"0.663781",
"0.6331858",
"0.6200698",
"0.6200294",
"0.609024",
"0.609024",
"0.609024",
"0.609024",
"0.6067112",
"0.6... | 0.67527145 | 16 |
Whether Date is last date of month | def is_last(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "is_last") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_date_accept_last_month(self):\n spi_search = \"find date last month\"\n inv_search = \"year:\" + datetime.datetime.strftime(datetime.datetime.today()\\\n +dateutil.relativedelta.relativedelta(months=-1), '%Y-%m')\n ... | [
"0.77162737",
"0.7637003",
"0.7193566",
"0.70495266",
"0.7004585",
"0.7004585",
"0.6877646",
"0.6862508",
"0.682804",
"0.68218356",
"0.6819492",
"0.6755318",
"0.66948193",
"0.6609038",
"0.6583995",
"0.6571988",
"0.65471333",
"0.639158",
"0.62951434",
"0.6255444",
"0.6177465",... | 0.5627973 | 44 |
The identityType which can be either SystemAssigned or None | def type(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(self) -> Optional[pulumi.Input[Union[str, 'ManagedIdentityType']]]:\n return pulumi.get(self, \"type\")",
"def identity_type(self) -> Optional[pulumi.Input[Union[str, 'CmkIdentityType']]]:\n return pulumi.get(self, \"identity_type\")",
"def type(self) -> Optional[pulumi.Input[Union[str, ... | [
"0.75816554",
"0.74341595",
"0.7400746",
"0.7229784",
"0.69520336",
"0.6785936",
"0.67084223",
"0.6648023",
"0.6622422",
"0.6600688",
"0.6586064",
"0.6586064",
"0.6508316",
"0.6442587",
"0.6383647",
"0.63552207",
"0.62491965",
"0.6175007",
"0.616516",
"0.616516",
"0.61416066"... | 0.0 | -1 |
Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded during restore. | def excluded_namespaces(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "excluded_namespaces") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def excluded_namespaces(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"excluded_namespaces\")",
"def network_excludes(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"network_excludes\")",
"def excludes(self) -> Set:\n if self._excludes is None:\n... | [
"0.726951",
"0.62028396",
"0.5755019",
"0.5741694",
"0.5657844",
"0.5616728",
"0.5605919",
"0.5605919",
"0.54789275",
"0.541648",
"0.5362451",
"0.53375274",
"0.5171774",
"0.51673895",
"0.51673895",
"0.5159387",
"0.51503",
"0.51384497",
"0.5132136",
"0.511799",
"0.5068539",
... | 0.68901426 | 2 |
Gets or sets the Backup Data Source Parameters | def backup_datasource_parameters_list(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[Union['BlobBackupDatasourceParametersArgs', 'KubernetesClusterBackupDatasourceParametersArgs']]]]]:
return pulumi.get(self, "backup_datasource_parameters_list") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backup_datasource_parameters_list(self) -> Optional[Sequence[Any]]:\n return pulumi.get(self, \"backup_datasource_parameters_list\")",
"def alternate_data_source_parameters(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['DataSourceParametersArgs']]]]:\n return pulumi.get(self, \"alternate... | [
"0.65967256",
"0.6167608",
"0.60494995",
"0.57744884",
"0.5750568",
"0.56374073",
"0.5545736",
"0.55366623",
"0.55174905",
"0.5504011",
"0.54434407",
"0.5417025",
"0.5359193",
"0.53465897",
"0.52679724",
"0.5253878",
"0.5172687",
"0.51035506",
"0.50621635",
"0.5059192",
"0.50... | 0.65284705 | 1 |
Gets or sets the DataStore Parameters | def data_store_parameters_list(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['AzureOperationalStoreParametersArgs']]]]:
return pulumi.get(self, "data_store_parameters_list") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_db_params(self):\n return self.get_section_config('db')",
"def data_store(self) -> pulumi.Input['DataStoreInfoBaseArgs']:\n return pulumi.get(self, \"data_store\")",
"def data_store_parameters_list(self) -> Optional[Sequence['outputs.AzureOperationalStoreParametersResponse']]:\n re... | [
"0.6543305",
"0.6396027",
"0.62810415",
"0.60769933",
"0.60487574",
"0.59728533",
"0.5954893",
"0.5902878",
"0.5873714",
"0.5806075",
"0.5778994",
"0.5533632",
"0.55123836",
"0.53959596",
"0.53892213",
"0.53793097",
"0.5341296",
"0.5333229",
"0.5328833",
"0.53278583",
"0.5304... | 0.6497708 | 2 |
This is day of the month from 1 to 28 other wise last of month | def days_of_month(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['DayArgs']]]]:
return pulumi.get(self, "days_of_month") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_end_month(month):\n return datetime(2020, month, 28)",
"def last_month_day():\r\n return (datetime.now().replace(day=1) + relativedelta(months=1) + timedelta(days=-1)).strftime(\r\n '%d-%m-%Y')",
"def end_month(d):\n return date(d.year, d.month, monthrange(d.year, d.month)[1])",
"def ... | [
"0.72630197",
"0.72102946",
"0.69404685",
"0.68378407",
"0.6751712",
"0.6708872",
"0.66512066",
"0.66361827",
"0.66361827",
"0.6594036",
"0.6382701",
"0.63677865",
"0.6337808",
"0.6312749",
"0.6309078",
"0.63083476",
"0.63046056",
"0.62925106",
"0.62711346",
"0.6258508",
"0.6... | 0.0 | -1 |
It should be January/February/....../December | def months_of_year(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[Union[str, 'Month']]]]]:
return pulumi.get(self, "months_of_year") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_month_from_number(self):\r\n self.assertEqual(cds.month_from_number(1).lower(), \"january\")\r\n self.assertEqual(cds.month_from_number(2).lower(), \"february\")\r\n self.assertEqual(cds.month_from_number(3).lower(), \"march\")\r\n self.assertEqual(cds.month_from_number(4).lowe... | [
"0.68180126",
"0.66443074",
"0.6586514",
"0.6534415",
"0.6534415",
"0.6532568",
"0.6496522",
"0.64385635",
"0.6434855",
"0.6405171",
"0.63991946",
"0.63788974",
"0.6369394",
"0.63448685",
"0.63098675",
"0.63045895",
"0.62641734",
"0.62180465",
"0.62179214",
"0.62167174",
"0.6... | 0.0 | -1 |
Class representing a secret store resource. | def __init__(__self__, *,
secret_store_type: pulumi.Input[Union[str, 'SecretStoreType']],
uri: Optional[pulumi.Input[str]] = None,
value: Optional[pulumi.Input[str]] = None):
pulumi.set(__self__, "secret_store_type", secret_store_type)
if uri is not Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secretstore():\n pass",
"def secret_store(self) -> Optional['outputs.SecretStoreResponse']:\n return pulumi.get(self, \"secret_store\")",
"def secrets(self):\n return self._secrets_store",
"def __init__(__self__, *,\n secret_store_type: str,\n uri: Optiona... | [
"0.6171773",
"0.60597205",
"0.5969506",
"0.58767223",
"0.5844875",
"0.5803025",
"0.57169145",
"0.57089055",
"0.5687889",
"0.56631774",
"0.5640458",
"0.5571856",
"0.5555573",
"0.5554669",
"0.5450947",
"0.5418171",
"0.5418171",
"0.54017866",
"0.5349379",
"0.53453124",
"0.534502... | 0.5872231 | 4 |
Gets or sets the type of the datastore. | def datastore_type(self) -> Optional[pulumi.Input[Union[str, 'StorageSettingStoreTypes']]]:
return pulumi.get(self, "datastore_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datastore_type(self) -> Optional[str]:\n return pulumi.get(self, \"datastore_type\")",
"def data_store_type(self) -> str:\n return pulumi.get(self, \"data_store_type\")",
"def data_store_type(self) -> str:\n return pulumi.get(self, \"data_store_type\")",
"def data_store_type(self) ->... | [
"0.83830196",
"0.7282083",
"0.7282083",
"0.7005503",
"0.7005503",
"0.7005503",
"0.68426",
"0.67546064",
"0.6690773",
"0.6659043",
"0.66421914",
"0.6623806",
"0.66209894",
"0.66209894",
"0.6607081",
"0.6566162",
"0.6566162",
"0.6554883",
"0.6511155",
"0.6494774",
"0.64919704",... | 0.7673924 | 1 |
Gets or sets the type. | def type(self) -> Optional[pulumi.Input[Union[str, 'StorageSettingTypes']]]:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_type(self):\n return self.type",
"def get_type(self):\n return self.type",
"def get_type(self):\n return self._type",
"def get_type(self):\n return self._type",
"def type(self):\n return self._getValue('type')",
"def get_type(self):\n return self._TYPE",
... | [
"0.8533302",
"0.8533302",
"0.844054",
"0.844054",
"0.8312111",
"0.827963",
"0.8276462",
"0.82763165",
"0.81963736",
"0.8196329",
"0.8196329",
"0.8196329",
"0.8196329",
"0.8196329",
"0.8196329",
"0.8196329",
"0.8196329",
"0.8196329",
"0.8196329",
"0.8196329",
"0.8196329",
"0... | 0.0 | -1 |
calculate the probabilities of the given data and labels p(x), p(y) and (y|x) | def extract_probs(label, x):
b = np.ascontiguousarray(x).view(np.dtype((np.void, x.dtype.itemsize * x.shape[1])))
unique_array, unique_indices, unique_inverse_x, unique_counts = \
np.unique(b, return_index=True, return_inverse=True, return_counts=True)
unique_a = x[unique_indices]
b1 = np.ascontiguousarray(unique... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prob(self, x, y):\n p = self.tag_prob(y)\n for i in range(len(y)):\n p *= self.out_prob(x[i], y[i])\n\n return p",
"def probabilities(self, x, y):\n return self.feed_and_return(x, y, self.network.a)",
"def predict_prob(self, _input_data):\n yhat_probs = (self.m... | [
"0.69859254",
"0.6970387",
"0.6938792",
"0.6771588",
"0.6624184",
"0.65702873",
"0.6564338",
"0.6527763",
"0.6505747",
"0.6497186",
"0.6476133",
"0.64545935",
"0.644594",
"0.6423038",
"0.641216",
"0.63977325",
"0.63880986",
"0.63880986",
"0.63880986",
"0.6362084",
"0.6315531"... | 0.732544 | 0 |
View method. Renders page for contact help | def referee_help_contacts(request):
if not validate_request(request): return redirect(reverse(URL_FORBIDDEN))
if request.method == "GET":
return render(
request,
'app/referee/help_contacts.html',
{
'title':'Help Contacts',
'layout_dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact():\n return render_template('contact.html')",
"def contact():\n\n\treturn render_template('contact.html', title='Contact',\n\t\t\t\t\t\t year=datetime.now().year,\n\t\t\t\t\t\t message='Your contact page.')",
"def contact():\n return render_template(\n 'contact.html',\n titl... | [
"0.773772",
"0.7708961",
"0.7685682",
"0.7600462",
"0.75811005",
"0.7575485",
"0.7575485",
"0.7569908",
"0.75331885",
"0.7529173",
"0.7511574",
"0.74924576",
"0.74924576",
"0.74924576",
"0.74924576",
"0.74924576",
"0.74924576",
"0.74924576",
"0.74924576",
"0.747382",
"0.74411... | 0.7591644 | 4 |
Loads the data from a json file. If there are no objects of interest, then load all the objects. | def loadjson(path, objectsofinterest, img):
with open(path) as data_file:
data = json.load(data_file)
# print (path)
pointsBelief = []
boxes = []
points_keypoints_3d = []
points_keypoints_2d = []
pointsBoxes = []
poses = []
centroids = []
translations = []
rotations ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load(self):\n if self.file_path.exists():\n with open(self.file_path) as fid:\n self.data = json.load(fid)",
"def load(self):\n if not self.exist:\n self.create()\n\n with open(self.file_path, encoding=Config.ENCODING) as file:\n self.data... | [
"0.77436537",
"0.7502876",
"0.71920633",
"0.7154787",
"0.7097119",
"0.70624936",
"0.69570625",
"0.6944725",
"0.6907088",
"0.6882725",
"0.6871144",
"0.6864754",
"0.68565696",
"0.6854614",
"0.6841895",
"0.6838909",
"0.6832275",
"0.68125933",
"0.67923707",
"0.67768687",
"0.67741... | 0.0 | -1 |
Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
hass.data[DOMAIN].pop(entry.entry_id)
return unload_ok | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True",
... | [
"0.697284",
"0.6888074",
"0.6779855",
"0.6747459",
"0.6689002",
"0.6657831",
"0.66162205",
"0.6603433",
"0.65925974",
"0.65595686",
"0.65411645",
"0.6507643",
"0.6507643",
"0.6507643",
"0.6507643",
"0.64977276",
"0.64931643",
"0.6486601",
"0.6486601",
"0.6486601",
"0.6486601"... | 0.64530563 | 34 |
Return the dataset used to populate the search index. | def get_search_queryset(self, index='_all'):
raise NotImplementedError(
"{} does not implement 'get_search_queryset'.".format(
self.__class__.__name__
)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataset(self):\n if self.mode == \"test\":\n return OnlineQueryDataset(self.mode, self.df, self.tokenizer)\n else:\n return OnlineQueryDataset(self.mode, self.df_reindex, self.tokenizer)",
"def indexed_dataset(self) -> Dict[int, List]:\n if self.__indexed_datase... | [
"0.725499",
"0.72075206",
"0.7205865",
"0.6751035",
"0.66947275",
"0.6607834",
"0.6565908",
"0.6444941",
"0.64403594",
"0.6313509",
"0.627967",
"0.62438416",
"0.623242",
"0.622177",
"0.61654854",
"0.6106826",
"0.6089863",
"0.60442346",
"0.60292387",
"0.60286516",
"0.6016198",... | 0.0 | -1 |
Return the list of indexes for which this model is configured. | def search_indexes(self):
return get_model_indexes(self.__class__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indexes(self) -> list:\n return self._indexes",
"def indexes(self):\n return getattr(self, '_indexes', None)",
"def indexes(self):\n indexes = self.execute(self.commands.get_indexes(self.name))\n return [Index(*tup) for tup in indexes]",
"def get_indexes(self):\n indexe... | [
"0.8692105",
"0.8514446",
"0.8210036",
"0.795419",
"0.77589834",
"0.76806927",
"0.7617313",
"0.7530399",
"0.7503585",
"0.73796904",
"0.7201449",
"0.71161354",
"0.7091268",
"0.707684",
"0.70442325",
"0.7041412",
"0.7020364",
"0.6934508",
"0.68621194",
"0.67804945",
"0.67197925... | 0.83852255 | 2 |
Return the doc_type used for the model. | def search_doc_type(self):
return self._meta.model_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"document_type\")",
"def get_doc_type(self):\n if not self.is_documented():\n return DocType.none\n if self._rawdoc.is_local():\n return DocType.internal\n return self._rawdoc.get_... | [
"0.82361764",
"0.80209893",
"0.7931122",
"0.7815026",
"0.77053124",
"0.76103824",
"0.7474635",
"0.7339738",
"0.7115166",
"0.70386565",
"0.7001553",
"0.6996704",
"0.6989295",
"0.69780153",
"0.69780153",
"0.6934298",
"0.69298863",
"0.6918553",
"0.6918553",
"0.6918553",
"0.69185... | 0.8121655 | 1 |
The max relevance score in the returned page. | def max_score(self):
return max(self._extract_set('score') or [0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_score(self):\r\n return self.lcp.get_max_score()",
"def get_max_score(self):\r\n maxscore = 0\r\n for responder in self.responders.values():\r\n maxscore += responder.get_max_score()\r\n return maxscore",
"def max_score(self):\n return self.raw_possible",
... | [
"0.76658165",
"0.7388483",
"0.73434436",
"0.7306693",
"0.7241699",
"0.7122095",
"0.70414704",
"0.70045257",
"0.6962654",
"0.69466114",
"0.68930626",
"0.68438125",
"0.6801763",
"0.6801763",
"0.67588747",
"0.6756714",
"0.6755588",
"0.6690131",
"0.6664121",
"0.66097033",
"0.6591... | 0.77822024 | 0 |
The min relevance score in the returned page. | def min_score(self):
return min(self._extract_set('score') or [0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min(self):\n return self.min",
"def find_min(self):\n return self.min",
"def relevance(self):\n return self.metadata.relevance",
"def _tmdb_score(title, min_votes=0):\n info = tmdb_info(title)\n if info:\n if min_votes and info['votes'] < min_votes:\n ret... | [
"0.6556876",
"0.6556876",
"0.6471062",
"0.64088386",
"0.6408385",
"0.6394548",
"0.6357086",
"0.6329675",
"0.6329675",
"0.6329516",
"0.63281",
"0.63099796",
"0.63099796",
"0.63099796",
"0.62903345",
"0.62828356",
"0.6275028",
"0.6274877",
"0.62644005",
"0.625758",
"0.625758",
... | 0.7817991 | 0 |
Find nearest value is an array | def find_nearest(array, value):
idx = (np.abs(array-value)).argmin()
return idx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_nearest(array, value):\n if isinstance(array, list):\n array = np.array(array)\n idx = (np.abs(array-value)).argmin()\n return idx",
"def find_nearest(array,value):\n idx = (np.abs(array-value)).argmin()\n return idx",
"def find_nearest(value,array):\n idx = numpy.abs(value-ar... | [
"0.7865756",
"0.77515066",
"0.76853406",
"0.7665857",
"0.76219594",
"0.76063406",
"0.76048523",
"0.76048523",
"0.753522",
"0.7457811",
"0.7457811",
"0.7439638",
"0.73862314",
"0.73599696",
"0.73247737",
"0.72137177",
"0.7179227",
"0.71250546",
"0.710034",
"0.703493",
"0.69839... | 0.7605422 | 6 |
function for Gaussian doublet | def f_doublet(x, c, i1, i2, sigma_gal, z, sigma_inst):
dblt_mu = [3727.092, 3729.875] # the actual non-redshifted wavelengths
l1 = dblt_mu[0] * (1+z)
l2 = dblt_mu[1] * (1+z)
sigma = np.sqrt(sigma_gal**2 + sigma_inst**2)
norm = (sigma*np.sqrt(2*np.pi))
term1 = ( i1 / norm ) * np.exp(-(x-l1)**... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def func_gaussian(self, dmv, vpar):\n dmoff = dmv - vpar[0]\n sig = vpar[1]\n sig = sig * sig\n return np.exp(-0.5 * dmoff * dmoff / sig) * self.ThetaFunc(dmv)",
"def Gaussian(x,t,sigma):\n return np.exp(-(x-t)**2/(2*sigma**2))",
"def _gaussian_distribution(self, x: ndarray, mu: ... | [
"0.70588374",
"0.7025088",
"0.69851714",
"0.6947471",
"0.6907649",
"0.6901051",
"0.6871714",
"0.6869415",
"0.68690425",
"0.68538356",
"0.68074876",
"0.6803383",
"0.6794585",
"0.67712307",
"0.6753062",
"0.67484576",
"0.6735663",
"0.67319995",
"0.6726064",
"0.6708039",
"0.67017... | 0.0 | -1 |
Returns True if n is prime. | def isPrime(n):
if n == 2:
return True
if n == 3:
return True
if n % 2 == 0:
return False
if n % 3 == 0:
return False
i = 5
w = 2
while i * i <= n:
if n % i == 0:
return False
i += w
w = 6 - w
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isprime(n):\r\n\treturn is_prime(n)",
"def isprime(n):\n\treturn is_prime(n)",
"def if_prime(cls, n):\n\n if (n <= 1):\n return False\n if (n <= 3):\n return True\n\n if (n % 2 == 0 or n % 3 == 0):\n return False\n\n i = 5\n while(i * i <=... | [
"0.8514553",
"0.85052115",
"0.8478591",
"0.8415317",
"0.8408101",
"0.84059155",
"0.8389028",
"0.8350958",
"0.83173066",
"0.83133805",
"0.8305305",
"0.83034956",
"0.830075",
"0.82713956",
"0.8248401",
"0.8248108",
"0.8245176",
"0.82376003",
"0.82293326",
"0.82223743",
"0.82108... | 0.7929015 | 52 |
update learning rate based on number of epochs. | def get_learning_rate(self):
config = self.config
cur_lr = Train_model_pipeline.adjust_learning_rate(
self.optimizer,
self.epoch,
config["training"]["learning_rate"],
decay=config["training"]["lr_decay_rate"],
step=config["training"]["lr_decay_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_learning_rate(self):\r\n self.scheduler.step(self.clock.epoch)",
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr",
"def updatelearningrate(self, epoch):\n self.lr = getlearningrate(epoch=epoch, opt=self.opt)\n # update learning ... | [
"0.84405017",
"0.81472224",
"0.803189",
"0.796083",
"0.79512155",
"0.79512155",
"0.7872908",
"0.7766583",
"0.7766583",
"0.7752016",
"0.76515144",
"0.76494586",
"0.7617318",
"0.7574289",
"0.75422424",
"0.75035465",
"0.7499424",
"0.74836063",
"0.7475335",
"0.74470955",
"0.74378... | 0.0 | -1 |
This function returns a singular html template. This template enables the user to view the home page. This is the centre of the program and where you can access all the various different parts of the program through the buttons provided. | def home_page() -> str:
return render_template("home.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n return render_template('Main_Page.html')",
"def home():\n return render_template('main.html')",
"def home():\n return render_template('homepage.html')",
"def home():\n return render_template(\"home.html\")",
"def home():\n return render_template(\"home.html\")",
"def home():\... | [
"0.8343259",
"0.82844776",
"0.8245626",
"0.8198781",
"0.8198781",
"0.81965923",
"0.8167671",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
... | 0.83848834 | 0 |
This is the first part of the recommendation to the user. This calls a function that searches for all the tanks currently available and all their capabilites. It then passes this information to a html template that is returned at the end of the function. The html template allows the user interface to display all the av... | def make_first_recommendation() -> str:
available_tanks = tank_search()
fermentation_tanks = available_tanks[0]
conditioning_tanks = available_tanks[1]
fermentation_advice = available_tanks[2]
conditioning_advice = available_tanks[3]
more_beer = available_tanks[4]
return render_templa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tank_search():\r\n more_fermentation = None\r\n more_fermentation = None\r\n fermentation_tanks = []\r\n conditioning_tanks = []\r\n #Search for available tanks that can ferment\r\n for tank_type in TANKS:\r\n if \"Fermenter\" in brewer_tanks[tank_type][\"Capabilities\"]:\r\n ... | [
"0.65310216",
"0.6325169",
"0.60679734",
"0.5968718",
"0.5820628",
"0.578148",
"0.57569426",
"0.55996466",
"0.5597419",
"0.5594505",
"0.55584127",
"0.5540173",
"0.5539492",
"0.548138",
"0.54568136",
"0.54489106",
"0.54305226",
"0.54056174",
"0.54024667",
"0.5389053",
"0.53655... | 0.6866057 | 0 |
Check to see if the data to be set is greater than 41. If so it sets its self to an empty bytearray | def data(self, data):
if len(data) > 41:
self._data = b""
else:
self._data = data
return self._data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bytearray_doesnt_overfill(self):\n self._doesnt_overfill_test(bytearray)",
"def test_bytearray_really_doesnt_overfill(self):\n self._doesnt_overfill_test(bytearray)",
"def test_has_correct_length(self) -> None:\n assert len(list(self._dataset)) == 7168",
"def iseod(self):\n\n ... | [
"0.6138799",
"0.60896724",
"0.59207314",
"0.5884751",
"0.5841276",
"0.58060604",
"0.5703514",
"0.5611757",
"0.55998605",
"0.55391407",
"0.5529907",
"0.5529907",
"0.5501765",
"0.5496981",
"0.54673624",
"0.54673624",
"0.54673624",
"0.54673624",
"0.5466879",
"0.5455637",
"0.5447... | 0.59941256 | 2 |
Initializes the DMAX class | def __init__(self, json):
if "show" not in json or "videos" not in json:
raise Exception("Invalid JSON.")
self.show = Show(json["show"])
self.seasons = []
for seasonNumber in self.show.seasonNumbers:
try:
season_json = json["videos"]["episode"][s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.max = None\n self.st = []",
"def __init__(self, MAX_VALUE = 6):\n self.DIE_MAX = MAX_VALUE\n self.NUMBER = 0",
"def __init__(self):\n self.counts = [0] * 10\n self.values = [0] * 10\n self.softmaxvalues = [0] * 10\n self.t = 0.3... | [
"0.6973113",
"0.666962",
"0.6616509",
"0.6554326",
"0.65416646",
"0.65109324",
"0.6510333",
"0.650464",
"0.6479047",
"0.64742815",
"0.64552224",
"0.6419474",
"0.6398021",
"0.63797534",
"0.6374326",
"0.6365662",
"0.6362007",
"0.63569117",
"0.6339352",
"0.6321092",
"0.6305269",... | 0.0 | -1 |
1hot encodes a tensor | def to_categorical(y, num_classes):
return np.eye(num_classes, dtype="uint8")[y] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output",
"def one_hot_encode(self, arr, n_labels):\n one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\... | [
"0.82578593",
"0.8061468",
"0.80140257",
"0.7917851",
"0.7914897",
"0.7883416",
"0.78429884",
"0.78089696",
"0.7765784",
"0.77376443",
"0.77376443",
"0.7733915",
"0.7728651",
"0.77133274",
"0.7686273",
"0.76797515",
"0.75851345",
"0.7560708",
"0.75560004",
"0.75353223",
"0.75... | 0.0 | -1 |
return a zero value corresponding to a flux calculation on sflux | def _get_zero_like(cls, sflux, axis=-1):
# _sflux = _drop_units(sflux)
# shape = _sflux.shape
# if axis < 0:
# axis = len(shape) + axis
# newshape = shape[:axis] + shape[axis + 1:]
# return np.zeros(newshape, _sflux.dtype)
return np.zeros_like(sflux).sum(axis=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ST_zero_flux(self):\n return 10 ** (-0.4 * self.ST_zero_mag) * Unit('erg*s-1*cm-2*AA-1')",
"def ST_zero_flux(self):\n return 10 ** (-0.4 * self.ST_zero_mag) * Unit('erg*s**-1*cm**-2*AA**-1')",
"def AB_zero_flux(self):\n return 10 ** (-0.4 * self.AB_zero_mag) * Unit('erg*s**-1*cm**-2*AA... | [
"0.81539816",
"0.812855",
"0.739736",
"0.7279082",
"0.72650796",
"0.7200664",
"0.69272596",
"0.69256216",
"0.6809822",
"0.67327976",
"0.6680877",
"0.6661498",
"0.65945995",
"0.6578463",
"0.6567132",
"0.6441287",
"0.6402233",
"0.6368012",
"0.6365504",
"0.63605064",
"0.6322309"... | 0.7736126 | 2 |
AB flux zero point in Jansky (Jy) | def AB_zero_Jy(self):
c = 1e-8 * Constants.c.to('m/s').value
f = 1e5 / c * self.lpivot.to('AA').value ** 2 * self.AB_zero_flux.value
return f * Unit('Jy') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Vega_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').value\n f = 1e5 / c * (self.lpivot.to('AA').value ** 2 *\n self.Vega_zero_flux.to('erg*s**-1*cm**-2*AA**-1').value)\n return f * Unit('Jy')",
"def ST_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').valu... | [
"0.7955171",
"0.7926594",
"0.74460584",
"0.7234044",
"0.7013625",
"0.67468727",
"0.66445875",
"0.6607706",
"0.6427392",
"0.62358874",
"0.60310906",
"0.5993075",
"0.59417474",
"0.5927505",
"0.5927505",
"0.59052306",
"0.5900024",
"0.58882886",
"0.5878071",
"0.5853615",
"0.58445... | 0.8312335 | 0 |
Vega flux zero point in Jansky (Jy) | def Vega_zero_Jy(self):
c = 1e-8 * Constants.c.to('m/s').value
f = 1e5 / c * (self.lpivot.to('AA').value ** 2 *
self.Vega_zero_flux.to('erg*s**-1*cm**-2*AA**-1').value)
return f * Unit('Jy') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ST_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').value\n f = 1e5 / c * self.lpivot.to('AA').value ** 2 * self.ST_zero_flux.value\n return f * Unit('Jy')",
"def Vega_zero_Jy(self):\n return self._get_mean_and_samples_attribute('Vega_zero_Jy')",
"def AB_zero_Jy(self):\n ... | [
"0.78034115",
"0.7717615",
"0.74681675",
"0.6807964",
"0.6759582",
"0.6725391",
"0.6689461",
"0.6658358",
"0.6530621",
"0.6493975",
"0.63182706",
"0.6184906",
"0.6149092",
"0.60269374",
"0.60091394",
"0.59725505",
"0.5924603",
"0.5868209",
"0.585497",
"0.5825818",
"0.58106613... | 0.8467789 | 0 |
Returns the attribute from the mean passband | def _get_mean_attribute(self, attr, *args, **kwargs):
attr = getattr(self.mean_, attr)
try:
return attr(*args, **kwargs)
except TypeError:
return attr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMean(self):\n return self.mean",
"def mean(self):\r\n\t\treturn sum(self.sample)/len(self.sample)",
"def _mean(self,gp):\r\n return self.gp_link.transf(gp)",
"def _mean(self,gp):\r\n return self.gp_link.transf(gp)",
"def _mean(self,gp):\r\n return self.gp_link.transf(gp)"... | [
"0.6703737",
"0.65768284",
"0.6554898",
"0.6554898",
"0.6554898",
"0.6554898",
"0.6554898",
"0.6549539",
"0.651033",
"0.6477349",
"0.6470019",
"0.6453719",
"0.6453719",
"0.6441814",
"0.64380246",
"0.6393722",
"0.63826346",
"0.6331023",
"0.6312477",
"0.62369126",
"0.6231755",
... | 0.6751219 | 0 |
AB flux zero point in Jansky (Jy) | def AB_zero_Jy(self):
return self._get_mean_and_samples_attribute('AB_zero_Jy') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AB_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').value\n f = 1e5 / c * self.lpivot.to('AA').value ** 2 * self.AB_zero_flux.value\n return f * Unit('Jy')",
"def Vega_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').value\n f = 1e5 / c * (self.lpivot.to('AA').value ** 2 ... | [
"0.8312335",
"0.7955171",
"0.7926594",
"0.7234044",
"0.7013625",
"0.67468727",
"0.66445875",
"0.6607706",
"0.6427392",
"0.62358874",
"0.60310906",
"0.5993075",
"0.59417474",
"0.5927505",
"0.5927505",
"0.59052306",
"0.5900024",
"0.58882886",
"0.5878071",
"0.5853615",
"0.584456... | 0.74460584 | 3 |
Vega magnitude zero point Vegamag = 2.5 log10(f_lamb) + 2.5 log10(f_vega) Vegamag = 2.5 log10(f_lamb) zpts | def Vega_zero_mag(self):
return self._get_mean_and_samples_attribute('Vega_zero_mag') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Vega_zero_mag(self):\n flux = self.Vega_zero_flux.value\n if flux > 0:\n return -2.5 * np.log10(flux)\n else:\n return float('nan')",
"def V_magEarth(alpha,a_p,d):\n V = 5.*np.log10(a_p*d) - 3.99 - 1.060e-3*alpha + 2.054e-4*alpha**2.\n return V",
"def vega(f... | [
"0.7171862",
"0.6595487",
"0.6569158",
"0.6311985",
"0.6289262",
"0.62558156",
"0.6234904",
"0.61879754",
"0.616959",
"0.61420524",
"0.6128055",
"0.61219585",
"0.60586685",
"0.6034381",
"0.60135555",
"0.5930348",
"0.5930348",
"0.5911923",
"0.590989",
"0.5858539",
"0.58078855"... | 0.69578356 | 1 |
Vega flux zero point in Jansky (Jy) | def Vega_zero_Jy(self):
return self._get_mean_and_samples_attribute('Vega_zero_Jy') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Vega_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').value\n f = 1e5 / c * (self.lpivot.to('AA').value ** 2 *\n self.Vega_zero_flux.to('erg*s**-1*cm**-2*AA**-1').value)\n return f * Unit('Jy')",
"def ST_zero_Jy(self):\n c = 1e-8 * Constants.c.to('m/s').valu... | [
"0.8467789",
"0.78034115",
"0.74681675",
"0.6807964",
"0.6759582",
"0.6725391",
"0.6689461",
"0.6658358",
"0.6530621",
"0.6493975",
"0.63182706",
"0.6184906",
"0.6149092",
"0.60269374",
"0.60091394",
"0.59725505",
"0.5924603",
"0.5868209",
"0.585497",
"0.5825818",
"0.58106613... | 0.7717615 | 2 |
Send out email to user with the order details | def email_order(request, order, user_correct):
users_entries = get_entries(order)
html_email = loader.render_to_string(
'email_templates/order_complete.html',
{
'order': order,
'user': request.user.first_name,
'user_correct': user_correct,
'users_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _send_email_details(self, order):\n customer_email = order.email\n email_subject = render_to_string(\n 'checkout/confirmation_emails/confirmation_email_subject.txt',\n {'order': order})\n email_body = render_to_string(\n 'checkout/confirmation_emails/confir... | [
"0.82928586",
"0.7682682",
"0.74174416",
"0.7049885",
"0.70146614",
"0.6994562",
"0.6991252",
"0.6910069",
"0.6819035",
"0.6795749",
"0.6749802",
"0.660168",
"0.64808744",
"0.6464286",
"0.6408604",
"0.6406102",
"0.63820356",
"0.6380898",
"0.63727355",
"0.6362171",
"0.63594854... | 0.7942199 | 1 |
Getter function for tensor's maximum value Returns | def max(self):
return self.__max | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max(self):\n\t\tif self.right:\n\t\t\treturn self.right.get_max()\n\t\treturn self.value",
"def get_max(self):\n if not self:\n return None\n return self.right.get_max() if self.right else self.value #Ternarary Operator",
"def get_max_value(self):\n if self.is_ready():\n... | [
"0.7814502",
"0.7655354",
"0.76547945",
"0.7586031",
"0.7586031",
"0.7586031",
"0.7586031",
"0.7586031",
"0.7586031",
"0.75612974",
"0.7405042",
"0.7402439",
"0.74016994",
"0.7342071",
"0.732159",
"0.7286938",
"0.72835016",
"0.7277852",
"0.72358626",
"0.72238904",
"0.7197944"... | 0.7198591 | 20 |
Constructor for dictionary of quantized tensors and it's parameters. Defines Qmn data format for all operands taking into account accumulator limitations and containers size. Construct dictionary with quantized data and number of integer and fractional bits. | def __quantize_layer_operands(self, params_type, var_type, accum_bits):
# define how much bits should we keep unused in operands
w_shape = self.__weights.get_shape()
macs_per_out = int(np.prod(w_shape[1:])) + 1 if w_shape is not None else 1
extra_bits_required = int(np.ceil(np.log2(macs_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantize(self, some_tensor, bits=32) -> dict:\n raise NotImplementedError(\"To be Overidden by derived class\")",
"def __init__(self, jsondict=None, strict=True):\n \n self.conversionFactor = None\n \"\"\" SI to Customary unit conversion factor.\n Type `float`. \"\"\"\n ... | [
"0.62280905",
"0.564548",
"0.56182826",
"0.55725956",
"0.5435131",
"0.54296976",
"0.54244226",
"0.53989583",
"0.53947866",
"0.5351157",
"0.53509235",
"0.534555",
"0.5313687",
"0.5309652",
"0.5300345",
"0.5295646",
"0.52824205",
"0.52723515",
"0.52277386",
"0.51975316",
"0.518... | 0.49785843 | 57 |
Draw multiline segment line. | def draw_multi_segment_line(cvs, points, antialias):
x, y = [], []
for (x1, y1) in points:
x.append(x1)
y.append(y1)
xs, ys = np.array(x), np.array(y)
points = pd.DataFrame({'x': xs, 'y': ys, 'val': 5.0})
agg = cvs.line(points, 'x', 'y', agg=ds.reductions.max("val"),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_line_segment(\n x1: float, y1: float, x2: float, y2: float, color: C3F\n ) -> None:\n pyglet.graphics.draw(\n 2,\n pyglet.gl.GL_LINE_STRIP,\n (GeoDrawer._VERTEX_MODE, [x1, y1, x2, y2]),\n (GeoDrawer._COLOR_MODE, color * 2),\n )",
"def c... | [
"0.712841",
"0.71167517",
"0.7035058",
"0.6927008",
"0.69184357",
"0.6912172",
"0.68933135",
"0.6888025",
"0.687332",
"0.68591684",
"0.6811891",
"0.6798206",
"0.6752544",
"0.6743064",
"0.6726996",
"0.668786",
"0.6682396",
"0.6651137",
"0.6635995",
"0.66094404",
"0.66072714",
... | 0.6414569 | 38 |
Add the positions of the extra analysis points to the plot using a scatter plot. | def add_to_plot(self, m=None, **kwargs):
if m is None:
logger.debug("No projection defined")
logger.debug('Adding extra analysis points to plot')
dataplot = plt.scatter(self.x, self.y, **kwargs)
else:
logger.debug("Applying projection to coordinates")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_positions_to_plot(self, **kwargs):\n logger.debug('Adding data positions to plot')\n plt.scatter(self.x, self.y, **kwargs)",
"def plot_scatter_points(self):\n self.plot(1)",
"def plot_scatter_points_lines(self):\n self.plot(2)",
"def show_scatter(self):\n plt.scatte... | [
"0.7823959",
"0.76678294",
"0.7274649",
"0.67439365",
"0.6629936",
"0.65924805",
"0.65924805",
"0.6554216",
"0.6543434",
"0.65303415",
"0.6525799",
"0.65004516",
"0.6477438",
"0.64087903",
"0.63663775",
"0.6360046",
"0.63596565",
"0.6346742",
"0.6313364",
"0.6305566",
"0.6264... | 0.6911374 | 3 |
ConvReLUBatch Normalization layer for timing. This does not use dilated convolutions. | def time_conv_layer(model, nb_filters):
model = Conv1D(filters=nb_filters, kernel_size=3, padding='causal', activation='relu')(model)
model = BatchNormalization()(model)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TCN(input_dim): \r\n # Number of dilations in order to use for the temporal blocks.\r\n dilations = np.array([1, 2, 4, 8, 16, 32])\r\n\r\n input_dim.insert(0,1)\r\n print(f\"input_dim: {input_dim}\")\r\n input_layer = Input(shape=input_dim)\r\n cropping = 0\r\n assert (sum(dilations) * blo... | [
"0.60287344",
"0.5751664",
"0.5739958",
"0.57281977",
"0.5697611",
"0.5562304",
"0.55605",
"0.5474903",
"0.54483545",
"0.5435087",
"0.5429619",
"0.5400676",
"0.53994817",
"0.5386998",
"0.5351907",
"0.5351409",
"0.5315514",
"0.5312692",
"0.53119487",
"0.531136",
"0.5309245",
... | 0.5593623 | 5 |
Multiplies learning rate by 0.1 at 100 and 150 epochs, i.e., new learning rate = old learning rate 0.1 | def lr_scheduler(epochs):
switch_points = [0, 99, 149]
for i in [2, 1, 0]:
if epochs >= switch_points[i]:
return 0.001 * pow(0.1, i) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr",
"def adjust_learning_rate(optimizer, epoch):\n lr = opt.lr * (0.5 ** (epoch // opt.step))\n return lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 *... | [
"0.7858263",
"0.77125233",
"0.7631209",
"0.7599146",
"0.7599146",
"0.75638705",
"0.7546732",
"0.7529453",
"0.75288504",
"0.75178415",
"0.7515504",
"0.75136405",
"0.7512143",
"0.75012887",
"0.7496099",
"0.7484208",
"0.7483087",
"0.7482462",
"0.7481481",
"0.74794",
"0.74794",
... | 0.0 | -1 |
Update segment tree. Don't forget to update cur.val when finishing update left or right branch. | def updateTree(self, i, val, cur):
start, end = cur.start, cur.end
if start == end == i:
cur.val = val
return
mid = start+(end-start)/2
if i <= mid:
cur.val -= cur.left.val
self.updateTree(i, val, cur.left)
cur.val += cur.left.v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __update(self, idx):\n parent = (idx - 1) // 2\n while parent >= 0:\n left, right = 2 * parent + 1, 2 * parent + 2\n self.__tree[parent] = self.__tree[left] + self.__tree[right]\n parent = (parent - 1) // 2",
"def updatetree(self):\n if self.node:\n self... | [
"0.67214155",
"0.6306272",
"0.61446464",
"0.6127258",
"0.59922403",
"0.5971634",
"0.5816988",
"0.5806862",
"0.5668333",
"0.5661651",
"0.56332695",
"0.5599132",
"0.5585826",
"0.55756366",
"0.5561707",
"0.549598",
"0.5485218",
"0.54720384",
"0.54681623",
"0.54573953",
"0.543765... | 0.7396965 | 0 |
Determines the dot product of two vectors. | def dotProduct(v1, v2):
return sum((a * b) for a, b in zip(v1, v2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))",
"def dot(vector1, vector2):\n return sum(a1 * a2 for a1, a2 in zip(vector1, vector2))",
... | [
"0.8847897",
"0.87523925",
"0.87215096",
"0.8702009",
"0.8628717",
"0.86110663",
"0.86099905",
"0.8586864",
"0.8546255",
"0.8509135",
"0.848024",
"0.8465942",
"0.84573877",
"0.83769715",
"0.835582",
"0.83436835",
"0.82595724",
"0.8258707",
"0.82569945",
"0.8238753",
"0.822051... | 0.8594053 | 7 |
Instantiate a new Location object. | def __init__(self, i1=None, i2=None, axial=None, label=None):
self.i1 = i1 # will be 1 for center.
self.i2 = i2
self.setAxial(axial)
if not label:
self.label = "ExCore"
self.makeLabel()
else:
self.fromLabel(label)
self.firstChar = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def newLocation(self, **attrlinks):\n return Location(self, **attrlinks)",
"def __init__(self, location):\n self.location = location",
"def create_location(self, location):\n \"Does nothing\"",
"def __init__(self):\n this = _sunpos.new_cLocation()\n try: self.this.append(this)\... | [
"0.75213677",
"0.7396841",
"0.7207325",
"0.714897",
"0.7116795",
"0.708318",
"0.6895766",
"0.688466",
"0.6838823",
"0.67938846",
"0.6786126",
"0.67531747",
"0.6702149",
"0.651652",
"0.6497623",
"0.6468116",
"0.64227",
"0.6399603",
"0.6314982",
"0.6285724",
"0.6156157",
"0.6... | 0.0 | -1 |
Check equality between locations. | def __eq__(self, other):
if not issubclass(other.__class__, Location):
return False
considerations = [
self.i1 == other.i1,
self.i2 == other.i2,
self.axial == other.axial,
self.label == other.label,
]
return all(considerations) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, Location):\n return False # pragma: nocover\n return self.latitude == other.latitude and self.longitude == other.longitude",
"def sameLocation(self, other):\n if not isinstance(other,Point):\n return False\n re... | [
"0.7465757",
"0.7173755",
"0.69456905",
"0.68631357",
"0.6830194",
"0.6830194",
"0.68289477",
"0.6805213",
"0.6774094",
"0.67294335",
"0.66825354",
"0.6651678",
"0.6637405",
"0.6637012",
"0.6622103",
"0.65752906",
"0.65546346",
"0.64931685",
"0.64499307",
"0.644077",
"0.64161... | 0.7117363 | 2 |
Determines if another location is stacked with this one (for equivalence testing). | def isInSameStackAs(self, loc):
if self.i1 == loc.i1 and self.i2 == loc.i2:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def altloc_match(self, other: AtomKey) -> bool:\n ...",
"def is_standalone(self, prev_locations):\n if self._locations != prev_locations:\n return True\n elif self.size:\n return True\n elif self._count:\n return True\n return False",
"def is_... | [
"0.6210208",
"0.6191093",
"0.6158436",
"0.61319274",
"0.6059272",
"0.6009066",
"0.5975616",
"0.5886521",
"0.58241713",
"0.5813602",
"0.57885575",
"0.57864624",
"0.5772882",
"0.5749183",
"0.5728331",
"0.570694",
"0.5688356",
"0.5680987",
"0.5679803",
"0.5677977",
"0.5656998",
... | 0.7433343 | 0 |
Calculates the distance between the current coordinates and the targetCoords. This is used to help determine the optimal packing for a core | def getDistanceOfLocationToPoint(self, targetCoords=None, pitch=None):
# auto detect what the input is for auto coords and translate into a tuple
if targetCoords:
if not isinstance(targetCoords, tuple):
targetCoords = targetCoords.coords(p=pitch)
else:
ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_distance(target_coords, chip):\n\n for z in chip.coordinates:\n for y in z:\n for x in y:\n x.distance_to_goal = abs(x.x_coord - target_coords[0])\n x.distance_to_goal += abs(x.y_coord - target_coords[1])\n x.distance_to_goal += abs(x.... | [
"0.7075014",
"0.6965575",
"0.68605727",
"0.6628953",
"0.65025884",
"0.6489333",
"0.6477388",
"0.6429518",
"0.6356393",
"0.6328232",
"0.63032037",
"0.62321806",
"0.61943305",
"0.6167752",
"0.6164678",
"0.6150171",
"0.6142189",
"0.6053825",
"0.6036588",
"0.6034328",
"0.6030777"... | 0.59636754 | 27 |
Return The total number of positions in the specified number of rings. Notes a single pin counts as 1 ring. | def getNumPositions(self, rings=None):
if rings is None:
rings = self.ring
if rings == 0:
return 0
else:
return 1 + sum([6 * n for n in range(rings)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumPositions(self, rings=None):\n if rings is None:\n rings = self.i1\n return sum(self.getNumPosInRing(ringNum) for ringNum in range(rings + 1))",
"def getNumRings(self, nPins, silent=False):\n numPositions = 0\n for nRings in itertools.count(0):\n numPos... | [
"0.78359944",
"0.72448283",
"0.703219",
"0.6982429",
"0.67126626",
"0.6570651",
"0.64970434",
"0.6483523",
"0.62990856",
"0.6290666",
"0.61671436",
"0.61543256",
"0.61224073",
"0.6110513",
"0.6020392",
"0.5976255",
"0.59602314",
"0.5941542",
"0.5895465",
"0.5866224",
"0.58632... | 0.833412 | 0 |
r""" Compute the difference mesh points contained in a certain location. When building finite different meshes, a lookup table from mesh point to block is required. This method returns a list of x, y indices that the triangle meshes in this location will have in 1/3 symmetric 120 geometry. The mesh indices returned wil... | def containsWhichFDMeshPoints(
self, resolution=1, fullCore=False, rectangular=False
):
if not fullCore:
symLine = self.isOnWhichSymmetryLine()
else:
symLine = False
numTriangleStacks = 2 * resolution
numAcrossCenter = 4 * resolution - 1
topC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mesh_span_indices(self):\n self._ensure_mesh()\n k2m = self._knots_to_mesh\n return np.where(k2m[1:] != k2m[:-1])[0]",
"def get_triangles(self):\n location = TopLoc_Location()\n bt = BRep_Tool()\n facing = bt.Triangulation(self.topods_shape(), location)\n if f... | [
"0.60541624",
"0.5712651",
"0.547683",
"0.5457749",
"0.5442335",
"0.5435382",
"0.52934265",
"0.52836204",
"0.52721506",
"0.5267491",
"0.5251447",
"0.5227243",
"0.5209922",
"0.51972866",
"0.5188963",
"0.51312953",
"0.5103185",
"0.50842696",
"0.507303",
"0.5047566",
"0.50386953... | 0.0 | -1 |
Figures out R coordinates of the center of a ThetaRZ voxel given thetaR mesh object parameters. | def Rcoords(self):
if self.radial > 0 and self.radial < len(self.ThRZmesh.getPositions(label="R")):
R = (self.radialInner() + self.radialOuter()) / 2.0
else:
# n = 0
runLog.warning(
"Error: Radial Index ({}) location not INSIDE mesh ".format(self.radia... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__( self , theta ):\r\n offset = np.dot( z_rot( theta ) , [ self.radius , 0 , 0 ] )\r\n # print \"Offset:\" , offset\r\n return np.add( self.center , offset )",
"def sphere_centers(r_x, r_y, r_z):\n a_ccs_p_trans_m = hom_translation_matrix(\n t_x=0.265, t_y=0, t_z=0.014)\... | [
"0.67175555",
"0.6523676",
"0.6337126",
"0.60952574",
"0.60732174",
"0.5942562",
"0.593301",
"0.59314597",
"0.58047277",
"0.5804206",
"0.58019036",
"0.5718087",
"0.5674354",
"0.5651975",
"0.56510645",
"0.5645725",
"0.56287086",
"0.55805355",
"0.5551723",
"0.55281585",
"0.5524... | 0.6335604 | 3 |
Figures out R, theta and Z coordinates of the center of a ThetaRZ voxel given thetaR mesh object parameters. | def ThRZcoords(self):
Th, R = self.ThRcoords()
if self.axial >= 0 and self.axial < len(self.ThRZmesh.getPositions(label="Z")):
Z = (
self.ThRZmesh.getUpper(label="Z", n=(self.axial - 1))
+ self.ThRZmesh.getUpper(label="Z", n=(self.axial))
) * 0.5
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__( self , theta ):\r\n offset = np.dot( z_rot( theta ) , [ self.radius , 0 , 0 ] )\r\n # print \"Offset:\" , offset\r\n return np.add( self.center , offset )",
"def sphere_centers(r_x, r_y, r_z):\n a_ccs_p_trans_m = hom_translation_matrix(\n t_x=0.265, t_y=0, t_z=0.014)\... | [
"0.66900045",
"0.6504501",
"0.6101904",
"0.58051807",
"0.57429713",
"0.5628544",
"0.5626944",
"0.56118596",
"0.55709165",
"0.55703896",
"0.55318254",
"0.55297714",
"0.5472685",
"0.5471592",
"0.54359967",
"0.54348487",
"0.543136",
"0.542039",
"0.54114324",
"0.53719383",
"0.537... | 0.53953683 | 19 |
This method returns the outer radial position of a ThetaRZ voxel given a ThetaR mesh object. | def radialOuter(self):
if self.radial in range(1, len(self.ThRZmesh.getPositions(label="R"))):
R = self.ThRZmesh.getUpper(label="R", n=(self.radial))
else:
runLog.warning(
"Error: Radial Index ({0}) location not INSIDE mesh ".format(
self.radia... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Rcoords(self):\n if self.radial > 0 and self.radial < len(self.ThRZmesh.getPositions(label=\"R\")):\n R = (self.radialInner() + self.radialOuter()) / 2.0\n else:\n # n = 0\n runLog.warning(\n \"Error: Radial Index ({}) location not INSIDE mesh \".fo... | [
"0.7125406",
"0.71002066",
"0.62747943",
"0.6120533",
"0.6097724",
"0.607654",
"0.59881234",
"0.58473873",
"0.57180834",
"0.5704827",
"0.566809",
"0.5636048",
"0.5629548",
"0.5613639",
"0.557644",
"0.54943687",
"0.5480546",
"0.54482675",
"0.5424394",
"0.5413129",
"0.53982836"... | 0.7560898 | 0 |
This method returns the inner theta position of a ThetaRZ voxel given a ThetaR mesh object. | def thetaInner(self):
if self.theta in range(1, len(self.ThRZmesh.getPositions(label="Th"))):
Th = self.ThRZmesh.getUpper(label="Th", n=(self.theta - 1))
else:
runLog.warning(
"Error: Azimuthal Index ({0}) location not INSIDE mesh ".format(
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thetaOuter(self):\n if self.theta in range(1, len(self.ThRZmesh.getPositions(label=\"Th\"))):\n Th = self.ThRZmesh.getUpper(label=\"Th\", n=(self.theta))\n else:\n runLog.warning(\n \"Error: Azimuthal Index ({}) location not INSIDE mesh \".format(\n ... | [
"0.6630596",
"0.6424146",
"0.6071748",
"0.6050471",
"0.600254",
"0.5967101",
"0.59149945",
"0.59070295",
"0.58497214",
"0.58067834",
"0.57926005",
"0.57720226",
"0.56903493",
"0.5669455",
"0.56661713",
"0.56590486",
"0.5624296",
"0.56221735",
"0.56156856",
"0.56049436",
"0.55... | 0.6993555 | 0 |
Returns the nth difference in lengths in the mesh in the direction labeled. | def getDi(self, n=None, label=None):
return self.di[label][n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leg_length(self, *args):\n i, j = args\n return Partition(list(self)).leg_length(i-1, j-1)",
"def length(self, di=(0, 0, 0), dj=(0, 0, 0)):\n xi, xj = self.get_nodes()\n di, dj = np.asarray(di), np.asarray(dj)\n delta = (xj - xi) + (dj - di)\n return np.linalg.norm(d... | [
"0.66709244",
"0.6425134",
"0.63889205",
"0.6266382",
"0.61785126",
"0.6163906",
"0.61486536",
"0.6041887",
"0.60280704",
"0.5987003",
"0.59715474",
"0.5940551",
"0.5937415",
"0.5912157",
"0.58962286",
"0.588649",
"0.58689743",
"0.5846504",
"0.58340883",
"0.5818476",
"0.58032... | 0.0 | -1 |
Create Dataset object out of JSON. | def dataset_from_json(json_data, label='', border_color=Color.DEFAULT_COLOR, settings=None):
if settings is None or not isinstance(settings, dict):
settings = {}
json_data = json.loads(json_data)
try:
return Dataset(
label=label,
arguments=json_data['arguments'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_json(url: URL, data: JsonDict) -> UnifiedDataset:\n cp = deepcopy(data)\n return UnifiedDataset(\n url,\n name=cp[\"name\"],\n description=cp.get(\"description\"),\n key_attribute_names=tuple(cp[\"keyAttributeNames\"]),\n )",
"def from_json(data: Dict[str, Any]) -> ... | [
"0.76634896",
"0.67382026",
"0.65945363",
"0.6544209",
"0.6420733",
"0.64172965",
"0.6387566",
"0.6356376",
"0.6267794",
"0.624005",
"0.6219303",
"0.6147498",
"0.6137764",
"0.61078167",
"0.6095902",
"0.6086496",
"0.60748947",
"0.60668117",
"0.6061267",
"0.605603",
"0.60260636... | 0.75412256 | 1 |
Checks, if the path of a figure to its target position is clear. | def path_clear(self, board, move, target_row, target_col):
if not (target_row > 7 or target_row < 0 or target_col > 7 or target_col < 0):
row_step = np.sign(move[0])
col_step = np.sign(move[1])
sq_cov = not any(board.status[self.field_row + i * row_step,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wall_cleared(self):\n\n # Did we make progress?\n if self.distance_from_goal >= self.best_distance:\n return False\n \n #self.best_distance = self.distance_from_goal\n\n # Are we far enough from the wall,\n # so that we don't switch back immediately\n ... | [
"0.60310495",
"0.5940462",
"0.5855814",
"0.5840895",
"0.5771076",
"0.5756367",
"0.5753545",
"0.574017",
"0.5731048",
"0.572563",
"0.5681641",
"0.56763905",
"0.56761026",
"0.5662323",
"0.5650444",
"0.5630062",
"0.5579302",
"0.5577852",
"0.5577646",
"0.5575347",
"0.55417365",
... | 0.6286603 | 0 |
get all legal moves from potential moves considering the current board. | def get_legal_moves(self, board):
moves = set()
capture_moves = set()
for move in self.pot_moves:
target_row = self.field_row + move[0]
target_col = self.field_col + move[1]
if self.path_clear(board, move, target_row, target_col):
if board.stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_moves(self, board):\n self.available_moves = [move for move in board.legal_moves]",
"def get_legal_moves(self):\n # for each square in the castle figure out if an moves can occur from it.\n moves = []\n allowed = [self.turn]\n if self.turn == DEFENDER:\n allo... | [
"0.8295077",
"0.8193593",
"0.81157243",
"0.79403186",
"0.7798424",
"0.7759739",
"0.77489996",
"0.77317995",
"0.77316743",
"0.76567984",
"0.76404345",
"0.76131314",
"0.7591718",
"0.75232416",
"0.7510404",
"0.74947417",
"0.7491143",
"0.74813557",
"0.74730325",
"0.745837",
"0.74... | 0.76901984 | 9 |
get all legal moves from potential moves considering the current board. | def get_legal_moves(self, board):
moves = set()
capture_moves = set()
if not (self.field_row*self.color_value == 1 or self.field_row*self.color_value == -6):
self.pot_moves = {(1*self.color_value, 0)}
for move in self.pot_moves:
target_row = self.field_row + move... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_moves(self, board):\n self.available_moves = [move for move in board.legal_moves]",
"def get_legal_moves(self):\n # for each square in the castle figure out if an moves can occur from it.\n moves = []\n allowed = [self.turn]\n if self.turn == DEFENDER:\n allo... | [
"0.8295077",
"0.8193593",
"0.81157243",
"0.79403186",
"0.7759739",
"0.77489996",
"0.77317995",
"0.77316743",
"0.76901984",
"0.76567984",
"0.76404345",
"0.76131314",
"0.7591718",
"0.75232416",
"0.7510404",
"0.74947417",
"0.7491143",
"0.74813557",
"0.74730325",
"0.745837",
"0.7... | 0.7798424 | 4 |
get all legal moves from potential moves considering the current board. | def get_legal_moves(self, board):
moves = set()
capture_moves = set()
for move in self.pot_moves:
target_row = self.field_row + move[0]
target_col = self.field_col + move[1]
if not (target_row > 7 or target_row < 0 or target_col > 7 or target_col < 0):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_moves(self, board):\n self.available_moves = [move for move in board.legal_moves]",
"def get_legal_moves(self):\n # for each square in the castle figure out if an moves can occur from it.\n moves = []\n allowed = [self.turn]\n if self.turn == DEFENDER:\n allo... | [
"0.8295077",
"0.8193593",
"0.81157243",
"0.79403186",
"0.7798424",
"0.7759739",
"0.77317995",
"0.77316743",
"0.76901984",
"0.76567984",
"0.76404345",
"0.76131314",
"0.7591718",
"0.75232416",
"0.7510404",
"0.74947417",
"0.7491143",
"0.74813557",
"0.74730325",
"0.745837",
"0.74... | 0.77489996 | 6 |
Override the default Equals behavior | def __eq__(self, other):
return self.sha == other.sha | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n pass",
"def __eq__(self, other):\n pass",
"def __eq__(self, other):\n raise NotImplementedError('must be implemented by subclass')",
"def __eq__(self, other):\n raise NotImplementedError('must be implemented by subclass')",
"def __eq__(self, ot... | [
"0.8262612",
"0.8262612",
"0.81877613",
"0.81877613",
"0.81877613",
"0.81877613",
"0.8174912",
"0.81672645",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.80995893",
"0.8097035",
... | 0.0 | -1 |
Return the 3x3 rotation matrix around the specified axis (0, 1, or 2) | def rotation_matrix3(axis, theta):
R = np.eye(3)
c = math.cos(theta)
s = math.sin(theta)
a1 = (axis + 1) % 3
a2 = (axis + 2) % 3
R[a1, a1] = c
R[a1, a2] = -s
R[a2, a1] = s
R[a2, a2] = c
return np.matrix(R) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_matrix_3x3_axis(angle, axis):\n assert axis.lower() in ['x','y','z']\n assert -180.0 <= angle <= 180.0\n angle_r = angle * (np.pi / 180.0)\n sa = np.sin(angle_r)\n ca = np.cos(angle_r)\n\n if axis == 'x':\n R = np.array([ [1, 0, 0],\n [0, ca, -sa],\n... | [
"0.8405892",
"0.80142015",
"0.80082905",
"0.7910554",
"0.7863072",
"0.77934295",
"0.7754999",
"0.759178",
"0.7467054",
"0.74107707",
"0.73978674",
"0.7268829",
"0.72499263",
"0.7171435",
"0.70944816",
"0.70641387",
"0.70350474",
"0.6999859",
"0.6960819",
"0.69501597",
"0.6948... | 0.81351817 | 1 |
Return the 3x3 rotation matrix around an arbitrary unit vector | def axis_angle_matrix3(unit, theta):
x, y, z = unit
c = math.cos(theta)
s = math.sin(theta)
C = 1 - c
return np.matrix([
[x * x * C + c, x * y * C - z * s, x * z * C + y * s],
[y * x * C + z * s, y * y * C + c, y * z * C - x * s],
[z * x * C - y * s, z * y * C + x * s, z * z ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def householder(vector):\n identity_mat = np.eye(len(vector))\n v = vector[np.newaxis]\n denominator = np.matmul(v, v.T)\n numerator = np.matmul(v.T, v)\n rot_mat = identity_mat - (2 * numerator / denominator)\n return rot_mat",
"def zx_rotation(vector,theta):\r\n R = np.array([[np.cos(theta... | [
"0.7235691",
"0.7223199",
"0.71644384",
"0.71598166",
"0.7087552",
"0.7070188",
"0.70591825",
"0.70576674",
"0.70284325",
"0.7022017",
"0.6956621",
"0.69373316",
"0.69373304",
"0.6937175",
"0.6884467",
"0.68788654",
"0.68784523",
"0.6834428",
"0.68294567",
"0.68276125",
"0.68... | 0.67920434 | 23 |
Returns the equation of the vanishing line given a normal | def vanishing_line(n, focal):
return (n[0], n[1], n[2] * focal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal(self, t=0):\n p = self.lerp(t)\n if self.da < 0:\n return Line(p, self.c - p)\n else:\n return Line(p, p - self.c)",
"def normal(self, t=0):\n return Line(self.lerp(t), self.cross_z)",
"def normal(self, t=0):\n n = Line3d()\n n.p = self... | [
"0.61756206",
"0.609104",
"0.6088258",
"0.6026685",
"0.58346623",
"0.5822214",
"0.57844436",
"0.5775565",
"0.5746366",
"0.566986",
"0.5667866",
"0.561225",
"0.55971414",
"0.5565568",
"0.5564125",
"0.55548465",
"0.5542301",
"0.5473425",
"0.544308",
"0.5440846",
"0.54264593",
... | 0.55697656 | 13 |
Return true if the bbox contains or partially intersects segment a. | def bbox_segment_intersects(bbox, a, b):
# check whether the line is completely left/right/above/below the bbox
if ((a[0] < bbox[0] and b[0] < bbox[0]) or
(a[0] > bbox[2] and b[0] > bbox[2]) or
(a[1] < bbox[1] and b[1] < bbox[1]) or
(a[1] > bbox[3] and b[1] > bbox[2])):
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersects_segment(\n self, a: Tuple[float, float], b: Tuple[float, float]\n ) -> bool:\n assert len(a) == 2\n assert len(b) == 2\n return bool(lib.cpBBIntersectsSegment(self, a, b))",
"def has_intersection(bboxa, bboxb):\n yamin, xamin, ha, wa = bboxa\n ybmin, xbmin, hb,... | [
"0.75345826",
"0.684739",
"0.6468728",
"0.6411044",
"0.63948536",
"0.63697517",
"0.6360881",
"0.6358078",
"0.6333877",
"0.6333793",
"0.6324441",
"0.6304301",
"0.6261146",
"0.6251937",
"0.6216856",
"0.61753935",
"0.6174581",
"0.615982",
"0.6148548",
"0.6109364",
"0.6099023",
... | 0.7556597 | 0 |
Return the area of the triangle defined by ``[a, b, c]``, where each vertex contains floats ``[x, y]`` | def triangle_area(a, b, c):
return 0.5 * abs(
a[0] * (b[1] - c[1]) +
b[0] * (c[1] - a[1]) +
c[0] * (a[1] - b[1])
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangleArea(a: Vec3, b: Vec3, c: Vec3) -> float:\n return cross3(b - a, c - a).length() / 2.0",
"def compute_triangle_area(a,b,c):\n ab = np.sqrt( ((a-b)**2).sum() )\n ac = np.sqrt( ((a-c)**2).sum() )\n bc = np.sqrt( ((b-c)**2).sum() )\n \n s = (ab+ac+bc)/2\n area = np.sqrt(s*(s-ab)*(s-... | [
"0.84191346",
"0.8271097",
"0.7881103",
"0.7828473",
"0.7608223",
"0.7597579",
"0.7597544",
"0.7516894",
"0.73595786",
"0.7270853",
"0.7270003",
"0.7252681",
"0.7234488",
"0.72305065",
"0.7196257",
"0.716151",
"0.71598786",
"0.7150997",
"0.7081849",
"0.70540684",
"0.701454",
... | 0.8303363 | 1 |
Returns an orthonormal 3x3 frame from a normal and one inplane vector | def construct_uvn_frame(n, u, b=None, flip_to_match_image=True):
n = normalized(n)
u = normalized(np.array(u) - np.dot(n, u) * n)
v = normalized_cross(n, u)
# flip to match image orientation
if flip_to_match_image:
if abs(u[1]) > abs(v[1]):
u, v = v, u
if u[0] < 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_onto_plane(vect):\n x, y, z = vect\n \n return (x, y, 0.)",
"def plane_equation(point_a, point_b, point_c):\n v1 = np.subtract(point_a, point_c)\n v2 = np.subtract(point_a, point_b)\n normal = np.cross(v1, v2)\n # print 'b4 norm', normal\n unit_normal = norm_vect(normal)\n ... | [
"0.6525695",
"0.6157837",
"0.60390997",
"0.59814924",
"0.59446204",
"0.58689696",
"0.58418417",
"0.5819643",
"0.57625496",
"0.5758399",
"0.57176363",
"0.56957775",
"0.5681581",
"0.56814426",
"0.56757444",
"0.5649199",
"0.5647722",
"0.5647722",
"0.5647695",
"0.56239986",
"0.56... | 0.0 | -1 |
Returns the most orthogonal vector to v, from the set w. The vector must also be at least as orthogonal as the tolerance. If nothing is that orthogonal, None is returned. All vectors are assumed to be unit length. | def most_orthogonal_vector(v, vectors, tolerance_dot=1.0):
best_dot = tolerance_dot
best_w = None
for w in vectors:
d = abs_dot(v, w)
if d < best_dot:
best_dot = d
best_w = w
return best_w | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orthogonal(v):\n return np.array([-v[1], v[0]])",
"def orthogonalize(*vlist, orthonormal=False):\n\n if not all(isinstance(vec, Vector) for vec in vlist):\n raise TypeError('Each element must be of Type Vector')\n\n ortho_vlist = []\n for i, term in enumerate(vlist):\n for j in rang... | [
"0.67741066",
"0.6380468",
"0.62507844",
"0.61287045",
"0.60421896",
"0.5899978",
"0.5876221",
"0.5853856",
"0.5655817",
"0.560325",
"0.55841815",
"0.55465436",
"0.5517424",
"0.54806405",
"0.5453591",
"0.54417384",
"0.54243976",
"0.5406809",
"0.54068065",
"0.5386803",
"0.5348... | 0.782882 | 0 |
Returns the background escape code for a 256 color id. | def bg(value: int) -> str:
return f"\033[48;5;{value}m" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hexcode(self):\n hexc = \"#%.02X%.02X%.02X\" % (int(self.rgb_255[0]), int(self.rgb_255[1]), int(self.rgb_255[2]))\n return hexc",
"def get_disassembly_background_color(self):\n pass",
"def color(self):\n return 0x2f3136",
"def hash_coloured_escapes(text):\n ansi_code = int(... | [
"0.6310946",
"0.62702185",
"0.6235028",
"0.6176788",
"0.60505176",
"0.6033834",
"0.60268897",
"0.6003054",
"0.59891343",
"0.59841806",
"0.5935414",
"0.5923829",
"0.58932525",
"0.5881386",
"0.586129",
"0.58512115",
"0.58179986",
"0.5817131",
"0.58159465",
"0.5809037",
"0.58073... | 0.58415335 | 16 |
Returns the foreground escape code for an rgb truecolor. | def fg(r: int, g: int, b: int) -> str:
return f"\033[38;2;{r};{g};{b}m" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_output_letter(rgb):\n\n\t\tif rgb == Rgb.pastel_purple():\n\t\t\treturn \"p\"\n\t\telif rgb == Rgb.pastel_yellow():\n\t\t\treturn \"y\"\n\t\telif rgb == Rgb.pastel_green():\n\t\t\treturn \"g\"\n\t\telif rgb == Rgb.pastel_blue():\n\t\t\treturn \"b\"\n\t\telif rgb == Rgb.strong_red():\n\t\t\treturn \" \"\n\... | [
"0.66595185",
"0.66303104",
"0.63110197",
"0.62869054",
"0.62146926",
"0.6190109",
"0.61543214",
"0.6143453",
"0.6120535",
"0.6107546",
"0.60825795",
"0.6072191",
"0.6029597",
"0.602686",
"0.6022544",
"0.60008687",
"0.5992301",
"0.5976879",
"0.597485",
"0.5958026",
"0.5956799... | 0.60285276 | 13 |
Adds a square target (green) zone. | def add_zone(self, env):
zone_template = 'assets/zone/zone-template.urdf'
replace = {'LENGTH': (self._zone_scale, self._zone_scale)}
zone_urdf = self.fill_template(zone_template, replace)
self.zone_pose = self.random_pose(env, self.zone_size)
# For tracking IDs and consistency w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addTargetShip(self, targetID):\n self.targets.append(targetID)",
"def update_target(self):\n\t\tself.check_top()\n\t\tself.check_bottom()\n\t\tself.update()\n\t\tself.screen.fill(self.target_color, self.rect)",
"def add_move(self, src_stool, dest_stool):\n self._moves.append((src_stool, dest_... | [
"0.54892117",
"0.5287607",
"0.5159287",
"0.51099575",
"0.50726104",
"0.50259787",
"0.5017053",
"0.50017875",
"0.49952358",
"0.4977025",
"0.4966806",
"0.4947801",
"0.4937651",
"0.49312523",
"0.49185157",
"0.4904081",
"0.48650113",
"0.4852642",
"0.4852642",
"0.4852642",
"0.4847... | 0.0 | -1 |
Reset to start an episode. If generating training data for goalconditioned Transporters with `main.py` or goal images using `generate_goals.py`, then call the superclass. The code already puts the bead poses inside `info`. For this env it's IDs 4 through 27 (for 24 beads) but I scale it based on num_parts in case we ch... | def reset(self, env, last_info=None):
super().reset(env)
# Override with targets from last_info (and the goal image!).
if self.goal_cond_testing:
assert last_info is not None
self.goal['places'] = self._get_goal_info(last_info) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n\n # initialize gym env variables\n self.finish = False\n self.curr_step = -1\n self.curr_episode += 1\n\n # initialize target position\n self.target = np.random.uniform(-10.0,10.0,size=(2))\n\n # initialize sheep positions\n if self.fixed_r... | [
"0.6176949",
"0.6074522",
"0.5975602",
"0.59743005",
"0.57683575",
"0.5717546",
"0.5702152",
"0.5672596",
"0.56602925",
"0.5626447",
"0.5621834",
"0.56006604",
"0.5592225",
"0.5589756",
"0.5568318",
"0.5528508",
"0.5511361",
"0.551104",
"0.55050945",
"0.5504384",
"0.5470071",... | 0.64481753 | 0 |
Sets the visit_count of this GetClientServicesRequest. | def visit_count(self, visit_count):
self._visit_count = visit_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_count(self, request_count):\n\n self._request_count = request_count",
"def set_city_count(self, city_count):\n self.city_count = city_count",
"def set_count(self, count):\n self._count = count",
"def count(self, count: int):\n\n self._count = count",
"def updateVisit... | [
"0.608174",
"0.5842999",
"0.56502795",
"0.55906713",
"0.55700123",
"0.55493486",
"0.55493486",
"0.55493486",
"0.55493486",
"0.5548173",
"0.55150986",
"0.54957044",
"0.54957044",
"0.5489625",
"0.5472022",
"0.5438496",
"0.53750515",
"0.5366077",
"0.53258246",
"0.53239393",
"0.5... | 0.73123235 | 0 |
Sets the start_date of this GetClientServicesRequest. | def start_date(self, start_date):
self._start_date = start_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_date(self, start_date):\n \n self._start_date = start_date",
"def set_start_date(self, date):\n pass",
"def start_date(self, start_date):\n self._start_date = start_date",
"def date_start(self, date_start):\n\n self._date_start = date_start",
"def start_date(sel... | [
"0.7699701",
"0.76394147",
"0.7597023",
"0.7369677",
"0.72937465",
"0.7273931",
"0.72681415",
"0.71883243",
"0.69063133",
"0.645389",
"0.645389",
"0.645389",
"0.645389",
"0.6425524",
"0.636349",
"0.6338499",
"0.6250987",
"0.6109751",
"0.6109751",
"0.6107773",
"0.6101889",
"... | 0.7600645 | 7 |
Sets the end_date of this GetClientServicesRequest. | def end_date(self, end_date):
self._end_date = end_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_date(self, end_date):\n self._end_date = end_date",
"def set_end_date(self, date):\n pass",
"def end_date(self, end_date):\n if self.local_vars_configuration.client_side_validation and end_date is None: # noqa: E501\n raise ValueError(\"Invalid value for `end_date`, mus... | [
"0.737525",
"0.7255867",
"0.7021835",
"0.7009939",
"0.69576657",
"0.69027793",
"0.6617165",
"0.66137564",
"0.650738",
"0.6492513",
"0.6492513",
"0.6492513",
"0.6478739",
"0.64646107",
"0.64540136",
"0.6451111",
"0.6359585",
"0.6307575",
"0.6307575",
"0.61456215",
"0.60940623"... | 0.7405955 | 4 |
Sets the limit of this GetClientServicesRequest. | def limit(self, limit):
self._limit = limit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit(self, limit):\n self._limit = limit\n return self",
"def limit(self, limit):\n self._limit = limit",
"def limit(self, limit):\n\n self._limit = limit\n return self",
"def limit(self, limit):\n self._limit = limit\n\n return self",
"def services_lim... | [
"0.6759188",
"0.6724407",
"0.671666",
"0.6714211",
"0.6648048",
"0.6555463",
"0.63988847",
"0.634026",
"0.62916523",
"0.6282289",
"0.622684",
"0.6140334",
"0.609011",
"0.60771364",
"0.5974385",
"0.5922815",
"0.5886958",
"0.58447844",
"0.58338434",
"0.5806115",
"0.58045757",
... | 0.6674071 | 5 |
Sets the offset of this GetClientServicesRequest. | def offset(self, offset):
self._offset = offset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_offset(self, offset):\n self.offset = offset",
"def set_offset(self, offset):\n self.offset = offset",
"def setOffset(self, offset):\n\t\tself.out_offs = offset",
"def offset(self, offset):\n self._offset = offset",
"def set_offset( self, offset ):\n assert offset in ran... | [
"0.6168336",
"0.6168336",
"0.5714592",
"0.5659624",
"0.557069",
"0.5545384",
"0.5450055",
"0.5446242",
"0.5425994",
"0.53646356",
"0.53536147",
"0.53251964",
"0.5301169",
"0.5297789",
"0.52944046",
"0.5273003",
"0.5180155",
"0.51798755",
"0.51798755",
"0.51798755",
"0.5179875... | 0.5639379 | 5 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, GetClientServicesRequest):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"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, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Given a time units string (one of ``VALID_TIME_UNITS``), return a function that converts from the time units to hours. | def build_convert_to_hours(time_units):
if time_units not in VALID_TIME_UNITS:
raise ValueError('Time units must be one of', VALID_TIME_UNITS)
if time_units == 'min':
return lambda x: x/60
elif time_units == 'h':
return lambda x: x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hours(duration):\n if not duration:\n return 0\n try:\n h, m, s = duration_parts(duration)\n return h\n except (ValueError, TypeError):\n return 0",
"def hours(input=None):\n return get(input).hours",
"def to_hours(self, timesteps, to_label=False):\n out = tim... | [
"0.6261804",
"0.60468644",
"0.58977234",
"0.58977234",
"0.58977234",
"0.58977234",
"0.5757926",
"0.5731297",
"0.565108",
"0.5632827",
"0.550144",
"0.5429626",
"0.5423557",
"0.5398271",
"0.53578603",
"0.53249365",
"0.530017",
"0.52656287",
"0.52480775",
"0.5216525",
"0.5207281... | 0.86979634 | 0 |
Given a model name, returns a model as well as an example input. | def load_model(model_name):
if hasattr(torchvision.models, model_name):
with torch.no_grad():
if model_name.startswith("inception"):
height = width = 299
mean = [0.5, 0.5, 0.5]
std = [0.5, 0.5, 0.5]
else:
height = width ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildModel(model_name):\n if model_name == \"resnet50\":\n model = kapp.resnet50.ResNet50(weights=\"imagenet\", include_top=False)\n return model, kapp.resnet50.preprocess_input\n elif model_name == \"vgg16\":\n model = kapp.vgg16.VGG16(weights=\"imagenet\", include_top=False)\n ... | [
"0.71637535",
"0.7161927",
"0.7068853",
"0.7063607",
"0.70578015",
"0.7014156",
"0.69370425",
"0.68783695",
"0.6842377",
"0.6840033",
"0.6838576",
"0.6804577",
"0.67129",
"0.6629585",
"0.659486",
"0.65926605",
"0.6517887",
"0.65063035",
"0.6504377",
"0.64932567",
"0.64932567"... | 0.6710387 | 13 |
get args from stdin. | def get_args():
parser = argparse.ArgumentParser(description='snorm score.', formatter_class=argparse.ArgumentDefaultsHelpFormatter,
conflict_handler='resolve')
parser.add_argument('--score-file', dest='score_file', type=str, help='score file')
parser.add_argument('--enroll-file', dest='enroll_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_input(args, parser):\n if args.text == sys.stdin:\n # check if stdin is empty\n stdin_ready, _, _ = select.select([sys.stdin], [], [], 0)\n if stdin_ready:\n return sys.stdin.read().strip()\n\n parser.print_help()\n sys.exit(1)\n\n return args.text",
"... | [
"0.73058635",
"0.7126134",
"0.7054991",
"0.6979393",
"0.6765645",
"0.6667644",
"0.66592336",
"0.6655319",
"0.6599314",
"0.655588",
"0.6501059",
"0.6484747",
"0.64797246",
"0.6465973",
"0.6456041",
"0.6447803",
"0.6429599",
"0.6416855",
"0.6401787",
"0.63615966",
"0.6320257",
... | 0.5825679 | 98 |
Get message subject line | def subject(self):
return self.mail.get('Subject') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSubject(self):\r\n return self.msg[\"Subject\"]",
"def get_subject(self):\n return self._subject",
"def subject(self):\n subject = loader.render_to_string(self.subject_template_name,\n self.get_context())\n return ''.join(subject.split... | [
"0.8046902",
"0.713639",
"0.70704764",
"0.6882871",
"0.6728475",
"0.6697977",
"0.66049546",
"0.659011",
"0.659011",
"0.65697634",
"0.65524113",
"0.65075904",
"0.64527464",
"0.6405712",
"0.63926536",
"0.63926536",
"0.6358073",
"0.6332952",
"0.6273278",
"0.62127334",
"0.6203614... | 0.68855006 | 3 |
Ensures a correctly formatted post succeeds. | def test_add_valid_goal(self, segment_call):
response = self.post_course_goal(valid=True, goal_key='certify')
segment_call.assert_called_once_with(self.user.id, EVENT_NAME_ADDED, {
'courserun_key': str(self.course.id),
'goal_key': 'certify',
'days_per_week': 0,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post_success(self):\n response = self.post(\n content='foo', style='friendly', embed_title=False)\n self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n self.assertEqual(response.data['content'], 'foo')\n self.assertEqual(response.data['title'], '')\n ... | [
"0.742366",
"0.6810092",
"0.6495741",
"0.6447934",
"0.640869",
"0.640869",
"0.63786227",
"0.63388467",
"0.62946403",
"0.6293656",
"0.62799037",
"0.62168",
"0.62142015",
"0.62138104",
"0.61901057",
"0.61895293",
"0.6187757",
"0.61821365",
"0.6157818",
"0.6152794",
"0.61493397"... | 0.0 | -1 |
This function removes the double spaces in a string, on top of the spaces at the beginning/end. INPUT string any kind of string, works with Arabic string if utf8 encoded OUTPUT The same string without double spaces, or single spaces in the beginning/end of string. | def readjustSpacesInString(string):
return ' '.join([x for x in string.split(' ') if x]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def space_strip(string):\n string= re.sub(\"(?m)^\\s+\", \"\", string)\n return re.sub(\"(?m)\\s+$\", \"\", string)",
"def normalizeSpaces(strText, bDouble=False):\n if bDouble:\n strText = re.sub(r\"[ ]+\", r\" \", strText, flags=re.UNICODE)\n # Remove double ... | [
"0.7796933",
"0.77147436",
"0.7688684",
"0.746226",
"0.7418028",
"0.7329049",
"0.7316045",
"0.7295581",
"0.7234878",
"0.71832365",
"0.71593314",
"0.713508",
"0.713136",
"0.713136",
"0.71208656",
"0.70681256",
"0.7028967",
"0.70131916",
"0.70041305",
"0.698904",
"0.69790846",
... | 0.7066367 | 16 |
Returns an LLLreduced basis. | def lll(basis, delta=.75):
orthog = gram_schmidt(basis)
mu = get_mus(basis, orthog)
k = 1
while k < len(basis):
for j in range(k - 1, -1, -1):
# Size condition
if np.abs(mu[k][j]) > .5:
basis[k] = basis[k] - np.rint(mu[k, j]) * basis[j]
ort... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lll(basis, delta=.75):\n orthog = gram_schmidt(basis)\n mu = get_mus(basis, orthog)\n k = 1\n while k < len(basis):\n for j in range(k - 1, -1, -1):\n # Size condition\n if np.abs(mu[k][j]) > .5:\n basis[k] = basis[k] - np.... | [
"0.6088242",
"0.5603393",
"0.55973816",
"0.55534863",
"0.54981947",
"0.5453062",
"0.54469985",
"0.54325265",
"0.5411515",
"0.5392617",
"0.5347899",
"0.5345974",
"0.53293407",
"0.5326715",
"0.5310972",
"0.52872187",
"0.5283247",
"0.52804685",
"0.5273278",
"0.5272898",
"0.52615... | 0.6045903 | 1 |
Returns an LLLreduced basis. | def lll(basis, delta=.75):
orthog = gram_schmidt(basis)
mu = get_mus(basis, orthog)
k = 1
while k < len(basis):
for j in range(k - 1, -1, -1):
# Size condition
if np.abs(mu[k][j]) > .5:
basis[k] = basis[k] - np.rint(mu[k, j]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lll(basis, delta=.75):\n orthog = gram_schmidt(basis)\n mu = get_mus(basis, orthog)\n k = 1\n while k < len(basis):\n for j in range(k - 1, -1, -1):\n # Size condition\n if np.abs(mu[k][j]) > .5:\n basis[k] = basis[k] - np.rint(mu[k, j]) * basis[j]\n ... | [
"0.6045903",
"0.5603393",
"0.55973816",
"0.55534863",
"0.54981947",
"0.5453062",
"0.54469985",
"0.54325265",
"0.5411515",
"0.5392617",
"0.5347899",
"0.5345974",
"0.53293407",
"0.5326715",
"0.5310972",
"0.52872187",
"0.5283247",
"0.52804685",
"0.5273278",
"0.5272898",
"0.52615... | 0.6088242 | 0 |
Convert word indices to strings. | def decode_batch_output(
decoded_tokens, vocab: Vocab, oov_dict: OOVDict
) -> List[List[str]]:
decoded_batch = []
if not isinstance(decoded_tokens, list):
decoded_tokens = decoded_tokens.transpose(0, 1).tolist()
for i, doc in enumerate(decoded_tokens):
decoded_doc = []
for word_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_idx2word():\n idx2word = {}\n d = train_data.shared['word2idx']\n for word, idx in d.items():\n print(word)\n idx2word[idx] = word\n if config.use_glove_for_unk:\n d2 = train_data.shared['new_word2idx']\n for word, idx in d2.items():\... | [
"0.691161",
"0.6769812",
"0.67211235",
"0.6648241",
"0.65625167",
"0.6545675",
"0.6496118",
"0.6462496",
"0.6454771",
"0.64292914",
"0.6411378",
"0.6349923",
"0.63463485",
"0.61219895",
"0.6090902",
"0.6039364",
"0.6024312",
"0.6007287",
"0.5997666",
"0.59450454",
"0.59119964... | 0.0 | -1 |
Test the `model` on the `batch`, return the decoded textual tokens and the Seq2SeqOutput. | def decode_batch(
batch: Batch,
model: Seq2Seq,
vocab: Vocab,
criterion=None,
*,
pack_seq=True,
show_cover_loss=False
) -> Tuple[List[List[str]], Seq2SeqOutput]:
if not pack_seq:
input_lengths = None
else:
input_lengths = batch.input_lengths
with torch.no_grad():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_batch(batch: Batch, model: Seq2Seq, vocab: Vocab, criterion=None, *, pack_seq=True,\n show_cover_loss=False) -> Tuple[List[List[str]], Seq2SeqOutput]:\n if not pack_seq:\n input_lengths = None\n else:\n input_lengths = batch.input_lengths\n with torch.no_grad():\n input_tenso... | [
"0.7244397",
"0.6625542",
"0.61642754",
"0.6108666",
"0.6038354",
"0.6008881",
"0.5928245",
"0.5921694",
"0.58876944",
"0.58759373",
"0.5862399",
"0.5862399",
"0.58540314",
"0.58071756",
"0.579755",
"0.5755968",
"0.57550913",
"0.5715045",
"0.5712757",
"0.5697481",
"0.5682049"... | 0.7166712 | 1 |
Test limit value of minus | def test_limit_minus(self, mock):
mock.configure_mock(**(self.config_payload(1, 1)))
d = lf.lambda_handler(event=self.lambdaevent_minus, context=None)
self.assertEqual(d, 0)
mock.client.return_value.update_thing_shadow.assert_called_once_with(
thingName=self.thingname,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_negative(self):\n lst = [-1, -5, -98]\n self.assertEqual(max_integer(lst), -1)",
"def test_negatives(self):\n self.assertEqual(max_integer([-1, -2, -3, -4]), -1)\n self.assertEqual(max_integer([-4, -3, -2, 0]), 0)",
"def test_limit_is_negative(self) -> None:\n\n chan... | [
"0.6971001",
"0.69547564",
"0.69515455",
"0.69505113",
"0.6830236",
"0.68218106",
"0.6651907",
"0.66355497",
"0.6612457",
"0.66121453",
"0.65927035",
"0.65729046",
"0.65464723",
"0.65441155",
"0.6542076",
"0.6521281",
"0.6495326",
"0.647462",
"0.64617383",
"0.63836545",
"0.63... | 0.0 | -1 |
In the constructor we instantiate two nn.Linear modules and assign them as member variables. | def __init__(self):
super(Match3DNet, self).__init__()
self.features = nn.Sequential(
# conv1
nn.Conv3d(1, 64, kernel_size=3, stride=1, padding=0),
nn.ReLU(inplace=True),
# conv2
nn.Conv3d(64, 64, kernel_size=3, stride=1, padding=0),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args):\n super(LinearND, self).__init__()\n self.fc = nn.Linear(*args)",
"def __init__(self, linear_args, activation_functions, softmax=False):\n super(NN, self).__init__()\n assert len(activation_functions) == len(linear_args) - 1\n k = len(linear_args)\n ... | [
"0.77401125",
"0.75483596",
"0.75074446",
"0.74346",
"0.7366003",
"0.7335429",
"0.73152226",
"0.7286699",
"0.7273464",
"0.72729063",
"0.72729063",
"0.7268201",
"0.72429734",
"0.72211164",
"0.72030157",
"0.7167753",
"0.7111596",
"0.7077496",
"0.7065618",
"0.7063983",
"0.705345... | 0.0 | -1 |
Returns whether a password is valid Each policy actually describes two positions in the password Exactly one of these positions must contain the given letter. valid_password(1, 3, "a", "abcde") == True valid_password(1, 3, "b", "cdefg") == False valid_password(2, 9, "c", "ccccccccc") == False | def valid_password(lower, upper, letter, password):
# Note the -1 to turn 1 indexing into 0 indexing
matches = [idx for idx in (lower, upper) if password[idx - 1] == letter]
return len(matches) == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_password_v1(password):\n letter_count = sum([x == password[\"letter\"] for x in list(password[\"password\"])])\n return password[\"low\"] <= letter_count <= password[\"high\"]",
"def valid_password(password):\n val = True\n\n if len(password) < 8:\n val = False\n return val... | [
"0.79252726",
"0.7824308",
"0.7759457",
"0.7746773",
"0.77271616",
"0.7685118",
"0.7660412",
"0.7639942",
"0.7581784",
"0.75088835",
"0.7507734",
"0.7464349",
"0.7456752",
"0.73747814",
"0.7365335",
"0.7202525",
"0.71280706",
"0.7126687",
"0.7121084",
"0.71059006",
"0.7095532... | 0.8354784 | 0 |
Takes a datetime object and converts the day and month into a cleanly formatted string. | def _get_neat_date(date: datetime) -> str:
month_selector = ["January", "February", "March", "April", "May", "June", "July", "August", "September",
"October", "November", "December"]
month_string = month_selector[date.month - 1]
day = date.day
if day == 1 or d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_datetime_to_string(dt):\n\treturn '{0}-{1}-{2}'.format(dt.year, dt.month, dt.day)",
"def convert_datetime_to_string(dt):\n\treturn '{0}-{1}-{2}'.format(dt.year, dt.month, dt.day)",
"def datetime_to_str(datetime_obj: Union[dt.datetime, dt.date] = dt.datetime.now(), sep: str = DATE_SEPARATOR) -> str:... | [
"0.7655184",
"0.7655184",
"0.7104725",
"0.6919156",
"0.6866312",
"0.6797844",
"0.67698574",
"0.67675644",
"0.6765239",
"0.67409647",
"0.669554",
"0.6692237",
"0.6640842",
"0.6617632",
"0.6605277",
"0.6573202",
"0.65608084",
"0.65386665",
"0.6499084",
"0.6496182",
"0.6489382",... | 0.0 | -1 |
Left shift with public integral offset. | def __lshift__(self, other):
# TODO: extend to secret offset
if not isinstance(other, int):
return NotImplemented
return runtime.mul(self, 1<<other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_left(self):\n self.pointer = (self.pointer - 1) % len(self.data)",
"def lrshift(val, n) -> np.int64:\n return (val % (1 << 64)) >> n",
"def leftshift(x, c):\n return x << c",
"def lshift_(self, value):\n assert isinstance(value, int), \"lshift must take an integer argument.\"\n ... | [
"0.70157146",
"0.6971136",
"0.6966064",
"0.687211",
"0.6779076",
"0.6691059",
"0.6663449",
"0.6568696",
"0.65645045",
"0.65489537",
"0.6513061",
"0.64453125",
"0.6443939",
"0.6401666",
"0.6386486",
"0.63442093",
"0.63239676",
"0.6321679",
"0.6321679",
"0.62379247",
"0.6200954... | 0.7011936 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.