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
Validates that a field in the record header does not have a value.
def header_field_should_not_have_value(self, label): locator = lex_locators["record"]["header"]["field_value"].format(label) self.selenium.page_should_not_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _entry_field_values_are_not_empty(entry: _LexiconEntry) -> None:\n empty_fields = [f for f in _REQUIRED_FIELDS if not entry[f]]\n\n if empty_fields:\n field_str = \", \".join(sorted(empty_fields))\n raise InvalidLexiconEntryError(\n f\"Entry fields have empty values: '{field_str}'\")", "def ge...
[ "0.683849", "0.6365718", "0.63112915", "0.6230485", "0.61937124", "0.6048413", "0.60448253", "0.59929425", "0.5948517", "0.59356445", "0.5925059", "0.5915659", "0.59072083", "0.58865273", "0.5876951", "0.58721685", "0.5848566", "0.5842581", "0.5815589", "0.5799302", "0.578277...
0.74657786
0
Validates that a field in the record header has a link as its value
def header_field_should_have_link(self, label): locator = lex_locators["record"]["header"]["field_value_link"].format(label) self.selenium.page_should_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_check(form, field):\n if form.registrable.data and len(field.data)==0:\n raise validators.ValidationError('link should is required when the forum is registrable')", "def _validate_item_link(self, item):\n if len(item.link) > 255:\n raise ValueError(\"item.link length too long...
[ "0.6734898", "0.6680483", "0.6659962", "0.6447703", "0.6380813", "0.6207591", "0.61978114", "0.6009429", "0.59542733", "0.59263813", "0.59231883", "0.58986306", "0.5892022", "0.58560866", "0.5845754", "0.5796058", "0.5663516", "0.56422627", "0.5615367", "0.5592679", "0.556438...
0.7419405
0
Validates that a field in the record header does not have a link as its value
def header_field_should_not_have_link(self, label): locator = lex_locators["record"]["header"]["field_value_link"].format(label) self.selenium.page_should_not_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_type(self):\n if self._type != \"link\":\n raise securesystemslib.exceptions.FormatError(\n \"Invalid Link: field `_type` must be set to 'link', got: {}\"\n .format(self._type))", "def link_check(form, field):\n if form.registrable.data and len(field.data)==0:\n ...
[ "0.6651557", "0.6540842", "0.64729846", "0.64548326", "0.62218595", "0.6217006", "0.607596", "0.5975116", "0.5898353", "0.5898042", "0.58803624", "0.5827015", "0.57602894", "0.5649541", "0.56489056", "0.5622549", "0.5617436", "0.5537711", "0.55272186", "0.5523555", "0.5493546...
0.7414802
0
Clicks a link in record header.
def click_header_field_link(self, label): locator = lex_locators["record"]["header"]["field_value_link"].format(label) self._jsclick(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(cls, user, link):\r\n pass", "def click(cls, user, link):\n pass", "def header_field_should_have_link(self, label):\n locator = lex_locators[\"record\"][\"header\"][\"field_value_link\"].format(label)\n self.selenium.page_should_contain_element(locator)", "def click(self...
[ "0.6810575", "0.6691521", "0.65496945", "0.6337218", "0.6258854", "0.6115506", "0.6081313", "0.60441154", "0.60302216", "0.6012667", "0.59126896", "0.58689827", "0.5819385", "0.58138835", "0.5788098", "0.57601273", "0.56691664", "0.5654446", "0.5648386", "0.56409955", "0.5631...
0.77199167
0
Validates that a checkbox field in the record header is checked
def header_field_should_be_checked(self, label): locator = lex_locators["record"]["header"]["field_value_checked"].format(label) self.selenium.page_should_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_CheckboxRequired(request):\n schema = schemaish.Structure()\n schema.add('checkbox', schemaish.Boolean(validator=validatish.Required()))\n\n form = formish.Form(schema, 'form')\n return form", "def header_field_should_be_unchecked(self, label):\n locator = lex_locators[\"record\"][\"h...
[ "0.6631701", "0.61190456", "0.6105029", "0.59637266", "0.5737197", "0.5682851", "0.56638116", "0.5659438", "0.5628575", "0.56126165", "0.56080025", "0.55531156", "0.5528249", "0.5469722", "0.54687536", "0.5466557", "0.5465746", "0.54445034", "0.54380137", "0.5435806", "0.5425...
0.6943328
0
Validates that a checkbox field in the record header is unchecked
def header_field_should_be_unchecked(self, label): locator = lex_locators["record"]["header"]["field_value_unchecked"].format( label ) self.selenium.page_should_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_widget_is_not_checkbox():\n form = ExampleForm()\n field = form[\"text\"]\n assert is_checkbox(field) is False", "def header_field_should_not_have_value(self, label):\n locator = lex_locators[\"record\"][\"header\"][\"field_value\"].format(label)\n self.selenium.page_should_not_co...
[ "0.62513125", "0.5875742", "0.58471143", "0.5810528", "0.5569274", "0.5510167", "0.5480259", "0.54778147", "0.5469235", "0.54215735", "0.5408021", "0.5368687", "0.53532887", "0.5350012", "0.527463", "0.5266475", "0.524117", "0.5231928", "0.5221544", "0.5200423", "0.5185765", ...
0.687146
0
Logs all of the browser capabilities as reported by selenium
def log_browser_capabilities(self, loglevel="INFO"): output = "selenium browser capabilities:\n" output += pformat(self.selenium.driver.capabilities, indent=4) self.builtin.log(output, level=loglevel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capabilities(self):\n pass", "def get_capabilities(self, config_section):\n get_opt = self.shishito_support.get_opt\n test_platform = self.shishito_support.test_platform\n if (test_platform == 'web'):\n # Get logging levels from config\n logging_driver = get_...
[ "0.6352043", "0.63287675", "0.6234685", "0.621302", "0.6083162", "0.60344166", "0.5915496", "0.58780015", "0.57179224", "0.57058084", "0.56078523", "0.5575174", "0.5550384", "0.5535238", "0.55145127", "0.548253", "0.54572767", "0.54152566", "0.54052216", "0.5400952", "0.53993...
0.87539417
0
Opens the Saleforce App Launcher Modal
def open_app_launcher(self, retry=True): self._jsclick("sf:app_launcher.button") self._jsclick("sf:app_launcher.view_all") self.wait_until_modal_is_open() try: # the modal may be open, but not yet fully rendered # wait until at least one link appears. We've seen ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def launch_an_app(appname,ui):\r\n ui = ui\r\n time.sleep(WAIT)\r\n \"\"\"Clicking on Launcher button\"\"\"\r\n ui.doDefault_on_obj('Launcher', False, role='button') \r\n time.sleep(WAIT)\r\n ui.doDefault_on_obj(name='Expand to all apps', role='button')\r\n time.sleep(WAIT)\r\n \"\"\"Launch...
[ "0.6479038", "0.6462919", "0.6434212", "0.6430649", "0.593074", "0.59013236", "0.5849572", "0.5847336", "0.5841618", "0.5819635", "0.58001095", "0.57615477", "0.57615477", "0.57615477", "0.57615477", "0.574904", "0.570637", "0.5686895", "0.5643976", "0.5634945", "0.5630922", ...
0.6853186
0
Enters a value into a lookup field.
def populate_lookup_field(self, name, value): input_locator = self._get_input_field_locator(name) menu_locator = lex_locators["object"]["field_lookup_link"].format(value) self._populate_field(input_locator, value) for x in range(3): self.wait_for_aura() try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_lookup_text_row(self, label, value, lookup, extra='', nothing=-1):\n if value in lookup:\n text = '<tt>{}</tt>{} (ID {})'.format(lookup[value].name, extra, value)\n else:\n if value > nothing:\n text = 'Unknown{} (ID {})'.format(extra, value)\n ...
[ "0.641252", "0.6169455", "0.606925", "0.5937431", "0.59248924", "0.57467043", "0.5721739", "0.5638932", "0.5584096", "0.55563086", "0.5553404", "0.5487033", "0.5400404", "0.53917044", "0.53668934", "0.53653044", "0.5303664", "0.5296934", "0.52910006", "0.5274896", "0.5239275"...
0.63465446
1
Set focus to an element In addition to merely setting the focus, we click the mouse to the field in case there are functions tied to that event.
def _focus(self, element): actions = ActionChains(self.selenium.driver) actions.move_to_element(element).click().perform() self.selenium.set_focus_to_element(element)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFocus(*args, **kwargs)->None:\n pass", "def OnSetFocus(self, event):\r\n\r\n self._owner.SetFocus()", "def set_focus(self, locator: Locator) -> None:\n element = self.ctx.get_element(locator)\n if not hasattr(element.item, \"SetFocus\"):\n raise ActionNotPossible(\n ...
[ "0.7593092", "0.75229216", "0.7500942", "0.7327072", "0.7300871", "0.7300871", "0.7300871", "0.7300871", "0.7252314", "0.7038113", "0.6970362", "0.6846653", "0.6653739", "0.66419196", "0.6593716", "0.65261585", "0.6503203", "0.64390767", "0.6426012", "0.6426012", "0.6426012",...
0.8282901
0
Use bruteforce to clear an element This moves the cursor to the end of the input field and then issues a series of backspace keys to delete the data in the field.
def _force_clear(self, element): value = element.get_attribute("value") actions = ActionChains(self.selenium.driver) actions.move_to_element(element).click().send_keys(Keys.END) for character in value: actions.send_keys(Keys.BACKSPACE) actions.perform()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clear(self, element):\n\n element.clear()\n self.selenium.driver.execute_script(\"arguments[0].value = '';\", element)\n\n # Select all and delete just in case the element didn't get cleared\n element.send_keys(Keys.HOME + Keys.SHIFT + Keys.END)\n element.send_keys(Keys.BACK...
[ "0.7640167", "0.7266357", "0.71256816", "0.6985051", "0.6673201", "0.6649528", "0.65886164", "0.65132946", "0.646155", "0.64538974", "0.64445746", "0.64432126", "0.6439535", "0.6426399", "0.64018774", "0.6384927", "0.63733244", "0.63733244", "0.63733244", "0.63733244", "0.637...
0.79356056
0
Enters multiple values from a mapping into form fields.
def populate_form(self, **kwargs): for name, value in kwargs.items(): self.populate_field(name, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_values(self):\n for key in self.inputs.keys():\n value = self.inputs[key]['entry'].get()\n self.inputs[key]['value'] = value", "def _update_all_fields(self, name, value):\n for field in self._field_map.values():\n setattr(field, name, value)", "def mult...
[ "0.5659952", "0.5232755", "0.51979226", "0.51860756", "0.5185267", "0.5160687", "0.5100644", "0.5097913", "0.5079921", "0.50635326", "0.5046377", "0.50151217", "0.49936998", "0.49446088", "0.4937811", "0.49083483", "0.49044922", "0.489954", "0.4892619", "0.4890959", "0.488867...
0.6376247
0
Selects a record type while adding an object.
def select_record_type(self, label): self.wait_until_modal_is_open() locator = lex_locators["object"]["record_type_option"].format(label) self._jsclick(locator) self.selenium.click_button("Next")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_type(self, typename, db):\n self._dbs[typename] = db\n return None", "def setRecord(self,record):\n idLower = record.getId().lower()\n type = record.name\n typeIds = self.indexed[type]\n if idLower in typeIds:\n oldRecord = typeIds[idLower]\n ...
[ "0.634989", "0.6107559", "0.6105183", "0.59830755", "0.5978904", "0.5968171", "0.5839918", "0.579843", "0.57609946", "0.5749956", "0.57482135", "0.5670924", "0.56359786", "0.56163234", "0.56163234", "0.56163234", "0.56163234", "0.56163234", "0.5583426", "0.556422", "0.5558005...
0.64888483
0
Navigates to a tab via the App Launcher
def select_app_launcher_tab(self, tab_name): locator = lex_locators["app_launcher"]["tab_link"].format(tab_name) self.open_app_launcher() self.selenium.wait_until_page_contains_element(locator) self.selenium.set_focus_to_element(locator) self._jsclick(locator) self.wait_u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_tab(self, tab_name):\r\n\r\n if tab_name not in ['Courseware', 'Course Info', 'Discussion', 'Wiki', 'Progress']:\r\n self.warning(\"'{0}' is not a valid tab name\".format(tab_name))\r\n\r\n # The only identifier for individual tabs is the link href\r\n # so we find the tab...
[ "0.6880814", "0.6681028", "0.6590685", "0.6584148", "0.62873447", "0.62018365", "0.6067406", "0.5995313", "0.59724635", "0.59715986", "0.59331524", "0.58777994", "0.584674", "0.58315337", "0.58249784", "0.5794458", "0.5784082", "0.5779934", "0.5776915", "0.5733068", "0.572697...
0.7127252
0
Deletes a Salesforce object by object name and Id.
def salesforce_delete(self, obj_name, obj_id): self.builtin.log("Deleting {} with Id {}".format(obj_name, obj_id)) obj_class = getattr(self.cumulusci.sf, obj_name) obj_class.delete(obj_id) self.remove_session_record(obj_name, obj_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_delete(self, object_name, object_id):\n cmd = self.object_cmd(object_name, 'list')\n cmd_delete = self.object_cmd(object_name, 'delete')\n if object_id in self.cinder(cmd):\n self.cinder(cmd_delete, params=object_id)", "def delete_object(self, id):\n self.request...
[ "0.7758005", "0.76952064", "0.76122814", "0.74693274", "0.7362586", "0.73347324", "0.7282619", "0.7258193", "0.7237982", "0.72049564", "0.7141652", "0.7136172", "0.71041375", "0.7103634", "0.70919704", "0.7081055", "0.7081055", "0.7081055", "0.7081055", "0.70636696", "0.70365...
0.84441805
0
Gets a Salesforce object by Id and returns the result as a dict.
def salesforce_get(self, obj_name, obj_id): self.builtin.log(f"Getting {obj_name} with Id {obj_id}") obj_class = getattr(self.cumulusci.sf, obj_name) return obj_class.get(obj_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, id):\n return {'id': id}", "def getbyid(self, id):\n\n return esd.retrieve(id)", "def get(cls, id):\n\n return cls.query.get(id)", "def get(cls, id):\n\n return cls.query.get(id)", "def get_object(id):", "async def get(self, collection: str, obj_id) -> dict:\n\t\...
[ "0.71033096", "0.65637094", "0.65452147", "0.65452147", "0.6522671", "0.64929986", "0.641275", "0.63342565", "0.6298969", "0.62821114", "0.627364", "0.62098897", "0.6207032", "0.6184861", "0.61029357", "0.6097872", "0.60920376", "0.6079806", "0.6054238", "0.6028868", "0.60259...
0.7229265
0
Creates a new Salesforce object and returns the Id. The fields of the object may be defined with keyword arguments where the keyword name is the same as the field name. The object name and Id is passed to the Store Session Record keyword, and will be deleted when the keyword Delete Session Records is called. As a best ...
def salesforce_insert(self, obj_name, **kwargs): self.builtin.log("Inserting {} with values {}".format(obj_name, kwargs)) obj_class = getattr(self.cumulusci.sf, obj_name) res = obj_class.create(kwargs) self.store_session_record(obj_name, res["id"]) return res["id"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ID(cls,objectid, **kkw):\n rec = cls(**kkw)\n rec.setObjectID(objectid) \n return rec", "def _create_instance(**kwargs):\n ctxt = context.get_admin_context()\n return db.instance_create(ctxt, _create_instance_dict(**kwargs))['id']", "def salesforce_delete(self, obj_name, o...
[ "0.6099784", "0.57673496", "0.5745987", "0.56620574", "0.5496389", "0.5413757", "0.54007477", "0.53912675", "0.5366959", "0.53419036", "0.53338027", "0.5332641", "0.5327667", "0.5312216", "0.52999014", "0.52999014", "0.52650034", "0.5248084", "0.5237554", "0.5214156", "0.5195...
0.7094382
0
Generate bulk test data This returns an array of dictionaries with templateformatted arguments which can be passed to the Salesforce Collection Insert keyword. You can use ``{{number}}`` to represent the unique index of the row in the list of rows. If the entire string consists of a number, Salesforce API will treat th...
def generate_test_data(self, obj_name, number_to_create, **fields): objs = [] for i in range(int(number_to_create)): formatted_fields = { name: format_str(value, {"number": i}) for name, value in fields.items() } newobj = self._salesforce_generate_obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_sample_data(no_of_records):\n rows_in_database = [{'id': counter, 'name': get_random_string(string.ascii_lowercase, 20), 'dt': '2017-05-03'}\n for counter in range(0, no_of_records)]\n return rows_in_database", "def _generate_samples(samples_data_table=None):\n samples_d...
[ "0.62281257", "0.58414435", "0.57256013", "0.56998044", "0.55656403", "0.5547948", "0.55262107", "0.54210865", "0.54113424", "0.54010236", "0.53936654", "0.5307927", "0.5285569", "0.52823174", "0.5281768", "0.52781165", "0.5264683", "0.5262325", "0.52562386", "0.5229721", "0....
0.6927312
0
Inserts records that were created with Generate Test Data. _objects_ is a list of data, typically generated by the Generate Test Data keyword. A 200 record limit is enforced by the Salesforce APIs. The object name and Id is passed to the Store Session Record keyword, and will be deleted when the keyword Delete Session ...
def salesforce_collection_insert(self, objects): assert ( not obj.get("id", None) for obj in objects ), "Insertable objects should not have IDs" assert len(objects) <= SF_COLLECTION_INSERTION_LIMIT, ( "Cannot insert more than %s objects with this keyword" % SF...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_orm_bulk_insert(n):\n session = Session(bind=engine)\n session.execute(\n insert(Customer),\n [\n {\n \"name\": \"customer name %d\" % i,\n \"description\": \"customer description %d\" % i,\n }\n for i in range(n)\n ...
[ "0.64643896", "0.6081418", "0.60779667", "0.6074153", "0.5980561", "0.5979267", "0.5907617", "0.5818981", "0.5811491", "0.57162386", "0.57037383", "0.56994545", "0.5665415", "0.5661283", "0.5619838", "0.5602595", "0.5576301", "0.5541686", "0.5505862", "0.54812557", "0.5477006...
0.7367196
0
Updates records described as Robot/Python dictionaries. _objects_ is a dictionary of data in the format returned by the Salesforce Collection Insert keyword. A 200 record limit is enforced by the Salesforce APIs.
def salesforce_collection_update(self, objects): for obj in objects: assert obj[ "id" ], "Should be a list of objects with Ids returned by Salesforce Collection Insert" if STATUS_KEY in obj: del obj[STATUS_KEY] assert len(objects) <= S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partial_update_objects(self, objects):\n requests = []\n for obj in objects:\n requests.append({\"action\": \"partialUpdateObject\", \"objectID\": obj[\"objectID\"], \"body\": obj})\n request = {\"requests\": requests}\n return self.batch(request)", "def save_objects(se...
[ "0.74889565", "0.7275556", "0.67248726", "0.6552144", "0.6240532", "0.61281914", "0.5878936", "0.5844297", "0.58166015", "0.5668504", "0.56546557", "0.565175", "0.5629312", "0.5626341", "0.5616312", "0.5604614", "0.55680174", "0.5566948", "0.55641276", "0.55485463", "0.551291...
0.79533464
0
Constructs and runs a simple SOQL query and returns a list of dictionaries. By default the results will only contain object Ids. You can specify a SOQL SELECT clase via keyword arguments by passing a commaseparated list of fields with the ``select`` keyword argument.
def salesforce_query(self, obj_name, **kwargs): query = "SELECT " if "select" in kwargs: query += kwargs["select"] else: query += "Id" query += " FROM {}".format(obj_name) where = [] for key, value in kwargs.items(): if key == "select":...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_object_raw(self, o):\n self.setQuery(\"\"\"\n Select ?s ?p where {\n ?s ?p %s\n } ORDER BY (?s)\"\"\" % (o))\n\n try:\n rval = self.query()\n g = rval.convert()\n return [(x['s'], x['p']) for x in g['results']['bindings']]\n excep...
[ "0.59299433", "0.58073217", "0.5761999", "0.571226", "0.5626093", "0.55796915", "0.5573094", "0.54810995", "0.5442956", "0.54407555", "0.5440693", "0.54233193", "0.5400067", "0.5384152", "0.53717834", "0.53488815", "0.53299403", "0.5325337", "0.53251", "0.532294", "0.5310475"...
0.71230334
0
Wait for modal to open
def wait_until_modal_is_open(self): self.selenium.wait_until_page_contains_element( lex_locators["modal"]["is_open"], timeout=15, error="Expected to see a modal window, but didn't", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_until_modal_is_closed(self):\n self.selenium.wait_until_page_does_not_contain_element(\n lex_locators[\"modal\"][\"is_open\"], timeout=15\n )", "def check_modal(client):\n modal_close_btn_xpath = \"/html/body/div[9]/div[3]/div/button[1]\"\n\n try:\n modal_close_btn ...
[ "0.7622249", "0.7095724", "0.70760953", "0.7060797", "0.6790178", "0.6715883", "0.6715883", "0.6715883", "0.6715883", "0.6562302", "0.64118767", "0.64118767", "0.64118767", "0.64118767", "0.6298654", "0.622454", "0.62229896", "0.61371136", "0.6118723", "0.59900486", "0.593611...
0.8239222
0
Wait for modal to close
def wait_until_modal_is_closed(self): self.selenium.wait_until_page_does_not_contain_element( lex_locators["modal"]["is_open"], timeout=15 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_until_modal_is_open(self):\n self.selenium.wait_until_page_contains_element(\n lex_locators[\"modal\"][\"is_open\"],\n timeout=15,\n error=\"Expected to see a modal window, but didn't\",\n )", "def check_modal(client):\n modal_close_btn_xpath = \"/html/b...
[ "0.7273317", "0.71254295", "0.68904704", "0.6873608", "0.6804555", "0.68041027", "0.6513829", "0.61945766", "0.6140105", "0.6140105", "0.6140105", "0.6140105", "0.60835415", "0.6065856", "0.6049788", "0.60275036", "0.59850746", "0.59787047", "0.59585005", "0.592383", "0.59188...
0.8103863
0
Waits until we are able to render the initial salesforce landing page It will continue to refresh the page until we land on a lightning page or until a timeout has been reached. The timeout can be specified in any time string supported by robot
def wait_until_salesforce_is_ready(self, locator=None, timeout=None, interval=5): # Note: we can't just ask selenium to wait for an element, # because the org might not be availble due to infrastructure # issues (eg: the domain not being propagated). In such a case # the element will ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_front_page_load(self, timeout=DEFAULT_LOGIN_TIMEOUT):\n conditions = [\n invisibility_of_element_located(self.page.button_accept.locator),\n invisibility_of_element_located(self.page.div_loading_documents.locator),\n invisibility_of_element_located(self.page.div_loa...
[ "0.66434354", "0.6375672", "0.6361778", "0.62447697", "0.60764015", "0.60569257", "0.60387635", "0.60162246", "0.6012954", "0.60054886", "0.59714395", "0.5865687", "0.5821413", "0.5795354", "0.5770845", "0.57457644", "0.57266104", "0.5703139", "0.5673199", "0.5658159", "0.565...
0.66569376
0
Serves as a breakpoint for the robot debugger
def breakpoint(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gdb_breakpoint():\n _gdb_python_call_gen('gdb_breakpoint')()", "def add_breakpoint():\n raise NotImplementedError()", "def pdb_view(request):\n import pdb; pdb.set_trace()\n return HttpResponse(\"This works.\")", "def debug():\n # written before I knew about the pdb module\n caller = curren...
[ "0.80616933", "0.708041", "0.6795347", "0.67953384", "0.6641149", "0.6635265", "0.66266686", "0.6533395", "0.6507743", "0.64715624", "0.64667577", "0.6454341", "0.6438292", "0.6403162", "0.63000405", "0.6268363", "0.62050426", "0.6176233", "0.61758935", "0.616019", "0.6157194...
0.7725402
1
Switch to lightning if we land on a classic page This seems to happen randomly, causing tests to fail catastrophically. The idea is to detect such a case and autoclick the "switch to lightning" link
def _check_for_classic(self): try: # we don't actually want to wait here, but if we don't # explicitly wait, we'll implicitly wait longer than # necessary. This needs to be a quick-ish check. self.selenium.wait_until_element_is_visible( "class:swi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lightning_turnon(self):\n self.turnOn()", "def test_light_interface(light_name='head_green_light'):\n l = Lights()\n rospy.loginfo(\"All available lights on this robot:\\n{0}\\n\".format(\n ', '.join(l.list_all_lights())))\n rospy.loginfo(\"Blinki...
[ "0.6474351", "0.6049255", "0.60098785", "0.58803", "0.571039", "0.5609471", "0.5589023", "0.5588631", "0.55719453", "0.552486", "0.5519454", "0.5497041", "0.5464873", "0.5446799", "0.54293966", "0.5422532", "0.5421984", "0.5421487", "0.5380591", "0.536266", "0.5356685", "0....
0.73217934
0
r""" Return all rows from sql table that match condition.
def read_all_rows(condition, database, table): connection = sqlite3.connect(database) connection.row_factory = sqlite3.Row cursor = connection.cursor() cursor.execute('SELECT * FROM ' + table + ' WHERE ' + condition) rows = cursor.fetchall() cursor.close() connection.close() return rows
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(self, table_name: str, row_filter: dict) -> list:\n sql = 'SELECT * FROM ' + table_name + ' WHERE '\n for key, value in row_filter.items():\n if type(value) is tuple:\n sql += key + ' '\n sql += value[0] + ' '\n sql += \"'\" + value[1...
[ "0.6921658", "0.68708515", "0.67352384", "0.66947955", "0.66095924", "0.65919626", "0.6581109", "0.6542389", "0.65064514", "0.6394499", "0.63609296", "0.6296992", "0.6295895", "0.622317", "0.6203416", "0.6198122", "0.619671", "0.61933297", "0.61845225", "0.61834896", "0.61724...
0.7410855
0
r""" Return cursor object which can iterate through rows matching condition.
def cursor_with_rows(condition, database, table): connection = sqlite3.connect(database) connection.row_factory = sqlite3.Row cursor = connection.cursor() cursor.execute('SELECT * FROM ' + table + ' WHERE ' + condition) return cursor, connection
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cursor(self):\n with self.connection() as conn:\n cursor = conn.cursor(prepared=True)\n try:\n yield cursor\n finally:\n cursor.close()", "def rowgen(searchcursor_rows):\n rows = searchcursor_rows\n ro...
[ "0.6193378", "0.6168785", "0.6114055", "0.6057929", "0.60495085", "0.59896654", "0.592929", "0.5915509", "0.59063196", "0.59040475", "0.59040475", "0.5888552", "0.58679223", "0.5834532", "0.577474", "0.5744007", "0.57143974", "0.57027924", "0.5641648", "0.56361765", "0.563343...
0.7218549
0
r""" Close connection and cursor.
def close(connection, cursor): cursor.close() connection.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if self.cursor:\n self.cursor.close()\n if self.conn:\n self.conn.close()", "def close_connection(self):\n self.cursor.close()\n self.connection.close()", "def close(cursor, conn):\n cursor.close()\n conn.close()", "def __clos...
[ "0.83350396", "0.83227044", "0.8266605", "0.8200751", "0.81766593", "0.79859394", "0.7881802", "0.7783966", "0.77768856", "0.77637964", "0.7759937", "0.7715322", "0.7711181", "0.77009636", "0.7679163", "0.76544863", "0.76360935", "0.7625238", "0.7625238", "0.7625238", "0.7615...
0.835283
0
Find where values of a first tensor are equal to values of a second one.
def where_in(a, b): return torch.nonzero((a[..., None] == b).any(-1)).squeeze()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersect1d(tensor1, tensor2):\n aux = torch.cat((tensor1, tensor2), dim=0)\n aux = aux.sort()[0]\n return aux[:-1][(aux[1:] == aux[:-1]).data]", "def check_equal(tensor_1, tensor_2):\n return tf.reduce_max(tf.abs(tensor_1 - tensor_2)).numpy() < 1e-6", "def _at_least_x_are_equal(a, b, x):\n ma...
[ "0.69859505", "0.6417683", "0.62976325", "0.62053716", "0.6149471", "0.6149237", "0.6107486", "0.6081227", "0.606979", "0.5993573", "0.59305525", "0.58065206", "0.57969844", "0.5771546", "0.57571447", "0.56957847", "0.56957316", "0.56669915", "0.5662999", "0.564584", "0.55743...
0.65178233
1
Randomly choose n elements from a 1dtensor.
def choose(n, a): return torch.as_tensor([a[idx] for idx in torch.randperm(len(a))[:n]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sample(self, n=1):\n return [self[i] for i in np.random.choice(self.length, n, replace=False)]", "def random_sampling(elements, n):\r\n import random\r\n return [random.choice(elements) for i in range(n)]", "def Sample(n=6):\n t = [random.normalvariate(0.0, 1.0) for i in range(n)]\n t.s...
[ "0.7265496", "0.7151787", "0.684487", "0.68300295", "0.6747794", "0.6736281", "0.67220575", "0.67206866", "0.6678554", "0.6662675", "0.6657964", "0.6632153", "0.6624737", "0.66138387", "0.6607942", "0.6597783", "0.65779805", "0.65667385", "0.6557566", "0.6545551", "0.6535659"...
0.744539
0
Unpack the data from a JSON object and create encodings. This function assumes that for each synset, its lemma on highway is always at index 0.
def process_data(self, json_dict: dict): all_token_ids = [] all_level_ids = [] all_synset_ids = [] all_lemma_ids = [] all_is_highway = [] all_targets = [] def tokenize(lemma_): return self.tokenizer( lemma_, add_special...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_to_packstream(cls, data):\n # TODO: other partial hydration\n if \"self\" in data:\n if \"type\" in data:\n return Structure(ord(b\"R\"),\n cls._uri_to_id(data[\"self\"]),\n cls._uri_to_id(data[\"start\...
[ "0.55587035", "0.53674453", "0.505383", "0.50060594", "0.5005306", "0.4995134", "0.49444664", "0.49142903", "0.48940662", "0.4857965", "0.4856359", "0.48483723", "0.48413804", "0.48019016", "0.47903192", "0.47873363", "0.47782275", "0.47761175", "0.47713354", "0.47687137", "0...
0.64224637
0
Adds spam information a graph for detection using Karger's algorithm.
def _add_spam_info_to_graph_k(graph, items, actions): # Adds flag information (graph.add_answer(...)) to the graph object. for act in actions: if act.type == ACTION_FLAG_SPAM: # Spam flag! graph.add_answer(act.user_id, act.item_id, -1, base_reliability = act.user....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spam(bot, msg):\n\n sendername = msg.sendername\n\n if msg.command != \"PRIVMSG\" or sendername in bot.services:\n return\n\n message = msg.args[1]\n\n if sendername not in spammers or message != spammers[sendername][0]:\n spammers[sendername] = [message, 0]\n else:\n spamme...
[ "0.60310346", "0.5441528", "0.5307215", "0.5306278", "0.5292672", "0.5228955", "0.5169543", "0.51104075", "0.50563246", "0.50283116", "0.5006519", "0.49944475", "0.4940373", "0.49399513", "0.49128112", "0.49016973", "0.4895419", "0.48774913", "0.483557", "0.48349544", "0.4821...
0.74099356
0
The function udoes flagging spam/ham without checking for original action in the DB (it is assumed that it should be done outside the function)
def _undo_spam_ham_flag(item, user, session, spam_flag=True): answr = -1 if spam_flag else 1 if item.sk_frozen: # The item is known as spam/ham. val = np.sign(item.sk_weight) * answr * BASE_SPAM_INCREMENT user.sk_base_reliab -= val return # Okay, item participate in offline s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _raise_spam_ham_flag_fresh(item, user, timestamp,\n session, spam_flag=True):\n # Creates a record in Action table\n if spam_flag:\n answr = -1\n act = ActionMixin.cls(item.id, user.id, ACTION_FLAG_SPAM, timestamp)\n item.spam_flag_counter += 1\n ...
[ "0.6985311", "0.59789354", "0.59601426", "0.5940987", "0.5914589", "0.58679473", "0.58446145", "0.57047296", "0.56003463", "0.5582888", "0.5571693", "0.5566933", "0.55616117", "0.5528202", "0.5487382", "0.54783595", "0.5448711", "0.5412162", "0.5398329", "0.5384775", "0.53812...
0.6337893
1
The function flags spam/ham on the item. It is assumed that the item was not flagged as spam/ham by the user.
def _raise_spam_ham_flag_fresh(item, user, timestamp, session, spam_flag=True): # Creates a record in Action table if spam_flag: answr = -1 act = ActionMixin.cls(item.id, user.id, ACTION_FLAG_SPAM, timestamp) item.spam_flag_counter += 1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _undo_spam_ham_flag(item, user, session, spam_flag=True):\n answr = -1 if spam_flag else 1\n if item.sk_frozen:\n # The item is known as spam/ham.\n val = np.sign(item.sk_weight) * answr * BASE_SPAM_INCREMENT\n user.sk_base_reliab -= val\n return\n # Okay, item participate ...
[ "0.7864932", "0.6828174", "0.63705266", "0.6302362", "0.6109251", "0.58881116", "0.58711064", "0.57879716", "0.5656033", "0.56387347", "0.55657727", "0.55283886", "0.55069524", "0.53776723", "0.5350696", "0.53247046", "0.53102404", "0.5235352", "0.5226677", "0.5216656", "0.52...
0.7826373
1
Deletes spam action from the db, it takes care of spam flag counter.
def _delete_spam_action(act, session): if act is None: return act.item.spam_flag_counter -= 1 session.delete(act)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_activity():\n pass", "def delete_spam_item_by_author(item, session):\n actions = ActionMixin.cls.get_actions_on_item(item.id, session)\n if item.sk_frozen:\n # If the item is frozen then users who flagged it already got changes\n # to their spam reliability.\n # In this c...
[ "0.63294035", "0.62134814", "0.6096816", "0.5966107", "0.5942011", "0.5865762", "0.5857666", "0.5855021", "0.58430976", "0.58430976", "0.58430976", "0.58430976", "0.58396226", "0.57542235", "0.5742879", "0.5742321", "0.57266784", "0.57226205", "0.5712291", "0.5710714", "0.570...
0.8381546
0
If item is deleted by author then there is no reputation damage to the author, plus users who flagged it receive boost to base reliability.
def delete_spam_item_by_author(item, session): actions = ActionMixin.cls.get_actions_on_item(item.id, session) if item.sk_frozen: # If the item is frozen then users who flagged it already got changes # to their spam reliability. # In this case the user's karma user also has changes to it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_item(self, item_id, user_id):\r\n item = self._db_manager.get_item(item_id)\r\n if item is None:\r\n flash(\"Invalid item.\")\r\n return\r\n if item[\"user_id\"] != user_id:\r\n flash(\"Only the original creator can delete an item.\")\r\n ...
[ "0.6042252", "0.58367413", "0.57703066", "0.5738266", "0.57119405", "0.57119405", "0.5659373", "0.56316453", "0.5622158", "0.5544149", "0.5543135", "0.5539816", "0.55358565", "0.55128115", "0.55047125", "0.55024445", "0.5482617", "0.5474065", "0.5461759", "0.5452901", "0.5446...
0.7050691
0
Preprocess data after extracted for ml. As the the scale between features are very difference, running scaling normalization before put data into machine learning algorithm is essential.
def _preprocess(self, data, normalize=False) -> np.ndarray: preprocessor = StandardScaler() if not normalize else Normalizer() data = preprocessor.fit_transform(data) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_data(self):\n\n self._preprocess_train_data()\n self._preprocess_test_data()", "def data_preprocessing_TA(X):\n \n #Removing the mean and scaling the data\n X_prep=StandardScaler().fit_transform(X)\n #do here your preprocessing\n return X_prep", "def preprocess(data)...
[ "0.7693326", "0.7410056", "0.73902357", "0.72746557", "0.72113276", "0.71665233", "0.7021973", "0.6938132", "0.69301885", "0.69071275", "0.6894873", "0.68790245", "0.6878616", "0.68515855", "0.6807007", "0.67938256", "0.67871", "0.6757415", "0.6750153", "0.67189497", "0.67176...
0.7775244
0
insert and return a new vertex with value val
def add_vertex(self, u, val): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, v):\n v = {'x': v[0], 'y': v[1]}\n if v not in self:\n self.append(v)\n return len(self)-1\n return self.index(v)", "def add_vertex(self, v):\n self[v] = {}", "def add_vertex(self, v):\n self[v] = {}", "def add_vertex(self, value):...
[ "0.70055175", "0.6672808", "0.6672808", "0.665914", "0.65796596", "0.64388794", "0.6434329", "0.6385019", "0.63737094", "0.6360909", "0.63309157", "0.62818736", "0.62777275", "0.6264226", "0.62505364", "0.6237072", "0.6217751", "0.6157137", "0.6152192", "0.6140421", "0.610808...
0.7464274
0
insert and return a new edge from vertex u to v with value val (identifies the edge)
def add_edge(self, u, v, val): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, u, v):\r\n keys = self.d.keys()\r\n #if nodes are not in graph, add them\r\n if u not in keys:\r\n self.add_node(u)\r\n if v not in keys:\r\n self.add_node(v)\r\n #add each node to the value set of each other\r\n u_old = self.d[u]\r...
[ "0.6902003", "0.68033904", "0.6797287", "0.6735052", "0.6735052", "0.673498", "0.6692211", "0.6499803", "0.6499803", "0.64099747", "0.6365838", "0.630058", "0.62901974", "0.6280423", "0.625974", "0.62564737", "0.624568", "0.61428213", "0.61315656", "0.61189634", "0.60859466",...
0.7721478
0
Connect to a pshell server in another process, note that this does not do any handshaking to the remote pshell or maintain a connection state, it meerly sets the internal destination remote pshell server information to use when sending commands via the sendCommandN functions and sets up any resources necessary for the ...
def connectServer(controlName, remoteServer, port, defaultTimeout): return (_connectServer(controlName, remoteServer, port, defaultTimeout))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self):\n source_address = (socket.gethostname(), 0)\n dest_address = (self.host, self.port)\n\n self.sock = self.ssh_transport._open_ssh_channel(dest_address, source_address)\n\n # hack to work around issue in using paraminko channels as a \"socket\". See http://bugs.python...
[ "0.64140594", "0.639816", "0.6377459", "0.6183722", "0.61817", "0.61457235", "0.6118319", "0.6075475", "0.60697454", "0.60515195", "0.60034555", "0.59717435", "0.5968937", "0.5933763", "0.5918022", "0.5911673", "0.58980364", "0.5888824", "0.58549833", "0.5849856", "0.5789333"...
0.6720791
0
This command will add a controlList of multicast receivers to a multicast group, multicast groups are based either on a specified command, or if the special argument PSHELL_MULTICAST_ALL is used, the given controlList will receive all multicast commands, the format of the controlList is a CSV formatted list of all the ...
def addMulticast(command, controlList): _addMulticast(command, controlList)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe_to_mc_groups(addrs=None):\n\n listen_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_IP)\n listen_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n listen_sock.bind(('', DEFAULT_TDM_PORT))\n\n for mc in addrs:\n print(\"subscribing to {}\".format(m...
[ "0.5905946", "0.55800664", "0.53881925", "0.5349174", "0.5195199", "0.4941558", "0.4911162", "0.4821562", "0.4777276", "0.4695401", "0.46406105", "0.46260658", "0.46048972", "0.4598583", "0.4537745", "0.45331293", "0.45294213", "0.4514538", "0.45126247", "0.4490134", "0.44843...
0.82443655
0
This command will send a given command to all the registered multicast receivers for this multicast group, multicast groups are based on the command's keyword, this function will issue the command as a best effort fireandforget command to each receiver in the multicast group, no results will be requested or expected, a...
def sendMulticast(command): _sendMulticast(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addMulticast(command, controlList):\n _addMulticast(command, controlList)", "def receive(self, command_list):\n for cmd in command_list:\n self._send_cmd_with_mapped_ids(cmd)", "def discoveryBroadcast(self):\n interfaces = netifaces.interfaces()\n for interface in interface...
[ "0.6507733", "0.5696942", "0.5583125", "0.5511868", "0.53806776", "0.53689533", "0.5362779", "0.536228", "0.533392", "0.53231615", "0.528227", "0.5262153", "0.52358514", "0.52324533", "0.52314097", "0.52299494", "0.52146405", "0.52002823", "0.51943034", "0.5193174", "0.518410...
0.71866304
0
Send a command overriding the default timeout, if the override timeout is 0, the server will not reply with a response and this function will not wait for one
def sendCommand2(controlName, timeoutOverride, command): return (_sendCommand2(controlName, timeoutOverride, command))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendCommand4(controlName, timeoutOverride, command):\n return (_sendCommand4(controlName, timeoutOverride, command))", "def send_command(self, command):\r\n print (\">> send cmd: {}\".format(command))\r\n self.abort_flag = False\r\n timer = threading.Timer(self.command_timeout, self.set...
[ "0.7543854", "0.74337345", "0.72187316", "0.71768516", "0.71304816", "0.6907192", "0.6906801", "0.6848764", "0.67818886", "0.67818886", "0.6768794", "0.67666864", "0.66927606", "0.6620532", "0.656423", "0.6549495", "0.65354204", "0.65237427", "0.6503479", "0.6459959", "0.6435...
0.7466738
1
Calculate the largest prime factor of n
def largest_prime_fac(n): divisor = 2 # Start with lowest prime and work through prime factors until highest is left while divisor ** 2 < n: while n % divisor == 0: n = n / divisor divisor += 1 return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_factor(n): \n max_factor = 1\n for i in range(2,floor(sqrt(n))+1):\n if n % i == 0:\n return max(max_factor, n // i)\n return max_factor", "def largest_factor(n):\n i = 1\n previous_factor = 1\n largest = 1\n while i < n:\n if n % i == 0:\n factor...
[ "0.8655445", "0.8430594", "0.8330235", "0.8084008", "0.8032695", "0.8024104", "0.78489286", "0.77927464", "0.7599451", "0.7428057", "0.74210066", "0.73958105", "0.7356557", "0.7315471", "0.7311111", "0.73058695", "0.72782797", "0.72395045", "0.72323185", "0.72276163", "0.7195...
0.88828486
0
Looks in config for legal server key, subkeys servername, username, and password then calls _ls_submit_online_intake with those values
def ls_submit_online_intake(params, task=None): servername = daconfig.get('legal server',{}).get('servername') username = daconfig.get('legal server',{}).get('username') password = daconfig.get('legal server',{}).get('password') return _ls_submit_online_intake(servername, username, password, params,task...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_ask_configs(config):\n\n if config.confluence_ask_user:\n print('(request to accept username from interactive session)')\n print(' Instance: ' + config.confluence_server_url)\n\n default_user = config.confluence_server_user\n u_str = ''\n if default_user:\n ...
[ "0.56631404", "0.5535071", "0.5369914", "0.53243005", "0.5206058", "0.51868904", "0.5166714", "0.51451874", "0.51194465", "0.5114242", "0.5108081", "0.50908875", "0.5070005", "0.50454277", "0.5037076", "0.50222623", "0.5017046", "0.49983636", "0.49888188", "0.49842295", "0.49...
0.6626169
0
Computes IoU overlaps between two sets of masks.
def compute_overlaps_masks(masks1, masks2): # If either set of masks is empty return empty result if masks1.shape[-1] == 0 or masks2.shape[-1] == 0: return np.zeros((masks1.shape[-1], masks2.shape[-1])) # flatten masks and compute their areas masks1 = np.reshape(masks1 > .5, (-1, masks1.sha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_overlaps(boxes1, boxes2):\n # Areas of anchors and GT boxes\n area1 = (boxes1[:, 2] - boxes1[:, 0]) * (boxes1[:, 3] - boxes1[:, 1])\n area2 = (boxes2[:, 2] - boxes2[:, 0]) * (boxes2[:, 3] - boxes2[:, 1])\n\n # Compute overlaps to generate matrix [boxes1 count, boxes2 count]\n # Each cell...
[ "0.7274957", "0.7274957", "0.7274957", "0.71368843", "0.7078123", "0.690092", "0.68660337", "0.684559", "0.68321913", "0.68063563", "0.67350006", "0.67350006", "0.66618323", "0.65612245", "0.65596884", "0.6539915", "0.6460802", "0.645651", "0.64440256", "0.6385012", "0.634447...
0.75193983
0
Performs nonmaximum suppression and returns indices of kept boxes.
def non_max_suppression(boxes, scores, threshold): assert boxes.shape[0] > 0 if boxes.dtype.kind != "f": boxes = boxes.astype(np.float32) # Compute box areas y1 = boxes[:, 0] x1 = boxes[:, 1] y2 = boxes[:, 2] x2 = boxes[:, 3] area = (y2 - y1) * (x2 - x1) # Get indicies of b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_maximum_suppression(boxes):\n\n boxes = sorted(boxes, key=lambda box: box[2]-box[0], reverse=True)\n nms_boxes = []\n overlap_threshold = 0.5\n\n for box in boxes:\n if not any([overlap_between(box, nms_box) > overlap_threshold for nms_box in nms_boxes]):\n nms_boxes.append(bo...
[ "0.70608395", "0.69983155", "0.6976223", "0.67720497", "0.67435426", "0.6703019", "0.6653769", "0.66231835", "0.654032", "0.65133655", "0.64524907", "0.6440792", "0.6414008", "0.6377664", "0.63635045", "0.6159006", "0.6144057", "0.6129111", "0.6109921", "0.60739964", "0.60683...
0.7059315
1
Applies the given deltas to the given boxes.
def apply_box_deltas(boxes, deltas): boxes = boxes.astype(np.float32) # Convert to y, x, h, w height = boxes[:, 2] - boxes[:, 0] width = boxes[:, 3] - boxes[:, 1] center_y = boxes[:, 0] + 0.5 * height center_x = boxes[:, 1] + 0.5 * width # Apply deltas center_y += deltas[:, 0] * height ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_deltas(self, deltas, boxes):\r\n assert torch.isfinite(deltas).all().item(), \"Box regression deltas become infinite or NaN!\"\r\n boxes = boxes.to(deltas.dtype)\r\n\r\n TO_REMOVE = 1 # TODO remove\r\n widths = boxes[:, 2] - boxes[:, 0] + TO_REMOVE\r\n heights = boxes[...
[ "0.7569099", "0.7402683", "0.7402683", "0.6315952", "0.6241788", "0.61341137", "0.6114744", "0.5946799", "0.59326583", "0.5875315", "0.5871217", "0.5838033", "0.5749699", "0.5743597", "0.571185", "0.55955154", "0.5593027", "0.55822027", "0.55420786", "0.55410147", "0.54427934...
0.7714714
0
Compute refinement needed to transform box to gt_box. box and gt_box are [N, (y1, x1, y2, x2)]
def box_refinement_graph(box, gt_box): box = tf.cast(box, tf.float32) gt_box = tf.cast(gt_box, tf.float32) height = box[:, 2] - box[:, 0] width = box[:, 3] - box[:, 1] center_y = box[:, 0] + 0.5 * height center_x = box[:, 1] + 0.5 * width gt_height = gt_box[:, 2] - gt_box[:, 0] gt_widt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box_refinement(box, gt_box):\n box = box.astype(np.float32)\n gt_box = gt_box.astype(np.float32)\n\n height = box[:, 2] - box[:, 0]\n width = box[:, 3] - box[:, 1]\n center_y = box[:, 0] + 0.5 * height\n center_x = box[:, 1] + 0.5 * width\n\n gt_height = gt_box[:, 2] - gt_box[:, 0]\n gt...
[ "0.7865797", "0.76733476", "0.618014", "0.5994145", "0.59115374", "0.5832164", "0.5813795", "0.579934", "0.57544625", "0.5738981", "0.56627333", "0.5630207", "0.5575435", "0.5548591", "0.5529105", "0.55070585", "0.54973537", "0.5483298", "0.5456566", "0.54436886", "0.5419322"...
0.767776
1
Compute refinement needed to transform box to gt_box. box and gt_box are [N, (y1, x1, y2, x2)]. (y2, x2) is assumed to be outside the box.
def box_refinement(box, gt_box): box = box.astype(np.float32) gt_box = gt_box.astype(np.float32) height = box[:, 2] - box[:, 0] width = box[:, 3] - box[:, 1] center_y = box[:, 0] + 0.5 * height center_x = box[:, 1] + 0.5 * width gt_height = gt_box[:, 2] - gt_box[:, 0] gt_width = gt_box...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box_refinement(box, gt_box):\n\n width = box[:, 2] - box[:, 0]\n height = box[:, 3] - box[:, 1]\n center_x = box[:, 0] + 0.5 * width\n center_y = box[:, 1] + 0.5 * height\n\n gt_width = gt_box[:, 2] - gt_box[:, 0]\n gt_height = gt_box[:, 3] - gt_box[:, 1]\n gt_center_x = gt_box[:, 0] + 0.5...
[ "0.7610481", "0.75958043", "0.6040042", "0.5797379", "0.5750006", "0.5604143", "0.55847067", "0.5577789", "0.5542151", "0.54945785", "0.54490364", "0.5434252", "0.54194343", "0.5370828", "0.5370079", "0.5363147", "0.53103286", "0.5297801", "0.5276397", "0.5259239", "0.5253485...
0.7863669
0
Resizes a mask using the given scale and padding. Typically, you get the scale and padding from resize_image() to ensure both, the image and the mask, are resized consistently.
def resize_mask(mask, scale, padding, crop=None): # Suppress warning from scipy 0.13.0, the output shape of zoom() is # calculated with round() instead of int() with warnings.catch_warnings(): warnings.simplefilter("ignore") mask = scipy.ndimage.zoom(mask, zoom=[scale, scale, 1], order=0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_mask(mask, scale, padding):\n h, w = mask.shape[:2]\n mask = scipy.ndimage.zoom(mask, zoom=[scale, scale, 1], order=0)\n mask = np.pad(mask, padding, mode='constant', constant_values=0)\n return mask", "def fixed_scale(im, inst_masks, mask, boxes, classes, target_h, target_w):\n h, w, c...
[ "0.7886953", "0.6024971", "0.601013", "0.59956163", "0.59815747", "0.5902877", "0.5891884", "0.5891884", "0.5866327", "0.5845942", "0.5541372", "0.55336607", "0.55139524", "0.5509066", "0.5439005", "0.54368395", "0.5432924", "0.5407946", "0.54037696", "0.5389475", "0.53850484...
0.75246656
1
Generate anchors at different levels of a feature pyramid. Each scale is associated with a level of the pyramid, but each ratio is used in all levels of the pyramid.
def generate_pyramid_anchors(scales, ratios, feature_shapes, feature_strides, anchor_stride): # Anchors # [anchor_count, (y1, x1, y2, x2)] anchors = [] for i in range(len(scales)): anchors.append(generate_anchors(scales[i], ratios, feature_shapes[i], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_anchors(base_size, scales, aspect_ratios):\n anchor = np.array([1, 1, base_size, base_size], dtype=np.float) - 0.5\n anchors = _ratio_enum(anchor, aspect_ratios)\n anchors = np.vstack(\n [_scale_enum(anchors[i, :], scales) for i in range(anchors.shape[0])]\n )\n return torch.fro...
[ "0.6872527", "0.65623045", "0.6540331", "0.65027565", "0.6455423", "0.64050436", "0.6319756", "0.61491024", "0.61491024", "0.6127928", "0.6111651", "0.5975255", "0.59621745", "0.593363", "0.593363", "0.59301746", "0.5921645", "0.5836477", "0.58142966", "0.577031", "0.5760737"...
0.7103498
0
Finds matches between prediction and ground truth instances.
def compute_matches(gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scores, pred_masks, iou_threshold=0.5, score_threshold=0.0): # Trim zero padding # TODO: cleaner to do zero unpadding upstream gt_boxes = trim_zeros(gt_boxes) gt_masks = gt_mask...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_detections(ground_truth, predictions, class_name, overlap_threshold=0.5,\n allow_multiple_matches_per_ignored=True,\n verbose=True):\n\n Detection = namedtuple('Detection', ['image', 'bbox', 'score', 'gt_match'])\n GT = namedtuple('GroundTruth', ['bb...
[ "0.6992981", "0.66807973", "0.64548296", "0.6320186", "0.62863857", "0.62353045", "0.60981554", "0.60942876", "0.59995085", "0.5991319", "0.5982584", "0.59579575", "0.59293205", "0.5912274", "0.59002244", "0.58984506", "0.5875461", "0.58587784", "0.5838439", "0.58294576", "0....
0.67443717
1
Compute AP over a range or IoU thresholds. Default range is 0.50.95.
def compute_ap_range(gt_box, gt_class_id, gt_mask, pred_box, pred_class_id, pred_score, pred_mask, iou_thresholds=None, verbose=1): # Default is 0.5 to 0.95 with increments of 0.05 iou_thresholds = iou_thresholds or np.arange(0.5, 1.0, 0.05) # Compute AP over r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolate_pr_auc(self):\n dtp = self.true_positives[:self.num_thresholds -\n 1] - self.true_positives[1:]\n p = self.true_positives + self.false_positives\n dp = p[:self.num_thresholds - 1] - p[1:]\n prec_slope = math_ops.div_no_nan(\n dtp, math_ops.maximum(dp,...
[ "0.6337302", "0.62020224", "0.5858441", "0.57893836", "0.570654", "0.5665017", "0.565793", "0.56508225", "0.56508225", "0.5629145", "0.56276184", "0.5604692", "0.5604692", "0.5554348", "0.5512706", "0.5496268", "0.5491129", "0.5452334", "0.545181", "0.5449995", "0.54353005", ...
0.7596389
0
Compute the recall at the given IoU threshold. It's an indication of how many GT boxes were found by the given prediction boxes.
def compute_recall(pred_boxes, gt_boxes, iou): # Measure overlaps overlaps = compute_overlaps(pred_boxes, gt_boxes) iou_max = np.max(overlaps, axis=1) iou_argmax = np.argmax(overlaps, axis=1) positive_ids = np.where(iou_max >= iou)[0] matched_gt_boxes = iou_argmax[positive_ids] recall = len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_recall(self, candidate_boxes=None, thresholds=None,\n area='all', limit=None):\n # Record max overlap value for each gt box\n # Return vector of overlap values\n areas = {'all': 0, 'small': 1, 'medium': 2, 'large': 3,\n '96-128': 4, '128-256': 5, '256-512': 6,...
[ "0.62621534", "0.61025965", "0.60362554", "0.5993026", "0.5992019", "0.598062", "0.59323263", "0.59282094", "0.5892321", "0.5827981", "0.5823096", "0.58173424", "0.5814973", "0.5813788", "0.5794595", "0.5781545", "0.5735283", "0.5735052", "0.57166195", "0.5709846", "0.5678209...
0.76745695
0
Splits inputs into slices and feeds each slice to a copy of the given computation graph and then combines the results. It allows you to run a graph on a batch of inputs even if the graph is written to support one instance only.
def batch_slice(inputs, graph_fn, batch_size, names=None): if not isinstance(inputs, list): inputs = [inputs] outputs = [] for i in range(batch_size): inputs_slice = [x[i] for x in inputs] output_slice = graph_fn(*inputs_slice) if not isinstance(output_slice, (tuple, list)):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_internal_graph(self, inputs, training=None, mask=None):\n # Note: masking support is relevant mainly for Keras.\n # It cannot be factored out without having the fully reimplement the network\n # calling logic on the Keras side. We choose to incorporate it in\n # Network because 1) it may be us...
[ "0.63945144", "0.6256652", "0.6116395", "0.610563", "0.60253406", "0.59494936", "0.5906976", "0.58991504", "0.5889422", "0.5747426", "0.572625", "0.57195914", "0.57115", "0.5608972", "0.56036955", "0.55904204", "0.55904204", "0.5562665", "0.55203986", "0.5502477", "0.54940283...
0.6462404
0
Download COCO trained weights from Releases.
def download_trained_weights(coco_model_path, verbose=1): if verbose > 0: print("Downloading pretrained model to " + coco_model_path + " ...") with urllib.request.urlopen(COCO_MODEL_URL) as resp, open(coco_model_path, 'wb') as out: shutil.copyfileobj(resp, out) if verbose > 0: print(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_pretrained_weights(env_name):\n print('Downloading model weights to ')\n os.system('mkdir -p %s' % MODEL_CACHE_DIR)\n os.system('cd \"%s\" && curl -s -S \"%s\" > %s' %\n (MODEL_CACHE_DIR, ENV_TO_URL[env_name], ENV_TO_FNAME[env_name]))", "def download():\n basedir = os.path.dirname(o...
[ "0.6020204", "0.5707817", "0.55433", "0.5521925", "0.542334", "0.5288183", "0.5267926", "0.52549994", "0.51362795", "0.5122463", "0.51079065", "0.5062796", "0.5055925", "0.50515425", "0.50506604", "0.50467", "0.50458384", "0.50201833", "0.5007972", "0.49885204", "0.4973859", ...
0.6550675
0
Makes the comparison between the areas found by the fronts and the hand drawn fronts
def fast_comparison(path = "Data/data_fronts/",path1 = "Results/modified_images/fronts/"): #computes the areas for the first frame in order to normalize the other areas pol0dx = grid(path1+"m_0.png_dx.txt") pol0dx.columns = ["y","x"] pol0sx = grid(path1+"m_0.png_sx.txt") pol0sx.columns = ["y","x"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compareAreas(self):\n self.play(area_ABE_copy.animate.move_to(RIGHT*2).scale(0.5),\n area_ABD_copy.animate.move_to(RIGHT*3.45).scale(0.5),\n area_ABC_copy.animate.move_to(RIGHT*5.3).scale(0.5))\n \n global geq_1, geq_2\n geq_1 = always_redraw(\n ...
[ "0.66837907", "0.6575163", "0.6263167", "0.58445203", "0.56722116", "0.56547314", "0.56170374", "0.55234486", "0.54833543", "0.54306924", "0.54007286", "0.53672487", "0.5356115", "0.5355021", "0.53413737", "0.5333159", "0.53326285", "0.53160363", "0.5291504", "0.52766323", "0...
0.6605803
1
Computes the error between two arrays of areas in L^2
def error(area, area_hand): #computes the error in L^2 between the two areas error = np.sqrt((area - area_hand)**2) return np.array(error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_error(d1, d2):\n square_sum = 0.0\n for i in range(len(d1)):\n square_sum += pow( distributions_EMD(d1[i], d2[i]), 2)\n return math.sqrt(square_sum)", "def l2_error(dist_orig, dist_proj):\n return torch.mean((dist_orig - dist_proj) ** 2).item()", "def l2_error(self, X=None, y=N...
[ "0.65325993", "0.63615954", "0.6179437", "0.609222", "0.605296", "0.6028187", "0.599732", "0.5983641", "0.5969193", "0.5934326", "0.5855971", "0.5838469", "0.5831721", "0.57680076", "0.57575697", "0.57521516", "0.57331836", "0.5730827", "0.5712154", "0.5709225", "0.57017916",...
0.7461862
0
Computes the velocity of the fronts. Since the Delta t is defined by the single frame, the velocity of the front results to be only the difference between the final and the initial position between two frames
def velocity(df0, df1): velocity = df1 - df0 return velocity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_frame_vels(self):\n num_frames = self.get_num_frames()\n frame_vel_size = self.get_frame_vel_size()\n dt = self.get_frame_duration()\n frame_vels = np.zeros([num_frames, frame_vel_size])\n\n for f in range(num_frames - 1):\n frame0 = self.get_frame(f)\n frame1 = self.get_frame(f ...
[ "0.6244868", "0.61821187", "0.60186166", "0.6012535", "0.597797", "0.59639156", "0.5961367", "0.5956541", "0.5949349", "0.5946402", "0.5931904", "0.5884024", "0.5822902", "0.578919", "0.57804185", "0.5740533", "0.5727816", "0.56713223", "0.56561303", "0.56134444", "0.55979645...
0.6255532
0
Computes the Velocity Autocorrelation Fuction (VACF) which is the correlation between the velocities of the fronts
def VACF(df,conversion = "x"): #conversion from pixels to micrometers if conversion == "y": df = df/1200*633 else: df = df/1600*844 #computes the velocity in one direction between the frames dif = pd.DataFrame() for i in range(1,len(df.T)): dif[i-1] = velocity(df[i-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arma_acf(ar, ma, lags=10):\n acovf = arma_acovf(ar, ma, lags)\n return acovf / acovf[0]", "def to_acf(self):\n rho = 0.5*np.fft.irfft(self) / self.delta_t\n return AutoCovariance(rho, delta_t=self.delta_t)", "def acorrelation(X):\r\n C = acovariance(X)\r\n V = N.diagonal(C)\r\n ...
[ "0.6702072", "0.66773623", "0.6595808", "0.63585", "0.621406", "0.6199433", "0.6074216", "0.5957068", "0.5952068", "0.59308684", "0.58676976", "0.5809938", "0.5808968", "0.5808968", "0.57998204", "0.57998204", "0.5779451", "0.5774701", "0.5768634", "0.57117593", "0.5701248", ...
0.7130035
0
Returns the size of the QTable
def get_Q_size(self): return len(self.qTable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_size(self):\n return len(self.table)", "def Size(self):\n return _table.Table_Size(self)", "def get_table_size(self):\r\n return self.table_size", "def __len__(self) -> int:\n return len(self._table)", "def __len__(self) -> int:\n return len(self.table)", "def n...
[ "0.84217036", "0.8339136", "0.8243864", "0.7573548", "0.756553", "0.75452423", "0.72798103", "0.72645706", "0.722", "0.7214287", "0.71470475", "0.70735765", "0.7053196", "0.70288885", "0.70014083", "0.69187534", "0.69187534", "0.68950015", "0.6887229", "0.6842048", "0.6799798...
0.8351228
1
[API router to undeploy a AutoML model]
async def undeploy_model( undeploy_model_request: ManageModel, token: str = Depends(oauth2_scheme), ): try: logging.info("Calling /gcp/automl/undeploy_model endpoint") logging.debug(f"Request: {undeploy_model_request}") if decodeJWT(token=token): response = ManageModelCon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UndeployModel(self, request, global_params=None):\n config = self.GetMethodConfig('UndeployModel')\n return self._RunMethod(\n config, request, global_params=global_params)", "def unload_model(app: FastAPI) -> None:\n\n logging.info(\"Shuting down the app\")\n app.state.model = None"...
[ "0.73572034", "0.65931576", "0.6241049", "0.6191326", "0.61793065", "0.61463386", "0.60557854", "0.6005815", "0.6002277", "0.58911914", "0.5883165", "0.5864652", "0.583561", "0.58052224", "0.5799982", "0.5774924", "0.5772157", "0.57606065", "0.5738826", "0.5733435", "0.567713...
0.73963165
0
Instantiates the publisher service client.
def __init__( self, *, credentials: ga_credentials.Credentials = None, transport: Union[str, PublisherServiceTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_setup(self):\n self.client = Client()", "def _CreatePubsubClient():\n client = pubsub_client.PubSubClient()\n client.CreateTopic(DEVICE_NOTE_PUBSUB_TOPIC)\n client.CreateTopic(HOST_NOTE_PUBSUB_TOPIC)\n return client", "def create_client(self) -> None:\n pass", "def create_client(self...
[ "0.6814219", "0.6603148", "0.6296222", "0.6273346", "0.6272793", "0.6184935", "0.6142706", "0.6142319", "0.61270845", "0.6113662", "0.6101793", "0.60950136", "0.6036625", "0.60295045", "0.6023517", "0.6020195", "0.5991119", "0.59851164", "0.5982286", "0.59499663", "0.59193116...
0.7053379
0
Converts given value to long if possible, otherwise None is returned.
def field_to_long(value): if isinstance(value, (int, long)): return long(value) elif isinstance(value, basestring): return bytes_to_long(from_hex(value)) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_long_int(val):\n return long(val) if six.PY2 else int(val)", "def to_long(x):\n if isinstance(x, long):\n return x\n elif isinstance(x, int):\n return long(x)\n else:\n return bytes_to_long(to_bytes(x))", "def getLong(t, swipl):\n i = c_long()\n if swipl.PL_get_long(...
[ "0.74933696", "0.715573", "0.67231256", "0.6618173", "0.6471894", "0.6345347", "0.6273417", "0.6199922", "0.6176904", "0.6092171", "0.6039979", "0.59916466", "0.5962227", "0.59519756", "0.59280604", "0.58702356", "0.5813299", "0.57505965", "0.57384586", "0.57117707", "0.57028...
0.8211291
0
Extracts textual status from the response statusdetail, if present. Otherwise extracts status field.
def get_text_status(json): if json is None: return None elif 'statusdetail' in json: return json['statusdetail'] elif 'status' in json: return json['status'] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_status(self, status_headers):\n self.status = status_headers.get_statuscode()\n if not self.status:\n self.status = '-'", "def extract_status(self, status) -> None:\r\n if \"VehicleInfo\" in status:\r\n if \"RemoteHvacInfo\" in status[\"VehicleInfo\"]:\r\n ...
[ "0.71241224", "0.69161105", "0.64333415", "0.6411626", "0.637063", "0.633951", "0.6296589", "0.6296589", "0.62450236", "0.6228615", "0.6178295", "0.616995", "0.6121935", "0.60539556", "0.6043532", "0.6018284", "0.59186006", "0.5911772", "0.5887343", "0.5886755", "0.5885079", ...
0.7453901
0
return next larger sparse number
def next_sparse(sparse_number): # print("sparse_number 0b{0:b}".format(sparse_number)) # Edge case. Handle explicitly for clarity if sparse_number == 0: return 1 power_max = twos_power_max(sparse_number) for power in range(0, power_max): # print("power", power) if is_zero...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_sparse_incremental(sparse_number):\n\n\n # limit is arbitrary in Python\n # http://stackoverflow.com/questions/5470693/python-number-limit\n limit = 2 ** 32\n for possible_sparse in range(sparse_number + 1, limit):\n if is_sparse(possible_sparse):\n return possible_sparse\n ...
[ "0.7672728", "0.61580247", "0.61358225", "0.60774994", "0.59932333", "0.58844113", "0.58825076", "0.58825076", "0.5832039", "0.5826069", "0.56333584", "0.56146306", "0.55914325", "0.55845207", "0.55805635", "0.55033994", "0.5497962", "0.5486491", "0.547879", "0.5476193", "0.5...
0.74779063
1
return next larger sparse number
def next_sparse_incremental(sparse_number): # limit is arbitrary in Python # http://stackoverflow.com/questions/5470693/python-number-limit limit = 2 ** 32 for possible_sparse in range(sparse_number + 1, limit): if is_sparse(possible_sparse): return possible_sparse return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_sparse(sparse_number):\n\n # print(\"sparse_number 0b{0:b}\".format(sparse_number))\n\n # Edge case. Handle explicitly for clarity\n if sparse_number == 0:\n return 1\n\n power_max = twos_power_max(sparse_number)\n\n for power in range(0, power_max):\n # print(\"power\", power...
[ "0.7477969", "0.61573946", "0.613509", "0.60775334", "0.5992545", "0.58828956", "0.588183", "0.588183", "0.5831891", "0.5825192", "0.56328684", "0.56140053", "0.559014", "0.5583566", "0.5578744", "0.55031174", "0.5497666", "0.548524", "0.5477917", "0.5475614", "0.5440766", ...
0.7672149
0
return True if number binary digit 1s have no adjacent 1s.
def is_sparse(number): if number == 0: return True if number == 1: # edge case. List explicitly for clarity. Define to be True return True else: bits = bits_list(number) # start power_of_2 at 1 so previous_bit index won't be out of list range for power_of_2 i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onlyonepositive(a):\n nbr = 0\n for e in a:\n if e >= 0: \n nbr += 1\n if nbr>1: return False\n return nbr==1", "def count_ones(value):\n return bin(value).count('1')", "def __nonzero__(self):\n for e in self:\n if e != 0:\n return T...
[ "0.6595635", "0.6540053", "0.6482591", "0.63950247", "0.63907003", "0.6204543", "0.61807245", "0.6171981", "0.61649305", "0.6097352", "0.6066647", "0.60572785", "0.6053024", "0.60443586", "0.6039504", "0.60368466", "0.6022546", "0.6005996", "0.5991123", "0.59874594", "0.59751...
0.6741046
0
return list of bits in number
def bits_list(number): # https://wiki.python.org/moin/BitManipulation if number == 0: return [0] else: # binary_literal string e.g. '0b101' binary_literal = bin(number) bits_string = binary_literal.lstrip('0b') # list comprehension bits = [int(bit_character) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitlist(n):\n return [n >> i & 1 for i in range(7,-1,-1)]", "def _bits(num):\r\n return bin(int(num))[2:]", "def binary_encoding(k: int, bit_number: int=10) -> List[int]:\n return [k>>i & 1 for i in range(bit_number)]", "def __get_bit_values(self, number, size=32):\n res = list(self._...
[ "0.8127424", "0.8050236", "0.7666614", "0.75274515", "0.7512719", "0.7469839", "0.7446176", "0.7345393", "0.7344313", "0.7332414", "0.72998476", "0.7210258", "0.71295255", "0.7124242", "0.70642513", "0.70642513", "0.7048847", "0.7041419", "0.7011808", "0.69538057", "0.688378"...
0.8186028
0
return bit in number at location 2 exponent
def bit_at_twos_power(number, exponent): bits = bits_list(number) # NOTE: reverse() modifies object, returns None bits.reverse() if exponent > (len(bits) - 1): return 0 else: return bits[exponent]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bit(num, position):\n\treturn (num >> position) & 0b1", "def _get_bit(self, num, bit, mask=1):\n return (int(num) >> bit) & mask", "def get_bit(num, i):\r\n return 1 if num & 1 << i else 0", "def power_of_2(c):\n return n & (n - 1) == 0", "def _find_nearest_power_of_two(x):\n\n retu...
[ "0.74136764", "0.6971582", "0.68619984", "0.68498963", "0.6782197", "0.6750494", "0.6733378", "0.67329884", "0.6702873", "0.6669386", "0.66691667", "0.66691667", "0.6624408", "0.6621196", "0.657315", "0.6546286", "0.6543188", "0.65373", "0.65147185", "0.6459624", "0.64361835"...
0.72224295
1
return highest power of two in number
def twos_power_max(number): bits = bits_list(number) return len(bits) - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_power2(num):\n return 2 ** int(np.ceil(np.log2(num)))", "def _find_nearest_power_of_two(x):\n\n return 1 << (x - 1).bit_length()", "def _nearest_bigger_power_of_two(x: int) -> int:\n y = 2\n while y < x:\n y *= 2\n return y", "def _next_power_of_two(self, n):\n if n == 0...
[ "0.7722803", "0.77092505", "0.7696812", "0.75224876", "0.7414126", "0.7350261", "0.72898906", "0.72811985", "0.7175145", "0.7173635", "0.7150411", "0.71332145", "0.71239346", "0.71106535", "0.7095859", "0.7025772", "0.7020954", "0.69823575", "0.69276136", "0.6903265", "0.6882...
0.78875387
0
Format an AWS instance's metadata for reporting.
def format_aws_instance(cls, aws_instance): instance_id = "Instance ID: {instance}".format(instance=aws_instance[0]) # NOQA aws_account = "AWS Account: {account}".format(account=aws_instance[1]["aws_account"]) # NOQA aws_region = "AWS Region: {region}".format(region=aws_instance[1]["aws_region...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_aws_instance_csv(cls, aws_instance):\n result = {\"instance_id\": aws_instance[0],\n \"aws_account\": aws_instance[1][\"aws_account\"],\n \"aws_region\": aws_instance[1][\"aws_region\"],\n \"key_name\": aws_instance[1][\"key_name\"],\n ...
[ "0.6706454", "0.6214005", "0.58400214", "0.57573223", "0.5682506", "0.5593217", "0.5534054", "0.5494629", "0.54934895", "0.5475465", "0.5431762", "0.54230183", "0.5374503", "0.53482795", "0.53469235", "0.5299905", "0.5294458", "0.527383", "0.51930857", "0.5163742", "0.5160937...
0.70394367
0
Format an AWS instance's metadata for reporting in CSV format.
def format_aws_instance_csv(cls, aws_instance): result = {"instance_id": aws_instance[0], "aws_account": aws_instance[1]["aws_account"], "aws_region": aws_instance[1]["aws_region"], "key_name": aws_instance[1]["key_name"], "launch_time": aw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_aws_instance(cls, aws_instance):\n instance_id = \"Instance ID: {instance}\".format(instance=aws_instance[0]) # NOQA\n aws_account = \"AWS Account: {account}\".format(account=aws_instance[1][\"aws_account\"]) # NOQA\n aws_region = \"AWS Region: {region}\".format(region=aws_instanc...
[ "0.6753999", "0.6415332", "0.56931126", "0.5526823", "0.5469592", "0.54025054", "0.5367501", "0.5292463", "0.5250131", "0.52448654", "0.52434593", "0.5198777", "0.51984173", "0.51540196", "0.51104605", "0.51003814", "0.50938004", "0.50337195", "0.5009848", "0.50069076", "0.49...
0.747481
0
Adds a player to the tournament database. The database assigns a unique serial id number for the player. (This should be handled by your SQL database schema, not in your Python code.)
def registerPlayer(name): # gets connection to tournament database in conn object conn = connect() # gets the cursor to execute queries c = conn.cursor() # executes insert query which takes the name variable passed in arguments # of this method and adds a new player record to PLAYER table where ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registerPlayer(playerName):\n\n tournName = \"Tournament for legacy tests\"\n\n # Connect to database\n conn, c = main.connect()\n\n # Insert a new player with this name\n SQL = \"INSERT INTO player (playerName) values (%s);\"\n data = (playerName, )\n c.execute(SQL, data)\n\n # If the ...
[ "0.7571331", "0.7488418", "0.7460844", "0.7456452", "0.7349081", "0.73410213", "0.730657", "0.72664267", "0.7244713", "0.7213591", "0.71821433", "0.71512973", "0.7140019", "0.71207255", "0.71172535", "0.70993054", "0.707552", "0.7067138", "0.7055108", "0.70531744", "0.7027579...
0.7729972
0
Returns a list of pairs of players for the next round of a match. Assuming that there are an even number of players registered, each player appears exactly once in the pairings. Each player is paired with another player with an equal or nearlyequal win record, that is, a player adjacent to him or her in the standings.
def swissPairings(): # retreives player standings i.e. id, player, wins, matches standings = playerStandings() # pairs for next round are stored in this array. next_round = [] # iterates on the standings results. As the results are already in # descending order, the pairs can be made using adja...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swissPairings():\n\n # Ok This is where things get interesting, how in the world should i solve this problem\n # A question to the udacity reviewer. Shouldn't standings be passed in to this function since weve already called it in tournament_test.testPairings\n\n #anyways\n\n nextRoundPlayers = []\...
[ "0.8103197", "0.7787016", "0.7717939", "0.76245844", "0.76115", "0.7596688", "0.7552793", "0.7453131", "0.7419286", "0.738509", "0.7381597", "0.72125864", "0.71837986", "0.714855", "0.7069176", "0.7043194", "0.7003615", "0.69710374", "0.6970802", "0.6916647", "0.6875584", "...
0.80501574
1
Adds two Reco objects, returns a Reco object.
def addReco(obj1,obj2): px = obj1.px + obj2.px py = obj1.py + obj2.py pz = obj1.pz + obj2.pz E = obj1.E + obj2.E return Reco(px,py,pz,E)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other):\n new = self.__class__()\n new.extend(self)\n new.extend(other)\n return new", "def __radd__(self, other):\n return self.runtime.add(self, other)", "def __add__(self, other):\n return self.add(other)", "def __radd__(self, other):\n\n ...
[ "0.6708373", "0.6588393", "0.6587373", "0.6527081", "0.6519195", "0.6519195", "0.6518886", "0.65113086", "0.6482993", "0.6482993", "0.6482993", "0.6482993", "0.6482993", "0.6482993", "0.6482993", "0.6479999", "0.6457409", "0.6420922", "0.6420922", "0.6419211", "0.6409279", ...
0.7727639
0
Converts a Reco object to a string.
def stringReco(obj): name = obj.get_name() name = obj._pid if (name is None) else name return ("pdg: " + name + " E: " + str(obj._E) + " px: " + str(obj._px) + " py: " + str(obj._py) + " pz: "+ str(obj._pz) + " mass: " + str(obj._m))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_(object_):\n return str(object_)", "def value_to_string(self, obj):\n value = self.value_from_object(obj)\n return value", "def _tostr(obj): # pragma: no cover\n return obj if isinstance(obj, str) else obj.decode()", "def obj_to_string(rental):\n string = rental.id + ';' +...
[ "0.6829037", "0.6601121", "0.6591872", "0.65873903", "0.6571199", "0.6557375", "0.6517904", "0.6511437", "0.6509183", "0.6501627", "0.64991844", "0.6456585", "0.636783", "0.636783", "0.636783", "0.6255697", "0.6255697", "0.624381", "0.62436426", "0.6181675", "0.6174107", "0...
0.6945018
0
Sends an email to the user who requested a new password or a confirmation email to a user who has reset his or her password. If email and password is set, a mail is sent to a newly registrated user. If email and token is set, a request to reset password is sent to the user with a link and a temporary token. If only the...
def email_user(to_email, password=None, token=None): try: if password and token: raise Exception('No email has been sent. Both token and password is set.') mail = Mail(APP) if to_email and password: message = Message( 'Resel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_emails():\n email = request.data['email'].strip()\n user = User.query.filter_by(email=email).first()\n option = \\\n request.data['option'].strip() # have a <select> in the frontend\n token = s.dumps(email, salt='email-confirm')\n\n msg = Message('Reset pass...
[ "0.7728737", "0.7559589", "0.748966", "0.7445745", "0.7434668", "0.7403786", "0.7355636", "0.7344078", "0.7325047", "0.7311936", "0.72110546", "0.7201742", "0.71804917", "0.7156649", "0.7125851", "0.7121934", "0.71122754", "0.70608777", "0.7039746", "0.69806916", "0.6928046",...
0.77339584
0
Uploads outfile to the storage element at dst_url under output directory outdir, returns 0 on success, raises an exception on error.
def upload(outfile, outdir): outpath = outdir + "/" + outfile my_env = os.environ.copy() my_env["X509_USER_PROXY"] = dst_cred for retry in range(0,99): try: subprocess.check_output(["globus-url-copy", "-create-dest", "-rst", "-stall-timeout", "300", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, url, output):\n\n shutil.copy2(self.get(url), output)", "def putFile(self, _src, _dst, delExisting = True):\n\n #-------------------- \n # Delete existing _dst from XNAT host.\n #-------------------- \n if delExisting:\n r = self.__...
[ "0.63402486", "0.6235955", "0.61301994", "0.6048785", "0.6006344", "0.5978161", "0.59224904", "0.58591557", "0.5799578", "0.5667479", "0.56134206", "0.56105936", "0.5528729", "0.54942703", "0.54917186", "0.5471971", "0.5471403", "0.5466291", "0.54457706", "0.5421599", "0.5386...
0.72268885
0
Merge the output hddm files from the individual jobs into a single hddm file for each input raw data file. Returns 0 on success, nonzero on error.
def merge_hddm_output(run, seqno, slices): inset = {"REST": "dana_rest.hddm", "converted_random": "converted_random.hddm", } outset = {"REST": "dana_rest_{0:06d}_{1:03d}.hddm", "converted_random": "converted_random_{0:06d}_{1:03d}.hddm", } badslices = [] slice...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_output_files(self):\n namenode = self.runner.namenode\n for i in range(self.cnt_reducers):\n fname = '%s.%s' % (self.output_dir, reduce_output(self.id, i))\n namenode.create_file(fname)\n self.result_files.append(fname)\n self.open_files.append(f...
[ "0.64265794", "0.63644433", "0.6353053", "0.60704476", "0.6045988", "0.60319865", "0.598607", "0.59759074", "0.5901085", "0.58970237", "0.5886435", "0.5850782", "0.57940143", "0.5781016", "0.5780351", "0.5770798", "0.576806", "0.5740822", "0.57112277", "0.570429", "0.56991875...
0.6682864
0
Return true if it's a JavaScript source.
def test_js_source(self): actual = is_js_source(self.view) self.assertTrue(actual)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_js_source(self):\n self.view.set_syntax_file(\"Packages/Python/Python.tmLanguage\")\n\n actual = is_js_source(self.view)\n\n self.assertFalse(actual)", "def is_js_file(fname):\r\n return REJS.search(fname) and \\\r\n TEST_INDICATOR not in fname", "def isJsFile(path):...
[ "0.72429377", "0.6709106", "0.66963446", "0.64444417", "0.62756056", "0.6237253", "0.6226813", "0.6111022", "0.5996234", "0.5935359", "0.58793366", "0.5862295", "0.58062017", "0.5804725", "0.5759924", "0.566558", "0.56178796", "0.5614935", "0.55970407", "0.55769956", "0.55665...
0.7687013
0
Return false if it's not a JS source.
def test_non_js_source(self): self.view.set_syntax_file("Packages/Python/Python.tmLanguage") actual = is_js_source(self.view) self.assertFalse(actual)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_js_source(self):\n actual = is_js_source(self.view)\n\n self.assertTrue(actual)", "def is_js_file(fname):\r\n return REJS.search(fname) and \\\r\n TEST_INDICATOR not in fname", "def isJsFile(path):\n return os.path.splitext(path)[1] == '.js'", "def has_source_file( self ):...
[ "0.7866086", "0.6981806", "0.68132186", "0.6648081", "0.63434523", "0.62751704", "0.62293243", "0.61936146", "0.6170908", "0.6103844", "0.60846484", "0.60547394", "0.6031727", "0.6030578", "0.5997301", "0.5979819", "0.5919813", "0.58965653", "0.5846535", "0.58112514", "0.5780...
0.7661912
1
Simple test of applyFunction() function. The function we'll apply is exp(x) so this is equivalent to the test_exp tests above
def test_applyFunction(self): ptwise_linear = XYs1d(axes=XYs1d.defaultAxes(labelsUnits={ XYs1dModule.yAxisIndex: ('crossSection', 'b'), XYs1dModule.xAxisIndex: ('energy_in', 'eV')}), data=[[1e-5, 1.0], [20.0e6, 21.0]]) self.assertAlmostEqual(ptwise_linear.evaluate(15.0e6), 16.0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exp(self):\n funcs = ['exp', 'exp_']\n for func in funcs:\n tensor = get_random_test_tensor(max_value=2)\n encrypted = SharedTensor(tensor)\n reference = getattr(tensor, func)()\n encrypted_out = getattr(encrypted, func)()\n self._check(...
[ "0.63081706", "0.6230978", "0.61486775", "0.6126683", "0.6062297", "0.5937917", "0.5935332", "0.58760333", "0.5758355", "0.5745007", "0.5745007", "0.5663189", "0.5640548", "0.5635015", "0.5623988", "0.5621284", "0.55899805", "0.5588484", "0.5581032", "0.55406785", "0.5523366"...
0.73073655
0
Generates authentication signature and return it in a dictionary
def generate_auth_dict(self) -> Dict[str, str]: # api.exchange.bitcoin.com uses Basic Authentication https://api.exchange.bitcoin.com/#authentication message = self.api_key + ":" + self.secret_key signature = base64.b64encode(bytes(message, "utf8")).decode("utf8") return { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_signature(self):\n sig_contents = \\\n self.payload + \".\" + \\\n b64encode(b\"application/xml\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"base64url\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"RSA-SHA256\").decode(\"ascii\")\n sig_hash...
[ "0.6962848", "0.6560777", "0.63824123", "0.63468164", "0.62796557", "0.62087584", "0.6205923", "0.6185844", "0.61836755", "0.6151539", "0.61321473", "0.61204165", "0.60580724", "0.6041897", "0.60394365", "0.60393846", "0.60349697", "0.6024893", "0.6023378", "0.6000974", "0.59...
0.7768794
0
bspline basis function c = number of control points. n = number of points on the curve. degree = curve degree
def bspline_basis(c, n, degree): # Create knot vector and a range of samples on the curve kv = np.array([0] * degree + [i for i in range(c - degree + 1)] + [c - degree] * degree, dtype='int') # knot vector u = np.linspace(0, c - degree, n) # samples range # Cox - DeBoor recursive fu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bspline(cv, n=100, degree=3, periodic=False):\n cv = np.asarray(cv)\n count = cv.shape[0]\n\n # Closed curve\n if periodic:\n kv = np.arange(-degree,count+degree+1)\n factor, fraction = divmod(count+degree+1, count)\n cv = np.roll(np.concatenate((cv,) * factor + (cv[:fraction],...
[ "0.7293481", "0.7283197", "0.7199199", "0.6930515", "0.68969107", "0.68087196", "0.6772325", "0.67143494", "0.6530433", "0.6447313", "0.6427295", "0.63659334", "0.63659334", "0.6351063", "0.63298196", "0.6279631", "0.6192802", "0.61839586", "0.6183348", "0.6149349", "0.609567...
0.85616636
0
Parses needed information from HAAR training data in an XML
def haar_parser(): tree = ET.parse('haarcascade_frontalface_alt.xml') root = tree.getroot() stage_number = 0 for haar_data in root.findall('haarcascade_frontalface_alt'): for stage in haar_data.findall('stages'): for underscore in stage.findall('_'): for tree in und...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_train_data(training_set, language):\n print \"Reading training set: \" + training_set\n xmldoc = minidom.parse(training_set)\n lex_list = xmldoc.getElementsByTagName('lexelt')\n training_output = {}\n\n print \"Processing training set and training models...\"\n for node in lex_list:\n ...
[ "0.6703193", "0.60255843", "0.59246445", "0.5912362", "0.5693699", "0.56034493", "0.55347985", "0.5478435", "0.5460303", "0.5457903", "0.54251546", "0.5424459", "0.53948337", "0.5363094", "0.5358695", "0.5322238", "0.5317914", "0.5302025", "0.5210451", "0.5201718", "0.5198267...
0.688683
0
Should print the given configuration to stdout.
def test_print_config(self) -> None: out = io.StringIO() with contextlib.redirect_stdout(out): self.config.print() self.assertEqual( out.getvalue().rstrip(), "{}: {}\n{}".format("q2", "abcdefghij", "^".rjust(7)), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_configuration():\n configlog.info(\"-\" * 50)\n configlog.info(\"Initializing with the following configuration\")\n configlog.info(\"Check constants.py to change any of the following\")\n configlog.info(\"-\" * 50)\n configlog.info(\"COMPANY_NAME: {}\".format(COMPANY_NAME))\n configlog....
[ "0.7587259", "0.7523338", "0.7368167", "0.7342062", "0.7209493", "0.71788865", "0.7166884", "0.7094218", "0.6971661", "0.6958332", "0.6929667", "0.69253343", "0.6881229", "0.6872495", "0.6839328", "0.68237674", "0.67180383", "0.6690289", "0.6649938", "0.6621531", "0.65711033"...
0.7887999
0
Should be able to iterate over a Turing machine tape.
def test_tape_iteration(self) -> None: tape = TMTape( tape="abcdef", blank_symbol=".", current_position=2, ) self.assertEqual(tuple(tape), ("a", "b", "c", "d", "e", "f"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self) -> Iterator[str]:\n return iter(self.tape)", "def test_machine_get_tape(self):\n self.machine.add_state('0 ,R, ,R, ,R, a,N,!')\n self.machine.init_tape(' aba caba_caba caba ')\n assert self.machine.get_tape() == 'aba caba caba caba'", "def test_machine_i...
[ "0.62442267", "0.58754504", "0.56811714", "0.5394346", "0.5377582", "0.5257124", "0.52406955", "0.52118194", "0.51803154", "0.51783246", "0.5150232", "0.5150232", "0.51491994", "0.51241785", "0.51049644", "0.5098543", "0.5087977", "0.50546545", "0.5031224", "0.50128055", "0.5...
0.6964048
0
Opens a cloud manifest file at `path` Converts headers of file to lowercase since partners choose to capitalize arbitrarily returns dictionary
def read_data_from_cloud_manifest(path: str) -> dict: with open_cloud_file(path, 'r') as csv_file: def clean_file_header(header: str) -> str: return header.strip().lower() data_to_ingest = {'rows': []} csv_reader = csv.DictReader(csv_file, delimiter=",") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_manifest(path: Path):\n with open(path, \"rt\") as fin:\n data = json_load(fin)\n return Manifest.schema().load(data, many=True)", "def get_manifest(path: str):\n base_url = urlparse(path.strip(\"/\"))\n if base_url.scheme != \"s3\":\n raise click.UsageError(\n ...
[ "0.6254436", "0.5879989", "0.5814724", "0.5759604", "0.5759604", "0.56664675", "0.5661104", "0.56387746", "0.5431581", "0.5358934", "0.5356918", "0.52470446", "0.51743126", "0.5156279", "0.5142583", "0.51353735", "0.50975263", "0.5095046", "0.50825524", "0.50421375", "0.50267...
0.591603
1
Entrypoint for SMS Workflow execution. Creates a SmsJobController and determines which process to run
def execute_workflow(self): logging.info(f"called {self.job} with {self.file_type}") job_params = { "job": self.job, "job_run_dao": self.job_run_dao, "incident_dao": self.incident_dao, "subprocess": self.file_type } with SmsJobController(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startComponent(self):\n\n # create message service instance\n self.ms = MessageService()\n\n # register\n self.ms.registerAs(\"MergeAccountant\")\n\n # subscribe to messages\n self.ms.subscribeTo(\"MergeAccountant:StartDebug\")\n self.ms.subscribeTo(\"MergeAccou...
[ "0.56484526", "0.55505526", "0.5288705", "0.52483284", "0.5208785", "0.5174079", "0.51654077", "0.51620835", "0.5160946", "0.51558024", "0.5151097", "0.51483196", "0.51433206", "0.5128541", "0.51023465", "0.5086026", "0.5081889", "0.50711775", "0.50601345", "0.50407666", "0.5...
0.68931174
0
Process the adding of an emoji to a server.
async def process_add_emoji( emoji, emoji_name, user_id, ctx: commands.Context = None, inter: AppCmdInter = None, allowed_mentions=None, ): response_deferred = await defer_inter(inter) url = emoji if not isinstance(emoji, disnake.PartialEmoji) else emoji.url user = await User.get(use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def add_emoji(\n client,\n event,\n emoji: ('str', 'The emoji to add.'),\n name: ('str', 'Custom name to add the emoji with.') = None\n):\n if not client.is_owner(event.user):\n abort('Owner only!')\n \n emoji = parse_emoji(emoji)\n if emoji is None:\n abort('That\\'s no...
[ "0.67287016", "0.6683286", "0.6535552", "0.63595986", "0.61546665", "0.61545706", "0.6151", "0.6147468", "0.60753864", "0.602852", "0.5925072", "0.58887196", "0.5861602", "0.58516765", "0.57721126", "0.5765197", "0.57616425", "0.5761379", "0.56382954", "0.55763", "0.555645", ...
0.7052691
0
Send the command prefixes of a guild.
async def process_prefix_list( guild: disnake.Guild, ctx: commands.Context = None, inter: AppCmdInter = None, allowed_mentions=None, ): await create_guild_model(guild) guild = await Guild.get(guild.id) msg = f"The following are the custom prefixes for {guild.name}:\n" + ", ".join( gu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_guild_join(self, guild: discord.Guild):\n with open(\"./config/prefixes.json\", \"r\") as f:\n prefixes = json.load(f)\n\n prefixes[str(guild.id)] = \".\"\n\n with open(\"./config/prefixes.json\", \"w\") as f:\n json.dump(prefixes, f, indent=4)", "async def...
[ "0.72532135", "0.70512486", "0.6933154", "0.67259693", "0.66195005", "0.65402573", "0.65276223", "0.6477757", "0.6397897", "0.6349567", "0.63149333", "0.6312094", "0.62954944", "0.6294326", "0.62471807", "0.62218827", "0.6151493", "0.61468345", "0.61232364", "0.6099351", "0.6...
0.74725825
0
Autocomplete typing for the command prefixes in a guild.
async def auto_complete_type_guild_prefixes( inter: disnake.AppCmdInter, user_input: str ) -> List[str]: await create_guild_model(inter.guild) guild = await Guild.get(inter.guild_id) return guild.prefixes[:24]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def process_prefix_list(\n guild: disnake.Guild,\n ctx: commands.Context = None,\n inter: AppCmdInter = None,\n allowed_mentions=None,\n):\n await create_guild_model(guild)\n guild = await Guild.get(guild.id)\n msg = f\"The following are the custom prefixes for {guild.name}:\\n\" + \", \...
[ "0.6334425", "0.61928004", "0.59438735", "0.5882108", "0.58367133", "0.5759399", "0.56862473", "0.566724", "0.5637605", "0.5576028", "0.55751395", "0.55580425", "0.5514969", "0.54804295", "0.5447843", "0.54456246", "0.5445153", "0.54353315", "0.54343086", "0.53711796", "0.536...
0.79266447
0
Post the reaction roles message
async def reaction_roles_post(inter: MessageInteraction, description, roles): view = disnake.ui.View(timeout=None) for role in roles: view.add_item(disnake.ui.Button(label=role.name, custom_id=role.id)) messages = await send_message(msg=description, channel=inter.channel, view=view) for message ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def setroles(self, ctx):\n if not has_permissions(ctx, MOD_ROLE):\n await ctx.send(\"You do not have sufficient permissions to perform this command\", hidden=True)\n return False\n\n def check(m):\n return m.author == ctx.author\n\n roles_dict = {}\n ...
[ "0.70767516", "0.7048763", "0.70305854", "0.67609715", "0.66043484", "0.6424783", "0.63169235", "0.6300088", "0.6295008", "0.6281987", "0.62049335", "0.6064257", "0.605706", "0.60347486", "0.6028766", "0.6005439", "0.60031676", "0.5964373", "0.59568113", "0.5954478", "0.59193...
0.858319
0
Handles role reaction button presses. A 'on_button_click' listener.
async def handle_role_reaction_press(interaction: disnake.MessageInteraction): if interaction.message not in await ReactionRoleMessage.get_all(): return role_id = int(interaction.component.custom_id) member: disnake.Member = interaction.author user = await User.get(member.id) role = member....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def subscribe_command(self, ctx: commands.Context, *_) -> None: # We don't actually care about the args\n view = RoleButtonView(ctx.author, self.assignable_roles)\n await ctx.send(\n \"Click the buttons below to add or remove your roles!\",\n view=view,\n delet...
[ "0.5762249", "0.5668957", "0.5659755", "0.5601932", "0.5597881", "0.55494606", "0.5509019", "0.550365", "0.54933995", "0.54303074", "0.5379965", "0.53338444", "0.5327616", "0.5321051", "0.5281076", "0.52789605", "0.52783185", "0.5262219", "0.52602375", "0.5247453", "0.5199621...
0.6394534
0
Plateau in refractive index below 330nm for Glass, edge of data artifact
def refractive_index(self): wd = np.arange(80,820,10) nd = self.boundary.imat.refractive_index(wd) plt.plot(wd, nd) return wd, nd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index_of_surface_gate(data, setup={}):\n alts = data['alt']\n return np.argmin(np.abs(alts), 1)", "def test_no_backg_subt():\n \n test_object = fa.read_in_envision(data_csv=HsHis6_PEX5C_vs_HsPEX5C, platemap_csv=Hs_His6_PEX5C_vs_HsPEX5C_platemap, data_type='plate', size=384)\n test_object.c...
[ "0.5831233", "0.5830266", "0.5719483", "0.563902", "0.55948025", "0.55843574", "0.5583961", "0.5577517", "0.55708694", "0.5549658", "0.55016595", "0.5486436", "0.54773384", "0.54688746", "0.5463584", "0.54448295", "0.53914726", "0.5348724", "0.5341465", "0.5329872", "0.531499...
0.618945
0
Read h5 format data file
def read_data(path): with h5py.File(path, 'r') as hf: data = np.array(hf.get('data')) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_hdf5(path_to_file):\n\n print(\"\\nReading HDF5 file: \", path_to_file)\n file = h5py.File(path_to_file, 'r')\n\n # List the groups\n groups = list(file.keys())\n print(\"Groups available: \", groups)\n\n # Read Zemax Metadata\n zemax_metadata = {}\n print(\"\\nZemax Metadata:\")\n...
[ "0.7600226", "0.756424", "0.7475437", "0.74319535", "0.74319535", "0.7393015", "0.72876596", "0.7209565", "0.71935135", "0.7171935", "0.7154797", "0.7107951", "0.70604193", "0.70279646", "0.70197207", "0.70096785", "0.6915676", "0.68875426", "0.6883653", "0.6829923", "0.67898...
0.7660385
0
Make input data as h5 file format Depending on 'is_train' (flag value), savepath would be changed.
def make_data(sess, data, data_dir): if FLAGS.is_train: #savepath = os.path.join(os.getcwd(), os.path.join('checkpoint',data_dir,'train.h5')) savepath = os.path.join('.', os.path.join('checkpoint',data_dir,'train.h5')) if not os.path.exists(os.path.join('.',os.path.join('checkpoint',data_dir))): o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_hd5(out_file, x_train, y_train, x_val, y_val, x_test, y_test):\n data = h5py.File(out_file, \"w\")\n train_data = data.create_group(\"train_data\")\n train_data.create_dataset(\"x_train\", data=x_train)\n train_data.create_dataset(\"y_train\", data=y_train)\n if x_val is not None:\n ...
[ "0.7217005", "0.70193493", "0.684831", "0.6649944", "0.6624915", "0.656537", "0.6552267", "0.64465964", "0.63645554", "0.6273017", "0.62496", "0.61882937", "0.6150306", "0.610883", "0.6098114", "0.6088304", "0.60781205", "0.6075722", "0.6039973", "0.6017013", "0.59959936", ...
0.71147066
1