query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Determine what kind of flavor we want for our Flan. | def check_flan_flavor(flavor):
if not flavor:
flan_flavor = "plain old boring"
else:
flan_flavor = flavor
return (flan_flavor + " flavored flan") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flavor(self):\n return self._flavor",
"def GetFlavor(params):\n flavors = {\n 'cygwin': 'win',\n 'win32': 'win',\n 'darwin': 'mac',\n }\n if 'flavor' in params:\n return params['flavor']\n if sys.platform in flavors:\n return flavors[sys.platform]\n if sys.platform.startswith('suno... | [
"0.7198069",
"0.70691574",
"0.70600504",
"0.7038061",
"0.6974424",
"0.6974424",
"0.6780557",
"0.67735255",
"0.66562754",
"0.6603192",
"0.6585234",
"0.6561961",
"0.6531786",
"0.63524115",
"0.6305831",
"0.6278412",
"0.6211117",
"0.61978173",
"0.6141366",
"0.6072828",
"0.6059918... | 0.7246331 | 0 |
Adds a symbol to the set of symbols of the Machine. Sets the blank symbol only if it is not already set. | def _set_symbol(self, symbol, blank=False):
self._symbols.add(symbol)
try:
assert self._blank_symbol == None or not blank
if blank:
self._blank_symbol = symbol
except:
raise Exception(
f"Machine got blank symbol '{symbol}' whic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, symbol, value):\n if symbol in self.symbol_map:\n raise ValueError(f\"symbol {symbol} already exists in map.\")\n self.symbol_map[symbol] = value",
"def add_symbol(self, symbol):\n self.symbols_list.append(symbol)\n self.symbols_list.sort()",
"def addSymbol(... | [
"0.737178",
"0.71844953",
"0.6879582",
"0.6751897",
"0.6693627",
"0.66602457",
"0.66042966",
"0.65442795",
"0.6537731",
"0.6475653",
"0.6472118",
"0.6463029",
"0.63761586",
"0.63514227",
"0.6310761",
"0.6297593",
"0.62926525",
"0.62787044",
"0.622642",
"0.62097865",
"0.619931... | 0.8360916 | 0 |
Parses a definition for a Machine object. | def parse(self, definition):
comment_re = re.compile(r"(#.*)")
state_re = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_]*)([.*])?$")
transition_re = re.compile(
r"^'(.)'\s+'(.)'\s+([<>])\s+([a-zA-Z_][a-zA-Z0-9_]*)$"
)
lines = list(
filter(
lambda x:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_single_definition(unparsedDefinition):\r\n parsed = {'definition': unparsedDefinition['difino']}\r\n parsed['subdefinitions'] = [\r\n _parse_subdefinitions(subdefinition)\r\n for subdefinition in unparsedDefinition['pludifinoj']\r\n ]\r\n \r\n parsed['examples'] = [\r\n ... | [
"0.56363386",
"0.55514866",
"0.5501883",
"0.54004073",
"0.535413",
"0.53299636",
"0.53040886",
"0.52859396",
"0.5224299",
"0.5166532",
"0.51594836",
"0.5115619",
"0.51043546",
"0.5061594",
"0.50540215",
"0.50540215",
"0.5051268",
"0.5033262",
"0.50239384",
"0.5016015",
"0.499... | 0.58957094 | 0 |
Resets the tape, head and state of the Machine. | def reset(self, tape):
self._current_state = self._start_state
self._tape = list(tape)
self._head = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.index = self.start_index\n self.state = self.initial_state\n self.tape = Tape(empty_value=self.empty_value)",
"def reset (self):\n\n self.currentState = self.initialState\n self.inputSymbol = None",
"def reset(self):\n Simulation.reset(self)",
... | [
"0.7429243",
"0.69576144",
"0.69318694",
"0.685927",
"0.6827475",
"0.6825976",
"0.67982167",
"0.6747884",
"0.6735652",
"0.672856",
"0.672856",
"0.672856",
"0.67073536",
"0.6703694",
"0.6701576",
"0.6701576",
"0.6701576",
"0.6701576",
"0.6701576",
"0.6701576",
"0.6701576",
"... | 0.8252242 | 0 |
Explicitly set the recording state to state. | def set_recording_state(self, state):
assert isinstance(state, (bool, int))
self.recording = state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_recording(self, recording):\n self.record_states = recording",
"def set_recording(self, recording):\r\n self.recording = recording",
"def enable_recording(self, new_state=True):\n self._is_recording = new_state",
"def __setstate__(self, state):\n\n self.set(DER = state)",
... | [
"0.8397688",
"0.71942544",
"0.70696265",
"0.7002531",
"0.6923284",
"0.69138104",
"0.6876642",
"0.682559",
"0.682559",
"0.682559",
"0.682559",
"0.682559",
"0.682559",
"0.682559",
"0.682559",
"0.682559",
"0.682559",
"0.682559",
"0.682559",
"0.682559",
"0.6818264",
"0.68059945... | 0.8421561 | 0 |
Toggle the recording state. | def toggle(self):
if self.recording:
logger.debug('Pausing ring buffer recording')
else:
logger.debug('Resuming ring buffer recording')
self.recording = not self.recording | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_recording_state(self, state):\n assert isinstance(state, (bool, int))\n self.recording = state",
"def enable_recording(self, new_state=True):\n self._is_recording = new_state",
"def update(self):\n enabled = True if self._camera[\"recording_mode\"] != \"never\" else False\n ... | [
"0.7379402",
"0.7345225",
"0.6897455",
"0.68279135",
"0.67939514",
"0.6779239",
"0.6746105",
"0.6724644",
"0.6659277",
"0.6649085",
"0.66368675",
"0.6609908",
"0.65981084",
"0.65981084",
"0.658571",
"0.6556684",
"0.64841735",
"0.6432129",
"0.6410469",
"0.63564646",
"0.6327811... | 0.82393235 | 0 |
Return the timestamp associated with the specified image index. | def get_timestamp(self, index):
return self.db.get_node(
'/images/img{:04d}'.format(index)).attrs.timestamp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetTimestamp(self, entry_index):\n return self._timestamps[entry_index]",
"def _getTimeStamp(self, index):\n\n if self._n_cset:\n if index is None:\n return self._timestamps[self._acsi]\n else:\n return self._timestamps[index]\n else:\n ... | [
"0.67218184",
"0.63522774",
"0.625728",
"0.6161379",
"0.6146714",
"0.6110099",
"0.6103994",
"0.60976535",
"0.6072466",
"0.60624766",
"0.59977585",
"0.5965456",
"0.59633976",
"0.59579647",
"0.5909631",
"0.5895183",
"0.5875945",
"0.58575124",
"0.5834482",
"0.58286786",
"0.58139... | 0.8940892 | 0 |
Return the recorded ROI for the given index. | def get_roi(self, index):
return self.db.get_node('/images/img{:04d}'.format(index)).attrs.roi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_roi_rect_by_index(self, index):\n return int(self.rect_list[index][\"x1\"]), int(self.rect_list[index][\"y1\"]), \\\n int(self.rect_list[index][\"x2\"]), int(self.rect_list[index][\"y2\"])",
"def get_roi_line_by_index(self, index):\n return int(self.line_list[index][\"x1\"]), ... | [
"0.6685425",
"0.6491489",
"0.63368607",
"0.62810946",
"0.62326044",
"0.62326044",
"0.5919045",
"0.5829573",
"0.58119226",
"0.5724068",
"0.5634868",
"0.5595355",
"0.5586868",
"0.5559789",
"0.554171",
"0.550977",
"0.5471687",
"0.54615474",
"0.5421114",
"0.53905815",
"0.5389214"... | 0.7410617 | 0 |
Save the ring buffer to file filename. The output format will depend on the extension of filename. | def save_as(self, filename):
raise NotImplementedError(
"Saving ring buffers to other formats is not yet implemented.")
if filename[-3:] == 'zip':
pass # TODO
elif filename[-2:] == 'h5':
pass # TODO
elif filename[-4:] == 'fits':
pass # ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, fname, snver=None):\n self._io.save(fname)",
"def to_file(self, filename):\n self.header['n'] = self.n\n save_gyre(filename, self.header, self.data)",
"def save_as(self, filename):\n # Join together the buffer contents so it can be written to a file\n contents = \"\"\n... | [
"0.66321325",
"0.6604608",
"0.6562731",
"0.64335483",
"0.64077777",
"0.63998353",
"0.6398885",
"0.6397939",
"0.6369856",
"0.6354021",
"0.6286657",
"0.62851137",
"0.6244096",
"0.6244096",
"0.6230271",
"0.61896867",
"0.61477333",
"0.611484",
"0.61135226",
"0.6100261",
"0.602092... | 0.8182043 | 0 |
Save the ring buffer to an HDF5 file using the PyTables library. This requires PyTables to be installed with either | def save_as_hdf5(self, filename): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_hdf5(self, filename):\n filename += '.h5'\n try:\n hf = h5py.File(filename, 'w')\n hf.create_dataset('Array', data=self.flat_array)\n hf.close()\n except TypeError as err:\n if isinstance(self.mess_inst, MessagesGUI):\n self.m... | [
"0.6295007",
"0.61233366",
"0.61118317",
"0.6024696",
"0.59897345",
"0.5931716",
"0.5925943",
"0.59007144",
"0.58521616",
"0.5777547",
"0.57388747",
"0.5730122",
"0.56849515",
"0.5677608",
"0.5652777",
"0.5609461",
"0.5578832",
"0.55645543",
"0.55201614",
"0.54989177",
"0.549... | 0.68898726 | 0 |
Save the ring buffer to a FITS file using the Astropy library. This requires Astropy to be installed with either | def save_as_fits(self, filename): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_fits(self, name=None, output_path=None):\n pass",
"def saveFits(self, filename):\n \n if isinstance(self.res, type(None)):\n raise Exception('Result is not yet aviable.')\n \n header = fits.Header()\n header['NAXIS1'] = self.naxis\n header['NA... | [
"0.6351375",
"0.6321986",
"0.63159454",
"0.6159946",
"0.59933627",
"0.595426",
"0.58952725",
"0.5888947",
"0.58830416",
"0.58048767",
"0.57406783",
"0.5735594",
"0.56605303",
"0.5650868",
"0.56002384",
"0.55981505",
"0.5546471",
"0.5463205",
"0.54400367",
"0.5366371",
"0.5353... | 0.6828635 | 0 |
Execute pre hook script | def test_pre_hooks(self):
os.makedirs('/tmp/localhost/pacha_pre')
touch_script = open('/tmp/localhost/pacha_pre/foo.sh', 'w')
touch_script.write('''touch /tmp/localhost/pre_got_executed.txt''')
touch_script.close()
run = rebuild.Rebuild(hostname='localhost')
run.pre_hook... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pre_post_hooks(self):\n os.makedirs('/tmp/localhost/pacha_pre')\n os.makedirs('/tmp/localhost/pacha_post')\n pre_script = open('/tmp/localhost/pacha_pre/foo.sh', 'w')\n pre_script.write('''touch /tmp/localhost/pre_got_executed.txt''')\n pre_script.close()\n post_s... | [
"0.759358",
"0.73621875",
"0.72918934",
"0.72264814",
"0.70526624",
"0.70117944",
"0.69909036",
"0.69263935",
"0.69135416",
"0.67982525",
"0.6788915",
"0.67710733",
"0.6768303",
"0.67355055",
"0.67089957",
"0.6687215",
"0.6654927",
"0.6652886",
"0.65357006",
"0.6516884",
"0.6... | 0.77686775 | 0 |
Execute both pre and post hooks | def test_pre_post_hooks(self):
os.makedirs('/tmp/localhost/pacha_pre')
os.makedirs('/tmp/localhost/pacha_post')
pre_script = open('/tmp/localhost/pacha_pre/foo.sh', 'w')
pre_script.write('''touch /tmp/localhost/pre_got_executed.txt''')
pre_script.close()
post_script = ope... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _post_hooks(self):",
"def setup_hooks(self):\n pass",
"def pre_execute(self):",
"def postRun(self):\n pass",
"def _post_run_hook(self, runtime):\n pass",
"def on_hook(self) -> None:",
"def pre_build_hook(self):",
"def on_before_execution(self):\n pass",
"def post_pro... | [
"0.80948967",
"0.70629466",
"0.7053906",
"0.6904916",
"0.6878891",
"0.67881465",
"0.662801",
"0.6619334",
"0.6613622",
"0.6613622",
"0.6613622",
"0.6613622",
"0.6613622",
"0.6590337",
"0.6590337",
"0.6590337",
"0.6590337",
"0.6545335",
"0.6488723",
"0.6484735",
"0.64458454",
... | 0.7164809 | 1 |
Run a full rebuild and fail because no db was found | def test_rebuild_no_db(self):
os.makedirs('/tmp/remote_pacha/localhost/etc')
os.mkdir('/tmp/remote_pacha/localhost/home')
remote_file = open('/tmp/remote_pacha/localhost/etc/etc.conf', 'w')
remote_file.write("remote second file")
remote_file.close()
remote_file = open('/t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebuild_db():\n delete_db()\n create_db()\n insert_db()",
"def validate_db():\n if not os.path.exists(app.config['DATABASE']):\n print(\"Init database!\")\n init()",
"def test_database():\n sanity_tester = sanity.DatabaseSanity(Base, engine)\n sanity_tester.test()\n if sa... | [
"0.7292154",
"0.6359214",
"0.6348415",
"0.6336012",
"0.6334465",
"0.6322623",
"0.62703866",
"0.62209284",
"0.62134",
"0.6208199",
"0.61339605",
"0.6126262",
"0.6058358",
"0.6006172",
"0.60014945",
"0.5991569",
"0.5980901",
"0.59504825",
"0.5948537",
"0.586677",
"0.5865437",
... | 0.64247996 | 1 |
Test a simple rebuild with some files in the pacha.db | def test_rebuild(self):
pacha.DB_DIR = '/tmp/pacha_test/db'
pacha.DB_FILE ='/tmp/pacha_test/db/pacha_test.db'
pacha.permissions.DB_FILE ='/tmp/pacha_test/db/pacha_test.db'
pacha.sync.DB_FILE ='/tmp/pacha_test/db/pacha_test.db'
pacha.hg.DB_FILE ='/tmp/pacha_test/db/pacha_test.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rebuild_no_db(self):\n os.makedirs('/tmp/remote_pacha/localhost/etc')\n os.mkdir('/tmp/remote_pacha/localhost/home')\n remote_file = open('/tmp/remote_pacha/localhost/etc/etc.conf', 'w')\n remote_file.write(\"remote second file\")\n remote_file.close()\n remote_fi... | [
"0.72980964",
"0.6863426",
"0.65527713",
"0.63870674",
"0.6255685",
"0.6245181",
"0.6117568",
"0.6076369",
"0.60150194",
"0.59235954",
"0.5922191",
"0.5913737",
"0.5906409",
"0.5903624",
"0.5890652",
"0.5864806",
"0.5862683",
"0.58509976",
"0.5833254",
"0.58128977",
"0.581065... | 0.8171218 | 0 |
Return the active plugins of `project_id`. | def get_plugins(self, project_id):
response.content_type = 'application/json'
project_plugins = self.server.projects[project_id].plugins
plugins = []
for plugin in project_plugins.keys():
plugins.append({'id': plugin})
return json.dumps(plugins) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_projects(self):\n return self.projects.filter(active=True)",
"def get_projects(self):\n return conf.projects",
"def get_enabled_plugins(self):\n return self._enabled_plugins",
"def get_plugins(self):\n return []",
"def get_plugins(group, project=None):\n return _ge... | [
"0.6666622",
"0.62207335",
"0.61864966",
"0.61825234",
"0.606817",
"0.60661215",
"0.60538733",
"0.6007684",
"0.59860665",
"0.5953358",
"0.5933789",
"0.589718",
"0.58709055",
"0.58422714",
"0.5795465",
"0.57738656",
"0.57128495",
"0.5710045",
"0.5668924",
"0.5614691",
"0.56042... | 0.73636353 | 0 |
Return the `main` plugin source of this plugin for the given language. | def plugin_source(self, project_id, plugin_id, language):
try:
project = self.server.projects[project_id]
plugin = project.plugins[plugin_id]
fullpath = plugin.client_plugin_source(language)
except (KeyError, ValueError):
raise HTTPError(404)
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_plugin_source(self, language):\n\n static = self.static\n if static is None:\n return None\n\n filename = os.path.join(static, \"main.\" + language)\n realfilename = os.path.realpath(filename)\n\n if not realfilename.startswith(self.static + '/'): # pragma:... | [
"0.7541241",
"0.688626",
"0.5591561",
"0.54446316",
"0.5422065",
"0.53816205",
"0.5327444",
"0.53084797",
"0.52598286",
"0.5217657",
"0.5198788",
"0.5177965",
"0.5143488",
"0.5103181",
"0.50855315",
"0.507945",
"0.5029944",
"0.50189203",
"0.49991527",
"0.4993731",
"0.49323747... | 0.69887185 | 1 |
Serve static files under web/assets at /assets. | def server_static(self, filepath):
root = os.path.join(self.webbase, 'assets')
return static_file(filepath, root=root) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files_serve(path):\n return flask.send_from_directory(\"static/js\", path)",
"def serve_static_files(request, path, insecure=False, **kwargs):\n\n if not settings.DEBUG and not insecure:\n raise Http404\n normalized_path = posixpath.normpath(unquote(path)).lstrip('/')\n absolute_path = fin... | [
"0.69144833",
"0.67893183",
"0.67141455",
"0.6705759",
"0.6669034",
"0.66611695",
"0.66611695",
"0.66611695",
"0.66611695",
"0.6539572",
"0.6536954",
"0.6501155",
"0.6495804",
"0.64598477",
"0.63987106",
"0.6387039",
"0.6364836",
"0.6289411",
"0.6248533",
"0.6242702",
"0.6177... | 0.71087754 | 0 |
Serve static files under pluginname/assets. | def server_plugin_static(self, filepath):
try:
pluginname, filename = filepath.split('/', 1)
plugin = [p for p in get_all_plugins(self.config, project=None)
if p.name==pluginname and plugin.assets is not None][0]
except (ValueError, IndexError):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_static(self, filepath):\n root = os.path.join(self.webbase, 'assets')\n return static_file(filepath, root=root)",
"def files_serve(path):\n return flask.send_from_directory(\"static/js\", path)",
"def serve_static_files(request, path, insecure=False, **kwargs):\n\n if not setting... | [
"0.66425836",
"0.650275",
"0.6494702",
"0.63426834",
"0.6313165",
"0.6253335",
"0.62064654",
"0.61046124",
"0.60932267",
"0.6077982",
"0.6062902",
"0.60482115",
"0.602354",
"0.600255",
"0.5975606",
"0.5932071",
"0.5927599",
"0.5903414",
"0.5891787",
"0.5891787",
"0.5891787",
... | 0.73649305 | 0 |
Create a nicely formatted HTML representation of a singular or list of substitutions. | def format_substitutions(subs: Union[SubstituteTerm, List[SubstituteTerm]]):
text = ""
if isinstance(subs, SubstituteTerm):
term_str = str(subs)
for line in term_str.split('\n'):
text += Markup.escape(line) + Markup('<br />')
text += Markup('<br />')
return text
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n t = Template(\n \"\"\"\n <h4>$title</h4>\n $imgs\n $footnotes\n <hr/>\"\"\")\n # Return result.\n return t.substitute({\n \"title\": self.title,\n \"imgs\": self.render_images(),\n \"fo... | [
"0.581361",
"0.5800976",
"0.57761186",
"0.5666923",
"0.5624687",
"0.5621324",
"0.5601476",
"0.5572784",
"0.5540061",
"0.5529508",
"0.5505106",
"0.5487089",
"0.5471752",
"0.5471752",
"0.5471752",
"0.5471752",
"0.54387504",
"0.54198366",
"0.53992283",
"0.5394507",
"0.53875756",... | 0.7432605 | 0 |
Tests whether the nicv is calculated correctly | def test_solve_nicv(self):
traces = np.array([[1, 2, 3], [4, 5, 6], [7, 0.4, 9], [2, 3, 12]])
plain = np.array([[1], [2], [1], [2]])
keys = plain
resulting_nicvs = np.array([0.23045267, 0.24016342, 0.49382716])
calculated_nicvs = NICV.calculate_nicv_array(plain, traces, 0, keys... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_run_nicv(self):\n\n traces, keys, plain = FileLoader.main(CONST_DEFAULT_TRACES_FILE,\n CONST_DEFAULT_KEYS_FILE,\n CONST_DEFAULT_PLAIN_FILE)\n\n result = NICV.run(traces, keys, plain)\n\n self.ass... | [
"0.6684239",
"0.60306436",
"0.59655744",
"0.5958371",
"0.59267014",
"0.58634454",
"0.5859812",
"0.58524597",
"0.58106333",
"0.5790867",
"0.5771807",
"0.57673794",
"0.57341224",
"0.5684923",
"0.5670353",
"0.5643081",
"0.5637038",
"0.5635449",
"0.56344414",
"0.56036335",
"0.560... | 0.6432046 | 1 |
Starts the algorithm when Start button is pressed | def startButtonPressed(self):
self.showtime = time.time()
self.save_file = open(os.path.join(args.parent_img_path, self.save_file_name), "a")
self.save_file.write("\nStart Button Pressed\n")
self.save_file.close()
# Timers for x axis scrolling.
self.tmr = QElapsedTimer(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start():",
"def start():",
"def start():",
"def start():",
"def start(self):\n self.reset()\n self.on_start()",
"def start_aco(self, event):\n if not self.running:\n self.start_btn_text.set(\"Start\")\n self.pause_btn_text.set(\"Pause\")\n self.ru... | [
"0.74529594",
"0.74529594",
"0.74529594",
"0.74529594",
"0.74321634",
"0.7334844",
"0.72592944",
"0.72418106",
"0.7226268",
"0.7208373",
"0.71964395",
"0.717658",
"0.717658",
"0.71589386",
"0.71589386",
"0.71418023",
"0.7085337",
"0.7085337",
"0.7085337",
"0.7085337",
"0.7085... | 0.7719503 | 0 |
Save a snapshot of the window state currently | def saveWindowState(self):
print("Save button has been pressed!")
screenshot = self.widgetHolder.grab()
self.screenshotNum += 1
if(self.addressBox.text() != ""):
screenshot.save(os.path.join(self.addressBox.text(), ("screenshot" + str(self.screenshotNum) + ".jpg")))
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_state(self):\n pass",
"def savestate(self, state):\n pass",
"def save_state(self, state=None):\n state = {}\n for i in range(self.workspace.count()):\n tab: SubTab = self.workspace.widget(i)\n state[tab.__class__.__name__] = tab.get_state()\n\n ... | [
"0.7000904",
"0.6870443",
"0.67957085",
"0.67244345",
"0.66360146",
"0.6524261",
"0.65233535",
"0.6421678",
"0.6420142",
"0.64183027",
"0.64110035",
"0.63840055",
"0.63635343",
"0.63402593",
"0.62987524",
"0.6275983",
"0.6211945",
"0.6211945",
"0.615993",
"0.61380464",
"0.613... | 0.759661 | 0 |
Initialize the Remaining Tool Life Estimation widget | def initRTLE(self):
# To create one "big" widget, use a VBox
self.thirdRowRTLE = QtWidgets.QVBoxLayout()
# Add the title on the first row of the VBox
self.RTLETitle = QLabel("Remaining Tool Life Estimation")
self.RTLETitle.setAlignment(QtCore.Qt.AlignHCenter)
self.RTLETi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_widget(self):",
"def __init__(self, parent=None):\n\n super().__init__(parent=parent)\n\n self.window_title = \"Goal Calibration\"\n\n screen_layout = QVBoxLayout()\n\n self.toolbar = ToolbarComponent(\n self.window_title, \"Back to Session\\n Record Check\")\n\n ... | [
"0.64532065",
"0.6402616",
"0.636205",
"0.62868494",
"0.62619424",
"0.62104297",
"0.6200258",
"0.6080374",
"0.60627997",
"0.60533",
"0.60170144",
"0.6016117",
"0.59908533",
"0.5986326",
"0.59852284",
"0.596869",
"0.594783",
"0.5926786",
"0.5923299",
"0.5911436",
"0.59096843",... | 0.6814796 | 0 |
Add the grayed Good, Average, Advanced, and Failure images to the image/label/graph CTWMlayout | def initImgCTWM(self):
# Initialize the image's layout
self.CTWMimageShow = QtWidgets.QVBoxLayout()
self.CTWMimageShow.setContentsMargins(0, 0, 15, 0) # someLayout.setContentsMargins(left, top, right, bottom)
self.labelFailureGrayCTWM = QLabel()
# default image for when algorit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initImgWHM(self):\n\n self.WHMimageShow = QtWidgets.QVBoxLayout()\n self.WHMimageShow.setContentsMargins(0, 0, 15, 0) # someLayout.setContentsMargins(left, top, right, bottom)\n\n self.labelLevelFourWHM = QLabel()\n # default image for when algorithm hasn't reached conclusion\n ... | [
"0.6386643",
"0.5866134",
"0.5834087",
"0.5791963",
"0.5699978",
"0.56788355",
"0.5668862",
"0.5624913",
"0.5623024",
"0.5611453",
"0.55672985",
"0.5561185",
"0.5535266",
"0.55314267",
"0.5491953",
"0.54872274",
"0.5486469",
"0.547803",
"0.5458148",
"0.54550576",
"0.54550034"... | 0.7204687 | 0 |
Add the grayed Level 1, Level 2, Level 3, and Level 4 images to the image/label/graph WHM layout | def initImgWHM(self):
self.WHMimageShow = QtWidgets.QVBoxLayout()
self.WHMimageShow.setContentsMargins(0, 0, 15, 0) # someLayout.setContentsMargins(left, top, right, bottom)
self.labelLevelFourWHM = QLabel()
# default image for when algorithm hasn't reached conclusion
self.lab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initImgCTWM(self):\n\n # Initialize the image's layout\n self.CTWMimageShow = QtWidgets.QVBoxLayout()\n self.CTWMimageShow.setContentsMargins(0, 0, 15, 0) # someLayout.setContentsMargins(left, top, right, bottom)\n\n self.labelFailureGrayCTWM = QLabel()\n # default image for ... | [
"0.61418724",
"0.59853095",
"0.58583283",
"0.5804678",
"0.57843477",
"0.5706259",
"0.5691361",
"0.5661333",
"0.56471395",
"0.56023145",
"0.55989903",
"0.5558774",
"0.5541108",
"0.5524603",
"0.54526556",
"0.5450648",
"0.54487604",
"0.5443195",
"0.54367644",
"0.5435571",
"0.542... | 0.67650187 | 0 |
Set the Environment group in the AZFP netCDF file. AZFP includes additional variables 'salinity' and 'pressure' | def set_env(self, env_dict):
# Only save environment group if file_path exists
if not os.path.exists(self.file_path):
print('netCDF file does not exist, exiting without saving Environment group...')
else:
ds = xr.Dataset({'temperature': (['ping_time'], env_dict['temperatu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_group(group_name):\n group_config = env.groups[group_name]\n set_role_defs(\n web=group_config['servers'][WEB_ROLE],\n db=group_config['servers'][DB_ROLE],\n )\n env.branch = group_config['branch']\n env.subdomain = group_config.get('subdomain', 'www')",
"def SetEnvironmentVa... | [
"0.56730884",
"0.54024184",
"0.517299",
"0.51126647",
"0.50913596",
"0.5072185",
"0.5056159",
"0.49816746",
"0.4974198",
"0.49667385",
"0.4952896",
"0.49426872",
"0.4900217",
"0.48419467",
"0.48245883",
"0.48163995",
"0.48155674",
"0.48152548",
"0.48042238",
"0.47832984",
"0.... | 0.6874508 | 0 |
Set the Platform group in the AZFP nc file. AZFP does not record pitch, roll, and heave. | def set_platform(self, platform_dict):
if not os.path.exists(self.file_path):
print("netCDF file does not exist, exiting without saving Platform group...")
elif self.format == '.nc':
with netCDF4.Dataset(self.file_path, 'a', format='NETCDF4') as ncfile:
plat = ncf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setGroup(self, group):\n\t\tself.config.GROUP = group",
"def setPlatform(self):\n\t\treturn None",
"def set_group(group_name):\n group_config = env.groups[group_name]\n set_role_defs(\n web=group_config['servers'][WEB_ROLE],\n db=group_config['servers'][DB_ROLE],\n )\n env.branch ... | [
"0.59620076",
"0.58957833",
"0.5449728",
"0.5411098",
"0.53018975",
"0.52523345",
"0.51879275",
"0.517697",
"0.5169259",
"0.51625127",
"0.5157414",
"0.5132932",
"0.5117618",
"0.51081556",
"0.5095792",
"0.50628644",
"0.50514495",
"0.5050298",
"0.5050298",
"0.5050298",
"0.50482... | 0.73987556 | 0 |
returns local pillar location | def get_unrendered_pillar_location():
if env.use_project_dir:
# TODO: render pillar template to stdout / temp directory to sync it? (or just generate one file for remote)
fab_location = os.path.dirname(env.real_fabfile)
pillar_location = os.path.abspath(os.path.join(fab_location, '../config/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location(self) -> str:\n return pulumi.get(self, \"location\")",
"def location(self) -> str:\n return pulumi.get(self, \"location\")",
"def location(self) -> str:\n return pulumi.get(self, \"location\")",
"def location(self) -> str:\n return pulumi.get(self, \"location\")",
... | [
"0.6535337",
"0.6535337",
"0.6535337",
"0.6535337",
"0.6535337",
"0.6535337",
"0.6535337",
"0.6535337",
"0.6535337",
"0.6535337",
"0.6535337",
"0.6535337",
"0.6535337",
"0.6509677",
"0.6489564",
"0.64180577",
"0.6398598",
"0.6373534",
"0.63255537",
"0.62913543",
"0.6271006",
... | 0.7167248 | 0 |
Returns all local pillar locations If a boolean false is passed as an argument it will not include the project pillar | def get_unrendered_pillar_locations(include_project=True):
pillar_locations = []
if include_project:
pillar_locations.append(get_unrendered_pillar_location())
if 'pillar_dirs' in env:
fab_location = os.path.dirname(env.real_fabfile)
for root in env.pillar_dirs:
pillar_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_locations(self):",
"def __load_pillar_dirs(pillar_dir, projects_location, target=None):\n pillars = []\n\n # We can bypass the project directory when creating the pillar\n if pillar_dir is None and env.use_project_dir is True:\n if \"pillar_dir\" in env:\n pillar_dir = env.... | [
"0.6342974",
"0.6299826",
"0.5687538",
"0.5537646",
"0.55367297",
"0.54880726",
"0.5416347",
"0.54008824",
"0.53594613",
"0.53230286",
"0.52886045",
"0.52729845",
"0.5245137",
"0.52230793",
"0.5211905",
"0.5208852",
"0.5167501",
"0.5167501",
"0.5167501",
"0.51619965",
"0.5159... | 0.68797123 | 0 |
Returns path to rendered pillar. Use to render pillars written in jinja locally not to upload unwanted data to network. | def get_rendered_pillar_location(
pillar_dir=None,
projects_location=None,
parse_top_sls=True,
target=None
):
if 'use_project_dir' not in 'env':
env.use_project_dir = False
if projects_location is None:
projects_location = _get_projects_location()
pillar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unrendered_pillar_location():\n if env.use_project_dir:\n # TODO: render pillar template to stdout / temp directory to sync it? (or just generate one file for remote)\n fab_location = os.path.dirname(env.real_fabfile)\n pillar_location = os.path.abspath(os.path.join(fab_location, '.... | [
"0.75512964",
"0.5691066",
"0.5684189",
"0.5667313",
"0.5623867",
"0.5567444",
"0.5545756",
"0.544221",
"0.54305345",
"0.52963436",
"0.5293972",
"0.52757126",
"0.5265386",
"0.5236548",
"0.519674",
"0.51963544",
"0.51852924",
"0.5177533",
"0.51751053",
"0.51736486",
"0.5154173... | 0.6923811 | 1 |
Loads all of the pillar directories into a list | def __load_pillar_dirs(pillar_dir, projects_location, target=None):
pillars = []
# We can bypass the project directory when creating the pillar
if pillar_dir is None and env.use_project_dir is True:
if "pillar_dir" in env:
pillar_dir = env.pillar_dir
else:
assert env... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_list_emptydirs(load):\n # TODO - implement this\n _init()\n\n return []",
"def _include_dir_list_yaml(\n loader: SafeLineLoader, node: yaml.nodes.Node\n) -> List[JSON_TYPE]:\n loc = os.path.join(os.path.dirname(loader.name), node.value)\n return [load_yaml(f) for f in _find_files(loc, ... | [
"0.6941456",
"0.6524377",
"0.65121335",
"0.6506694",
"0.6448074",
"0.6384362",
"0.63644636",
"0.6255887",
"0.6255887",
"0.62340707",
"0.6178828",
"0.61648023",
"0.6150959",
"0.6123499",
"0.6123203",
"0.61123794",
"0.60826766",
"0.607872",
"0.604056",
"0.60251266",
"0.60152185... | 0.72813815 | 0 |
Get the base unit type for values. (e.g. for "s", this would be "time") Meant to be overridden by subclasses. | def unit_type(self) -> str: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self) -> str | None:\n set_req = self.gateway.const.SetReq\n if (\n AwesomeVersion(self.gateway.protocol_version) >= AwesomeVersion(\"1.5\")\n and set_req.V_UNIT_PREFIX in self._values\n ):\n custom_unit: str = self._values[set_req.V_UNI... | [
"0.6967566",
"0.68649644",
"0.6752575",
"0.6752575",
"0.67353094",
"0.66816056",
"0.6639613",
"0.66268444",
"0.6624583",
"0.65786624",
"0.65508604",
"0.65508604",
"0.6527846",
"0.6527846",
"0.64999187",
"0.64862823",
"0.64670765",
"0.6377557",
"0.6360455",
"0.6340261",
"0.632... | 0.73981583 | 0 |
Get the default prefix for values. (e.g. for time, specifying "n" would mean "0.25" would be interpreted as "0.25 ns".) Meant to be overridden by subclasses. | def default_prefix(self) -> str: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_prefix(self) -> str:\n return \"\"",
"def default_prefix(self) -> str:\n return \"\"",
"def get_default_prefix(path):\n if path in prefixes_dict.keys():\n return prefixes_dict[path]\n else:\n return ''",
"def prefix_format(self) -> Optional[pulumi.Input[str]]:\n ... | [
"0.77152824",
"0.77152824",
"0.7141563",
"0.6859565",
"0.6859565",
"0.6814326",
"0.672612",
"0.672612",
"0.672612",
"0.6715219",
"0.6713998",
"0.65031195",
"0.64007133",
"0.64007133",
"0.6362454",
"0.6357433",
"0.6357433",
"0.6347293",
"0.62549293",
"0.6252407",
"0.6252407",
... | 0.8122663 | 0 |
Get the prefix string of this value. | def value_prefix(self) -> str:
return self._value_prefix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix(self):\n return self[\"prefix\"]",
"def prefix(self):\n return self[\"prefix\"]",
"def prefix(self) -> typing.Optional[str]:\n return self._values.get('prefix')",
"def prefix(self) -> typing.Optional[str]:\n return self._values.get('prefix')",
"def prefix(self) -> typ... | [
"0.8380622",
"0.8380622",
"0.8363356",
"0.8363356",
"0.8363356",
"0.83399963",
"0.83399963",
"0.8309719",
"0.82662296",
"0.82662296",
"0.82662296",
"0.8106413",
"0.80589676",
"0.8014214",
"0.7835368",
"0.7776197",
"0.7772175",
"0.77160835",
"0.76984036",
"0.76984036",
"0.7698... | 0.83942115 | 0 |
Get this value in the given prefix. e.g. "ns", "mV", etc. | def value_in_units(self, prefix: str, round_zeroes: bool = True) -> float:
# e.g. extract "n" from "ns" or blank if it's blank (e.g. "V" -> "")
letter_prefix = ""
if prefix != self.unit:
letter_prefix = "" if prefix == "" else prefix[0]
retval = self._value * (self._prefix /... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key_group_value(self, prefix):\r\n return self.get(prefix, 0)",
"def __init__(self, value: str, prefix: Optional[str] = None) -> None:\n import re\n\n default_prefix = get_or_else(prefix, self.default_prefix)\n\n regex = r\"^(-?[\\d.]+) *(.*){}$\".format(re.escape(self.unit))\... | [
"0.6545774",
"0.64610213",
"0.6451306",
"0.63316613",
"0.63316613",
"0.6318682",
"0.6318682",
"0.6318682",
"0.6223908",
"0.62179166",
"0.61228144",
"0.6106077",
"0.60550314",
"0.60550314",
"0.6023333",
"0.6023333",
"0.60072017",
"0.5932636",
"0.5902027",
"0.5872409",
"0.58686... | 0.73336035 | 0 |
Get this value in the given prefix but including the units. e.g. return "5 ns". | def str_value_in_units(self, prefix: str, round_zeroes: bool = True) -> str:
# %g removes trailing zeroes
return "%g" % (self.value_in_units(prefix, round_zeroes)) + " " + prefix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value_in_units(self, prefix: str, round_zeroes: bool = True) -> float:\n # e.g. extract \"n\" from \"ns\" or blank if it's blank (e.g. \"V\" -> \"\")\n letter_prefix = \"\"\n if prefix != self.unit:\n letter_prefix = \"\" if prefix == \"\" else prefix[0]\n\n retval = self... | [
"0.7767109",
"0.66928834",
"0.6519841",
"0.63229734",
"0.6318947",
"0.6224571",
"0.58197325",
"0.57916725",
"0.5767626",
"0.5767626",
"0.5767626",
"0.5722515",
"0.5713658",
"0.5713658",
"0.5702866",
"0.56945306",
"0.56730574",
"0.56654096",
"0.5658151",
"0.5638247",
"0.561698... | 0.70049864 | 1 |
Compare inequality of this value with another. The types must match. | def ne(self: _TT, other: _TT) -> bool: # pylint: disable=invalid-name
if type(self) != type(other):
raise TypeError("Types do not match")
return not self.eq(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\r\n\t\treturn (self.type != other.type or self.value != other.value)",
"def __eq__(self, other):\n return int.__ne__(self, other)",
"def __ne__(self, other):\n return not_equal(self, other)",
"def __ne__(self, other):\n return int.__eq__(self, other)",
"def __n... | [
"0.7789724",
"0.7358024",
"0.73365855",
"0.7321399",
"0.73185587",
"0.72969794",
"0.726275",
"0.7210425",
"0.71830374",
"0.7177267",
"0.7163777",
"0.7156712",
"0.7136913",
"0.71352273",
"0.71352273",
"0.7127493",
"0.71195805",
"0.7101706",
"0.7090631",
"0.707465",
"0.70697814... | 0.74639887 | 1 |
Check if self is less than other. The types must match. | def __lt__(self: _TT, other: _TT) -> bool:
if type(self) != type(other):
raise TypeError("Types do not match")
return self.value < other.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self.lessThan(other)",
"def __lt__(self, other):\n\n # seems like this should be == -1 but we're using a min heap\n return self._comparator.compare_measurements(self, other) == 1",
"def __lt__(self, other: Any) -> bool:\n\n if isinstance(other, Valu... | [
"0.8177419",
"0.79188776",
"0.79169124",
"0.7903571",
"0.78901744",
"0.7861724",
"0.78578293",
"0.7849604",
"0.7845744",
"0.78049344",
"0.78003174",
"0.78003174",
"0.77952206",
"0.77952206",
"0.7792081",
"0.7786218",
"0.7763305",
"0.77572745",
"0.77443147",
"0.7683894",
"0.76... | 0.82047075 | 0 |
Check if self is less than or equal to other. The types must match. | def __le__(self: _TT, other: _TT) -> bool:
if type(self) != type(other):
raise TypeError("Types do not match")
return self.value <= other.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self: _TT, other: _TT) -> bool:\n if type(self) != type(other):\n raise TypeError(\"Types do not match\")\n return self.value >= other.value",
"def __lt__(self: _TT, other: _TT) -> bool:\n if type(self) != type(other):\n raise TypeError(\"Types do not match\"... | [
"0.8269749",
"0.8156888",
"0.7959218",
"0.782644",
"0.77851874",
"0.77851874",
"0.77802277",
"0.7744213",
"0.770726",
"0.76717806",
"0.7658956",
"0.7649101",
"0.76487803",
"0.76363945",
"0.76281005",
"0.76281005",
"0.76222974",
"0.7605231",
"0.76008826",
"0.7593185",
"0.75652... | 0.8232501 | 1 |
Check if self is greater than other. The types must match. | def __gt__(self: _TT, other: _TT) -> bool:
if type(self) != type(other):
raise TypeError("Types do not match")
return self.value > other.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return self.greaterThan(other)",
"def __gt__(self, other):\n return greater(self, other)",
"def __gt__(self, other):\n if isinstance(other, type(self)):\n return self.number > other.number\n return NotImplemented",
"def __gt__(self, other):\n ... | [
"0.81865174",
"0.8154882",
"0.8097635",
"0.80737174",
"0.80651623",
"0.79862756",
"0.7908505",
"0.7908505",
"0.7897956",
"0.7880695",
"0.7827148",
"0.78116065",
"0.7770164",
"0.77450734",
"0.7710154",
"0.7675555",
"0.7668449",
"0.7646003",
"0.7645967",
"0.7642438",
"0.7638837... | 0.84351224 | 0 |
Check if self is greater than or equal to other. The types must match. | def __ge__(self: _TT, other: _TT) -> bool:
if type(self) != type(other):
raise TypeError("Types do not match")
return self.value >= other.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self: _TT, other: _TT) -> bool:\n if type(self) != type(other):\n raise TypeError(\"Types do not match\")\n return self.value > other.value",
"def __gt__(self, other):\n try:\n return self.length2 > other.length2\n except AttributeError:\n r... | [
"0.83619857",
"0.79011303",
"0.7867107",
"0.7860233",
"0.7860233",
"0.7816087",
"0.77685213",
"0.77589154",
"0.77209496",
"0.76975673",
"0.76957923",
"0.7693637",
"0.7683857",
"0.7682663",
"0.7681263",
"0.7644248",
"0.7611871",
"0.76117724",
"0.7608347",
"0.7548623",
"0.75484... | 0.79357976 | 1 |
Divide self by a float or an integer. | def __div__(self: _TT, other: float) -> _TT:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __div__(self, other):\n if isinstance(other, (int, float)):\n return self * (1 / other)\n else:\n raise TypeError(\"Cannot divide vector by {}\".format(other))",
"def __float__(self):\n return self.num / self.denom # result of / is of type float",
"def __float__(... | [
"0.7320664",
"0.69769216",
"0.68392104",
"0.67019427",
"0.6665211",
"0.6632792",
"0.6573752",
"0.65672463",
"0.6504861",
"0.6484198",
"0.64667606",
"0.64667606",
"0.6462356",
"0.6447575",
"0.6424389",
"0.642397",
"0.6388483",
"0.6358386",
"0.6299705",
"0.6291538",
"0.62612695... | 0.70374024 | 1 |
Make default values for query loads from file Inputs | def _make_query_defaults(fpath=None):
if issubclass(fpath.__class__, dict):
return fpath
if fpath is None:
dirname = os.path.dirname(__file__)
fpath = os.path.join(dirname, 'gaia_query_defaults.json')
with open(fpath, 'r') as file:
defaults = json.load(file)
defaults[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_parameters(self):\n super().set_default_parameters()\n if not \"replace_existing_files\" in vars(self):\n self.replace_existing_files = False\n if not \"num_files_per_point\" in vars(self):\n self.num_files_per_point = -1\n if not \"input_location_t... | [
"0.60389036",
"0.601876",
"0.5980216",
"0.58689564",
"0.58154815",
"0.57716036",
"0.5697071",
"0.5696502",
"0.5696502",
"0.5669771",
"0.5663183",
"0.56288123",
"0.5566678",
"0.55634654",
"0.5559713",
"0.5559713",
"0.5547716",
"0.5538425",
"0.5533474",
"0.55144423",
"0.5504232... | 0.61275357 | 0 |
Make the FROM portion of a gaia query | def _make_query_FROM(FROM=None, inmostquery=False, _tab=' '):
# FROM
if FROM is None:
FROM = 'gaiadr2.gaia_source'
else:
# Tab level
FROM = _tab + FROM
FROM = FROM.replace('\n', '\n{tab}'.format(tab=_tab))
if inmostquery is False:
p1, p2 ='(\n', '\n)'
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(self, **kwargs):\n kwargs['query'] += ' FROM {0}'\n return kwargs",
"def make_simple_gaia_query(WHERE=None, ORDERBY=None, user_cols=None,\n FROM=None, all_columns=False,\n panstarrs1=False, gaia_mags=False, user_ASdict=None,\n ... | [
"0.6614978",
"0.61699456",
"0.6159343",
"0.58413786",
"0.5812289",
"0.5739446",
"0.5714148",
"0.56808925",
"0.566304",
"0.5579747",
"0.5577638",
"0.5536559",
"0.54920757",
"0.5476934",
"0.5460719",
"0.5455013",
"0.5453083",
"0.5445262",
"0.5438601",
"0.5314289",
"0.5314045",
... | 0.76869965 | 0 |
Add tab level to query indents the whoel query by the tab level INPUTS | def _query_tab_level(query, tablevel, _tab=' '):
# Tab level
query = (_tab * tablevel) + query
query = query.replace('\n', '\n{tab}'.format(tab=_tab * tablevel))
return query | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indent(self):\n cursor = self.parent.textCursor()\n # Check if something is selected\n if cursor.hasSelection():\n # get the line/block nr\n temp = cursor.blockNumber()\n # Move to last line of the selection\n cursor.setPosition(cursor.selectionE... | [
"0.59627014",
"0.5929822",
"0.57490826",
"0.5587191",
"0.55496967",
"0.5524422",
"0.55157614",
"0.5461489",
"0.54595464",
"0.54595464",
"0.54491377",
"0.5444654",
"0.54384845",
"0.53927594",
"0.53513",
"0.53413427",
"0.5338122",
"0.5308848",
"0.5278413",
"0.52711105",
"0.5251... | 0.7476199 | 0 |
make_gaia_query wrapper for singlelayer queries with some defaults changed and options removed use_AS and inmostquery are now True. _tab is set to default | def make_simple_gaia_query(WHERE=None, ORDERBY=None, user_cols=None,
FROM=None, all_columns=False,
panstarrs1=False, gaia_mags=False, user_ASdict=None,
defaults=None,
pprint=False):
return make_gaia_query(WH... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_gaia_query(WHERE=None, ORDERBY=None, user_cols=None,\n FROM=None, use_AS=False, all_columns=False,\n panstarrs1=False, gaia_mags=False, user_ASdict=None,\n inmostquery=False, defaults=None, _tab=' ',\n pprint=False):\n\n que... | [
"0.6972428",
"0.6177298",
"0.59810084",
"0.5893489",
"0.5882486",
"0.5809476",
"0.5776969",
"0.57672256",
"0.5734848",
"0.57066286",
"0.56771684",
"0.56697667",
"0.56555134",
"0.55999047",
"0.5582388",
"0.55091554",
"0.548246",
"0.5457023",
"0.5439728",
"0.5434059",
"0.542945... | 0.7225929 | 0 |
Role definition assignable scopes. | def assignable_scopes(self) -> Optional[Sequence[str]]:
return pulumi.get(self, "assignable_scopes") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope(self): # noqa: ANN201",
"def resourcescope(self, **content):\n self.resource_scopes.update(content)\n self.resource_scopes.update(self.overwrite_resource_scopes)",
"def sync_role_definitions(self) -> None:\n\n logger.info(\"Syncing role definition\")\n\n self.create_custo... | [
"0.60752875",
"0.6011554",
"0.5966682",
"0.58738226",
"0.5784672",
"0.5532327",
"0.5522923",
"0.5497077",
"0.54913694",
"0.5475104",
"0.54418015",
"0.5439452",
"0.54112625",
"0.5387419",
"0.5387419",
"0.5361026",
"0.535442",
"0.53304493",
"0.5325078",
"0.53107214",
"0.5287417... | 0.6489873 | 0 |
Creates get server time request. | def create_get_server_time_request(self) -> Request: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_time_request(self, time_request=None, **kwargs):\n pass",
"async def server_time(self):\n uri = \"/fapi/v1/time\"\n success, error = await self.request(\"GET\", uri)\n return success, error",
"async def server_time(self):\n uri = \"/v3/time\"\n success, error ... | [
"0.71161586",
"0.710048",
"0.7074786",
"0.63061607",
"0.6067773",
"0.6006844",
"0.5954438",
"0.5925175",
"0.5921816",
"0.5905734",
"0.58900654",
"0.5886727",
"0.5805509",
"0.57868576",
"0.5767524",
"0.56739175",
"0.56166404",
"0.55978155",
"0.55939704",
"0.5588009",
"0.557775... | 0.92682254 | 0 |
Creates get exchange information request. | def create_get_exchange_info_request(self) -> Request: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_exchange_info(self):\n return self.request.get(path=\"/info\")",
"async def exchange_information(self):\n uri = \"/fapi/v1/exchangeInfo\"\n success, error = await self.request(\"GET\", uri)\n return success, error",
"def info_request():\n return SentmanRequest(Sentman... | [
"0.6371393",
"0.626008",
"0.61865425",
"0.5915095",
"0.5806554",
"0.57620054",
"0.56828505",
"0.56110024",
"0.5597447",
"0.5590681",
"0.55883807",
"0.5579138",
"0.55778676",
"0.5576951",
"0.55403996",
"0.55241215",
"0.55219364",
"0.54678017",
"0.54575783",
"0.54566455",
"0.54... | 0.9146309 | 0 |
Creates get order book request. | def create_get_order_book_request(self, symbol: str,
limit: Optional[int] = None
) -> Request: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_get_order_book_ticker_request(self, symbol: Optional[str] = None) -> Request:",
"def create_get_active_orders_request(self, symbol: Optional[Symbol] = None) -> Request:\n\n method = \"GET\"\n path = \"/order\"\n params: Params = {}\n if symbol is not None:\n para... | [
"0.732504",
"0.6521436",
"0.6265566",
"0.6235177",
"0.6190984",
"0.6113074",
"0.60771656",
"0.600444",
"0.58509076",
"0.58471024",
"0.58257186",
"0.5825667",
"0.5776991",
"0.57641727",
"0.57420135",
"0.57350874",
"0.5727396",
"0.57121",
"0.57111156",
"0.5689941",
"0.5679834",... | 0.8088169 | 0 |
Creates get trades request. | def create_get_trades_request(self, symbol: str,
limit: Optional[int] = None
) -> Request: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_trades(self, custom_id=None, **params):\n self.conn.send('getTrades', custom_id=custom_id, **params)",
"def create_get_old_trades_request(self, symbol: str,\n limit: Optional[int] = None,\n from_id: Optional[int] = None\... | [
"0.70739233",
"0.6914997",
"0.6770701",
"0.6479608",
"0.6251119",
"0.6111586",
"0.6002261",
"0.59284556",
"0.5846841",
"0.582136",
"0.5813551",
"0.5812295",
"0.55721855",
"0.5497863",
"0.54819024",
"0.54717994",
"0.544952",
"0.54111767",
"0.54066515",
"0.54021704",
"0.5368807... | 0.77220756 | 0 |
Creates get old trades request. | def create_get_old_trades_request(self, symbol: str,
limit: Optional[int] = None,
from_id: Optional[int] = None
) -> Request: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_get_trades_request(self, symbol: str,\n limit: Optional[int] = None\n ) -> Request:",
"async def get_trades(self) -> List[TradeRequest]:\n data = j.dumps({\n 'startindex': 0,\n 'statustype': 'inbound'\n ... | [
"0.68606144",
"0.5969047",
"0.5944057",
"0.585075",
"0.5561133",
"0.5437442",
"0.543485",
"0.5401337",
"0.5395618",
"0.53787464",
"0.5301194",
"0.53001654",
"0.5294499",
"0.52473414",
"0.52418077",
"0.51947874",
"0.51888263",
"0.51588106",
"0.5120697",
"0.51170117",
"0.507229... | 0.77538776 | 0 |
Creates get aggregate trades request. | def create_get_aggregate_trades_request(self, symbol: str,
from_id: Optional[int] = None,
start_time: Optional[int] = None,
end_time: Optional[int] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_get_trades_request(self, symbol: str,\n limit: Optional[int] = None\n ) -> Request:",
"def get_aggregate_trades(self, **params):\n return self._get('aggTrades', data=params)",
"async def get_trades(self) -> List[TradeRequest]:\... | [
"0.68014985",
"0.6169688",
"0.6037264",
"0.599703",
"0.5987353",
"0.5858652",
"0.5748156",
"0.5577184",
"0.53568965",
"0.5333962",
"0.51393855",
"0.51202315",
"0.5112776",
"0.5110323",
"0.5027064",
"0.5026124",
"0.497617",
"0.4972202",
"0.49705622",
"0.49700186",
"0.496191",
... | 0.7781773 | 0 |
Creates get candles request. | def create_get_candles_request(self, symbol: str,
interval: CandleInterval,
start_time: Optional[int] = None,
end_time: Optional[int] = None,
limit: Optional[int] = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def candles(Symbol='tBTCUSD', TimeFrame='1m', Section='last', **params):\n endpoint = f'candles/trade:{TimeFrame}:{Symbol}/{Section}'\n return request(authenticate=False, version=2, endpoint=endpoint, method='GET', query_params=params)",
"def create_get_order_book_ticker_request(self, symbol: Optional[str]... | [
"0.6428837",
"0.63910097",
"0.6307044",
"0.6032909",
"0.5932165",
"0.5737868",
"0.5690126",
"0.5639366",
"0.56390595",
"0.5533687",
"0.54466134",
"0.5438658",
"0.54099303",
"0.5408952",
"0.53919846",
"0.53648704",
"0.5350378",
"0.53325224",
"0.5304621",
"0.52980816",
"0.52812... | 0.7876789 | 0 |
Creates get average price request. | def create_get_average_price_request(self, symbol: str) -> Request: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def market_avg_price(**params):\n endpoint = 'calc/trade/avg'\n return request(authenticate=False, version=2, endpoint=endpoint, method='POST', query_params=params)",
"def get_avg_price(request):\n Domestic = list((\n Domesticinvoice.objects.values(\"part_number\")\n .order_by(\"part_n... | [
"0.74623203",
"0.621032",
"0.59907883",
"0.5593431",
"0.55899495",
"0.55266565",
"0.5448381",
"0.536205",
"0.5281099",
"0.5275768",
"0.52384526",
"0.52199763",
"0.5152695",
"0.51318204",
"0.5119559",
"0.509412",
"0.50874466",
"0.5057626",
"0.50513655",
"0.5045796",
"0.5042818... | 0.8379332 | 0 |
Creates get 24 hr ticker price change statistics request. | def create_get_ticker_price_change_stat_request(self, symbol: Optional[str] = None) -> Request: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_get_price_ticker_request(self, symbol: Optional[str] = None) -> Request:",
"async def stocks(request: Request, ticker, period=\"1d\", interval=\"1d\"):\n logger.info(F\"NewApiRequest: /stocks/{ticker} - Client: {request.client.host}\")\n result = req_yfinance_data(ticker, period, interval)\n ... | [
"0.6441152",
"0.6221633",
"0.59904134",
"0.59666836",
"0.59625936",
"0.59306914",
"0.58434874",
"0.58414406",
"0.580836",
"0.58030313",
"0.5784473",
"0.57638127",
"0.5753864",
"0.57435334",
"0.5716701",
"0.57016826",
"0.57014763",
"0.5695598",
"0.5677654",
"0.56690216",
"0.56... | 0.75477177 | 0 |
Creates get price ticker request. | def create_get_price_ticker_request(self, symbol: Optional[str] = None) -> Request: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_get_order_book_ticker_request(self, symbol: Optional[str] = None) -> Request:",
"def create_get_ticker_price_change_stat_request(self, symbol: Optional[str] = None) -> Request:",
"def ticker(Symbol='tBTCUSD', **params):\n endpoint = f'ticker/{Symbol}'\n return request(authenticate=False, versi... | [
"0.7758816",
"0.7129887",
"0.67537385",
"0.65345323",
"0.6506096",
"0.64805275",
"0.642444",
"0.62744725",
"0.6256892",
"0.62148654",
"0.6125416",
"0.6053881",
"0.60432076",
"0.6020693",
"0.6019181",
"0.6018983",
"0.59284323",
"0.59092075",
"0.5872912",
"0.5797917",
"0.579233... | 0.83962804 | 0 |
Creates get order book ticker request. | def create_get_order_book_ticker_request(self, symbol: Optional[str] = None) -> Request: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_get_order_book_request(self, symbol: str,\n limit: Optional[int] = None\n ) -> Request:",
"def create_get_price_ticker_request(self, symbol: Optional[str] = None) -> Request:",
"def create_get_active_orders_request(self, symbo... | [
"0.77037174",
"0.73872566",
"0.66121036",
"0.6435228",
"0.63414663",
"0.63413537",
"0.63181764",
"0.6157562",
"0.61130935",
"0.6103782",
"0.6067148",
"0.6040989",
"0.6039777",
"0.59814703",
"0.5929844",
"0.5920914",
"0.58353144",
"0.5794885",
"0.57883084",
"0.57195693",
"0.56... | 0.84829605 | 0 |
Create a quantized module from a float module. | def from_float(cls, mod, rt_spec):
assert rt_spec, 'Runtime spec must be provided for quantized module.'
assert type(mod) == cls._FLOAT_MODULE, \
'{}.from_float() only accepts {}, but got {}'.format(
cls.__name__, cls._FLOAT_MODULE, type(mod))
if rt_spec.config:
approx_mode = rt_spe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_float(cls, mod, qconfig=None):\n assert type(mod) == cls._FLOAT_MODULE, 'qat.' + cls.__name__ + '.from_float only works for ' + \\\n cls._FLOAT_MODULE.__name__\n if not qconfig:\n assert hasattr(mod, 'qconfig'), 'Input float module must have qconfig defined'\n ... | [
"0.5964679",
"0.5546134",
"0.539766",
"0.53756374",
"0.53318864",
"0.509586",
"0.50848216",
"0.50687",
"0.50204843",
"0.5019796",
"0.49529195",
"0.4937981",
"0.4924518",
"0.49216995",
"0.49216995",
"0.49122363",
"0.49056807",
"0.48999634",
"0.48298004",
"0.48293215",
"0.48261... | 0.6295467 | 0 |
Parses weekday info from TransXChange VehicleJourney element | def get_weekday_info(vehicle_journey_element):
j = vehicle_journey_element
try:
reg_weekdays = j.OperatingProfile.RegularDayType.DaysOfWeek.get_elements()
weekdays = []
for elem in reg_weekdays:
weekdays.append(elem._name)
if len(weekdays) == 1:
return wee... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weekday(self, *args, **kwargs): # real signature unknown\r\n pass",
"def weekday(self):\n return 0",
"def weekday(self):\n return 0",
"def _add_weekday(cab_data):\n return cab_data.assign(weekday=lambda x: x.time.dt.weekday)",
"def day_of_the_week(arg):",
"def get_weekday():\n... | [
"0.5879346",
"0.580937",
"0.580937",
"0.572081",
"0.56893337",
"0.5650452",
"0.5637283",
"0.5607974",
"0.56014806",
"0.5592245",
"0.5551809",
"0.554587",
"0.55122876",
"0.55105877",
"0.548227",
"0.54800606",
"0.5450938",
"0.5450938",
"0.54231006",
"0.53793997",
"0.5354168",
... | 0.73737246 | 0 |
Parse day range from TransXChange DayOfWeek element | def parse_day_range(dayinfo):
# Converters
weekday_to_num = {'monday': 0, 'tuesday': 1, 'wednesday': 2,
'thursday': 3, 'friday': 4, 'saturday': 5,
'sunday': 6}
num_to_weekday = {0: 'monday', 1: 'tuesday', 2: 'wednesday',
3: 'thursday', 4: 'fr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sacred_wednesdays_in_range(range):\n a = range[0]\n b = range[1]\n wed = DayOfWeek.Wednesday.on_or_after(a)\n h_date = HinduLunarDate.from_fixed(wed)\n ell = [wed] if (h_date.day == 8) else []\n if is_in_range(wed, range):\n ell[:0] = sacred_wednesdays_in_range([wed + 1, ... | [
"0.5496665",
"0.543932",
"0.5376049",
"0.53370285",
"0.53251046",
"0.53128916",
"0.52130604",
"0.52100086",
"0.51588666",
"0.51536095",
"0.51492774",
"0.5116746",
"0.51075894",
"0.51075894",
"0.5061645",
"0.5046265",
"0.5030777",
"0.49754682",
"0.49712953",
"0.49668193",
"0.4... | 0.57446337 | 0 |
Parse calendar attributes from GTFS info DataFrame | def get_calendar(gtfs_info):
# Parse calendar
use_cols = ['service_id', 'weekdays', 'start_date', 'end_date']
calendar = gtfs_info.drop_duplicates(subset=use_cols)
calendar = calendar[use_cols].copy()
calendar = calendar.reset_index(drop=True)
# Container for final results
gtfs_calendar = p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_gdelt(self, data):\n event_columns = data.split('\\t')\n\n event_id = event_columns[0]\n event_day = event_columns[1]\n log.debug('Processing GlobalEventID|Day: \"%s|%s\"' %\n (event_id, event_day))\n self.event_id = event_id\n self.event_day =... | [
"0.54350966",
"0.5254869",
"0.5206205",
"0.5167809",
"0.51677114",
"0.51135755",
"0.5051638",
"0.49221087",
"0.4899555",
"0.48970625",
"0.48751247",
"0.48377562",
"0.48232663",
"0.47850588",
"0.47701675",
"0.47611856",
"0.47551274",
"0.47356272",
"0.47324926",
"0.4717232",
"0... | 0.58480823 | 0 |
get the value of property | def get_property(self, property):
return self.shell(["getprop", property]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_property_value(self, property, db):\n try:\n for p in self.properties:\n if p.idProperty == int(property):\n return p.get_value()\n except:\n return None",
"def get_property(self,name):\n... | [
"0.7941893",
"0.7909971",
"0.77775764",
"0.7767588",
"0.77223784",
"0.77041876",
"0.76570535",
"0.7650142",
"0.7638551",
"0.76133937",
"0.76112604",
"0.749107",
"0.73521394",
"0.7293686",
"0.72851413",
"0.72355616",
"0.72355616",
"0.72355616",
"0.72355616",
"0.72355616",
"0.7... | 0.8040457 | 0 |
Get release version, e.g. 4.3, 6.0 | def get_release_version(self):
return self.get_property(ADB.VERSION_RELEASE_PROPERTY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version():\n vers = [\"%(major)i.%(minor)i\" % __version_info__, ]\n\n if __version_info__['micro']:\n vers.append(\".%(micro)i\" % __version_info__)\n if __version_info__['releaselevel'] != 'final':\n vers.append('%(releaselevel)s' % __version_info__)\n return ''.join(vers)",
"... | [
"0.77913886",
"0.76947",
"0.76920176",
"0.7547371",
"0.74932665",
"0.748319",
"0.74643856",
"0.74372",
"0.74146926",
"0.7410422",
"0.7371019",
"0.7371019",
"0.7371019",
"0.7309727",
"0.7307411",
"0.7293789",
"0.7246911",
"0.72350556",
"0.7227028",
"0.7217797",
"0.71741927",
... | 0.77419925 | 1 |
Gets C{mDefaultViewport} and then C{deviceWidth} and C{deviceHeight} values from dumpsys. This is a method to obtain display dimensions and density | def getDisplayInfo(self):
displayInfo = {}
logicalDisplayRE = re.compile(".*DisplayViewport\{valid=true, .*orientation=(?P<orientation>\d+),"
" .*deviceWidth=(?P<width>\d+), deviceHeight=(?P<height>\d+).*")
dumpsys_display_result = self.shell("dumpsys displa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPhysicalDisplayInfo(self) -> Dict[str, Union[int, float]]:\n phyDispRE = re.compile(\n r'.*PhysicalDisplayInfo{(?P<width>\\d+) x (?P<height>\\d+), .*, density (?P<density>[\\d.]+).*')\n ret = self.raw_shell('dumpsys display')\n if m := phyDispRE.search(ret):\n disp... | [
"0.74370897",
"0.70635206",
"0.68633056",
"0.6790453",
"0.6726588",
"0.67075944",
"0.6488533",
"0.63612247",
"0.63053894",
"0.62600154",
"0.62398136",
"0.62202364",
"0.6205368",
"0.6180356",
"0.61504287",
"0.6013623",
"0.5996462",
"0.5982676",
"0.595784",
"0.5908984",
"0.5905... | 0.7067989 | 1 |
Get the focused window | def getFocusedWindow(self):
for window in self.getWindows().values():
if window.focused:
return window
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_focus():\n\n grab = Gtk.grab_get_current()\n if grab:\n return grab\n\n for win in Gtk.Window.list_toplevels():\n if win.get_property('has-toplevel-focus'):\n return win.get_focus()\n return None",
"def get_current_window_hwnd():\n\... | [
"0.82754207",
"0.7990088",
"0.79269695",
"0.78902453",
"0.7771113",
"0.77084357",
"0.76523995",
"0.7572203",
"0.7493838",
"0.74732333",
"0.7388945",
"0.737243",
"0.7316451",
"0.72121274",
"0.71596885",
"0.7146752",
"0.7128303",
"0.7115939",
"0.7070776",
"0.70313734",
"0.70070... | 0.89264476 | 0 |
Get the focused window name | def getFocusedWindowName(self):
window = self.getFocusedWindow()
if window:
return window.activity
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_window_name():\n\n hwnd = get_current_window_hwnd()\n length = GetWindowTextLength(hwnd)\n buff = ctypes.create_unicode_buffer(length + 1)\n GetWindowText(hwnd, buff, length + 1)\n\n return buff.value",
"def get_active_window():\n import sys\n active_window_name = None\n i... | [
"0.8290948",
"0.79969233",
"0.77145165",
"0.7210582",
"0.7204464",
"0.7195852",
"0.7187464",
"0.7000211",
"0.6848736",
"0.6820531",
"0.6781241",
"0.67631227",
"0.67302585",
"0.671873",
"0.6689578",
"0.6682993",
"0.66681176",
"0.6588884",
"0.6539611",
"0.6511903",
"0.6504544",... | 0.8592689 | 0 |
Unlock the screen of the device | def unlock(self):
self.shell("input keyevent MENU")
self.shell("input keyevent BACK") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AutoUnlockScreen(self):\n try:\n adb_unlock_args = _UNLOCK_SCREEN_KEYEVENT % {\n \"adb_bin\": self._adb_command,\n \"device_serial\": self._device_serial}\n subprocess.check_call(adb_unlock_args.split())\n except subprocess.CalledProcessError:\n... | [
"0.78045547",
"0.6979634",
"0.68082917",
"0.66119015",
"0.6594464",
"0.6511773",
"0.6493254",
"0.6444232",
"0.64277303",
"0.6415282",
"0.6392453",
"0.63728315",
"0.63514555",
"0.63182056",
"0.6295242",
"0.6275887",
"0.62549883",
"0.62520796",
"0.6246753",
"0.61857814",
"0.617... | 0.7007274 | 1 |
Long touches at (x, y) | def longTouch(self, x, y, duration=2000, orientation=-1):
self.drag((x, y), (x, y), duration, orientation) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_longpress(self, str_arg):\n arg = validateString(str_arg)\n # if arg.startswith(r'('):\n # raise ValueError('Bad argument, You may want to use longpress2 with coordinates as auguments.')\n x = 0\n y = 0\n seconds = 2000\n try:\n if arg.startswith(r... | [
"0.6385681",
"0.6150676",
"0.6017381",
"0.5978405",
"0.58477354",
"0.5800321",
"0.5673395",
"0.5568427",
"0.5531724",
"0.5509743",
"0.5380173",
"0.5319348",
"0.53193176",
"0.5300884",
"0.52711636",
"0.5261942",
"0.5232455",
"0.52198887",
"0.5178191",
"0.5171264",
"0.5168396",... | 0.7007885 | 0 |
Sends drag event n PX (actually it's using C{input swipe} command. | def drag(self, (x0, y0), (x1, y1), duration, steps=1, orientation=-1):
if orientation == -1:
orientation = self.getOrientation()
(x0, y0) = self.__transformPointByOrientation((x0, y0), orientation, self.getOrientation())
(x1, y1) = self.__transformPointByOrientation((x1, y1), orienta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drag(self, event):\n self.yview('scroll', self.ypos - event.y, 'units')\n self.xview('scroll', self.xpos - event.x, 'units')\n self.ypos = event.y\n self.xpos = event.x",
"def ClickAndDrag(self, delta_x=0, delta_y=0):\n self._EnsureHIDValueInRange(delta_x)\n self._EnsureHIDV... | [
"0.62665534",
"0.6111395",
"0.5892968",
"0.5777181",
"0.57424283",
"0.57383215",
"0.57218766",
"0.57197344",
"0.5630357",
"0.56054354",
"0.5605419",
"0.5514419",
"0.5508359",
"0.5495053",
"0.53900796",
"0.5375627",
"0.53695005",
"0.53499943",
"0.53412974",
"0.53388983",
"0.53... | 0.6404803 | 0 |
Only do something if this object has a search_document property and an index_components() method. | def on_save(sender, **kwargs):
obj = kwargs["instance"]
if (
not hasattr(obj, "search_document")
or not hasattr(obj, "index_components")
or not callable(obj.index_components)
):
return
transaction.on_commit(make_updater(kwargs["instance"])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_search_document(self, index='_all'):\n raise NotImplementedError(\n \"{} does not implement 'get_search_document'.\".format(self.__class__.__name__)\n )",
"def supports_book_search(self):\n return False",
"def _do_search_action(self, index, action, force=False):\n ... | [
"0.66740507",
"0.6086673",
"0.6014173",
"0.59897864",
"0.58953184",
"0.5854505",
"0.58025813",
"0.57932407",
"0.5785991",
"0.5781423",
"0.5732713",
"0.56731194",
"0.5663661",
"0.56631273",
"0.56279314",
"0.5615476",
"0.55995417",
"0.55688345",
"0.5557545",
"0.55552804",
"0.55... | 0.6202369 | 1 |
Updates the search index for an object. Assumes it has a search_document attribute and an index_components() | def make_updater(instance):
components = instance.index_components()
pk = instance.pk
def on_commit():
search_vectors = []
for text, weight in components:
search_vectors.append(
SearchVector(Value(text, output_field=TextField()), weight=weight)
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_index(self, document):\n\t\tix = self.get_index()\n\n\t\twith ix.searcher():\n\t\t\twriter = AsyncWriter(ix)\n\t\t\twriter.delete_by_term(self.id, document[self.id])\n\t\t\twriter.add_document(**document)\n\t\t\twriter.commit(optimize=True)",
"def update_document(obj):\n index = obj.get_index_name(... | [
"0.71704626",
"0.6848658",
"0.6616188",
"0.65059805",
"0.63653237",
"0.63453496",
"0.634416",
"0.6302417",
"0.6235462",
"0.6203117",
"0.6128573",
"0.61170757",
"0.60977256",
"0.6055189",
"0.6028021",
"0.5986587",
"0.59665364",
"0.59641314",
"0.5958063",
"0.5940997",
"0.592000... | 0.6918292 | 1 |
group vluns in libs by rounded cvss score and report all | def group_vulns_in_libs_by_cvss(self, df_dependencies):
cvss_numeric = pandas.to_numeric(df_dependencies['CVSS'])
bin0 = bin1 = bin2 = bin3 = bin4 = bin5 = bin6 = bin7 = bin8 = bin9 = bin10 = 0
for row in cvss_numeric:
value = round(row, 0)
if value < 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_cvss_score_and_vector_severities(apps, _):\n cvss_systems = [\n \"cvssv2\",\n \"cvssv3\",\n \"cvssv3.1\",\n ]\n\n cvss_vector_systems = [\n \"cvssv2_vector\",\n \"cvssv3_vector\",\n \"cvssv3.1_vector\",\n ]\n\n all_cvss_systems = cvss_systems + cvs... | [
"0.5470115",
"0.54475075",
"0.53560334",
"0.5241141",
"0.52371013",
"0.5234901",
"0.5210737",
"0.51736027",
"0.5165898",
"0.5158116",
"0.5143539",
"0.51215786",
"0.510381",
"0.50826854",
"0.50627923",
"0.50498676",
"0.5042613",
"0.503236",
"0.50254",
"0.5015093",
"0.5014526",... | 0.6109658 | 0 |
Count findings based on tag associated | def count_by_tag(self, dataframe, tags):
if tags and not dataframe['tags'].empty:
data_to_return = []
counter = 0
for tag in tags:
for datafield in dataframe['tags']:
if tag in datafield:
counter += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_count(self, tag: Text) -> int:\r\n sub_tags = tag.split(\"+\")\r\n return len([e for e in self.elements if all(t in e.tags for t in sub_tags)])",
"def pos_tag_counts(doc):\n tags = []\n for token in doc:\n tags.append(token.pos_)\n frequency = dict(Counter(tags).most_common(... | [
"0.67256415",
"0.6657197",
"0.66489214",
"0.6582122",
"0.6580195",
"0.64372814",
"0.6407761",
"0.63473797",
"0.63320565",
"0.63153505",
"0.6284836",
"0.6276899",
"0.6252535",
"0.6238871",
"0.6220066",
"0.6181116",
"0.61404437",
"0.6114114",
"0.61076623",
"0.60928756",
"0.6057... | 0.67084455 | 1 |
Group Data by Severity and count findings. | def group_by_severity(self, dataframe):
blocker = dataframe[(dataframe['severity'] == 'BLOCKER')]['delta'].count()
critical = dataframe[(dataframe['severity'] == 'CRITICAL')]['delta'].count()
major = dataframe[(dataframe['severity'] == 'MAJOR')]['delta'].count()
minor = dataframe[(da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_grouping(self):\n group_container, film_container, plank_container = [[] for a in range(self.tot_conditions)], \\\n [[] for a in range(self.tot_conditions)], \\\n [[] for a in range(s... | [
"0.6221499",
"0.6004024",
"0.5713319",
"0.56625205",
"0.55638",
"0.55037814",
"0.54887646",
"0.5456852",
"0.5438692",
"0.5416134",
"0.53570604",
"0.53044593",
"0.5290189",
"0.5248686",
"0.5247813",
"0.5245111",
"0.5245111",
"0.52328354",
"0.5223807",
"0.52144516",
"0.52034396... | 0.6730897 | 0 |
Generate Report of OWASP DependencyChecker Data | def generate_dependency_checker_report(self, df):
lineitem_list = []
for index, dat in df.iterrows():
if 'message' in dat:
msg = dat['message']
str_msg = str(msg)
if str_msg.startswith("Filename:"):
lineitem = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_report():\n\n # Fetch the top 3 most viewed articles and number of views and print them\n articles_query = get_articles_query()\n popular_articles = execute_query(articles_query)\n print_top_articles(popular_articles)\n\n # Fetch the most popular authors and print them\n authors_quer... | [
"0.6349714",
"0.6115491",
"0.6089617",
"0.60730565",
"0.5983427",
"0.58648086",
"0.5862421",
"0.5851142",
"0.5844404",
"0.5793625",
"0.5771352",
"0.5768434",
"0.5756283",
"0.57550555",
"0.563971",
"0.5591594",
"0.55902934",
"0.55511624",
"0.5532146",
"0.55305606",
"0.5529665"... | 0.6661429 | 0 |
Analyses dataframe based on project list and filters for CWE column | def analyse_by_applications(self, dataframe, applicationslist, cwe_filter):
result = []
for app in applicationslist:
df_analysis = dataframe[(dataframe['project'] == app)]
counts = 0
counts += len(df_analysis[(df_analysis['CWE'].isin(cwe_filter))].index)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def healthcare_filter(df_all): \n #get requested assets under healthcare tag \n df_filtered = pandas.DataFrame(columns=['osm_id','asset','geometry']) #create df for saving data\n for row in range(len(df_all.index)): \n if 'healthcare' in df_all[\"asset\"][row]: #check if healthcare key ... | [
"0.60948294",
"0.54548633",
"0.54526734",
"0.54413414",
"0.5439022",
"0.53998333",
"0.53511494",
"0.5345424",
"0.5326692",
"0.53213",
"0.5316692",
"0.52784705",
"0.523554",
"0.5214889",
"0.5200827",
"0.51885015",
"0.5170738",
"0.51610965",
"0.5160015",
"0.51404864",
"0.513783... | 0.598965 | 1 |
setup signal handlers for logging enable/disable Note that this doesn't work on Windows. | def setup_signal_handlers(self):
signal.signal(signal.SIGUSR1, self.handle_logging_signal)
signal.signal(signal.SIGUSR2, self.handle_logging_signal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_signal_handlers():\n # type: () -> None\n for signum in [signal.SIGINT, signal.SIGTERM]:\n signal.signal(signum, log_and_exit_handler)\n\n signal.signal(signal.SIGUSR1, dump_thread_handler)",
"def init_signal_handler():\n signal.signal(signal.SIGUSR1, sig_handler)\n signal.signal(... | [
"0.7772562",
"0.73069805",
"0.70535564",
"0.69866353",
"0.6862096",
"0.6861376",
"0.64042336",
"0.63918316",
"0.63752675",
"0.621561",
"0.61876076",
"0.60945964",
"0.6074691",
"0.60609514",
"0.5999939",
"0.59959495",
"0.5987227",
"0.59856313",
"0.5965386",
"0.5942906",
"0.589... | 0.81305313 | 0 |
Handle a signal sent to this process (SIGUSR1 or SIGUSR2) to enable or disable logging. | def handle_logging_signal(self, signum, frame):
if signum == signal.SIGUSR1:
logger.warning('Logging enabled via signal; send SIGUSR2 to PID '
'%d to disable logging', getpid())
self.log_enabled = True
elif signum == signal.SIGUSR2:
logger.w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_signal_handlers(self):\n signal.signal(signal.SIGUSR1, self.handle_logging_signal)\n signal.signal(signal.SIGUSR2, self.handle_logging_signal)",
"def set_signal(self):\n eprint(\"Signal caught, ending log...\")\n self.log_sig = True",
"def init_signal_handler():\n signa... | [
"0.7424925",
"0.6531359",
"0.60466653",
"0.60098785",
"0.57099855",
"0.5659611",
"0.5627149",
"0.5599337",
"0.55690354",
"0.5476252",
"0.5459919",
"0.5393123",
"0.53718174",
"0.5364912",
"0.5362066",
"0.5353693",
"0.5314653",
"0.5218517",
"0.5217412",
"0.5206121",
"0.5176048"... | 0.8433533 | 0 |
Method to run the Twisted reactor; mock point for testing | def run_reactor(self):
self.reactor.run() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n\n if reactor.running:\n return\n\n self._thread = threading.Thread(target=reactor.run, args=(False,))\n self._thread.daemon = True\n self._thread.start()",
"def run(self):\n\n if reactor.running:\n misc.formatted_print('RosBridgeWebSockCom... | [
"0.7778394",
"0.74967456",
"0.7319666",
"0.7220562",
"0.7220562",
"0.7008422",
"0.7003522",
"0.6994657",
"0.66136485",
"0.6601231",
"0.6545518",
"0.6543385",
"0.64206713",
"0.63929015",
"0.6370003",
"0.635786",
"0.627061",
"0.61581725",
"0.613168",
"0.61298543",
"0.60738724",... | 0.8518277 | 0 |
Setup TCP listener for the Site; helper method for testing | def listentcp(self, site):
logger.warning('Setting TCP listener on port %d for HTTP requests',
self.bind_port)
self.reactor.listenTCP(self.bind_port, site) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_for_run(self):\n self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n self.server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n self.server.bind((self.ip_address, self.port))\n self.server.listen(100)",
"def _startListening(self, port=None):\n i... | [
"0.70610344",
"0.67669165",
"0.6753614",
"0.669443",
"0.65610534",
"0.65455735",
"0.6543585",
"0.6519221",
"0.6474275",
"0.6452438",
"0.6423061",
"0.64223975",
"0.639628",
"0.638766",
"0.6324891",
"0.6289175",
"0.626186",
"0.62408364",
"0.6237316",
"0.6210429",
"0.6184662",
... | 0.7318118 | 0 |
Setup TLS listener for the Site; helper method for testing | def listentls(self, site):
logger.warning('Setting TCP TLS listener on port %d for HTTPS requests',
self.bind_port)
self.reactor.listenSSL(self.bind_port, site, self.tls_factory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _config_tls(self):\n pass",
"def test_tls_in_tls_tunnel(self) -> None:\n self.start_destination_server()\n self.start_proxy_server()\n\n sock = socket.create_connection(\n (self.proxy_server.host, self.proxy_server.port)\n )\n with self.client_context.wrap... | [
"0.7026453",
"0.6474438",
"0.6472922",
"0.6274493",
"0.62616086",
"0.6183114",
"0.61796516",
"0.61622256",
"0.61182225",
"0.6105451",
"0.60914046",
"0.60610014",
"0.606056",
"0.6055678",
"0.59946406",
"0.59886986",
"0.59402734",
"0.5873588",
"0.581147",
"0.57844216",
"0.57763... | 0.74420154 | 0 |
Setup the LoopingCall to poll Consul every ``self.poll_interval``; helper for testing. | def add_update_loop(self):
l = LoopingCall(self.update_active_node)
l.clock = self.reactor
logger.warning('Setting Consul poll interval to %s seconds',
self.poll_interval)
l.start(self.poll_interval) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polling_call(self) -> global___Snippet.ClientCall:",
"def setup_poll(self):\n while True:\n try:\n self.do_polling()\n time.sleep(0.01)\n except KeyboardInterrupt:\n print(self.get_stream())\n exit()",
"def _start_poll... | [
"0.64300156",
"0.6119329",
"0.6094615",
"0.58870393",
"0.5854085",
"0.5847177",
"0.5814883",
"0.5669755",
"0.56681806",
"0.56652987",
"0.56584185",
"0.5645527",
"0.5624671",
"0.56083053",
"0.559879",
"0.55794555",
"0.55784315",
"0.5574817",
"0.556912",
"0.5552644",
"0.5544401... | 0.7342474 | 0 |
Render the response to the given request. This simply gets the current active vault node from ``self.redirector`` (our instance of | def render(self, request):
path = request.uri
# python3 will get a byte string here
if not isinstance(path, str): # nocoverage - py3 only
path = path.decode('utf-8')
# find the original Twisted server header
twisted_server = request.responseHeaders.getRawHeaders(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, request):\n return render(request, self.template, self.context)",
"def render(self, request):\r\n response = LoudWSGIResponse(\r\n self._reactor, self._threadpool, self._application, request)\r\n response.start()\r\n return NOT_DONE_YET",
"def render(self, r... | [
"0.6560809",
"0.6359053",
"0.6336096",
"0.6310626",
"0.6300567",
"0.6269164",
"0.61724883",
"0.61724883",
"0.61724883",
"0.61724883",
"0.61724883",
"0.6134169",
"0.6116021",
"0.5992712",
"0.5980887",
"0.58995026",
"0.58071774",
"0.5804967",
"0.5791897",
"0.57851684",
"0.57508... | 0.7892752 | 0 |
Return num_items many items of seq, spread evenly. If seq is shorter than num_items, include all items. Otherwise, include first and last items and spread evenly in between. (If num_items is 1, only include first item.) | def select_evenly_spread(seq, num_items):
if len(seq) <= num_items:
return seq
if num_items == 1:
return [seq[0]]
step_size = (len(seq) - 1) / float(num_items - 1)
float_indices = [i * step_size for i in range(num_items)]
return [seq[int(round(index))] for index in float_indices] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def takespread(sequence, num):\n length = float(len(sequence))\n for i in range(num):\n yield sequence[int(np.ceil(i * length / num))]",
"def takespread(sequence, num):\n length = float(len(sequence))\n for i in range(num):\n yield sequence[int(ceil(i * length / num))]",
"def chunk(si... | [
"0.6699766",
"0.66776925",
"0.64731294",
"0.6373739",
"0.6299112",
"0.6218917",
"0.61767405",
"0.6134805",
"0.6121701",
"0.6070096",
"0.6070043",
"0.6037862",
"0.59886056",
"0.59750354",
"0.59304655",
"0.5926504",
"0.59138757",
"0.5903377",
"0.59028697",
"0.5899408",
"0.58725... | 0.71883833 | 0 |
Dump records into a etree. | def dumps_etree(records, xslt_filename=None, prefix=None):
E = ElementMaker(namespace=MARC21_NS, nsmap={prefix: MARC21_NS})
def dump_record(record):
"""Dump a single record."""
rec = E.record()
leader = record.get('leader')
if leader:
rec.append(E.leader(leader))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dumps(records, xslt_filename=None, **kwargs):\n root = dumps_etree(records=records, xslt_filename=xslt_filename)\n return etree.tostring(\n root,\n pretty_print=True,\n xml_declaration=True,\n encoding='UTF-8',\n **kwargs\n )",
"def dumps_etree(pid, record, **kwarg... | [
"0.69029105",
"0.63929474",
"0.56852293",
"0.55213356",
"0.5477097",
"0.5326399",
"0.5287852",
"0.5261604",
"0.5207058",
"0.51850164",
"0.51611996",
"0.51485854",
"0.5118779",
"0.5108804",
"0.50956446",
"0.5054487",
"0.5044759",
"0.50340503",
"0.50274277",
"0.49789754",
"0.49... | 0.7121784 | 0 |
Get the path to the .env file and load it. | def load_env():
project_dir = abspath(join(dirname(__file__), '../..', '..', '..'))
dotenv.read_dotenv(join(project_dir, 'nijanthan/practise/base_pro/.env')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_env(env_path=''):\n if not env_path:\n env_path = Path.home() / '.pincidents'\n load_dotenv(dotenv_path=env_path)",
"def load_config(env_file_path: str) -> None:\n if os.path.isfile(env_file_path):\n load_dotenv(dotenv_path=env_file_path)\n else:\n logger.info(f\".env fi... | [
"0.78547215",
"0.7557182",
"0.73901635",
"0.721461",
"0.7143697",
"0.69619185",
"0.69241214",
"0.6902178",
"0.68390185",
"0.68265843",
"0.6611378",
"0.65993965",
"0.65926677",
"0.65620166",
"0.65477896",
"0.63888115",
"0.6374202",
"0.63433176",
"0.6342294",
"0.63167065",
"0.6... | 0.7732894 | 1 |
(W,H) = nmf(V, Winit, Hinit, tol, timelimit, maxiter) | def nmf(V, Winit, Hinit, tol, timelimit, maxiter):
W = Winit; H = Hinit; initt = time();
gradW = dot(W, dot(H, H.T)) - dot(V, H.T)
gradH = dot(dot(W.T, W), H) - dot(W.T, V)
initgrad = norm(r_[gradW, gradH.T])
tolW = max(0.001, tol) * initgrad
tolH = tolW
for i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def NMF(X,r):\n nmf_mdl = nmf.NMF(X,num_bases=r)\n nmf_mdl.initialization()\n nmf_mdl.factorize()\n return nmf_mdl.W,nmf_mdl.H,np.dot(nmf_mdl.W,nmf_mdl.H)",
"def test_hmf_init(self):\n spec = np.random.random((20, 100))\n invvar = np.random.random((20, 100))\n hmf = HMF(spec, invvar)\n ... | [
"0.6112802",
"0.60931575",
"0.5728019",
"0.56031424",
"0.55949867",
"0.55810726",
"0.5515399",
"0.55091494",
"0.5394185",
"0.5364246",
"0.5362784",
"0.5339164",
"0.5308675",
"0.5297075",
"0.52824354",
"0.52717924",
"0.52717847",
"0.52690816",
"0.5243116",
"0.5242015",
"0.5231... | 0.81835836 | 0 |
Computes x^y in z_n | def zn_pow(x, y, n):
if y < 0:
y = abs(y)
x = inverse_in_zn(x, n)
product = 1
for i in range(y):
product = (product * x) % n
vprint("{}^{}={}".format(x, i, product))
return product | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def power(x, y):\n return x^y",
"def f(x, i_x, y, i_y, z, i_z, length):\r\n s_x = x(i_x, length)\r\n s_y = y(i_y, length)\r\n s_z = z(i_z, length)\r\n sol = ''\r\n i=0\r\n while len(sol)<length:\r\n sol += xor(xor(mult(s_x[i],s_y[i]) , mult(s_y[i], s_z[i])),s_z[i])\r\n i+=1\r\n... | [
"0.66730636",
"0.6635001",
"0.6572842",
"0.6569926",
"0.63914114",
"0.63569474",
"0.63238096",
"0.6276317",
"0.6223808",
"0.6194685",
"0.6188878",
"0.6178684",
"0.61747915",
"0.61637163",
"0.6114781",
"0.6096214",
"0.6078316",
"0.60657305",
"0.6062788",
"0.60532427",
"0.60515... | 0.75251645 | 0 |
Checks if g is a generator of z_n | def is_generator_in_zn(g, n):
elts_generated = elts_generated_by_g_in_zn(g, n)
vprint("g:{}, elts:{}\n".format(g, elts_generated))
return all([i in elts_generated for i in zn_star(n)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_generator(p, g):\n if(not (1 <= g <= (p - 1))): # g must be an element in Z_{p}^{*}\n return False\n \n q = (p - 1) // 2 # Since p = 2q + 1\n if(pow(g, 2, p) == 1):\n return False\n elif(pow(g, q, p) == 1):\n return False\n ... | [
"0.7949682",
"0.70262194",
"0.6968087",
"0.62968594",
"0.6117654",
"0.57494915",
"0.5652518",
"0.5647986",
"0.56283367",
"0.56008095",
"0.55592644",
"0.55405307",
"0.54814005",
"0.54731536",
"0.5467142",
"0.5421483",
"0.5421247",
"0.5407625",
"0.5404735",
"0.53993076",
"0.536... | 0.7681654 | 1 |
Returns a list containing the generator(s) of z_n | def generators(n):
return [g for g in zn_star(n)
if is_generator_in_zn(g, n)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parition_generator(n):\n # generator\n k = np.zeros(n, dtype=np.dtype(int))\n Z = np.zeros(n, dtype=np.dtype(int))\n h = [float(n)]\n yield(Z)\n while next_partition(Z, k, h) is not None:\n yield(Z)",
"def _generators_for_H(self):\n if self.level() in [1, 2]:\n retu... | [
"0.67002165",
"0.63764656",
"0.62214935",
"0.60862786",
"0.60487634",
"0.60005474",
"0.5977176",
"0.5936845",
"0.592394",
"0.588313",
"0.5868543",
"0.5853401",
"0.58512384",
"0.58411086",
"0.58137316",
"0.5801812",
"0.5782896",
"0.5781784",
"0.57633716",
"0.5753569",
"0.57496... | 0.8108819 | 0 |
Find inverse of g in z_n | def inverse_in_zn(g, n):
assert(n >= g)
x, y, d = extended_euclidean(n, g)
if y < 0:
return y + n
return y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse_gc(g):\n i = g\n j = 1\n while j<N:\n i = i ^ (g >> j)\n j = j + 1\n return i",
"def _invert(G):\n return Surreal.from_value(1 / G._n)",
"def inverse_fisher_z_transform(z):\r\n return ((e ** (2 * z)) - 1.) / ((e ** (2 * z)) + 1.)",
"def inv(z: int) -> int:\n ... | [
"0.75171715",
"0.67687446",
"0.6758636",
"0.6735445",
"0.6680595",
"0.6458415",
"0.64496434",
"0.63375884",
"0.63053936",
"0.6281091",
"0.62721896",
"0.62156457",
"0.6212842",
"0.61471933",
"0.6141524",
"0.6140245",
"0.61159855",
"0.6105521",
"0.61054134",
"0.60821134",
"0.60... | 0.8124559 | 0 |
Finds dlog(h) baseg in Z_n, i.e. given generator g, finds x such that g^x = h in Z_n | def dlog(g, h, n):
elts_generated = elts_generated_by_g_in_zn(g, n)
# If this assert fails, then g wasn't actually a generator
assert(h in elts_generated)
return elts_generated.index(h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def g_d(self, z):\n a = self.g(z)\n return a * (1 - a)",
"def g(i):\n return int(np.log2(gc(i)^gc(i+1)))",
"def G(k):\n return k^(k>>1)",
"def g(z):\n return 1. / (1. + np.exp(-z))",
"def generation(x, g):\n return int(x/g)",
"def d(i):\n if i==0:\n return 0\n elif ... | [
"0.67295223",
"0.66372913",
"0.61786944",
"0.61676687",
"0.60204524",
"0.6011649",
"0.60047656",
"0.6002928",
"0.59030944",
"0.5895163",
"0.58863825",
"0.58171076",
"0.581507",
"0.5794808",
"0.5784611",
"0.5769089",
"0.57558495",
"0.57503766",
"0.5745927",
"0.5738804",
"0.565... | 0.77870095 | 0 |
Speedily computes a^x (mod n) | def fast_exp(a, x, n):
x_2 = int2bin(x)
vprint("{} = [{}]_2".format(str(x), x_2))
powers = [a % n]
vprint("{}^(2^0) = {}^1 = {} \\equiv {}".format(a, a, a, (a % n)))
i = 1
while i < len(x_2):
# This (hilariously ugly) print statement prints the
# intermediary operations in a form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fast_power(a, n, m): # (a ^ n) % m\n result = 1\n value = a\n power = n\n while power > 0:\n if power % 2 == 1:\n result = result * value\n result %= m\n value = value * value\n value %= m\n power = power//2\n return result",
"def fast_expo(a, ... | [
"0.79421157",
"0.7464723",
"0.73651356",
"0.7330644",
"0.73195386",
"0.7313797",
"0.72905034",
"0.7276198",
"0.7246754",
"0.7216778",
"0.72006136",
"0.71849555",
"0.71495146",
"0.70580775",
"0.70481366",
"0.7007317",
"0.6999108",
"0.69729644",
"0.6950965",
"0.69267964",
"0.69... | 0.7604963 | 1 |
Update and return an existing `Alumno` instance, given the validated data. | def update(self, instance, validated_data):
instance.edad_min = validated_data.get('edad_min', instance.edad_min)
instance.edad_max = validated_data.get('edad_max', instance.edad_max)
instance.complejo_id = validated_data.get('complejo_id', instance.complejo_id)
instance.turno_id = valid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, instance, validated_data):\n for attr, value in list(validated_data.items()):\n if attr == 'authority':\n instance.authority = value\n else:\n setattr(instance, attr, value)\n instance.save()\n return instance",
"def update... | [
"0.5845844",
"0.5769151",
"0.57466364",
"0.5688297",
"0.56788665",
"0.5669592",
"0.5633918",
"0.5633918",
"0.5615619",
"0.55975354",
"0.55958843",
"0.55896044",
"0.5553421",
"0.55398446",
"0.5533651",
"0.5492649",
"0.54891443",
"0.5474566",
"0.5474315",
"0.54662853",
"0.54543... | 0.6467178 | 0 |
Loads a .pkl file. | def load_pkl_file(p):
pkl_file = open(p, 'rb')
obj = pickle.load(pkl_file)
pkl_file.close()
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_pkl_file(path):\n with open(path, 'rb') as pkl_file:\n return pickle.load(pkl_file)",
"def load_pkl(file_name):\n with open(file_name) as fp:\n data = pkl.load(fp)\n return data",
"def load_pkl(path):\r\n f = open(path, 'rb')\r\n try:\r\n rval = cPickle.load(f)\r\n ... | [
"0.80848205",
"0.80261904",
"0.7606655",
"0.74007636",
"0.7380519",
"0.7297209",
"0.72097653",
"0.7130443",
"0.699941",
"0.69030744",
"0.6784717",
"0.66750306",
"0.6643464",
"0.6591345",
"0.65817916",
"0.6562977",
"0.6518841",
"0.65133154",
"0.65023845",
"0.64697045",
"0.6465... | 0.8053456 | 1 |
Saves train and test DataFrames. | def save_train_test(train_df, test_df, save_path: str, save_as_dict: bool=True):
if save_as_dict:
data = {
'train_df': train_df,
'test_df': test_df
}
save_pkl_file(data, save_path)
else:
# Remove the extension so we can add 'train' or 'test' to the save_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __save_datasets(self):\n self.train.to_csv('{}/{}/{}'.format(path_to_train_set, img_format, 'train.csv'))\n self.valid.to_csv('{}/{}/{}'.format(path_to_valid_set, img_format, 'valid.csv'))\n self.test.to_csv('{}/{}/{}'.format(path_to_test_set, img_format, 'test.csv'))",
"def download_tra... | [
"0.74632454",
"0.72168815",
"0.68651634",
"0.6844151",
"0.684323",
"0.6843225",
"0.671058",
"0.6538746",
"0.6511335",
"0.64811313",
"0.64115703",
"0.63099635",
"0.6287524",
"0.62760574",
"0.6226931",
"0.618777",
"0.6178389",
"0.6170827",
"0.61698985",
"0.6161954",
"0.6153325"... | 0.75162804 | 0 |
Look over spacecraft files and make a histogram of (solid angle [sr] time interval [sec]) on MET vs. Zenith angle vs. Cos(Inclination) | def make_livetime_histogram(aHtgLt, nRegion, pathFileScAll, metStart, metStop, aFileToI, aCoordsPix_array, aAreaPix_array, origin_time=0, metExStart=0, metExStop=0):
fmwStart = ConvertMetToFMW(metStart)
fmwStop = ConvertMetToFMW(metStop)
print '=========================================='
print 'Going to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculation_time_analysis():\n\tfrom . import spectra as sp\n\tp_dict = {'Bfield':700,'rb85frac':1,'Btheta':88*np.pi/180,'Bphi':0*np.pi/180,'lcell':75e-3,'T':84,'Dline':'D2','Elem':'Cs'}\n\tchiL,chiR,chiZ = sp.calc_chi([-3500],p_dict)\n\t\n\tfor angle in [0, np.pi/32, np.pi/16, np.pi/8, np.pi/4, np.pi/2]:\n\t\... | [
"0.5840523",
"0.5802977",
"0.57698035",
"0.5718962",
"0.5679438",
"0.5674738",
"0.5654353",
"0.5648745",
"0.5530748",
"0.55119634",
"0.55090517",
"0.544853",
"0.54482937",
"0.5443324",
"0.54364717",
"0.5420338",
"0.54029834",
"0.53914154",
"0.5384595",
"0.5371579",
"0.5368214... | 0.6619343 | 0 |
Parse incoming data for socket s | def parse(self, data, s):
fn = s.fileno()
perf = re.compile("<xml><perf>(\d+)</perf></xml>")
numbers = re.compile("<xml>(?:<number>(\d+)</number>)+</xml>")
if not self.accepting:
self.mq[fn].put_nowait("die\n")
self.inputs.remove(s)
else:
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(data: bytes, port: int, origin: helpers.ConnectionType):\n # Ignore packets from master server... game server is more interesting\n if port == helpers.MASTER_PORT:\n return\n # Iteratively parse packet data until nothing is left to parse\n reads = 0\n while len(data) >= 2:\n ... | [
"0.68106925",
"0.6662685",
"0.6619296",
"0.66118187",
"0.66085845",
"0.65729916",
"0.6566147",
"0.6561392",
"0.65554523",
"0.6542034",
"0.65204155",
"0.65103513",
"0.64792174",
"0.64737993",
"0.64652234",
"0.6451255",
"0.6406737",
"0.6398697",
"0.6397721",
"0.63719755",
"0.63... | 0.7151742 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.