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
Property trait that accesses an attr on a BoundingBox's `_bbox` trait.
def BboxProperty(attr_name, readonly=False): def _bbox_getter(attr_name): def get_attr(self): return getattr(self._bbox, attr_name) return get_attr def _bbox_setter(attr_name): def set_attr(self, value): return setattr(self._bbox, attr_name, value) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bbox(self, primitive):\n accessor = primitive.attributes.get(\"POSITION\")\n return accessor.min, accessor.max", "def getbbox(self):\n pass", "def __getitem__(self, name):\n return self.gattrs[name]", "def get_attr(self, key: str) -> Any:\n raise NotImplementedError(\"T...
[ "0.5937778", "0.561052", "0.56001234", "0.5597013", "0.55287915", "0.55163205", "0.5487905", "0.5487905", "0.5485995", "0.5485995", "0.5484998", "0.54427093", "0.54417217", "0.543217", "0.5417654", "0.5400444", "0.53891706", "0.5352632", "0.5352632", "0.53514254", "0.5349861"...
0.7442278
0
return a random url from the static range
def _create_random_url(self): return self._base_url % random.randrange(self._random_create_start, self._random_create_end)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_url():\r\n url = u\"http://{0}.com\".format(random_string())\r\n return url", "def url_maker():\n chars = string.ascii_lowercase + string.ascii_uppercase + string.digits\n tempchar = [random.choice(chars) for n in range(5)]\n return \"http://i.imgur.com/\" + \"\".join(tempch...
[ "0.75876474", "0.72136134", "0.70216435", "0.6956417", "0.6789919", "0.6730312", "0.6597461", "0.65511966", "0.6459239", "0.6387315", "0.6387315", "0.63566333", "0.6303848", "0.62931544", "0.6264384", "0.61681366", "0.60464245", "0.6004846", "0.60008365", "0.59711754", "0.595...
0.810785
0
read the image urls from the self._image_urls_file_name and store in memory as a list, but return IOError if file DNE or 0 bytes.
def _read_image_urls(self): if not os.path.isfile(self._image_urls_file_name): raise IOError, "'%s' is not found" % self._image_urls_file_name if os.path.getsize(self._image_urls_file_name) == 0: raise IOError, "'%s' is empty" % self._image_urls_file_name for line in open...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_images(input_file_path, output_path):\n if not exists(input_file_path):\n raise FileNotFoundError(input_file_path)\n if not exists(output_path):\n raise NotADirectoryError(output_path)\n\n faulty_lines = []\n with open(input_file_path) as infile:\n for line in infile:\n ...
[ "0.64938587", "0.64104074", "0.63533175", "0.62307644", "0.61395705", "0.6009202", "0.5853331", "0.58512306", "0.5811358", "0.5738813", "0.57255757", "0.5710022", "0.57027847", "0.5694293", "0.56759477", "0.5669109", "0.56605816", "0.56493473", "0.563708", "0.5610239", "0.560...
0.8521112
0
create a list of valid image urls using a randomly generated self._base_url and then writes them to a text file.
def create_image_urls(self): self._image_urls = [] while True: image_url = self._create_random_url() request = urllib2.Request(image_url) opener = urllib2.build_opener(NoRedirection) try: response = opener.open(request) code...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveImages(self):\n if self.imageLink and not self.image:\n f= open('imageLink.txt','wb')\n f.write(bytes(str(self.imageLink), 'UTF-8'))\n f.close()\n req = urllib3.urlopen(self.imageLink, headers={'User-Agent': 'Mozilla/5.0'})\n result = urllib3.ur...
[ "0.64285827", "0.61699784", "0.61367637", "0.60362965", "0.6010603", "0.5938444", "0.58879215", "0.588389", "0.5798857", "0.566587", "0.5665044", "0.5651153", "0.5647106", "0.5646363", "0.5635563", "0.5531043", "0.5524617", "0.55107826", "0.55068314", "0.54994315", "0.5456978...
0.76970375
0
Creates a new fixture and adds it to the fixture pool
def create_fixture_instance(self, instance_dict): class_name = instance_dict.get('class_name') if not class_name: raise AXApiInvalidParam("'class_name' must be supplied during fixture creation") fix_class = self.get_fixture_class(name=class_name) mark_active = instance_dict.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixtures():", "def start_fixture(self):\n pass", "def load_database(db_session, fixture):\n # TODO: the fixture file path controls\n\n # load the fixture\n datas = pickle.loads(fixture)\n db_session.add_all(datas)\n db_session.commit()\n print \"load database ok\"", "def setUpFix...
[ "0.6056403", "0.586278", "0.5855234", "0.5821136", "0.57689506", "0.5739174", "0.56620824", "0.5635566", "0.56250745", "0.5587689", "0.5587689", "0.5548034", "0.5503349", "0.549727", "0.5428702", "0.54181784", "0.53824115", "0.53703463", "0.53610915", "0.5360567", "0.53593236...
0.5883227
1
Verifies uniqueness of instance name, or raises AXApiInvalidParam if it already exists
def _verify_unique_instance_name(self, name): existing = self.instances.find_one({'name': name, 'deleted': False}) if existing: raise AXApiInvalidParam("Fixture instance with name '{}' already exists".format(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duplicate_names_fail(self):\n name = 'some_name'\n instance_types.create(name, 256, 1, 120, 200, 'flavor1')\n self.assertRaises(exception.InstanceTypeExists,\n instance_types.create,\n name, 256, 1, 120, 200, 'flavor2')", "def check_...
[ "0.6955145", "0.64076835", "0.6331418", "0.6246967", "0.6105957", "0.6080625", "0.60061294", "0.5978304", "0.5874458", "0.5850276", "0.5835531", "0.5809082", "0.57808006", "0.5773074", "0.5737927", "0.5737927", "0.57119274", "0.57102257", "0.56951034", "0.5669034", "0.5659929...
0.79201096
0
Launches the necessary workflow to perform fixture instance action
def perform_fixture_instance_action(self, instance_id, action_name, user=None, arguments=None): with lock_instance(instance_id): instance = self.get_fixture_instance(id=instance_id) fix_class = self.get_fixture_class(id=instance.class_id) action = fix_class.actions.get(action...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_fixture(self):\n pass", "def test_run_tempest(self, tempest_actions, show_step, _):\n show_step(1)\n tempest_actions.prepare_and_run_tempest()", "def init_workflow():\n pass", "def main():\n fixture_util = FixtureUtil()\n fixture_util.set_stream_handler_logging_level()...
[ "0.6931977", "0.65578943", "0.6186647", "0.616885", "0.6142634", "0.6069325", "0.6024939", "0.5972109", "0.5967295", "0.59441286", "0.59109944", "0.5907235", "0.5878874", "0.5812543", "0.58103865", "0.5805487", "0.58021915", "0.5774877", "0.57505906", "0.5738221", "0.57374245...
0.6887621
1
Callback which we or axops invokes upon completion of an action job to transition the instance state. Payload will be the entire service object
def process_action_result(self, service): logger.info("Notified of action result:\n%s", pretty_json(service)) annotations = service.get('annotations', {}) instance_id = annotations.get('instance_id') action_name = annotations.get('action') if not instance_id: logger.w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_action(self, state):", "def instance_action():\n data = check_args(\n ('cloudProvider', 'apiKey', 'secretKey', 'instanceAction',\n 'instanceId')\n )\n job = jobs.instance_action.apply_async(args=(data,))\n return make_response(job_id=job.id)", "def __call__(self, ...
[ "0.5909055", "0.573255", "0.5583706", "0.5533153", "0.5494742", "0.54761547", "0.5452019", "0.5439728", "0.53636885", "0.5362042", "0.52939844", "0.5288115", "0.52772313", "0.5261649", "0.52485555", "0.5224333", "0.5212607", "0.52040434", "0.5195659", "0.5169902", "0.51617724...
0.68170696
0
Sets the instance's enabled field to be True or False depending on the policy
def set_enabled_from_policy(self, instance, service_status, action_name): fixture_class = self.get_fixture_class(id=instance.class_id, verify_exists=False) if not fixture_class: logger.error("Fixture class %s for instance %s no longer exists. This should not happen.", instance.class_id, inst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable(self):\n self.enabled = True", "def enable(self):\n self.enabled = True", "def set_enabled(self, enabled=True):\n self._enabled = enabled", "def enabled(self, enabled):\n \n self._enabled = enabled", "def setEnabled(self, enable: bool) -> None:\n self.en...
[ "0.70353025", "0.70353025", "0.7026392", "0.70054436", "0.6958848", "0.6942414", "0.6909379", "0.68414813", "0.68414813", "0.6791215", "0.67889", "0.6772832", "0.67663443", "0.67381793", "0.67381793", "0.67381793", "0.67381793", "0.67381793", "0.67381793", "0.67381793", "0.67...
0.71664494
0
Checks the completed service for artifact named 'attributes' If exists, loads the json and updates the instance with attribute values
def update_attributes_from_artifacts(self, instance, service): try: artifacts = self.axops_client.search_artifacts({'workflow_id': service['id'], 'name': ATTRIBUTE_ARTIFACT_NAME}) if not artifacts: logger.info("Job did not have '%s' artifact. Skipping attribute parsing", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_update_with_json_attrs(hass: HomeAssistant) -> None:\n\n respx.get(\"http://localhost\").respond(\n status_code=HTTPStatus.OK,\n json={\"key\": \"123\", \"other_key\": \"some_json_value\"},\n )\n assert await async_setup_component(\n hass,\n SENSOR_DOMAIN,\n ...
[ "0.5695464", "0.55972224", "0.55405647", "0.54598075", "0.5417405", "0.54166555", "0.5379903", "0.53422505", "0.5303454", "0.52921903", "0.5285825", "0.52804995", "0.5277226", "0.5252016", "0.5234792", "0.52121645", "0.52084136", "0.5206056", "0.5190542", "0.51895976", "0.517...
0.778703
0
Returns a dictionary from the attribute artifact json file, or None if json was invalid
def download_artifact_json(self, artifact_id): try: response = self.axops_client.download_artifact(artifact_id) data = io.BytesIO(response.raw.read()) tar = tarfile.open(mode='r:*', fileobj=data) for member in tar.getnames(): attr_str = tar.extract...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_model_output_from_json(json_file_path: str) -> dict:\n cprint(f\"### Function Name:-> {inspect.stack()[0][3]} ###\", 'yellow', 'on_grey', attrs=['bold'])\n try:\n json_data = dict()\n json_file_path = Path(json_file_path)\n if json_file_path.exists():\n with open(...
[ "0.6071951", "0.60544235", "0.59932405", "0.59605145", "0.5904924", "0.587944", "0.58763856", "0.57965106", "0.5785816", "0.5781285", "0.5768887", "0.57507616", "0.5743237", "0.57149357", "0.57103604", "0.5682458", "0.56810623", "0.563795", "0.5632252", "0.5611354", "0.560419...
0.6275994
0
Returns a single, unique fixture by name or id >>> fixmgr.get_fixture_instance(name='linux01')
def get_fixture_instance(self, id=None, name=None, verify_exists=True): query = {} if id: query['_id'] = id if name: query['name_lower'] = name if not query: raise AXIllegalArgumentException("No query filters supplied") fix_doc = self.instances...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fixture(name):\n path = os.path.join(os.environ.get(\"WORKSPACE\", \"./\"), \"fixtures\", name)\n if not os.path.isfile(path):\n raise NotFound(\"File {} not found\".format(path))\n return path", "def _get_fixture(item, arg_name, fixture=None):\n if arg_name == \"request\":\n # ...
[ "0.6509923", "0.62037605", "0.6023634", "0.5966281", "0.59145325", "0.5883537", "0.576336", "0.56827825", "0.5630251", "0.5515407", "0.5480694", "0.5458051", "0.5450804", "0.5437768", "0.5419975", "0.54180723", "0.5371775", "0.53615993", "0.5356714", "0.53151685", "0.5307016"...
0.7184157
0
Helper to persist updates fixture instance to both the cache and axdb. May raise AXIllegalOperationException if duplicate name is detected
def _persist_instance_updates(self, instance): assert instance.id in _instance_locker.resource_locks, "update attempted without acquiring resource lock" pre_update_doc = self.instances.find_one({'_id' : instance.id}) now = int(time.time() * 1e6) instance.mtime = now try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_with_same_name(data_store_path):\n data_set = [\n {\"name\": \"Eric Idle\", \"phone\": \"123-456-7890\", \"address\": \"here\"},\n {\"name\": \"John Cleese\", \"phone\": \"111-222-3333\", \"address\": \"there\"},\n ]\n data_store_path.write_text(yaml.dump(data_set))\n data_store ...
[ "0.56453335", "0.5638679", "0.562441", "0.551899", "0.54881793", "0.5471136", "0.54626113", "0.5439041", "0.5436143", "0.5416441", "0.54127663", "0.5400142", "0.5376579", "0.5373746", "0.53714424", "0.53673923", "0.53653735", "0.535895", "0.53459835", "0.53347355", "0.5305739...
0.64539367
0
Normalizes a fixture API query to mongodb query lowercases field names replaces 'id' search with '_id' replace 'name' with 'name_lower' if value is a list, change query to use $in
def _normalize_query(self, query): if not query: return {} def _parse_value(value): """Checks and parses if supplied value is a float, bool, or int""" # Check if it is a boolean, int, or float value try: value = json.loads(value.lower()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bulk(self):\n\n class BlogPost(Document):\n title = StringField()\n\n BlogPost.drop_collection()\n\n post_1 = BlogPost(title=\"Post #1\")\n post_2 = BlogPost(title=\"Post #2\")\n post_3 = BlogPost(title=\"Post #3\")\n post_4 = BlogPost(title=\"Post #4\"...
[ "0.5652842", "0.54111284", "0.5205573", "0.5133935", "0.5102323", "0.508832", "0.50550246", "0.5027909", "0.5022632", "0.5020408", "0.49917224", "0.4956201", "0.49088815", "0.4906609", "0.48816794", "0.48648617", "0.48380446", "0.48306593", "0.48206267", "0.47830543", "0.4770...
0.6131159
0
Delete a fixture instance
def delete_fixture_instance(self, instance_id, user=None): try: self.perform_fixture_instance_action(instance_id, InstanceAction.DELETE, user=user) except AXApiResourceNotFound: pass except AXIllegalOperationException: instance = self.get_fixture_instance(id=i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n try:\n os.remove(self.fixture_file)\n except OSError:\n pass", "def tearDown(self):\n try:\n os.remove(self.fixtureFile)\n except OSError:\n pass", "def unload_fixture(apps, schema_editor):\n\n objects = deserializ...
[ "0.6940621", "0.692528", "0.69055957", "0.682422", "0.6686394", "0.6677909", "0.6641366", "0.66057193", "0.66004485", "0.6591869", "0.65908605", "0.6550908", "0.6547031", "0.6540931", "0.653834", "0.6536195", "0.6519616", "0.6490032", "0.6481485", "0.6466083", "0.64228755", ...
0.7225935
0
Retrieves list of fixture classes
def get_fixture_classes(self): class_docs = self.axdb_client.get_fixture_classes() return [FixtureClass.deserialize_axdbdoc(doc) for doc in class_docs]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test___get_all_classes():\n config = {\"plugins\": [\"tests.mock_plugin\"]}\n classes = r._get_all_classes(config, r.DataSource)\n assert \"food\" in classes\n classes = r._get_all_classes(config, r.DataSink)\n assert \"food\" in classes", "def classes(self):\n return list(self._classes...
[ "0.69747436", "0.68032426", "0.6723094", "0.67205036", "0.66684055", "0.66140205", "0.6590699", "0.65699035", "0.6460346", "0.64232725", "0.6349382", "0.6337411", "0.63094455", "0.6287659", "0.6227922", "0.6225331", "0.6224209", "0.6224209", "0.6224209", "0.6224209", "0.62242...
0.8160155
0
Retrieves a FixtureClass by name or id
def get_fixture_class(self, name=None, id=None, verify_exists=True): assert any([name, id]), "name or id must be specified" if id: class_doc = self.axdb_client.get_fixture_class_by_id(id) else: class_doc = self.axdb_client.get_fixture_class_by_name(name) if not cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fixture_instance(self, id=None, name=None, verify_exists=True):\n query = {}\n if id:\n query['_id'] = id\n if name:\n query['name_lower'] = name\n if not query:\n raise AXIllegalArgumentException(\"No query filters supplied\")\n fix_doc =...
[ "0.68102133", "0.63522667", "0.6269279", "0.62185544", "0.5852546", "0.5790573", "0.56684893", "0.56657773", "0.5638562", "0.5626019", "0.56245923", "0.5616098", "0.5595591", "0.55895376", "0.5558115", "0.5544552", "0.54989797", "0.54697937", "0.54538095", "0.5406854", "0.540...
0.7685728
0
Returns FixtureClass object from a template dictionary
def template_to_class(self, fix_template): action_templates = {} actions = fix_template.get('actions', {}) for action_name, action in actions.items(): if action['template'] not in action_templates: service_template = self.axops_client.get_template(fix_template['repo']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_template(cls, template, fpath, defaults=defaults, **kwargs):\n\n try:\n #use defaults first and overwrite with user's specs\n inp = template.substitute(defaults, **kwargs)\n return cls(fpath, inp_string=inp)\n except (KeyError, ValueError) as error:\n ...
[ "0.5881686", "0.56846297", "0.5514073", "0.543241", "0.5410768", "0.5402855", "0.54024947", "0.5372281", "0.53655285", "0.5360564", "0.53439814", "0.5325336", "0.5324815", "0.5289122", "0.5269114", "0.5266425", "0.5260116", "0.5245977", "0.5245977", "0.5230463", "0.52099055",...
0.6678587
0
Creates or updates a fixture class from a fixture template
def upsert_fixture_class(self, template_id): logger.info("Creating fixture class from template %s", template_id) fix_template = self.axops_client.get_fixture_template(template_id) if not fix_template: raise AXApiResourceNotFound("Fixture template with id {} not found".format(template...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_to_class(self, fix_template):\n action_templates = {}\n actions = fix_template.get('actions', {})\n for action_name, action in actions.items():\n if action['template'] not in action_templates:\n service_template = self.axops_client.get_template(fix_templa...
[ "0.65396756", "0.62506515", "0.59753823", "0.5943368", "0.58272135", "0.5778742", "0.5752988", "0.5752593", "0.5732679", "0.56499195", "0.5555245", "0.5514245", "0.5514245", "0.55002886", "0.54912806", "0.5437936", "0.54379094", "0.5406374", "0.5405126", "0.5376389", "0.53567...
0.68192595
0
Detects schema differences between an existing/enabled class and a new class, and performs schema migration
def apply_class_changes(self, old_class, new_class): new_class.id = old_class.id if old_class.json() == new_class.json(): logger.info("No differences detected for %s", old_class) return old_class class_rename = bool(old_class.name != new_class.name) _, modified_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def upgradeSchema(self) -> None:", "def migrate(self):\n\tpass", "def migration():", "def migrate(cls)->None:\n pass", "def run_migration_checks():\n check_model_state()\n check_migration_state()", "def test_rename_table(self):\n name_column = Varchar()\n name_column._met...
[ "0.6485096", "0.62964654", "0.62357086", "0.6202014", "0.6036749", "0.5846033", "0.5809117", "0.57921636", "0.57222635", "0.5719591", "0.5644546", "0.5415942", "0.53654855", "0.5353281", "0.53493696", "0.53360534", "0.5309979", "0.5306251", "0.5306251", "0.53041565", "0.53006...
0.6924647
0
Batch apply updates to a bunch of instances one by one
def _batch_update(self, query, mutation): logger.info("Performing batch update on %s. Mutation: %s", query, mutation) modified = 0 for doc in self.instances.find(query): with lock_instance(doc['_id']): pre_update_doc = self.instances.find_one({'_id' : doc['_id']}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_batch(self, *args, **kwargs):\n pass", "def _update_bulk(self, iterable):\n self.cursor.executemany(self.UPDATE, iterable)", "def do_update(services):\n\n global running_update\n\n for service in services:\n feed = registry[service.name][0]\n try:\n if type(feed) is list:\...
[ "0.7189869", "0.67823553", "0.6594094", "0.65462065", "0.6333698", "0.6327298", "0.63183355", "0.6301259", "0.62568325", "0.6213043", "0.620062", "0.61573243", "0.60297054", "0.60237336", "0.6015194", "0.5980684", "0.59799725", "0.5921715", "0.59208184", "0.59198505", "0.5910...
0.72539556
0
Rebases the class to a different template id, possibly renaming the class, changing repo/branch
def update_fixture_class(self, class_id, template_id): fix_template = self.axops_client.get_fixture_template(template_id) if not fix_template: raise AXApiResourceNotFound("Fixture template with id {} not found".format(template_id)) with self._class_lock: old_class = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upsert_fixture_class(self, template_id):\n logger.info(\"Creating fixture class from template %s\", template_id)\n fix_template = self.axops_client.get_fixture_template(template_id)\n if not fix_template:\n raise AXApiResourceNotFound(\"Fixture template with id {} not found\".fo...
[ "0.60265285", "0.548767", "0.53971523", "0.5313759", "0.52969855", "0.52776825", "0.5181988", "0.5159817", "0.5146217", "0.5131519", "0.5125715", "0.5116691", "0.50743043", "0.50523776", "0.5018573", "0.5015002", "0.49250206", "0.49166882", "0.49112496", "0.4904856", "0.49042...
0.6263676
0
Delete a fixture class
def delete_fixture_class(self, class_id): with self._class_lock: existing_fix = self.instances.find_one({'class_id': class_id, 'status': {'$ne': InstanceStatus.DELETED}}) if existing_fix: raise AXIllegalOperationException("Fixtures belonging to class {} should be deleted ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDownClass(cls):\n cls.object.delete()", "def tearDownClass(cls):\n cls.image1.delete()\n cls.image2.delete()\n cls.object.delete()\n cls.alone_object.delete()", "def teardown_class(klass):", "def teardown_class(klass):", "def tearDown(self):\n try:\n ...
[ "0.76624334", "0.7159592", "0.6976561", "0.6976561", "0.69745296", "0.6954003", "0.69403875", "0.6908376", "0.69015247", "0.6889659", "0.6858757", "0.6812754", "0.6783995", "0.67155194", "0.67155194", "0.67155194", "0.6672961", "0.6656083", "0.6640979", "0.6635113", "0.660845...
0.75745016
1
Get availability/total summary of instances
def get_summary(self, group_by=None, query=None): if query: query = self._normalize_query(query) else: query = {} query['deleted'] = False group = {'available': '$available'} if group_by is not None: for g in group_by.split(','): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_instance_summary(instance, use_color='auto'):\n\n colorize_ = partial(colorize, use_color=use_color)\n\n name = colorize_(instance.name, \"yellow\")\n instance_type = instance.extra['gonzo_size']\n\n if instance.state == NodeState.RUNNING:\n status_colour = \"green\"\n else:\n ...
[ "0.67294395", "0.6531367", "0.63594925", "0.62042433", "0.61958486", "0.6144866", "0.61127305", "0.60415524", "0.6023646", "0.5973577", "0.59683967", "0.59578544", "0.59206754", "0.5883215", "0.5829848", "0.57911754", "0.5772057", "0.5769414", "0.5760281", "0.575405", "0.5715...
0.68932736
0
Ensures referrer field of a fixture instances and volumes is consistent with requestdb
def check_referrers_consistency(self): logger.info("Checking for inconsistent referrers field") assigned_fix_reqs = set() # Get all assigned fixture requests. Ensure that the instance has the fixture request in it's list of referrers # If instance does not have the referrer, add it. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_two_referrers(dumper, db):\n dumper.reader.load_db(\n db.create_sample(\n 5,\n fkeys=[\n (\"table1\", \"t2id\", \"table2\", \"id\"),\n (\"table1\", \"t3id\", \"table3\", \"id\"),\n (\"table2\", \"t24id\", \"table4\", \"id\"),\n ...
[ "0.5467652", "0.54017663", "0.5354186", "0.53372955", "0.5319541", "0.52375287", "0.52053463", "0.519841", "0.51736194", "0.5166318", "0.51587826", "0.51434124", "0.51431364", "0.5142787", "0.5140959", "0.5132825", "0.51286983", "0.5115832", "0.5107719", "0.5107071", "0.50780...
0.6751544
0
Checks for expired fixtures and deletes them from the database
def expire_deleted_fixtures(self): logger.info("Purging instances deleted %s days ago", common.DELETED_INSTANCE_GC_DAYS) n_days_ago_in_usec = int((time.time() * 1e6) - (common.DELETED_INSTANCE_GC_DAYS * common.NANOSECONDS_IN_A_DAY)) expired = self.instances.find({ 'mtime': {'$lt': n_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_db():\n yest = datetime.utcnow() - timedelta(days=1)\n try:\n Load.query.filter(Load.time < yest).delete()\n db.session.commit()\n except:\n db.session.rollback()", "def test_delete_expired_users(self):\n self.assertEqual(JenkinsUser.objects.count(), 2)\n Reg...
[ "0.72296244", "0.6820401", "0.6633651", "0.6567142", "0.6555037", "0.6515077", "0.6496617", "0.63939756", "0.6382256", "0.6220373", "0.62095785", "0.62095785", "0.62095785", "0.62095785", "0.61654776", "0.6140848", "0.6122539", "0.61133766", "0.6063629", "0.6057618", "0.60368...
0.7687136
0
Return all closed regions in image who's pixel satisfy test.
def closed_regions(self, image, test): pixel = image.load() xs, ys = map(xrange, image.size) todo = set(xy for xy in product(xs, ys) if test(pixel[xy])) while todo: region = set() edge = set([todo.pop()]) while edge: region |= edge ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region_of_interest(self, img):\n # get region vertices\n r1, r2, r3, r4 = self.region_filter_params[\"ratios\"]\n img_height, img_width = img.shape\n vertices = define_region_vertices(img_height, img_width, r1, r2, r3, r4)\n\n # defining a blank mask to start with\n ma...
[ "0.6369291", "0.61883307", "0.61683273", "0.59781677", "0.5959679", "0.5878107", "0.57691103", "0.5762268", "0.57292086", "0.57239795", "0.5704556", "0.56894153", "0.56618047", "0.5644161", "0.5634841", "0.56319225", "0.56288725", "0.56288725", "0.56288725", "0.56288725", "0....
0.84021664
0
Update the status of job with job id `jid` to status `status`.
def update_job_status(jid, new_status): rd.hset(_generate_job_key(jid), 'status', new_status)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_job_status(jid, new_status):\n jrd.hset(_generate_job_key(jid), 'status', new_status)", "def update_job_status(self, job_id, status):\n\n if not (job_id and status):\n raise ValueError(\"Please provide both job_id and status\")\n\n job = self.get_mongo_util().get_job(job_id...
[ "0.8721243", "0.7878231", "0.7645582", "0.7384852", "0.7075129", "0.6978821", "0.6939226", "0.6873175", "0.6858812", "0.6784618", "0.67413497", "0.67406476", "0.67188567", "0.6665409", "0.66392183", "0.65370345", "0.64245987", "0.6391169", "0.627715", "0.6251563", "0.6248479"...
0.87232137
0
Overridden method resize the gride on window resize
def resizeEvent(self, event): self.resized.emit() return super(PiWndow, self).resizeEvent(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_parent_resize(self, event):\n #self.resize()\n #self.resize_scaled(drag_rootx=self.resize_frame.winfo_rootx())\n self.resize_scaled(current=MathStat.lerp(0,\n self.prop_frame.winfo_width(), self.last_right_bias))", "def ev_windowresized(self, event: WindowResized) -> None:"...
[ "0.77815837", "0.7722773", "0.7567626", "0.7532544", "0.7514508", "0.74756813", "0.74474376", "0.7378988", "0.72276026", "0.7209269", "0.7195889", "0.718926", "0.71728903", "0.71120715", "0.7109021", "0.7090584", "0.7055913", "0.6997535", "0.69884354", "0.6966881", "0.6963820...
0.77234805
1
Test get sparse feature for nodes
def testGetNodeSparseFeature(self): op = ops.get_sparse_feature(tf.constant([1, 2, 3, 4], dtype=tf.int64), [0, 1], None, 2) with tf.Session() as sess: sparse_features = sess.run(op) features = [ sess.run(tf.sparse_tensor_to_dense(sp)) for sp in sparse_features ] self.assertAll...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetEdgeSparseFeature(self):\n op = ops.get_edge_sparse_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1])\n with tf.Session() as sess:\n sparse_features = sess.run(op)\n features = [\n sess.run(tf.sparse_tensor_to_dense(sp)) for sp in sparse_features\n ]\n ...
[ "0.73272765", "0.6820091", "0.67619544", "0.6610567", "0.64725614", "0.6449944", "0.64042735", "0.6263585", "0.6103143", "0.61015546", "0.60968196", "0.6084827", "0.6057236", "0.60563654", "0.60050356", "0.59953785", "0.5979681", "0.59236443", "0.59099656", "0.5838602", "0.58...
0.82523984
0
Test get sparse feature for edges
def testGetEdgeSparseFeature(self): op = ops.get_edge_sparse_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1]) with tf.Session() as sess: sparse_features = sess.run(op) features = [ sess.run(tf.sparse_tensor_to_dense(sp)) for sp in sparse_features ] self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetNodeSparseFeature(self):\n op = ops.get_sparse_feature(tf.constant([1, 2, 3, 4], dtype=tf.int64), [0, 1], None, 2)\n with tf.Session() as sess:\n sparse_features = sess.run(op)\n features = [\n sess.run(tf.sparse_tensor_to_dense(sp)) for sp in sparse_features\n ]\n\n s...
[ "0.7218904", "0.63896483", "0.6371443", "0.6266918", "0.62178236", "0.61970073", "0.613634", "0.6091845", "0.5928558", "0.5921789", "0.59213215", "0.58553857", "0.5815543", "0.57850456", "0.57541674", "0.56809664", "0.5644477", "0.56365854", "0.55811906", "0.55731964", "0.556...
0.79959077
0
Test get binaray feature for nodes
def testGetBinaryFeature(self): op = ops.get_binary_feature(tf.constant([1, 2], dtype=tf.int64), [0, 1], 3) with tf.Session() as sess: binary_features = sess.run(op) self.assertAllEqual([['aa', 'eaa'], ['bb', 'ebb']], binary_features)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetEdgeBinaryFeature(self):\n op = ops.get_edge_binary_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1], 3)\n with tf.Session() as sess:\n binary_features = sess.run(op)\n self.assertAllEqual([['eaa', 'eaa'], ['ebb', 'ebb']], binary_features)", "def test_binops(self):",...
[ "0.67418295", "0.65028363", "0.5886723", "0.5849335", "0.5824959", "0.5815598", "0.5767881", "0.5749302", "0.56867933", "0.56607276", "0.5647841", "0.5642658", "0.56263286", "0.56138974", "0.559451", "0.5587335", "0.55846936", "0.5578987", "0.5569948", "0.55669355", "0.556448...
0.6703744
1
Test get binary feature for edges
def testGetEdgeBinaryFeature(self): op = ops.get_edge_binary_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1], 3) with tf.Session() as sess: binary_features = sess.run(op) self.assertAllEqual([['eaa', 'eaa'], ['ebb', 'ebb']], binary_features)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetBinaryFeature(self):\n op = ops.get_binary_feature(tf.constant([1, 2], dtype=tf.int64), [0, 1], 3)\n with tf.Session() as sess:\n binary_features = sess.run(op)\n self.assertAllEqual([['aa', 'eaa'], ['bb', 'ebb']], binary_features)", "def edge_ground(X):\n gradient_x = img_conv(X, k...
[ "0.68867505", "0.6366488", "0.6243037", "0.62199426", "0.6127697", "0.6102369", "0.6087157", "0.60346556", "0.59115744", "0.58970225", "0.5876137", "0.57994354", "0.57452404", "0.5710747", "0.57041126", "0.57013994", "0.56978977", "0.5695617", "0.565691", "0.56377554", "0.563...
0.8017388
0
Test get dense feature for nodes
def testGetDenseFeature(self): op = ops.get_dense_feature(tf.constant([1, 2], dtype=tf.int64), [0, 1], [2, 3], 3) with tf.Session() as sess: dense_features = sess.run(op) self.assertAllClose([[2.4, 3.6], [2.4, 3.6]], dense_features[0]) self.assertAllClose([[4.5, 6.7, 8.9], [4.5, 6.7, 8.9]], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetEdgeDenseFeature(self):\n op = ops.get_edge_dense_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1], [2, 3])\n with tf.Session() as sess:\n dense_features = sess.run(op)\n self.assertAllClose([[2.4, 3.6], [2.4, 3.6]], dense_features[0])\n self.assertAllClose([[4.5,...
[ "0.72559947", "0.67886496", "0.65579146", "0.64986455", "0.64469945", "0.6297318", "0.6294088", "0.6167789", "0.6160456", "0.6077242", "0.59941447", "0.5963346", "0.59530985", "0.5951871", "0.5840117", "0.5824145", "0.57557094", "0.5753232", "0.57435966", "0.57184446", "0.567...
0.78006595
0
Test get dense feature for edges
def testGetEdgeDenseFeature(self): op = ops.get_edge_dense_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1], [2, 3]) with tf.Session() as sess: dense_features = sess.run(op) self.assertAllClose([[2.4, 3.6], [2.4, 3.6]], dense_features[0]) self.assertAllClose([[4.5, 6.7, 8.9]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetDenseFeature(self):\n op = ops.get_dense_feature(tf.constant([1, 2], dtype=tf.int64), [0, 1], [2, 3], 3)\n with tf.Session() as sess:\n dense_features = sess.run(op)\n self.assertAllClose([[2.4, 3.6], [2.4, 3.6]], dense_features[0])\n self.assertAllClose([[4.5, 6.7, 8.9], [4.5, 6.7,...
[ "0.7243192", "0.69505996", "0.6386442", "0.63060486", "0.6300891", "0.6059663", "0.5921134", "0.58920044", "0.5870613", "0.58467954", "0.58444846", "0.5779876", "0.5760521", "0.5699653", "0.5684468", "0.5669936", "0.5648048", "0.5621084", "0.5606891", "0.5605643", "0.5564011"...
0.8108021
0
Load a plugin from a directory path rather than a python package within sys.path. This would either be ``myplugin.py`` or ``myplugin/__init__.py`` within the given ``plugin_dir``.
def _load_plugin_from_dir(self, plugin_name, plugin_dir): # FIX ME: `imp` is deprecated in Python 3.4 and will be going away # so we need to update forward compatibility for ``importlib``. # # See: https://github.com/datafolklabs/cement/issues/386 LOG.debug("attempting to load...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli_load_plugin(self, args) -> str:\n plugin_name = args.plugin_name\n current_dir = os.path.dirname(os.path.realpath(__file__))\n if not os.path.isfile(\"{}/{}.py\".format(current_dir, plugin_name)):\n return error(\"Plugin {} DNE\".format(plugin_name))\n\n # First, let'...
[ "0.6916508", "0.68514174", "0.6643727", "0.65699375", "0.6476672", "0.6329865", "0.6303747", "0.62341803", "0.6217344", "0.6157128", "0.61493677", "0.61439323", "0.6132839", "0.61202306", "0.6070565", "0.6015545", "0.594124", "0.58788246", "0.58368605", "0.58302", "0.58088845...
0.7679594
0
Load a plugin from a python package. Returns True if no ImportError is encountered.
def _load_plugin_from_bootstrap(self, plugin_name, base_package): full_module = '%s.%s' % (base_package, plugin_name) # If the base package doesn't exist, we return False rather than # bombing out. if base_package not in sys.modules: try: __import__(base_pac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_plugin(self, plugin):\n return imp.load_module(self._main_module, *plugin[\"info\"])", "def plugin_import(plugin):\n\n return importlib.import_module(plugin, package=\"directord\")", "def cli_load_plugin(self, args) -> str:\n plugin_name = args.plugin_name\n current_dir = os.pa...
[ "0.70234805", "0.68948036", "0.6878378", "0.6738148", "0.6616493", "0.66163725", "0.66088516", "0.65382975", "0.6505495", "0.6326678", "0.6311166", "0.62846106", "0.62615424", "0.62216526", "0.61738795", "0.61628515", "0.61538166", "0.61223394", "0.6082919", "0.60692656", "0....
0.7497673
0
Load a plugin whose name is ``plugin_name``. First attempt to load from a plugin directory (plugin_dir), secondly attempt to load from a bootstrap module (plugin_bootstrap) determined by ``CementApp.Meta.plugin_bootstrap``. Upon successful loading of a plugin, the plugin name is appended to the ``self._loaded_plugins l...
def load_plugin(self, plugin_name): LOG.debug("loading application plugin '%s'" % plugin_name) # first attempt to load from plugin_dirs for load_dir in self.load_dirs: load_dir = abspath(load_dir) if self._load_plugin_from_dir(plugin_name, load_dir): sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_plugin_from_dir(self, plugin_name, plugin_dir):\n\n # FIX ME: `imp` is deprecated in Python 3.4 and will be going away\n # so we need to update forward compatibility for ``importlib``.\n #\n # See: https://github.com/datafolklabs/cement/issues/386\n\n LOG.debug(\"attem...
[ "0.7045509", "0.68277836", "0.6615645", "0.65783507", "0.65219337", "0.6168164", "0.6166937", "0.6153133", "0.603769", "0.6017749", "0.6007957", "0.5936667", "0.5920107", "0.59188616", "0.58921534", "0.585424", "0.5792454", "0.57535785", "0.56395006", "0.5621667", "0.56081516...
0.7847527
0
Load a list of plugins. Each plugin name is passed to ``self.load_plugin()``.
def load_plugins(self, plugin_list): for plugin_name in plugin_list: self.load_plugin(plugin_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(plugin_list: list[str]) -> None:\n\n if plugin_list is None or len(plugin_list) == 0:\n raise PluginLoaderError(\"None or empty list passed plugin loader.\")\n\n try:\n plugin: IPlugin\n for plugin_file in plugin_list:\n plugin = importlib.impo...
[ "0.8064172", "0.7858561", "0.75934744", "0.7524198", "0.74683875", "0.7416607", "0.73836267", "0.7295292", "0.7247374", "0.7145177", "0.7036643", "0.69947654", "0.6944811", "0.6913434", "0.68554175", "0.6810764", "0.6804907", "0.67874926", "0.67491233", "0.67149556", "0.66665...
0.859365
0
List of plugins that have been loaded.
def get_loaded_plugins(self): return self._loaded_plugins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self):\n return self.rpc.call(MsfRpcMethod.PluginLoaded)['plugins']", "def get_plugins(self):\n return []", "def plugin_list(self):\r\n return get_module_list()", "def available_plugins():\n return PluginConnector.available_plugins()", "def getAvailablePlugins(self):\n ...
[ "0.8586829", "0.8316143", "0.8056693", "0.8050387", "0.79434705", "0.7777282", "0.7626144", "0.75808483", "0.7544936", "0.75321484", "0.7513205", "0.75094754", "0.7476133", "0.7441247", "0.7406904", "0.740663", "0.7388524", "0.73757917", "0.7358085", "0.7344863", "0.7317727",...
0.84580123
1
List of plugins that are enabled (not necessary loaded yet).
def get_enabled_plugins(self): return self._enabled_plugins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_plugins(self):\n return []", "def available_plugins():\n return PluginConnector.available_plugins()", "def plugin_list(self):\r\n return get_module_list()", "def get_enabled_plugins(self):\n return [p for p in self.get_all_plugins if p[\"plugin_state\"] == \"enabled\"]", ...
[ "0.8339704", "0.8162594", "0.8157118", "0.81241125", "0.81090266", "0.79501456", "0.7901278", "0.7882036", "0.78794426", "0.77211344", "0.77055705", "0.7700278", "0.76569206", "0.7651718", "0.74794424", "0.745278", "0.7425413", "0.7393598", "0.738529", "0.7381147", "0.7367391...
0.821764
1
List of disabled plugins
def get_disabled_plugins(self): return self._disabled_plugins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_enabled_plugins(self):\n return [p for p in self.get_all_plugins if p[\"plugin_state\"] == \"enabled\"]", "def get_enabled_plugins(self):\n return self._enabled_plugins", "def get_plugins(self):\n return []", "def plugin_list(self):\r\n return get_module_list()", "def ge...
[ "0.7614633", "0.7553389", "0.75279945", "0.7443351", "0.7277866", "0.7091898", "0.70777154", "0.7022327", "0.6932261", "0.69020647", "0.689735", "0.68944365", "0.68162185", "0.6764687", "0.67471033", "0.67389685", "0.67251486", "0.66634655", "0.6657755", "0.66140616", "0.6560...
0.8493453
0
r"""GCP = great circle points from (lon1,lat1) > (lon2,lat2).
def gcp(lon1, lat1, lon2, lat2): Npt = 200 p1 = np.array(lonlat2xyz(lon1, lat1)) p2 = np.array(lonlat2xyz(lon2, lat2)) delta = p2 - p1 # length of the line: between 0 and 2, generally < 1 r = np.linalg.norm(delta) d = np.linspace(0, 1.0, int(Npt*r + 10)) # sample points along the line co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(p1, p2):\n # Note: GeoPy expects (latitude, longitude) pairs.\n return geopy.distance.great_circle(\n (p1.y, p1.x),\n (p2.y, p2.x)\n ).miles", "def pointfind2(plat, plon, lat, lon, pdif=1):\n\n\tdist_min = 1000000.\n\t\n\t\n\tfor i in range(lon.shape[0]):\n\t\tfor j in ran...
[ "0.6885366", "0.65239805", "0.63336706", "0.63148177", "0.6299968", "0.6127645", "0.61270505", "0.6075573", "0.60572517", "0.6042769", "0.60286987", "0.6018993", "0.59866035", "0.59788495", "0.59559065", "0.5934518", "0.5926352", "0.59001684", "0.58833873", "0.5822907", "0.58...
0.70047563
0
Read a Featran settings file and return a list of settings
def settings(cls, settings_dir, settings_filename=None): # type: (str, str) -> List[Dict[str, Any]] f = cls.__get_featran_settings_file(settings_dir, settings_filename) with file_io.FileIO(f, "r") as fio: settings = json.load(fio) return settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_settings():\n \n settings = OrdDic()\n settings.update(json.load(open(\"resources/files/settings.txt\", \"r\")))\n\n ## OLD WAY BELOW\n\n #r = open(\"resources/files/settings.txt\", \"r\", newline=\"\\n\")\n # for option in r.read().split('\\n'):\n # tr...
[ "0.7102021", "0.70868576", "0.7059203", "0.7037486", "0.69387", "0.6818304", "0.66388637", "0.6611855", "0.659556", "0.6580886", "0.652529", "0.65144247", "0.6462294", "0.6341641", "0.62923574", "0.62744516", "0.62440145", "0.6239939", "0.6227235", "0.62151223", "0.6198884", ...
0.7195697
0
Reorders a numpy dictionary so that feature keys are in the same order as those in a Featran settings file.
def reorder_numpy_dataset(cls, dataset, # type: Iterator[Dict[str, np.ndarray]] settings_path # type: str ): # type: (...) -> Iterator[OrderedDict[str, np.ndarray]] feature_names = Featran.names(settings_path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reorder_features(outputs: t.Dict[str, torch.Tensor]) -> t.Dict[str, torch.Tensor]:\r\n results = collections.OrderedDict()\r\n keys = outputs.keys()\r\n\r\n res_keys: t.List = sorted([key for key in keys if 'res' in key])\r\n p_keys: t.List = sorted([key for key in keys if 'p' in key], reverse=Tru...
[ "0.65474087", "0.60033643", "0.5774473", "0.5615092", "0.55150896", "0.5487108", "0.5471396", "0.544606", "0.5441302", "0.5424468", "0.5393674", "0.5364288", "0.5292287", "0.5273655", "0.5270219", "0.5205825", "0.5180123", "0.5159714", "0.5151066", "0.51053035", "0.5077025", ...
0.66269344
0
Reorders a pandas DataFrame so that feature columns are in the same order as those in a Featran settings file.
def reorder_dataframe_dataset(cls, dataset, # type: Iterator[pd.DataFrame] settings_path # type: str ): # type: (...) -> Iterator[pd.DataFrame] feature_names = Featran.names(settings_path) for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reorder_cols(df):\n # print(df.columns)\n req_order = [df.columns.tolist()[-1]] + df.columns.tolist()[:-1]\n # print(req_order)\n df = df.loc[:, req_order]\n df = df.sort_values(by=['participant_id'], ignore_index=True)\n return df", "def reorder_columns(data: pd.DataFrame):\n return dat...
[ "0.66248345", "0.6539427", "0.63924694", "0.6261986", "0.62243295", "0.6177894", "0.61388737", "0.61321455", "0.6041618", "0.5983137", "0.59600985", "0.58889955", "0.5882089", "0.58378375", "0.5830742", "0.58172053", "0.5798357", "0.5798357", "0.57415587", "0.5627095", "0.561...
0.67649025
0
Creates a default log config file Normally we just use the root logger, but if debug is specified, we create a separate logger for bigacme, and stops it from propagate to the root logger. Otherwise it will be flooded with suds logging
def create_logconfigfile(debug): config = ConfigParser.ConfigParser() config.add_section('loggers') if debug: config.set('loggers', 'keys', 'root, bigacme') else: config.set('loggers', 'keys', 'root') config.add_section('handlers') config.set('handlers', 'keys', 'fileHandler') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_logger_creator(config):\n cfg = config[\"logger_config\"].copy()\n cls = cfg.pop(\"type\")\n # Provide default for logdir, in case the user does\n # not specify this in the \"logger_config\" dict.\n logdir_ =...
[ "0.73750424", "0.702182", "0.68984103", "0.6830591", "0.68221974", "0.6803222", "0.67796206", "0.676728", "0.67659885", "0.6738408", "0.67314416", "0.67223585", "0.6712152", "0.6700481", "0.66865337", "0.6676777", "0.6672695", "0.6649287", "0.66484153", "0.6597267", "0.655657...
0.75977945
0
Deletes the account key from disk
def delete_account_key(configuration): os.remove(configuration.cm_key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_key_file():\n\n key_path = _get_path_to_key_file()\n\n if _search_for_key_file(key_path):\n try:\n os.remove(key_path)\n except OSError as e:\n raise NonRecoverableError(\n 'Unable to delete key pair: {0}.'\n .format(str(e)))", "...
[ "0.7390688", "0.7232279", "0.7135629", "0.7051478", "0.695327", "0.6949479", "0.6926622", "0.68914104", "0.68800974", "0.6865197", "0.67859584", "0.6766877", "0.6745468", "0.6686547", "0.6654138", "0.66517293", "0.66275847", "0.6625675", "0.65753704", "0.6574957", "0.65446925...
0.7831444
0
Return list of matched extensions for request
def get_matched_extensions(request): def _match(e): return e.obj if e.obj.matches(request) else None result = EXTENSION_MANAGER.map(_match) return filter(bool, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_request_extensions(self):\n return []", "def get_supported_extensions(ext=\".as\"):\n result = list(ext + x for x in LOADERS.keys())\n result.append(ext)\n return result", "def list_extensions(self, **_params):\r\n return self.get(self.extensions_path, params=_params)", "def ge...
[ "0.75951755", "0.7271211", "0.72127724", "0.7194703", "0.6986083", "0.6902174", "0.6794423", "0.6713986", "0.66939974", "0.66939974", "0.64852667", "0.64221865", "0.6406773", "0.6382086", "0.6368284", "0.63533074", "0.63501287", "0.6343359", "0.63414174", "0.63372016", "0.630...
0.80292445
0
Calls func immediately if API is already initialized. Otherwise, call is deferred until call to VOIP.initialize(). Any call to VOIP.shutdown() always clears list of previously deferred calls.
def callWhenInitialized(func): if _api: func() else: _initCallbacks.append(func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_once_when_loaded(self, function: Callable[[], None]) -> None:\n if self.is_loaded():\n function()\n else:\n self._call_once_loaded_callback.Register(function)", "async def wrapper(call: ServiceCall) -> None:\n entry = async_get_entry_for_service_call(ha...
[ "0.5526264", "0.5442476", "0.5366207", "0.52752405", "0.52704024", "0.5259977", "0.52292216", "0.517247", "0.51048285", "0.5088277", "0.5084857", "0.5078337", "0.5066153", "0.5066153", "0.50597996", "0.5033456", "0.5030401", "0.5030401", "0.5030401", "0.50179005", "0.49924242...
0.7787551
0
Task 1 Creating a blank image with width= 2 border_size + original_img.width and height = 2 border_size + original_img.height
def add_border(original_img,border_size): new_image=SimpleImage.blank(2 * border_size + original_img.width ,2 * border_size + original_img.height ) """ Task 2: Creating black border """ for y in range(new_image.height): for x in range(new_image.width): # converti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blanck_picture(img):\r\n blank_image = np.zeros((img.shape[0],img.shape[1],3), np.uint8)\r\n blank_image[0:, 0:] = 0, 0, 0\r\n return blank_image", "def blanck_picture(img):\r\n\r\n blank_image = np.zeros((img.shape[0],img.shape[1],3), np.uint8)\r\n blank_image[0:img.shape[0], 0:img.shape[1]] ...
[ "0.6714025", "0.66643125", "0.6648807", "0.6640605", "0.6602212", "0.65825695", "0.65742725", "0.6541321", "0.6522661", "0.65158063", "0.6493315", "0.6445736", "0.64126253", "0.63945997", "0.6369834", "0.63664925", "0.63554645", "0.63346535", "0.63316894", "0.6321211", "0.632...
0.7270797
0
Insert song data into songs table.
def __insert_song_data(cur, df): song_data = ( df.song_id.values[0], df.title.values[0], df.artist_id.values[0], (df.year.values[0]).item(), (df.duration.values[0]).item() ) cur.execute(song_table_insert, song_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __insert_songplay_data(cur, df):\n # for each songplay event, described by a row in the dataframe\n for index, row in df.iterrows():\n \n # get songid and artistid from song and artist tables\n cur.execute(song_select, (row.song, row.artist, row.length))\n results = cur.fetcho...
[ "0.73941624", "0.7331522", "0.7066406", "0.68631", "0.6647466", "0.6645665", "0.6616873", "0.65485114", "0.65401894", "0.65284353", "0.65230757", "0.65068346", "0.6503408", "0.65010774", "0.64738923", "0.64560986", "0.6448128", "0.64197713", "0.6394165", "0.63929015", "0.6354...
0.81044644
0
Insert artist data into artists table.
def __insert_artist_data(cur, df): artist_data = ( df.artist_id.values[0], df.artist_name.values[0], df.artist_location.values[0], (df.artist_latitude.values[0]).item(), (df.artist_longitude.values[0]).item() ) cur.execute(artist_table_insert, artist_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_artist(self, artist):\n\n insert_artist = 'INSERT INTO artists (name, email, artist_id) VALUES (?, ?, ?)'\n\n try:\n with sqlite3.connect(db_path) as conn:\n res = conn.execute(insert_artist, (artist.name, artist.email, artist.artist_id))\n new_id = r...
[ "0.7611701", "0.7460821", "0.72466445", "0.6892506", "0.664807", "0.6483982", "0.64573", "0.6429627", "0.6339579", "0.6308975", "0.6247855", "0.62155104", "0.61949694", "0.6127392", "0.6117658", "0.61147165", "0.60814154", "0.6041325", "0.6039622", "0.6022872", "0.60218924", ...
0.8167363
0
Reads a JSON song description file containing song data like artist, song duration, song name and more. Use this data to populate Sparkify songs and artists database tables.
def process_song_file(cur, filepath): # open song file df = pd.read_json(filepath,lines=True) # insert song record __insert_song_data(cur, df) # insert artist record __insert_artist_data(cur, df)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_song_file(cur, filepath):\n\n df = pd.read_json(filepath, lines=True)\n\n song_data = df[['song_id', 'title',\n 'artist_id', 'year', 'duration']].values[0]\n cur.execute(song_table_insert, song_data)\n\n artist_data = df[['artist_id', 'artist_name', 'artist_location',\n ...
[ "0.6549911", "0.6497012", "0.6399922", "0.6382647", "0.63702226", "0.63260293", "0.6318441", "0.62333465", "0.6057228", "0.60279065", "0.60231286", "0.59848255", "0.5944067", "0.5818484", "0.5815019", "0.5814996", "0.58030635", "0.5800439", "0.57995254", "0.5778145", "0.57499...
0.65851
0
Insert date information into time table.
def __insert_time_data(cur, df): # convert timestamp column to datetime t = pd.to_datetime(df.ts, unit='ms') # create a dataframe with corresponding database values time_data = ( t, t.dt.hour.values, t.dt.day.values, t.dt.weekofyear.values, t.dt.month.values,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_date_time(self):\n now = datetime.datetime.now()\n self.get_current().insert('insert', str(now.strftime(\"%I:%M %p %d-%m-%Y\")))", "def add_time(data, t):\n data['year'] = t.year\n data['month'] = t.month\n data['day'] = t.day\n data['hour'] = t.hour\n data['minute'] = t.min...
[ "0.6609031", "0.6235518", "0.6142989", "0.6069743", "0.5931244", "0.58743", "0.5769201", "0.5762199", "0.57264966", "0.57218134", "0.56859434", "0.5610331", "0.55671865", "0.5566922", "0.55216056", "0.5502776", "0.54993623", "0.5499289", "0.54931325", "0.543372", "0.54251844"...
0.6670788
0
Given a table of songplay events, for each songlay event, search the songid and artistid on songs and artists database tables, populating the songplays table with the songplay data, the song and the artist IDs of the music being played.
def __insert_songplay_data(cur, df): # for each songplay event, described by a row in the dataframe for index, row in df.iterrows(): # get songid and artistid from song and artist tables cur.execute(song_select, (row.song, row.artist, row.length)) results = cur.fetchone() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_music_entity_tables():\n\tsession = get_session()\n\tclient = SpotifyAuthAPI()\n\n\tplaylists = get_playlists_to_process(session)\n\n\tplaylist_count = playlists.count()\n\n\tfor i, playlist in enumerate(playlists):\n\t\tprint \"populating playlist {} of {}\".format(i + 1, playlist_count)\n\n\t\tplayl...
[ "0.70601434", "0.6467758", "0.6230667", "0.6196121", "0.5981305", "0.59780943", "0.5847388", "0.5834742", "0.57726717", "0.57629967", "0.5731776", "0.5681712", "0.56512606", "0.5603103", "0.55705607", "0.5554595", "0.5541459", "0.5522053", "0.5501534", "0.5497537", "0.5495845...
0.7293666
0
Test that attribute templates are validated against given bounds.
def test_object_template_validation(): length_template = PropertyTemplate("Length", bounds=RealBounds(2.0, 3.5, 'cm')) dial_template = ConditionTemplate("dial", bounds=IntegerBounds(0, 5)) color_template = ParameterTemplate("Color", bounds=CategoricalBounds(["red", "green", "blue"])) with pytest.raises...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assert_bounds_are_valid(\n self, new_bounds: devices.PrimaryBounds\n ) -> None:\n correct_length = len(new_bounds) == self.nprimaries\n tuples_of_float = all(\n [\n isinstance(item, tuple) and isinstance(b, (float, np.floating))\n for item in ne...
[ "0.6381215", "0.6191196", "0.60321444", "0.59561", "0.594038", "0.58459795", "0.58178777", "0.5817579", "0.58098483", "0.57411844", "0.573926", "0.570897", "0.5658499", "0.56572485", "0.5657168", "0.5644796", "0.56357795", "0.55865157", "0.55815446", "0.5565243", "0.55587995"...
0.6241862
1
Test the retrieve drinks enpoint /data/drinks"
def test_if_user_can_retrive_drinks(self): # take data from the ones extracted from the json file drinks = self.test_data["drinks"] save_drinks = [] for drink in drinks: drink = Drink(**drink) save_drinks.append(drink) Drink.objects.bulk_create(save_drink...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_response(drink):\n\n #create url\n drink2 = introcs.replace_str(drink,' ','%20')\n url = str('https://www.thecocktaildb.com/api/json/v1/'+APIKEY+'/search.php?s='+str(drink2))\n\n #query url\n result = introcs.urlread(url)\n\n #return result\n return result", "def test_get_offers(...
[ "0.62879044", "0.6248839", "0.61403203", "0.6029827", "0.595824", "0.5950868", "0.5855003", "0.5836545", "0.58276004", "0.58260334", "0.5825966", "0.58221614", "0.5807348", "0.58021325", "0.5796781", "0.5774858", "0.57394475", "0.5738574", "0.5729782", "0.5723868", "0.5719225...
0.6907348
0
Test the add data endpoint /data/data_collected/
def test_if_user_can_add_and_retrieve_data(self): # take the first three drinks drinks = self.test_data["drinks"][:3] # create drink objects from the json data drinks = [Drink(**i) for i in drinks] Drink.objects.bulk_create(drinks) data = self.test_data["data"][0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_process_data(self):\n pass", "def insert_data(self):\n # Make a connexion with a mock database\n self.generate_data_collection()", "def test_add(self):\n # Everything added will be deleted later in test_delete.\n first_name = 'Trevor'\n last_name = 'Harvey'\n ...
[ "0.65526533", "0.65504", "0.64901567", "0.64688575", "0.637096", "0.6353962", "0.63452864", "0.62429106", "0.62413156", "0.6223261", "0.6206434", "0.6182021", "0.61503667", "0.6114721", "0.6098006", "0.6083136", "0.60707694", "0.60618895", "0.60558987", "0.6031864", "0.602494...
0.7164119
0
Merge changes introduced by notebooks local and remote from a shared ancestor base. Return new (partially) merged notebook and unapplied diffs from the local and remote side.
def merge_notebooks(base, local, remote, args=None): if args and args.log_level == "DEBUG": for (name, nb) in [("base", base), ("local", local), ("remote", remote)]: _logger.debug("%s In merge, input %s notebook:" % ("="*20, name)) buf = StringIO() pretty_print_notebook(n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_get_diffbase(review_target, branch):\n return ['git', 'merge-base', review_target, branch]", "def merge(): #Status: WIP\r\n pass", "def merge_from(self, other):\n assert not self.is_final\n if self.parent is not None:\n assert other.parent is not None\n self.parent.merge_from(o...
[ "0.53412235", "0.5067476", "0.48546484", "0.47724307", "0.4723565", "0.4699313", "0.4685136", "0.46764392", "0.46666393", "0.46520692", "0.46505848", "0.46465474", "0.4643478", "0.46357703", "0.46177492", "0.46163565", "0.46112147", "0.4602513", "0.45935103", "0.4579357", "0....
0.72284716
0
Assure that the partition has only the specified number of replicas, deleting any extras
def delete_replicas(self, target_count): while len(self.replicas) > target_count: self.remove_replica(self.replicas[-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_cluster_resource_quota(self):\n pass", "def test_delete_hyperflex_cluster_storage_policy(self):\n pass", "def deleteShards():\n os.popen('rm *_shard')", "def test_base_replica_repair_with_contention(self):\n self._base_replica_repair_test(fail_mv_lock=True)", "def nu...
[ "0.59140897", "0.590533", "0.5891525", "0.5885933", "0.5833488", "0.5766058", "0.57631654", "0.57603097", "0.56855255", "0.56625503", "0.56470937", "0.5603259", "0.5556599", "0.554412", "0.552986", "0.55177534", "0.5512172", "0.54553056", "0.5409592", "0.54087335", "0.5405373...
0.7159342
0
Given a position and a broker, make sure the broker is in the replica set for this partition at the given position.
def add_or_update_replica(self, position, new_broker): if len(self.replicas) > position: if self.replicas[position] == new_broker: # No change in the replica at this position return else: # New replica at this position. Swap it in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_replica_for_exchange(self, replica):\n pass", "def replicaof(self, *args, **kwargs) -> NoReturn:\n raise RedisClusterException(\"REPLICAOF is not supported in cluster mode\")", "def is_replica(self):\n if (\n self.replica\n and self.aip\n and no...
[ "0.5618285", "0.53380245", "0.52990556", "0.4901489", "0.4876627", "0.484487", "0.48137334", "0.47763926", "0.47661713", "0.4744803", "0.47381744", "0.4703642", "0.46730462", "0.46692634", "0.46577626", "0.46351507", "0.46206054", "0.4593262", "0.4572723", "0.45560184", "0.45...
0.59172034
0
This function will return only the first part of the column names query so that you can get the column names Will return "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = "
def colNames_string(self): # SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'some_table'; return "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = "
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _columns(cursor, table):\n cursor.execute('''\n SELECT column_name FROM information_schema.columns WHERE table_schema = 'public' AND table_name = %s\n ''', (table, ))\n return [column['column_name'] for column in cursor.fetchall()]", "def _get_column_names(self, query):\n\n try:\n ...
[ "0.7587509", "0.7528652", "0.7386827", "0.73188144", "0.7196022", "0.71589047", "0.7113789", "0.70294404", "0.7011823", "0.69226605", "0.69214416", "0.6867249", "0.68229336", "0.6776281", "0.6633766", "0.66171926", "0.64768475", "0.6472669", "0.6421773", "0.6416172", "0.64115...
0.75491923
1
Compiles the given vue.js template to javascript
def vue_template_compiler(source, options=None): options = options or {} res = NodeLikeInterpreter().evaljs( ('const compiler = require("vue-template-compiler");' 'var compiled = compiler.compile(dukpy.source);', 'var result = {"error": null, "output": compiled.render};' 'resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_template(template_file, data):\n from cStringIO import StringIO\n output_stream = StringIO()\n\n import xyaptu\n xcp = xyaptu.xcopier(data, ouf=output_stream)\n xcp.xcopy(template_file)\n\n output = output_stream.getvalue()\n return output", "def render(template, variables={}):\r...
[ "0.5720077", "0.5713875", "0.5637231", "0.5489268", "0.54380643", "0.5364401", "0.5290392", "0.5281405", "0.52704805", "0.52584887", "0.5253346", "0.5240135", "0.52134985", "0.5159162", "0.513993", "0.51194215", "0.5086437", "0.5069739", "0.50688916", "0.50660187", "0.5045320...
0.7864779
0
Conducts forward propagation using Dropout. X is a numpy.ndarray of shape (nx, m) containing the input data for the network. nx is the number of input features. m is the number of data points. weights is a dictionary of the weights and biases of the neural network. L the number of layers in the network. keep_prob is th...
def dropout_forward_prop(X, weights, L, keep_prob): cache = {} cache['A0'] = X for i in range(L): layer = str(i + 1) prev = str(i) w = 'W' + layer b = 'b' + layer a = 'A' + layer ap = 'A' + prev drop = 'D' + layer z = np.matmul(weights[w], cach...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dropout_forward_prop(X, weights, L, keep_prob):\n rnd = np.random.rand\n cache = {}\n cache[\"A0\"] = X\n for j in range(L):\n z = np.dot(weights[\"W\" + str(j+1)], cache[\n \"A\" + str(j)]) + (weights[\"b\" + str(j+1)])\n if j == L-1:\n \"\"\" The last layer use...
[ "0.8092365", "0.7698822", "0.7559529", "0.6820467", "0.6445729", "0.6243247", "0.61436987", "0.6070557", "0.6039815", "0.60051537", "0.5972164", "0.5904196", "0.588693", "0.58746326", "0.5862984", "0.5819266", "0.5816549", "0.57878774", "0.5781992", "0.5780524", "0.57765776",...
0.7797605
1
Set Section Number for Assembly This collects the products on a wall and loops through the products increasing the count of the number of openings found. Then assigns the number to comment 2 of the part This can only be set for parts that have a integer assigned for the mv.opening_name property
def set_section_number(self, assembly): wall_bp = utils.get_wall_bp(assembly.obj_bp) product_bp = utils.get_bp(assembly.obj_bp, 'PRODUCT') if wall_bp: products = self.get_wall_products(wall_bp) adjusted_opening_number = 0 for product in products: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_library_section(self, path: list[str], material_id: int) -> int:\n next_index = next_object_key(self)\n new_section = Section()\n new_section.load_section_from_library(path, material_id)\n setattr(self, str(next_index), new_section)\n return next_index", "def add_custom...
[ "0.5174256", "0.49899268", "0.4913171", "0.48809946", "0.4871566", "0.48547396", "0.48413014", "0.47745255", "0.47412124", "0.47402564", "0.4733575", "0.47258484", "0.4708002", "0.4698902", "0.4694061", "0.46830198", "0.465838", "0.46321988", "0.46154633", "0.46126166", "0.46...
0.8266816
0
Get Sorted List of Products on a Wall
def get_wall_products(self, wall_bp): products = [] for child in wall_bp.children: props = props_closet.get_object_props(child) if props.is_closet or props.is_fixed_shelf_and_rod_product_bp: child.mv.comment = wall_bp.mv.name_object products.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_products():\n products = product.Product.query. \\\n order_by(desc(product.Product.likes)).all()[:6]\n context = {\n 'products': products\n }\n return render_template('stores/topstores.html', **context)", "def sort_products(param: str, querySet: QuerySet):\n products_list...
[ "0.5951398", "0.581583", "0.578056", "0.57139724", "0.56682044", "0.56030166", "0.5492769", "0.54736334", "0.5452253", "0.5443932", "0.54422987", "0.54090714", "0.5393291", "0.53909343", "0.5382308", "0.5372019", "0.5362841", "0.5352322", "0.5346223", "0.5342234", "0.5313254"...
0.7254866
0
Get Sorted List of Panels in a product
def get_product_panels(self, product_bp, panel_list): for child in product_bp.children: props = props_closet.get_object_props(child) if props.is_panel_bp: assembly = fd_types.Assembly(child) if common_closet_utils.part_is_not_hidden(assembly): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_wall_panels(self, wall_bp):\n wall_panels = []\n products = self.get_wall_products(wall_bp)\n for product in products:\n product_panel_list = self.get_product_panels(product, [])\n for product_panel in product_panel_list:\n wall_panels.append(produc...
[ "0.6058318", "0.59466535", "0.5723221", "0.54906386", "0.54906386", "0.5452169", "0.5402853", "0.5379197", "0.53562945", "0.53431034", "0.53294426", "0.5325394", "0.53230935", "0.53167313", "0.5307443", "0.5296484", "0.5198259", "0.5186805", "0.51833737", "0.5181582", "0.5126...
0.7261949
0
Get Sorted List of Panels for a wall Returns List of Base Points
def get_wall_panels(self, wall_bp): wall_panels = [] products = self.get_wall_products(wall_bp) for product in products: product_panel_list = self.get_product_panels(product, []) for product_panel in product_panel_list: wall_panels.append(product_panel) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_panels(rectangles):\n\n pairs = []\n for rect in rectangles:\n if (2 * rect[1][0] < rect[1][1]) or (rect[1][0] > 2 * rect[1][1]):\n if 2 * rect[1][0] < rect[1][1]:\n long_dim1 = 0\n elif rect[1][0] > 2 * rect[1][1]:\n long_dim1 = 1\n\n ...
[ "0.6349068", "0.5936909", "0.5917394", "0.5908087", "0.5884993", "0.5861732", "0.58608633", "0.58252734", "0.5817485", "0.5776837", "0.57392085", "0.571232", "0.57121414", "0.57106364", "0.5676142", "0.566193", "0.5654982", "0.5653337", "0.56288165", "0.562557", "0.5623271", ...
0.6852642
0
Copy a key from to
def copy_key(self, frm, to): frm_location = self.s3_location(frm) copy_source = { 'Bucket': frm_location.bucket, 'Key': frm_location.key[1:] } to_location = self.s3_location(to) bucket = self.get_bucket(to_location.bucket) log.info("Copying %s to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_key(self, key):\n # Get the TTL for the key\n ttl = self.src.ttl(key)\n\n # -2 means the key doesn't actually exist and is a lie\n if ttl == -2:\n # self.log.debug(f\"TTL -2: {key}\")\n return\n\n # -1 means the key has no expiration and we set it t...
[ "0.7891342", "0.71922034", "0.7077428", "0.6817545", "0.66453826", "0.64820206", "0.6481614", "0.6416798", "0.6412328", "0.63470095", "0.62531435", "0.6101375", "0.6060823", "0.6043063", "0.6036096", "0.60295564", "0.602396", "0.58916676", "0.5850373", "0.58423436", "0.581670...
0.7800135
1
Clean the input buffer and get a name that's typed in.
def getName(): tcflush(sys.stdin, TCIFLUSH) name = input(" You say:\n ") updateNameDatabase(name) return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n name = input(\"What is your name? \")\n if len(name) > 0:\n self.name = name", "def input_name(self):\n return self.__input_name", "def get_name():\n return raw_input(\"What's your name? \")", "def get_name():\n print(\"\")\n name = input(\"Greet...
[ "0.6385", "0.6207764", "0.6180437", "0.61366755", "0.61346084", "0.61324376", "0.61028165", "0.6036705", "0.5994801", "0.5983757", "0.59797794", "0.5919747", "0.5912155", "0.5897724", "0.58420867", "0.58420867", "0.58420867", "0.58420867", "0.58420867", "0.58420867", "0.58420...
0.6812864
0
Clean the input buffer and get a question that's typed in. Check whether the question is valid and assign it a number.
def getQuestion(): tcflush(sys.stdin, TCIFLUSH) question = input(" You say:\n ") return validQuestion(question)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def q3(question):\r\n while True:\r\n try:\r\n q3 = int(input(\"3. What is Space Mountain's top speed? \"))\r\n except ValueError:\r\n print(\"Not an integer. Try again.\")\r\n else:\r\n return q3", "def query_number(question, default=1):\n if default i...
[ "0.61125576", "0.60552406", "0.60416114", "0.5948589", "0.58855236", "0.5854401", "0.5830539", "0.5826007", "0.5791179", "0.57606035", "0.5711347", "0.5687633", "0.5670047", "0.56182665", "0.56069666", "0.56068426", "0.5589072", "0.5507646", "0.5489154", "0.5453224", "0.53819...
0.68517786
0
Checks if the question is valid and either returns the idex of the answer or 1 if the question is invalid.
def validQuestion(question): with open("validQuestions.txt") as f: questions = f.readlines() questions = [x.strip() for x in questions] f.close() if question not in questions: return -1 else: return questions.index(question)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_correct_answer(self):\n if not self.is_answered():\n return None\n\n if self.question_type == 6: # ArithmeticTask\n return self.option_id == self.sub_question_type % 3 + 1\n elif self.question_type == 8: # ImageTask\n return self.option_id == self.sub_...
[ "0.54407066", "0.54207426", "0.53760725", "0.5322238", "0.5310691", "0.5254964", "0.52356493", "0.51965064", "0.5154023", "0.51331747", "0.5088845", "0.50735825", "0.50370145", "0.501664", "0.5015551", "0.50013846", "0.5000354", "0.49814048", "0.4976692", "0.49745822", "0.496...
0.5770506
0
Takes the index of a valid question and answers it.
def answerQuestion(questionIndex): with open("validQuestionAnswers.txt") as f: answers = f.readlines() answers = [x.strip() for x in answers] f.close() say(answers[questionIndex])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answer_question(self, question: str, answers: List, correct_idx: int):\n\n print(f'Answering question \"{question}\"')\n\n if random.random() < self.accuracy:\n print('choosing the correct answer...')\n return answers[correct_idx]\n\n print('choosing the wrong answer....
[ "0.7261938", "0.66562337", "0.62853575", "0.6284653", "0.62221134", "0.621178", "0.61885947", "0.6133315", "0.61233443", "0.60936624", "0.609328", "0.60869336", "0.6070864", "0.6061757", "0.60096675", "0.5970721", "0.5932469", "0.5873908", "0.5851904", "0.5834502", "0.5830821...
0.7478638
0
Function to simulate the robot saying something.
def say(thing): print(' Robot says:\n ', thing, '\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func(self):\n if not self.raw:\n self.msg(\"Say what?\")\n return\n options = {\"is_pose\": True}\n speech = self.raw.lstrip(\" \")\n # calling the speech hook on the location\n speech = self.caller.location.at_say(speech)\n # Feedback for the obj...
[ "0.7130198", "0.69434243", "0.68653554", "0.6862429", "0.68530047", "0.68277746", "0.67506194", "0.6745897", "0.6740784", "0.6708938", "0.6704635", "0.6582257", "0.65500647", "0.6539492", "0.6502522", "0.6440188", "0.6378434", "0.6367629", "0.63538563", "0.6323134", "0.629302...
0.7752175
0
Separates 'line' by spaces, similar to the builtin 'split' function. However, it also treats punctuation as separate words.
def break_it_down(line): # Make a copy for us to play with words = str(line) # Strategy: Leverage the built-in split, by adding spaces # around punctuation # Supported punctuation: ; : , ? ! . " for p in (':', ';', ',', '?', '!', '.', '"'): words = words.replace(p, ' {p} '.format(p=p)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_words(line):\n return", "def split(line, skipspace=0):\n a = re.sub('\\s+',' ', line.strip()) ##normalize white's -> 1 space\n a = re.split('(\\s)', a) ##split/keep space\n for aa in a: ## for each PPH, convert it to SPH\n if aa==' ':\n ...
[ "0.7058087", "0.6917028", "0.6839836", "0.67597264", "0.66572416", "0.664746", "0.65869975", "0.6507391", "0.642199", "0.6243214", "0.6220661", "0.6123521", "0.6098219", "0.6062644", "0.6021635", "0.6019111", "0.59929484", "0.59677184", "0.5951733", "0.5949034", "0.59477687",...
0.7155448
0
Reads in a book and creates the trigrams
def read_in_book(): # Keep track of paragraphs new_lines = False with open(book_filename, 'r') as book: # Ignore the top of the file, it's all boilerplate # 'project gutenberg' stuff anyway line_it = iter(book) line = next(line_it) while line[:3] != "***": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(book, num):\n book_text = read_book_from_file(book)\n filtered_book = convert_book_to_list_of_words(book_text)\n trigram_dict = create_trigram_dict(filtered_book)\n return generate_text(trigram_dict, num)", "def make_trigrams(texts,trigram_mod,bigram_mod):\n return [trigram_mod[bigram_mod...
[ "0.68062276", "0.6260758", "0.6202152", "0.6153598", "0.5912411", "0.5798249", "0.5704431", "0.5645663", "0.5528312", "0.54867786", "0.5464841", "0.54393923", "0.5408576", "0.5360164", "0.5352898", "0.53275985", "0.53247416", "0.5324078", "0.5320836", "0.53150266", "0.5311325...
0.7397099
0
Add 'word' to the sentence. 'word' could be punctuation, treat it accordingly
def add_word_to_sentence(sentence, word, dialog=False): # In general, add a space before adding this word # In some instances, do not add a space: # * word is: . , ; : ! ? # * word is an ellipsis # * If the previous word was: \n\n skip_space = ((word in ('.', ',', ':', ';', '!', '?')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, word):\r\n if not word or word.strip() == '':\r\n return\r\n self.words.append(word)", "def add_sentence(self, sentence):\n for word in sentence.split(' '):\n self.add_word(word)", "def add_sentence(self, sentence):\n for word in sentence.split(' ...
[ "0.723863", "0.72308135", "0.72308135", "0.70532537", "0.70370543", "0.7023629", "0.7000412", "0.6985124", "0.6963167", "0.6880629", "0.6836367", "0.6826433", "0.679377", "0.6777574", "0.67711866", "0.6751843", "0.67057586", "0.6701697", "0.66921616", "0.6685027", "0.6638351"...
0.76089525
0
Generates num_sentences number of sentences.
def write_sentences(num_sentences): sentence_count = 0 sentences = list() # Get a starting point word_tuple = random.choice(list(trigrams.keys())) value = random.choice(trigrams[word_tuple]) # Find a trigram that'll start a sentence by finding '\n\n' while word_tuple[0] != '\n\n': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_number_of_sentences(self):\n self.number_of_sentences = int(self.num_sentences.get())", "def generate_sentences(self, count=5):\n\n with self.open_text_data() as f:\n result = self.read_sentences(f, count=count)\n return result", "def _get_num_sentences(doc: Doc, min_sen...
[ "0.74095225", "0.6612392", "0.6589216", "0.655897", "0.63650364", "0.61993533", "0.6197445", "0.61843055", "0.60508823", "0.6017097", "0.60111636", "0.6007302", "0.59827065", "0.59385765", "0.5907668", "0.5861528", "0.58307236", "0.57782775", "0.57639855", "0.5741121", "0.573...
0.70788294
1
Convert plain dictionaries to MutationDict.
def coerce(cls, key, value): # @ReservedAssignment if not isinstance(value, MutationDict): if isinstance(value, dict): return MutationDict(value) # this call will raise ValueError return Mutable.coerce(key, value) else: return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_change(binary_dict:dict):\r\n dict_change= {}\r\n for key, value in binary_dict.items():\r\n dict_change[value] = key\r\n return dict_change", "def values(self) -> Dict[str, Any]:\n return self.dict.copy()", "def asdict(v: Any) -> Dict[Any, Any]:\n return to_dict(v, reuse_ins...
[ "0.5589519", "0.5548092", "0.55288583", "0.55198234", "0.54380774", "0.53876173", "0.5385113", "0.53800666", "0.5363616", "0.5341232", "0.5340839", "0.53195035", "0.5279707", "0.527896", "0.52454096", "0.52354544", "0.5224615", "0.521172", "0.52049816", "0.520259", "0.5202309...
0.63197917
0
A type to encode/decode JSON on the fly. sqltype is the string type for the underlying DB column.
def JSONAlchemy(sqltype): class _JSONEncodedObj(JSONEncodedObj): impl = sqltype return MutationObj.as_mutable(_JSONEncodedObj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_column_type(cls, **kwargs: Any) -> Any:\n return sqlalchemy.JSON()", "def sql_to_python_type(sql_type):\n if sql_type.startswith(\"CHAR(\"):\n return str\n\n if sql_type.startswith(\"INTERVAL\"):\n # Calcite will always convert to milliseconds\n # no matter what the actu...
[ "0.7661815", "0.74991727", "0.743899", "0.68335366", "0.6789992", "0.6789992", "0.67713505", "0.6475594", "0.6413169", "0.64099956", "0.6337696", "0.6271806", "0.6241204", "0.6188259", "0.60408694", "0.6027532", "0.6002539", "0.5950744", "0.588287", "0.58516645", "0.5842662",...
0.7874687
0
Convert a numpy dtype into a Column datatype. Only handles common types. Implemented as a function to decouple from numpy
def convert_numpy_type(cls, dtype): import numpy as np m = { 'int64': cls.DATATYPE_INTEGER64, 'float64': cls.DATATYPE_FLOAT, 'object': cls.DATATYPE_TEXT # Hack. Pandas makes strings into object. } t = m.get(dtype.name, None) if not t: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dtype(x, dtype):\n return x.type(dtype)", "def col(name=None, dtype=None):\r\n if dtype is None:\r\n dtype = config.floatX\r\n type = CudaNdarrayType(dtype=dtype, broadcastable=(False, True))\r\n return type(name)", "def _astype_internal(self, column: str, numpy_dtype: str) -> None:\n...
[ "0.72403413", "0.6946642", "0.6823858", "0.6764341", "0.6701959", "0.6656315", "0.665516", "0.66546", "0.6622384", "0.6566192", "0.655135", "0.6548834", "0.6538818", "0.64513427", "0.6432096", "0.6430312", "0.64242333", "0.63871026", "0.63726074", "0.6336595", "0.6335416", ...
0.7141431
1
Like dict, but does not hold any null values.
def nonull_dict(self): return {k: v for k, v in self.dict.items() if v and k != '_codes'}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_empty_values(_dict):\n return {k: v for k, v in list(_dict.items()) if v is not None}", "def remove_nonetype(dictionary):\n\n return {k: v for k, v in dictionary.items() if v is not None}", "def remove_none_values(dict_):\r\n\r\n res = {}\r\n res.update((key, value) for key, value in dic...
[ "0.6980913", "0.68990964", "0.68517286", "0.6843782", "0.6819606", "0.6797191", "0.674241", "0.6687487", "0.66704786", "0.659102", "0.6541672", "0.64255816", "0.63741374", "0.63616335", "0.6356433", "0.6352695", "0.6298491", "0.628249", "0.61883426", "0.6167995", "0.6152006",...
0.73098445
0
Return a SQL fragment to translate the column names to vids. This allows the identity of the column to propagate through views.
def vid_select(self): cols = [] raise DeprecationWarning() return ",".join(["{} AS {}".format(c.name, c.vid) for c in self.columns])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colNames_string(self):\n # SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'some_table';\n return \"SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = \"", "def get_column_names(self):\n # here, creating combined column/volue column names for uniq...
[ "0.59262216", "0.5894315", "0.574054", "0.56851643", "0.5681624", "0.5644304", "0.5625935", "0.55269486", "0.54988027", "0.5494023", "0.54818374", "0.54605204", "0.54546434", "0.543926", "0.54041135", "0.5399145", "0.53989536", "0.5346631", "0.5316943", "0.5296577", "0.528737...
0.6494514
0
Using the size values for the columns for the table, construct a regular expression to parsing a fixed width file.
def get_fixed_regex(self): import re pos = 0 regex = '' header = [] for col in self.columns: size = col.width if col.width else col.size if not size: continue pos += size regex += "(.{{{}}})".format(size) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _xml_oneliner_re_from_tab_width(tab_width):\r\n return re.compile(r\"\"\"\r\n (?:\r\n (?<=\\n\\n) # Starting after a blank line\r\n | # or\r\n \\A\\n? # the beginning of the doc\r\n )\r\n ( # save i...
[ "0.5282245", "0.5202611", "0.51584333", "0.5112584", "0.5097661", "0.50882554", "0.50331146", "0.5007031", "0.5002561", "0.49994928", "0.4918503", "0.48867288", "0.4848906", "0.4840389", "0.48324287", "0.4815891", "0.4813815", "0.48072702", "0.48031062", "0.48031032", "0.4784...
0.70005393
0
Return the column specification suitable for use in the Panads read_fwf function. This will ignore any columns that don't have one or both of the start and width values
def get_fixed_colspec(self): # Warning! Assuming th start values are sorted. Really should check. return ( [c.name for c in self.columns if c.start and c.width], [(c.start, c.start + c.width) for c in self.columns if c.start and c.width] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cols_dummy():", "def get_cols_drop():", "def get_colspecs(self):\n width = 80\n\n total_width = 0.0\n # first see if we get too wide.\n for node in self._col_specs:\n colwidth = float(node['colwidth']+1) / width\n total_width += colwidth\n self._...
[ "0.6024424", "0.596831", "0.55173266", "0.55082816", "0.5469748", "0.5435759", "0.5397927", "0.53476435", "0.5337917", "0.5330196", "0.52848995", "0.5283734", "0.5212504", "0.519947", "0.5173507", "0.5160879", "0.5160859", "0.5137145", "0.5115543", "0.5109305", "0.5104314", ...
0.6883937
0
Return a function to generate a hash for the row.
def _get_hasher(self): import hashlib # Try making the hash set from the columns marked 'hash' indexes = [i for i, c in enumerate(self.columns) if c.data.get('hash', False) and not c.is_primary_key] # Otherwise, just use everything by the primary key. if len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row_hash(self, values):\n\n if self._row_hasher is None:\n self._row_hasher = self._get_hasher()\n\n return self._row_hasher(values)", "def __hash__(self):\n return hash((self.rowx, self.row_name))", "def __hash__(self):\n return hash((self.rowx, self.row_name))", "...
[ "0.7663322", "0.71563137", "0.71563137", "0.70118684", "0.69970787", "0.686038", "0.6825169", "0.67699486", "0.6738878", "0.6705481", "0.6677108", "0.65766907", "0.655196", "0.651539", "0.64861447", "0.645168", "0.6409274", "0.6398196", "0.6374908", "0.6355639", "0.6340128", ...
0.7440421
1
Calculate a hash from a database row.
def row_hash(self, values): if self._row_hasher is None: self._row_hasher = self._get_hasher() return self._row_hasher(values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_hasher(self):\n import hashlib\n\n # Try making the hash set from the columns marked 'hash'\n indexes = [i for i, c in enumerate(self.columns) if\n c.data.get('hash', False) and not c.is_primary_key]\n\n # Otherwise, just use everything by the primary key.\n ...
[ "0.68689716", "0.6646721", "0.65519816", "0.6487062", "0.6475017", "0.6446482", "0.642479", "0.6363834", "0.6354104", "0.6345296", "0.6343771", "0.6343771", "0.6314289", "0.6281258", "0.6269364", "0.6265466", "0.6261672", "0.62480664", "0.62444127", "0.6209676", "0.61848885",...
0.7178461
0
Create new fields under Item using Custom Field.
def add_new_item_field(*fields, **keywords): for field in fields: print "Creating {0} custom field...".format(field) doc = frappe.get_doc({ "doctype": "Custom Field", "dt": "Item", "fieldtype": "Data", "label": field, "insert_after": keywo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, field_create_information):\n field = Field.create_field_from_type(self.context, field_create_information)\n self.add_child(field)\n qry = CreateEntityQuery(self, field, field)\n self.context.add_query(qry)\n return field", "def __createField(self, field):\n ...
[ "0.6731207", "0.65036666", "0.63113326", "0.6303203", "0.6252452", "0.6211109", "0.61917996", "0.60896796", "0.60567904", "0.6042853", "0.6004768", "0.5927914", "0.5907266", "0.5865502", "0.58608884", "0.58579487", "0.58533096", "0.5780834", "0.577232", "0.5770017", "0.574490...
0.8216481
0
Checking for white 220 is the threshold 0.8 is the tolerance level
def check_for_white(img): return white_percentage(img, 220, 0.8)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threshold(self, value):\r\n threshold = 0.5\r\n if value >= threshold:\r\n return 1\r\n else:\r\n return 0", "def check_if_white_back_black_edge(pred):\n values = np.unique(pred)\n # print(values)\n\n # check if binary\n if len(values) > 2:\n print(\"Your prediction ...
[ "0.67174834", "0.6487796", "0.6463961", "0.6462622", "0.6449646", "0.64339715", "0.6431686", "0.6416966", "0.6413505", "0.6399163", "0.6366602", "0.6365009", "0.63525826", "0.63525826", "0.6338424", "0.6333677", "0.6312592", "0.62757385", "0.6274855", "0.62545544", "0.6245186...
0.74915415
1
Read values for this FRDNodeBlock Object from File in_file.
def _read(self, in_file): in_file.read(18) # pad bytes self.numnod = int(in_file.read(12)) in_file.read(37) # pad bytes self.format = int(in_file.read(1)) in_file.read(1) # eol self.nodes = [] for _ in range(self.numnod): node = FRDNode() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read (self, file):\n\t\tself.unpack (file.read (self.size()))", "def _read(self, in_file):\n #\n # I know this function is long, but the FRD block is long as well...\n # Splitting this into multiple functions would not help in my opinion.\n # Therefore -> shut up pylint\n #...
[ "0.64550364", "0.64484376", "0.6424904", "0.6268296", "0.61367387", "0.6080603", "0.5937796", "0.5892623", "0.5884091", "0.5808201", "0.5802144", "0.5770803", "0.57474285", "0.57171625", "0.5675041", "0.5671114", "0.5668935", "0.565586", "0.56404734", "0.5631533", "0.56228155...
0.7449321
0
Read content of .frd file at file_name into this FRDFile object.
def load(self, file_name): self.file_name = file_name with open(file_name, 'rb') as in_file: eof = (in_file.read(1) == b'') while not eof: key = int(in_file.read(4)) code = in_file.read(1).decode() block = None if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, file_name):\n self.file_name = file_name\n self.frd = FRDFile(file_name)\n self._build_node_kon()\n self._build_step_idx()", "def read_file(self, file_name):\n f = file(file_name, \"r\")\n temp = f.read()\n f.close()", "def read_file(self, file_na...
[ "0.67018384", "0.6318946", "0.63110256", "0.6101249", "0.60530573", "0.6052063", "0.59483385", "0.59376913", "0.58921003", "0.58904785", "0.58904785", "0.58143395", "0.57983696", "0.5744066", "0.5725705", "0.57159245", "0.5706403", "0.5704132", "0.56743497", "0.5661764", "0.5...
0.6547037
1
Load a .frd file into the parser.
def load(self, file_name): self.file_name = file_name self.frd = FRDFile(file_name) self._build_node_kon() self._build_step_idx()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, filename=None):\n importer = aspecd.io.AdfImporter()\n importer.source = filename\n importer.import_into(self)", "def parse_from_file (path):\n with open(path) as f:\n return NFFG.parse(f.read())", "def parse_data(fp):\n pass", "def parser(path):\n\t\n\tdata = A...
[ "0.5935266", "0.59271276", "0.5809597", "0.5808671", "0.57380855", "0.570663", "0.56843936", "0.5647207", "0.56359386", "0.5616617", "0.55926186", "0.55878085", "0.5581737", "0.55808693", "0.557875", "0.55486715", "0.55269253", "0.5493946", "0.54497474", "0.5449209", "0.54446...
0.6210889
0
Return time and date of the .frd File as dateTime object.
def get_time_and_date(self): date_str = '' time_str = '' for header in self.frd.headers: if header.code != 'U': continue elif header.string.startswith('DATE'): date_str = header.string.replace('DATE', '').strip() elif header.str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_date(self, file: str) -> date:", "def get_reference_datetime(file):\n date_string = file.root.discharge1._f_getAttr('reference_datetime')[0]\n ref_date = datetime.datetime.strptime(date_string, '%d-%b-%Y;%H:%M:%S.%f')\n\n return ref_date", "def fileTime(ft):\n return datetime(1601, 1, ...
[ "0.7005805", "0.67642593", "0.63170445", "0.6281667", "0.62567914", "0.6216308", "0.6198236", "0.61430544", "0.6116791", "0.61078763", "0.6100694", "0.6098714", "0.6086509", "0.60758436", "0.6074926", "0.60441864", "0.60393834", "0.6037444", "0.60246754", "0.6000636", "0.5949...
0.71200657
0
Get a list of result values in the .frd File for specified nodes. If no name or step is specified, all results are returned in a list ordered by steps and names in order of appearance in the .frd file. Note that the returned list entries are always iterables, even if the result has only one component (e.g. the return v...
def get_results_node(self, number, names=None, steps=None): results = [] if steps is not None: steps = self._confirm_step_selection(steps) for r_block in self.frd.result_blocks: if names is not None and r_block.name not in names: continue eli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getResults():\n return declList", "def reduce_file_nodes(self, nodes, names=None, steps=None):\n if steps is not None:\n steps = self._confirm_step_selection(steps)\n\n idx_start = len(self.frd.node_block.numnod) - 1\n idx_end = -1\n\n for idx in range(idx_start, idx...
[ "0.5681287", "0.54788417", "0.53779167", "0.5319097", "0.52856684", "0.52736264", "0.5220714", "0.51983696", "0.50550765", "0.5038064", "0.5021821", "0.5014237", "0.4971941", "0.493412", "0.49338633", "0.49247366", "0.49199513", "0.49097717", "0.48912197", "0.4874564", "0.485...
0.660576
0
Get a list of result values in the .frd File for specified coords. If the given coords do not match a single node, the result is interpolated within the closest element. If no name or step is specified, all results are returned in a list ordered by steps and names in order of appearance in the .frd file. Note that the ...
def get_results_pos(self, pos, names=None, steps=None): results = [] if steps is not None: steps = self._confirm_step_selection(steps) for r_block in self.frd.result_blocks: if names is not None and r_block.name not in names: continue elif st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_results_node(self, number, names=None, steps=None):\n results = []\n\n if steps is not None:\n steps = self._confirm_step_selection(steps)\n\n for r_block in self.frd.result_blocks:\n if names is not None and r_block.name not in names:\n continue\n ...
[ "0.5653371", "0.55662644", "0.5507174", "0.5180463", "0.51406765", "0.5003665", "0.49956143", "0.48708457", "0.4850714", "0.48479825", "0.48446918", "0.482175", "0.48052558", "0.4792894", "0.4790502", "0.4779765", "0.47455412", "0.47317955", "0.47205234", "0.47185212", "0.469...
0.65983754
0
Peform a given test on a subset of all result values. If the test fails on a node, an AssertionError, showing node, name and step information is raised.
def assert_node_results(self, func, nodes=None, names=None, steps=None): if steps is not None: steps = self._confirm_step_selection(steps) for r_block in self.frd.result_blocks: if names is not None and r_block.name not in names: continue elif steps i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test(self, **kwargs):\n raise ValueError(\"This function is not available in lazy results evaluation as it would \"\n \"require all pairwise tests to be performed.\")", "def run_tests():\n def print_result(result, correct):\n if result == correct:\n print(...
[ "0.609516", "0.5704925", "0.56402946", "0.56204367", "0.5566396", "0.55041707", "0.548175", "0.548175", "0.5443711", "0.54336387", "0.54155505", "0.54101396", "0.5401243", "0.5401163", "0.5395193", "0.53657943", "0.535768", "0.5350234", "0.5317045", "0.5309218", "0.5298009", ...
0.6197507
0
Reduce the .frd file to only the specified node numbers. Unspecified nodes and their results , as well as all elements and irrelevant parameter headers will be removed.
def reduce_file_nodes(self, nodes, names=None, steps=None): if steps is not None: steps = self._confirm_step_selection(steps) idx_start = len(self.frd.node_block.numnod) - 1 idx_end = -1 for idx in range(idx_start, idx_end, -1): node = self.frd.node_block.nodes[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_file_xyz(self, positions, names=None, steps=None):\n if steps is not None:\n steps = self._confirm_step_selection(steps)\n\n new_result_blocks = []\n for r_block in self.frd.result_blocks:\n\n if steps is not None and r_block.numstep not in steps:\n ...
[ "0.4992362", "0.485108", "0.48227835", "0.47917888", "0.4737131", "0.47243077", "0.47234166", "0.47175255", "0.46770194", "0.46455526", "0.46138802", "0.4606024", "0.4602345", "0.45982596", "0.45940492", "0.45859158", "0.45589364", "0.45575878", "0.45548314", "0.45547643", "0...
0.6279778
0
Reduce the .frd file to only the specified coordinates. Nodes and nodal results not at the coordinates, as well as all elements and irrelevant parameter headers will be removed. If the coordinates are not nodes already, new nodes will be added, with the result data interpolated from existing nodes.
def reduce_file_xyz(self, positions, names=None, steps=None): if steps is not None: steps = self._confirm_step_selection(steps) new_result_blocks = [] for r_block in self.frd.result_blocks: if steps is not None and r_block.numstep not in steps: self._rem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_file_nodes(self, nodes, names=None, steps=None):\n if steps is not None:\n steps = self._confirm_step_selection(steps)\n\n idx_start = len(self.frd.node_block.numnod) - 1\n idx_end = -1\n\n for idx in range(idx_start, idx_end, -1):\n node = self.frd.node...
[ "0.5718647", "0.5148735", "0.5044131", "0.49771503", "0.4973383", "0.46994126", "0.46815512", "0.46652865", "0.46373084", "0.46176004", "0.46161243", "0.4591282", "0.45868823", "0.45721558", "0.45531732", "0.4538066", "0.45342803", "0.45301354", "0.45250836", "0.4520615", "0....
0.6120035
0
Get component/entity names for the supplied result names.
def get_comp_names(self, names): names = names[:] comp_names = {} for r_block in self.frd.result_blocks: if r_block.name in names and r_block.name not in comp_names: comp_names[r_block.name] = [] for ent in r_block.entities: if ent....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_organism_names(results):\r\n\r\n organism_names = []\r\n\r\n for result in results:\r\n organism_names.append(result)\r\n\r\n return organism_names", "def get_results(self, case_names, params):\n results = []\n for name in case_names:\n results.append(self.get_res...
[ "0.63385856", "0.60410285", "0.5936411", "0.58623135", "0.5808179", "0.57885474", "0.5764268", "0.5759296", "0.5756003", "0.57452196", "0.5718865", "0.5609413", "0.5596123", "0.5576773", "0.5566023", "0.55454105", "0.5527062", "0.5521235", "0.55142796", "0.5489114", "0.548573...
0.6814703
0