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 |
|---|---|---|---|---|---|---|
Sort a batch first tensor by some specified lengths. | def sort_batch_by_length(tensor: torch.Tensor, sequence_lengths: torch.Tensor): # pragma: no cover
if not isinstance(tensor, torch.Tensor) or not isinstance(sequence_lengths, torch.Tensor):
raise ValueError("Both the tensor and sequence lengths must be torch.Tensors.")
sorted_sequence_lengths, permut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_sequence(tensor, lengths, batch_first=False):\n idx = None\n if batch_first:\n idx = 0\n else:\n idx = 1 \n\n sorted_lengths, indices = torch.sort(lengths, dim=0, descending=True)\n new_tensor = torch.index_select(tensor, idx, indices)\n return new_tensor, sorted_lengths, i... | [
"0.7724261",
"0.69436157",
"0.6844491",
"0.6843462",
"0.6521751",
"0.64858633",
"0.6468342",
"0.6313309",
"0.6261741",
"0.6215167",
"0.6071167",
"0.6047345",
"0.6037141",
"0.5877621",
"0.57658434",
"0.5735705",
"0.5731621",
"0.5663803",
"0.5609692",
"0.55841684",
"0.5505005",... | 0.71572137 | 1 |
After the RNN has run forward, the states need to be updated. This method just sets the state to the updated new state, performing several pieces of bookkeeping along the way namely, unsorting the states and ensuring that the states of completely padded sequences are not updated. Finally, it also detaches the state var... | def _update_states(
self, final_states: RnnStateStorage, restoration_indices: torch.LongTensor
) -> None:
# TODO(Mark): seems weird to sort here, but append zeros in the subclasses.
# which way around is best?
new_unsorted_states = [state.index_select(1, restoration_indices) for stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_reservoir(self):\n self.state = np.zeros((self.state_size,1),dtype=self.typefloat)",
"def reset(self, initial_read: np.ndarray = None):\n # Reset the network back to zero inputs\n self.rnn_state = np.zeros((self.bs, self.n_rnn, 1), dtype=self.dtype) # RNN outputs are single float\... | [
"0.6610135",
"0.65826535",
"0.6549108",
"0.6498498",
"0.6406637",
"0.6341982",
"0.63399833",
"0.6326141",
"0.63115764",
"0.63104784",
"0.62701285",
"0.62633973",
"0.6258822",
"0.62395835",
"0.62327385",
"0.6226765",
"0.62249744",
"0.6216144",
"0.6213042",
"0.6186836",
"0.6180... | 0.63758636 | 5 |
Creates block for additional layer on the top of Yolo | def yoloConvBlock(inputs, filters, training, data_format):
inputs = conv2D_fiexed_padding(inputs,
filters=filters,
kernel_size=1,
data_format=data_format)
inputs = batchNorm(inputs,
tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_layer(self, X, name, block, num_blocks, out_channels):\n\n for i in range(0, num_blocks):\n X = block(X, name = name + '_block{}'.format(i), out_channels=out_channels)\n return X",
"def make_layer(basic_block, num_basic_block, **kwarg):\n layers = []\n for _ in range(num_... | [
"0.6571643",
"0.6400423",
"0.6317208",
"0.62309486",
"0.6218364",
"0.61357737",
"0.61288464",
"0.6088831",
"0.6061056",
"0.60530674",
"0.60400337",
"0.60349166",
"0.5993262",
"0.599026",
"0.5964414",
"0.59249586",
"0.5900055",
"0.58406895",
"0.58327127",
"0.5814586",
"0.57737... | 0.52822113 | 74 |
Callable to get the current FAST_PATH. Notes It's too dangerous to use ``FAST_PATH`` directly as it can change between import and runtime. For example, a module that does ``from armi.context import FAST_PATH`` is disconnected from the official ``FAST_PATH`` controlled by this module. | def getFastPath() -> str:
return _FAST_PATH | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activateLocalFastPath() -> None:\n global _FAST_PATH, _FAST_PATH_IS_TEMPORARY, APP_DATA\n\n # Try to fix pathing issues in Windows.\n if os.name == \"nt\":\n APP_DATA = APP_DATA.replace(\"/\", \"\\\\\")\n\n _FAST_PATH = os.path.join(\n APP_DATA,\n \"{}{}-{}\".format(\n ... | [
"0.60882795",
"0.605693",
"0.59744304",
"0.59591717",
"0.58974904",
"0.5862997",
"0.58501434",
"0.57836175",
"0.5762772",
"0.57626957",
"0.5759677",
"0.57438505",
"0.5720141",
"0.57143867",
"0.56692713",
"0.56607157",
"0.5652313",
"0.56497383",
"0.56156147",
"0.56033456",
"0.... | 0.78833216 | 0 |
Recursive list of files in `root` for which `accept` is True. | def files_from_root(root, accept):
for (dir_path, _dir_names, file_names) in os.walk(root, followlinks=True):
for file_name in file_names:
if accept(file_name):
path = os.path.join(dir_path, file_name)
yield path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files_from_roots(roots, accept):\n for root in roots:\n if root is not None:\n yield from files_from_root(root, accept)",
"def list_and_filter(self, pattern, root_path):\n for path, dirs, files in os.walk(os.path.abspath(root_path)):\n for filename in fnmatch.filter(files, patter... | [
"0.7324623",
"0.6678171",
"0.65009624",
"0.6424164",
"0.63775784",
"0.634527",
"0.6330603",
"0.61771095",
"0.61700517",
"0.6140535",
"0.6119523",
"0.6116006",
"0.61089087",
"0.61089087",
"0.60989136",
"0.60097593",
"0.5978241",
"0.59675187",
"0.59561133",
"0.59477156",
"0.594... | 0.7743396 | 0 |
`files_from_root` for each nonNone root in `roots`. | def files_from_roots(roots, accept):
for root in roots:
if root is not None:
yield from files_from_root(root, accept) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files_from_root(root, accept):\n for (dir_path, _dir_names, file_names) in os.walk(root, followlinks=True):\n for file_name in file_names:\n if accept(file_name):\n path = os.path.join(dir_path, file_name)\n yield path",
"def list_all_files(root):\n local... | [
"0.7021418",
"0.700054",
"0.6979969",
"0.6979969",
"0.6870376",
"0.6625571",
"0.6555373",
"0.6454558",
"0.64163804",
"0.6379745",
"0.63219464",
"0.6293437",
"0.6272975",
"0.6258986",
"0.62472296",
"0.62086666",
"0.6178142",
"0.6155295",
"0.6117345",
"0.6102557",
"0.6099181",
... | 0.79726034 | 0 |
Source file name for cached `json_name`. `file_name` is supposed to be a `clean_path`. The function can be invoked on non`clean_path`, but it will not be relevant. | def get_source_file_name(json_name):
assert json_name.endswith(JSON_EXT)
(directory, base_name) = os.path.split(json_name)
new_directory = os.path.relpath(directory, start=CACHE)
new_directory = os.path.join("/", new_directory)
new_base_name = base_name[:-len(JSON_EXT)]
i = new_base_name.rfind("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_pathless_raw_file_name_json(self):\n\n this_pathless_file_name = probsevere_io._get_pathless_raw_file_name(\n unix_time_sec=VALID_TIME_UNIX_SEC,\n file_extension=probsevere_io.JSON_FILE_EXTENSION)\n\n self.assertTrue(this_pathless_file_name == PATHLESS_JSON_FILE_NAM... | [
"0.65274745",
"0.60142744",
"0.5981841",
"0.5979348",
"0.59530264",
"0.5897203",
"0.58208066",
"0.5801662",
"0.57683647",
"0.57652867",
"0.57648027",
"0.575628",
"0.575283",
"0.57473785",
"0.5746032",
"0.57209015",
"0.5702706",
"0.56992",
"0.569025",
"0.5617208",
"0.5575295",... | 0.76126736 | 0 |
Invoke `patsopt jsonize2` on `file_name`. Backup the content in cache and return the content as a JSON object. `file_name` is assumed to be from `environment.which`. | def make_cached_json(file_name):
result = None
path = clean_path(file_name)
working_directory = os.path.split(os.path.abspath(file_name))[0]
file_type_switch = "-s" if is_sats_file(file_name) else "-d"
command = []
command.append("patsopt")
command.append("--jsonize-2")
command.append(fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_json(file_name):\n result = None\n path = environment.which(file_name)\n if path is not None:\n result = get_json_from_cache(path)\n if result is None:\n result = make_cached_json(path)\n return result",
"def get_json_from_cache(file_name):\n result = None\n pat... | [
"0.74878883",
"0.65308976",
"0.62760246",
"0.6252161",
"0.61996615",
"0.6184463",
"0.61573595",
"0.6019261",
"0.5950648",
"0.59505975",
"0.575985",
"0.5758125",
"0.5697089",
"0.5679286",
"0.56600976",
"0.56074715",
"0.5603026",
"0.5535352",
"0.551096",
"0.54855394",
"0.547109... | 0.84522766 | 0 |
Yield cached JSON file names. | def cached_files():
for (dir_path, _dir_names, file_names) in os.walk(CACHE):
for file_name in file_names:
if is_json_file(file_name):
yield os.path.join(dir_path, file_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_cached():\n for json_name in cached_files():\n source_name = get_source_file_name(json_name)\n yield (json_name, source_name)",
"def files():\n return get_cached(\"files.json\")",
"def get_all_cached_files(cache_dir=None):\n if cache_dir is None:\n cache_dir = TRANSFORMER... | [
"0.8255684",
"0.7748787",
"0.69488394",
"0.6355367",
"0.622507",
"0.61023486",
"0.606647",
"0.5963534",
"0.5929145",
"0.59097606",
"0.5899345",
"0.588221",
"0.58737516",
"0.58708644",
"0.5863449",
"0.58517885",
"0.5819335",
"0.5810678",
"0.58006537",
"0.5793024",
"0.5792372",... | 0.84436315 | 0 |
Returns an array of all the bodyparts labelled for a specific project | def get_bodyparts(project_dir):
print(f"\n\n\nLoading data")
df_paths = sorted(glob.glob(os.path.join(project_dir, '*.h5')))
points_2d_df = utils.create_dlc_points_2d_file(df_paths)
arr = points_2d_df[points_2d_df["frame"]==0][["marker"]][points_2d_df["camera"]==0].values
final_arr = arr.flatten().t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_body_names():\n return [bi.body_name for bi in get_body_infos()]",
"def get_body_part_names(self):\n self.x_cols, self.y_cols, self.p_cols = [], [], []\n for bp in self.body_parts_lst:\n self.x_cols.append(f\"{bp}_x\")\n self.y_cols.append(f\"{bp}_y\")\n ... | [
"0.5924533",
"0.5851983",
"0.5332319",
"0.5228887",
"0.5177854",
"0.5096487",
"0.50235313",
"0.4949935",
"0.4935677",
"0.49348524",
"0.49242568",
"0.48989278",
"0.48819113",
"0.48530495",
"0.48119307",
"0.48087025",
"0.48074394",
"0.48022595",
"0.47842735",
"0.47667518",
"0.4... | 0.6495619 | 0 |
Return a list of field names that have a value of None. | def get_empty_fields(self):
return [f for f in self.__dict__ if not self.__dict__[f]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_optional_fields(cls) -> List[str]:\n ret: List[str] = []\n for f in fields(cls):\n # Check if exactly two arguments exists and one of them are None type\n if hasattr(f.type, \"__args__\") and type(None) in f.type.__args__:\n ret.append(f.name)\n return ret",
"def get_emp... | [
"0.73210156",
"0.6572073",
"0.65427876",
"0.61071235",
"0.6067238",
"0.5977162",
"0.5961841",
"0.5961719",
"0.59441406",
"0.59439206",
"0.5893623",
"0.5883057",
"0.5871245",
"0.58538157",
"0.5759051",
"0.5741048",
"0.5687027",
"0.56673044",
"0.5663676",
"0.5658784",
"0.564975... | 0.72070867 | 1 |
Return a list of field names that have a value of None and are listed in REQUIRED_FIELDS. | def get_empty_required_fields(self):
empty_fields = self.get_empty_fields()
return [f for f in empty_fields if f in self.REQUIRED_FIELDS] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_optional_fields(cls) -> List[str]:\n ret: List[str] = []\n for f in fields(cls):\n # Check if exactly two arguments exists and one of them are None type\n if hasattr(f.type, \"__args__\") and type(None) in f.type.__args__:\n ret.append(f.name)\n return ret",
"def get_emp... | [
"0.76924604",
"0.7199804",
"0.7147",
"0.7063235",
"0.6900872",
"0.6739515",
"0.67196345",
"0.6575395",
"0.65500325",
"0.6532921",
"0.6526607",
"0.6503688",
"0.64944416",
"0.64796436",
"0.6387062",
"0.633614",
"0.6328458",
"0.6327992",
"0.6327635",
"0.6315212",
"0.63133955",
... | 0.82673043 | 0 |
Perform the projection of the 3d point on the image plane and get the corresponding 2D pixel in homogenous coordinate | def project(self, point):
return np.round(project(self.camera.P, point)).astype(int) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_2d_point(point_3d_homogeneous, projection_matrix):\r\n\r\n temp = np.matmul(projection_matrix, point_3d_homogeneous)\r\n\r\n return cv.convertPointsFromHomogeneous(np.array([temp], np.float))",
"def projectToImage(pts_3D, P):\n pts_3D = np.reshape(pts_3D, (-1, 3))\n pts_3D = np.transpose(pts_... | [
"0.7105897",
"0.70460516",
"0.69263464",
"0.69134504",
"0.68637097",
"0.6642078",
"0.66228956",
"0.6543086",
"0.65035224",
"0.6473501",
"0.6471415",
"0.64623535",
"0.64556277",
"0.643515",
"0.6393049",
"0.637202",
"0.63195956",
"0.6278771",
"0.6271532",
"0.62531495",
"0.62445... | 0.66177845 | 7 |
Project an array of points to the image and take the patch around the projected patch. | def patches_from_3d_points(self, points, patch_size):
patch_centers = np.round(project(self.camera.P, points.T)).astype(int)
patches = self.patches(patch_centers, patch_size)
return patches | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_points_img(points, proj_mat, width, height):\n pixels = proj_mat.dot(points)\n pixels = np.divide(pixels[:2, :], pixels[2, :]).transpose().astype(np.int)\n\n # Remove pixels that are outside the image\n pixels[:, 0] = np.clip(pixels[:, 0], 0, width)\n pixels[:, 1] = np.clip(pixels[:, 1],... | [
"0.69747895",
"0.68717074",
"0.6786015",
"0.67620945",
"0.6751937",
"0.6751547",
"0.6705673",
"0.6513742",
"0.64428806",
"0.6394383",
"0.63692087",
"0.6358192",
"0.63323975",
"0.6315678",
"0.6313526",
"0.62519985",
"0.6236571",
"0.61296725",
"0.61140496",
"0.61099887",
"0.609... | 0.64410716 | 9 |
Returns the json response for the user. | def get_json(self):
url = 'http://lkd.to/api/' + self.user
response = requests.get(url)
return response.json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n\n user = None\n if self.request.headers.get('X-Pp-User'):\n user = self.request.headers['X-Pp-User']\n\n result_json = {\n \"user\": user\n }\n\n self.success(result_json)",
"def me(user):\n return json_response(\n status=200,\n ... | [
"0.79608285",
"0.789394",
"0.77476966",
"0.7639642",
"0.75853306",
"0.74673474",
"0.73737633",
"0.73520535",
"0.7330948",
"0.72740054",
"0.71548593",
"0.7094854",
"0.707074",
"0.7063743",
"0.6977924",
"0.6960361",
"0.69519913",
"0.6943994",
"0.69074225",
"0.68979686",
"0.6876... | 0.7924542 | 1 |
uses modified sieve of eratosthenes to get all primes smaller than n or k, whichever is lowest | def getKBitPrimes(k = 2 ** 10, n = 2 ** 20):
lim = min(k + 1, n + 1) # we don't want to generate any primes larger than n
numList = [True] * lim # initialise boolean list
primes = [] # initialise list of primes
for i in range(2,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sieve(n):\n global primes; lower = len(primes)\n if n+1 > lower:\n primes += [True, False] * ((n-lower)/2+1)\n for i in xrange(3, int(math.sqrt(n)+1), 2):\n if primes[i]:\n for j in xrange(3*i, n+1, 2*i):\n if j >= lower:\n primes[j] = False\n return [i for i, is_prime in enumera... | [
"0.7555216",
"0.74895614",
"0.74073946",
"0.7250602",
"0.72279334",
"0.720625",
"0.719876",
"0.7196724",
"0.7189192",
"0.7186157",
"0.7183029",
"0.7183029",
"0.71790385",
"0.7169732",
"0.71556395",
"0.71351683",
"0.7103499",
"0.7062384",
"0.7060789",
"0.7059072",
"0.705612",
... | 0.7695826 | 0 |
uses modified sieve of eratosthenes to get all primes smaller than n or a function of k, whichever is lowest | def getListOfPrimes(k = 40, n = 1000000):
low = 2 ** (k - 1) # smallest number k bits could be
lim = min(int(math.sqrt(low)), n + 1) # we don't want to generate any primes larger than n
numList = [True] * lim # initialise boolean list
primes = [] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getKBitPrimes(k = 2 ** 10, n = 2 ** 20):\n\n lim = min(k + 1, n + 1) # we don't want to generate any primes larger than n\n\n numList = [True] * lim # initialise boolean list\n primes = [] # initialise list of primes\n\n for i... | [
"0.78275377",
"0.77020377",
"0.75048006",
"0.7314518",
"0.7311774",
"0.72330105",
"0.7220817",
"0.721237",
"0.7211136",
"0.7211136",
"0.7205165",
"0.7205075",
"0.7202709",
"0.71895456",
"0.7177979",
"0.7159104",
"0.71421486",
"0.71343744",
"0.71190596",
"0.7103089",
"0.709835... | 0.7596925 | 2 |
given a number n checks if it is a pseudoprime | def isPrime(n, primes):
k = math.log(n, 2) # number of bits in n
r = getRounds(k)
return checks(n, primes, r) # run checks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def es_primo(n):\n \n for i in range(2, n):\n if n % i == 0:\n return False\n return True",
"def is_emirp(n) -> bool:\r\n if not is_prime(n):\r\n return False\r\n if not is_palindromic_number(n):\r\n return is_prime(int(str(n)[::-1]))\r\n return False",
"def is... | [
"0.7817889",
"0.756404",
"0.7498624",
"0.7495883",
"0.7408246",
"0.73520905",
"0.7348549",
"0.7344327",
"0.7332384",
"0.73083454",
"0.72970504",
"0.72853136",
"0.7277175",
"0.7270681",
"0.72549516",
"0.72549516",
"0.7248159",
"0.72481024",
"0.7240805",
"0.72302043",
"0.722468... | 0.6840112 | 69 |
Compute the Euclidean distance between two clusters | def distance(self, other_cluster):
vert_dist = self._vert_center - other_cluster.vert_center()
horiz_dist = self._horiz_center - other_cluster.horiz_center()
return math.sqrt(vert_dist ** 2 + horiz_dist ** 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clusters_distance_2(cluster1, cluster2):\n cluster1_center = np.average(cluster1, axis=0)\n cluster2_center = np.average(cluster2, axis=0)\n return euclidean_distance(cluster1_center, cluster2_center)",
"def clusters_distance_2(cluster1, cluster2):\n cluster1_center = np.average(cluster1, axis=0)... | [
"0.81775135",
"0.81775135",
"0.79127324",
"0.78077495",
"0.7784722",
"0.77496314",
"0.7724567",
"0.77208877",
"0.77196676",
"0.76718706",
"0.7651091",
"0.7649259",
"0.7636495",
"0.7611328",
"0.7577201",
"0.7567845",
"0.7540201",
"0.7527902",
"0.7499525",
"0.74857473",
"0.7484... | 0.7671838 | 11 |
Helper function that computes Euclidean distance between two clusters in a list. | def pair_distance(cluster_list, idx1, idx2):
return (cluster_list[idx1].distance(cluster_list[idx2]), min(idx1, idx2),
max(idx1, idx2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clusters_distance(cluster1, cluster2):\n return max([euclidean_distance(point1, point2) for point1 in cluster1 for point2 in cluster2])",
"def euclidean_distance(list1, list2):\n # Make sure we're working with lists\n # Sorry, no other iterables are permitted\n assert isinstance(list1, list)\n ... | [
"0.7759954",
"0.77486587",
"0.7324022",
"0.72768706",
"0.7233181",
"0.7127059",
"0.7127059",
"0.71191543",
"0.710676",
"0.7086177",
"0.70542765",
"0.7045018",
"0.702509",
"0.7019013",
"0.7011726",
"0.7004062",
"0.699501",
"0.69649434",
"0.6964823",
"0.6946888",
"0.69108677",
... | 0.70325375 | 12 |
Compute area of circle proportional to population | def circle_area(pop):
return math.pi * pop / (200.0 ** 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circle_area(circle):\n return pi * circle.radius * circle.radius",
"def area_of_circle(radius):\n return radius",
"def area(self):\n\t\t#print (self.radius*self.radius*math.pi)\n\t\tcircle_area = (self.radius*self.radius*math.pi)\n\t\treturn circle_area",
"def circleArea(radius):\n return math.p... | [
"0.7593919",
"0.72660565",
"0.7104535",
"0.7018462",
"0.70127475",
"0.6954907",
"0.69055337",
"0.6902162",
"0.6892975",
"0.6892975",
"0.68512183",
"0.68495506",
"0.68369377",
"0.67983717",
"0.6783153",
"0.67829245",
"0.6779431",
"0.676742",
"0.67648333",
"0.6741363",
"0.67177... | 0.774671 | 0 |
Sets blur, closing, and threshold to default values. | def reset_params(self):
self.blur = -1
self.closing = -1
self.thresh = -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_thresholds(self, blur=-1, closing=-1, thresh=-1):\n if (\n type(self.image_8bit_fg) is not np.ndarray\n or type(self.image_8bit_bg) is not np.ndarray\n ):\n return None\n\n if blur >= 0:\n self.blur = int(blur)\n if closing >= 0:\n ... | [
"0.63233703",
"0.62988913",
"0.6081117",
"0.57702655",
"0.57080543",
"0.5648541",
"0.5634385",
"0.5600758",
"0.55921084",
"0.5591982",
"0.54528534",
"0.5422042",
"0.5383879",
"0.5361995",
"0.5347043",
"0.5338919",
"0.53244644",
"0.5315123",
"0.5278364",
"0.5274111",
"0.527296... | 0.72089654 | 0 |
String, identifying a container. Required for linking. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def container_name(self):\n pass",
"def container_name(self):\n if self._container_name:\n return self._container_name\n else:\n return self.image.split(u'/').pop()",
"def containerID(self):\n return self._container",
"def container_name(self):\n prefi... | [
"0.803164",
"0.7900112",
"0.74964523",
"0.7456995",
"0.74225354",
"0.7402549",
"0.7308042",
"0.7037781",
"0.6918682",
"0.69069767",
"0.68863183",
"0.68863183",
"0.6826897",
"0.6747464",
"0.6705376",
"0.6456792",
"0.6430358",
"0.63004947",
"0.6297614",
"0.626567",
"0.62496185"... | 0.0 | -1 |
String, identifying a fakemetadata image to be run. | def image(self):
return self._image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"image_name\")",
"def image_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"image_id\")",
"def image_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"image_id\")",
"def image_name(self... | [
"0.6817836",
"0.6565314",
"0.6565314",
"0.65061367",
"0.65061367",
"0.6489994",
"0.64073396",
"0.6397145",
"0.63928074",
"0.6390052",
"0.6379286",
"0.6378512",
"0.6378512",
"0.6378512",
"0.6378512",
"0.6378512",
"0.6378512",
"0.6378512",
"0.6378512",
"0.6378512",
"0.6378512",... | 0.0 | -1 |
Constructs a ResNet50 model. | def resnet50(**kwargs):
model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model",
"def resnet50(**kwargs):\n model = ResNet(... | [
"0.7557751",
"0.75548905",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74557495",
"0.73601955",
"0.7355623",
"0.724254",
"0.724254",
"0.7191571",
"0.7158499",
"0.7101107",
"0.70165247",
"0.69687796",
"0.68687624",
"0.6822836",
"0.6801022",
"0.67330164",
"0.6718... | 0.7386862 | 8 |
Get yesterday`s date and split it to year,month and day strings | def get_yesterday() -> tuple:
logging.debug("Starting get_yesterday function.")
today = datetime.now(pytz.timezone("America/New_York"))
yesterday = (today - timedelta(days=1)).strftime("%Y-%m-%d")
yesterday_split = yesterday.split("-")
year = yesterday_split[0]
month = yesterday_split[1]
day... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yesterdayDate(self):\n yesterday = time.time() - 24*3600\n return time.strftime(\"%m/%d/%Y\", time.localtime(yesterday))",
"def yesterday(self):\n if self.isLeapYear():\n fdays = 29\n else:\n fdays = 28\n\n DIM = [0, 31, fdays, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\n c... | [
"0.74804103",
"0.71562994",
"0.68993646",
"0.6834052",
"0.6524088",
"0.6156523",
"0.60876703",
"0.58559275",
"0.57265025",
"0.5714436",
"0.5667846",
"0.5587033",
"0.55408067",
"0.5473568",
"0.54648554",
"0.5409383",
"0.54093677",
"0.5387093",
"0.53761303",
"0.5356072",
"0.535... | 0.71722984 | 1 |
Node to the left of the current node at the same level | def test_leftsibling_in_level(self):
q = self.session.query(self.model)
node3 = q.filter(self.model.get_pk_column() == 3).one()
node5 = q.filter(self.model.get_pk_column() == 5).one()
node6 = q.filter(self.model.get_pk_column() == 6).one()
node8 = q.filter(self.model.get_pk_colum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left(self, node):\r\n if self._col(node.count) > 0:\r\n return self.nodes[node.count - 1]\r\n else:\r\n return None",
"def __rotate_left(self) -> \"Node\":\n lower = self.right\n # add left subtree of lower to upper (self) as right child and update links\n ... | [
"0.77153677",
"0.7653816",
"0.7610829",
"0.7603214",
"0.7601941",
"0.7595608",
"0.75828964",
"0.75705504",
"0.75705504",
"0.7550267",
"0.7526808",
"0.7526051",
"0.7503785",
"0.7487387",
"0.74856937",
"0.74856937",
"0.74002117",
"0.7394875",
"0.73832166",
"0.73780876",
"0.7373... | 0.0 | -1 |
Gets the selected theme from Configuration model. | def _get_theme_selected():
try:
theme_selected = Configuration.objects.filter(group='theme', key='selected')[0]
theme_name = theme_selected.value
except:
theme_name = 'default'
return theme_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_theme(self) -> str:\n return self.theme or self.account.theme",
"def themeinfo(self):\n return theme_registry.find(self.theme)",
"def get_current_app_mode() -> ThemeMode:\n theme: ApplicationTheme = themes[0]\n\n # Change current mode.\n path = theme.path\n try:\n with ... | [
"0.7405846",
"0.68021315",
"0.6606931",
"0.6567375",
"0.6517577",
"0.6334023",
"0.63043463",
"0.6228855",
"0.62239754",
"0.6128579",
"0.58902335",
"0.58402276",
"0.5632274",
"0.5588047",
"0.55853784",
"0.5469488",
"0.54248726",
"0.54126537",
"0.5390111",
"0.53644234",
"0.5352... | 0.79342544 | 0 |
Shows the home page for the cms. | def home(request):
MAX_WIDTH_IMG = 350
MAX_HEIGHT_IMG = 350
MAX_WIDTH_CONTENT = 950
menu = Menu.objects.get(nav_option = "home")
page = menu.page
try:
img_width = page.image.width + 30
img_height = page.image.height
difference = 20
if img_width > MAX_WIDTH_IMG:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage(request):\n\treturn render(request, 'core/homepage.html')",
"def home(request):\n\treturn render(request, \"compta/home.html\")",
"def home():\n return render_template(\n 'home.html',\n title='Home Page',\n year=datetime.now().year,\n )",
"def homepage():\n return r... | [
"0.7924809",
"0.79158443",
"0.78859514",
"0.787882",
"0.7875724",
"0.7847001",
"0.7840399",
"0.78321475",
"0.7759051",
"0.774798",
"0.7745158",
"0.7745158",
"0.7745158",
"0.7745158",
"0.7745158",
"0.7745158",
"0.7745158",
"0.7745158",
"0.7745158",
"0.7745158",
"0.7716594",
... | 0.0 | -1 |
Initializes the turtle to the origin and facing east with the pen up. | def init_turtle():
turtle.up()
turtle.home() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setTurtle(t):\r\n t.pu()\r\n t.goto(initialCoordinates())",
"def up():\n turtleTmp.penup()",
"def init():\n turtle.setworldcoordinates(-WINDOW_WIDTH / 2, -WINDOW_WIDTH / 2,\n WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2)\n\n turtle.up()\n turtle.setheading(0)\n tur... | [
"0.655452",
"0.65056694",
"0.6478682",
"0.62812686",
"0.6011844",
"0.5976363",
"0.59475094",
"0.58842516",
"0.5717818",
"0.5681687",
"0.56631356",
"0.5642275",
"0.5557394",
"0.55196226",
"0.55114704",
"0.5459394",
"0.542305",
"0.54205865",
"0.54117817",
"0.54094595",
"0.53954... | 0.7370557 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in xrange(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8040086",
"0.79256725",
"0.7923959",
"0.78855336",
"0.78781366",
"0.7816429",
"0.7766289",
"0.7756418",
"0.7744994",
"0.77324396",
"0.77295053",
"0.77257586",
"0.77034765",
"0.7690202",
"0.7690202",
"0.7664886",
"0.7657751",
"0.7656609",
"0.7656609",
"0.7646568",
"0.764656... | 0.0 | -1 |
Test method minus(a, b) | def test_minus(self):
self.assertEqual(1, foo.minus(3, 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minus(self, a, b):\n return a - b",
"def subtract(a, b):\n return a - b",
"def subtract(a, b):\n return a - b",
"def test_minus(self):\n self.assertEqual(1, minus(3, 2))",
"def test_subtract(self):\n self.assertEqual(work_file.subtract(10, 5), 5)\n self.assertEqual(work_fi... | [
"0.8735923",
"0.84872174",
"0.84872174",
"0.8446348",
"0.8368554",
"0.821625",
"0.8200198",
"0.808657",
"0.8084278",
"0.8021095",
"0.8021095",
"0.80167377",
"0.800326",
"0.80027634",
"0.80027634",
"0.80027634",
"0.79776347",
"0.793875",
"0.78997195",
"0.78528136",
"0.78211117... | 0.8387047 | 4 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ShowServerGroupResult):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8456063",
"0.83918154",
"0.8144437",
"0.8140196",
"0.8132038",
"0.8093834",
"0.80918837",
"0.80918837",
"0.80918837",
"0.80852824",
"0.80852824",
"0.807626",
"0.807626",
"0.80657643"
] | 0.0 | -1 |
randomly chooses place to set ship in bounds, either horizontal or vertical | def choose_ship(self, ship_type, board):
ship_size = b_types.get_ship_sizes().get(ship_type)
if random.randrange(0, 2): # to randomly decide vertical or horizontal
vertical_offset = ship_size
horizontal_offset = 0
direction = b_types.Coordinate(1, 0)
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_ship(self, height, width):\n # Ship\n ship = random.choice([\"cruiseship\", \"tanker\"])\n # Center x, y\n buffer = 20\n y = random.randint(buffer, height - buffer - 1)\n x = random.randint(buffer, width - buffer - 1)\n # Size\n s = random.randint(... | [
"0.7479409",
"0.6657294",
"0.6653017",
"0.6635863",
"0.6622439",
"0.65683323",
"0.64733535",
"0.6438657",
"0.6437536",
"0.64136493",
"0.64009655",
"0.63839793",
"0.63666856",
"0.6365995",
"0.635961",
"0.6349791",
"0.63401484",
"0.6337378",
"0.63190913",
"0.6305767",
"0.629990... | 0.71425813 | 1 |
Test 404 question not found | def test_unsuccessful_post_answer(self):
self.is_authenticated(self.user1)
response = self.post_answer_without_question()
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
self.assertEqual(response.data.get('error'),
self.post_answer_without_ques... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_found(self):\n self._error_test(fitbit_exceptions.HTTPNotFound)",
"def test_404_not_found(self):\n response = self.client.get('/testPage404')\n self.assertEqual(response.status_code, 404)",
"def test_errors(self):\n rc = self.app.get('/this_should_not_exist', follow_red... | [
"0.8237991",
"0.8040965",
"0.8037892",
"0.7916197",
"0.7897643",
"0.7883211",
"0.78337044",
"0.78294086",
"0.78256917",
"0.780403",
"0.7780415",
"0.7745557",
"0.772033",
"0.7691509",
"0.7644321",
"0.7635478",
"0.76227444",
"0.7615831",
"0.76010025",
"0.75871754",
"0.7586676",... | 0.0 | -1 |
Test 404 get answer with no question | def test_unsuccessful_get_an_answer_without_question(self):
self.is_authenticated(self.user1)
response = self.get_answer_without_question()
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_existent_question(self):\n\n res = self.app.get('/api/v1/questions/'+str(56))\n self.assertEqual(res.status_code, 404)",
"def test_404_get_questions(self):\n res = self.client().get('/api/questions?page=1000')\n res_body = json.loads(res.data)\n\n self.assertEqual(... | [
"0.7710573",
"0.76209813",
"0.7453974",
"0.7318774",
"0.7250207",
"0.71921813",
"0.7159586",
"0.7139105",
"0.71047735",
"0.70333827",
"0.7030539",
"0.69485205",
"0.68955845",
"0.688991",
"0.6886794",
"0.6881696",
"0.68806094",
"0.68676114",
"0.683795",
"0.68364197",
"0.681885... | 0.73679906 | 3 |
Test posting with un authenticated user (401) | def test_post_answer_if_not_autheticated(self):
response = self.post_answer()
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post_unauthenticated(self):\n\n url = reverse('file')\n\n data = {}\n\n response = self.client.post(url, data)\n\n self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)",
"def test_guests_can_not_post_message(self):\n url = reverse('posts-list')\n ... | [
"0.81244415",
"0.80296326",
"0.784055",
"0.7837534",
"0.7818368",
"0.77100974",
"0.7705728",
"0.7692003",
"0.76032794",
"0.7586472",
"0.75610125",
"0.7528392",
"0.74692696",
"0.7468585",
"0.74499327",
"0.73847276",
"0.7384698",
"0.73739606",
"0.7364549",
"0.7330721",
"0.72950... | 0.7973648 | 2 |
Test 404 meetup not found | def test_unsuccessful_post_answer_to_wrong_meetup(self):
self.is_authenticated(self.user1)
response = self.post_answer_with_no_meetup()
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_getting_one_question_with_no_meetup(self):\n response = self.get_one_question_with_invalid_meetup()\n self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)",
"def test_not_found(self):\n self._error_test(fitbit_exceptions.HTTPNotFound)",
"def test_get_specific_office_n... | [
"0.75472564",
"0.74345964",
"0.7318024",
"0.73130393",
"0.72373426",
"0.72281307",
"0.72043496",
"0.71932197",
"0.7159948",
"0.71310955",
"0.7130887",
"0.7130726",
"0.7126912",
"0.7099324",
"0.708367",
"0.7071698",
"0.70533675",
"0.70396304",
"0.7012997",
"0.6999891",
"0.6998... | 0.6746113 | 64 |
Test 404 answer is invalid | def test_unsuccessful_post_answer_with_special_characters(self):
self.is_authenticated(self.user1)
response = self.post_answer_with_special_character()
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_errors(self):\n rc = self.app.get('/this_should_not_exist', follow_redirects=True)\n assert b'404 error :(' in rc.data",
"def test_not_found(self):\n self._error_test(fitbit_exceptions.HTTPNotFound)",
"def test_error404():\n response = echo_client(\"GET test/test HTTP/1.1\")\n ... | [
"0.79368186",
"0.77104884",
"0.7629859",
"0.75715923",
"0.75505847",
"0.7549113",
"0.749996",
"0.74985224",
"0.7491064",
"0.74099535",
"0.7402806",
"0.73896855",
"0.73539317",
"0.73317194",
"0.73293227",
"0.7315089",
"0.7294703",
"0.7281353",
"0.7245871",
"0.724494",
"0.72181... | 0.0 | -1 |
Test 404 answer is invalid | def test_unsuccessful_post_answer_without_body(self):
self.is_authenticated(self.user1)
response = self.post_answer_without_body()
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_errors(self):\n rc = self.app.get('/this_should_not_exist', follow_redirects=True)\n assert b'404 error :(' in rc.data",
"def test_not_found(self):\n self._error_test(fitbit_exceptions.HTTPNotFound)",
"def test_error404():\n response = echo_client(\"GET test/test HTTP/1.1\")\n ... | [
"0.7936776",
"0.7710057",
"0.76296586",
"0.75714433",
"0.7549984",
"0.75493276",
"0.74987364",
"0.7498531",
"0.7490571",
"0.7409333",
"0.7401093",
"0.738934",
"0.73543495",
"0.73307514",
"0.7330059",
"0.7314209",
"0.7295995",
"0.72801787",
"0.7245308",
"0.72451836",
"0.721833... | 0.0 | -1 |
Gets the best play if this player is starting. Returns lead play | def get_best_lead_play(self, game_state):
possible_leads = self.get_possible_leads(game_state)
return get_best_play(possible_leads, self, game_state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player_best_score(self, player):\n return self.get_highscores().filter(player=player).first()",
"def next_player(self):\n return next(self.next_tour)",
"def get_winner(self):\n diff = self.home_score - self.away_score\n if diff > 0:\n return self.home_team\n ... | [
"0.6535223",
"0.6408301",
"0.63496757",
"0.62630254",
"0.62401694",
"0.6237387",
"0.62372833",
"0.6200139",
"0.6200139",
"0.6192626",
"0.6119592",
"0.6109556",
"0.6022093",
"0.60206586",
"0.599635",
"0.5980972",
"0.597508",
"0.59728754",
"0.5962783",
"0.59345406",
"0.59345406... | 0.71021163 | 0 |
Copies the model parameters of one estimator to another. | def copy_model_parameters(sess, estimator1, estimator2):
e1_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator1.scope)]
e1_params = sorted(e1_params, key=lambda v: v.name)
e2_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator2.scope)]
e2_params = sorte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_para(from_model, to_model):\n for i, j in zip(from_model.trainable_weights, to_model.trainable_weights):\n j.assign(i)",
"def sync_parameters(self, model: nn.Module) -> None:\n # before ema, copy weights from orig\n avg_param = (\n itertools.chain(self.... | [
"0.66554946",
"0.61860365",
"0.61860365",
"0.6184476",
"0.60527664",
"0.60499156",
"0.60399276",
"0.5963272",
"0.5963272",
"0.5920757",
"0.59034836",
"0.5899948",
"0.58918744",
"0.58678216",
"0.58601093",
"0.58497196",
"0.5828383",
"0.58271724",
"0.57635075",
"0.5753243",
"0.... | 0.7852879 | 0 |
Creates an epsilongreedy policy based on a given Qfunction approximator and epsilon. | def make_epsilon_greedy_policy(estimator, nA):
def policy_fn(sess, observation, epsilon):
A = np.ones(nA, dtype=float) * epsilon / nA
q_values = estimator.predict(sess, np.expand_dims(observation, 0))[0]
best_action = np.argmax(q_values)
A[best_action] += (1.0 - epsilon)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createEpsilonGreedyPolicy(Q, epsilon, num_actions):\n\n def policyFunction(state):\n Action_probabilities = np.ones(num_actions,\n dtype=float) * epsilon / num_actions\n\n best_action = np.argmax(Q[state])\n Action_probabilities[best_action] += (1.0... | [
"0.7798874",
"0.77691996",
"0.7605976",
"0.75869274",
"0.7572639",
"0.7566527",
"0.74508333",
"0.74306667",
"0.7294456",
"0.71730536",
"0.70615804",
"0.67399865",
"0.66476536",
"0.65339935",
"0.63165617",
"0.62469697",
"0.6236141",
"0.6199064",
"0.6132793",
"0.6104808",
"0.60... | 0.70483947 | 11 |
Calculate ``Relative_Humidity`` from ``Mixing_Ratio``. Will not execute if ``Relative_Humidity`` is already present. Calculation ultimately requires either ``Mixing_Ratio`` or ``Specific_Humidity`` as original alongpath output variables. | def calculate_rh(self):
# Check for existence of relative humidity and mixing ratio
if self.data.get('Relative_Humidity') is None:
if self.data.get('Mixing_Ratio') is None:
raise KeyError('Calculate mixing ratio first!')
else:
# Convert mixing rati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_sh(self):\n if self.data.get('Specific_Humidity') is None:\n if self.data.get('Mixing_Ratio') is None:\n raise KeyError('Calculate mixing ratio first!')\n else:\n w_kg = self.data['Mixing_Ratio'] / 1000\n self.data['Specific_Hu... | [
"0.71848184",
"0.6732853",
"0.6652302",
"0.6406012",
"0.620816",
"0.6157318",
"0.6057532",
"0.6040382",
"0.60385966",
"0.59931153",
"0.58349055",
"0.580519",
"0.57064366",
"0.57062626",
"0.5691482",
"0.5683108",
"0.568102",
"0.5674275",
"0.5613528",
"0.55368257",
"0.5531811",... | 0.77395326 | 0 |
Convert ``Relative_Humidity`` to ``Mixing_Ratio``. Only called by ``self.calculate_w()``, private. | def _convert_rh2w(self):
sat_vapor = 6.11 * (10.0 ** ((7.5 * self.data['Temperature_C']) /
(237.7 + self.data['Temperature_C'])))
sat_w = 621.97 * (sat_vapor / (self.data['Pressure'] - sat_vapor))
self.data['Mixing_Ratio'] = (
self.data['Relativ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mixing_ratio_from_relative_humidity():\n p = 1013.25 * units.mbar\n temperature = 20. * units.degC\n rh = 81.7219 * units.percent\n w = mixing_ratio_from_relative_humidity(p, temperature, rh)\n assert_almost_equal(w, 0.012 * units.dimensionless, 3)",
"def _convert_q2w(self):\n q_kg... | [
"0.69655776",
"0.6906715",
"0.66592425",
"0.66525936",
"0.66042984",
"0.6206057",
"0.6087353",
"0.60067016",
"0.5951692",
"0.5904284",
"0.58876926",
"0.5863381",
"0.5739086",
"0.5683451",
"0.5654657",
"0.55444795",
"0.5484089",
"0.54336953",
"0.5403929",
"0.5230735",
"0.52287... | 0.67031014 | 2 |
Convert ``Specific_Humidity`` to ``Mixing_Ratio``. Only called by ``self.calculate_w()``, private. | def _convert_q2w(self):
q_kg = self.data['Specific_Humidity'] / 1000
self.data['Mixing_Ratio'] = (q_kg / (1 - q_kg)) * 1000 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_sh(self):\n if self.data.get('Specific_Humidity') is None:\n if self.data.get('Mixing_Ratio') is None:\n raise KeyError('Calculate mixing ratio first!')\n else:\n w_kg = self.data['Mixing_Ratio'] / 1000\n self.data['Specific_Hu... | [
"0.6973811",
"0.6702793",
"0.6619602",
"0.64303654",
"0.6375755",
"0.63524246",
"0.6255523",
"0.62350726",
"0.6197779",
"0.609372",
"0.60455805",
"0.59479225",
"0.54961616",
"0.54614466",
"0.54241765",
"0.5393916",
"0.52461195",
"0.5162813",
"0.5134354",
"0.51246977",
"0.5124... | 0.7029973 | 0 |
Slide a window across an image | def sliding_window(image, stepSize, windowSize):
# slide a window across the image
for y in xrange(0, image.shape[0], stepSize):
for x in xrange(0, image.shape[1], stepSize):
# yield the current window
yield (x, y, image[y:y + windowSize[1], x:x + windowSize[0]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slide(x1, y1, x2, y2):\n gui.mouseDown(x1, y1)\n gui.moveTo(x2, y2)\n release()",
"def SlideIn(self, event):\r\n\r\n window = self._sliding_pane.window\r\n self._sliding_frame = wx.MiniFrame(None, -1, title=_(\"Pane Preview\"),\r\n style=wx.FRA... | [
"0.6774549",
"0.64769423",
"0.59907347",
"0.59835094",
"0.59425205",
"0.5923081",
"0.59215647",
"0.5913144",
"0.58244616",
"0.5792905",
"0.56039774",
"0.5589112",
"0.5588209",
"0.555756",
"0.55531913",
"0.5540124",
"0.5532071",
"0.5525115",
"0.55067134",
"0.5503757",
"0.54801... | 0.6160178 | 2 |
this route is the home page for the stocks app | def home():
return render_template('home.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n stocks = preprocess()\n\n return render_template(\"main.html\",stocks=stocks)",
"def home():\n payload = manager.get_payload()\n return render_template('index.html', payload=payload)",
"def home(self, *args, **kwargs):\n pass",
"def home():\n\n\treturn render_template('solai.... | [
"0.764286",
"0.72043943",
"0.7109931",
"0.7071429",
"0.70648223",
"0.70529723",
"0.7013938",
"0.6985076",
"0.69660246",
"0.69386816",
"0.69133544",
"0.6886232",
"0.68528324",
"0.677999",
"0.6777151",
"0.67677915",
"0.6767387",
"0.673665",
"0.6731425",
"0.6728887",
"0.6723348"... | 0.6611458 | 52 |
Update the variable by applying the sum operation to the given axis. Note this function is called only when a variable is defined. | def sumAxisPoints(self, var):
varID = var.id
var = cdutil.averager(var, axis="(%s)" % self.axis.id, weight='equal',
action='sum')
var.id = varID
return var | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(self, axis: int = 0):\r\n self.values = self.values.sum(axis=axis)\r\n self.layers = [None]\r\n return self.copy()",
"def val_sum(self, axis = None):\n f = self.to_Poly()\n return f.val_sum(axis).to_PolyMesh(self.params)",
"def val_sum(self, axis = None):\n f =... | [
"0.7798656",
"0.72094023",
"0.7198746",
"0.7142355",
"0.6994705",
"0.696371",
"0.6416693",
"0.6130709",
"0.6114878",
"0.6070165",
"0.5996128",
"0.57939684",
"0.57059014",
"0.56736",
"0.56670916",
"0.56556636",
"0.5624183",
"0.5610915",
"0.5582863",
"0.55789256",
"0.5567717",
... | 0.65481174 | 6 |
Generate a list with the axis label + axis name and store it in self.axesNames | def setAxesNames(self):
labels = ['T', 'Z', 'Y', 'X'] + [chr(ord('S')-i) for i in xrange(18)]
if (len(self.axisList) >= 4):
i = 0
else:
i = 4 - len(self.axisList)
for axis in self.axisList:
self.axesNames.append(labels[i] + ' - ' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axesNames(self, data, info):\n return []",
"def axesnames(self):\n return self._axesnames",
"def customAxisNames(self):\n return []",
"def names(self):\n labels = [\n \"$X_{%i}$\" % i if d.name is None else d.name\n for i, d in enumerate(self.dimensions)\... | [
"0.8175542",
"0.8034366",
"0.7761233",
"0.744326",
"0.7132904",
"0.7007034",
"0.6794579",
"0.6758302",
"0.671349",
"0.66251487",
"0.6612587",
"0.65528935",
"0.64799905",
"0.64797544",
"0.642378",
"0.634746",
"0.62659645",
"0.62648904",
"0.6260601",
"0.62532294",
"0.6251837",
... | 0.8043291 | 1 |
Returns True if a tab with the given name exists | def tabExists(self, name):
numTabs = self.count()
for i in range(numTabs):
if (name == self.tabText(i)):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_tab_present(self, tab_name):\n tab_locator = (By.XPATH, \"//a[@class='k-link' and text()='%s']\" % tab_name)\n return self.is_element_present(tab_locator)",
"def is_on_tab(self, tab_name):\r\n return self._is_on_tab(tab_name)",
"def _is_on_tab(self, tab_name):\r\n current_tab... | [
"0.79192084",
"0.7535681",
"0.72463804",
"0.6815143",
"0.65881294",
"0.6570198",
"0.6495287",
"0.6495287",
"0.64776754",
"0.64764607",
"0.6447487",
"0.6373912",
"0.6371637",
"0.6368041",
"0.63458776",
"0.6343646",
"0.62992656",
"0.62980825",
"0.6269284",
"0.62614965",
"0.6250... | 0.8910699 | 0 |
Select the wavelength range to give a straight line or gaussian fitting, or apparent optical depth. or equivalent width. | def Select_Data(spec,wave_edges):
if len(wave_edges) < 2:
raise ValueError('must be at least two bin edges!')
wave,flux,error,dfp,dfm= spec
inds = np.where( (wave > wave_edges[0]) & (wave <= wave_edges[1]) )[0]
return wave[inds], flux[inds],error[inds], dfp[inds], dfm[inds] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getWidthOption(self):\n if self.mdapOptions['kmerRange']:\n w = self.mdapOptions['kmerRange'].split(',')\n return '-minw %s -maxw %s ' % (w[0],w[1])\n else:\n return '-w %d' % (int(self.mdapOptions['kmerSize']))\n \n \n #-----------",
"def ... | [
"0.6383119",
"0.6229016",
"0.62009525",
"0.59333307",
"0.59069043",
"0.59013176",
"0.5863111",
"0.58313495",
"0.5731369",
"0.56628895",
"0.5650786",
"0.5648051",
"0.5644675",
"0.5630036",
"0.5614785",
"0.56142664",
"0.55308276",
"0.54703945",
"0.5444324",
"0.54240376",
"0.541... | 0.0 | -1 |
Given two points make a straight line. | def straight_line(p1,p2,spec):
x1,y1 = p1; x2,y2 = p2
m = (y2-y1) / (x2-x1)
x = np.arange(x1-0.01, x2+0.01, 0.01)
y = m *(x-x1) + y1
f = np.vectorize(interp1d(x,y,kind = 'linear'))
wave,flux,error = Select_Data(spec,[x1,x2])
return wave,f(wave) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_line(point_1, point_2):\r\n A = point_1.y - point_2.y\r\n B = point_2.x - point_1.x\r\n C = point_1.y * B + point_1.x * A\r\n return np.matrix([[A],[B],[-C]])",
"def line(x1, y1, x2, y2):\r\n\r\n x1 = normalize(x1)\r\n y1 = normalize(y1)\r\n x2 = normalize(x2)\r\n y2 = normal... | [
"0.7465267",
"0.74210334",
"0.73293996",
"0.72397566",
"0.7079121",
"0.7047918",
"0.7017029",
"0.6992693",
"0.69429743",
"0.68974835",
"0.6883813",
"0.685722",
"0.6823622",
"0.67928267",
"0.6734979",
"0.67067754",
"0.6705018",
"0.66975784",
"0.66586316",
"0.66410434",
"0.6628... | 0.6991096 | 8 |
In the constructor we instantiate two nn.Linear modules and assign them as member variables. | def __init__(self):
super(FcNet, self).__init__()
# get size of some layers
start_num = 48
max_num = 200
mid_num = 50
end_num = 8
# define regressor
self.regress = nn.Sequential(
nn.Linear(start_num,max_num,bias=True),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args):\n super(LinearND, self).__init__()\n self.fc = nn.Linear(*args)",
"def __init__(self, linear_args, activation_functions, softmax=False):\n super(NN, self).__init__()\n assert len(activation_functions) == len(linear_args) - 1\n k = len(linear_args)\n ... | [
"0.7740035",
"0.75485957",
"0.7506749",
"0.74343014",
"0.7366208",
"0.7335571",
"0.73144513",
"0.72861767",
"0.72730076",
"0.7272271",
"0.7272271",
"0.72678465",
"0.72425723",
"0.72200733",
"0.7202108",
"0.7166431",
"0.7110935",
"0.7076567",
"0.7065075",
"0.7062705",
"0.70526... | 0.6324448 | 65 |
This property returns the minimum values of the intervals. | def mins(self):
return self.intervals[:, 0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_range(self):\n return self._min_range",
"def min(self, values):\n return self.aggregate(values, \"min\")",
"def mins(self) -> Tensor:\n return self._ranges[:, 0]",
"def min(self):\n return self._reduce_for_stat_function(F.min, only_numeric=False)",
"def minimum(self) -> ... | [
"0.78477347",
"0.7382199",
"0.7368395",
"0.7235103",
"0.72304946",
"0.71500134",
"0.7129748",
"0.703205",
"0.7028051",
"0.7014253",
"0.6998861",
"0.69750655",
"0.6953545",
"0.6953545",
"0.6942073",
"0.6933282",
"0.69168216",
"0.6870001",
"0.6854123",
"0.68284553",
"0.6824953"... | 0.809721 | 0 |
This property returns the maximum values of the intervals. | def maxs(self):
return self.intervals[:, 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxs(self):\n return self._maxs",
"def get_max_value(self):\n max_value = max(self.values)\n return max_value",
"def max_range(self):\n return self._max_range",
"def maxs(self) -> Tensor:\n return self._ranges[:, 1]",
"def max(self):\n max_i = np.nanargmax(self... | [
"0.7787913",
"0.76968336",
"0.7657693",
"0.7347122",
"0.7325614",
"0.7311917",
"0.7267983",
"0.72499734",
"0.7249726",
"0.7171346",
"0.7164656",
"0.71634406",
"0.71515113",
"0.7149648",
"0.71469295",
"0.71469295",
"0.7138356",
"0.7119737",
"0.7098567",
"0.708105",
"0.70460606... | 0.8576871 | 0 |
A function to close database connections at exit time. | def close_db_connections():
for db in db_connections.values():
db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown_db():\n print('Exit.')\n global conn\n conn.close()",
"def exit(self):\n self.__mongo_db.close_connection()\n self.__postgre_db.close_connection()",
"def close_db_connections(func, *args, **kwargs):\n def _close_db_connections(*args, **kwargs):\n ret = None\n ... | [
"0.8105806",
"0.8031834",
"0.8019544",
"0.79990995",
"0.79952264",
"0.79678446",
"0.79373443",
"0.77105314",
"0.7706929",
"0.769407",
"0.76526755",
"0.76499426",
"0.759192",
"0.7575837",
"0.75692064",
"0.7547735",
"0.7539985",
"0.7532532",
"0.75121015",
"0.75000024",
"0.74983... | 0.8107023 | 0 |
Loads a dataset stored as a JSON file. This will not split your dataset into training and testing sets, rather it returns all features and targets in `train_features` and `train_targets` and leaves `test_features` and `test_targets` as empty numpy arrays. This is done to match the API of the other data loaders. | def load_json_data(path, fraction=None, examples_per_class=None):
with open(path, 'rb') as file:
data = json.load(file)
features = np.array(data[0]).astype(float)
targets = np.array(data[1]).astype(int)
return features, np.array([[]]), targets, np.array([]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_training_data(\n self,\n train_data_file=\"datasets/train_data.json\",\n test_data_file=\"datasets/test_data.json\",\n ):\n train_data = pd.read_json(train_data_file)\n test_data = pd.read_json(test_data_file)\n return train_data, test_data",
"def load_data(s... | [
"0.70590216",
"0.70439076",
"0.6758911",
"0.6728074",
"0.66151065",
"0.6589193",
"0.65266496",
"0.6456374",
"0.64488",
"0.6426629",
"0.63432705",
"0.6334379",
"0.6304334",
"0.628108",
"0.6255854",
"0.62443906",
"0.62319154",
"0.6230251",
"0.6212526",
"0.6210923",
"0.6192233",... | 0.624827 | 15 |
Get dataset loaders for PyTorch models, which would be split to two parts according to ratio. | def get_data_loaders(data, batch_size, ratio=0.8, num_workers=1):
train_size = int(len(data) * ratio)
val_size = len(data) - train_size
train_set, val_set = random_split(data, [train_size, val_size])
data_train_loader = DataLoader(train_set, batch_size=batch_size, num_workers=num_workers, shuffle=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_loaders(opt):\n train_samples, val_samples = get_train_val_metadata(opt.dataset_dir,\n opt.validation_cities,\n opt.patch_size,\n opt.strid... | [
"0.7568673",
"0.7477081",
"0.741638",
"0.73696834",
"0.73394865",
"0.73394865",
"0.73394865",
"0.73394865",
"0.73394865",
"0.73394865",
"0.73394865",
"0.73394865",
"0.73394865",
"0.7258499",
"0.7226253",
"0.71834964",
"0.7141532",
"0.71294844",
"0.7059554",
"0.7047163",
"0.70... | 0.78073627 | 0 |
Create a GiphySnapBotBase instance and connect to Slack. | def __init__(self, config):
self._slack_client = self._connect(config["slack_bot_token"])
self.bot_id = self._get_user_id()
self.default_channel = config["default_channel"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, config):\n self.config = config\n\n self.slack_client = SlackClient(self.config.SLACK_TOKEN)",
"def slackbot(self, *args, **kwargs):\n while True:\n self.slack.api_connect()",
"def __init__(self, bot):\n self.bot = bot",
"def __init__(self, bot):\n ... | [
"0.6465272",
"0.62106293",
"0.61245006",
"0.61245006",
"0.6087447",
"0.6064036",
"0.6064036",
"0.5904246",
"0.5854513",
"0.5775163",
"0.57336086",
"0.57251763",
"0.57118875",
"0.5663135",
"0.56420577",
"0.56201714",
"0.56182754",
"0.5600013",
"0.5596115",
"0.5578965",
"0.5566... | 0.6428783 | 1 |
Returns True if a CPLEX licence can be obtained. The licence is kept until releaseLicence() is called. | def grabLicence(self):
return pulpCPLEX.grabLicence() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid(self):\n\t\treturn bool(call_sdk_function('PrlLic_IsValid', self.handle))",
"def releaseLicence(self):\n\t\t\tpulpCPLEX.releaseLicence()",
"def isLicensed(self):\n try:\n if arcpy.CheckExtension(\"Spatial\") != \"Available\":\n raise Exception\n except Excep... | [
"0.69270617",
"0.6410763",
"0.62439114",
"0.62439114",
"0.62439114",
"0.62439114",
"0.62439114",
"0.62439114",
"0.62439114",
"0.62439114",
"0.62377673",
"0.62377673",
"0.621339",
"0.621339",
"0.621339",
"0.621339",
"0.621339",
"0.621339",
"0.621339",
"0.621339",
"0.621339",
... | 0.659232 | 1 |
Calculate the dot product of two lists of linear expressions | def lpDot(v1, v2):
if not isinstance(v1, list) and not isinstance(v2, list):
return v1 * v2
elif not isinstance(v1, list):
return lpDot([v1]*len(v2),v2)
elif not isinstance(v2, list):
return lpDot(v1,[v2]*len(v1))
else:
return lpSum([lpDot(e1,e2) for e1,e2 in zip(v1,v2)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dotproduct(x, y):\n return sum(imap(operator.mul, x, y))",
"def dot(lhs: typing.Iterable, rhs: typing.Iterable) -> float:\n return sum(ls * rs for ls, rs in zip(lhs, rhs))",
"def dotproduct(v1, v2):\n\treturn sum(imap(operator.mul, v1, v2))",
"def dot(xs: List[float], ys: List[float]) -> float:... | [
"0.78355074",
"0.7832497",
"0.78309417",
"0.78125596",
"0.773899",
"0.7681337",
"0.7669243",
"0.763772",
"0.76329523",
"0.75609875",
"0.7558322",
"0.75474113",
"0.754159",
"0.7512239",
"0.75114906",
"0.7499014",
"0.7486321",
"0.74629396",
"0.7427861",
"0.74275404",
"0.7423966... | 0.68838185 | 42 |
Sets the name field in the Member table for hte given net id. | def set_name(net_id, name):
connection = get_connection()
cursor = connection.cursor()
sql_string = "UPDATE Member SET name='"+name+"' WHERE netID='"+net_id+"'"
cursor.execute(sql_string)
connection.commit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n\t\tself.name_ = name",
"def setName(self, *args):\n return _libsbml.Member_setName(self, *args)",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def se... | [
"0.63201934",
"0.6314181",
"0.6128475",
"0.6128475",
"0.6128475",
"0.6128475",
"0.6128475",
"0.6122542",
"0.6122542",
"0.6022324",
"0.6015917",
"0.600689",
"0.60021234",
"0.59892446",
"0.5988903",
"0.59812367",
"0.5977737",
"0.59760904",
"0.5967097",
"0.59655523",
"0.59655523... | 0.82391423 | 0 |
This function updates the database to ensure that the members semesters paid is decremented by one. Run this function once per semester at the END of the semester. Running this prematurely may result in members appearing to be unpaid when they are in fact paid. If a members semester paid (dues_paid) value ever falls be... | def run_end_of_semester():
connection = get_connection()
cursor = connection.cursor()
sql_string = "SELECT netID FROM MEMBER"
cursor.execute(sql_string)
entries = cursor.fetchall()
for entry in entries:
#example string:
#UPDATE Member SET dues_paid = (SELECT dues_paid FROM Member... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finalize_memberships():\n memberships = Membership.objects.all()\n for membership in memberships:\n membership.available_days -= 1\n membership.save()\n if membership.available_days == 0:\n membership.delete()\n profile = membership.user.profile\n pro... | [
"0.63669664",
"0.6186703",
"0.59360194",
"0.58630836",
"0.5767328",
"0.5707056",
"0.54516405",
"0.53881466",
"0.53559357",
"0.5223189",
"0.51733625",
"0.51517355",
"0.5131988",
"0.5127758",
"0.5098497",
"0.5088823",
"0.5075988",
"0.50227106",
"0.50145364",
"0.49799365",
"0.49... | 0.74120164 | 0 |
Get the list of persistent subscriptions for a given stream. | def get_stream_subscriptions(self, stream, local=False, isCollectionStream=False):
type_constant = constants.STREAM_GLOBAL_NS_PREFIX
if local:
type_constant = constants.STREAM_LOCAL_NS_PREFIX
if isCollectionStream is False:
stream = type_constant.replace(".", "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscriptions(self):\n return self.subscriptions.all()",
"def subscribers(id):\n return core.query(schema.streamBySubscribers, id)",
"def get_subscriptions(self) -> Iterator[\"Subscription\"]:\n yield from self._subscriptions[self.id]",
"def getsubscriptions(self):\n subs = {}... | [
"0.64453465",
"0.63017",
"0.6282609",
"0.62488437",
"0.6210649",
"0.61723197",
"0.61405814",
"0.6119435",
"0.6048308",
"0.6029438",
"0.60041195",
"0.5980617",
"0.5967056",
"0.59476316",
"0.5919334",
"0.5888426",
"0.5859906",
"0.5847143",
"0.58318067",
"0.58284813",
"0.5805561... | 0.6515627 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in xrange(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.76458347",
"0.76... | 0.7664208 | 15 |
save transition(state, action, state_next, reward) on memory | def push(self, state, action, state_next, reward):
if len(self.memory) < self.capacity:
self.memory.append(None)
self.memory[self.index] = Transition(state, action, state_next, reward)
self.index = (self.index+1) % self.capacity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remember(self, state, action, reward, next_state, done):\n self.memory.store_transition(state, action, reward, next_state, done)",
"def store(self, state, action, reward, next_state, done):\n self.replay_memory.append((state, action, reward, next_state, done))",
"def store_transition(self, st... | [
"0.80997014",
"0.8027614",
"0.78709704",
"0.76576394",
"0.7565871",
"0.75102687",
"0.74917406",
"0.73098683",
"0.71566135",
"0.71431875",
"0.7142068",
"0.7052871",
"0.70438755",
"0.7033314",
"0.702911",
"0.7009684",
"0.69990855",
"0.6984384",
"0.6806627",
"0.67822224",
"0.675... | 0.6871432 | 18 |
Return an object containing movies that have sequels. Included in the data is a sequel count for each movie. | def have_sequels(self):
# Get any movies that may be a sequel to another movie in the db.
regex = ' (VIII|VII|VI|V|IV|III|II)?$'
sequels = Movie.objects.filter(name__regex=regex)
# For each potential sequel, find the original version of the movie and
# add it to the result set -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movies(self):\n return self.data.groupby('Parameters')",
"def seasons(self):\n if self._season_cache_ver == self._db._version:\n return self._season_cache\n\n # Find out how many seasons in this series by fetching the highest season.\n seasons = self._db.query(type='epi... | [
"0.57516795",
"0.52561754",
"0.5255407",
"0.5214885",
"0.5150534",
"0.5132368",
"0.50735825",
"0.50451887",
"0.50289625",
"0.49071613",
"0.48980388",
"0.48542562",
"0.48462233",
"0.48284057",
"0.48234606",
"0.48064923",
"0.4761629",
"0.47448117",
"0.46944073",
"0.46528056",
"... | 0.7861201 | 0 |
Send email only if user signed up by email. | def user_signed_up_(request, user, **kwargs):
percentage = 0
for key in PERCENTAGE_BASIC_DETAILS_FIELDS.keys():
if getattr(user, key) not in ["NS", None]:
percentage += PERCENTAGE_BASIC_DETAILS_FIELDS[key]
User.objects.filter(id=user.id).update(profile_completion_percentage=percentage)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_signup_user(email, msg, settings, message_data):\r\n from bookie.lib.message import ActivationMsg\r\n msg = ActivationMsg(email, msg, settings)\r\n status = msg.send(message_data)\r\n if status == 4:\r\n from bookie.lib.applog import SignupLog\r\n trans = transaction.begin()\r\n... | [
"0.71819746",
"0.6592231",
"0.65630525",
"0.6542936",
"0.65299785",
"0.6529051",
"0.6488187",
"0.6486482",
"0.6481081",
"0.647809",
"0.6450923",
"0.64473075",
"0.6445198",
"0.6432277",
"0.6418857",
"0.64036417",
"0.6378019",
"0.6369633",
"0.6369367",
"0.63639426",
"0.63572156... | 0.0 | -1 |
View function for home page of site. | def index(request):
# Generate counts of some of the main objects
num_books=Book.objects.all().count()
num_instances=BookInstance.objects.all().count()
# Available books (status = 'a')
num_instances_available=BookInstance.objects.filter(status__exact='a').count()
# Render the HTML templ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(request):\n\treturn render(request, \"compta/home.html\")",
"def home_page(request):\r\n return render(request, 'ez_main/home_page.html')",
"def home(request):\r\n return render(request, 'home.html')",
"def homepage(request):\n\treturn render(request, 'core/homepage.html')",
"def homepage(req... | [
"0.849322",
"0.84272915",
"0.8341576",
"0.83309823",
"0.8298116",
"0.82954043",
"0.8276347",
"0.8254529",
"0.8215572",
"0.813312",
"0.81240594",
"0.8122915",
"0.81204784",
"0.8104254",
"0.80974406",
"0.80929583",
"0.80929583",
"0.80929583",
"0.80929583",
"0.80929583",
"0.8092... | 0.0 | -1 |
Returns names of all type of measurement that can be collected from sensor. | def get_measurement_types():
all_measures = ['temperature', 'humidity', 'pressure']
####################
return all_measures
#################### | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sensor_types():\n sensors = FetchandStore.get_data(\"https://tie.digitraffic.fi/api/v1/data/weather-data\")\n sensornames = [sensor[\"name\"] for sensor in sensors ]\n sensornames = list(set(sensornames))\n for index, sensorname in enumerate(sorted(sensornames)):\n print(... | [
"0.7149051",
"0.71399355",
"0.6890928",
"0.67240286",
"0.6566882",
"0.64986306",
"0.64895433",
"0.646307",
"0.6410755",
"0.63638294",
"0.63449687",
"0.6275012",
"0.62392426",
"0.623474",
"0.6134032",
"0.6123516",
"0.6064614",
"0.60195863",
"0.60082895",
"0.5941735",
"0.593996... | 0.8275239 | 0 |
Returns simulation indices for each batch. | def batch_indices(self):
b = self.batch_size
return [np.arange(i*b, i*b+b) for i in range(self.num_batches)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBatch(self, n, rng, dataset):\n pmax = self._root.priority\n step = pmax / n\n indices = np.zeros(n, dtype='int32')\n for i in range(n):\n p = rng.uniform(i*step, (i+1)*step)\n node = self.find(p)\n index = self._checkTerminal(node.position, datas... | [
"0.6484931",
"0.63545775",
"0.62493354",
"0.61353695",
"0.6069578",
"0.60541326",
"0.6015781",
"0.6007576",
"0.6003031",
"0.5963983",
"0.5957164",
"0.5942351",
"0.59320587",
"0.590528",
"0.59003115",
"0.5867581",
"0.58520615",
"0.5764001",
"0.57462007",
"0.5727988",
"0.572587... | 0.7248145 | 0 |
Returns Batch of simulations. | def get_batch(self, batch_id):
#fmt = lambda x: join(self.path, self.simulation_paths[x])
fmt = lambda x: self.simulation_paths[x]
simulation_paths = [fmt(i) for i in self.batch_indices[batch_id]]
return Batch(simulation_paths, root=self.path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batches(self):\n return [self.get_batch(i) for i in range(self.num_batches)]",
"def make_simulations(self):\n pass",
"def create_all_background_simulations(self):\r\n simulations = []\r\n simulations_ids = count(1)\r\n simulations_permutations = self.create_permutations()... | [
"0.65918654",
"0.6588829",
"0.64610994",
"0.62035245",
"0.6104148",
"0.6091849",
"0.60865116",
"0.60746044",
"0.6015022",
"0.5848671",
"0.5834533",
"0.5786289",
"0.5706551",
"0.5706271",
"0.5688351",
"0.5669418",
"0.56669545",
"0.565456",
"0.56469566",
"0.5634723",
"0.5632444... | 0.53668433 | 61 |
Returns float The intercept for the regression model, both in PCAspace and in the original Xspace. | def intercept_(self):
return self.regression.intercept_ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intercept(self) -> np.ndarray:\n return self._intercept",
"def xintercept(self):\n if self.slope() == 0:\n return None\n else:\n return self.c/self.a",
"def get_fit_intercept(self):\n return self.fit_intercept",
"def intercept(self):\n return self.... | [
"0.72997254",
"0.7032565",
"0.6881393",
"0.6861565",
"0.65778625",
"0.6526551",
"0.6416596",
"0.6281493",
"0.6198875",
"0.60104394",
"0.59822035",
"0.58986765",
"0.5896262",
"0.5893306",
"0.5886017",
"0.58669794",
"0.58651",
"0.5801083",
"0.5662712",
"0.5647124",
"0.560309",
... | 0.72896934 | 1 |
Tests that trying to cast to the input type causes an error. | def test_init_same_type(self, config: HandlerConfig) -> None:
# Arrange.
# Make it look like both units are the same type.
config.mock_from_unit.is_compatible.return_value = True
config.mock_to_unit.is_compatible.return_value = True
# Act and assert.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_as_type_invalid_cast(self, wrapped_unit: MyType) -> None:\n # Arrange.\n # Create a new fake UnitType.\n other_type = mock.MagicMock()\n # Give it a name for easier debugging.\n other_type.__name__ = \"OtherType\"\n\n # A fake unit to convert.\n to_convert ... | [
"0.74648464",
"0.71662015",
"0.7030438",
"0.70297706",
"0.69756204",
"0.6962889",
"0.68221825",
"0.6792473",
"0.6791158",
"0.67358685",
"0.6733664",
"0.6721574",
"0.65562814",
"0.65533173",
"0.65022475",
"0.64720994",
"0.6451617",
"0.644495",
"0.6440527",
"0.6429706",
"0.6382... | 0.60553384 | 47 |
Returns the v1 recipe definition JSON for the given recipe definition | def convert_recipe_definition_to_v1_json(definition):
input_data = []
for parameter in definition.input_interface.parameters.values():
input_data_dict = {'name': parameter.name, 'required': parameter.required}
if parameter.param_type == FileParameter.PARAM_TYPE:
input_data_dict['typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_recipe_raw_definition(self):\n return self.recipe_settings",
"def recipe_as(self, recipe):\n prefix, suffix = self._get_jsonp()\n return prefix + JSON.recipe_as(self, recipe) + suffix",
"def _format_recipe(recipe):\n # Some fields are not consistently returned from the API, ... | [
"0.61709976",
"0.6101443",
"0.59689856",
"0.585736",
"0.58034945",
"0.58034945",
"0.5633648",
"0.552476",
"0.55204403",
"0.54341507",
"0.5423151",
"0.5423151",
"0.5375078",
"0.52640104",
"0.52515584",
"0.51887536",
"0.51826286",
"0.5165345",
"0.5158399",
"0.51283306",
"0.5124... | 0.7984808 | 0 |
Creates a v1 recipe definition JSON object from the given dictionary | def __init__(self, definition=None, do_validate=False):
if not definition:
definition = {}
self._definition = definition
if 'version' not in self._definition:
self._definition['version'] = DEFAULT_VERSION
if self._definition['version'] != DEFAULT_VERSION:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_recipe_definition_to_v1_json(definition):\n\n input_data = []\n for parameter in definition.input_interface.parameters.values():\n input_data_dict = {'name': parameter.name, 'required': parameter.required}\n if parameter.param_type == FileParameter.PARAM_TYPE:\n input_dat... | [
"0.7250429",
"0.62862056",
"0.6062529",
"0.6056447",
"0.6030971",
"0.60003966",
"0.5773899",
"0.56571335",
"0.55765814",
"0.5534653",
"0.55206394",
"0.54503477",
"0.54503477",
"0.5441728",
"0.54324377",
"0.5429954",
"0.5412238",
"0.5365865",
"0.5356793",
"0.5341673",
"0.53172... | 0.51741236 | 29 |
Get the command line arguments | def get_command_line_arguments():
parser = argparse.ArgumentParser(description='Training script for Lux RL agent.')
parser.add_argument('--id', help='Identifier of this run', type=str, default=str(random.randint(0, 10000)))
parser.add_argument('--learning_rate', help='Learning rate', type=float, default=0.0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cli_arguments(self):\n pass",
"def get_args():\n\n parser = get_argument_parser()\n args = parser.parse_args()\n\n return args",
"def get_command_line_args():\n \n parser = argparse.ArgumentParser()\n parser.add_argument('-s', '--symbol', help='symbol query')\n\n ... | [
"0.81876403",
"0.78115046",
"0.7758656",
"0.7589955",
"0.7581819",
"0.75676763",
"0.7533646",
"0.75306165",
"0.7524564",
"0.7522715",
"0.74770534",
"0.7473281",
"0.74606335",
"0.74426633",
"0.7437458",
"0.7433479",
"0.7403201",
"0.7399979",
"0.73626983",
"0.7356871",
"0.73470... | 0.0 | -1 |
Create list of symbolic models from list of constraints. | def get_symbolic_constraint_models(constraint_list):
symbolic_models = [con.get_symbolic_model() for con in constraint_list]
return symbolic_models | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_symbolic_models(self):\n return get_symbolic_constraint_models(self.constraints)",
"def get_input_constraint_symbolic_models(self):\n return get_symbolic_constraint_models(self.input_constraints)",
"def get_input_and_state_constraint_symbolic_models(self):\n return get_symbolic... | [
"0.6720935",
"0.6604116",
"0.6061367",
"0.57600373",
"0.57306725",
"0.5673877",
"0.56720406",
"0.5646246",
"0.56300354",
"0.5564367",
"0.5564367",
"0.5561411",
"0.55342615",
"0.55069935",
"0.55042267",
"0.5489418",
"0.54208297",
"0.5405674",
"0.5357118",
"0.53316927",
"0.5324... | 0.7994029 | 0 |
Gets the constraint list length. | def __len__(self):
return len(self.constraints) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list_length(self):\r\n return self._api.get_list_length()",
"def number_of_constraints(self):\n return len(self.constraints)",
"def length(self):\n return self.list.length",
"def length(self):\n return self.list.length",
"def getLength(self):\r\n return len(self.l... | [
"0.75647",
"0.74716944",
"0.7277864",
"0.7277864",
"0.72583824",
"0.71741503",
"0.7154733",
"0.7145619",
"0.71263385",
"0.71193296",
"0.7083542",
"0.7075465",
"0.704117",
"0.7038371",
"0.6993606",
"0.6993606",
"0.69927025",
"0.6987867",
"0.6973777",
"0.69580966",
"0.69423485"... | 0.77659154 | 0 |
Computes the output of the decoder layer. | def call(self,
inputs,
encoder_outputs,
look_ahead_mask,
padding_mask,
training,
cache=None):
query = reference = self._layernorm_mha_intra(inputs)
outputs = self._mha_intra(
query, reference, look_ahead_mask, training, cache=cache)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(self, decoder_input, sampler_output):\n\n self.attention_hidden, self.attention_cell = self.attention_lstm(\n decoder_input, (self.attention_hidden, self.attention_cell))\n self.attention_hidden = F.dropout(\n self.attention_hidden, self.p_attention_dropout, self.trai... | [
"0.7319583",
"0.72437924",
"0.71589524",
"0.7131469",
"0.7008653",
"0.6987145",
"0.6983874",
"0.6965416",
"0.6904709",
"0.68299496",
"0.68055284",
"0.67707664",
"0.6711518",
"0.66930145",
"0.6690021",
"0.666011",
"0.6564177",
"0.64769137",
"0.64134175",
"0.6409309",
"0.640320... | 0.0 | -1 |
Takes as input the source and target token ids, and returns the estimated logits for the target sequences. Note this function should be called in training mode only. | def call(self, src_token_ids, tgt_token_ids):
padding_mask = utils.get_padding_mask(src_token_ids, SOS_ID)
encoder_outputs = self._encode(src_token_ids, padding_mask, training=True)
logits = self._decode(
tgt_token_ids, encoder_outputs, padding_mask)
return logits | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_extracted_logits(args, concat_logits, sentence_token_ids):\n # (batch_size, max_len, vocab_size)\n\n # concatenate all batches\n prediction_scores = torch.cat(concat_logits, axis=0)\n\n if prediction_scores.shape[0] == 0:\n return [None], [None], [None]\n elif prediction_scores.sh... | [
"0.62186915",
"0.6035615",
"0.5991248",
"0.59197724",
"0.586245",
"0.57157457",
"0.5707674",
"0.5689875",
"0.5683518",
"0.56812346",
"0.5642958",
"0.56159955",
"0.5615901",
"0.5599286",
"0.55966735",
"0.5492784",
"0.5454842",
"0.54466915",
"0.54146147",
"0.5413821",
"0.538304... | 0.7595194 | 0 |
Computes the estimated logits of target token ids, based on the encoded source sequences. Note this function should be called in training mode only. | def _decode(self, tgt_token_ids, encoder_outputs, padding_mask):
tgt_seq_len = tf.shape(tgt_token_ids)[1]
# [batch_size, tgt_seq_len, hidden_size]
tgt_token_embeddings = self._embedding_logits_layer(
tgt_token_ids, 'embedding')
# [tgt_seq_len, hidden_size]
positional_encoding = utils.get_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(self, src_token_ids, tgt_token_ids):\n padding_mask = utils.get_padding_mask(src_token_ids, SOS_ID)\n encoder_outputs = self._encode(src_token_ids, padding_mask, training=True)\n logits = self._decode(\n tgt_token_ids, encoder_outputs, padding_mask)\n return logits",
"def data_to_toke... | [
"0.732148",
"0.6449221",
"0.64204353",
"0.615949",
"0.6032487",
"0.5917816",
"0.58999336",
"0.5863381",
"0.5855574",
"0.58284295",
"0.5808619",
"0.5780792",
"0.5767678",
"0.56971204",
"0.56967306",
"0.5675012",
"0.56208116",
"0.5603362",
"0.5582367",
"0.55696166",
"0.55484575... | 0.61755896 | 3 |
Takes as input the source token ids only, and outputs the token ids of the decoded target sequences using beam search. Note this function should be called in inference mode only. | def transduce(self, src_token_ids):
batch_size, src_seq_len = tf.unstack(tf.shape(src_token_ids))
max_decode_length = src_seq_len + self._extra_decode_length
decoding_fn = self._build_decoding_fn(max_decode_length)
decoding_cache = self._build_decoding_cache(src_token_ids, batch_size)
sos_ids = tf.o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _decode(self, tgt_token_ids, encoder_outputs, padding_mask):\n tgt_seq_len = tf.shape(tgt_token_ids)[1]\n\n # [batch_size, tgt_seq_len, hidden_size]\n tgt_token_embeddings = self._embedding_logits_layer(\n tgt_token_ids, 'embedding')\n\n # [tgt_seq_len, hidden_size]\n positional_encoding ... | [
"0.6721631",
"0.64324224",
"0.6414864",
"0.61933273",
"0.6150404",
"0.60951316",
"0.60701597",
"0.60650873",
"0.6008842",
"0.5974258",
"0.59090567",
"0.58860636",
"0.5876962",
"0.5869006",
"0.58279914",
"0.5776144",
"0.5729593",
"0.5724102",
"0.5722021",
"0.571703",
"0.569644... | 0.7278429 | 0 |
Builds a dictionary that caches previously computed key and value feature maps and attention weights of the growing decoded sequence. | def _build_decoding_cache(self, src_token_ids, batch_size):
padding_mask = utils.get_padding_mask(src_token_ids, SOS_ID)
encoder_outputs = self._encode(src_token_ids, padding_mask, training=False)
size_per_head = self._hidden_size // self._num_heads
src_seq_len = padding_mask.shape[-1]
decoding_ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_dict(datagen, keep_prob=0.5):\n bx, by, br = next(datagen)\n while not (bx.shape[0] > 0 and bx.shape[1] > 0):\n bx, by, br = next(datagen)\n\n dec_lengths = np.full((bx.shape[0], ), bx.shape[1], dtype=np.int32)\n\n feed_dict = {\n ... | [
"0.6315829",
"0.62677526",
"0.60323584",
"0.6020446",
"0.60019535",
"0.59072214",
"0.59032166",
"0.58442223",
"0.5824739",
"0.5822384",
"0.5782209",
"0.5780009",
"0.57400274",
"0.56984276",
"0.5677791",
"0.5653472",
"0.564991",
"0.56240684",
"0.56113446",
"0.55793875",
"0.557... | 0.56094515 | 19 |
Updates the date dropdown selector for the US Treasury Curve plot | def update_treasury_date_dropdown(add_button, date, existing_dates):
date = app_obj.utils.parse_date(date).date()
existing_dates_lst = [str(d["value"]) for d in existing_dates]
if str(date) not in existing_dates_lst:
existing_dates.append({'label': date, 'value': date})
return existing_dates | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_treasury_curve_graph(dates):\n\n if not isinstance(dates, list):\n dates = [dates]\n\n # Variables to update\n dates = list(map(app_obj.utils.parse_date, dates))\n df = dl.macro.get_treasury_curve(dates)\n\n if len(dates) > 1:\n title = \"US Treasury Yield Curve\"\n elif ... | [
"0.6316083",
"0.5895226",
"0.5871739",
"0.5739442",
"0.57329386",
"0.56489575",
"0.55692434",
"0.53081036",
"0.52715707",
"0.5269471",
"0.5242455",
"0.5237529",
"0.52213037",
"0.52142614",
"0.51683587",
"0.51552796",
"0.5142742",
"0.51418936",
"0.51286465",
"0.5041402",
"0.50... | 0.6368112 | 0 |
Updates the date dropdown selector for the US Treasury Curve plot | def update_swap_date_dropdown(add_button, date, existing_dates):
date = app_obj.utils.parse_date(date).date()
existing_dates_lst = [str(d["value"]) for d in existing_dates]
if str(date) not in existing_dates_lst:
existing_dates.append({'label': date, 'value': date})
return existing_dates | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_treasury_date_dropdown(add_button, date, existing_dates):\n date = app_obj.utils.parse_date(date).date()\n\n existing_dates_lst = [str(d[\"value\"]) for d in existing_dates]\n\n if str(date) not in existing_dates_lst:\n existing_dates.append({'label': date, 'value': date})\n\n return ... | [
"0.63679045",
"0.6315381",
"0.58951956",
"0.5871215",
"0.57396334",
"0.5733645",
"0.56488234",
"0.5569513",
"0.5308155",
"0.52711445",
"0.52692676",
"0.52419335",
"0.52377194",
"0.5220252",
"0.5214798",
"0.5168824",
"0.51556545",
"0.5143205",
"0.5142608",
"0.51286757",
"0.504... | 0.48586145 | 33 |
Updates the US Treasury Yield Curve plot | def update_treasury_curve_graph(dates):
if not isinstance(dates, list):
dates = [dates]
# Variables to update
dates = list(map(app_obj.utils.parse_date, dates))
df = dl.macro.get_treasury_curve(dates)
if len(dates) > 1:
title = "US Treasury Yield Curve"
elif len(dates) == 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_yield_curve(self):\n data = Bootstrapping.get_ytm_discount_data(self)\n fig = plt.figure(figsize=[10, 6])\n ax = fig.add_subplot(1, 1, 1)\n ax.plot(data['Yield to maturity'])\n ax.set_xlabel('year')\n ax.set_ylabel('rate')\n ax.set_title('Zero-coupon yield ... | [
"0.70127887",
"0.57041097",
"0.5498102",
"0.54678935",
"0.5446348",
"0.5444202",
"0.5437324",
"0.53771615",
"0.5360551",
"0.5351194",
"0.53176993",
"0.52774304",
"0.5275424",
"0.52347016",
"0.5232244",
"0.52309996",
"0.5230035",
"0.5223509",
"0.5214762",
"0.5204662",
"0.51792... | 0.71769685 | 0 |
Updates the US Treasury Yield Curve plot | def update_swap_curve_graph(dates):
if not isinstance(dates, list):
dates = [dates]
# Variables to update
dates = list(map(app_obj.utils.parse_date, dates))
df = dl.macro.get_swap_curve(dates)
if len(dates) > 1:
title = "USD Swap Curve"
elif len(dates) == 1:
title = f"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_treasury_curve_graph(dates):\n\n if not isinstance(dates, list):\n dates = [dates]\n\n # Variables to update\n dates = list(map(app_obj.utils.parse_date, dates))\n df = dl.macro.get_treasury_curve(dates)\n\n if len(dates) > 1:\n title = \"US Treasury Yield Curve\"\n elif ... | [
"0.7177669",
"0.7011968",
"0.570454",
"0.54698384",
"0.54487795",
"0.5446485",
"0.5438269",
"0.5379529",
"0.5362728",
"0.5353498",
"0.53206056",
"0.52786106",
"0.52762467",
"0.5234873",
"0.5233306",
"0.5232386",
"0.5230204",
"0.52228564",
"0.52165943",
"0.52066034",
"0.518032... | 0.5497115 | 3 |
Set the direction of the fan. | def set_direction(self, direction: str) -> None:
self.wink.set_fan_direction(direction) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_set_direction(self, direction: str) -> None:\n if direction == DIRECTION_FORWARD:\n self._device.fan_dir = SENSEME_DIRECTION_FORWARD\n else:\n self._device.fan_dir = SENSEME_DIRECTION_REVERSE",
"def set_direction(self, dir):\n if dir == 0:\n s... | [
"0.8002017",
"0.7371954",
"0.7242101",
"0.71836823",
"0.70205814",
"0.6959635",
"0.69295996",
"0.6862913",
"0.680304",
"0.6784216",
"0.671103",
"0.66704005",
"0.6656352",
"0.66099894",
"0.66099894",
"0.656002",
"0.64762187",
"0.6465095",
"0.6440604",
"0.64347273",
"0.64276415... | 0.84235466 | 0 |
Return true if the entity is on. | def is_on(self):
return self.wink.state() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_on(self) -> bool:\n return self.entity_description.is_on_fn(self._client)",
"def is_on(self) -> bool:\n return self.entity_description.state_fn(self._valve)",
"def is_on(self) -> bool:\n return self.entity_description.get_ufp_value(self.device) is True",
"def is_on(self) -> bool:\... | [
"0.87465113",
"0.84266686",
"0.81326634",
"0.81326634",
"0.80003965",
"0.7792787",
"0.77730155",
"0.77141106",
"0.76367974",
"0.76367974",
"0.76367974",
"0.76367974",
"0.76367974",
"0.76222014",
"0.76222014",
"0.76222014",
"0.76222014",
"0.76222014",
"0.76222014",
"0.76222014",... | 0.6858198 | 80 |
test the application is existing | def test_app_exists(self):
self.assertFalse(current_app is None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_app_is_created(app):\n assert app.name == \"myapp.app\"",
"def test_create_app():\n assert not create_app().testing\n assert create_app({'TESTING': True}).testing",
"def test_06_applications_2(self):\r\n with self.flask_app.app_context():\r\n self.create()\r\n\r\n ... | [
"0.75029016",
"0.71167576",
"0.6975744",
"0.6966747",
"0.69663864",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
"0.6958118",
... | 0.865878 | 0 |
Creates an archive of web_static with .tgz format | def do_pack():
makedirs('versions', exist_ok=True)
date = 'versions/web_static_{}{}{}{}{}{}.tgz'.format(
time.year, time.month, time.day, time.minute, time.second)
check = local("tar -cvzf " + date + " ./web_static/")
if check.succeeded:
return date
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_pack():\n now = datetime.datetime.now()\n path = 'versions/web_static_' +\\\n '{}{}{}{}{}{}'.format(now.year, now.month,\n now.day, now.hour,\n now.minute, now.second) + '.tgz'\n\n local('mkdir -p versions')\n success = lo... | [
"0.8182459",
"0.8038955",
"0.8009358",
"0.79612845",
"0.7926607",
"0.79021347",
"0.79015094",
"0.787007",
"0.78659654",
"0.7856876",
"0.7829254",
"0.7760937",
"0.77472615",
"0.76877767",
"0.7682033",
"0.7641572",
"0.7625207",
"0.76055473",
"0.7588102",
"0.7587893",
"0.7531546... | 0.751031 | 22 |
Mark a video as flagged. | def flag_video(self, video_id, flag_reason=""):
print("flag_video needs implementation") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flag_video(self, video_id, flag_reason=\"Not supplied\"):\n video = self._video_library.get_video(video_id)\n if not video:\n print(\"Cannot flag video: Video does not exist\")\n return\n if video.flag is not None:\n print(\"Cannot flag video: Video is alre... | [
"0.7585753",
"0.7543017",
"0.6934897",
"0.68738246",
"0.67508376",
"0.6579819",
"0.65071416",
"0.59914064",
"0.5956641",
"0.583062",
"0.5781579",
"0.5766682",
"0.57447886",
"0.57447886",
"0.57447886",
"0.57447886",
"0.56196725",
"0.5476563",
"0.54668385",
"0.53899056",
"0.535... | 0.7286989 | 2 |
returns a list of of lists of tokens augmented with cues. also returns a list of idxs of tokens, in front of which a cue was inserted | def process_doc(nlp, matcher, text, split_sents=False):
doc = nlp(text)
sent_ids = [(sent.start, sent.end) for sent in doc.sents]
matches = matcher(doc)
# identify matches over the same span (MWE matches)
outputs = []
insertion_idxs = []
if split_sents:
segment_ids = sent_ids
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_augmented_sentences(self) -> list:\n return self.augmented_sentence_list",
"def _get_all_possible_tokens_ahead(self, context):\n tokens = []\n if context.position < len(context.input_str):\n for terminal in self.grammar.terminals.values():\n try:\n ... | [
"0.6007375",
"0.56676924",
"0.56605214",
"0.5653904",
"0.561744",
"0.5612755",
"0.5609536",
"0.55499583",
"0.5531606",
"0.5530382",
"0.5530382",
"0.5464793",
"0.5420096",
"0.5407237",
"0.5404665",
"0.5399825",
"0.5379936",
"0.53538287",
"0.5323158",
"0.53222764",
"0.53155655"... | 0.0 | -1 |
Converts from a Python `datetime` object. The resulting timestamp is aware or naive depending on whether the datetime object is so. It is always canonical. | def iso_from_datetime(py_datetime: datetime) -> ISOTimestamp:
base_ts = py_datetime.isoformat(sep=' ', timespec='seconds')
decimals = f".{py_datetime.microsecond:06}".rstrip('0.')
return ISOTimestamp(f"{base_ts[:19]}{decimals}{base_ts[19:]}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _datetime_to_timestamp(self, dt):\n return time.mktime(dt.timetuple())",
"def _normalize_timestamp(timestamp):\n if isinstance(timestamp, datetime.datetime):\n timestamp = time.mktime(timestamp.timetuple())\n return timestamp",
"def to_timestamp(value):\n if not isinstanc... | [
"0.68928134",
"0.6804961",
"0.6739286",
"0.6735331",
"0.67178756",
"0.66334987",
"0.6563601",
"0.6562498",
"0.65226996",
"0.6515211",
"0.6510304",
"0.6408954",
"0.6397091",
"0.6357933",
"0.63567334",
"0.63506657",
"0.63433874",
"0.6341242",
"0.633366",
"0.6298633",
"0.6298408... | 0.58847636 | 51 |
Converts from a UNIX timestamp, which is defined as the (possibly floatingpoint) number of seconds since the UNIX | def iso_from_unix_time(unix_time: float, precision: int = 9) -> ISOTimestamp:
frac_part, int_part = math.modf(unix_time)
seconds = int(int_part)
if frac_part < 0:
seconds -= 1
frac_part += 1
decimals = f"{{0:.{precision}f}}".format(frac_part)[1:].rstrip('0.') # noqa
return _from... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_to_unix(timestamp):\n return timestamp / 1e6",
"def unix_to_timestamp(unix):\n return int(round(unix * 1e6))",
"def timestamp2sec(timestamp):\n return (int(timestamp.seconds) + 60 * int(timestamp.minutes) + 3600 * int(timestamp.hours) + float(int(timestamp.hours) / 1000))",
"def from_T... | [
"0.7793631",
"0.748361",
"0.7422288",
"0.7393854",
"0.7393115",
"0.73410517",
"0.72873163",
"0.7094508",
"0.7089574",
"0.7019733",
"0.68634385",
"0.68456674",
"0.67356116",
"0.67199403",
"0.67126966",
"0.66765016",
"0.6637003",
"0.66334635",
"0.6626025",
"0.66118824",
"0.6601... | 0.0 | -1 |
Like `iso_from_unix_time`, but takes a UNIX time specified in an integral number of nanoseconds since the UNIX epoch, as is the case for the `stat` call in more modern POSIX systems. | def iso_from_unix_time_nanos(unix_time_nanos: int) -> ISOTimestamp:
seconds, nanos = divmod(unix_time_nanos, 1000000000)
return _from_unix_time(seconds, f".{nanos:09}".rstrip('0.')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iso_from_unix_time(unix_time: float, precision: int = 9) -> ISOTimestamp:\n frac_part, int_part = math.modf(unix_time)\n\n seconds = int(int_part)\n\n if frac_part < 0:\n seconds -= 1\n frac_part += 1\n\n decimals = f\"{{0:.{precision}f}}\".format(frac_part)[1:].rstrip('0.') # noqa\n... | [
"0.6873119",
"0.6841705",
"0.6690594",
"0.6409187",
"0.6345398",
"0.6308382",
"0.6285912",
"0.6284337",
"0.6100769",
"0.6077109",
"0.60379446",
"0.6012509",
"0.59663635",
"0.5905667",
"0.587394",
"0.58120483",
"0.5805675",
"0.5801703",
"0.5799543",
"0.57534105",
"0.5729217",
... | 0.6899322 | 0 |
Converts to UNIX time, in float format. Note that this function does not check whether the resulting value fits any POSIXspecific limits. If the timestamp does not specify any timezone, it will be assumed to be relative to UTC. | def iso_to_unix_time(iso_time: ISOTimestamp) -> float:
base_ts, decimals, tz_part = iso_timestamp_split(iso_time)
if tz_part == '':
tz_part = '+00:00'
return datetime.fromisoformat(base_ts + tz_part).timestamp() + (float(decimals) if decimals != '' else 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_to_unix(timestamp):\n return timestamp / 1e6",
"def to_unix(cls, timestamp):\n if not isinstance(timestamp, datetime.datetime):\n raise TypeError(\"Time.milliseconds expects a datetime object\")\n return timestamp.timestamp()",
"def to_unix_time(timestamp):\n date =... | [
"0.74473137",
"0.669871",
"0.6665431",
"0.6633857",
"0.6366789",
"0.6252085",
"0.6221789",
"0.6219085",
"0.6159659",
"0.6136492",
"0.60856915",
"0.60229105",
"0.60129255",
"0.59996086",
"0.5911279",
"0.5906084",
"0.58990073",
"0.5883957",
"0.5874994",
"0.58646345",
"0.5860488... | 0.63550776 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.