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 |
|---|---|---|---|---|---|---|
Check if device is online and add the entity. | def add_entity(device: SmartPlug, async_add_entities):
# Attempt to get the sysinfo. If it fails, it will raise an
# exception that is caught by async_add_entities_retry which
# will try again later.
device.get_sysinfo()
async_add_entities([SmartPlugSwitch(device)], update_before_add=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_added_to_hass(self):\n self.hass.data[DOMAIN].add_entity_id(self.entity_id)\n self.hass.data[DOMAIN].add_sensor(self)",
"def is_online(self, device):\n # TODO: Add info for the device if it is actually ONLINE\n return device in self.backends",
"def poll_device(self):... | [
"0.6015471",
"0.5891063",
"0.5770823",
"0.5731657",
"0.57188225",
"0.56620145",
"0.5643109",
"0.56374156",
"0.5606649",
"0.55505234",
"0.55300385",
"0.551577",
"0.5509076",
"0.5490396",
"0.54673177",
"0.54582417",
"0.5448342",
"0.5441688",
"0.54276526",
"0.5424822",
"0.540992... | 0.61210483 | 0 |
Return the name of the Smart Plug. | def name(self):
return self._alias | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_name(self):\n try:\n return self.plug_dict['PlugName'].value\n except KeyError:\n return self.name",
"def name(self):\n return self.device.name()",
"def name(self):\n return self._device.name",
"def name(self):\n return self._device.name",
... | [
"0.73118305",
"0.67245513",
"0.6720181",
"0.6720181",
"0.6720181",
"0.6548154",
"0.65193725",
"0.6470974",
"0.64691734",
"0.6463785",
"0.6447527",
"0.64367044",
"0.6378771",
"0.6340218",
"0.63257974",
"0.6311699",
"0.6280503",
"0.62558603",
"0.62558603",
"0.6251322",
"0.62336... | 0.0 | -1 |
Turn the switch off. | def turn_off(self, **kwargs):
self.smartplug.turn_off() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def off_switch(self):\n self._switch_callback = None",
"def turn_off(self):\n self.handleCommand(1)\n self._state = STATE_OFF",
"def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self._state = False",
"def turn_off(self):\n print(\"Turning the l... | [
"0.867637",
"0.85906535",
"0.8523712",
"0.84588856",
"0.84180963",
"0.8404447",
"0.8398465",
"0.8375364",
"0.83491224",
"0.83192796",
"0.82949907",
"0.8277566",
"0.81680954",
"0.8155346",
"0.8112255",
"0.8091075",
"0.8072859",
"0.8058921",
"0.8058517",
"0.8041678",
"0.8036265... | 0.870139 | 0 |
Return the state attributes of the device. | def device_state_attributes(self):
return self._emeter_params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_a... | [
"0.92740184",
"0.92052007",
"0.91505814",
"0.91505814",
"0.9148704",
"0.9148704",
"0.91484547",
"0.91484547",
"0.91484547",
"0.91484547",
"0.91484547",
"0.91484547",
"0.91484547",
"0.91484547",
"0.91484547",
"0.91484547",
"0.91484547",
"0.91484547",
"0.91484547",
"0.9137356",
... | 0.82703704 | 45 |
Get an existing VirtualNetworkAppliance resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
name: Optional[pulumi.Input[str]] = None,
virtual_hub_id: Optional[pulumi.Input[str]] = None) -> 'VirtualNetworkAppliance':
opts = pulumi.ResourceOptions.merge(opts, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n force: Optional[pulumi.Input[bool]] = None,\n instance_id: Optional[pulumi.Input[str]] = None,\n state: Optional[pulumi.Input[str]] = None) -> 'InstanceStat... | [
"0.6201526",
"0.57982093",
"0.5736015",
"0.5646393",
"0.5609894",
"0.5605176",
"0.5562416",
"0.5540888",
"0.5526297",
"0.5516919",
"0.54881024",
"0.54570943",
"0.54539675",
"0.5443733",
"0.5311846",
"0.53039557",
"0.52989674",
"0.5293997",
"0.5219828",
"0.5211493",
"0.5136214... | 0.75466305 | 0 |
Generate a 32char alnum string. 190 bits of entropy. | def generateAuthToken():
alnum = ''.join(c for c in map(chr, range(256)) if c.isalnum())
return ''.join(random.choice(alnum) for _ in range(32)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gensalt():\n return hexlify(os.urandom(24)).decode()",
"def generate_anki_guid() -> str:\n\n def base62(num: int, extra: str = \"\") -> str:\n s = string\n table = s.ascii_letters + s.digits + extra\n buf = \"\"\n while num:\n num, i = divmod(num, len(table))\n ... | [
"0.6859951",
"0.6815058",
"0.6766438",
"0.6642308",
"0.6622564",
"0.6618715",
"0.66116697",
"0.6578876",
"0.6557206",
"0.65500194",
"0.6549186",
"0.65366834",
"0.65309227",
"0.6520865",
"0.64620394",
"0.6459862",
"0.6436619",
"0.6401984",
"0.63992006",
"0.6395819",
"0.6387713... | 0.6681493 | 3 |
extract sublist given by indexes from lst | def extract_cols(lst,indexes):
return (lst[i] for i in indexes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_sub_list(mylist, indices):\n return [mylist[ii] for ii in indices]",
"def slice_by_index(lst, indexes):\r\n if not lst or not indexes:\r\n return []\r\n slice_ = itemgetter(*indexes)(lst)\r\n if len(indexes) == 1:\r\n return [slice_]\r\n return list(slice_)",
"def slice... | [
"0.82304233",
"0.79625535",
"0.74052036",
"0.7185462",
"0.70088667",
"0.681775",
"0.67038435",
"0.64502764",
"0.64241606",
"0.63586104",
"0.6246116",
"0.6240312",
"0.62159413",
"0.61312914",
"0.6083401",
"0.60636836",
"0.6040687",
"0.5940993",
"0.5921108",
"0.59043574",
"0.58... | 0.6623756 | 7 |
The time that the assessment was created and first evaluated. Returned as UTC time in ISO 8601 format | def first_evaluation_date(self) -> str:
return pulumi.get(self, "first_evaluation_date") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_run(self):\n if self._time_run is None:\n self._time_run = datetime.now(timezone.utc)\n return self._time_run.isoformat()",
"def created_time_utc(self) -> str:\n return pulumi.get(self, \"created_time_utc\")",
"def created_time_utc(self) -> pulumi.Output[str]:\n ... | [
"0.76280046",
"0.7515763",
"0.74972713",
"0.74526536",
"0.74526536",
"0.74526536",
"0.7347567",
"0.7347567",
"0.7347567",
"0.7303399",
"0.7303399",
"0.7303399",
"0.7303399",
"0.7303399",
"0.7303399",
"0.7303399",
"0.7303399",
"0.7303399",
"0.7303399",
"0.7303399",
"0.7303399"... | 0.0 | -1 |
Human readable description of the assessment status | def description(self) -> Optional[str]:
return pulumi.get(self, "description") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detailed_status(self) -> str:\n return pulumi.get(self, \"detailed_status\")",
"def detailed_status_message(self) -> str:\n return pulumi.get(self, \"detailed_status_message\")",
"def detailed_status(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"detailed_status\")",
"def d... | [
"0.78685915",
"0.76621175",
"0.7628766",
"0.7628766",
"0.75564736",
"0.75564736",
"0.739618",
"0.7385615",
"0.7385615",
"0.7385615",
"0.73588413",
"0.7323723",
"0.73222595",
"0.73222595",
"0.73222595",
"0.73222595",
"0.73222595",
"0.73222595",
"0.73222595",
"0.73222595",
"0.7... | 0.0 | -1 |
The platform where the assessed resource resides Expected value is 'OnPremise'. | def source(self) -> str:
return pulumi.get(self, "source") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform(self):\n return self.random.choice([\n 'Laptop', \n 'Desktop', \n 'Workstation', \n 'Server', \n 'Virtual Machine', \n 'Container', \n 'Micro-Service', \n 'Droplet', \n 'SaaS'\n ])",
"def... | [
"0.75705874",
"0.7193047",
"0.7128984",
"0.6988576",
"0.6982647",
"0.6844657",
"0.67143387",
"0.66910464",
"0.6656804",
"0.6565426",
"0.6519895",
"0.6486373",
"0.6448944",
"0.6413797",
"0.6358302",
"0.6339542",
"0.6335407",
"0.6312602",
"0.62690324",
"0.62471485",
"0.6216142"... | 0.0 | -1 |
The severity level of the assessment | def severity(self) -> str:
return pulumi.get(self, "severity") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def severity(self):\n return self._severity",
"def severity(self):\n return self._severity",
"def severity(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"severity\")",
"def severity(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"severity\")",
"def s... | [
"0.82292265",
"0.82292265",
"0.8184784",
"0.801551",
"0.7976034",
"0.77871335",
"0.77871335",
"0.77871335",
"0.76659864",
"0.71346414",
"0.7123284",
"0.7088337",
"0.7083264",
"0.6930347",
"0.6812457",
"0.678891",
"0.6676945",
"0.6643234",
"0.6637242",
"0.6548396",
"0.65459704... | 0.8408239 | 1 |
Gets right and left Lanelet of current_lanelet | def get_right_and_left_lanelet(self):
if self.scenario is not None:
possible_lanelet_ids = self.scenario.lanelet_network.find_lanelet_by_position([np.array(list(self.current_pos))])[0]
self.current_lanelet = None
self.right_lanelet = None
self.left_lanelet = N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lane(self):\n return self.lane",
"def _get_potential_right_way(self, lanelet):\n if lanelet.adj_right:\n if lanelet.adj_right_same_direction:\n potential_right_way = self.left_ways.get(lanelet.adj_right)\n else:\n potential_right_way = sel... | [
"0.69697505",
"0.6693879",
"0.65481895",
"0.6400882",
"0.6338087",
"0.6309185",
"0.6169792",
"0.61585784",
"0.61184555",
"0.6088736",
"0.60837555",
"0.60834515",
"0.6081923",
"0.60523117",
"0.6044031",
"0.6035172",
"0.60120726",
"0.59962624",
"0.5978671",
"0.59441257",
"0.589... | 0.879685 | 0 |
r""" Split a dataset into a training and a testing set for crossvalidation. | def train_test_split(coordinates, data, weights=None, **kwargs):
args = check_fit_input(coordinates, data, weights, unpack=False)
ndata = args[1][0].size
indices = np.arange(ndata)
split = next(ShuffleSplit(n_splits=1, **kwargs).split(indices))
train, test = (tuple(select(i, index) for i in args) fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)",
"def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_s... | [
"0.8388776",
"0.82056624",
"0.8001761",
"0.79581153",
"0.79135597",
"0.7875",
"0.78179085",
"0.78164434",
"0.7807517",
"0.7786878",
"0.77385145",
"0.7680169",
"0.7663266",
"0.7634292",
"0.7632027",
"0.76205504",
"0.7608531",
"0.75842917",
"0.7573939",
"0.7573855",
"0.7559456"... | 0.0 | -1 |
Index each array in a tuple of arrays. If the arrays tuple contains a ``None``, the entire tuple will be returned as is. | def select(arrays, index):
if arrays is None or any(i is None for i in arrays):
return arrays
return tuple(i.ravel()[index] for i in arrays) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aind(x):\n\treturn tuple(x.T)",
"def index(self, arr, idx, temp = True, name = None):\n \n temp = temp or name is not None\n \n arr_t = arr.type\n\n if isinstance(arr_t, ScalarT):\n # even though it's not correct externally, it's\n # often more convenient to treat indexing\n # i... | [
"0.5842294",
"0.55760646",
"0.55092984",
"0.5497843",
"0.54363334",
"0.52967614",
"0.5283771",
"0.5263889",
"0.5225666",
"0.5220214",
"0.5194468",
"0.51706874",
"0.51583457",
"0.5133251",
"0.51113605",
"0.5105309",
"0.5093947",
"0.50427014",
"0.50376666",
"0.5035451",
"0.4927... | 0.7136496 | 0 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(Paraset, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.header is None:
self.header = std_msgs.msg.Header()
if self.command is None:
self.command = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.77940345",
"0.77196896",
"0.77196896",
"0.7685901",
"0.76253456",
"0.75629234",
"0.7438996",
"0.74165684",
"0.73517054",
"0.73081905",
"0.7280219",
"0.7237793",
"0.7226802",
"0.7223405",
"0.7223405",
"0.7218974",
"0.72109884",
"0.72109884",
"0.72109884",
"0.72109884",
"0.7... | 0.0 | -1 |
Returns the average of the quantiles of the data residuals over the posterior samples in psamples. The quantiles over multiple observatories are flattened into one array. | def posterior_data_mean_quantiles(ts, rvs, psamples):
Nobs = len(ts)
Nsamples = psamples.shape[0]
Npl = (psamples.shape[-1] - 4*Nobs)/5
psamples=params.Parameters(arr=psamples, npl=Npl, nobs=Nobs)
ll=LogLikelihood(ts, rvs)
qs=np.zeros(sum([len(t) for t in ts]))
for psample in psamples:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconstructions_mean(self):\n self.assert_sampled()\n return [[j.mean().numpy() for j in i] for i in self._reconstructions]",
"def results_psavg_sims():\n posterior_means = [[1.18040327516, 7.55106444832, 3.27420103073, 3.51998795534, 0.67212630002],\n [0.619197296326, 6.494206... | [
"0.5438853",
"0.53853667",
"0.513857",
"0.51143295",
"0.5108789",
"0.50843376",
"0.50440335",
"0.49840745",
"0.49840745",
"0.49546733",
"0.49069557",
"0.48922843",
"0.48532405",
"0.48440713",
"0.4824196",
"0.4818035",
"0.4816973",
"0.4809339",
"0.47977382",
"0.4781622",
"0.47... | 0.62415504 | 0 |
Get the destination pathname from a source pathname | def path_src_to_dest(src_pathname, dest_filename_suffix=None):
src_relpath = Path(src_pathname).relative_to(config["topdir"])
dest_pathname = Path(config["outdir"]).joinpath(src_relpath)
if dest_filename_suffix:
dest_pathname = dest_pathname.with_suffix(dest_filename_suffix)
return dest_pathname | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDestination(source):\n\ti = len(source)-1\n\tif source[i] == '/':\n\t\tsource = source[0:i - 1]\n\twhile i >= 0:\n\t\tif source[i] == '/':\n\t\t\tbreak\n\t\ti -= 1\n\tdestination = source[0: i]\n\treturn destination",
"def bestrelpath(self, dest):\n try:\n if self == dest:\n ... | [
"0.7815231",
"0.66032153",
"0.65959716",
"0.6490605",
"0.63670933",
"0.629784",
"0.61708474",
"0.6148273",
"0.6114234",
"0.6095512",
"0.60766137",
"0.6070404",
"0.6042116",
"0.6041628",
"0.60336053",
"0.60242707",
"0.60152113",
"0.60108036",
"0.59943426",
"0.5941626",
"0.5933... | 0.6820696 | 1 |
Get a datetime object or a int() Epoch timestamp and return a pretty string like 'an hour ago', 'Yesterday', '3 months ago', 'just now', etc | def timeago(time=False):
return arrow.get(time).humanize() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize_ts(timestamp=False):\n now = datetime.now()\n diff = now - datetime.fromtimestamp(timestamp)\n second_diff = diff.seconds\n day_diff = diff.days\n\n if day_diff < 0:\n return ''\n\n if day_diff == 0:\n if second_diff < 10:\n return \"just now\"\n if se... | [
"0.7884672",
"0.77373904",
"0.77095693",
"0.76925206",
"0.764941",
"0.7515793",
"0.71035963",
"0.6907508",
"0.68417704",
"0.68209934",
"0.68120766",
"0.6656181",
"0.6655731",
"0.6655061",
"0.6622342",
"0.6586432",
"0.6553994",
"0.65284973",
"0.6513826",
"0.65034336",
"0.64692... | 0.6893186 | 8 |
Get a datetime object or a int() Epoch timestamp and return a pretty string like 'an hour ago', 'Yesterday', '3 months ago', 'just now', etc | def format_date(time=False):
return arrow.get(time).format('DD-MM-YYYY') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize_ts(timestamp=False):\n now = datetime.now()\n diff = now - datetime.fromtimestamp(timestamp)\n second_diff = diff.seconds\n day_diff = diff.days\n\n if day_diff < 0:\n return ''\n\n if day_diff == 0:\n if second_diff < 10:\n return \"just now\"\n if se... | [
"0.78833723",
"0.7736534",
"0.77089053",
"0.7691787",
"0.7648496",
"0.7515203",
"0.7102702",
"0.6906622",
"0.68916446",
"0.6840511",
"0.68208",
"0.6811143",
"0.66553074",
"0.66552603",
"0.6654102",
"0.66214156",
"0.6586633",
"0.655445",
"0.65288556",
"0.65129405",
"0.65016985... | 0.0 | -1 |
Return pytz timezone give offset in minutes. If none found, then returns the EST as the default timezone. Javascript sends offset in minutes. 120 = GMT+0200, we're storing that in request.COOKIES.get('timezone_offset') minutes = request.COOKIES.get('timezone_offset') or 0 | def get_timezone_from_offset(minutes, default='US/Eastern'):
if minutes < 0:
minutes = -minutes
minus = True
else:
minus = False
min = minutes % 60
hours = (minutes - min) / 60
offset = "%s%02d%02d" % (minus and "+" or "-", hours, min)
# This is only method I found to d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timezone_offset():\n timezone = get_localzone()\n offset_minutes = timezone.utcoffset(datetime.datetime.now()).total_seconds() // SECONDS_IN_MINUTE\n return parse_int(offset_minutes)",
"def get_timezone(time_zone=''):\n return pytz.timezone(time_zone)",
"def get_timezone(timezone: str=None)... | [
"0.72785103",
"0.6679715",
"0.6583705",
"0.65549064",
"0.6543888",
"0.6491711",
"0.64791346",
"0.64500356",
"0.6345579",
"0.63271415",
"0.6276202",
"0.6270148",
"0.62497365",
"0.6246483",
"0.6226378",
"0.62032956",
"0.62001926",
"0.61094964",
"0.6066218",
"0.60319906",
"0.602... | 0.68559456 | 1 |
Remove previous lines from the color bar | def cleanCb(axColorBar):
for line in axColorBar.axes.lines:
line.remove()
return axColorBar | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suppressColorBar():\n dislin.nobar()",
"def removeColorbar(self):\n if self._colorbar is not None:\n self._colorbar.remove()\n self._colorbar = None",
"def _clear(self, event):\n if self.ignore(event) or self._changed_canvas():\n return\n self._backg... | [
"0.71303684",
"0.660231",
"0.6472268",
"0.619576",
"0.6145884",
"0.61119395",
"0.6065317",
"0.604062",
"0.60274917",
"0.60210115",
"0.5998631",
"0.5994174",
"0.5974805",
"0.5931044",
"0.5931044",
"0.5913806",
"0.5910324",
"0.58925134",
"0.58901626",
"0.5881482",
"0.5880484",
... | 0.7817924 | 0 |
Implement the backward propagation for a single RELU unit. | def relu_backward(dA, internal_params):
Z = internal_params
dZ = np.array(dA, copy=True)
dZ[Z <= 0] = 0
return dZ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backward(ctx, grad_output):\n loss, reg, u, lbda = ctx.saved_tensors\n\n device = u.device\n\n # do clever computations\n eps = 1e-10\n grad, = torch.autograd.grad(loss, u, only_inputs=True,\n retain_graph=True)\n x = (u - eps * grad)... | [
"0.73352236",
"0.71486855",
"0.7119195",
"0.71168137",
"0.71005285",
"0.70849323",
"0.7057232",
"0.70508224",
"0.7043897",
"0.69935083",
"0.6958827",
"0.69462305",
"0.6926561",
"0.6926561",
"0.6916806",
"0.69087493",
"0.69087493",
"0.6883199",
"0.6877849",
"0.68603426",
"0.68... | 0.0 | -1 |
Quit the driver and close all the windows. | def quit(self):
t1 = time.time()
self.driver.quit()
self.my_print("{0} Closed all window and quit the driver, Spend {1} seconds".format(success, time.time() - t1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n\n self._driver.quit()",
"def close(self):\n self.driver.quit()",
"def quit(self):\n self.driver.close_app()\n self.driver.quit()",
"def quit(self):\n \n if 'driver' in self.__dict__:\n self.driver.quit()\n if 'session' in self.__dict__:\n ... | [
"0.8036812",
"0.79629827",
"0.795821",
"0.78595424",
"0.7770819",
"0.76681316",
"0.76402706",
"0.7605801",
"0.7596018",
"0.75735897",
"0.7557502",
"0.754583",
"0.74882543",
"0.74882543",
"0.7468486",
"0.741782",
"0.73938257",
"0.7338536",
"0.73011684",
"0.7273469",
"0.7255594... | 0.767974 | 5 |
Implicitly wait.All elements on the page. | def wait(self, secs):
t1 = time.time()
self.driver.implicitly_wait(secs)
self.my_print("{0} Set wait all element display in {1} seconds, Spend {2} seconds".format(success,
secs,time.time() - t1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait(self):\n try:\n confirm_modal_dialog = EC.presence_of_all_elements_located((By.CLASS_NAME, 'btn-default'))\n WebDriverWait(self.web_element, 2).until(confirm_modal_dialog)\n except TimeoutException:\n confirm_ajs_dialog = EC.presence_of_all_elements_located((... | [
"0.6774106",
"0.6140227",
"0.604411",
"0.60229385",
"0.58454835",
"0.5785627",
"0.57709783",
"0.5755594",
"0.57234937",
"0.57192695",
"0.56270385",
"0.5626797",
"0.5621867",
"0.5621245",
"0.55927444",
"0.555113",
"0.5505866",
"0.55023366",
"0.5485123",
"0.5483368",
"0.5418298... | 0.6151248 | 1 |
Transform quaternion to angle+axis. | def q2aa(rotation, deg=False):
if not rotation or rotation == (1., 0., 0., 0.):
return 0, glm.vec3(0, 0, 1)
c, xs, ys, zs = rotation #glm.conjugate(rotation)
angle = math.acos(c) * 2
s = math.sin(angle / 2)
if s == 0:
return 0, glm.vec3(0, 0, 1)
if deg:
angle... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quaternion_to_angle_axis(quaternion: torch.Tensor) -> torch.Tensor:\n if not torch.is_tensor(quaternion):\n raise TypeError(\"Input type is not a torch.Tensor. Got {}\".format(\n type(quaternion)))\n\n if not quaternion.shape[-1] == 4:\n raise ValueError(\"Input must be a tensor ... | [
"0.80896837",
"0.7828082",
"0.76484704",
"0.7593675",
"0.75211877",
"0.7500747",
"0.739449",
"0.7384831",
"0.7341718",
"0.73231936",
"0.7306254",
"0.7173864",
"0.7168933",
"0.70976406",
"0.7024865",
"0.69696397",
"0.6951341",
"0.68998903",
"0.6812831",
"0.67968774",
"0.678609... | 0.7065577 | 14 |
String for representing the Model object. | def __str__(self):
return self.user.username | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
len_title=75
if len(self.description)>len_title:
titlestring=self.description[:len_title] + '...'
else:
titlestring=self.description
return titlestring | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
Get the frame rate for the video (frames per second) | def get_frame_rate(video):
video = cv2.VideoCapture(video)
# Find OpenCV version
(major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.')
# With webcam get(CV_CAP_PROP_FPS) does not work.
# Let's see for ourselves.
if int(major_ver) < 3:
fps = video.get(cv2.cv.CV_CAP_PROP_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFrameRate(self):\n if not self.proxy:\n self.proxy = self.session.service(\"ALVideoRecorder\")\n return self.proxy.getFrameRate()",
"def get_framerate(self):\n return self._framerate",
"def get_video_frame_rate(filename):\n clip = VideoFileClip(filename)\n frame_rat... | [
"0.81442916",
"0.8075644",
"0.8055693",
"0.7882474",
"0.7812777",
"0.78085417",
"0.7706465",
"0.76848507",
"0.7590933",
"0.754675",
"0.7445812",
"0.7424559",
"0.74061906",
"0.73243004",
"0.72998464",
"0.7207",
"0.7132246",
"0.71312964",
"0.7037846",
"0.7024697",
"0.70194876",... | 0.80189574 | 3 |
Get location from environment or default. | def get_location() -> location.SdcLocation:
return location.SdcLocation(fac=os.getenv('ref_fac', default='r_fac'), # noqa: SIM112
poc=os.getenv('ref_poc', default='r_poc'), # noqa: SIM112
bed=os.getenv('ref_bed', default='r_bed')) # noqa: SIM112 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getConfigPath():\n\n global args, ConfigPathDefault\n\n if args.config_location:\n return args.config_location;\n return ConfigPathDefault;",
"def get_location(self):\n return self._overridden_location or self.get_default_location()",
"def _config_location(cls):\n local = cls.... | [
"0.7177347",
"0.69822437",
"0.6899748",
"0.6846995",
"0.67594796",
"0.67408764",
"0.6567466",
"0.6567466",
"0.6567466",
"0.6550206",
"0.6428071",
"0.6418596",
"0.64051044",
"0.6391328",
"0.6383778",
"0.6383778",
"0.6383778",
"0.6383778",
"0.6373471",
"0.63651264",
"0.6365045"... | 0.70311564 | 1 |
Decides if self and d2 represent the same calendar date, whether or not they are the in the same place in memory. | def equals(self, d2):
if self.year == d2.year and self.month == d2.month and self.day == d2.day:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if self.day == other.day and self.month == other.month and self.year == other.year:\n return True\n else:\n return False",
"def __eq__(self, other):\n if self.month == other.month:\n if self.day == other.day:\n if se... | [
"0.7327474",
"0.70843506",
"0.69978386",
"0.69955295",
"0.67568344",
"0.6674572",
"0.6666818",
"0.66469276",
"0.6643512",
"0.66216856",
"0.6603491",
"0.65605384",
"0.65052336",
"0.6463389",
"0.6428842",
"0.63874286",
"0.6381778",
"0.63668907",
"0.6357204",
"0.6326482",
"0.629... | 0.7742764 | 0 |
returns an integer representing the NUMBER OF DAYS between self and d2 | def diff(self, d2):
copyD1 = self.copy()
copyD2 = d2.copy()
count = 0
if copyD1.equals(copyD2):
return count
elif copyD1.isBefore(copyD2):
while copyD1.isBefore(copyD2):
count += 1
copyD1.tomorrow()
return -count
else:
while copyD1.isAfter(copyD2):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def days_between(self, other):\n new_self = self.copy()\n new_other = other.copy()\n count=0\n if self.is_before(other):\n while(True):\n if new_self == new_other:\n break\n count-=1\n new_self.advance_one()\n ... | [
"0.7421999",
"0.70217705",
"0.7015891",
"0.70060354",
"0.6984977",
"0.6973993",
"0.69367176",
"0.69147235",
"0.6771477",
"0.6736787",
"0.6724909",
"0.67015916",
"0.6631658",
"0.6615054",
"0.65624464",
"0.64617056",
"0.64391494",
"0.64064854",
"0.63979155",
"0.6366386",
"0.633... | 0.7299645 | 1 |
Helper to create variable in the graph for loss and accuracy | def _loss(self):
cross_entropy = tf.reduce_mean(-tf.log(self.probability + epsilon) * self.y)
self.loss = cross_entropy
self.accuracy = tf.reduce_mean(
tf.cast(tf.equal(tf.argmax(self.y, 1), self.prediction), tf.float32)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_variables(self):\n\n \n with tf.name_scope(\"variable\"):\n if self.reg_type == 'L2':\n regularizer = tf.contrib.layers.l2_regularizer(scale=self.reg_scale)\n else:\n regularizer = tf.contrib.layers.l1_regularizer(scale=s... | [
"0.66808236",
"0.6173153",
"0.60105604",
"0.5973663",
"0.595178",
"0.5943431",
"0.59281385",
"0.59214157",
"0.5914717",
"0.58809876",
"0.5870538",
"0.586332",
"0.57834566",
"0.57678026",
"0.5762465",
"0.5725662",
"0.57229817",
"0.5709355",
"0.56967914",
"0.56902784",
"0.56888... | 0.0 | -1 |
Helper that create operation for tf.Summary | def _summary(self):
trainable_variable = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
for var in trainable_variable:
tf.summary.histogram(var.op.name, var)
self.merged_summary_op = tf.summary.merge_all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()",
"def build_summary(self, summary_dict):\n for key, value in summary_dict.items():\n tf.summary.scalar(key, value)\n merged_op = tf.summary.... | [
"0.7653137",
"0.7264843",
"0.7201825",
"0.7160656",
"0.71536696",
"0.71536696",
"0.7131979",
"0.7107685",
"0.7087615",
"0.70610017",
"0.69643545",
"0.6726661",
"0.66922903",
"0.66441953",
"0.65188915",
"0.6511948",
"0.6479601",
"0.6457221",
"0.6440502",
"0.6383894",
"0.635726... | 0.66810215 | 13 |
Getter for the discipline ID of the current grade instance | def get_discipline_id(self):
return self.__discipline_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_course_id(self):\n return self.ID",
"def get_discipline_name(self):\n return self.__discipline_name",
"def get_student_id(self):\n return self.__student_id",
"def get_student_id(self):\n return self._student_id",
"def cisid(self):\n return self._cisid",
"def get... | [
"0.6913118",
"0.6868929",
"0.6817603",
"0.67311543",
"0.66436386",
"0.6582481",
"0.6561987",
"0.64400834",
"0.6425438",
"0.6415259",
"0.6405952",
"0.64044946",
"0.6386278",
"0.63797176",
"0.63546896",
"0.6352328",
"0.63472956",
"0.63415945",
"0.63360286",
"0.6332231",
"0.6309... | 0.8454621 | 0 |
Getter for the student's name for the current Grade instance | def get_student_name(self):
return self.__student_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_student(self):\n return self.student",
"def __str__(self):\n return str(self.__student_name) + \" has grade \" + str(self.__grade_value) + \" at \" + str(self.__discipline_name)",
"def get_name(self) -> str:\r\n return self.name",
"def get_name(self): \r\n return self.name... | [
"0.7320124",
"0.7260825",
"0.7234937",
"0.72178173",
"0.7213346",
"0.71864283",
"0.7184898",
"0.7140616",
"0.7140616",
"0.7140616",
"0.71247065",
"0.7109712",
"0.7109712",
"0.7109712",
"0.7109598",
"0.7109598",
"0.70767534",
"0.70767534",
"0.70767534",
"0.70767534",
"0.707675... | 0.8675116 | 0 |
Completes all neccessary setup for the selenium web driver. | def setup_webdriver(self):
try:
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=" + constants.PROFILE_PATH)
driver = webdriver.Chrome(executable_path=constants.DRIVER_PATH,
options=options)
return driver
except common.exceptions.Web... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\r\n self.verificationErrors = []\r\n self.selenium = (selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(),self.shortDescription()), selvars.set_site()))\r\n self.selenium.start()\r\n self.session = self.selenium.sessionId\r\n self.... | [
"0.7022256",
"0.6994955",
"0.6994091",
"0.6979893",
"0.68989444",
"0.6878437",
"0.68558806",
"0.6812124",
"0.6702638",
"0.66713977",
"0.66394764",
"0.6589581",
"0.6589581",
"0.6589581",
"0.6561834",
"0.6549946",
"0.654924",
"0.6535904",
"0.65287876",
"0.6522772",
"0.6497466",... | 0.56090736 | 81 |
Conv2D wrapper, with bias and relu activation | def conv2d(data, outputs=32, kernel_size=(5, 5), stride=1, regularization=0.00005):
layer = tf.contrib.layers.conv2d(inputs=data,
num_outputs=outputs,
kernel_size=kernel_size,
stride=strid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _conv_block( inputs, filters, kernel, strides, nl):\n channel_axis = 1 if K.image_data_format() == 'channels_first' else -1\n x = Conv2D(filters, kernel, padding='same', strides=strides)(inputs)\n x = BatchNormalization(axis=channel_axis)(x)\n return _return_activati... | [
"0.6938004",
"0.6925405",
"0.68856287",
"0.6861973",
"0.6792042",
"0.6778072",
"0.6776451",
"0.6741474",
"0.66937774",
"0.6685073",
"0.66835284",
"0.66489744",
"0.66489744",
"0.66344804",
"0.66231155",
"0.6617821",
"0.66165745",
"0.6604576",
"0.6601505",
"0.65865606",
"0.6580... | 0.0 | -1 |
Exclude keys from dictionary recursively. | def filter_keys(data, keys=[]):
# filter key
for filter_key in keys:
if filter_key in data:
del data[filter_key]
# filter sub dictionaries
for _, value in data.items():
if type(value) == dict:
filter_keys(value, keys) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclude(m, keys):\n return {k: v for k, v in m.items() if k not in keys}",
"def drop_keys(d):\n if isinstance(d, dict):\n return {\n k: drop_keys(v)\n for k, v in d.items()\n if k not in [\"propNames\", \"package\"]\n and v is not None\n and... | [
"0.71982557",
"0.71017826",
"0.71017253",
"0.67643905",
"0.66744727",
"0.666494",
"0.65937793",
"0.6584339",
"0.65840596",
"0.64567673",
"0.643585",
"0.6431892",
"0.6385448",
"0.6362211",
"0.63301265",
"0.6303851",
"0.62677956",
"0.62537575",
"0.6232684",
"0.6205915",
"0.6177... | 0.6290627 | 16 |
Initialize this dataset class. | def __init__(self, opt):
BaseDataset.__init__(self, opt)
self.dir_A = os.path.join(opt.dataroot, opt.phase + 'A') # create a path '/path/to/data/trainA'
self.dir_B = os.path.join(opt.dataroot, opt.phase + 'B') # create a path '/path/to/data/trainB'
self.A_paths = sorted(make_dataset(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.__dataset = None",
"def __init__(self, dataset):\n self._dataset = dataset",
"def __init__(self, dataset: Dataset):\n self.dataset = dataset",
"def __init__(self, config):\n logger.info(f\"{self.__class__.__name__}: Dataset initializing ...\")\n s... | [
"0.816631",
"0.81641185",
"0.8013762",
"0.76137954",
"0.7422038",
"0.7393049",
"0.7352237",
"0.73437655",
"0.7111143",
"0.71019876",
"0.7099074",
"0.7096382",
"0.70223516",
"0.696418",
"0.6961817",
"0.6889772",
"0.6879775",
"0.68740934",
"0.68599087",
"0.68520594",
"0.6842619... | 0.6488813 | 96 |
Return a data point and its metadata information. | def __getitem__(self, index):
A_path = self.A_paths[index % self.A_size] # make sure index is within then range
if self.opt.serial_batches: # make sure index is within then range
index_B = index % self.B_size
else: # randomize the index for domain B to avoid fixed pairs.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point(self):\n return self.x, self.y, self.z",
"def to_data(self):\n point = {\n 'point': [self.pt[0], self.pt[1], self.pt[2]],\n 'layer_height': self.layer_height,\n\n 'mesh_normal': self.mesh_normal.to_data(),\n 'up_vector': self.up_vector.to_data()... | [
"0.6607296",
"0.6599758",
"0.65745145",
"0.6535129",
"0.65202826",
"0.63402396",
"0.6291092",
"0.6291092",
"0.61568433",
"0.61515397",
"0.6138252",
"0.6133588",
"0.6116883",
"0.60677505",
"0.6049698",
"0.60260797",
"0.5992455",
"0.59917825",
"0.59876746",
"0.59777427",
"0.596... | 0.0 | -1 |
Wrap each string element in tag and join the elements. | def __convertToHtmlListElement(self, listOfStringValues: List[str]) -> str:
return ''.join(f"<li>{element}</li>" for element in listOfStringValues) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_tags(tag, word):\n tag1 = \"<{}>\".format(tag)\n tag2 = \"</{}>\".format(tag)\n final = tag1 + word + tag2\n return final",
"def create_string(element_list):\n \n outstring = '<html><body>'\n \n for element in element_list:\n outstring += html.tostring(element)\n outstri... | [
"0.5969318",
"0.5911578",
"0.58806515",
"0.5838043",
"0.5793163",
"0.5753264",
"0.5704033",
"0.5701071",
"0.56826556",
"0.55926114",
"0.5556637",
"0.55514723",
"0.5513206",
"0.5507362",
"0.54939824",
"0.5471039",
"0.54170644",
"0.5402638",
"0.5396076",
"0.53810865",
"0.535553... | 0.6051207 | 0 |
Boolean condition asserts that value and derivative of cosine of the AutoDiff instance are equal to the expected value and derivative as calculated in the function for the case in which x is a real number. RETURNS ======== If the boolean condition returns True nothing is returned. If it is computed to be false, then an... | def test_cos_con():
c=14
assert {'diff':EF.cos(c).der, 'value': EF.cos(c).val}=={'diff':0, 'value': math.cos(c)} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_arccos():\n c=0.5\n def myfunc(x):\n f1=EF.arccos(x)\n return f1\n\n f_obj=ADiff(myfunc)\n res=f_obj.Jac(c)\n expectAns={'diff':-1/math.sqrt(1-c**2), 'value':math.acos(c)}\n assert res==expectAns",
"def checkFloat(comment, value, expected, tol=1e-10, update=True):\n if n... | [
"0.619214",
"0.61027396",
"0.60238",
"0.60212696",
"0.58170915",
"0.57943696",
"0.5740132",
"0.57104975",
"0.5706199",
"0.56809705",
"0.56070656",
"0.5600859",
"0.554108",
"0.5490728",
"0.545431",
"0.54504",
"0.5438208",
"0.5426342",
"0.54098964",
"0.54043466",
"0.5397096",
... | 0.6238311 | 0 |
Returns the euclidean distance between two User vertices. | def euclidean_distance(user1: User, user2: User) -> float:
common_animes = set.intersection(set(user1.neighbor_anime.keys()),
set(user2.neighbor_anime.keys()))
return sqrt(sum(pow(anime.neighbor_users[user1] - anime.neighbor_users[user2], 2)
for anime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EuclideanDistance( self, a, b ):\n return sqrt( self.EuclideanDistanceSq(a,b) )",
"def euclidean_distance(self,):\n return sqrt(pow((self.pose1.x - self.pose2.x), 2) +\n pow((self.pose1.y - self.pose2.y), 2))",
"def __dist(u, v):\n return spatial.distance.euclidean(u, v)... | [
"0.6963895",
"0.69466466",
"0.68903524",
"0.6880266",
"0.686357",
"0.6833224",
"0.6806497",
"0.6797395",
"0.6784993",
"0.6771039",
"0.6765979",
"0.67626446",
"0.67287564",
"0.671541",
"0.6711146",
"0.67072904",
"0.66899544",
"0.667745",
"0.6650605",
"0.6641603",
"0.6625499",
... | 0.7759146 | 0 |
Return the square rooted value of the sum of squares of user review scores. | def _square_rooted(user: User, animes: set[Anime]) -> float:
return sqrt(sum([anime.neighbor_users[user] * anime.neighbor_users[user]
for anime in animes])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_rmse(self, data):\n res= data.score- data[['userid','itemid']].apply(lambda row:self.calc_score(row[0], row[1]),axis=1)\n res=[el**2 for el in np.array(res)]\n return np.sqrt(np.sum(res)/data.shape[0])",
"def root_mean_square_value( values ):\n return ma.sqrt(mean_square_value( v... | [
"0.67789346",
"0.6725351",
"0.67098415",
"0.6668904",
"0.66526634",
"0.650096",
"0.64910007",
"0.6392752",
"0.6374066",
"0.63549167",
"0.63388354",
"0.6285989",
"0.6280445",
"0.6243268",
"0.6229393",
"0.6226667",
"0.6225889",
"0.6224023",
"0.61846817",
"0.6182643",
"0.6182643... | 0.6883933 | 0 |
Get the ingredient spec. | def spec(self):
return self._spec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_spec(self):\r\n return self.input_spec",
"def find_ingredient(self, ingredient_str):\n return self.find_doc('ingredient', 'name', self.get_unique_ingredients_name(ingredient_str))",
"def _get_spec(self, requirement_name):\n return Spec(','.join(self.versions_spec[requirement_... | [
"0.6274449",
"0.6177592",
"0.60568184",
"0.60404813",
"0.59850353",
"0.5973417",
"0.5872426",
"0.58190626",
"0.5700041",
"0.5700041",
"0.56123567",
"0.55838734",
"0.55769014",
"0.55754685",
"0.5558199",
"0.5453096",
"0.5428837",
"0.5402059",
"0.5395059",
"0.5375218",
"0.53725... | 0.65218824 | 0 |
Sets the initial state of self, which includes the contents of sourceCollection, if it is present. | def __init__(self, sourceCollection = None):
self._size = 0
self._modCount = 0
if sourceCollection:
for item in sourceCollection:
self.add(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, sourceCollection = None):\n self._front = self._rear = None\n AbstractCollection.__init__(self, sourceCollection)",
"def source(self, source):\n\n self._source = source",
"def source(self, source):\n\n self._source = source",
"def source(self, source):\n\n ... | [
"0.6834638",
"0.61755556",
"0.61755556",
"0.61755556",
"0.61755556",
"0.61755556",
"0.61755556",
"0.61755556",
"0.6115388",
"0.5937697",
"0.58528554",
"0.58218473",
"0.5799573",
"0.5783457",
"0.57636255",
"0.575177",
"0.56940144",
"0.5668226",
"0.56664675",
"0.56180024",
"0.5... | 0.7065542 | 0 |
We will attempt to get the local timezone of the server running the module and use that. If we can't get the timezone then we will set the default to be UTC Linnux has been tested and other opersting systems should be OK. Failures cause assumption of UTC Windows is not supported and will assume UTC | def _get_local_tz(module, timezone='UTC'):
if platform.system() == 'Linux':
timedatectl = get_bin_path('timedatectl')
if timedatectl is not None:
rcode, stdout, stderr = module.run_command(timedatectl)
if rcode == 0 and stdout:
line = _findstr(stdout, 'Time zo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_tz():\n return 'UTC'",
"def timezone():\n \n pass",
"def local_timezone() -> Timezone | FixedTimezone:\n return get_local_timezone()",
"def local_tz(self):\n return pytz.timezone(self.calendar.timezone)",
"def timezone():\n\n return time.timezone",
"def get_timezone():\n ... | [
"0.7593437",
"0.70392257",
"0.68582565",
"0.68310165",
"0.6800011",
"0.6789667",
"0.6762175",
"0.67572707",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
... | 0.76198214 | 0 |
Convert byte string onto Unicode string using UTF8 encoding Works with byte strings and byte string lists | def byte2str(self, obj):
encoding = "utf-8"
if isinstance(obj, list):
if len(obj)>0 and not isinstance(obj[0], str):
self.helper.log_debug(
"conversion from list of %s onto list of <class 'str'>" %
type(obj[0]))
return [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unicode2utf8(s):\n return s.encode(encoding='utf-8', errors='ignore')",
"def asunicode(s):\n if isinstance(s, bytes):\n return s.decode('utf-8', 'replace')\n else:\n return s",
"def to_unicode(string):\n if not isinstance(string, unicode):\n for codec in CODECS:\r\n ... | [
"0.7599131",
"0.7429441",
"0.7393733",
"0.73679966",
"0.73527426",
"0.7275011",
"0.7239559",
"0.72345823",
"0.72203404",
"0.720482",
"0.71890503",
"0.71776223",
"0.71598697",
"0.71495706",
"0.71413255",
"0.7125601",
"0.70986843",
"0.70421576",
"0.70337594",
"0.7014159",
"0.70... | 0.0 | -1 |
Setter for the password hash. | def password(self, password):
self.password_hash = generate_password_hash(password) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_password(self):\n self.__password = self.str_to_hash(self.__password)",
"def set_password_hash(self, password):\n salt = bcrypt.gensalt()\n self.password_hash = bcrypt.hashpw(password.encode(), salt)",
"def set_password(self, password):\n self.password = self.hash_password(... | [
"0.84580356",
"0.83336854",
"0.8251061",
"0.81436145",
"0.8076932",
"0.803501",
"0.80028546",
"0.79949045",
"0.7984532",
"0.7984532",
"0.7878497",
"0.7878497",
"0.7878497",
"0.7878497",
"0.7842239",
"0.78154725",
"0.77743006",
"0.7770604",
"0.7759591",
"0.775318",
"0.773285",... | 0.78225017 | 15 |
Validate hash of given password. | def check_password(self, password):
return check_password_hash(self.password_hash, password) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_password(self, password):\n return check_hash(password, self.password)",
"def verify_password(self, hash, password):\r\n try:\r\n PasswordHasher().verify(hash, password)\r\n return True\r\n except:\r\n return False",
"def verify_password(self, pas... | [
"0.8055371",
"0.7954082",
"0.78996164",
"0.78987145",
"0.78145176",
"0.7811876",
"0.77887774",
"0.769057",
"0.75888485",
"0.75888485",
"0.75888485",
"0.75888485",
"0.75888485",
"0.75888485",
"0.75888485",
"0.755989",
"0.7526725",
"0.74951416",
"0.7485249",
"0.7479043",
"0.747... | 0.7377351 | 28 |
Sets the number of sentences to request this GUI's Markov Chain to produce from the current value of the num_sentences SpinBox component. | def set_number_of_sentences(self):
self.number_of_sentences = int(self.num_sentences.get()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_sentences(self, sentences):\n self._sentences = sentences",
"def _set_number_of_words(self, N):\n self.N_words_to_display = N",
"def setCount(self, num):\n self.count=num",
"def edit_text(self):\n self.text = self.ui.plainTextEdit.toPlainText()\n sentences_number = ... | [
"0.65060955",
"0.61695755",
"0.59748507",
"0.5911244",
"0.58793664",
"0.5843372",
"0.5841032",
"0.58173054",
"0.5584266",
"0.55234367",
"0.549743",
"0.5469665",
"0.5469665",
"0.54437494",
"0.54421407",
"0.5417",
"0.5392903",
"0.53676283",
"0.5358095",
"0.5322339",
"0.53115636... | 0.87004405 | 0 |
Sets the minimum sentence length of any sentence this GUI's Markov Chain will output, as per the current value of the set_min_sentence SpinBox. If the current value is greater than or equal to the current maximum sentence length, no change is made. | def set_min_sentence_length(self):
new_min = int(self.set_min_sentence.get())
cur_max = self.max_sentence_length
if new_min < cur_max:
self.min_sentence_length = new_min
else:
old_min = self.min_sentence_length
old_min_var = tk.StringVar(self.master)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMinSentenceSize(self, value):\n return self._set(minSentenceSize=value)",
"def set_max_sentence_length(self):\n new_max = int(self.set_max_sentence.get())\n cur_min = self.min_sentence_length\n\n if new_max > cur_min:\n self.max_sentence_length = new_max\n els... | [
"0.7855158",
"0.76631397",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
... | 0.87098616 | 0 |
Sets the maximum sentence length of any sentence this GUI's Markov Chain will output, as per the current value of the set_max_sentence SpinBox. If the current value is less than or equal to the current minimum sentence length, no change is made. | def set_max_sentence_length(self):
new_max = int(self.set_max_sentence.get())
cur_min = self.min_sentence_length
if new_max > cur_min:
self.max_sentence_length = new_max
else:
old_max = self.max_sentence_length
old_max_var = tk.StringVar(self.master)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMaxSentenceLength(self, value):\n return self._set(maxSentenceLength=value)",
"def setMaxSentenceLength(self, value):\n return self._set(maxSentenceLength=value)",
"def setMaxSentenceLength(self, value):\n return self._set(maxSentenceLength=value)",
"def setMaxSentenceLength(self,... | [
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"... | 0.8767241 | 0 |
Get all the posts that are of type NEWS | def get_news(request):
return get_all_posts(request, PostType.NEWS) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_posts(self, published=False) -> Type[QuerySet]:\n categories = self.get_descendant_categories()\n posts = Post.objects.filter(categories__in=categories)\n if published:\n posts = posts.filter(published__lte=timezone.now())\n return posts",
"def get_all_posts(request... | [
"0.6337393",
"0.6113393",
"0.60611385",
"0.60267586",
"0.6009277",
"0.59933615",
"0.59903824",
"0.58913356",
"0.5810465",
"0.5692559",
"0.5685967",
"0.565168",
"0.5642692",
"0.56090117",
"0.5573423",
"0.55714744",
"0.5566585",
"0.55500364",
"0.5540304",
"0.5528783",
"0.552878... | 0.65027636 | 0 |
Creates a view that will return all the posts that are published and by ordering them by importance first, then date | def get_all_posts(request, show_only=None):
if(show_only == None):
posts = Post.objects.filter(published_date__lte=timezone.now()).order_by('-is_important', '-published_date')
title = "All Posts"
else:
posts = Post.objects.filter(post_type__exact=show_only.name).filter(published_date__lt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def published_posts(self) -> Type[QuerySet]:\n return Post.objects.filter(published__lt=timezone.now()).order_by('-published')",
"def post_list(request):\n # Only show the posts that have been published\n posts = Post.objects.filter(date_published__isnull=False)\n return render(request,\n ... | [
"0.66984665",
"0.65487033",
"0.6492767",
"0.64507943",
"0.64296913",
"0.6417808",
"0.6417808",
"0.63767827",
"0.6332085",
"0.6223986",
"0.62032664",
"0.61715215",
"0.61628515",
"0.61628515",
"0.6007591",
"0.5923551",
"0.5904396",
"0.590371",
"0.5891956",
"0.58891535",
"0.5856... | 0.64107 | 7 |
The Action Group resource IDs. | def group_ids(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
return pulumi.get(self, "group_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups(self):\r\n return resources.Groups(self)",
"def action_group_id(self) -> Optional[str]:\n return pulumi.get(self, \"action_group_id\")",
"def group_ids(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"group_ids\")",
"def resource_group_ids_scope(self) -> str:\n ... | [
"0.667532",
"0.6325436",
"0.6276232",
"0.6123759",
"0.6123759",
"0.60838944",
"0.607983",
"0.6047004",
"0.5986194",
"0.5986194",
"0.5986194",
"0.5986194",
"0.5986194",
"0.5975283",
"0.5970267",
"0.5931191",
"0.58320796",
"0.5817181",
"0.5813919",
"0.579841",
"0.5774376",
"0... | 0.64152503 | 1 |
An optional custom email subject to use in email notifications. | def custom_email_subject(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "custom_email_subject") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self, subject: \"str\"):\n self._attrs[\"subject\"] = subject",
"def subject(self, subject: \"str\"):\n self._attrs[\"subject\"] = subject",
"def subject(self):\n return self.mail.get('Subject')",
"def _get_email_subject(app_name):\n return '{} <==> Tote'.format(app_name)",
... | [
"0.6489472",
"0.6489472",
"0.6424295",
"0.6249044",
"0.62452984",
"0.62452984",
"0.61771196",
"0.6170477",
"0.61662596",
"0.61575764",
"0.61519724",
"0.6137915",
"0.6137259",
"0.6122633",
"0.61057836",
"0.6089166",
"0.6057406",
"0.5999996",
"0.5969143",
"0.5958554",
"0.595855... | 0.8148969 | 0 |
Test if the user is logged in. | def post(self):
obj = request.get_json()
if ('username' not in obj) or ('session' not in obj):
return {"status":"MISSING_PARAMS"}
status = authenticate(obj['username'], obj['session'])
if status:
return {'status':'AUTH_OK'}
else:
return {'status':'AUTH_FAIL'} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_logged_in():\n return 'user' in session",
"def logged_in():\n\n if current_user.is_authenticated:\n return True\n\n return False",
"def logged_in(self):\n return self.auth.get_user_by_session() is not None",
"def isLoggedIn(self):\n session = self.getSession()\n if ses... | [
"0.8699016",
"0.8686575",
"0.8583789",
"0.83448195",
"0.8343801",
"0.8300311",
"0.8294276",
"0.82341635",
"0.81461996",
"0.8126107",
"0.8106466",
"0.7975631",
"0.7970333",
"0.7902963",
"0.7742969",
"0.7733253",
"0.76417047",
"0.76340127",
"0.76274747",
"0.7586603",
"0.745795"... | 0.0 | -1 |
Returns a random string of length string_length. | def my_random_string(string_length=10):
random = str(uuid.uuid4()) # Convert UUID format to a Python string.
random = random.upper() # Make all characters uppercase.
random = random.replace("-", "") # Remove the UUID '-'.
return random[0:string_length] # Return the random string. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_string(length):\n return ''.join(SystemRandom().choice(ascii_letters + digits)\n for i in range(length))",
"def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))",
"def get_random_stri... | [
"0.8691263",
"0.8690539",
"0.8676425",
"0.86712104",
"0.86504567",
"0.86304426",
"0.8626901",
"0.85903996",
"0.8588565",
"0.8576007",
"0.8560824",
"0.85416645",
"0.8539037",
"0.85361385",
"0.84932715",
"0.8490938",
"0.844971",
"0.8442166",
"0.84295636",
"0.8426424",
"0.838733... | 0.8082956 | 75 |
Return the latest saved_model. | def get_latest_saved_model(model_dir):
saved_models = os.path.join(model_dir, 'best_models')
saved_chkp = sorted([int(mdl) for mdl in os.listdir(saved_models)])
latest = saved_chkp[-1]
path = os.path.join(saved_models, '%d' % latest)
# Next, find the full path to the saved model
mdl_time = os.l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_model():\n return get_models()[-1]",
"def get_last_saved_model(cls, model_dir) -> Tuple[Optional[Path], int]:\n return cls._get_first_model(model_dir, sort='step', desc=True)",
"def load_latest_save(self, device=None):\n return torch.load(str(self.previous_saves()[-1].absolute()... | [
"0.8486878",
"0.76698536",
"0.7298401",
"0.7079473",
"0.70578605",
"0.6916961",
"0.686052",
"0.68335253",
"0.68335253",
"0.66821706",
"0.66821706",
"0.6669951",
"0.66666996",
"0.66666996",
"0.66666996",
"0.66666996",
"0.66666996",
"0.66666996",
"0.66666996",
"0.66666996",
"0.... | 0.73232174 | 2 |
Create submission, saved to csv file. | def create_submission_file(img_idx, img_pred, file_path, set_threshold=0.5, apply_crf=False):
# Inference, and collect to dictionary
n_samples = len(img_idx)
report_every = int(float(n_samples) / 100)
print("Found %d samples" % n_samples)
rle = FastRle(4)
for i, (idx, pred) in enumerate(zip(img_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_submission(name, results):\n if name[-4:] != \".csv\":\n file_path = name + \".csv\"\n else:\n file_path = name\n \n file = open(file_path, \"w\")\n \n id = 0\n file.write(\"Id,Prediction\\n\") # Header\n \n # Write each result one by one\n for result in res... | [
"0.75609756",
"0.7271815",
"0.70726645",
"0.7013777",
"0.69272214",
"0.68094724",
"0.67973834",
"0.67973834",
"0.67973834",
"0.67973834",
"0.67973834",
"0.67973834",
"0.67723316",
"0.67553675",
"0.6739765",
"0.666555",
"0.66282994",
"0.6571957",
"0.64385194",
"0.64376986",
"0... | 0.0 | -1 |
Submit a CSV to kaggle. | def submit(path, msg):
cmd = 'kaggle competitions submit'
cmd = '%s %s' % (cmd, 'tgs-salt-identification-challenge')
cmd = '%s -f %s' % (cmd, path)
cmd = '%s -m "%s"' % (cmd, msg)
os.system(cmd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submission_to_surprise(name_train):\n \n ids, values = get_ids_values(name_train)\n \n item, user = replace_ids_submission(ids)\n \n def create_csv_submission2(item, user, y_pred, name):\n \"\"\"\"\"\"\n with open(name, 'w') as csvfile:\n fieldnames = ['Item', 'User',... | [
"0.6166462",
"0.59776264",
"0.59139615",
"0.5908297",
"0.57993096",
"0.5764987",
"0.5726517",
"0.57245255",
"0.5722129",
"0.56691563",
"0.5666378",
"0.5666378",
"0.5666378",
"0.5666378",
"0.5666378",
"0.5666378",
"0.56507397",
"0.5597532",
"0.55808806",
"0.5572247",
"0.556397... | 0.0 | -1 |
Wf the initial value of 1, the global variable is set to global_wf [Hi], the xi is the current xi subscript incoming, initialized to 0. | def anfiswfsum(theXi,outLayer1,beforeValue,beforeMat):
global theHi,global_wf,wf_Hi_Xi_Ui
for u in range(0, nn.Ui):
if theHi <= nn.Hi-1:
afterValue = beforeValue * outLayer1[theXi, u]
afterMat = beforeMat
afterMat[0,theXi] = u
if theXi == nn.Xi-1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gwf(self, psi_w, H, J):\n\t if self.vw <= 0.:\n\t return 0.00001\n\t else:\n\t return self.GWMAX*exp(-(-psi_w/J)**H)",
"def srwf(xi):\n\treturn np.sqrt(wienergain(xi)) # SRWF gain function.",
"def qwf(self, vw, ev, gp, psi_l, lai, dt):\n\t\t#if the amount of water in storage is less tha... | [
"0.6307007",
"0.61151093",
"0.59348685",
"0.5829508",
"0.5822576",
"0.5808111",
"0.57853186",
"0.5776802",
"0.5737508",
"0.56701636",
"0.56696725",
"0.5603101",
"0.5589305",
"0.555555",
"0.55292255",
"0.55243504",
"0.55144686",
"0.54702765",
"0.54500973",
"0.5426993",
"0.5419... | 0.5805866 | 6 |
Test the command to bulkupdate patients contact | def test_update_contact(mock_app, gpx4_patients):
runner = mock_app.test_cli_runner()
patients_collection = mock_app.db.patients
# GIVEN a database with some patients
patients_collection.insert_many(gpx4_patients)
test_patients = patients_collection.find()
# Sharing a contact information
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_otoroshi_controllers_adminapi_tcp_service_api_controller_bulk_update_action(self):\n pass",
"def test_otoroshi_controllers_adminapi_tcp_service_api_controller_bulk_patch_action(self):\n pass",
"def test_update_batch(self):\n self.batch_data['batch_id'] = self.batch_info.id\n ... | [
"0.7028907",
"0.67930585",
"0.666327",
"0.62609684",
"0.6216473",
"0.6037648",
"0.5950919",
"0.59361154",
"0.593158",
"0.589418",
"0.58618575",
"0.58603084",
"0.585794",
"0.5840429",
"0.5838186",
"0.58320105",
"0.58251095",
"0.58173716",
"0.5804996",
"0.5788242",
"0.57680327"... | 0.6999571 | 1 |
Returns the number of connections | def __len__(self):
return dict.__len__(self) // 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getconnectioncount(self):\n return self.proxy.getconnectioncount()",
"def _created_connections(self):\n return len(self._available_connections) + len(self._in_use_connections)",
"def get_num_connections(self):\n\n synapses = 0\n for mat in self.weights:\n synapses += ... | [
"0.84989995",
"0.80466455",
"0.8036355",
"0.77807605",
"0.77768886",
"0.7705548",
"0.75783026",
"0.7436398",
"0.73844874",
"0.7367792",
"0.72922146",
"0.7227403",
"0.7174849",
"0.71431017",
"0.7136167",
"0.71298695",
"0.710992",
"0.7084595",
"0.7055083",
"0.7054783",
"0.70309... | 0.0 | -1 |
Enable user to buy a stock. | def openproject():
# POST
if request.method == "POST":
# Validate form submission
if not request.form.get("projectname"):
return apology("missing project name")
elif not request.form.get("link"):
return apology("missing project link")
# Record project ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy(self, stock, amount):\n self.orders[stock] += amount",
"def buy(self, symbol: str=None, quantity: int=0, in_force: str='gtc', extended: bool=False):\n return self.trader.buy(symbol, quantity, in_force, extended)",
"def buy_stock (self, ticker, buy_date, sell_date, amount):\n\n if s... | [
"0.6653856",
"0.6647518",
"0.65846837",
"0.65707827",
"0.6548142",
"0.63767505",
"0.6267546",
"0.62477654",
"0.6235365",
"0.62160015",
"0.62022454",
"0.6190609",
"0.6190339",
"0.6174273",
"0.6115096",
"0.6108209",
"0.60575914",
"0.6052103",
"0.6047494",
"0.604169",
"0.6035211... | 0.0 | -1 |
Retrieves Batch connection parameters from environment variables | def validate_client_parameters(namespace):
# simply try to retrieve the remaining variables from environment variables
if not namespace.account_name:
namespace.account_name = az_config.get('batch', 'account', None)
if not namespace.account_endpoint:
namespace.account_endpoint = az_config.ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getParamsFromEnv(self):\r\n self.port = os.getenv('PGPORT', self.port)\r\n self.host = os.getenv('PGHOST', self.host)\r\n self.database = os.getenv('PGDATABASE', self.database)\r\n self.user = os.getenv('PGUSER', self.user)\r\n self.password = os.getenv('PGPASSWORD', self.pas... | [
"0.65879214",
"0.63385504",
"0.60384786",
"0.5714945",
"0.566517",
"0.5661886",
"0.5602447",
"0.5579198",
"0.5530082",
"0.5513854",
"0.5481908",
"0.54728484",
"0.543364",
"0.5416506",
"0.5404828",
"0.5402597",
"0.537637",
"0.53413635",
"0.5330548",
"0.5320838",
"0.52848506",
... | 0.5095665 | 41 |
Absolute maximum cooling setpoint. | def abs_max_cool_setpoint_limit(self) -> int:
return self.cluster.get("abs_max_cool_setpoint_limit", 3200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abs_min_cool_setpoint_limit(self) -> int:\n return self.cluster.get(\"abs_min_cool_setpoint_limit\", 1600)",
"def absmax(self):\n raise NotImplementedError",
"def abs_max_heat_setpoint_limit(self) -> int:\n return self.cluster.get(\"abs_max_heat_setpoint_limit\", 3000)",
"def _maximu... | [
"0.7390342",
"0.6880755",
"0.6699675",
"0.66157746",
"0.6585473",
"0.64992166",
"0.64724123",
"0.6445962",
"0.6444601",
"0.63723814",
"0.63416517",
"0.63181305",
"0.62716085",
"0.6267244",
"0.62624335",
"0.62495303",
"0.6168795",
"0.61668366",
"0.61656046",
"0.6160874",
"0.61... | 0.75471944 | 0 |
Absolute maximum heating setpoint. | def abs_max_heat_setpoint_limit(self) -> int:
return self.cluster.get("abs_max_heat_setpoint_limit", 3000) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absmax(self):\n raise NotImplementedError",
"def argmaxY( self ):\n max = -1e30\n for i in range( 0, self.GetN() ):\n p = ( ROOT.Double(), ROOT.Double() )\n self.GetPoint( i, p[0], p[1] )\n if p[1] > max: max = p[1]\n return max",
"def maxY(self):\n retu... | [
"0.74692106",
"0.73951626",
"0.70762277",
"0.707307",
"0.705706",
"0.7016047",
"0.69126564",
"0.68926084",
"0.67964274",
"0.67854404",
"0.67479825",
"0.67303455",
"0.6711814",
"0.6688887",
"0.6684824",
"0.66841793",
"0.66813904",
"0.66564053",
"0.66160107",
"0.6611545",
"0.66... | 0.6980156 | 6 |
Get unreportable occupancy attribute. | async def get_occupancy(self) -> bool | None:
res, fail = await self.read_attributes(["occupancy"])
self.debug("read 'occupancy' attr, success: %s, fail: %s", res, fail)
if "occupancy" not in res:
return None
return bool(self.occupancy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_occupant(self):\n\t\treturn self.occupant",
"def get_occupant(self):\n\t\tpass",
"def not_assignable(self):\n return self.unavailable + self.occupied",
"def get_occupancy(self):\n # Compute logo for current alignment\n logo = self.get_logo()\n # Compute occupancy denominat... | [
"0.68534285",
"0.6847008",
"0.63162404",
"0.600313",
"0.6003007",
"0.5726995",
"0.5713434",
"0.5629928",
"0.55774504",
"0.5566915",
"0.54400116",
"0.54259133",
"0.53681576",
"0.535954",
"0.53496844",
"0.52831364",
"0.5246753",
"0.5236286",
"0.52140903",
"0.51890177",
"0.51715... | 0.61989087 | 3 |
FIND THE POINT AT WHICH AN ARRAY STARTS CHANGING "SIGNIFICANTLY". | def find_relevant_change(array, err = 1e-3):
dif = np.abs(array - array[0])
dif = dif > err
idx = min(np.where(dif == True)[0])
return idx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point_in_arr(arr, point):\n for i in range(len(arr)):\n if arr[i][0] == point[0] and arr[i][1] == point[1]:\n return i\n return -1",
"def get_main_points(neuron):\n (branch_index,) = np.where(neuron.branch_order[neuron.n_soma:] == 2)\n (endpoint_index,) = np.where(neuron.branch_... | [
"0.6181049",
"0.6115391",
"0.59461176",
"0.5827277",
"0.58249587",
"0.57680404",
"0.57669914",
"0.5746077",
"0.57221997",
"0.5691695",
"0.5679983",
"0.5664177",
"0.56624424",
"0.5650071",
"0.5614284",
"0.5610214",
"0.5593673",
"0.5587134",
"0.5584181",
"0.5520613",
"0.548389"... | 0.0 | -1 |
sigmoid function to compute next state of activation vector a vector of activations a vector of activations after sigmoid function has been applied | def sigmoid (vec : np.ndarray) -> np.ndarray :
op = lambda x : 1.0 / (1.0 + np.exp (-x))
return list (map (op, vec)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.exp(-preActivation))",
"def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))",
"def activation_sigmoid(self):\n self.value = 1 / (1 + np.e ** (-self.value))",
"def activation(z):\n # formula for sigmoid\n... | [
"0.7785965",
"0.7722604",
"0.7588552",
"0.75411016",
"0.75239503",
"0.7478232",
"0.74757403",
"0.7425777",
"0.7419607",
"0.7419607",
"0.7419607",
"0.7419607",
"0.7419607",
"0.7419607",
"0.740651",
"0.73894197",
"0.73894197",
"0.7375873",
"0.73713607",
"0.7363129",
"0.7350871"... | 0.7017219 | 60 |
Reshape a 4D tensor of image data to a grid for easy visualization. | def visualize_grid(Xs, ubound=255.0, padding=1):
pixel_sz = 2
(H, W, C, N) = Xs.shape
Xs_resize = np.zeros((H*pixel_sz, W*pixel_sz, C, N))
Xs = (ubound*(Xs-np.min(Xs))/(np.max(Xs)-np.min(Xs))).astype('uint8')
for c in range(C):
for n in range(N):
Xs_resize[:,:,c,n] = imresize(X... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reshape(self, data):\n\n\t\td = np.zeros((32,32,3))\n\t\td_r = data[0:1024].reshape(32,32)\n\t\td_g = data[1024:2048].reshape(32,32)\n\t\td_b = data[2048:].reshape(32,32)\n\n\t\tfor h in range(32):\n\t\t for w in range(32):\n\t\t for c in range(3):\n\n\t\t if c == 0 : d[h,w,c] = d_r[h,w]\... | [
"0.69275147",
"0.68927044",
"0.66429174",
"0.66399515",
"0.6569427",
"0.65163445",
"0.64027023",
"0.63976663",
"0.6344992",
"0.63068163",
"0.62804306",
"0.6278322",
"0.62271667",
"0.6149602",
"0.6141104",
"0.61091465",
"0.608741",
"0.60288805",
"0.5931444",
"0.5919866",
"0.59... | 0.5604002 | 46 |
Pulse the Enable Pin on the LCD | def pulseEnable( self, _data ): # uint8_t
self.expanderWrite( _data | LCD_EN ) # En high
sleep_us(1) # enable pulse must be >450ns
self.expanderWrite( _data & (0xFF ^ LCD_EN) ) # En low
sleep_us(50) # commands need > 37us to settle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pulse_enable(self):\n self.set_low(self._en_pin)\n self._usleep(1)\n self.set_high(self._en_pin)\n self._usleep(1)\n self.set_low(self._en_pin)\n # commands need > 37us to settle\n self._usleep(100)",
"def enable_pulse_modulation(self):\n self.write(\"... | [
"0.8290033",
"0.72652996",
"0.7065156",
"0.69558316",
"0.6947763",
"0.6901592",
"0.676794",
"0.6735534",
"0.66760164",
"0.6586983",
"0.6527253",
"0.6503161",
"0.64747596",
"0.64213467",
"0.6400039",
"0.6391462",
"0.6362962",
"0.6358918",
"0.63532215",
"0.6292264",
"0.6276042"... | 0.7924556 | 1 |
Display / Hide the cursor | def cursor( self, value=True ):
if value:
self._displaycontrol |= LCD_CURSORON
else:
self._displaycontrol &= (0xFF^LCD_CURSORON)
self.command( LCD_DISPLAYCONTROL | self._displaycontrol ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_cursor(self) -> None:\n self._impl.hide_cursor()",
"def hide_cursor():\n props = WindowProperties()\n props.setCursorHidden(True)\n # somehow the window gets undecorated after hiding the cursor\n # so we reset it here to the value we need\n #props.setUndecorated(settings.fullscreen... | [
"0.8427776",
"0.79905635",
"0.79196095",
"0.7895877",
"0.77774394",
"0.7620958",
"0.7511472",
"0.720188",
"0.7103194",
"0.7019723",
"0.68951255",
"0.6515224",
"0.6471635",
"0.63646114",
"0.6314855",
"0.62869525",
"0.62826526",
"0.61686635",
"0.61674845",
"0.61616623",
"0.6103... | 0.70292604 | 9 |
Main page of the website that by default renders the score page. | def index():
# call the datetime function
datetime_today = datetime.datetime.now(central)
datestring_today = datetime_today.strftime("%m-%d-%Y")
return render_score_page("index.html", datestring_today, "bballfast.com") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scoringpage (request):\n # Define views here\n context = {}\n return render(request, 'scoringPage.html', context=context)",
"def main_page():\n return render_template(\"index.html\")",
"def main_page():\n return render_template(\"main_page.html\")",
"def homepage():\n \n return render_t... | [
"0.7296351",
"0.7006198",
"0.68405885",
"0.6829979",
"0.6770165",
"0.6762042",
"0.67004645",
"0.66702193",
"0.66341364",
"0.6612518",
"0.6606914",
"0.658859",
"0.65757966",
"0.65526485",
"0.6531723",
"0.65306866",
"0.65016776",
"0.65003675",
"0.64927125",
"0.6475726",
"0.6475... | 0.6906065 | 2 |
Calculates the person's age by subtracting DOB by today's date. | def calculate_age(born):
today = datetime.date.today()
return today.year - born.year - ((today.month, today.day) < (born.month, born.day)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def age(self):\n today = datetime.date.today()\n\n return today.year - int(self.birthday[0:4])",
"def getAge(self):\n if self.birthday == None:\n raise ValueError\n return (datetime.date.today() - self.birthday).days",
"def getAge(self):\n if self.birthday == None:... | [
"0.77002764",
"0.76725006",
"0.76725006",
"0.76725006",
"0.76725006",
"0.76384634",
"0.7616854",
"0.7543764",
"0.7532337",
"0.74960154",
"0.7455721",
"0.74450886",
"0.7438945",
"0.7346812",
"0.72818804",
"0.7278958",
"0.7239315",
"0.7176156",
"0.699009",
"0.69411945",
"0.6939... | 0.73218644 | 14 |
Create a mask from image that indicates where the painting is located in the image. | def cell_based_hist_segmentation(img, cells=[32, 32]):
descriptor = []
w,h = img.shape[:2]
w_ranges = [(i*w)//cells[0] for i in range(cells[0])]+[-1]
h_ranges = [(i*h)//cells[1] for i in range(cells[1])]+[-1]
celled_hist = obtain_celled_histograms(img, cells, w_ranges, h_ranges)
rectangular_se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mask_image(image):\n pass",
"def get_mask(self, img):\n raise NotImplementedError()",
"def getHitmask(self,image):\n\t\tmask = []\n\t\tfor x in range(image.get_width()):\n\t\t\tmask.append([])\n\t\t\tfor y in range(image.get_height()):\n\t\t\t\tmask[x].append(bool(image.get_at((x,y))[3]))\n\t... | [
"0.7490076",
"0.7396982",
"0.7186577",
"0.71678144",
"0.71678144",
"0.71678144",
"0.701324",
"0.70111656",
"0.69884086",
"0.6943392",
"0.6866654",
"0.68239546",
"0.6784365",
"0.67684",
"0.6760218",
"0.67311895",
"0.6713658",
"0.6712798",
"0.66874224",
"0.6645183",
"0.6642625"... | 0.0 | -1 |
Test the _delete_sheets() method | def test_delete_sheet(self):
self.workbook.add_worksheet('Sheet1')
self.workbook.add_worksheet('Sheet2')
self.workbook._write_sheets()
exp = """<sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/><sheet name="Sheet2" sheetId="2" r:id="rId2"/></sheets>"""
got = self.fh.getvalu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_buckets(self):\n pass",
"def test_delete_bucket(self):\n pass",
"def test_delete_run(self):\n pass",
"def test_aws_service_api_vm_workshift_delete(self):\n pass",
"def test_delete(self):\r\n course = CourseFactory.create(org='edX', course='999')\r\n ... | [
"0.64588976",
"0.59919167",
"0.5933634",
"0.58989644",
"0.58353966",
"0.5820436",
"0.57939655",
"0.5754813",
"0.57505316",
"0.5708442",
"0.5697343",
"0.56962657",
"0.5692305",
"0.56788445",
"0.56646174",
"0.5659868",
"0.5630166",
"0.5594766",
"0.55886954",
"0.55800515",
"0.55... | 0.7621504 | 0 |
x = np.arange(20,10,0.1) plt.plot(x,np.log(sigmoid(x))) plt.show() | def sigmoid(z):
return 1/(1+np.exp(-z)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_sigmoid():\n X = np.linspace(-10, 10, 100)\n sX = sigmoid(X)\n plt.figure(figsize=(15,5))\n plt.xlabel(r'$\\theta^Tx^{(i)}$')\n plt.ylabel(r'$h(x^{(i)}, \\theta)$')\n plt.plot(X, sX)\n plt.show()",
"def figure_10_12_b():\n xs = np.arange(-6,6,0.1)\n plt.plot(xs,sigmoid(xs))\n ... | [
"0.86532986",
"0.8537651",
"0.74224055",
"0.73892915",
"0.7387803",
"0.7384661",
"0.73766726",
"0.73766726",
"0.73766726",
"0.73766726",
"0.73766726",
"0.73766726",
"0.7353146",
"0.7335383",
"0.7329763",
"0.7288945",
"0.7288945",
"0.7244903",
"0.72270805",
"0.7202366",
"0.720... | 0.6489566 | 75 |
Cunado xi == 0 quiero que devuelva 0 | def _lambda(xi):#xi=xis; xi=Phi.dot(w); xi = 0
div0 = np.divide(1, (2*xi),where=xi!=0)
return (div0 * (sigmoid(xi)-(1/2))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __basis0(self, xi):\n return np.where(np.all([self.knot_vector[:-1] <= xi,\n xi < self.knot_vector[1:]], axis=0), 1.0, 0.0)",
"def fun(self, x):\n if np.any(x[self._z] != 0):\n return np.inf\n else:\n return 0",
"def fun(self, x):\n ... | [
"0.73291653",
"0.7065022",
"0.70590764",
"0.70390016",
"0.69431263",
"0.6851851",
"0.67398393",
"0.6538563",
"0.65233064",
"0.6513084",
"0.6513084",
"0.65040666",
"0.6467056",
"0.6450215",
"0.6440012",
"0.6418634",
"0.63759553",
"0.62805474",
"0.6250463",
"0.6203136",
"0.6200... | 0.0 | -1 |
result == (sigmoid(a)ts) ((1sigmoid(a))(1ts) ) | def likelihood(ts,w,Phi):
a = Phi.dot(w)
return np.exp(a*ts)*sigmoid(-a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(z):\r\n \r\n return vSigmoid(z);",
"def sigmoid(t):\n return 1 / (1 + np.exp(-t))",
"def sigmoid(t):\n return np.exp(t)/(1+np.exp(t))",
"def sigmoid(x):\n return 1 / (1 + math.exp(-... | [
"0.7970833",
"0.7970833",
"0.7970203",
"0.79701793",
"0.7938187",
"0.79161793",
"0.7890822",
"0.7872404",
"0.7864835",
"0.7840145",
"0.7840145",
"0.78354704",
"0.78354704",
"0.78354704",
"0.78354704",
"0.78354704",
"0.78354704",
"0.78171295",
"0.78124434",
"0.7805588",
"0.780... | 0.0 | -1 |
Derivative of the function at point x. | def df(x):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _derivative_(self, x, diff_param=None):\n return 2*exp(-x**2)/sqrt(pi)",
"def derivative(func: Callable, x: float, delta: float) -> float:\n return (func(x + delta) - func(x - delta)) / (2.0 * delta)",
"def dalf(x):\n return derivative(alf, x, dx=1e-6)",
"def calculate_derivative_value(s... | [
"0.8278267",
"0.8048703",
"0.7841336",
"0.77691346",
"0.7767401",
"0.7767401",
"0.76579374",
"0.7624486",
"0.75324166",
"0.75161165",
"0.74648845",
"0.7456165",
"0.723277",
"0.72323114",
"0.72116315",
"0.7076324",
"0.6956006",
"0.6950806",
"0.6944872",
"0.69253236",
"0.692054... | 0.0 | -1 |
Return ndarray normalized by length, i.e. Euclidean norm, along axis. >>> matrix = Matrix() >>> v0 = numpy.random.random(3) >>> v1 = matrix._unitVector(v0) >>> numpy.allclose(v1, v0 / numpy.linalg.norm(v0)) True >>> v0 = numpy.random.rand(5, 4, 3) >>> v1 = matrix._unitVector(v0, axis=1) >>> v2 = v0 / numpy.expand_dims(... | def _unitVector(self, data: numpy.array, axis: Optional[int] = None, out: Optional[numpy.array] = None) -> numpy.array:
if out is None:
data = numpy.array(data, dtype = numpy.float64, copy = True)
if data.ndim == 1:
data /= math.sqrt(numpy.dot(data, data))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_vector(data, axis=None, out=None):\r\n if out is None:\r\n data = numpy.array(data, dtype=numpy.float64, copy=True)\r\n if data.ndim == 1:\r\n data /= math.sqrt(numpy.dot(data, data))\r\n return data\r\n else:\r\n if out is not data:\r\n out[:] =... | [
"0.8269818",
"0.82546455",
"0.8250857",
"0.80327684",
"0.77269816",
"0.75500673",
"0.7432038",
"0.73765016",
"0.7347887",
"0.7319297",
"0.7309126",
"0.7309126",
"0.7309126",
"0.73058844",
"0.73058844",
"0.73058844",
"0.73058844",
"0.73058844",
"0.73058844",
"0.73058844",
"0.7... | 0.8197814 | 3 |
Initializes ensemble model parameters. | def __init__(self,
weight_scheme,
inference_options):
self._weight_scheme = weight_scheme
self._beam_size = inference_options["beam_size"]
self._length_penalty = inference_options["length_penalty"]
self._maximum_labels_length = inference_options["maximum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_model_params(self):\n super()._init_model_params()\n\n if 'e' in self.init_params:\n if self.init_type == 'uniform':\n if self.nr_no_train_de == 0:\n self.B = [\n np.full(\n (self.n_states, self.n... | [
"0.7625147",
"0.7260391",
"0.72239",
"0.7147076",
"0.70976734",
"0.70523953",
"0.7039951",
"0.70193547",
"0.69938004",
"0.69877213",
"0.6969741",
"0.69261277",
"0.69225925",
"0.6909206",
"0.6908926",
"0.68184847",
"0.68084455",
"0.6789725",
"0.6764455",
"0.673326",
"0.6704384... | 0.0 | -1 |
Return package version as listed in `__version__` in `init.py`. | def get_version(package):
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version_from_package() -> str:\n path = join(dirname(__file__), \"__init__.py\")\n path = normpath(abspath(path))\n with open(path) as f:\n for line in f:\n if line.startswith(\"__version__\"):\n token, version = line.split(\" = \", 1)\n version = ve... | [
"0.8489624",
"0.83920646",
"0.83877116",
"0.83816165",
"0.8380421",
"0.83707577",
"0.8359593",
"0.8358526",
"0.8357767",
"0.80770814",
"0.7975172",
"0.7939306",
"0.7892174",
"0.7892174",
"0.7892174",
"0.78021485",
"0.7722347",
"0.7697771",
"0.7693506",
"0.76890945",
"0.765900... | 0.83721197 | 8 |
check to see if two string are equal | def compare(self, substring, needle):
if len(substring) < len(needle):
return False
for i in range(len(needle)):
if substring[i] != needle[i]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isEqual(string1, string2):\n return (True)",
"def _strings_are_equal(self, value1, value2):\n if value1.lower().strip().replace('_', ' ') == value2.lower().strip().replace('_', ' '):\n return 1\n return 0",
"def test_strings_are_equal(self):\n string1 = 'this is the first s... | [
"0.84568053",
"0.7992798",
"0.7917697",
"0.77368325",
"0.76884824",
"0.76275694",
"0.75396967",
"0.74432564",
"0.7406243",
"0.7353515",
"0.7260431",
"0.72181237",
"0.7209652",
"0.71532357",
"0.70831275",
"0.704882",
"0.7018718",
"0.6991484",
"0.69509274",
"0.6922243",
"0.6880... | 0.0 | -1 |
Returns the full path for the dataset file. | def dataset_path(cls):
basepath = os.path.dirname(__file__)
filepath = os.path.abspath(
os.path.join(basepath, "..", "datasets", get_env('DATA_FILENAME')))
return filepath | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path(self):\n return self._data_file",
"def dataset_path(dataset, work_dir=consts.WORK_DIR):\r\n return join_path(work_dir, consts.DATA_DIR, dataset)",
"def get_filepath(filename):\n return os.path.join(\"datasets\", filename)",
"def dataset_dir(self):\n return self._dataset_dir",
"... | [
"0.8058205",
"0.80355954",
"0.7945212",
"0.77371156",
"0.7652561",
"0.7644312",
"0.7565171",
"0.75521266",
"0.7542085",
"0.75204843",
"0.7462107",
"0.7460071",
"0.7443824",
"0.7371767",
"0.7316586",
"0.73021555",
"0.72992235",
"0.7249082",
"0.7211426",
"0.7210987",
"0.7207542... | 0.87297165 | 0 |
Populate queue with messages containing S3 keys from 'prefix', grouped by the first occurrence of '/' after 'prefix'. If is required that the prefix ends with '/', which means that all the subdirs will be scanned. | def populate_queue_with_subdirs(bucket: str, prefix: str, queue: str) -> None:
# No reason to run the function without scanning subdirs
assert prefix[-1] == "/"
dirs = get_client("s3").list_objects_v2(
Bucket=bucket, Prefix=prefix, Delimiter="/",
)
# Paging is not supported here
asser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_s3_files(bucket, prefix):\n \n s3 = boto3.client('s3')\n\n if type(prefix) != list:\n prefix = [prefix]\n \n # Loop over prefixes:\n file_list = []\n for p in prefix:\n \n # Load one prefix:\n response = s3.list_objects_v2(Bucket=bucket, Prefix=p)\n ... | [
"0.65747863",
"0.65253735",
"0.65112585",
"0.64017195",
"0.62606305",
"0.62546366",
"0.6225744",
"0.62026757",
"0.6166004",
"0.6156403",
"0.6142595",
"0.6133839",
"0.6086885",
"0.6068397",
"0.6056256",
"0.60536903",
"0.6052233",
"0.604813",
"0.603384",
"0.60187894",
"0.599217... | 0.77303046 | 0 |
Close the connection if already open and create a new connection. | def initialize(self):
if not self.connection.is_closed():
self.connection.close()
self.connection.connect() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _close_connection(self):\n if self.connection:\n self.connection.destroy()\n self.connection = None",
"def close_connection_if_open():\n\ttry:\n\t\tconn = flask.g._database_connection\n\texcept AttributeError:\n\t\tpass\n\telse:\n\t\tconn.close()\n\t\tdel flask.g._database_connec... | [
"0.72940964",
"0.72033143",
"0.7164679",
"0.69590634",
"0.68829936",
"0.68330306",
"0.6756814",
"0.67430496",
"0.6740128",
"0.67233616",
"0.67085904",
"0.669894",
"0.66818845",
"0.6676526",
"0.6672563",
"0.6630847",
"0.661474",
"0.661474",
"0.6594738",
"0.65928644",
"0.659176... | 0.6224986 | 62 |
get the available computation devices (CPU & GPUs) Get the computation devices for deep learning experiments with given preferred list of GPU and flag for multiGPU computation. | def get_computation_devices(
preferred_gpu_list: Optional[List[int]],
multi_gpu_flag: bool,
) -> List[Device]:
# use CPU when GPUs are not preferred or not available
if (preferred_gpu_list is None) \
or (len(preferred_gpu_list) == 0) \
or (not torch.cuda.is_available()):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_all_gpus(): #@save\n num_gpus = len(tf.config.experimental.list_physical_devices('GPU'))\n devices = [tf.device(f'/GPU:{i}') for i in range(num_gpus)]\n return devices if devices else [tf.device('/CPU:0')]",
"def detect_gpus():\n def worker(q):\n # `device_lib` will not release the me... | [
"0.7351089",
"0.711227",
"0.7013773",
"0.7013773",
"0.69962704",
"0.6990039",
"0.69724643",
"0.69648427",
"0.69502217",
"0.6850669",
"0.6835772",
"0.678422",
"0.67773485",
"0.675242",
"0.6687484",
"0.6627573",
"0.6611311",
"0.6611311",
"0.6591264",
"0.64701104",
"0.6435652",
... | 0.8674712 | 0 |
Numpy implementation of the Frechet Distance. The Frechet distance between two multivariate Gaussians X_1 ~ N(mu_1, C_1) and X_2 ~ N(mu_2, C_2) is d^2 = ||mu_1 mu_2||^2 + Tr(C_1 + C_2 2sqrt(C_1C_2)). Stable version by Dougal J. Sutherland. | def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):
mu1 = np.atleast_1d(mu1)
mu2 = np.atleast_1d(mu2)
sigma1 = np.atleast_2d(sigma1)
sigma2 = np.atleast_2d(sigma2)
assert mu1.shape == mu2.shape, \
'Training and test mean vectors have different lengths'
assert sigma1.sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):\r\n\r\n mu1 = np.atleast_1d(mu1)\r\n mu2 = np.atleast_1d(mu2)\r\n\r\n sigma1 = np.atleast_2d(sigma1)\r\n sigma2 = np.atleast_2d(sigma2)\r\n\r\n assert mu1.shape == mu2.shape, \\\r\n 'Training and test mean vectors have differ... | [
"0.7606565",
"0.760468",
"0.75966567",
"0.75819856",
"0.74629045",
"0.70034355",
"0.6697771",
"0.66525847",
"0.6602489",
"0.64158535",
"0.6381264",
"0.62491024",
"0.6149679",
"0.6146693",
"0.6079008",
"0.598141",
"0.5977956",
"0.59448826",
"0.590892",
"0.58807087",
"0.5873282... | 0.7578174 | 4 |
Test instructor creation with missing role info | def test_create_instructor_missing_role(self):
response = self.client.post(self.url, data=json.dumps(self.payload_missing_role),
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, msg=response.content.decode())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_instructor(self):\n response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual(Instructor.objects.count(), self.qty + 1)\n ... | [
"0.7794621",
"0.7467939",
"0.7449668",
"0.7408569",
"0.7357018",
"0.7348701",
"0.7240623",
"0.7208329",
"0.71653557",
"0.7107521",
"0.705882",
"0.6785346",
"0.67461926",
"0.6733531",
"0.66950613",
"0.66404426",
"0.66112673",
"0.6588831",
"0.65816295",
"0.6567953",
"0.6553653"... | 0.8201606 | 0 |
Creates an ArgumentParser to read the options for this script from sys.argv | def make_argument_parser():
parser = argparse.ArgumentParser(
description="Make an libsvm-formatted dataset from a set of images"
)
parser.add_argument('sources',
help='Specifies the source image files/directory')
parser.add_argument('output',
help... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_command_line(self, argv):\n from optparse import OptionParser\n usage = \"usage: %prog [options]\"\n parser = OptionParser(usage)\n\n (options, args) = parser.parse_args(argv)",
"def _init_parser():\n\t\n\t_parser = argparse.ArgumentParser()\n\t_parser.add_argument(\"--pull\... | [
"0.77495533",
"0.7427968",
"0.7407757",
"0.73361915",
"0.73148197",
"0.7309196",
"0.72941315",
"0.729033",
"0.7288606",
"0.72717685",
"0.72671",
"0.72608715",
"0.7257929",
"0.72291887",
"0.72102225",
"0.7202624",
"0.71952707",
"0.7194806",
"0.71738976",
"0.71731013",
"0.71731... | 0.0 | -1 |
Relative vector pointing from center to target(eye or mouth) | def distance(self, f):
return [(f[0] + (f[2])*self.target[0])/self.im_w - self.tpw,
(f[1] + (f[3])*self.target[1])/self.im_h - self.tph] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point_at(self, target=[0.0, 0.0, 10000.0]):\r\n if target[0] == self.eye[0] and target[1] == self.eye[1] and target[2] == self.eye[2]:\r\n return\r\n dx, dy, dz = target[0] - self.eye[0], target[1] - self.eye[1], target[2] - self.eye[2]\r\n rot = -degrees(arctan2(dx, dz))\r\n horiz = sqrt(dot(... | [
"0.6803924",
"0.65862095",
"0.6295688",
"0.6282717",
"0.62604606",
"0.6249994",
"0.6249994",
"0.6249994",
"0.61998945",
"0.6189077",
"0.6186509",
"0.61403877",
"0.61380464",
"0.61097914",
"0.60480255",
"0.6009291",
"0.5991502",
"0.5973568",
"0.5961979",
"0.595217",
"0.5885064... | 0.0 | -1 |
type of activation function used in the hidden layers | def activation(self):
return self.__activation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoder_activation_func(num_layer):\n ec_funct = []\n for i in range(num_layer):\n ec_funct.append('relu')\n ec_funct.append('softmax')\n\n return ec_funct",
"def activation_func(activation:str):\n return nn.ModuleDict([\n ['relu', nn.ReLU(inplace=True)],\n ['leaky_relu',... | [
"0.724085",
"0.719596",
"0.7140935",
"0.71137583",
"0.71036595",
"0.7055742",
"0.70314294",
"0.6977066",
"0.6974104",
"0.68584967",
"0.68507534",
"0.68432015",
"0.6818952",
"0.67827785",
"0.6753838",
"0.6738937",
"0.6732502",
"0.6710012",
"0.6702611",
"0.6668781",
"0.66434306... | 0.63954556 | 39 |
activation function sigmoid or tanh | def activationFunction(self, z):
if self.__activation == 'sig':
activation = 1 / (1 + np.exp(-z))
else:
tanhnum = np.exp(z) - np.exp(-z)
tanhden = np.exp(z) + np.exp(-z)
activation = tanhnum / tanhden
return activation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation(z):\n # formula for sigmoid\n return 1 / (1 + np.exp(-z))",
"def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))",
"def _tanh_to_sigmoid(x):\n return x * 0.5 + 0.5",
"def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.exp(-preActivation))",... | [
"0.8432375",
"0.8404371",
"0.82695425",
"0.82086027",
"0.80934036",
"0.80158395",
"0.8015465",
"0.7978896",
"0.7978881",
"0.79766303",
"0.79766303",
"0.7974799",
"0.7967132",
"0.79436386",
"0.79399025",
"0.79387474",
"0.7902738",
"0.7902738",
"0.7902738",
"0.7902738",
"0.7902... | 0.77524894 | 37 |
derivate of the activation function | def derivative(self, cache):
if self.__activation == 'sig':
derivative = cache * (1 - cache)
else:
derivative = 1 - cache ** 2
return derivative | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative_activation(z):\n return activation(z) * (1 - activation(z))",
"def activ_fn_derivative(z):\n return 1 - np.square(np.tanh(z))",
"def d_act_f(self, p):\n if self.activation is None:\n return p\n if self.activation == \"tanh\":\n return 1 - np.tanh(p)*... | [
"0.830826",
"0.7284745",
"0.7055898",
"0.7015848",
"0.69733274",
"0.6966202",
"0.6885254",
"0.68363667",
"0.6835931",
"0.6812788",
"0.680407",
"0.6769177",
"0.67670155",
"0.6765087",
"0.6757609",
"0.67508197",
"0.67384857",
"0.67384857",
"0.67384857",
"0.67384857",
"0.6735879... | 0.0 | -1 |
Load a pickled DeepNeuralNetwork object | def load(filename):
try:
with open(filename, 'rb') as f:
data = pickle.load(f)
return data
except FileNotFoundError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(fname):\n with open(fname, 'rb') as inp:\n model = pickle.load(inp)\n\n if type(model) != NeuralNetwork:\n raise ImportError('Given file is not a neural network')\n\n return model",
"def load(self, filename, path=\".\"):\n if filename is None:\n ... | [
"0.7039734",
"0.6884281",
"0.68586236",
"0.68396556",
"0.67182696",
"0.67000514",
"0.66847837",
"0.66503686",
"0.65774935",
"0.6571297",
"0.65578455",
"0.6523443",
"0.6505813",
"0.63297397",
"0.63203365",
"0.6310363",
"0.62374526",
"0.6227036",
"0.6219301",
"0.62069404",
"0.6... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.