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 |
|---|---|---|---|---|---|---|
Return a sorted list of dists in this repository. | def dists(self):
return sorted(self.request('')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sorted_snapshots(self) -> list:\n try:\n snapshots = self.opensearch.snapshot.get(repository=self.opensearch_repo_name, snapshot='_all')\n except NotFoundError:\n self.LOGGER.exception('Snapshots not found')\n return []\n return sorted(snapshots['snapsh... | [
"0.6364134",
"0.5983244",
"0.5802773",
"0.5769931",
"0.56961775",
"0.56273186",
"0.56005895",
"0.5599317",
"0.55475336",
"0.5535256",
"0.55140406",
"0.54800045",
"0.5470834",
"0.54468995",
"0.54446924",
"0.54091454",
"0.5393043",
"0.5387074",
"0.5375136",
"0.53282857",
"0.529... | 0.71823305 | 0 |
Return a json representation of the object. | def to_json(self):
# when lazy='dynamic', self.items is no longer a list of items
# it is a query builder that can look into the items table
return {'id': self.id,
'name': self.name,
'items': [item.to_json() for item in self.items.all()]
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asjson(self):\n\n return json.dumps(self._object)",
"def json(self):\n return json.dumps(self.get_dict())",
"def getJSON(self):\r\n \r\n return json.dumps(self.__dict__)",
"def json(self) -> str:\n return _json.dumps(self.__dict__())",
"def get_json(self):\n re... | [
"0.85881746",
"0.85144717",
"0.85010296",
"0.8471798",
"0.8469792",
"0.8467199",
"0.8460206",
"0.8424132",
"0.8397134",
"0.83231527",
"0.83231527",
"0.82983935",
"0.8284798",
"0.8284798",
"0.8282486",
"0.82612973",
"0.82551295",
"0.82551295",
"0.82551295",
"0.82551295",
"0.82... | 0.0 | -1 |
Moves the current position index into the tokens list. | def advance(self):
self.pos += 1
if self.pos >= len(self.tokens):
self.current_token = None # Indicates end of input
else:
self.current_token = self.tokens[self.pos] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance(self):\n self.current = self.tokens.pop(0)",
"def advance(self):\r\n self.__token_counter += 1\r\n self.__current_token = self.__tokens_list[self.__token_counter]",
"def advance(self):\n self.token = next(self.tokenizer)",
"def advance(self):\r\n try:\r\n ... | [
"0.7529755",
"0.7250262",
"0.6917003",
"0.6900764",
"0.6499248",
"0.6309208",
"0.62837327",
"0.621196",
"0.6129539",
"0.6093842",
"0.605819",
"0.60156584",
"0.6009605",
"0.5964253",
"0.5877616",
"0.58744884",
"0.58601576",
"0.58601576",
"0.5833498",
"0.583038",
"0.5745453",
... | 0.7271733 | 1 |
Transforms a search string expression into a django query filter object. | def parse_search(filter_expr, allowed_fields):
if not filter_expr or not filter_expr.strip() or not allowed_fields:
return None
lexer = Lexer(filter_expr)
parser = Parser(lexer, allowed_fields)
data_node = parser.parse()
qf_builder = QueryFilterBuilder(data_node)
return qf_builder.buil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_filter(self, filterexpr):\n sql = []\n params = {}\n i = 0\n for expr in re.split(r\"(?<!\\\\),\", filterexpr):\n parts = [\n s.strip() for s in re.split(r\"(\\s*=\\s*|\\s+like(?i)\\s+)\", expr)\n ]\n if len(parts) != 3:\n ... | [
"0.6250438",
"0.5899883",
"0.5846151",
"0.58043486",
"0.5793258",
"0.5772558",
"0.5729353",
"0.5722138",
"0.5708399",
"0.57039165",
"0.5665315",
"0.5645583",
"0.56355786",
"0.56304073",
"0.5598504",
"0.5589285",
"0.5584287",
"0.55831873",
"0.5576378",
"0.5564929",
"0.5531737"... | 0.6627686 | 0 |
The official representation of the books title, author and status of book | def __repr__(self):
return f'Book: {self.title} ({self.author},{self.status})' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def book_author(self):\n # return f'{self.name} {self.author}'\n return f'{self.name} {self.status}'",
"def __repr__(self):\n tmp = \"=====Book Object=====\\n\"\n tmp += \"title: '{}'\\n\".format(self.title)\n tmp += \"author: '{}'\\n\".format(self.author)\n tmp += \"hig... | [
"0.74267817",
"0.6793802",
"0.6754861",
"0.6654976",
"0.66334295",
"0.6469351",
"0.64489436",
"0.64038557",
"0.6380901",
"0.63792026",
"0.63419574",
"0.6216165",
"0.6179099",
"0.61269486",
"0.6122825",
"0.6118947",
"0.61123055",
"0.61079276",
"0.61068773",
"0.60962856",
"0.60... | 0.78873754 | 0 |
selects SPI channel to disable. Sets the relevant chip select pin to HIGH. | def stop(self,channel):
self.set_cs(channel,1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_channel(self):\r\n self.KCube.CC_DisableChannel(self.serial)",
"def pc_disable_channels(self,channels):#Channels a 4 bit integer\n #Disable any channel that is indicated by a 1 in the 4 bit integer\n for i in range(4):\n if((0B0001 << i) & channels)!= 0:\n ... | [
"0.6656939",
"0.63252366",
"0.62514657",
"0.62203664",
"0.62047476",
"0.6191659",
"0.6129879",
"0.59869295",
"0.5976373",
"0.59670794",
"0.5957715",
"0.5950629",
"0.5947942",
"0.591073",
"0.5853701",
"0.58140737",
"0.5743219",
"0.57403857",
"0.5726284",
"0.56497097",
"0.56307... | 0.52416986 | 64 |
Closes the database again at the end of the request. | def close_db(error):
if hasattr(g, 'sqlite_db'):
g.sqlite_db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _end_db(self):\n database.close()",
"def end_connection(self):\n self.db.close()",
"def close_db(self):\n self.con.close()",
"def _close():\n if _database:\n _database.close()",
"def close(self):\n self.db_connection.close()",
"def close(self):\n self.db.c... | [
"0.84597117",
"0.8063647",
"0.80243427",
"0.799994",
"0.7965991",
"0.7959317",
"0.7959317",
"0.793528",
"0.79080456",
"0.7837638",
"0.78289086",
"0.78139913",
"0.7760883",
"0.77436775",
"0.76676434",
"0.7636659",
"0.75463897",
"0.7546091",
"0.7543379",
"0.75397",
"0.7526698",... | 0.0 | -1 |
Test case for create_workspaces_post | def test_create_workspaces_post(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_workspace(\n client: httpx.Client, name: str\n) -> Response[Union[WorkspaceModel, ErrorMessage, HTTPValidationError]]:\n url = \"/api/workspaces\"\n\n response = client.post(url=url, json={\"name\": name})\n\n if response.status_code == 200:\n response_obj = Response.from_httpx_respon... | [
"0.6533075",
"0.6367479",
"0.63452095",
"0.6128464",
"0.6077742",
"0.6054926",
"0.6047479",
"0.6025091",
"0.6004002",
"0.59906256",
"0.5940144",
"0.59355676",
"0.5900545",
"0.5853676",
"0.58246696",
"0.58078206",
"0.57963216",
"0.5759327",
"0.5742325",
"0.5730885",
"0.5720575... | 0.9287057 | 0 |
Build the VGG 19 Model | def vgg19_simple_api(rgb, reuse):
VGG_MEAN = [103.939, 116.779, 123.68]
with tf.variable_scope("VGG19", reuse=reuse) as vs:
start_time = time.time()
logger.info("build vgg model started")
rgb_scaled = rgb * 255.0
# Convert RGB to BGR
if tf.__version__ <= '0.11':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_vgg_model():\n vgg16 = tf.keras.applications.vgg16.VGG16()\n model = tf.keras.Model(\n inputs=vgg16.inputs, outputs=[layer.output for layer in vgg16.layers if 'conv' in layer.name])\n return model",
"def vgg19(**kwargs):\n model = VGG(make_layers(cfg['E'], batch_norm=True), **kwargs)... | [
"0.8009813",
"0.796908",
"0.7828679",
"0.7809282",
"0.7745107",
"0.75176656",
"0.74975973",
"0.74975973",
"0.74975973",
"0.7480831",
"0.746432",
"0.7452439",
"0.7450316",
"0.7438949",
"0.73900795",
"0.7389471",
"0.7383659",
"0.7352815",
"0.73460376",
"0.7318092",
"0.73149586"... | 0.64203745 | 74 |
GIVEN a Flask application configured for testing WHEN the '/person' page is requested (PUT) with full body THEN check that the response is valid | def test_put_method_succes(test_client):
data = {"city":"Jerusalem"}
response = test_client.put('/person/1', json=data)
assert response.status_code == 200
data = response.json
assert "Contact updated succesfully" in data['message'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_error_400_edit_person(self):\n\n res = self.client().patch('/persons/123412', headers = casting_director_auth_header)\n data = json.loads(res.data)\n\n self.assertEqual(res.status_code, 400)\n self.assertFalse(data['success'])\n self.assertEqual(data[... | [
"0.6584486",
"0.6569538",
"0.6520706",
"0.64523965",
"0.6420635",
"0.6361465",
"0.6332173",
"0.6329564",
"0.62855756",
"0.6257734",
"0.61949867",
"0.612935",
"0.60930866",
"0.6080881",
"0.6074097",
"0.60247004",
"0.60140824",
"0.6013069",
"0.59876907",
"0.5984523",
"0.5982703... | 0.5877301 | 34 |
GIVEN a Flask application configured for testing WHEN the '/person' page is requested (PUT) with id that not exist THEN check that the response is valid | def test_put_method_failer(test_client):
data = {"city":"Jerusalem"}
response = test_client.put('/person/3', json=data)
assert response.status_code == 200
data = response.json
assert "No such contact. Enter id again" in data['message'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_error_404_edit_person(self):\n json_edit_person_with_new_age = {\n 'age' : 30\n } \n res = self.client().patch('/persons/123412', json = json_edit_person_with_new_age, headers = casting_director_auth_header)\n data = json.loads(res.data)\n\n self.assertEqual(r... | [
"0.67732006",
"0.66472363",
"0.64728093",
"0.6453308",
"0.64335734",
"0.6417516",
"0.6398736",
"0.6184848",
"0.61829555",
"0.61626315",
"0.61323816",
"0.611782",
"0.6103255",
"0.6033819",
"0.6025535",
"0.6014339",
"0.6011045",
"0.60021394",
"0.5994888",
"0.5987755",
"0.598459... | 0.6150003 | 10 |
Convert each ascii code in list to its binary value | def ascii_list_to_binary(ascii_list):
for i in range(len(ascii_list)):
ascii_list[i] = ascii_to_binary(ascii_list[i])
return ascii_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ASCIItobinary(inlist):\n outlist = []\n for elem in inlist:\n binelem = format(elem, \"08b\")\n outlist.append(binelem)\n return outlist",
"def to_binary(seqs):\n bin_dict = dict()\n bin_dict[\"A\"] = \"1000\"\n bin_dict[\"C\"] = \"0100\"\n bin_dict[\"G\"] = \"0010\"\n b... | [
"0.77579415",
"0.68571997",
"0.6735094",
"0.6702067",
"0.6680374",
"0.66461813",
"0.6538475",
"0.65318185",
"0.6521526",
"0.63740367",
"0.6370131",
"0.6355684",
"0.63210124",
"0.6319932",
"0.62785035",
"0.62586766",
"0.6198551",
"0.6189577",
"0.6188519",
"0.6188402",
"0.61883... | 0.7877523 | 0 |
Convert and return a list as a single string | def list_to_string(my_list):
return "".join(my_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listToString(self,list):\n stringList = str(list)\n stringList = stringList[1:-1]\n\n return stringList",
"def list_to_string(list):\n return ' '.join(list)",
"def list_to_string(list):\n result = \"\"\n for i in list:\n result += i\n return result",
"def list_to_s... | [
"0.8289423",
"0.8088045",
"0.8072939",
"0.78658843",
"0.78383297",
"0.78248954",
"0.7785099",
"0.7712129",
"0.7702163",
"0.7649348",
"0.76235014",
"0.76125807",
"0.7551479",
"0.7517213",
"0.7511507",
"0.7479474",
"0.74332786",
"0.7429711",
"0.74187475",
"0.73748106",
"0.73211... | 0.81503993 | 1 |
Convert an int to an ascii char | def convert_ascii_to_char(integer):
return chr(integer) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int_to_char(num: int) -> str:\n return chr(num + 97)",
"def UnicodeCharToUTF8(x: int) -> chr:\n return chr(x)",
"def ASCIIToChar(ascii):\n return chr(ascii)",
"def digit_to_char(digit: int) -> str:\n return ALPHABET[digit]",
"def char_to_ascii_code(char):\n return ord(char)",
"... | [
"0.8740396",
"0.7655313",
"0.73916876",
"0.7205126",
"0.70512706",
"0.70410717",
"0.697718",
"0.6893514",
"0.68761337",
"0.6858288",
"0.68575644",
"0.68551207",
"0.68502784",
"0.6838994",
"0.6827926",
"0.67275155",
"0.669782",
"0.6683206",
"0.6607615",
"0.65441847",
"0.649105... | 0.8363322 | 1 |
add enough 0 at left of a string to have string length equal to given length | def add_zero_at_left(my_string, length):
return str(my_string).zfill(length) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propend_zero(string, desired_length):\n\n while len(string) < desired_length:\n string = '0' + string\n return string",
"def add_zero_at_right(my_string, length):\n return my_string.ljust(length, \"0\")",
"def _pad( string, length ):\n\t\n\tdiff = length - len(string)\n\tfor i in range(0,di... | [
"0.8383057",
"0.8172917",
"0.78381824",
"0.7720441",
"0.757742",
"0.7572663",
"0.7572663",
"0.740616",
"0.7334053",
"0.7334053",
"0.71823835",
"0.7161691",
"0.7127795",
"0.70220315",
"0.6931794",
"0.68947303",
"0.6883805",
"0.68052745",
"0.67682165",
"0.6725329",
"0.67074966"... | 0.8781401 | 0 |
Add enough zeros at right side of a string to equal length | def add_zero_at_right(my_string, length):
return my_string.ljust(length, "0") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_zero_at_left(my_string, length):\n return str(my_string).zfill(length)",
"def propend_zero(string, desired_length):\n\n while len(string) < desired_length:\n string = '0' + string\n return string",
"def add_zeros(string):\n updated_string = string + '0'",
"def _prepend_zero(self, v... | [
"0.8629841",
"0.8070033",
"0.7934985",
"0.7853376",
"0.77545327",
"0.7518569",
"0.72765386",
"0.72427654",
"0.72009784",
"0.71125644",
"0.7091968",
"0.70513076",
"0.70437986",
"0.70235324",
"0.6997621",
"0.69901437",
"0.69901437",
"0.6902204",
"0.6880655",
"0.6880655",
"0.677... | 0.8300816 | 1 |
Convert Opcodes to a list of tuples, which is compatible with the opcodes of difflibs SequenceMatcher. This is the equivalent of ``[x for x in opcodes]`` | def as_list(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_opcodes(codeobj):\n import dis\n i = 0\n opcodes = []\n s = codeobj.co_code\n while i < len(s):\n code = ord(s[i])\n opcodes.append(code)\n if code >= dis.HAVE_ARGUMENT:\n i += 3\n else:\n i += 1\n return opcodes",
"def opcodes_to_edit_... | [
"0.6462871",
"0.6241281",
"0.5870459",
"0.58060455",
"0.58001024",
"0.57935834",
"0.5792298",
"0.577102",
"0.5737246",
"0.5646377",
"0.56316876",
"0.54677594",
"0.5459944",
"0.5433738",
"0.53979",
"0.5386008",
"0.53780043",
"0.53451985",
"0.5218206",
"0.515094",
"0.5138814",
... | 0.0 | -1 |
Returns the values of a Gaussian filter centered at b, with standard deviation sigma. | def get_gaussian_filter(b: float, b_list: np.ndarray,
sigma: float) -> np.ndarray:
a = 1/(2*sigma**2)
return np.exp(-a*(b_list-b)**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Gaussian_kernel(sigma=1):\n\n #number of points after 4 stds\n N = int(3*sigma)\n\n #distances\n dx = np.r_[ np.arange(-N,0), np.arange(0,N+1)]\n\n #evaluating the expenontial\n cnst = 1/( np.sqrt(2*np.pi) * sigma)\n\n\n kernel = cnst*np.exp(-dx**2/(2*sigma**2))\n\n return kernel / np.s... | [
"0.66198426",
"0.65832686",
"0.657929",
"0.65479004",
"0.6536781",
"0.6484464",
"0.64478284",
"0.642893",
"0.63540673",
"0.6350312",
"0.63454187",
"0.63254696",
"0.6301724",
"0.628418",
"0.6274874",
"0.62390685",
"0.6236283",
"0.6228122",
"0.62069327",
"0.618917",
"0.6185701"... | 0.808362 | 0 |
Returns none if no user found with the given username else return the user object | def find_user(username):
query = {
User.Fields.USERNAME: username
}
user_dict = DatabaseManager.find(
User.USER_COLLECTION_NAME, query, multiple=False
)
if user_dict:
return User(**user_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(self, username):\n c = self.connection.cursor()\n c.execute('SELECT * FROM Users WHERE username=?', (username,))\n user = c.fetchone()\n if user is not None:\n return User(user)\n\n return None",
"def get_user(cls, username: str) -> Model:\n try:\... | [
"0.8643432",
"0.8503169",
"0.8409542",
"0.8409345",
"0.8340706",
"0.8302213",
"0.8281286",
"0.8264821",
"0.82497746",
"0.8248975",
"0.82366765",
"0.8208221",
"0.8185815",
"0.81754637",
"0.81549406",
"0.81425005",
"0.81425005",
"0.8071525",
"0.80441886",
"0.8023243",
"0.801706... | 0.7800233 | 34 |
Compute sum over columns of R log(R). O(NK) memory. Vectorized. Args | def calcRlogR_numexpr(R):
if R.shape[0] > 1:
return numexpr.evaluate("sum(R*log(R), axis=0)")
else:
# Edge case: numexpr somehow fails if R has shape (1,K)
return calcRlogR_numpy(R) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcRlogR_numpy_vectorized(R):\n H = np.sum(R * np.log(R), axis=0)\n return H",
"def calcRlogR_numpy_forloop(R):\n N = R.shape[0]\n K = R.shape[1]\n H = np.zeros(K)\n for n in range(N):\n for k in range(K):\n H[k] += R[n,k] * np.log(R[n,k])\n return H",
"def logsum(x)... | [
"0.74044675",
"0.66049373",
"0.62426966",
"0.62059224",
"0.61650336",
"0.609651",
"0.60695976",
"0.59759766",
"0.5920558",
"0.59052676",
"0.5892823",
"0.5865039",
"0.5853541",
"0.5853541",
"0.58501714",
"0.5816974",
"0.5811774",
"0.5805117",
"0.57970834",
"0.5795465",
"0.5774... | 0.71167755 | 1 |
Compute sum over columns of R log(R). O(NK) memory. Vectorized. Args | def calcRlogR_numpy_vectorized(R):
H = np.sum(R * np.log(R), axis=0)
return H | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcRlogR_numexpr(R):\n if R.shape[0] > 1:\n return numexpr.evaluate(\"sum(R*log(R), axis=0)\")\n else:\n # Edge case: numexpr somehow fails if R has shape (1,K)\n return calcRlogR_numpy(R)",
"def calcRlogR_numpy_forloop(R):\n N = R.shape[0]\n K = R.shape[1]\n H = np.zeros... | [
"0.711639",
"0.66055155",
"0.62418985",
"0.6206396",
"0.61653095",
"0.6095285",
"0.60689867",
"0.59763604",
"0.5920757",
"0.5904863",
"0.5893755",
"0.58645874",
"0.5853151",
"0.58531046",
"0.58531046",
"0.5818251",
"0.5811622",
"0.5806993",
"0.579792",
"0.57972807",
"0.577397... | 0.7404733 | 0 |
Returns a list of articles for the given word. | def search_questions(word):
search_corpus = get_synonyms(word)[:10]
for item in search_corpus:
print("{} - processing {}/{}".format(word,
search_corpus.index(item) + 1, len(search_corpus)))
full_query = SEARCH_ENDPOINT_URL.format(item)
respo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_word_list_from_article(self):\n word_list = self.article.split(\" \")\n self.word_list = self.keep_only_letters(word_list)",
"def article(word):\n\n import re\n\n for rule in article_rules:\n pattern, article = rule\n if re.search(pattern, word) is not None:\n ... | [
"0.71605414",
"0.6518964",
"0.62828195",
"0.62623763",
"0.62564945",
"0.6253382",
"0.6159756",
"0.61592406",
"0.5977053",
"0.59523237",
"0.59371656",
"0.59272635",
"0.59199136",
"0.58195764",
"0.5819323",
"0.58072335",
"0.57979816",
"0.57869434",
"0.5782607",
"0.57814807",
"0... | 0.0 | -1 |
Returns the current player. | def current_turn(self) -> int:
return self._player | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_player(self):\n return self._current_player",
"def get_current_player(self):\n return self.active_players[0]",
"def current_player(self):\r\n return self.players[self.current_player_id]",
"def getCurrentPlayer(self):\n return self.gameState.getPlayer(self.currentTu... | [
"0.9245915",
"0.89793205",
"0.8955319",
"0.8911761",
"0.8768719",
"0.8768719",
"0.87559545",
"0.874917",
"0.8726008",
"0.8671053",
"0.8643228",
"0.8390637",
"0.83448976",
"0.8290218",
"0.8205605",
"0.8166268",
"0.81155735",
"0.80380714",
"0.80039126",
"0.7981886",
"0.7946152"... | 0.6673146 | 68 |
Constructor of the class, the constructor class the inheritated constructor. | def __init__(self, model, params, data=None, labels=None):
super().__init__(model, np.array(data), np.array(labels))
if not set(self.models.keys()).issubset(set(params.keys())):
missing_params = list(set(self.models.keys()) - set(params.keys()))
raise ValueError("Some estimators are missing parameters: %s" % ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _constructor(self):\n pass",
"def _constructor(self):\n return self.__class__",
"def _constructor(self):\n return self.__class__",
"def __init__(self, *args, **kwargs):\n\n pass",
"def __init__(self, *args, **kwargs):\n pass",
"def __init__(self, *args, **kwargs):\n... | [
"0.7949814",
"0.7563012",
"0.7563012",
"0.7376946",
"0.72568077",
"0.72568077",
"0.72568077",
"0.72568077",
"0.71191245",
"0.7104319",
"0.71009606",
"0.7094136",
"0.70424324",
"0.70424324",
"0.70424324",
"0.70424324",
"0.70424324",
"0.70424324",
"0.70424324",
"0.70424324",
"0... | 0.0 | -1 |
Generate x and y component of n_boids' position or velocity vectors. Return an array with two vectors of length n_boids. | def generate_vectors(self, n_boids:int, lower_limits:np.ndarray, upper_limits:np.ndarray):
range = upper_limits - lower_limits
return (lower_limits[:, np.newaxis] + np.random.rand(2, n_boids) * range[:, np.newaxis]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instantiate_our_boids(self):\n\t\tboids = np.zeros(self.num_boids, dtype=[('position', float, 2)])\n\t\taboids = np.zeros(self.num_aboids, dtype=[('position', float, 2)])\n\t\ttemp_boids = []\n\t\ttemp_aboids = []\n\t\ti = self.num_boids\n\t\twhile i > 0:\n\t\t x = random.randint(self.x_min, self.x_max)\n\t... | [
"0.61721534",
"0.59134454",
"0.58683664",
"0.5842603",
"0.57777333",
"0.5746877",
"0.5723114",
"0.56825614",
"0.567943",
"0.5660509",
"0.5652184",
"0.56122565",
"0.55120564",
"0.5495572",
"0.5439696",
"0.54184175",
"0.53586155",
"0.53331697",
"0.53231907",
"0.53193",
"0.52960... | 0.6398382 | 0 |
When a boid meets a side, change the velocity's respective component's sign | def bounce(self):
self.flock.bounce(x_limits=[self.x, self.right], y_limits=[self.y, self.top]) # bounce off bottom or top
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blade_vel(omega, d):\n u = omega * d / 2\n\n return u",
"def control_velocity(self):\n if self.vel > (cfg.PARTICLE_VELOCITY + 2) and not self.is_travelling and self.will_show_symptoms:\n self.vel = cfg.PARTICLE_VELOCITY",
"def bounce(self, thing):\n xDist = abs(self.rect.cent... | [
"0.6340508",
"0.600403",
"0.59946454",
"0.59639645",
"0.59175825",
"0.58587456",
"0.58471483",
"0.5839654",
"0.58046716",
"0.57755107",
"0.5730521",
"0.57238245",
"0.5677364",
"0.5650587",
"0.56413436",
"0.5623228",
"0.560337",
"0.559992",
"0.5596506",
"0.55809045",
"0.556785... | 0.0 | -1 |
Return response when ticket is not valid (expired, used, wrong credentials). | def forbidden(self, request, *args, **kwargs):
return forbidden_view(request) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cas_callback_with_invalid_ticket(self, client):\n response = client.get('/cas/callback?ticket=is_invalid')\n assert response.status_code == 302\n assert 'casLoginError' in response.location",
"def test_validate_ticket_no_ticket(self):\n self.assertRaises(InvalidRequest,\n ... | [
"0.7077381",
"0.6879075",
"0.67711955",
"0.67477053",
"0.67115104",
"0.67091143",
"0.66983795",
"0.6585767",
"0.65639585",
"0.656254",
"0.6546046",
"0.64952254",
"0.64350116",
"0.6429421",
"0.64156544",
"0.63884944",
"0.63418317",
"0.6328984",
"0.62147385",
"0.6193095",
"0.61... | 0.0 | -1 |
Set source directory to train data | def set_training_data(self):
path_outdir = QFileDialog.getExistingDirectory(self, 'Model Directory', self.path_output_classified,
QFileDialog.DontResolveSymlinks)
if path_outdir:
self.path_classified = self.source_training_data.text()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_data_dir(new_data_dir):\n\n # Ensure we update the global variables.\n global data_dir, train_dir, val_dir\n\n data_dir = new_data_dir\n train_dir = os.path.join(new_data_dir, \"train2017\")\n val_dir = os.path.join(new_data_dir, \"val2017\")",
"def get_dataset_dir(self):\n return super... | [
"0.73992187",
"0.7223071",
"0.7100074",
"0.70586705",
"0.6866643",
"0.67590445",
"0.6468651",
"0.64085996",
"0.63928425",
"0.62625027",
"0.62539816",
"0.6238622",
"0.62346107",
"0.62329304",
"0.62297446",
"0.6203096",
"0.61976475",
"0.6190975",
"0.61681855",
"0.6167979",
"0.6... | 0.7422345 | 0 |
return error with available variations | def _available_variations(self, i):
meta = i['meta']
list_of_variations = sorted(['_'+v for v in list(meta.get('variations',{}.keys()))])
return {'return':1, 'error':'python package variation is not defined in "{}". Available: {}'.format(meta['alias'],' '.join(list_of_variations))} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relevancy_errors(self):\n\n msgs = []\n if self.is_relevant:\n if not self.dataset.is_relevant:\n error = \"dataset not relevant\"\n msgs.append(error)\n if not self.vehicle_count:\n if not self.dataset.vehicle_relevant_count:\n ... | [
"0.6823999",
"0.6568666",
"0.6357992",
"0.6208694",
"0.6195897",
"0.6195897",
"0.6195897",
"0.6195897",
"0.6195897",
"0.6165759",
"0.6033869",
"0.58729875",
"0.5783961",
"0.57529616",
"0.57006246",
"0.5678562",
"0.56683916",
"0.56414443",
"0.5562552",
"0.55596375",
"0.5539494... | 0.6853779 | 0 |
Plot array of images into grid. | def plot_image_array(image_array, ncols=5, size=1, path=False):
nimg = len(image_array)
nrows = int(ceil(nimg/ncols))
fig, axes = plt.subplots(nrows=nrows, ncols=ncols, sharex=True, sharey=True, figsize=(ncols*size,nrows*size))
if nrows == 0:
return
elif ncols == 1:
for r, ax in zip(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_batch(imgs):\n _, axs = plt.subplots(5, 5, figsize=(10, 10))\n axs = axs.flatten()\n for img, ax in zip(imgs, axs):\n ax.axis('off')\n ax.imshow(img, cmap='gray')\n plt.show()",
"def plot_image_grid(images, num_rows, num_cols, save_path=None):\n figure = pyplot.figure()\n ... | [
"0.7679107",
"0.75932735",
"0.73964614",
"0.7349937",
"0.7343825",
"0.72475857",
"0.7244832",
"0.72047144",
"0.7176516",
"0.7142839",
"0.7134367",
"0.7114148",
"0.7111488",
"0.70372534",
"0.7034833",
"0.6962865",
"0.69577414",
"0.6956503",
"0.6933005",
"0.69280356",
"0.688622... | 0.68189204 | 24 |
The coefficient of variation (CV) is defined as sigma / mu | def CV(self):
if self._CV is None:
if self.DOC == 0:
self._CV = np.nan
else:
self._CV = self.STD / self.DOC
return self._CV | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cov_sigma(self):\n D_K = tsa.duplication_matrix(self.neqs)\n D_Kinv = np.linalg.pinv(D_K)\n\n sigxsig = np.kron(self.sigma_u, self.sigma_u)\n return 2 * D_Kinv @ sigxsig @ D_Kinv.T",
"def cov(self):\n\n sigma = np.eye(self.dim)\n for i in range(self.dim):\n ... | [
"0.7309371",
"0.68928933",
"0.6518742",
"0.65179306",
"0.65164286",
"0.64369214",
"0.637987",
"0.6377832",
"0.63074774",
"0.6294234",
"0.6282565",
"0.61874574",
"0.6179084",
"0.615709",
"0.61377025",
"0.6118373",
"0.6086782",
"0.6084654",
"0.60813516",
"0.6064449",
"0.6044669... | 0.6449155 | 5 |
Write CSV file of the dataframe. | def to_csv(self, filename=None, start=None, stop=None, **kwargs):
# Create directory to avoid errno 2
if filename:
directory = os.path.dirname(os.path.realpath(filename))
try:
os.makedirs(directory)
except FileExistsError:
if os.path.is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_csv(self):\n self.query_dataframe.to_csv(self.csv_filename, index=False)",
"def _write_csv_file(self):\n dataframe = self.__get_all_data()\n df = pd.DataFrame(data=dataframe)\n\n # reodering our columns\n df = df[\n [\"id\", \"title\", \"assignee\", \"inven... | [
"0.83169013",
"0.81662977",
"0.80099434",
"0.80060804",
"0.7997509",
"0.79785794",
"0.7952063",
"0.79363966",
"0.7853491",
"0.78478336",
"0.77764726",
"0.7762786",
"0.7711197",
"0.7701078",
"0.76608205",
"0.76277035",
"0.7601563",
"0.7572468",
"0.75335455",
"0.75219023",
"0.7... | 0.0 | -1 |
The ID of the project to create the sink in. If omitted, the project associated with the provider is used. | def project(self) -> pulumi.Output[str]:
return pulumi.get(self, "project") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_project_id(self):\n\n self.params[self.EventParams.PROJECT_ID] = self.config.get_project_id()",
"def project_id(self):\n return generate_project_id(name=self.name, creator=self.creator)",
"def project_id(self):\n raise NotImplementedError()",
"def _get_project_id():\n\n extras = Ba... | [
"0.6575019",
"0.6461057",
"0.6352186",
"0.6348306",
"0.6092305",
"0.6092305",
"0.60450715",
"0.60450715",
"0.60450715",
"0.60450715",
"0.60450715",
"0.60450715",
"0.603206",
"0.603206",
"0.60082376",
"0.60082376",
"0.60082376",
"0.5954827",
"0.5954827",
"0.5954827",
"0.593564... | 0.5223915 | 72 |
The identity associated with this sink. This identity must be granted write access to the configured `destination`. | def writer_identity(self) -> pulumi.Output[str]:
return pulumi.get(self, "writer_identity") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDestinationUid( self ):\n return self.dest_uid",
"def identity(self) -> pulumi.Output[Optional['outputs.ServerIdentity']]:\n return pulumi.get(self, \"identity\")",
"def identity(self):\n return self._identity",
"def identity(self):\n return self._identity",
"def identity... | [
"0.62338537",
"0.6123904",
"0.61005014",
"0.61005014",
"0.5994519",
"0.5960692",
"0.59593827",
"0.5954192",
"0.59510493",
"0.59335804",
"0.5889127",
"0.5886991",
"0.5867579",
"0.5853181",
"0.5811076",
"0.5809523",
"0.57882357",
"0.57882357",
"0.57846135",
"0.57846135",
"0.571... | 0.67694825 | 0 |
Get profile by id | def get_profile_by_id(profile_id):
try:
return models.Profile.objects.get(id=profile_id)
except models.Listing.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile(self, profile_id):\n return self._v1_request('{}/{}'.format(self.PERSON, profile_id), self.HTTP_GET)",
"def get_profile(self, profileId, **kwargs) -> ApiResponse:\n return self._request(fill_query_params(kwargs.pop('path'), profileId), params=kwargs)",
"def get(self, id):\n ... | [
"0.80646354",
"0.7579057",
"0.7427037",
"0.73806304",
"0.7344502",
"0.73159194",
"0.72923046",
"0.7275348",
"0.7259301",
"0.72127247",
"0.7170029",
"0.7160495",
"0.7135726",
"0.7082019",
"0.70792925",
"0.7000702",
"0.69815993",
"0.69015646",
"0.69006985",
"0.6871165",
"0.6808... | 0.8274376 | 0 |
Adds item to the rear of the queue. | def add(self, item):
newNode = Node(item, None)
if self.isEmpty():
self._front = newNode
else:
self._rear.next = newNode
self._rear = newNode
self._size += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue(self, item):\n self._queue.append(item)",
"def add_rear(self, item):\n self.items.append(item)",
"def enqueue(self, item):\n if self.is_full():\n raise IndexError\n self.items[self.rear] = item\n self.rear += 1\n self.rear %= len(self.items)\n ... | [
"0.8235839",
"0.8016984",
"0.7950682",
"0.7945479",
"0.7921612",
"0.7921612",
"0.7895839",
"0.78896725",
"0.78544074",
"0.7816105",
"0.7809661",
"0.77750415",
"0.7757902",
"0.7757902",
"0.7729542",
"0.772027",
"0.76649785",
"0.761995",
"0.76195085",
"0.76015407",
"0.75596565"... | 0.7385864 | 25 |
Removes and returns the item at the front of the queue. | def pop(self):
if self.isEmpty():
raise KeyError("The queue is empty.")
oldItem = self._front.data
self._front = self._front.next
if self._front is None:
self._rear = None
self._size -= 1
return oldItem | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def front(self):\n if self.is_empty():\n return None\n return self.queue[0]",
"def remove_front(self):\n if self.items:\n return self.items.pop(0)\n return None",
"def dequeue(self):\n item = self._queue[0]\n self._queue = self._queue[1:]\n ... | [
"0.81699145",
"0.8098115",
"0.80262893",
"0.799565",
"0.79495174",
"0.79259527",
"0.78870165",
"0.787439",
"0.78542054",
"0.7846039",
"0.7799477",
"0.7787887",
"0.77632433",
"0.7761244",
"0.7757063",
"0.77319723",
"0.7727979",
"0.77227384",
"0.7705304",
"0.770361",
"0.7686234... | 0.7872133 | 8 |
Closes the database again at the end of the request. | def close_db(error):
if hasattr(g, 'sqlite_db'):
g.sqlite_db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _end_db(self):\n database.close()",
"def end_connection(self):\n self.db.close()",
"def close_db(self):\n self.con.close()",
"def _close():\n if _database:\n _database.close()",
"def close(self):\n self.db_connection.close()",
"def close(self):\n self.db.c... | [
"0.8461634",
"0.8065207",
"0.8025285",
"0.8000245",
"0.7967081",
"0.7960311",
"0.7960311",
"0.7935975",
"0.79090637",
"0.7838507",
"0.78297377",
"0.78149796",
"0.77614033",
"0.7744163",
"0.766843",
"0.76375765",
"0.7546959",
"0.7546763",
"0.7544125",
"0.753966",
"0.7527875",
... | 0.0 | -1 |
Generate a neatly formatted full name. | def get_formatted_name(first, last, middle=''):
if middle:
full_name = first + ' ' + middle + ' ' + last
else:
full_name = first + ' ' + last
return full_name.title() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(self):\n first = self.first.capitalize()\n last = self.last.capitalize()\n output = f'{first} {last}'\n return(output)",
"def create_full_name(self):\n return f'{self.first_name} {self.last_name}'",
"def get_formatted_name(first, last):\r\n full_name = f\"{fi... | [
"0.85359615",
"0.8465424",
"0.8277628",
"0.81811726",
"0.81678885",
"0.81621647",
"0.81377685",
"0.81220114",
"0.810649",
"0.80998695",
"0.8091836",
"0.80716896",
"0.80716896",
"0.80633485",
"0.80534726",
"0.8045596",
"0.8042312",
"0.80329484",
"0.80289537",
"0.8027869",
"0.8... | 0.78212637 | 46 |
Set the stiffness of one or more joints. Should be used for any joint except when full body stiffness is needed. | def setStiffness( self, name = None, effort = 1.0 ):
# One second should be enough time for the controller to hook up.
self.stiffnessPublisher = rospy.Publisher( '/joint_stiffness', JointState );
rospy.sleep( rospy.Duration( 1 ) );
self.stiffnessPublisher.publish( JointState( na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_narrow_finger_stiffness(self, stiffness):\n\n self.model.jnt_stiffness[self.hinge_narrow_finger_id] = stiffness",
"def SetStiffness(self, stiffness, manip=None):\n if (isinstance(stiffness, numbers.Number) and\n not (0 <= stiffness and stiffness <= 1)):\n raise Ex... | [
"0.6330976",
"0.6330424",
"0.6208527",
"0.61565125",
"0.60783106",
"0.6034703",
"0.582353",
"0.57978517",
"0.5457218",
"0.542278",
"0.5360302",
"0.5242643",
"0.5088342",
"0.5023263",
"0.5016033",
"0.5003577",
"0.49275747",
"0.49235043",
"0.49151543",
"0.49019775",
"0.49017254... | 0.7290915 | 0 |
Returns the distance between the two nodes. | def distance_callback(from_index, to_index):
# Convert from routing variable Index to distance matrix NodeIndex.
from_node = manager.IndexToNode(from_index)
to_node = manager.IndexToNode(to_index)
return distance_matrix[from_node][to_node] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, a, b):\n\n return networkx.dijkstra_path_length(self._graph, a.post_nid, b.post_nid, 'distance')",
"def distance(self, node_1, node_2):\n x1 = self.map.intersections[node_1][0]\n y1 = self.map.intersections[node_1][1]\n x2 = self.map.intersections[node_2][0]\n y2 = self.map.... | [
"0.79567164",
"0.78979194",
"0.76900876",
"0.75238395",
"0.74698466",
"0.7448442",
"0.7444227",
"0.73453987",
"0.7318005",
"0.7289066",
"0.7259131",
"0.720584",
"0.7184812",
"0.71656555",
"0.7159316",
"0.7145472",
"0.71199346",
"0.7113095",
"0.71123624",
"0.7109324",
"0.70841... | 0.0 | -1 |
Plot one model's loss on one figure | def plot_loss(validation_loss,train_loss,name,display=False):
# create new figure
f2, axs2 = plt.subplots(figsize=(12, 12))
axs2.set_title('Training and validation losses on {}'.format(name))
axs2.set_xlabel('Steps')
axs2.set_ylabel('Loss')
# plot training loss and validation loss
axs2.plot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_loss(model_history):\n plt.plot(model_history.history['loss'])\n plt.title('model loss')\n plt.ylabel('loss')\n plt.xlabel('epoch')\n plt.legend(['train', 'test'], loc='upper left')\n plt.show()",
"def plot_loss(self):\n plt.plot(self.train_loss)\n plt.plot(self.val_loss)... | [
"0.7792669",
"0.7785525",
"0.76865715",
"0.7404636",
"0.737656",
"0.7372639",
"0.7322165",
"0.72670597",
"0.7227357",
"0.72157454",
"0.7190421",
"0.7154668",
"0.7133464",
"0.71312934",
"0.7099973",
"0.7090779",
"0.70643884",
"0.7047984",
"0.70371455",
"0.7031433",
"0.7011735"... | 0.6701662 | 40 |
Plot all training and validation losses on one figure | def plot_all_losses(testing_models, colour, trining_loss):
plt.figure("Training loss")
plt.title('Training loss')
plt.xlabel('Steps')
plt.ylabel('Loss')
# y axis value limitation
plt.ylim([0,4])
plt.plot(trining_loss, colour, label=testing_models)
plt.legend(loc="upper right") # set labe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot(self):\n \n # Plot training & validation accuracy values\n fig, ax = plt.subplots(1, 2)\n ax[0].plot(self.history.history[\"accuracy\"], label=\"Train\")\n ax[0].plot(self.history.history[\"val_accuracy\"], label=\"Test\")\n ax[0].set_title(\"Model accuracy\")\n ... | [
"0.80205494",
"0.79295415",
"0.78396493",
"0.78294474",
"0.7821317",
"0.77336895",
"0.7712563",
"0.76949704",
"0.768724",
"0.7679324",
"0.7663226",
"0.76465875",
"0.7604481",
"0.76006013",
"0.7584859",
"0.75550836",
"0.75550836",
"0.75285584",
"0.75240266",
"0.7511565",
"0.74... | 0.7461139 | 21 |
Create impression Event to be sent to the logging endpoint. | def create_impression_event(self, experiment, variation_id, user_id, attributes):
self.params = {}
self._add_common_params(user_id, attributes)
self._add_impression_goal(experiment)
self._add_experiment(experiment, variation_id)
return Event(self.OFFLINE_API_PATH.format(project_id=self.params[self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_impression_event(self, experiment, variation_id, user_id, attributes):\n\n self.params = {}\n self._add_common_params(user_id, attributes)\n self._add_required_params_for_impression(experiment, variation_id)\n return Event(self.IMPRESSION_ENDPOINT,\n self.params,\n ... | [
"0.72267675",
"0.6491906",
"0.59713316",
"0.59025687",
"0.58714634",
"0.5701278",
"0.56391364",
"0.5634842",
"0.55564296",
"0.55374485",
"0.5528021",
"0.5502537",
"0.54976827",
"0.5481621",
"0.5421002",
"0.53334755",
"0.52296084",
"0.5218639",
"0.5211039",
"0.5205475",
"0.519... | 0.7103576 | 1 |
Create conversion Event to be sent to the logging endpoint. | def create_conversion_event(self, event_key, user_id, attributes, event_value, valid_experiments):
self.params = {}
self._add_common_params(user_id, attributes)
self._add_conversion_goal(event_key, event_value)
self._add_experiment_variation_params(user_id, valid_experiments)
return Event(self.OFFL... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_conversion_event(self, event_key, user_id, attributes, event_value, valid_experiments):\n\n self.params = {}\n self._add_common_params(user_id, attributes)\n self._add_required_params_for_conversion(event_key, user_id, event_value, valid_experiments)\n return Event(self.CONVERSION_ENDPOINT,\... | [
"0.6483912",
"0.64371496",
"0.6145754",
"0.60948193",
"0.5940583",
"0.5823257",
"0.5793404",
"0.5757036",
"0.5735984",
"0.5724619",
"0.57076156",
"0.5652152",
"0.5622759",
"0.5565409",
"0.553207",
"0.55297136",
"0.5495755",
"0.5494328",
"0.54722077",
"0.547099",
"0.5449084",
... | 0.6371079 | 2 |
Create impression Event to be sent to the logging endpoint. | def create_impression_event(self, experiment, variation_id, user_id, attributes):
self.params = {}
self._add_common_params(user_id, attributes)
self._add_required_params_for_impression(experiment, variation_id)
return Event(self.IMPRESSION_ENDPOINT,
self.params,
http_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_impression_event(self, experiment, variation_id, user_id, attributes):\n\n self.params = {}\n self._add_common_params(user_id, attributes)\n self._add_impression_goal(experiment)\n self._add_experiment(experiment, variation_id)\n return Event(self.OFFLINE_API_PATH.format(project_id=self.p... | [
"0.7101875",
"0.6490257",
"0.59718424",
"0.5903417",
"0.5867494",
"0.57041496",
"0.5640005",
"0.56333715",
"0.5556963",
"0.5537515",
"0.55276155",
"0.55057335",
"0.5497833",
"0.54850423",
"0.5420238",
"0.53363454",
"0.5231466",
"0.5214472",
"0.52135974",
"0.5203498",
"0.51951... | 0.7225688 | 0 |
Create conversion Event to be sent to the logging endpoint. | def create_conversion_event(self, event_key, user_id, attributes, event_value, valid_experiments):
self.params = {}
self._add_common_params(user_id, attributes)
self._add_required_params_for_conversion(event_key, user_id, event_value, valid_experiments)
return Event(self.CONVERSION_ENDPOINT,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event(wrapped, instance, args, kwargs, start_time, response,\n exception):\n event = GreengrassPublishEvent(\n wrapped,\n instance,\n args,\n kwargs,\n start_time,\n response,\n exception\n )\n... | [
"0.64379394",
"0.63704854",
"0.6147466",
"0.60960585",
"0.5939261",
"0.58237773",
"0.57953227",
"0.5757407",
"0.57358",
"0.57237506",
"0.57073903",
"0.5653525",
"0.56249243",
"0.5565563",
"0.55327255",
"0.55297714",
"0.5496907",
"0.54941636",
"0.54741544",
"0.54728705",
"0.54... | 0.648307 | 0 |
Constructor for the Flow Runner. | def __init__(self, flow_obj, parent_runner=None, runner_args=None,
_store=None, token=None):
self.token = token or flow_obj.token
self.data_store = _store or data_store.DB
self.parent_runner = parent_runner
# If we have a parent runner, we use its queue manager.
if parent_runner is n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n\n # Component options\n self.components = {}\n\n # Defined pipelines\n self.pipelines = {}\n\n # Current workflow\n self.workflow = []\n\n # Embeddings index params\n self.embeddings = None\n self.documents = None\n self.da... | [
"0.6741386",
"0.66164917",
"0.65970826",
"0.65970826",
"0.65970826",
"0.65306944",
"0.6526331",
"0.6515029",
"0.6477521",
"0.6465047",
"0.6444959",
"0.64383364",
"0.64277387",
"0.64203614",
"0.6403321",
"0.6376847",
"0.6354413",
"0.63457936",
"0.63392204",
"0.6333194",
"0.633... | 0.6914319 | 0 |
Returns a random session ID for this flow based on the runner args. | def GetNewSessionID(self):
# Calculate a new session id based on the flow args. Note that our caller
# can specify the base path to the session id, but they can not influence
# the exact session id we pick. This ensures that callers can not engineer a
# session id clash forcing us to overwrite an existi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_session_id(cls):\n return \"\".join(\n random.choice(cls.SESSION_ID_CHARACTERS)\n for i in range(cls.SESSION_ID_HEADER_SIZE))",
"def get_session_id(self):\n if not self.session_id:\n return uuid.uuid4()\n else:\n return self.session_id",
... | [
"0.6617417",
"0.6452386",
"0.63822037",
"0.63822037",
"0.63822037",
"0.6269492",
"0.6219374",
"0.6172727",
"0.6172727",
"0.61058706",
"0.6017577",
"0.5962487",
"0.59575313",
"0.59290975",
"0.5871184",
"0.5848817",
"0.58407706",
"0.5829654",
"0.5827419",
"0.58181834",
"0.57914... | 0.62679756 | 6 |
Allows this flow to send a message to its parent flow. If this flow does not have a parent, the message is ignored. | def SendReply(self, response):
if not isinstance(response, rdfvalue.RDFValue):
raise RuntimeError("SendReply can only send a Semantic Value")
# Only send the reply if we have a parent and if flow's send_replies
# attribute is True. We have a parent only if we know our parent's request.
if self.ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_to(self, destination):\n pass",
"def send(self, msg):\n print(\"Parent Send : \" + msg)",
"def setParent(self, parent):\n\t\traise Exception(\"Abstract method IDataFlow.setParent not implemented in: \" + str(self))",
"def parent_null_object(self):\n parent = self.nul_object_na... | [
"0.67793417",
"0.6650302",
"0.6366906",
"0.629527",
"0.62673867",
"0.6266635",
"0.6266635",
"0.6266635",
"0.6266635",
"0.6266635",
"0.6266635",
"0.6214963",
"0.6214688",
"0.6214688",
"0.6214504",
"0.61763424",
"0.61627036",
"0.6149926",
"0.6134415",
"0.6087449",
"0.5973429",
... | 0.0 | -1 |
convert reduced dipole matrix element in units of ea0 into oscillator strength gf omega in units of 2piGHz wavenum in cm^1 | def DipoletoGf(dipole,wavenum):
wavenum = wavenum*100.
#return (2./3.)*(m_e*omeg/hbar)*(dipole*e*a0)**2/(e**2)
return (2./3.)*(wavenum*a0/alpha)*(dipole**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calc_m(omega):\n return 0.48 + 1.574*omega - 0.176*omega**2",
"def Photoelectric(E):\n return Xe[selectE(E/MeV)][2]*cm2/g",
"def get_e0_nuc(mol):\n\n e0_nuc = 0\n\n for a in range(len(mol.atom_charges())):\n for b in range(a+1, len(mol.atom_charges())):\n\n r_ab2 = np.dot(m... | [
"0.61114967",
"0.59915566",
"0.5941235",
"0.5845998",
"0.581445",
"0.5793312",
"0.57570183",
"0.5717677",
"0.57152784",
"0.5692672",
"0.56867117",
"0.5681777",
"0.5631928",
"0.5627947",
"0.5565759",
"0.5535211",
"0.552312",
"0.5495181",
"0.54923123",
"0.54923123",
"0.5489013"... | 0.5614915 | 14 |
returns polarizability of mF sublevel from given scalar and tensor polarizabilities | def mFPolarizability(state,I,scalar,tensor):
F = state.F
J = state.J
B_num = F*(2*F-1)*(2*F+1)*(2*J+3)*(J+1)*(2*J+1)
B_den = (2*F+3)*(F+1)*J*(2*J-1)
B = B_num/B_den
A = (3*state.mF**2-F*(F+1))/(F*(2*F-1))
X = (-1)**(I+J+F) * wigner_6j(F,J,I,J,F,2) * A * np.sqrt(B)
return scalar ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _vol_fn(t, x):\n f = x[..., 0]\n v = x[..., 1]\n\n beta = tf.convert_to_tensor(\n self._beta(t), dtype=self._dtype, name='beta_fn') if _is_callable(\n self._beta) else self._beta\n volvol = tf.convert_to_tensor(\n self._volvol(t), dtype=self._dtype, name='volv... | [
"0.552541",
"0.5446801",
"0.5426915",
"0.540964",
"0.5394565",
"0.5342776",
"0.5313435",
"0.52845734",
"0.52001685",
"0.51971734",
"0.517977",
"0.5165918",
"0.516118",
"0.51427823",
"0.51417243",
"0.5107165",
"0.51032144",
"0.50855166",
"0.5083616",
"0.5080305",
"0.5072958",
... | 0.5563327 | 0 |
Render website's index page. | def index():
return render_template('index.html', **locals()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n return render_template(\"index.html\")",
"def index():\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def render_index():\r\n return render_template('index.html')",
"def index():\n\treturn render_template(\"index.h... | [
"0.86683875",
"0.8658163",
"0.8649707",
"0.8623437",
"0.8574163",
"0.85623866",
"0.85574925",
"0.8469923",
"0.8469923",
"0.8469923",
"0.8469923",
"0.8469923",
"0.8469923",
"0.8469923",
"0.8469923",
"0.8469923",
"0.8451491",
"0.8451491",
"0.8441001",
"0.8441001",
"0.8441001",
... | 0.7962979 | 68 |
Add header to force latest IE rendering engine and Chrome Frame. | def add_header(response):
response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=edge,chrome=1'\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-Age=0'\n return response",
"def add_header (response):... | [
"0.7968451",
"0.77127254",
"0.7675221",
"0.7658596",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
"0.76585805",
... | 0.78781104 | 1 |
Find a project as per id | def find(project_id):
return find_entity("projects", project_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_project(id):\n for p in get_projects():\n if p.id == id:\n return p\n return None",
"def find_project(project_id):\n # TODO currently fetching hard coded pk. Implement dynamic handling.\n project_id = int(project_id)\n p = Project.objects.get(pk=project_id)\n print(p)\n\n clone_p... | [
"0.8211924",
"0.79322475",
"0.7657108",
"0.74146277",
"0.7395544",
"0.7369179",
"0.7192951",
"0.7056943",
"0.70056736",
"0.6969368",
"0.6924127",
"0.68658376",
"0.68604195",
"0.6840642",
"0.68078375",
"0.680639",
"0.68040586",
"0.6799655",
"0.6794427",
"0.67672276",
"0.676061... | 0.85924464 | 0 |
Describe the fixed numpy shapes of each observation. Returns Dict[str, Tuple[int]] The shape, as a tuple, of each numpy array by their name. | def observation_shape(self) -> Dict[str, tuple]:
return {
"board": (self.N, self.N),
"heads": (self.num_players, ),
"directions": (self.num_players, ),
"deaths": (self.num_players, )
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def observation_shape(self):\n return self.field.size, self.field.size",
"def shape(self):\n a = np.load(self.liste[0])\n return list(np.shape([a]))",
"def output_shape(self):\n feat_dim = 0\n for obs_group in self.observation_group_shapes:\n # get feature dimensio... | [
"0.6661938",
"0.65305376",
"0.65204155",
"0.63922167",
"0.6387242",
"0.63616973",
"0.6340836",
"0.6339912",
"0.6314745",
"0.6286728",
"0.62669957",
"0.62529516",
"0.6237499",
"0.6177217",
"0.6165164",
"0.61649925",
"0.6135009",
"0.6125718",
"0.6118948",
"0.610513",
"0.6088086... | 0.6183968 | 13 |
Whether or not an action is valid for a specific state. | def is_valid_action(self, state: object, player: int, action: str) -> bool:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_valid_action(self, action):\n if action == SHIFT:\n return self._can_shift()\n elif action == REDUCE:\n return self._can_reduce()\n elif is_nt(action):\n return self._can_open()\n else:\n raise ValueError(f'invallid action `{action}`')... | [
"0.7481022",
"0.73292553",
"0.7208724",
"0.7153317",
"0.7051773",
"0.6863204",
"0.68580323",
"0.6794537",
"0.67248154",
"0.6721521",
"0.6710157",
"0.66667056",
"0.66584843",
"0.6653492",
"0.664085",
"0.6640052",
"0.6597371",
"0.6592574",
"0.6588916",
"0.6549258",
"0.65202546"... | 0.826453 | 0 |
iterator to all files of given glob pattern return a iterator to all files of given pattern under given directory | def find_all_files_recur_iter(rootdir, globpattern):
for dirpath,dirnames,filenames in os.walk(rootdir):
for filename in filenames:
if fnmatch.fnmatch(filename,globpattern):
yield path.join(dirpath,filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def glob(root, pattern):\n if root is None:\n return\n \n if os.path.isfile(root) and fnmatch.fnmatch(root, pattern):\n yield root\n return\n \n for base, dirs, files in os.walk(root):\n matches = fnmatch.filter(files, pattern)\n for filename in matches:\n ... | [
"0.7893544",
"0.7842612",
"0.7840435",
"0.778692",
"0.77503985",
"0.7659715",
"0.7611062",
"0.7568725",
"0.7546636",
"0.7535656",
"0.741455",
"0.73981756",
"0.7381941",
"0.7368201",
"0.73534375",
"0.7338851",
"0.7323447",
"0.73135614",
"0.7271119",
"0.7221649",
"0.71907485",
... | 0.8343261 | 0 |
Sets the incident_id of this IncidentItem. | def incident_id(self, incident_id):
self._incident_id = incident_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def incident_entry_id(self, incident_entry_id):\n\n self._incident_entry_id = incident_entry_id",
"def incident_status_id(self, incident_status_id):\n\n self._incident_status_id = incident_status_id",
"def incident_guid(self, incident_guid):\n\n self._incident_guid = incident_guid",
"def... | [
"0.74490833",
"0.73341304",
"0.6642728",
"0.65336955",
"0.642416",
"0.6306374",
"0.6178729",
"0.6134165",
"0.6116973",
"0.58793455",
"0.58793455",
"0.58793455",
"0.58793455",
"0.5872939",
"0.58414406",
"0.58414406",
"0.5821033",
"0.581259",
"0.56970614",
"0.5587104",
"0.55646... | 0.8211669 | 1 |
Sets the incident_status_id of this IncidentItem. | def incident_status_id(self, incident_status_id):
self._incident_status_id = incident_status_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id_status_conta(self, id_status_conta):\n self._id_status_conta = id_status_conta",
"def identity_status(self, identity_status):\n\n self._identity_status = identity_status",
"def incident_id(self, incident_id):\n\n self._incident_id = incident_id",
"def incident_id(self, incident_id... | [
"0.66948134",
"0.66819197",
"0.65196824",
"0.65196824",
"0.65196824",
"0.61228955",
"0.59545547",
"0.5883093",
"0.58495206",
"0.58495206",
"0.58495206",
"0.582612",
"0.582612",
"0.580551",
"0.58023953",
"0.5669766",
"0.5668248",
"0.5642688",
"0.5642688",
"0.5642688",
"0.56426... | 0.83143103 | 0 |
Sets the incident_date of this IncidentItem. | def incident_date(self, incident_date):
self._incident_date = incident_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expenditure_date(self, expenditure_date):\n\n self._expenditure_date = expenditure_date",
"def date(self, date):\n \n self._date = date",
"def date(self, date):\n\n self._date = date",
"def date(self, date):\n\n self._date = date",
"def date(self, date):\n\n se... | [
"0.67425287",
"0.6736588",
"0.67267406",
"0.67267406",
"0.67267406",
"0.6628953",
"0.65872526",
"0.65872526",
"0.65872526",
"0.6483731",
"0.6378405",
"0.6369492",
"0.6369492",
"0.6369492",
"0.6351972",
"0.63504666",
"0.6178046",
"0.6178046",
"0.6151485",
"0.61163723",
"0.6103... | 0.8753607 | 0 |
Sets the description of this IncidentItem. | def description(self, description):
self._description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, description):\n self.description = description",
"def set_description(self, description):\n self.description = description",
"def set_description(self, description):\n self._description = description",
"def set_description(self, description):\n\t\tself.descripti... | [
"0.77103335",
"0.77103335",
"0.7697414",
"0.7688845",
"0.76310956",
"0.76310956",
"0.76310956",
"0.76310956",
"0.76310956",
"0.76310956",
"0.76310956",
"0.7630433",
"0.7614412",
"0.7598354",
"0.7471542",
"0.74295163",
"0.74295163",
"0.74295163",
"0.74295163",
"0.74295163",
"0... | 0.7585131 | 54 |
Sets the report_number of this IncidentItem. | def report_number(self, report_number):
if report_number is not None and len(report_number) > 50:
raise ValueError("Invalid value for `report_number`, length must be less than or equal to `50`") # noqa: E501
self._report_number = report_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_id(self, report_id):\n\n self._report_id = report_id",
"def invoice_number(self, invoice_number):\n\n self._invoice_number = invoice_number",
"def invoice_no(self, invoice_no):\n\n self._invoice_no = invoice_no",
"def account_no(self, account_no):\n self._account_no = a... | [
"0.71759826",
"0.6279367",
"0.6132869",
"0.6117398",
"0.6004508",
"0.5984424",
"0.597743",
"0.5941485",
"0.5832759",
"0.58186287",
"0.58186287",
"0.58094704",
"0.57918006",
"0.57841295",
"0.5726397",
"0.57167774",
"0.5699795",
"0.5674917",
"0.5674917",
"0.5674917",
"0.5674917... | 0.7303032 | 0 |
Sets the room_location_id of this IncidentItem. | def room_location_id(self, room_location_id):
self._room_location_id = room_location_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location_id(self, location_id):\n\n self._location_id = location_id",
"def location_id(self, location_id):\n\n self._location_id = location_id",
"def location_id(self, location_id):\n\n self._location_id = location_id",
"def location_id(self, location_id):\n\n self._location_i... | [
"0.701475",
"0.701475",
"0.701475",
"0.701475",
"0.62634146",
"0.6209231",
"0.6130512",
"0.5843723",
"0.5843723",
"0.5843723",
"0.57679856",
"0.5712536",
"0.5697296",
"0.56801677",
"0.5676867",
"0.5636122",
"0.5636122",
"0.5636122",
"0.5636122",
"0.5636122",
"0.5636122",
"0... | 0.8075042 | 0 |
Sets the room_base_id of this IncidentItem. | def room_base_id(self, room_base_id):
self._room_base_id = room_base_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boatroom_id(self, boatroom_id):\n\n self._boatroom_id = boatroom_id",
"def item_id(self, item_id):\n\n self._item_id = item_id",
"def bus_ob_rec_id(self, bus_ob_rec_id):\n\n self._bus_ob_rec_id = bus_ob_rec_id",
"def aom_id(self, aom_id):\n self._aom_id = aom_id",
"def set_b... | [
"0.5885365",
"0.5422206",
"0.5346442",
"0.5322127",
"0.51871103",
"0.512358",
"0.512358",
"0.512358",
"0.512358",
"0.5099787",
"0.50731254",
"0.5068036",
"0.49532357",
"0.4926064",
"0.4926064",
"0.4924133",
"0.49177977",
"0.49121848",
"0.49073732",
"0.48591062",
"0.48529166",... | 0.81819576 | 0 |
Sets the location_comments of this IncidentItem. | def location_comments(self, location_comments):
if location_comments is not None and len(location_comments) > 100:
raise ValueError("Invalid value for `location_comments`, length must be less than or equal to `100`") # noqa: E501
self._location_comments = location_comments | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments(self, comments):\n self._comments = comments",
"def comments(self, comments):\n\n self._comments = comments",
"def comments(self, comments):\n\n self._comments = comments",
"def comments(self, comments):\n\n self._comments = comments",
"def comments(self, comments):... | [
"0.6821631",
"0.68065715",
"0.68065715",
"0.68065715",
"0.68065715",
"0.68065715",
"0.68065715",
"0.68065715",
"0.6555462",
"0.5990549",
"0.58765906",
"0.5810977",
"0.570911",
"0.5689223",
"0.5689223",
"0.5689223",
"0.5689223",
"0.5689223",
"0.5689223",
"0.5689223",
"0.568922... | 0.75269777 | 0 |
Sets the incident_clery_geography_id of this IncidentItem. | def incident_clery_geography_id(self, incident_clery_geography_id):
self._incident_clery_geography_id = incident_clery_geography_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def incident_id(self, incident_id):\n\n self._incident_id = incident_id",
"def incident_id(self, incident_id):\n\n self._incident_id = incident_id",
"def incident_id(self, incident_id):\n\n self._incident_id = incident_id",
"def id_origem_comercial(self, id_origem_comercial):\n se... | [
"0.57908815",
"0.57908815",
"0.57908815",
"0.53940165",
"0.52681047",
"0.5212687",
"0.52026427",
"0.51831067",
"0.51831067",
"0.51831067",
"0.5155297",
"0.51195717",
"0.5109601",
"0.5109601",
"0.5109601",
"0.5109601",
"0.5056121",
"0.50515676",
"0.50385976",
"0.49901652",
"0.... | 0.8823854 | 0 |
Sets the created_by_security_user_id of this IncidentItem. | def created_by_security_user_id(self, created_by_security_user_id):
self._created_by_security_user_id = created_by_security_user_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def security_user_id(self, security_user_id):\n\n self._security_user_id = security_user_id",
"def created_by(self, created_by):\n\n self._created_by = created_by",
"def created_by(self, created_by):\n\n self._created_by = created_by",
"def created_by(self, created_by):\n\n self._... | [
"0.7067223",
"0.65181124",
"0.65181124",
"0.65181124",
"0.65181124",
"0.65181124",
"0.65181124",
"0.65181124",
"0.65181124",
"0.6489157",
"0.62637985",
"0.62637985",
"0.6081797",
"0.6067837",
"0.59392005",
"0.59392005",
"0.59392005",
"0.59392005",
"0.59392005",
"0.59392005",
... | 0.81658953 | 0 |
Sets the date_created of this IncidentItem. | def date_created(self, date_created):
self._date_created = date_created | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_created(self, date_created):\n \n self._date_created = date_created",
"def date_created(self, date_created: datetime):\n\n self._date_created = date_created",
"def created_date(self, created_date):\n \n self._created_date = created_date",
"def created_date(self, cr... | [
"0.8152101",
"0.8121046",
"0.7846807",
"0.78257656",
"0.78257656",
"0.78257656",
"0.7217913",
"0.7217913",
"0.7178193",
"0.7178193",
"0.71538734",
"0.71538734",
"0.71538734",
"0.71538734",
"0.71538734",
"0.693136",
"0.693136",
"0.693136",
"0.66011494",
"0.66011494",
"0.660114... | 0.8117602 | 2 |
Sets the incident_guid of this IncidentItem. | def incident_guid(self, incident_guid):
self._incident_guid = incident_guid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def incident_id(self, incident_id):\n\n self._incident_id = incident_id",
"def incident_id(self, incident_id):\n\n self._incident_id = incident_id",
"def incident_id(self, incident_id):\n\n self._incident_id = incident_id",
"def incident_entry_id(self, incident_entry_id):\n\n self... | [
"0.660777",
"0.660777",
"0.660777",
"0.6346826",
"0.59834146",
"0.59834146",
"0.58145875",
"0.57832265",
"0.5690402",
"0.55523354",
"0.5526377",
"0.5383508",
"0.5383508",
"0.5362231",
"0.53251046",
"0.53251046",
"0.53251046",
"0.53251046",
"0.52794033",
"0.52656233",
"0.52376... | 0.8491172 | 0 |
Sets the timestamp of this IncidentItem. | def timestamp(self, timestamp):
if timestamp is not None and len(timestamp) > 8:
raise ValueError("Invalid value for `timestamp`, length must be less than or equal to `8`") # noqa: E501
self._timestamp = timestamp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp(self, timestamp: datetime):\n\n self._timestamp = timestamp",
"def timestamp(self, timestamp):\n\n self._timestamp = timestamp",
"def timestamp(self, timestamp):\n\n self._timestamp = timestamp",
"def timestamp(self, timestamp):\n\n self._timestamp = timestamp",
"d... | [
"0.72529453",
"0.71838295",
"0.71838295",
"0.71838295",
"0.71838295",
"0.669585",
"0.65401703",
"0.63520265",
"0.6346221",
"0.6295756",
"0.6278668",
"0.62417644",
"0.62382233",
"0.621417",
"0.6196834",
"0.6196834",
"0.6196834",
"0.61778677",
"0.61750525",
"0.61750525",
"0.615... | 0.5431823 | 73 |
Sets the workflow_step_id of this IncidentItem. | def workflow_step_id(self, workflow_step_id):
self._workflow_step_id = workflow_step_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workflow_id(self, workflow_id):\n\n self._workflow_id = workflow_id",
"def workflow_steps(self, workflow_steps):\n\n self._workflow_steps = workflow_steps",
"def workflow_step(self, operator, workflow_step):\n self._tql.add_filter('workflowStep', operator, workflow_step, TQL.Type.INTEG... | [
"0.700012",
"0.57901716",
"0.57213134",
"0.5541691",
"0.5448926",
"0.5240126",
"0.5226895",
"0.51334774",
"0.5130864",
"0.5115899",
"0.51024663",
"0.5071236",
"0.50466466",
"0.50314426",
"0.4957165",
"0.4957165",
"0.49076658",
"0.48965397",
"0.48915404",
"0.48716095",
"0.4869... | 0.8320757 | 1 |
Sets the current_workflow_history_id of this IncidentItem. | def current_workflow_history_id(self, current_workflow_history_id):
self._current_workflow_history_id = current_workflow_history_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_workflow_history_id(self, previous_workflow_history_id):\n\n self._previous_workflow_history_id = previous_workflow_history_id",
"def previous_workflow_history_id(self, previous_workflow_history_id):\n\n self._previous_workflow_history_id = previous_workflow_history_id",
"def workflo... | [
"0.65762407",
"0.65762407",
"0.59459156",
"0.5685798",
"0.5685798",
"0.55643994",
"0.55368364",
"0.5266945",
"0.5233534",
"0.5090395",
"0.5070523",
"0.5055673",
"0.5014595",
"0.49696207",
"0.4940281",
"0.49105248",
"0.48972946",
"0.47109735",
"0.4703001",
"0.46973294",
"0.468... | 0.8511062 | 1 |
Sets the date_modified of this IncidentItem. | def date_modified(self, date_modified):
self._date_modified = date_modified | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_modified(self, date_modified):\n \n self._date_modified = date_modified",
"def date_modified(self, date_modified: datetime):\n\n self._date_modified = date_modified",
"def modified_date(self, modified_date):\n \n self._modified_date = modified_date",
"def modified_... | [
"0.81770265",
"0.81499135",
"0.7920733",
"0.7898401",
"0.70130724",
"0.70116705",
"0.70116705",
"0.7004017",
"0.7004017",
"0.6524672",
"0.6358133",
"0.6345829",
"0.63148916",
"0.63148916",
"0.63148916",
"0.6288668",
"0.62305504",
"0.6223991",
"0.6195748",
"0.612869",
"0.61196... | 0.8136589 | 4 |
Returns the string representation of the model | def to_str(self):
return pprint.pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8602178",
"0.8509178",
"0.82356834",
"0.80495524",
"0.8011123",
"0.79336935",
"0.7877631",
"0.7789918",
"0.7789225",
"0.7745271",
"0.7629439",
"0.760794",
"0.7581855",
"0.7514664",
"0.75062877",
"0.75031793",
"0.74870557",
"0.7443237",
"0.7434521",
"0.7426648",
"0.7407079"... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
Initialize trainer or optimizer to work with AMP dynamic loss scaling. | def init_trainer(optimizer_or_trainer):
global _amp_loss_scale_initialized
global _amp_initialized
global _loss_scaler
assert _amp_initialized, "AMP not initialized, did you forget to call amp.init()?"
if not _amp_loss_scale_initialized:
_amp_loss_scale_initialized = True
loss_scaler... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_optimizer(self):\n\t\tself.optimizer = optim.Adam(self.classifier_model.parameters(),\n\t\t\t\t\t\t\t\t\tlr=self.opt.base_learning_rate,\n\t\t\t\t\t\t\t\t\tbetas = (self.opt.beta1, self.opt.beta2))\n\t\t# divide the learning rate by a factor of 10 after 80 epochs\n\t\tself.scheduler = optim.lr_scheduler.... | [
"0.661444",
"0.6536225",
"0.648597",
"0.64639163",
"0.6434472",
"0.64287764",
"0.6400332",
"0.63713557",
"0.6270339",
"0.6257637",
"0.62182194",
"0.6162633",
"0.61402524",
"0.6137225",
"0.61273485",
"0.6102657",
"0.6102657",
"0.60848576",
"0.60766214",
"0.6061583",
"0.6052291... | 0.7569323 | 0 |
Goes to 'Contact Us' html page. | def contact_us(request):
return render(request, 'ContactUs/index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact_us_page(request):\n\treturn render_to_response('contact_us.html')#, HttpResponseRedirect('/contact')",
"def contact_us():\n return render_template(\"contact_us.html\")",
"def contact():\r\n return render_template(\r\n 'contact.html',\r\n title='Contact',\r\n year=datetime... | [
"0.82819813",
"0.7893407",
"0.77878845",
"0.77878845",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77215904",
"0.77203727",
"0.77203727",
"0.76682794",... | 0.78447217 | 2 |
Get list of coordinates of the bounding box from an element. | def get_bbox(elem):
if len(elem) > 0:
return elem[0].get('bbox').strip('[]').split(', ')
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coordinate_list(self):\n return self.bounding_box.flatten().tolist()",
"def bounding_box(self):\r\n\r\n return [(self.x + 10, self.y + 10),\r\n (self.x - 10, self.y + 10),\r\n (self.x - 10, self.y - 10),\r\n (self.x + 10, self.y - 10)]",
"def bound... | [
"0.7716231",
"0.7251395",
"0.71257573",
"0.7114709",
"0.71075386",
"0.6997461",
"0.69575685",
"0.69501036",
"0.6912827",
"0.6864919",
"0.67389",
"0.66757184",
"0.665654",
"0.6620153",
"0.66072214",
"0.658676",
"0.6562872",
"0.65298855",
"0.6446907",
"0.64401156",
"0.64313054"... | 0.69012004 | 9 |
If invalid token used => 401 | def test_401_with_invalid_token(self):
auth_headers = self.get_auth_header(token='invalid')
response = self.get_content_api_response(
self.page.id, auth_headers=auth_headers
)
self.assertEqual(response.status_code, 401) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_error():\n # TODO the json sometimes gets returned in the browser, need to have a more reliable way to check if api or if full page request\n if request.is_xhr:\n return (jsonify({'error': 'authentication required'}), 401,\n {'WWW-Authenticate': 'Bearer realm=\"Authentication ... | [
"0.82697237",
"0.76618165",
"0.7634846",
"0.7367179",
"0.7367179",
"0.727538",
"0.7227796",
"0.71629703",
"0.71574754",
"0.7078855",
"0.70412016",
"0.70299107",
"0.69828707",
"0.69525725",
"0.69417256",
"0.69106895",
"0.6906113",
"0.68826824",
"0.6880985",
"0.686781",
"0.6857... | 0.7364759 | 5 |
This is view for the Homepage. | def home(request):
return render(request, 'store/home_page.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, request):\n return render(request, \"home.html\", {})",
"def home(request):\n return render_to_response(\"home.html\", {\n \n }, context_instance=RequestContext(request))",
"def home(request):\n\t\n return render(request, 'base/home.html')",
"def home(request):\r\n ret... | [
"0.8449991",
"0.83030814",
"0.82750803",
"0.82342553",
"0.81758094",
"0.8133337",
"0.8129574",
"0.8124833",
"0.8123266",
"0.811152",
"0.81012785",
"0.80741954",
"0.8057138",
"0.8040725",
"0.8038154",
"0.8015257",
"0.8013558",
"0.8012033",
"0.7987741",
"0.7964014",
"0.7962803"... | 0.78979677 | 31 |
Returns a string of the repo path. | def get_repopath(repo_username, repo_name, prefix_mode):
if prefix_mode == "none":
repopath = repo_name
elif prefix_mode == "underscore":
repopath = repo_username + "_" + repo_name
elif prefix_mode == "directory":
repopath = repo_username + "/" + repo_name
return repopath | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repo_url_to_path(self, repo):\n repo = repo.replace('http://', '')\n repo = repo.replace('https://', '')\n repo = repo.replace('/', '_')\n\n return os.sep.join([self._data_directory, repo])",
"def getRepoPath(repo):\n\n return path.join(os.getcwd(), workspaceFolder, git.repoNa... | [
"0.8007359",
"0.7993179",
"0.791482",
"0.78982574",
"0.7801459",
"0.77292734",
"0.7708822",
"0.76416427",
"0.75422025",
"0.7409246",
"0.74087197",
"0.73757243",
"0.7336122",
"0.7336122",
"0.7241429",
"0.7234172",
"0.71877074",
"0.70945936",
"0.707093",
"0.70358646",
"0.703016... | 0.6795645 | 51 |
draws box around each object | def draw_box(predicted_classes,image,rect_th= 10,text_size= 3,text_th=3):
img=(np.clip(cv2.cvtColor(np.clip(image.numpy().transpose((1, 2, 0)),0,1), cv2.COLOR_RGB2BGR),0,1)*255).astype(np.uint8).copy()
for predicted_class in predicted_classes:
label=predicted_class[0]
probability=predicted_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_boxes(self, buffer):\n\n for object in self.objects:\n x_coords = []\n y_coords = []\n\n for point in object.points:\n x_coords.append(point[0])\n y_coords.append(point[1])\n\n bottom_left = (min(x_coords)-buffer, min(y_c... | [
"0.7167346",
"0.7044269",
"0.7028325",
"0.7012512",
"0.7009927",
"0.68871367",
"0.6809563",
"0.6795203",
"0.6766132",
"0.67560244",
"0.6737268",
"0.6734497",
"0.6694489",
"0.6683161",
"0.6670406",
"0.66558146",
"0.6633006",
"0.66167295",
"0.6598407",
"0.6598407",
"0.6598236",... | 0.6001494 | 83 |
If feat is shorter than `length`, pad it with a learnable vector to `length`. If feat is longer than `length`, remove it for training and validation; for testing, divide it into multiple chuncks with `length`. | def build_video_idx(self):
video_idx = [k.split('.')[0] for k in os.listdir(self.feat_path)]
video_split = [k for k in video_idx
if self.split in self.ann['database'][k]['subset']]
return video_split | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixed_len_feature(length=[], dtype='int64'):\n if dtype == 'int64':\n return tf.FixedLenFeature(length, tf.int64)\n elif dtype == 'int32':\n return tf.FixedLenFeature(length, tf.int32)\n elif dtype == 'string':\n return tf.FixedLenFeature(length, tf.string)\n elif dtype == 'flo... | [
"0.6160841",
"0.5897227",
"0.5816345",
"0.57879823",
"0.5725935",
"0.5613792",
"0.55995965",
"0.552188",
"0.5512237",
"0.5441403",
"0.5427668",
"0.5421655",
"0.53804666",
"0.5363223",
"0.5359724",
"0.53486437",
"0.5346012",
"0.533991",
"0.5334417",
"0.5314632",
"0.5303209",
... | 0.0 | -1 |
Check if the user can share the doc. | def shareable_by(self, user):
query = ((Q(permission__user_permits=user) | Q(permission__comm_permits__com_roles__member__user=user) | Q(permission__role_permits__member__user=user)) & Q(permission__level=1) & Q(permission__document = self))
perms = Document.objects.filter(query).count()
print(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shareable(self) -> bool:\n return pulumi.get(self, \"shareable\")",
"def can_view(self):\n # If the page is in a workflow and this user is a reviewer then they can view\n if self.can_review():\n return True\n\n # Otherwise, check if this page is shared with the user\n ... | [
"0.74003005",
"0.7368801",
"0.6682713",
"0.6682713",
"0.6493515",
"0.6450051",
"0.63830763",
"0.63561755",
"0.63561755",
"0.63285077",
"0.628773",
"0.6272837",
"0.62602234",
"0.6244225",
"0.6233648",
"0.62310654",
"0.62275404",
"0.62267786",
"0.6216217",
"0.6193304",
"0.61904... | 0.7636415 | 0 |
Check if the user can view the doc. | def viewable_by(self, user):
query = (Q(permission__user_permits=user) | Q(permission__comm_permits__com_roles__member__user=user) | Q(permission__role_permits__member__user=user)) & Q(permission__document = self)
perms = Document.objects.filter(query).count()
print(perms)
if perms:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_view_perm(self, user):\n return self.has_perm(user, 'can_view')",
"def can_view(self):\n # If the page is in a workflow and this user is a reviewer then they can view\n if self.can_review():\n return True\n\n # Otherwise, check if this page is shared with the user\n... | [
"0.75008756",
"0.74809724",
"0.7374297",
"0.7318521",
"0.73034847",
"0.72883666",
"0.7278285",
"0.7237825",
"0.7236536",
"0.7232674",
"0.7231028",
"0.7228486",
"0.71630627",
"0.715868",
"0.7145537",
"0.7142444",
"0.7126502",
"0.7105017",
"0.70891124",
"0.70789164",
"0.7064345... | 0.7471061 | 2 |
Return if the set of BEL relations contains a contradiction. | def relation_set_has_contradictions(relations: Collection[str]) -> bool:
has_increases = any(relation in CAUSAL_INCREASE_RELATIONS for relation in relations)
has_decreases = any(relation in CAUSAL_DECREASE_RELATIONS for relation in relations)
has_cnc = any(relation == CAUSES_NO_CHANGE for relation in relati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pair_has_contradiction(graph: BELGraph, u: BaseEntity, v: BaseEntity) -> bool:\n relations = {data[RELATION] for data in graph[u][v].values()}\n return relation_set_has_contradictions(relations)",
"def missing_relation(self) -> bool:\n return not (self.patient and self.study)",
"def isInvalida... | [
"0.6730397",
"0.6587511",
"0.64661753",
"0.64406735",
"0.6396573",
"0.62406325",
"0.61769575",
"0.6082322",
"0.60571903",
"0.60387",
"0.60362387",
"0.6021255",
"0.6016676",
"0.6014302",
"0.6007723",
"0.5952486",
"0.5937618",
"0.59208447",
"0.58868015",
"0.58434963",
"0.579687... | 0.7594815 | 0 |
Just like authorize_redirect(), but autoredirects if authorized. This is generally the right interface to use if you are using oodreads for singlesign on. | def authenticate_redirect(self, callback_uri=None):
http = httpclient.AsyncHTTPClient()
http.fetch(self._oauth_request_token_url(callback_uri=callback_uri), self.async_callback(
self._on_request_token, self._OAUTH_AUTHENTICATE_URL, None)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize(req, resp):\n api.redirect(resp, location=authorize_url())",
"def redirect_login(request):\n client_id = settings.KEYCLOAK_CLIENT_ID\n base_authorize_url = settings.KEYCLOAK_AUTHORIZE_URL\n redirect_uri = request.build_absolute_uri(reverse('callback'))\n if 'next' in request.GET:\n ... | [
"0.6623823",
"0.63104594",
"0.6265392",
"0.6252927",
"0.6203371",
"0.6200838",
"0.6200838",
"0.61750764",
"0.6145789",
"0.612664",
"0.60968953",
"0.6064893",
"0.60554636",
"0.59429115",
"0.5927952",
"0.5921196",
"0.5900874",
"0.58841914",
"0.5858411",
"0.58546555",
"0.5849241... | 0.532455 | 92 |
`is_namespace` returns ``True`` only for namespaced names. | def test_is_namespace(self):
self.assertThat(
is_namespace(42),
Is(False))
self.assertThat(
is_namespace((u'foo', u'bar')),
Is(False))
self.assertThat(
is_namespace(namespaced(u'foo')),
Is(False))
self.assertThat(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_namespace(self, namespace: Sequence[str]):\n if self.namespace is None:\n return False\n\n for index, item in enumerate(namespace):\n try:\n if item != self.namespace[index]:\n return False\n except IndexError:\n ... | [
"0.7588699",
"0.73202884",
"0.6870046",
"0.68623793",
"0.6773055",
"0.6771014",
"0.6748202",
"0.6615351",
"0.6551627",
"0.6466989",
"0.62727976",
"0.6198409",
"0.5966324",
"0.59225005",
"0.58724415",
"0.58525366",
"0.5839484",
"0.5819745",
"0.5798542",
"0.578283",
"0.5723017"... | 0.80479205 | 0 |
Creates and saves a User with the given email and password. | def _create_user(self, email, full_name, password, is_superuser, **extra_fields):
if not email:
raise ValueError('Email id is required')
email=self.normalize_email(email)
if is_superuser:
user = self.model(
email=self.normalize_email(email),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('User must have an email address')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self.... | [
"0.8466284",
"0.8451141",
"0.84238786",
"0.84134024",
"0.8409551",
"0.84064895",
"0.8404198",
"0.8390803",
"0.83900774",
"0.83900774",
"0.83900774",
"0.83900774",
"0.8376972",
"0.83751047",
"0.83751047",
"0.83751047",
"0.83751047",
"0.8370614",
"0.8366722",
"0.83633083",
"0.8... | 0.0 | -1 |
Sets the affiliate_collect of this PaymentOption. | def affiliate_collect(self, affiliate_collect):
self._affiliate_collect = affiliate_collect | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affiliation(self, value):\n self._affiliation = value",
"def affiliation(self, affiliation):\n\n self._affiliation = affiliation",
"def __init__(self, affiliate_collect=None, credit_card=None): # noqa: E501 # noqa: E501\n\n self._affiliate_collect = None\n self._credit_card = ... | [
"0.5708313",
"0.5559551",
"0.5256321",
"0.4656538",
"0.44539222",
"0.4396272",
"0.4388847",
"0.43845254",
"0.43420902",
"0.43214628",
"0.42808032",
"0.42727646",
"0.42654437",
"0.4260001",
"0.4253478",
"0.4232897",
"0.42132708",
"0.42132708",
"0.42132708",
"0.4185904",
"0.418... | 0.7956137 | 0 |
Returns the string representation of the model | def to_str(self):
return pprint.pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8602178",
"0.8509178",
"0.82356834",
"0.80495524",
"0.8011123",
"0.79336935",
"0.7877631",
"0.7789918",
"0.7789225",
"0.7745271",
"0.7629439",
"0.760794",
"0.7581855",
"0.7514664",
"0.75062877",
"0.75031793",
"0.74870557",
"0.7443237",
"0.7434521",
"0.7426648",
"0.7407079"... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
Return a new list of indices, containing only pixels that are not nan in f. | def filter_not_nans(f):
h = f.shape[0]
w = f.shape[1]
no_nans = []
for r in range(h):
for c in range(w):
pixel = f[r][c]
if np.isnan(pixel[0]) or np.isnan(pixel[1]):
no_nans.append((r,c))
return no_nans | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_not_infs(f):\n h = f.shape[0]\n w = f.shape[1]\n no_nans = []\n for r in range(h):\n for c in range(w):\n pixel = f[r][c]\n if pixel[0] == np.finfo(np.float64).max or pixel[1] == np.finfo(np.float64).max:\n #if np.isinf(pixel[0]) or np.isinf(pixel[1]):\n ... | [
"0.795113",
"0.6960747",
"0.6656945",
"0.6625793",
"0.62596023",
"0.62487805",
"0.6091704",
"0.6090234",
"0.6064679",
"0.59584886",
"0.59584296",
"0.59303886",
"0.5707754",
"0.5704187",
"0.56920594",
"0.567887",
"0.5639105",
"0.5630448",
"0.5576077",
"0.5575584",
"0.5575584",... | 0.8373031 | 0 |
Return a new list of indices, containing only pixels that are not nan in f. | def filter_not_infs(f):
h = f.shape[0]
w = f.shape[1]
no_nans = []
for r in range(h):
for c in range(w):
pixel = f[r][c]
if pixel[0] == np.finfo(np.float64).max or pixel[1] == np.finfo(np.float64).max:
#if np.isinf(pixel[0]) or np.isinf(pixel[1]):
no_nan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_not_nans(f):\n h = f.shape[0]\n w = f.shape[1]\n no_nans = []\n for r in range(h):\n for c in range(w):\n pixel = f[r][c]\n if np.isnan(pixel[0]) or np.isnan(pixel[1]):\n no_nans.append((r,c))\n return no_nans",
"def kill_nans(f):\n h = f.shape[0]\... | [
"0.83717966",
"0.69598114",
"0.6658029",
"0.6625586",
"0.62599814",
"0.6248168",
"0.6091185",
"0.60887694",
"0.6065803",
"0.5959325",
"0.5957549",
"0.5929739",
"0.5706359",
"0.5704149",
"0.5691554",
"0.56778026",
"0.5638282",
"0.562858",
"0.5575407",
"0.5573505",
"0.5573505",... | 0.79500204 | 1 |
Compute the distance between two patches. Patches are 2d numpy arrays of flow vectors. | def patchdist(p0, p1):
assert(p0.shape == p1.shape)
D = p0.size
sum = 0
for i in range(p0.shape[0]):
for j in range(p1.shape[1]):
sum += flowdist(p0[i, j], p1[i, j])
return sum / D | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_distance(p1, p2, kernel):\n assert p1.shape == p2.shape, \"Patch sizes are not equal ...\"\n assert p1.shape[0] == p1.shape[1], \"Input patch must be a square matrix ...\"\n assert p1.shape[0] % 2 != 0, \"Patch size must be odd ...\"\n diff = (p1 - p2) ** 2\n return np.sum(np.multiply(kern... | [
"0.78316903",
"0.6152066",
"0.61492705",
"0.6096571",
"0.6043906",
"0.6018227",
"0.6017249",
"0.6002765",
"0.5991862",
"0.5979456",
"0.5977529",
"0.59693813",
"0.59666556",
"0.5948958",
"0.59437686",
"0.5925044",
"0.59040266",
"0.5889393",
"0.5889393",
"0.58784515",
"0.586817... | 0.7490617 | 1 |
Tests the update and list commands | def test_update_list(self):
old_cwd = os.getcwd()
clear_projects()
t3_dir = os.path.join(os.path.normpath(os.path.dirname(__file__)), "t3")
os.chdir(t3_dir)
old_stdout = sys.stdout
sys.stdout = std_out = StringIO()
uj_main(["list"])
sys.stdout = old_stdo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_list(self):\n pass",
"def test_cli_edit_ok_list(self):\n runner = engine.engine()\n runner.run([\"test/test_data\"], a.edit)\n self.assertEqual(2, runner.logger.stats['processed'])\n self.assertEqual(2, runner.logger.stats['written'])",
"def test_update(self):... | [
"0.78701085",
"0.7512504",
"0.74465746",
"0.6881489",
"0.6862326",
"0.6731412",
"0.6657591",
"0.66106236",
"0.6569405",
"0.6539214",
"0.65323246",
"0.6515431",
"0.64910054",
"0.64138067",
"0.6392061",
"0.6383799",
"0.63780075",
"0.6377122",
"0.63609874",
"0.63524324",
"0.6348... | 0.6978146 | 3 |
Distance matrix only when x and y have the same number of data. Less computation thanks to a triangular matrix. | def func_compute_kernel_matrix_square(x: torch.Tensor,
y: torch.Tensor,
soft_dtw_generator) -> torch.Tensor:
mat = torch.zeros((x.shape[0], y.shape[0]))
for i_row in range(x.shape[0]):
for i_col in range(i_row, y.shape[0]):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dist_matrix(x, y):\r\n N = len(x)\r\n xx = np.vstack( (x,)*N )\r\n yy = np.vstack( (y,)*N )\r\n return np.sqrt( (xx - xx.T)**2 + (yy - yy.T)**2 )",
"def distance_matrix(x0, y0, x1, y1):\n\n obs = np.vstack((x0, y0)).T\n interp = np.vstack((x1, y1)).T\n\n d0 = np.subtract.outer(obs[:... | [
"0.8087696",
"0.7373356",
"0.71461076",
"0.7135947",
"0.70303595",
"0.6986701",
"0.69323003",
"0.6929242",
"0.6893403",
"0.6801656",
"0.6730091",
"0.66986245",
"0.6688068",
"0.6684457",
"0.6582055",
"0.656726",
"0.65080345",
"0.65043",
"0.643822",
"0.6436435",
"0.6436338",
... | 0.0 | -1 |
mocks results of get_current_song | def mock_get_curr_song(self, user):
return "A song" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_that_song_function_calls_get_info(self, mock):\n x = song()\n self.assertTrue(mock.called)",
"def test_that_song_function_calls_get_info(self, mock):\n x = song()\n self.assertTrue(mock.called)",
"def test_that_song_function_calls_get_info(self, mock):\n x = song()\n... | [
"0.7522482",
"0.7522482",
"0.7522482",
"0.6982279",
"0.6754492",
"0.64124566",
"0.63914114",
"0.6226258",
"0.6216624",
"0.6216624",
"0.6216624",
"0.61369234",
"0.60531616",
"0.6046146",
"0.59999096",
"0.590387",
"0.5878408",
"0.58730143",
"0.5862186",
"0.581636",
"0.57872546"... | 0.81191814 | 0 |
Update loss scaling according to overall gradients. If all gradients is finite after incr_every_n_steps, loss scaling will increase by incr_ratio. Otherwisw, loss scaling will decrease by decr_ratio after decr_every_n_nan_or_inf steps and each step some gradients are infinite. | def update_loss_scaling(is_overall_finite, prev_loss_scaling, num_good_steps,
num_bad_steps, incr_every_n_steps,
decr_every_n_nan_or_inf, incr_ratio, decr_ratio):
zero_steps = fluid.layers.fill_constant(shape=[1], dtype='int32', value=0)
with fluid.layers.Switch()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_op_if_no_nan_or_inf():\n return tf.group(\n get_loss_scale_update_op(loss_scale, loss_scale_normal_steps,\n inc_loss_scale_every_n),\n *get_apply_gradients_ops_func())",
"def _rescale_gradients(self) -> None:\n if ... | [
"0.66075605",
"0.65641093",
"0.6467381",
"0.6403557",
"0.60881484",
"0.5963493",
"0.5921189",
"0.58387566",
"0.58355343",
"0.58321565",
"0.58054245",
"0.5793449",
"0.578539",
"0.57193345",
"0.5712192",
"0.5703516",
"0.56481093",
"0.56331694",
"0.56275266",
"0.55855674",
"0.55... | 0.77917963 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.