query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Parse an input specs into a jax.ShapeDtypeStruct.
def input_spec_to_jax_shape_dtype_struct( spec: Union[Tuple[Tuple[int, ...], jnp.dtype], Tuple[int, ...]], batch_size: Optional[int] = None) -> jax.ShapeDtypeStruct: spec = tuple(spec) if len(spec) == 2 and isinstance(spec[0], collections.abc.Iterable): shape = (batch_size,) + tuple(spec[0][1:]) if batc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_spec (spec_file):\n spec_object = None\n spec_name = spec_file.replace(\".\", \"_\")\n params = []\n default_params = {}\n int_conversion = []\n namedtuple = False\n delimiter = \"\\n\"\n\n spec_file = open(spec_file, \"r\")\n spec = spec_file.readlines()\n spec_file.close()...
[ "0.53998345", "0.5399715", "0.53511655", "0.52155787", "0.5175422", "0.50308526", "0.4997735", "0.4945539", "0.48813435", "0.48683077", "0.4854738", "0.485412", "0.4849468", "0.48474205", "0.4809551", "0.47939855", "0.4788989", "0.47868943", "0.47620076", "0.4761896", "0.4733...
0.6715354
0
Performs static analysis of the graph to compute theoretical FLOPs. One can also use the XProf profiler to get the actual FLOPs at runtime based on device counters. Theoretical FLOPs are more useful for comparing models across different library implementations and is hardwareagnostic.
def compute_flops(flax_model_apply_fn: Callable[[jnp.ndarray], Any], input_spec: Sequence[Union[Tuple[Tuple[int, ...], jnp.dtype], Tuple[int, ...], None]], fuse_multiply_add: bool) -> float: dummy_input = [] for spec in input_spec: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeFScores(self, targetLabels, actualLabels):\r\n if self.prMeasures is None:\r\n self.prMeasures = self.computePRMeasures(targetLabels, actualLabels)\r\n if self.prMeasures[0] == 0:\r\n return 0\r\n self.f1score = 2 * self.prMeasures[0] * self.prMeasures[...
[ "0.5671943", "0.566783", "0.5635351", "0.5540157", "0.54438156", "0.53901833", "0.5383728", "0.5367138", "0.53378254", "0.53330487", "0.5325549", "0.5321701", "0.5314026", "0.5289707", "0.5265528", "0.52629256", "0.52588695", "0.5254436", "0.5246063", "0.5239378", "0.52301675...
0.5317833
12
Load dataset from file '../data/dataset.txt' and transfer to a list.
def load_data(): with open('../data/dataset.txt', 'r') as data_file: return data_file.read().split('\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_datasets(filepath):\n\n data_file = open(filepath, 'r')\n data_list = data_file.readlines()\n data_file.close()\n\n return data_list", "def load_data(path_dataset):\n data = read_txt(path_dataset)[1:]\n return preprocess_data(data)", "def load_data(text_file) -> list:\n\n file = o...
[ "0.7310075", "0.7081436", "0.69368184", "0.6830235", "0.681044", "0.6765116", "0.6706157", "0.6666456", "0.6652845", "0.6651481", "0.664702", "0.6612349", "0.660296", "0.65759784", "0.6559554", "0.65574807", "0.65524375", "0.6543727", "0.6543159", "0.6526245", "0.651906", "...
0.8187677
0
Load stop words from file '../data/stop_words.txt' and transfer to a list.
def load_stop_words(): with open('../data/stop_words.txt', 'r') as stop_words_file: return stop_words_file.read().split()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_stop_words() -> list:\r\n with open(f'{ENGINE}/stop_words.txt', 'r') as i:\r\n stop_words = i.read().splitlines()\r\n stop_words = list(map(lambda x: x.upper(), stop_words)) # Force all stop words to UPPER case.\r\n return stop_words", "def load_stop_list():\n stop_list = []\n ...
[ "0.86854786", "0.85702604", "0.82870823", "0.8085797", "0.8026547", "0.80048776", "0.7859866", "0.7739571", "0.75412995", "0.75381225", "0.7501206", "0.74701536", "0.7468609", "0.7460182", "0.7407307", "0.7407307", "0.7407307", "0.7394937", "0.7389229", "0.7364115", "0.734005...
0.8828992
0
Generate a label list according to the first word in each line of dataset.
def generate_labels(): label_set = set([]) for data in load_data(): label = data.split(' ', 1)[0] label_set.add(label) labels = list(label_set) labels.sort() return labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data_labels(datasets):\n # Split by words\n x_text = datasets['data']\n x_text = [clean_str(sent) for sent in x_text]\n # Generate labels\n labels = [0, 1, 2, 3, 4]\n print(len(x_text))\n for i in range(len(x_text)):\n label = [0 for j in datasets['target_names']] \n ...
[ "0.67625064", "0.67520624", "0.67273957", "0.6714275", "0.6602932", "0.64764017", "0.6445512", "0.6442318", "0.64260095", "0.64215446", "0.6377378", "0.63764703", "0.63636106", "0.62697333", "0.6204013", "0.6184638", "0.616843", "0.6156621", "0.6108328", "0.6107273", "0.60736...
0.7592209
0
Write labels to file '../data/labels.txt', each line is a label
def write_labels(): with open('../data/labels.txt', 'w') as labels_file: labels = generate_labels() labels_file.write('\n'.join(labels))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_labels(self, labels: List[str], labels_path: Path):\n labels_path.write_text(escape_line_delimited_texts(labels))", "def _write_labels(self, labels: List[str], labels_path: Path):\n labels_path.write_text(escape_line_delimited_texts(labels))", "def SaveLabels(filepath, labels):\n # ...
[ "0.8117613", "0.8117613", "0.7926602", "0.78796244", "0.77901435", "0.7717908", "0.75571084", "0.73993284", "0.7089501", "0.70833546", "0.70000726", "0.6994793", "0.6964666", "0.69481635", "0.68660444", "0.68279904", "0.6752153", "0.66779125", "0.6638492", "0.6627301", "0.661...
0.92478794
0
Generate corpus from dataset, remove label from every question.
def generate_corpus(): data = load_data() questions = [s.split(' ', 1)[1].lower() for s in data] return questions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_text_classifier_del_training_samples_all(self):\n pass", "def create_corpus(df):\r\n corpus=[]\r\n for tweet in tqdm(df['text']):\r\n words=[word.lower() for word in word_tokenize(tweet) if((word.isalpha()==1))]\r\n corpus.append(words)\r\n return corpus", "def test_text_...
[ "0.6179051", "0.61695355", "0.612701", "0.60080475", "0.5991426", "0.5968233", "0.5966245", "0.5962449", "0.5961979", "0.5824949", "0.58028716", "0.57764983", "0.5754227", "0.57507855", "0.5742542", "0.57408285", "0.57311505", "0.57246226", "0.5599109", "0.5594712", "0.558772...
0.7546315
0
Generate vocabulary from dataset and count their frequency.
def generate_vocabulary(): stop_words = load_stop_words() words = ' '.join(generate_corpus()).split() print(len(words)) vocabulary = {} for word in words: if word in stop_words: continue if word in vocabulary.keys(): vocabulary[word] += 1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_dataset(words):\n count = []\n # count.extend(collections.Counter(words).most_common(n_words - 1))\n count.extend(collections.Counter(words).most_common())\n dictionary = dict()\n for word, _ in count:\n dictionary[word] = len(dictionary)\n data = list()\n # unk_count = 0\n for word in words:\...
[ "0.7119916", "0.69955856", "0.6780356", "0.67377347", "0.67227477", "0.6565314", "0.6564769", "0.6538594", "0.652457", "0.64863276", "0.64687914", "0.6460493", "0.64345866", "0.6428765", "0.6409645", "0.64018935", "0.6317153", "0.6303987", "0.62944937", "0.62928957", "0.62851...
0.6724139
4
Write vocabulary to '../data/vocabulary.txt', each line contains a word and its frequency.
def write_vocabulary(): with open('../data/vocabulary.txt', 'w') as vocabulary_file: vocabulary = generate_vocabulary() word_count = sum(vocabulary.values()) print(word_count) vocabs_str = [("%s %d" % (key, value)) for key, value in vocabulary.items()] vocabulary_file.write('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_vocab(vocab, path, encoding=\"Utf-8\"):\n with open(path, \"w\", encoding=encoding) as fout:\n for word, freq in vocab:\n fout.write(\"%s\\t%d\\n\" % (word, freq))", "def write_vocabulary(vocab_processor, outfile):\n vocab_size = len(vocab_processor.vocabulary_)\n with open(outfil...
[ "0.77696854", "0.76118624", "0.75237185", "0.74841684", "0.7428175", "0.7263195", "0.7193403", "0.7069946", "0.6974747", "0.6899833", "0.67634916", "0.67428726", "0.67143416", "0.66633344", "0.6374416", "0.63653886", "0.6339275", "0.6330938", "0.6319669", "0.631088", "0.62634...
0.8666452
0
Returns variable value from launch params
def get_action_var_val_from_launch_params(launch_vars, var_name): filtered_launch_vars = list( filter( lambda e: e["name"] == var_name, launch_vars, ) ) if len(filtered_launch_vars) > 1: LOG.error( "Unable to populate runtime editables: Multiple ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParameter(self, value):\n if value in self.commandLineDefaults:\n return self.commandLineDefaults[value]\n if value in self.defaults:\n return self.defaults[value]\n return None", "def get_parm_value(parameters, name, env_name, default_value):\n value = parame...
[ "0.65366197", "0.6387033", "0.6228277", "0.6148368", "0.6089504", "0.59744775", "0.5972712", "0.59664136", "0.59335375", "0.5925959", "0.58825845", "0.58721554", "0.58434135", "0.5822617", "0.5805199", "0.57746196", "0.576227", "0.5749721", "0.5739871", "0.57335603", "0.57299...
0.7026889
0
Returns patch arguments or variable data
def get_patch_runtime_args( app_uuid, deployments, patch_payload, ignore_runtime_variables, runtime_params_file ): patch_name = patch_payload["name"] patch_args = {} patch_args["patch"] = patch_payload patch_args["variables"] = [] attrs_list = patch_payload["attrs_list"] if ignore_runtim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_data(self):\n return get_json()", "def patch(self):\n return self._get(\"patch\")", "def arguments(self):\n return parse_arguments(self['data'])", "def punkte(self):\n return self.args", "def view_patch():\n\n return jsonify(\n get_dict(\"url\", \"args\", \"f...
[ "0.6376717", "0.635689", "0.5775939", "0.57362425", "0.5714351", "0.56508195", "0.55597174", "0.55584913", "0.54944223", "0.5489795", "0.5393315", "0.5366492", "0.53662485", "0.53613627", "0.5359275", "0.5359163", "0.5354778", "0.53506154", "0.53359705", "0.53352034", "0.5322...
0.64711076
0
Returns action arguments or variable data
def get_action_runtime_args( app_uuid, action_payload, patch_editables, runtime_params_file ): action_name = action_payload["name"] runtime_vars = {} runbook_vars = action_payload["runbook"].get("variable_list", None) or [] for _var in runbook_vars: editable_dict = _var.get("editables", No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action_params(self, a):\n return self.params[a]", "def get_args(self, action):\n\n def args_function(wildcards):\n result = {\n \"input\": {\n \"reads_left\": list(\n sorted(self._collect_reads(wildcards, wildcards.library_...
[ "0.6437903", "0.6257496", "0.623383", "0.62315136", "0.61940783", "0.61828846", "0.6014103", "0.60115045", "0.5947184", "0.5910995", "0.58544385", "0.5768185", "0.5747866", "0.57099986", "0.56821144", "0.56821144", "0.5678529", "0.56717134", "0.5665467", "0.5658113", "0.56555...
0.5925324
9
Download runlogs, given runlog uuid and app name
def download_runlog(runlog_id, app_name, file_name): client = get_api_client() app = _get_app(client, app_name) app_id = app["metadata"]["uuid"] if not file_name: file_name = "runlog_{}.zip".format(runlog_id) res, err = client.application.download_runlog(app_id, runlog_id) if not err:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_run_logs(id_, **kwargs):\n run = get_run_object(id_)\n check_run_permission(run, kwargs[\"token_info\"])\n query = \"ilyde-run-{}\".format(run.id)\n return query_elasticsearch(query)", "def download_workflow_log_files(repo, github_token, workflow_run_id, data_root_dir):\n headers = {...
[ "0.64194244", "0.59884953", "0.5788865", "0.57788175", "0.5744236", "0.5743501", "0.5706302", "0.5553888", "0.5492111", "0.5492111", "0.5474755", "0.5382931", "0.53668857", "0.53567404", "0.52949184", "0.5284501", "0.5284132", "0.52608335", "0.522752", "0.5216262", "0.5213479...
0.77006644
0
Creates an output layout to work with a layout of screens Creates a output layout, which can be used to describing outputs in physical space relative to one another, and perform various useful operations on that state.
def __init__(self) -> None: ptr = lib.wlr_output_layout_create() self._ptr = ffi.gc(ptr, lib.wlr_output_layout_destroy) self.add_event = Signal(ptr=ffi.addressof(ptr.events.add)) self.change_event = Signal(ptr=ffi.addressof(ptr.events.change)) self.destroy_event = Signal(ptr=ffi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_layout(self):\n\n pass", "def create_layout( self ):", "def make_layout(self):\n\n for h in range(0, self.num_layout_heads):\n self.set_random_layout(h)\n self.set_local_layout(h)\n self.set_global_layout(h)\n\n self.check_and_propagate_first_...
[ "0.65080345", "0.6411471", "0.6406481", "0.63220835", "0.62492615", "0.622953", "0.61851484", "0.6097497", "0.60499716", "0.601536", "0.58365935", "0.58044183", "0.5791375", "0.57711107", "0.5690821", "0.5674785", "0.5657845", "0.5563014", "0.5554139", "0.55327636", "0.551320...
0.56408554
17
Destroy the current output layout
def destroy(self) -> None: if self._ptr is not None: ffi.release(self._ptr) self._ptr = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy(self):\n self.window.destroy_output_panel(self.name)", "def remove(self, output: Output) -> None:\n lib.wlr_output_layout_remove(self._ptr, output._ptr)", "def destroy(self):\r\n if self.cur_message is not None:\r\n self.cur_message.destroy()\r\n self.cur_...
[ "0.77853394", "0.69212544", "0.6771963", "0.6771322", "0.6740442", "0.67121965", "0.6695389", "0.6649884", "0.66008115", "0.6560119", "0.6526077", "0.650882", "0.64833146", "0.6450388", "0.64317787", "0.6415468", "0.6410194", "0.64075977", "0.63597274", "0.63597274", "0.63597...
0.0
-1
Add an auto configured output to the layout This will place the output in a sensible location in the layout. The coordinates of the output in the layout may adjust dynamically when the layout changes. If the output is already in the layout, it will become auto configured. If the position of the output is set such as wi...
def add_auto(self, output: Output) -> None: lib.wlr_output_layout_add_auto(self._ptr, output._ptr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, output: Output, lx: int, ly: int) -> None:\n lib.wlr_output_layout_add(self._ptr, output._ptr, lx, ly)", "def move(self, output: Output, lx: int, ly: int) -> None:\n lib.wlr_output_layout_move(self._ptr, output._ptr, lx, ly)", "def output(self, layout: Optional[dict] = None) -> Outp...
[ "0.70198876", "0.63294667", "0.5761119", "0.56359804", "0.5577666", "0.55675364", "0.55489993", "0.5502449", "0.54143834", "0.53270626", "0.5263954", "0.5225019", "0.5154998", "0.5103272", "0.5067622", "0.50329566", "0.4984036", "0.49752924", "0.49733323", "0.49177164", "0.49...
0.80270034
0
Determine coordinates of the output in the layout Given x and y in layout coordinates, adjusts them to local output coordinates relative to the given reference output.
def output_coords(self, output: Output) -> tuple[float, float]: ox = ffi.new("double *") oy = ffi.new("double *") lib.wlr_output_layout_output_coords(self._ptr, output._ptr, ox, oy) return ox[0], oy[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_position(layout):\n\n if layout.children:\n toyplot_vertical_align = layout.style[\"-toyplot-vertical-align\"]\n # Align the first line's baseline with the anchor.\n if toyplot_vertical_align == \"first-baseline\":\n offset_y = 0\n # Ali...
[ "0.6292434", "0.60976356", "0.60090214", "0.5698411", "0.567165", "0.5587634", "0.5562373", "0.5496815", "0.54904616", "0.5438968", "0.5402502", "0.53729147", "0.53563195", "0.53547263", "0.53337777", "0.53318155", "0.53305453", "0.5305409", "0.5298191", "0.5286754", "0.52553...
0.6738363
0
Use the output layout in a context manager
def __enter__(self) -> OutputLayout: return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_layout(self):\n return", "def layout(self):\n pass", "def _generate_layout(self):\n\n pass", "def output(self, layout: Optional[dict] = None) -> OutputWidget:\n return OutputWidget(self, layout)", "def create_layout( self ):", "def context(subcontext=None) -> None:\n ...
[ "0.64091706", "0.6069155", "0.5997315", "0.5928173", "0.58884573", "0.5709779", "0.5672082", "0.5537715", "0.5532014", "0.5498159", "0.548384", "0.5475992", "0.5458588", "0.54453886", "0.53986293", "0.53619075", "0.53441685", "0.5322948", "0.53207755", "0.5281953", "0.5273164...
0.719726
0
Clean up the output layout when exiting the context
def __exit__(self, exc_type, exc_value, exc_tb) -> None: self.destroy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def horde_cleanup(self):", "def handle_caught(self):\n self.destroy()\n \n #---------------------------------------------------------------------------------------------------------------------------------------------------------#\n \n #-----------------------------------------...
[ "0.6551884", "0.650356", "0.6438108", "0.63920903", "0.63920903", "0.63920903", "0.63851225", "0.63832134", "0.63832134", "0.63832134", "0.63832134", "0.63832134", "0.63832134", "0.63832134", "0.63832134", "0.63832134", "0.63832134", "0.63832134", "0.63735616", "0.63735616", ...
0.0
-1
Get the output at the specified layout coordinates. Returns None if no output matches the coordinates.
def output_at(self, x: float, y: float) -> Output | None: output_ptr = lib.wlr_output_layout_output_at(self._ptr, x, y) if output_ptr == ffi.NULL: return None return Output(output_ptr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_coords(self, output: Output) -> tuple[float, float]:\n ox = ffi.new(\"double *\")\n oy = ffi.new(\"double *\")\n lib.wlr_output_layout_output_coords(self._ptr, output._ptr, ox, oy)\n\n return ox[0], oy[0]", "def get_output_by_name(self, name):\n for var in self.outpu...
[ "0.6571606", "0.5839956", "0.56035906", "0.54842794", "0.5437366", "0.5349081", "0.5301348", "0.5281909", "0.51899874", "0.5155416", "0.5151213", "0.51356196", "0.51304936", "0.5116058", "0.5116058", "0.5091115", "0.5090367", "0.5016866", "0.5016222", "0.49573547", "0.4944155...
0.7370843
0
Add the output to the layout at the specified coordinates. If the output is already part of the output layout, this moves the output.
def add(self, output: Output, lx: int, ly: int) -> None: lib.wlr_output_layout_add(self._ptr, output._ptr, lx, ly)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, output: Output, lx: int, ly: int) -> None:\n lib.wlr_output_layout_move(self._ptr, output._ptr, lx, ly)", "def add_node_output_locations(self, xy,epsgIN,start,end,step): \n nodeIds = self.grid.get_node_output_locations(xy,epsgIN)\n if(elementIds != []):\n se...
[ "0.6960685", "0.60513806", "0.60398746", "0.5813254", "0.575669", "0.56998533", "0.56029904", "0.5567559", "0.54616624", "0.5377717", "0.53622025", "0.5348922", "0.5346724", "0.5326581", "0.53180915", "0.5304156", "0.5291399", "0.52477604", "0.51817405", "0.5181331", "0.51578...
0.7201141
0
Move an output to specified coordinates.
def move(self, output: Output, lx: int, ly: int) -> None: lib.wlr_output_layout_move(self._ptr, output._ptr, lx, ly)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to(self, destination_coords):\n self.x = destination_coords[0]\n self.y = destination_coords[1]\n return", "def move(self, coordinates, direction):\n pass", "def instantiate_output_move(row, col, row_idx_bitwidth, col_idx_bitwidth):\n group_name = py_ast.CompVar(\n ...
[ "0.66784644", "0.64650375", "0.63968575", "0.6348587", "0.6258059", "0.6240109", "0.62277734", "0.62160134", "0.61788344", "0.6122616", "0.60436296", "0.60330397", "0.60210365", "0.59689134", "0.5945228", "0.59423894", "0.59325606", "0.5914747", "0.58816713", "0.5859127", "0....
0.7212036
0
Remove an output from the layout.
def remove(self, output: Output) -> None: lib.wlr_output_layout_remove(self._ptr, output._ptr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_layout(self, layout: Layout):\n self.layouts.pop(layout, None)", "def removeLayout(self, *args):\n return _libsbml.LayoutModelPlugin_removeLayout(self, *args)", "def removeOutput(self, *args):\n return _libsbml.Transition_removeOutput(self, *args)", "def destroy(self):\n ...
[ "0.7089926", "0.68975186", "0.6884714", "0.6528211", "0.63225365", "0.6296304", "0.6290189", "0.6283299", "0.62830955", "0.62702155", "0.626779", "0.62561774", "0.62509525", "0.6069614", "0.6065491", "0.6051975", "0.60506624", "0.5988264", "0.5982314", "0.59661174", "0.585206...
0.849233
0
Get the box of the layout for the given reference output in layout coordinates. If `reference` is None, the box will be for the extents of the entire layout. If the output isn't in the layout, the box will be empty.
def get_box( self, reference: Output | None = None, dest_box: Box | None = None ) -> Box: if reference: reference_ptr = reference._ptr else: reference_ptr = ffi.NULL if not dest_box: dest_box = Box(ptr=ffi.new("struct wlr_box *")) lib.wlr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounding_box(self):\n if not isinstance(self.ref_cell, Cell):\n return None\n if self.rotation is None or self.rotation % 90 == 0:\n cell_bbox = self.ref_cell.get_bounding_box()\n if cell_bbox is None:\n return None\n polygons = self....
[ "0.5901545", "0.58824706", "0.5489302", "0.5370161", "0.53481007", "0.5327489", "0.5279537", "0.5278215", "0.5267045", "0.51329285", "0.51328117", "0.5108612", "0.5098542", "0.5029901", "0.49236295", "0.49177372", "0.48856136", "0.48354876", "0.47964993", "0.47919694", "0.479...
0.7389529
0
Get the closest point on this layout from the given point from the reference output. If reference is NULL, gets the closest point from the entire layout.
def closest_point( self, lx: float, ly: float, reference: Output | None = None ) -> tuple[float, float]: if reference: reference_ptr = reference._ptr else: reference_ptr = ffi.NULL dest_lx = ffi.new("double *") dest_ly = ffi.new("double *") li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closest_point(self, point, maxdist=0.0, return_param=False):\n return self.xyz", "def closest_point_to(self, x):\n x = np.array(x)\n v = self.p1 - self.p0\n b = self.p0 - x\n\n t = -np.dot(v, b) / np.dot(v, v)\n if (0 <= t <= 1):\n closest = t*(self.p1 - s...
[ "0.68781555", "0.6766535", "0.6657588", "0.66149604", "0.6594103", "0.65055597", "0.64913166", "0.6426414", "0.64132017", "0.63651127", "0.62755954", "0.624393", "0.6239674", "0.62271637", "0.6206133", "0.60887647", "0.6084108", "0.60477453", "0.60337806", "0.6023641", "0.601...
0.76994383
0
Sets the current_state to the initial_state (0) and sets input_symbol to None.
def reset (self): self.currentState = self.initialState self.inputSymbol = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset_state(self):\n self.state = self.start_state.copy()", "def _reset_for_new_walk(self):\n # Starting State\n self.state = State('start', 0, 1, 0, 0, self.state_space_parameters.input_size, 0, 0, False)\n\n # Architecture String\n self.state_list = [self.state.copy()]",...
[ "0.65661925", "0.64960563", "0.6418424", "0.6401293", "0.6351065", "0.6345368", "0.6306686", "0.62734896", "0.6161061", "0.6148739", "0.6071161", "0.60412455", "0.6023714", "0.6023049", "0.6021861", "0.6006364", "0.598042", "0.5976253", "0.5970858", "0.5970858", "0.5970858", ...
0.83541876
0
This sets the default transition. This defines an action and next_state if the FSM cannot find the input symbol provided by the user and the current state in the transition list. The default transition can be removed by setting the attribute defaultTransition to None. In this case, for default the nextState will be the...
def setDefaultTransition (self, action, nextState): if nextState is not None: self.defaultTransition = (action, nextState) else: self.defaultTransition = (action, self.initialState)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTransition (self, inputSymbol, state):\n\n if (inputSymbol, state) in self.stateTransitions:\n return self.stateTransitions[(inputSymbol, state)]\n elif self.defaultTransition is not None:\n return self.defaultTransition\n else:\n raise ExceptionFSM ('Tr...
[ "0.5937508", "0.58190686", "0.5759606", "0.57087535", "0.5651682", "0.565062", "0.5649066", "0.56352", "0.5580734", "0.5491866", "0.5468211", "0.5421407", "0.53243065", "0.52767915", "0.5274182", "0.5246616", "0.5239235", "0.5184615", "0.51798594", "0.5175904", "0.5171481", ...
0.77794313
0
This method returns the tuples (action, next state) given an inputSymbol and state.
def getTransition (self, inputSymbol, state): if (inputSymbol, state) in self.stateTransitions: return self.stateTransitions[(inputSymbol, state)] elif self.defaultTransition is not None: return self.defaultTransition else: raise ExceptionFSM ('Transition is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_state(self, state, action):\n pass", "def p(self, next_state, state, action):\n\n return self._p[state, next_state, action]", "def process (self, inputSymbol):\n \n self.inputSymbol = inputSymbol\n (self.action, self.nextState) = self.getTransition (self.inputSymbol,...
[ "0.7005093", "0.6508219", "0.6507524", "0.6235809", "0.6222719", "0.6205359", "0.6205105", "0.60368776", "0.5969271", "0.5955513", "0.59514", "0.59455127", "0.5928941", "0.5909269", "0.5861482", "0.58402", "0.5836453", "0.58101356", "0.58081824", "0.58023584", "0.5797929", ...
0.6625956
1
This is the main method that process user input. This cause the FSM to change state and call an action. This method calls getTransition() to find the correct action and nextState associated with the inputSymbol and currentState. This method processes one complete input symbol.
def process (self, inputSymbol): self.inputSymbol = inputSymbol (self.action, self.nextState) = self.getTransition (self.inputSymbol, self.currentState) if self.action is not None: self.action (self) self.memoryState.append(self.currentState) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input(self, symbol, *args, **kwargs):\n if self.__state is None:\n raise ValueError(\"FSM state is undefined\")\n try:\n transition = self.__get_state_attr(self._transition_prefix)\n except AttributeError:\n raise Exception(\"unable to find transition funct...
[ "0.7126944", "0.6313032", "0.6273754", "0.6034373", "0.5996154", "0.5985508", "0.59294426", "0.58302075", "0.58178115", "0.5808534", "0.57349867", "0.5706727", "0.5656725", "0.5618711", "0.56094056", "0.5534585", "0.5453117", "0.5448634", "0.54410994", "0.5429249", "0.5428419...
0.80351883
0
Here the FSM is stared and the state transitions are defined.
def main(): f = FiniteStatesMachine('stopped', []) f.setDefaultTransition(Error, None) f.addTransitionList('start', 'stopped', starFSMVariables, 'started') f.addTransitionList('collect', 'started', collectData, 'collecting') f.addTransitionList('collect', 'processing',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leaderFiniteStateMachine(self):\n if(self.mode == 'simulation'):\n print(self.name + \": Actualizamos la maquina de estado del lider\")\n \n else:\n if(self.current_state == EMERGENCY or self.current_state == UNDEFINED): # No puede salir de EMERGENCIA, hay que reinic...
[ "0.6921972", "0.69081324", "0.68047744", "0.67634577", "0.6744643", "0.6723987", "0.67230344", "0.6710408", "0.6695104", "0.6627893", "0.656548", "0.65531117", "0.65408266", "0.6513487", "0.6502165", "0.6502138", "0.64529026", "0.64302516", "0.6429017", "0.6428415", "0.642449...
0.6766668
3
Generates parsing spec for tf.parse_example to be used with classifiers. If users keep data in tf.Example format, they need to call tf.parse_example
def classifier_parse_example_spec(feature_columns, label_key, label_dtype=dtypes.int64, label_default=None, weight_column=None): parsing_spec = fc.make_parse_example_spec(feature_col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tf_example_parser(example):\n def _get_feature_map():\n \"\"\"Returns data format of the serialized tf record file.\"\"\"\n return {\n # 3 sparse feature with variable length. Use this if you have a\n # variable number or more than 1 feature value per example.\n \"featur...
[ "0.7969642", "0.77698576", "0.7314053", "0.7263414", "0.72264713", "0.71797144", "0.7169134", "0.7144098", "0.70959514", "0.7066097", "0.704645", "0.702182", "0.69985455", "0.6914308", "0.68740547", "0.68440163", "0.68436134", "0.6774798", "0.6757371", "0.66926384", "0.663061...
0.0
-1
Generates parsing spec for tf.parse_example to be used with regressors. If users keep data in tf.Example format, they need to call tf.parse_example
def regressor_parse_example_spec(feature_columns, label_key, label_dtype=dtypes.float32, label_default=None, label_dimension=1, weight_column=None): pars...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tf_example_parser(example):\n def _get_feature_map():\n \"\"\"Returns data format of the serialized tf record file.\"\"\"\n return {\n # 3 sparse feature with variable length. Use this if you have a\n # variable number or more than 1 feature value per example.\n \"featur...
[ "0.8089116", "0.7692144", "0.7427058", "0.73363465", "0.7304736", "0.72581846", "0.7235934", "0.7229534", "0.7021413", "0.70062184", "0.69566554", "0.69477016", "0.69340587", "0.69241685", "0.6892932", "0.6824007", "0.6796293", "0.6792499", "0.6732977", "0.67035663", "0.66994...
0.0
-1
Read the AWS from the credentials dictionary and then create a boto3 connection to AWS with those credentials.
def create_session(credentials): if type(credentials) == dict: pass elif type(credentials) == str: credentials = json.loads(credentials) else: credentials = json.load(credentials) session = Session(aws_access_key_id = credentials["aws_access_key"], aws_secr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect_to_s3(self, credentials):\n connection = s3.S3Connection(credentials['token'], credentials['secret'])\n bucket = connection.get_bucket(credentials['bucket'])\n return connection, bucket", "def authenticate(self, credentials=None):\n if credentials is None: # pragma: no cover\n ...
[ "0.7304738", "0.68542176", "0.6808308", "0.67948496", "0.663381", "0.65727234", "0.6560181", "0.6550317", "0.6514393", "0.6512412", "0.6453467", "0.6438175", "0.6430765", "0.64142025", "0.6409353", "0.63990295", "0.63990295", "0.63990295", "0.6398798", "0.63965577", "0.639609...
0.6753502
4
Create a session with no credentials, meant to be used by internal instance with assumed iam role.
def use_iam_role(): session = Session(region_name='us-east-1') return session
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_session(self, **params):\n raise NotImplementedError('Should be implemented by a sub-class.')", "def create_session(self):\n self._session = self.create_scoped_session()\n self.session = self._session()", "def create_session(credentials):\n if type(credentials) == dict:\n ...
[ "0.6815272", "0.6593538", "0.64895034", "0.640303", "0.63064355", "0.6300941", "0.6279542", "0.62607354", "0.6249621", "0.6249621", "0.6246718", "0.6229943", "0.6218699", "0.61909324", "0.61593825", "0.6153288", "0.6141328", "0.6137293", "0.6135626", "0.61204773", "0.6110543"...
0.62233883
12
Lookup all of the IP addresses for a given AWS instance name. Multiple instances with the same name is a result of instances belonging to an auto scale group. Useful when an action needs to happen to all machines in an auto scale group.
def machine_lookup_all(session, hostname, public_ip = True): client = session.client('ec2') response = client.describe_instances(Filters=[{"Name":"tag:Name", "Values":[hostname]}, {"Name":"instance-state-name", "Values":["running"]}]) addresses = [] ite...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_instances_by_name_mask(self, mask_name):\n\n instances = []\n\n instance_list = self.nova_cli.servers.list()\n logger.info('Instances list is {0}'.format(instance_list))\n logger.info(\n 'Expected instance name should inlude {0}'.format(mask_name))\n\n for ins...
[ "0.690664", "0.684622", "0.6602771", "0.61565304", "0.6142604", "0.60926044", "0.60590464", "0.60518944", "0.60219425", "0.60186154", "0.6005966", "0.5953812", "0.5896932", "0.5894132", "0.5887551", "0.5881828", "0.5880497", "0.58594406", "0.58584875", "0.5843627", "0.5772551...
0.6998335
0
Lookup the IP addresses for a given AWS instance name.
def machine_lookup(session, hostname, public_ip = True): try: idx, target = hostname.split('.', 1) idx = int(idx) # if it is not a valid number, then it is a hostname hostname = target except: idx = 0 client = session.client('ec2') response = client.describe_instances(F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ips(rg_name, vmss_name):\n\n script = \"az vmss list-instance-public-ips --resource-group {rg} --name {vmss} | grep ipAddress\".format(\n rg=rg_name,\n vmss=vmss_name\n )\n run_script(script)", "def machine_lookup_all(session, hostname, public_ip = True):\n client = session.clie...
[ "0.70247114", "0.6887101", "0.6677439", "0.6462593", "0.6427537", "0.63524264", "0.61925566", "0.61001545", "0.60729104", "0.59737617", "0.5951085", "0.59333456", "0.5926617", "0.5926617", "0.59114546", "0.5910869", "0.5896637", "0.58187497", "0.5816545", "0.5800161", "0.5798...
0.6471544
3
Lookup the public DNS for a given AWS RDS instance name.
def rds_lookup(session, hostname): client = session.client('rds') response = client.describe_db_instances(DBInstanceIdentifier=hostname) item = response['DBInstances'] if len(item) == 0: print("Could not find DNS for '{}'".format(hostname)) return None else: return item[0][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_public_lookup(session, hostname):\n if session is None:\n return None\n\n client = session.client('ec2')\n response = client.describe_instances(\n Filters=[{\"Name\": \"tag:Name\", \"Values\": [hostname]},\n {\"Name\": \"instance-state-name\", \"Values\": [\"runn...
[ "0.7454354", "0.6793534", "0.64854825", "0.638419", "0.637897", "0.63712627", "0.63638", "0.6352668", "0.62254494", "0.6122659", "0.60128444", "0.59898543", "0.59575254", "0.59271836", "0.58951855", "0.58788455", "0.5849263", "0.58443725", "0.5781869", "0.5759335", "0.5698314...
0.780593
0
Locate an item in a list based on a predicate function.
def _find(xs, predicate): for x in xs: if predicate(x): return x return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(func, list_seq):\n for list_item in list_seq:\n if func(list_item):\n return list_item", "def list_find(f, items):\n for i, x in enumerate(items):\n if f(x):\n return i\n return None", "def finditem(func, seq):\n return next((item for item in seq if func...
[ "0.7345009", "0.7329399", "0.69864964", "0.68509775", "0.6848589", "0.6835385", "0.6782268", "0.67755824", "0.631964", "0.63177335", "0.62872744", "0.6159832", "0.60666436", "0.60513777", "0.60492444", "0.60366356", "0.59750605", "0.59668785", "0.5961629", "0.595214", "0.5874...
0.7533438
0
Terminate all of the instances for an ASG, with the given timeout between each termination.
def asg_restart(session, hostname, timeout, callback=None): client = session.client('ec2') resource = session.resource('ec2') response = client.describe_instances(Filters=[{"Name":"tag:Name", "Values":[hostname]}, {"Name":"instance-state-name", "Values":["ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terminate_all(self):\n self._stop_all('terminate')", "def terminate_instances(self, ids):\n self.conn.terminate_instances(instance_ids=ids)", "def terminate_instances(self, props):\n return self._vm_async_apply(props, 'delete')", "def terminate_instance_in_asg(instance_id):\n if n...
[ "0.6357317", "0.6248194", "0.6084295", "0.59850127", "0.5979804", "0.5917791", "0.5914561", "0.58749413", "0.5839589", "0.5790333", "0.5714129", "0.56740266", "0.56631154", "0.5644305", "0.5632723", "0.5591108", "0.557721", "0.5561397", "0.55381894", "0.5480454", "0.5472366",...
0.6897586
0
Lookup the Group name for the ASG creating the EC2 instances with the given hostname
def asg_name_lookup(session, hostname): if session is None: return None client = session.client('autoscaling') response = client.describe_auto_scaling_groups() if len(response['AutoScalingGroups']) == 0: return None else: # DP NOTE: Unfortunatly describe_auto_scaling_groups(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instanceid_lookup(session, hostname):\n if session is None:\n return None\n\n client = session.client('ec2')\n response = client.describe_instances(\n Filters=[{\"Name\": \"tag:Name\", \"Values\": [hostname]}])\n\n item = response['Reservations']\n if len(item) == 0:\n retur...
[ "0.63809437", "0.63582885", "0.62746876", "0.62431866", "0.61943334", "0.6136143", "0.6110822", "0.6015477", "0.5964197", "0.5958102", "0.59372044", "0.5880964", "0.583179", "0.57972753", "0.57745284", "0.57554305", "0.57206607", "0.57174826", "0.5665552", "0.5599069", "0.559...
0.7942209
0
Lookup the Id for the VPC with the given domain name.
def vpc_id_lookup(session, vpc_domain): if session is None: return None client = session.client('ec2') response = client.describe_vpcs(Filters=[{"Name": "tag:Name", "Values": [vpc_domain]}]) if len(response['Vpcs']) == 0: return None else: return response['Vpcs'][0]['VpcId']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_keystone_v3_domain_id(self, domain_name):\n LOG_OBJ.debug(\"Get the domain ID.\")\n\n _url = \"http://\" + self.host_ip + \":35357/v3/domains?name=\" + \\\n str(domain_name)\n _headers = {'x-auth-token': self.cloud_admin_info[\"token_domain\"],\n 'conte...
[ "0.7072395", "0.66890675", "0.62828547", "0.60626096", "0.60512835", "0.60456634", "0.60456634", "0.5988567", "0.5966641", "0.5933054", "0.5929906", "0.5865763", "0.5865732", "0.5855496", "0.5855496", "0.5855496", "0.5855496", "0.5855496", "0.5855496", "0.583406", "0.5822499"...
0.81332946
0
Lookup the Id for the Subnet with the given domain name.
def subnet_id_lookup(session, subnet_domain): if session is None: return None client = session.client('ec2') response = client.describe_subnets(Filters=[{"Name": "tag:Name", "Values": [subnet_domain]}]) if len(response['Subnets']) == 0: return None else: return response['Sub...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_keystone_v3_domain_id(self, domain_name):\n LOG_OBJ.debug(\"Get the domain ID.\")\n\n _url = \"http://\" + self.host_ip + \":35357/v3/domains?name=\" + \\\n str(domain_name)\n _headers = {'x-auth-token': self.cloud_admin_info[\"token_domain\"],\n 'conte...
[ "0.62816155", "0.6252993", "0.61216253", "0.6116545", "0.57401055", "0.56873554", "0.5656026", "0.5638093", "0.56223834", "0.5614454", "0.5596863", "0.5574551", "0.55497974", "0.5529772", "0.5517432", "0.5475204", "0.5445243", "0.5445243", "0.54308754", "0.54301274", "0.54301...
0.7532417
0
Lookup all of the Availablity Zones for the connected region.
def azs_lookup(session, lambda_compatible_only=False): if session is None: return [] client = session.client('ec2') response = client.describe_availability_zones() # SH Removing Hack as subnet A is already in Production and causes issues trying to delete # We will strip out subnets A and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_zones(self):\n path = '/os-availability-zone/detail'\n res = self.compute.call(path, 'GET', data='', \n token=self.manager.identity.token)\n self.logger.debug('Get openstack availability zone: %s' % truncate(res))\n return res[0]['availabilityZ...
[ "0.64122", "0.6283016", "0.6114804", "0.6100205", "0.58681506", "0.58634186", "0.58540446", "0.57796514", "0.5697409", "0.56809247", "0.5643406", "0.56392354", "0.5632144", "0.55650926", "0.5555251", "0.5555251", "0.5555251", "0.5555251", "0.5555251", "0.5555251", "0.5512116"...
0.4891052
85
Lookup the Id for the AMI with the given name. If ami_name ends with '.boss', the AMI_VERSION environmental variable is used to either search for the latest commit hash tagged AMI ('.bossh') or for the AMI with the specific tag ('.boss').
def ami_lookup(session, ami_name, version = None): if session is None: return None specific = False if ami_name.endswith(".boss"): ami_version = os.environ["AMI_VERSION"] if version is None else version if ami_version == "latest": # limit latest searching to only version...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ami_by_name ( ec2_conn, ami_name ) :\n amis = ec2_conn.get_all_images( filters = { \"name\": [ ami_name ] } )\n for ami in amis :\n return ami", "def get_ami_by_id ( ec2_conn, ami_id ) :\n amis = ec2_conn.get_all_images( image_ids = [ ami_id ] )\n for ami in amis :\n return ami", "d...
[ "0.6669751", "0.5976176", "0.58265173", "0.5811249", "0.5770496", "0.56842625", "0.56431633", "0.56096363", "0.5589823", "0.55881256", "0.5372395", "0.53390926", "0.5291101", "0.5243476", "0.51454204", "0.5121465", "0.50918853", "0.5083589", "0.5083099", "0.507428", "0.506357...
0.74430376
0
Lookup the Ids for all of the VPC Security Groups.
def sg_lookup_all(session, vpc_id): if session is None: return NoneDict() client = session.client('ec2') response = client.describe_security_groups(Filters=[{"Name": "vpc-id", "Values": [vpc_id]}]) if len(response['SecurityGroups']) == 0: return NoneDict() else: sgs = NoneD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sg_ids(vpc):\n list = [i.id for i in vpc.security_groups.all()]\n return list", "def vpc_security_group_ids(self) -> pulumi.Output[Sequence[str]]:\n return pulumi.get(self, \"vpc_security_group_ids\")", "def vpc_security_group_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]...
[ "0.776428", "0.7407091", "0.7198566", "0.7198566", "0.68077105", "0.68063724", "0.67918974", "0.6652626", "0.66312367", "0.66312367", "0.63980854", "0.6179441", "0.6063443", "0.5990153", "0.59719115", "0.59415746", "0.5895164", "0.58848244", "0.5872261", "0.5848759", "0.58404...
0.7723206
1
Lookup the Id for the VPC Security Group with the given name.
def sg_lookup(session, vpc_id, group_name): if session is None: return None client = session.client('ec2') response = client.describe_security_groups(Filters=[{"Name": "vpc-id", "Values": [vpc_id]}, {"Name": "tag:Name", "Values": [group_name]}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sg_id(sg_name):\n print()\n print(\"Searching for SG ID\")\n client = boto3.client('ec2')\n all_sg = client.describe_security_groups()\n print(sg_name)\n grp_id = \"None\"\n for sec_grp in all_sg['SecurityGroups']:\n print(sec_grp['GroupName'])\n if sg_name == sec_grp['Gr...
[ "0.7680698", "0.7084317", "0.6718247", "0.66819984", "0.66819984", "0.6648008", "0.6648008", "0.6557056", "0.65039665", "0.6483536", "0.6483536", "0.6401095", "0.63624", "0.62879884", "0.62802815", "0.6271635", "0.62600183", "0.60661876", "0.6065279", "0.5980223", "0.5909057"...
0.81316435
0
Lookup the Id for the VPC Route Table with the given name.
def rt_lookup(session, vpc_id, rt_name): if session is None: return None client = session.client('ec2') response = client.describe_route_tables(Filters=[{"Name": "vpc-id", "Values": [vpc_id]}, {"Name": "tag:Name", "Values": [rt_name]}]) if l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_id(self, tag_name):\n response = await self.describe(tag_name)\n if response['RouteTables']:\n return response['RouteTables'][0][\"RouteTableId\"]\n else:\n raise RtbDoesntExists", "def transit_router_route_table_id(self) -> Optional[pulumi.Input[str]]:\n ...
[ "0.7265778", "0.6650314", "0.6650314", "0.65430045", "0.65120596", "0.64262307", "0.6146517", "0.60185033", "0.56920457", "0.5620676", "0.5594443", "0.5552543", "0.5518078", "0.5444758", "0.54276913", "0.5355043", "0.5323631", "0.5280393", "0.5248865", "0.52361125", "0.522494...
0.7589303
0
Name the default Route Table that is created for a new VPC. Find the default VPC Route Table and give it a name so that it can be referenced latter. Needed because by default the Route Table does not have a name and rt_lookup() will not find it. The default VPC Route Table is determined as the first Route Table without...
def rt_name_default(session, vpc_id, new_rt_name): client = session.client('ec2') response = client.describe_route_tables(Filters=[{"Name": "vpc-id", "Values": [vpc_id]}]) rt_id = None for rt in response['RouteTables']: nt = _find(rt['Tags'], lambda x: x['Key'] == 'Name') if nt is None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rt_lookup(session, vpc_id, rt_name):\n if session is None:\n return None\n\n client = session.client('ec2')\n response = client.describe_route_tables(Filters=[{\"Name\": \"vpc-id\", \"Values\": [vpc_id]},\n {\"Name\": \"tag:Name\", \"Values\":...
[ "0.6255291", "0.5958707", "0.5942567", "0.58998066", "0.5847473", "0.5646883", "0.5562245", "0.5402062", "0.54012924", "0.5368249", "0.5318241", "0.52420455", "0.5207002", "0.51904994", "0.5187961", "0.516698", "0.51573324", "0.5153503", "0.5133534", "0.51282156", "0.5078571"...
0.84361637
0
Lookup the Id for the Peering Connection between the two VPCs.
def peering_lookup(session, from_id, to_id, owner_id=None): if session is None: return None if owner_id is None: owner_id = get_account_id_from_session(session) client = session.client('ec2') response = client.describe_vpc_peering_connections(Filters=[{"Name": "requester-vpc-info.vpc-i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peering_connection_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"peering_connection_id\")", "def peering_connection_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"peering_connection_id\")", "def connection_id(self) -> pulumi.Output[str]:\n return pul...
[ "0.7403329", "0.70283127", "0.6273366", "0.60336775", "0.5969494", "0.5969494", "0.5969494", "0.5969494", "0.5969494", "0.5969494", "0.5954346", "0.5914856", "0.58613765", "0.5849268", "0.581425", "0.581425", "0.581425", "0.581425", "0.581425", "0.581425", "0.581425", "0.58...
0.6654912
2
Lookup the names of valid Key Pair. If the SSH_KEY enviro variable is defined and points to a valid keypair, that keypair name is returned. Else all of the keypairs are printed to stdout and the user is prompted to select which keypair to use.
def keypair_lookup(session): if session is None: return None client = session.client('ec2') response = client.describe_key_pairs() # If SSH_KEY exists and points to a valid Key Pair, use it key = os.environ.get("SSH_KEY", None) # reuse bastion.py env vars if key is not None: k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_key_pair(ec2, kp_name):\n if not [i for i in ec2.get_all_key_pairs() if str(i).split(':')[1] == kp_name]:\n sys.stderr.write(\"Key pair: {} does not exist, please import_key_pair prior to running.\\n\".format(kp_name))\n sys.exit(1)", "def key_pair_name(self) -> Optional[pulumi.Input[s...
[ "0.6621088", "0.61450076", "0.61450076", "0.6030742", "0.5993051", "0.5961809", "0.58859694", "0.5711315", "0.55931115", "0.5490621", "0.54890466", "0.5479529", "0.54452103", "0.5428441", "0.54208297", "0.5379685", "0.5375169", "0.53638816", "0.53498614", "0.5281988", "0.5258...
0.78218615
0
Look up instance id by hostname (instance name).
def instanceid_lookup(session, hostname): if session is None: return None client = session.client('ec2') response = client.describe_instances( Filters=[{"Name": "tag:Name", "Values": [hostname]}]) item = response['Reservations'] if len(item) == 0: return None else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHostKey(instance):\n return instance['hostname']", "def get_instance_id(self):\n return \"{0}-{1}\".format(self._vc_name, self._host)", "def instance_public_lookup(session, hostname):\n if session is None:\n return None\n\n client = session.client('ec2')\n response = client.des...
[ "0.7457449", "0.7274183", "0.7065669", "0.7018674", "0.69828963", "0.6804619", "0.6804448", "0.66520125", "0.665048", "0.66439986", "0.65985245", "0.6568026", "0.654998", "0.6524222", "0.65042883", "0.65042883", "0.65042883", "0.64500105", "0.6423488", "0.6423488", "0.6423488...
0.8307429
0
Looks up the ARN for a SSL Certificate
def cert_arn_lookup(session, domain_name): if session is None: return None client = session.client('acm') response = client.list_certificates() for certs in response['CertificateSummaryList']: if certs['DomainName'] == domain_name: return certs['CertificateArn'] if c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ssl_certificate_arn(environment):\n name = Constants['SslCertificateName'][environment]\n\n certificates = ACM.list_certificates(CertificateStatuses=[ 'ISSUED' ])['CertificateSummaryList']\n arns = [ c['CertificateArn'] for c in certificates if c['DomainName'] == name ]\n\n if len(arns) == 0:\n...
[ "0.7575733", "0.67465764", "0.64577544", "0.64160997", "0.628164", "0.6254604", "0.6073698", "0.5756983", "0.5599451", "0.5599451", "0.5599451", "0.5577368", "0.5577368", "0.5577027", "0.5553289", "0.5553289", "0.5549295", "0.5541539", "0.550942", "0.5448711", "0.5382661", ...
0.7114357
1
Lookup the Public DNS name for a EC2 instance
def instance_public_lookup(session, hostname): if session is None: return None client = session.client('ec2') response = client.describe_instances( Filters=[{"Name": "tag:Name", "Values": [hostname]}, {"Name": "instance-state-name", "Values": ["running"]}]) item = resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rds_lookup(session, hostname):\n\n client = session.client('rds')\n response = client.describe_db_instances(DBInstanceIdentifier=hostname)\n\n item = response['DBInstances']\n if len(item) == 0:\n print(\"Could not find DNS for '{}'\".format(hostname))\n return None\n else:\n ...
[ "0.7093993", "0.6950115", "0.69366145", "0.6753267", "0.6640436", "0.66227126", "0.6474817", "0.6400321", "0.6302448", "0.62650925", "0.6223052", "0.6206862", "0.61611843", "0.6119791", "0.60280055", "0.6024374", "0.6014244", "0.6009959", "0.5994625", "0.5985246", "0.59798884...
0.77868897
0
Lookup cloudfront public domain name which has hostname as the origin.
def cloudfront_public_lookup(session, hostname): if session is None: return None client = session.client('cloudfront') response = client.list_distributions( MaxItems='100' ) items = response["DistributionList"]["Items"] for item in items: cloud_front_domain_name = item["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def host(self):\n if self.url.startswith(\"dns:\"):\n return self.url[4:]\n else:\n return urlparse(self.url).hostname", "def get_domain():\n domain=\"\"\n for item in re.split(\"\\.\", env.host)[1:]:\n domain = domain + \".\" + item\n return domain.lstrip(\".\...
[ "0.7322436", "0.71760046", "0.7071095", "0.7029442", "0.7000298", "0.69341964", "0.6933069", "0.6917955", "0.6914039", "0.6898984", "0.6894848", "0.6891883", "0.6890801", "0.6877511", "0.681708", "0.6752261", "0.6731664", "0.6730647", "0.6730647", "0.67285687", "0.6695391", ...
0.82743466
0
Lookup the Public DNS name for a ELB
def elb_public_lookup(session, hostname): if session is None: return None client = session.client('elb') responses = client.describe_load_balancers() hostname_ = hostname.replace(".", "-") for response in responses["LoadBalancerDescriptions"]: if response["LoadBalancerName"].star...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rds_lookup(session, hostname):\n\n client = session.client('rds')\n response = client.describe_db_instances(DBInstanceIdentifier=hostname)\n\n item = response['DBInstances']\n if len(item) == 0:\n print(\"Could not find DNS for '{}'\".format(hostname))\n return None\n else:\n ...
[ "0.7090508", "0.6931591", "0.66295487", "0.6527898", "0.64692634", "0.6408615", "0.6370166", "0.6294847", "0.62296087", "0.6155501", "0.61130655", "0.60973746", "0.6082369", "0.6069316", "0.60271686", "0.5922691", "0.59071743", "0.58485824", "0.58454686", "0.58105326", "0.579...
0.82099265
0
Look up ELB Id by name
def lb_lookup(session, lb_name): if session is None: return None lb_name = lb_name.replace('.', '-') client = session.client('elb') response = client.describe_load_balancers() for i in range(len(response['LoadBalancerDescriptions'])): if (response['LoadBalancerDescriptions'][i]['L...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_elb ( elb_conn, elb_name ) :\n try :\n elb_r = elb_conn.get_all_load_balancers( load_balancer_names = [ elb_name ] )\n if len( elb_r ) > 0 :\n return elb_r[ 0 ]\n except :\n return None", "def instanceid_lookup(session, hostname):\n if session is None:\n return None\...
[ "0.6410251", "0.6320013", "0.62699234", "0.5826108", "0.5814295", "0.5814165", "0.57875586", "0.57076484", "0.56870925", "0.56859106", "0.56775266", "0.56501776", "0.5644913", "0.5644913", "0.5629282", "0.5629282", "0.5629282", "0.5623974", "0.5578806", "0.5548592", "0.553271...
0.55268645
21
Lookup up SNS topic ARN given a topic name
def sns_topic_lookup(session, topic_name): if session is None: return None client = session.client('sns') response = client.list_topics() topics_list = response['Topics'] for topic in topics_list: arn_topic_name = topic["TopicArn"].split(':').pop() if arn_topic_name == topic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_topic_arn(topic_name):\n # https://stackoverflow.com/a/37723278/1558022\n sts_client = boto3.client('sts')\n account_id = sts_client.get_caller_identity().get('Account')\n\n return f'arn:aws:sns:eu-west-1:{account_id}:{topic_name}'", "def get_full_topicarn ( base_topicarn, topicname ) :\n ...
[ "0.79431546", "0.72963053", "0.7135237", "0.7135237", "0.7130573", "0.6910786", "0.69055796", "0.6537543", "0.65364784", "0.646367", "0.6283038", "0.59111613", "0.5876922", "0.5643607", "0.56244606", "0.55634636", "0.5465788", "0.54464096", "0.54258615", "0.5421659", "0.53438...
0.8113506
0
Delete all of the SQS Queues that start with the given domain name
def sqs_delete_all(session, domain): client = session.client('sqs') resp = client.list_queues(QueueNamePrefix=domain.replace('.','-')) for url in resp.get('QueueUrls', []): client.delete_queue(QueueUrl=url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_test_queues(prefix=TEST_NAME_PREFIX, region_name=None):\n sqs = boto3.resource('sqs', region_name=region_name)\n num_queues = 0\n try:\n for queue in sqs.queues.all():\n if re.match(r'.+%s\\d+' % TEST_NAME_PREFIX, queue.url):\n queue.delete()\n num...
[ "0.7308705", "0.6090805", "0.60719943", "0.5983654", "0.59769964", "0.59579396", "0.5926879", "0.5807085", "0.57812786", "0.57787776", "0.57786417", "0.57765925", "0.57747895", "0.5687993", "0.5681951", "0.56519437", "0.5629436", "0.5589249", "0.5585626", "0.55741715", "0.556...
0.83173805
0
Lookup up SQS url given a name.
def sqs_lookup_url(session, queue_name): client = session.client('sqs') resp = client.get_queue_url(QueueName=queue_name) return resp['QueueUrl']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_name(self, name):\n self.name = name\n self._stream_from_name()\n return self.URL", "def get_by_url(self, url, pool_name=None):\n\t\tif not pool_name:\n\t\t\treturn self.pool[url]\n\t\treturn getattr(self, pool_name)[url]", "def image_url(self, name):\r\n s3_key = self._gen...
[ "0.570739", "0.56668997", "0.55974376", "0.55352825", "0.55016017", "0.54813766", "0.5397629", "0.53500366", "0.5313121", "0.53008205", "0.5254056", "0.5221821", "0.52081007", "0.52081007", "0.5193847", "0.5184935", "0.5153158", "0.5135208", "0.5130682", "0.5095509", "0.50650...
0.75557625
0
Requests a certificate in the AWS Certificate Manager for the domain name
def request_cert(session, domain_name, validation_domain): if session is None: return None client = session.client('acm') validation_options = [ { 'DomainName': domain_name, 'ValidationDomain': validation_domain }, ] response = client.request_certific...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(domain):\n if not domain:\n logger.error(\n \"ctl:info:generate\", \"Choose a fully-qualified domain name of the \"\n \"certificate. Must match a domain present on the system\"\n )\n domain = click.prompt(\"Domain name\")\n try:\n client().certifi...
[ "0.71145135", "0.68516237", "0.68167555", "0.6727174", "0.63520133", "0.62255585", "0.6130389", "0.61267835", "0.5947188", "0.5946464", "0.587936", "0.5868433", "0.5864199", "0.5861729", "0.5860213", "0.58348227", "0.5812201", "0.5778908", "0.57471037", "0.5649767", "0.564291...
0.7149025
0
Get hosted zone by looking up account name and using that to tell which zone to return.
def get_hosted_zone(session): account = get_account_id_from_session(session) if account == hosts.PROD_ACCOUNT: return hosts.PROD_DOMAIN elif account == hosts.DEV_ACCOUNT: return hosts.DEV_DOMAIN else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_zone(cls, name):\n\n def get_closest(n):\n \"\"\"\n Return closest matching zone\n \"\"\"\n while n:\n try:\n return DNSZone.objects.get(name=n)\n except DNSZone.DoesNotExist:\n pass\n ...
[ "0.7249278", "0.70573413", "0.6600804", "0.6556853", "0.65454966", "0.6509461", "0.6491115", "0.64886916", "0.64364696", "0.6349082", "0.6179819", "0.61753106", "0.61310756", "0.61241627", "0.6072795", "0.59662193", "0.5963174", "0.5910606", "0.58478206", "0.58478206", "0.584...
0.7208443
1
Look up Hosted Zone ID by DNS Name
def get_hosted_zone_id(session, hosted_zone): if session is None: return None client = session.client('route53') response = client.list_hosted_zones_by_name( DNSName=hosted_zone, MaxItems='1' ) if len(response['HostedZones']) >= 1: full_id = response['HostedZones'][0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_zone(self, conn, host):\n fl = 'name=\"%s\"' % host\n request = conn.instances().aggregatedList(project=PROJECT, filter=fl)\n \twhile request is not None:\n \t\tresponse = request.execute()\n \t\tzones = response.get('items', {})\n \t\tfor zone in zones.values():\n \t\t\tfor in...
[ "0.6939275", "0.68444455", "0.6659618", "0.6528168", "0.65258527", "0.6513309", "0.6497108", "0.6493159", "0.64013845", "0.6360987", "0.63570255", "0.6320351", "0.63168037", "0.6304107", "0.6270168", "0.62638074", "0.62486017", "0.6175367", "0.61118865", "0.6106997", "0.61064...
0.60102695
28
Updates or Creates a domain name with FQDN resource.
def set_domain_to_dns_name(session, domain_name, dns_resource, hosted_zone): if session is None: return None client = session.client('route53') hosted_zone_id = get_hosted_zone_id(session, hosted_zone) if hosted_zone_id is None: print("Error: Unable to find Route 53 Hosted Zone, " + ho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_dns(self):\n if self.ptr:\n which_zone = None\n zones = dns.models.Zone.objects.all()\n for zone in zones:\n if self.ptr.endswith(zone.name) or self.ptr.endswith(zone.name + '.'):\n which_zone = zone\n break\n\n...
[ "0.61005515", "0.5949715", "0.58637345", "0.58026123", "0.57765675", "0.57385725", "0.56413877", "0.5568498", "0.55607516", "0.5557578", "0.55217475", "0.55150574", "0.55067784", "0.5486445", "0.5471696", "0.5465719", "0.546032", "0.5456307", "0.54177785", "0.5328181", "0.532...
0.62173575
0
gets to resource name attached to a domain name
def get_dns_resource_for_domain_name(session, domain_name, dns_resource, hosted_zone): if session is None: return None client = session.client('route53') hosted_zone_id = get_hosted_zone_id(session, hosted_zone) if hosted_zone_id is None: print("Error: Unable to find Route 53 Hosted Zo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domain_name(self) -> str:\n return pulumi.get(self, \"domain_name\")", "def domain_name(self) -> str:\n return pulumi.get(self, \"domain_name\")", "def get_domain_name(self):\n return self.domain_name.get_text()", "def domain_name(self) -> pulumi.Output[str]:\n return pulumi.g...
[ "0.7044255", "0.7044255", "0.6996854", "0.68066776", "0.68066776", "0.68066776", "0.677094", "0.6686967", "0.6686967", "0.6686967", "0.6535889", "0.6506666", "0.6484692", "0.64764667", "0.64130455", "0.6407385", "0.64038163", "0.6345912", "0.63330495", "0.6319494", "0.6309725...
0.5892597
49
Delete all of the matching CNAME records from a DNS Zone
def route53_delete_records(session, hosted_zone, cname): if session is None: return None client = session.client('route53') hosted_zone_id = get_hosted_zone_id(session, hosted_zone) if hosted_zone_id is None: print("Could not locate Route53 Hosted Zone '{}'".format(hosted_zone)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deletednsrecord(kasserver, kasapi):\n kasserver.delete_dns_record(\"test.example.com\", \"CNAME\")\n assert kasapi.requests_contains(\"delete_dns_settings\")", "def delete_container_links(container):\n container_uri = container.cdn_uri.replace(\"http://\", \"\")\n domain = get_domain...
[ "0.68798274", "0.6212371", "0.6047711", "0.60346884", "0.5980792", "0.58506405", "0.5818954", "0.57226974", "0.5720566", "0.57001406", "0.56724554", "0.56326467", "0.56292945", "0.56163657", "0.5554157", "0.554218", "0.55259824", "0.5514953", "0.5445766", "0.5426144", "0.5409...
0.70036846
0
Unsubscribe all subscriptions for the given SNS topic
def sns_unsubscribe_all(session, topic, region="us-east-1", account=None): if session is None: return None if account is None: account = get_account_id_from_session(session) topic = "arn:aws:sns:{}:{}:{}".format(region, account, topic.replace(".", "-")) client = session.client('sns') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def unsubscribe(self, topic: str, subscription_id: int = None) -> None:\n ...", "async def unsubscribe_topics(self) -> None:\n self._sub_state = await self._mqtt_client.unsubscribe(self._sub_state)", "def unsubscribe(self, topic):\n request = protos.RequestUnsubscribe(topic=topic)\n ...
[ "0.78564173", "0.7503416", "0.7494931", "0.7264927", "0.7082679", "0.6934921", "0.6786763", "0.6547516", "0.6486138", "0.6444043", "0.64201444", "0.6402963", "0.63842636", "0.63343644", "0.6314208", "0.63087684", "0.62940603", "0.6240863", "0.6240863", "0.62375754", "0.623116...
0.811901
0
Creates a new Topic
def sns_create_topic(session, topic): if session is None: return None client = session.client("sns") response = client.create_topic(Name=topic) print(response) if response is None: return None else: return response['TopicArn']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_topic (self):\n return self.tm.create_topic()", "def create_topic(project_id, topic_id):\n topic_path = PUBLISHER_CLIENT.topic_path(project_id, topic_id)\n topic = PUBLISHER_CLIENT.create_topic(request={\"name\": topic_path})\n print(\"Created topic: {}\".format(topic.name))", "def c...
[ "0.8382125", "0.8278133", "0.78403986", "0.7770088", "0.7703768", "0.7568904", "0.74277943", "0.74015033", "0.7379665", "0.7325611", "0.7288096", "0.7258471", "0.7200558", "0.7183344", "0.7131199", "0.7119998", "0.70848787", "0.7084135", "0.68914306", "0.674492", "0.66853815"...
0.7385752
8
Delete all of the IAM policies that start with the given domain name
def policy_delete_all(session, domain, path="/"): client = session.client('iam') resp = client.list_policies(Scope='Local', PathPrefix=path) prefix = domain.replace('.', '-') for policy in resp.get('Policies', []): if policy['PolicyName'].startswith(prefix): ARN = policy['Arn'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_all(self):\n for name in self.app.config['SIMPLE_DOMAINS']:\n self.connection.delete_domain(name)", "def delete_policies():\n if PoliciesOutput.POLICIES_EVENT not in ctx.instance.runtime_properties:\n return\n\n service_component_name = ctx.instance.runtime_...
[ "0.6473392", "0.6243997", "0.5969745", "0.5849608", "0.57430595", "0.57022417", "0.5679662", "0.56782377", "0.5672439", "0.56152827", "0.55565584", "0.54859465", "0.5423485", "0.5404208", "0.5362759", "0.53223443", "0.5299086", "0.5266806", "0.5250096", "0.52498037", "0.52363...
0.71195954
0
Returns the arn associated the the role name. Using this method avoids hardcoding the aws account into the arn name.
def role_arn_lookup(session, role_name): if session is None: return None client = session.client('iam') response = client.get_role(RoleName=role_name) if response is None: return None else: return response['Role']['Arn']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_role_arn(self, role, partition='aws'):\n if not role or role.startswith(\"arn:aws\"):\n return role\n if not role.startswith(\"role/\"):\n role = \"role/\" + role\n return \"arn:{0}:iam::{1}:{2}\".format(partition, self.account_id, role)", "def role_arn(self...
[ "0.7859572", "0.7753478", "0.7637809", "0.7498932", "0.7498932", "0.7476314", "0.7476314", "0.7476314", "0.7476314", "0.74674606", "0.74520385", "0.74520385", "0.74520385", "0.74520385", "0.74520385", "0.73431563", "0.73144424", "0.73144424", "0.73144424", "0.71579766", "0.71...
0.7266079
19
Returns the arn associated the the role name. Using this method avoids hardcoding the aws account into the arn name.
def instance_profile_arn_lookup(session, instance_profile_name): if session is None: return None client = session.client('iam') response = client.get_instance_profile(InstanceProfileName=instance_profile_name) if response is None: return None else: return response['InstanceP...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_role_arn(self, role, partition='aws'):\n if not role or role.startswith(\"arn:aws\"):\n return role\n if not role.startswith(\"role/\"):\n role = \"role/\" + role\n return \"arn:{0}:iam::{1}:{2}\".format(partition, self.account_id, role)", "def role_arn(self...
[ "0.7861198", "0.7756153", "0.76403385", "0.7501626", "0.7501626", "0.747887", "0.747887", "0.747887", "0.747887", "0.747008", "0.7452663", "0.7452663", "0.7452663", "0.7452663", "0.7452663", "0.7345726", "0.7315004", "0.7315004", "0.7315004", "0.7266874", "0.7158131", "0.71...
0.0
-1
Test for existence of an S3 bucket. Note that this method can only test for the existence of buckets owned by the user.
def s3_bucket_exists(session, name): client = session.client('s3') resp = client.list_buckets() for bucket in resp['Buckets']: if bucket['Name'] == name: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bucket_exists(self, bucket, s3_client=None):\n\n s3_client = s3_client or self.s3_client\n\n try:\n s3_client.list_objects(Bucket=bucket, MaxKeys=1)\n return True\n except botocore.exceptions.EndpointConnectionError:\n logging.error(\"Couldn't connect to an...
[ "0.8318233", "0.8141941", "0.8003047", "0.789405", "0.7766357", "0.7745054", "0.76827997", "0.75209075", "0.7424082", "0.7327559", "0.7192139", "0.71852547", "0.71528953", "0.7121559", "0.70840293", "0.7035105", "0.6945679", "0.69106793", "0.68924725", "0.68634355", "0.684299...
0.8081882
2
gets the account id from the session using the iam client. This method will work even if you have assumed a role in another account.
def get_account_id_from_session(session): if session is None: return None return session.client('iam').list_users(MaxItems=1)["Users"][0]["Arn"].split(':')[4]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_id():\n return client.get_caller_identity()['Account']", "def id(self) -> str:\n account_id = self.__session.client(\"sts\").get_caller_identity().get(\"Account\")\n if account_id:\n return account_id\n raise ValueError(\"get_caller_identity did not return Account\"...
[ "0.716123", "0.69258696", "0.6868835", "0.6868835", "0.6868835", "0.6868835", "0.6868835", "0.6868835", "0.6868835", "0.6868835", "0.6804414", "0.67929757", "0.67919576", "0.6678467", "0.6673702", "0.661376", "0.6577138", "0.6577138", "0.6577138", "0.6577138", "0.6577138", ...
0.797403
0
Returns the arn for a lambda given a lambda function name.
def lambda_arn_lookup(session, lambda_name): if session is None: return None client = session.client("lambda") response = client.get_function(FunctionName=lambda_name) if response is None: return None else: return response['Configuration']['FunctionArn']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lambda_arn(region: str, first_part: str, second_part: str=None) -> str:\n client = boto3.client('lambda', region_name=region)\n response = client.list_functions()\n for x in response['Functions']:\n if second_part:\n if first_part in x['FunctionArn'] and second_part in x['Functio...
[ "0.62491465", "0.6024986", "0.59035015", "0.5837769", "0.5678364", "0.56479216", "0.55890566", "0.54492086", "0.5431791", "0.5426185", "0.53477263", "0.52988434", "0.52703404", "0.5237456", "0.5228843", "0.5223322", "0.52192754", "0.52119076", "0.5209872", "0.52070284", "0.51...
0.7466593
0
Use SHA1 hash to hash a string, convert it to integer and shift right (160 m) places
def chord_hash(input_string): h = hashlib.sha1() # 160 bit string encoded_data = input_string.encode('utf-8') h.update(encoded_data) hex_string = h.hexdigest() hex_value = int(hex_string, 16) hash_integer_value = hex_value >> (160 - m) return hash_integer_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sha1(self, s):\n\t\tself.sha1_calls += 1\n\t\treturn int(hashlib.sha1(s).hexdigest(), 16)", "def computeHash(string):\n\tif isBytes(string):\n\t\tstring = string.decode(\"latin-1\")\n\thash_ = 63689\n\tfor char in string:\n\t\thash_ = hash_ * 378551 + ord(char)\n\treturn hash_ % 65536", "def strhash(s: str...
[ "0.7196707", "0.71366036", "0.69533736", "0.6906234", "0.6869732", "0.6842359", "0.68278766", "0.6794289", "0.6765675", "0.6747291", "0.6716161", "0.65964735", "0.6587518", "0.6550875", "0.65399194", "0.6535304", "0.6471856", "0.6450568", "0.6412695", "0.6410531", "0.6410033"...
0.7221014
0
Returns a value modulo 2^m. Used to wrap the value between 0 and 2^m.
def constrain(value): size = 2**m return (value%size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def powermod(a, b, m):\n return mod(power(a, b), m)", "def mod_pow(a: int, b: int, m: int) -> int:\n\tres = 1\n\twhile b > 0:\n\t\tif b % 2 != 0:\n\t\t\tres = (res * a) % m\n\t\ta = (a * a) % m\n\t\tb //= 2\n\treturn res", "def powmod(x, k, m):\n ans = 1\n while k > 0:\n if odd(k):\n ...
[ "0.6996555", "0.69771385", "0.6762345", "0.6758635", "0.67553735", "0.6721199", "0.66469485", "0.6575849", "0.65531385", "0.6530114", "0.6495845", "0.6472579", "0.6451471", "0.6407313", "0.63954645", "0.6324573", "0.6313473", "0.6308792", "0.63087666", "0.63069856", "0.627844...
0.61999327
25
Checks if a given value is in the range start to end while considering given options, i.e., including/excluding start and/or end of the range.
def is_between(value, start, end, including_start=False, including_end=False): if not including_start and not including_end: # not include both start and end if (start < value < end): return True elif (start > end) and (start < value <= (2**m - 1) or 0 <= value < end): retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_range(start, end, x):\n if start <= end:\n return start <= x <= end\n else:\n return start <= x or x <= end", "def check_ranges(ranges, value):\n for fromto in ranges:\n start, end = fromto.split('-')\n if int(value) in range(int(start), int(end) + 1):\n return True\n ...
[ "0.747743", "0.7280649", "0.70743567", "0.69564146", "0.6774148", "0.6771647", "0.6761343", "0.67048234", "0.66715246", "0.6633946", "0.65986615", "0.6595173", "0.6571696", "0.6535455", "0.6530302", "0.6497032", "0.6490265", "0.64786255", "0.64565444", "0.6445503", "0.6378988...
0.7582872
0
Pops up Advanced Options
def adv_new_window(self): adv=workflow.advancedoptions_w.ADialog() adv.exec_()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def option_show_advanced_dialog(self):\n return six.next(six.itervalues(self.zap._request(self.zap.base + 'spider/view/optionShowAdvancedDialog/')))", "def help_opt(self):\n print(OPTIONS)", "def set_option_show_advanced_dialog(self, boolean, apikey=''):\n return six.next(six.itervalues(se...
[ "0.73913246", "0.6876063", "0.6805797", "0.67696077", "0.66258967", "0.65356195", "0.63632023", "0.63622886", "0.6299096", "0.62647694", "0.62544674", "0.6179508", "0.61681664", "0.61645436", "0.6160933", "0.6142374", "0.6141672", "0.6141665", "0.6137324", "0.6122997", "0.611...
0.6164144
14
write undulator parameters into .pkl for storage
def und_pickle(self): und=json.load(open("pickle\\und.json","r")) und["energy"]=self.ui.und_energy.text() und["current"]=self.ui.und_current.text() und["period"]=self.ui.und_period.text() und["num"]=self.ui.und_nperiods.text() und["sigx"]=self.ui.und_sigx.text() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_pkl(self, filename):\n param_dict = {}\n param_dict['learningrate'] = self.learningrate\n param_dict['verbose'] = self.verbose\n param_dict['loadsize'] = self.loadsize\n param_dict['batchsize'] = self.batchsize\n param_dict['momentum'] = self.momentum\n par...
[ "0.64397955", "0.6262204", "0.6123736", "0.59713453", "0.5930658", "0.58989054", "0.58577263", "0.58267593", "0.57620645", "0.57597244", "0.57279533", "0.5693982", "0.5675025", "0.56738997", "0.5597991", "0.5597991", "0.5558043", "0.5554464", "0.5553245", "0.5546644", "0.5511...
0.0
-1
Loads default values from file, need to implement recalling numbers from saved run
def und_default(self): f=open("pickle\\undload.json","r") und=json.load(f) f.close() self.ui.und_energy.setText(und["energy"]) self.ui.und_current.setText(und["current"]) self.ui.und_kx.setText(und["kx"]) self.ui.und_ky.setText(und["ky"]) self.ui....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadDefaults(self):\n # (025) Merged into settings.RawSettings.\n pass", "def init_from_file(self):\n self.src.load('start.00') \n self.oe1.load('start.01')\n #self.det.load('start.02')\n print('NOTE: variables loaded from start.00/start.01 files')", "def load(se...
[ "0.6519448", "0.6475309", "0.61636525", "0.6163593", "0.61309457", "0.60647124", "0.60643244", "0.6055603", "0.6055603", "0.6055603", "0.5975182", "0.595574", "0.5928173", "0.5853351", "0.5782269", "0.5742056", "0.57281154", "0.57196534", "0.5714985", "0.56829745", "0.5681391...
0.0
-1
Loads default values from file, need to implement recalling numbers from last run
def und_load_values(self): f=open("pickle\\und.json","r") und=json.load(f) f.close() self.ui.und_energy.setText(und["energy"]) self.ui.und_current.setText(und["current"]) self.ui.und_kx.setText(und["kx"]) self.ui.und_ky.setText(und["ky"]) self.ui....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadDefaults(self):\n # (025) Merged into settings.RawSettings.\n pass", "def init_from_file(self):\n self.src.load('start.00') \n self.oe1.load('start.01')\n #self.det.load('start.02')\n print('NOTE: variables loaded from start.00/start.01 files')", "def write_d...
[ "0.65797085", "0.63128245", "0.6236716", "0.6220871", "0.6120827", "0.6109339", "0.610519", "0.6086135", "0.6086135", "0.6086135", "0.5866077", "0.57987785", "0.5787708", "0.57814926", "0.57568806", "0.57412106", "0.5712932", "0.5709793", "0.57072526", "0.5689901", "0.5677772...
0.0
-1
Runs undulator without heatbump
def main(): app=QtGui.QApplication(sys.argv) ud=UDialog() ud.exec_() sys.exit(app.exec_())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_to_untuned_inputs(self):\n\n self.h_e=self.inputs.noise_flat.T\n self.h=np.vstack([self.h_e,self.h_i])", "def _DeRedden(lam,flux,ra,dec,dustmap_path='/Users/vzm83/Softwares/sfddata-master'): \n m = sfdmap.SFDMap(dustmap_path) \n flux_unred = pyasl.unred(lam,flux,m.ebv(ra,d...
[ "0.5825724", "0.55327785", "0.5512841", "0.5493843", "0.5459791", "0.5459475", "0.54442096", "0.5436492", "0.5357355", "0.5350859", "0.53506887", "0.5313294", "0.52936095", "0.52837026", "0.52817035", "0.5275026", "0.52726203", "0.5268448", "0.5245947", "0.52385837", "0.52303...
0.0
-1
remove a connection from the node
def remove_connection(self, conn: Connection): self.__connections.remove(conn) # now from other: other = conn.other for others_conn in other.get_connections(): if others_conn.other.node_id == self.node_id: other.__connections.remove(others_conn) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_node():\n\ttry:\n\t\tnetwork.remove_connection()\n\texcept ValueError as err:\n\t\tfeedback.config(text=err)", "def remove(self, node):\r\n\r\n # Allow node name, get the real node object\r\n if isinstance(node, basestring):\r\n name = node\r\n node = self.nodes[nam...
[ "0.8202315", "0.7998739", "0.7811269", "0.7807282", "0.77307093", "0.76354533", "0.73361313", "0.72516835", "0.72249186", "0.72085327", "0.7105888", "0.7099663", "0.7082802", "0.70826495", "0.70426273", "0.7015274", "0.70009166", "0.6988864", "0.6969774", "0.6945303", "0.6941...
0.767631
5
remove a connection from a node, by the id of the other node in the connection
def remove_connection_by_id(self, node_id: int): for conn in self.get_connections(): if conn.other.node_id == node_id: self.remove_connection(conn) break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_connection(self, conn: Connection):\n self.__connections.remove(conn)\n # now from other:\n other = conn.other\n for others_conn in other.get_connections():\n if others_conn.other.node_id == self.node_id:\n other.__connections.remove(others_conn)\n ...
[ "0.75725925", "0.7457941", "0.7354663", "0.7288606", "0.72552603", "0.70799124", "0.70066655", "0.6946529", "0.69460434", "0.6903269", "0.68844795", "0.68477476", "0.6784337", "0.6707545", "0.668367", "0.66627955", "0.6633565", "0.65117043", "0.649248", "0.64896923", "0.64595...
0.8295772
0
remove all connection but the input one
def keep_only_connection(self, conn_to_keep: Connection, apply_for_other=False): for conn_other_id in self.get_connections_ids().copy(): if conn_other_id != conn_to_keep.other.node_id: self.remove_connection_by_id(conn_other_id) if not apply_for_other: return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_connection(self, source, target):\r\n\r\n connection = (self.coalesce_node(source), self.coalesce_node(target))\r\n self.connections.discard(connection)", "def removeConnection(tagA, tagB): #@NoSelf", "def remove_connection(self, conn: Connection):\n self.__connections.remove(c...
[ "0.7204449", "0.709915", "0.7043632", "0.6896871", "0.68019485", "0.6683061", "0.6558739", "0.6539934", "0.65027815", "0.6491711", "0.6482698", "0.64230627", "0.64163333", "0.6373198", "0.6361596", "0.63564336", "0.6348523", "0.6335339", "0.6326395", "0.6289121", "0.6273604",...
0.6474718
11
check if all inputs are torch.Tensor
def check_input_type(func): @functools.wraps(func) def wrapper_check_input_type(*args): new_args = [] for X in list(args): new_args.append(_check_type(X)) return func(*new_args) return wrapper_check_input_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_is_tensor(obj):\n if not isinstance(obj, torch.Tensor):\n raise TypeError(\"Input type is not a torch.Tensor. Got {}\".format(type(obj)))", "def _is_tensor(x: Any) -> bool:\n if has_tensorflow and isinstance(x, _TfTensor):\n return True\n if has_pytorch and isinstance...
[ "0.763875", "0.7580402", "0.74269634", "0.7156365", "0.70370084", "0.6998518", "0.6929256", "0.687199", "0.68316144", "0.67247117", "0.6717951", "0.6665843", "0.66343147", "0.65878856", "0.65676725", "0.6534087", "0.6494567", "0.6458143", "0.6451148", "0.63843507", "0.636687"...
0.0
-1
check if all inputs are torch.Tensor
def check_object_input_type(func): @functools.wraps(func) def wrapper_check_input_type(ref, *args): new_args = [ref] for X in list(args): new_args.append(_check_type(X)) return func(*new_args) return wrapper_check_input_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_is_tensor(obj):\n if not isinstance(obj, torch.Tensor):\n raise TypeError(\"Input type is not a torch.Tensor. Got {}\".format(type(obj)))", "def _is_tensor(x: Any) -> bool:\n if has_tensorflow and isinstance(x, _TfTensor):\n return True\n if has_pytorch and isinstance...
[ "0.763875", "0.7580402", "0.74269634", "0.7156365", "0.70370084", "0.6998518", "0.6929256", "0.687199", "0.68316144", "0.67247117", "0.6717951", "0.6665843", "0.66343147", "0.65878856", "0.65676725", "0.6534087", "0.6494567", "0.6458143", "0.6451148", "0.63843507", "0.636687"...
0.0
-1
Generate key using random bytes with specified size.
def generate_key(self, size): key = bytearray() for i in range(0,size): random_byte = ord(os.urandom(1)) key.append(random_byte) return key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_key():\n return get_random_bytes(KEY_SIZE)", "def random_key(size):\n return ''.join(random.choice(string.letters) for _ in range(size))", "def get_random_secret_key(cls, size=None):\n if not size:\n size = cls.default_secret_key_size\n return os.urandom(size)", "d...
[ "0.86057556", "0.80857086", "0.8032245", "0.8031311", "0.8002937", "0.79636395", "0.7943351", "0.790454", "0.7867546", "0.7851878", "0.77818877", "0.7591018", "0.7578894", "0.75569624", "0.7556202", "0.74411345", "0.74128795", "0.73925257", "0.7379331", "0.72996837", "0.72394...
0.8874437
0
'Encrypt' the password with the key. Reverse key bytes and XOR with password bytes. Very low security but a bit obfuscated.
def mix_keys(self, password, key): rev_key = list(reversed(key)) # Reverse bytes result = bytearray() for i in range(0, len(password)): xored = password[i] ^ rev_key[i] # Mix each byte result.append(xored) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xor_encode(data, key):\n if not data:\n return \"\"\n if not key:\n raise exceptions.EncryptError\n return binascii.hexlify(\n ''.join(chr(ord(a) ^ ord(b)) for a, b in zip(data, key)).encode(\"utf-8\")).decode(\"utf-8\")", "def encrypt_password(pass_to_encrypt):\n\n temp_key ...
[ "0.71066976", "0.70337445", "0.70089537", "0.6976745", "0.69720566", "0.68509895", "0.6773852", "0.6713531", "0.669853", "0.6677601", "0.66625684", "0.6630633", "0.66287386", "0.6601027", "0.6546598", "0.65335375", "0.6481441", "0.64804226", "0.646954", "0.6465444", "0.643424...
0.70879525
1
Log of the loss (error) summed over all entries The negative of the logarithm of the frequency (probability) of the predicted label given the true binary label for a category.
def log_loss(actual, predicted): predicted, actual = np.array(predicted), np.array(actual) small_value = 1e-15 predicted[predicted < small_value] = small_value predicted[predicted > 1 - small_value] = 1. - small_value return (-1. / len(actual)) * np.sum( actual * np.log(predicted) + (1. - ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_loss(self):\n probabilities = self.probability_array().copy()\n # need to flip the probabilities for p < 0.5 with this binary case.\n # 1 - old_val is same as oldval*-1 + 1. Do in 2 steps:\n probabilities[np.equal(0, self.y)] *= -1\n probabilities[np.equal(0, self.y)] +=...
[ "0.732824", "0.71484697", "0.70312464", "0.7027971", "0.7025981", "0.69825447", "0.696504", "0.69374216", "0.69364244", "0.6865856", "0.68495315", "0.68495315", "0.6829255", "0.6797045", "0.67773986", "0.6731861", "0.66845536", "0.66764647", "0.6645182", "0.6607527", "0.65839...
0.65407634
24
Finds the peak in the specified time range. Finds the peak in the data in the specified time range. You must pass it pretrigger and timebase as well as the time and data series. timebase is an integer equal to (1 us)/(delta t of the digitizer). For example, if capturing data at 10 MHz, timebase = (1e6/1e7) = 10. For da...
def polyPeak_noPlot(time, data, timerange = [40,80],axis = 'x'): # Find the indices corresponding to the ends of the time range t1 = mj.tindex(time,timerange[0])#+pretrigger) t2 = mj.tindex(time,timerange[1])#+pretrigger) # print 't1=', t1 # print 't2=', t2 # generate an array of indices spanni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak(data, fft_data=None):\n return np.max(np.abs(data))", "def find_peak(mhw, mhw_relSeas, ev, tt_start):\n tt_peak = np.argmax(mhw_relSeas)\n mhw[\"time_peak\"].append(mhw[\"time_start\"][ev] + tt_peak)\n mhw[\"date_peak\"].append(date.fromordinal(mhw[\"time_start\"][ev] + tt_peak))\n mhw[\"...
[ "0.6256507", "0.62215835", "0.61286575", "0.59447867", "0.5906512", "0.5898816", "0.58075976", "0.5780191", "0.57295424", "0.5648836", "0.5639455", "0.5607322", "0.5568726", "0.55157095", "0.551521", "0.5498673", "0.54892355", "0.54749453", "0.5392688", "0.53639615", "0.53472...
0.6415059
0
Compute B field of Helmholtz coil at (x,y,z) i is current in amps and coil is the coil selection. 1 for the old wooden coil 2 for the new delrin coil Please, please enter the radial position in METERS.
def helmholtz2(r, i = 1.0, coil = 2): r1, r2, r3 = r # a is the radius of the coil in meters, and d is the distance between the # two coils. if coil == 1: # coil 1 is the old wooden coil. It has two turns per side, a radius # of 6.1" and a separation of 5.9". a = 6.1 * 0.0254 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_magnetic_field(self, coords, params={}, basis=\"rpz\"):", "def getMagneticField(self, z):\n return float(self.solenoid.B_interp(z))", "def compute_magnetic_field(self, coords, params=None, basis=\"rpz\"):\n assert basis.lower() in [\"rpz\", \"xyz\"]\n if isinstance(coords, Grid...
[ "0.599397", "0.5703977", "0.554072", "0.5501309", "0.5486127", "0.54798865", "0.54760885", "0.54760885", "0.5459302", "0.5427586", "0.53788805", "0.53339124", "0.53275996", "0.53201574", "0.52815235", "0.5273773", "0.5241065", "0.5233045", "0.5220011", "0.5209557", "0.5185021...
0.5485373
5
Provides positions in meters along probe stalks for 4x4 array of probes built by M. Kaur.
def get_probeLocs_calib_setup(dir, num_probes = 16): position_vectors = [[0] * 3 for i in range(num_probes)] #every x postion # Convert to meters x_pos = [-4.25*1e-3*25.4, -4.25*1e-3*25.4, 4.24*1e-3*25.4, 4.24*1e-3*25.4] y_pos = [-4.25*1e-3*25.4, 4.24*1e-3*25.4, 4.24*1e-3*25.4, -4.25*1e-3*25.4] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_probeLocs_calib_setup_cm(dir, num_probes = 16):\n position_vectors = [[0] * 3 for i in range(num_probes)]\n\n #every x postion\n\n # Convert to meters\n x_pos = [-4.25*2.54, -4.25*2.54, 4.24*2.54, 4.24*2.54]\n y_pos = [-4.25*2.54, 4.24*2.54, 4.24*2.54, -4.25*2.54]\n z_pos = [-2.25*2.54, -...
[ "0.68602735", "0.635877", "0.622993", "0.62070554", "0.57699996", "0.5661007", "0.5541144", "0.54987085", "0.54753906", "0.54418695", "0.5396649", "0.5383856", "0.53815603", "0.5378696", "0.53735656", "0.534419", "0.53433716", "0.5325735", "0.53203666", "0.52891964", "0.52763...
0.68148327
1
Provides positions in meters along probe stalks for 4x4 array of probes built by M. Kaur.
def get_probeLocs_calib_setup_cm(dir, num_probes = 16): position_vectors = [[0] * 3 for i in range(num_probes)] #every x postion # Convert to meters x_pos = [-4.25*2.54, -4.25*2.54, 4.24*2.54, 4.24*2.54] y_pos = [-4.25*2.54, 4.24*2.54, 4.24*2.54, -4.25*2.54] z_pos = [-2.25*2.54, -0.75*2.54, 0....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_probeLocs_calib_setup(dir, num_probes = 16):\n position_vectors = [[0] * 3 for i in range(num_probes)]\n\n #every x postion\n\n # Convert to meters\n x_pos = [-4.25*1e-3*25.4, -4.25*1e-3*25.4, 4.24*1e-3*25.4, 4.24*1e-3*25.4]\n y_pos = [-4.25*1e-3*25.4, 4.24*1e-3*25.4, 4.24*1e-3*25.4, -4.25*1...
[ "0.6814141", "0.6357938", "0.6228107", "0.62063867", "0.576915", "0.56598634", "0.5540284", "0.5499135", "0.5474505", "0.54411244", "0.5393473", "0.5382529", "0.5381584", "0.53801537", "0.5371877", "0.53437704", "0.53433514", "0.5324205", "0.5318798", "0.5288676", "0.5275662"...
0.68606234
0
Written by M. Kaur KG 20190605 This (I think) goes though every shot, and finds the maximum magetic field then averages the maximum signal over several shots
def getRatio(probe_num, position_vector, shot_range, dir, day ='050119r'): ratio_x = 0 ratio_y = 0 ratio_z = 0 # helm_B = [0,0,0] divideby = 0 for shot in range(shot_range[0], shot_range[1]+1): print( 'On shot ', day+str(shot), ' for probe ',probe_num) x,y,z, currmax,helmB_new =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coldaverage( names):\n\n rs = radioastronomy.Spectrum() # create input and average structures\n avenames = names # create an output list to average\n\n# assume only a limited range of galactic latitudes are available\n# not range above +/-60.\n use60Range = False\n minGlat = 90. ...
[ "0.62299377", "0.6013409", "0.5896017", "0.58733714", "0.58249664", "0.5776324", "0.57661194", "0.56742597", "0.56561136", "0.5610272", "0.5569868", "0.55585563", "0.55527085", "0.55359155", "0.54949343", "0.5475598", "0.5468535", "0.54521996", "0.54429483", "0.5442529", "0.5...
0.0
-1
This finds the ratio between the idealized helmholtz field and the actual recoreded signal This also corrects for inverted signals... however due to what I'm assuming is noise, finding the inverted ones are a bit tricky feel free to uncomment the plotting lines and see if it needs adjusments, though I did get it workin...
def ratio_4_doc(shot, dir, num_probes = 16): # data = [[0] *3 for i in range(num_probes)] # magdata = hdr.getMagData(shot) probe_locs = get_probeLocs_calib_setup(shot) data=hdr.getquikData(shot) time,eastcurrent,westcurrent = loadcurrent(shot)#using eastcurrent ratios = [[0]*3 for i in range(num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculate_measurement_error(self): \n \n # Calculate Hartmann Spot\n # FIXME what are factor_1, factor_2 ???\n factor_1, factor_2 = 206265*5.89e-7, 206265*6.5e-7\n term1, term2 = factor_1/self.actuator_spacing, factor_2/self.r0\n hartmann_spot = np.max([term1, term...
[ "0.62044317", "0.59503055", "0.5934977", "0.58116406", "0.5744772", "0.5688612", "0.5682206", "0.5657256", "0.5637151", "0.56292534", "0.562283", "0.56201357", "0.5602905", "0.5597058", "0.55753255", "0.55715555", "0.55521727", "0.5543683", "0.55348676", "0.5511092", "0.55000...
0.6009351
1
This function is where any userspecified values shoulbe be. Given shots in the x, y and z direction, it finds position vectors (a 16 by 3 array becuase there are 16 probe locations (4 locations on 4 probes) and each probe location has an x, y, and z coordinate relative to the center of the Bfield) then uses those posit...
def generateMatrix(): num_probes = 16 # print(position_vectors) # Create the (48x4) calibration matrix: calibration_lookup= [[0] * 3 for i in range(num_probes)] calibration_matrix = [[0] * 9 for i in range(num_probes)] counter = 0 # first populate with x-direction: shot_range = [17, 20...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_magnetic_field(self, coords, params={}, basis=\"rpz\"):", "def get_probeLocs_calib_setup_cm(dir, num_probes = 16):\n position_vectors = [[0] * 3 for i in range(num_probes)]\n\n #every x postion\n\n # Convert to meters\n x_pos = [-4.25*2.54, -4.25*2.54, 4.24*2.54, 4.24*2.54]\n y_pos = [...
[ "0.63979864", "0.58925015", "0.5888225", "0.5737547", "0.56940204", "0.566803", "0.5652638", "0.561245", "0.56079805", "0.5605385", "0.56043845", "0.5591721", "0.5587432", "0.55768406", "0.55294365", "0.5511706", "0.55075437", "0.54954225", "0.5465866", "0.54398566", "0.54375...
0.51907223
42
More precise than plotting becuase it doens't have to thin the times For every shot, find the calibration value, then average it
def generatelookup(num_probes = 16): calibration_lookup= [[0] * 3 for i in range(num_probes)] # print(calibration_lookup) day = '050119r' date = '050119' def _run_calib(shots, dir): """ Helper function """ for shot in shots: shot = day+str(shot) ratios = rati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photometric_calibration():\n pass", "def calibration(self) -> int:", "def doRun(run=77):\n r = xanes_analyzeRun.AnalyzeRun(run)\n r.load()\n calibs = list(r.results.keys())\n calibs.sort()\n p2 = [np.nanmedian(r.results[c].p1, axis=0) for c in calibs]\n p2 = np.asarray(p2)\n ref...
[ "0.63869935", "0.6185194", "0.6163579", "0.60991865", "0.5894125", "0.5810871", "0.57928896", "0.5788251", "0.5757029", "0.5747513", "0.5740013", "0.567313", "0.56440735", "0.56413454", "0.56288755", "0.5609218", "0.56066924", "0.5535295", "0.550225", "0.5496323", "0.5492045"...
0.51465684
84
Retrieve the .mat filenames for the troika dataset. Review the README in ./datasets/troika/ to understand the organization of the .mat files.
def LoadTroikaDataset(): data_dir = "./datasets/troika/training_data" data_fls = sorted(glob.glob(data_dir + "/DATA_*.mat")) ref_fls = sorted(glob.glob(data_dir + "/REF_*.mat")) return data_fls, ref_fls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrices_names(self, folder=None):\n if folder is None:\n abs_path = os.path.abspath(os.path.dirname(sys.argv[0]))\n folder = os.path.join(abs_path, 'matrix')\n\n matrix_name_x = \"%s_%s_%s_%s_x.txt\" % (\n self.D, self.Rs, self.axe_X, self.FOV_img)\n matri...
[ "0.62999743", "0.5992772", "0.5919344", "0.58812904", "0.5764292", "0.57600445", "0.5720086", "0.56433666", "0.5607395", "0.5561246", "0.55274653", "0.55114895", "0.5472151", "0.54595053", "0.54580384", "0.5449727", "0.54414546", "0.54392225", "0.54072315", "0.5384773", "0.53...
0.73199314
0
Loads and extracts signals from a troika data file.
def LoadTroikaDataFile(data_fl): data = sp.io.loadmat(data_fl)['sig'] return data[2:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_signal_raw(filepath):\n signal_raw = sio.loadmat(filepath)['signal_raw']\n return signal_raw", "def _load_unlabeled(self, path):\n signal, info = wfdb.rdsamp(path)\n self.fs = 250\n self.lead_match = ['anonymous1', 'anonymous2']\n self.raw_data = np.transpose(np.array([...
[ "0.626287", "0.62021583", "0.6054611", "0.5924737", "0.5851997", "0.5830161", "0.5783297", "0.573766", "0.5731504", "0.57031226", "0.5665131", "0.56484056", "0.5623416", "0.56071955", "0.5598461", "0.5585858", "0.55778784", "0.55460054", "0.5543505", "0.553586", "0.5512837", ...
0.6063819
2
Loads and extracts reference from a troika reference file.
def LoadTroikaRefFile(ref_fl): refdata = sp.io.loadmat(ref_fl)['BPM0'] return refdata[2:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_reference(self, path_to_reference):\n with open(path_to_reference,'r') as f:\n qids_to_relevant_docids = self.load_reference_from_stream(f)\n return qids_to_relevant_docids", "def test_load_ref():\n\n itraj = os.path.join(path, \"alanine_dipeptide.nc\")\n iref = os.path.jo...
[ "0.65891796", "0.63777584", "0.6298703", "0.6292496", "0.6262168", "0.60937804", "0.605416", "0.5891338", "0.5869947", "0.58570164", "0.5797035", "0.5793951", "0.57778513", "0.57709974", "0.57157594", "0.56981564", "0.56818175", "0.56198025", "0.56030697", "0.5597448", "0.558...
0.6084144
6