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 |
|---|---|---|---|---|---|---|
Get the URL of the docker builder image for fuzzing the benchmark with fuzzer. | def get_builder_image_url(benchmark, fuzzer, docker_registry):
return f'{docker_registry}/builders/{fuzzer}/{benchmark}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_runner_image_url(experiment, benchmark, fuzzer, docker_registry):\n tag = 'latest' if environment.get('LOCAL_EXPERIMENT') else experiment\n return f'{docker_registry}/runners/{fuzzer}/{benchmark}:{tag}'",
"def _to_dockerfile_url(image):\n path = \"/\".join((image.platform, image.release, image.a... | [
"0.800936",
"0.68247736",
"0.62919927",
"0.6119331",
"0.60827637",
"0.5836558",
"0.5680232",
"0.5606805",
"0.5593281",
"0.55321765",
"0.5527971",
"0.55201703",
"0.5511697",
"0.5464959",
"0.5450358",
"0.5436414",
"0.5423743",
"0.5383551",
"0.53793126",
"0.5351387",
"0.53473455... | 0.8987414 | 0 |
Returns True if |benchmark| is a valid fuzzbench benchmark name. | def validate_name(benchmark):
if VALID_BENCHMARK_REGEX.match(benchmark) is None:
logs.error('%s does not conform to %s pattern.', benchmark,
VALID_BENCHMARK_REGEX.pattern)
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(benchmark):\n if not validate_name(benchmark):\n return False\n\n if benchmark not in get_all_benchmarks():\n logs.error('%s must have a benchmark.yaml.', benchmark)\n return False\n\n # Validate config file can be parsed.\n try:\n get_fuzz_target(benchmark)\n ... | [
"0.75245595",
"0.70732296",
"0.5810576",
"0.5674972",
"0.5586452",
"0.55509335",
"0.55345166",
"0.5492754",
"0.54216146",
"0.5396599",
"0.533939",
"0.52890986",
"0.52809453",
"0.5276064",
"0.5262049",
"0.5236118",
"0.5226639",
"0.51745903",
"0.51519513",
"0.51472944",
"0.5053... | 0.816597 | 0 |
Returns True if |benchmark| has a valid type. | def validate_type(benchmark):
benchmark_type = get_type(benchmark)
if benchmark_type not in BENCHMARK_TYPE_STRS:
logs.error('%s has an invalid benchmark type %s, must be one of %s',
benchmark, benchmark_type, BENCHMARK_TYPE_STRS)
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(benchmark):\n if not validate_name(benchmark):\n return False\n\n if benchmark not in get_all_benchmarks():\n logs.error('%s must have a benchmark.yaml.', benchmark)\n return False\n\n # Validate config file can be parsed.\n try:\n get_fuzz_target(benchmark)\n ... | [
"0.6986698",
"0.6440675",
"0.6303851",
"0.62154716",
"0.6090882",
"0.608178",
"0.6064316",
"0.6046675",
"0.5970051",
"0.5952641",
"0.58843154",
"0.58391774",
"0.5755268",
"0.57513607",
"0.5732901",
"0.57144207",
"0.56996477",
"0.56742626",
"0.55769104",
"0.5570763",
"0.556722... | 0.837678 | 0 |
Returns True if |benchmark| is a valid fuzzbench benchmark. | def validate(benchmark):
if not validate_name(benchmark):
return False
if benchmark not in get_all_benchmarks():
logs.error('%s must have a benchmark.yaml.', benchmark)
return False
# Validate config file can be parsed.
try:
get_fuzz_target(benchmark)
except yaml.pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_type(benchmark):\n benchmark_type = get_type(benchmark)\n if benchmark_type not in BENCHMARK_TYPE_STRS:\n logs.error('%s has an invalid benchmark type %s, must be one of %s',\n benchmark, benchmark_type, BENCHMARK_TYPE_STRS)\n return False\n return True",
"de... | [
"0.69998956",
"0.67811495",
"0.5615518",
"0.5273485",
"0.5138776",
"0.5041119",
"0.48480907",
"0.48040372",
"0.47753853",
"0.47583094",
"0.4682528",
"0.4670917",
"0.466327",
"0.4620052",
"0.45891234",
"0.45834735",
"0.45678422",
"0.4562975",
"0.45465788",
"0.45328742",
"0.451... | 0.7685098 | 0 |
Returns the list of all benchmarks. | def get_all_benchmarks():
all_benchmarks = []
for benchmark in os.listdir(BENCHMARKS_DIR):
benchmark_path = os.path.join(BENCHMARKS_DIR, benchmark)
if os.path.isfile(os.path.join(benchmark_path, 'benchmark.yaml')):
all_benchmarks.append(benchmark)
return sorted(all_benchmarks) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_all(self):\n runs = []\n for run in self.benchmarks:\n run.start()\n run.wait()\n runs.append(run.metadata)\n return runs",
"def list(self, classes):\n\n def add(benchmarks, parts, flags, exclude):\n if (\n flags[\"lan... | [
"0.71444166",
"0.6889727",
"0.64351124",
"0.6397667",
"0.6397363",
"0.62924254",
"0.6077235",
"0.59082776",
"0.58880574",
"0.57301986",
"0.56475395",
"0.5644938",
"0.5587757",
"0.55655915",
"0.5550465",
"0.5548563",
"0.5522972",
"0.5509917",
"0.5496706",
"0.54954356",
"0.5495... | 0.79568917 | 0 |
Returns the list of all coverage benchmarks. | def get_coverage_benchmarks():
return [
benchmark for benchmark in get_all_benchmarks()
if get_type(benchmark) == BenchmarkType.CODE.value
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_benchmarks():\n all_benchmarks = []\n for benchmark in os.listdir(BENCHMARKS_DIR):\n benchmark_path = os.path.join(BENCHMARKS_DIR, benchmark)\n if os.path.isfile(os.path.join(benchmark_path, 'benchmark.yaml')):\n all_benchmarks.append(benchmark)\n return sorted(all_ben... | [
"0.6990162",
"0.6294294",
"0.61898667",
"0.57358605",
"0.5668825",
"0.5625119",
"0.5591114",
"0.54327077",
"0.5404844",
"0.5391268",
"0.53692985",
"0.5357925",
"0.5353722",
"0.5342524",
"0.53213197",
"0.5292404",
"0.52296937",
"0.52178067",
"0.5196261",
"0.51935357",
"0.51894... | 0.80346346 | 0 |
Returns the list of standard bug benchmarks. | def get_bug_benchmarks():
return [
benchmark for benchmark in get_all_benchmarks()
if get_type(benchmark) == BenchmarkType.BUG.value
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_benchmarks():\n all_benchmarks = []\n for benchmark in os.listdir(BENCHMARKS_DIR):\n benchmark_path = os.path.join(BENCHMARKS_DIR, benchmark)\n if os.path.isfile(os.path.join(benchmark_path, 'benchmark.yaml')):\n all_benchmarks.append(benchmark)\n return sorted(all_ben... | [
"0.6447797",
"0.58259064",
"0.5799858",
"0.5799062",
"0.5770896",
"0.5712318",
"0.5706508",
"0.5695553",
"0.5673421",
"0.5479634",
"0.54711425",
"0.5403768",
"0.5383399",
"0.5374102",
"0.5373461",
"0.5352589",
"0.5352316",
"0.5337508",
"0.5330979",
"0.53233963",
"0.5322599",
... | 0.8056906 | 0 |
Returns True if |benchmark| is written in C/C++. | def is_cpp(benchmark):
return get_language(benchmark) == 'c++' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _c_optimizations_required():\n pure_env = os.environ.get('PURE_PYTHON')\n require_c = pure_env == \"0\"\n return require_c",
"def _should_attempt_c_optimizations():\n if PYPY:\n return False\n\n if _c_optimizations_required():\n return True\n return not _c_optimizations_ignore... | [
"0.6263037",
"0.6229608",
"0.6097612",
"0.6020831",
"0.5982895",
"0.58478355",
"0.57693976",
"0.57392836",
"0.5669367",
"0.55203027",
"0.5460529",
"0.53889805",
"0.5354336",
"0.5303164",
"0.5300068",
"0.5299565",
"0.5283687",
"0.5242149",
"0.52138",
"0.5201266",
"0.5121601",
... | 0.82368374 | 0 |
Returns |benchmarks| with only benchmarks written in C/C++. | def exclude_non_cpp(benchmarks):
return [benchmark for benchmark in benchmarks if is_cpp(benchmark)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_coverage_benchmarks():\n return [\n benchmark for benchmark in get_all_benchmarks()\n if get_type(benchmark) == BenchmarkType.CODE.value\n ]",
"def get_bug_benchmarks():\n return [\n benchmark for benchmark in get_all_benchmarks()\n if get_type(benchmark) == Benchmark... | [
"0.69631344",
"0.64020723",
"0.61482394",
"0.56974643",
"0.5492792",
"0.54700804",
"0.5441572",
"0.5409977",
"0.5309843",
"0.52634937",
"0.5233209",
"0.52182776",
"0.52005297",
"0.5169763",
"0.5148801",
"0.51456755",
"0.51412374",
"0.51203877",
"0.5105856",
"0.5091856",
"0.50... | 0.801431 | 0 |
Returns the prorgamming language the benchmark was written in. | def get_language(benchmark):
config = benchmark_config.get_config(benchmark)
return config.get('language', 'c++') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def programming_language(self) -> str:\n return self.random.choice(PROGRAMMING_LANGS)",
"def generation_language(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"generation_language\")",
"def code(self):\n return self.language()",
"def language(self):\n return \"... | [
"0.72861236",
"0.65404236",
"0.6198768",
"0.61458135",
"0.6069835",
"0.6027784",
"0.59970075",
"0.5983806",
"0.5961204",
"0.5961204",
"0.5915103",
"0.5895517",
"0.5860599",
"0.58391285",
"0.58170784",
"0.57956773",
"0.5790107",
"0.57584816",
"0.57295835",
"0.572077",
"0.57125... | 0.76412416 | 0 |
Returns list of IDs of tags for specified model name by (code, name) pair | def get_tag_ids(self, cr, uid, model, code=None, name=None, context=None):
assert bool(code) or bool(name), "code or name must not be None! (code=%s;name=%s)" % (code, name)
tag_domain = [('model_id.model', '=', model)]
if code is not None:
tag_domain.append(('code', '=', code))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getTagIDs(self):\n paths = self._criteria.get('paths')\n if paths:\n store = getMainStore()\n return list(store.find(Tag.id, Tag.path.is_in(paths)))",
"def get_tag_ids(tag_names):\n\ttag_names = tuple(tag_names)\n\twith postgres, postgres.cursor() as cur:\n\t\tcur.execute... | [
"0.6331528",
"0.61098045",
"0.5848875",
"0.5817225",
"0.57898426",
"0.57898426",
"0.5781574",
"0.5777682",
"0.5743095",
"0.56093746",
"0.5590287",
"0.5589514",
"0.5496177",
"0.54333645",
"0.5430249",
"0.5416349",
"0.54159564",
"0.54110205",
"0.54062647",
"0.53955483",
"0.5384... | 0.8124625 | 0 |
Checks if all of supplied objects have tag with specified code and/or name Return True if all object ids has specified tags | def check_tag(self, cr, uid, ids, code=None, name=None, context=None):
assert bool(code is None) or bool(name is None), "code or name must not be None"
tag_domain = [('id', 'in', ids)]
if code is not None:
tag_domain.append(('tag_ids.code', '=', code))
if name is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_tag(tags, tagged_events):\n found_tags = set()\n tags_set = set(tags)\n for tag in tags:\n for tag_event in tagged_events:\n if tag in tag_event[1][\"tag\"][\"labels\"]:\n found_tags.add(tag)\n not_found = tags_set - found_tags\n tag_status = {}\n fo... | [
"0.61141014",
"0.6103309",
"0.5986072",
"0.5873774",
"0.5779968",
"0.57688856",
"0.57678956",
"0.576175",
"0.5726771",
"0.57225233",
"0.57074004",
"0.563474",
"0.5622186",
"0.5621437",
"0.5620893",
"0.56001145",
"0.55933976",
"0.55933976",
"0.5574528",
"0.5566219",
"0.5503636... | 0.67218775 | 0 |
Take the path to a raw json asset and convert it to target directory. | def processed_json_dir(path):
return os.path.dirname(path.replace(RAW_ASSETS_PATH, ASSETS_PATH)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processed_json_path(path):\n return path.replace(RAW_ASSETS_PATH, ASSETS_PATH).replace('.json', '.bin')",
"def copy_json():\n sourcePath = 'contents/external/'\n targetPath = 'build/external/'\n for base,subdirs,files in os.walk(sourcePath):\n for file in files:\n orig = os.path.j... | [
"0.7122769",
"0.6316052",
"0.5610777",
"0.54790395",
"0.52522516",
"0.522991",
"0.5213277",
"0.51795095",
"0.51795095",
"0.51695764",
"0.51168185",
"0.5074967",
"0.5063665",
"0.50393045",
"0.50152886",
"0.4990693",
"0.49906608",
"0.49886268",
"0.49885842",
"0.49729767",
"0.49... | 0.6894641 | 1 |
Initializes this object's schema, input_files and output_path. | def __init__(self, schema, input_files, output_path):
self.schema = schema
self.input_files = input_files
self.output_path = output_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n\n self.read_input_file()\n self.read_simulation_files()",
"def __init__(self):\n\t\tself.parsed = False\n\t\tdir_path = os.path.dirname(os.path.realpath(__file__))\n\t\tself.xsdfilename = os.path.join(dir_path, 'xml', 'schema.xsd')\n\t\tself.schema = 'schema.xsd'\n\t\tself.pr... | [
"0.69186145",
"0.6781864",
"0.6756163",
"0.6735031",
"0.6637486",
"0.6575436",
"0.6545899",
"0.65405905",
"0.6535554",
"0.65054566",
"0.6497379",
"0.6446711",
"0.6439875",
"0.64162254",
"0.6388665",
"0.63697845",
"0.63621044",
"0.63425386",
"0.6337463",
"0.6333185",
"0.633097... | 0.8291974 | 0 |
Take the path to a raw png asset and convert it to target webp path. | def processed_texture_path(path):
return path.replace(RAW_ASSETS_PATH, ASSETS_PATH).replace('png', 'webp') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def img2webp(path):\n file, ext = os.path.splitext(path)\n image = Image.open(path).convert(\"RGBA\")\n image = ImageOps.expand(image, 75)\n image.save(file + \".webp\", \"WEBP\")\n os.remove(path)",
"def image_webp():\n data = resource(\"images/wolf_1.webp\")\n return Response(data, headers... | [
"0.66254675",
"0.6108834",
"0.59269124",
"0.57612014",
"0.54063636",
"0.5362226",
"0.5322664",
"0.53141046",
"0.5290474",
"0.5259612",
"0.520573",
"0.51810825",
"0.51549965",
"0.51190436",
"0.5110097",
"0.51075953",
"0.50395477",
"0.5022422",
"0.48821872",
"0.48676977",
"0.48... | 0.72864443 | 0 |
Run the flatbuffer compiler on the given json file and schema. | def convert_json_to_flatbuffer_binary(json, schema, out_dir):
command = [FLATC, '-o', out_dir, '-b', schema, json]
run_subprocess(command) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(\n self,\n input_file=sys.stdin,\n output_file=sys.stdout,\n schema_map=None,\n ):\n schema_map, error_logs = self.deduce_schema(\n input_file, schema_map=schema_map\n )\n\n for error in error_logs:\n logging.info(\n f... | [
"0.6357114",
"0.634119",
"0.6240263",
"0.6036583",
"0.598429",
"0.59565043",
"0.57677084",
"0.56092983",
"0.5584701",
"0.55134827",
"0.54945713",
"0.5492932",
"0.5417545",
"0.5400936",
"0.5390043",
"0.53854465",
"0.5339671",
"0.53241897",
"0.5318094",
"0.5313744",
"0.5285585"... | 0.69766474 | 0 |
Run the webp converter on the given png file. | def convert_png_image_to_webp(png, out, quality=80):
command = [CWEBP, '-q', str(quality), png, '-o', out]
run_subprocess(command) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def img2webp(path):\n file, ext = os.path.splitext(path)\n image = Image.open(path).convert(\"RGBA\")\n image = ImageOps.expand(image, 75)\n image.save(file + \".webp\", \"WEBP\")\n os.remove(path)",
"def generate_webp_textures():\n input_files = PNG_TEXTURES['input_files']\n output_files = PNG_... | [
"0.59895134",
"0.5819123",
"0.5774753",
"0.5767522",
"0.57351494",
"0.57216007",
"0.56728303",
"0.5661198",
"0.5626706",
"0.55680203",
"0.5460881",
"0.5396583",
"0.53937674",
"0.5302584",
"0.5294534",
"0.5288155",
"0.52613574",
"0.523901",
"0.51677066",
"0.5115962",
"0.510950... | 0.67798376 | 0 |
Checks if the source file needs to be rebuilt. | def needs_rebuild(source, target):
return not os.path.isfile(target) or (
os.path.getmtime(source) > os.path.getmtime(target)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_source_file( self ):\n return self._source_file is not None",
"def source_changed(source, cache):\n return os.path.getmtime(source)>os.path.getmtime(cache)",
"def should_run(self):\n # from IPython.html.tasks.py\n\n css_targets = [pjoin(static, 'css', 'style.min.css')]\n ... | [
"0.6899336",
"0.66479534",
"0.6410455",
"0.63760024",
"0.63628346",
"0.63059103",
"0.62350976",
"0.619009",
"0.61705863",
"0.615026",
"0.6144818",
"0.6059382",
"0.6036777",
"0.5976113",
"0.5958864",
"0.5946087",
"0.5920723",
"0.591227",
"0.5905643",
"0.58806807",
"0.58798784"... | 0.78058094 | 0 |
Take the path to a raw json asset and convert it to target bin path. | def processed_json_path(path):
return path.replace(RAW_ASSETS_PATH, ASSETS_PATH).replace('.json', '.bin') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processed_json_dir(path):\n return os.path.dirname(path.replace(RAW_ASSETS_PATH, ASSETS_PATH))",
"def processed_texture_path(path):\n return path.replace(RAW_ASSETS_PATH, ASSETS_PATH).replace('png', 'webp')",
"def copy_json():\n sourcePath = 'contents/external/'\n targetPath = 'build/external/'\n ... | [
"0.61563104",
"0.57579714",
"0.54303104",
"0.5163897",
"0.5136838",
"0.5134525",
"0.50500184",
"0.50419426",
"0.50137776",
"0.50136286",
"0.50113374",
"0.49979314",
"0.49422348",
"0.49397087",
"0.493285",
"0.49240142",
"0.49194804",
"0.48922402",
"0.48879048",
"0.487408",
"0.... | 0.74835473 | 0 |
Run the flatbuffer compiler on the all of the flatbuffer json files. | def generate_flatbuffer_binaries():
for element in FLATBUFFERS_CONVERSION_DATA:
schema = element.schema
output_path = element.output_path
if not os.path.exists(output_path):
os.makedirs(output_path)
for json in element.input_files:
target = processed_json_path(json)
if needs_rebuild(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n os.makedirs(PATH)\n fetch_data()\n convert_to_json(model_list, 'models.json', is_model=True)\n convert_to_json(backend_list, 'backends.json')\n convert_to_json(type_list, 'types.json')\n convert_to_json(featurizer_list, 'featurizers.json')",
"def main(gtfs_file, input_json_file):\... | [
"0.608436",
"0.6008992",
"0.59380484",
"0.5935062",
"0.5781285",
"0.5768037",
"0.5759169",
"0.57256293",
"0.57182896",
"0.5655328",
"0.5653805",
"0.56392854",
"0.5626525",
"0.55395234",
"0.5531216",
"0.5497599",
"0.5481104",
"0.54802907",
"0.5461012",
"0.5456868",
"0.5416904"... | 0.73920244 | 0 |
Run the webp converter on off of the png files. | def generate_webp_textures():
input_files = PNG_TEXTURES['input_files']
output_files = PNG_TEXTURES['output_files']
if not os.path.exists(TEXTURE_PATH):
os.makedirs(TEXTURE_PATH)
for png, out in zip(input_files, output_files):
if needs_rebuild(png, out):
convert_png_image_to_webp(png, out, WEBP_QU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n argvs = sys.argv\n argc = len(argvs)\n if argc == 1:\n print('usage: convert2png.py <path/to/*.ppm> ...')\n sys.exit(1)\n\n os.makedirs('result/convert2png', exist_ok=True)\n\n for i in range(1, argc):\n img = cv2.imread(argvs[i])\n\n # root, ext = os.path.s... | [
"0.6570944",
"0.64156437",
"0.61769783",
"0.5975264",
"0.5974723",
"0.5941165",
"0.59038806",
"0.5838966",
"0.58314997",
"0.5811597",
"0.5809414",
"0.5798533",
"0.5736212",
"0.56903666",
"0.56399405",
"0.56066835",
"0.557636",
"0.557636",
"0.5565635",
"0.5556461",
"0.55448854... | 0.70537895 | 0 |
Delete all the processed webp textures. | def clean_webp_textures():
for webp in PNG_TEXTURES['output_files']:
if os.path.isfile(webp):
os.remove(webp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean():\n clean_flatbuffer_binaries()\n clean_webp_textures()",
"def delete(self):\n\t\tif self.hasUdim:\n\t\t\tfor a in self.udimPaths:\n\t\t\t\ta.delete()\n\t\telse:\n\t\t\tsuper( textureFile, self ).delete()",
"def destroy(self):\n\n self.cmapTexture.destroy()\n\n for tex in (self.modul... | [
"0.70913655",
"0.6556138",
"0.6525104",
"0.6477908",
"0.6368207",
"0.6253116",
"0.62028897",
"0.6191404",
"0.6172181",
"0.6160886",
"0.6124062",
"0.6107779",
"0.60488415",
"0.60330206",
"0.6033018",
"0.6028536",
"0.6020569",
"0.6011445",
"0.5983217",
"0.590569",
"0.5905648",
... | 0.8128452 | 0 |
Delete all the processed flatbuffer binaries. | def clean_flatbuffer_binaries():
for element in FLATBUFFERS_CONVERSION_DATA:
for json in element.input_files:
path = processed_json_path(json)
if os.path.isfile(path):
os.remove(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean():\n clean_flatbuffer_binaries()\n clean_webp_textures()",
"def clean(self):\n # Delete vertices / faces / colors / normals :\n self._vert_buffer.delete()\n self._index_buffer.delete()\n self._normals_buffer.delete()\n self._xrange_buffer.delete()\n self._mat... | [
"0.7080938",
"0.6617103",
"0.64717567",
"0.6464323",
"0.6414247",
"0.6351224",
"0.6346113",
"0.6323048",
"0.6296938",
"0.62765425",
"0.6252906",
"0.6217102",
"0.61619747",
"0.61525744",
"0.6143297",
"0.6128095",
"0.6123065",
"0.6101668",
"0.60976034",
"0.6087722",
"0.6086085"... | 0.7819535 | 0 |
Prints an error message to stderr for BuildErrors. | def handle_build_error(error):
sys.stderr.write('Error running command `%s`. Returned %s.\n' % (
' '.join(error.argv), str(error.error_code))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(message):\n print(message, file=sys.stderr)",
"def perror(message):\n print(message, file=sys.stderr)",
"def error(*args, **kwargs): # pragma: nocover\n kwargs['file'] = sys.stderr\n print(\"\\n\\tERROR:\", *args, **kwargs)\n if args and args[0].startswith(\"[Errno 2] No such file or ... | [
"0.70509905",
"0.6726131",
"0.6711041",
"0.6696196",
"0.6692284",
"0.6691786",
"0.6670899",
"0.6622568",
"0.65966165",
"0.65933764",
"0.65801626",
"0.65647084",
"0.65214205",
"0.65149754",
"0.6462072",
"0.6449125",
"0.6441902",
"0.64412487",
"0.64282566",
"0.6401715",
"0.6378... | 0.7691449 | 0 |
Plots the color mapping together with the fixed points. Creates a movie file. | def tracer_movie(datadir = 'data/', tracerFile = 'tracers.dat',
fixedFile = 'fixed_points.dat', zlim = [],
head_size = 3, hm = 1,
imageDir = './', movieFile = 'fixed_points.mpg',
fps = 5.0, bitrate = 1800):
import pylab as plt
# read the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show(self, view = None, save = False, savename = None, cmap = None):\n\n # define the style\n if cmap == None:\n style = PlotStyle(cmap_name = 'macplus')\n else:\n style = PlotStyle(cmap_name = cmap)\n \n # default is skymap\n if view == None:... | [
"0.66461504",
"0.6347427",
"0.6157591",
"0.6120898",
"0.6077686",
"0.60383564",
"0.6011217",
"0.59548956",
"0.59487545",
"0.594416",
"0.58821493",
"0.5876597",
"0.5861647",
"0.58368415",
"0.58342564",
"0.58336323",
"0.5828103",
"0.5826117",
"0.5800824",
"0.57943434",
"0.57858... | 0.72189265 | 0 |
Plots an image and the projections (sums) of it on the x, y axes. | def plot_image_and_proj(image, title="", **kwargs):
fig = plt.figure()
gs = gridspec.GridSpec(3, 2, width_ratios=[3, 1], height_ratios=[0.2, 3, 1])
ax0 = plt.subplot(gs[1,0])
plt.title(title)
ims = plt.imshow(image, aspect="auto", **kwargs)
ax2 = plt.subplot(gs[2,0], sharex=ax0, )
plt.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show(image):\n fig = pyplot.figure()\n ax = fig.add_subplot(1,1,1)\n imgplot = ax.imshow(image, cmap=mpl.cm.Greys)\n imgplot.set_interpolation('nearest')\n ax.xaxis.set_ticks_position('top')\n ax.yaxis.set_ticks_position('left')\n pyplot.show()",
"def show(image):\n fig = pyplot.figur... | [
"0.6885412",
"0.6744014",
"0.6729617",
"0.6729617",
"0.6729617",
"0.66539717",
"0.6561349",
"0.6445221",
"0.64222753",
"0.6366756",
"0.62954986",
"0.62783086",
"0.6277011",
"0.6251577",
"0.623828",
"0.62100685",
"0.62035716",
"0.6173411",
"0.6167177",
"0.61653167",
"0.6155882... | 0.7413701 | 0 |
Request data for a list of block hashes. | def send_get_data(self, block_hashes):
msg = msg_getdata()
for x in block_hashes:
msg.inv.append(CInv(MSG_BLOCK, x))
self.send_message(msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_blocks():\n chain_to_send = blockchain\n blocklist = \"\"\n for i in range(len(chain_to_send)):\n block = chain_to_send[i]\n block_index = str(block.index)\n block_timestamp = str(block.timestamp)\n block_data = str(block.data)\n block_hash = block.hash\n ... | [
"0.6409231",
"0.6145271",
"0.6124917",
"0.59927475",
"0.5951528",
"0.5827728",
"0.5783262",
"0.57184494",
"0.56973565",
"0.56766754",
"0.5650549",
"0.5647434",
"0.5635516",
"0.56190014",
"0.5569193",
"0.5569193",
"0.55531555",
"0.55520594",
"0.55443203",
"0.5535596",
"0.55184... | 0.70251316 | 0 |
Test whether the last headers announcements received are right. Headers may be announced across more than one message. | def check_last_headers_announcement(self, headers):
test_function = lambda: (len(self.recent_headers_announced) >= len(headers))
self.wait_until(test_function)
with p2p_lock:
assert_equal(self.recent_headers_announced, headers)
self.block_announced = False
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_bad_headers(self):\n\n headers = [self.sender, self.reply_to] + self.recipients\n for header in headers:\n if _has_newline(header):\n return True\n\n if self.subject:\n if _has_newline(self.subject):\n for linenum, line in enumerate(s... | [
"0.65723264",
"0.61208695",
"0.6049333",
"0.6003903",
"0.59692436",
"0.5896339",
"0.5871474",
"0.5851515",
"0.57597494",
"0.57581687",
"0.57434636",
"0.57434636",
"0.573652",
"0.57329977",
"0.5717457",
"0.5645279",
"0.55954987",
"0.55861056",
"0.55829144",
"0.555257",
"0.5521... | 0.8560445 | 0 |
Test whether the last announcement received had the right inv. inv should be a list of block hashes. | def check_last_inv_announcement(self, inv):
test_function = lambda: self.block_announced
self.wait_until(test_function)
with p2p_lock:
compare_inv = []
if "inv" in self.last_message:
compare_inv = [x.hash for x in self.last_message["inv"].inv]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def InventoryReceived(self, inventory):\n if inventory.Hash.ToBytes() in self._MissedBlocks:\n self._MissedBlocks.remove(inventory.Hash.ToBytes())\n\n if inventory is MinerTransaction:\n return False\n\n if type(inventory) is Block:\n if BC.Default() is None:\n... | [
"0.61076456",
"0.5824365",
"0.5646299",
"0.5420734",
"0.5327307",
"0.5240005",
"0.5224036",
"0.5191901",
"0.51852673",
"0.5120963",
"0.51135236",
"0.51021546",
"0.506925",
"0.5056993",
"0.50302124",
"0.49842632",
"0.4932219",
"0.4904889",
"0.49018604",
"0.48957723",
"0.487126... | 0.87524366 | 0 |
Mine count blocks and return the new tip. | def mine_blocks(self, count):
# Clear out block announcements from each p2p listener
[x.clear_block_announcements() for x in self.nodes[0].p2ps]
self.generatetoaddress(self.nodes[0], count, self.nodes[0].get_deterministic_priv_key().address)
return int(self.nodes[0].getbestblockhash(), ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_blocks(self): # -> int:\n ...",
"def getblocknumber(self):\n return self.getblockcount()",
"def calculate_tip(meal_base, tip_rate):",
"def getblockcount(self):\n return self.proxy.getblockcount()",
"def parent_block_count(self):\n return self.block_count",
"def parent_... | [
"0.5717195",
"0.5667572",
"0.56337124",
"0.5575411",
"0.5538822",
"0.55174536",
"0.54982716",
"0.5473228",
"0.53758806",
"0.5342303",
"0.53158927",
"0.5282329",
"0.521116",
"0.52065545",
"0.52049637",
"0.5188872",
"0.5170571",
"0.5148232",
"0.5138396",
"0.50767654",
"0.507296... | 0.6711444 | 0 |
Mine a reorg that invalidates length blocks (replacing them with length+1 blocks). | def mine_reorg(self, length):
# make sure all invalidated blocks are node0's
self.generatetoaddress(self.nodes[0], length, self.nodes[0].get_deterministic_priv_key().address)
for x in self.nodes[0].p2ps:
x.wait_for_block_announcement(int(self.nodes[0].getbestblockhash(), 16))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simple_reorg(self, height, shift=0):\n hashes = []\n fee_delta = 1000000\n orig_len = self.rpc.getblockcount()\n old_hash = self.rpc.getblockhash(height)\n if height + shift > orig_len:\n final_len = height + shift\n else:\n final_len = 1 + orig_l... | [
"0.57378554",
"0.5465236",
"0.5457202",
"0.5445514",
"0.54246277",
"0.5282873",
"0.52699226",
"0.5255896",
"0.5254636",
"0.52333164",
"0.51682156",
"0.5163101",
"0.51473725",
"0.5139157",
"0.5117177",
"0.5074714",
"0.5061125",
"0.50600505",
"0.50330913",
"0.50164944",
"0.5009... | 0.749667 | 0 |
Runs only the lyrics search. | def run_lyrics(self):
if self._GUI:
self._run_lyrics_gui()
else:
self._run_lyrics_nogui() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _run_lyrics_gui(self):\n self._log.info(\"Searching for lyrics\")\n\n self.save_lyrics(find=True)\n Action(\"load\", load=True)\n\n self._log.info(\"Done\")",
"def _run_lyrics_nogui(self):\n self.read_files()\n\n # find lyrics\n self._log_print(msg_GREEN=\"Sea... | [
"0.7195334",
"0.6765707",
"0.625291",
"0.5987377",
"0.595524",
"0.5927061",
"0.5899226",
"0.5836227",
"0.5817641",
"0.5816498",
"0.579893",
"0.574689",
"0.57248443",
"0.56937945",
"0.56414646",
"0.56008506",
"0.5592254",
"0.55891544",
"0.55754983",
"0.5552696",
"0.5535671",
... | 0.67778045 | 1 |
Runs only lyrics search with specifics of the GUI mode. | def _run_lyrics_gui(self):
self._log.info("Searching for lyrics")
self.save_lyrics(find=True)
Action("load", load=True)
self._log.info("Done") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_lyrics(self):\n if self._GUI:\n self._run_lyrics_gui()\n else:\n self._run_lyrics_nogui()",
"def _run_lyrics_nogui(self):\n self.read_files()\n\n # find lyrics\n self._log_print(msg_GREEN=\"Searching for lyrics\")\n\n self.save_lyrics()\n\n ... | [
"0.7300415",
"0.66114295",
"0.60927004",
"0.5863751",
"0.57411414",
"0.5515903",
"0.54406303",
"0.54393154",
"0.54014164",
"0.53518796",
"0.53172654",
"0.5292283",
"0.52921987",
"0.52903503",
"0.52819675",
"0.52603555",
"0.5241229",
"0.5237763",
"0.5199213",
"0.5194571",
"0.5... | 0.7690281 | 0 |
Performs check of Batch Job Definition container properties. | def _validate_container_properties(container_properties, prefix=None):
if not prefix:
prefix = 'container_properties'
container_config = [
{
'field_name': 'image',
'field_value': container_properties.get('image'),
'prefix': prefix,
'required_type'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_batch_jobdef(jobdef_name, jobdef_meta):\n jobdef_config = [\n {\n 'field_name': 'job_definition_name',\n 'field_value': jobdef_name,\n 'prefix': '',\n 'validators': [\n _validate_required_field\n ]\n },\n {\n... | [
"0.5902173",
"0.5750896",
"0.56742275",
"0.5597777",
"0.5589587",
"0.54979694",
"0.5465641",
"0.5424713",
"0.5351139",
"0.53396976",
"0.5328847",
"0.53148127",
"0.5310186",
"0.52777135",
"0.5270606",
"0.5264659",
"0.526109",
"0.52511007",
"0.5231011",
"0.52110624",
"0.5206256... | 0.5885001 | 1 |
Create a new DB table for the DataFrame | def create_db_dataframe(self, df, table_name):
try:
print("-I- Writing " + table_name + " with DataFrame")
df.to_sql(name=table_name, con=self.engine, if_exists='replace', index=True)
print("-I- Write complete.")
except Exception as e:
print("-W- " + str(e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_from_dataframe(self):\n self.insert()\n data = self.tbl.select()\n data.index.name = None\n tbl = Table.create(':memory:', \"Foo_2\", data, verbose=True,\n primary_key='id', autoincrement=True)\n self.check(self.idata, tbl.select())",
"... | [
"0.77422994",
"0.7363433",
"0.7361235",
"0.73389554",
"0.7315704",
"0.7284163",
"0.7265219",
"0.71784484",
"0.71592116",
"0.7123823",
"0.7109681",
"0.7104714",
"0.7104014",
"0.70893764",
"0.7065188",
"0.7056585",
"0.70464426",
"0.7045202",
"0.7043078",
"0.70418227",
"0.703520... | 0.7874062 | 0 |
Appends DataFrame to the specified table | def append_db_dataframe(self, df, table_name):
try:
print("-I- Appending " + table_name + " with DataFrame")
df.to_sql(name=table_name, con=self.engine, if_exists='append', index=True)
print("-I- Append complete.")
except Exception as e:
print("-W- " + str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_data(self, table_name, df):\n\t\tself.__check_colnames(table_name, df)\n\t\tif self.__dbfile is not None:\n\t\t\tdf.to_sql(table_name, self._conn, index=False, if_exists=\"append\")",
"def append_table(self, table):\n if not table:\n return\n\n indexes = []\n for idx in... | [
"0.7775088",
"0.7292738",
"0.71129256",
"0.6842862",
"0.67572284",
"0.65789384",
"0.6511594",
"0.6447779",
"0.6344674",
"0.6329825",
"0.6316417",
"0.63103884",
"0.63037944",
"0.62382275",
"0.6213505",
"0.6189217",
"0.6157169",
"0.6135792",
"0.60964775",
"0.60880053",
"0.60660... | 0.7644748 | 1 |
test_save_contact test case to test if the contact object is saved into the contact list | def test_save_contact(self):
# .save_contact() is the save to contact function.
# Test would check if an addition has been made to our contact list
self.new_contact.save_contact()
self.assertEqual(len(Contact.contact_list), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_save_contact(self):\n self.new_contact.save_contact() # saving the new contact\n self.assertEqual(len(Contact.contact_list), 1)",
"def test_save_multiple_contacts(self):\n self.new_contact.save_contact() # saving the new contact\n test_contact = Contact(\"Test\", \"User\", ... | [
"0.90264815",
"0.8396352",
"0.8371293",
"0.7489064",
"0.73771274",
"0.7365106",
"0.7324921",
"0.730443",
"0.7194348",
"0.7193277",
"0.7079255",
"0.70014966",
"0.69934404",
"0.6915084",
"0.691342",
"0.6848425",
"0.68055904",
"0.67810017",
"0.67704403",
"0.67631304",
"0.6691770... | 0.8957478 | 1 |
def test_save_multiple_contact to check if we can save multiple contacts to our contact_list | def test_save_multiple_contact(self):
self.new_contact.save_contact()
# new contact
test_contact = Contact("Test", "user", "0798765432", "test@user.com")
test_contact.save_contact()
self.assertEqual(len(Contact.contact_list), 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_save_multiple_contacts(self):\n self.new_contact.save_contact() # saving the new contact\n test_contact = Contact(\"Test\", \"User\", 254712345678, \"test@user.com\") # new user\n test_contact.save_contact() # saving the new contact\n self.assertEqual(len(Contact.contact_lis... | [
"0.91369456",
"0.8120368",
"0.80584645",
"0.73653406",
"0.70864254",
"0.70563537",
"0.7039114",
"0.70254576",
"0.6958467",
"0.68221486",
"0.68147147",
"0.6792331",
"0.66435987",
"0.65641314",
"0.6561918",
"0.65477175",
"0.6451238",
"0.6439873",
"0.64368606",
"0.6408157",
"0.6... | 0.9152661 | 0 |
test_delete_contact to test if we can remove a contact from our contact list | def test_delete_contact(self):
self.new_contact.save_contact()
# new contact
test_contact = Contact("Test", "user", "0745639300", "test@usr.com")
# new contact saved
test_contact.save_contact()
# For deleting the new contact
self.new_contact.delete_contact()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_contact(self):\n self.new_contact.save_contact()\n test_contact = Contact(\"Test\", \"User\", 254712345678, \"test@user.com\") # new contact\n test_contact.save_contact()\n self.new_contact.delete_contact() # delete a contact object\n self.assertEqual(len(Contac... | [
"0.87605715",
"0.8085114",
"0.766524",
"0.73715454",
"0.72436273",
"0.7203849",
"0.7119705",
"0.6994788",
"0.69293314",
"0.6898616",
"0.68878806",
"0.6867588",
"0.6844377",
"0.6803209",
"0.678051",
"0.6768761",
"0.67519003",
"0.67358315",
"0.67193764",
"0.66907907",
"0.668907... | 0.88033223 | 0 |
Test to check if we can return a Boolean if we cannot find the contact. | def test_contact_exists(self):
self.new_contact.save_contact()
# Test user
test_contact = Contact("Test", "user", "0722334455", "test@user.com")
# We save
test_contact.save_contact()
# variable that stores what we expect
contact_exists = Contact.contact_exist("07... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_is_workshop_contact(self, obj):\n user = self.context['request'].user\n if not user.is_authenticated:\n return False\n # pylint: disable=no-member\n profile = UserProfile.objects.get(user=user)\n return profile in obj.contacts.all()",
"def found(raise_error: ... | [
"0.6157852",
"0.6054971",
"0.60262066",
"0.5897116",
"0.58594185",
"0.5804995",
"0.5778651",
"0.57772166",
"0.56551945",
"0.563208",
"0.56082284",
"0.5526532",
"0.5509251",
"0.5509251",
"0.55092347",
"0.55092347",
"0.55092347",
"0.5499786",
"0.5489946",
"0.5465567",
"0.546275... | 0.6327621 | 0 |
Test to confirm that we are copying the email address from a found contact | def test_copy_email(self):
self.new_contact.save_contact()
Contact.copy_email("0712345678")
self.assertEqual(self.new_contact.email, pyperclip.paste())
# Below we are simply stating that if the module being tested is running we collect the test methods and execute them. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_copy_email(self):\n self.new_contact.save_contact()\n Contact.copy_email(254719702373)\n\n self.assertEqual(self.new_contact.email, pyperclip.paste())",
"def test_copy_email(self):\n\n\n self.new_credential.save_credential()\n Credential.copy_email(\"Chris\")\n\n ... | [
"0.83343744",
"0.7601879",
"0.6900183",
"0.6812739",
"0.6561415",
"0.6468561",
"0.6455767",
"0.64429235",
"0.6356866",
"0.6320259",
"0.62970245",
"0.62465024",
"0.6236399",
"0.6219535",
"0.6197941",
"0.6197167",
"0.6179059",
"0.6178218",
"0.61507607",
"0.6110539",
"0.60834587... | 0.7637972 | 1 |
partial_distance_covariance_test(x, y, z, num_resamples=0, exponent=1, random_state=None) Test of partial distance covariance independence. Compute the test of independence based on the partial distance covariance, for two random vectors conditioned on a third. The test is a permutation test where the null hypothesis i... | def partial_distance_covariance_test(x, y, z, **kwargs):
# pylint:disable=too-many-locals
random_state = _random_state_init(kwargs.pop("random_state", None))
# B
num_resamples = kwargs.pop("num_resamples", 0)
_check_kwargs_empty(kwargs)
# Compute U-centered matrices
u_x = _dcor_internals.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_coeffvar(self):\n self.assertEqual(coeffvar(list1, sample=False), np.std(list1) /\n np.mean(list1))\n self.assertEqual(coeffvar(list1), np.std(list1, ddof=1) /\n np.mean(list1))",
"def test_exact_two_qubit_cnot_decompose_random(self, seed):\n... | [
"0.5698384",
"0.53769475",
"0.5372643",
"0.52613395",
"0.51615024",
"0.5145563",
"0.50757515",
"0.50168383",
"0.4970485",
"0.4894757",
"0.484348",
"0.48419997",
"0.48381978",
"0.48207268",
"0.48052663",
"0.47089332",
"0.470408",
"0.46567678",
"0.463776",
"0.46216598",
"0.4603... | 0.8479564 | 0 |
Creates an SSL keyfile and returns the path. | def CreateKeyFile():
keyfile = tempfile.mkstemp()[1]
cmd = [
'openssl',
'genrsa',
'-out', keyfile,
'2048'
]
_RunCommand(cmd)
return keyfile | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _keypath(self) -> pathlib.Path:\n home = pathlib.Path.home()\n keyfile = home / \".cmdc\" / \"apikey\"\n keyfile.parent.mkdir(parents=True, exist_ok=True)\n return keyfile",
"def generate_key():\r\n # generating key\r\n key = Fernet.generate_key()\r\n\r\n key_dir = os.pat... | [
"0.6690019",
"0.640222",
"0.63990533",
"0.63100165",
"0.6247914",
"0.6236544",
"0.622373",
"0.61842155",
"0.6159797",
"0.6129716",
"0.6111204",
"0.6094071",
"0.6050029",
"0.60403",
"0.60227233",
"0.6010699",
"0.5991577",
"0.59733444",
"0.59372234",
"0.5916288",
"0.5860859",
... | 0.7345631 | 0 |
Creates an SSL CSR file and returns the path. | def CreateCsrFile(keyfile):
csrfile = tempfile.mkstemp()[1]
cmd = [
'openssl',
'req',
'-new',
'-key', keyfile,
'-out', csrfile,
'-subj', '/C=NA/ST=NA/L=NA/O=Chromium/OU=Test/CN=chromium.org'
]
_RunCommand(cmd)
return csrfile | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateCrtFile(keyfile, csrfile):\n crtfile = tempfile.mkstemp()[1]\n cmd = [\n 'openssl',\n 'x509',\n '-req',\n '-days', '1',\n '-in', csrfile,\n '-signkey', keyfile,\n '-out', crtfile\n ]\n _RunCommand(cmd)\n return crtfile",
"def create_csr(dn):\n tmp_file = f... | [
"0.76157844",
"0.7091698",
"0.682195",
"0.66409546",
"0.64632416",
"0.64031243",
"0.6295008",
"0.6232049",
"0.6201246",
"0.6178768",
"0.61259174",
"0.61010826",
"0.6063991",
"0.5976694",
"0.5963608",
"0.5935446",
"0.58889717",
"0.58795524",
"0.58761525",
"0.5852114",
"0.57947... | 0.7676574 | 0 |
Creates an SSL CRT file and returns the path. | def CreateCrtFile(keyfile, csrfile):
crtfile = tempfile.mkstemp()[1]
cmd = [
'openssl',
'x509',
'-req',
'-days', '1',
'-in', csrfile,
'-signkey', keyfile,
'-out', crtfile
]
_RunCommand(cmd)
return crtfile | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _retrieve_crt_path(haproxy_base_dir, listener, primary_cn):\n confs_dir = os.path.abspath(os.path.normpath(haproxy_base_dir))\n confs_path = os.path.join(confs_dir, listener.id)\n if haproxy_base_dir and listener.id:\n if not os.path.isdir(confs_path):\n os.makedirs(confs_path, 0o755... | [
"0.6699168",
"0.6504106",
"0.6388449",
"0.6253104",
"0.62328863",
"0.6191254",
"0.6086789",
"0.60492927",
"0.6046661",
"0.5963553",
"0.5953179",
"0.59513456",
"0.57639164",
"0.5744498",
"0.5647329",
"0.56415385",
"0.56214416",
"0.561746",
"0.55993444",
"0.55791825",
"0.553878... | 0.71155643 | 0 |
Creates an SSL PEM file and returns the path. | def CreatePemFile():
keyfile = CreateKeyFile()
csrfile = CreateCsrFile(keyfile)
crtfile = CreateCrtFile(keyfile, csrfile)
pemfile = tempfile.mkstemp()[1]
with open(keyfile) as k:
with open(crtfile) as c:
with open(pemfile, 'wb') as p:
p.write('%s\n%s' % (k.read(), c.read()))
return pemfile | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ca_file(tmpdir):\n key = rsa.generate_private_key(public_exponent=65537, key_size=2048)\n public_key = key.public_key()\n\n builder = x509.CertificateBuilder()\n builder = builder.subject_name(\n x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, \"pyopenssl.org\")])\n )\n builder = bu... | [
"0.66648823",
"0.6361533",
"0.62127554",
"0.6201686",
"0.61935896",
"0.6074794",
"0.6025097",
"0.5998469",
"0.5896556",
"0.5884485",
"0.5839449",
"0.5786212",
"0.5751437",
"0.57417154",
"0.5737081",
"0.57288885",
"0.57241213",
"0.5713234",
"0.56344074",
"0.55794954",
"0.55756... | 0.7334299 | 0 |
Transform from one radial coordinate to another. Note that this coordinate conversion is only strictly valid inside of the LCFS. | def rad_coord_transform(x,name_in,name_out, geqdsk):
if name_in == name_out:
return x
if 'r_V' not in geqdsk['fluxSurfaces']['geo']:
R0 = geqdsk['RMAXIS']
eq_vol = geqdsk['fluxSurfaces']['geo']['vol']
r_V = np.sqrt(eq_vol/(2*np.pi**2*R0))
geqdsk['fluxSurfaces']['geo']['r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deg2rad_inplace(a):",
"def convert(self, lat, lon):\r\n a = self.a\r\n b = self.b\r\n long0 = self.long0\r\n k0 = self.k0\r\n dx = self.dx\r\n\r\n e = (1 - b ** 2 / a ** 2) ** 0.5\r\n e2 = e ** 2 / (1 - e ** 2)\r\n n = (a - b) / (a + b)\r\n nu = ... | [
"0.6106413",
"0.5955033",
"0.5679703",
"0.5614722",
"0.56037164",
"0.55267453",
"0.54864424",
"0.5467077",
"0.5389721",
"0.5381061",
"0.5360404",
"0.535843",
"0.535422",
"0.5338711",
"0.53266436",
"0.5319456",
"0.53012145",
"0.52922064",
"0.52901214",
"0.52864665",
"0.5284524... | 0.6349656 | 0 |
Transformation to apply on each notebook. You should return modified nb, resources. If you wish to apply your transform on each cell, you might want to overwrite transform_cell method instead. | def call(self, nb, resources):
self.log.debug("Applying transform: %s", self.__class__.__name__)
try :
for worksheet in nb.worksheets:
for index, cell in enumerate(worksheet.cells):
worksheet.cells[index], resources = self.transform_cell(cell, resources, i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_cell(self, cell, resources, index):\n\n raise NotImplementedError('should be implemented by subclass')\n return cell, resources",
"def cell_preprocessor(function):\n\n @functools.wraps(function)\n def wrappedfunc(nb: NotebookNode, resources: dict) -> (NotebookNode, dict):\n ... | [
"0.585268",
"0.57084334",
"0.56029147",
"0.5561479",
"0.5502522",
"0.5467713",
"0.5347716",
"0.52935684",
"0.52670693",
"0.5254548",
"0.5215245",
"0.52104896",
"0.51687974",
"0.5122487",
"0.50810003",
"0.50767034",
"0.50586015",
"0.5045944",
"0.4984737",
"0.49372816",
"0.4937... | 0.76527107 | 0 |
Overwrite if you want to apply a transformation on each cell. You should return modified cell and resource dictionary. | def transform_cell(self, cell, resources, index):
raise NotImplementedError('should be implemented by subclass')
return cell, resources | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(self, nb, resources):\n self.log.debug(\"Applying transform: %s\", self.__class__.__name__)\n try :\n for worksheet in nb.worksheets:\n for index, cell in enumerate(worksheet.cells):\n worksheet.cells[index], resources = self.transform_cell(cell, ... | [
"0.65440035",
"0.5804093",
"0.57728004",
"0.57344264",
"0.5611276",
"0.5597317",
"0.5579851",
"0.5579851",
"0.5579851",
"0.55642366",
"0.55408597",
"0.54695153",
"0.5432807",
"0.5426063",
"0.53927785",
"0.53927785",
"0.53927785",
"0.53927785",
"0.53927785",
"0.53927785",
"0.5... | 0.70315164 | 0 |
Publish flow to OpenML server. Returns | def publish(self):
xml_description = self._generate_flow_xml()
file_elements = {'description': xml_description}
return_code, return_value = _perform_api_call(
"flow/", file_elements=file_elements)
self.flow_id = int(xmltodict.parse(return_value)['oml:upload_flow']['oml:id'])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish(self):\n return",
"def publish():\n pass",
"def publish(self, waypoints): \n lane = Lane()\n lane.header.frame_id = '/world'\n lane.header.stamp = rospy.Time(0)\n lane.waypoints = waypoints\n self.final_waypoints_pub.publish(lane)",
"def _generate_flow... | [
"0.637059",
"0.6307481",
"0.5872563",
"0.5749436",
"0.56772095",
"0.56606215",
"0.5617935",
"0.55418754",
"0.552572",
"0.5460382",
"0.54280865",
"0.54070175",
"0.53559107",
"0.5355898",
"0.5346886",
"0.53458697",
"0.5340997",
"0.53381914",
"0.53381914",
"0.5327639",
"0.529557... | 0.7366736 | 0 |
Checks if a flow exists for the given model and possibly creates it. If the given flow exists on the server, the flowid will simply be returned. Otherwise it will be uploaded to the server. Returns | def _ensure_flow_exists(self):
import sklearn
flow_version = 'sklearn_' + sklearn.__version__
_, _, flow_id = _check_flow_exists(self._get_name(), flow_version)
# TODO add numpy and scipy version!
if int(flow_id) == -1:
return_code, response_xml = self.publish()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def create_flow(self, flow: \"FlowObject\") -> UUID:\n return await self.create_flow_from_name(flow.name)",
"async def create_flow_from_name(self, flow_name: str) -> UUID:\n flow_data = FlowCreate(name=flow_name)\n response = await self._client.post(\n \"/flows/\", json=flow... | [
"0.63103426",
"0.5682208",
"0.5225242",
"0.513043",
"0.49558088",
"0.49539042",
"0.48757178",
"0.4860312",
"0.48489386",
"0.48403105",
"0.4821129",
"0.48097745",
"0.48096967",
"0.4789475",
"0.47876206",
"0.47869292",
"0.47778752",
"0.47659418",
"0.4671119",
"0.46696758",
"0.4... | 0.69185144 | 0 |
Read the data in from xyz.csv add two new columns, one to calculate dollar flux, and the other to calculate percentage flux return as a list of tuples | def calculate_flux(XYZ: str) -> list:
df = pd.read_csv(XYZ)
df['Dollar Flux'] = df['12/31/20'] - df['12/31/19']
df['Percentage Flux'] = df['12/31/20'] / df['12/31/19'] - 1
return list(tuple(df.loc[i]) for i in range(df.shape[0])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_flux(XYZ: str) -> list:\n\n\n data = pd.read_csv(XYZ,dtype={'12/31/2020': int,'12/31/2019': int})\n\n data['dollar_flux'] = data.iloc[:,1].sub(data.iloc[:,2])\n data['pct_flux'] = data.iloc[:,[-2,1]].pct_change(axis=1).dropna(axis=1)\n\n\n return list(data.to_records(index=False))",
"de... | [
"0.685175",
"0.6411039",
"0.62081707",
"0.6109357",
"0.60995525",
"0.5916653",
"0.5815268",
"0.58103406",
"0.5806701",
"0.5740641",
"0.57309264",
"0.571921",
"0.570458",
"0.5695528",
"0.5673751",
"0.56716675",
"0.5653346",
"0.5641983",
"0.5631174",
"0.5611434",
"0.56070626",
... | 0.70332384 | 0 |
Run gdal_merge using an external process. | def run_merge(*src, argv=None):
tmpdir = tempfile.mkdtemp()
inputs = []
for i, drv in enumerate(src):
if type(drv) != str:
tmppath = os.path.join(tmpdir, "input_%s.tif" % i)
drv.write(tmppath)
inputs.append(tmppath)
else:
inputs.append(src)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_gdal_util(util_name,\n gdal_path=None,\n src_files='',\n src_band=None,\n dst_file=None,\n options={}):\n # define specific options\n _opt_2b_in_quote = [\"-mo\", \"-co\"]\n\n # get the gdal installed path i... | [
"0.6366613",
"0.6252653",
"0.5960626",
"0.59505725",
"0.5807357",
"0.5765494",
"0.57650673",
"0.5709829",
"0.563321",
"0.5595598",
"0.55921483",
"0.5452208",
"0.5446093",
"0.54422516",
"0.5391504",
"0.5345127",
"0.5292853",
"0.52140045",
"0.5213958",
"0.51817507",
"0.5178978"... | 0.7390473 | 0 |
Create inital launcher with angle 45 degrees and velocity 40 win is the GraphWin to draw the launcher in. | def __init__(self, win):
# draw the base shot of the launcher
base = Circle(Point(0,0), 3)
base.setFill("red")
base.setOutline("red")
base.draw(win)
# save the window and create initial angle and velocity
self.win = win
self.angle = radians(45.0)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, win): \r\n\r\n # draw the base shot of the launcher \r\n base = Circle(Point(0,0), 3) \r\n base.setFill('red')\r\n base.setOutline('red')\r\n base.draw(win) \r\n\r\n # save the window and create initial angle and velocity\r\n self.win = win \r\n ... | [
"0.73945683",
"0.6352571",
"0.5805394",
"0.579472",
"0.5572521",
"0.55596024",
"0.5541648",
"0.5446335",
"0.54389066",
"0.5437201",
"0.5429614",
"0.54086167",
"0.54053193",
"0.5386864",
"0.5362621",
"0.53455466",
"0.5335464",
"0.53260404",
"0.52860785",
"0.52791184",
"0.52733... | 0.7478532 | 0 |
undraw the arrow and draw a new one for the current values of angle and velocity. | def redraw(self):
self.arrow.undraw()
pt2 = Point(self.vel*cos(self.angle), self.vel*sin(self.angle))
self.arrow = Line(Point(0,0), pt2).draw(self.win)
self.arrow.setArrow("last")
self.arrow.setWidth(3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redraw(self): \r\n\r\n self.arrow.undraw() \r\n pt2 = Point(self.vel*cos(self.angle), self.vel*sin(self.angle))\r\n self.arrow = Line(Point(0,0), pt2).draw(self.win) \r\n self.arrow.setArrow('last')\r\n self.arrow.setWidth(3)",
"def get_quiver_arrows(self):\n dif_x =... | [
"0.77334005",
"0.65644336",
"0.6287359",
"0.6213265",
"0.61974335",
"0.6153086",
"0.5998839",
"0.5908423",
"0.5908423",
"0.59016716",
"0.5891196",
"0.58837223",
"0.5872633",
"0.5846972",
"0.58233887",
"0.5820985",
"0.5800393",
"0.57933944",
"0.5788004",
"0.5777631",
"0.575778... | 0.7731802 | 1 |
change angle by amt degrees | def adjAngle(self, amt):
self.angle = self.angle+radians(amt)
self.redraw() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjAngle(self, amt): \r\n\r\n self.angle = self.angle + radians(amt)\r\n self.redraw()",
"def angle(self) -> float:\n ...",
"def angle(self, angle_deg) -> None:\n ...",
"def rotateDegrees(angle):\n rotate(angle *2*math.pi / 360)",
"def angle(self) -> int:",
"def angle(s... | [
"0.8125653",
"0.7635241",
"0.7557885",
"0.75281644",
"0.751763",
"0.7443927",
"0.73215574",
"0.7298224",
"0.72973174",
"0.7293998",
"0.7246493",
"0.72278506",
"0.7201105",
"0.7193929",
"0.7187989",
"0.7185721",
"0.7136344",
"0.71154463",
"0.71035147",
"0.7098545",
"0.7091846"... | 0.79394275 | 1 |
win is the GraphWin to display the shot, angle, velocity, and height are initial projectile parameters. | def __init__(self, win, angle, velocity, height):
self.proj = Projectile(angle, velocity, height)
self.marker = Circle(Point(0,height), 3)
self.marker.setFill("red")
self.marker.setOutline("red")
self.marker.draw(win) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, win):\n \n # draw the base shot of the launcher\n base = Circle(Point(0,0), 3)\n base.setFill(\"red\")\n base.setOutline(\"red\")\n base.draw(win)\n\n # save the window and create initial angle and velocity\n self.win = win\n self.an... | [
"0.61466646",
"0.611178",
"0.60369253",
"0.59023196",
"0.58787185",
"0.58351535",
"0.5771538",
"0.5740812",
"0.5733873",
"0.5672222",
"0.5656955",
"0.5644705",
"0.563213",
"0.55671704",
"0.554327",
"0.54865324",
"0.54692745",
"0.54463905",
"0.5439828",
"0.5418802",
"0.5388303... | 0.61944795 | 0 |
Testing eratosthenes function in task 559 | def test_task559_eratosthenes(number, expected_value):
assert algo.Task559.eratosthenes(number) == expected_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eratosthenes(x):\n multiples = []\n for i in range(2, x+1):\n if i not in multiples:\n print (i)\n for j in range(i*i, x+1, i):\n multiples.append(j)",
"def main():\n doctest.testmod()\n print(eratosthenes(2))",
"def eratosthenes2(n):\n multiples =... | [
"0.7555729",
"0.7525924",
"0.7279653",
"0.7068233",
"0.6793754",
"0.6754159",
"0.6716757",
"0.66996837",
"0.66710955",
"0.657833",
"0.6571549",
"0.6510445",
"0.64366025",
"0.6392734",
"0.62452984",
"0.62227535",
"0.6184394",
"0.6181353",
"0.61811525",
"0.61747223",
"0.616319"... | 0.7610841 | 0 |
Testing mersen_numbers function in task 559 | def test_task559_mersen_number(number, expected_value):
assert algo.Task559.mersen_numbers(number) == expected_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_numbers(number):\n print(\"\\nRunning test_numbers with {}\".format(number))",
"def test_numbers(self):\n \n result = gen_expansion(sym.pi, 2)\n self.assertEqual(result, '14')\n result = gen_expansion(sym.exp(1), 2)\n self.assertEqual(result, '72')",
"def test_angl... | [
"0.5994305",
"0.58658266",
"0.5729014",
"0.56989163",
"0.5615644",
"0.5593863",
"0.5531031",
"0.55126804",
"0.54742104",
"0.5439089",
"0.543804",
"0.54284734",
"0.54218674",
"0.54073083",
"0.5352614",
"0.5331817",
"0.53211087",
"0.5284186",
"0.5279782",
"0.52637136",
"0.52580... | 0.7466113 | 0 |
treq should be lazy imported since importing treq will install reactor. twisted.web.client.HTTPConnectionPool is patched here too. | def get_treq():
patch_twisted_http_connection_pool_bug()
import treq
return treq | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fake_twisted_request(*args, **kwargs):\n kwargs.setdefault(\n 'Request', lambda channel: Request(channel=channel, queued=False))\n request = fake_nevow_request(*args, **kwargs)\n request.finish = lambda: next(request.finish.counter)\n request.finish.counter = itertools.count()\n return re... | [
"0.5803267",
"0.5696364",
"0.565525",
"0.554367",
"0.5538993",
"0.5526741",
"0.55221415",
"0.54777414",
"0.54584825",
"0.54484373",
"0.5435534",
"0.5435227",
"0.5414661",
"0.5396609",
"0.53723156",
"0.53629166",
"0.53303",
"0.5325433",
"0.5303499",
"0.5299356",
"0.5226295",
... | 0.81258976 | 0 |
Given an instance retrieve the expected test configurations for instance's datastore. | def expected_instance_datastore_configs(instance_id):
instance = instance_info.dbaas.instances.get(instance_id)
datastore_type = instance.datastore['type']
datastore_test_configs = CONFIG.get(datastore_type, {})
return datastore_test_configs.get("configurations", {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_configuration_details_from_instance_validation(self):\n print(\"instance_info.id: %s\" % instance_info.id)\n inst = instance_info.dbaas.instances.get(instance_info.id)\n configuration_id = inst.configuration['id']\n print(\"configuration_info: %s\" % configuration_id)\n ... | [
"0.6595712",
"0.641086",
"0.63042694",
"0.59832126",
"0.5969446",
"0.5716063",
"0.56343365",
"0.55800563",
"0.549223",
"0.5459904",
"0.5443902",
"0.52584755",
"0.52367705",
"0.52236694",
"0.5125736",
"0.5114252",
"0.51125515",
"0.5100617",
"0.5088254",
"0.50832015",
"0.508082... | 0.82026744 | 0 |
Returns the expected test configurations for the default datastore defined in the Test Config as dbaas_datastore. | def expected_default_datastore_configs():
default_datastore = CONFIG.get('dbaas_datastore', None)
datastore_test_configs = CONFIG.get(default_datastore, {})
return datastore_test_configs.get("configurations", {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expected_instance_datastore_configs(instance_id):\n instance = instance_info.dbaas.instances.get(instance_id)\n datastore_type = instance.datastore['type']\n datastore_test_configs = CONFIG.get(datastore_type, {})\n return datastore_test_configs.get(\"configurations\", {})",
"def ... | [
"0.778061",
"0.63270247",
"0.6234825",
"0.6132579",
"0.5991797",
"0.5882307",
"0.58755237",
"0.58285725",
"0.58114976",
"0.5798612",
"0.5786422",
"0.5751315",
"0.57506293",
"0.57444537",
"0.5743285",
"0.5723634",
"0.5672421",
"0.56719977",
"0.566023",
"0.5647218",
"0.5636959"... | 0.9044427 | 0 |
Test create configurations with invalid values. | def test_configurations_create_invalid_values(self):
values = '{"this_is_invalid": 123}'
try:
instance_info.dbaas.configurations.create(
CONFIG_NAME,
values,
CONFIG_DESC)
except exceptions.UnprocessableEntity:
resp, body = i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_configurations_create_invalid_value_type(self):\n values = '{\"key_buffer_size\": \"this is a string not int\"}'\n assert_unprocessable(instance_info.dbaas.configurations.create,\n CONFIG_NAME, values, CONFIG_DESC)",
"def test_configurations_create_value_out_of_... | [
"0.7433865",
"0.73964936",
"0.71891207",
"0.715679",
"0.7153514",
"0.70355123",
"0.6980659",
"0.6954836",
"0.6950144",
"0.69497925",
"0.6934946",
"0.6908571",
"0.68892264",
"0.68862695",
"0.6879564",
"0.68716174",
"0.6868052",
"0.6838863",
"0.68274814",
"0.67229503",
"0.67174... | 0.83784807 | 0 |
Test create configuration with invalid value type. | def test_configurations_create_invalid_value_type(self):
values = '{"key_buffer_size": "this is a string not int"}'
assert_unprocessable(instance_info.dbaas.configurations.create,
CONFIG_NAME, values, CONFIG_DESC) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_configurations_create_invalid_values(self):\n values = '{\"this_is_invalid\": 123}'\n try:\n instance_info.dbaas.configurations.create(\n CONFIG_NAME,\n values,\n CONFIG_DESC)\n except exceptions.UnprocessableEntity:\n ... | [
"0.79776704",
"0.71556807",
"0.7127362",
"0.7073835",
"0.70391345",
"0.6960719",
"0.6936632",
"0.6775403",
"0.6733872",
"0.67331606",
"0.6680334",
"0.665938",
"0.6640967",
"0.6639813",
"0.66186374",
"0.66141385",
"0.6563347",
"0.65561086",
"0.65486705",
"0.6546909",
"0.653990... | 0.85598314 | 0 |
Test create configuration with value out of bounds. | def test_configurations_create_value_out_of_bounds(self):
expected_configs = self.expected_default_datastore_configs()
values = json.dumps(expected_configs.get('out_of_bounds_over'))
assert_unprocessable(instance_info.dbaas.configurations.create,
CONFIG_NAME, values,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_creation_outside_bounds():\n with pytest.raises(ValueError) as __:\n value = 42\n __ = param.Integer(value=value, hardbounds=[0, 41])",
"def test_creation_incorrect_hardbounds_count():\n with pytest.raises(ValueError) as __:\n value = 1\n __ = pa... | [
"0.73345673",
"0.7262614",
"0.709626",
"0.6822857",
"0.6742535",
"0.67301244",
"0.66877306",
"0.6641707",
"0.65475726",
"0.6366669",
"0.63600886",
"0.6332785",
"0.63235784",
"0.62723964",
"0.62111956",
"0.61827594",
"0.61725974",
"0.6138109",
"0.6133746",
"0.6107105",
"0.6103... | 0.8452791 | 0 |
test assigning a configuration to an instance | def test_assign_configuration_to_valid_instance(self):
print("instance_info.id: %s" % instance_info.id)
print("configuration_info: %s" % configuration_info)
print("configuration_info.id: %s" % configuration_info.id)
config_id = configuration_info.id
instance_info.dbaas.instances.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_property_success(self):\r\n self.config.option1 = 9001\r\n self.assertEqual(self.config.values['option1'], 9001)\r\n\r\n self.config.option2 = 'bar'\r\n self.assertEqual(self.config.values['option2'], 'bar')",
"def test_assign_configuration_to_instance_with_config(self):\... | [
"0.73201257",
"0.722626",
"0.71452546",
"0.71109563",
"0.7043339",
"0.69083005",
"0.68408525",
"0.6799425",
"0.6775065",
"0.6765029",
"0.6743073",
"0.6678476",
"0.66665244",
"0.6651853",
"0.66037625",
"0.66030836",
"0.6543711",
"0.6542435",
"0.64977694",
"0.64900345",
"0.6489... | 0.774803 | 0 |
test assigning a configuration to an instance conflicts | def test_assign_configuration_to_instance_with_config(self):
config_id = configuration_info.id
assert_raises(exceptions.BadRequest,
instance_info.dbaas.instances.modify, instance_info.id,
configuration=config_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_assign_configuration_to_valid_instance(self):\n print(\"instance_info.id: %s\" % instance_info.id)\n print(\"configuration_info: %s\" % configuration_info)\n print(\"configuration_info.id: %s\" % configuration_info.id)\n config_id = configuration_info.id\n instance_info.... | [
"0.7306956",
"0.6951928",
"0.6661572",
"0.6550587",
"0.6458475",
"0.6450685",
"0.6450343",
"0.6390336",
"0.6361332",
"0.63590527",
"0.6295276",
"0.62598777",
"0.6243222",
"0.6216796",
"0.61950976",
"0.6121061",
"0.61144525",
"0.6114061",
"0.60864514",
"0.60847384",
"0.6062219... | 0.7328827 | 0 |
test that a new instance will apply the configuration on create | def test_start_instance_with_configuration(self):
global configuration_instance
databases = []
databases.append({"name": "firstdbconfig", "character_set": "latin2",
"collate": "latin2_general_ci"})
databases.append({"name": "db2"})
configuration_instance... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_instance(self):\n with self.assertRaises(exceptions.NoInitiation):\n Config()",
"def test_create(self):\n pass",
"def test_assign_configuration_to_valid_instance(self):\n print(\"instance_info.id: %s\" % instance_info.id)\n print(\"configuration_info: %s\"... | [
"0.7183207",
"0.6918183",
"0.68747693",
"0.67909354",
"0.66707224",
"0.6631046",
"0.6573294",
"0.655102",
"0.64721066",
"0.6381421",
"0.63577807",
"0.63453907",
"0.6345164",
"0.63238394",
"0.6323695",
"0.6323695",
"0.6323695",
"0.6312962",
"0.62646854",
"0.6260534",
"0.624123... | 0.7056933 | 1 |
wait for the instance created with configuration | def test_instance_with_configuration_active(self):
def result_is_active():
instance = instance_info.dbaas.instances.get(
configuration_instance.id)
if instance.status in CONFIG.running_status:
return True
else:
assert_equal("BU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __create(self):\n pass\n\n # create at cluster-provider\n # get kubeconfig\n # wait for api\n # ^ could be async and seperate steps?",
"async def _config_async(self):\n pass",
"def test_start_instance_with_configuration(self):\n global configuration_instance... | [
"0.6413858",
"0.6308735",
"0.6107467",
"0.5980934",
"0.59375745",
"0.5925346",
"0.5910224",
"0.5910224",
"0.5906443",
"0.5879241",
"0.58150035",
"0.5814853",
"0.58117807",
"0.5788292",
"0.57844514",
"0.5767152",
"0.5764334",
"0.574734",
"0.57401824",
"0.57239306",
"0.57191616... | 0.6520709 | 0 |
test to unassign configuration from instance | def test_unassign_configuration_from_instances(self):
instance_info.dbaas.instances.update(configuration_instance.id,
remove_configuration=True)
resp, body = instance_info.dbaas.client.last_response
assert_equal(resp.status, 202)
instance_inf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deconfigure(self):\n\n pass",
"def test_unassign_configuration_after_patch(self):\n instance_info.dbaas.instances.update(instance_info.id,\n remove_configuration=True)\n assert_equal(202, instance_info.dbaas.last_http_code)\n instance = ... | [
"0.7048801",
"0.6946879",
"0.6614459",
"0.649544",
"0.6400702",
"0.63704515",
"0.6354921",
"0.63240206",
"0.63082576",
"0.63082576",
"0.63082576",
"0.63082576",
"0.63082576",
"0.63082576",
"0.63082576",
"0.63082576",
"0.63082576",
"0.63082576",
"0.6148849",
"0.6103507",
"0.61... | 0.7414041 | 0 |
test that after restarting the instance it becomes active | def test_restart_service_should_return_active(self):
instance_info.dbaas.instances.restart(instance_info.id)
resp, body = instance_info.dbaas.client.last_response
assert_equal(resp.status, 202)
def result_is_active():
instance = instance_info.dbaas.instances.get(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_workflows_restart(self):\n pass",
"def restart(self) -> None:",
"def restart(self):",
"def test_update_instances_schedule_state(self):\n pass",
"def restart(self):\r\n pass",
"def restart(self):\n pass",
"def test_relaunch_deployment_run(self):\n pass",
"de... | [
"0.7256215",
"0.696777",
"0.69622266",
"0.68948066",
"0.6872024",
"0.68592834",
"0.6850953",
"0.67642987",
"0.66722554",
"0.6623265",
"0.6588452",
"0.64710295",
"0.6453188",
"0.64142096",
"0.63846517",
"0.6372318",
"0.6364346",
"0.6354914",
"0.6351463",
"0.635094",
"0.6344332... | 0.7464111 | 0 |
Return a given noise sim. Provide either 'psa' or all of 'season', 'pa', and 'patch' . Will return a stack of enmaps with shape [n_freqs, 3, Ny, Nx], where the second element has the elements (T, Q, U). n_freqs will be 1 for pa1 and pa2. | def getActpolSim(iterationNum = 0, patch = 'deep5',
season = 's13', \
array = 'pa1', \
psa = None,\
noiseDictFile = 'templateInputsMr3c.dict', \
noiseDictFilePath = os.path.join(os.path.dirname(os.path.abspath(__file__)),'../inputPara... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_many_fits(spectrum,rms,guesses,nruns):\n tk_fit = []\n tex_fit = []\n ntot_fit = []\n width_fit = []\n for i in range(nruns):\n noisy_spectrum = add_noise(spectrum,rms)\n noisy_spectrum.specfit(fittype='cold_ammonia',guesses=guesses,fixed=[F,F,F,F,F,T])\n parcopy =... | [
"0.5349266",
"0.534863",
"0.5337738",
"0.5226224",
"0.5186345",
"0.5164142",
"0.5131979",
"0.5094437",
"0.50330424",
"0.5022629",
"0.5019019",
"0.49728072",
"0.49429372",
"0.4927111",
"0.49185708",
"0.49174252",
"0.491209",
"0.48873687",
"0.4871158",
"0.486897",
"0.48670015",... | 0.6391047 | 0 |
The relative weight is used to determine how much we want to see the data of this VM. | def update_relative_weight(self):
self.relative_weight = 1
# Add up all of the historical cpu datapoints (higher CPU = more weight)
for i in self.cpu_datapoints:
self.relative_weight += i
# Multiply by the status value (so VMs with red alarm have most weight)
self.rel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight(self):\n return self._base.weight",
"def get_weight(self):\n pass",
"def get_weight(self):\n pass",
"def weight(self):\r\n return self._weight",
"def weight(self) -> float:\r\n return self._weight",
"def weight(self):",
"def weight(self):\n return se... | [
"0.76758707",
"0.75917065",
"0.75917065",
"0.7509697",
"0.7506455",
"0.74212307",
"0.74037105",
"0.74037105",
"0.74037105",
"0.7399485",
"0.7393575",
"0.7339185",
"0.7339185",
"0.7282254",
"0.72358805",
"0.7191375",
"0.7191375",
"0.7191375",
"0.7191375",
"0.7191375",
"0.71913... | 0.77360976 | 0 |
Exchange the authorization code for an access token. | def exchange_token(self, code):
access_token_url = OAUTH_ROOT + '/access_token'
params = {
'client_id': self.client_id,
'client_secret': self.client_secret,
'redirect_uri': self.redirect_uri,
'code': code,
}
resp = requests.get(access_token... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exchange_code(self, code):\n data = {\n 'client_id': self.client_id,\n 'client_secret': self.client_secret,\n 'grant_type': 'authorization_code',\n 'code': code,\n 'redirect_uri': self.redirect_uri,\n 'scope': 'identify'\n }\n\n ... | [
"0.7655848",
"0.72651523",
"0.7153681",
"0.71138126",
"0.70811975",
"0.7071909",
"0.7048902",
"0.7033969",
"0.70338416",
"0.69557816",
"0.6936204",
"0.6890346",
"0.6886055",
"0.68474656",
"0.68372333",
"0.6788539",
"0.67677724",
"0.67472637",
"0.67402524",
"0.66617274",
"0.66... | 0.78054535 | 0 |
Optimise & Modifiy s3xml etree to and produce s3ocr etree | def s3ocr_etree(self):
s3xml_etree = self.resource.struct(options=True,
references=True,
stylesheet=None,
as_json=False,
as_tree=True)
# xml tags
ITEXT = "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_s3_xsl(**kwargs):\n access_id = kwargs.get(\"access_id\")\n access_secret = kwargs.get(\"access_secret\")\n bucket = kwargs.get(\"bucket\")\n dest_prefix = kwargs.get(\"destination_prefix\")\n source_prefix = kwargs.get(\"source_prefix\")\n if kwargs.get(\"dag\"):\n run_id = ... | [
"0.6150906",
"0.51852006",
"0.508772",
"0.50787896",
"0.50765",
"0.5073153",
"0.5026106",
"0.50156415",
"0.49646425",
"0.49586073",
"0.4957999",
"0.4951361",
"0.4915427",
"0.49097997",
"0.48692062",
"0.48484707",
"0.4826902",
"0.47564453",
"0.47277948",
"0.47235677",
"0.47011... | 0.6966398 | 0 |
Update custom fieldtype specific settings into the etree | def __update_custom_fieldtype_settings(self,
eachfield, #field etree
):
# xml attributes
TYPE = "type"
READABLE = "readable"
WRITABLE = "writable"
LABEL = "label"
HINT = "comment"
DEFAU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __update_custom_field_settings(self,\n eachfield, #field etree\n resourcetablename,\n fieldname\n ):\n\n # xml attributes\n TYPE = \"type\"\n ... | [
"0.72086793",
"0.5807909",
"0.53538555",
"0.5347925",
"0.53453594",
"0.52939373",
"0.5225218",
"0.521721",
"0.521721",
"0.521721",
"0.521721",
"0.521721",
"0.517917",
"0.51706946",
"0.51572657",
"0.5152697",
"0.513768",
"0.5122455",
"0.5120483",
"0.51168615",
"0.5108007",
"... | 0.78392935 | 0 |
Update custom field specific settings into the etree | def __update_custom_field_settings(self,
eachfield, #field etree
resourcetablename,
fieldname
):
# xml attributes
TYPE = "type"
READABLE = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __update_custom_fieldtype_settings(self,\n eachfield, #field etree\n ):\n\n # xml attributes\n TYPE = \"type\"\n READABLE = \"readable\"\n WRITABLE = \"writable\"\n LABEL = \"label\"\n HINT = \... | [
"0.7209946",
"0.5625204",
"0.55950165",
"0.5523595",
"0.54563826",
"0.5431626",
"0.53579104",
"0.5331359",
"0.5295891",
"0.5295891",
"0.5295891",
"0.5295891",
"0.5295891",
"0.5272213",
"0.5268226",
"0.52631927",
"0.5263186",
"0.52535546",
"0.52160764",
"0.52101666",
"0.517815... | 0.72390586 | 0 |
Helper to trim off any enclosing paranthesis | def __trim(self, text):
if isinstance(text, str) and \
text[0] == "(" and \
text[-1] == ")":
text = text[1:-1]
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeOuterParentheses(self, S):\n _open, _close = \"(\", \")\"\n oc, cc = 0, 0\n part, res = \"\", \"\"\n\n for i, p in enumerate(S):\n if p == _open:\n oc += 1\n elif p == _close:\n cc += 1\n\n part += p\n\n ... | [
"0.73211086",
"0.7262523",
"0.7182982",
"0.710938",
"0.68146855",
"0.67114186",
"0.66600233",
"0.6646801",
"0.66210675",
"0.63920456",
"0.6388178",
"0.6297051",
"0.6198644",
"0.61323136",
"0.6124953",
"0.6042619",
"0.6026883",
"0.59085965",
"0.58875585",
"0.58423495",
"0.5814... | 0.7543117 | 0 |
Generate barcode of uuid | def barcode(self, uuid):
barcode = code128.Code128(str(uuid), barWidth=1, barHeight=20)
barcode.drawOn(self.canvas, self.lastx, self.lasty)
self.lasty = self.lasty - 20
self.y = self.lasty | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_generate_barcode_upce(self):\n pass",
"def gen_uuid() -> str:\n return str(uuid4())",
"def gen_uuid():\n return str( uuid.uuid4() )",
"def gen_uuid():\n return str( uuid.uuid4() )",
"def gen_uuid():\n return str(uuid.uuid4())",
"def test_generate_barcode_qr_code(self):\n ... | [
"0.7014342",
"0.6803592",
"0.6756756",
"0.6756756",
"0.67063415",
"0.66737944",
"0.6648601",
"0.6631629",
"0.65757394",
"0.6569812",
"0.6564768",
"0.6560364",
"0.6551317",
"0.65252805",
"0.6519483",
"0.64701307",
"0.6449104",
"0.6431399",
"0.63647515",
"0.63552344",
"0.634510... | 0.70955324 | 0 |
Writes one character on canvas | def writechar(self, char=" "):
font=self.selectfont(char)
t = self.canvas.beginText(self.x, self.y)
t.setFont(font, self.fontsize)
t.setFillGray(self.gray)
t.textOut(char)
self.canvas.drawText(t)
return t | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writechar(self, char: int, /) -> None:",
"def point(self, x, y, char):\n assert len(char) == 1\n assert x >= 0\n assert x < self.cols\n assert y >= 0\n assert y < self.lines\n\n self.canvas[y][x] = char",
"def draw(self, x, y, char=None, fg=(255, 255, 255), bg=None... | [
"0.73790383",
"0.7066766",
"0.68195283",
"0.6806944",
"0.67353094",
"0.67342776",
"0.6577753",
"0.657208",
"0.65341264",
"0.63544863",
"0.62962973",
"0.6283854",
"0.6271442",
"0.62612313",
"0.6221333",
"0.61874944",
"0.6184578",
"0.61663246",
"0.61465734",
"0.6140425",
"0.603... | 0.7528636 | 0 |
Select font according to the input character | def selectfont(self, char):
charcode = ord(char)
for font in fontchecksequence:
for fontrange in fontmapping[font]:
if charcode in xrange(fontrange[0], fontrange[1]):
return font
return "Helvetica" # fallback, if no thirdparty font is installed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectFont():\n font,ok = QtGui.QFontDialog.getFont()\n if ok:\n return font\n else:\n return None",
"def get_font(self, option):\n return get_font(option=option)",
"def comdlg32_ChooseFont(jitter, get_str, set_str):\n ret_ad, args = jitter.func_args_stdcall([\"lpcf\"])\n ... | [
"0.71344846",
"0.6802239",
"0.6530128",
"0.6522377",
"0.6478366",
"0.64376915",
"0.6403912",
"0.6403912",
"0.6403912",
"0.63943005",
"0.63856626",
"0.63823503",
"0.63529533",
"0.6318125",
"0.6304441",
"0.62798864",
"0.6212459",
"0.62093073",
"0.6207095",
"0.61832416",
"0.6175... | 0.8041888 | 0 |
Function to draw check boxes default no of boxes = 1 | def draw_check_boxes(self,
boxes=1,
completeline=0,
lines=0,
seek=0,
continuetext=0,
fontsize=15,
gray=0,
style="",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_checkboxes(self):\n self.create_y_crop_box()",
"def draw(self, surface):\n for box in self.checkboxes:\n box.draw(surface)",
"def _create_checkboxes(self) -> widgets.VBox:\n checkboxes = []\n pgons_checkboxes = []\n graph_checkboxes = []\n\n graph... | [
"0.6706593",
"0.62596804",
"0.5975192",
"0.57803637",
"0.5758032",
"0.5719117",
"0.5667263",
"0.5657341",
"0.5637688",
"0.5620014",
"0.5609665",
"0.5569312",
"0.5564542",
"0.55392426",
"0.5529903",
"0.55119216",
"0.5509527",
"0.54798144",
"0.5429685",
"0.5427229",
"0.541907",... | 0.71929073 | 0 |
Generate ``model``specific synthesis script. | def generate_yosys_script(summary, renderer, ostream, model, model_sources, template = "synth.specific.tmpl.ys"):
renderer.add_generic( ostream, template,
model = model, model_sources = model_sources, yosys_script = summary.yosys["script"],
iteritems = iteritems, itervalues = itervalues ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_script(model: onnx.ModelProto, output_file: str = None) -> str:\n current_dir = os.path.dirname(os.path.realpath(__file__))\n env = jinja2.Environment(loader=jinja2.FileSystemLoader(current_dir + '/templates/'))\n model_header_render = gen_model_header(env, model)\n imports, main_function, sub_... | [
"0.71790755",
"0.61078423",
"0.6011807",
"0.5968458",
"0.5965008",
"0.5928381",
"0.59106827",
"0.5892473",
"0.58815545",
"0.5837325",
"0.5752082",
"0.57328606",
"0.5700278",
"0.5665125",
"0.5638353",
"0.5630792",
"0.5620719",
"0.5588311",
"0.55843246",
"0.556606",
"0.55422443... | 0.63034165 | 1 |
Adapt a CWL job object to the Galaxy API. CWL derived tools in Galaxy can consume a job description sort of like CWL job objects via the API but paths need to be replaced with datasets and records and arrays with collection references. This function will stage files and modify the job description to adapt to these chan... | def galactic_job_json(job, test_data_directory, upload_func, collection_create_func):
datasets = []
dataset_collections = []
def upload_file(file_path):
if not os.path.isabs(file_path):
file_path = os.path.join(test_data_directory, file_path)
_ensure_file_exists(file_path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def galactic_job_json(\n job, test_data_directory, upload_func, collection_create_func, tool_or_workflow=\"workflow\"\n):\n\n datasets = []\n dataset_collections = []\n\n def upload_file(file_path, secondary_files, **kwargs):\n file_path = abs_path_or_uri(file_path, test_data_directory)\n ... | [
"0.59139556",
"0.58567005",
"0.5696271",
"0.5631622",
"0.5470596",
"0.52659386",
"0.52299416",
"0.5168686",
"0.49637362",
"0.49448887",
"0.49375767",
"0.48854095",
"0.48788068",
"0.48770913",
"0.4875025",
"0.48702103",
"0.4839494",
"0.48336488",
"0.48224968",
"0.47955766",
"0... | 0.5963013 | 0 |
Convert objects in a Galaxy history into a CWL object. Useful in running conformance tests and implementing the cwlrunner interface via Galaxy. | def output_to_cwl_json(galaxy_output, get_metadata, get_dataset):
def element_to_cwl_json(element):
element_output = GalaxyOutput(
galaxy_output.history_id,
element["object"]["history_content_type"],
element["object"]["id"],
)
return output_to_cwl_json(ele... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __build_history(self, obj: Object) -> dict:\n previous_history = obj.history\n return {**previous_history, self.__get_timestamp(): {'type_id': obj.type_id, 'redshift': obj.redshift}}",
"def __build_history(self, obj: Object) -> dict:\n previous_history = dict(obj.history)\n return... | [
"0.5449591",
"0.53597903",
"0.53180766",
"0.5217686",
"0.5002477",
"0.48273036",
"0.48258838",
"0.47788423",
"0.47186252",
"0.4703909",
"0.46876624",
"0.46831584",
"0.46785995",
"0.46753672",
"0.46651852",
"0.46631747",
"0.46261874",
"0.45973223",
"0.45775396",
"0.455817",
"0... | 0.56445116 | 0 |
Run the EM algorithm. | def run_em(self, maxiter=400, tol=1e-4, verbose=True, regularization=0.0):
self.means = self.means.T
L = None
for i in xrange(maxiter):
newL = self._expectation()
if i == 0 and verbose:
print("Initial NLL =", -newL)
self._maximization(regular... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_em(self, r):\n self.tc.reset()\n self.pf.Y = r.T\n em_data = {}\n if self.print_mode:\n print 'The hessian trace is {}'.format(\n np.trace(self.tc.t_H.get_value()))\n\n print 'Running full EM'\n\n for u in range(self.n_itr):\n t... | [
"0.72161376",
"0.628836",
"0.6144694",
"0.61367214",
"0.6123989",
"0.60628617",
"0.60402554",
"0.6032735",
"0.60259813",
"0.60199857",
"0.59711766",
"0.5922304",
"0.59206814",
"0.5912053",
"0.5896723",
"0.5892612",
"0.58919305",
"0.58890396",
"0.58829486",
"0.58683765",
"0.58... | 0.6405142 | 1 |
The decorator method to be called on the class object. This method will set the proper `discoverable` type to the class. It should return the class passed in, according to the decorator spec. | def discoverable(_class):
# Set the attribute to the class name, to prevent subclasses from also
# being discoverable.
setattr(_class, _get_discoverable_attribute(_class), True)
return _class | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_class_discoverable(_class, default_discoverability=False):\n return bool(getattr(_class, _get_discoverable_attribute(_class),\n default_discoverability))",
"def not_discoverable(_class):\n\n # Set the attribute to the class name, to prevent subclasses from also\n # being no... | [
"0.6100534",
"0.5945838",
"0.5689444",
"0.5677215",
"0.56717265",
"0.55983895",
"0.55354106",
"0.5534171",
"0.55314434",
"0.5498857",
"0.54959726",
"0.5491333",
"0.54092",
"0.54038715",
"0.5341593",
"0.53414214",
"0.5279805",
"0.52688867",
"0.52337843",
"0.52116585",
"0.52032... | 0.70861286 | 0 |
The decorator method to be called on the class object. This method will set the proper `not discoverable` type to the class. It should return the class passed in, according to the decorator spec. | def not_discoverable(_class):
# Set the attribute to the class name, to prevent subclasses from also
# being not discoverable.
setattr(_class, _get_discoverable_attribute(_class), False)
return _class | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discoverable(_class):\n\n # Set the attribute to the class name, to prevent subclasses from also\n # being discoverable.\n setattr(_class, _get_discoverable_attribute(_class), True)\n return _class",
"def checktype(type):\n def decorator(klass):\n register_type(type, klass)\n ret... | [
"0.7026496",
"0.60254246",
"0.58712715",
"0.58391374",
"0.5762568",
"0.57158124",
"0.55842835",
"0.54794437",
"0.5475729",
"0.54330164",
"0.5426265",
"0.5411975",
"0.53922296",
"0.5384349",
"0.53761977",
"0.5354712",
"0.53032106",
"0.52928644",
"0.5277489",
"0.5265347",
"0.52... | 0.7357723 | 0 |
Returns true if the class is marked discoverable | def is_class_discoverable(_class, default_discoverability=False):
return bool(getattr(_class, _get_discoverable_attribute(_class),
default_discoverability)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_discoverable_attribute(_class):\n return \"__{}_is_discoverable\".format(_class.__name__)",
"def discoverable(_class):\n\n # Set the attribute to the class name, to prevent subclasses from also\n # being discoverable.\n setattr(_class, _get_discoverable_attribute(_class), True)\n return _... | [
"0.69203067",
"0.6642737",
"0.62106764",
"0.6052726",
"0.5998927",
"0.5970129",
"0.5938582",
"0.5887358",
"0.58857167",
"0.5808782",
"0.57919824",
"0.57619464",
"0.5701386",
"0.5670407",
"0.56579703",
"0.5640263",
"0.5625706",
"0.5594766",
"0.5586563",
"0.5519655",
"0.5512455... | 0.8230393 | 0 |
Get an attribute to set on a class to consider it discoverable | def _get_discoverable_attribute(_class):
return "__{}_is_discoverable".format(_class.__name__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discoverable(_class):\n\n # Set the attribute to the class name, to prevent subclasses from also\n # being discoverable.\n setattr(_class, _get_discoverable_attribute(_class), True)\n return _class",
"def get_attr(self, key: str) -> Any:\n raise NotImplementedError(\"This method should be impl... | [
"0.71000606",
"0.666556",
"0.6570846",
"0.653001",
"0.63913965",
"0.63654155",
"0.6253668",
"0.620802",
"0.6182992",
"0.6182578",
"0.6147421",
"0.61464113",
"0.61088574",
"0.60911614",
"0.608464",
"0.608464",
"0.6043526",
"0.60277534",
"0.6022185",
"0.6009808",
"0.60057694",
... | 0.74975735 | 0 |
Convert file to raw file. | def convert_to_raw(file):
img = Image.open(file)
img = img.convert('L') # convert to 8 bits per pixels
(x, y) = img.size
pixels = bytearray(list(img.getdata()))
filename, file_extension = os.path.splitext(file)
file2 = file.replace(file_extension, '.dat')
file_name = str(x) + 'x' + str(y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_convert_file():\n try:\n str_out = io.BytesIO()\n str_out.write(process_text(request.data.decode('utf-8')).encode('utf-8'))\n str_out.seek(0)\n\n return send_file(\n str_out,\n attachment_filename='result.txt',\n as_attachment=True,\n ... | [
"0.64115816",
"0.6371769",
"0.6140477",
"0.5940787",
"0.5906996",
"0.57152784",
"0.562413",
"0.5623284",
"0.56161326",
"0.5604619",
"0.55842215",
"0.5559293",
"0.55592465",
"0.5539912",
"0.54099935",
"0.5399127",
"0.53941727",
"0.5383642",
"0.5368682",
"0.53505486",
"0.534988... | 0.6456368 | 0 |
Convert a raw file to jpg file. | def convert_to_jpg(raw_file):
match = re.match('(\d+)x(\d+)x(\d+)x(\d+)_(\w+)', raw_file)
if match:
# print(match.group(1))
# print(match.group(2))
# print(match.group(3))
# print(match.group(4))
# print(match.group(5))
x = int(match.group(1))
y = int(mat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_image_conversion_for_image_file(self):\n # Given\n with open(self.image_file_path) as f:\n # When\n result = convert_image_to_jpeg(f)\n img = Image.open(result)\n # Then\n self.assertEqual(JpegImageFile.format, img.format)\n self.... | [
"0.64591265",
"0.62869",
"0.5926924",
"0.5918034",
"0.56613654",
"0.5598152",
"0.5569632",
"0.5559631",
"0.5479805",
"0.54383266",
"0.54034483",
"0.5335417",
"0.53307116",
"0.52239347",
"0.51870555",
"0.51752836",
"0.5163474",
"0.5141427",
"0.51402164",
"0.5122234",
"0.507653... | 0.6899732 | 0 |
Wrapper function on top of the interpolation executable. It is also a benchmarking function, it returns the name of the output image and the time needed to do all the iterations | def interpolate(file_in, file_out, device, iterations, interpolation_type, new_width, new_height):
command_string = './Interpolate ' + device + ' ' + str(iterations) + ' ' + interpolation_type + ' ' + file_in + ' ' + file_out + ' ' + str(new_width) + ' ' + str(new_height)
program_out = str(subprocess.check_ou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def problem2():\n\n data = loaddata(\"data/bayerdata.npy\")\n r, g, b = separatechannels(data)\n\n img = assembleimage(r, g, b)\n display_image(img)\n\n img_interpolated = interpolate(r, g, b)\n display_image(img_interpolated)",
"def Resampler(name):\n\n def resample_average(path, dsquery, dsti... | [
"0.6005782",
"0.5990915",
"0.58582526",
"0.57174736",
"0.5715835",
"0.57075953",
"0.5687177",
"0.5644446",
"0.55878294",
"0.55830985",
"0.55769694",
"0.55724096",
"0.5563402",
"0.55316186",
"0.55314726",
"0.5511741",
"0.5504877",
"0.54847926",
"0.54411846",
"0.5347744",
"0.53... | 0.6844896 | 0 |
Benchmark cpu vs gpu time wise. | def benchmark_cpu_vs_gpu(input_raw_file):
nb_iterations = 20
(cpu1, f1) = interpolate(input_raw_file, 'cpu_nn_lena.dat', 'cpu', nb_iterations, 'nn', 4000, 2000)
(gpu1, f2) = interpolate(input_raw_file, 'gpu_nn_lena.dat', 'gpu', nb_iterations, 'nn', 4000, 2000)
(cpu2, f3) = interpolate(input_raw_file, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speed():\r\n\r\n algo = ['logistic_sgd', 'logistic_cg', 'mlp', 'convolutional_mlp',\r\n 'dA', 'SdA', 'DBN', 'rbm', 'rnnrbm']\r\n to_exec = [True] * len(algo)\r\n# to_exec = [False] * len(algo)\r\n# to_exec[-1] = True\r\n do_float64 = True\r\n do_float32 = True\r\n do_gpu = True\... | [
"0.7225633",
"0.695674",
"0.68218005",
"0.6769229",
"0.6725079",
"0.6654836",
"0.6625746",
"0.65144086",
"0.647302",
"0.63773113",
"0.63309896",
"0.6302064",
"0.6302064",
"0.6302064",
"0.6184083",
"0.61827475",
"0.6167184",
"0.6167184",
"0.6167184",
"0.6154827",
"0.6154827",
... | 0.7135301 | 1 |
Check bit exactness on interpolation executable between Gpu vs Cpu with various parameters. | def check_bit_exactness(input_raw_file):
(t1, f1) = interpolate(input_raw_file, 'cpu_nn_lena.dat', 'cpu', 1, 'nn', 8000, 4000)
(t2, f2) = interpolate(input_raw_file, 'gpu_nn_lena.dat', 'gpu', 1, 'nn', 8000, 4000)
(t3, f3) = interpolate(input_raw_file, 'cpu_bl_lena.dat', 'cpu', 1, 'bl', 8000, 4000)
(t4, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cpu_gpu_result(self, precision=1e-1):\n res1 = run_infer(self.model, CASE_ROOT + \"/resnet_fluid_gpu.yaml\",\n self.input_data)\n res2 = run_infer(self.model, CASE_ROOT + \"/resnet_fluid_cpu.yaml\",\n self.input_data)\n result1 = res1[0]... | [
"0.640324",
"0.56350285",
"0.5585213",
"0.55641",
"0.5548312",
"0.55470926",
"0.5535607",
"0.5483092",
"0.547579",
"0.5412719",
"0.53335917",
"0.533129",
"0.53188753",
"0.5310341",
"0.53064054",
"0.53023964",
"0.53012884",
"0.529403",
"0.5288582",
"0.5288348",
"0.5280955",
... | 0.7583435 | 0 |
Setup an example users generator instance so can use the record | def setUp(self):
gen = UsersGenerator({})
gen.generate_adt_user()
self.record = gen.class_data.findall('record')[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n\n # Allocates users\n self.users = []\n self.user_session_tokens = []\n\n # Template for creating users\n user_template = {\n \"clientId\": 2,\n \"username\": \"user\",\n \"pwd\": \"password\",\n \"nameLast\": \"Last\",\n ... | [
"0.6956374",
"0.6918225",
"0.686735",
"0.6851119",
"0.67789096",
"0.67656577",
"0.66330135",
"0.6540279",
"0.6540279",
"0.6522282",
"0.6480351",
"0.64449173",
"0.64280057",
"0.63684684",
"0.6364395",
"0.63467336",
"0.63422114",
"0.63228506",
"0.6303323",
"0.63001335",
"0.6283... | 0.780119 | 0 |
Fetch organization details from the API. | def fetch_details_from_api(self, org_names=None):
logger.debug('Fetching org details from API...')
details = {}
if org_names is None:
org_names = self._all_page_names(without_namespace=True)
for org in org_names:
code = self._code_by_name(org)
if code ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_organization(organization):\n return fetch_json(organization_url, organization)",
"def test_get_organization(self):\n pass",
"def test_retrieve_l_organization(self):\n pass",
"def test_get_organization_from_api_key(self):\n pass",
"def get_organization(self, id: str) -> di... | [
"0.82742935",
"0.7215253",
"0.71555364",
"0.71401477",
"0.70368063",
"0.6870949",
"0.6747574",
"0.67154455",
"0.6695743",
"0.66767126",
"0.66356957",
"0.6629043",
"0.65509844",
"0.6486175",
"0.64638036",
"0.64497346",
"0.64293605",
"0.6352869",
"0.6321579",
"0.62873846",
"0.6... | 0.7452373 | 1 |
Create new organization category tree and pages. | def recreate_tree(self, fetch_from_api=False):
logger.debug('Creating organization category tree and pages...')
for parent, children in self._hierarchy(
fetch_from_api=fetch_from_api).items():
self._create_pages(parent)
parent_category = f'[[Category:{parent}]]'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_category_pages(app):\n env = app.builder.env\n\n template = \"category.html\"\n\n categories = env.categories\n for name, category in categories.iteritems():\n context = {}\n context[\"title\"] = category.name\n context[\"subcategories\"] = category.subcategories\n ... | [
"0.6847534",
"0.67013305",
"0.63725936",
"0.6334025",
"0.6069195",
"0.59774697",
"0.5846274",
"0.5729139",
"0.57264924",
"0.57257324",
"0.5705253",
"0.5705121",
"0.5620174",
"0.56092304",
"0.5568929",
"0.55641246",
"0.5545612",
"0.553405",
"0.5525433",
"0.55243224",
"0.551429... | 0.7765683 | 0 |
Nuke organization category tree and pages. | def nuke_tree(self):
logger.debug('Nuking organization category tree and pages...')
def recurse_delete(page):
if page.exists:
page_is_category = True
try:
page_members = page.members()
except AttributeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recreate_tree(self, fetch_from_api=False):\n logger.debug('Creating organization category tree and pages...')\n for parent, children in self._hierarchy(\n fetch_from_api=fetch_from_api).items():\n self._create_pages(parent)\n parent_category = f'[[Category:{pa... | [
"0.6612943",
"0.6476937",
"0.6362572",
"0.6236043",
"0.6191051",
"0.61242706",
"0.6083505",
"0.5918996",
"0.5907317",
"0.5860402",
"0.58141035",
"0.5798131",
"0.57252145",
"0.5720753",
"0.5695223",
"0.56784064",
"0.56283355",
"0.56238097",
"0.55597705",
"0.5531781",
"0.550324... | 0.7459369 | 0 |
Update organization pages from apografi API. | def update_pages(self, fetch_from_api=False, details=None,
force_create=False):
logger.debug('Updating organization pages...')
def template_text(org_details):
te = TemplateEditor(self.TEMPLATE)
template = te.templates[self.TEMPLATE_NAME][0]
# Add... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, organisation: Organisation) -> None:\n ...",
"def UpdateOrganizationSettings(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')",
"def update(self):\n... | [
"0.576033",
"0.5739277",
"0.5607183",
"0.55946696",
"0.5534071",
"0.54312897",
"0.53235763",
"0.53037417",
"0.5271056",
"0.5237154",
"0.51738906",
"0.5145725",
"0.51090777",
"0.51086265",
"0.5090848",
"0.50289696",
"0.49717492",
"0.49616772",
"0.49475837",
"0.4938556",
"0.493... | 0.6676893 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.