query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Return the name of the scene. | def name(self):
return self._scene_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_scene_name(self):\n return self._document.GetDocumentName()",
"def scene_name():\n\n pass",
"def get_current_scene_name():\n\n scene_name = cmds.file(query=True, sceneName=True, shortName=True)\n scene_name = osp.splitext(scene_name)[0]\n\n return scene_name",
"def bspb_sceneName():\n ... | [
"0.88859296",
"0.8629169",
"0.8004623",
"0.7645613",
"0.7175747",
"0.7175747",
"0.7131868",
"0.69200826",
"0.6756709",
"0.67234814",
"0.66674066",
"0.66612965",
"0.6615379",
"0.6598769",
"0.6598569",
"0.6596836",
"0.6596836",
"0.6596836",
"0.6596836",
"0.6596836",
"0.6596836"... | 0.9163909 | 0 |
Shifts a periodically separated clump by the domain width. Looks for gaps in the positions larger than max('dx'), shifts one group to the right (left if shiftRight=Flase) to be spatially contiguous. | def shift(clump,shiftRight = True):
try:
DomainRight = clump.ds["DomainRightEdge"]
DomainLeft = clump.ds["DomainLeftEdge"]
DomainWidth = DomainRight - DomainLeft
except:
DomainRight = clump.data.ds["DomainRightEdge"]
DomainLeft = clump.data.ds["DomainLeftEdge"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rel_shift(self, xs):\n bs, qlen, klen, n_heads = xs.size()\n xs = xs.permute(0, 3, 2, 1)\n idx = torch.arange(klen, device=xs.device)\n k_idx, q_idx = idx.unsqueeze(0), idx.unsqueeze(1)\n rel_pos_idx = torch.abs(k_idx - q_idx)\n if klen != qlen:\n rel_pos_i... | [
"0.56847703",
"0.55326337",
"0.5481701",
"0.54664737",
"0.538059",
"0.5325605",
"0.52111894",
"0.5205152",
"0.519846",
"0.51961416",
"0.5108735",
"0.51027304",
"0.50812495",
"0.50812495",
"0.50812495",
"0.50812495",
"0.5061491",
"0.50597787",
"0.50593007",
"0.5058505",
"0.503... | 0.7429752 | 0 |
Set the group's definition. | def set_definition(self, definition):
return self.client._perform_json(
"PUT", "/admin/groups/%s" % self.name,
body = definition) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def definition(self, definition):\n\n self._definition = definition",
"def set_definition(self, definition):\n return self.client._perform_json(\n \"PUT\", \"/projects/%s/managedfolders/%s\" % (self.project_key, self.odb_id),\n body=definition)",
"def setGroup(self, ... | [
"0.700113",
"0.68629426",
"0.6688239",
"0.66694266",
"0.65902597",
"0.65711033",
"0.6542075",
"0.64840984",
"0.64840984",
"0.64840984",
"0.6321388",
"0.6256382",
"0.62282515",
"0.62070966",
"0.6112045",
"0.608821",
"0.5954409",
"0.58832735",
"0.58815926",
"0.58678097",
"0.573... | 0.83831835 | 0 |
Encode float x between 1 and 1 as two bytes. | def encode(x):
i = int(16384 * x)
return Struct('h').pack(i) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def float_to_bin (x):\n assert type (x) is float\n s_hex = float.hex (x)\n hex_parts = RE_FLOAT_HEX_PARTS.match (s_hex)\n assert hex_parts\n \n s = hex_parts.group ('sign')\n m = hex_parts.group ('mantissa')\n se = hex_parts.group ('signexp')\n e = hex_parts.group ('exp')\n \n # Ma... | [
"0.6785549",
"0.6759016",
"0.6680987",
"0.66505665",
"0.662883",
"0.64889437",
"0.63726604",
"0.630351",
"0.6209765",
"0.62045646",
"0.60710794",
"0.6047133",
"0.6036422",
"0.5979504",
"0.5974094",
"0.59223753",
"0.59071773",
"0.5883423",
"0.5873075",
"0.5860104",
"0.58443576... | 0.6081865 | 10 |
returns well formated time string. | def get_time_human_readable():
return time.strftime("%A, %H:%M") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _time_str(self):\n try:\n if not self._time:\n raise ValueError\n format_ = '%a, %d %b %Y %H:%M:%S'\n return datetime.fromtimestamp(float(self._time)).strftime(format_)\n except ValueError:\n return plastic_date()",
"def get_time_str():... | [
"0.815023",
"0.80154544",
"0.7944513",
"0.78629076",
"0.78456205",
"0.780953",
"0.7661317",
"0.7514476",
"0.75072527",
"0.7481121",
"0.7479614",
"0.74715257",
"0.7369408",
"0.730658",
"0.72583234",
"0.7253269",
"0.7239677",
"0.7239282",
"0.72138816",
"0.7201866",
"0.7179637",... | 0.7368552 | 13 |
Get haversine distance between two points. Expects points as (latitude, longitude) tuples. | def measure_between_two_points(self, point_a, point_b):
# cHaversine expects points to be given as (latitude, longitude) pairs.
# TODO: Determine if this check for non-null values is necessary.
if point_a and point_b:
return haversine(tuple(point_a), tuple(point_b)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def haversine(point_1, \n point_2):\n # Specify the radius of the Earth in kilometers\n earth_radius = 6372.8\n # Extract latitudes and longitudes from the provided points\n latitude_1 = point_1[0]\n latitude_2 = point_2[0]\n longitude_1 = point_1[1]\n longitude_2 = point_2[1]\n ... | [
"0.83035445",
"0.7816804",
"0.77963793",
"0.7723899",
"0.7710364",
"0.77098763",
"0.76932836",
"0.7692517",
"0.76734084",
"0.7669112",
"0.76634717",
"0.76595026",
"0.76426387",
"0.76405525",
"0.76393706",
"0.7636176",
"0.7633867",
"0.76333475",
"0.7632323",
"0.7632117",
"0.76... | 0.7399359 | 63 |
Testing response from utility.slug_exists | def test_slug_exists(scorekeeper_slug: str,
database_connection: mysql.connector.connect,
print_response: bool = False):
response = utility.slug_exists(scorekeeper_slug, database_connection)
assert response
if print_response:
print(json.dumps(response, inden... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_slug_not_exists(scorekeeper_slug: str,\n database_connection: mysql.connector.connect,\n print_response: bool = False):\n response = utility.slug_exists(scorekeeper_slug, database_connection)\n assert not response\n if print_response:\n print... | [
"0.7455614",
"0.696593",
"0.6729905",
"0.6658974",
"0.6644025",
"0.651248",
"0.64338064",
"0.6289599",
"0.62832946",
"0.6256759",
"0.6191592",
"0.6190503",
"0.6176051",
"0.6156027",
"0.6128501",
"0.6127749",
"0.6121748",
"0.6099984",
"0.6061959",
"0.6038353",
"0.60328275",
... | 0.78204477 | 0 |
Testing response from utility.slug_exists | def test_slug_not_exists(scorekeeper_slug: str,
database_connection: mysql.connector.connect,
print_response: bool = False):
response = utility.slug_exists(scorekeeper_slug, database_connection)
assert not response
if print_response:
print(json.dumps... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_slug_exists(scorekeeper_slug: str,\n database_connection: mysql.connector.connect,\n print_response: bool = False):\n response = utility.slug_exists(scorekeeper_slug, database_connection)\n assert response\n if print_response:\n print(json.dumps(resp... | [
"0.78219306",
"0.69698805",
"0.6733279",
"0.6659201",
"0.6638983",
"0.6518815",
"0.6433914",
"0.62932885",
"0.62897146",
"0.6262688",
"0.6193431",
"0.6191733",
"0.6183213",
"0.6163275",
"0.6135989",
"0.6127789",
"0.61203545",
"0.60967493",
"0.6067284",
"0.60357344",
"0.603227... | 0.7455917 | 1 |
Given a byte string, return a RNG seed value | def get_seed_from_bytes(s):
return unpack_from('l', md5(s).digest())[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_seed(input):\n return hashlib.md5(input.encode(\"utf8\")).hexdigest()",
"def random_seed(chars, nb_chars):\n s = ''\n for i in range(nb_chars):\n s += chars[random.randint(0, len(chars) - 1)]\n\n return s",
"def MT19937_CTR(string: str, seed: int) -> bytes:\n # Verify that th... | [
"0.73840284",
"0.6614374",
"0.6609516",
"0.6471527",
"0.6441519",
"0.6411584",
"0.6379423",
"0.63573474",
"0.6315166",
"0.63030607",
"0.62426937",
"0.621534",
"0.6212165",
"0.61402225",
"0.61214125",
"0.60838044",
"0.6072454",
"0.6050465",
"0.6027221",
"0.5991569",
"0.5981195... | 0.79750985 | 0 |
Return the variant name that ``environ`` is assigned to within ``experiment`` If ``record`` is true, write a line to the log file indicating that the variant was shown. (No deduping is done the log line is always written. A page with ``show_variant`` might record multiple hits on reloads etc) | def show_variant(environ, experiment, record=False, variant=None):
swab = environ['swab.swab']
exp = swab.experiments[experiment]
variants = exp.weighted_variants
swabid = _getswabid(environ)
if not swab.include(environ, experiment):
variant = variant if variant is not None else exp.control... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_goal(environ, goal, experiment=None):\n\n if is_bot(environ):\n return\n\n swab = environ['swab.swab']\n if experiment is None:\n try:\n experiments = swab.experiments_by_goal[goal]\n except KeyError:\n raise ValueError(\"Invalid goal: {!r}\".format(go... | [
"0.57108766",
"0.53370416",
"0.5209742",
"0.47805443",
"0.47755566",
"0.47740227",
"0.47651005",
"0.4763143",
"0.47235376",
"0.46972078",
"0.4593119",
"0.45164788",
"0.4513941",
"0.45026544",
"0.45011175",
"0.44935486",
"0.44927618",
"0.44902852",
"0.4485001",
"0.44665545",
"... | 0.6956545 | 0 |
convert to unix timestamp | def conv_unix(evt_time):
st = time.strptime(evt_time, '%Y-%m-%d %H:%M')
return time.mktime(st) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unix_to_timestamp(unix):\n return int(round(unix * 1e6))",
"def timestamp_to_unix(timestamp):\n return timestamp / 1e6",
"def to_unix_time(timestamp):\n date = datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S')\n return int(time.mktime(date.timetuple()))*1000",
"def to_unix(cls, timestamp):\n ... | [
"0.81328446",
"0.81225735",
"0.806153",
"0.79576576",
"0.78275156",
"0.76299036",
"0.7617567",
"0.73813546",
"0.7369568",
"0.7350043",
"0.72691005",
"0.725604",
"0.7213637",
"0.7193658",
"0.7176386",
"0.7169469",
"0.70531976",
"0.7052877",
"0.70428014",
"0.70408314",
"0.70312... | 0.78108984 | 5 |
Dismisses a request. Returns the updated ApprovalRequest. | def DismissApprovalRequest(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Reject(self, request, global_params=None):\n config = self.GetMethodConfig('Reject')\n return self._RunMethod(\n config, request, global_params=global_params)",
"def leave_request_decline(self, token, **kwargs):\n cr, uid, context = self._get_cr_uid_context()\n res = self._ch... | [
"0.637088",
"0.6211055",
"0.594087",
"0.594087",
"0.5614389",
"0.5610705",
"0.5576027",
"0.55367386",
"0.5525588",
"0.54731977",
"0.54731977",
"0.54731977",
"0.54731977",
"0.54731977",
"0.54731977",
"0.54731977",
"0.54731977",
"0.54731977",
"0.54731977",
"0.54731977",
"0.5473... | 0.72069657 | 0 |
Gets the address of the 'sender'. This is determined by looking at the ``Sender`` header and then the ``From`` header. Alternatively if a ``ResentDate`` header is present, look at ``ResentSender`` and ``ResentFrom``, in that order. | def sender(self):
key, alt = ('Sender', 'From') if not self.resent else \
('Resent-Sender', 'Resent-From')
value = self.get(key) or self.get(alt)
_, addr = getaddresses([value])[0]
return addr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def envelope_sender(self):\n envelope_sender = None\n # TODO: Make this check better as soon as SMTP from and sender are \n # Addresses, not AddressLists anymore.\n if self.smtp_from != None and len(self.smtp_from) > 0:\n envelope_sender = self.smtp_from\n elif self.se... | [
"0.7063626",
"0.6986507",
"0.65325415",
"0.62701935",
"0.62288105",
"0.61276823",
"0.61128455",
"0.59757423",
"0.59212536",
"0.59179157",
"0.5907463",
"0.5851787",
"0.5830255",
"0.5721543",
"0.5663292",
"0.56535846",
"0.5631547",
"0.55883694",
"0.5586396",
"0.55701566",
"0.55... | 0.86421484 | 0 |
Block until `num_windows` are present and are ready (usually 2, but can be overridden in the case of popups opening other popups). Switch the current window to the new popup. | def wait_for_and_switch_to_popup(self, num_windows=2, timeout=10):
self.wait_until(lambda d: len(d.window_handles) == num_windows, timeout)
self.selenium.switch_to.window(self.selenium.window_handles[-1])
self.wait_page_ready() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def into_new_window(self):\r\n t1 = time.time()\r\n try:\r\n all_handle = self.driver.window_handles\r\n flag = 0\r\n while len(all_handle) < 2:\r\n time.sleep(1)\r\n all_handle = self.driver.window_handles\r\n flag += 1\r\... | [
"0.721894",
"0.6129312",
"0.6125073",
"0.6033363",
"0.58155733",
"0.57954174",
"0.5764158",
"0.56394064",
"0.552571",
"0.55177635",
"0.55119395",
"0.55041003",
"0.54933107",
"0.54900235",
"0.5489751",
"0.5424759",
"0.5410189",
"0.5352759",
"0.534321",
"0.5331983",
"0.5310833"... | 0.81485814 | 0 |
Loads the training data for a dataset. | def load_training_as_df(
key: str, source_base_path: str = SOURCE_BASE_PATH, include_validation: bool = False) -> pd.DataFrame:
train = _load_target_and_source(key, source_base_path, 'train')
if include_validation:
validation = _load_target_and_source(key, source_base_path, 'validation')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(self):\n\n self._load_train_data()\n self._load_test_data()",
"def load_dataset(self):\n # Get all the files in the directory\n file_list = self.get_file_list()\n\n # Concatenate the data corresponding to a list of files\n data = self.concatenate_file_data(... | [
"0.7938365",
"0.79241556",
"0.7774563",
"0.75485736",
"0.739858",
"0.73710525",
"0.7321907",
"0.7295291",
"0.72888845",
"0.720759",
"0.71871364",
"0.71665263",
"0.7162327",
"0.7147582",
"0.7132345",
"0.71184653",
"0.71032596",
"0.7087726",
"0.7026929",
"0.702674",
"0.70197713... | 0.0 | -1 |
Computes the sum of piped elements. | def sum_():
@sinks
def _dagpype_internal_fn_act(target):
try:
s = (yield)
while True:
s += (yield)
except GeneratorExit:
target.send(s)
target.close()
return _dagpype_internal_fn_act | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sum_sequence(seq):\n\n def _add(x, y): return x + y\n\n return reduce(_add, seq, 0)",
"def sum_elements(arr):\n return sum(arr)",
"def summed(L):\r\n result = 0\r\n for e in L:\r\n result = result + e # or result += e\r\n return result",
"def with_sum_sum_reduction(self):\n ... | [
"0.6616403",
"0.65874755",
"0.6501158",
"0.649301",
"0.6461831",
"0.645371",
"0.64041674",
"0.63927406",
"0.6296797",
"0.6282094",
"0.6263707",
"0.6238551",
"0.6228723",
"0.6215732",
"0.6215732",
"0.61986583",
"0.61852807",
"0.61668545",
"0.6148457",
"0.6136826",
"0.6115042",... | 0.6042551 | 25 |
Returns the nth piped element. | def nth(n):
if n >= 0:
@sinks
def _dagpype_internal_fn_act_p(target):
i = 0
try:
while True:
e = (yield)
if i == n:
target.send(e)
target.close()
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nth(iterable, index):\n return next(itertools.islice(iterable, index, None))",
"def nth(iterable, n, default=None):\n return next(islice(iterable, n, None), default)",
"def nth(iterable, n, default=None):\n return next(islice(iterable, n, None), default)",
"def nth(iterable, n, default=None):\n ... | [
"0.7004952",
"0.67978615",
"0.67978615",
"0.67978615",
"0.67094094",
"0.6700167",
"0.6694007",
"0.64411706",
"0.6437495",
"0.6082297",
"0.5898216",
"0.5897228",
"0.5822544",
"0.581808",
"0.57932955",
"0.57579285",
"0.57565194",
"0.5737585",
"0.5726128",
"0.57235223",
"0.56921... | 0.5993725 | 10 |
Converts all elements to a list. | def to_list():
@sinks
def _dagpype_internal_fn_act(target):
l = []
try:
while True:
l.append((yield))
except GeneratorExit:
target.send(l)
target.close()
return _dagpype_internal_fn_act | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_list(self):\n return self._elements",
"def convert_to_list(element):\r\n return list(element)",
"def to_list(self):\n return self.main_list[:self.num_elements]",
"def tolist(self):\n \n ret = []\n \n for e in self:\n ret.append(e)\n \n... | [
"0.8275669",
"0.81462365",
"0.79078794",
"0.7889437",
"0.77627856",
"0.7532826",
"0.74830043",
"0.74379027",
"0.7401745",
"0.73202884",
"0.72912097",
"0.72816545",
"0.72770405",
"0.7252381",
"0.7232675",
"0.7164391",
"0.71600354",
"0.7124933",
"0.7115259",
"0.7034816",
"0.700... | 0.0 | -1 |
Computes the smallest element. | def min_():
@sinks
def _dagpype_internal_fn_act(target):
has = False
try:
m = (yield)
has = True
while True:
m = min((yield), m)
except GeneratorExit:
if has:
target.send(m)
target.close()
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smallest (self):\n return self.pointers[0].smallest()",
"def find_smallest(self):\n return self._find_smallest(self.root)",
"def _find_min(self):\n if self.is_empty(): # is_empty inherited from base class\n raise Empty('Priority queue is empty')\n small = self._data.first()\n wa... | [
"0.7876701",
"0.772716",
"0.76537013",
"0.75176656",
"0.74732924",
"0.739643",
"0.72460824",
"0.7240524",
"0.7236728",
"0.7220079",
"0.7197006",
"0.7191742",
"0.7152507",
"0.71227264",
"0.71118397",
"0.7097382",
"0.7097382",
"0.7088581",
"0.70704484",
"0.7034412",
"0.7017098"... | 0.0 | -1 |
Calculates the percentage of identity of the total positives of the sequence. | def calculate_percid(
pos_total, length_query, length_subject, length_total, option_pid="mean"
):
if option_pid == "mean":
pid = pos_total / ((length_query + length_subject) / 2.0)
elif option_pid == "subject":
pid = pos_total / length_subject
elif option_pid == "query":
pid = po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percent_identity(align_1, align_2):\n matches = 0\n for i in range(len(align_1)):\n if align_1[i] == align_2[i]:\n matches+= 1\n percent_identity = matches / len(align_1)\n return percent_identity",
"def get_percent_identity(seq1, seq2, count_gaps=False):\n\n # Make sure the ... | [
"0.65390223",
"0.6515089",
"0.63775533",
"0.6201187",
"0.615566",
"0.6150113",
"0.61199296",
"0.6119925",
"0.60783774",
"0.6054726",
"0.60261333",
"0.6025453",
"0.59780717",
"0.5976818",
"0.59649134",
"0.5948958",
"0.5903477",
"0.5860782",
"0.58463955",
"0.5841654",
"0.582455... | 0.0 | -1 |
Returns the set of `.Character`\s that have `value` for this feature. | def get_value_characters (self, value):
return self.binary_features_model.get_feature_value_characters(
self, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_values(self, value):\n return [\n obj for obj in self if obj == value\n ]",
"def by_label_contains(self, value: str) -> RegistryType:\n return {k: v for k, v in self.items() if value in k}",
"def might_contain(self, value):\n h = self.hash_value(value)\n re... | [
"0.5890968",
"0.5688868",
"0.5527459",
"0.5504594",
"0.54946214",
"0.5487836",
"0.5477165",
"0.5427281",
"0.5349244",
"0.5341464",
"0.53099036",
"0.5278726",
"0.5217075",
"0.516564",
"0.5146724",
"0.51349",
"0.51041853",
"0.50752044",
"0.50656664",
"0.5048949",
"0.5046607",
... | 0.6952912 | 0 |
Returns the name of this feature. | def name (self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n name = self.function_name\n\n # Feature type is based on additional data that used\n # for example if insight is for Healthsites Facilities\n # than feature type is Healthsites Facilities\n\n if self.feature_type:\n name = '%s for %s' % (name, self.fe... | [
"0.8163839",
"0.8099396",
"0.8087407",
"0.80335754",
"0.80335754",
"0.8014481",
"0.8000538",
"0.7997496",
"0.7997496",
"0.7997496",
"0.7986719",
"0.7942612",
"0.7941901",
"0.7937916",
"0.7937916",
"0.7937916",
"0.7930768",
"0.7928762",
"0.7927503",
"0.7927503",
"0.7927503",
... | 0.0 | -1 |
Sets the name of this feature. Raises `.InvalidFeatureError` if a `.Feature` with `name` already exists. | def name (self, name):
if name == self.name:
return
if (self.binary_features_model, name) in Feature._cache:
raise InvalidFeatureError('A feature with that name already exists')
Feature._cache[(self.binary_features_model, name)] = self
del Feature._cache[(self.bin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name: str):\n self._name = name",
"def set_name(self, name):\n assert isinstance(name, str), 'Name must be string'\n self._name = name",
"def SetName(self, name):\n self.name = name",
"def set_name(self, name):\n self._name = name",
"def set_name(self, ... | [
"0.71547073",
"0.7124311",
"0.71228874",
"0.7100316",
"0.7080733",
"0.7080733",
"0.69512314",
"0.69512314",
"0.69512314",
"0.69512314",
"0.69512314",
"0.6949462",
"0.6898298",
"0.6898298",
"0.6895141",
"0.6895141",
"0.6895141",
"0.6895141",
"0.68934083",
"0.68934083",
"0.6859... | 0.73817676 | 0 |
Mean squared error loss between tensors. | def _mse_loss(reference: tf.Tensor, estimate: tf.Tensor) -> tf.Tensor:
return tf.reduce_mean(tf.square(reference - estimate), axis=-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mse_loss(self, x, y):\n loss = tf.reduce_mean(tf.square(x - y))\n return loss",
"def mean_squared_error(self):\n print('Mean squared error regression loss: ' + str(mean_squared_error(self.model.dataset.get_y_test(),\n ... | [
"0.7225804",
"0.7004067",
"0.69485277",
"0.6944287",
"0.6882972",
"0.6753286",
"0.6753286",
"0.6722914",
"0.67028606",
"0.6654901",
"0.66345024",
"0.66239566",
"0.6554793",
"0.6505661",
"0.64975107",
"0.646438",
"0.6446355",
"0.64342386",
"0.64339024",
"0.6426225",
"0.6424997... | 0.6628873 | 11 |
Returns a window tensor of length block_samples. | def get_window(wintype: str, block_samples: int) -> tf.Tensor:
if wintype == 'vorbis':
window = tf.signal.vorbis_window(block_samples, dtype=tf.float32)
elif wintype == 'kaiser-bessel-derived':
window = tf.signal.kaiser_bessel_derived_window(block_samples,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def window_blocks(large_array, window_size):\n y_size = large_array.shape[0]/window_size\n blocks_array = large_array.reshape(y_size, window_size)\n return blocks_array",
"def _sample_window(n, startwindow, stopwindow, window=\"hann\"):\n swindow = np.ones(n)\n\n if startwindow is not None:\n ... | [
"0.59750587",
"0.57199824",
"0.5640767",
"0.5506828",
"0.5499058",
"0.5434761",
"0.54266846",
"0.5417098",
"0.54167485",
"0.5407174",
"0.5351567",
"0.5336577",
"0.5298298",
"0.52684",
"0.52637005",
"0.5256342",
"0.52424526",
"0.52358645",
"0.52228546",
"0.521575",
"0.5212628"... | 0.6902383 | 0 |
Returns a list of all configurations. | def list_configurations(MaxResults=None, NextToken=None):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_configurations(ctx):\n config_set = __ensure_configuration_exists(ctx)\n formatter = ConfigSetListFormatter.build(config_set, format='plain')\n out = formatter.format()\n\n click.echo(out)",
"def antenny_list_configs(self):\n return self.antenny_config.list_configs()",
"def configs(... | [
"0.81496894",
"0.76175296",
"0.7560762",
"0.7486581",
"0.7457627",
"0.7395934",
"0.7383896",
"0.73618954",
"0.72756207",
"0.7179393",
"0.71595",
"0.71187985",
"0.7080655",
"0.707782",
"0.701058",
"0.6980264",
"0.6970693",
"0.6902579",
"0.6885412",
"0.6857631",
"0.6851067",
... | 0.7460839 | 4 |
Updates the specified configuration. | def update_configuration(ConfigurationId=None, Data=None, Description=None):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_config(self, config):\n return self._update_config(\"config\", config)",
"def update(self, config_dict):\r\n self._update(config_dict, allow_new_keys=True)",
"def update(self, config_dict):\n self._update(config_dict, allow_new_keys=True)",
"def update(self, config):\n if not i... | [
"0.8141559",
"0.7549448",
"0.7420452",
"0.73441833",
"0.7247309",
"0.7192998",
"0.7133488",
"0.71058196",
"0.71058196",
"0.7082361",
"0.701444",
"0.69779575",
"0.6977395",
"0.69764256",
"0.696486",
"0.69444394",
"0.6938764",
"0.69255507",
"0.6875318",
"0.68520725",
"0.6830598... | 0.73293966 | 4 |
Gets a list of all possible configuration variables. | def choices() -> List[str]:
return [t.name.upper() for t in ConfigurationVariable] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables(self):\n return []",
"def list_variables(self):\n return list(self._properties.keys())",
"def get_all_variables(self):\n return self.item.get_all_variables()",
"def __get_vars(self):\n if self.resolved_vars:\n return self.resolved_vars\n ret... | [
"0.740127",
"0.7112045",
"0.70103055",
"0.69724935",
"0.68641305",
"0.68588084",
"0.67774206",
"0.67564994",
"0.67217577",
"0.6690859",
"0.6690859",
"0.6690859",
"0.6593279",
"0.65261173",
"0.6487689",
"0.6443123",
"0.6429913",
"0.6395116",
"0.63869435",
"0.6374178",
"0.63390... | 0.6276216 | 24 |
Gets a configuration value. If the variable was not defined, an exception is raised. | def get_value(self, key: Union[str, ConfigurationVariable]) -> Any:
if not key:
raise KeyError(key)
key_str = key.name if isinstance(key, ConfigurationVariable) else key
return self._fetch_value(key_str) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fake_safe_get(self, value):\n try:\n val = getattr(self.configuration, value)\n except AttributeError:\n val = None\n return val",
"def get_config_var(name):\n return get_config_vars().get(name)",
"def config_value(name):\n def get():\n try:\n ... | [
"0.7283182",
"0.7142011",
"0.70885974",
"0.705593",
"0.70391566",
"0.70325804",
"0.7007848",
"0.69628954",
"0.6950451",
"0.694499",
"0.6901913",
"0.6897057",
"0.68651205",
"0.6820106",
"0.67958146",
"0.6787257",
"0.67792886",
"0.6766844",
"0.67599636",
"0.6758628",
"0.6747717... | 0.62023264 | 59 |
Returns a list of categories that do not contain any recipes | def get_empty_categories(session: Session = Depends(generate_session)):
return db.categories.get_empty(session) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_modules_not_in_category(self, category=\"framework\"):\r\n d = ModEntry.select().where((ModEntry.category.is_null(True)) | (ModEntry.category != category))\r\n L.debug(\"There a re %s modules not in category %s\", d.count(), category)\r\n return [get_modentry(x.id, x) for x in d]",
... | [
"0.6808517",
"0.6448826",
"0.6354266",
"0.63300705",
"0.62893087",
"0.62727416",
"0.62042975",
"0.6190728",
"0.6075756",
"0.6016972",
"0.5989042",
"0.5975313",
"0.59666854",
"0.59597105",
"0.59583783",
"0.5939417",
"0.59355664",
"0.59276164",
"0.5898155",
"0.5896381",
"0.5884... | 0.6654499 | 1 |
Returns a list of recipes associated with the provided category. | def get_all_recipes_by_category(
category: str, session: Session = Depends(generate_session), is_user: bool = Depends(is_logged_in)
):
category_obj = db.categories.get(session, category)
category_obj = RecipeCategoryResponse.from_orm(category_obj)
if not is_user:
category_obj.recipes = [x for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recipes(category):\n # if statements to display the recipes base on category name\n if category == \"Pre Workout Meal\":\n recipe = mongo.db.recipes.find({\"category_name\": \"Pre Workout Meal\"})\n elif category == \"Post Workout Meal\":\n recipe = mongo.db.recipes.find({\"category_name... | [
"0.76018226",
"0.69922644",
"0.67220163",
"0.65922475",
"0.6558985",
"0.6557389",
"0.65376204",
"0.653463",
"0.65069",
"0.639185",
"0.6188669",
"0.6144611",
"0.61445194",
"0.61394197",
"0.6134375",
"0.6122007",
"0.6094847",
"0.60712487",
"0.59640574",
"0.59531623",
"0.5946525... | 0.7455978 | 1 |
Uses the PATCH to update a resource for the given scope. Only one operation can be performed in each PATCH call. | def patch(self, id_or_uri, operation, path, value, timeout=-1):
headers = {'Content-Type': 'application/json-patch+json'}
return self._client.patch(id_or_uri, operation, path, value, timeout=timeout, custom_headers=headers) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fusion_api_patch_scope(self, uri, body=None, api=None, headers=None, etag=None):\n return self.scope.patch(uri=uri, body=body, api=api, headers=headers, etag=etag)",
"def partial_update(self, request, pk=None): #partial update a specific object\n return Response({'http_method': 'PATCH'})",
... | [
"0.70250696",
"0.63248914",
"0.63185644",
"0.6283441",
"0.62729067",
"0.62419254",
"0.6233083",
"0.61171335",
"0.60754937",
"0.6051159",
"0.60433984",
"0.6014973",
"0.59888595",
"0.5987367",
"0.59501636",
"0.5913019",
"0.5878041",
"0.5796376",
"0.5739735",
"0.5718846",
"0.571... | 0.0 | -1 |
Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal. | def sort_012(input_list):
if len(input_list) == 0:
return None
_zero = 0
_one = 0
_two = 0
for num in input_list:
if num == 0:
_zero += 1
elif num == 1:
_one += 1
else:
_two += 1
output = []
for i in rang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(array):\n\n for i in range(0, len(array)):\n for j in range(len(array)-1, i, -1):\n if array[j] < array[j-1]:\n ## Move the lighter bubble up\n _temp = array[j]\n array[j] = array[j-1]\n array[j-1] = _temp\n \n ... | [
"0.6790825",
"0.6756854",
"0.6684242",
"0.6669369",
"0.6659245",
"0.66420394",
"0.6598284",
"0.6588693",
"0.65535897",
"0.6550824",
"0.6500933",
"0.6485513",
"0.64646965",
"0.64432114",
"0.6430052",
"0.6428736",
"0.64218473",
"0.6420982",
"0.64177406",
"0.6404819",
"0.6386866... | 0.0 | -1 |
Standardize input data to have zero mean and unit variance along feature dimensions. Similar to scikitlearn.processing.scale(), but returns means and variances in addition to standarized input, and has ddof parameter which affects computation of variances. | def standardize(X, axis=0, ddof=0):
# Modified from scikit-learn.preprocessing.scale()!
#X = np.asarray(X)
X = np.asarray(X, dtype=np.float) # XXX: what about dtype? convert to float64? for higher precision? let client decide?
Xr = np.rollaxis(X, axis) # view on X to enable broadcasting on the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standardize(data):\n stddev = data.std()\n #if stddev == 0.:\n # sys.exit(\"data.std() == 0. !\")\n if stddev != 0.:\n data = (data - data.mean()) / (data.std())\n\n return data",
"def standardize(data):\r\n mean = data.mean(axis=0)\r\n std = data.std(axis=0)\r\n return (da... | [
"0.7115907",
"0.70862305",
"0.70727885",
"0.70645875",
"0.70583",
"0.70100576",
"0.69769627",
"0.69720316",
"0.69720316",
"0.6946827",
"0.682666",
"0.6804854",
"0.6770882",
"0.67705953",
"0.67619914",
"0.6750939",
"0.67126554",
"0.6708978",
"0.66790986",
"0.6639417",
"0.66385... | 0.76980513 | 0 |
Formats the time value in a format suitable for LUUP comms. | def output(self):
if self.after_sunrise:
return "%02d:%02d:%02dR" % self.time
if self.after_sunset:
return "%02d:%02d:%02dT" % self.time
return "%02d:%02d:%02d" % self.time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n ... | [
"0.830306",
"0.8286327",
"0.8100969",
"0.7786937",
"0.7718911",
"0.76446545",
"0.7608089",
"0.7536039",
"0.7455622",
"0.7420675",
"0.7377161",
"0.73537415",
"0.73470724",
"0.7339059",
"0.7318305",
"0.730552",
"0.73000723",
"0.7267157",
"0.72397643",
"0.72223276",
"0.7189066",... | 0.0 | -1 |
Formats the time value in a format suitable for LUUP comms. | def output(self):
return {
"id": self.id,
"name": self.name,
"type": 2,
"enabled": 1,
"days_of_week": self.days,
"time": self.time.output()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n ... | [
"0.830306",
"0.8286327",
"0.8100969",
"0.7786937",
"0.7718911",
"0.76446545",
"0.7608089",
"0.7536039",
"0.7455622",
"0.7420675",
"0.7377161",
"0.73537415",
"0.73470724",
"0.7339059",
"0.7318305",
"0.730552",
"0.73000723",
"0.7267157",
"0.72397643",
"0.72223276",
"0.7189066",... | 0.0 | -1 |
Formats the time value in a format suitable for LUUP comms. | def output(self):
return {
"id": self.id,
"name": self.name,
"type": 3,
"enabled": 1,
"days_of_month": self.days,
"time": self.time.output()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n ... | [
"0.830306",
"0.8286327",
"0.8100969",
"0.7786937",
"0.7718911",
"0.76446545",
"0.7608089",
"0.7536039",
"0.7455622",
"0.7420675",
"0.7377161",
"0.73537415",
"0.73470724",
"0.7339059",
"0.7318305",
"0.730552",
"0.73000723",
"0.7267157",
"0.72397643",
"0.72223276",
"0.7189066",... | 0.0 | -1 |
Formats the timer value in a format suitable for LUUP comms. | def output(self):
time = "%04d-%02d-%02d %02d:%02d:%02d" % (self.year, self.month, \
self.date, self.hours, self.minutes, self.seconds)
return {
"id": self.id,
"name": self.name,
"type": 4,
"enabled": 1,
"abstime": time
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_to_string(value):\n if value == gst.CLOCK_TIME_NONE:\n return \"--:--:--.---\"\n ms = value / gst.MSECOND\n sec = ms / 1000\n ms = ms % 1000\n mins = sec / 60\n sec = sec % 60\n hours = mins / 60\n mins = mins % 60\n return \"%02d:%02d:%02d.%03d\" % (hours, mins, sec, ms)... | [
"0.7057297",
"0.70508975",
"0.6897918",
"0.6799885",
"0.66760427",
"0.66338396",
"0.6560244",
"0.65564954",
"0.6544702",
"0.6493388",
"0.6485683",
"0.6468109",
"0.6445397",
"0.6445397",
"0.64337915",
"0.64230114",
"0.641604",
"0.64019185",
"0.63848585",
"0.63845503",
"0.63766... | 0.0 | -1 |
Formats the time value in a format suitable for LUUP comms. | def output(self):
return {
"device": self.device.id,
"action": "SetModeTarget",
"arguments": [
{
"name": "NewModeTarget",
"value": self.value
}
],
"service": "urn:upnp-org:serv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n ... | [
"0.830306",
"0.8286327",
"0.8100969",
"0.7786937",
"0.7718911",
"0.76446545",
"0.7608089",
"0.7536039",
"0.7455622",
"0.7420675",
"0.7377161",
"0.73537415",
"0.73470724",
"0.7339059",
"0.7318305",
"0.730552",
"0.73000723",
"0.7267157",
"0.72397643",
"0.72223276",
"0.7189066",... | 0.0 | -1 |
Formats the time value in a format suitable for LUUP comms. | def output(self):
acts = []
for i in self.actions:
acts.append(i.output())
return {
"delay": self.delay,
"actions": acts
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n ... | [
"0.830306",
"0.8286327",
"0.8100969",
"0.7786937",
"0.7718911",
"0.76446545",
"0.7608089",
"0.7536039",
"0.7455622",
"0.7420675",
"0.7377161",
"0.73537415",
"0.73470724",
"0.7339059",
"0.7318305",
"0.730552",
"0.73000723",
"0.7267157",
"0.72397643",
"0.72223276",
"0.7189066",... | 0.0 | -1 |
Converts LUUP group value to an Group object. | def parse(vera, s):
aset = Group()
aset.delay = s.get("delay", 0)
if s.has_key("actions"):
for i in s["actions"]:
aset.actions.append(Action.parse(vera, i))
return aset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_group(self, label: str, buf, typedef=None, pos=0, end=None):\n return self._decode_message(label + \".group\", buf, typedef, pos, end, group=True)",
"def parse_group( self, group ):\n return group",
"def createGroup(self):\n return _libsbml.GroupsModelPlugin_createGroup(self)",
... | [
"0.64105105",
"0.62783045",
"0.61443603",
"0.5964704",
"0.5950644",
"0.58804524",
"0.58676463",
"0.57369196",
"0.5734876",
"0.57157207",
"0.56987154",
"0.5675089",
"0.56251466",
"0.5616373",
"0.5611009",
"0.56036973",
"0.5572259",
"0.55713665",
"0.5571279",
"0.5571249",
"0.55... | 0.0 | -1 |
Formats the time value in a format suitable for LUUP comms. | def output(self):
triggers = []
for i in self.triggers:
triggers.append(i.output())
timers = []
for i in self.timers:
timers.append(i.output())
actions = []
for i in self.actions:
actions.append(i.output())
val = {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n ... | [
"0.8302747",
"0.8286827",
"0.8102087",
"0.7787403",
"0.77195966",
"0.76435107",
"0.7608041",
"0.7536261",
"0.74554026",
"0.742164",
"0.7377048",
"0.735342",
"0.7346546",
"0.7339629",
"0.7318111",
"0.73050725",
"0.7300715",
"0.7268844",
"0.7240075",
"0.7223254",
"0.71890646",
... | 0.0 | -1 |
Returns the user_data. Doesn't fetch, this is a local copy. | def get_user_data(self):
return self.user_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetUserData(self):\r\n\r\n return self.user_data",
"def user_data(self):\n return self._user_data",
"def _get_user_data(self):\n return {\"key\": self._key}",
"def user_data(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"user_data\")",
"def get_user_data(... | [
"0.8169714",
"0.8095618",
"0.7632922",
"0.71973425",
"0.7140925",
"0.7117155",
"0.7097041",
"0.6993281",
"0.69420636",
"0.68616825",
"0.6822268",
"0.67933583",
"0.6765997",
"0.6761875",
"0.67468804",
"0.67468804",
"0.67435133",
"0.67283404",
"0.6670426",
"0.6670426",
"0.66704... | 0.8329072 | 1 |
Initialize the battery's attributes. | def __init__(self, battery_size=70):
self.battery_size = battery_size
self._range = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, battery_size=40):\n self.battery_size = battery_size",
"def __init__(self, battery_size=70):\r\n\t\tself.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size =... | [
"0.7382613",
"0.7372676",
"0.73595077",
"0.73595077",
"0.73595077",
"0.7341583",
"0.7341583",
"0.7318316",
"0.7314949",
"0.72837543",
"0.720656",
"0.7195093",
"0.6997041",
"0.6961723",
"0.69487923",
"0.69059587",
"0.69059587",
"0.69059587",
"0.69059587",
"0.69059587",
"0.6905... | 0.72273797 | 10 |
This function generates a dataset for testing. | def __generate_test_config(m,n):
L = np.random.rand(m)
L /= np.sum(L)
S = np.random.rand(m)
S /= np.sum(S)
A0 = np.random.randint(2, size=n)
if(np.sum(A0) == 0):
A0[0] = 1
max_n0 = np.sum(A0)
A1 = np.random.randint(2, size=n)
if(np.sum(A1) == 0):
A1[0] = 1
max_n1 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_dataset(self):\n sets = {\n \"train\": 10,\n \"test\": 5,\n }\n\n fields = {\n \"strings_list\": lambda x: str_to_ascii(self.generate_string_list(x)),\n \"data\": lambda x: np.random.randint(0, 10, (x, 10)),\n \"number\": lamb... | [
"0.79837745",
"0.7818398",
"0.7485943",
"0.7339358",
"0.72963846",
"0.7289017",
"0.7251184",
"0.71550786",
"0.7155024",
"0.71485484",
"0.713878",
"0.70842254",
"0.70625556",
"0.7059079",
"0.7013427",
"0.7010403",
"0.700694",
"0.70036906",
"0.69783914",
"0.69538766",
"0.693573... | 0.0 | -1 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion matrix")
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194862",
"0.80949175",
"0.8029915",
"0.8019153",
"0.79941195",
"0.7991258",
"0.7980955",
"0.7976606",
"0.79610753",
"0.79590565",
"0.79378676",
"0.7934962",
"0.7934504",
"0.79313844",
"0.7926313",
"0.7924577",
"0.79241234",
"0.7923211",
"0.7923023",
"0.7921931",
"0.791787... | 0.78289187 | 77 |
Stacks all tiles to the left (removes 0 tiles in between | def stack(self):
# create temporary matrix
temp_matrix = [[0] * self.TILES_PER_ROW for _ in range(self.TILES_PER_ROW)]
# for each row in actual matrix
for i in range(len(self.main_grid_values)):
empty_spot = 0
# for each value in actual matrix
for j ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_left (grid):\r\n \r\n for row in range (4):\r\n section = []\r\n for col in range (4):\r\n section.append(grid[row][col])\r\n add(section)\r\n for i in range (4):\r\n grid[row][i] = section[i]",
"def push_left (grid):\r\n \r\n for i in range(... | [
"0.658915",
"0.6504933",
"0.65013134",
"0.6491859",
"0.64734244",
"0.64495087",
"0.62187284",
"0.61069673",
"0.60476315",
"0.60431457",
"0.6032471",
"0.59942514",
"0.5932268",
"0.5927403",
"0.58883834",
"0.58675236",
"0.5861471",
"0.5860595",
"0.5842543",
"0.58294946",
"0.578... | 0.5866541 | 16 |
Estimate the traffic_density_value based on the event_level. | def estimate_traffic_density_value(event_level):
if event_level == 1:
traffic_density_value = 0.2
elif event_level == 2:
traffic_density_value = 0.4
elif event_level == 3:
traffic_density_value = 0.6
elif event_level == 4:
traffic_density_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDensityEstimate(self):\n return self.density",
"def edge_density(self) -> float:\n return self.number_of_edges() / (\n self.number_of_nodes() * self.number_of_nodes()\n )",
"def density( self ) :\n return self.__density",
"def density( self ) :\n return self.__density",
"... | [
"0.57345724",
"0.56086147",
"0.5601732",
"0.5601732",
"0.5601732",
"0.5592952",
"0.5555226",
"0.55484194",
"0.54998827",
"0.54952395",
"0.5457937",
"0.54040146",
"0.5395886",
"0.5351017",
"0.53383577",
"0.53267956",
"0.52948207",
"0.5237844",
"0.5216934",
"0.5212698",
"0.5209... | 0.9137478 | 0 |
Builds string representation of this Filter according to given status props | def _status(self,
useheader,
headerstring,
shownose,
showemote
):
# setup initial strings
if useheader:
msg = [menutils.header(headerstring)]
else:
msg = [self._tab + headerstring]
# lean and position check
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return self._status(True, \"Filter Settings\", True, True)",
"def __str__(self):\n status = \"height = {}\\n\".format(self.height)\n status += \"width = {}\\n\".format(self.width)\n status += \"channels = {}\\n\".format(self.channels)\n status += \"architec... | [
"0.64111984",
"0.6269969",
"0.61518097",
"0.6081638",
"0.6052652",
"0.59558564",
"0.59185785",
"0.5865406",
"0.58609235",
"0.5812674",
"0.575836",
"0.57502013",
"0.5701664",
"0.56334794",
"0.561896",
"0.5615521",
"0.5615521",
"0.5615521",
"0.5611125",
"0.56078815",
"0.5597464... | 0.0 | -1 |
Checks if this position is same as other | def __flt_eq_pos(self, other):
if self.position is None:
return True
return (
self.position == other.position
and self.is_lean == other.is_lean
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_same_as(self, other) -> bool:\n return self.x == other.x and self.y == other.y",
"def __eq__(self, other):\n return np.all(self.grid == other.grid) and np.all(self.pos == other.pos)",
"def sameLocation(self, other):\n if not isinstance(other,Point):\n return False\n ... | [
"0.8272488",
"0.77663636",
"0.76447225",
"0.7614881",
"0.75296444",
"0.75296444",
"0.7499151",
"0.7494381",
"0.74886096",
"0.74875194",
"0.7385204",
"0.73789984",
"0.73221517",
"0.7297861",
"0.7261573",
"0.72557604",
"0.7214861",
"0.7179091",
"0.7162696",
"0.71524656",
"0.714... | 0.741624 | 10 |
Checks if this eqyes is same as other | def __flt_eq_eye(self, other):
if self.eyes is None:
return True
return self.eyes == other.eyes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\r\n return self.label == other.label and self.positive_state == other.positive_state",
"def same_as(self, other):\n return super().__eq__(other)",
"def equals(self, other): # -> bool:\n ...",
"def __eq__(self,other):\n return (self - other == 0.)",
"def... | [
"0.72695816",
"0.7240952",
"0.71349186",
"0.712271",
"0.70886564",
"0.70744175",
"0.7070279",
"0.7070279",
"0.7063236",
"0.7007927",
"0.6974256",
"0.69569004",
"0.69407207",
"0.6939727",
"0.69346464",
"0.692419",
"0.69163775",
"0.69163775",
"0.6910529",
"0.6908768",
"0.689498... | 0.7057644 | 9 |
Checks if this eyebrows is same as other | def __flt_eq_eyb(self, other):
if self.eyebrows is None:
return True
return self.eyebrows == other.eyebrows | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_same_as(self, other) -> bool:\n return self.x == other.x and self.y == other.y",
"def equivalent(self, other):\n return id(self) == id(other)",
"def same_as(self, other):\n return super().__eq__(other)",
"def is_equal(self, a, b):\n return a.X[0] == b.X[0]",
"def is_ident... | [
"0.7462955",
"0.7440001",
"0.74314004",
"0.7364724",
"0.7345994",
"0.7310879",
"0.729638",
"0.7276006",
"0.7238774",
"0.7218947",
"0.7211706",
"0.7200641",
"0.71863335",
"0.71863335",
"0.71863335",
"0.7175648",
"0.7164705",
"0.71396947",
"0.7128936",
"0.7128527",
"0.7128527",... | 0.0 | -1 |
Checks if this mouth is same as other | def __flt_eq_mth(self, other):
if self.mouth is None:
return True
return self.mouth == other.mouth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_player(self, other):\n return self.name == other.name \\\n and self.color == other.color",
"def __eq__(self, other):\n for ls, lo in zip(self.leaderboard_names, other.leaderboard_names):\n if ls != lo:\n return False\n for ls, lo in zip(self.lead... | [
"0.7532379",
"0.7131618",
"0.71137446",
"0.706669",
"0.69201463",
"0.6890522",
"0.68844396",
"0.6851405",
"0.6715963",
"0.67021585",
"0.6684793",
"0.6682464",
"0.6668589",
"0.66326725",
"0.66319984",
"0.66313493",
"0.6631014",
"0.6618932",
"0.66138184",
"0.66033596",
"0.66016... | 0.76118165 | 0 |
DO NOT MODIFY THIS FUNCTION. Turns a concatenated string of integers separated by commas into an array of integers. (Inverse of array_to_concatenated_string). | def concatenated_string_to_array(string):
return np.array([int(x) for x in string.split(",")]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_int_list(input_str):\n return [int(part) for part in input_str.split(\",\")]",
"def concatenated_string_to_array(string):\n return np.array([int(x) for x in string.split(\",\")])",
"def strToIntArray(line, delim=\",\"):\n\tarr = line.split(delim)\n\treturn [int(a) for a in arr]",
"def strToLi... | [
"0.7098479",
"0.7086754",
"0.70612913",
"0.7033959",
"0.6964396",
"0.6868449",
"0.681138",
"0.6683693",
"0.6658759",
"0.66382974",
"0.65829784",
"0.65423083",
"0.64676654",
"0.646104",
"0.640258",
"0.63879126",
"0.6272543",
"0.62636197",
"0.6262445",
"0.6212794",
"0.61693317"... | 0.7137505 | 0 |
Gets Lake resource spec. | def GetLakeResourceSpec():
return concepts.ResourceSpec(
'dataplex.projects.locations.lakes',
resource_name='lakes',
projectsId=concepts.DEFAULT_PROJECT_ATTRIBUTE_CONFIG,
locationsId=LocationAttributeConfig(),
lakesId=LakeAttributeConfig()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_spec(self) -> Optional[pulumi.Input['ZoneResourceSpecArgs']]:\n return pulumi.get(self, \"resource_spec\")",
"def resource_spec(self) -> pulumi.Input['ZoneResourceSpecArgs']:\n return pulumi.get(self, \"resource_spec\")",
"def resource_spec(self) -> pulumi.Output['outputs.ZoneResourc... | [
"0.6344094",
"0.63038486",
"0.6272768",
"0.6107871",
"0.61015373",
"0.61015373",
"0.58368295",
"0.5692467",
"0.56837964",
"0.5666892",
"0.5640301",
"0.56166697",
"0.5608287",
"0.55980504",
"0.5566798",
"0.5566798",
"0.5566798",
"0.55617744",
"0.55613405",
"0.55532306",
"0.553... | 0.7039225 | 0 |
Gets Asset resource spec. | def GetAssetResourceSpec():
return concepts.ResourceSpec(
'dataplex.projects.locations.lakes.zones.assets',
resource_name='assets',
projectsId=concepts.DEFAULT_PROJECT_ATTRIBUTE_CONFIG,
locationsId=LocationAttributeConfig(),
lakesId=LakeAttributeConfig(),
zonesId=ZoneAttributeConfi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asset(self):\n\t\treturn self._asset",
"def _get(self) -> json_api.generic.Metadata:\n api_endpoint = ApiEndpoints.assets.fields\n return api_endpoint.perform_request(http=self.auth.http, asset_type=self.parent.ASSET_TYPE)",
"def resource_spec(self) -> pulumi.Output['outputs.ZoneResourceSpec'... | [
"0.6476778",
"0.64248",
"0.6403296",
"0.63654333",
"0.63585794",
"0.62365174",
"0.61875117",
"0.60630274",
"0.60630274",
"0.60616636",
"0.60417134",
"0.6038786",
"0.6005142",
"0.5932051",
"0.59171665",
"0.5909279",
"0.5895812",
"0.58878636",
"0.5885875",
"0.5878514",
"0.58126... | 0.7784672 | 0 |
Adds a resource argument for a Dataplex Lake. | def AddLakeResourceArg(parser, verb, positional=True):
name = 'lake' if positional else '--lake'
return concept_parsers.ConceptParser.ForResource(
name,
GetLakeResourceSpec(),
'The Lake {}'.format(verb),
required=True).AddToParser(parser) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: StudioArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n args: AppArgs,\n opts: Optional[pulumi.... | [
"0.6283504",
"0.6018771",
"0.60154927",
"0.6006599",
"0.59795964",
"0.59432536",
"0.5939319",
"0.591699",
"0.59037113",
"0.59015626",
"0.59015626",
"0.59015626",
"0.58287686",
"0.58016133",
"0.5783999",
"0.57805574",
"0.57735217",
"0.57735217",
"0.57631904",
"0.5750424",
"0.5... | 0.69543314 | 0 |
Adds a resource argument for a Dataplex Zone. | def AddZoneResourceArg(parser, verb, positional=True):
name = 'zone' if positional else '--zone'
return concept_parsers.ConceptParser.ForResource(
name,
GetZoneResourceSpec(),
'The Zone {}'.format(verb),
required=True).AddToParser(parser) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: ZoneArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n args: Optional[ZoneArgs] = None,\n opts: ... | [
"0.69324344",
"0.6784813",
"0.67455554",
"0.62313795",
"0.6043233",
"0.59471524",
"0.58801323",
"0.58437955",
"0.5808192",
"0.5782746",
"0.57183087",
"0.5672343",
"0.5633759",
"0.5629229",
"0.55915713",
"0.55720156",
"0.5571359",
"0.5566925",
"0.55518407",
"0.5539854",
"0.553... | 0.8057603 | 0 |
FNV hash a filename to be used to find it's ID in the manifest | def FNV1Hash(filename):
FNV1_32_INIT = 0x811c9dc5
FNV1_PRIME_32 = 16777619
lowerName = filename.lower()
_hash = FNV1_32_INIT
uint32_max = 2 ** 32
for c in lowerName:
_hash = (_hash * FNV1_PRIME_32) % uint32_max
_hash = _hash ^ ord(c)
return format(_hash, 'x') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_id(username, filename) -> str:\r\n unique_name = username + \"/#/\" + filename\r\n return hashlib.sha224(unique_name.encode(\"utf-8\")).hexdigest()",
"def _HashFilename(filename):\n if isinstance(filename, unicode):\n filename = filename.encode(UTF8)\n else:\n filename = unicod... | [
"0.7470258",
"0.72008824",
"0.71966946",
"0.6936476",
"0.6872454",
"0.686601",
"0.6861185",
"0.6861185",
"0.6846643",
"0.6797219",
"0.6794213",
"0.67499024",
"0.67079115",
"0.6703175",
"0.66876423",
"0.66661847",
"0.6645909",
"0.6633942",
"0.66307604",
"0.66263074",
"0.660669... | 0.75056905 | 0 |
Raise `click.ClickException` for settings file not found. | def _raise_settings_not_found():
result = click.ClickException(
'there is no settings file. Use `pulp-smash settings create` to '
'create one.'
)
result.exit_code = -1
raise result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cli(ctx, root):\n try:\n ctx.obj = create_initial_context(root)\n except SettingsBroken as e:\n click.echo(\n 'Failed to read the settings file: %s' % str(e),\n err=True\n )\n exit(1)",
"def test_no_setting(self):\n with self.assertRaises(Imprope... | [
"0.6399793",
"0.63502395",
"0.61822855",
"0.6178516",
"0.6165805",
"0.60659224",
"0.60520494",
"0.6001203",
"0.5979787",
"0.58991784",
"0.5860672",
"0.58510244",
"0.5824477",
"0.5776361",
"0.5770407",
"0.5736104",
"0.56836015",
"0.56050754",
"0.5603973",
"0.5594075",
"0.55636... | 0.8626588 | 0 |
Given a set of BoxList containing the `labels` field, return a set of BoxList for which `labels > 0`. | def keep_only_positive_boxes(boxes):
assert isinstance(boxes, (list, tuple))
assert isinstance(boxes[0], BoxList)
assert boxes[0].has_field("labels")
positive_boxes = []
positive_inds = []
for boxes_per_image in boxes:
labels = boxes_per_image.get_field("labels")
inds_mask = labe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mask_labels(labels):\n def do_one_row(row):\n erase = False\n for i, _ in enumerate(row):\n if erase:\n row[i] = 0\n else:\n if row[i] == 10:\n erase = True\n row[i] = 1\n return row\n\n ret = np.co... | [
"0.60932386",
"0.58965284",
"0.58630615",
"0.5844093",
"0.58265597",
"0.56753725",
"0.5661014",
"0.5642238",
"0.56337553",
"0.55428267",
"0.55085385",
"0.5502294",
"0.5468191",
"0.54316103",
"0.5421658",
"0.53988284",
"0.5359744",
"0.5350843",
"0.53286016",
"0.53136826",
"0.5... | 0.6557715 | 0 |
This function responds to a request for POST /api/categories/{id} and updates an existing category | def update_one(id, body):
# Get the category requested from the db into session
existed_category = Category.query.filter(Category.id == id).one_or_none()
# TODO try catch unique type
if existed_category is not None:
# turn the passed in category into a db object, IMPORTANT: body.id = null
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(self, id):\n parser = reqparse.RequestParser()\n parser.add_argument('name', location='json', required=False)\n parser.add_argument('details', location='json', required=False)\n args = parser.parse_args()\n\n category = Categories.query.get(id)\n admin = get_jwt_cl... | [
"0.7960862",
"0.76526177",
"0.7405785",
"0.7334255",
"0.73098946",
"0.7018985",
"0.70019513",
"0.69915915",
"0.69138974",
"0.6888584",
"0.6883344",
"0.6834275",
"0.67945135",
"0.6789431",
"0.67796975",
"0.676376",
"0.66204786",
"0.6562276",
"0.65492725",
"0.6525093",
"0.64894... | 0.7004808 | 6 |
Returns HLS channel thresholded binary image | def hls_select(img, thresh=(0, 1), channel=2):
# Convert to HLS color space
img = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)
img = img[:,:, channel]
# Apply a threshold to the saturation channel
binary_output = np.zeros_like(img, dtype='uint8')
binary_output[(img > thresh[0]) & (img <= thresh[1])] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hls_thresh(img, thresh=(100, 255)):\n\thls = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)\n\ts_channel = hls[:,:,2]\n\tbinary_output = np.zeros_like(s_channel)\n\tbinary_output[(s_channel > thresh[0]) & (s_channel <= thresh[1])] = 1\n\treturn binary_output",
"def hls_select(img, thresh=(0, 255)):\n \n # 1) Con... | [
"0.8120919",
"0.73225015",
"0.7048407",
"0.6875629",
"0.68713135",
"0.68606114",
"0.67371464",
"0.66210836",
"0.6606525",
"0.66001385",
"0.65635836",
"0.65600836",
"0.64880157",
"0.6451675",
"0.6443836",
"0.6390359",
"0.63841474",
"0.63765574",
"0.63520026",
"0.634955",
"0.63... | 0.71154135 | 2 |
Sobel directional gradient thresholded binary image | def abs_sobel_thresh(img, orient = 'x', sobel_kernel = 3, thresh = (0, 255)):
# Convert to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
gray = cv2.GaussianBlur(gray, (7, 7), 0)
# Take the gradient in given orientation
if orient == 'x':
sobel = cv2.Sobel(gray, cv2.CV_64F, 1, 0, ks... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dir_threshold(self,sobel_kernel=3, thresh=(0, np.pi/2)): \n\t\t# 1) Convert to grayscale\n\t\tgray = cv2.cvtColor(self.img, cv2.COLOR_RGB2GRAY)\n\t\t# 2) Take the gradient in x and y separately\n\t\tsobelx = cv2.Sobel(gray, cv2.CV_64F, 1, 0, ksize = sobel_kernel)\n\t\tsobely = cv2.Sobel(gray, cv2.CV_64F, 0, 1,... | [
"0.7433044",
"0.74020636",
"0.7391537",
"0.7139834",
"0.7122859",
"0.71148056",
"0.70989805",
"0.70909303",
"0.69601524",
"0.6872311",
"0.68430775",
"0.67360157",
"0.6610729",
"0.6584235",
"0.6545409",
"0.6540358",
"0.6511584",
"0.6435265",
"0.6325449",
"0.62410545",
"0.62364... | 0.66049045 | 13 |
Sobel direction thresholded binary image Define a function that applies Sobel x and y, then computes the direction of the gradient and applies a threshold. | def dir_threshold(img, sobel_kernel = 3, thresh = (0, np.pi / 2)):
# Convert to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
# Take the gradient in x and y separately
sobelx = cv2.Sobel(gray, cv2.CV_64F, 1, 0, ksize = sobel_kernel)
sobely = cv2.Sobel(gray, cv2.CV_64F, 0, 1, ksize = sobel_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dir_threshold(self,sobel_kernel=3, thresh=(0, np.pi/2)): \n\t\t# 1) Convert to grayscale\n\t\tgray = cv2.cvtColor(self.img, cv2.COLOR_RGB2GRAY)\n\t\t# 2) Take the gradient in x and y separately\n\t\tsobelx = cv2.Sobel(gray, cv2.CV_64F, 1, 0, ksize = sobel_kernel)\n\t\tsobely = cv2.Sobel(gray, cv2.CV_64F, 0, 1,... | [
"0.7754886",
"0.7750277",
"0.7674439",
"0.75668216",
"0.7248371",
"0.70974934",
"0.6836462",
"0.6737414",
"0.6712526",
"0.66784084",
"0.65687925",
"0.6506963",
"0.6378256",
"0.62585795",
"0.6250263",
"0.61934227",
"0.60181105",
"0.60126114",
"0.5994576",
"0.5981358",
"0.59706... | 0.7503214 | 4 |
Set SEM to frame size specified by frame_size_selector. | def set_frame_size(self, frame_size_selector):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFrameSize(self, frame_size):\n \n self.frame_size = frame_size",
"def set_frame_size(*args):\n return _ida_frame.set_frame_size(*args)",
"def apply_frame_settings(self, frame_size_selector, pixel_size, dwell_time):\n raise NotImplementedError",
"def set_pixel_size(self, pixel_siz... | [
"0.644009",
"0.63082814",
"0.5972231",
"0.5803603",
"0.56265026",
"0.5586474",
"0.5455755",
"0.54258424",
"0.5414509",
"0.5359248",
"0.5288303",
"0.52389497",
"0.5198493",
"0.51921535",
"0.5184719",
"0.51140684",
"0.5082957",
"0.5035657",
"0.50345194",
"0.50292933",
"0.502907... | 0.7696333 | 0 |
Set Y stigmation parameter (in %). | def set_stig_y(self, target_stig_y):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setY(self, y):\n self.y = y\n pass",
"def set_y(self, y: float):\n self.y = y",
"def setY(self, y):\r\n\t\tself._y=y",
"def SetY(self, y):\r\n\r\n self._y = y",
"def set_y(self, y):\n self._y = y",
"def set_y(self, new_y):\r\n self.y = new_y",
"def Y(self, ... | [
"0.77033234",
"0.7687281",
"0.76164025",
"0.75109446",
"0.73778045",
"0.73550785",
"0.7325942",
"0.7274487",
"0.72567415",
"0.72567415",
"0.7248914",
"0.7227555",
"0.7178724",
"0.71495086",
"0.69311374",
"0.69233173",
"0.692218",
"0.692218",
"0.6917661",
"0.6884505",
"0.68823... | 0.66743505 | 28 |
Read Y stage position (in micrometres) from SEM. | def get_stage_y(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y(self):\n return self._reg2val(MMA7660_Y_ADDR)",
"def xycurves_read_y(self) -> float:\n return float(self.dss_obj.XYCurvesF(ctypes.c_int32(2), ctypes.c_double(0)))",
"def y(self, s):\n return self._y_rasters[s]",
"def findY(self):\n return self.y",
"def y ( self ) :\n ... | [
"0.62444323",
"0.59207594",
"0.58742946",
"0.5865831",
"0.58595407",
"0.5778589",
"0.57625204",
"0.57396144",
"0.57395995",
"0.571952",
"0.57005346",
"0.5683039",
"0.56525946",
"0.56453514",
"0.56392694",
"0.5624726",
"0.5623031",
"0.56142044",
"0.5597574",
"0.55852264",
"0.5... | 0.6468053 | 0 |
r"""The equivalent von Mises stress of the stress tensor. | def vonMises(self):
s = self.voigt
return ((1 / 2) * ((s[0] - s[1])**2
+ (s[1] - s[2])**2
+ (s[2] - s[0])**2
+ 6 * (s[3]**2 + s[4]**2 + s[5]**2))) ** (1 / 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stress_tensor(self):\n s = \"::: forming the Cauchy stress tensor :::\"\n print_text(s, self.color)\n epi = self.strain_rate_tensor(self.U3)\n I = Identity(3)\n\n sigma = 2*self.eta*epi - self.p*I\n return sigma",
"def mV_surf(T):\n A = erf(T**.5)/2**.5\n return A",
"def effecti... | [
"0.63026965",
"0.621516",
"0.59602857",
"0.58621234",
"0.5846458",
"0.58017313",
"0.57350266",
"0.5717649",
"0.5678394",
"0.5677587",
"0.56758827",
"0.567131",
"0.5667499",
"0.56650406",
"0.56198925",
"0.56179166",
"0.5612985",
"0.5609266",
"0.5601824",
"0.55683726",
"0.55656... | 0.6874339 | 0 |
Create `StrainTensor` instance object. | def __new__(cls, strains, units='inch/inch', stype='engineering'):
new = super().__new__(cls, strains, units)
new.__stype = stype
# check dimensions
if new.has_dimension(length / length):
return new
else:
raise TypeError(
"`units` must be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(*args, **kwargs):\n return BinarySharedTensor(*args, **kwargs)",
"def strain_rate_tensor(self):\n U = self.U3\n return 0.5 * (grad(U) + grad(U).T)",
"def tensor(*args, **kwargs):\n return Tensor(*args, **kwargs)",
"def _create_selu(cls, op, op_t):\n node = cls._common_singa_ten... | [
"0.5762378",
"0.5685676",
"0.5597922",
"0.55938536",
"0.55464846",
"0.5477593",
"0.5474433",
"0.5372612",
"0.53288615",
"0.52480525",
"0.5143131",
"0.5105402",
"0.5087074",
"0.5053489",
"0.503757",
"0.5035616",
"0.5013724",
"0.49595508",
"0.49333724",
"0.49260095",
"0.4909906... | 0.45179656 | 75 |
Returns the default collector settings | def get_default_config(self):
config = super(VMSDomsCollector, self).get_default_config()
config.update({
'path': 'vms'
})
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_config(self):\r\n config = super(CMDCollector, self).get_default_config()\r\n config.update({\r\n 'enabled': 'True',\r\n 'fs': ',',\r\n 'timeout': 300,\r\n })\r\n return config",
"def getDefaultSettings():\n return {}",
"def ge... | [
"0.7050511",
"0.7008343",
"0.69491726",
"0.6575027",
"0.6531221",
"0.65213996",
"0.6514668",
"0.64666957",
"0.6446549",
"0.6413717",
"0.63976383",
"0.638016",
"0.6367657",
"0.63565797",
"0.6351409",
"0.6331504",
"0.6311715",
"0.6235863",
"0.623104",
"0.62065274",
"0.6201228",... | 0.67132765 | 3 |
Return a random twoqubit ladder circuit in the form of two MPOs. | def random_two_qubit_gate_ladder_qutip(n_sites):
if n_sites <= 2:
raise ValueError("Must have more than 2 qubits to form a ladder circuit (n_sites={}).".format(n_sites))
layer_1 = random_two_qubit_gate_layer_qutip(n_sites, left=0)
layer_2 = random_two_qubit_gate_layer_qutip(n_sites, left=1)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_problem_2d_chain():\n n = 3\n\n a = list_to_variable_dict(np.ones(n))\n th = list_to_variable_dict(np.zeros(n))\n lim_u = list_to_variable_dict(4 * np.pi / 6 * np.ones(n))\n lim_l = list_to_variable_dict(-4 * np.pi / 6 * np.ones(n))\n params = {\n \"a\": a,\n \"theta\": t... | [
"0.65684927",
"0.617027",
"0.5893483",
"0.58299404",
"0.5754283",
"0.56673276",
"0.5612049",
"0.5587564",
"0.5536792",
"0.5526099",
"0.5504806",
"0.5503199",
"0.5471561",
"0.5454141",
"0.54378676",
"0.5433846",
"0.5360063",
"0.5334182",
"0.533043",
"0.52917546",
"0.52819854",... | 0.6002943 | 2 |
Return a random twoqubit ladder circuit in the form of two MPOs. | def random_two_qubit_gate_ladder(n_sites):
if n_sites <= 2:
raise ValueError("Must have more than 2 qubits to form a ladder circuit (n_sites={}).".format(n_sites))
layer_1 = random_two_qubit_gate_layer(n_sites, left=0)
layer_2 = random_two_qubit_gate_layer(n_sites, left=1)
return layer_1, layer_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_problem_2d_chain():\n n = 3\n\n a = list_to_variable_dict(np.ones(n))\n th = list_to_variable_dict(np.zeros(n))\n lim_u = list_to_variable_dict(4 * np.pi / 6 * np.ones(n))\n lim_l = list_to_variable_dict(-4 * np.pi / 6 * np.ones(n))\n params = {\n \"a\": a,\n \"theta\": t... | [
"0.65689045",
"0.60028154",
"0.58913124",
"0.58287895",
"0.57535493",
"0.56672996",
"0.56114334",
"0.55856556",
"0.55353236",
"0.5525551",
"0.55039227",
"0.55038536",
"0.54712576",
"0.5451976",
"0.5435777",
"0.54336375",
"0.5358143",
"0.53325707",
"0.53301644",
"0.52907723",
... | 0.6170097 | 1 |
Return the superoperator for a depolarising channel. | def depolarising_channel(p):
return qt.kraus_to_super([
np.sqrt(1 - 3.*p/4.) * qt.qeye(2),
np.sqrt(p/4.) * qt.sigmax(),
np.sqrt(p/4.) * qt.sigmay(),
np.sqrt(p/4.) * qt.sigmaz()
]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_detector_integration_operator(self):\n return self.instrument.get_detector_integration_operator()",
"def get_detector_response_operator(self):\n return BlockDiagonalOperator(\n [self.instrument.get_detector_response_operator(self.sampling[b])\n for b in self.block], a... | [
"0.5802397",
"0.54883647",
"0.54648656",
"0.54432774",
"0.54142916",
"0.5380579",
"0.5352711",
"0.5334963",
"0.5281863",
"0.5213507",
"0.5166896",
"0.51423717",
"0.5140613",
"0.50614816",
"0.50526285",
"0.50503814",
"0.5048025",
"0.5045142",
"0.5030909",
"0.5008779",
"0.49789... | 0.55187756 | 1 |
Check if value exists in sdb. If it does, return, otherwise generate a random string and store it. This can be used for storing secrets in a centralized place. | def sdb_get_or_set_hash(
uri,
opts,
length=8,
chars="abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)",
utils=None,
):
if not isinstance(uri, str) or not uri.startswith("sdb://"):
return False
if utils is None:
utils = salt.loader.utils(opts)
ret = sdb_get(uri, opts, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_or_generate(name):\n # TODO(kpy): Use memcache to avoid expensive random number generation.\n value = ''.join('%02x' % random.randrange(256) for i in range(32))\n return Config.get_or_insert(key_name=name, value=value).value",
"def check_secret_key(cls):\n logger.info(\"attemp... | [
"0.62834156",
"0.5699868",
"0.56982523",
"0.5695171",
"0.56184644",
"0.54917884",
"0.5477109",
"0.54618174",
"0.54544103",
"0.53758",
"0.5367238",
"0.53363734",
"0.5330585",
"0.5321428",
"0.53098136",
"0.5305735",
"0.528827",
"0.5264259",
"0.5242812",
"0.5232729",
"0.5188904"... | 0.55998874 | 5 |
When select file button is pressed a dialog of filenames is presented to the user. The selected files are then used when searching for codings If files are selected, then selected cases are cleared. The default is all file IDs. To revert to default after files are selected, the user must press select files button then ... | def selectFiles(self):
filenames = []
self.fileIDs = ""
self.caseIDs = "" # clears any case selections
cur = self.settings['conn'].cursor()
cur.execute("select id, name, status from source")
result = cur.fetchall()
for row in result:
filenames.append(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_files(self):\n options = QFileDialog.Options()\n options |= QFileDialog.DontUseNativeDialog\n files, _ = QFileDialog.getOpenFileNames(self.parent,\n \"File Export\",\n os.path.expanduser('~... | [
"0.7522203",
"0.7286166",
"0.7180548",
"0.7145201",
"0.7129874",
"0.7106964",
"0.70322937",
"0.6931579",
"0.6924414",
"0.69111323",
"0.69007957",
"0.68112266",
"0.6739185",
"0.6712555",
"0.6684609",
"0.6662698",
"0.6649995",
"0.6628709",
"0.662563",
"0.66180706",
"0.6616277",... | 0.80876476 | 0 |
Takes road shape mesh object. returns list of verts in global space | def rs_evaluate_verts(road_shape):
locs = []
for i in [0, 2, 4, 6]:
locs.append(road_shape.matrix_world @ road_shape.data.vertices[i].co)
return locs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_all_vertices(self, ref_frame='WORLD') -> np.ndarray:\n\n\t\tdepsgraph = bpy.context.evaluated_depsgraph_get() # to account for deformations\n\n\t\tif ref_frame not in {'LOCAL', 'WORLD'}:\n\t\t\traise ValueError(f\"Invalid ref_frame: {ref_frame}. Must be one of ['LOCAL', 'WORLD']\")\n\n\t\tverts = []\n\n\... | [
"0.65510815",
"0.6334725",
"0.6297034",
"0.6210977",
"0.6131488",
"0.61265653",
"0.60700357",
"0.6055088",
"0.6006846",
"0.6006846",
"0.6006224",
"0.59914243",
"0.5983983",
"0.5967597",
"0.5950081",
"0.5895438",
"0.5894565",
"0.58800244",
"0.58592534",
"0.5840108",
"0.5816266... | 0.702167 | 0 |
Returns all visitors that have been registered but not seen | def get_current_visitors():
return Visitor.objects.filter(acknowledged=False).order_by("arrival_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_visit(self):\r\n return filter(lambda n: not self.visited(n), self.table.keys())",
"def get_unvisited_nodes(self) -> List[Node]:\n\n db = mysql.connector.connect(\n host=self.db_uri, database=self.db_name, user=self.db_user, password=self.db_pass\n )\n\n cursor = db.... | [
"0.6442964",
"0.6386559",
"0.621115",
"0.6067615",
"0.5901003",
"0.58763206",
"0.58632696",
"0.58006614",
"0.5747568",
"0.56837654",
"0.567758",
"0.5675179",
"0.56230587",
"0.55976754",
"0.5594614",
"0.5592165",
"0.5592165",
"0.5592165",
"0.5592165",
"0.5592165",
"0.5592165",... | 0.57727563 | 8 |
A QuerySet (list on frontend) of the Course objects which are crosslisted with this course (not including this course). | def crosslistings(self):
return self.primary_listing.listing_set.exclude(id=self.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def courses_with_role(self):\r\n return CourseAccessRole.objects.filter(role=self.role, user=self.user)",
"def satisfying_courses(self):\n return (\n Course.objects.all()\n .exclude(id__in=self.overrides.all())\n .filter(\n Q(department__in=self.depar... | [
"0.6728154",
"0.6714028",
"0.6621667",
"0.65071315",
"0.6421437",
"0.63046616",
"0.6286539",
"0.6191101",
"0.6110874",
"0.6095246",
"0.6094224",
"0.6093279",
"0.60353184",
"0.6015792",
"0.60097045",
"0.59841174",
"0.59410495",
"0.5847002",
"0.58329654",
"0.5830098",
"0.581904... | 0.6968052 | 0 |
A QuerySet (list on frontend) of all the PreNGSSRequirement objects this course fulfills. Note that a course fulfills a requirement if and only if it is not in the requirement's overrides set (related name nonrequirements_set), and is in the requirement's courses set (related name requirement_set) or its department is ... | def pre_ngss_requirements(self):
return (
PreNGSSRequirement.objects.exclude(id__in=self.pre_ngss_nonrequirement_set.all())
.filter(semester=self.semester)
.filter(
Q(id__in=self.pre_ngss_requirement_set.all())
| Q(id__in=self.department.pre_ng... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_prerequirements(requirements: List[Req]) -> Prereqs:\n all_steps = {step for req in requirements for step in req}\n \n # initialize\n prereqs = {step: set() for step in all_steps}\n\n # add actual requirements\n for pre, post in requirements:\n prereqs[post].add(pre)\n \n ret... | [
"0.65657735",
"0.65197456",
"0.6250825",
"0.6239728",
"0.61949897",
"0.6155034",
"0.61228627",
"0.6076228",
"0.60494286",
"0.5859076",
"0.5847443",
"0.57035714",
"0.56132984",
"0.558871",
"0.55577815",
"0.5555229",
"0.55495256",
"0.54970825",
"0.5487136",
"0.5446815",
"0.5441... | 0.78029996 | 0 |
True if permission is required from the department for registration, false otherwise. | def permit_required(self):
return "permission" in self.description.lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_permission(self, request, view):\n return request.user.group != 'patient'",
"def has_permission(self):\n\n org_id = self.kwargs.get(\"pk1\", False)\n # i'm checking the org_id is truthy here since some org user views don't\n # have `/org/pk1/` for example the initial publish l... | [
"0.67300475",
"0.6655574",
"0.65506923",
"0.6515449",
"0.6492487",
"0.64640814",
"0.6453731",
"0.64535713",
"0.6445859",
"0.6445859",
"0.6445859",
"0.6371776",
"0.6353381",
"0.63396174",
"0.6338675",
"0.6324837",
"0.62998104",
"0.6281281",
"0.6281281",
"0.6276974",
"0.6248508... | 0.6805399 | 0 |
Returns the last StatusUpdate object for this section, or None if no status updates have occured for this section yet. | def last_status_update(self):
try:
return StatusUpdate.objects.filter(section=self).latest("created_at")
except StatusUpdate.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_update(self) -> Optional['outputs.CSIVXFlexOSStatusLastUpdate']:\n return pulumi.get(self, \"last_update\")",
"def last_update(cls):\n\n score = Score.query.with_entities(Score.updated_on).order_by(desc(Score.updated_on)).first()\n if score:\n return score[0]\n els... | [
"0.68608874",
"0.67597",
"0.6646863",
"0.66452193",
"0.6610159",
"0.6586678",
"0.64550143",
"0.64273673",
"0.6382295",
"0.6257615",
"0.6067049",
"0.5996363",
"0.5996363",
"0.5985811",
"0.59653395",
"0.59528345",
"0.58898485",
"0.58679897",
"0.58635503",
"0.58495295",
"0.58457... | 0.8278528 | 0 |
A QuerySet (list on frontend) of all Course objects which satisfy this requirement; in other words, a course satisfies this requirement if and only if it is in this set. A course is in this set if and only if it is not in the overrides set, and it is either in the courses set or its department is in the departments set... | def satisfying_courses(self):
return (
Course.objects.all()
.exclude(id__in=self.overrides.all())
.filter(
Q(department__in=self.departments.all(), semester=self.semester)
| Q(id__in=self.courses.all())
)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_courses(self):\r\n\r\n return self.def_ms.get_courses()",
"def get_all_allowed_enrollments(self):\n if self.is_superuser:\n return Enrollment.objects.all()\n\n # Enrollments belonging to students the user manages\n manages = Q(student__case_manager=self)\n # ... | [
"0.54506207",
"0.54416525",
"0.54084677",
"0.5347712",
"0.5326133",
"0.529219",
"0.5261276",
"0.52394545",
"0.5212234",
"0.5200809",
"0.5189396",
"0.51864004",
"0.51634246",
"0.5120046",
"0.50903416",
"0.5048085",
"0.50080127",
"0.5007544",
"0.500172",
"0.49911886",
"0.499118... | 0.801339 | 0 |
Validator to check that a phone number is in the proper form. The number must be in a form which is parseable by the | def validate_phone(value):
if value.strip() == "":
return
try:
phonenumbers.parse(value, "US")
except phonenumbers.phonenumberutil.NumberParseException:
raise ValidationError("Enter a valid phone number.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_phone_number(value):\n\n try:\n z = phonenumbers.parse(value, None)\n except phonenumbers.NumberParseException:\n raise forms.ValidationError(\"Enter a valid phone number.\")\n\n if not phonenumbers.is_valid_number(z):\n raise forms.ValidationError(\"Enter a valid phone n... | [
"0.8465023",
"0.82467127",
"0.80120647",
"0.79973745",
"0.78578955",
"0.77385324",
"0.77174115",
"0.76849085",
"0.75791246",
"0.75637096",
"0.75398934",
"0.75086373",
"0.75041157",
"0.74982065",
"0.73511785",
"0.7346509",
"0.72754884",
"0.72742647",
"0.7273203",
"0.72612786",
... | 0.82337385 | 2 |
Enable team management in this server. | async def admin_enable(self, ctx: commands.Context):
if ctx.guild.id in self.guilds:
await ctx.send('Team management is already enabled in this guild.')
return
await self._enable_guild(guild=ctx.guild)
await ctx.send('Team management enabled.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def admin_disable(self, ctx: commands.Context):\n if ctx.guild.id not in self.guilds:\n await ctx.send('Team management is already disabled in this guild.')\n return\n await self._disable_guild(guild=ctx.guild)\n await ctx.send('Team management disabled.')",
"def test_add_team_manager_to... | [
"0.6525538",
"0.6448005",
"0.6207515",
"0.6038968",
"0.60138315",
"0.59763694",
"0.5774415",
"0.56903124",
"0.56903124",
"0.56903124",
"0.56903124",
"0.55746585",
"0.55334055",
"0.55019486",
"0.5432621",
"0.5403025",
"0.54026604",
"0.5400243",
"0.53799796",
"0.53538686",
"0.5... | 0.7834238 | 0 |
Load a yaml file located at 'path' and return the content as a dictionary. If the yaml file does not exist an empty dictionary will be returned. | def load_yaml(path):
if os.path.exists(path):
f = open(path)
data = yaml.load(f)
f.close()
return data
else:
# This should maybe throw an exception or something
return {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(path):\n if os.path.exists(path):\n f = open(path)\n data = yaml.load(f)\n f.close()\n return data\n else:\n return {}",
"def load_yaml(path: str) -> dict:\n with open(path, 'r') as f:\n yaml_file = yaml.load(f, Loader=yaml.FullLoader)\n return ... | [
"0.8915657",
"0.882651",
"0.8767586",
"0.86684346",
"0.85486746",
"0.8146139",
"0.8006426",
"0.7931592",
"0.7920281",
"0.78656274",
"0.78147167",
"0.7727598",
"0.772376",
"0.7703141",
"0.7632216",
"0.76269853",
"0.7573534",
"0.75541437",
"0.75241333",
"0.75060207",
"0.7403873... | 0.86826485 | 3 |
Load an environment aware yaml configuration file into a dictionary. If a configuration depends on the target of the deployment it is possible to pass the name of the environment to this function (env). In such a case | def load_yaml_config(path, env = ''):
config = load_yaml(path)
if config:
if 'all' in config:
all = config['all']
else:
return {}
if env != '':
if env in config:
all.update(config[env])
return all
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_env():\n global api_key\n\n # Load the config file\n env_file = path.join(path.dirname(path.abspath(__file__)), 'env.yml')\n try:\n stream = open(env_file, 'r')\n y = yaml.safe_load(stream)\n except IOError:\n print(\"ERROR: Environment file {} not found\".format(env_fi... | [
"0.73397475",
"0.724708",
"0.7114326",
"0.6869409",
"0.6824845",
"0.6765012",
"0.66690683",
"0.6633101",
"0.66101325",
"0.6602983",
"0.66008955",
"0.65983796",
"0.6538155",
"0.6531328",
"0.6526037",
"0.64967567",
"0.6493746",
"0.6463301",
"0.6429241",
"0.642644",
"0.64079624"... | 0.72177577 | 2 |
Convenience function to apply parametric rectify to a given layer's output. Will set the layer's nonlinearity to identity if there is one and will apply the parametric rectifier instead. | def prelu(layer, **kwargs):
nonlinearity = getattr(layer, 'nonlinearity', None)
if nonlinearity is not None:
layer.nonlinearity = nonlinearities.identity
return ParametricRectifierLayer(layer, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rrelu(layer, **kwargs):\n nonlinearity = getattr(layer, 'nonlinearity', None)\n if nonlinearity is not None:\n layer.nonlinearity = nonlinearities.identity\n return RandomizedRectifierLayer(layer, **kwargs)",
"def draw(self, layer: Layer) -> None:\r\n if layer and layer.layer_index >= ... | [
"0.52134",
"0.49756256",
"0.48148406",
"0.48042098",
"0.4692173",
"0.4687671",
"0.4650861",
"0.45507547",
"0.454745",
"0.45252416",
"0.44434115",
"0.4381154",
"0.43678042",
"0.43678042",
"0.43648186",
"0.43609592",
"0.43596599",
"0.434965",
"0.43344998",
"0.43342414",
"0.4328... | 0.6670499 | 0 |
Get MAC of STA iface | def get_mac(self) -> str:
self.sendline("iw {} info".format(self.iface_dut))
# We are looking for MAC definition of STA
# wdev 0x1
# addr 96:4e:c9:cc:7a:2c
# type managed
self.expect("addr (?P<mac>..:..:..:..:..:..)\r\n\t(type|ssid)")
return self.match.group('mac'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMac(self):\n # Import netifaces here to prevent error importing this module in setup.py\n import netifaces\n interfaces = ['eth0', 'wlan0']\n try:\n interfaces.append(netifaces.gateways()['default'][netifaces.AF_INET][1])\n except:\n pass\n for... | [
"0.80129766",
"0.79265904",
"0.74136776",
"0.73187107",
"0.7257851",
"0.7190333",
"0.71811783",
"0.71526283",
"0.71414393",
"0.71414393",
"0.70488745",
"0.7038794",
"0.70227486",
"0.70227486",
"0.6977995",
"0.69032127",
"0.6897833",
"0.68003696",
"0.6776057",
"0.67335254",
"0... | 0.8607074 | 0 |
Return location estimate as Pandas DataFrame. | def as_DF(self):
hc_df = pd.DataFrame(self.s, index=self.s_names)
hc_df.columns.name = 'type'
hc_df.index.name = 's'
return hc_df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_df(self):\n return pd.DataFrame(self.points)",
"def create_demo_location_history() -> geopandas.GeoDataFrame:\n np.random.seed(123)\n\n time = pd.date_range(start=datetime.fromtimestamp(1624241116), end=datetime.now(), freq=\"1min\").values\n\n center_point = (-36.875990410695394, 174.763... | [
"0.6573011",
"0.65202236",
"0.6124628",
"0.6085926",
"0.60649395",
"0.6012716",
"0.5984655",
"0.596708",
"0.5949491",
"0.5924197",
"0.5868256",
"0.585691",
"0.5854988",
"0.58433855",
"0.58325243",
"0.57697463",
"0.57554924",
"0.57476753",
"0.573561",
"0.5725807",
"0.571275",
... | 0.0 | -1 |
Return position estimate as Pandas DataFrame. | def as_DF(self):
gs_df = pd.DataFrame(self.P, columns=self.xvec, index=self.yvec)
gs_df.columns.name = 'x'
gs_df.index.name = 'y'
return gs_df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_df(self):\n return pd.DataFrame(self.points)",
"def test_pmt_pos_nt():\r\n pandas.DataFrame(straxen.pmt_positions(False))",
"def test_pmt_pos_1t():\r\n pandas.DataFrame(straxen.pmt_positions(True))",
"def reach_points_as_dataframe(self) -> pd.DataFrame:\n df_pt = pd.DataFrame([pt.... | [
"0.6984047",
"0.6672237",
"0.65964663",
"0.6274763",
"0.6267464",
"0.6238453",
"0.6057081",
"0.60310453",
"0.5990171",
"0.5941943",
"0.59085494",
"0.5869681",
"0.5850982",
"0.58254164",
"0.58222926",
"0.5817974",
"0.58097893",
"0.5791353",
"0.5778901",
"0.57716084",
"0.573542... | 0.6172669 | 6 |
Return discounted value of r from i steps away. | def get_discounted_r(self, r, i):
return self.gamma**i * r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discount(self, r, done, s):\n discounted_r, cumul_r = np.zeros_like(r), 0\n for t in reversed(range(0, len(r))):\n cumul_r = r[t] + cumul_r * self.gamma\n discounted_r[t] = cumul_r\n return discounted_r",
"def discount_rewards(r):\r\n discounted_r = np.zeros_like... | [
"0.7262249",
"0.7245121",
"0.71241426",
"0.7104458",
"0.7074022",
"0.7056644",
"0.7050547",
"0.7033863",
"0.69333416",
"0.69234216",
"0.67071486",
"0.66693866",
"0.66520005",
"0.6651897",
"0.66337484",
"0.6615558",
"0.6549958",
"0.65360075",
"0.65175",
"0.65175",
"0.6503656",... | 0.7935221 | 0 |
Sample an action from actionvalue PD at given state estimate s. | def habit_action(self, s, U):
q_vals = self.action_values(s)
# u = U[q_vals.argmax()] # could just select maximum with this
p_u = utils.softmax(q_vals, self.tau)
u = np.random.choice(U, p=p_u)
return u | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample(self, state):\n dist = self.action_distribution(state)\n raw_action = dist.rsample() # reparametrization trick\n\n # enforcing action bounds\n tanh_action = torch.tanh(raw_action) # prevent recomputation later.\n action = tanh_action * self.action_scale + self.action... | [
"0.74562204",
"0.7402805",
"0.731101",
"0.7184198",
"0.71417177",
"0.71379983",
"0.71202266",
"0.7069236",
"0.7061565",
"0.70416117",
"0.69302785",
"0.68354154",
"0.6808989",
"0.67309713",
"0.67212164",
"0.67040527",
"0.66987514",
"0.66881603",
"0.6673124",
"0.66585416",
"0.6... | 0.5966925 | 100 |
Return reward expectations as Pandas DataFrame. | def as_DF(self, s_names, u_names):
return pd.DataFrame(self.Q, index=u_names, columns=s_names) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expected_df():\n return pd.DataFrame(\n {\n \"growth\": [0.873922, 0.814298, 0.0],\n \"gene\": [\"b2935\", \"b0723\", \"b0451\"],\n \"status\": [\"optimal\", \"optimal\", \"optimal\"],\n }\n )",
"def to_df(self) -> pd.DataFrame:\n data = []\n ... | [
"0.69180316",
"0.62610114",
"0.6097818",
"0.6051681",
"0.5990983",
"0.5990983",
"0.5990983",
"0.5990983",
"0.5990983",
"0.59867096",
"0.5964313",
"0.59531885",
"0.5869568",
"0.5862875",
"0.58611727",
"0.5839496",
"0.5834608",
"0.5831896",
"0.58125675",
"0.5805539",
"0.5796367... | 0.0 | -1 |
Creates a onerow matrix from a 1dimensional vector. | def matFromVec(vec):
return matCopy([vec]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_matrix_vector(matrix, vector):\n nin, nout = matrix.shape\n t = np.zeros((nin + 1, nout + 1), matrix.dtype)\n t[0:nin, 0:nout] = matrix\n t[nin, nout] = 1.\n t[0:nin, nout] = vector\n return t",
"def degree_vector_to_matrix(vector):\n return np.diag(vector)",
"def from_vector_to_... | [
"0.7024122",
"0.69289327",
"0.682338",
"0.6816746",
"0.66888577",
"0.6635227",
"0.65571386",
"0.6460049",
"0.63051444",
"0.6217509",
"0.61792284",
"0.6169112",
"0.61245954",
"0.60745007",
"0.6073748",
"0.6070568",
"0.60367274",
"0.60358083",
"0.6014249",
"0.6012171",
"0.59711... | 0.6146151 | 12 |
Creates a diagonal matrix from a 1dimensional vector. | def matDiag(vec):
ret=matZeros((len(vec),len(vec)))
for i in range(len(vec)):
matSet(ret,i,i,vec[i])
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_vector_to_diagonal_matrix(vector):\n num_columns = gs.shape(vector)[-1]\n identity = gs.eye(num_columns)\n identity = gs.cast(identity, vector.dtype)\n diagonals = gs.einsum('...i,ij->...ij', vector, identity)\n return diagonals",
"def putDiagonal(self, vector):\n if type(vector) i... | [
"0.87564635",
"0.80113494",
"0.7831122",
"0.6801142",
"0.676436",
"0.6751105",
"0.6699491",
"0.66378134",
"0.6580752",
"0.6462667",
"0.64605",
"0.6394687",
"0.6380027",
"0.6331664",
"0.6331436",
"0.6303248",
"0.6250806",
"0.62469774",
"0.62246674",
"0.62108475",
"0.61493284",... | 0.77196306 | 3 |
Creates a 0filled matrix of the given height and width, in that order. | def matZeros(shape):
return [[0 for y in range(shape[1])] \
for x in range(shape[0])] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeroes(height, width):\n g = [[0.0 for _ in range(width)] for __ in range(height)]\n return Matrix(g)",
"def zeroes(height, width):\n g = [[0.0 for _ in range(width)] for __ in range(height)]\n return Matrix(g)",
"def zeroMatrix(width, height):\n returnvalue = Matrix()\n for i in ... | [
"0.867037",
"0.86283284",
"0.8307162",
"0.6982549",
"0.69613975",
"0.69407684",
"0.6922779",
"0.6922779",
"0.68814385",
"0.6792176",
"0.67342633",
"0.65986866",
"0.65751123",
"0.65580314",
"0.6508141",
"0.64947295",
"0.648471",
"0.6480173",
"0.64299357",
"0.64299357",
"0.6404... | 0.6677387 | 11 |
Finds the dot product of two number lists of equal size. | def vecDot(a, b):
ret=0.0
for i in range(len(a)):
ret+=a[i]*b[i]
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot_product(a, b):\n dp = 0.0\n for i, j in zip(a, b):\n dp += i * j\n return dp",
"def dotproduct(x, y):\n return sum(imap(operator.mul, x, y))",
"def dotproduct(v1, v2):\n\treturn sum(imap(operator.mul, v1, v2))",
"def dot_product(a, b):\n if len(a) != len(b):\n raise Value... | [
"0.813033",
"0.8037089",
"0.8029752",
"0.8021911",
"0.793196",
"0.79242224",
"0.78488046",
"0.782734",
"0.78164923",
"0.7624061",
"0.76132137",
"0.7601698",
"0.75902164",
"0.75278425",
"0.7526788",
"0.75223345",
"0.7516658",
"0.7412646",
"0.7396712",
"0.7360405",
"0.7359722",... | 0.7476762 | 17 |
CIEDE2000 color difference formula. | def ciede2000(lab1, lab2):
dl=lab2[0]-lab1[0]
hl=lab1[0]+dl*0.5
sqb1=lab1[2]*lab1[2]
sqb2=lab2[2]*lab2[2]
c1=math.sqrt(lab1[1]*lab1[1]+sqb1)
c2=math.sqrt(lab2[1]*lab2[1]+sqb2)
hc7=math.pow((c1+c2)*0.5,7)
trc=math.sqrt(hc7/(hc7+6103515625))
t2=1.5-trc*0.5
ap1=lab1[1]*t2
ap2=la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rgb_ciede2000_color_difference(input: Tensor, target: Tensor, **kwargs) -> Tensor:\n return ciede2000_color_difference(*map(rgb_to_cielab, (input, target)), **kwargs)",
"def delta_e_cie2000(color1, color2, Kl=1, Kc=1, Kh=1):\r\n\r\n color1_vector = _get_lab_color1_vector(color1)\r\n color2_matrix = ... | [
"0.7731565",
"0.7134013",
"0.71129715",
"0.7099679",
"0.7037567",
"0.697382",
"0.68623465",
"0.6710321",
"0.6661201",
"0.6566841",
"0.6383605",
"0.6309896",
"0.62807333",
"0.6124545",
"0.61032057",
"0.6060593",
"0.60499483",
"0.5960436",
"0.5951952",
"0.5935354",
"0.5933458",... | 0.581778 | 25 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.