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 |
|---|---|---|---|---|---|---|
Compute the softmax of each element along an axis of X. | def softmax(X, theta=1.0, axis=None):
# make X at least 2d
y = np.atleast_2d(X)
# find axis
if axis is None:
axis = next(j[0] for j in enumerate(y.shape) if j[1] > 1)
# multiply y against the theta parameter,
y = y * float(theta)
# subtract the max for numerical stabi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, x):\n\n out = np.zeros(x.shape)\n for i in range(x.shape[0]):\n max_x = x[i] - np.max(x[i])\n out[i] = np.exp(max_x) / np.sum(np.exp(max_x), axis=0)\n\n return out",
"def softmax(x: npt.NDArray) -> npt.NDArray:\n row_wise_max = np.max(x, axis=1).res... | [
"0.86478335",
"0.8523097",
"0.85011977",
"0.84512436",
"0.84243035",
"0.8400698",
"0.8381795",
"0.83787024",
"0.83724785",
"0.836225",
"0.83545095",
"0.8344736",
"0.8326514",
"0.83093625",
"0.8273076",
"0.82727146",
"0.82651985",
"0.8247394",
"0.8247394",
"0.8243556",
"0.8242... | 0.0 | -1 |
Compute softmax values for each sets of scores in x. | def softmax(x, beta=1):
return np.exp(np.asarray(x) * beta) / np.sum(np.exp(np.asarray(x) * beta), axis=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.0 | -1 |
Numerically stable elementwise Softmax | def softmax(x):
x_exp = (x - x.max(1)[0].view(-1, 1)).exp()
return x_exp / x_exp.sum(1).view(-1, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x, stable=0):\n if stable:\n e_x = np.exp(x - np.max(x, axis=0))\n return e_x / e_x.sum(axis=0)\n return np.exp(x) / np.sum(np.exp(x), axis=0)",
"def softmax(x): \n e_x = np.exp(x - np.max(x)) \n return e_x / e_x.sum()",
"def softmax(x):\r\n e_x = np.exp(x - np.... | [
"0.83267283",
"0.82796085",
"0.825423",
"0.825423",
"0.82472557",
"0.82471764",
"0.82471764",
"0.82471764",
"0.82471764",
"0.8231207",
"0.82232916",
"0.82137066",
"0.82038087",
"0.8200272",
"0.81935287",
"0.81931937",
"0.81931937",
"0.81931937",
"0.81931937",
"0.81931937",
"0... | 0.80973065 | 48 |
take 1D float array of rewards and compute discounted reward | def discount_rewards(r, gamma):
#print("r", r)
discounted_r = np.zeros_like(r)
running_add = 0
for t in reversed(xrange(0, r.size)):
#print("t", t)
running_add = running_add * gamma + r[t]
discounted_r[t] = running_add
return discounted_r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \r\n running_add = running_add * reward_discount + rewards[t]\r\n discounted_r[t] = running_add\r\n return discounted_r",
"def discoun... | [
"0.8100923",
"0.78397125",
"0.7792625",
"0.7742053",
"0.7653779",
"0.75987715",
"0.7583268",
"0.75820553",
"0.7579539",
"0.7536054",
"0.7519005",
"0.75047183",
"0.7467692",
"0.7456702",
"0.7433794",
"0.7426565",
"0.74062765",
"0.73950297",
"0.7370545",
"0.73564714",
"0.732851... | 0.703724 | 25 |
Return the lines of a file in a list. | def read_file(file_name):
try:
with open(file_name, mode='r') as file:
lines = file.readlines()
except OSError:
print("file", file_name, "not found.")
file_lines = []
for line in lines:
file_lines.append(line)
return file_lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readListFromFile( filename ):\n try:\n with open( filename ) as f:\n lines = f.readlines()\n return lines\n except:\n #e = sys.exc_info()[0]\n print( 'Error reading file ' + filename )",
"def read_lines_from_file(fname):\n return []",
"def _fileLinesToLis... | [
"0.7582556",
"0.7188501",
"0.71296144",
"0.7125667",
"0.7121562",
"0.7094333",
"0.7090027",
"0.7059228",
"0.70463",
"0.7044487",
"0.7039346",
"0.7038872",
"0.70384693",
"0.70139015",
"0.70033765",
"0.6982144",
"0.69175905",
"0.686716",
"0.6855514",
"0.6852645",
"0.68377066",
... | 0.62672174 | 64 |
Create a wrapped, monitored gym.Env for safety. | def make_env(self, env_id, seed, logger_dir=None, reward_scale=1.0, mpi_rank=0, subrank=0, info_keywords=()):
scenario = scenarios.load('{}.py'.format(env_id)).Scenario()
world = scenario.make_world()
env_dict = {
"world": world,
'reset_callback': scenario.reset_world,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_wrapped_env(seed=123,\n visualize=False, \n run_logs_dir=\"./run_logs/\", \n dMoments=None,\n step_timeout=10,\n integrator_accuracy = 5e-5,\n ):\n rank = 0 # MPI.COMM_WORLD.Get_rank()\n set_global_seeds(seed + 10000 * rank)\n print(\"Making wrapped env\... | [
"0.7291933",
"0.71476954",
"0.70490533",
"0.70490533",
"0.6989433",
"0.69867665",
"0.6983361",
"0.69435",
"0.67789096",
"0.6649843",
"0.6632334",
"0.65918314",
"0.65638644",
"0.65459406",
"0.651608",
"0.651608",
"0.64992607",
"0.6495524",
"0.6495524",
"0.6399907",
"0.63572866... | 0.59170043 | 45 |
Checking if a list is equal to a list. | def is_equal(a: list[int], b: list[int]) -> bool:
i = 0
if len(a) == 0 and len(b) == 0:
return True
if len(a) == 0 and len(b) > 0:
return False
if len(a) > 0 and len(b) == 0:
return False
while i < len(a) and i < len(b):
if a[i] == b[i]:
if i == len(a) -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_same(lst1, lst2):\n return len(lst1) == len(lst2) and all([x == y for x, y in zip(lst1, lst2)])",
"def check_lists_equal(list_1, list_2):\n if len(list_1) != len(list_2):\n return False\n return sorted(list_1) == sorted(list_2)",
"def all_equal(list_a, list_b):\n if len(list_a) != l... | [
"0.78387725",
"0.7770302",
"0.77526116",
"0.7652526",
"0.7583793",
"0.7523901",
"0.74438715",
"0.7386059",
"0.72481924",
"0.7203102",
"0.7052353",
"0.6903722",
"0.688241",
"0.685984",
"0.68577284",
"0.68557405",
"0.68352264",
"0.68290585",
"0.6791731",
"0.6768179",
"0.6722047... | 0.69091326 | 11 |
Checking what the max value of a list is. | def max(input: list[int]) -> int:
i = 0
if len(input) == 0:
raise ValueError("max() arg is an empty List")
else:
while i < len(input):
j = i + 1
while j < len(input):
if input[i] > input[j]:
if j == len(input) - 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum(some_list):\n return max(some_list)",
"def max_or_zero(list):\n try:\n return max(list)\n except ValueError:\n return 0",
"def max(self, num_list):\n try:\n max = int(num_list[0])\n\n for number in num_list:\n ... | [
"0.7975214",
"0.7798693",
"0.7690492",
"0.75982237",
"0.7539442",
"0.7529354",
"0.7481824",
"0.74741864",
"0.7453818",
"0.7428711",
"0.7419007",
"0.73673505",
"0.7347873",
"0.73248017",
"0.73163944",
"0.72837734",
"0.7174969",
"0.7174356",
"0.71677434",
"0.7163559",
"0.715932... | 0.6652531 | 65 |
Returns the details of a virtual network in a private cloud. | def show_virtual_network(client, private_cloud, virtual_network, location):
return client.get(location, private_cloud, virtual_network) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private_network(self) -> str:\n return pulumi.get(self, \"private_network\")",
"def list_virtual_networks(client, private_cloud, resource_pool, location):\n return client.list(location, private_cloud, resource_pool)",
"def virtual_network(self):\n return self.broker.virtual_network(**{\"Vi... | [
"0.69066435",
"0.68641645",
"0.66429555",
"0.64058644",
"0.63984174",
"0.6323161",
"0.6316874",
"0.6283044",
"0.6261179",
"0.6218056",
"0.61452466",
"0.6103788",
"0.6063678",
"0.6061959",
"0.60519266",
"0.59895545",
"0.59864265",
"0.597254",
"0.5969824",
"0.5968256",
"0.58977... | 0.77753043 | 0 |
Test exception for giving a bad filetype. | def test_bad_menu():
with pt.raises(Exception):
sc.import_menu('test.txt') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_file_type(barred_tac_list_importer):\n expect_failure(barred_tac_list_importer, exc_message='Wrong suffix')",
"def test_read_type_error():\n filename = {}\n with pytest.raises(TypeError):\n read_file(filename)",
"def test_fetch_or_create_requires_file_type():\n pytest.raises... | [
"0.7940577",
"0.7615568",
"0.75243056",
"0.74428564",
"0.74098617",
"0.7337893",
"0.7219399",
"0.71084017",
"0.70997214",
"0.70903224",
"0.7089458",
"0.7037418",
"0.70099515",
"0.6954027",
"0.69308364",
"0.69238627",
"0.6920612",
"0.6908897",
"0.68930936",
"0.6873504",
"0.683... | 0.0 | -1 |
Size of data left to be read. Notes `_fsize` is the uncompressed size of both files in the pair, summed. `_tell` is the amount of uncompressed data that has been read from this wrapper thus far. | def len(self):
return self._fsize - self._tell | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def len(self):\n return self._fsize - self._fp.tell()",
"def _filelength(self):\r\n with open(self.fileName, 'rb') as f:\r\n f.seek(0, 2) # move to end of file\r\n length = f.tell() # get current position\r\n return length",
"def get_size(self, fileobject):\n ... | [
"0.7139826",
"0.6518028",
"0.63594913",
"0.63079417",
"0.6108515",
"0.6085027",
"0.60787904",
"0.59550196",
"0.59547025",
"0.59246975",
"0.5887387",
"0.58497894",
"0.580786",
"0.5803867",
"0.5802381",
"0.57805043",
"0.5749601",
"0.5743155",
"0.5733529",
"0.571891",
"0.5709965... | 0.7152826 | 0 |
Size of data left to be read. | def len(self):
return self._fsize - self._fp.tell() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_length(self):\n size = self.unpack_dword(0x4)\n if size >= 0x80000000:\n size -= 0x80000000\n return size",
"def get_size(self):\n return self._data_size",
"def size(self):\n return self.data.size",
"def size(self):\n return len(self.data)",
"de... | [
"0.7816329",
"0.780202",
"0.77463967",
"0.77291405",
"0.77291405",
"0.77291405",
"0.77291405",
"0.77291405",
"0.7713576",
"0.762909",
"0.7604626",
"0.7552866",
"0.7543932",
"0.75396913",
"0.748357",
"0.748357",
"0.748357",
"0.7440955",
"0.7440036",
"0.7424612",
"0.7417099",
... | 0.7120207 | 38 |
Return filename used to represent a set of pairedend files. Assumes Illuminastyle naming conventions where each file has _R1_ or _R2_ in its name. | def interleaved_filename(file_path):
if not isinstance(file_path, tuple):
raise OneCodexException("Cannot get the interleaved filename without a tuple.")
if re.match(".*[._][Rr][12][_.].*", file_path[0]):
return re.sub("[._][Rr][12]", "", file_path[0])
else:
warnings.warn("Paired-end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(i):\n rand_name = os.path.join(os.getcwd(), \"input-%d.txt\" % i)\n ref_name = os.path.join(os.getcwd(), \"input-%d.ref\" % i)\n return rand_name, ref_name",
"def create_filename (self):\n\t\tassert self.__patient_name and self.__location_name, \"New filename could not be determined, one or... | [
"0.6361047",
"0.62988627",
"0.6291889",
"0.62638634",
"0.6204989",
"0.60608757",
"0.60481226",
"0.6038897",
"0.60292923",
"0.5980579",
"0.59389335",
"0.59262383",
"0.58894366",
"0.5883494",
"0.5878525",
"0.5867033",
"0.5834226",
"0.5830204",
"0.582772",
"0.58055633",
"0.57992... | 0.67012686 | 0 |
Called from the parent class, so we can provide the appropriate flask app for this test case. | def load_app(self, config: Mapping[str, Any]) -> SignupApp:
return signup_init_app(name='signup', test_config=config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_app(flask_app):\n flask_app.test_client_class = TestClient\n return flask_app.test_client()",
"def setUp(self):\n self.app = Flask(__name__)\n self.app_context = self.app.app_context()\n self.app_context.push()\n self.client = self.app.test_client()",
"def app... | [
"0.7208283",
"0.7110204",
"0.69486",
"0.69486",
"0.69486",
"0.68976754",
"0.6854521",
"0.6824677",
"0.67804205",
"0.67590564",
"0.67555094",
"0.6672011",
"0.6666826",
"0.6650347",
"0.66274214",
"0.6599824",
"0.65958625",
"0.65943205",
"0.65929145",
"0.6574945",
"0.6564183",
... | 0.0 | -1 |
Closes the connection to the oracle database. | def __exit__(self, exc_type, exc_val, exc_tb):
self.db_connection.close()
if exc_val:
raise Exception(exc_val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disconnect(self):\n\n try:\n self.cursor.close()\n self.db.close()\n except cx_Oracle.DatabaseError:\n pass",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def close_db_connecti... | [
"0.77250123",
"0.7358969",
"0.72373635",
"0.71440935",
"0.7091228",
"0.707828",
"0.70280993",
"0.7025696",
"0.6994175",
"0.69639736",
"0.69239086",
"0.6909188",
"0.68693054",
"0.68389696",
"0.68357813",
"0.68182534",
"0.68057346",
"0.6734138",
"0.6719252",
"0.6685423",
"0.667... | 0.0 | -1 |
Return a 2dimensional Gaussian function. | def gaussian2d(x, amplitude=1.0, center_x=0.0, sigma_x=1.0, center_y=0.0, sigma_y=1.0, rota=0.0):
if len(x) == 1:
y = x
else:
(x, y) = x
if not sigma_y:
sigma_y = sigma_x
if not center_y:
center_y = center_x
if rota:
center_x = cent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gaussian_distribution(self, x: ndarray, mu: float, sigma: float) -> ndarray:\n return 1 / (np.sqrt(2 * np.pi) * sigma) * np.exp(\n -np.power(\n (x - mu) / sigma, 2) / 2)",
"def gaussian(x, mu, sigma):\n return (np.exp(-(x - mu)**2 / 2.0 / sigma**2) /\n np.sqrt(... | [
"0.74237794",
"0.73306733",
"0.73152167",
"0.728595",
"0.7184317",
"0.71404076",
"0.7132665",
"0.7045012",
"0.70133954",
"0.69431984",
"0.69364214",
"0.6909197",
"0.68970215",
"0.6889527",
"0.68853754",
"0.68715364",
"0.6863365",
"0.68582445",
"0.68248075",
"0.68248075",
"0.6... | 0.64682645 | 60 |
Return a 2dimensional Gaussian function as a 1D array. | def gaussian2d_as1d(x, **kwargs):
g = gaussian2d(x, **kwargs)
return g.ravel() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gaussian_distribution(self, x: ndarray, mu: float, sigma: float) -> ndarray:\n return 1 / (np.sqrt(2 * np.pi) * sigma) * np.exp(\n -np.power(\n (x - mu) / sigma, 2) / 2)",
"def apply_gaussian(X, sigma):\n return np.array([ndimage.gaussian_filter(x, sigma) for x in X])",
... | [
"0.6920575",
"0.6815412",
"0.6749616",
"0.67461413",
"0.6602257",
"0.6490649",
"0.63469195",
"0.62234205",
"0.6163416",
"0.61532956",
"0.614421",
"0.6139505",
"0.6126984",
"0.6122659",
"0.61177367",
"0.610907",
"0.6094161",
"0.60617733",
"0.6026461",
"0.6012973",
"0.60067636"... | 0.70776016 | 0 |
convert face cards like king, joker etc to number so that its easy to process keep the order of face cards intact. A = 14, K=13, Q=12, J=11 keep the original format in self.face_cards intact to display to users | def convert_face_cards_to_numbers(self):
face_card_conversion = {'A': 14, 'K': 13, 'Q': 12, 'J': 11}
cards_int = []
for card in self.cards_list:
if isinstance(card[1], int):
cards_int.append(card)
else:
cards_int.append((card[0],face... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score_on_hands(cards_on_hand):\r\n score = 0\r\n straightCount = 0\r\n max_card = 0\r\n suite_dict = {}\r\n face_dict = {}\r\n transfer_dict = {'A':1,'J':11,'Q':12,'K':13}\r\n card_face = []\r\n '''Circulate the player's hand, build a list of points and a suit dict'''\r\n for index i... | [
"0.61547965",
"0.6130416",
"0.6081708",
"0.605504",
"0.59374684",
"0.5866693",
"0.58592176",
"0.5848381",
"0.58357334",
"0.58254117",
"0.5807185",
"0.575238",
"0.5751966",
"0.57223415",
"0.5670172",
"0.5651044",
"0.5641043",
"0.56213045",
"0.55857915",
"0.5582981",
"0.5552984... | 0.8454125 | 0 |
gets an image and title and diplay it on a plot figure as requested | def show_plot(img, title):
plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
plt.title("Hand Number: " + title)
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_image(img, label=\"\"): \n if img.shape[0] == 3:\n img = img.transpose(1,2,0)\n fig,ax = plt.subplots(1)\n sns.set_style('white')\n ax.imshow(np.asarray(img))\n if label!=\"\":\n plt.title(number_label[label])\n return fig,ax",
"def matplotlibDisplay(img, title=\"Image\",... | [
"0.72506547",
"0.71965265",
"0.7158166",
"0.70354605",
"0.6869228",
"0.6792556",
"0.6762094",
"0.67556643",
"0.67373943",
"0.6722401",
"0.67004097",
"0.66413766",
"0.6632582",
"0.6615512",
"0.65873194",
"0.6587001",
"0.65716314",
"0.65646404",
"0.65646404",
"0.65646404",
"0.6... | 0.7389479 | 0 |
Run this function before each test to set up database | def setUp(self):
User.query.delete()
Message.query.delete()
Follows.query.delete()
Like.query.delete()
self.client = app.test_client()
u = User(
id = 1,
email="test@test.com",
username="testuser",
password=bcrypt.generate_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.app = app.test_client()\n db.init_db()",
"def setUp(self):\n db.create_all()",
"def setUp(self):\n self.db_fd, app.app.config['DATABASE'] = tempfile.mkstemp()\n app.app.config['TESTING'] = True\n self.app = app.app.test_client()\n app.ini... | [
"0.83405554",
"0.8301226",
"0.8281778",
"0.82676876",
"0.8266887",
"0.8262941",
"0.8238698",
"0.82058024",
"0.81675917",
"0.8161589",
"0.81611335",
"0.81485444",
"0.8146026",
"0.81282765",
"0.8114873",
"0.80946434",
"0.8086281",
"0.80798703",
"0.80751455",
"0.80748886",
"0.80... | 0.0 | -1 |
Clean up the database after every test | def tearDown(self):
db.session.rollback() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n self.db.drop_all()\n pass",
"def tearDown(self):\r\n testing.tearDown()\r\n empty_db()",
"def tearDown(self):\r\n testing.tearDown()\r\n empty_db()",
"def tearDown(self):\r\n testing.tearDown()\r\n empty_db()",
"def tearDown(self... | [
"0.8734857",
"0.868604",
"0.868604",
"0.868604",
"0.868604",
"0.868604",
"0.868604",
"0.868604",
"0.868604",
"0.868604",
"0.8647254",
"0.8647254",
"0.8628906",
"0.8628906",
"0.8628906",
"0.8628906",
"0.8628906",
"0.8628906",
"0.85536563",
"0.8527188",
"0.8502627",
"0.845350... | 0.0 | -1 |
Test if a logged in user can see the follower / following pages | def test_followers_following_list_authorized(self):
# user2 following user1
# follow = Follows(user_being_followed_id=1, user_following_id=2)
self.u2.following.append(self.u)
db.session.commit()
with self.client as client:
client.post(
'/login',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_view(self, user):\r\n return True",
"def can_be_viewed_by(self,user):\n return True",
"def current_user_has_access(self):\n return self.user_has_access(users.get_current_user())",
"def can_access(user, page):\n page_groups = PageViewGroup.objects.filter(page=page)\n if user.is_... | [
"0.6881413",
"0.68442315",
"0.6748409",
"0.6579297",
"0.65386754",
"0.6531184",
"0.6521393",
"0.65135825",
"0.6462357",
"0.6460252",
"0.64018106",
"0.63577366",
"0.6329789",
"0.6324544",
"0.63115484",
"0.6295612",
"0.62870365",
"0.6273988",
"0.62673205",
"0.62673205",
"0.6231... | 0.0 | -1 |
Set initial values for the parameters of the model. Set initial parameters for the optimization, depending on the value | def initialize_parameters(self, y):
init = self.initialization
shape = (
y.shape[-1:] if self.space.default_point_type == "vector" else y.shape[-2:]
)
if isinstance(init, str):
if init == "random":
return gs.random.normal(size=(2,) + shape)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_model_parameters(self, verbose=False):\n from scipy.special import gamma\n\n z0 = self.z0\n\n # set parameters that are constants\n p_v, d_v, cs0, sigma, vout0 = (1, 2, 6.7, 0.1, 25.0)\n p_vB, d_vB, Mach0, p_M, d_M = (4, 2, 0.5, 1, 3)\n\n # calculate amplitudes th... | [
"0.7283343",
"0.7212948",
"0.6957001",
"0.694778",
"0.69092476",
"0.68616325",
"0.6854166",
"0.685236",
"0.68468285",
"0.6828957",
"0.68114245",
"0.68106455",
"0.6752893",
"0.6746727",
"0.67225045",
"0.67137873",
"0.6713665",
"0.6669497",
"0.66484594",
"0.66200525",
"0.661467... | 0.0 | -1 |
Update the weights of the policy network given the training samples | def update(self, returns, log_probs):
policy_gradient = []
for log_prob, Gt in zip(log_probs, returns):
policy_gradient.append(-log_prob * Gt)
loss = torch.stack(policy_gradient).sum()
self.optimizer.zero_grad()
loss.backward()
self.optimizer.step() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n\t\tpass",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value\n self.weights_clipping()",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value",
"def update_weights(self):\n\n self.wei... | [
"0.77734596",
"0.7563685",
"0.75521344",
"0.7446542",
"0.7285319",
"0.7269821",
"0.72412425",
"0.7240121",
"0.7122059",
"0.7118337",
"0.7015456",
"0.6948369",
"0.6932317",
"0.69278985",
"0.6916601",
"0.6896981",
"0.6896062",
"0.6882207",
"0.68685794",
"0.6867294",
"0.68551135... | 0.0 | -1 |
Represent a Home page. | def index():
return render_template("index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n return render_template('home_page.html')",
"def homepage():\n\treturn render_template(\"home/a_homepage.html\", title=\"Welcome\")",
"def home():\n return render_template('home.html', title=\"Home\")",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t... | [
"0.8243073",
"0.8140089",
"0.81337893",
"0.8132717",
"0.8116384",
"0.807183",
"0.8066942",
"0.8049672",
"0.8021537",
"0.7964486",
"0.7964486",
"0.7964486",
"0.7964486",
"0.7964486",
"0.7964486",
"0.7964486",
"0.7964486",
"0.7964486",
"0.7964486",
"0.7964486",
"0.7964486",
"... | 0.0 | -1 |
Returns a dictionary loaded with all of the indexes available in the table. ``table`` must be an instance of TableSchema. | def index_schema_builder(table):
conn = table.parent.parent.connection
idx = OrderedDict()
indexes = conn.execute("SHOW INDEXES FROM `%s`.`%s`" % (table.parent.name, table.name))
if not indexes:
return idx
for index in indexes:
n = index['Key_name']
if n not in idx:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_table(self, table='main_table'):\r\n logins = {}\r\n\r\n for row in self.curs.execute(f\"SELECT * FROM {table}\"):\r\n logins[row[0]] = row[1]\r\n return logins",
"def indices(online: bool = False) -> dict:\n return _get_indices(online)",
"def get_indices(self):\n\n... | [
"0.59797174",
"0.5743214",
"0.572891",
"0.5716111",
"0.5606535",
"0.5578626",
"0.5386283",
"0.5334639",
"0.5334056",
"0.53178096",
"0.52642757",
"0.5252717",
"0.5238943",
"0.52105",
"0.51723325",
"0.51395226",
"0.5134731",
"0.51213443",
"0.5073045",
"0.50576985",
"0.5055018",... | 0.6425035 | 0 |
Determine whether the given drawable belongs in this pass, return True or False | def filter(self, drawable):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isOnCanvas(self, x, y):\n return 0 <= x < self.width and 0 <= y < self.height",
"def isdrawn(self):\n return hasattr(self, 'drawn')",
"def clicked(self, x_pos, y_pos):\n img = self.tower_imgs\n if self.x - img.get_width() // 2 + self.width >= x_pos >= self.x - img.get_width() //... | [
"0.62435806",
"0.62236756",
"0.6065715",
"0.60121834",
"0.5989342",
"0.5973137",
"0.5942461",
"0.5937724",
"0.59372824",
"0.59335953",
"0.593039",
"0.59251314",
"0.58959013",
"0.5855895",
"0.5850801",
"0.5849296",
"0.5845072",
"0.5840028",
"0.5833401",
"0.5815968",
"0.5802136... | 0.55374753 | 65 |
Average together an array of dictionaries to create a single map | def create_average_feed_map(self,maps):
avg_map = {'map':np.zeros((self.Ny,self.Nx)),
'cov':np.zeros((self.Ny,self.Nx))}
nchans = maps.shape[-1]
for i,(ifeed,feed) in enumerate(zip(self.feedlist,self.feeds)):
if feed == 20:
continue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_dictlist(dict_list):\r\n avg=sum(dict_list)/len(dict_list)\r\n return avg",
"def summaries(e_dict, m_dict):\n for key, value in m_dict.items():\n e_dict[key].append(np.mean(value))\n return e_dict",
"def mean(data, *args, **kwargs):\n result = OrderedDict()\n for observation_la... | [
"0.70351887",
"0.6997996",
"0.67753744",
"0.66063255",
"0.6570353",
"0.6504898",
"0.6441947",
"0.63998234",
"0.63585275",
"0.62968725",
"0.62076324",
"0.61617136",
"0.61447734",
"0.6101886",
"0.60690403",
"0.60645324",
"0.60629624",
"0.5979048",
"0.5957444",
"0.59145755",
"0.... | 0.6128933 | 13 |
Get the integrated flux of source | def aperture_phot(self,data,x,y,v):
r = np.sqrt((x-self.avg_map_fits['Values'][1])**2 + (y-self.avg_map_fits['Values'][3])**2)
inner = (r < 8./60.) & np.isfinite(data)
outer = (r > 8.5/60.) & (r < 12./60.) & np.isfinite(data)
annu = np.nanmedian(data[outer])
annu_rms =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flux(source, freq=0.0, deltafreq=0.0, daysback=0.0) :\n x = queryFlux(source,freq,deltafreq,daysback)\n return x.flux",
"def flux(self, x):\n return self.cal_spec.get_flux(self(x))",
"def flux_hack(self):\r\n return self.planes[1].galaxies[0].light_profiles[0].flux",
"def queryFlux(so... | [
"0.7669197",
"0.74209905",
"0.69844174",
"0.66117144",
"0.6566223",
"0.65192187",
"0.6499765",
"0.6499711",
"0.649263",
"0.6489329",
"0.63118315",
"0.625141",
"0.624883",
"0.6186395",
"0.6161923",
"0.61520916",
"0.6108406",
"0.6097724",
"0.60267305",
"0.6010993",
"0.6008663",... | 0.0 | -1 |
Gets the dictionary for the frame. | def _getDct(dct, frame):
if dct is None:
#dct = frame.f_back.f_locals
dct = frame.f_back.f_globals
return dct | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDict(self):\n \n return self[self._name]",
"def get_dict(self):\n return",
"def get_dict(self):\n return self._data",
"async def get_frame(self) -> dict[str, int]:\n cmd = await self.send_command(\"FRAME\", timeout=1)\n if not cmd.succeeded():\n rai... | [
"0.7267939",
"0.71171606",
"0.7022939",
"0.6759889",
"0.6726255",
"0.6726255",
"0.6726255",
"0.6726255",
"0.6726255",
"0.6726255",
"0.6726255",
"0.65882003",
"0.65148646",
"0.64980626",
"0.6446308",
"0.644445",
"0.6389688",
"0.63613594",
"0.63613594",
"0.6349561",
"0.6348474"... | 0.62339044 | 28 |
Tests if this is a sympy object. | def isSympy(val):
properties = dir(val)
return ("is_symbol" in properties) or ("evalf" in properties) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_symbol(obj):\n return isinstance(obj, Symbol)",
"def is_symbolic(self: Q) -> bool:\n\n symbolic = False\n\n if (\n hasattr(self.t, \"free_symbols\")\n or hasattr(self.x, \"free_symbols\")\n or hasattr(self.y, \"free_symbols\")\n ... | [
"0.68962616",
"0.66811335",
"0.6582384",
"0.6101717",
"0.5944321",
"0.5900767",
"0.5859516",
"0.5850032",
"0.5845883",
"0.5759307",
"0.5725144",
"0.56389153",
"0.56389153",
"0.56115603",
"0.5567855",
"0.55135876",
"0.5505195",
"0.5484248",
"0.54709846",
"0.54577804",
"0.54283... | 0.6495493 | 3 |
Tests if a vector, numbers or symbols, are equal. | def isVecZero(vec):
trues = [isZero(e) for e in vec]
return all(trues) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testEquals(self):\n v1 = Vector(3, 4, 5)\n assert (v1 == [3, 4, 5])\n assert (v1 != [0, 2, 4])\n v2 = Vector(3.0, 4.0, 5.000)\n assert (v1 == v2)\n v3 = Vector(2, 2)\n assert v1 != v3",
"def test_equal_with_different_type():\n assert_false(Vector(1.0) == 1.... | [
"0.77007866",
"0.7403604",
"0.7031848",
"0.70036083",
"0.6930626",
"0.6805227",
"0.67998993",
"0.6627008",
"0.65910006",
"0.65815514",
"0.6547712",
"0.65207255",
"0.646505",
"0.64251965",
"0.6414125",
"0.6353729",
"0.63000643",
"0.6294559",
"0.62733984",
"0.62645084",
"0.6258... | 0.0 | -1 |
Recursively evaluates if two indexable, mutable objects are equal under subtituions. | def recursiveEquals(obj1, obj2, **kwargs):
if isIndexable(obj1) != isIndexable(obj2):
return False
if isIndexable(obj1):
for entry1, entry2 in zip(obj1, obj2):
if not recursiveEquals(entry1, entry2, **kwargs):
return False
return True
# Do the numeric eval... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deep_equals(obja, objb, isequal):\n\n objatree = wo.typedtree(obja)\n objbtree = wo.typedtree(objb)\n match = objatree == objbtree\n ok = match == isequal\n\n if ok:\n s = \"pass\"\n else:\n s = \"fail\"\n\n print(f\"{obja} == {objb} is {match} : {s}\")\n return ok",
... | [
"0.68917024",
"0.6596789",
"0.6577442",
"0.6479338",
"0.64557725",
"0.64390177",
"0.64297426",
"0.6371889",
"0.6368599",
"0.63447434",
"0.6282089",
"0.625527",
"0.6224617",
"0.6221564",
"0.6213155",
"0.619821",
"0.6193105",
"0.6192547",
"0.616437",
"0.6164099",
"0.6162677",
... | 0.73336893 | 0 |
Finds the distinct symbols on the expressions. | def getDistinctSymbols(eqnDct, symbols=None, excludes=None):
if excludes is None:
excludes = []
dct = getDctSymbols(eqnDct, symbols)
rhsSymbols = []
[rhsSymbols.extend(v) for v in dct.values()]
newRhsSymbols = [s for s in rhsSymbols if not s in excludes]
lst = list(set(newRhsSymbols))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IterUniqueSymbols(self):\n return SymbolGroup._IterUnique(self)",
"def free_symbols(self) -> set[Basic]:\n empty: set[Basic] = set()\n return empty.union(*(a.free_symbols for a in self.args))",
"def terminals(g):\n return set(g._lexical_index.keys())",
"def get_reachable_symbols(self)... | [
"0.657047",
"0.60996306",
"0.5917533",
"0.58740634",
"0.5867453",
"0.58007026",
"0.57815665",
"0.5718306",
"0.57136565",
"0.56482387",
"0.56368625",
"0.5602955",
"0.5599397",
"0.55940604",
"0.5589479",
"0.55606186",
"0.5550915",
"0.5514069",
"0.5513399",
"0.54779536",
"0.5463... | 0.65912104 | 0 |
Create a PyQuante Molecule from ccData object. | def makepyquante(data):
_check_pyquante()
# Check required attributes.
required_attrs = {"atomcoords", "atomnos"}
missing = [x for x in required_attrs if not hasattr(data, x)]
if missing:
missing = " ".join(missing)
raise MissingAttributeError(
f"Could not cre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mol_from_cbor(cbor_str: str) -> masm.Molecule:\n serializer = masm.JsonSerialization\n cbor_binary = serializer.base_64_decode(cbor_str)\n cbor_format = serializer.BinaryFormat.CBOR\n serialization = serializer(cbor_binary, cbor_format)\n return serialization.to_molecule()",
"def __init__(self... | [
"0.6127257",
"0.5955953",
"0.58659273",
"0.5852008",
"0.5816335",
"0.5488921",
"0.5417257",
"0.54081833",
"0.5378631",
"0.5372726",
"0.5339961",
"0.5331621",
"0.532856",
"0.5288974",
"0.5225449",
"0.5213084",
"0.5169375",
"0.5157298",
"0.51539534",
"0.5151509",
"0.51321834",
... | 0.70717275 | 0 |
Initialize linear associator model | def __init__(self, input_dimensions=2, number_of_nodes=4, transfer_function="Hard_limit"):
self.input_dimensions = input_dimensions
self.number_of_nodes = number_of_nodes
self.transfer_function = transfer_function
self.initialize_weights() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dualgan:nn.Module, l_adv:float=1., l_rec:float=1., l_idt:float=0.):\n super().__init__()\n store_attr()",
"def __init__(self):\n self.incidents_models = {}\n self.risks = []\n self.incidents_models = None",
"def __init__(self, elementLabels: tuple):\n ... | [
"0.6391725",
"0.6366248",
"0.63397354",
"0.6335165",
"0.6327864",
"0.62552357",
"0.6243334",
"0.62063235",
"0.6159212",
"0.6156385",
"0.6153855",
"0.61227274",
"0.6105251",
"0.6105251",
"0.607627",
"0.6017138",
"0.6017138",
"0.6017138",
"0.6017138",
"0.6017138",
"0.59813696",... | 0.0 | -1 |
This function sets the weight matrix. | def set_weights(self, W):
if self.weights.shape!=W.shape:
return -1
self.weights = W | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_output_weights(self, weight_matrix):\n pass",
"def _set_weights(self, weights):\r\n self.weights = weights.reshape(self.output_size, self.input_size+1)",
"def fill_weight_matrix(self,adjMatrix):\n\t\tassert len(adjMatrix[0]) == self._size\n\t\tself.myWeights = self.init_zero_matrix(self._... | [
"0.75917155",
"0.7561686",
"0.74251693",
"0.73995805",
"0.7366359",
"0.73237705",
"0.71820426",
"0.7178649",
"0.7132717",
"0.7092969",
"0.7077529",
"0.7051122",
"0.7018717",
"0.70061266",
"0.69976825",
"0.69909936",
"0.69626874",
"0.6801653",
"0.6777497",
"0.6747767",
"0.6715... | 0.74057245 | 3 |
Given a batch of data, and the targets, this function adjusts the weights using pseudoinverse rule. | def fit_pseudo_inverse(self, X, y):
self.pseudo_inv = np.linalg.pinv(X)
self.weights = np.dot(y,self.pseudo_inv) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_weights(weights, target, learn_rate):\r\n\r\n for w in range(0, len(target)):\r\n weights[w] += learn_rate * (target[w] - weights[w])",
"def soft_update_target_network(self):\n \n pars_behavior = self.model.get_weights() # these have form [W1, b1, W2, b2, ..], Wi ... | [
"0.69113845",
"0.6477466",
"0.643578",
"0.6262895",
"0.6146144",
"0.61448354",
"0.61231244",
"0.6039901",
"0.60239935",
"0.59915715",
"0.597584",
"0.5928853",
"0.59271747",
"0.58957636",
"0.5841941",
"0.58308053",
"0.58119714",
"0.5809456",
"0.57148284",
"0.5703953",
"0.56741... | 0.54883343 | 44 |
Feature standardizer This function standardizes the datesets passed as pandas dataframes by a dictionary. The reference dataframe will be used to calculate the statistical properties (mean and standard deviation) and used to normalize other dataframes. After standardizing the dataset, the features in each dataset have ... | def standard_scale_numeric_features(
dataframe_dict: dict,
reference_dataframe_key: str,
columns_to_normalize: list,
handle_missing_values: bool = True,
) -> dict:
scaler = None
scaled_dataframe_dict = {}
# For scaling the data, the reference, that will be used to fit the S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standardize(sets_x):\n\n # initiate empty list for return variable\n standardized_x = []\n\n # iterate through subsets\n for x in sets_x:\n # call preprocess function, normalize and generate features for each subset\n # and store the result into list\n standardized_x.append(gen... | [
"0.63430774",
"0.6236263",
"0.6199419",
"0.6146865",
"0.6103232",
"0.608885",
"0.6086649",
"0.6037316",
"0.6037316",
"0.59492195",
"0.5938442",
"0.59094757",
"0.59068686",
"0.58896196",
"0.58403134",
"0.58382845",
"0.5793191",
"0.5775445",
"0.5761759",
"0.57486457",
"0.574490... | 0.6571455 | 0 |
Get a list of AWS cidr networks that are already used in input region, | def get_aws_reserved_networks(region=None, all_regions=False):
result = []
if all_regions:
for aws_region in get_aws_regions_list():
for vpc in boto3.client('ec2', region_name=aws_region).describe_vpcs()['Vpcs']:
result.append(vpc)
else:
result = boto3.client('ec2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_networks(start, end, cidr):\n networks = []\n start_net = IPNetwork(f'{start}/{cidr}')\n end = IPNetwork(f'{end}/{cidr}')\n working_net = start_net\n LOG.info(f'Start net: {start_net}')\n while working_net < end + 1:\n LOG.debug(f'Adding network {working_net}')\n networ... | [
"0.6820038",
"0.6804681",
"0.66976684",
"0.6677424",
"0.6308663",
"0.6253607",
"0.6247374",
"0.61671066",
"0.6154734",
"0.6149155",
"0.61050117",
"0.6080339",
"0.60021174",
"0.6000208",
"0.59814507",
"0.59408814",
"0.59382296",
"0.593478",
"0.58991605",
"0.5884177",
"0.587677... | 0.7293091 | 0 |
Get available CIDR (network object), among input ip ranges, according requirements | def calculate_suggested_cidr(ranges, prefix, minimal_num_of_addr):
possible_subnets = []
# For each PyVPCBlock object (available or not)
for net_range in ranges:
# Only if available block found, there is logic to continue
if net_range.block_available:
possible_networks = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nets_arin(self, response):\n\n nets = []\n\n # Find the first NetRange value.\n pattern = re.compile(\n r'^NetRange:[^\\S\\n]+(.+)$',\n re.MULTILINE\n )\n temp = pattern.search(response)\n net_range = None\n net_range_start = None\n ... | [
"0.68123966",
"0.68078184",
"0.6761085",
"0.64270276",
"0.63745517",
"0.6356885",
"0.63083756",
"0.62884295",
"0.6201431",
"0.6179098",
"0.61649907",
"0.61573243",
"0.6120111",
"0.6094949",
"0.606572",
"0.60341364",
"0.6007882",
"0.59868324",
"0.59868324",
"0.59753007",
"0.59... | 0.7409682 | 0 |
Return version number of input distribution name, If distribution not found return not found indication | def get_self_version(dist_name):
try:
return get_distribution(dist_name).version
except DistributionNotFound:
return 'version not found' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_distrib_version():\n distrib, version, codename = _get_release_infos() \n return version",
"def get_version(self, name: str, version=None) -> int:\n division, is_vertebrate = self.get_division(name)\n if version is None:\n latest_version = self.get_release(is_vertebrate)... | [
"0.6932195",
"0.68048453",
"0.67014503",
"0.6700116",
"0.66417897",
"0.65806717",
"0.64669347",
"0.63702524",
"0.6356416",
"0.63375515",
"0.63276076",
"0.6314892",
"0.6295694",
"0.62482536",
"0.6214278",
"0.62090105",
"0.61680084",
"0.61538136",
"0.61250836",
"0.61203957",
"0... | 0.7520793 | 0 |
Adds column of the days since previous admission for each admission | def discharge_admit_diff(df, table_name="", update=True, admit_diff=False):
dff = df.copy()
if update is True:
conn = sqlite3.connect(database_path)
q = f"""SELECT {','.join([col for col in df.columns if col != 'merge'])} FROM {table_name}
WHERE member_id IN {tuple(df.member_id.unique()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance(self):\n\n max_days = Calendar.months[self.__months - 1]\n if self.__months == 2 and Calendar.leapyear(self.__years):\n max_days += 1\n if self.__days == max_days:\n self.__days = 1\n if self.__months == 12:\n self.__months = 1\n ... | [
"0.5347169",
"0.53097117",
"0.53028345",
"0.5291805",
"0.5257914",
"0.52219546",
"0.515763",
"0.5132564",
"0.50713074",
"0.5068003",
"0.504201",
"0.5029407",
"0.50188977",
"0.49447027",
"0.49383736",
"0.49306113",
"0.49297476",
"0.49281722",
"0.4928082",
"0.49247012",
"0.4910... | 0.5400222 | 0 |
Convert to a NetworkX representation (for plotting). | def __toNetworkX(self):
G = nx.Graph()
G.add_nodes_from(range(self.n))
for u in range(self.n):
for v in range(self.n):
if self.adjacent(u, v):
G.add_edge(u, v)
return G | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_networkx(self):\n return nx_util.to_networkx(requests.get(self.__url).json())",
"def test_to_networkx(self, molecule):\n graph = molecule.to_networkx()",
"def to_networkx(self):\n g = nx.Graph()\n for v in self.vs.values():\n g.add_node(v)\n for v in self.fs... | [
"0.78237706",
"0.72152233",
"0.7174843",
"0.69513005",
"0.6698474",
"0.6696587",
"0.66749895",
"0.65931714",
"0.6374036",
"0.63475806",
"0.62553084",
"0.62349886",
"0.6081653",
"0.60185397",
"0.60123825",
"0.5998786",
"0.5968667",
"0.59636873",
"0.5888532",
"0.58625335",
"0.5... | 0.7452247 | 1 |
Function to check dtype of input data. | def _check_dtype(input_dtype):
product_version = tbe_platform.cce_conf.get_soc_spec("SOC_VERSION")
if product_version in ("Hi3796CV300ES"):
if input_dtype == "float32":
raise RuntimeError("float32 is not support in ES")
util.check_dtype_rule(input_dtype, ("float16",))
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_type(data):\n\n if all(data[col].dtypes == data.dtypes[0] for col in data.columns):\n if all(data[col].isnull().sum() == 0 for col in data.columns):\n print('All columns have values of the correct type.')\n else:\n print('Bad result.')",
"def _check_dtype_array(array, d... | [
"0.74189794",
"0.73898906",
"0.73041904",
"0.7157919",
"0.71237206",
"0.7039965",
"0.6881545",
"0.68634605",
"0.68466705",
"0.68417937",
"0.68379974",
"0.6788021",
"0.6753139",
"0.6749034",
"0.67395383",
"0.6737242",
"0.67154336",
"0.66748595",
"0.66574705",
"0.66382",
"0.659... | 0.76709163 | 0 |
Setups a development environment by enabling SQL debug and generates some default objects | def setup_development_environment():
import hashlib
# Enable SQL debug
sql_debug(True)
# Create test user
test_name = "test"
test_salt = "salt"
test_password = hashlib.sha256("{name}{salt}".format(name=test_name, salt=test_salt).encode("utf8")).hexdigest()
account = Account(name=test_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_dev():\n setup_general()",
"def setup_debugging():\n import sys\n sys.path.append('/root/pycharm-debug-py3k.egg')\n import pydevd\n pydevd.settrace('192.168.4.47', port=5422, stdoutToServer=True, stderrToServer=True, suspend=False)",
"def setup():\n load_app()\n setup_db()",
"d... | [
"0.7207912",
"0.6664608",
"0.65393883",
"0.6502808",
"0.6413062",
"0.61525255",
"0.6120485",
"0.61162895",
"0.60940105",
"0.60651845",
"0.6021736",
"0.60192657",
"0.60139734",
"0.60022974",
"0.5996824",
"0.5996283",
"0.59662175",
"0.59578",
"0.5935246",
"0.5929286",
"0.592408... | 0.80060893 | 0 |
Return the relative path to the file, assuming the file is in the DOC_BUILD_DIR directory. | def relative_path(filename):
length = len(os.path.abspath(DOC_BUILD_DIR)) + 1
return os.path.abspath(filename)[length:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_path(file: mesonlib.FileOrString) -> str:\n if isinstance(file, File):\n return file.absolute_path(self.source_dir, self.build_dir)\n return os.path.normpath(os.path.join(self.build_dir, file))",
"def path(cls, relpath=None):\r\n base = os.getcwd() if not Parse... | [
"0.71793926",
"0.71409625",
"0.71349555",
"0.7133555",
"0.69052494",
"0.68666387",
"0.6847979",
"0.68221444",
"0.68153244",
"0.68073785",
"0.67918336",
"0.67832875",
"0.6728163",
"0.67208076",
"0.6708988",
"0.6689211",
"0.66874605",
"0.6669374",
"0.65553904",
"0.6484692",
"0.... | 0.8497054 | 0 |
Returns the postfix form of the infix expression found in `expr` | def infixToPostfix(expr, prec):
ops = Stack()
postfix = []
toks = expr.split()
for t in toks:
if t.isdigit():
postfix.append(t)
elif t == '(':
ops.push('(')
elif t == ')':
op = ops.pop()
while op != '(':
postfix.appe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infix_to_postfix(expr):\n ops = Stack()\n postfix = []\n toks = expr.split()\n def tests(chr):\n if chr.isdigit():\n postfix.append(chr)\n\n elif chr == '(':\n ops.push('(')\n\n elif ops.peek() == '(' or ops.empty():\n ops.push(chr)\n\n e... | [
"0.81900203",
"0.7979371",
"0.7801753",
"0.7429643",
"0.7404279",
"0.7347274",
"0.7156811",
"0.7048756",
"0.6956311",
"0.6874034",
"0.68503463",
"0.67862564",
"0.67233485",
"0.6722634",
"0.6648669",
"0.6607104",
"0.65920854",
"0.6575015",
"0.65612596",
"0.65422934",
"0.649845... | 0.76920533 | 3 |
Read urllink string, check that it has valid format. Ask to accept the new record. | def addsession_url_link(update, context):
url_link = update.message.text
url_link_valid = check_new_url(url_link)
if (not url_link_valid):
update.message.reply_text('Oops, your link is not a valid URL-link.\n'
'Please, retype the URL-link in a good format.')
return URL_LINK
context.user_data['url-str'] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_parse_malformed_url(self):\r\n url = u'http://whttp://lucumr.pocoo.org/2012/8/5/stateless-and-proud/'\r\n read = readable.ReadUrl.parse(url)\r\n self.assertEqual(read.status, 901)",
"def __input_data_ok(self, line=None):\n # valid pattern: 1407478022|www.facebook.com\n ... | [
"0.6080697",
"0.58234376",
"0.5622866",
"0.5566156",
"0.5435617",
"0.5294316",
"0.519682",
"0.5171269",
"0.5155476",
"0.5140307",
"0.51257664",
"0.5114938",
"0.51061934",
"0.51035976",
"0.5092639",
"0.50793076",
"0.5033676",
"0.5027845",
"0.49950567",
"0.49864694",
"0.4981721... | 0.0 | -1 |
Return the Event Queue. Often used in register child. | def queue(self):
return self._queue | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_queue(self):\n return self.assoc.dul.event_queue",
"def get_queue(self):\n return self.queue",
"def get_queue(self):\n return self.queue",
"def _get_queue(self):\n return self.__queue",
"def _get_queue(self):\n return self.__queue",
"def _get_queue(self):\n return ... | [
"0.86091846",
"0.72210234",
"0.72210234",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7111571",
"0.69332856",
"0.680833",
... | 0.70246494 | 21 |
Return the name of this Component/Manager | def name(self):
return self.__class__.__name__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_component_name(self):\n return self._name",
"def name(self):\n return \"component_manager\"",
"def get_name(self):\n return COMPONENT_LIST[self.index][0]",
"def name(self):\r\n return self.component.get(\"Name\", \"\")",
"def name(self):\r\n return self.component.... | [
"0.85097605",
"0.8446357",
"0.8200038",
"0.80708385",
"0.80708385",
"0.79353374",
"0.7899912",
"0.7868577",
"0.7840524",
"0.78305936",
"0.78292775",
"0.780781",
"0.780781",
"0.780781",
"0.780781",
"0.7804831",
"0.7796037",
"0.7796037",
"0.7796037",
"0.7796037",
"0.7796037",
... | 0.7716819 | 44 |
Return the running state of this Component/Manager | def running(self):
return self._running | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running(self): # type: () -> bool\n return self.state['Running']",
"def running_state(self) -> int | None:\n return self.cluster.get(\"running_state\")",
"def state(self) -> RunState:\n return self._async_scheduler.state",
"def running(self):\n info = self.info()\n ret... | [
"0.7704407",
"0.768777",
"0.75955904",
"0.7558845",
"0.74164623",
"0.7393625",
"0.7381565",
"0.7361183",
"0.73058176",
"0.72484815",
"0.7248193",
"0.7219353",
"0.7219353",
"0.7209725",
"0.7209725",
"0.7209725",
"0.72024614",
"0.7201346",
"0.7201346",
"0.71923715",
"0.7189943"... | 0.76450056 | 2 |
Return the Event Queue. Often used in register child. | def queue(self):
return self._queue | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_queue(self):\n return self.assoc.dul.event_queue",
"def get_queue(self):\n return self.queue",
"def get_queue(self):\n return self.queue",
"def _get_queue(self):\n return self.__queue",
"def _get_queue(self):\n return self.__queue",
"def _get_queue(self):\n return ... | [
"0.86091846",
"0.72210234",
"0.72210234",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7137214",
"0.7111571",
"0.69332856",
"0.680833",
... | 0.70246494 | 20 |
Returns string UUID of the boot volume (/), or None if error. | def GetPrimaryVolumeUUID(self):
cmd = [DISKUTIL, 'info', '-plist', '/']
try:
plist = util.GetPlistFromExec(cmd)
except util.ExecError:
return None
return plist.get('VolumeUUID') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_boot_device(self):\n root_vol = None\n boot_vol = None\n for volume in self.volumes:\n if not volume.partitions:\n continue\n for partition in volume.partitions:\n if partition.mount_point == \"/\":\n ... | [
"0.7211224",
"0.69130087",
"0.6680294",
"0.64639413",
"0.64130294",
"0.63189584",
"0.63145447",
"0.62791365",
"0.6256662",
"0.61167836",
"0.606931",
"0.60163456",
"0.5969097",
"0.5951745",
"0.58585423",
"0.58264923",
"0.58071536",
"0.5804914",
"0.5781416",
"0.57693416",
"0.57... | 0.75135744 | 0 |
Returns True if the boot volume (/) is encrypted, False otherwise. | def IsBootVolumeEncrypted(self):
uuid = self.GetPrimaryVolumeUUID()
if not uuid:
return False
volumes = self._GetAPFSVolumes(uuid=uuid)
return bool(volumes and volumes[0].get('Encryption')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_booted_from_volume(self, instance, disk_mapping=None):\n return not bool(instance.get('image_ref'))",
"def encrypted(self) -> Optional[bool]:\n return pulumi.get(self, \"encrypted\")",
"def encrypted(self) -> Optional[bool]:\n return pulumi.get(self, \"encrypted\")",
"def encrypt... | [
"0.6894691",
"0.6687584",
"0.6687584",
"0.66304755",
"0.6320171",
"0.6246809",
"0.61777335",
"0.61218166",
"0.6111284",
"0.609413",
"0.60671836",
"0.59723514",
"0.59393007",
"0.5835118",
"0.58129823",
"0.5777294",
"0.5768005",
"0.57586783",
"0.5728411",
"0.5723119",
"0.57046"... | 0.8629213 | 0 |
add 4 byte hex header at the beginning of the message; Returns a bytes object. | def _add_voevent_header(self, message):
print("message length %d" % (len(message)))
print("%04x" % (len(message)))
print("%08x" % (len(message)))
header = '%04x' % (len(message))
return header + message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_apdu_header(self, apdu):\n if not type(apdu) is bytes:\n return \"ERROR: An APDU has to be a bytestring.\"\n start = b'\\x68'\n apdu_length = len(apdu)\n if apdu_length > 253:\n return \"ERROR: APDU too long.\"\n return start + struct.pack(\"B\", ... | [
"0.6215956",
"0.6212898",
"0.61799604",
"0.61649907",
"0.6157985",
"0.61034787",
"0.6080803",
"0.6004299",
"0.59685373",
"0.5884172",
"0.5879107",
"0.58748627",
"0.58627194",
"0.57854205",
"0.57853705",
"0.5779987",
"0.5766742",
"0.57542604",
"0.57502997",
"0.57402337",
"0.57... | 0.6659834 | 0 |
Return model name if known. | def model(self) -> str:
return self.properties[DBUS_ATTR_MODEL] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_name(self) -> str:\n raise NotImplementedError",
"def model_name(self) -> str:\n return self._model_name",
"def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String)",
"def model_name(self):\n setting = self.get_setting_definition... | [
"0.8194693",
"0.7968126",
"0.7912313",
"0.7665799",
"0.7594676",
"0.7592662",
"0.75644517",
"0.7532425",
"0.74195427",
"0.7415931",
"0.7308307",
"0.7284989",
"0.7273867",
"0.7255279",
"0.7253903",
"0.72169966",
"0.72012585",
"0.71117526",
"0.71013314",
"0.70968163",
"0.707153... | 0.61725616 | 74 |
Return a sequence to file mapping by calling get_seq_to_file on a list of directories. When sequences for files in later directories match those from earlier directories, the later file replaces the earlier one. | def collect_seq_to_file(image_dirs, prefix, suffix):
seq_to_file = {}
for image_dir in image_dirs:
seq_to_file.update(get_seq_to_file(image_dir, prefix, suffix))
return seq_to_file | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _map_files(self, files):\n if getattr(files, '__iter__', None):\n for f in files:\n if not os.path.isabs(f):\n yield os.path.join(self._path, f)\n else:\n yield f\n else:\n if not os.path.isabs(files):\n ... | [
"0.57200646",
"0.5603551",
"0.5428384",
"0.5365151",
"0.53543",
"0.52780384",
"0.52780384",
"0.52640384",
"0.51690215",
"0.5144148",
"0.5144148",
"0.5107793",
"0.50772166",
"0.50669485",
"0.5037193",
"0.5034475",
"0.5030254",
"0.50258476",
"0.5019535",
"0.5009431",
"0.496896"... | 0.6355487 | 0 |
Return the first cmap in the font, we assume it exists and is a unicode cmap. | def get_font_cmap(font):
return font['cmap'].tables[0].cmap | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectfont(self, char):\n\n charcode = ord(char)\n for font in fontchecksequence:\n for fontrange in fontmapping[font]:\n if charcode in xrange(fontrange[0], fontrange[1]):\n return font\n return \"Helvetica\" # fallback, if no thirdparty font ... | [
"0.59702957",
"0.59402055",
"0.5895646",
"0.564658",
"0.5613291",
"0.5608715",
"0.56026316",
"0.552686",
"0.552686",
"0.54798454",
"0.5472726",
"0.54425484",
"0.53768235",
"0.5354973",
"0.5337661",
"0.531796",
"0.52931774",
"0.5281218",
"0.5233462",
"0.5233462",
"0.5229504",
... | 0.8077624 | 0 |
Add cmap format 4 table for Windows support, based on the format 12 cmap. | def add_cmap_format_4(font):
cmap = get_font_cmap(font)
newtable = CmapSubtable.newSubtable(4)
newtable.platformID = 3
newtable.platEncID = 1
newtable.language = 0
# Format 4 only has unicode values 0x0000 to 0xFFFF
newtable.cmap = {cp: name for cp, name in cmap.items() if cp <= 0xFFFF}
font['cmap']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmap_idl4():\n r=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... | [
"0.61801964",
"0.56779355",
"0.5510604",
"0.5491872",
"0.5491872",
"0.5491872",
"0.54730815",
"0.54730815",
"0.5442689",
"0.5442677",
"0.53250027",
"0.5310387",
"0.52932644",
"0.52878886",
"0.51642835",
"0.5120832",
"0.50980926",
"0.5072049",
"0.50696397",
"0.50308245",
"0.50... | 0.83590245 | 0 |
to return a bool value, telling a node in graph being or not being a event node | def is_event(g, node):
if node not in g.nodes():
print('Not a node in the graph')
return False
else:
if g.node[node]['type'] == 'event':
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_node(self, n):\n return n in self.node_dict",
"def is_user(g, node):\n if node not in g.nodes():\n print('Not a node in the graph')\n return False\n elif g.node[node]['type'] == 'user':\n return True\n else:\n return False",
"def is_start_node():\n ret... | [
"0.6641038",
"0.6577558",
"0.64325243",
"0.6401383",
"0.63804096",
"0.6380383",
"0.6378461",
"0.6234613",
"0.6222642",
"0.6216343",
"0.620699",
"0.6203426",
"0.617027",
"0.6130251",
"0.6130251",
"0.6122867",
"0.6108754",
"0.61046404",
"0.6079078",
"0.605906",
"0.60585195",
... | 0.86759436 | 0 |
to return a bool value, telling a node in graph being or not being a user node | def is_user(g, node):
if node not in g.nodes():
print('Not a node in the graph')
return False
elif g.node[node]['type'] == 'user':
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_node(self, u: Hashable) -> bool:\n return u in self._names",
"def has_node(self, u: Hashable) -> bool:\n try:\n self.get_node_by_id(u)\n return True\n except KeyError:\n return False",
"def user_is_nodeadmin(userobj):\n from .node import Node\n ... | [
"0.67041546",
"0.6592569",
"0.64812267",
"0.64284223",
"0.6385174",
"0.6325588",
"0.63175076",
"0.6282001",
"0.6265334",
"0.6210744",
"0.6184324",
"0.6175842",
"0.61406976",
"0.61165345",
"0.61165345",
"0.61143684",
"0.61065114",
"0.60745806",
"0.6074393",
"0.60625255",
"0.60... | 0.867981 | 0 |
Strip the input value if it is a string and returns None if it had only whitespaces | def _strip(value):
if isinstance(value, basestring):
value = value.strip()
if len(value) == 0:
return None
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _nullify(self, value):\n if not str(value).strip():\n return None\n else:\n return value",
"def normalize_content(cls, value: Optional[str]) -> Optional[str]:\n if value and value.strip():\n return value\n\n return None",
"def strip_if_not_blank(... | [
"0.7963226",
"0.7558468",
"0.75185513",
"0.72606844",
"0.70583236",
"0.7019522",
"0.7004776",
"0.6991211",
"0.69583523",
"0.6907512",
"0.68280506",
"0.67513376",
"0.6658939",
"0.65599304",
"0.6554476",
"0.6492995",
"0.6482253",
"0.6471949",
"0.64684564",
"0.6462428",
"0.64537... | 0.8337188 | 0 |
Returns maximum value of a list; 0 if list is empty. | def max_or_zero(list):
try:
return max(list)
except ValueError:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_max(list):\n return find_value_at(list, 0)",
"def maximum(some_list):\n return max(some_list)",
"def max(l):\n if l:\n s_list = sorted(l)\n return s_list[-1]\n else:\n raise ValueError(\"list empty\")",
"def find_greatest_number(incoming_list):\n retval = max(inco... | [
"0.8186424",
"0.7809494",
"0.7699659",
"0.7682465",
"0.7658206",
"0.76157045",
"0.75729984",
"0.7564758",
"0.75142056",
"0.74919003",
"0.74354166",
"0.7420706",
"0.74061656",
"0.7372001",
"0.73590267",
"0.7328897",
"0.7326603",
"0.7325956",
"0.7196364",
"0.71924347",
"0.71229... | 0.8840953 | 0 |
Takes in a model folder path and gets the name of the most recent checkpoint. | def get_most_recent_checkpoint(model_folder):
checkpoints = [a.stem for a in model_folder.glob("*.index")]
latest_checkpoint = sorted(checkpoints, key=lambda x: -int(x.split('-')[-1]))[0]
return latest_checkpoint | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_last_checkpoint(self):\n highest_num, last_checkpoint = -np.inf, None\n for filename in os.listdir(self.logdir):\n # checkpoints look like logdir/model.ckpt-N\n # self._save_path is \"logdir/model.ckpt\"\n if os.path.basename(self._save_path) in filename:\n try:\n N =... | [
"0.8014767",
"0.7837369",
"0.75782955",
"0.7504171",
"0.75004077",
"0.7471074",
"0.7231649",
"0.7204703",
"0.7185792",
"0.7093291",
"0.7090314",
"0.69762653",
"0.69500506",
"0.6923864",
"0.68234986",
"0.6820031",
"0.6701305",
"0.66401935",
"0.6564668",
"0.6563758",
"0.6563527... | 0.8405909 | 0 |
The topological diameter of a network | def topo_diameter(self):
import math
Temp = 0
for i in range(self.nodenum):
for j in range(self.nodenum):
pathlist = []
self.pathij(i, j, pathlist)
distance = []
for k in range(len(pathlist)):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undirected_diameter(self) -> int:\n return nx.diameter(self.to_undirected())",
"def find_diameter(self):\n all_ways = []\n for vertex1 in self.graph.keys():\n for vertex2 in self.graph.keys():\n if vertex2 != vertex1:\n result = self.pathFinder(ve... | [
"0.81324637",
"0.73549366",
"0.7212592",
"0.7079882",
"0.6771153",
"0.6738865",
"0.6738865",
"0.6720883",
"0.6720883",
"0.6712754",
"0.6702523",
"0.65123874",
"0.649436",
"0.6422196",
"0.6353817",
"0.6237044",
"0.6223903",
"0.6211234",
"0.61825013",
"0.6102325",
"0.6092057",
... | 0.80972713 | 1 |
This method is the setter method for self.__value attribute. | def value(self, value):
self.__value = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_value (self):\n raise NotImplementedError",
"def value(self, value):\n\n self._value = value",
"def value(self, value):\n\n self._value = value",
"def value(self, value):\n\n self._value = value",
"def value(self, value):\n\n self._value = value",
"def value(sel... | [
"0.8436878",
"0.8239251",
"0.8239251",
"0.8239251",
"0.8239251",
"0.8239251",
"0.8239251",
"0.8162073",
"0.81347865",
"0.81347865",
"0.81347865",
"0.80020404",
"0.78766996",
"0.78568804",
"0.78568804",
"0.7840692",
"0.783777",
"0.78244156",
"0.78244156",
"0.7804884",
"0.77078... | 0.8672968 | 0 |
Test creating a new tag with invalid payload | def test_create_tag_invalid(self):
payload = {'name': ''}
res = self.client.post(TAGS_URL, payload)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_tag_invalid_payload(self):\n\n tag_payload = {'name': ''}\n response = self.client.post(URL_TAGS, tag_payload)\n\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)",
"def test_create_tag_invalid(self):\n payload = {'name':''}\n res = self.clie... | [
"0.8802175",
"0.8645113",
"0.85850036",
"0.8521736",
"0.84213364",
"0.8288155",
"0.8284713",
"0.810476",
"0.7905386",
"0.7135043",
"0.7107819",
"0.6966567",
"0.68623394",
"0.68487984",
"0.6843626",
"0.6826251",
"0.6824321",
"0.6820896",
"0.67746127",
"0.6761142",
"0.6761142",... | 0.86444473 | 2 |
Return the scipy (marginal) posterior for passed parameter. | def _posterior_marginal_scipy(self, parameter):
letter = parameter.strip().split('_')[1]
A = sum(self._prior_hyperparameters.values())
ai = self.prior_hyperparameters['a_{}'.format(letter)]
N = sum(self._data.values())
ni = self._data[letter]
return _scipy_beta(ai+ni, A-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prior_marginal_scipy(self, parameter):\n letter = parameter.strip().split('_')[1]\n A = sum(self._prior_hyperparameters.values())\n ai = self.prior_hyperparameters['a_{}'.format(letter)]\n\n return _scipy_beta(ai, A-ai)",
"def posterior_parameter(self):\n if self.__posteri... | [
"0.76313055",
"0.6752423",
"0.66483516",
"0.654338",
"0.65295607",
"0.62390584",
"0.6232847",
"0.6205957",
"0.6153562",
"0.61455786",
"0.61181355",
"0.60957754",
"0.6091746",
"0.607018",
"0.6053912",
"0.6013177",
"0.59840304",
"0.59524983",
"0.59475017",
"0.5921584",
"0.59039... | 0.8680153 | 0 |
Plot parameter prior pdf using passed matplotlib ax. | def _plot_prior_pdf(self, parameter, ax, **kwargs):
y_label = kwargs.pop('y_label', 'Prior pdf')
x_label = kwargs.pop('x_label', parameter)
x_min = self.distribution_parameter_support[parameter][0]
x_max = self.distribution_parameter_support[parameter][1]
dx = (x_max - x_min)/10... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_parameter_prior(self, parameter, **kwargs):\n width = kwargs.pop('width', 8)\n height = kwargs.pop('height', 3)\n y_label = kwargs.pop('y_label', 'Prior pdf')\n x_label = kwargs.pop('x_label', parameter)\n\n fig, ax = plt.subplots(1, 1, figsize=(width, height))\n ... | [
"0.73476464",
"0.7303399",
"0.6752052",
"0.6730011",
"0.64765376",
"0.6355472",
"0.63546145",
"0.6144492",
"0.61285305",
"0.61122084",
"0.6061205",
"0.6047029",
"0.60294515",
"0.6026977",
"0.6016804",
"0.60077846",
"0.6004579",
"0.59469926",
"0.5939574",
"0.59349275",
"0.5882... | 0.7894863 | 0 |
Return the prior mean for the specified parameter. | def prior_mean(self, parameter):
if parameter not in self:
raise ConjugateParameterException('Parameter not recognized!')
else:
i = parameter.split('_')[1]
ai = self.prior_hyperparameters['a_{}'.format(i)]
A = sum(self.prior_hyperparameters.values())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def posterior_mean(self, parameter):\n if parameter not in self:\n raise ConjugateParameterException('Parameter not recognized!')\n else:\n i = parameter.split('_')[1]\n ai = self.prior_hyperparameters['a_{}'.format(i)]\n A = sum(self.prior_hyperparameters.... | [
"0.77960056",
"0.6811811",
"0.66823816",
"0.6575153",
"0.6534252",
"0.64853966",
"0.647731",
"0.6443126",
"0.6428318",
"0.6391523",
"0.637634",
"0.637634",
"0.63282377",
"0.6326249",
"0.63238055",
"0.6319615",
"0.6297563",
"0.62542635",
"0.62487966",
"0.6244395",
"0.62282336"... | 0.84788823 | 0 |
Return the posterior mean for the specified parameter. | def posterior_mean(self, parameter):
if parameter not in self:
raise ConjugateParameterException('Parameter not recognized!')
else:
i = parameter.split('_')[1]
ai = self.prior_hyperparameters['a_{}'.format(i)]
A = sum(self.prior_hyperparameters.values())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prior_mean(self, parameter):\n if parameter not in self:\n raise ConjugateParameterException('Parameter not recognized!')\n else:\n i = parameter.split('_')[1]\n ai = self.prior_hyperparameters['a_{}'.format(i)]\n A = sum(self.prior_hyperparameters.valu... | [
"0.7408755",
"0.65426844",
"0.632092",
"0.62143314",
"0.6206901",
"0.6185513",
"0.6135589",
"0.60521066",
"0.60307956",
"0.6003379",
"0.5967519",
"0.5956202",
"0.5956033",
"0.58950335",
"0.5886061",
"0.5871528",
"0.5861594",
"0.5857031",
"0.5856158",
"0.58520925",
"0.5850065"... | 0.84081346 | 0 |
Return a sample of the passed parameter from the (marginal) Beta posterior. | def posterior_sample_parameter(self, parameter):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _posterior_marginal_scipy(self, parameter):\n letter = parameter.strip().split('_')[1]\n A = sum(self._prior_hyperparameters.values())\n ai = self.prior_hyperparameters['a_{}'.format(letter)]\n N = sum(self._data.values())\n ni = self._data[letter]\n\n return _scipy_be... | [
"0.6756069",
"0.6750759",
"0.66246235",
"0.6472297",
"0.64247423",
"0.6420742",
"0.6349176",
"0.6337736",
"0.6292265",
"0.6280987",
"0.62556845",
"0.62541556",
"0.61511225",
"0.6149604",
"0.61478007",
"0.61154574",
"0.61002386",
"0.6087288",
"0.6086534",
"0.6082683",
"0.60768... | 0.7203621 | 0 |
Gets a collection of `InputExample`s for the train set. | def get_train(self, data_file):
return self.read_data(data_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_inputs(self, example):\n return example",
"def get_train_examples(self):\n raise NotImplementedError()",
"def get_train_examples(self, input_file):\r\n raise NotImplementedError()",
"def _create_examples(self, data, set_type):\n examples = []\n for (i, elem) in en... | [
"0.73513573",
"0.71743697",
"0.71278554",
"0.6560718",
"0.6422419",
"0.6403078",
"0.6340598",
"0.62880164",
"0.6281034",
"0.6251411",
"0.6248832",
"0.6248533",
"0.6248533",
"0.6248533",
"0.6248533",
"0.6248533",
"0.6248533",
"0.6248533",
"0.6248533",
"0.6248533",
"0.6248533",... | 0.0 | -1 |
Gets a collection of `InputExample`s for the dev set. | def get_dev(self, data_file):
return self.read_data(data_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dev_examples(self, input_file):\r\n raise NotImplementedError()",
"def get_train_inputs(self, example):\n return example",
"def get_examples(self, env):\n return self.fam.c_get_examples(self, env)",
"def get_dev_examples(self):\n raise NotImplementedError()",
"def _create_ex... | [
"0.68112403",
"0.6588688",
"0.655683",
"0.6552607",
"0.64272827",
"0.63816285",
"0.6255956",
"0.61930686",
"0.61160946",
"0.6094262",
"0.6054992",
"0.6051947",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",... | 0.0 | -1 |
Tests the space group finder that returns all the rotation matrices for a lattice. | def test_4_sgops(self):
from celib.symmetry_module import get_spacegroup
result = get_spacegroup(self.lattice, self.atomtypes, self.basis, True, 1e-10)
#The FCC lattice has 48 point group operations; we want to check each of them
#against the correct values.
self.assertEqual(resu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extractRotate(self,groups):\n self.rotate = math.pi * float(groups[0]) / 180\n self.rX = 0\n self.rY = 0\n if len(groups) == 3:\n if groups[1]:\n \tself.rX = float(groups[1])\n if groups[2]:\n \tself.rY = float(groups[2])\n\n #alpha... | [
"0.5698659",
"0.54044193",
"0.5292343",
"0.5281485",
"0.52310616",
"0.5200369",
"0.5081966",
"0.50813",
"0.5076169",
"0.5004332",
"0.4996704",
"0.49837616",
"0.49610397",
"0.4957767",
"0.49557602",
"0.49485978",
"0.49470687",
"0.4946389",
"0.49309647",
"0.49233016",
"0.491659... | 0.4605593 | 68 |
Return the local minimum's index given a stating point. Note that this is not robust for noisy data and will always move down the indices if placed at a peak. The extra numerical factors require a minimum slope. | def lmin(scape, start):
i = start
while scape[i - 1] < scape[i] - 0.06:
i -= 1
while scape[i + 1] < scape[i] - 0.06:
i += 1
return i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_minimum(signal, index, max_samples_to_search):\n search_end_idx = min(index + max_samples_to_search, signal.shape[0])\n min_idx = np.argmin(signal[index:search_end_idx])\n return index + min_idx",
"def minimum_index(self):\n return self._minidx",
"def index_of_min(deck, firstIndex)... | [
"0.6898985",
"0.68027645",
"0.6574405",
"0.65286124",
"0.6485343",
"0.64324343",
"0.63863814",
"0.6375529",
"0.6361183",
"0.63559335",
"0.63392276",
"0.6315246",
"0.628172",
"0.6277534",
"0.62705564",
"0.62344897",
"0.62030107",
"0.62029105",
"0.61941874",
"0.6159487",
"0.612... | 0.56837535 | 64 |
Return the name of the sensor. | def name(self):
return self.robot.name + ' ' + SWITCH_TYPES[self.type][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso... | [
"0.91896784",
"0.9168378",
"0.890185",
"0.8770976",
"0.8511273",
"0.8479953",
"0.844435",
"0.8299758",
"0.8186503",
"0.8105667",
"0.8079737",
"0.8066149",
"0.8049647",
"0.7700968",
"0.7612295",
"0.7611456",
"0.7600605",
"0.7600605",
"0.7600605",
"0.75392073",
"0.75166553",
... | 0.0 | -1 |
Returns list of product variables as ``Variable`` or ``SpectralVariable`` class objects. | def readVariables(self, product):
data_variables = self.getDataVariables(product)
mask_variables = self.getMaskVariables(product)
meteorological_variables = self.getMeteorologicalVariables(product)
sensor_variables = self.getSensorVariables(product)
info_variables = self.get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDataVariables(self, product):\r\n\r\n data_variable_names = self.getDataVariableNames(product)\r\n data_variables = [self.createDataVariable(product, n) for n in data_variable_names]\r\n data_variables = [self.editDataVariable(product, v) for v in data_variables]\r\n\r\n return d... | [
"0.6673094",
"0.65489125",
"0.65141535",
"0.6480595",
"0.64581805",
"0.6349883",
"0.62883854",
"0.6119275",
"0.6116998",
"0.61092746",
"0.61028063",
"0.6033775",
"0.6020363",
"0.6013184",
"0.5978308",
"0.59124255",
"0.5902464",
"0.590174",
"0.59011734",
"0.5892988",
"0.587968... | 0.61185414 | 8 |
Returns list of product "data" type variables as ``Variable`` or `SpectralVariable` class objects. | def getDataVariables(self, product):
data_variable_names = self.getDataVariableNames(product)
data_variables = [self.createDataVariable(product, n) for n in data_variable_names]
data_variables = [self.editDataVariable(product, v) for v in data_variables]
return data_variables | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _variable_types(self):\n return self._variable_single_types + self._variable_array_types",
"def vars(self):\n return [Var(i,self.dims[i]) for i in range(self.nvar)] # TODO: use stored state info (=1 sometimes)",
"def getDataVariableNames(self, product):\r\n return []",
"def variables(se... | [
"0.66370356",
"0.6517246",
"0.6436121",
"0.6391193",
"0.63387704",
"0.63354594",
"0.6333873",
"0.6284197",
"0.62416744",
"0.61944",
"0.61532813",
"0.60988384",
"0.60918325",
"0.60885936",
"0.5961736",
"0.5950214",
"0.59378254",
"0.593155",
"0.592988",
"0.59269077",
"0.5919450... | 0.7200427 | 0 |
Returns list of product "mask" type variables as ``Variable`` class objects. | def getMaskVariables(self, product):
mask_variable_names = self.getMaskVariableNames(product)
mask_variables = [self.createMaskVariable(product, n) for n in mask_variable_names]
mask_variables = [self.editMaskVariable(product, v) for v in mask_variables]
return mask_variables | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMaskVariableNames(self, product):\r\n return []",
"def getMaskVariableNames(self, product):\r\n\r\n h = product.getSceneRasterHeight()\r\n\r\n # 10m resolution\r\n if h == 10980:\r\n return self.return_available_variables(product, MASK_VARIABLE_NAMES_10m)\r\n\r\n ... | [
"0.6821693",
"0.6388557",
"0.6255446",
"0.62545663",
"0.6193279",
"0.6131361",
"0.609196",
"0.6068199",
"0.592613",
"0.5925131",
"0.58977854",
"0.5893189",
"0.58479047",
"0.57421154",
"0.5694922",
"0.5686976",
"0.5645195",
"0.56333876",
"0.56333876",
"0.56333876",
"0.5556208"... | 0.73823506 | 0 |
Returns list of product "meteorological" type variables as ``Variable`` class objects. | def getMeteorologicalVariables(self, product):
meteorological_variable_names = self.getMeteorologicalVariableNames(product)
meteorological_variables = [self.createMeteorologicalVariable(product, n) for n in meteorological_variable_names]
meteorological_variables = [self.editMeteorologicalVari... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _variable_types(self):\n return self._variable_single_types + self._variable_array_types",
"def variables(self):\n return {u for u in self if u.type == 'var'}",
"def vars(self):\n return [Var(i,self.dims[i]) for i in range(self.nvar)] # TODO: use stored state info (=1 sometimes)",
"def ... | [
"0.6879589",
"0.64656603",
"0.6390412",
"0.63594055",
"0.63440067",
"0.631634",
"0.6309914",
"0.6253169",
"0.62341386",
"0.61652195",
"0.6118893",
"0.6115976",
"0.60680306",
"0.6055131",
"0.60370594",
"0.6022582",
"0.6014393",
"0.6000987",
"0.5993063",
"0.5991066",
"0.5974143... | 0.67884076 | 1 |
Returns list of product "sensor" type variables as ``Variable`` class objects. | def getSensorVariables(self, product):
sensor_variable_names = self.getSensorVariableNames(product)
sensor_variables = [self.createSensorVariable(product, n) for n in sensor_variable_names]
sensor_variables = [self.editSensorVariable(product, v) for v in sensor_variables]
return se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSensorVariableNames(self, product):\r\n\r\n return []",
"def getSensorVariableNames(self, product):\r\n return []",
"def _variable_types(self):\n return self._variable_single_types + self._variable_array_types",
"def vars(self):\n return [Var(i,self.dims[i]) for i in range(self... | [
"0.6750072",
"0.6716479",
"0.6492746",
"0.6474434",
"0.6394079",
"0.63495994",
"0.62539953",
"0.62413377",
"0.6215323",
"0.6193386",
"0.61144584",
"0.60982084",
"0.6068696",
"0.60247207",
"0.60168356",
"0.59995025",
"0.59842956",
"0.59350985",
"0.5907617",
"0.59062946",
"0.58... | 0.7740241 | 0 |
Returns "sensor" type `Variable` class objects, for given product variable | def createSensorVariable(self, product, variable_name):
sensor_variable_dict = {'name': variable_name,
'dtype': None,
'vtype': 'sensor',
'units': None,
'ndims': None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSensorVariables(self, product):\r\n sensor_variable_names = self.getSensorVariableNames(product)\r\n sensor_variables = [self.createSensorVariable(product, n) for n in sensor_variable_names]\r\n sensor_variables = [self.editSensorVariable(product, v) for v in sensor_variables]\r\n\r\n ... | [
"0.71037596",
"0.6081413",
"0.606984",
"0.6044338",
"0.58650655",
"0.58245784",
"0.5769328",
"0.5735407",
"0.57089734",
"0.5650917",
"0.5636367",
"0.5608584",
"0.5593829",
"0.5584411",
"0.558125",
"0.5575986",
"0.5564306",
"0.55297095",
"0.55143905",
"0.55136764",
"0.5427982"... | 0.70375246 | 1 |
Return dictionary of product attributes | def readAttributes(self, product):
return {"product_string": None} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attributes(self) -> Dict[str, str]:\n pass",
"def get_attributes(self):\n\n endpoint = self._get_api_endpoint() + '/attributes'\n results = self.tq.get(endpoint, withp='attribute')\n if 'data' not in results:\n return {}\n\n return results['data']\n # ... | [
"0.71890765",
"0.70803684",
"0.70581627",
"0.6945636",
"0.6945636",
"0.6945636",
"0.68543226",
"0.68158424",
"0.67674136",
"0.67346096",
"0.67291784",
"0.67128557",
"0.6711666",
"0.67089134",
"0.6695861",
"0.6653375",
"0.6648942",
"0.6634209",
"0.65978914",
"0.65826434",
"0.6... | 0.79112864 | 0 |
Given a Divisor and a Bound , Find the largest integer N , Such That , | def max_multiple(divisor: int, bound: int) -> int:
while bound > 0:
if bound % divisor == 0:
return bound
bound -= 1
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constrain(n: int, low: int, high: int) -> int:\n return max(min(n, high), low)",
"def largestV(a, b, x):\n v = a - 1\n while (binom(v, b) > x):\n v -= 1\n return v",
"def random_int_below(upper_bound):\r\n \r\n try:\r\n upper_bound = int(upper_bound)\r\n except ValueError:\r\n r... | [
"0.7100869",
"0.6582037",
"0.6556253",
"0.6473116",
"0.645128",
"0.6407993",
"0.63761735",
"0.6345415",
"0.63397336",
"0.623664",
"0.623165",
"0.6208433",
"0.61841863",
"0.6173743",
"0.6166029",
"0.6160189",
"0.6142218",
"0.6140274",
"0.6140274",
"0.6126571",
"0.60343826",
... | 0.7975764 | 0 |
This generates a salt from 24 random bytes from an OSspecific randomness source. The returned data should be unpredictable enough for cryptographic applications, though its exact quality depends on the OS implementation. | def gensalt():
return hexlify(os.urandom(24)).decode() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_salt():\n return os.urandom(32)",
"def generate_salt(size):\n return hexlify(urandom(size)).decode()",
"def gen_salt(salt_len):\n return bytes([random.choice(SALT_SYMBOLS) for _ in range(salt_len)])",
"def gensalt(log_rounds=12):\n\n return _encode_salt(os.urandom(16), min(max(log_rounds,... | [
"0.7874136",
"0.7557884",
"0.74225837",
"0.6882084",
"0.6810053",
"0.67966956",
"0.6780011",
"0.67797995",
"0.67797995",
"0.67470133",
"0.67338526",
"0.64085406",
"0.63891435",
"0.63775766",
"0.6352436",
"0.6305246",
"0.6251377",
"0.6206848",
"0.6161566",
"0.61504525",
"0.614... | 0.72840464 | 3 |
Get total Sale Price. | def _get_toal_sp_(obj):
fTotalSP = 0.0
for item in obj.order_line:
fTotalSP += item.price_subtotal
return fTotalSP | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sale_price(self):\n if self.sold_on is not None:\n return 0.0 # Already sold\n return 5000.0 * self.wheels",
"def sale_price(self):\n if self.sold_on is not None:\n return 0.0 # Already sold\n return 5000.0 * self.wheels",
"def sale_price(self):\n ... | [
"0.7759613",
"0.7759613",
"0.7759613",
"0.7597612",
"0.7426395",
"0.7359071",
"0.7303887",
"0.7303887",
"0.72452945",
"0.72202235",
"0.7216077",
"0.71286404",
"0.7081923",
"0.7066995",
"0.7028116",
"0.7008929",
"0.6972375",
"0.6955347",
"0.69491374",
"0.69467616",
"0.694145",... | 0.64721996 | 55 |
Get a supplier of current line product. | def _get_supplier_(obj, line):
iNo = 0
strRet = None
for item in obj.order_line:
iNo += 1
if (item.id == line.id):
if (len(item.product_id.seller_ids)>0):
strRet = item.product_id.seller_ids[0] and item.product_id.seller_ids[0].name.name or None
b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_suppliers(self):\n return Product.objects.get(id=self.id).supplier_set.all()",
"def get_value(self):\n if callable(self.supplier):\n return self.supplier()\n return None",
"def getServiceSupplier(self):\n return self._ServiceSupplier",
"def load_supplier_table(s... | [
"0.64133656",
"0.63187885",
"0.6049192",
"0.58041596",
"0.5619052",
"0.5593138",
"0.55110204",
"0.5473946",
"0.5470719",
"0.5439386",
"0.5436191",
"0.54032654",
"0.53969985",
"0.53848344",
"0.53772223",
"0.5364426",
"0.5361436",
"0.5347504",
"0.53167635",
"0.53167635",
"0.531... | 0.7412126 | 0 |
Sets the display_name of this DocuViewareCertificate. | def display_name(self, display_name):
self._display_name = display_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_name(self, display_name: str):\n\n self._display_name = display_name",
"def display_name(self, display_name):\n self._display_name = display_name",
"def display_name(self, display_name):\n self._display_name = display_name",
"def display_name(self, display_name):\n sel... | [
"0.76669747",
"0.75461864",
"0.75461864",
"0.75461864",
"0.75461864",
"0.75461864",
"0.75461864",
"0.7496336",
"0.6860233",
"0.6674837",
"0.66596836",
"0.6504475",
"0.6333702",
"0.6273019",
"0.6112418",
"0.56817055",
"0.55757827",
"0.55757827",
"0.55757827",
"0.55757827",
"0.... | 0.76356727 | 4 |
Sets the password of this DocuViewareCertificate. | def password(self, password):
self._password = password | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password(self, password):\n from kalon.auth import encrypt_password\n self.document.password = encrypt_password(password)",
"def set_password(self, password):\n self.password = password",
"def set_password(self, password):\n self.PASS = password",
"def set_password(self, p... | [
"0.7717396",
"0.7409183",
"0.7385214",
"0.73271275",
"0.7299657",
"0.7247361",
"0.7197626",
"0.7187312",
"0.70104456",
"0.6977275",
"0.6967492",
"0.6904367",
"0.6895133",
"0.68860495",
"0.68661994",
"0.6856501",
"0.6831577",
"0.6824606",
"0.67926687",
"0.67926687",
"0.6781761... | 0.7262863 | 6 |
Sets the timestamp_server_uri of this DocuViewareCertificate. | def timestamp_server_uri(self, timestamp_server_uri):
self._timestamp_server_uri = timestamp_server_uri | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_server_user_password(self, timestamp_server_user_password):\n\n self._timestamp_server_user_password = timestamp_server_user_password",
"def setServer(self, server):\n libxml2mod.xmlURISetServer(self._o, server)",
"def client_x509_cert_url(self, client_x509_cert_url):\n\n sel... | [
"0.5899968",
"0.58443666",
"0.57003057",
"0.56740457",
"0.5608553",
"0.55392957",
"0.55392957",
"0.55392957",
"0.55392957",
"0.55392957",
"0.55392957",
"0.55392957",
"0.5527041",
"0.55142653",
"0.5496049",
"0.5496049",
"0.5308467",
"0.530545",
"0.529187",
"0.5173793",
"0.5159... | 0.81117606 | 0 |
Sets the timestamp_server_user_name of this DocuViewareCertificate. | def timestamp_server_user_name(self, timestamp_server_user_name):
self._timestamp_server_user_name = timestamp_server_user_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_server_user_password(self, timestamp_server_user_password):\n\n self._timestamp_server_user_password = timestamp_server_user_password",
"def timestamp_server_uri(self, timestamp_server_uri):\n\n self._timestamp_server_uri = timestamp_server_uri",
"def set_uname(self, username):\n ... | [
"0.70667785",
"0.61226904",
"0.6117793",
"0.6074107",
"0.558692",
"0.5516358",
"0.5507451",
"0.54474777",
"0.54211557",
"0.538357",
"0.5376872",
"0.534631",
"0.534631",
"0.534631",
"0.534631",
"0.534631",
"0.534631",
"0.534631",
"0.534631",
"0.534631",
"0.53356355",
"0.5329... | 0.8281697 | 0 |
Sets the timestamp_server_user_password of this DocuViewareCertificate. | def timestamp_server_user_password(self, timestamp_server_user_password):
self._timestamp_server_user_password = timestamp_server_user_password | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_server_user_name(self, timestamp_server_user_name):\n\n self._timestamp_server_user_name = timestamp_server_user_name",
"def set_password(self, password):\n from kalon.auth import encrypt_password\n self.document.password = encrypt_password(password)",
"def set_password(self,... | [
"0.6508013",
"0.62661606",
"0.6208464",
"0.6122581",
"0.595476",
"0.5936785",
"0.59284014",
"0.5900181",
"0.58858687",
"0.5847365",
"0.58363277",
"0.57710904",
"0.5769611",
"0.57676387",
"0.5742726",
"0.570235",
"0.5683581",
"0.56833714",
"0.56833714",
"0.56833714",
"0.568337... | 0.8525406 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, DocuViewareCertificate):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, DocuViewareCertificate):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Appends the given tag to the contents of this tag. | def append(self, tag):
self.insert(len(self.contents), tag) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_tag(self, tag):\n if tag not in self._tag:\n self._tag.append(tag)\n\n return self",
"def add_tag(self, tag):\n cp = self.copy()\n cp.tags.add(tag)\n return cp",
"def add_tag(self, tag):\n self.tags.append(tag)",
"def add_tag(self, tag: str) -> Non... | [
"0.70069104",
"0.6814596",
"0.6761336",
"0.6722421",
"0.62967855",
"0.6246681",
"0.6173467",
"0.5934135",
"0.59195983",
"0.58950955",
"0.587808",
"0.5853093",
"0.5808527",
"0.57641244",
"0.575272",
"0.5741883",
"0.572421",
"0.5709216",
"0.566572",
"0.56350446",
"0.56336284",
... | 0.855696 | 0 |
Returns the first item that matches the given criteria and appears after this Tag in the document. | def findNext(self, name=None, attrs={}, text=None, **kwargs):
return self._findOne(self.findAllNext, name, attrs, text, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_after(self, **opts):\n return self.parser.first(search_after=self, **opts)",
"def find_after(self, **opts):\n return self.parser.find(search_after=self, **opts)",
"def after(self):\n if self._last_item:\n if self.items_count <= self.page_limit and self._items_count_aft... | [
"0.6296708",
"0.62482417",
"0.60613966",
"0.57909214",
"0.5694481",
"0.5646614",
"0.55756783",
"0.5358776",
"0.5325472",
"0.52817196",
"0.5257027",
"0.5241261",
"0.52172786",
"0.52167696",
"0.5201796",
"0.51998675",
"0.51245713",
"0.51127404",
"0.50674105",
"0.5050638",
"0.50... | 0.5045595 | 20 |
Returns the first item that matches the given criteria and appears before this Tag in the document. | def findPrevious(self, name=None, attrs={}, text=None, **kwargs):
return self._findOne(self.findAllPrevious, name, attrs, text, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before(self):\n if self._first_item:\n if self.items_count <= self.page_limit and self._items_count_before_first_item > 0:\n return self._first_item\n return None",
"def find_first_tag(self, tag):\n for lm, _ in self.search(tag=tag):\n return lm",
"... | [
"0.713459",
"0.5871199",
"0.55292624",
"0.5518544",
"0.5507421",
"0.5507204",
"0.5501318",
"0.54121214",
"0.5406256",
"0.5401401",
"0.5382331",
"0.53574866",
"0.53268796",
"0.5321099",
"0.53132635",
"0.5289827",
"0.52808315",
"0.52805835",
"0.52720207",
"0.52692795",
"0.52243... | 0.4970831 | 47 |
Returns true iff this tag is not identical to the other tag, as defined in __eq__. | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__ (self, other):\n return not self == other",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other: 'Attribute') -> bool:\n return not self == other",
"def __ne__(self, other):\n # type: (object) -> bool\n return not self == o... | [
"0.8204736",
"0.8196523",
"0.81185234",
"0.80999553",
"0.80999553",
"0.80999553",
"0.8095061",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",
"0.8094383",... | 0.8108378 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.