query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Optimization method to find the best size for the hidden node according to a training set. | def find_optimal_model(
self, training_set, use_aic=False, min_node=10,
max_node=90, start_size=20, end_size=5, node_samples=4,
check_decreasing_ll=False, missing_residues=None):
if not self.show_warnings:
warning_list = warnings.filters[:]
warnings.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hidden_layer_size(self):\r\n return self.hidden_layer_size",
"def get_num_hidden(self) -> int:\n return self.config.model_size",
"def get_n_best(self):\n pass",
"def get_final_emb_size(self):\n size = self.n_layers * 1 * 2 * self.hidden_size\n return size",
... | [
"0.5985635",
"0.5964452",
"0.593218",
"0.58241916",
"0.58158845",
"0.58039904",
"0.5761179",
"0.5725219",
"0.5707045",
"0.5702115",
"0.5667222",
"0.56550604",
"0.5606332",
"0.5548744",
"0.5548744",
"0.5546417",
"0.55433387",
"0.5542178",
"0.5492614",
"0.5483099",
"0.5469575",... | 0.6054712 | 0 |
Print a message to the standard output, in case show_info is enabled. | def info(self, message):
if self.show_info:
print(message) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_info(msg):\n print(msg)",
"def show_info(title, message):\n\n pass",
"def print_info(message: str):\n global verbose\n if verbose:\n print(\"%s%s%s\" % (KYEL, message, KNRM))",
"def info(msg, *args):\n if args:\n msg %= args\n click.echo(msg, file=sys.stdout)",
"de... | [
"0.78605205",
"0.7734865",
"0.76229465",
"0.7563187",
"0.7400993",
"0.73952097",
"0.7378441",
"0.7370511",
"0.7139444",
"0.7125532",
"0.7115362",
"0.71005535",
"0.7092673",
"0.70315975",
"0.70026535",
"0.6999533",
"0.69383913",
"0.69325316",
"0.6913429",
"0.6901743",
"0.68721... | 0.83142126 | 0 |
Does the url contain a downloadable resource | def is_downloadable(url):
h = requests.head(url, allow_redirects=True)
header = h.headers
content_type = header.get('content-type')
if 'text' in content_type.lower():
return False
if 'html' in content_type.lower():
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_downloadable(url) -> bool:\n content_type = requests.head(url, allow_redirects=True).headers.get('content-type')\n if 'text' in content_type.lower() or 'html' in content_type.lower():\n return False\n return True",
"def is_downloadable(self):\n return True",
"def is_downloadable(s... | [
"0.7863911",
"0.76044476",
"0.75145316",
"0.74376166",
"0.736647",
"0.7229701",
"0.71826774",
"0.7152465",
"0.71362215",
"0.70722294",
"0.7068388",
"0.70574546",
"0.7050864",
"0.6838795",
"0.6838795",
"0.6756243",
"0.67460054",
"0.66819596",
"0.66469514",
"0.6644246",
"0.6609... | 0.7924052 | 0 |
Go to the given workspace number. | def go_to(i3: i3ipc.Connection, workspace: int):
i3.command(f"workspace number {workspace}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_workspace(num):\n LOGGER.debug('change_workspace: requested workspace {}'.format(num))\n output = get_focused_output()\n prefix = get_workspace_prefix(output)\n ws_num = get_workspace_num(prefix, num)\n workspace = get_workspace(ws_num, prefix, num)\n result = switch_workspace(f'{works... | [
"0.71325797",
"0.6187763",
"0.6157023",
"0.59943575",
"0.5943539",
"0.5912566",
"0.58262795",
"0.57753295",
"0.5770139",
"0.55275774",
"0.5519753",
"0.5467741",
"0.54426324",
"0.5431287",
"0.5407863",
"0.5407681",
"0.5323033",
"0.5264269",
"0.5262899",
"0.5244698",
"0.5241639... | 0.79520303 | 0 |
Move the focused container to the given workspace. | def move_to(i3: i3ipc.Connection, workspace: int):
i3.command(f"move container to workspace number {workspace}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_container(i3, name, monitor, container_id=None):\n i3.command(f'move container to workspace {name}')\n i3.command(f'workspace {name}, move workspace to output {monitor}')\n if container_id:\n i3.command(f'[con_id=\"{container_id}\"] focus')",
"def set_workspace(client, workspace):\n d... | [
"0.72039133",
"0.56448215",
"0.55889195",
"0.5587443",
"0.5435935",
"0.5378369",
"0.5328443",
"0.52069813",
"0.5197307",
"0.51802254",
"0.50865215",
"0.50180376",
"0.50041604",
"0.49425906",
"0.48882422",
"0.48878294",
"0.4881337",
"0.48195142",
"0.4800425",
"0.4756636",
"0.4... | 0.73667777 | 0 |
Find the workspace to switch to. If the current workspace is a target, go to the next target. If the current workspace isn't a target, go to the first open target. | def get_target_workspace(current_workspace, open_workspaces, target_workspaces):
logger.debug('get_target_workspace(current: %s, open: %s, targets: %s)',
current_workspace, open_workspaces, target_workspaces)
if len(target_workspaces) <= 0:
logger.debug('No workspaces given - defaultin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go_to(i3: i3ipc.Connection, workspace: int):\n i3.command(f\"workspace number {workspace}\")",
"def next_workspace(self, flag='next'):\n non_visible_workspaces = filter(lambda w: not w['visible'],\n self.get_workspaces())\n\n if non_visible_workspaces =... | [
"0.60954845",
"0.58509964",
"0.5680681",
"0.56290454",
"0.54656833",
"0.53953046",
"0.5384196",
"0.53578043",
"0.529885",
"0.5252498",
"0.520959",
"0.52038735",
"0.51325685",
"0.50813437",
"0.50762445",
"0.5061682",
"0.50541234",
"0.5039189",
"0.50001895",
"0.49859533",
"0.49... | 0.73417485 | 0 |
Get the number of the current workspace. | def get_current_workspace_num(i3: i3ipc.Connection):
return i3.get_tree().find_focused().workspace().num | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspace_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"workspace_id\")",
"def workspace_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"workspace_id\")",
"def workspace_id(self) -> str:\n return pulumi.get(self, \"workspace_id\")",
"def workspace_id(self) -... | [
"0.70615363",
"0.70615363",
"0.70028317",
"0.70028317",
"0.68003416",
"0.6721158",
"0.67083037",
"0.6684436",
"0.6620677",
"0.6572125",
"0.6547534",
"0.6448233",
"0.6448233",
"0.6275984",
"0.6210025",
"0.616503",
"0.6121598",
"0.6117455",
"0.6078367",
"0.6078367",
"0.6078367"... | 0.81946534 | 0 |
Get the numbers of open workspaces. | def get_open_workspaces(i3: i3ipc.Connection):
return [ws.num for ws in i3.get_tree().workspaces()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_opened_windows_list():\n\n global opened_windows_names\n EnumWindows(EnumWindowsProc(foreach_window), 0)\n return opened_windows_names",
"def get_open_disk_space(self):\n count = 0\n for i in range(self.size):\n if self.disk_mem[i]==\".\":\n count += 1\n ... | [
"0.64218664",
"0.63412476",
"0.61509293",
"0.6022424",
"0.60122925",
"0.5947481",
"0.5943279",
"0.5939426",
"0.59035146",
"0.58829737",
"0.5813977",
"0.57102287",
"0.56623214",
"0.56597006",
"0.5650875",
"0.5648794",
"0.56483734",
"0.5648095",
"0.5639259",
"0.5620538",
"0.561... | 0.7764141 | 0 |
Provides an ndimensional parallel iterator that generates index tuples for each iteration point. Sequentially, pndindex is identical to np.ndindex. | def pndindex(*args):
return np.ndindex(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pndindex(*args):\n return np.ndindex(*args)",
"def master_ndindex(self): # itermaster_indices(self):\n return itertools_product(\n *[range(*r) for r in self.location]\n ) # TODO check",
"def _get_index_iterator(indexes, length):\n return combinations(indexes, length)",
... | [
"0.698849",
"0.67596734",
"0.6384372",
"0.6358893",
"0.6060668",
"0.5980556",
"0.59671396",
"0.59533405",
"0.58904546",
"0.583905",
"0.57712317",
"0.57544845",
"0.57544845",
"0.57114184",
"0.56809837",
"0.5676592",
"0.5672165",
"0.5670588",
"0.5669132",
"0.5669132",
"0.563339... | 0.69749606 | 1 |
Creates the name for the handler called from ``__init__`` if a name is not given. | def _create_name(self) -> str:
return self.stream.__class__.__name__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __set_name__(self, cls, name):\n pass",
"def _get_name(cls, **kwargs: Any) -> str:\n raise NotImplementedError('Subclasses must implement this method.') # pragma: no cover",
"def __init__(__self__, *,\n name: pulumi.Input[str]):\n pulumi.set(__self__, \"name\", name)",... | [
"0.62612844",
"0.61916685",
"0.6182883",
"0.61657673",
"0.6151574",
"0.61496806",
"0.6144922",
"0.61412007",
"0.61395377",
"0.61388636",
"0.61388636",
"0.61388636",
"0.61388636",
"0.61388636",
"0.61388636",
"0.6127988",
"0.6106006",
"0.60805684",
"0.60805684",
"0.60805684",
"... | 0.6380641 | 0 |
Attempts to cache `objdoc` for module `modname`. | def __setitem__(self, modname: str, objdoc: Objdoc):
spec = importlib.util.find_spec(modname)
if spec.origin is None:
raise CannotCache(f"not a module file; can't cache: {modname}")
path = self.__get_path(spec)
path = path.parent / (path.name + ".json.gz")
check = _g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __put_module_in_sys_cache(module_name, module_obj):\n #try:\n #if hasattr(sys, 'stypy_module_cache'):\n sys.stypy_module_cache[module_name] = module_obj\n # else:\n # __preload_sys_module_cache()\n # sys.stypy_module_cache[module_name] = module_obj\n # except:\n ... | [
"0.636846",
"0.60199344",
"0.5941785",
"0.5705336",
"0.56785536",
"0.56135726",
"0.5584943",
"0.54140854",
"0.53702223",
"0.5348207",
"0.5324705",
"0.52313477",
"0.51907396",
"0.51213115",
"0.50879973",
"0.5077939",
"0.5061241",
"0.50270915",
"0.49785343",
"0.49644643",
"0.49... | 0.66609263 | 0 |
True if `path` is a subpath of `other`. | def is_subpath(path: Path, other: Path):
try:
Path(path).relative_to(other)
except ValueError:
return False
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sub(parent, path):\n parent = canonical_path(parent, resolve_link=False)\n path = canonical_path(path, resolve_link=False)\n return os.path.commonprefix([parent, path]) == parent",
"def _issubpath(self, a, b):\n p1 = a.rstrip(os.sep).split(os.sep)\n p2 = b.rstrip(os.sep).split(os.se... | [
"0.73897827",
"0.7339206",
"0.67567295",
"0.65496707",
"0.6387099",
"0.6286626",
"0.61776984",
"0.61434525",
"0.61350846",
"0.61014986",
"0.60929364",
"0.6068817",
"0.60278535",
"0.5977593",
"0.59686697",
"0.59164315",
"0.58905256",
"0.58664703",
"0.58248734",
"0.58200943",
"... | 0.8505086 | 0 |
Returns the path to the objdoc cache for a module. | def _get_pycache_path(spec: ModuleSpec) -> Path:
# Refuse to do __pycache__ caching for anything in PREFIX.
# FIXME: Not sure if this is the right policy.
if is_subpath(spec.origin, sys.prefix):
raise CannotCache(spec.name)
# Find out where the module cache file goes.
mod_cache_path = impor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cache_path(self):",
"def get_cache_path(self):",
"def cache_path(self):",
"def cache_path(self):",
"def cachepath(self, *args, **kw):\n cachename = self.cachefunc(*args, **kw)\n ret = os.path.join(self.cachedir, cachename)+'.'+self.serializer\n return ret",
"def get_module_pa... | [
"0.6733192",
"0.6733192",
"0.65243727",
"0.65243727",
"0.6192765",
"0.6134021",
"0.6128572",
"0.6034457",
"0.59029865",
"0.58758134",
"0.584348",
"0.583628",
"0.5831629",
"0.5797197",
"0.57850033",
"0.5753407",
"0.57359135",
"0.56733376",
"0.56616026",
"0.5656423",
"0.5656423... | 0.71900195 | 0 |
Returns the path to the supdoc cache directory. | def get_cache_dir() -> Path:
try:
cache_dir = Path(os.environ["SUPDOC_CACHE_DIR"])
except KeyError:
try:
cache_dir = Path(os.environ["XDG_CACHE_DIR"])
except KeyError:
if sys.platform == "linux":
cache_dir = Path.home() / ".cache"
elif ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_path(self):\n cache_path = os.path.join(os.path.dirname(__file__), '..', 'cache')\n if not os.path.exists(cache_path):\n os.mkdir(cache_path)\n return cache_path",
"def cache_path(self):",
"def cache_path(self):",
"def get_cache_path(self):",
"def get_cache_path(se... | [
"0.8008654",
"0.77709967",
"0.77709967",
"0.7667538",
"0.7667538",
"0.7616764",
"0.75312096",
"0.75106233",
"0.74233025",
"0.7411959",
"0.73736256",
"0.7335555",
"0.7317151",
"0.7300587",
"0.7297673",
"0.7265668",
"0.7265422",
"0.7102412",
"0.7053087",
"0.7030431",
"0.6959811... | 0.81167746 | 0 |
Returns a cache that stores files in a separate directory. | def DirCache(dir: Path) -> Cache:
dir = Path(dir)
return Cache(lambda spec: dir / spec.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cachefile(filename):\n if not os.path.exists(cachedir):\n os.makedirs(cachedir)\n return os.path.join(cachedir, filename)",
"def cache_file(cache_key):\n\n return MASTOOLS_DIR / f\"{cache_key}_cache.json\"",
"def cache_path(self):",
"def cache_path(self):",
"def cache(*filepath):\n ... | [
"0.7048509",
"0.6932892",
"0.69263685",
"0.69263685",
"0.6910586",
"0.68598944",
"0.68423784",
"0.6811715",
"0.67268217",
"0.67268217",
"0.66995484",
"0.6692884",
"0.66060275",
"0.6589656",
"0.65850544",
"0.6582661",
"0.6568272",
"0.6557517",
"0.6557517",
"0.6490931",
"0.6454... | 0.7716556 | 0 |
Caches modules in `modnames` and their submodules. | def cache_modules(*modnames) -> None:
inspector = Inspector()
modnames = { n for m in modnames for n in find_submodules(m) }
for modname in modnames:
logging.debug(f"inspecting: {modname}")
objdoc = inspector.inspect_module(modname)
logging.debug(f"writing cache: {modname}")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pymod_cache():\n pymod.cache.cache = Singleton(pymod.cache.factory)",
"def _refresh_cache():\n global _num_types, _num_funcs\n\n num_types = interrogate_number_of_global_types()\n num_funcs = interrogate_number_of_functions()\n\n if num_types != _num_types:\n for i in range(num_types):\... | [
"0.65368474",
"0.647988",
"0.60674167",
"0.6010362",
"0.5922582",
"0.5811887",
"0.5756406",
"0.57526934",
"0.5709762",
"0.5666927",
"0.5654441",
"0.5649179",
"0.5631578",
"0.5589954",
"0.5557051",
"0.5550639",
"0.5539117",
"0.54829466",
"0.5482664",
"0.5446342",
"0.5420631",
... | 0.82407486 | 0 |
Create a driver to the specified appium server & return driver,touch objects. | def create_driver(self, app_server):
config = self.config[app_server]
cmd = config['CMD']
server_name = config['NAME']
log_file_name = config['LOG_FILE_NAME']
full_log_path = os.path.join(os.environ['basedir'], 'logs', 'appium', log_file_name)
url = config['URL']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appium_init(self):\n desired_cups = {}\n desired_cups['platformName'] = 'Android'\n desired_cups['platformVersion'] = android_version\n desired_cups['deviceName'] = device_name\n desired_cups['appPackage'] = pkg_name\n desired_cups['appActivity'] = activity\n de... | [
"0.6603057",
"0.6471961",
"0.6052382",
"0.6052382",
"0.6046912",
"0.5883527",
"0.5859736",
"0.5768993",
"0.56850535",
"0.55772156",
"0.54033375",
"0.5355655",
"0.5336413",
"0.52726877",
"0.5258186",
"0.5250311",
"0.52132326",
"0.5192618",
"0.5192618",
"0.51881385",
"0.5179297... | 0.7865572 | 0 |
Close the application, quits the drivers. | def close_driver(self):
package_dict = self.config['PACKAGE']
try:
self.driver.terminate_app(package_dict[self.app_name]) # Kill app
self.driver.quit() # Kill drivers
except WebDriverException:
pass
finally:
LOGGER.info("Closed {apl} on {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quit(self):\n self.driver.close_app()\n self.driver.quit()",
"def close_application(self):\n self.close()\n QtGui.QApplication.exit()",
"def close(self):\n\n self._driver.quit()",
"def program_close():\n\n print(\"\\n\")\n sys.exit(0)",
"def close(self):\n\n ... | [
"0.75867534",
"0.7412425",
"0.73730874",
"0.73533124",
"0.72978216",
"0.7290101",
"0.71743464",
"0.7127176",
"0.71195775",
"0.7048997",
"0.7048084",
"0.6993627",
"0.69605225",
"0.69441557",
"0.69411415",
"0.6929923",
"0.6924687",
"0.69232714",
"0.69213384",
"0.69039327",
"0.6... | 0.7819079 | 0 |
Read mobile window size & sets the scroll length for a mobile. | def set_scroll_length(self):
size = self.driver.get_window_size()
self.x_cord = int(size['width'] / 2)
self.start_y = int(size['height'] * 0.9)
self.end_y = int(size['height'] * 0.1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetViewportSize(self):\n return self.tab.EvaluateJavaScript(\n '[ window.innerWidth, window.innerHeight ]')",
"def get_window_size():\n global windowSize\n windowSize = DRIVER.driver.get_window_size()\n return windowSize",
"def set_viewport_size(driver, device):\n if device == \"lapt... | [
"0.5914855",
"0.5613949",
"0.5598261",
"0.5566157",
"0.55612123",
"0.5541413",
"0.5541",
"0.5487701",
"0.5459118",
"0.5452546",
"0.5340624",
"0.5302332",
"0.524592",
"0.51727504",
"0.51644754",
"0.5149017",
"0.51306283",
"0.50865525",
"0.5083901",
"0.5060446",
"0.50539947",
... | 0.65684086 | 0 |
Perform tap for requested element or coordinates. | def tap_screen(self, element=None, config=None, x_cord=None, y_cord=None):
if element and config:
self.touch.tap(x=config[element]['x'],
y=config[element]['y']).perform()
elif x_cord:
self.touch.tap(x=x_cord, y=y_cord).perform()
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tap(self, locator, x_offset=None, y_offset=None, count=1):\r\n driver = self._current_application()\r\n el = self._element_find(locator, True, True)\r\n action = TouchAction(driver)\r\n action.tap(el, x_offset, y_offset, count).perform()",
"def double_tap(self, locator):\r\n ... | [
"0.73958546",
"0.6878971",
"0.6814113",
"0.6399038",
"0.6340633",
"0.58948916",
"0.5836868",
"0.57950395",
"0.5761519",
"0.5747372",
"0.57057613",
"0.56118274",
"0.5496889",
"0.5388753",
"0.52636874",
"0.5225673",
"0.52115715",
"0.5081884",
"0.5049696",
"0.50416523",
"0.50377... | 0.7536684 | 0 |
Swipe the screen to scroll down. | def swipe_up(self):
self.driver.swipe(start_x=self.x_cord, start_y=self.start_y,
end_x=self.x_cord, end_y=self.end_y, duration=1000) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swipe_down(self):\n self.swipe_sub(SWIPE_MATRIX[1])",
"def swipe_element_to_bottom_of_screen(self):\n window_size_y = self.driver.get_window_size()[\"height\"]\n self.swipe(30, window_size_y - 80, 30, window_size_y - 500)",
"def swipe_down(self, page_portion=0.25):\n driver = self.d... | [
"0.758218",
"0.71756256",
"0.71166104",
"0.7037795",
"0.6950055",
"0.69194794",
"0.68665427",
"0.6834109",
"0.67843467",
"0.676057",
"0.66562134",
"0.6606951",
"0.65145755",
"0.65032494",
"0.6459125",
"0.64556295",
"0.64275724",
"0.6410148",
"0.6391791",
"0.63822305",
"0.6373... | 0.7214927 | 1 |
Swipe the screen to move right. | def swipe_right(self, config):
self.driver.swipe(start_x=config['SWIPE_RIGHT']['x'],
start_y=config['SWIPE_RIGHT']['y'],
end_x=(config['SWIPE_RIGHT']['x'] - 400),
end_y=config['SWIPE_RIGHT']['y'], duration=1000) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swipe_right(self):\n self.swipe_sub(SWIPE_MATRIX[3])",
"def swipeRight (self) :\n rotated = Grid(np.rot90(self.grid))\n self.grid = np.rot90(np.rot90(np.rot90(rotated.swipeBase())))",
"def right(self):\n self.move(1,0)",
"def onMoveRight(self):\n self.mainGrid.moveRight()",... | [
"0.8454436",
"0.78103113",
"0.7573303",
"0.74607587",
"0.7398949",
"0.73591566",
"0.72639054",
"0.7250936",
"0.71935",
"0.7191789",
"0.7183003",
"0.7181764",
"0.71255744",
"0.71070856",
"0.70980036",
"0.70931053",
"0.7075506",
"0.7070613",
"0.70595074",
"0.70166427",
"0.69603... | 0.83857 | 1 |
Method to perform long press of element or a coordinate and slide. | def press_long_and_slide(self, element, x_cord, y_cord, hold_time):
if element:
self.touch.long_press(el=element, duration=hold_time).move_to(
x=x_cord, y=y_cord).release().perform()
else:
LOGGER.error('Element and co-ordinates must be given for long press!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_longpress(self, str_arg):\n arg = validateString(str_arg)\n # if arg.startswith(r'('):\n # raise ValueError('Bad argument, You may want to use longpress2 with coordinates as auguments.')\n x = 0\n y = 0\n seconds = 2000\n try:\n if arg.startswith(r... | [
"0.8066344",
"0.76812494",
"0.7387225",
"0.71065205",
"0.65214574",
"0.64916337",
"0.6470704",
"0.64311725",
"0.62847203",
"0.62028587",
"0.60926753",
"0.60913044",
"0.60368675",
"0.59834635",
"0.59390086",
"0.58624774",
"0.58039314",
"0.57924074",
"0.57913846",
"0.57878906",
... | 0.8362803 | 0 |
Select an key on the screen using keycode. | def press_using_keycode(self, text):
num = KEY_CODE_DICT[text]
self.driver.press_keycode(num)
time.sleep(3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keyevent(self, keycode: Union[str, int]) -> None:\n self.shell(['input', 'keyevent', str(keycode)])",
"def keypress(key):\n k = PyKeyboard()\n if key == 'enter':\n key = k.return_key\n k.tap_key(key)",
"def keypress(cls, _, key):\n return key",
"def presskey(self, key):\... | [
"0.72298855",
"0.70825064",
"0.7031476",
"0.7016587",
"0.7005039",
"0.6958417",
"0.6877484",
"0.6845089",
"0.67478025",
"0.674171",
"0.6733207",
"0.6687262",
"0.66723675",
"0.6649785",
"0.6627836",
"0.66275096",
"0.65697426",
"0.65491766",
"0.6541191",
"0.6495486",
"0.6452972... | 0.7188671 | 1 |
Press back button on mobile for 'num' times. | def press_back(self, num=1):
for _11 in range(0, num): # _11 as dummy variable
self.driver.back() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def press_back_button(self):\n self.driver.back()",
"def __call__(self, count = 1):\r\n assert type(count) == types.IntType and count >= 1, \\\r\n 'Invalid count value (%s) given!' % count\r\n\r\n self.phone.comment('back(%s)' % (count != 1 and str(count) or \"\"))\r\n\r\n ... | [
"0.686586",
"0.6603821",
"0.6489235",
"0.62731624",
"0.6251216",
"0.60601574",
"0.6037806",
"0.60344905",
"0.5995057",
"0.5986757",
"0.59838754",
"0.59783083",
"0.59600383",
"0.5889037",
"0.5838801",
"0.58346796",
"0.57942283",
"0.57372975",
"0.57372975",
"0.5688485",
"0.5674... | 0.7851241 | 0 |
Return element according to element type given. | def return_element(self, el_type, text, bounds=False):
if el_type == 'access':
element = self.driver.find_element_by_accessibility_id(text)
elif el_type == 'id':
element = self.driver.find_element_by_id(text)
elif el_type == 'xpath' and bounds:
element = self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element_type(self) -> global___Type:",
"def element(selection, sel_type='id'):\n selector = get_selector_method(sel_type)\n return selector(selection)",
"def element_by_atom_type(atom_type, verbose=False):\n matched_element = None\n\n if matched_element is None and atom_type.mass:\n matc... | [
"0.7039218",
"0.6531085",
"0.65199196",
"0.6413907",
"0.6378142",
"0.63359797",
"0.6290994",
"0.6273379",
"0.62482876",
"0.62119603",
"0.6187754",
"0.61422116",
"0.60904515",
"0.6073134",
"0.60068643",
"0.5997687",
"0.59854156",
"0.59780675",
"0.59744245",
"0.59307486",
"0.59... | 0.71218866 | 0 |
Return list of elements of class 'android.widget.TextView'. | def return_textview_elements(self):
return self.driver.find_elements_by_class_name('android.widget.TextView') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def texts(self):\n return [elem.text for elem in self.web_elements]",
"def get_elements_text(self, elements: Union[List[WebElement], Tuple[By, str]]) -> List[str]:\n elements = self.find_elements(elements)\n return [element.get_attribute('innerText') for element in elements]",
"def get_all... | [
"0.6248276",
"0.60573405",
"0.60127634",
"0.5948078",
"0.5905251",
"0.577305",
"0.5733306",
"0.56923234",
"0.5615578",
"0.556697",
"0.5562241",
"0.5440046",
"0.5421704",
"0.53165835",
"0.53053695",
"0.5239165",
"0.52215254",
"0.5188379",
"0.51882476",
"0.517459",
"0.51421756"... | 0.85841584 | 0 |
Return element according to 'text' or 'search text' and clicks it. | def click_using_class(self, text, search_text=None, delay=3, is_button=False):
if search_text:
class_name = 'android.widget.EditText'
button = self.return_button(search_text, class_name)
elif is_button:
class_name = 'android.widget.Button'
button = self.re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_button(self, text, class_name='android.widget.TextView'):\n for button in self.driver.find_elements_by_class_name(class_name):\n if button.text == text:\n return button\n return None",
"def click_search_button(self):\n self.click_element(self.generic_sear... | [
"0.661339",
"0.65298027",
"0.64589846",
"0.63079387",
"0.6279679",
"0.6225251",
"0.61082816",
"0.60499865",
"0.5844906",
"0.5839642",
"0.58275473",
"0.58186126",
"0.5792587",
"0.57632035",
"0.57194805",
"0.569059",
"0.568484",
"0.5681119",
"0.5595558",
"0.5590351",
"0.5569256... | 0.72133875 | 0 |
Count letters in a name. | def counter(name):
count_name = list(name)
counter = 0
for letter in count_name:
counter += 1
print(f"There are {counter} letter in the name {name}.")
print(f"\tAnd btw... {name} backwards is {name[::-1].lower()}.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def char_count(self, _list, char):\n\t\tcont = 0\n\t\tfor i in _list:\n\t\t\tcont += i[\"name\"].count(char.upper())\n\t\t\tcont += i[\"name\"].count(char.lower())\n\t\treturn cont",
"def test_single_letter_count(self):\n self.assertEqual(functions.single_letter_count(\"Hello World\", \"h\"), 1)\n ... | [
"0.75467575",
"0.74104375",
"0.74040395",
"0.739459",
"0.73699015",
"0.7357591",
"0.7343402",
"0.7343402",
"0.7343402",
"0.7343402",
"0.731937",
"0.7260459",
"0.72601306",
"0.72523135",
"0.72024745",
"0.7005587",
"0.69186723",
"0.6886823",
"0.68676317",
"0.68437684",
"0.67980... | 0.74775517 | 1 |
Test case for delete_opening_balance_journals_key | def test_delete_opening_balance_journals_key(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_opening_balance_journals_key(self):\n pass",
"def test_get_opening_balance_journals(self):\n pass",
"def test_post_opening_balance_journals(self):\n pass",
"def test_client_risk_assessment_delete(self):\n pass",
"def test_deleteItinerary(self):\n event = dict... | [
"0.7443269",
"0.6647047",
"0.6586451",
"0.6173807",
"0.59971863",
"0.5906599",
"0.5883001",
"0.58747035",
"0.58452064",
"0.5810683",
"0.5803397",
"0.5792871",
"0.57869107",
"0.57812667",
"0.5751271",
"0.5725391",
"0.5719262",
"0.57173496",
"0.56513774",
"0.5649916",
"0.564739... | 0.954454 | 0 |
Test case for get_opening_balance_journals | def test_get_opening_balance_journals(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_opening_balance_journals_key(self):\n pass",
"def test_post_opening_balance_journals(self):\n pass",
"def test_delete_opening_balance_journals_key(self):\n pass",
"def test_open_ru_ballance(self, ):\n if self.report_type == 'open.ru':\n (mid, aid) = self.ma... | [
"0.7997928",
"0.7800163",
"0.6249587",
"0.5947075",
"0.5603603",
"0.5390032",
"0.53497434",
"0.5313137",
"0.52879274",
"0.52468204",
"0.52310777",
"0.5218465",
"0.5213669",
"0.5169804",
"0.5147557",
"0.5146794",
"0.5145016",
"0.5138725",
"0.51375633",
"0.50891036",
"0.5077854... | 0.93086916 | 0 |
Test case for get_opening_balance_journals_key | def test_get_opening_balance_journals_key(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_opening_balance_journals(self):\n pass",
"def test_delete_opening_balance_journals_key(self):\n pass",
"def test_post_opening_balance_journals(self):\n pass",
"def test_journals_paged_fields(self, api_client):\n rv = api_client.get(\"/journals-paged\")\n json_d... | [
"0.814138",
"0.7337289",
"0.66358453",
"0.5097487",
"0.5004364",
"0.49763408",
"0.49549302",
"0.49017188",
"0.48923275",
"0.48898348",
"0.48454645",
"0.4810751",
"0.47996962",
"0.47848547",
"0.47577968",
"0.4739",
"0.47346452",
"0.47301468",
"0.4718948",
"0.471765",
"0.470826... | 0.9500056 | 0 |
Test case for post_opening_balance_journals | def test_post_opening_balance_journals(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_opening_balance_journals(self):\n pass",
"def test_get_opening_balance_journals_key(self):\n pass",
"def test_delete_opening_balance_journals_key(self):\n pass",
"def test_finalize_and_open_period(self):\n employee_payments_qty = EmployeePayment.objects.filter(employe... | [
"0.84121585",
"0.69012296",
"0.649312",
"0.6370543",
"0.5991055",
"0.5923325",
"0.5892853",
"0.5802448",
"0.5717177",
"0.56970596",
"0.5671049",
"0.56420887",
"0.5641799",
"0.56363505",
"0.5616931",
"0.56020135",
"0.5594999",
"0.55920017",
"0.55864936",
"0.5533124",
"0.551042... | 0.9369089 | 0 |
Go to the page 'url', find the next link to got, then extract the JSON query result, find the wanted train, and display the results. | def main(url, MY_OUTWARD_TIME_MINI, MY_OUTWARD_TIME_MAXI="23:59"):
MY_OUTWARD_TIME_MINI = MY_OUTWARD_TIME_MINI.replace("h", ":")
MY_OUTWARD_TIME_MAXI = MY_OUTWARD_TIME_MAXI.replace("h", ":")
# Create the web browser object
b = RB(history=True, allow_redirects=True)
# Open the page
b.open(url)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_details_json(self, url):\n response = self.get_response(url)\n if response:\n html_soup = BeautifulSoup(response.text, 'html.parser')\n listings_json = html_soup.find('script', id='__NEXT_DATA__')\n if listings_json:\n listings_json = str(listi... | [
"0.640374",
"0.6311036",
"0.6293636",
"0.62394124",
"0.61887467",
"0.6168092",
"0.6126903",
"0.60940063",
"0.60837823",
"0.6080943",
"0.60407084",
"0.60225344",
"0.60035765",
"0.5994992",
"0.5961852",
"0.5961246",
"0.59560084",
"0.5912258",
"0.59046686",
"0.5901058",
"0.58722... | 0.7052188 | 0 |
generate the hashes for the passwords | def gen_hash(self, data):
password_gen = crypt.encrypt(data)
return password_gen | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_password(args):\n for password in args:\n heashed=hash_password(password)\n print(heashed)\n # checked=check_password(heashed)",
"def generate_hash(password, salt):\n # encode the password/salt in utf-8\n bytes_string = password.encode(encoding='utf-8')\n salt = salt.enco... | [
"0.69298804",
"0.68461454",
"0.6780465",
"0.67700803",
"0.6745123",
"0.6678128",
"0.66269416",
"0.6591104",
"0.65296036",
"0.6519999",
"0.65092117",
"0.65037704",
"0.6464029",
"0.646137",
"0.6457473",
"0.6453947",
"0.64536256",
"0.64312357",
"0.64078385",
"0.63722223",
"0.636... | 0.6938553 | 0 |
Transfer model weights to target model with a factor of Tau | def transfer_weights(self):
W, target_W = self.model.get_weights(), self.target_model.get_weights()
for i in range(len(W)):
target_W[i] = self.tau * W[i] + (1 - self.tau)* target_W[i]
self.target_model.set_weights(target_W) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_target_model(self):\n self.target_model.set_weights(self.model.get_weights())",
"def update_target_model(self):\n self.target_model.set_weights(self.model.get_weights())",
"def update_target_model(self):\n self.target_model.set_weights(self.model.get_weights())",
"def _update_... | [
"0.73884064",
"0.73884064",
"0.73884064",
"0.7025803",
"0.6765796",
"0.67450416",
"0.6741832",
"0.67204714",
"0.6674984",
"0.6514898",
"0.65123016",
"0.6492347",
"0.6492347",
"0.6467089",
"0.6460493",
"0.64421093",
"0.64420146",
"0.6416018",
"0.6381238",
"0.6341845",
"0.63382... | 0.7874975 | 0 |
Output the company CIK listed (applicable only for stocks issues in the SEC, so no exchange name is required) | def get_company_cik(stock_ticker: str):
company_cik = sec_finance_functions.get_company_data_by_ticker(stock_ticker).company_cik
return company_cik | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def company(self):\n\n x = 0\n my_company = self.data[\"Company Name\"]\n my_account = self.data[\"Account\"]\n result = []\n for i in my_company:\n my_string = i + \" -- \" + my_account[x]\n x += 1\n result.append(my_string)\n\n return res... | [
"0.62574416",
"0.6169119",
"0.6011516",
"0.5925151",
"0.56726855",
"0.5637131",
"0.5628796",
"0.56104475",
"0.5564428",
"0.54830617",
"0.5324723",
"0.5307937",
"0.5264544",
"0.52378327",
"0.5234159",
"0.52317774",
"0.51992476",
"0.5190561",
"0.5165406",
"0.5164627",
"0.514469... | 0.6787039 | 0 |
Get the number of fillings of a stock for the given year (or all fillings since the company listing) | def get_last_filling(stock_ticker: str,
filling_year: Optional[int] = None):
company_cik = sec_finance_functions.get_company_data_by_ticker(stock_ticker).company_cik
all_company_fillings = sec_finance_functions.get_all_company_filings_by_cik(company_cik)
all_company_fillings_by_year = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numPostings(years):\n\tcount = []\n\tfor year in years:\n\t\tfilename = \"SmartEnergy\" +str(year) +\".xlsx\"\n\t\tDB = pd.read_excel(filename, sheet_name = 'Filters')\n\t\tcount.append(DB.iloc[10][1])\n\treturn count",
"def _bands_competed_last_year():\n lLastYear = datetime.datetime.now().year - 1\n ... | [
"0.60557085",
"0.5479599",
"0.5406363",
"0.53464955",
"0.53220004",
"0.5278154",
"0.517318",
"0.51207525",
"0.51200336",
"0.4972167",
"0.49510524",
"0.49407512",
"0.49316242",
"0.49237838",
"0.49139115",
"0.49106917",
"0.49084038",
"0.48991558",
"0.48983836",
"0.48923317",
"0... | 0.6672505 | 0 |
Call to inform that the any concurrent ripping process is finished. | def rip_finished(self):
if self.is_ripping:
self.is_ripping.clear() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def syncDone (self) :\r\n self.ongoing_sync_count -= 1",
"def _notify_end(self):\n to_scan = len(self._files_to_scan)\n event.notify(ScanProgressEvent(to_scan, to_scan, True))",
"def finished(self):",
"def finished(self):\n pass",
"def finish(self) -> None:",
"def finish(self)... | [
"0.6337645",
"0.62002885",
"0.6101757",
"0.60869145",
"0.60562354",
"0.60562354",
"0.6047451",
"0.6047451",
"0.6047451",
"0.6047451",
"0.6016429",
"0.59790313",
"0.59760773",
"0.5959373",
"0.5959373",
"0.5951485",
"0.5951485",
"0.5918788",
"0.59124225",
"0.5900939",
"0.589903... | 0.67650646 | 0 |
Iterate over DISC, splitting it into packets starting at TRACK_NUMBER index 1. This call will ensure that no packets cross a track or pregap boundary, and will also obey any edits to the disc. It will not, however, read any samples from disc, just tell the calling code what to read. | def iterate(cls, disc, track_number):
assert track_number >= 0 and track_number < len(disc.tracks)
track = disc.tracks[track_number]
packet_frame_size = (
disc.audio_format.rate / cls.PACKETS_PER_SECOND)
# Mock up a packet that ends at the start of index 1, so the
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_packets(self, reader: Par2FileReader):\n start_count = len(self)\n pointers = reader.get_pointers()\n # Create RecoverySets if needed\n for set_id, pointer_set in packets.by_set_id(pointers).items():\n print(set_id.hex(), pointer_set)\n if set_id not in s... | [
"0.5243465",
"0.50652975",
"0.503824",
"0.49788526",
"0.49385667",
"0.48881853",
"0.48847038",
"0.4879093",
"0.48679477",
"0.4829947",
"0.48023844",
"0.4800166",
"0.47898296",
"0.47791988",
"0.47784358",
"0.47733098",
"0.4772302",
"0.4743291",
"0.4735822",
"0.4723006",
"0.469... | 0.73285556 | 0 |
Takes base paths to specs and resources. | def set_paths(self, specs, resources):
self.install = 'install.xml'
self.specs_path = path_format(specs)
self.root = path_format(dirname(dirname(self.specs_path)) + '/')
self.res_path = path_format(resources)
self.resources['BASE'] = self.res_path
self.specs['BASE'] = sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_resource_path(self):\n\n # Without arguments\n resources_root_path = os.path.abspath(os.path.join(\n MY_DIRECTORY, '..', '..', 'resources'\n ))\n self.assertEqual(resources_root_path, paths.resource())",
"def __init__(self, specs, resources, properties=None):\n ... | [
"0.6165541",
"0.6127959",
"0.611318",
"0.6023412",
"0.59037876",
"0.576045",
"0.575814",
"0.5617551",
"0.56028676",
"0.55873394",
"0.5575436",
"0.5532464",
"0.5520052",
"0.54906976",
"0.54781777",
"0.5471999",
"0.54613155",
"0.54188824",
"0.53953713",
"0.539372",
"0.5368863",... | 0.7049754 | 0 |
Extracts paths to available izpack resources and spec files from the installer's install.xml spec. | def parse_paths(self):
self.soup = BeautifulSoup(open(self.get_path('install')))
for spec in list(self.specs.keys()):
spec_file = self.find_specs_path(spec)
if spec_file:
# If spec file exists
self.specs[spec] = path_format(spec_file)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_paths(self, specs, resources):\n self.install = 'install.xml'\n self.specs_path = path_format(specs)\n self.root = path_format(dirname(dirname(self.specs_path)) + '/')\n self.res_path = path_format(resources)\n self.resources['BASE'] = self.res_path\n self.specs['B... | [
"0.5985074",
"0.5818984",
"0.55800974",
"0.5558382",
"0.5510714",
"0.5509265",
"0.54902023",
"0.5484745",
"0.54695016",
"0.543011",
"0.5405252",
"0.53903776",
"0.5373021",
"0.5365647",
"0.5341147",
"0.5305645",
"0.53018004",
"0.52990454",
"0.52964294",
"0.52779734",
"0.527142... | 0.6754402 | 0 |
Find the path for the spec in the install.xml file. | def find_specs_path(self, spec):
element = self.soup.find(spec)
if element:
child = element.find('xi:include')
if child: # if xi:include exists, specs are external.
path = self.properties.substitute(child['href'])
else:
# Internal spec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_paths(self):\n self.soup = BeautifulSoup(open(self.get_path('install')))\n for spec in list(self.specs.keys()):\n spec_file = self.find_specs_path(spec)\n if spec_file:\n # If spec file exists\n self.specs[spec] = path_format(spec_file)\n ... | [
"0.66329956",
"0.6390044",
"0.6344499",
"0.62348706",
"0.61632514",
"0.6048204",
"0.5858314",
"0.5840221",
"0.580385",
"0.5725794",
"0.5686409",
"0.5641364",
"0.56244683",
"0.5608649",
"0.55820984",
"0.5533073",
"0.5533073",
"0.5516132",
"0.5502403",
"0.5439248",
"0.54391897"... | 0.7470482 | 0 |
Parse the install.xml (or resources.xml) soup to find all available resources. | def parse_resources(self, soup):
for res in soup.find_all('res'):
if 'customlangpack' in res['id'].lower():
self.find_langpack_path(res)
else:
rid = remove_xml(res['id'])
self.resources[rid] = path_format(self.properties.substitute(res['src... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_resources(self):\n path = self.get_path('resources')\n\n if not path:\n rsoup = self.soup\n else:\n rsoup = BeautifulSoup(open(path))\n\n self.parse_resources(rsoup)",
"def parse_paths(self):\n self.soup = BeautifulSoup(open(self.get_path('install... | [
"0.7189946",
"0.59733474",
"0.5380635",
"0.53306276",
"0.52788985",
"0.5263637",
"0.5235712",
"0.5170429",
"0.5113374",
"0.50949967",
"0.5075004",
"0.50734943",
"0.5058489",
"0.5009926",
"0.4998898",
"0.4996702",
"0.4971879",
"0.49711636",
"0.49570197",
"0.49357328",
"0.49281... | 0.66038096 | 1 |
Finds a langpack path from the given xml langpack element | def find_langpack_path(self, langpack):
lid = langpack['id']
src = path_format(self.properties.substitute(langpack['src']))
if '.xml_' in lid:
self.langpacks[lid[-3:]] = src
if not 'default' in self.langpacks:
self.langpacks['default'] = src
self.reso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_langpack_path(self, lid='default'):\n path = self.langpacks[lid]\n return force_absolute(self.res_path, path)",
"def _safe_get_element(path, root):\n elements = path.split('.')\n parent = root\n for element in elements[:-1]:\n parent = getattr(parent, element, None)\n ... | [
"0.60459447",
"0.542366",
"0.54062265",
"0.53140926",
"0.5283099",
"0.5267232",
"0.52111304",
"0.52110153",
"0.5112656",
"0.5109639",
"0.50798786",
"0.503845",
"0.5029484",
"0.5024299",
"0.50155646",
"0.50155646",
"0.5005777",
"0.49973974",
"0.49784917",
"0.49735188",
"0.4969... | 0.71990365 | 0 |
Returns the path to the langpack with the given localization id. | def get_langpack_path(self, lid='default'):
path = self.langpacks[lid]
return force_absolute(self.res_path, path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_langpack_path(self, langpack):\n lid = langpack['id']\n src = path_format(self.properties.substitute(langpack['src']))\n if '.xml_' in lid:\n self.langpacks[lid[-3:]] = src\n\n if not 'default' in self.langpacks:\n self.langpacks['default'] = src\n ... | [
"0.73198885",
"0.6105887",
"0.5961551",
"0.58504504",
"0.58083636",
"0.5787844",
"0.5782545",
"0.5768041",
"0.55205953",
"0.5518579",
"0.5518284",
"0.54572797",
"0.54148406",
"0.540771",
"0.539632",
"0.539049",
"0.5386805",
"0.5383221",
"0.5375136",
"0.5335914",
"0.53032947",... | 0.79494125 | 0 |
Removes the .xml from a resource or spec id. | def remove_xml(rid):
if '.xml' in rid[-4:]:
return rid[:-4]
else:
return rid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self): \n self.doRoot(self.removeDir)\n settings.getChanged('mosh.resourceReplacer.applied').remove(self.file)",
"def removeID(self, doc):\n if doc is None: doc__o = None\n else: doc__o = doc._o\n ret = libxml2mod.xmlRemoveID(doc__o, self._o)\n return ret",
... | [
"0.6571621",
"0.59867907",
"0.59495574",
"0.5810718",
"0.58104086",
"0.57775265",
"0.5769766",
"0.5720916",
"0.56980383",
"0.5681628",
"0.5668962",
"0.56642413",
"0.5655876",
"0.5647954",
"0.56197345",
"0.5602799",
"0.550016",
"0.5495898",
"0.5472836",
"0.5450075",
"0.5386508... | 0.6564904 | 1 |
Ensures that the base path is not appended to an absolute path. | def force_absolute(base, path):
if os.path.abspath(path) and os.path.exists(path):
return path
else:
return path_format(base + path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_bad_path(path, base):\r\n return not resolved(joinpath(base, path)).startswith(base)",
"def relative_base(base):\n return as_base(base).lstrip('/')",
"def _graceful_relative_url(base_url, url):\n if url == base_url:\n return ''\n base_prefix = '%s://%s' % urlparse.urlparse(base_url o... | [
"0.6916786",
"0.67421585",
"0.66749847",
"0.64415956",
"0.64331144",
"0.6391375",
"0.634446",
"0.63375163",
"0.63358223",
"0.63287544",
"0.63265294",
"0.6256979",
"0.6243405",
"0.6241263",
"0.62288374",
"0.61725926",
"0.6163012",
"0.61393946",
"0.61246914",
"0.610019",
"0.608... | 0.8096843 | 0 |
Append a child SHETNode object to this parent. | def append_child(self, child):
self._children.append(child) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appendChild(self, child):\n self.__initChild()\n self.__child.append(child)",
"def add_child(self, child):\r\n self.children.append(child)",
"def add_child(self, child):\n assert isinstance(child, (Node, str))\n self.children.append(child)\n return child",
"def a... | [
"0.75263894",
"0.71979386",
"0.71660924",
"0.70930797",
"0.7083536",
"0.7083536",
"0.70750386",
"0.70191234",
"0.70174617",
"0.69852936",
"0.6984658",
"0.6984658",
"0.6984658",
"0.6974553",
"0.6964133",
"0.691352",
"0.6870681",
"0.68534565",
"0.683959",
"0.6832848",
"0.682881... | 0.743963 | 1 |
Return the child object for this row. | def child(self, row):
return self._children[row] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fm_get_child(self, idx):\n return self._relation_lst[self.CHILD][idx]",
"def parent_row(self):\n dict_cur.execute('SELECT * FROM \"{}\" WHERE {} = {}'.format(\n self.parent_table(), self.id_col_of_parent(), self.parent_id\n ))\n return dict_cur.fetchone()",
"def child... | [
"0.69378644",
"0.6922745",
"0.67441875",
"0.67046505",
"0.64928705",
"0.6490793",
"0.64874583",
"0.636516",
"0.6325162",
"0.63212925",
"0.6312723",
"0.62407464",
"0.6223152",
"0.6199766",
"0.61490715",
"0.6089433",
"0.6058238",
"0.6028954",
"0.6019511",
"0.60055214",
"0.60042... | 0.7951686 | 0 |
Return the number of children for this object. | def child_count(self):
return len(self._children) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children_count(self):\n return len(self._children_ids)",
"def get_num_children(self):\n return len(self.children)",
"def num_children(self):\r\n return len(self.children)",
"def n_children(self):\n ch = self.children\n return 0 if not ch else len(ch) + sum([c.n_children... | [
"0.90056854",
"0.89945096",
"0.8814528",
"0.84932816",
"0.8328836",
"0.820382",
"0.81602144",
"0.8130981",
"0.8113122",
"0.8032147",
"0.8006279",
"0.7992068",
"0.7951158",
"0.79241395",
"0.7880368",
"0.7846781",
"0.7826892",
"0.7825752",
"0.7825752",
"0.7813822",
"0.78123784"... | 0.90249795 | 0 |
Return the row number of this object in its parents child object list. | def row(self):
if self._parent != None:
return self._parent._children.index(self)
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position(self):\n # (this to be able to let the model know my 'row')\n if self.parent and self in self.parent.children:\n return self.parent.children.index(self)\n return 0",
"def get_row_count(self):\n\t\treturn self.iter_n_children(None)",
"def get_parent_index(self):\n ... | [
"0.7749123",
"0.7150035",
"0.7133484",
"0.7002957",
"0.6893562",
"0.68775827",
"0.68358344",
"0.68228674",
"0.6657135",
"0.65858424",
"0.6512793",
"0.65048885",
"0.6504525",
"0.6482687",
"0.64728826",
"0.6462298",
"0.6381234",
"0.6368826",
"0.6327531",
"0.63188356",
"0.630715... | 0.8057412 | 0 |
Returns a count of games for each team between a range of dates. The range of dates is inclusive. The result is a dictionary, where the key is a team ID and the values is the number of games played within the date range. | def games_count(self, start_date, end_date): # noqa
if start_date > end_date:
raise RuntimeError("End date must be beyond start")
cur_date = start_date
tot_gc = defaultdict(int)
while cur_date <= end_date:
teams_playing = self._teams_playing_one_day(cur_date)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_stats(games: List[BaseGame], date_min = None, date_max = None):\n if not games: games = self.games\n\n under2_5 = len(list(filter(lambda g: g.is_total_under(), games)))\n under3_5 = len(list(filter(lambda g: g.is_total_under(3.5), games)))\n under1_5 = len(list(filter(lambda... | [
"0.66655016",
"0.6575532",
"0.6239661",
"0.60753345",
"0.5819676",
"0.56853807",
"0.56271034",
"0.5605924",
"0.552719",
"0.5430894",
"0.5406802",
"0.5393699",
"0.53550273",
"0.5331798",
"0.52389354",
"0.5208741",
"0.5198225",
"0.51977944",
"0.5194764",
"0.51899004",
"0.51551"... | 0.77764916 | 0 |
Returns the full list of all players in the NHL. Each player is returned with their teamID and playerID. | def players(self):
if self.players_cache is None:
team_df = self.teams()
self.players_cache = self.ea.players_endpoint(
team_df["id"].tolist())
columns = ["teamId", "playerId", "name", "position"]
all_players = []
for team in self.players_cache["t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_players(team_id: int) -> list[Player]:\n\n players = Player.query.filter_by(team_id=team_id).order_by(Player.position.asc()).all()\n\n return players",
"async def get_players(self):\r\n if os.environ.get(\"WoW_Token\") is None:\r\n return\r\n else:\r\n async with... | [
"0.73543996",
"0.7350862",
"0.7326979",
"0.7267568",
"0.7178544",
"0.71210647",
"0.7101303",
"0.7095917",
"0.70638573",
"0.70361084",
"0.70209825",
"0.695598",
"0.69269913",
"0.68729657",
"0.6858013",
"0.68501425",
"0.6834751",
"0.6827907",
"0.68150014",
"0.68046874",
"0.6801... | 0.77101475 | 0 |
Returns a dict of all exporters available in this module. | def exporters():
return dict(_exporters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_exported_services(self):\n with self.__export_lock:\n return [reg.get_export_reference() for reg in self.__exported_regs]",
"def modules(self):\n return self._modules.keys()",
"def export(self) -> Dict[str, Any]:\n return {\n \"name\": self.name,\n \"ch... | [
"0.67320096",
"0.671589",
"0.6693358",
"0.65067416",
"0.65005225",
"0.6418204",
"0.6391994",
"0.61761796",
"0.61683196",
"0.6134161",
"0.6020214",
"0.60188884",
"0.60087794",
"0.6007217",
"0.59965616",
"0.5981217",
"0.5973341",
"0.5953239",
"0.59515285",
"0.59218055",
"0.5913... | 0.8974469 | 0 |
Returns a dict of all expression writers available in this module. | def ewriters():
return dict(_ewriters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exporters():\n return dict(_exporters)",
"def loggers() -> Dict[str, logging.Logger]:\n return dict(logging.root.manager.loggerDict) # type: ignore",
"def _getWriters(reactor):\n if IReactorFDSet.providedBy(reactor):\n return reactor.getWriters()\n elif \"IOCP\" in reactor.__class__.__n... | [
"0.60313106",
"0.5901297",
"0.5880711",
"0.58622074",
"0.58196956",
"0.5742172",
"0.56615275",
"0.5657879",
"0.5596137",
"0.55732113",
"0.5545482",
"0.5508399",
"0.5503588",
"0.5474215",
"0.5455626",
"0.54393846",
"0.54258674",
"0.5408531",
"0.53520226",
"0.53115875",
"0.5309... | 0.5967789 | 1 |
generates all prime numbers smaller than _n_ using the Sieve of Eratosthenes | def primes(n):
sieve = [True]*n
for p in range(2, n):
if sieve[p]:
yield p
for i in range(p*p, n, p):
sieve[i] = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n):\n\tsieve = [True] * n\n\tyield 2\n\tfor i in xrange(3,int(n**0.5)+1,2):\n\t\tif sieve[i]:\n\t\t\tyield i\n\t\t\tsieve[i*i::2*i] = [False]*((n-i*i-1)/(2*i)+1)\n\tfor i in xrange(i+2,n,2):\n\t\tif sieve[i]: yield i",
"def eratosthenes_sieve(n):\r\n\tnumbers = [True for i in range(n + 1)]\r\n\t\r\n\t... | [
"0.84180295",
"0.8417532",
"0.82622313",
"0.82567656",
"0.82486343",
"0.82486343",
"0.8190478",
"0.818247",
"0.8172363",
"0.81599665",
"0.81357145",
"0.8119539",
"0.8106137",
"0.8075972",
"0.8052299",
"0.8046388",
"0.80405337",
"0.8021724",
"0.8011649",
"0.8010728",
"0.800634... | 0.8424956 | 0 |
Check if the given sequence is a Fibonacci sequence. Fibonacci sequence is assumed to have length > 2. | def check_fibonacci(data: Sequence[int]) -> bool:
if len(data) < 3:
return False
if data[0] != 0 or data[1] != 1:
return False
for n in range(2, len(data)):
if data[n] != data[n - 1] + data[n - 2]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_fibonacci(data: Sequence[int]) -> bool:\n def fib_gen(n: int) -> Iterable:\n a, b = 0, 1\n while a <= n:\n yield a\n a, b = b, a + b\n\n last_el = data[-1]\n perfect_fib = list(el for el in fib_gen(last_el))\n\n if len(data) < 3:\n return False\n ... | [
"0.7771214",
"0.7764462",
"0.7430969",
"0.7402631",
"0.70261985",
"0.68094856",
"0.67896724",
"0.65808904",
"0.6365835",
"0.63628143",
"0.632067",
"0.62956697",
"0.6284243",
"0.62702245",
"0.625835",
"0.6245525",
"0.61474824",
"0.6098934",
"0.6074185",
"0.60714906",
"0.602317... | 0.81119895 | 0 |
return the first n bits of fractional part of float f | def frac_bin(f, n=32):
f -= math.floor(f) # get only the fractional part
f *= 2**n # shift left
f = int(f) # truncate the rest of the fractional content
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mask_i_float(i, n):\n range_n = arange(cast(array(n), int32))\n i_float = cast(array(i), int32)\n mask_i = equal(range_n, i_float)\n mask_i_float = cast(mask_i, float32)\n return mask_i_float",
"def fpart(x):\n return x - np.floor(x)",
"def fpart(x):\n return x - math.floor(x)"... | [
"0.6895186",
"0.6649497",
"0.66047823",
"0.627372",
"0.6265717",
"0.61318606",
"0.6037289",
"0.6027234",
"0.60202575",
"0.60193044",
"0.59969354",
"0.5991846",
"0.59733486",
"0.59640974",
"0.5958672",
"0.59521466",
"0.5927512",
"0.5888159",
"0.58834416",
"0.58711225",
"0.5788... | 0.7696176 | 0 |
Preprocesses the given bitext by removing empty lines, sentence pairs in incorrect languages, sentences above a the specified length threshold, and sentence pair exceeding the specified length ratio. | def preprocess_bitext(src_path, tgt_path, src_lang, tgt_lang, max_len, max_len_ratio):
# Generate output paths
src_out_path = '.'.join(src_path.split('.')[:-1]) + '.clean.{:s}'.format(src_lang)
tgt_out_path = '.'.join(tgt_path.split('.')[:-1]) + '.clean.{:s}'.format(tgt_lang)
# Open aligned corpora
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(text):\n text = remove_space(text)\n text = clean_special_punctuations(text)\n text = handle_emojis(text)\n text = clean_number(text)\n text = spacing_punctuation(text)\n text = clean_repeat_words(text)\n text = remove_space(text)\n #text = stop(text)# if changing this, then ... | [
"0.5930999",
"0.56018895",
"0.54720354",
"0.54013246",
"0.5385498",
"0.53538865",
"0.5309747",
"0.5302773",
"0.530155",
"0.5279971",
"0.5275908",
"0.52461535",
"0.5241778",
"0.523378",
"0.5210483",
"0.5210375",
"0.52024615",
"0.51972234",
"0.51928794",
"0.51886725",
"0.518412... | 0.6658864 | 0 |
Generate a small set of random templates for testing | def tst_random_set():
final_wave, final_spec, final_z = desi_qso_templates(
outfil='test_random_set.fits', N_perz=100, seed=12345) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_multi_template():\n data = []\n data.extend([\"{}_data.json\".format(i) for i in range(50)])\n data.extend([\"{}_log.csv\".format(i) for i in range(50)])\n data.extend([\"filename_{}.py\".format(i) for i in range(50)])\n data.extend([\"stuff_{}.py\".format(i) for i in range(50)])\n temp ... | [
"0.72083974",
"0.63701993",
"0.6368686",
"0.6321199",
"0.62644243",
"0.6257337",
"0.6201381",
"0.617634",
"0.6142078",
"0.6015824",
"0.6010889",
"0.59950966",
"0.5977103",
"0.597154",
"0.5879443",
"0.5858846",
"0.5847928",
"0.583918",
"0.5821612",
"0.58189946",
"0.58071667",
... | 0.6923423 | 1 |
Prints a message that the restaurant is open. | def open_restaurant(self):
print(f"The restaurant is open.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_restaurant(self):\n msg = f\"{self.name} is open. Come on in!\"\n print(f\"\\n{msg}\")",
"def open_restaurant(self):\n\t\topen = f\"{self.restaurant_name} is now open.\"\n\t\tprint(f\"\\n{open}\")",
"def open_restaurant(self):\r\n\t\tprint(self.restaurant_name.title() + \" is open\")",
... | [
"0.84129494",
"0.83964026",
"0.83871007",
"0.8371406",
"0.8318077",
"0.8231593",
"0.8231593",
"0.8231593",
"0.8207684",
"0.8207684",
"0.8207684",
"0.8207684",
"0.81987953",
"0.81586903",
"0.8079485",
"0.80655825",
"0.7935586",
"0.7746546",
"0.7586863",
"0.7568593",
"0.6807336... | 0.8771324 | 0 |
Remove duplicates in a 2D list. | def remove_dupl_2d(arr):
arr_len = len(arr)
idx = 0
unique = set()
while idx < arr_len:
if tuple(arr[idx]) in unique:
del arr[idx]
arr_len -= 1
continue
unique.add(tuple(arr[idx]))
idx += 1
return arr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_elements_from_2D_list(list_2d):\n return list(set(flatten_2D_list(list_2d)))",
"def remove_duplicates(list):\n x = 0\n while x < len(list):\n y = x + 1\n while y < len(list):\n if list[x] == list[y]:\n del list[y]\n else:\n y +... | [
"0.77904236",
"0.7317339",
"0.7272788",
"0.70233446",
"0.6959906",
"0.6949109",
"0.69180614",
"0.6898379",
"0.6891898",
"0.6872626",
"0.686393",
"0.68368906",
"0.6829106",
"0.6820149",
"0.6818071",
"0.6759585",
"0.6757643",
"0.66838396",
"0.66789544",
"0.66774946",
"0.6656065... | 0.75136393 | 1 |
Initialise verboseprint() if verbose to a specific nvfunc or print, else to no printing. | def init_verbose_print(verbose=True, vfunc=print, nvfunc=None):
global verboseprint
if verbose:
verboseprint = vfunc
else:
if not nvfunc:
verboseprint = lambda *a, **k: None
else:
verboseprint = nvfunc
return verboseprint | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verbose_print(verbose, print_function=None):\n\n if verbose:\n return print_function or print\n else:\n def vprint(*args, **kwars):\n pass\n return vprint",
"def set_verboseprint(func=misc.init_verbose_print(verbose=True, vfunc=print, nvfunc=misc.log)):\n global verbo... | [
"0.7538737",
"0.7518328",
"0.6643926",
"0.66073173",
"0.6594862",
"0.65729207",
"0.65286297",
"0.63692355",
"0.6299959",
"0.629843",
"0.6282386",
"0.6246638",
"0.612347",
"0.6121666",
"0.6113824",
"0.6102391",
"0.6084847",
"0.598136",
"0.59381145",
"0.5932641",
"0.5875921",
... | 0.8172151 | 0 |
Returns a list of all abundant numbers less than an upper limit | def getAbundantNumbers(upperLimit):
result = []
for i in range(1, upperLimit):
if d(i) > i:
result.append(i)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(limit=28123):\n sum_divs = [1] * (limit + 1)\n\n for i in range(2, int(limit**0.5) + 1):\n sum_divs[i * i] += i\n for k in range(i + 1, limit // i + 1):\n sum_divs[k * i] += k + i\n\n abundants = set()\n res = 0\n\n for n in range(1, limit + 1):\n if sum_... | [
"0.6772986",
"0.65578127",
"0.6472297",
"0.6274483",
"0.61667085",
"0.6099296",
"0.6032808",
"0.6027965",
"0.5983113",
"0.59658635",
"0.59558725",
"0.5935221",
"0.5906062",
"0.58387524",
"0.5832162",
"0.5813864",
"0.58016706",
"0.579645",
"0.57799524",
"0.57706046",
"0.576062... | 0.8741688 | 0 |
Returns true iff the number n can be written as the sum of two abundant numbers. | def canBeWritten(n):
for a in abundantNumbersList:
if a >= n: break
if (n - a) in abundantNumbersSet:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_abundant(n):\r\n if sum_proper_divisors(n) > n:\r\n return True\r\n else:\r\n return False",
"def isAbundant(n):\n\treturn sumProperDivisors(n, PRIMES) > n",
"def is_abundant(num: int) -> bool:\n return sum(divisors(num)) - num > num",
"def is_abundant(n: int, print_div: bool = ... | [
"0.7858181",
"0.76310307",
"0.7264005",
"0.7210944",
"0.68021965",
"0.6637436",
"0.6592846",
"0.6582656",
"0.6508782",
"0.64454526",
"0.63586575",
"0.63261133",
"0.6279456",
"0.623999",
"0.62178534",
"0.616031",
"0.61566705",
"0.61406416",
"0.61299574",
"0.6128495",
"0.611129... | 0.7694291 | 1 |
For making a new request for ride. | def ride():
from services import taxi_service
customer_id = request.form['customer_id']
res = taxi_service.ride(customer_id)
return json_response(res) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_request(self, **kwargs):\n if kwargs['ride_id'] in app.database['Rides']:\n request_ids = [x for x in app.database['Requests']]\n if request_ids:\n request_id = max(request_ids) + 1\n else:\n request_id = 1\n self.new_reque... | [
"0.75216687",
"0.65378934",
"0.64955944",
"0.6391881",
"0.6327837",
"0.6260179",
"0.6085085",
"0.6083617",
"0.6060242",
"0.5994067",
"0.5968204",
"0.58465064",
"0.58400995",
"0.5741157",
"0.5677039",
"0.5617212",
"0.55390745",
"0.55201983",
"0.5494111",
"0.5423132",
"0.541637... | 0.6671646 | 1 |
Test the function 'save_screenshot' | def test_save_screenshot():
surface_flow_file = Path(TEST_RESULTS_FILES_PATH, "surface_flow.vtu")
screenshot_file = save_screenshot(surface_flow_file, "Mach")
assert screenshot_file.exists()
if screenshot_file.exists():
screenshot_file.unlink() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __take_screenshot(web_driver: webdriver, test_name: str):\n root_dir = os.path.dirname(os.path.abspath(__file__)).replace(\"tests\", \"reports\")\n file_name = f\"{str(datetime.datetime.now().timestamp())}_{test_name}.jpg\"\n screenshot_file_path = os.path.join(root_dir, file_name)\n web_driver.sav... | [
"0.7212455",
"0.7189058",
"0.70866424",
"0.7077667",
"0.70456177",
"0.6968092",
"0.69598687",
"0.6943727",
"0.6886083",
"0.6874362",
"0.6820328",
"0.6815366",
"0.68121475",
"0.6712085",
"0.6625147",
"0.6597559",
"0.6579359",
"0.6511203",
"0.65101516",
"0.6504467",
"0.65036196... | 0.81533283 | 0 |
get the date as a string only shows month/day [bias] as days want to add on today(could be minus) defaut is zero stands for today | def get_date_str(bias=0):
today = datetime.datetime.today() # 獲得今天的日期
date = (today + datetime.timedelta(days=bias)).strftime("%m/%d") # 格式化日期
return ' ' + date[1:] if date[0] == '0' else date # 把0換成空白 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def todaystr():\n today = datetime.datetime.today()\n return f\"{today.year}{today.month:02}{today.day:02}\"",
"def getDate():\n current_time = datetime.datetime.now()\n day = current_time.day\n month = current_time.month\n year = current_time.year\n date = \"{dd}-{mm}-{yyyy}\".format(dd=day... | [
"0.77219003",
"0.7503358",
"0.7500843",
"0.7455331",
"0.7453163",
"0.7407494",
"0.73675853",
"0.73555744",
"0.7328088",
"0.7196816",
"0.7162487",
"0.70597667",
"0.7008564",
"0.6929033",
"0.6923107",
"0.6921202",
"0.68978816",
"0.6877118",
"0.6834021",
"0.68301964",
"0.6810871... | 0.8040248 | 0 |
Calculates the demand along each edge for a particular routing and flow | def calc_demand(self, routing: np.ndarray, demand: float,
commodity_idx: int) -> np.ndarray:
commodity = self.commodities[commodity_idx]
node_flow = np.zeros(self.num_nodes)
node_flow[commodity[0]] = demand
split_matrix = np.zeros((self.num_nodes, self.num_nodes), dt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_per_flow_link_utilisation(self, flow: Tuple[int, int],\n demand: float,\n routing: np.ndarray) -> np.ndarray:\n edge_mapping = {edge: i for i, edge in\n enumerate(sorted(self.graph.edges))}\n\n ... | [
"0.7155596",
"0.6779073",
"0.6652812",
"0.6349164",
"0.63395905",
"0.6288503",
"0.62845767",
"0.6226773",
"0.62261355",
"0.61473256",
"0.61391884",
"0.6069398",
"0.6058541",
"0.6003596",
"0.5980734",
"0.5970249",
"0.59189695",
"0.59046817",
"0.58885455",
"0.58686656",
"0.5754... | 0.7746539 | 0 |
Calculates the link utilisation over a graph for a particular flow and its demand. (NB utilisation in bandwidth, not relative to capacity) | def calc_per_flow_link_utilisation(self, flow: Tuple[int, int],
demand: float,
routing: np.ndarray) -> np.ndarray:
edge_mapping = {edge: i for i, edge in
enumerate(sorted(self.graph.edges))}
link_utili... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_overall_link_utilisation(self, demands: Demand,\n routing: Routing) -> np.ndarray:\n flows = [(i, j) for i in range(self.num_nodes)\n for j in range(self.num_nodes)\n if i != j]\n\n link_utilisation = np.zeros(self.num_edge... | [
"0.71253026",
"0.67660636",
"0.66454524",
"0.6522981",
"0.6514812",
"0.647129",
"0.6460042",
"0.6392503",
"0.6243768",
"0.62313336",
"0.6146924",
"0.61348885",
"0.6108246",
"0.5984085",
"0.5855024",
"0.58338815",
"0.5774301",
"0.57635266",
"0.5752603",
"0.57300353",
"0.570590... | 0.77368706 | 0 |
Calculates the overall utilisation of each link in a network given a routing choice and a set of demands. (NB utilisation in bandwidth, not relative to capacity) | def calc_overall_link_utilisation(self, demands: Demand,
routing: Routing) -> np.ndarray:
flows = [(i, j) for i in range(self.num_nodes)
for j in range(self.num_nodes)
if i != j]
link_utilisation = np.zeros(self.num_edges)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_slow(self, demands: Demand, routing: Routing) -> float:\n edge_capacities = [e[2]['weight'] for e in\n sorted(self.graph.edges(data=True))]\n link_utilisation = self.calc_overall_link_utilisation(demands, routing)\n # Because utilisation compared to link widt... | [
"0.69715726",
"0.6957851",
"0.6760472",
"0.6361233",
"0.6345169",
"0.61192685",
"0.61020505",
"0.6086766",
"0.60547054",
"0.5906217",
"0.5893766",
"0.58539325",
"0.58028054",
"0.56963044",
"0.5695608",
"0.5679503",
"0.56758183",
"0.56425416",
"0.5628271",
"0.5583995",
"0.5572... | 0.75995314 | 0 |
Takes a time interval, number of steps, adjacency matrix, payment matrix (or matrices), relationship matrix and initial state of all vertices to return the result of the hyperrational evolutionary game played on the given graph in that time interval | def hr_game(t0, tf, n, A, B, R, x0):
# t0 - Initial time
# tf - Final time
# n - Number of steps
# A - Adjacency matrix, np.ndarray (N,N)
# B - A 2D or 3D matrix with all payoff matrices, np.ndarray (S,S,N)
# R - Relationship or preference matrix, np.ndarray (N,N)
# x0 - Initial state of o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def params(timeseries_input):\n # Settings for Nelder Mead Algorithm\n global timeseries\n timeseries=timeseries_input\n\n NumIters = 1 # First Iteration\n MaxIters = 1e3 # Maximum number of iterations\n Tolerance = 1e-5 # Tolerance on best and worst function values\n N = 5 # Number of Hes... | [
"0.6062276",
"0.6009414",
"0.5854938",
"0.55636716",
"0.5466281",
"0.54142034",
"0.54097426",
"0.53703797",
"0.5366806",
"0.5362178",
"0.53470725",
"0.5342757",
"0.5329308",
"0.52993786",
"0.5255946",
"0.52543396",
"0.5253646",
"0.5226769",
"0.5217197",
"0.5200583",
"0.51922"... | 0.6342304 | 0 |
Constructor for the RestoreObjectState class | def __init__(self,
error=None,
object_status=None,
resource_pool_id=None,
restored_object_id=None,
source_object_id=None,
):
# Initialize members of the class
self.error = error
self.object_status =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, state):\n self.state = state",
"def restore(self, obj):\n return obj",
"def __init__(self,\n alternate_restore_base_directory=None,\n continue_on_error=None,\n encryption_enabled=None,\n generate_ssh_keys=None,\n ... | [
"0.6527886",
"0.6478938",
"0.63768274",
"0.63061714",
"0.6259334",
"0.6208393",
"0.6155825",
"0.6133407",
"0.612051",
"0.6097409",
"0.5997136",
"0.5995691",
"0.59769154",
"0.5974528",
"0.5970553",
"0.59491473",
"0.59310687",
"0.592171",
"0.5913257",
"0.58927315",
"0.58747876"... | 0.69528556 | 0 |
Test login with 2SA. | def test_login_2sa(self):
dsm_7 = SynologyDSMMock(
VALID_HOST,
VALID_PORT,
VALID_USER_2SA,
VALID_PASSWORD,
VALID_HTTPS,
VALID_VERIFY_SSL,
)
dsm_7.dsm_version = 7
with pytest.raises(SynologyDSMLogin2SARequiredExceptio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_login_2sa_new_session(self):\n dsm_7 = SynologyDSMMock(\n VALID_HOST,\n VALID_PORT,\n VALID_USER_2SA,\n VALID_PASSWORD,\n VALID_HTTPS,\n VALID_VERIFY_SSL,\n device_token=DEVICE_TOKEN,\n )\n dsm_7.dsm_version ... | [
"0.7610409",
"0.7500811",
"0.74207056",
"0.74207056",
"0.7279427",
"0.72677475",
"0.7121446",
"0.7109126",
"0.707014",
"0.70642114",
"0.7060475",
"0.70395577",
"0.70346",
"0.69922304",
"0.69830513",
"0.6942732",
"0.6919252",
"0.6907737",
"0.6880657",
"0.6877048",
"0.6873271",... | 0.80582833 | 0 |
Test login with 2SA and a new session with granted device. | def test_login_2sa_new_session(self):
dsm_7 = SynologyDSMMock(
VALID_HOST,
VALID_PORT,
VALID_USER_2SA,
VALID_PASSWORD,
VALID_HTTPS,
VALID_VERIFY_SSL,
device_token=DEVICE_TOKEN,
)
dsm_7.dsm_version = 7
ass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_login_2sa(self):\n dsm_7 = SynologyDSMMock(\n VALID_HOST,\n VALID_PORT,\n VALID_USER_2SA,\n VALID_PASSWORD,\n VALID_HTTPS,\n VALID_VERIFY_SSL,\n )\n dsm_7.dsm_version = 7\n with pytest.raises(SynologyDSMLogin2SAR... | [
"0.79027075",
"0.6791165",
"0.6721474",
"0.6619786",
"0.65200156",
"0.649458",
"0.64693856",
"0.64288",
"0.6404014",
"0.64035445",
"0.63950443",
"0.63943654",
"0.6369294",
"0.6346183",
"0.6331206",
"0.6299405",
"0.6282982",
"0.6256549",
"0.6255143",
"0.6224549",
"0.62157404",... | 0.82061094 | 0 |
Check if the serial message have a valid CRC. | def crcCheck(serialMessage):
checkResult = False
#CRC from serial message
crc = int.from_bytes(serialMessage[14:16], byteorder='little', signed=False)
#calculated CRC
crcCalc = libscrc.modbus(serialMessage[0:14])
if crc == crcCalc:
checkResult = True
return checkResult | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_crc(self):\n return self.name.startswith('CRC')",
"def check_crc(chunk, crc):\n\n crc = bytes(crc)\n crc_this = bytes(ensure_crc(crc16.crc16xmodem(bytes(chunk))).encode('utf-8'))\n if crc_this == crc:\n return True\n else:\n return False",
"def check_crc(function_specifi... | [
"0.7833014",
"0.76461273",
"0.7568382",
"0.7517449",
"0.7303092",
"0.7155623",
"0.711303",
"0.6821579",
"0.68020415",
"0.6791723",
"0.6733442",
"0.64848715",
"0.6392629",
"0.6391682",
"0.6333633",
"0.622844",
"0.622844",
"0.6166218",
"0.6160127",
"0.61058235",
"0.6096547",
... | 0.8432148 | 0 |
This function tests that square inherits from Base | def test_SquareinheritancefromBase(self):
Square.reset_objects()
self.assertEqual(issubclass(Square, Base), True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_SquareinheritancefromRectangle(self):\n Square.reset_objects()\n self.assertEqual(issubclass(Square, Rectangle), True)",
"def test_inheritance(self):\n self.assertTrue(issubclass(Rectangle, Base))",
"def test_square_class(self):\n s1 = Square(10)\n self.assertEqual(1... | [
"0.78790617",
"0.7464751",
"0.74157864",
"0.72943133",
"0.7226751",
"0.6838892",
"0.6658183",
"0.63029987",
"0.62793493",
"0.6201508",
"0.61887723",
"0.6183908",
"0.61684614",
"0.6153239",
"0.61244017",
"0.61089444",
"0.6081408",
"0.60803723",
"0.6078038",
"0.6011344",
"0.600... | 0.8380413 | 0 |
This function tests that square inherits from Base | def test_SquareinheritancefromRectangle(self):
Square.reset_objects()
self.assertEqual(issubclass(Square, Rectangle), True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_SquareinheritancefromBase(self):\n Square.reset_objects()\n self.assertEqual(issubclass(Square, Base), True)",
"def test_inheritance(self):\n self.assertTrue(issubclass(Rectangle, Base))",
"def test_square_class(self):\n s1 = Square(10)\n self.assertEqual(10, s1.size... | [
"0.8381641",
"0.7465298",
"0.74154085",
"0.72949463",
"0.7227583",
"0.68388546",
"0.66581863",
"0.6302443",
"0.62782824",
"0.6202097",
"0.61873174",
"0.61839616",
"0.6166422",
"0.6153196",
"0.61243147",
"0.6108876",
"0.6081987",
"0.6081601",
"0.6077003",
"0.6009714",
"0.60062... | 0.7879409 | 1 |
This function tests that ValueError is thrown for 0 size value | def test_0size(self):
Square.reset_objects()
with self.assertRaises(ValueError) as e:
s1 = Square(0)
self.assertEqual(str(e.exception), "width must be > 0") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_size(s):\n\n s = check_1d(s, \"size\")\n if any(map(lambda d: d <= 0, s)):\n raise Exception('Size cannot be 0 or negative')\n\n return s",
"def test_Sobol_G_raises_error_if_values_wrong_size():\n a = [1, 2, 3, 4, 5, 6, 7, 8]\n with raises(ValueError):\n evaluate(np.array([... | [
"0.7179001",
"0.70014584",
"0.6692978",
"0.66857994",
"0.6674627",
"0.6652692",
"0.665025",
"0.6612061",
"0.66108143",
"0.6585465",
"0.6583776",
"0.6574457",
"0.65705",
"0.6555679",
"0.6463471",
"0.6458329",
"0.6458053",
"0.64574504",
"0.6448534",
"0.64482915",
"0.6438322",
... | 0.73414814 | 0 |
This function tests for bad x value with string | def test_badxvaluewithstring(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(1, "foo", 2, 3)
self.assertEqual(str(e.exception), 'x must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_x_ValueError(self):\n self.assertRaisesRegex(\n ValueError,\n 'x must be >= 0',\n Rectangle,\n 4, 2, -1, 0, 12\n )",
"def test_is_valid_label_value_invalid_input():\n # test length violations\n assert not is_valid_label_value(value=f\... | [
"0.69795847",
"0.6597234",
"0.6589841",
"0.6565734",
"0.6538347",
"0.64426655",
"0.6354306",
"0.6324324",
"0.6260431",
"0.625534",
"0.62540674",
"0.6247289",
"0.6183881",
"0.61823475",
"0.61577374",
"0.615086",
"0.6148752",
"0.6140381",
"0.61370695",
"0.61370695",
"0.6133567"... | 0.7074882 | 0 |
This function tests for bad x value with tuple | def test_badxvaluewithtuple(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(1, (1, 2), 2, 3)
self.assertEqual(str(e.exception), 'x must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tuples_to_avoid(self):\n self.assertFalse(\n any(key in self.resultDict and self.resultDict[key] == tuplesToAvoid[key] for key in tuplesToAvoid))",
"def __allowed_values_correct_tuple(self):\n strTestName = 'Values of a tuple (correct)'\n RxCSObject = _RxCSobject()\n\n ... | [
"0.7006258",
"0.69747514",
"0.6616531",
"0.6556147",
"0.6536729",
"0.6535097",
"0.6523847",
"0.65184593",
"0.64959896",
"0.6440684",
"0.6398612",
"0.6395714",
"0.637838",
"0.6376401",
"0.6351738",
"0.6275108",
"0.62562424",
"0.62542605",
"0.62175417",
"0.6212631",
"0.6210541"... | 0.69840086 | 1 |
This function tests for bad x value with list | def test_badxvaluewithlist(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(1, [1, 2], 2, 3)
self.assertEqual(str(e.exception), 'x must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __allowed_values_incorrect_list_with_allowed_values(self):\n strTestName = 'Value NaN given in a list with allowed values (incorrect)'\n RxCSObject = _RxCSobject()\n\n RxCSObject.paramAddMan('parameter1', 'Numpy Array 2D')\n RxCSObject.paramAllowed('parameter1', range(int(2e3)) + [n... | [
"0.68315846",
"0.65919036",
"0.6537355",
"0.6444303",
"0.641923",
"0.6327543",
"0.6288081",
"0.6235862",
"0.6219361",
"0.61817026",
"0.6179775",
"0.61674714",
"0.61317503",
"0.6115415",
"0.6108486",
"0.61075026",
"0.6064361",
"0.60562",
"0.6040578",
"0.6025303",
"0.6013717",
... | 0.7108924 | 0 |
This function tests for bad size value with bools | def test_badsizevaluebool(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(True, 1, 2, 3)
self.assertEqual(str(e.exception), 'width must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_size(size):\r\n\r\n if not isinstance(size, (list, tuple)):\r\n raise ValueError(\"Size must be a tuple\")\r\n if len(size) != 2:\r\n raise ValueError(\"Size must be a tuple of length 2\")\r\n if size[0] < 0 or size[1] < 0:\r\n raise ValueError(\"Width and height must be >=... | [
"0.71509224",
"0.68044245",
"0.6784293",
"0.67276603",
"0.6585997",
"0.654349",
"0.6481282",
"0.6463",
"0.64172286",
"0.6415458",
"0.64140904",
"0.63802457",
"0.6275432",
"0.6251223",
"0.62397385",
"0.6207709",
"0.61241347",
"0.6112032",
"0.6096959",
"0.6092303",
"0.6078279",... | 0.71739995 | 0 |
This function tests for bad y value with bools | def test_badyvaluewithbools(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(1, 2, True, 3)
self.assertEqual(str(e.exception), 'y must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_y(self):\n return any(map(lambda s: s.is_y, self))",
"def false_neg(yt, yp) -> Any:\n from keras import backend as K\n return K.sum(K.cast((1 - yp) * (0 + yt) > 0.5, 'float')) / K.maximum(1.0, K.sum(0 + yt))",
"def isfalse(variable):\n\n # Return the answer\n return variable in [0, 0... | [
"0.69083273",
"0.6695718",
"0.6674473",
"0.66075134",
"0.6587407",
"0.6464221",
"0.64067847",
"0.6404094",
"0.6357871",
"0.63352954",
"0.6284141",
"0.6274285",
"0.62531525",
"0.6222517",
"0.62003815",
"0.6190041",
"0.6136608",
"0.60998005",
"0.6085489",
"0.60599977",
"0.60529... | 0.6742841 | 1 |
This function tests for bad size value with floats | def test_badsizevaluefloats(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(float(1), 1, 2, 3)
self.assertEqual(str(e.exception), 'width must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_float(check):",
"def is_float(self, size=None):\n return False",
"def test_float(self):\n self.assertFalse(validate_measure_input('0.0', self.measures))\n self.assertFalse(validate_measure_input('1.0', self.measures))\n self.assertFalse(validate_measure_input('1.1', se... | [
"0.7329806",
"0.726083",
"0.6919333",
"0.6791456",
"0.67735356",
"0.6667604",
"0.6654166",
"0.6617173",
"0.66136104",
"0.6580767",
"0.6558897",
"0.65265524",
"0.6493573",
"0.6468674",
"0.6459855",
"0.6433279",
"0.64139265",
"0.64002323",
"0.6386368",
"0.63839954",
"0.637679",... | 0.74446696 | 0 |
This function tests for bad x value with sets | def test_badxvaluewithsets(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(1, {1, 2, 3}, 2, 3)
self.assertEqual(str(e.exception), 'x must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_values(self):\n # Assume\n df1 = pd.DataFrame([[1, 6, 2, 3, 19],\n [4, 5, 8, 6, 30],\n [4, 5, 12, 8, 22],\n [4, 7, 9, 5, 21],\n [7, 8, 9, 12, 5]],\n columns=[... | [
"0.6515592",
"0.65142566",
"0.64434457",
"0.6162853",
"0.61155057",
"0.60888386",
"0.60695523",
"0.603732",
"0.6008015",
"0.5992704",
"0.5987261",
"0.5945447",
"0.5944256",
"0.59343463",
"0.5927906",
"0.59046",
"0.5895334",
"0.5876729",
"0.5865866",
"0.58559877",
"0.58026785"... | 0.705099 | 0 |
This function tests for bad x value with dicts | def test_badxvaluewithdicts(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(1, {"foo": 1}, 2, 3)
self.assertEqual(str(e.exception), 'x must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_badyvaluewithdicts(self):\n Rectangle.reset_objects()\n with self.assertRaises(TypeError) as e:\n r1 = Square(1, 2, {\"foo\": 1}, 3)\n self.assertEqual(str(e.exception), 'y must be an integer')",
"def check_for_dict(check):",
"def test_bad_valuetype():\n test = [{'ke... | [
"0.7063102",
"0.6901642",
"0.68893194",
"0.67338705",
"0.6730255",
"0.66233486",
"0.65747875",
"0.6557071",
"0.6369715",
"0.6351837",
"0.6335188",
"0.6329998",
"0.6318528",
"0.6300104",
"0.62784344",
"0.62771666",
"0.6276584",
"0.62739366",
"0.62530696",
"0.6234832",
"0.62275... | 0.74902976 | 0 |
This function tests for bad y value with dicts | def test_badyvaluewithdicts(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(1, 2, {"foo": 1}, 3)
self.assertEqual(str(e.exception), 'y must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_y_not_int_not_float(wage_X_y, wage_gam):\n X, y = wage_X_y\n y_str = ['hi'] * len(y)\n\n with pytest.raises(ValueError):\n check_y(y_str, wage_gam.link, wage_gam.distribution)",
"def _validate_dict_data(self, expected, actual):\n for k, v in expected.iteritems():\n ... | [
"0.65423876",
"0.6532567",
"0.6517453",
"0.6497255",
"0.62020665",
"0.6187707",
"0.61815435",
"0.61809665",
"0.6161865",
"0.61170024",
"0.6088386",
"0.6066407",
"0.60333383",
"0.60322386",
"0.60267806",
"0.60139036",
"0.60025436",
"0.5979485",
"0.5971068",
"0.5970892",
"0.596... | 0.6933743 | 0 |
This function tests for bad x value with funcs | def test_badxvaluewithfuncs(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(1, print(), 2, 3)
self.assertEqual(str(e.exception), 'x must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_error(f, x):\n try:\n f(x)\n return False\n except:\n return True",
"def test_correct_value(self):\n self.assertTrue(py_function(6) == 36)\n self.assertFalse(py_function(5) == 9)\n for i in range(0, 10):\n self.assertTrue(py_function(i) == i**2 if... | [
"0.70177335",
"0.6598538",
"0.6551677",
"0.6535496",
"0.64791",
"0.64751804",
"0.6444109",
"0.6384782",
"0.63809425",
"0.6376168",
"0.6334867",
"0.63270766",
"0.6288615",
"0.6278401",
"0.62581235",
"0.62579507",
"0.62479675",
"0.6207513",
"0.6186114",
"0.6177712",
"0.6177712"... | 0.7192149 | 0 |
This function tests the size getter | def test_sizegetter(self):
Rectangle.reset_objects()
r1 = Square(1, 2, 2, 3)
self.assertEqual(r1.size, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_size(self):\n ...",
"def get_size(self):",
"def getSize(self):\n assert False",
"def size(self):",
"def size(self) -> int:",
"def size() -> int:\n ...",
"def _size(self):\n raise NotImplementedError",
"def getSize(self) -> int:\n ...",
"def getSize(self) -... | [
"0.79357636",
"0.7931725",
"0.78921765",
"0.7866568",
"0.7854694",
"0.7824038",
"0.7799345",
"0.7788262",
"0.7788262",
"0.7726975",
"0.76932454",
"0.7617639",
"0.75942594",
"0.75844234",
"0.7560417",
"0.75556916",
"0.75556916",
"0.75556916",
"0.7538814",
"0.753443",
"0.751555... | 0.8108042 | 0 |
This function tests the size setter | def test_sizesetter(self):
Rectangle.reset_objects()
r1 = Square(1, 2, 2, 3)
self.assertEqual(r1.size, 1)
r1.size = 100
self.assertEqual(r1.size, 100) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sizesetterwithset(self):\n Rectangle.reset_objects()\n with self.assertRaises(TypeError) as e:\n r1 = Square(1, 2, 2, 3)\n self.assertEqual(r1.size, 1)\n r1.size = {\"foo\", 2}\n self.assertEqual(str(e.exception), \"width must be an integer\")",
"def... | [
"0.7792907",
"0.7693151",
"0.7666621",
"0.75800925",
"0.7571968",
"0.7473297",
"0.7417849",
"0.73012525",
"0.7267939",
"0.7258394",
"0.7256592",
"0.7232874",
"0.71553475",
"0.71380746",
"0.70957935",
"0.7058936",
"0.7051922",
"0.70510983",
"0.69948095",
"0.699118",
"0.6963985... | 0.8216275 | 0 |
This function tests the size setter with string | def test_sizesetterwithstring(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(1, 2, 2, 3)
self.assertEqual(r1.size, 1)
r1.size = "foo"
self.assertEqual(str(e.exception), "width must be an integer") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __size_restriction_correct_string_number(self):\n\n strTestName = 'String size equal to a string (correct)'\n RxCSObject = _RxCSobject()\n\n RxCSObject.paramAddMan('parameter1', 'String parameter')\n RxCSObject.paramType('parameter1', str)\n RxCSObject.paramSizEq('parameter1'... | [
"0.7452561",
"0.74343324",
"0.72125316",
"0.7165165",
"0.7162416",
"0.7097643",
"0.70611894",
"0.70401406",
"0.7039656",
"0.700409",
"0.69777435",
"0.6852879",
"0.6768443",
"0.6762896",
"0.6759838",
"0.67128867",
"0.669268",
"0.6645321",
"0.66379744",
"0.6613321",
"0.6609989"... | 0.7871389 | 0 |
This function tests the size setter with func | def test_sizesetterwithfunc(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(1, 2, 2, 3)
self.assertEqual(r1.size, 1)
r1.size = print()
self.assertEqual(str(e.exception), "width must be an integer") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sizesetter(self):\n Rectangle.reset_objects()\n r1 = Square(1, 2, 2, 3)\n self.assertEqual(r1.size, 1)\n r1.size = 100\n self.assertEqual(r1.size, 100)",
"def test_sizesetterwithset(self):\n Rectangle.reset_objects()\n with self.assertRaises(TypeError) as... | [
"0.76074827",
"0.73241836",
"0.7299613",
"0.71340346",
"0.70718694",
"0.70272154",
"0.69879526",
"0.69618094",
"0.69158465",
"0.68551946",
"0.6852976",
"0.68434936",
"0.6834289",
"0.68095237",
"0.68004525",
"0.6782642",
"0.6782323",
"0.6747741",
"0.6726101",
"0.67179966",
"0.... | 0.7818356 | 0 |
This function tests the to_dictionary function | def test_to_dict(self):
Square.reset_objects()
s1 = Square(10, 2, 1)
s1_dictionary = s1.to_dictionary()
self.assertEqual(s1_dictionary, {'id': 1, 'x': 2, 'size': 10, 'y': 1}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dict_to_dict(self):\n @converters.wrap\n def inner_test(param: dict):\n \"\"\"Make sure the parameter was converted correctly.\"\"\"\n self.assertEqual(param, {'foo': 1, 'bar': ['bat', 2]})\n inner_test(param={'foo': 1, 'bar': ['bat', 2]})",
"def test_key_dict(... | [
"0.7176084",
"0.7108782",
"0.7050815",
"0.70425564",
"0.7028966",
"0.7027133",
"0.7022392",
"0.696475",
"0.696263",
"0.69530326",
"0.6941427",
"0.6933888",
"0.69253755",
"0.6914849",
"0.68335044",
"0.6824801",
"0.68152386",
"0.67968",
"0.67782664",
"0.6765529",
"0.6721175",
... | 0.722105 | 0 |
This function tests the update function with to_dict | def test_updatewithdict(self):
s1 = Square(10, 2, 1)
s1_dictionary = s1.to_dictionary()
s2 = Square(1, 1)
s2.update(**s1_dictionary)
self.assertEqual(s2.size, 10)
self.assertEqual(s2.x, 2)
self.assertEqual(s2.y, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_dict(new,old):",
"def test_updatewithdictionarybycomparingdictionaries(self):\n s1 = Square(10, 2, 1, 9)\n s1_dictionary = s1.to_dictionary()\n s2 = Square(1, 1)\n s2.update(**s1_dictionary)\n self.assertEqual(s1.__dict__, s2.__dict__)",
"def test_dict(self):\n ... | [
"0.7573673",
"0.7532664",
"0.7381514",
"0.7352229",
"0.7200704",
"0.6979389",
"0.69530696",
"0.69241667",
"0.6872416",
"0.6872416",
"0.6872416",
"0.6859202",
"0.6837425",
"0.6832763",
"0.6792921",
"0.6743073",
"0.67334944",
"0.6720713",
"0.6713036",
"0.67053515",
"0.6689018",... | 0.75755227 | 0 |
This function tests the display function | def test_display__method(self):
Rectangle.reset_objects()
s1 = Square(5)
f = io.StringIO()
with contextlib.redirect_stdout(f):
s1.display()
self.assertEqual(f.getvalue(), "#####\n#####\n#####\n#####\n#####\n") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_updated_display1(self):\n capturedOutput = io.StringIO()\n sys.stdout = capturedOutput\n r1 = Rectangle(2, 3, 2, 2)\n r1.display()\n sys.stdout = sys.__stdout__\n desired = '\\n\\n ##\\n ##\\n ##\\n'\n self.assertEqual(capturedOutput.getvalue(), desired)... | [
"0.76996773",
"0.7673609",
"0.7643031",
"0.76228404",
"0.75821286",
"0.75602204",
"0.74880636",
"0.7453267",
"0.74367535",
"0.74138623",
"0.7400215",
"0.7366837",
"0.7365232",
"0.7323895",
"0.727535",
"0.7186175",
"0.713864",
"0.7048027",
"0.6800203",
"0.66780984",
"0.6641431... | 0.7729406 | 0 |
Repeat a dataframe n times. | def repeat(df, n):
return pd.concat([df] * n, ignore_index=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Repeat(dataset, count=None):\n return dataset.repeat(count=count)",
"def repeat(self, fn, *args, **kwargs):\n return repeat_n_times(self.n, fn, *args, **kwargs)",
"def repeat(x, repeats, axis=None):\r\n return RepeatOp(axis=axis)(x, repeats)",
"def repeat(self, n, keys=None, axis=1, wrap_kwa... | [
"0.7628029",
"0.72188824",
"0.6911393",
"0.68845344",
"0.6785106",
"0.6629356",
"0.65931594",
"0.6574859",
"0.6574258",
"0.6532897",
"0.63699496",
"0.6342583",
"0.62876594",
"0.6276754",
"0.623809",
"0.6219316",
"0.6213674",
"0.6166084",
"0.61549324",
"0.61308444",
"0.6125135... | 0.8607267 | 0 |
Test type inference works properly for a parquet file with unconventional types types. | def test_infer_parquet_types(tmpdir):
# Create a temporary directory to store the parquet file
tmpdir = str(tmpdir)
# Create a dataframe with all the types
df = pd.DataFrame(
{
"int": [1, 2, 3],
"float": [1.1, 2.2, 3.3],
"string": ["a", "b", "c"],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_as_type(loader):\n exp = loader.find_by_id(3)\n assert isinstance(exp.artifacts[\"predictions_df\"], artifact.Artifact)\n # Use as_type for the first time.\n pickle_artifact1 = exp.artifacts[\"predictions_df\"].as_type(artifact.PickleArtifact)\n # Use as_type for the second time.\n pickl... | [
"0.5770566",
"0.57687217",
"0.5768028",
"0.5666308",
"0.5590542",
"0.558034",
"0.5571467",
"0.55513895",
"0.5543602",
"0.55353683",
"0.55230504",
"0.5512718",
"0.55033225",
"0.5497453",
"0.5489926",
"0.54898447",
"0.5441415",
"0.5438022",
"0.5430504",
"0.540938",
"0.5402098",... | 0.7926908 | 0 |
Shows all the installations from the database | def show_installations(self):
database = Database('data/database.db')
installations = database.read_installations()
view = Template(filename="view/template.html", lookup=lookup)
return view.render(
rows = [[item.number, item.name, item.address, item.zip_code, item.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_installation(self):\n\t\tself.db = DB()\n\t\tinstallation_all = self.db.select_all_from(\"installations\")\n\t\ttmpl = lookup.get_template(\"installation.html\")\n\t\treturn (tmpl.render(installation=installation_all))",
"def installation(request):\n return render(request, 'ecosystem/installation.html... | [
"0.81771755",
"0.65928066",
"0.65425545",
"0.6422345",
"0.6343154",
"0.61781883",
"0.6152795",
"0.60611415",
"0.5992566",
"0.5938621",
"0.5864382",
"0.58546007",
"0.57651806",
"0.5752968",
"0.57020676",
"0.5668832",
"0.565056",
"0.5634714",
"0.5633282",
"0.56175447",
"0.56138... | 0.84590834 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.