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
If votes is not a QuerySet or contains the wrong model, TypeError is raised
def test_wrong_input_type(self): with self.assertRaises(TypeError): votes_to_percentages(['not', 'a', 'queryset']) with self.assertRaises(TypeError): votes_to_percentages(Disposable.objects.all())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_votes(self):\n with self.assertRaises(ValueError):\n votes_to_percentages(DisposableVote.objects.none())", "def vote(request, model, object_id):\n if request.method != 'POST':\n raise Http404\n\n vote_type = request.POST.get('type', None)\n if vote_type == 'up' an...
[ "0.6306854", "0.59208554", "0.58282936", "0.55802065", "0.5557189", "0.55157584", "0.5507421", "0.542246", "0.53265035", "0.5298787", "0.52821714", "0.52754", "0.5245972", "0.52318245", "0.522503", "0.522503", "0.5198582", "0.51905507", "0.5157574", "0.5144505", "0.5129177", ...
0.61271936
1
If votes is empty, a ValueError is raised
def test_empty_votes(self): with self.assertRaises(ValueError): votes_to_percentages(DisposableVote.objects.none())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_missing_vote_value(self) -> None:\n self.clear_votes()\n try:\n message = \"successfully voted\"\n QuestionVote.objects.create(\n question=self.question,\n user=self.user,\n )\n except django.db.IntegrityError:\n ...
[ "0.6663037", "0.6053366", "0.5947015", "0.5833709", "0.574379", "0.5649357", "0.5536872", "0.5523675", "0.54281944", "0.54198414", "0.5394457", "0.5368231", "0.5327113", "0.5319719", "0.5312464", "0.5308163", "0.5286258", "0.5258488", "0.5245959", "0.52093315", "0.5204067", ...
0.76942736
0
Busca un cero usando el metodo de la biseccion. func es la funcion, a y b encajonan el cero, tol=toleracia
def biseccion(func, a, b, tol=1e-4): p = (a + b) / 2 while np.fabs(func(p)) > tol: p = (a + b) / 2 if func(a) * func(p) < 0: b = p elif func(a) * func(p) > 0: a = p else: return p return p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bisezione(f,a,b,toll=10**-5):\n m = (a+b)/2\n f_m = f(m)\n while abs(f_m) > toll:\n if f(a)*f_m < 0:\n b = m\n elif f(b)*f_m < 0:\n a = m\n elif f_m == 0:\n print(\"Trovata solzione esatta\")\n return m\n else:\n print(...
[ "0.5555701", "0.5502055", "0.5292556", "0.52499145", "0.5237464", "0.51849324", "0.5158482", "0.5082896", "0.50477093", "0.5032028", "0.50297546", "0.5017506", "0.5013907", "0.5013907", "0.50065714", "0.5002977", "0.49987894", "0.49891984", "0.4987446", "0.49794155", "0.49753...
0.58301175
0
return the child point q corresponding to p in the parent. note that q.side == p.side THINK ABOUT IT
def parent_to_child(p): a,b = LINES[p.side] if p.x < 0.5: return Point(a, p.side, 2*p.x) else: return Point(b, p.side, 2*p.x - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent(self,p):\n node = self._validate(p)\n return self._make_position(node._parent)", "def parent(self, p):\n node = self._validate_position(p)\n return self._make_position(node)", "def parent(self, p):\n node = self._validate(p)\n return self._make_position(node._parent...
[ "0.70021415", "0.6914503", "0.68851006", "0.67637295", "0.67503387", "0.67251015", "0.67251015", "0.67251015", "0.6384844", "0.636594", "0.6338018", "0.63363457", "0.63363457", "0.62673676", "0.62673676", "0.624849", "0.6232469", "0.6232469", "0.619909", "0.609522", "0.598931...
0.7743672
0
return a random endpoint in the current child not on taken_side
def random_endpoint(child, taken_side=None): sides = [s for s in SIDES[child] if s != taken_side] return Point(child, random.choice(sides), 0 if random.random() < 0.5 else 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_random_pos_on_a_side(self):\n pass", "def throw(self):\n self.side = random.randint(1, self.num_sides)", "def get_random_node(self):\n if random.randint(0, 100) > self.goal_sample_rate:\n random_node = self.Node(\n random.uniform(self.min_rand, self.max_r...
[ "0.70703185", "0.6206867", "0.61404693", "0.5760542", "0.5755857", "0.5748231", "0.56564564", "0.56409484", "0.56029654", "0.5594463", "0.5553292", "0.5547132", "0.55098593", "0.5449766", "0.544954", "0.5447059", "0.5444465", "0.54438233", "0.5443404", "0.54398537", "0.543976...
0.832961
0
Loads a .py module from github (raw) Returns a module object
def get_module_from_github(url): with urlopen(url) as response: if response.code == 200: text = str(response.read(), encoding="utf-8") _, path = mkstemp(suffix=".py", text=True) with open(path, mode='wt', encoding='utf-8') as fh: fh.write(text) directory, file_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_module(self, fullname):\n LOGGER.info('Loading module {0}'.format(fullname))\n if fullname in sys.modules:\n return sys.modules[fullname]\n\n splitted_names = fullname.split('.')\n if 'github' in splitted_names:\n if len(splitted_names) >= 3:\n ...
[ "0.6863036", "0.65888363", "0.64832926", "0.6392326", "0.637052", "0.6313743", "0.62788546", "0.62697667", "0.62596184", "0.6259035", "0.6255723", "0.6192319", "0.6162507", "0.61570686", "0.6147943", "0.6132673", "0.6108426", "0.60681444", "0.6066579", "0.60329056", "0.599268...
0.78711605
0
retuns the quote's text with tagged part of quote chunks
def serialize_quote(self): partofs = PartOfQuote.objects.filter(part_of=self) quote = self.text for x in partofs: quote = quote.replace(x.text, create_tag(x)) return quote
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_quote(self, text):\n return [\"<blockquote>\"] + text", "def process_quote_text(quote_text):\n quote_text = quote_text.replace('―', '').replace('\\n\\n', '\\n')\n quote_text = quote_text[:-1] if quote_text[-1] == '\\n' else quote_text\n for char in HTML:\n quote_text = quote_text...
[ "0.6213396", "0.6097698", "0.6085885", "0.6053056", "0.5988718", "0.5977862", "0.5800565", "0.5786364", "0.57424855", "0.57417625", "0.5605103", "0.5602675", "0.55760896", "0.55452555", "0.5529984", "0.5528037", "0.5527219", "0.5504466", "0.5502221", "0.5453675", "0.54405576"...
0.6584478
0
Increase the number of xor gateways (split + join)
def inc_xor_gateways(self): self.num_xor_gateways += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xor(a, b):", "def __init__(self, width, partition_points):\n super().__init__(width, partition_points, XORCombiner, \"xor\")", "def xor_network():\n # fmt: off\n tpm = np.array([\n [0, 0, 0],\n [0, 1, 1],\n [1, 0, 1],\n [1, 1, 0],\n [1, 1, 0],\n [1, 0,...
[ "0.6017773", "0.5604052", "0.55942357", "0.55624527", "0.5541649", "0.55383646", "0.55364746", "0.55166155", "0.546064", "0.5433929", "0.5414978", "0.5412313", "0.5385111", "0.53839195", "0.5364891", "0.5353381", "0.5341885", "0.53325903", "0.53294843", "0.5320235", "0.528355...
0.7862372
0
Increase the number of tau transitions
def inc_tau_trans(self): self.num_tau_trans += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _kendall_tau_add(self, len_old: int, diff_pos: int, tau_old: float):\n return 2.0 / (len_old + 1) * (float(diff_pos) / len_old - tau_old)", "def _kendall_tau_add(self, len_old, diff_pos, tau_old):\n return 2./(len_old+1)*(float(diff_pos)/len_old-tau_old)", "def tau_turnover(self):\n re...
[ "0.6267952", "0.6195915", "0.5895552", "0.58890814", "0.58763903", "0.5635565", "0.5554859", "0.5525284", "0.5503111", "0.5492844", "0.5483372", "0.5452114", "0.54350936", "0.5365188", "0.5355348", "0.5350318", "0.5350318", "0.53370744", "0.52750194", "0.52710396", "0.5266659...
0.81626916
0
Create a task with the specified label in the BPMN
def add_task(bpmn, counts, label): from pm4py.objects.bpmn.bpmn_graph import BPMN task = BPMN.Task(name=label) bpmn.add_node(task) return bpmn, task, counts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_task():", "def create_task(self, name, value):\n pass", "def add_task():\n # get values from user\n responses = accept_inputs([\"Task label\", \"Short task description\", \"Parent task label\"])\n # insert into db\n query_no_results(\"insert into task values(?, ?, ?)\",\n [responses[\"...
[ "0.74706125", "0.73837596", "0.67262894", "0.66487724", "0.660005", "0.64948", "0.6458578", "0.642163", "0.6415165", "0.6370665", "0.6368903", "0.627783", "0.6273318", "0.6252123", "0.62488365", "0.6243665", "0.62112993", "0.61936545", "0.6173977", "0.61645275", "0.6154962", ...
0.77884877
0
Parse the www/template.html and createsthe content of file lib/htmltemplate/htmlclasses.py
def parse(force=False): from htmltemplate import WWW_DIR, TEMPLATE_FILE, TEMPLATE_PY # pylint: disable=duplicate-string-formatting-argument print("Parse html template") lines = open(WWW_DIR+TEMPLATE_FILE).readlines() pyClassFile = open(TEMPLATE_PY,"w") pyClassFile.write("''' File automatically generated wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_template_file(self):\n pass", "def create_page(self, data):\n env = Environment(loader=FileSystemLoader(self.template_folder), trim_blocks=True, lstrip_blocks=True)\n template = env.get_template(self.template_file_name)\n template_vars = {'class_name': self.get_class_name(dat...
[ "0.683075", "0.64649874", "0.63023174", "0.6233896", "0.6180485", "0.6096842", "0.6082805", "0.6066677", "0.606245", "0.6048339", "0.60287607", "0.6013675", "0.6008966", "0.59312356", "0.5891936", "0.589168", "0.5890535", "0.5880855", "0.58584857", "0.58117074", "0.5795981", ...
0.7633674
0
Computes labels and inertia using a full distance matrix. This will overwrite the 'distances' array inplace.
def _labels_inertia_precompute_dense(norm, X, sample_weight, centers, distances): n_samples = X.shape[0] if norm == 'L2': labels, mindist = pairwise_distances_argmin_min( X=X, Y=centers, metric='euclidean', metric_kwargs={'squared': True}) elif norm == 'L1': labels, mindist = pai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assign_labels_array(X, sample_weight, x_squared_norms, centers,\n labels, distances):\n n_clusters = centers.shape[0]\n n_samples = X.shape[0]\n store_distances = 0\n inertia = 0.0\n\n dtype = numpy.float32 if centers.dtype == numpy.float32 else numpy.float64\n center...
[ "0.60576165", "0.57919693", "0.566674", "0.5591969", "0.5492387", "0.5474446", "0.54441214", "0.54441214", "0.53986883", "0.5384593", "0.536254", "0.53395325", "0.5278341", "0.5267286", "0.5205148", "0.51953477", "0.5181319", "0.5104884", "0.5094013", "0.50924665", "0.5090735...
0.5923138
1
Interactively retrieves the crendential for a user_id client_id user identifier client_secret user's secret key persist True to immediately store the credential, False otherwise (default)
def get_client_credentials_intractive(self, client_id, client_secret, persist=False): if type(client_id) == unicode: client_id = client_id.encode('ascii') if type(client_secret) == unicode: client_secret = client_secret.encode('ascii') flow = OAuth2WebServerFlow(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_credentials():\n store = Storage(CLIENT_CREDENTIALS_FILE)\n credentials = store.get()\n if not credentials or credentials.invalid:\n flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)\n flow.user_agent = APPLICATION_NAME\n if flags:\n credentials = to...
[ "0.577868", "0.57673126", "0.5747401", "0.5735007", "0.5692768", "0.5685396", "0.5674494", "0.56565887", "0.5637241", "0.5617159", "0.5594525", "0.55890554", "0.5583921", "0.55628043", "0.5555722", "0.554597", "0.55318135", "0.552191", "0.552191", "0.55188334", "0.55112743", ...
0.62820846
0
Remove the locally stored credentials
def remove_client_credentials(self): if self._dry_run: return os.unlink(self._store_pathname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_credential(credentials):\n credentials.delete_credentials()", "def delete_credentials(self):\n Credentials.credentials_list.remove(self)", "def delete_credentials(self):\n Credentials.credentials_list.remove(self)", "def delete_credentials(self):\n Credentials.credentials_l...
[ "0.7707641", "0.75258327", "0.75258327", "0.75258327", "0.74404943", "0.7261854", "0.70868516", "0.7018398", "0.6845732", "0.67399734", "0.67137116", "0.6710589", "0.6710589", "0.6691028", "0.65997237", "0.65893865", "0.6577486", "0.6569618", "0.6546576", "0.6540298", "0.6538...
0.8074535
0
Returns the credential store if the file exists
def _load_credential_store(self): try: return shelve.open(self._store_pathname) except Exception: raise CredentialError('Unable to open credential store: ' + self._store_pathname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_creds_file(self):\n filename = self.filename\n\n home = str(Path.home())\n filepath = home + os.sep + filename\n self.path = filepath\n if not os.path.isfile(filepath):\n return False\n\n j = json.load(open(filepath))\n self.keys = j\n retu...
[ "0.70948315", "0.70730686", "0.70023566", "0.6916191", "0.6912367", "0.69121444", "0.689295", "0.6887308", "0.6858863", "0.68382764", "0.68215716", "0.6797262", "0.6796208", "0.6744389", "0.67271996", "0.6713757", "0.67029476", "0.6693516", "0.6684445", "0.6670447", "0.665934...
0.73352385
0
Flushes and closes the credential store
def _save_credential_store(self, store): store.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self.save()\n # self.fileKey = None\n if self.openAccount:\n self.openAccount.close()\n self.openAccount = None", "def close(self):\n self.password = None\n self.session.close()", "async def aclose(self) -> None:\n\t\tawait self._store...
[ "0.6961587", "0.6681481", "0.65697914", "0.6494412", "0.6471906", "0.64025295", "0.6352745", "0.63433146", "0.6317204", "0.6268953", "0.62491477", "0.6214849", "0.62142926", "0.62142706", "0.6199774", "0.61757946", "0.61647165", "0.61625445", "0.614162", "0.6118002", "0.61150...
0.76500064
0
Extract location from FX node stack trace.
def _location_from_fx_stack_trace( node_stack_trace: str, ) -> Optional[diagnostics.infra.Location]: if "File" not in node_stack_trace: return None lines = node_stack_trace.strip().split("\n") idx = 0 while idx < len(lines) and "File" not in lines[idx]: idx += 1 if idx + 1 >= le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_loc(node):\n lineno = node.lineno\n end_lineno = get_last_deep_child(node).lineno\n return end_lineno - lineno", "def frame_location_info(self):\n\n return str(self.active_frame.f_code.co_filename) + \":\" + str(self.active_frame.f_lineno)", "def getStackPosition(self):\r\n ...
[ "0.64482874", "0.6389762", "0.63267493", "0.62837934", "0.61853236", "0.61039037", "0.6071818", "0.6055752", "0.60536265", "0.60212994", "0.6014216", "0.5930068", "0.58694696", "0.57997334", "0.5782252", "0.5774222", "0.5765356", "0.57514143", "0.57455015", "0.57362705", "0.5...
0.79784185
0
Map FX value to TorchScript value. When creating TorchScript graph from FX graph, we need a mapping from FX variable to TorchScript variable. This function maps FX variable, fx_node_arg, to torch.jit.Value.
def _retrieve_or_adapt_input_to_graph_set( fx_node_arg: fx_type_utils.Argument, fx_name_to_onnxscript_value: Dict[ str, Union[ onnxscript_graph_building.TorchScriptTensor, Tuple[onnxscript_graph_building.TorchScriptTensor, ...], ], ], tracer: onnxscript_gr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_module(\n self,\n node: torch.fx.Node,\n parent_onnxscript_graph: onnxscript_graph_building.TorchScriptGraph,\n fx_name_to_onnxscript_value: Dict[\n str,\n Union[\n onnxscript_graph_building.TorchScriptTensor,\n Tuple[onnxscri...
[ "0.60945934", "0.5849507", "0.56277806", "0.55226827", "0.51107115", "0.5005654", "0.49181044", "0.48638496", "0.48501047", "0.48006842", "0.47544688", "0.47219574", "0.46902397", "0.46803787", "0.46616042", "0.46607846", "0.46585023", "0.46428233", "0.4638741", "0.4633322", ...
0.6808531
0
Fill the meta information of onnxscript_values with that from the fx FakeTensor.
def _fill_tensor_shape_type( onnxscript_values: Union[ onnxscript_graph_building.TorchScriptTensor, Tuple[onnxscript_graph_building.TorchScriptTensor, ...], ], name: str, expected_values: Union[ fx_type_utils.META_VALUE_TYPE, List[fx_type_utils.META_VALUE_TYPE], T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_values(self):\n\n if self.featureType != \"gene\":\n self.transcriptId = self.meta['transcript_id']\n self.transcriptName = self.meta['transcript_name']\n self.transcriptBioType = self.meta['transcript_biotype']\n if self.featureType == 'exon':\n ...
[ "0.60349166", "0.5497529", "0.5374807", "0.5361385", "0.5248724", "0.5213704", "0.5072275", "0.5041288", "0.50263256", "0.5021723", "0.50011504", "0.49802682", "0.48824126", "0.48571992", "0.48536652", "0.4850609", "0.48376772", "0.47934875", "0.4792228", "0.4781153", "0.4781...
0.5958788
1
Export a fx.GraphModule submodule to ONNXScript graph. The export process specifically targets `call_module` nodes that are created by the exporter's `Modularize` pass. Each `call_module` node has an associated fx.GraphModule by `node.target` underneath the root fx.GraphModule. These `call_module` nodes are exported as...
def call_module( self, node: torch.fx.Node, parent_onnxscript_graph: onnxscript_graph_building.TorchScriptGraph, fx_name_to_onnxscript_value: Dict[ str, Union[ onnxscript_graph_building.TorchScriptTensor, Tuple[onnxscript_graph_buil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(\n self,\n fx_graph_module: torch.fx.GraphModule,\n onnxfunction_dispatcher: onnxfunction_dispatcher.OnnxFunctionDispatcher,\n op_level_debug: bool,\n parent_onnxscript_graph: Optional[\n onnxscript_graph_building.TorchScriptGraph\n ] = None,\n ) -> o...
[ "0.6208346", "0.57180774", "0.5517651", "0.5326858", "0.53166723", "0.51689684", "0.5160342", "0.49694705", "0.49519387", "0.49379078", "0.4789286", "0.47887295", "0.47632617", "0.47464138", "0.47271678", "0.4721467", "0.46698704", "0.46584198", "0.46493828", "0.46453112", "0...
0.6967324
0
Restore a queue from a message reader. This publishes to the queue any messages returned by the reader. Any existing messages in the queue will still be in the queue.
def restore(self, reader): while True: msg = reader.read() if msg is None: break self.publish(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recover(self):\n if self._message_storage:\n for neighbor in self.neighbors:\n self.channel.queue_declare(queue=str(self.id) + str(neighbor))\n for message in self._message_storage:\n self.channel.basic_publish(\n exchang...
[ "0.5806696", "0.563494", "0.56112945", "0.5548665", "0.54663706", "0.54382193", "0.536221", "0.5321514", "0.53204316", "0.5261433", "0.5235016", "0.5229662", "0.5212791", "0.5189782", "0.51616454", "0.5141593", "0.5140806", "0.51346123", "0.5111369", "0.50946546", "0.50933266...
0.7559581
0
pull alarm from queue if you want
def pull_alarm(self): self.job = MATCH_QUEUE.take(timeout=settings.QUEUE_WAIT_TIMEOUT) if not self.job: raise lock.PassEmpty # JSON数据格式,反序列化 try: self.alarm_list = map(json.loads, self.job.body.strip().splitlines()) except Exception as error: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alarm(self, interval, call):", "async def alarm(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:\n self.__read_verbose_param(context)\n chat_id = update.effective_message.chat_id\n job_removed = remove_job_if_exists(str(chat_id), context)\n due = 1.0\n con...
[ "0.62227225", "0.590374", "0.58129394", "0.5800809", "0.5796147", "0.57914853", "0.57625484", "0.57412857", "0.5735919", "0.56989264", "0.5624381", "0.55708325", "0.5546818", "0.55423856", "0.5510702", "0.54998934", "0.5499139", "0.5491048", "0.54501593", "0.5438655", "0.5430...
0.74262494
0
check whether match for every alarmalarm_defmatch_key the match result will be self.matched_alarm_list
def match_alarm(self): for alarm in self.alarm_list: is_matched = False self._match_alarm_by_def(alarm) if alarm["_match_info"].get("alarm_def_id"): self.matched_alarm_list.append(alarm) is_matched = True if is_matched: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _match_alarm_by_def(self, alarm, origin_alarm_def_id=None,\n unmatch_log=None):\n if unmatch_log is None and settings.ENV == \"TEST\":\n unmatch_log = True\n\n matched_alarm_def_id = None\n for alarm_def in self.alarm_def_list:\n for match_k...
[ "0.77223146", "0.61824495", "0.61445177", "0.59490174", "0.58866197", "0.5850368", "0.5601849", "0.5581404", "0.5487921", "0.5483094", "0.53939867", "0.5369485", "0.5360608", "0.53533703", "0.5322929", "0.5289111", "0.52547723", "0.52222395", "0.52204394", "0.5210209", "0.519...
0.82694453
0
match alarm by alarm_def alarm["_match_info"]["alarm_def_id"] will be matched alarm_def's id
def _match_alarm_by_def(self, alarm, origin_alarm_def_id=None, unmatch_log=None): if unmatch_log is None and settings.ENV == "TEST": unmatch_log = True matched_alarm_def_id = None for alarm_def in self.alarm_def_list: for match_key, match_func...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_alarm(self):\n for alarm in self.alarm_list:\n is_matched = False\n self._match_alarm_by_def(alarm)\n if alarm[\"_match_info\"].get(\"alarm_def_id\"):\n self.matched_alarm_list.append(alarm)\n is_matched = True\n\n if is_mat...
[ "0.7166458", "0.57819176", "0.5482392", "0.531153", "0.5286329", "0.5285556", "0.52826345", "0.5204021", "0.51818633", "0.5035592", "0.5033543", "0.49758896", "0.49523956", "0.4948084", "0.49357826", "0.49351478", "0.49312088", "0.4913772", "0.48917705", "0.48898852", "0.4885...
0.798852
0
Returns a list of durations
def get_dur(self): return [char.get_dur() for char in self.string]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDurations(self):\n return self.durations", "def durations_per_type(self):\n pass", "def getDuration(self):\n return (self._get_int('duration'), self._attributes.getDivisions())", "def get_duration(self):\n duration = 0\n\n for entry in self.entries:\n dura...
[ "0.81575495", "0.726394", "0.6876918", "0.676946", "0.6652773", "0.65874827", "0.65300137", "0.64949", "0.6487036", "0.6487036", "0.64002234", "0.6309793", "0.6307618", "0.630678", "0.62959886", "0.62911266", "0.6283895", "0.62529457", "0.6236019", "0.6182811", "0.6182114", ...
0.74434316
1
My new constructor, which makes sure that the ``FRAME_TOOL_WINDOW`` style is not passed through to the ``AuiFloatingFrame`` constructor
def __init__(self, *args, **kwargs): if 'style' in kwargs: style = kwargs['style'] # This is the default style, as defined # in the AuiFloatingFrame constructor else: style = (wx.FRAME_TOOL_WINDOW | wx.FRAME_FLOAT_ON_PARENT | ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _AuiDockingGuide_init(self, *args, **kwargs):\n\n if 'style' in kwargs:\n style = kwargs['style']\n\n # This is the default style, as defined\n # in the AuiDockingGuide constructor\n else:\n style = (wx.FRAME_TOOL_WINDOW |\n wx.FRAME_STAY_ON_TOP |\n wx....
[ "0.70367366", "0.6843715", "0.6642154", "0.6578007", "0.654084", "0.6410062", "0.6291096", "0.62042177", "0.594362", "0.59111077", "0.5909552", "0.5876681", "0.57657516", "0.56834096", "0.56624097", "0.564891", "0.56267667", "0.56264985", "0.5610823", "0.55926937", "0.5591156...
0.8233745
0
I am also monkeypatching the ``wx.lib.agw.aui.AuiDockingGuide.__init__`` method, because in this instance, when running over SSH/X11, the ``wx.FRAME_TOOL_WINDOW`` style seems to result in the docking guide frames being given title bars, which is quite undesirable. I cannot patch the entire class in the aui package, bec...
def _AuiDockingGuide_init(self, *args, **kwargs): if 'style' in kwargs: style = kwargs['style'] # This is the default style, as defined # in the AuiDockingGuide constructor else: style = (wx.FRAME_TOOL_WINDOW | wx.FRAME_STAY_ON_TOP | wx.FRAME_NO_TASKBA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parent, direction=0):\r\n\r\n self._direction = direction\r\n\r\n style = wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP | \\\r\n wx.FRAME_NO_TASKBAR | wx.NO_BORDER\r\n\r\n # Use of FRAME_SHAPED on wxMac causes the frame to be visible\r\n # breaking the docking ...
[ "0.78029877", "0.76468927", "0.75003105", "0.67746687", "0.67715925", "0.65943986", "0.65633965", "0.652213", "0.63551587", "0.6119899", "0.5991007", "0.5870099", "0.58692646", "0.5821341", "0.5789795", "0.57829094", "0.57701516", "0.5749214", "0.5741523", "0.572504", "0.5701...
0.8088298
0
Generate adversarial via CW optimization.
def make_cw(env, X_data, epochs=50, eps=0.1, batch_size=1): print('\nMaking adversarials via CW') n_sample = X_data.shape[0] n_batch = int((n_sample + batch_size - 1) / batch_size) X_adv = np.empty_like(X_data) for batch in range(n_batch): with Timer('Batch {0}/{1} '.format(batch + 1, n_ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize(w, b, X, Y, num_iterations,learning_rate,print_cost = False):\n costs = []\n for i in range(num_iterations):\n\n # Cost and gradient calculation (≈ 1-4 lines of code)\n ### START CODE HERE ###\n grads,cost = propagate(w,b,X,Y)\n ### END CODE HERE ###\n\n # Retr...
[ "0.6353723", "0.6047894", "0.6027479", "0.59312564", "0.5912963", "0.5872055", "0.58629537", "0.584317", "0.58246624", "0.5762034", "0.5742786", "0.5726614", "0.5690474", "0.56794494", "0.5674205", "0.56507385", "0.564974", "0.5638503", "0.56237", "0.5580002", "0.5579754", ...
0.67412966
0
Compute orbit positions for the general two body problem from the initial orbital elements with a deterministic mathematical model. Factory function that returns a functional model.
def make_position_model_g2b_math(traj_size = 731): num_particles = 2 space_dims = 3 t = keras.Input(shape=(traj_size,), name='t') q0 = keras.Input(shape=(num_particles, space_dims,), name='q0') v0 = keras.Input(shape=(num_particles, space_dims,), name='v0') m = keras.Input(shape=(num_particles,)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_physics_model_r2bc_math(position_model: keras.Model, traj_size: int):\n # Create input layers\n t = keras.Input(shape=(traj_size,), name='t')\n q0 = keras.Input(shape=(2,), name='q0')\n v0 = keras.Input(shape=(2,), name='v0')\n mu = keras.Input(shape=(1,), name='mu')\n # The combined inp...
[ "0.60584325", "0.5861145", "0.56984997", "0.5582579", "0.5571899", "0.5571185", "0.55394447", "0.55196565", "0.5519342", "0.5471972", "0.54458904", "0.5429235", "0.5407269", "0.5400973", "0.53884035", "0.5383207", "0.535556", "0.5349774", "0.53446734", "0.5344", "0.5325683", ...
0.6602906
0
Turns bytes into unicode, if needed. Uses UTF8.
def asunicode(s): if isinstance(s, bytes): return s.decode('utf-8', 'replace') else: return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_unicode(data):\n if isinstance(data, bytes):\n return data.decode('utf-8')\n else:\n return data", "def utf8tounicode(arg):\n\n try:\n if isinstance(arg, unicode):\n return arg.decode('utf-8')\n except NameError:\n pass # Python 3\n re...
[ "0.7771352", "0.7608568", "0.760092", "0.7586902", "0.75841767", "0.75071144", "0.7426475", "0.7411024", "0.73730016", "0.7314761", "0.7290108", "0.723653", "0.7233475", "0.72172374", "0.7215756", "0.7209994", "0.719679", "0.7185164", "0.71597666", "0.71575105", "0.7137322", ...
0.7844327
0
load_ticker Retrieves market data from external data source (in this case Bloomberg)
def load_ticker(self, time_series_request): time_series_request_vendor = self.construct_vendor_time_series_request(time_series_request) data_frame = None self.logger.info("Request Bloomberg data") # do we need daily or intraday data? if (time_series_request.freq in ['daily', '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self):\n try:\n df = self.live_quote_arg_func(self.tickers)\n for index, ticker in enumerate(self.tickers):\n ticker_info = df.loc[index]\n self.ticker_dict[ticker].append(ticker_info['price'],\n ...
[ "0.7115917", "0.6569476", "0.64997846", "0.641512", "0.63950694", "0.63743776", "0.63675433", "0.6357785", "0.6351763", "0.6344594", "0.634049", "0.6279552", "0.62463516", "0.6239634", "0.6233006", "0.61905515", "0.6186492", "0.6181986", "0.6160244", "0.61591166", "0.60775226...
0.6994034
1
Applies a substituition cypher done by the rotor from right to left input_letter > integer that represents the letter rotor > rotor as a list of integers
def _rotor_right2left(rotor, input_letter, offset, ring): alpha_size = len(ALPHABET) return (rotor[(input_letter + offset - ring) % alpha_size] - offset +\ ring) % alpha_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rotor_left2right(rotor, input_letter, offset, ring):\n\t\tletter = (input_letter + offset - ring) % len(ALPHABET)\n\t\treturn (rotor.index(letter) - offset + ring) % len(ALPHABET)", "def scramble(r_letters, s_letters):\r\n if len(r_letters) == 0:\r\n # Base case: All letters used\r\n print(...
[ "0.63908404", "0.61391145", "0.6079742", "0.6025106", "0.59956324", "0.5960136", "0.5949024", "0.5942177", "0.5936276", "0.5896446", "0.5841828", "0.58261704", "0.58245915", "0.5823976", "0.5818802", "0.5812918", "0.5809682", "0.5798197", "0.5780767", "0.5763846", "0.5762415"...
0.6469157
0
Applies a substituition cypher done by the rotor from left to right input_letter > integer that represents the letter rotor > rotor as a list of integers
def _rotor_left2right(rotor, input_letter, offset, ring): letter = (input_letter + offset - ring) % len(ALPHABET) return (rotor.index(letter) - offset + ring) % len(ALPHABET)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rotor_right2left(rotor, input_letter, offset, ring):\n\t\talpha_size = len(ALPHABET)\n\t\treturn (rotor[(input_letter + offset - ring) % alpha_size] - offset +\\\n\t\t\t\t\tring) % alpha_size", "def rotate_character(char, rot):\n if type(char) != type(''):\n return char\n if type(rot) != type(1...
[ "0.6404293", "0.61947584", "0.614188", "0.60083866", "0.6000814", "0.59757674", "0.59642", "0.5956721", "0.5927695", "0.5915064", "0.5900568", "0.5884531", "0.58663297", "0.5865185", "0.58637923", "0.58486325", "0.58378184", "0.582674", "0.582506", "0.582498", "0.58215237", ...
0.6343704
1
Executes a forward pass through all the rotors from right to left Returns the encrypted letter as an integer
def _forward(self, letter): self._turn_rotors() l = letter for i in range(-1, -self.n_rotors - 1, -1): l = self._rotor_right2left(self.rotors[i], l, self.offsets[i], self.rings[i]) return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encryptionRotate(text):\n s = text\n transformedChar = \"\"\n transformedChar = s[-1] + s[:-1]\n\n print(\"Single Rotation Encrypted text : \" )\n return transformedChar", "def rotate_letter(c, num):\n return chr(((ord(c) - 97) + num) % 26 + 97)", "def incrementRotor(self):\n self....
[ "0.66399425", "0.6564686", "0.65551734", "0.6526592", "0.6486069", "0.6390609", "0.63876545", "0.63511467", "0.63508856", "0.6246106", "0.6229571", "0.618497", "0.61506116", "0.6106474", "0.6098463", "0.60835016", "0.60799736", "0.6076406", "0.60617894", "0.60591775", "0.6045...
0.6679923
0
Given the letter returned by the reflector, executes a backward pass, cyphering the input letter in all rotors from left to right Returns the output letter as an integer
def _backwards(self, letter): l = letter for i in range(self.n_rotors): l = self._rotor_left2right(self.rotors[i], l, self.offsets[i], self.rings[i]) return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _forward(self, letter):\n\t\tself._turn_rotors()\n\t\tl = letter\n\t\tfor i in range(-1, -self.n_rotors - 1, -1):\n\t\t\tl = self._rotor_right2left(self.rotors[i], l, self.offsets[i],\n\t\t\t\t\t\t\t\t\tself.rings[i])\n\t\treturn l", "def cipherFromReflector(self, char):\n inputCharNum = self.GetNumBy...
[ "0.6735222", "0.6486761", "0.6389943", "0.6337723", "0.6333011", "0.6282108", "0.6205114", "0.61938417", "0.6165998", "0.61477476", "0.6132617", "0.6115616", "0.6112447", "0.60500765", "0.60370743", "0.60039794", "0.5961587", "0.59385735", "0.5931577", "0.5929782", "0.5909112...
0.66574705
1
Decrypts text. The configuration should be the same as the initial configuration used by the machine for encryption. Use the reset method to reset the offsets if necessary.
def decrypt(self, text): if self.offsets != self.start_off: raise Exception("Current offset != starting offset. Use the reset"+\ " method before decrypting.") return self.encrypt(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(text, offset):\r\n return format_text(text, -offset)", "def decrypt(self, text):\n return self.encrypt(text)", "def decrypt(text,key):\r\n aes = pyaes.AESModeOfOperationCTR(key)\r\n decrypted = aes.decrypt(text)\r\n return decrypted", "def decrypt(text, ...
[ "0.7697106", "0.7482718", "0.7030502", "0.6725311", "0.66860723", "0.6614009", "0.65919447", "0.6583637", "0.65643156", "0.65093535", "0.64935434", "0.6470546", "0.6464969", "0.64432144", "0.6407435", "0.64009774", "0.63371176", "0.6336156", "0.63166344", "0.63100886", "0.625...
0.8522153
0
FindFile(file) Attempts to locate file in any of the mods folders. If file is a full path, it will attempt to use the GetFile() function to split the folder and file from the full path. Returns a tuple of (folder, file) in either case. If the file is not a full path and can't be found, it will raise FileNotFoundError, ...
def FindFile(seeker): for folder in var.MOD_LOCATION: for file in os.listdir(folder): if file.lower() == seeker.lower(): if not folder.endswith(("/", "\\")): folder = folder + "\\" return folder, file if True in [slash in seeker for slash...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursively_find_file(folder, file_name):\n # TODO: print a hint when not founding file_name", "def checkFilePath(self, filename, searchpath=[]):\n\t\tif filename is None:\n\t\t\treturn None\n\t\telif os.path.isfile(filename):\n\t\t\treturn filename\n\t\telse:\n\t\t\t# Append current dir to searchpath and...
[ "0.63258296", "0.61334497", "0.5949965", "0.5717448", "0.57132846", "0.56921214", "0.56921214", "0.5606734", "0.55925655", "0.5592373", "0.5583398", "0.5573338", "0.5568939", "0.55592126", "0.5536514", "0.55215186", "0.5459383", "0.5438104", "0.53975683", "0.53717285", "0.536...
0.7348206
0
ExecuteFile(file, params) Runs an executable file located in (one of) the Mods location. Returns the process' return code.
def ExecuteFile(*args): # the docstring lies about parameters folder, file = FindFile(args[0]) params = args[1:] log.logger("PARS_EXEC_FILE", format=[file, folder[:-1], params], display=False) process = subprocess.Popen([folder + file] + list(params)) process.communicate() return process.retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_file(file_path, globals_, script_dir=SCRIPT_DIR):\n fix_sys_path()\n script_name = os.path.basename(file_path)\n script_name = SCRIPT_EXCEPTIONS.get(script_name, script_name)\n script_path = os.path.join(script_dir, script_name)\n print script_path\n execfile(script_path, globals_)", "def run_execu...
[ "0.698795", "0.69709724", "0.6680755", "0.6648183", "0.6581526", "0.64158064", "0.6392396", "0.62397593", "0.6199557", "0.60507655", "0.601007", "0.5984262", "0.5943254", "0.5921672", "0.59054035", "0.58133644", "0.5799649", "0.57672405", "0.5734077", "0.5714152", "0.5699595"...
0.7974937
0
GetFile(file) Splits the folder and file from a full path. Returns a tuple of (folder, file).
def GetFile(file): file = file.replace("/", "\\").strip("\\") new = list(file) new.reverse() if "\\" not in new: return None, file # Don't raise an error, but there isn't any folder indx = new.index("\\") return file[:-indx], file[-indx:] # Full path and file name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file_path(file_path):\n\n file_name = os.path.basename(file_path)\n\n cutoff = len(file_path) - len(file_name)\n\n folder_path = file_path[:cutoff]\n\n return folder_path, file_name", "def parse_file_path(file_path):\n\n file_name = os.path.basename(file_path)\n\n cutoff = len(file_pa...
[ "0.6762138", "0.6762138", "0.60875225", "0.60354054", "0.6009469", "0.59130657", "0.5769223", "0.56438655", "0.56382656", "0.56349343", "0.5631418", "0.56203586", "0.5578579", "0.5524074", "0.55204046", "0.5500459", "0.5481047", "0.5479951", "0.546729", "0.5453095", "0.544330...
0.7454542
0
ExtractFile(file, dst=None, pw=None) Extracts an archive into the temp folder. Specify a file, a destination and a password. If 'file' is not an archive, it will simply copy it over. If 'dst' is not specified, it will use the file's name. Returns the location of the resulting files.
def ExtractFile(file, dst=None, pw=None): path, file = FindFile(file) if file.endswith(".rar"): type = "rar" elif file.endswith((".zip", ".7z")): type = "zip" else: type = None if dst is None: dst = file if not dst.endswith(("/", "\\")): dst = dst + "\\...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extractfile(file, passwd):\n try:\n zipf = zipfile.ZipFile(file)\n zipf.extractall(path=os.path.join(file[:-4]), pwd=str.encode(passwd))\n print('Password: {}'.format(passwd))\n except:\n pass", "def ExtractFile(self, dest_dir):\n self.__get_packed_xwalk_app_template(dest...
[ "0.65115666", "0.5753972", "0.56500095", "0.5603992", "0.5527236", "0.5507701", "0.5500255", "0.54809153", "0.5445222", "0.53783196", "0.53759146", "0.5262364", "0.5165045", "0.51642126", "0.51533556", "0.5140736", "0.5131286", "0.5126001", "0.508101", "0.5036791", "0.5029284...
0.773322
0
ExtractMod(mod, dst=None, pw=None, range=None, overwrite=True) Checks for a mod's existence and installs it if it exists. 'dst' will be the final location. Defaults to the temp folder if unspecified. 'pw' will be fed as the password to the ExtractFile function. 'range' will be the range for which to check files; it's a...
def ExtractMod(mod, dst=None, pw=None, range=None, overwrite=True): file = getattr(fl, mod) if dst is None: dst = var.BOOTLEG_TEMP + mod try: if range is None: FindFile(file) else: # explicit override of the range function - yay __builtins__ :D for num in __...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExtractFile(file, dst=None, pw=None):\n\n path, file = FindFile(file)\n\n if file.endswith(\".rar\"):\n type = \"rar\"\n elif file.endswith((\".zip\", \".7z\")):\n type = \"zip\"\n else:\n type = None\n\n if dst is None:\n dst = file\n if not dst.endswith((\"/\", \...
[ "0.5237817", "0.5110865", "0.47217962", "0.47020456", "0.46294928", "0.45337695", "0.44764635", "0.44509658", "0.44130152", "0.43863454", "0.43481404", "0.4293722", "0.42685872", "0.42552644", "0.4250608", "0.423482", "0.42136598", "0.42102575", "0.42053008", "0.41918778", "0...
0.8552399
0
ExtractFolder(path) Extracts all the archives from a folder into that same folder. Returns a tuple of all the resulting folders' names.
def ExtractFolder(path): if not path.endswith(("/", "\\")): path = path + "\\" folders = [] files = [] for file in os.listdir(path): files.append(path + file) _file, ext = GetName(file) folder = ExtractFile(path + file) CopyFolder(folder, path + _file) fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_archive(path: str, extracted_dir_path: str) -> str:\n logging.info('extracting %s to %s', path, extracted_dir_path)\n with tarfile.open(path) as tar:\n tar.extractall(path=extracted_dir_path)\n extracted_items = os.listdir(extracted_dir_path)\n if len(extracted_items) != 1:\n ...
[ "0.6846293", "0.6732933", "0.61467665", "0.60470045", "0.60425836", "0.5991757", "0.5988355", "0.5841082", "0.5742796", "0.5741708", "0.56827486", "0.5606064", "0.5600333", "0.5590889", "0.55497", "0.5535603", "0.5427062", "0.53971833", "0.5387293", "0.531985", "0.5301058", ...
0.78496677
0
ExtractLGP(file, dir=None) Extracts the contents of a LGP archive in a folder. Returns the resulting directory.
def ExtractLGP(file, dir=None): if dir is None: p, f = GetFile(file) dir = var.BOOTLEG_TEMP + f subprocess.Popen([var.ULGP_LOCATION, "-x", file, "-C", dir]) return dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RepackLGP(dir, file=None):\n\n if file is None:\n p, f = GetFile(dir)\n if f.endswith((\"/\", \"\\\\\")):\n f = f[:-1]\n file = var.BOOTLEG_TEMP + f + \".lgp\"\n subprocess.Popen([var.ULGP_LOCATION, \"-c\", file, \"-C\", dir])\n return file", "def download_extract(nam...
[ "0.6670236", "0.5393562", "0.5357665", "0.5296923", "0.5217785", "0.5009716", "0.49887457", "0.48910058", "0.48338923", "0.47894818", "0.47348577", "0.46446905", "0.4632599", "0.46304503", "0.4612503", "0.4566002", "0.45542613", "0.4552373", "0.45423222", "0.4542051", "0.4519...
0.7894865
0
RepackLGP(dir, file=None) Packs the contents of a folder into a LGP archive. Returns the resulting file.
def RepackLGP(dir, file=None): if file is None: p, f = GetFile(dir) if f.endswith(("/", "\\")): f = f[:-1] file = var.BOOTLEG_TEMP + f + ".lgp" subprocess.Popen([var.ULGP_LOCATION, "-c", file, "-C", dir]) return file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExtractLGP(file, dir=None):\n\n if dir is None:\n p, f = GetFile(file)\n dir = var.BOOTLEG_TEMP + f\n subprocess.Popen([var.ULGP_LOCATION, \"-x\", file, \"-C\", dir])\n return dir", "def pack(file_path, extension):\n package_dir = file_path.split('.')[0] + '.' + extension\n print...
[ "0.59195614", "0.5775735", "0.5496996", "0.5278678", "0.51489365", "0.5020867", "0.49108347", "0.49014816", "0.48940563", "0.48889828", "0.4886973", "0.48255393", "0.48208666", "0.48069724", "0.47919792", "0.46869788", "0.46493793", "0.4645264", "0.464379", "0.46393862", "0.4...
0.7751973
0
LaunchFile(file, params) Runs a raw executable file. The parameters are to feed to the process. Can be multiple parameters. Returns the process' return code.
def LaunchFile(*params): file = subprocess.Popen(params) file.communicate() return file.returncode
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExecuteFile(*args): # the docstring lies about parameters\n\n folder, file = FindFile(args[0])\n params = args[1:]\n\n log.logger(\"PARS_EXEC_FILE\", format=[file, folder[:-1], params], display=False)\n process = subprocess.Popen([folder + file] + list(params))\n process.communicate()\n retur...
[ "0.7223708", "0.68104553", "0.633585", "0.6269134", "0.6211025", "0.6098034", "0.60761744", "0.5994176", "0.5913522", "0.5878413", "0.5876325", "0.5871793", "0.567408", "0.566498", "0.5593275", "0.557758", "0.5562519", "0.5535439", "0.5529694", "0.5520267", "0.5504367", "0....
0.81206
0
CopyFolder(src, dst, overwrite=True) Copies the content of 'src' into 'dst'. The destination may or may not exist. The 'overwrite' parameter will tell the function whether to overwrite files. This supports nested folders. Always returns 0.
def CopyFolder(src, dst, overwrite=True): if not src.endswith(("/", "\\")): src = src + "\\" if not dst.endswith(("/", "\\")): dst = dst + "\\" os.makedirs(dst, exist_ok=True) for file in os.listdir(src): if not overwrite and os.path.isfile(dst + file): continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_folder(src: str, dest: str) -> None:\n\tuux.show_info(\"Copying folder \" + src + \" => \" + dest)\n\n\tif not os.path.exists(src):\n\t\tuux.show_error(\"Unable to copy, '\" + src + \"' does not exist.\")\n\t\treturn\n\n\tmkdir(dest)\n\n\tfor fn in os.listdir(src):\n\t\tif os.path.isfile(src + fn):\n\t\t\...
[ "0.75916386", "0.6912031", "0.6744624", "0.6506837", "0.64595366", "0.64063305", "0.62938625", "0.6196626", "0.6196626", "0.61707675", "0.6094042", "0.6064407", "0.60359025", "0.6029565", "0.6015132", "0.60149294", "0.5964577", "0.59552974", "0.59481025", "0.5929881", "0.5926...
0.80914754
0
CopyFile(path, file, new) Creates of copy of 'file' with name 'new' in 'path'. Always returns 0.
def CopyFile(path, file, new): if not path.endswith(("/", "\\")): path = path + "\\" shutil.copy(path + file, path + new) return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_file(file_name, new_file_name):\n\n import os\n\n if not os.path.exists(file_name):\n raise FileNotFoundError\n\n with open(str(file_name), 'rb') as infile:\n with open(str(new_file_name), 'wb') as outfile:\n while True:\n buff =...
[ "0.7342367", "0.7062944", "0.6988448", "0.6937015", "0.6923848", "0.686875", "0.67582273", "0.6685474", "0.66165555", "0.6615056", "0.6586806", "0.65143555", "0.6512323", "0.646609", "0.6458299", "0.6458299", "0.6458299", "0.64416116", "0.64161277", "0.6405297", "0.6394165", ...
0.82788193
0
DeleteFile(path) Deletes all files and folders given. Always returns 0.
def DeleteFile(*path): for line in path: if os.path.isdir(line): shutil.rmtree(line) if os.path.isfile(line): os.remove(line) return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_file(path):\n return files.delete_file(path)", "def file_delete(self, path):\n params = {'root': self.session.root, 'path': format_path(path)}\n\n url, params, headers = self.request(\"/fileops/delete\", params)\n\n return self.rest_client.POST(url, params, headers)", "def de...
[ "0.7869286", "0.76546806", "0.7388755", "0.72415155", "0.72076136", "0.72005427", "0.7192144", "0.7170887", "0.7170887", "0.7164125", "0.70655143", "0.69983995", "0.6865429", "0.68378466", "0.67944336", "0.6735856", "0.6728706", "0.67129046", "0.67129046", "0.67070305", "0.66...
0.80297625
0
RenameFile(path, org, new) Renames item x of 'org' to item x of 'new' in path. Returns 0 if all items could be renamed. Returns more than 0 if there were more items in 'org' than 'new' Returns less than 0 if there were more items in 'new' than 'org'
def RenameFile(path, org, new): cont = zip(org, new) if not path.endswith(("/", "\\")): path = path + "\\" for file in cont: if os.path.isfile(path + file[0]): os.rename(path + file[0], path + file[1]) return len(org) - len(new)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename(self,oldItem,newItem):\r\n raise AbstractError\r\n return False", "def rename(old, new):", "def rename(old, new):", "def projectFileRenamed(self, oldfn, newfn):\n editor = self.getOpenEditor(oldfn)\n if editor:\n editor.fileRenamed(newfn)", "def rename(oldn...
[ "0.6143776", "0.60080373", "0.60080373", "0.58179", "0.57596266", "0.5529786", "0.5525997", "0.55170435", "0.5496105", "0.5486858", "0.546561", "0.5431416", "0.54079854", "0.5389883", "0.53634936", "0.53631765", "0.52538437", "0.52488685", "0.52396923", "0.52350086", "0.52344...
0.80195767
0
AttribFile(file, attr="R S H I", params) Sets Windows file and folders attributes. Default attribute change is to remove all unwanted attributes. Parameters are optional, it's mainly to touch folders as well. Returns 0 if it completed successfully.
def AttribFile(file, attr="-R -S -H -I", *params): params = " ".join(params).split() # handle tuples and multispaced items if isinstance(attr, (tuple, list, set)): attr = " ".join(attr) lines = attr.split() + [file] + params attrib = subprocess.Popen(["C:\\Windows\\System32\\attrib.exe"] + line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetAttributes(self, attr):\r\n \r\n if self._ownsAttr:\r\n del self._attr\r\n \r\n self._attr = attr\r\n self._ownsAttr = False", "def set_file_attr(self):\n if self.resolution == 1000:\n satellite_type = ['AQUA', 'TERRA']\n if self...
[ "0.5261392", "0.49339035", "0.4924765", "0.4917284", "0.49015188", "0.48957682", "0.48640934", "0.48483077", "0.46952525", "0.46852258", "0.4674856", "0.4672482", "0.4654802", "0.46223906", "0.46107024", "0.46076995", "0.45837176", "0.45700586", "0.45637625", "0.45579827", "0...
0.7758203
0
StripAttribute(path) Removes all unwanted attributes from files in path.
def StripAttributes(path): if not path.endswith(("/", "\\")): path += "\\" folders = [path] allf = [] while folders: folder = folders.pop(0) allf.append(folder) for lister in os.listdir(folder): if os.path.isdir(folder + lister): folders.appen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_attributes(cube, field, filename):\n cube.attributes = None", "def strip_attributes(arff_file):\r\n start = arff_file.find('% filename')\r\n new_arff = arff_file[start:]\r\n return new_arff", "def remove_attributes(self, remove_attrs):\n remove = []\n for attr in self.data:...
[ "0.63845766", "0.6220756", "0.6163511", "0.6163511", "0.6080287", "0.5801426", "0.5746101", "0.57427835", "0.57427835", "0.57427835", "0.5729805", "0.5704866", "0.5638217", "0.5624947", "0.5587875", "0.5585241", "0.5573176", "0.55374366", "0.5532499", "0.5501856", "0.5465265"...
0.6896639
0
StripFolder(path) Brings all files within all subfolders to the root ('path'). Deletes all subfolders of the main path. Returns a tuple of all the subfolders that were copied over.
def StripFolder(path): if not path.endswith(("/", "\\")): path = path + "\\" folders = [path] allf = [] while folders: folder = folders.pop(0) allf.append(folder) for lister in os.listdir(folder): if os.path.isdir(folder + lister): folders.app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExtractFolder(path):\n\n if not path.endswith((\"/\", \"\\\\\")):\n path = path + \"\\\\\"\n folders = []\n files = []\n for file in os.listdir(path):\n files.append(path + file)\n _file, ext = GetName(file)\n folder = ExtractFile(path + file)\n CopyFolder(folder,...
[ "0.7029333", "0.60177916", "0.59128374", "0.5911949", "0.5794489", "0.57633936", "0.57363594", "0.57268214", "0.5675963", "0.56686217", "0.5616837", "0.55706525", "0.5567647", "0.5564295", "0.5555438", "0.55062664", "0.5492872", "0.5459668", "0.5448241", "0.54460824", "0.5433...
0.8126114
0
CallSkipMod(mod) Prints a missing mod warning using 'mod' as the missing file. Always returns 0.
def CallSkipMod(mod): if len(var.MOD_LOCATION) == 1: iner = "ONE_IN" else: iner = "MULT_IN_ONE" file = getattr(fl, mod) if "{0}" in file: file = file.format(1) # make sure it does say *something* log.logger("PARS_SKIP", format=[mod, file, iner, "', '".join(var.MOD_LOCATION)]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shall_skip(module):\n # skip it, if there is nothing (or just \\n or \\r\\n) in the file\n return path.getsize(module) < 3", "def skipped (func):\n try:\n from nose.plugins.skip import SkipTest\n\n def skipme (*a, **k):\n raise SkipTest()\n\n skipme.__name__ = func.__...
[ "0.5755264", "0.56256", "0.5601252", "0.5555863", "0.5437181", "0.5423412", "0.5353894", "0.5249999", "0.5243704", "0.52432823", "0.5241218", "0.5223273", "0.5221188", "0.5192148", "0.51250154", "0.5081649", "0.5074118", "0.50586987", "0.50229686", "0.5008486", "0.50062305", ...
0.8526851
0
ARN of an App Runner automatic scaling configuration resource that you want to associate with your service. If not provided, App Runner associates the latest revision of a default auto scaling configuration.
def auto_scaling_configuration_arn(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "auto_scaling_configuration_arn")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_scaling_configuration_arn(self) -> Optional[str]:\n return pulumi.get(self, \"auto_scaling_configuration_arn\")", "def auto_scaling_configuration_arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"auto_scaling_configuration_arn\")", "def autoscaling(self) -> Optional[pulumi.Inp...
[ "0.7602388", "0.73555046", "0.6526771", "0.6416983", "0.6149178", "0.6127391", "0.5787056", "0.55833757", "0.55405587", "0.5494746", "0.54689515", "0.5468072", "0.5468072", "0.5468072", "0.5468072", "0.5468072", "0.5468072", "0.5468072", "0.54050505", "0.5402634", "0.53579885...
0.7562741
1
Settings of the health check that AWS App Runner performs to monitor the health of your service. See Health Check Configuration below for more details.
def health_check_configuration(self) -> Optional[pulumi.Input['ServiceHealthCheckConfigurationArgs']]: return pulumi.get(self, "health_check_configuration")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def health_check_configuration(self) -> pulumi.Output['outputs.ServiceHealthCheckConfiguration']:\n return pulumi.get(self, \"health_check_configuration\")", "def healthcheck(parameters): \n\n print(\"In healthcheck module\")", "def health_check():\n app.logger.info(\"Health Check!\")\n return ...
[ "0.68419075", "0.6347665", "0.62836397", "0.61189044", "0.6003582", "0.58736956", "0.5865395", "0.5828682", "0.58054304", "0.58054304", "0.5802205", "0.57770216", "0.5776012", "0.5757377", "0.57560873", "0.57560873", "0.5734575", "0.57197356", "0.5709717", "0.5709717", "0.570...
0.67506576
1
Configuration settings related to network traffic of the web application that the App Runner service runs. See Network Configuration below for more details.
def network_configuration(self) -> Optional[pulumi.Input['ServiceNetworkConfigurationArgs']]: return pulumi.get(self, "network_configuration")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def network_settings(self): # type: () -> t.Dict[str, t.Any]\n return self.inspection['NetworkSettings']", "def network_configuration(self) -> pulumi.Output['outputs.ServiceNetworkConfiguration']:\n return pulumi.get(self, \"network_configuration\")", "def network_config(self) -> 'outputs.Networ...
[ "0.6015695", "0.59456706", "0.5870308", "0.5870308", "0.5752671", "0.5752671", "0.56932443", "0.5645092", "0.5629313", "0.5614321", "0.5545634", "0.55261374", "0.5504293", "0.5500942", "0.54950154", "0.54877526", "0.54553556", "0.5371222", "0.5335917", "0.5307572", "0.5297308...
0.6002301
1
The observability configuration of your service. See Observability Configuration below for more details.
def observability_configuration(self) -> Optional[pulumi.Input['ServiceObservabilityConfigurationArgs']]: return pulumi.get(self, "observability_configuration")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observability_configuration(self) -> pulumi.Output[Optional['outputs.ServiceObservabilityConfiguration']]:\n return pulumi.get(self, \"observability_configuration\")", "def fleetobservability(self) -> Optional['outputs.FeatureSpecFleetobservability']:\n return pulumi.get(self, \"fleetobservabil...
[ "0.7956246", "0.56444937", "0.531778", "0.52681047", "0.52177036", "0.51991004", "0.5184514", "0.51248384", "0.51248384", "0.51227665", "0.51139295", "0.5072489", "0.5047751", "0.49704665", "0.49501875", "0.4946865", "0.4931813", "0.49101347", "0.48935717", "0.48596627", "0.4...
0.81733936
0
The runtime configuration of instances (scaling units) of the App Runner service. See Instance Configuration below for more details.
def instance_configuration(self) -> Optional[pulumi.Input['ServiceInstanceConfigurationArgs']]: return pulumi.get(self, "instance_configuration")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_scaling(self):\n return self.container['auto_scaling']", "def instance_configuration(self) -> pulumi.Output['outputs.ServiceInstanceConfiguration']:\n return pulumi.get(self, \"instance_configuration\")", "def runtime_config(self) -> str:\n return self._node[\"app_data\"].get(\"ru...
[ "0.6600584", "0.6487364", "0.64526594", "0.6082388", "0.583839", "0.5779044", "0.57518584", "0.5666383", "0.5536144", "0.5521754", "0.5508416", "0.54588073", "0.54588073", "0.5430509", "0.5426012", "0.5424304", "0.54210854", "0.53770417", "0.53453577", "0.5336255", "0.5292929...
0.65064335
1
The observability configuration of your service. See Observability Configuration below for more details.
def observability_configuration(self) -> Optional[pulumi.Input['ServiceObservabilityConfigurationArgs']]: return pulumi.get(self, "observability_configuration")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observability_configuration(self) -> pulumi.Output[Optional['outputs.ServiceObservabilityConfiguration']]:\n return pulumi.get(self, \"observability_configuration\")", "def fleetobservability(self) -> Optional['outputs.FeatureSpecFleetobservability']:\n return pulumi.get(self, \"fleetobservabil...
[ "0.79563946", "0.56439465", "0.53201985", "0.5269377", "0.521966", "0.52014226", "0.518629", "0.5127047", "0.5127047", "0.5122262", "0.5114975", "0.5073362", "0.5050198", "0.49730882", "0.49526307", "0.49493897", "0.4934082", "0.49124867", "0.48943686", "0.4861345", "0.484888...
0.8173864
1
Get an existing Service resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None, arn: Optional[pulumi.Input[str]] = None, auto_scaling_configuration_arn: Optional[pulumi.Input[str]] = None, encryption_configuration: Optional[pulumi.Input[pulum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None) -> 'Service':\n opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))\n\n __props__ = ServiceArgs.__new__(ServiceArgs)\n\n __props__.__dict__[\"correla...
[ "0.6462436", "0.6262246", "0.5981988", "0.5969614", "0.5956969", "0.59401536", "0.5937153", "0.59308213", "0.59026575", "0.5882669", "0.5830883", "0.58301145", "0.5791222", "0.57855755", "0.57324743", "0.5667298", "0.56250405", "0.5620358", "0.559672", "0.5583968", "0.5560769...
0.70002896
0
Settings of the health check that AWS App Runner performs to monitor the health of your service. See Health Check Configuration below for more details.
def health_check_configuration(self) -> pulumi.Output['outputs.ServiceHealthCheckConfiguration']: return pulumi.get(self, "health_check_configuration")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def health_check_configuration(self) -> Optional[pulumi.Input['ServiceHealthCheckConfigurationArgs']]:\n return pulumi.get(self, \"health_check_configuration\")", "def health_check_configuration(self) -> Optional[pulumi.Input['ServiceHealthCheckConfigurationArgs']]:\n return pulumi.get(self, \"heal...
[ "0.67506087", "0.67506087", "0.6347388", "0.6283836", "0.61198914", "0.6003206", "0.5874187", "0.5865065", "0.5828394", "0.58038205", "0.58038205", "0.58012503", "0.57780075", "0.5776028", "0.57574344", "0.5757239", "0.5757239", "0.5735045", "0.57179314", "0.57096285", "0.570...
0.6842051
0
Subdomain URL that App Runner generated for this service. You can use this URL to access your service web application.
def service_url(self) -> pulumi.Output[str]: return pulumi.get(self, "service_url")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_url(self):\n return \"http://{0}:{1}/app\".format(self.host, self.port)", "def public_rest_url(path_url: str, domain: str = CONSTANTS.DEFAULT_DOMAIN) -> str:\n return CONSTANTS.FTX_BASE_URL + path_url", "def get_service_url():\n return get_config_handler().get_service_url()", "def app_u...
[ "0.6826508", "0.6681023", "0.6672236", "0.6605209", "0.6551995", "0.65030795", "0.6468015", "0.64567655", "0.6423532", "0.63967156", "0.6384149", "0.63212645", "0.6273218", "0.6251125", "0.6244899", "0.6244899", "0.6230171", "0.62126696", "0.6212174", "0.62013507", "0.6196434...
0.68187
1
Given a model name, returns a pytorch transformers model in eval mode.
def load_torchtransformers(model_name): # There are two versions of huggingface, support both try: import pytorch_transformers except ModuleNotFoundError: import transformers as pytorch_transformers if model_name == "bert": tokenizer = pytorch_transformers.BertTokenizer.from_pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model(name, disable_logging=False):\n return PluginLoader._import(\"train.model\", name, disable_logging)", "def load_simple_transformer(model_name):\n model = torch.nn.Transformer(nhead=2, num_encoder_layers=1, num_decoder_layers=1)\n model = model.eval()\n src = torch.rand((10, 32, 512)...
[ "0.697611", "0.6974655", "0.6780623", "0.6676455", "0.65731716", "0.6506318", "0.6412367", "0.6401762", "0.6367586", "0.6244505", "0.6217965", "0.619761", "0.6148934", "0.61453503", "0.61379516", "0.6132714", "0.6060599", "0.6044852", "0.59870446", "0.59724617", "0.5971283", ...
0.73867327
0
Load DeepSpeech LSTM model from GitHub repo. Unfortunately TVM does not currently support LSTM operators in the PyTorch frontend. This is also the case for most other frontends.
def load_deepspeech(model_name): # For reference: # from deepspeech_pytorch.model import DeepSpeech # from torch.utils.model_zoo import load_url # import torch.onnx # pretrained_url = 'https://github.com/SeanNaren/deepspeech.pytorch/releases/download/v2.0/an4_pretrained_v2.pth' # params = load...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_fn(model_dir):\n print(\"Loading model.\")\n\n # First, load the parameters used to create the model.\n model_info = {}\n model_info_path = os.path.join(model_dir, 'model_info.pth')\n with open(model_info_path, 'rb') as f:\n model_info = torch.load(f)\n\n print(\"model_info: {}\"...
[ "0.6424617", "0.63462615", "0.62104595", "0.615085", "0.61280006", "0.61014485", "0.5989856", "0.59578437", "0.5916136", "0.5891427", "0.5865856", "0.58404297", "0.5829503", "0.57395333", "0.5738998", "0.57333404", "0.5731952", "0.5727657", "0.5726606", "0.5726429", "0.570725...
0.6610076
0
A simple transformer from pytorch.
def load_simple_transformer(model_name): model = torch.nn.Transformer(nhead=2, num_encoder_layers=1, num_decoder_layers=1) model = model.eval() src = torch.rand((10, 32, 512)) tgt = torch.rand((20, 32, 512)) return model, [src, tgt]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n input_dim,\n dec_seq_len,\n out_seq_len,\n d_model=512,\n nhead=8,\n num_encoder_layers=6,\n num_decoder_layers=6,\n dim_feedforward=2048,\n dropout=0...
[ "0.6855274", "0.658197", "0.6179455", "0.6175562", "0.6171663", "0.61527574", "0.6151067", "0.6151067", "0.6151067", "0.6151067", "0.6151067", "0.6151067", "0.6151067", "0.61124516", "0.61082864", "0.61082345", "0.60755324", "0.6045084", "0.60307", "0.6029154", "0.60272676", ...
0.7178562
0
Get a PyTorch model by type and name. Returns PyTorch trace and input shape dict.
def get_model(model_name, type): MODEL_MAP = {"torchvision": (["*"], load_torchvision), "torchtransformers": (["bert", "transformer_xl"], load_torchtransformers), "github": (["deepspeech"], load_deepspeech), "custom": (["simple_transfor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model(name, disable_logging=False):\n return PluginLoader._import(\"train.model\", name, disable_logging)", "def get_model(\n model_type: str,\n model_name: str = None,\n num_classes: t.Optional[int] = 1000,\n input_shape: t.Optional[t.Tuple] = (3, 224, 224),\n model: t.Optional[Mod...
[ "0.6649939", "0.6573367", "0.6460272", "0.6365849", "0.6321241", "0.62554383", "0.6205857", "0.609324", "0.60782516", "0.60180837", "0.6016271", "0.60053897", "0.60016245", "0.5934384", "0.58993465", "0.587728", "0.5876873", "0.5870805", "0.58685386", "0.5868329", "0.5839506"...
0.8065929
0
Function for fetching and manipulating picons
def piconget(pid, mnpicon, picndir, piconslug, hxclr1, hxclr2, mangle=None, colrful=False, brite=False): if direxists(picndir): urlbase = "http://images.pluto.tv/channels/" if mnpicon: urlend = 'solidLogoPNG.png' else: urlend = 'colorLogoPNG.png' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _icons(self):", "def icon(self):", "def om_icons(self):\n icons = ({'path': 'misc_/DataTemplates/ic-xml.gif',\n 'alt': self.meta_type, 'title': self.meta_type},)\n if not self._v_cooked:\n self._cook()\n if self._v_errors:\n icons = icons + ({'pat...
[ "0.70672655", "0.65587485", "0.62278324", "0.6146548", "0.613125", "0.61307836", "0.6071784", "0.60547864", "0.59524333", "0.59221816", "0.59087664", "0.5892237", "0.5814968", "0.5772996", "0.5772996", "0.5770113", "0.57606995", "0.5742103", "0.57360274", "0.57078516", "0.570...
0.68753237
1
A generic base class for electrical units. The class contains attributes to store the magnitude of the key and also contain the respective frequency associated with the electrical characteristic. Where series of frequency values are required it is expected that these will be achieved by using a list containing objects ...
def __init__(self, frequency: int = None, freq_unit: str = None, **kwargs): self._freq: int = freq self._freq_unit: str = freq_unit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, value, key_length=1):\r\n super().__init__(self.key, value)\r\n self.key_length = key_length\r\n self.items = OrderedDict()\r\n self.parse()\r\n\r\n self._PlatformTailNumber = None\r\n self._PlatformHeadingAngle = None\r\n self._ImageSourceSensor ...
[ "0.55618083", "0.54142815", "0.53817075", "0.53536946", "0.53438824", "0.52844536", "0.51879114", "0.51562005", "0.5135914", "0.5134475", "0.51331466", "0.5132032", "0.5116857", "0.51153636", "0.50826174", "0.50541294", "0.50439155", "0.5021056", "0.50179166", "0.50034547", "...
0.5463841
1
There are two modes. 1. Add a int/float to an Volt() object. Return a new Volt() object with '.volts' that is the sum of the 'self.volts' and the passed int/float. 2. Adding two Volt() objects together, returning a new Volt() object with '.volts' that is the sum of 'self.volts' and 'other.volts'.
def __add__(self, other): if isinstance(other, int) or isinstance(other, float): return Volt(self.volts + other, self.volt_unit, self.freq, self.freq_unit) if self.volt_unit != other.volt_unit: raise ArithmeticError(f"The objects' volt units {self.volt_unit} and {other.volt_unit}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other):\n if isinstance(other, int) or isinstance(other, float):\n return Amp(self.amps + other, self.amp_unit, self.freq, self.freq_unit)\n if self.amp_unit != other.amp_unit:\n raise ArithmeticError(f\"The objects' amp units {self.amp_unit} and {other.amp_uni...
[ "0.74142647", "0.72871935", "0.7271407", "0.7136929", "0.7131495", "0.70471036", "0.7003873", "0.6998109", "0.695118", "0.687143", "0.68235624", "0.6776829", "0.67384326", "0.67028344", "0.66680944", "0.6656349", "0.6656332", "0.6616977", "0.6614763", "0.6606953", "0.6599726"...
0.8909028
0
1. Subtract a insulation_code from an Volt() object. Return a new Volt() object with '.volts' that is the difference of the 'self.volts'and the passed int/float. 2. Subtract two Volt() objects, returning a new Volt() object with '.volts' that is the difference of 'self.volts' and 'other.volts'.
def __sub__(self, other): if isinstance(other, int) or isinstance(other, float): return Volt(self.volts - other, self.volt_unit, self.freq, self.freq_unit) if self.volt_unit != other.volt_unit: raise ArithmeticError(f"The objects' volt units {self.volt_unit} and {other.volt_unit}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __sub__(self, other):\n if isinstance(other, int) or isinstance(other, float):\n return Amp(self.amps - other, self.amp_unit, self.freq, self.freq_unit)\n if self.amp_unit != other.amp_unit:\n raise ArithmeticError(f\"The objects' amp units {self.amp_unit} and {other.amp_uni...
[ "0.6897913", "0.686807", "0.68031883", "0.67141724", "0.6677903", "0.6609048", "0.66008663", "0.6557345", "0.6422639", "0.6399935", "0.6376798", "0.6290664", "0.62754256", "0.62695223", "0.6264662", "0.6258906", "0.6256665", "0.6246081", "0.622621", "0.621305", "0.61873764", ...
0.7975307
0
Multiply a Volt() object. If multiplying by a int or float the self. Multiply two Volt() objects together, returning the product of the two objects.
def __mul__(self, other): if isinstance(other, int) or isinstance(other, float): return Volt(self.volts * other, self.volt_unit, self.freq, self.freq_unit) else: if self.volt_unit != other.volt_unit: raise ArithmeticError(f"The objects' volt units {self.volt_unit}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __mul__(self, other):\n # print other\n if type(other) == int or type(other) == float:\n return self.scale(other)\n elif type(other) == Vector:\n return self.dot(other)\n else:\n return NotImplemented", "def __mul__(self, other):\r\n return ...
[ "0.74306023", "0.7297101", "0.72146547", "0.71841425", "0.71742857", "0.7134762", "0.7093439", "0.70923084", "0.7059664", "0.6998358", "0.6965713", "0.69609094", "0.6956492", "0.69293594", "0.6906382", "0.6905946", "0.68920153", "0.6883814", "0.6873146", "0.68704355", "0.6852...
0.83590376
0
The volt attribute setter.
def volts(self, volt: NumType): self._volt = volt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_setVoltage(self):\n self.read(\":VOLT?\")", "def setvoltages(self):\n pass", "def set_volt(self,volt):\n self.spi_disable()\n self.spi_enable()\n data1=volt*256//self.vref\n if data1>255:\n data1=255\n if data1<0:\n data1=0\n ...
[ "0.64910316", "0.6318452", "0.6313791", "0.61006796", "0.60669094", "0.60529065", "0.60273206", "0.5980553", "0.59714717", "0.59714717", "0.5874598", "0.5865234", "0.5841621", "0.5784756", "0.5784631", "0.5780349", "0.57798725", "0.57798725", "0.57798725", "0.57736105", "0.57...
0.7285518
0
There are two modes. 1. Add an int/float to an Amps() object. Return a new Amp() object with '.amps' that is the sum of the 'self.amps' and the passed int/float. 2. Adding two Amp() objects together, returning a new Amp() object with '.amps' that is the sum of 'self.amps' and 'other.amps'.
def __add__(self, other): if isinstance(other, int) or isinstance(other, float): return Amp(self.amps + other, self.amp_unit, self.freq, self.freq_unit) if self.amp_unit != other.amp_unit: raise ArithmeticError(f"The objects' amp units {self.amp_unit} and {other.amp_unit} are not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __mul__(self, other):\n if isinstance(other, int) or isinstance(other, float):\n return Amp(self.amps * other, self.amp_unit, self.freq, self.freq_unit)\n if self.amp_unit != other.amp_unit:\n raise ArithmeticError(f\"The objects' amp units {self.amp_unit} and {other.amp_uni...
[ "0.7433785", "0.714936", "0.710161", "0.6762452", "0.67164207", "0.66605616", "0.66493183", "0.65010947", "0.6368861", "0.63628244", "0.6322242", "0.629921", "0.62943053", "0.6284239", "0.6264756", "0.62547755", "0.62463784", "0.6244722", "0.62421227", "0.61927456", "0.618531...
0.8724514
0
1. Subtract a int/float from an Amp() object. Return a new Amp() object with '.amps' that is the difference of the 'self.amps' and the passed int/float. 2. Subtract two Amp() objects, returning a new Amp() object with '.amps' that is the difference of 'self.amps' and 'other.amps'.
def __sub__(self, other): if isinstance(other, int) or isinstance(other, float): return Amp(self.amps - other, self.amp_unit, self.freq, self.freq_unit) if self.amp_unit != other.amp_unit: raise ArithmeticError(f"The objects' amp units {self.amp_unit} and {other.amp_unit} are not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __truediv__(self, other):\n if isinstance(other, int) or isinstance(other, float):\n return Amp(self.amps / other, self.amp_unit, self.freq, self.freq_unit)\n if self.amp_unit != other.amp_unit:\n raise ArithmeticError(f\"The objects' amp units {self.amp_unit} and {other.amp...
[ "0.68999416", "0.6833628", "0.676385", "0.66355044", "0.6598059", "0.6590933", "0.6540221", "0.6534598", "0.65079206", "0.64034814", "0.6343812", "0.63341063", "0.6326702", "0.63187754", "0.6307621", "0.6303723", "0.62694395", "0.624874", "0.6240412", "0.6204857", "0.62013614...
0.84507024
0
Multiply two Amp() objects together, returning the product of the two objects.
def __mul__(self, other): if isinstance(other, int) or isinstance(other, float): return Amp(self.amps * other, self.amp_unit, self.freq, self.freq_unit) if self.amp_unit != other.amp_unit: raise ArithmeticError(f"The objects' amp units {self.amp_unit} and {other.amp_unit} are not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __mul__(self, other):\r\n return self.prod(other)", "def mul(self, a: 'PFElement', b: 'PFElement') -> 'PFElement':\n return self(self._pf_mul(a.value, b.value, self.multiplicative_group))", "def mul(self, a, b):\n return a * b", "def __mul__(self, other, **kwargs):\n kwargs.up...
[ "0.7408632", "0.7406158", "0.7264367", "0.6947231", "0.6929308", "0.6916226", "0.6911664", "0.6869576", "0.6840827", "0.68196017", "0.6803583", "0.67914593", "0.6761148", "0.67590225", "0.6757337", "0.67506737", "0.6744073", "0.66633433", "0.66592115", "0.6612321", "0.6610977...
0.80016875
0
There are two modes. 1. Add a complex to an Ohms() object. Return a new Ohm() object with '.ohm' that is the sum of the 'self.ohm' and the passed complex(). 2. Adding two Ohm() objects together, returning a new Ohm() object with '.ohm' that is the sum of 'self.ohm' and 'other.ohm'.
def __add__(self, other): if isinstance(other, complex): return Ohm(self.ohm + other, self.ohm_unit, self.freq, self.freq_unit) if self.ohm_unit != other.ohm_unit: raise ArithmeticError(f"The objects' ohm units {self.ohm_unit} and {other.ohm_unit} are not the same.") if s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other):\n if isinstance(other, complex):\n return Power(self.power + other, self.power_unit, self.freq, self.freq_unit)\n if self.power_unit != other.power_unit:\n raise ArithmeticError(f\"The objects' ohm units {self.power_unit} and {other.power_unit} are not ...
[ "0.75681996", "0.74703264", "0.74501014", "0.7414552", "0.7378725", "0.7324489", "0.68723", "0.67236125", "0.6660199", "0.6646521", "0.6638953", "0.6621129", "0.65180033", "0.6511642", "0.6492798", "0.64850414", "0.64789504", "0.6464822", "0.64206195", "0.64200747", "0.641864...
0.89833313
0
There are two modes. 1. Subtract a complex to an Ohms() object. Return a new Ohm() object with '.ohm' that is the sum of the 'self.ohm' and the passed complex(). 2. Subtract two Ohm() objects, returning a new Ohm() object with '.ohm' that is the difference of 'self.ohm' and 'other.ohm'. a) The frequencies (including th...
def __sub__(self, other): if isinstance(other, complex): return Ohm(self.ohm - other, self.ohm_unit, self.freq, self.freq_unit) if self.ohm_unit != other.ohm_unit: raise ArithmeticError(f"The objects' ohm units {self.ohm_unit} and {other.ohm_unit} are not the same.") if s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __truediv__(self, other):\n if isinstance(other, int) or isinstance(other, float) or isinstance(other, complex):\n return Ohm(self.ohm / other, self.ohm_unit, self.freq, self.freq_unit)\n if self.ohm_unit != other.ohm_unit:\n raise ArithmeticError(f\"The objects' ohm units {...
[ "0.7698359", "0.76604456", "0.74490535", "0.733054", "0.68389434", "0.6429149", "0.6335388", "0.62942797", "0.6225056", "0.6210105", "0.6170732", "0.6101144", "0.6083943", "0.6012478", "0.60102427", "0.5950072", "0.5921162", "0.5875086", "0.581623", "0.58135456", "0.5800836",...
0.90131366
0
Multiply two Ohm() objects together, returning the product of the two objects.
def __mul__(self, other): if isinstance(other, int) or isinstance(other, float) or isinstance(other, complex): return Ohm(self.ohm * other, self.ohm_unit, self.freq, self.freq_unit) if self.ohm_unit != other.ohm_unit: raise ArithmeticError(f"The objects' ohm units {self.ohm_unit}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __mul__(self, y):\n sum = 0\n x = self\n if len(x) > len(y):\n x, y = y, x\n for key in x:\n if key not in y:\n continue\n sum += x[key] * y[key]\n return sum", "def __mul__(self, y):\n sum = 0\n x = self\n ...
[ "0.7158825", "0.7158825", "0.6799878", "0.67005163", "0.6686018", "0.66069025", "0.6605818", "0.6602995", "0.6474987", "0.6459986", "0.64501494", "0.64255404", "0.637624", "0.63341546", "0.6328572", "0.6253951", "0.62519056", "0.62491167", "0.6203832", "0.6196025", "0.6124351...
0.77959746
0
Return ohm as a resistance. This will not change the insulation_code of self._ohms.
def r(self) -> float: return self._ohms.real
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getResistence(self):\n return self.resistence", "def calculate_rh(self):\n # Check for existence of relative humidity and mixing ratio\n if self.data.get('Relative_Humidity') is None:\n if self.data.get('Mixing_Ratio') is None:\n raise KeyError('Calculate mixing...
[ "0.58289057", "0.5756095", "0.55540806", "0.5437796", "0.54163355", "0.53827655", "0.5373473", "0.5333576", "0.5330446", "0.5281449", "0.5253052", "0.5227909", "0.5227909", "0.5215746", "0.5182154", "0.5170751", "0.5131431", "0.5111294", "0.5100755", "0.5100755", "0.5049968",...
0.59486413
0
There are two modes. 1. Add a complex to a Power() object. Return a new Power() object with '.power' that is the sum of the 'self.Power' and the passed complex(). 2. Adding two Power() objects together, returning a new Power() object with '.power' that is the sum of 'self.power' and 'other.ohm'.
def __add__(self, other): if isinstance(other, complex): return Power(self.power + other, self.power_unit, self.freq, self.freq_unit) if self.power_unit != other.power_unit: raise ArithmeticError(f"The objects' ohm units {self.power_unit} and {other.power_unit} are not the same."...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other):\n if isinstance(other, complex):\n return Ohm(self.ohm + other, self.ohm_unit, self.freq, self.freq_unit)\n if self.ohm_unit != other.ohm_unit:\n raise ArithmeticError(f\"The objects' ohm units {self.ohm_unit} and {other.ohm_unit} are not the same.\")\n...
[ "0.8250026", "0.7914886", "0.785498", "0.7705226", "0.7285699", "0.7202161", "0.7138414", "0.7040537", "0.70316243", "0.7004599", "0.6935744", "0.6896497", "0.6888758", "0.6868086", "0.6868002", "0.6853717", "0.68070215", "0.6806516", "0.68060136", "0.6790358", "0.67831635", ...
0.90089023
0
There are two modes. 1. Subtract a complex to an Power() object. Return a new Power() object with '.power' that is the sum of the 'self.power' and the passed complex(). 2. Subtract two Power() objects, returning a new Power() object with '.ohm' that is the difference of 'self.power' and 'other.power'. a) The frequencie...
def __sub__(self, other): if isinstance(other, complex): return Power(self.power - other, self.power_unit, self.freq, self.freq_unit) if self.power_unit != other.power_unit: raise ArithmeticError(f"The objects' ohm units {self.power_unit} and {other.power_unit} are not the same."...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __sub__(self, other):\n if isinstance(other, complex):\n return Ohm(self.ohm - other, self.ohm_unit, self.freq, self.freq_unit)\n if self.ohm_unit != other.ohm_unit:\n raise ArithmeticError(f\"The objects' ohm units {self.ohm_unit} and {other.ohm_unit} are not the same.\")\n...
[ "0.7868433", "0.73533434", "0.73213", "0.7271727", "0.7052522", "0.6915829", "0.66105074", "0.65981007", "0.65697485", "0.64671576", "0.64670223", "0.6457807", "0.6430139", "0.6407553", "0.64031404", "0.63710004", "0.6362891", "0.6256372", "0.62556434", "0.62384874", "0.62046...
0.8721685
0
Multiply two Power() objects together, returning the product of the two objects.
def __mul__(self, other): if isinstance(other, int) or isinstance(other, float) or isinstance(other, complex): return Power(self.power * other, self.power_unit, self.freq, self.freq_unit) if self.power_unit != other.power_unit: raise ArithmeticError(f"The objects' power units {se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(self, x, y):\n return self( x.lift() * y.lift() )", "def __mul__(self, other):\r\n return self.prod(other)", "def mul_power(a,b):\r\n if (base(a)==base(b)):\r\n return make_power(base(a), power(a)+power(b))\r\n else:\r\n return calc_power(a)*calc_power(b)", "...
[ "0.77632946", "0.7752715", "0.7435338", "0.7435006", "0.72454077", "0.71805924", "0.7164024", "0.71510655", "0.7143583", "0.71129245", "0.7090096", "0.7073022", "0.7042423", "0.7029677", "0.7001191", "0.6972775", "0.6965795", "0.695625", "0.6954136", "0.6921609", "0.68991876"...
0.8015777
0
Compare the frequency attributes of the two objects and ensure that they are equal to allow the calculation to take place. Set the 'self._freq_equal' to True if the same.
def compare_freq(self): if self._obj1.frequency != self._obj2.frequency: raise ArithmeticError(f"The objects' frequency {self._obj1.frequency} and {self._obj2.frequency} are not the same.") if self._obj1.freq_unit != self._obj1.freq_unit: raise ArithmeticError(f"The objects' freq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return np.array_equal(\n self.np_floats(),\n other.np_floats()) and np.array_equal(\n self.np_ints(),\n other.np_ints()) and np.array_equal(\n self.freqs,\n other.freqs)", "def __gt__(self, other):\n if not...
[ "0.6924577", "0.6023659", "0.60017574", "0.5967577", "0.5945457", "0.5889283", "0.58852327", "0.5857143", "0.5848025", "0.5846018", "0.58393663", "0.5835524", "0.58251196", "0.58249813", "0.58152753", "0.5802302", "0.57974994", "0.57899815", "0.5783015", "0.57757765", "0.5775...
0.8551229
0
Calculate voltage using the two passed objects. Based on the two objects the method will determine the correct equation to use. The method will return None if the objects cannot be used for the called method.
def calc_voltage(self) -> (Volt, None): power: ComType = complex(0) power_unit: str = '' amp: NumType = 0 amp_unit: str = '' ohm: ComType = complex(0) ohm_unit: str = '' if self._amp_exists and self._ohm_exists: if hasattr(self._obj1, 'amps'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inductive_voltdiv(Vin=None, Vout=None, L1=None, L2=None, find=''):\n if Vin is not None and L1 is not None and L2 is not None:\n Vout = (Vin * L1) / (L1 + L2)\n elif Vout is not None and L1 is not None and L2 is not None:\n Vin = (Vout) * (L1 + L2) / (L1)\n elif Vin is not None and Vout ...
[ "0.6214673", "0.614571", "0.6009014", "0.5904963", "0.5863507", "0.5747999", "0.5747329", "0.56916034", "0.567709", "0.5654466", "0.55869013", "0.5584726", "0.55484796", "0.5530032", "0.5502495", "0.5500371", "0.54994154", "0.5498538", "0.5459045", "0.54423773", "0.543532", ...
0.675314
0
Calculate impedance using the two passed objects. Based on the two objects the method will determine the correct equation to use. The method will return None if the objects cannot be used for the called method.
def calc_impedance(self) -> (Ohm, None): power: ComType = complex(0) power_unit: str = '' amp: NumType = 0 amp_unit: str = '' volt: NumType = 0 volt_unit: str = '' if self._volt_exists and self._volt_exists: if hasattr(self._obj1, 'volts'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def di(o1, o2):\n return o1/o2", "def calc(operand_1, operand_2):\n try:\n return operand_1/operand_2\n except ZeroDivisionError:\n return 0", "def calc(operand_1, operand_2):\n return operand_1/operand_2", "def calc(operand_1, operand_2):\n return operand...
[ "0.601999", "0.5506426", "0.541305", "0.541305", "0.541305", "0.5373895", "0.53608656", "0.5356382", "0.53304803", "0.52975565", "0.5249021", "0.52109116", "0.5167401", "0.513542", "0.50895154", "0.50706196", "0.50706196", "0.5034539", "0.4954093", "0.49457806", "0.49324915",...
0.6352273
0
function to check if the current value is in a future time
def val_future_time(value): today = timezone.now() if value < today: raise ValidationError('Datetime should be a future Date and time')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_in_future(date) -> bool:\n is_in_the_future = time_after(date)\n return is_in_the_future", "def valid(t):\n return float(t) > time.time()", "def isPast(self):\n return (self._t < time())", "def is_in_the_future(dt):\n if dt > datetime.now(pytz.utc):\n return True\n retur...
[ "0.742416", "0.7342394", "0.72829944", "0.7265453", "0.7176794", "0.7147083", "0.7041912", "0.70314723", "0.6834246", "0.67728204", "0.6656451", "0.66316754", "0.6564517", "0.65577716", "0.65541255", "0.65340716", "0.65168554", "0.64972854", "0.64915395", "0.6470125", "0.6452...
0.7358469
1
''' In words ending with 'y', this function replaces 'y' by 'i'. step1c turns terminal y to i when there is another vowel in the stem.""" '''
def step1c(self, word): if word.endswith('y'): result = word.rfind('y') base = word[:result] if self.containsVowel(base): word = base word += 'i' return word
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step1c(self):\n\t\tif (self.ends(\"y\") and self.vowelinstem()):\n\t\t\tself.b = self.b[:self.k] + 'i' + self.b[self.k+1:]", "def _step1c(self, word):\n\n def nltk_condition(stem):\n \"\"\"\n This has been modified from the original Porter algorithm so\n that y->i is o...
[ "0.7266689", "0.66175455", "0.63900864", "0.61191475", "0.6068698", "0.60429436", "0.5993422", "0.5989975", "0.5857056", "0.5811782", "0.5710952", "0.57005095", "0.56973", "0.56643087", "0.5558673", "0.5556823", "0.55546314", "0.5542172", "0.54957694", "0.54321015", "0.540186...
0.80976295
0
equ_type correpsonds to the WavelengthSolutionFunctions coeffs correponds to the function but for a polynomial coeffs = c y = c[0]+c[1]x+c[2]x2+c[3]c3+.... extra extra info from the extraction process
def __init__ (self, equ_type='none' , extra='none'): self.equ_type = self.set_equation_type(equ_type) self.coeffs = [] self.extra = str(extra)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nth_order_const_coeff(*coeffs: List[Symbol], t: Symbol = t) -> Tuple[List[Symbol], Procedure]:\n\n # First, set up characteristic equation.\n char_eq_r, r = sympy.S.Zero, Dummy('r')\n\n for order, coeff in enumerate(coeffs[::-1]):\n char_eq_r += coeff * r ** order\n\n char_eq = Poly(char_eq_...
[ "0.5734576", "0.56887656", "0.5681322", "0.5651976", "0.56423664", "0.5576589", "0.5528677", "0.5461771", "0.5373789", "0.5370976", "0.5368531", "0.5363878", "0.5342567", "0.5324895", "0.5313149", "0.52953506", "0.5280881", "0.5260313", "0.5219243", "0.52093476", "0.5208789",...
0.57912767
0
This uses the header and tries out all possible functions for getting the wavelength solution coefficients returns a dictionary with keywords in ['linear','ctype','crvl','wcs','w0','co_0','wv_0','spectre']
def wlsoln_coeff_from_header (pyfits_header, apply_WCS_rv=False, preferred=None, output='sel'): # coefficient choices cc = {} #========================================================================# # linear dispersion cc['linear'] = coeff_basic_linear(pyfits_header) #========================...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header(fpath):\n # If you want to change something, instead of overwriting a bug, add a new\n # key with the desired functionallity. This way, prior code doesn't break.\n # One can be very waste full with this function as it is fast anyways.\n\n\n ret = {}\n with open(fpath) as f:\n for l...
[ "0.6472098", "0.57686627", "0.57133174", "0.55999637", "0.55356216", "0.5518358", "0.5444714", "0.5396722", "0.5379888", "0.5344746", "0.5342612", "0.534053", "0.52858293", "0.5228", "0.5175586", "0.5174878", "0.51518154", "0.514766", "0.5131736", "0.51092917", "0.51056576", ...
0.6787802
0
Returns the parent of self. If self is root ('/'), parent returns None. You much check the output of parent before using the value. Notcie that parent of root in the shell is '/', so this is a semantic difference between FarmFS and POSIX.
def parent(self): if self._path == sep: return None elif self._parent is None: self._parent = Path(first(split(self._path))) return self._parent else: return self._parent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent(self):\n return self if self.is_root else self.__parent", "def get_parent(self):\n if self.parent:\n return self.parent()\n else:\n return None", "def find_parent(self):\n parent = self._parent\n if parent:\n return parent\n ...
[ "0.78836995", "0.77781475", "0.76843834", "0.7628968", "0.75214714", "0.75041956", "0.74604297", "0.7354661", "0.734197", "0.72440976", "0.7241017", "0.7235812", "0.72275674", "0.72217995", "0.72217995", "0.72217995", "0.7179848", "0.7179848", "0.71753633", "0.71729606", "0.7...
0.81464714
0
Creates a hard link to dst. dst DNE Dir F SLF SLD SLB s DNR R R N N R R e Dir R R R R R R l F R R R R ? ? f SL R R R R ? ? R means raises. N means new hardlink created.
def link(self, dst): assert isinstance(dst, Path) link(dst._path, self._path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lnh(src, dst):\n os.link(src, dst)", "def link(self, src, dst, label=None):\n self._tag(dst, label)\n self._mkdir_for(dst)\n abs_src = self._rootjoin(src)\n abs_dst = os.path.join(self.chroot, dst)\n try:\n os.link(abs_src, abs_dst)\n except OSError as e:\n if e.errno == errno....
[ "0.6689718", "0.652778", "0.6506502", "0.6506502", "0.62713677", "0.6266134", "0.6220446", "0.6215565", "0.59210443", "0.5917583", "0.58603233", "0.5844886", "0.57999426", "0.5775267", "0.5713437", "0.5691181", "0.56734186", "0.566668", "0.5611633", "0.55994177", "0.5585695",...
0.66363525
1
Reads src_fd and puts the contents into a file located at self._path.
def copy_fd(self, src_fd, tmpdir=None): if tmpdir is None: tmpfn = sameDir else: tmpfn = lambda _: tmpdir._path mode = 'w' if 'b' in src_fd.mode: mode += 'b' with safeopen(self._path, mode, useDir=tmpfn) as dst_fd: copyfileobj(src_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_file(self, src: PathLike, dest: PathLike, force: bool = False):", "def handle_file(self, source_path, dest_path):\n raise NotImplemented", "def copyfileobj(fsrc, fdst, length=0):\r\n # Localize variable access to minimize overhead.\r\n if not length:\r\n length = COPY_BUFSIZE\r\n ...
[ "0.5596338", "0.5459085", "0.5378296", "0.52936655", "0.52718097", "0.520541", "0.5150503", "0.5127887", "0.5090162", "0.5075606", "0.5064022", "0.50478476", "0.500685", "0.5000948", "0.49774417", "0.4976913", "0.49672064", "0.4959817", "0.4932902", "0.49120706", "0.49093175"...
0.66701883
0
Copy self to path dst. Does not attempt to ensure dst is a valid destination. Raises IsADirectoryError and FileDoesNotExist on namespace errors. The file will either be fully copied, or will not be created. This is achieved via temp files and atomic swap. This API works for large files, as data is read in chunks and se...
def copy_file(self, dst, tmpdir=None): if tmpdir is None: tmpfn = sameDir else: tmpfn = lambda _: tmpdir._path assert isinstance(dst, Path) with open(self._path, 'rb') as src_fd: with safeopen(dst._path, 'wb', useDir=tmpfn) as dst_fd: c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n source = os.path.abspath(self.path)\n destination = os.path.abspath(self.target)\n\n logger.info(\"Running Copy Method - SOURCE=\\\"{src}\\\" DESTINATION=\\\"{dst}\\\" IGNORE=\\\"{ignore}\\\"\".format(src=source, dst=destination, ignore=self.ignore))\n\n if not os.path...
[ "0.6731077", "0.6349671", "0.61228085", "0.6079704", "0.60696405", "0.6063155", "0.6027516", "0.6027516", "0.59982765", "0.5988888", "0.5988461", "0.59474134", "0.5924743", "0.5887651", "0.58503205", "0.5818022", "0.5792588", "0.5786693", "0.57735986", "0.5770276", "0.5768486...
0.6634319
1
Building paths using conventional POSIX systems will discard CWD if the path is absolute. FarmFS makes passing of CWD explicit so that path APIs are pure functions. Additionally FarmFS path construction doesn't allow for absolute paths to be mixed with frames. This is useful for spotting bugs and making sure that pathi...
def userPath2Path(arg, frame): arg = ingest(arg) if isabs(arg): return Path(arg) else: return Path(arg, frame)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_path(path: Union[Path, str], path_is_absolute: bool = False) -> Path:\n if not path_is_absolute:\n return Path(os.getcwd()) / path\n if isinstance(path, str):\n return Path(path)\n return path", "def makePath(path):\n\n compatPath = os.path.abspath(os.path.expanduser(path))\n\...
[ "0.7044446", "0.6547335", "0.64296883", "0.6427195", "0.6424488", "0.6364664", "0.62077975", "0.61788577", "0.6155652", "0.60604566", "0.6044922", "0.6038902", "0.60300344", "0.6017157", "0.59847945", "0.5975106", "0.593022", "0.5901871", "0.5887952", "0.5885305", "0.5880734"...
0.67894834
1
Returns list of objects nonselected in the view.
def get_non_selected(self): obj_list = self.get_list() for sel in self.get_selected(): obj_list.remove(sel) return obj_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_hidden(self):\n return self.filter(hidden=False)", "def non_hidden(self):\n return self.filter(hidden=False)", "def get_selected_items(self):\n\n datas = [i.data(NODEROLE) for i in self.view.get_indices()]\n items = [d for d in datas if d is not None] # filter Nones\n\n ...
[ "0.7010305", "0.7010305", "0.67899483", "0.6676391", "0.6551073", "0.6375752", "0.6311826", "0.61739516", "0.61335963", "0.5950215", "0.59168136", "0.59028524", "0.58810467", "0.5845068", "0.58445495", "0.580032", "0.5723122", "0.5704929", "0.5687304", "0.5663265", "0.5649339...
0.8311188
0
This is a special string; when received it will make all Menu > Objects entries unchecked It mean we clicked outside of the items and deselected all
def on_row_selected(self, obj_name): if obj_name == 'none': for act in self.app.ui.menuobjects.actions(): act.setChecked(False) return # get the name of the selected objects and add them to a list name_list = [] for obj in self.get_selected(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generateMenuItemCheckedState(self, obj, **args):\n result = []\n if not args.get('mode', None):\n args['mode'] = self._mode\n args['stringType'] = 'checkbox'\n indicators = self._script.formatting.getString(**args)\n if obj.getState().contains(pyatspi.STATE_CHECKE...
[ "0.605545", "0.60228664", "0.60228664", "0.5937537", "0.5895686", "0.5885168", "0.58458877", "0.57850504", "0.5775188", "0.5724976", "0.5644342", "0.5637988", "0.5612422", "0.5612422", "0.5608615", "0.55828875", "0.55805236", "0.5510928", "0.5507137", "0.5500436", "0.54773974...
0.6350823
0
Run miraligner tool (from seqcluster suit) with default parameters.
def _miraligner(fastq_file, out_file, species, db_folder, config): resources = config_utils.get_resources("miraligner", config) miraligner = config_utils.get_program("miraligner", config) jvm_opts = "-Xms750m -Xmx4g" if resources and resources.get("jvm_opts"): jvm_opts = " ".join(resources.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def miraligner(args):\n hairpin, mirna = _download_mirbase(args)\n precursors = _read_precursor(args.hairpin, args.sps)\n matures = _read_mature(args.mirna, args.sps)\n gtf = _read_gtf(args.gtf)\n out_dts = []\n out_files = []\n for bam_fn in args.files:\n sample = op.splitext(op.basena...
[ "0.6715519", "0.6451304", "0.6105899", "0.60812104", "0.60113335", "0.5978272", "0.5951038", "0.589538", "0.56262004", "0.5610903", "0.5578043", "0.5525972", "0.5519358", "0.5513471", "0.5505446", "0.5498328", "0.54912096", "0.5486555", "0.5481968", "0.5479372", "0.54618645",...
0.7081002
0
Perform a bit_resize operation with resize from front flags.
def test_bit_resize_from_front(self): ops = [bitwise_operations.bit_resize(self.test_bin_ones, 10, resize_flags=aerospike.BIT_RESIZE_FROM_FRONT)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.test_key) # We should not have changed the zeroes bi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bit_resize_shrink_from_front(self):\n ops = [bitwise_operations.bit_resize(self.zero_one_bin, 5, resize_flags=aerospike.BIT_RESIZE_FROM_FRONT)]\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins = self.as_connection.get(self.test_key)\n\n assert len(bins[self.zero_...
[ "0.78656524", "0.7009931", "0.6986943", "0.69517285", "0.67249167", "0.65363735", "0.607698", "0.60718304", "0.6062587", "0.59940326", "0.5831852", "0.5756714", "0.5624054", "0.5552826", "0.551713", "0.54809797", "0.5480332", "0.5291675", "0.5257721", "0.52422786", "0.5236649...
0.74251884
1
By default we can create a new bin with resize.
def test_bit_resize_default_allows_create(self): ops = [bitwise_operations.bit_resize("new_bin_name", 10)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.test_key) assert bins["new_bin_name"] == bytearray([0] * 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bit_resize_create_only_allows_create(self):\n bit_policy = {\"bit_write_flags\": aerospike.BIT_WRITE_CREATE_ONLY}\n ops = [bitwise_operations.bit_resize(\"new_bin_name\", 10, policy=bit_policy)]\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins = self.as_connectio...
[ "0.7059136", "0.6962264", "0.6600574", "0.6584359", "0.6526519", "0.6474382", "0.6400263", "0.63203436", "0.6264439", "0.62524", "0.6250521", "0.6248925", "0.62143785", "0.5967999", "0.5863293", "0.57773244", "0.5767365", "0.5744283", "0.5743729", "0.5714881", "0.56769586", ...
0.74629015
0
Create a bin with resize using the create only flag.
def test_bit_resize_create_only_allows_create(self): bit_policy = {"bit_write_flags": aerospike.BIT_WRITE_CREATE_ONLY} ops = [bitwise_operations.bit_resize("new_bin_name", 10, policy=bit_policy)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.tes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bit_resize_create_only_prevents_update(self):\n bit_policy = {\"bit_write_flags\": aerospike.BIT_WRITE_CREATE_ONLY}\n ops = [bitwise_operations.bit_resize(self.test_bin_zeroes, 10, policy=bit_policy)]\n with pytest.raises(e.BinExistsError):\n self.as_connection.operate(self...
[ "0.71709293", "0.70837414", "0.6715232", "0.6555181", "0.65351737", "0.6414123", "0.6213422", "0.5822711", "0.57785696", "0.5771307", "0.5741651", "0.5709636", "0.55918306", "0.55503404", "0.54320246", "0.52427995", "0.52391505", "0.523907", "0.5202887", "0.519918", "0.515285...
0.7797645
0