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 |
|---|---|---|---|---|---|---|
The path to the Nox shared directory for the build type. This path is dependent on build type. e.g. e.g. if ``build_type`` is ``Debug``, then the ``.nox/.cache/libbezierdebug`` is expected to be returned. This subdirectory will be created if it doesn't exist. If the ``session`` is actually running as part of the intend... | def _cmake_libbezier_root(session, build_type):
if build_type == BUILD_TYPE_DEBUG:
build_session_name = DEBUG_SESSION_NAME
elif build_type == BUILD_TYPE_RELEASE:
build_session_name = RELEASE_SESSION_NAME
else:
raise ValueError(f"Invalid build type {build_type!r}")
if session._ru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_directory(self) -> Optional[str]:\n return self.configuration.build_directory",
"def _get_session_dir(self):\n\n fnd = os.path.join(self.config.capture_dir, self.timestamp.date_string(), self.timestamp.time_string())\n if not os.path.isdir(fnd):\n os.makedirs(fnd)\n\n ... | [
"0.62338483",
"0.6032974",
"0.56745934",
"0.5573401",
"0.54791427",
"0.54650176",
"0.5436696",
"0.541816",
"0.540874",
"0.53899753",
"0.53712296",
"0.5349595",
"0.53116405",
"0.5290689",
"0.5287308",
"0.52851725",
"0.5256396",
"0.5231676",
"0.5209273",
"0.5200714",
"0.5187412... | 0.6486678 | 0 |
Determine if a ``cmake`` binary is needed. This will check if ``cmake`` is on the path so it can be used if needed. Installing ``cmake`` into the ``nox``managed virtual environment can be forced by setting the ``NOX_INSTALL_CMAKE`` environment variable. | def _cmake_needed():
if "NOX_INSTALL_CMAKE" in os.environ:
return True
return shutil.which("cmake") is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_cmake_windows():\n chk = Popen(\"wmic product where \\\"name = 'cmake'\\\" get installlocation,version\",\n shell=True, stdout=PIPE, stderr=PIPE)\n stdout, stderr = chk.communicate()\n if stderr:\n return False, stderr\n lines = [re.sub(\" +\", \" \", line.strip())\n ... | [
"0.6568444",
"0.6497539",
"0.574696",
"0.5692192",
"0.5687764",
"0.5657557",
"0.5591417",
"0.5488396",
"0.5476304",
"0.5427161",
"0.542626",
"0.5424831",
"0.5404955",
"0.539574",
"0.5392243",
"0.53877354",
"0.5385094",
"0.5382117",
"0.5369663",
"0.53570956",
"0.53368527",
"... | 0.87866205 | 0 |
Build and install ``libbezier`` via ``cmake``. The ``session`` may be one of ``libbezierdebug`` / ``libbezierrelease`` in which case we directly build as instructed. Additionally, it may correspond to a session that seeks to build ``libbezier`` as a dependency, e.g. ``nox session unit3.11``. | def _cmake(session, build_type):
libbezier_root = _cmake_libbezier_root(session, build_type)
cmake_external = True
if _cmake_needed():
session.install(DEPS["cmake"])
cmake_external = False
else:
session.run_always(print, "Using pre-installed ``cmake``")
session.run_alway... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(session: nox.Session) -> None:\n\n dist_dir = DIR.joinpath(\"dist\")\n if dist_dir.exists():\n shutil.rmtree(dist_dir)\n\n session.install(\".[dev]\")\n session.run(\"flit\", \"build\")",
"def _cmake_libbezier_root(session, build_type):\n if build_type == BUILD_TYPE_DEBUG:\n ... | [
"0.6017405",
"0.55873793",
"0.5576852",
"0.53642064",
"0.5051541",
"0.50440264",
"0.48939013",
"0.48880678",
"0.47903594",
"0.47713056",
"0.47565785",
"0.4674581",
"0.46128416",
"0.4612213",
"0.4604993",
"0.45972347",
"0.45376772",
"0.4534982",
"0.45184386",
"0.4514612",
"0.4... | 0.7123291 | 0 |
Create a post on the target node, then forget it and check that the change is propagated to the reference node. | async def test_create_and_forget_post_on_target(fixture_account):
_ = await create_and_forget_post(fixture_account, TARGET_NODE, REFERENCE_NODE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_create_and_forget_post_on_reference(fixture_account):\n _ = await create_and_forget_post(fixture_account, REFERENCE_NODE, TARGET_NODE)",
"def remove_node(self, node):\n node.pre.post = node.post\n node.post.pre = node.pre",
"def postprocess(self, target):\n if self.params... | [
"0.6950787",
"0.562694",
"0.56176555",
"0.54716897",
"0.541197",
"0.5351572",
"0.5323476",
"0.526401",
"0.52540886",
"0.52151847",
"0.517234",
"0.517234",
"0.5145133",
"0.51140887",
"0.5105281",
"0.50855756",
"0.50417876",
"0.50337064",
"0.5030256",
"0.5011787",
"0.49801177",... | 0.68948114 | 1 |
Create a post on the reference node, then forget it and check that the change is propagated to the target node. | async def test_create_and_forget_post_on_reference(fixture_account):
_ = await create_and_forget_post(fixture_account, REFERENCE_NODE, TARGET_NODE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_create_and_forget_post_on_target(fixture_account):\n _ = await create_and_forget_post(fixture_account, TARGET_NODE, REFERENCE_NODE)",
"def remove_node(self, node):\n node.pre.post = node.post\n node.post.pre = node.pre",
"def post():\n raise NotImplementedError",
"def postp... | [
"0.6819375",
"0.56737834",
"0.53768146",
"0.53580016",
"0.5322453",
"0.5284637",
"0.527231",
"0.5263982",
"0.522729",
"0.5180288",
"0.51782423",
"0.51492476",
"0.5135717",
"0.5119328",
"0.5112924",
"0.51117015",
"0.51117015",
"0.5071542",
"0.50299793",
"0.5021029",
"0.4989852... | 0.70503724 | 0 |
Attempts to forget a forget message. This should fail. | async def test_forget_a_forget_message(fixture_account):
# TODO: this test should be moved to the PyAleph API tests, once a framework is in place.
async with AlephClient(api_server=TARGET_NODE) as client:
post_hash = await create_and_forget_post(
fixture_account, TARGET_NODE, TARGET_NODE
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forget(self, response, request):\n pass",
"def forget(self, req, ino, nlookup):\r\n self.reply_none(req)",
"def forget(self, desc):\n fd = self.get_fd(desc)\n assert fd in self.callbacks, 'Missing descriptor fd %d' % fd\n LOGGER.debug('Monitoring forget fd %d', fd)\n ... | [
"0.6300369",
"0.5941023",
"0.5711176",
"0.55541223",
"0.54513514",
"0.5419461",
"0.535819",
"0.5255098",
"0.51856637",
"0.51792186",
"0.5168489",
"0.5095458",
"0.50846356",
"0.5010153",
"0.5002374",
"0.49978048",
"0.49861926",
"0.4983129",
"0.49690428",
"0.4935797",
"0.491030... | 0.65627205 | 0 |
Get a named environment variable. | def GetEnvVariable(name):
return os.environ.get(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_environment_variable(name):\n\n variable = None\n try:\n variable = os.environ[name]\n except KeyError:\n pass\n \n return variable",
"def get_var(var_name: str):\n return os.environ[var_name]",
"def get_env_variable(var_name):\n try:\n return os.environ[var_na... | [
"0.87718797",
"0.8226911",
"0.79157805",
"0.7888638",
"0.7883775",
"0.77977866",
"0.77544516",
"0.7713071",
"0.77109146",
"0.770913",
"0.7647273",
"0.7614183",
"0.760763",
"0.75793314",
"0.7554774",
"0.7553723",
"0.7534137",
"0.74628687",
"0.7448695",
"0.7385682",
"0.737286",... | 0.87937665 | 0 |
Set a named environment variable with a given value. | def SetEnvVariable(name, value):
os.environ[name] = str(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setenv(name, value):\n os.environ[name] = value",
"def setEnv(self, name, value=None):\n if value is None:\n try:\n value = os.environ[name]\n except KeyError:\n raise RuntimeError(\"%s does not exist in current environment\", name)\n self.... | [
"0.87134653",
"0.8205182",
"0.79807407",
"0.78888154",
"0.78787637",
"0.7677949",
"0.76059335",
"0.75354844",
"0.74976945",
"0.74042916",
"0.7390883",
"0.71949416",
"0.7159599",
"0.69523114",
"0.6902715",
"0.6863283",
"0.68212205",
"0.671528",
"0.6712321",
"0.6707747",
"0.669... | 0.88576657 | 0 |
Copies the Python library into the archive. If a project is not specified a 'clean' copy from the resources folder is used. Otherwise, if a project is specified the library is copied from this folder instead. | def _copy_pyfmu_lib_to_archive(archive: PyfmuArchive, project: PyfmuProject = None) -> PyfmuArchive:
copy_from_resources = project is None
if(copy_from_resources):
lib_path = Resources.get().pyfmu_dir
err_msg = 'No directory named pyfmu was found in the resources directory, likely thi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _copy_sources_to_archive(project: PyfmuProject, archive: PyfmuArchive) -> PyfmuArchive:\n\n main_script_found = project.main_script_path.is_file()\n\n if(not main_script_found):\n raise RuntimeError(\n f'main script: {project.main_script} was not found inside project: {project.root}')\n... | [
"0.64933664",
"0.5902674",
"0.5609611",
"0.55711323",
"0.5568186",
"0.555647",
"0.5538248",
"0.5502564",
"0.548661",
"0.5464845",
"0.54637194",
"0.5448981",
"0.544053",
"0.54380023",
"0.5412886",
"0.5411097",
"0.53673863",
"0.5293993",
"0.52591866",
"0.52514356",
"0.5245982",... | 0.6618189 | 0 |
Copies the binaries to the archive. | def _copy_binaries_to_archive(archive: PyfmuArchive) -> PyfmuArchive:
binaries_path = Resources.get().binaries_dir
archive_binaries_path = archive.root / 'binaries'
copytree(binaries_path,archive_binaries_path)
# paths
archive.binaries_dir = archive_binaries_path
archive.wrapper_win64 = arc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _copy_bins():\n # STEP 1: If we're performing a build from a copied source tree,\n # copy the generated python files into the package\n\n _clean_bins()\n\n py_z3_build_dir = os.path.join(BUILD_DIR, 'python', 'z3')\n root_z3_dir = os.path.join(ROOT_DIR, 'z3')\n shutil.copy(os.path.join(py_z3_b... | [
"0.68936133",
"0.6779901",
"0.62614894",
"0.62124294",
"0.6180376",
"0.61597294",
"0.6126058",
"0.61067873",
"0.6056795",
"0.6052452",
"0.59870726",
"0.59836006",
"0.593985",
"0.5876153",
"0.58177185",
"0.57706106",
"0.5768951",
"0.5737206",
"0.5716604",
"0.571588",
"0.571377... | 0.726194 | 0 |
Copies the source files of the project into the archive. Note that that a distinction is made between source files and the pyfmu library. In this case source files refer to files written by the developer. | def _copy_sources_to_archive(project: PyfmuProject, archive: PyfmuArchive) -> PyfmuArchive:
main_script_found = project.main_script_path.is_file()
if(not main_script_found):
raise RuntimeError(
f'main script: {project.main_script} was not found inside project: {project.root}')
archive... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _copy_sources():\n shutil.rmtree(SRC_DIR_LOCAL, ignore_errors=True)\n os.mkdir(SRC_DIR_LOCAL)\n\n shutil.copy(os.path.join(SRC_DIR_REPO, 'LICENSE.txt'), SRC_DIR_LOCAL)\n shutil.copy(os.path.join(SRC_DIR_REPO, 'z3.pc.cmake.in'), SRC_DIR_LOCAL)\n shutil.copy(os.path.join(SRC_DIR_REPO, 'CMakeLists.... | [
"0.67813885",
"0.6701942",
"0.6504455",
"0.6486274",
"0.62781286",
"0.61347514",
"0.5991642",
"0.59877133",
"0.59674793",
"0.5884148",
"0.5863999",
"0.5734428",
"0.5731935",
"0.5714663",
"0.5710563",
"0.56204545",
"0.55885804",
"0.5577444",
"0.5576197",
"0.5570292",
"0.556934... | 0.7808164 | 0 |
Generate a slave configuration file for the project | def _generate_slave_config(project: PyfmuProject):
return project.project_configuration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateConfig(run,subrun,conditions):\n \n configname = (conditions.numcdir + \"/\" + str(run) + \"/\" + str(subrun)\n + \"/numc_config_\" + str(run) + \"_\" + str(subrun) + \".cfg\")\n \n configContents = \"\"\n \n configContents += \"[software]\\n\"\n if conditi... | [
"0.6151639",
"0.6110963",
"0.6057893",
"0.59914786",
"0.59746087",
"0.5969774",
"0.5953391",
"0.5931592",
"0.5870527",
"0.5858295",
"0.58413357",
"0.5787947",
"0.5786818",
"0.57844406",
"0.57683694",
"0.5750266",
"0.5745577",
"0.57249355",
"0.5690371",
"0.56799483",
"0.567246... | 0.8178835 | 0 |
Exports a pyfmu project as an FMU to the specified output path. | def export_project(project: PyfmuProject, outputPath: Path, overwrite=False, store_compressed : bool = True) -> PyfmuArchive:
isProject = isinstance(project, PyfmuProject)
if(not isProject):
try:
project = PyfmuProject.from_existing(Path(project))
except Exception as e:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_fmu_from_backend(backend: str, output_path):\n\n backend_manifest = toml.loads(\n pkg_resources.resource_string(__name__, \"resources/backends.toml\").decode()\n )[\"backend\"][backend]\n\n if \"files\" not in backend_manifest:\n raise RuntimeError(\"'files' attribute is not def... | [
"0.593329",
"0.580445",
"0.5661186",
"0.55634034",
"0.54955745",
"0.54675204",
"0.5450275",
"0.5377026",
"0.5331168",
"0.52884156",
"0.5244811",
"0.51316965",
"0.507457",
"0.50743216",
"0.5050527",
"0.49739325",
"0.49655154",
"0.4964104",
"0.49630287",
"0.4947938",
"0.4927027... | 0.63657063 | 0 |
Test that a single subscriber can wait for a notification. | async def test_single_subscriber() -> None:
subject = ChangeNotifier()
result = asyncio.create_task(subject.wait())
# ensure that the wait actually waits by delaying and
# checking that the task has not resolved
await asyncio.sleep(0.1)
assert result.done() is False
asyncio.get_running_loo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subscribe_one_listener(self):\n def listener():\n pass\n EVENT_MANAGER.subscribe('test_listener', listener)\n self.assertIn(listener, EVENT_MANAGER._listeners['test_listener'])",
"def test_process_subscriptions(self):\n pass",
"def test_wait_for_dispatched_events... | [
"0.67060125",
"0.65932137",
"0.6491856",
"0.6489073",
"0.6468356",
"0.64609706",
"0.64155495",
"0.6400904",
"0.63933694",
"0.6392784",
"0.63844556",
"0.63465035",
"0.63395816",
"0.630902",
"0.6261916",
"0.6237958",
"0.62291896",
"0.62265927",
"0.62171865",
"0.62025374",
"0.61... | 0.83785117 | 0 |
Test that multiple subscribers can wait for a notification. This test checks that the subscribers are awoken in the order they subscribed. This may or may not be guarenteed according to the implementations of both ChangeNotifier and the event loop. This test functions as a canary, given that our code may relies on this... | async def test_multiple_subscribers(count: int) -> None:
subject = ChangeNotifier()
results = []
async def _do_task_1() -> None:
await subject.wait()
results.append(1)
async def _do_task_2() -> None:
await subject.wait()
results.append(2)
async def _do_task_3() -> ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_single_subscriber() -> None:\n subject = ChangeNotifier()\n result = asyncio.create_task(subject.wait())\n\n # ensure that the wait actually waits by delaying and\n # checking that the task has not resolved\n await asyncio.sleep(0.1)\n assert result.done() is False\n\n asyncio.g... | [
"0.7654742",
"0.6791694",
"0.67711705",
"0.6699863",
"0.66720235",
"0.6671149",
"0.65840507",
"0.6576444",
"0.65402824",
"0.65248865",
"0.6514565",
"0.64312106",
"0.6329941",
"0.62138104",
"0.61673623",
"0.61454916",
"0.610082",
"0.6076075",
"0.6068079",
"0.6021281",
"0.60173... | 0.79677045 | 0 |
Find a new random position to capitalize. Generates a random position in the word given. If the position is already in the list of capitalized positions we recurse into ourself to find a new position in the hopes it is not taken. If a nontaken position is found return it. | def __generate_position(cls, word, positions):
capital_letter_pos = randrange(0, len(word))
if capital_letter_pos not in positions:
return capital_letter_pos
else:
return cls.__generate_position(word, positions) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_word_candidate(self, word):\n capital_flag = word[0].isupper()\n word = word.lower()\n if capital_flag and word in self.teencode_dict:\n return self.replace_teencode(word).capitalize()\n elif word in self.teencode_dict:\n return self.replace_teencode(wo... | [
"0.62091696",
"0.59202105",
"0.5523696",
"0.5503066",
"0.547387",
"0.54658806",
"0.5396803",
"0.5341057",
"0.5324486",
"0.5303184",
"0.527203",
"0.52641755",
"0.5237489",
"0.521156",
"0.5191172",
"0.5188996",
"0.51812834",
"0.5142846",
"0.5115259",
"0.5105673",
"0.51039654",
... | 0.7391081 | 0 |
Return image paths that are used to load current data | def get_image_paths(self):
return self.image_paths | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imagePath(self):\n if self.use_dic:\n if self.imlist:\n paths = []\n for img in self.allimgs:\n paths.append(join(self.home, 'data'+str(self.data), self.activity, self.imsize, str(img)+'.jpg'))\n return paths\n else:\n... | [
"0.7938416",
"0.725925",
"0.7238045",
"0.713749",
"0.70309734",
"0.70227635",
"0.69758546",
"0.6951882",
"0.6888719",
"0.68881595",
"0.68349445",
"0.6830974",
"0.68300325",
"0.6827915",
"0.682074",
"0.67943096",
"0.6743538",
"0.6701265",
"0.66961235",
"0.667215",
"0.6649558",... | 0.8136774 | 1 |
Load all the networks from the disk | def load_networks(self, which_epoch):
for name in self.model_names:
if isinstance(name, str):
filename = '%s_net_%s.pth' % (which_epoch, name)
path = os.path.join(self.save_dir, filename)
net = getattr(self, 'net_' + name)
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_networks(self, epoch):\n for name in self.network_names:\n if isinstance(name, str):\n load_filename = '{0}_net_{1}.pth'.format(epoch, name)\n load_path = os.path.join(self.save_dir, load_filename)\n net = getattr(self, 'net')\n ... | [
"0.757982",
"0.7220006",
"0.7206127",
"0.71215206",
"0.69833153",
"0.689606",
"0.68895173",
"0.6841449",
"0.64756674",
"0.6397471",
"0.6348178",
"0.6279125",
"0.6264778",
"0.6220326",
"0.6162121",
"0.6137851",
"0.6126606",
"0.61137325",
"0.6075236",
"0.60523635",
"0.6050564",... | 0.72750616 | 1 |
Send a message, wait for the reply and return it. | def send_and_get_reply(self, message):
future = self.send_message(message)
while not future.done():
self.recv_messages()
return future.result() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_message_blocking(self, message):\n serial_message = create_message_string(message)\n try:\n result_msg = threads.blockingCallFromThread(reactor, self._r_send_message_and_wait, message.id, serial_message)\n if result_msg.result_code > 0:\n raise MessageHan... | [
"0.7116037",
"0.6791779",
"0.6784362",
"0.6776918",
"0.6752511",
"0.6673307",
"0.66648877",
"0.6660884",
"0.6628851",
"0.66143185",
"0.65833926",
"0.6581771",
"0.6564788",
"0.6507853",
"0.6427855",
"0.63627934",
"0.63522094",
"0.63263",
"0.6312736",
"0.62629914",
"0.62494886"... | 0.79550886 | 0 |
Raise ConnectionResetError from an empty read. Sometimes the socket raises an error itself, sometimes it gives no data. I haven't worked out when it behaves each way. | def unwrap_read(b):
if not b:
raise ConnectionResetError(ECONNRESET, os.strerror(ECONNRESET))
return b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_read(self):\n try:\n data = self.read_socket()\n except socket.error:\n log.debug('Socket connection died, retrying')\n try:\n data = self.read_socket()\n except socket.error:\n data = ''\n self.available... | [
"0.6980817",
"0.64748394",
"0.63624614",
"0.6227593",
"0.6224124",
"0.61560684",
"0.6078846",
"0.6077925",
"0.6047706",
"0.5987651",
"0.59817505",
"0.59768194",
"0.5969458",
"0.596324",
"0.59362006",
"0.5881376",
"0.5784304",
"0.575677",
"0.5754514",
"0.5732901",
"0.57074463"... | 0.70600915 | 0 |
Fetch the rcis for which the user `user_id` is a collaborator. | def get_rcis_for_user(user_id, logged_in_user):
throw_if_not_valid_uuid(user_id)
# You can only lookup rcis for a user if
# 1 - That user is you OR
# 2 - You have permissions to MODERATE_RCIS
if (user_can(Permission.MODERATE_RCIS, logged_in_user)):
pass
else:
if user_id != log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_collaborator(self, user):\r\n url = '{0}/{1}'.format(self.get_url(), user)\r\n\r\n return http.Request('GET', url), resource.parse_boolean",
"def list_collaborator_repos(self):\n user = User.objects.get(username=self.username)\n\n return Collaborator.objects.filter(user=user)",... | [
"0.70321167",
"0.6983158",
"0.6155061",
"0.60814947",
"0.5872913",
"0.58680415",
"0.5865748",
"0.5754583",
"0.5742509",
"0.5730352",
"0.55844826",
"0.5580106",
"0.55742717",
"0.5529332",
"0.5498648",
"0.5412649",
"0.5351761",
"0.533972",
"0.53311074",
"0.53309596",
"0.5330959... | 0.7421634 | 0 |
Fetch the rcis for the specified buildings | def get_rcis_for_buildings(buildings, logged_in_user):
# Only users that have the MODERATE_RCIS permission can do this
if not user_can(Permission.MODERATE_RCIS, logged_in_user):
raise Unauthorized('You do not have sufficient permissions '
'to lookup rcis for a building.')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_building_complaint_results():\n data = None\n blob = BUCKET.blob(BUILDING_COMPLAINT_FNAME)\n if blob.exists():\n blob.reload(client=STORAGE_CLIENT)\n if blob.time_created.strftime(\"%Y-%m-%d\") == datetime.now().strftime(\"%Y-%m-%d\"):\n print(\"Getting cached file \" + BU... | [
"0.579916",
"0.5711566",
"0.56665075",
"0.5653628",
"0.56069314",
"0.55711275",
"0.5566297",
"0.54066116",
"0.53905445",
"0.53905445",
"0.53594965",
"0.5314262",
"0.5283206",
"0.523652",
"0.52040005",
"0.52013963",
"0.51709515",
"0.51532847",
"0.51526946",
"0.51436186",
"0.51... | 0.7561781 | 0 |
Performs a fulltextsearch for rcis using the rci_index table | def search_rcis(search_string, logged_in_user):
# Only those with the MODERATE_RCIS permission can do this
if not user_can(Permission.MODERATE_RCIS, logged_in_user):
raise Unauthorized('You do not have sufficient permissions '
'to perform an rci search')
# If they d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self, query, maxhits=100):",
"def search(self, term):",
"def indexCranFull(path, writer):\n # Title field type\n tft = FieldType()\n tft.setIndexed(True)\n tft.setStored(True)\n tft.setTokenized(TokenizeFields)\n tft.setIndexOptions(FieldInfo.IndexOptions.DOCS_AND_FREQS) #only inde... | [
"0.5863599",
"0.5852773",
"0.58377564",
"0.58365643",
"0.5782749",
"0.5698087",
"0.5659711",
"0.5636571",
"0.56024635",
"0.5601399",
"0.55891126",
"0.55734104",
"0.5545314",
"0.55211955",
"0.54569286",
"0.54401505",
"0.5440057",
"0.54078734",
"0.5392578",
"0.53598946",
"0.533... | 0.6453066 | 0 |
Creates a new rci record for a room. The user who created it is added to the list of collaborators on this rci Multiple rcis can exist for the same room | def create_rci(user_id, building_name, room_name, logged_in_user):
# You can only create rcis for someone else if you have
# permissions to MODERATE_RCS or you are creating an
# rci for youself.
if (user_can(Permission.MODERATE_RCIS, logged_in_user)):
pass
else:
if user_id != logged... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self):\n logging.warning(\n \"IRC back-end does not support explicit creation, joining room \"\n \"instead to ensure it exists.\"\n )\n self.join()",
"def add_person(room_id, person=None, isModerator='false'):\n\n url = 'https://api.ciscospark.com/v1/membe... | [
"0.5737292",
"0.56656927",
"0.5614069",
"0.54499",
"0.53897387",
"0.5284605",
"0.5268692",
"0.525973",
"0.5254858",
"0.5241346",
"0.5216373",
"0.5203479",
"0.5149393",
"0.51213235",
"0.51154166",
"0.5107435",
"0.5088726",
"0.5088554",
"0.5086095",
"0.5078065",
"0.50442624",
... | 0.7433758 | 0 |
Return a list of all the levels of symlinks (if any). | def get_symlinks(path):
paths_seen = []
while os.path.islink(path) and path not in paths_seen:
paths_seen.append(path)
path = os.readlink(path)
return paths_seen | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _findall_with_symlink_dirs(dir=os.curdir):\n from stat import ST_MODE, S_ISREG, S_ISDIR, S_ISLNK\n\n list = []\n stack = [dir]\n pop = stack.pop\n push = stack.append\n\n while stack:\n dir = pop()\n names = os.listdir(dir)\n\n for name in names:\n if dir != os... | [
"0.72142315",
"0.6384743",
"0.61012304",
"0.5908418",
"0.5857168",
"0.5823405",
"0.5812741",
"0.57732093",
"0.576869",
"0.5764103",
"0.5713112",
"0.5704628",
"0.5684123",
"0.5652097",
"0.56513274",
"0.5644409",
"0.5640265",
"0.5621183",
"0.5561458",
"0.5557151",
"0.5554733",
... | 0.65540594 | 1 |
Function to extract certain single parameter from sliced (!) Parameters object, using final characters of key | def extractparam(pardict, parsuffix):
return next(v for k, v in pardict.items() if k.endswith(parsuffix)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sliceparams(pardict, parprefix):\n return {k: v.value for k, v in pardict.items() if k.startswith(parprefix)}",
"def get_parameter(request, param):\n if param == \"Params\":\n return request.split(\"\\r\\n\\r\\n\")[1]\n if isinstance(param, type([])):\n return [request.split(\"\\r\\n\\... | [
"0.6528267",
"0.60644865",
"0.603612",
"0.60237336",
"0.5997725",
"0.5919343",
"0.5863278",
"0.5827714",
"0.57720065",
"0.572905",
"0.57272595",
"0.5702063",
"0.56501746",
"0.5643642",
"0.5536104",
"0.5528417",
"0.54970986",
"0.548728",
"0.5483127",
"0.5480679",
"0.5440431",
... | 0.6739432 | 0 |
Returns a list of all domains that have case search enabled | def case_search_enabled_domains():
return CaseSearchConfig.objects.filter(enabled=True).values_list('domain', flat=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_search_domains(self):\n\t\treturn handle_to_object(call_sdk_function('PrlVmCfg_GetSearchDomains', self.handle))",
"def get_search_domains(self):\n\t\treturn handle_to_object(call_sdk_function('PrlVmDevNet_GetSearchDomains', self.handle))",
"def get_search_domains(self):\n\t\treturn handle_to_object(cal... | [
"0.6752655",
"0.6728221",
"0.6703617",
"0.6663335",
"0.6485199",
"0.63677365",
"0.62158686",
"0.6208196",
"0.600086",
"0.5988815",
"0.587213",
"0.5805327",
"0.57764536",
"0.5726186",
"0.5679686",
"0.5665102",
"0.5608236",
"0.5604671",
"0.5603721",
"0.55901605",
"0.557919",
... | 0.812631 | 0 |
Creates a finding. The corresponding source must exist for finding creation to succeed. | def CreateFinding(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, saved_source_id):\n raw_saved_source_data = self.es.get(index='.kibana', doc_type='doc', id=saved_source_id)\n\n saved_source_type = raw_saved_source_data['_source']['type']\n\n if saved_source_type == 'search':\n return SavedSearch(saved_source_id, self.conf)\n ... | [
"0.5563419",
"0.5391005",
"0.53004205",
"0.52571666",
"0.5033544",
"0.4957112",
"0.49099705",
"0.48986265",
"0.4850277",
"0.48197755",
"0.47886813",
"0.4759506",
"0.47311297",
"0.4714782",
"0.47018147",
"0.4695215",
"0.4669532",
"0.46666187",
"0.4661979",
"0.46613547",
"0.466... | 0.6507437 | 0 |
Gets the settings for an organization. | def GetOrganizationSettings(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization(self):\n return self._tower.get_organization_by_id(self._data.get('organization'))",
"def get_organization(self):\n return self.reference[REF_ORGANIZATION][REF_VALUE]",
"def get_settings(self):\n return self.settings",
"def get_settings(self):\n return AlgoliaUtil... | [
"0.6531588",
"0.63072646",
"0.6303513",
"0.6214031",
"0.6210266",
"0.6196567",
"0.61524755",
"0.61524755",
"0.61522657",
"0.6115161",
"0.6096789",
"0.6080201",
"0.6032534",
"0.6032217",
"0.60233885",
"0.5999289",
"0.59819794",
"0.5930463",
"0.59230536",
"0.58928144",
"0.58858... | 0.67236316 | 0 |
Runs asset discovery. The discovery is tracked with a longrunning operation. This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error. | def RunAssetDiscovery(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dynamic_discovery(self):\n while True:\n sleep(DYNAMIC_DISCOVERY_SLEEP)\n logging.debug(\"Starting Dynamic Discovery!\")\n self.datastream_discovery()",
"async def discover(self, timeout: int):",
"def device_discovery(endless):\r\n click.echo(\"start device discov... | [
"0.53132546",
"0.52043504",
"0.50640583",
"0.49701884",
"0.4934346",
"0.49093106",
"0.48654908",
"0.48019454",
"0.46924293",
"0.46736896",
"0.46329835",
"0.46166724",
"0.4614775",
"0.4611845",
"0.4610237",
"0.4595047",
"0.45567325",
"0.44880915",
"0.44680697",
"0.4466964",
"0... | 0.6418688 | 0 |
Updates the state of a finding. | def SetFindingState(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_state(self) -> None:\n raise NotImplementedError(\"\")",
"def update(self):\n self._state = self._state",
"def update(self):\n self._state = 23",
"def update(self):\n LOGGER.debug(\"Updating %s\", self._internal_name)\n\n self._car = next(car for car in self._da... | [
"0.59868526",
"0.5946726",
"0.58944976",
"0.582417",
"0.5746484",
"0.5685828",
"0.560972",
"0.5553921",
"0.5535862",
"0.55232507",
"0.54852974",
"0.5483653",
"0.5456856",
"0.5454017",
"0.5436579",
"0.5423705",
"0.5414675",
"0.54120606",
"0.54035336",
"0.53912306",
"0.5390182"... | 0.6254548 | 0 |
Creates or updates a finding. The corresponding source must exist for a finding creation to succeed. | def UpdateFinding(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateFinding(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')",
"def upsert_location(self, location):",
"def present(name, profile=\"splunk\", **kwargs):\n ret = {\... | [
"0.59747934",
"0.5305638",
"0.52075016",
"0.5022337",
"0.5010924",
"0.4989372",
"0.49407497",
"0.49222812",
"0.4900527",
"0.48605803",
"0.48231402",
"0.48165116",
"0.48128673",
"0.47879487",
"0.47696444",
"0.47513163",
"0.47464198",
"0.47367585",
"0.47304508",
"0.4685552",
"0... | 0.572375 | 1 |
Updates an organization's settings. | def UpdateOrganizationSettings(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, organisation: Organisation) -> None:\n ...",
"async def update_organization(request: Request, org: str, data: dict):\n redis = request.app.state.redis\n organizations_obj = orjson.loads(await redis.get_key(\"influxdb_organizations\"))\n if org not in organizations_obj:\n l... | [
"0.6645526",
"0.6367876",
"0.6235934",
"0.61899066",
"0.61634797",
"0.5981182",
"0.5965602",
"0.5965602",
"0.5965602",
"0.59545356",
"0.5923391",
"0.5913866",
"0.58903724",
"0.5757463",
"0.57474107",
"0.5691196",
"0.5676832",
"0.56686866",
"0.5609739",
"0.5597612",
"0.559523"... | 0.7443516 | 0 |
Register the OpenConfig plugin with pyang. | def pyang_plugin_init():
plugin.register_plugin(OpenConfigPlugin()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pyang_plugin_init():\n plugin.register_plugin(SwaggerPlugin())",
"def register_config(self, config):\n self.config = config",
"def pyang_plugin_init():\n plugin.register_plugin(JNCPlugin())",
"def register_oslo_configs(conf):\n conf.register_opts(_get_oslo_configs())",
"def init_extensi... | [
"0.6605517",
"0.64692044",
"0.6182477",
"0.61139697",
"0.59673387",
"0.5926363",
"0.58919436",
"0.576068",
"0.576068",
"0.5701465",
"0.5636033",
"0.55883014",
"0.55129075",
"0.540313",
"0.53899056",
"0.53440803",
"0.53327215",
"0.52935225",
"0.52852607",
"0.52852607",
"0.5285... | 0.8556503 | 0 |
Override functions for the base linter. Called for particular validation functions that need overrides in the context of OpenConfig. This handles cases where there are external modules that do not validate according to the base rules. It is called as a wrapper for the functions that are known to be problematic. | def openconfig_override_base_linter(ctx, stmt):
if stmt.i_module is not None and \
stmt.i_module.arg in ["iana-if-type", "ietf-interfaces"]:
return
lint.v_chk_recommended_substmt(ctx, stmt)
lint.v_chk_required_substmt(ctx, stmt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_user_module_and_set_functions(self):\n user_module_name = self._environment.module_name\n\n self._pre_model_fn = getattr(self._default_inference_handler, \"default_pre_model_fn\", None)\n self._model_warmup_fn = getattr(\n self._default_inference_handler, \"default_mod... | [
"0.56141853",
"0.5590765",
"0.5425439",
"0.5425189",
"0.54127127",
"0.54035336",
"0.5351303",
"0.5322117",
"0.53048044",
"0.52999836",
"0.5278297",
"0.5273837",
"0.52682817",
"0.5258054",
"0.5239282",
"0.5216856",
"0.5194579",
"0.51836413",
"0.5166742",
"0.51471525",
"0.51057... | 0.6335226 | 0 |
Preinitialisation phase validation functions. Called on a perstatement basis prior to pyang"s more detailed parsing. | def preinitialisation(ctx, stmt):
validmap = {
u"module": [OCLintFunctions.check_module_rawtext],
u"submodule": [OCLintFunctions.check_module_rawtext],
}
for fn in OCLintStages.map_statement_to_lint_fn(stmt, validmap):
fn(ctx, stmt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _preparation_workflow(self):\n self._validate_environment()\n self._validate_parameters()\n self._update_verbosity()",
"def __init__(self):\n ## Global initialization\n self.default_initialization()\n ## Initial function set\n self.selfdriven = False\n ... | [
"0.65360445",
"0.6210559",
"0.6143885",
"0.58537585",
"0.5833954",
"0.5737549",
"0.56520575",
"0.5624278",
"0.560756",
"0.5599847",
"0.5546776",
"0.5546776",
"0.5546776",
"0.5521387",
"0.55122775",
"0.5510123",
"0.5510123",
"0.5510123",
"0.5510123",
"0.5510123",
"0.55028474",... | 0.65451175 | 0 |
OpenConfig types validation functions. Called perstatement after pyang's type validation of the module this is used to make stricter rules for type usage. | def openconfig_type(ctx, stmt):
validmap = {
u"*": [
OCLintFunctions.check_yang_feature_usage,
],
u"LEAVES": [
OCLintFunctions.check_enumeration_style,
OCLintFunctions.check_bad_types,
OCLintFunctions.check_posix_pattern_equal,
],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_check_types():",
"def CheckType(self, *args, **kwargs):\n pass",
"def validate(self):\n self._check_type()",
"def missing_types():\n\n return ...",
"def validate(self):\n for validator in self.exttype_validators:\n validator.validate(self.ext_type)",
"def check_... | [
"0.67340696",
"0.64839584",
"0.64499223",
"0.63502586",
"0.6287869",
"0.62815964",
"0.6224019",
"0.61045134",
"0.60690725",
"0.6053788",
"0.6043522",
"0.5977028",
"0.5966141",
"0.5952671",
"0.59226125",
"0.58937335",
"0.58929896",
"0.5870712",
"0.58636916",
"0.583743",
"0.580... | 0.68283397 | 0 |
Map for a statement to the lint functions to be run. | def map_statement_to_lint_fn(stmt, validation_map):
functions = []
defining_module = stmt.pos.ref.split("/")[-1].split(".")[0]
if (OCLintFunctions.is_openconfig_validatable_module(defining_module) not in
[ModuleType.OC, ModuleType.OCINFRA]):
return []
if u"*" in validation_map:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preinitialisation(ctx, stmt):\n validmap = {\n u\"module\": [OCLintFunctions.check_module_rawtext],\n u\"submodule\": [OCLintFunctions.check_module_rawtext],\n }\n\n for fn in OCLintStages.map_statement_to_lint_fn(stmt, validmap):\n fn(ctx, stmt)",
"def build_pylint_map(lines: Ite... | [
"0.54601175",
"0.53570026",
"0.5243579",
"0.5084244",
"0.50405496",
"0.5009271",
"0.5002389",
"0.49856475",
"0.49338922",
"0.4910472",
"0.48225835",
"0.47954324",
"0.47737345",
"0.47453067",
"0.47441888",
"0.46995747",
"0.4689769",
"0.4685097",
"0.4677912",
"0.46384662",
"0.4... | 0.74205494 | 0 |
Check whether the module is an OpenConfig module. Avoid validating modules that are not OpenConfig. | def is_openconfig_validatable_module(mod):
if re.match(r"[a-z0-9]+\-.*", mod.lower()):
# Avoid parsing IETF and IANA modules which are currently
# included by OpenConfig, and avoid parsing the extension
# module itself.
modname_parts = mod.split("-")
if modname_parts[0] in [u"ietf", u"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_module(name):\n return importlib.util.find_spec(name) is not None",
"def isModule(self, name):\n return os.path.isfile(self.modulePath(name))",
"def is_module(obj):\n return type(obj) is types.ModuleType",
"def ismodule(object):\r\n return isinstance(object, types.ModuleType)",
"def h... | [
"0.6292562",
"0.62247145",
"0.6096134",
"0.6062846",
"0.60508007",
"0.60447425",
"0.58263654",
"0.5776816",
"0.57713026",
"0.57498693",
"0.5728876",
"0.5714014",
"0.5714014",
"0.5713641",
"0.567669",
"0.5666378",
"0.56464684",
"0.5620756",
"0.561488",
"0.5611185",
"0.56041145... | 0.7018697 | 0 |
Check that the module has the relevant OC versioning. The module needs an openconfigextensions openconfigversion statement, which should match the semantic version format. There must also be a revision statement that matches semantic version | def check_versioning(ctx, stmt):
# Don't perform this check for modules that are not OpenConfig
# or are OpenConfig infrastructure (e.g., extensions)
if (OCLintFunctions.is_openconfig_validatable_module(stmt.arg) in
[ModuleType.NONOC, ModuleType.OCINFRA]):
return
version = None
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_openmanage_version():\n try:\n # Because of\n # https://github.com/rcbops/rcbops-maas/issues/82#issuecomment-52315709\n # we need to redirect sdterr to stdout just so MaaS does not see any\n # extra output\n output = subprocess.check_output(['/opt/dell/srvadmin/bin/o... | [
"0.6428637",
"0.6389198",
"0.6284506",
"0.6274872",
"0.6264212",
"0.62464863",
"0.62284446",
"0.6201926",
"0.6189911",
"0.6170663",
"0.61306524",
"0.61203897",
"0.611717",
"0.61134136",
"0.60968935",
"0.603837",
"0.60099405",
"0.6009611",
"0.6005615",
"0.60004836",
"0.599533"... | 0.82903695 | 0 |
Check that OpenConfig's posixpattern extension always equal in number to pattern statements. | def check_posix_pattern_equal(ctx, stmt):
elemtype = stmt.search_one("type")
if elemtype is None:
return
patternCount = len(elemtype.search("pattern"))
posixPatternCount = 0
for ss in elemtype.substmts:
if hasattr(ss, "i_extension_modulename") and len(ss.keyword) >= 2:
if ss.key... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __check_pattern(node):\n if node.tag != \"discover_datasets\":\n return False\n if \"from_tool_provided_metadata\" in node.attrib and string_as_bool(\n node.attrib.get(\"from_tool_provided_metadata\", \"false\")\n ):\n return True\n if \"pattern\" not in node.attrib:\n r... | [
"0.60653764",
"0.5990045",
"0.5966558",
"0.5773356",
"0.5713722",
"0.5665559",
"0.5570794",
"0.5566986",
"0.5497402",
"0.5477803",
"0.5457212",
"0.541959",
"0.5396837",
"0.5373294",
"0.53390944",
"0.5327264",
"0.529566",
"0.5254494",
"0.5232507",
"0.52188087",
"0.520588",
"... | 0.814446 | 0 |
Check validation rules for OpenConfig typedef statements. | def check_typedef_style(ctx, stmt):
elemtype = stmt.search_one("type")
if elemtype is None:
return
# errors are appended to the context, such that we can just call the
# base checks here.
OCLintFunctions.check_enumeration_style(ctx, stmt)
OCLintFunctions.check_bad_types(ctx, stmt)
OC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openconfig_type(ctx, stmt):\n\n validmap = {\n u\"*\": [\n OCLintFunctions.check_yang_feature_usage,\n ],\n u\"LEAVES\": [\n OCLintFunctions.check_enumeration_style,\n OCLintFunctions.check_bad_types,\n OCLintFunctions.check_posix_pattern_equa... | [
"0.71963197",
"0.61892575",
"0.61892575",
"0.605749",
"0.6053348",
"0.60257095",
"0.59989786",
"0.598064",
"0.58966446",
"0.5846445",
"0.5826264",
"0.58119136",
"0.57786435",
"0.5752238",
"0.5738242",
"0.57268596",
"0.5703315",
"0.5702884",
"0.569783",
"0.5670189",
"0.5653953... | 0.62987345 | 1 |
Check that a list has an enclosing container and that its name is not duplicated when path compression is performed. | def check_list_enclosing_container(ctx, stmt):
parent_substmts = [i.arg for i in stmt.parent.i_children
if i.keyword in INSTANTIATED_DATA_KEYWORDS]
if stmt.parent.keyword != "container":
err_add(ctx.errors, stmt.parent.pos,
"OC_LIST_NO_ENCLOSING_CONTAINER", stmt.arg)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _causes_name_clash(candidate, path_list, allowed_occurences=1):\n duplicate_counter = -allowed_occurences\n for path in path_list:\n parts = tuple(reversed(path.parts))\n if len(parts) >= len(candidate) and parts[: len(candidate)] == candidate:\n duplicate_counter += 1\n retur... | [
"0.5892461",
"0.565741",
"0.5613205",
"0.55718607",
"0.5350621",
"0.5332492",
"0.53243756",
"0.53159964",
"0.52973473",
"0.52799547",
"0.52512836",
"0.5180906",
"0.5152998",
"0.5116761",
"0.51038194",
"0.51001775",
"0.5084161",
"0.50034744",
"0.4985611",
"0.4980341",
"0.49776... | 0.7374932 | 0 |
Check applied configuration mirrors intended configuration. Check that each leaf in config has a corresponding leaf in state. | def check_leaf_mirroring(ctx, stmt):
# Skip the check if the container is not a parent of other containers
if stmt.search_one("container") is None:
return
containers = stmt.search("container", children=stmt.i_children)
# Only perform this check if this is a container that has both a config
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_configs(self):\n\n pass",
"def check_config(cfg):",
"def checkconfig(self): \n validconfig = {\n 'loglevel': lambda s: s in self.loglevels,\n 'logfilelevel': lambda s: s in self.loglevels,\n 'nodes': lambda s: isinstance(s, list),\n 'pynodes':... | [
"0.64304566",
"0.6234635",
"0.6060892",
"0.5957074",
"0.5865625",
"0.58552164",
"0.5828294",
"0.58257306",
"0.58245903",
"0.5695445",
"0.5681925",
"0.5620344",
"0.5609939",
"0.55835867",
"0.55818564",
"0.5554554",
"0.5532019",
"0.5517622",
"0.54956913",
"0.5450382",
"0.543327... | 0.6933727 | 0 |
Check whether relative paths are used within a module. | def check_relative_paths(ctx, stmt):
path = stmt.arg
if path[0] == "/":
abspath = True
else:
abspath = False
components = yangpath.split_paths(path)
# consider the namespace in the first component
# assumes that if the namespace matches the module namespace, then
# relative path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_relative_to(p1: Path, p2: Path) -> bool:\n # stolen from CPython's source\n try:\n p1.relative_to(p2)\n return True\n except ValueError:\n return False",
"def testRelativeImport(self):\r\n self.buildTempDirs()\r\n expected = os.path.join(... | [
"0.6869687",
"0.6536748",
"0.64589703",
"0.6399969",
"0.6396609",
"0.6358301",
"0.6248277",
"0.62355566",
"0.6224298",
"0.61984104",
"0.6163366",
"0.6139353",
"0.60878813",
"0.60558623",
"0.6032954",
"0.6031183",
"0.6009926",
"0.6003163",
"0.5970523",
"0.5964149",
"0.59610105... | 0.74338627 | 0 |
Retrieves IDs for all unread emails from Google Scholar in the inbox. | def list_unread_emails(self):
try:
query = 'is:unread from:scholaralerts-noreply@google.com'
page_token = None
p_emails = []
while True:
request = self.service.users().messages().list(userId='me',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unread_email_ids(gmail_client):\n response = gmail_client.users().messages().list(userId='me',q='is:unread').execute()\n\n if 'messages' in response: # messages key only exists if there are unread messages\n return [message['id'] for message in response['messages']]\n else:\n print(\... | [
"0.78592354",
"0.6723793",
"0.6524522",
"0.6461173",
"0.6350678",
"0.6300802",
"0.62430155",
"0.6206626",
"0.61463904",
"0.60048586",
"0.599582",
"0.5995647",
"0.5925185",
"0.59171236",
"0.58979136",
"0.5723904",
"0.57000566",
"0.56837285",
"0.5668073",
"0.5665703",
"0.565328... | 0.7026751 | 1 |
A utility function for marking all Google Scholar emails as unread. For testing/dev. | def util_unread(self):
try:
query = 'from:scholaralerts-noreply@google.com'
page_token = None
p_emails = []
while True:
request = self.service.users().messages().list(userId='me',
q=que... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_all_notifications_as_read(self):\n for n in Notification.objects(owner=self, unread=True):\n n.unread = False\n n.save()",
"def mark_messages_unread(self, mbox, msgset):\n self._remove_flag(mbox, msgset, r'(\\Seen)')",
"def mark_all_seen(request):\n for notice in Notice.obje... | [
"0.64856887",
"0.6319826",
"0.61861587",
"0.5957531",
"0.5792893",
"0.5776432",
"0.5679364",
"0.5596349",
"0.5591367",
"0.55591613",
"0.55379",
"0.5523552",
"0.5514427",
"0.55060863",
"0.5438884",
"0.5402701",
"0.5399778",
"0.5335347",
"0.53021204",
"0.52854794",
"0.5274966",... | 0.6649934 | 0 |
Parses the string containg author name, publication title and pub year. | def _parse_email_bib_data(cls, bib_data):
pub_title = None
pub_year = None
# Get author name(s)
parsed_bib = bib_data.split(" - ")
m_author = _utils.clean_string(parsed_bib[0])
# Split further to get year and author
if len(parsed_bib) > 1:
parsed_b2 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_title_and_year(self, refstr):\n\n refstr = self.re_cleanup_unstructured.sub(', ', refstr, 1)\n match = self.rec_field_unstructured.match(refstr)\n if match:\n year = match.group('year')\n title = match.group('title')\n return title,year\n retur... | [
"0.6900416",
"0.63709486",
"0.62956035",
"0.62166965",
"0.6151116",
"0.5968089",
"0.59247315",
"0.5864115",
"0.58436435",
"0.58410937",
"0.57976186",
"0.57691216",
"0.5761068",
"0.568099",
"0.5677778",
"0.56761026",
"0.56722224",
"0.5651078",
"0.55680865",
"0.5563626",
"0.556... | 0.6413628 | 1 |
Sets the decorated flag. Boolean decorated Whether to decorate the messages or not | def setDecorated(self, decorated): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setDecorated(self, decorated):\n\n self.__decorated = bool(decorated);",
"def __init__(self, decorated):\n self.decorated = decorated",
"def __init__(self, decorated):\n self.decorated = decorated",
"def __init__(self, decorated):\n self.decorated = decorated",
"... | [
"0.80290896",
"0.6202508",
"0.6202508",
"0.6202508",
"0.61949885",
"0.5997182",
"0.5989105",
"0.5888754",
"0.5856343",
"0.58484894",
"0.54945767",
"0.5458451",
"0.53302723",
"0.5267318",
"0.5258446",
"0.52281266",
"0.5188401",
"0.5188187",
"0.5168227",
"0.5163902",
"0.5115567... | 0.7947615 | 1 |
Sets a new style. string name The style name OutputFormatterStyleInterface style The style instance | def setStyle(self, name, style):
assert isinstance(style, OutputFormatterStyleInterface); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setStyle(self, name, style):\n assert isinstance(style, OutputFormatterStyleInterface);\n\n self.__styles[str(name).lower()] = style;",
"def style(self, style):\n\n self.container['style'] = style",
"def style(self, style):\n\n self._style = style",
"def style(self, style):\n\... | [
"0.91476715",
"0.6719606",
"0.66959774",
"0.66959774",
"0.66267467",
"0.645602",
"0.6296942",
"0.6281076",
"0.6274121",
"0.6239283",
"0.62259066",
"0.6091348",
"0.60776895",
"0.6023569",
"0.6006409",
"0.59719384",
"0.5910294",
"0.59041893",
"0.5883003",
"0.5866776",
"0.583513... | 0.91670996 | 0 |
Escapes "<" special char in given text. string text Text to escape string Escaped text | def escape(cls, text):
pattern = re.compile(r"([^\\]?)<", re.DOTALL | re.IGNORECASE);
return pattern.sub(r"\1\<", text); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape(text):\n return text_type(text).replace('&', '&').replace('<', '<').replace('>', '>')",
"def escape(text):\n return text.replace('&', '&'). \\\n replace('<', '<'). \\\n replace('>', '>').replace('\"', '"'). \\\n replace(\"'\", ''')",
"def escap... | [
"0.81701976",
"0.8090127",
"0.7855193",
"0.77116364",
"0.7658348",
"0.7579301",
"0.75117946",
"0.74189794",
"0.7365607",
"0.73042184",
"0.72741497",
"0.72246087",
"0.7206095",
"0.7205839",
"0.7152623",
"0.7152623",
"0.70491564",
"0.70413965",
"0.69392335",
"0.69316506",
"0.69... | 0.8334513 | 0 |
Initializes console output formatter. Boolean decorated Whether this formatter should actually decorate strings | def __init__(self, decorated = None, styles = None):
if styles is None:
styles = dict();
assert isinstance(styles, dict);
self.__decorated = None;
self.__styles = dict();
self.__styleStack = None;
self.__decorated = bool(decorated);
self.setStyle('e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_formatter(self, formatter):\n self.format = formatter",
"def test_cli_demo_with_formatters(self):\n with CaptureOutput() as capturer:\n main('coloredlogs', '--demo-with-formatter')\n output = capturer.get_text()\n # Make sure the output contains all of the expec... | [
"0.5886996",
"0.5854199",
"0.5756707",
"0.5529008",
"0.5466704",
"0.5442293",
"0.53787905",
"0.53781426",
"0.53328705",
"0.53305304",
"0.5316752",
"0.53032565",
"0.5295079",
"0.52869666",
"0.5271367",
"0.5192564",
"0.5163987",
"0.51445955",
"0.51416653",
"0.5129492",
"0.51193... | 0.6261503 | 0 |
Sets the decorated flag. Boolean decorated Whether to decorate the messages or not | def setDecorated(self, decorated):
self.__decorated = bool(decorated); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setDecorated(self, decorated):",
"def __init__(self, decorated):\n self.decorated = decorated",
"def __init__(self, decorated):\n self.decorated = decorated",
"def __init__(self, decorated):\n self.decorated = decorated",
"def isDecorated(self):",
"def decor(flag_stri... | [
"0.7947615",
"0.6202508",
"0.6202508",
"0.6202508",
"0.61949885",
"0.5997182",
"0.5989105",
"0.5888754",
"0.5856343",
"0.58484894",
"0.54945767",
"0.5458451",
"0.53302723",
"0.5267318",
"0.5258446",
"0.52281266",
"0.5188401",
"0.5188187",
"0.5168227",
"0.5163902",
"0.5115567"... | 0.80290896 | 0 |
Sets a new style. string name The style name OutputFormatterStyleInterface style The style instance | def setStyle(self, name, style):
assert isinstance(style, OutputFormatterStyleInterface);
self.__styles[str(name).lower()] = style; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setStyle(self, name, style):\n assert isinstance(style, OutputFormatterStyleInterface);",
"def style(self, style):\n\n self.container['style'] = style",
"def style(self, style):\n\n self._style = style",
"def style(self, style):\n\n self._style = style",
"def set_style(self,... | [
"0.9165384",
"0.67165893",
"0.6692259",
"0.6692259",
"0.66227466",
"0.64535797",
"0.62938464",
"0.62794334",
"0.6271978",
"0.62362087",
"0.6224224",
"0.60880125",
"0.60743177",
"0.6023068",
"0.60015994",
"0.59714717",
"0.590903",
"0.5903184",
"0.5882966",
"0.58634144",
"0.583... | 0.9146194 | 1 |
Replaces style of the output. array match string The replaced style | def __replaceStyle(self, match):
if not match:
return;
# we got "\<" escaped char
if ('\\' == match.group(1)) :
return self.__applyCurrentStyle(match.group(0));
if not match.group(3) :
if ('/' == match.group(2)) :
# we got "</>" tag
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grep(syntax_dictonary,file,flag):\n\n with open(file,'r') as inFile:\n for line in inFile:\n for syntax in syntax_dictonary:\n matches=re.finditer(syntax,line)\n if matches:\n for to_color in matches:\n if flag... | [
"0.5792695",
"0.55524844",
"0.55517656",
"0.5526292",
"0.5432557",
"0.541356",
"0.53475136",
"0.5345239",
"0.5332803",
"0.53101003",
"0.5277522",
"0.5234917",
"0.52161556",
"0.52121043",
"0.5201785",
"0.51802194",
"0.51686066",
"0.51581204",
"0.51537764",
"0.5116946",
"0.5111... | 0.59796953 | 0 |
Tries to create new style instance from string. string string | def __createStyleFromString(self, string):
matches = re.findall(r"([^=]+)=([^;]+)(;|$)", str(string).lower());
if not matches :
return False;
style = OutputFormatterStyle();
for match in matches:
if ('fg' == match[0]) :
style.setForeground(match... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_str (s):\n try: \n return from_csv(s)\n except Exception: \n pass\n \n try: \n return from_hex(s)\n except Exception: \n pass\n\n try:\n return from_name(s)\n except Exception: \n pass\n\n raise ColourFormatError(\"'%s' is not a recogni... | [
"0.67518777",
"0.6705039",
"0.66630095",
"0.63047135",
"0.61890393",
"0.60690844",
"0.6006118",
"0.5980124",
"0.5963591",
"0.5955348",
"0.59149146",
"0.5892828",
"0.5877765",
"0.5864281",
"0.5808365",
"0.5803129",
"0.5736909",
"0.5718819",
"0.56865275",
"0.5685408",
"0.568053... | 0.73787135 | 0 |
Sets style foreground color. string color The color name InvalidArgumentException When the color name isn't defined | def setForeground(self, color = None):
if (None is color) :
self.__foreground = None;
return;
color = str(color);
if color not in self.__availableForegroundColors :
raise InvalidArgumentException(
'Invalid foreground color specified: "{0}".... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setForeground(self, color = None):",
"def setForeground(self, color):\n self.format.setForeground(color)",
"def set_fgcolor(self, color):\n widget = self.widget\n role = widget.foregroundRole()\n if not color:\n palette = QApplication.instance().palette(widget)\n ... | [
"0.78607947",
"0.77197295",
"0.7425519",
"0.6750225",
"0.66946864",
"0.660865",
"0.65918064",
"0.6545977",
"0.64734566",
"0.6400713",
"0.63426363",
"0.6247159",
"0.61929345",
"0.611282",
"0.61021894",
"0.6100469",
"0.6094778",
"0.60583633",
"0.6054567",
"0.6049136",
"0.604630... | 0.805327 | 0 |
Applies the style to a given text. string text The text to style string | def apply(self, text):
codes = list();
if (None is not self.__foreground) :
codes.append(self.__foreground);
if (None is not self.__background) :
codes.append(self.__background);
if self.__options :
codes.extend(self.__options);
if not co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_text(self, x, y, text, style=None):\n style = self.__prepare_style(style, ' ')\n for i, c in enumerate(text):\n if self.check_coord_in_range(x + i, y):\n text_style = Style(c, style.fg_color, style.bg_color, style.font_style)\n self.canvas[y][x + i] = ... | [
"0.7056724",
"0.67541975",
"0.65413916",
"0.6453618",
"0.6167393",
"0.6100885",
"0.6045894",
"0.59826106",
"0.5980849",
"0.59700817",
"0.5968986",
"0.5936094",
"0.5887033",
"0.5871911",
"0.5813749",
"0.5810726",
"0.5808238",
"0.58055824",
"0.5758577",
"0.5757632",
"0.5746484"... | 0.72625744 | 0 |
Pushes a style in the stack. OutputFormatterStyleInterface style | def push(self, style):
assert isinstance(style, OutputFormatterStyleInterface);
self.__styles.append(style); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def style(self, style):\n self.style += [ style ]\n return self",
"def setStyle(self, name, style):\n assert isinstance(style, OutputFormatterStyleInterface);",
"def pop(self, style = None):\n if style:\n assert isinstance(style, OutputFormatterStyleInterface);\n\n ... | [
"0.6624626",
"0.6620557",
"0.625348",
"0.61521053",
"0.61084783",
"0.58075875",
"0.56666833",
"0.5660158",
"0.5633988",
"0.55929387",
"0.55411714",
"0.55411714",
"0.53560007",
"0.534326",
"0.522115",
"0.52009064",
"0.52002436",
"0.5183119",
"0.51750374",
"0.51434374",
"0.5142... | 0.8490765 | 0 |
Pops a style from the stack. OutputFormatterStyleInterface style OutputFormatterStyleInterface InvalidArgumentException When style tags incorrectly nested | def pop(self, style = None):
if style:
assert isinstance(style, OutputFormatterStyleInterface);
if not self.__styles :
return self.__emptyStyle;
if (None is style) :
return self.__styles.pop();
rstyles = self.__styles[:];
rstyles.reverse();... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsetStyle(self):\n return _libsbml.ASTNode_unsetStyle(self)",
"def push(self, style):\n assert isinstance(style, OutputFormatterStyleInterface);\n\n self.__styles.append(style);",
"def popcolor():\r\n _pycolor.setcolor(_colorstack.pop())",
"def close_stack(self):\n self._c... | [
"0.5910415",
"0.5853895",
"0.55292815",
"0.54663306",
"0.5452405",
"0.51728725",
"0.5140911",
"0.5109656",
"0.5103772",
"0.5025427",
"0.50132424",
"0.49879906",
"0.4974542",
"0.4961057",
"0.49333432",
"0.4924675",
"0.4903432",
"0.48943666",
"0.4878881",
"0.48723054",
"0.48469... | 0.8403173 | 0 |
Create a report instance with just one data definition request. | def create_report(self, data_def_request):
report = Report(self.appresponse)
report.add(data_def_request)
report.run()
return report | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n if not self._instance:\n self._instance = \\\n self.appresponse.reports.create_instance(self._data_defs)\n\n results = self._instance.get_data()['data_defs']\n\n for i, res in enumerate(results):\n source_name = self._data_defs[... | [
"0.6945925",
"0.6571463",
"0.65675294",
"0.62266",
"0.6215719",
"0.6177279",
"0.61580354",
"0.60626197",
"0.60510135",
"0.59738034",
"0.5967633",
"0.59258056",
"0.5907549",
"0.5893056",
"0.58930534",
"0.58871746",
"0.5867009",
"0.5806715",
"0.5769565",
"0.57692486",
"0.576250... | 0.8130535 | 0 |
Get all running report instances on appliance. Several different services can have instances running, which covers both system processes as well as user initiated reports. The primary means of identifying the sources is through the | def get_instances(self, service=None, include_system_reports=False):
if service is None:
services = [PACKETS_REPORT_SERVICE_NAME,
GENERAL_REPORT_SERVICE_NAME]
else:
services = [service]
def test_user_agent(data):
system_report_agents =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getAllRunningInstances(self):\n return self._ec2.get_only_instances(filters={\n 'tag:leader_instance_id': self._instanceId,\n 'instance-state-name': 'running'})",
"def instances(self):\r\n # It would be more efficient to do this with filters now\r\n # but not all s... | [
"0.6190587",
"0.6086637",
"0.5987062",
"0.59571713",
"0.5895622",
"0.5870559",
"0.5869155",
"0.5841146",
"0.58344287",
"0.58192277",
"0.5716235",
"0.57121915",
"0.5692027",
"0.5680699",
"0.5650573",
"0.56342584",
"0.5625258",
"0.5621685",
"0.55971277",
"0.5575232",
"0.5570978... | 0.69805455 | 0 |
Initialize a new report against the given AppResponse object. | def __init__(self, appresponse):
logger.debug("Initializing Report object with appresponse '{}'"
.format(appresponse.host))
self.appresponse = appresponse
self._data_defs = []
self._instance = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_report(self, data_def_request):\n\n report = Report(self.appresponse)\n report.add(data_def_request)\n report.run()\n return report",
"def __init__(self, report_data, account_id, report_type=None, account_name=None):\n self._report_data = report_data\n self._r... | [
"0.6557712",
"0.59809476",
"0.5962258",
"0.5953143",
"0.5904615",
"0.5874375",
"0.5821927",
"0.5821927",
"0.57878345",
"0.5786952",
"0.5785183",
"0.5736232",
"0.56741256",
"0.55706704",
"0.55570936",
"0.5555247",
"0.55533063",
"0.5526234",
"0.5524962",
"0.55132705",
"0.548807... | 0.8631745 | 0 |
Add one data definition request. | def add(self, data_def_request):
logger.debug("Adding a data_def request {}"
.format(data_def_request.to_dict()))
self._data_defs.append(data_def_request) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_data(self, name, data):\n self._add_data(self.el_request, {name: data})",
"def add_data(self, data: List[dict]):\n raise NotImplementedError()",
"def add_data(self, x=1, y=1, dtype=1, name=\"New data\", description=\"New data\"):\n assert 1 <= dtype <= 3, \"Bad value for data type\... | [
"0.6640396",
"0.5943952",
"0.58081955",
"0.578674",
"0.5777193",
"0.5755013",
"0.5729995",
"0.5718345",
"0.57115006",
"0.5692612",
"0.5660032",
"0.5656406",
"0.56525636",
"0.5650116",
"0.56080574",
"0.56009495",
"0.5583359",
"0.55813307",
"0.5575642",
"0.5535753",
"0.55186623... | 0.8052723 | 0 |
Check records and convert string to integer/float. If the type of the column is 'number' or unit is not 'none', then check if the column name has 'avg' in its name, if yes, then convert it to float, otherwise to integer. | def _cast_number(self, result, source_name):
logger.debug("Converting string in records into integer/float")
columns = self.appresponse.reports.sources[source_name]['columns']
functions = [lambda x: x] * len(result['columns'])
for i, col in enumerate(result['columns']):
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _transform_col(col, val):\n if dict_values(col.types)[0] in ('int', 'real'):\n return col.asnumeric(), float(val)\n\n # for enums, character, etc...\n return col, val",
"def validate_number(column_name, value, column_data_type=\"number\"):\n valid = value.isnumeric()\n if valid is False... | [
"0.58722836",
"0.58568656",
"0.5834865",
"0.5796722",
"0.57819337",
"0.57524997",
"0.5688824",
"0.56240994",
"0.5623223",
"0.5608642",
"0.5603809",
"0.5593155",
"0.55602044",
"0.55432016",
"0.5503347",
"0.54604965",
"0.5448227",
"0.543836",
"0.54231226",
"0.54220694",
"0.5420... | 0.59469414 | 0 |
Create a report instance and record the results of multiple data definition instances as a list of records (dictionaries). | def run(self):
if not self._instance:
self._instance = \
self.appresponse.reports.create_instance(self._data_defs)
results = self._instance.get_data()['data_defs']
for i, res in enumerate(results):
source_name = self._data_defs[i].source.name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_report(self, data_def_request):\n\n report = Report(self.appresponse)\n report.add(data_def_request)\n report.run()\n return report",
"def create_report(self, form_data):\n R = {}\n for e in self.entries:\n R[e.name] = e.get_value(form_data)\n ... | [
"0.6906406",
"0.6807092",
"0.6369592",
"0.6292839",
"0.6256244",
"0.6218317",
"0.6192088",
"0.6170289",
"0.61589146",
"0.61557996",
"0.61462045",
"0.614145",
"0.60766226",
"0.6038981",
"0.60229534",
"0.59614575",
"0.59580255",
"0.5955435",
"0.59394836",
"0.5926783",
"0.592529... | 0.7896495 | 0 |
Return data in pandas DataFrame format for the indexed data definition requests. This will return a single DataFrame for the given index, unlike ``get_data`` and ``get_legend`` which will optionally return info for all data defs in a report. Requires `pandas` library to be available in environment. | def get_dataframe(self, index=0):
import pandas
data = self.get_data(index)
columns = self.get_legend(index)
df = pandas.DataFrame(data, columns=columns)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pandas_dataframe(data, index, columns):\n return pd.DataFrame(data, index, columns)",
"def __call__(self, index: pd.Index) -> pd.DataFrame:\n if not isinstance(self.values, (list, tuple)):\n values = pd.Series(\n self.values,\n index=index,\n ... | [
"0.6771765",
"0.659238",
"0.64827335",
"0.63643426",
"0.6300528",
"0.61421627",
"0.61071855",
"0.60951865",
"0.6033154",
"0.6016457",
"0.6010233",
"0.60094196",
"0.59995186",
"0.59882385",
"0.5965368",
"0.59505904",
"0.5918567",
"0.5917435",
"0.59121406",
"0.584483",
"0.58366... | 0.79279476 | 0 |
Returns the next power of two greater than or equal to `n` | def next_pow_two(n):
i = 1
while i < n:
i = i << 1
return i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _next_power_of_two(self, n):\n if n == 0:\n return 1\n return int(2 ** math.ceil(math.log2(n)))",
"def nextpow2(n):\n m_f = np.log2(n)\n m_i = np.ceil(m_f)\n return np.int(2 ** m_i)",
"def nextPowerOf2(n):\n count = 0; \n \n # First n in the below \n # condition is for the \... | [
"0.8846374",
"0.84687304",
"0.841344",
"0.81295115",
"0.8119157",
"0.80217546",
"0.7982148",
"0.7935714",
"0.78664106",
"0.7832619",
"0.77918994",
"0.77531743",
"0.77531743",
"0.7700856",
"0.76726377",
"0.76673084",
"0.761716",
"0.76112163",
"0.751201",
"0.7486262",
"0.746107... | 0.8760269 | 1 |
Sum the values of this PDF. Raises NotImplementedError | def sum_values(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(self):\n return sum(self.values)",
"def sum(self) -> float:\n return sum(self.values)",
"def sum (self):\n return self.values.sum ()",
"def sum (self):\n return self.values.sum ()",
"def sum(self):\n return self.vsum",
"def sum(self):\n return sum(self._v... | [
"0.7242074",
"0.7185059",
"0.71379614",
"0.71379614",
"0.6908979",
"0.68571997",
"0.68458724",
"0.6803095",
"0.6802074",
"0.6680856",
"0.6641651",
"0.65785503",
"0.6528973",
"0.6522363",
"0.6466094",
"0.6403688",
"0.63977075",
"0.63977075",
"0.63977075",
"0.63977075",
"0.6216... | 0.7723348 | 0 |
Calculate the norm of this operator. Raises NotImplementedError | def norm(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def norm(self):",
"def norm(self):\n return sqrt(self.dot(self))",
"def norm(self):\n return math.sqrt(self.dotProduct(self))",
"def norm( self):\n return self._norm",
"def norm(self):\n return np.sqrt(np.dot(self._data, self._data))",
"def norm(self):\n # TODO: implement\n... | [
"0.81147134",
"0.8092853",
"0.80451155",
"0.79301953",
"0.7917328",
"0.79092366",
"0.7791435",
"0.7787146",
"0.77486014",
"0.7693271",
"0.76545006",
"0.7616547",
"0.7454818",
"0.74467516",
"0.74390215",
"0.74237293",
"0.73992544",
"0.7263563",
"0.7189563",
"0.71869063",
"0.71... | 0.8745577 | 0 |
Calculate the expected value of this PDF. Raises NotImplementedError | def expected_value(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self) -> float:",
"def calculate(self) -> float:",
"def calculate_probability(self):\n return 0",
"def pdf(self, x):\n raise NotImplementedError",
"def pdf(self, value=None):\n if value is None:\n value = self.value\n return self.rv.pdf(\n ... | [
"0.6462741",
"0.6402875",
"0.6378321",
"0.63368565",
"0.63221127",
"0.6310824",
"0.630854",
"0.630854",
"0.630854",
"0.62380314",
"0.62017816",
"0.6088052",
"0.6035139",
"0.6011425",
"0.600801",
"0.5999864",
"0.5974068",
"0.5940353",
"0.5939242",
"0.59268934",
"0.5921506",
... | 0.7001191 | 0 |
Plot the probabilities over the mesh. | def plot(self, filename, title=None, labels=None, **kwargs):
if self._logger:
self._logger.info("starting plot of probabilities...")
t1 = datetime.now()
plt.cla()
plt.clf()
axis = self._mesh.axis()
if self._mesh.is_1d():
pdf = np.zeros(self._sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_prediction_grid (xx, yy, prediction_grid, filename):\n from matplotlib.colors import ListedColormap\n background_colormap = ListedColormap ([\"hotpink\",\"lightskyblue\", \"yellowgreen\"])\n observation_colormap = ListedColormap ([\"red\",\"blue\",\"green\"])\n plt.figure(figsize =(10,10))\n ... | [
"0.65089583",
"0.65018743",
"0.6315799",
"0.63069105",
"0.6218019",
"0.6153953",
"0.6080807",
"0.5980349",
"0.59296113",
"0.5915293",
"0.5887138",
"0.586622",
"0.58613384",
"0.5831769",
"0.58201355",
"0.58085155",
"0.57825243",
"0.57561404",
"0.5736011",
"0.5731636",
"0.57263... | 0.6731137 | 0 |
Plot the contour function of the probabilities over the mesh. | def plot_contour(self, filename=None, title=None, labels=None, **kwargs):
if not self._mesh.is_2d():
if self._logger:
self._logger.warning('it is only possible to plot the contour function of two-dimensional meshes')
return None
if self._logger:
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contour_torch(xmin, xmax, ymin, ymax, M, ngrid = 33):\r\n xgrid = torch.linspace(xmin, xmax, ngrid)\r\n ygrid = torch.linspace(ymin, ymax, ngrid)\r\n (xx, yy) = torch.meshgrid((xgrid, ygrid))\r\n D = torch.cat((xx.reshape(ngrid, ngrid, 1), yy.reshape(ngrid, ngrid, 1)), dim = 2)\r\n zz = M(D)\r\n... | [
"0.6900895",
"0.66477424",
"0.65961605",
"0.6485944",
"0.6469908",
"0.6459694",
"0.63136697",
"0.630626",
"0.63031965",
"0.627178",
"0.6266183",
"0.6243717",
"0.6243717",
"0.6243717",
"0.6236249",
"0.61978984",
"0.61978984",
"0.61978984",
"0.61978984",
"0.61966765",
"0.618543... | 0.7318809 | 0 |
Check whether argument is a PDF object. | def is_pdf(obj):
return isinstance(obj, PDF) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isPdf(page):\n return page['data'][:4] == '%PDF'",
"def should_see_pdf(self):\n return self.organization.has_a_pdf()",
"def checkIfPdf(pageDict, metaData):\n if isPdf(pageDict):\n pageDict['mimeType'] = 'application/pdf'\n if pageDict['mimeType'] != 'application/pdf':\n raise ... | [
"0.71253026",
"0.69582605",
"0.6793114",
"0.6668833",
"0.6091303",
"0.575064",
"0.571446",
"0.5694071",
"0.56710374",
"0.56359786",
"0.5614855",
"0.55165863",
"0.5472787",
"0.5464011",
"0.5439452",
"0.53831315",
"0.53778434",
"0.53214794",
"0.53214794",
"0.5264426",
"0.526309... | 0.9019407 | 0 |
view news page function that returns the news detail page and its data from a source | def articles(news_id):
#get news based on source id
articles = get_articles(news_id)
print(articles)
title = f'{news_id}'
return render_template("articles.html", articles = articles, title = title) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def news_web():\n get_news()",
"def GET_details(self, article):\r\n return DetailsPage(link = article).render()",
"def NewsArticles():\n health_articles = get_articles('health')\n education_articles = get_articles('technology')\n return render_template('articles.html',health=health_articles,... | [
"0.71132565",
"0.68933827",
"0.6859497",
"0.68433774",
"0.68349904",
"0.6828015",
"0.6810112",
"0.6797548",
"0.6774499",
"0.67217493",
"0.66773784",
"0.6649373",
"0.6621307",
"0.6618013",
"0.65945625",
"0.6587606",
"0.65707415",
"0.6539199",
"0.6519273",
"0.6513173",
"0.64391... | 0.7116731 | 0 |
Apply the improved Goldsmith segmentation. | def apply_goldsmith(self, beta, min_oc, side):
suff_list = list()
for (leaf, oc) in self._dart.feuilles.items():
if oc > min_oc:
suff_list.append(leaf)
alist = list(map(tolower, self._words))
self._gold.initialize_text(alist)
self._gold.initialize(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segmentation_rgb(self, image, k=2):\n\n \n iterations = 5\n \n print(image.shape)\n imageW = image.shape[0]\n imageH = image.shape[1]\n\n\n dataVector = np.ndarray(shape=(imageW * imageH, 5), dtype=float)\n \n pixelClusterAppartenance = np.ndarray(s... | [
"0.5992505",
"0.57202804",
"0.5709125",
"0.5536524",
"0.54906774",
"0.5426793",
"0.540764",
"0.53932285",
"0.53868073",
"0.53821707",
"0.53572136",
"0.5354711",
"0.53336775",
"0.52919114",
"0.52766573",
"0.52743936",
"0.5260331",
"0.52588606",
"0.5256777",
"0.525671",
"0.5249... | 0.57398474 | 1 |
Naive heuristic association between the words of the first database and the second database based on the frequencies of the words. We associate each word w1 of the first database to those of the second if its frequencies is in [1/factor,factor]w1.freq. We add an initial distance of infinity. | def associate_words(self, factor):
self._groupFactor = factor
for str1 in self._txt1.data:
self._distWords[str1] = {}
f1 = self._txt1[str1].freq
for str2 in self._txt2.data:
if f1 / factor < self._txt2[str2].freq < f1 * factor:
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_similarity_between_words(word1, word2):\n # pos = wn.Noun is mandatory otherwise the lowest common hypernym cant be found because of part of speach\n word1_synsets = wn.synsets(word1, pos=wn.NOUN)\n word2_synsets = wn.synsets(word2, pos=wn.NOUN)\n\n w1 = get_words_from_sysets(word1_synsets)\n ... | [
"0.65414834",
"0.6335103",
"0.6274449",
"0.6219751",
"0.618673",
"0.6158708",
"0.6114623",
"0.6093511",
"0.60726845",
"0.6060269",
"0.60591626",
"0.6050568",
"0.6041385",
"0.6032515",
"0.6004154",
"0.5905257",
"0.59030735",
"0.5889902",
"0.5872754",
"0.5871324",
"0.58262694",... | 0.6900126 | 0 |
Compute the distance between a word and the associated words, store the distances and return the minimum | def dist_word(self, str1):
min_dist = float("inf")
min_str = ""
if str1 in self._txt1.data:
# allocate list for computation of the maximum size
warp = [[1 for j in range(int(self._txt1[str1].freq * self._groupFactor) + 1)]
for i in range(self._txt1[s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_dist(self, sax_word_2):\n dist = 0.0\n diffs = np.apply_along_axis(np.abs, 0, np.subtract(self.sax(), sax_word_2.sax()))\n for i in range(len(diffs)):\n if diffs[i] > 1:\n dist += self._normal_cutoffs[self.a][int(max(self.sax()[i], sax_word_2.sax()[i])) - 1]\n... | [
"0.7562761",
"0.7433262",
"0.7367496",
"0.73641276",
"0.7191897",
"0.7097025",
"0.70166236",
"0.67707133",
"0.6700924",
"0.66888124",
"0.66408676",
"0.6624273",
"0.6601847",
"0.65372324",
"0.6517134",
"0.64808726",
"0.6408117",
"0.64037645",
"0.6386217",
"0.63658386",
"0.6358... | 0.7765728 | 0 |
Change the current task and the corresponding progress bar | def change_task(self, ref):
self._current_task = ref
self._progress_bar = 0
self._offset_bar = 0
# display a progress bar
self._progress_window = LoadingWindow(self._current_task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_progress(self, progress: float):",
"def setProgress(self, prog):\n\t\tself.progress = prog",
"def start_progress_bar(self):\r\n self.progress[\"value\"] = self.progress_step",
"def current_progress(self, current_progress):\n\n self._current_progress = current_progress",
"def progress_... | [
"0.72730386",
"0.71251273",
"0.69530666",
"0.69386685",
"0.69243014",
"0.68304414",
"0.68231434",
"0.6792519",
"0.67500025",
"0.6655898",
"0.6655898",
"0.6653279",
"0.6541686",
"0.65215546",
"0.65215546",
"0.6511799",
"0.6508723",
"0.65051985",
"0.6482829",
"0.6478734",
"0.64... | 0.8310493 | 0 |
Generate a unique code for the user | def generate_code(self):
code = ''.join(
random.choices(string.ascii_lowercase + string.digits, k=5))
self.code = '{}{}'.format(self.user.id, code) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userIDGen() :\n\treturn __randomString(8)",
"def default_code():\n return uuid.uuid4().hex",
"def create_uid():\n return random_string(5, string.hexdigits.lower())\n # return (\"%x\" % (int(time.time()) * 0x10 % 0x1000000000)\n # + random_string(7, string.hexdigits.lower()))",
"def ge... | [
"0.7929677",
"0.7744052",
"0.7558292",
"0.7503004",
"0.73610365",
"0.73000455",
"0.7299813",
"0.7271843",
"0.7239155",
"0.72386396",
"0.7233488",
"0.7230034",
"0.7214862",
"0.71583015",
"0.7139136",
"0.7110704",
"0.71068066",
"0.71041226",
"0.70988166",
"0.7094834",
"0.709449... | 0.8312475 | 0 |
Makes API calls to GetResources to get the live tags of the account's Lambda functions Returns an empty dict instead of fetching custom tags if the tag fetch env variable is not set to true | def build_tags_cache(self):
tags_fetch_success = False
tags_by_arn_cache = {}
get_resources_paginator = resource_tagging_client.get_paginator("get_resources")
try:
for page in get_resources_paginator.paginate(
ResourceTypeFilters=[GET_RESOURCES_LAMBDA_FILTER]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_tags():\n try:\n data = ReadTag().run()\n except Exception as ex:\n return jsonify({'code': '500','message':'Internal server error'})\n else:\n return jsonify({'code': '200','data': data})",
"def handle_tags(self, request):\n \"\"\"\n @api {get} /tags List ... | [
"0.63779163",
"0.6164453",
"0.6077826",
"0.6077826",
"0.6054122",
"0.5954868",
"0.59436256",
"0.59143525",
"0.5852645",
"0.5787442",
"0.5776673",
"0.5714367",
"0.56962407",
"0.5691499",
"0.56902766",
"0.5673385",
"0.5652038",
"0.5645147",
"0.56284046",
"0.560214",
"0.55958384... | 0.694687 | 0 |
Get the tags for the Lambda function from the cache Will refetch the tags if they are out of date, or a lambda arn is encountered which isn't in the tag list | def get(self, key):
if self._is_expired():
send_forwarder_internal_metrics("local_cache_expired")
logger.debug("Local cache expired, fetching cache from S3")
self._refresh()
function_tags = self.tags_by_id.get(key, [])
return function_tags | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_tags_cache(self):\n tags_fetch_success = False\n tags_by_arn_cache = {}\n get_resources_paginator = resource_tagging_client.get_paginator(\"get_resources\")\n\n try:\n for page in get_resources_paginator.paginate(\n ResourceTypeFilters=[GET_RESOURCES_... | [
"0.7093553",
"0.6433123",
"0.57398766",
"0.56591403",
"0.5483682",
"0.54647005",
"0.54647005",
"0.535396",
"0.5320117",
"0.5299555",
"0.5230967",
"0.5205328",
"0.51857775",
"0.5177456",
"0.5112319",
"0.51019406",
"0.50899804",
"0.50851274",
"0.5038372",
"0.5017219",
"0.499552... | 0.7364843 | 0 |
Setup force fields and interaction groups to work with designated solute indices | def setupSolute(self,soluteIndices):
assert not self.soluteInitialized, "Solute previously initialized, can't add force to system again"
alchemicalParticles = set(soluteIndices)
chemicalParticles = set(range(self.system.getNumParticles())) - alchemicalParticles
#Loop over all p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dihedral_force_group(system, g=2):\n print('Scanning forces:')\n for f in system.getForces():\n if isinstance(f, simtk.openmm.openmm.PeriodicTorsionForce):\n print('Found the torsions - setting group to 2')\n f.setForceGroup(2)\n print(f.getForceGroup(), f.__class__)",
"def set_dihedral... | [
"0.5441716",
"0.5441716",
"0.53769016",
"0.53353584",
"0.52586436",
"0.5255978",
"0.52520597",
"0.51885605",
"0.512525",
"0.51223946",
"0.5112757",
"0.51095253",
"0.5079673",
"0.50777256",
"0.50706017",
"0.5044604",
"0.50404036",
"0.50329983",
"0.5021927",
"0.5009306",
"0.500... | 0.55506086 | 0 |
Rotate `vect' around `axis' by `angle'. Both `vect' and `angle' must be 3D normalized vectors. `angle' is expressed in radians. | def rotate (vect, angle, axis):
cosine = np.cos (angle)
sine = np.sin (angle)
return (vect * cosine + \
sine * np.cross (axis, vect) + \
np.dot (axis, vect) * (1 - cosine) * axis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_around_axis(vec, axis, angle):\n\n axis = normalise(axis)\n a = cos(angle / 2.0)\n b, c, d = -axis * sin(angle / 2.0)\n aa, bb, cc, dd = a * a, b * b, c * c, d * d\n bc, ad, ac, ab, bd, cd = b * c, a * d, a * c, a * b, b * d, c * d\n rot_matrix = np.array([[aa + bb - cc - dd, 2 * (bc +... | [
"0.78022397",
"0.7738507",
"0.74586517",
"0.74344265",
"0.73214376",
"0.7226712",
"0.6932697",
"0.6861774",
"0.6852306",
"0.6830251",
"0.6795782",
"0.6774258",
"0.6742441",
"0.672508",
"0.67197126",
"0.6717138",
"0.65685695",
"0.65345263",
"0.6482394",
"0.64753675",
"0.647505... | 0.81967634 | 0 |
Return the direction corresponding to a normalized vector. The return value is a (latitude, longitude) pair (in radians) corresponding to the direction of the 3D normalized vector `pointing'. | def pointing_to_coord (pointing):
return (np.arctan2 (pointing[2], np.sqrt (pointing[0]**2 + pointing[1]**2)),
np.arctan2 (pointing[1], pointing[0])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def direction(self):\n norm=math.sqrt(self.x**2 + self.y**2 + self.z**2)\n return Vector3(self.x/norm, self.y/norm, self.z/norm)",
"def get_normalized_direction(self, direction):\n return round(self.normal_joystick_slope * direction + self.normal_joystick_intercept, 2)",
"def find_directio... | [
"0.6638371",
"0.64791757",
"0.6372592",
"0.6317593",
"0.6152417",
"0.6144029",
"0.60309136",
"0.5891321",
"0.58296084",
"0.58030427",
"0.57916224",
"0.57379407",
"0.57097596",
"0.57028234",
"0.5671111",
"0.56257254",
"0.5614319",
"0.5601918",
"0.5539505",
"0.5531735",
"0.5528... | 0.65921193 | 1 |
Initialize the object. If `elevation' is provided, this is the elevation (in degrees) of the instrument with respect to the horizon. Similarly, if `latitude' is provided, this is the (fixed) latitude (in degrees again) of the balloon during flight. The value of `longitude' provides the longitude (in degrees) at the beg... | def __init__ (self,
elevation = 45.0,
start_angle = 0.0,
latitude = 78.0,
longitude = 0.0,
rot_per_min = 1,
rev_days = 15):
self.elevation = np.radians (elevation) # Units: [rad]
self.sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n latitude_deg,\n longitude_deg,\n absolute_altitude_m,\n relative_altitude_m):\n self.latitude_deg = latitude_deg\n self.longitude_deg = longitude_deg\n self.absolute_altitude_m = absolute_altitude_m\n self.re... | [
"0.6200441",
"0.59662384",
"0.5653226",
"0.5583272",
"0.55413",
"0.55394137",
"0.54876",
"0.5458472",
"0.5450822",
"0.5375087",
"0.5365067",
"0.5324281",
"0.526845",
"0.52305406",
"0.5207937",
"0.5196677",
"0.51931405",
"0.5176746",
"0.5158859",
"0.5155488",
"0.5140593",
"0... | 0.7597978 | 0 |
Return the pointing axis at the given time. `time' is expressed in seconds. The result is a 3D normalized vector in the Earth coordinate system (equatorial coordinates). | def pointing_dir_earth (self, time):
return self.vect_from_lspe_to_earth (self.pointing_dir_lspe (time),
time) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spin_axis_earth (self, time):\n\n return self.vect_from_lspe_to_earth (self.spin_axis_lspe (time),\n time)",
"def _P(time='now'):\n obstime = parse_time(time)\n\n # Define the frame where its Z axis is aligned with geocentric north\n geocentric = Pr... | [
"0.7195893",
"0.626813",
"0.6265568",
"0.6017088",
"0.6016693",
"0.59964687",
"0.5989676",
"0.5925973",
"0.5901042",
"0.58309186",
"0.5752033",
"0.56539387",
"0.5561295",
"0.5533267",
"0.55301183",
"0.5498682",
"0.5498639",
"0.5467805",
"0.5411977",
"0.53572595",
"0.53317136"... | 0.6909739 | 1 |
Return the coordinates of LSPE at the given time. The result is a (latitude, longitude) pair specifying where LSPE is at the given `time' (in seconds). | def lspe_coordinates (self, time):
return (self.base_lat,
self.base_long
+ time * 2 * np.pi * (1 + 1 / self.rev_days) / SECONDS_PER_DAY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sunlongitude(time):\n B0 = 36000.7695\n C0 = 280.4659\n # fmt: off\n A = np.array([19147e-4, 200e-4, 48e-4, 20e-4, 18e-4, 18e-4, \\\n 15e-4, 13e-4, 7e-4, 7e-4, 7e-4, 6e-4, \\\n 5e-4, 5e-4, 4e-4, 4e-4])\n B = np.array([35999.050, 71998.1, 1934, 32964, 19, \\\n ... | [
"0.64156216",
"0.62733424",
"0.6054417",
"0.59554416",
"0.575077",
"0.5719059",
"0.569973",
"0.56042564",
"0.54053766",
"0.53990406",
"0.5355739",
"0.5332108",
"0.53242445",
"0.5267854",
"0.52543586",
"0.5240149",
"0.52363694",
"0.52345276",
"0.52316546",
"0.5230655",
"0.5202... | 0.8144775 | 0 |
Return the spin axis at the given time. `dummy' is the time and is expressed in seconds. The result is a 3D normalized vector in the LSPE coordinate system. It is always the z versor (regardless of the value of `dummy', hence the name). | def spin_axis_lspe (self, dummy):
return np.array ([0, 0, 1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_axis(self):\n if self.axes_wcs.wcs.ctype[0] not in ['TIME', 'UTC']:\n raise cu.CubeError(1, 'No time axis present')\n delta = self.axes_wcs.wcs.cdelt[0]\n crpix = self.axes_wcs.wcs.crpix[0]\n crval = self.axes_wcs.wcs.crval[0]\n start = crval - crpix * delta\n... | [
"0.5662792",
"0.56608665",
"0.4881431",
"0.4871758",
"0.4856755",
"0.48545897",
"0.48476598",
"0.4830106",
"0.48291278",
"0.48289394",
"0.4797889",
"0.47638732",
"0.47162256",
"0.47007903",
"0.4672042",
"0.46469656",
"0.4621797",
"0.4613369",
"0.4603024",
"0.45925656",
"0.459... | 0.63085514 | 0 |
Return the LSPE spin axis at the given time. `time' is expressed in seconds. The result is a 3D normalized vector in the equatorial coordinate system. | def spin_axis_earth (self, time):
return self.vect_from_lspe_to_earth (self.spin_axis_lspe (time),
time) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vect_from_lspe_to_earth (self, vector, time):\n\n position_coord = self.lspe_coordinates (time)\n # The following code has been optimized:\n # position_vector = coord_to_pointing (position_coord)\n # angle = np.arccos (np.dot (self.spin_axis_lspe (time), position_vector))\n ... | [
"0.624724",
"0.608877",
"0.5773101",
"0.5696111",
"0.56890506",
"0.5685792",
"0.56773686",
"0.56202793",
"0.5601596",
"0.5515599",
"0.5491223",
"0.54664624",
"0.5454418",
"0.53252333",
"0.5323779",
"0.52936375",
"0.52904826",
"0.52311695",
"0.5209736",
"0.5209331",
"0.5205471... | 0.7387977 | 0 |
Print a progress bar to stderr. `time' is the current time (in the units used by the simulation codes) and `max_time' is the maximum value achievable by `time'. The `elapsed_time' object is an instance of `timedelta' and represents the time used by the program to run the simulation up to now. | def print_progress_bar (time, max_time, elapsed_time):
BAR_LENGTH = 40
bars = '*' * int (time * BAR_LENGTH / max_time)
spaces = ' ' * (BAR_LENGTH - len (bars))
day = time / SECONDS_PER_DAY
sys.stderr.write ("\r%3d%% [%s%s] Day %2d, elapsed time: %s" % \
(percent, bars, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_progress(progress, max_time, starting_time=start_time):\n \n percent = float(progress)/float(max_time)\n int_percent = int(percent*100)\n elapsed_min = (time.mktime(time.gmtime())-starting_time)/60.0\n if percent > 0:\n eta_min = int(round(elapsed_min/percent))\n else:\n ... | [
"0.5788066",
"0.54384786",
"0.53692865",
"0.5292549",
"0.52400863",
"0.5239075",
"0.52185994",
"0.50773895",
"0.5041363",
"0.49800476",
"0.4970177",
"0.49299452",
"0.4911074",
"0.48527604",
"0.48265725",
"0.47950646",
"0.4790856",
"0.478905",
"0.47759262",
"0.47538003",
"0.47... | 0.81312686 | 0 |
Given a nonempty list of words, return the k most frequent elements. >>> freq_el(['the', 'day', 'is', 'sunny', 'the', 'the', 'the', 'sunny', 'is', 'is'],4) ['the', 'is', 'sunny', 'day'] >>> freq_el(['i', 'love', 'leetcode', 'i', 'love', 'coding'], 2) ['i', 'love'] | def freq_el(word_list, i):
#get word counts
word_counts = Counter(word_list)
# word_counts = defaultdict(int)
# for word in word_list:
# word_counts[word] += 1
#Make dictionary with count as key, words with same count as a value in a list
byfreq = defaultdict(list)
for k, v in word_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_k_frequent(top_k, words, list_of_texts):\n dict_top_freq = {}\n for word in words:\n dict_top_freq[word.lower()] = 0\n for string in list_of_texts:\n if word.lower() in string.lower():\n counter = string.lower().count(word.lower())\n dict_top_fre... | [
"0.6942574",
"0.6654207",
"0.64189833",
"0.6268213",
"0.6245693",
"0.6126585",
"0.61117077",
"0.60501295",
"0.5966201",
"0.58625007",
"0.5859646",
"0.58459145",
"0.5841241",
"0.58375907",
"0.58151615",
"0.5806208",
"0.57930243",
"0.5736317",
"0.5726623",
"0.56840736",
"0.5673... | 0.6746735 | 1 |
Check ongoing hacks and their expiration time. | async def check_hacks(self) -> None:
hacks = await self.get_expired_hacks()
for h in hacks:
await self.delete_skill_action_by_target_id_and_skill_type(h[3], 'hack')
await self.update_user_is_hacked(h[3], 0)
channel = self.bots_txt
await channel.send(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def check_hacks(self) -> None:\n\n hacks = await self.get_expired_hacks()\n for h in hacks:\n await self.delete_skill_action_by_target_id_and_skill_type(h[3], 'hack')\n\n channel = self.bots_txt\n\n await channel.send(\n content=f\"<@{h[0]}>\",\n ... | [
"0.6332263",
"0.61418",
"0.6007292",
"0.5943196",
"0.58323187",
"0.5762643",
"0.57544595",
"0.5733186",
"0.5719667",
"0.56494826",
"0.56424487",
"0.5639762",
"0.56145597",
"0.56025016",
"0.557354",
"0.5539113",
"0.55334616",
"0.55320907",
"0.5497794",
"0.54934573",
"0.5474352... | 0.6524886 | 0 |
Check ongoing wires and their expiration time. | async def check_wires(self) -> None:
wires = await self.get_expired_wires()
for w in wires:
await self.delete_skill_action_by_target_id_and_skill_type(w[3], 'wire')
await self.update_user_is_wired(w[3], 0)
channel = self.bots_txt
await channel.send(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_time(self):\n while True:\n for name in self.neighbors:\n if not self.neighbors[name].is_killed:\n if not self.neighbors[name].update_ready and time.time() - self.neighbors[name].send_timer > self.timeout:\n self.neighbors[name].u... | [
"0.65001595",
"0.6412871",
"0.63458043",
"0.6326673",
"0.60454017",
"0.60435474",
"0.59640604",
"0.593387",
"0.58764803",
"0.58728606",
"0.58079773",
"0.58026534",
"0.5788628",
"0.5678883",
"0.56563866",
"0.5635532",
"0.55532116",
"0.55090255",
"0.54870677",
"0.54717106",
"0.... | 0.65165544 | 0 |
Makes an embedded message for a hacking skill action. | async def get_hack_embed(self, channel: discord.TextChannel, perpetrator_id: int, target_id: int,) -> discord.Embed:
timestamp = await self.get_timestamp()
hack_embed = discord.Embed(
title="Someone just got Hacked and lost Control of Everything!",
timestamp=datetime.utcfromtim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embed():",
"async def get_hack_embed(self, channel: discord.TextChannel, perpetrator_id: int, target_id: int,) -> discord.Embed:\n\n timestamp = await utils.get_timestamp()\n\n hack_embed = discord.Embed(\n title=\"Someone just got Hacked and lost Control of Everything!\",\n ... | [
"0.62329346",
"0.6124491",
"0.587228",
"0.5870885",
"0.5819266",
"0.5695436",
"0.56612295",
"0.5650086",
"0.565002",
"0.5605291",
"0.55691373",
"0.5486994",
"0.54725134",
"0.54720557",
"0.5419409",
"0.5406215",
"0.53687006",
"0.53319746",
"0.53255194",
"0.53077865",
"0.530545... | 0.61595505 | 1 |
Load the GDP distribution data. | def load_gdp_distribution_data(data_file):
header = parse_data_header(data_file)
with open(data_file, 'r') as data:
data = np.genfromtxt(data, delimiter=' ', skip_header=6)
# Set the areas in which there is no data to 0
data[data == header['NODATA_value']] = 0
return header, data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_gdp(return_X_y=False):\n return _load_dataset(\n 'gdp/GDP-growth.csv',\n target='GDP_g',\n return_X_y=return_X_y\n )",
"def gc_data(dataset, dirname, train_ratio=0.8):\n \n # Define path where dataset should be saved\n data_path = \"data/{}.pth\".format(dataset)\n\n ... | [
"0.6761434",
"0.61682534",
"0.5997922",
"0.5802538",
"0.57439554",
"0.5732135",
"0.57174516",
"0.56894815",
"0.568445",
"0.5624929",
"0.5624929",
"0.5624929",
"0.5624929",
"0.55964226",
"0.5584472",
"0.55799586",
"0.55481315",
"0.5513387",
"0.55123305",
"0.55046046",
"0.54860... | 0.7005061 | 0 |
Transform the data matrix into a probability distribution. | def data_to_probability(matrix, filter=True):
probability = matrix / np.sum(matrix)
if filter:
probability = uniform_filter(probability, 5)
probability[probability < 0.0] = 0
probability[matrix < 0.0] = 0
return probability | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _process(self, data: np.ndarray) -> np.ndarray:\n probabilities = np.empty(data.size, dtype=object)\n\n for idx, counts_dict in enumerate(data):\n shots = sum(counts_dict.values())\n freq = counts_dict.get(self._outcome, 0)\n alpha_posterior = [freq + self._alpha_... | [
"0.6562862",
"0.65416527",
"0.65341675",
"0.65325946",
"0.628948",
"0.6261325",
"0.61452293",
"0.61193466",
"0.61073834",
"0.6097872",
"0.6066533",
"0.6049817",
"0.604197",
"0.6031189",
"0.60156745",
"0.5981147",
"0.59589565",
"0.59247404",
"0.59140575",
"0.5879477",
"0.58702... | 0.7274346 | 0 |
Sample GSTs coordinates form the gdp_matrix. | def sample_gst_coordinates(n_gsts, gdp_matrix, gdp_header, replace=False,
randomize=False, filter_prob=False):
gdp_matrix = gdp_matrix.copy()
gdp_matrix[gdp_matrix < 0] = 0
probability = data_to_probability(gdp_matrix, filter_prob).flatten()
positions = np.arange(0, gdp_matrix... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def samples(self, gp):\r\n orig_shape = gp.shape\r\n gp = gp.flatten()\r\n Ysim = np.random.poisson(self.gp_link.transf(gp))\r\n return Ysim.reshape(orig_shape)",
"def samples(self, gp):\r\n orig_shape = gp.shape\r\n gp = gp.flatten()\r\n Ysim = np.array([np.rando... | [
"0.6173968",
"0.6131709",
"0.60087246",
"0.5958241",
"0.586408",
"0.5851609",
"0.57908034",
"0.56812274",
"0.5660166",
"0.5615396",
"0.5614734",
"0.5602829",
"0.558856",
"0.558392",
"0.55351126",
"0.55022514",
"0.5497691",
"0.54315424",
"0.53993696",
"0.5357536",
"0.53326756"... | 0.73859173 | 0 |
Get latitude from index in mat. | def get_lat(idx, header, randomize=False):
lat = header[Y_CORNER] + header[N_ROWS] - idx - 0.5
if randomize:
lat += np.random.normal(-0.5, 1, size=lat.shape)
return lat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lat(self):\n return self._grid.lat[self._lat_indices]",
"def latitude(self):\n return self.coordinates[0]",
"def lat(self):\n return self['lat']",
"def latitude(self, lat):\n data = float(lat[1:])\n if lat[0] == \"N\":\n return data\n else:\n ... | [
"0.7090824",
"0.68235976",
"0.6739625",
"0.64890015",
"0.6369841",
"0.63169545",
"0.62889147",
"0.6272594",
"0.6227671",
"0.60823774",
"0.60797375",
"0.6052779",
"0.59712523",
"0.5914202",
"0.5913499",
"0.5913499",
"0.5913499",
"0.59112895",
"0.5899973",
"0.58851177",
"0.5845... | 0.68420064 | 1 |
Check if there are one or many AMIs for the SaintsXCTF web server. | def test_ami_exists(self) -> None:
owner = self.sts.get_caller_identity().get('Account')
amis = self.ec2_client.describe_images(
Owners=[owner],
Filters=[{
'Name': 'name',
'Values': ['saints-xctf-web-server*']
}]
)
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_amino_acids(self):\n for frag in self.iter_amino_acids():\n return True\n return False",
"def check_ambari_server_process_up(self):\n process_name = \"ambari-server\"\n output = self.__find_process(process_name)\n return re.search(process_name, output)",
"def mwa_avail... | [
"0.5806803",
"0.55998677",
"0.5584755",
"0.55754",
"0.5542552",
"0.5514128",
"0.5512015",
"0.5510901",
"0.5468208",
"0.5435975",
"0.5409473",
"0.54016274",
"0.5394734",
"0.5394464",
"0.53695977",
"0.53601456",
"0.5357701",
"0.53484225",
"0.53327304",
"0.5313508",
"0.5305635",... | 0.5968224 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.