query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Upon object exit close all databases. | def __exit__(self, exc_type, exc_val, exc_tb):
self.database_handle.close_databases() | [
"def close_on_exit(db):\r\n db.close()",
"def exit_db(self):\n self.db_conn.close()",
"def close_database(self):\n self.conn.close()",
"def close_db_comminucation(self):\n self.cur.close()\n self.conn.close()",
"def close_db():\n try:\n if this.conn is not None:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse the given plist file returning a dictionary containing the data. | def parse_plist_file(file_path):
with open(file_path, 'rb') as file_pointer:
plist_file = plistlib.load(file_pointer)
return plist_file | [
"def parse_pref(file):\n dict = {}\n with open(file) as f:\n raw_content = f.read()\n lines = raw_content.splitlines(True)[1:]\n for line in lines:\n student_id = int(line.split('\\t')[0])\n pref_list_line = line.split('\\t')[1]\n pref_list = [int(x) for x... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return non installed applications from the IPhone. | def get_iphone_non_installed_applications(self):
applications = []
for application in self.parsed_info_file['Applications']:
application_array = application.split('.')
applications.append({
'name': ''.join(application_array[2:]),
'company': applica... | [
"def GetListOfAvailableApplications():\n kratos_path = GetKratosMultiphysicsPath()\n import os, re\n\n apps = [\n f.split('.')[0] for f in os.listdir(kratos_path) if re.match(r'.*Application*', f)\n ]\n\n return apps",
"def get_iphone_installed_applications(self):\n applications = []\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return installed applications from the IPhone. | def get_iphone_installed_applications(self):
applications = []
for application in self.parsed_info_file['Installed Applications']:
application_array = application.split('.')
test1 = len(application_array[0]) == 2
test2 = len(application_array[1]) == 2
if... | [
"def get_iphone_non_installed_applications(self):\n applications = []\n for application in self.parsed_info_file['Applications']:\n application_array = application.split('.')\n applications.append({\n 'name': ''.join(application_array[2:]),\n 'compan... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone build version. | def get_iphone_build_version(self):
return self.parsed_info_file['Build Version'] | [
"def version(self):\n return self._root.get(\"platformBuildVersionName\", \"\")",
"def _GetXcodeBuildVersionString():\n return os.environ['XCODE_PRODUCT_BUILD_VERSION']",
"def get_iphone_product_version(self):\n return self.parsed_info_file['Product Version']",
"def get_iphone_iTunes_version(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone device name. | def get_iphone_device_name(self):
return self.parsed_info_file['Device Name'] | [
"def device_name(self, text):\n pass",
"def get_device_name(self, device):\n return None if device == \"DEV1\" else device.lower()",
"def device_name(id):\n return device_id_to_name_mapping[id] if id in device_id_to_name_mapping else 'Unknown Device'",
"def get_device_name_and_platform(self, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone display name. | def get_iphone_display_name(self):
return self.parsed_info_file['Display Name'] | [
"def get_iphone_device_name(self):\n return self.parsed_info_file['Device Name']",
"def friendly_name(self) -> str:\n return self.device_info.friendly_name",
"def platform_display_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"platform_display_name\")",
"def computer_name()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone GUID. | def get_iphone_GUID(self):
return self.parsed_info_file['GUID'] | [
"def get_iphone_unique_identifier(self):\n return self.parsed_info_file['Unique Identifier']",
"def get_guid(self):\n first = self.id_product_guid[6:8] + self.id_product_guid[4:6]\n second = self.id_product_guid[2:4] + self.id_product_guid[0:2]\n return f\"03000000{first}0000{second}00... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone ICCID. | def get_iphone_ICCID(self):
return self.parsed_info_file['ICCID'] | [
"def getCcid():\n\n return EInterface.sendCommand(\"AT#CCID\")[0]",
"def _getIccid(self, sim: skywire.Sim.Instance) -> str:\n\n # If this isn't our active SIM, this won't work\n if sim != self._current:\n raise ValueError(f\"Cannot query SIM ICCID when not active ({sim} != {self._curre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone IMEI. | def get_iphone_IMEI(self):
return self.parsed_info_file['IMEI'] | [
"def get_iphone_MEID(self):\n return self.parsed_info_file['MEID'] if 'MEID' in self.parsed_info_file else ''",
"def get_iphone_ICCID(self):\n return self.parsed_info_file['ICCID']",
"def get_iphone_phone_number(self):\n return self.parsed_info_file['Phone Number']",
"def get_iphone_uniqu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone last backup date | def get_iphone_last_backup_date(self):
return self.parsed_info_file['Last Backup Date'] | [
"def last_backup_time(self) -> str:\n return pulumi.get(self, \"last_backup_time\")",
"def get_backup_date(self):\n return self.parsed_manifest_file['Date']",
"def last_backup(self) -> Backup:\n fetch = self.fetch()\n if not fetch:\n return False\n else:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone MEID if available. | def get_iphone_MEID(self):
return self.parsed_info_file['MEID'] if 'MEID' in self.parsed_info_file else '' | [
"def get_iphone_GUID(self):\n return self.parsed_info_file['GUID']",
"def get_iphone_phone_number(self):\n return self.parsed_info_file['Phone Number']",
"def get_iphone_IMEI(self):\n return self.parsed_info_file['IMEI']",
"def get_iphone_unique_identifier(self):\n return self.pars... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone phone number. | def get_iphone_phone_number(self):
return self.parsed_info_file['Phone Number'] | [
"def getPhone(self):\n return self._phone",
"def telephone(self):\n return self.__telephone",
"def telephone(self):\n if self._telephone is None:\n return None\n elif len(self._telephone) == 1:\n return self._telephone[0]\n else:\n return self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone product name. | def get_iphone_product_name(self):
return self.parsed_info_file['Product Name'] | [
"def product_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"product_name\")",
"def get_product_name():\n return \"SmartAlpha\"",
"def product_name(self) -> str:\n return self.driver.find_element(*self.PRODUCT_TITLE_LOC).text",
"def getProductName(self):\n productClass = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone product type. | def get_iphone_product_type(self):
return self.parsed_info_file['Product Type'] | [
"def _get_productType(self) -> \"std::string\" :\n return _core.Product__get_productType(self)",
"def e_product_item_type(self) -> str:\n return self._e_product_item_type",
"def gen_product_type(self):\n product_type = self.fake.fake_product_type(number=None)\n return product_type",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone product version. | def get_iphone_product_version(self):
return self.parsed_info_file['Product Version'] | [
"def version(self):\n return get_product_version(self)",
"def get_iphone_iTunes_version(self):\n return self.parsed_info_file['iTunes Version']",
"def product_version_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"product_version_name\")",
"def get_iphone_build_version(self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone serial number. | def get_iphone_serial_number(self):
return self.parsed_info_file['Serial Number'] | [
"def serial_number(self) -> str:\n return self._serial_number",
"def get_serial_number(self):\n return usb.util.get_string(self.dev, 256, 3)",
"def serial_number(self) -> str:\n return self._serial_number.lstrip(\"0\")",
"def get_iphone_phone_number(self):\n return self.parsed_info... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone target identifier. | def get_iphone_target_identifier(self):
return self.parsed_info_file['Target Identifier'] | [
"def target_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"target_id\")",
"def getTargetID(self) -> int:\n ...",
"def get_iphone_unique_identifier(self):\n return self.parsed_info_file['Unique Identifier']",
"def get_iphone_target_type(self):\n return self.parsed_info_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone target type. | def get_iphone_target_type(self):
return self.parsed_info_file['Target Type'] | [
"def get_iphone_target_identifier(self):\n return self.parsed_info_file['Target Identifier']",
"def get_iphone_product_type(self):\n return self.parsed_info_file['Product Type']",
"def target_type(self) -> Optional[TargetType]:\n if self.data.target_type_id is None:\n return None... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone unique identifier | def get_iphone_unique_identifier(self):
return self.parsed_info_file['Unique Identifier'] | [
"def get_iphone_GUID(self):\n return self.parsed_info_file['GUID']",
"def imx6_get_unique_id():\n registers = [0x021BC420, 0x021BC410]\n mm = QMmap()\n return \"\".join(mm.read(addr) for addr in registers)",
"def get_iphone_phone_number(self):\n return self.parsed_info_file['Phone Number'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone iBooks data if available | def get_iphone_iBooks_data(self):
if 'iBooks Data 2' in self.parsed_info_file:
return self.parsed_info_file['iBooks Data 2']
else:
return '' | [
"def get_iphone_iBooks_infomation(self):\n information = {\n 'iBooks_data': self.get_iphone_iBooks_data()\n }\n\n self.storage_master['iphone_iBooks_information'] = information\n return information",
"def get_iphone_iTunes_information(self):\n information = {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone iTunes files | def get_iphone_iTunes_files(self):
return self.parsed_info_file['iTunes Files'] | [
"def itunes(file, filter, show_only):\n\n ps = get_itunes_playlists(file, filter)\n if show_only:\n for p in ps:\n click.echo(p.name)\n for i, s in enumerate(p.songs):\n click.echo(str(i+1) + ' - ' + unicode(s))\n click.echo()\n else:\n get_playlists(ps)",
"def get_iphone_iTunes_inf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone iTunes settings | def get_iphone_iTunes_settings(self):
return self.parsed_info_file['iTunes Settings'] | [
"def get_iphone_iTunes_information(self):\n information = {\n 'iTunes_files': self.get_iphone_iTunes_files(),\n 'iTunes_settings': self.get_iphone_iTunes_settings(),\n 'iTunes_version': self.get_iphone_iTunes_version()\n }\n\n self.storage_master['iphone_iTunes_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone iTunes version | def get_iphone_iTunes_version(self):
return self.parsed_info_file['iTunes Version'] | [
"def get_iphone_product_version(self):\n return self.parsed_info_file['Product Version']",
"def get_iphone_build_version(self):\n return self.parsed_info_file['Build Version']",
"def get_iphone_product_name(self):\n return self.parsed_info_file['Product Name']",
"def get_iphone_iTunes_inf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone backup key bag | def get_backup_key_bag(self):
return self.parsed_manifest_file['BackupKeyBag'] | [
"def get_backup_information(self):\n information = {\n 'backup_key_bag': self.get_backup_key_bag(),\n 'version': self.get_backup_version(),\n 'date': self.get_backup_date(),\n 'system_domain_version': self.get_backup_version(),\n 'was_passcode_set': self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone backup version | def get_backup_version(self):
return self.parsed_manifest_file['Version'] | [
"def get_backup_information(self):\n information = {\n 'backup_key_bag': self.get_backup_key_bag(),\n 'version': self.get_backup_version(),\n 'date': self.get_backup_date(),\n 'system_domain_version': self.get_backup_version(),\n 'was_passcode_set': self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone backup date | def get_backup_date(self):
return self.parsed_manifest_file['Date'] | [
"def get_iphone_last_backup_date(self):\n return self.parsed_info_file['Last Backup Date']",
"def setBackupDate(self):\n lastmodified = os.stat(self.backup_file).st_mtime\n datetime.fromtimestamp(lastmodified)\n\n backup_text = \"\"\"Backup file: {}, {} \"\"\".format(\n self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone backup system domain version | def get_backup_system_domain_version(self):
return self.parsed_manifest_file['SystemDomainsVersion'] | [
"def getDNSFullVersion(self): \n dnsPath = self.getDNSInstallDir()\n # for 9:\n iniDir = self.getDNSIniDir()\n if not iniDir:\n return 0\n nssystemini = self.getNSSYSTEMIni()\n nsappsini = self.getNSAPPSIni()\n if nssystemini and os.path.isfile(nssystem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone backup lock down status | def get_backup_lock_down(self):
return self.parsed_manifest_file['Lockdown'] | [
"def get_status_backup_state(self):\n return self.parsed_status_file['BackupState']",
"def backup_heartbeat(self):\n return self.data.get('backup_heartbeat')",
"def disable_backup(self):\r\n request_json = self._request_json_('Backup', False)\r\n\r\n flag, response = self._cvpysdk_ob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the applications that are on the IPhone backup | def get_backup_applications(self):
return self.parsed_manifest_file['Applications'] | [
"def get_iphone_non_installed_applications(self):\n applications = []\n for application in self.parsed_info_file['Applications']:\n application_array = application.split('.')\n applications.append({\n 'name': ''.join(application_array[2:]),\n 'compan... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return whether the IPhone backup is encrypted | def get_backup_is_encrypted(self):
return self.parsed_manifest_file['IsEncrypted'] | [
"def is_encrypted():\n return False",
"def is_encrypted(self): # -> bool\n pass",
"def SupportsEncryption(self):\n return self.path_spec.type_indicator in (\n definitions.TYPE_INDICATORS_WITH_ENCRYPTION_SUPPORT)",
"def is_encrypted(self):\n try:\n with open(self._file... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return whether the IPhone backup is a full backup | def get_status_is_full_backup(self):
return self.parsed_status_file['IsFullBackup'] | [
"def HasBackup(self):\n return os.path.isdir(self.__backup_directory)",
"def allow_backup(self):\n return self._root.find(\"application\").get(\n \"allowBackup\", \"false\") == \"true\"",
"def check_backup():\n last = last_backup()\n loc = backup_location()\n if not exists(loc):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone backup state | def get_status_backup_state(self):
return self.parsed_status_file['BackupState'] | [
"def BackupInstallationState(self):\n if not self.HasBackup():\n return None\n return InstallationState(os.path.realpath(self.__backup_directory))",
"def get_backup_information(self):\n information = {\n 'backup_key_bag': self.get_backup_key_bag(),\n 'version': self.get_bac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the IPhone snapshot state | def get_status_snapshot_state(self):
return self.parsed_status_file['SnapshotState'] | [
"def get_snapshot_status(self, current=True):\r\n if current:\r\n if self.__prev_snapshot is not None:\r\n return self.__prev_snapshot.get_snapshot_info()\r\n if self.__temp_snapshot is not None:\r\n return self.__temp_snapshot.get_snapshot_info()\r\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search the local manifest database dictionary (storage_master ['iphone_file_contents']) for the given value | def search_manifest_database(self, column_to_search, search_string):
for file in self.storage_master['iphone_file_contents']:
if search_string in file[column_to_search]:
return file
return False | [
"def analyse_iphone_content_files(self):\n manifest_db = self.database_handle.get_manifest_db()\n\n if manifest_db is not False:\n for db_row in self.database_handle.get_manifest_db():\n absolute_path = self.get_iphone_content_file_from_fileID(db_row[0])\n file... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse and read from the database file specified from the relative IOS path and the database table name | def parse_database_file(self, search_string, table_name):
search_column = Constants.DEFAULT_SQL_STORAGE_COLUMNS_LIST_FORM[2] # Relative path search
file_dict = self.search_manifest_database(search_column, search_string)
absolute_file_path = Constants.DEFAULT_SQL_STORAGE_COLUMNS_LIST_FORM[4]
... | [
"def read_database():\r\n file_list = glob.glob('csv_files/*.csv') # retrieving list of files (check for your file structure)\r\n database_input_dict = {}\r\n for file in file_list:\r\n table = read_table(file) # for each file create table\r\n table_name = file[file.rfind(\"/\")+1:file.find... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get voicemail information from Iphone backup via the Voicemail.db file | def get_voicemail_information(self):
# TODO: Parse all other tables within the voicemail.db database
return self.parse_database_file(Constants.VOICEMAIL_INFORMATION_DB_PATH, Constants.VOICEMAIL_INFORMATION_DB_TABLE) | [
"def get_backup_information(self):\n information = {\n 'backup_key_bag': self.get_backup_key_bag(),\n 'version': self.get_backup_version(),\n 'date': self.get_backup_date(),\n 'system_domain_version': self.get_backup_version(),\n 'was_passcode_set': self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get sms message information from Iphone backup via the sms.db file | def get_sms_message_information(self):
# TODO: Parse all other tables within the sms.db database
return self.parse_database_file(Constants.SMS_MESSAGE_INFORMATION_DB_PATH, Constants.SMS_MESSAGE_INFORMATION_DB_TABLE) | [
"def get_message(self):\r\n message_number = input('Read message number: ')\r\n for i in range(number_of_messages):\r\n if sms_store.index == message_number:\r\n return SMSMessage",
"def get_voicemail_information(self):\n # TODO: Parse all other tables within the voi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return all information related to iPhone system within the backup | def get_iphone_system_information(self):
information = {
'build_version': self.get_iphone_build_version(),
'device_name': self.get_iphone_device_name(),
'display_name': self.get_iphone_display_name(),
'GUID': self.get_iphone_GUID(),
'ICCID': self.get_i... | [
"def get_backup_information(self):\n information = {\n 'backup_key_bag': self.get_backup_key_bag(),\n 'version': self.get_backup_version(),\n 'date': self.get_backup_date(),\n 'system_domain_version': self.get_backup_version(),\n 'was_passcode_set': self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return all information related to iBooks within the backup | def get_iphone_iBooks_infomation(self):
information = {
'iBooks_data': self.get_iphone_iBooks_data()
}
self.storage_master['iphone_iBooks_information'] = information
return information | [
"def printAllAvailibleBooks(self):\r\n for resource in self.catalogue:\r\n if isinstance(resource, Book):\r\n if resource.checkBookAvailibility() == True:\r\n resource.printBookDetail()",
"def printAllBookdetailInCaltalogue(self):\r\n for resource in self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return all information related to iTunes within the backup | def get_iphone_iTunes_information(self):
information = {
'iTunes_files': self.get_iphone_iTunes_files(),
'iTunes_settings': self.get_iphone_iTunes_settings(),
'iTunes_version': self.get_iphone_iTunes_version()
}
self.storage_master['iphone_iTunes_information'... | [
"def get_backup_information(self):\n information = {\n 'backup_key_bag': self.get_backup_key_bag(),\n 'version': self.get_backup_version(),\n 'date': self.get_backup_date(),\n 'system_domain_version': self.get_backup_version(),\n 'was_passcode_set': self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return all information related to the backup | def get_backup_information(self):
information = {
'backup_key_bag': self.get_backup_key_bag(),
'version': self.get_backup_version(),
'date': self.get_backup_date(),
'system_domain_version': self.get_backup_version(),
'was_passcode_set': self.get_backup... | [
"def list_backups(self):\r\n return self.manager._list_backups_for_instance(self)",
"def list(self, instance=None):\r\n if instance is None:\r\n return super(CloudDatabaseBackupManager, self).list()\r\n return self.api._manager._list_backups_for_instance(instance)",
"def fetch_ba... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return all information related to the backup status | def get_status_information(self):
information = {
'is_full_backup': self.get_status_is_full_backup(),
'version': self.get_status_version(),
'UUID': self.get_status_UUID(),
'date': self.get_status_date(),
'backup_state': self.get_status_backup_state(),
... | [
"def get_status_backup_state(self):\n return self.parsed_status_file['BackupState']",
"def get_backup_information(self):\n information = {\n 'backup_key_bag': self.get_backup_key_bag(),\n 'version': self.get_backup_version(),\n 'date': self.get_backup_date(),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return and store iphone content files in self.storage_master['iphone_file_contents'] | def get_database_rows_iphone_content_files(self):
information = []
for row_index, db_row in enumerate(self.database_handle.get_iminer_file_database()):
information.append({})
for column_index, column_name in enumerate(db_row):
information[row_index][Constants.DEF... | [
"def analyse_iphone_content_files(self):\n manifest_db = self.database_handle.get_manifest_db()\n\n if manifest_db is not False:\n for db_row in self.database_handle.get_manifest_db():\n absolute_path = self.get_iphone_content_file_from_fileID(db_row[0])\n file... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the master storage dictionary | def get_storage_master(self):
return self.storage_master | [
"def _get_storage(self, for_write=False):",
"def get_storage(context):\n zope_root = context.getPhysicalRoot()\n annotations = IAnnotations(zope_root)\n storage = annotations.get(KEY, None)\n\n if storage is None:\n storage = annotations[KEY] = PersistentDict()\n\n return storage",
"def st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse and store Iphone content files in the .database_handle (IphoneFileDatabase object) | def analyse_iphone_content_files(self):
manifest_db = self.database_handle.get_manifest_db()
if manifest_db is not False:
for db_row in self.database_handle.get_manifest_db():
absolute_path = self.get_iphone_content_file_from_fileID(db_row[0])
file_type = db_... | [
"def parse_and_index_all_iphone_files(self):\n content_files = self.analyse_iphone_content_files()\n if content_files is not False:\n self.get_database_rows_iphone_content_files()\n return True\n else:\n self.storage_master['iphone_file_contents'] = 'Database re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse all iphone information from the initial instance declaration. | def parse(self):
self.get_iphone_system_information()
self.get_iphone_applications()
self.get_iphone_iTunes_information()
self.get_iphone_iBooks_infomation()
self.get_backup_information()
self.get_status_information() | [
"def get_iphone_IMEI(self):\n return self.parsed_info_file['IMEI']",
"def get_iphone_iTunes_information(self):\n information = {\n 'iTunes_files': self.get_iphone_iTunes_files(),\n 'iTunes_settings': self.get_iphone_iTunes_settings(),\n 'iTunes_version': self.get_iph... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse all iphone content files and save to both the storage master and the relavent iphone database | def parse_and_index_all_iphone_files(self):
content_files = self.analyse_iphone_content_files()
if content_files is not False:
self.get_database_rows_iphone_content_files()
return True
else:
self.storage_master['iphone_file_contents'] = 'Database read failed, ... | [
"def analyse_iphone_content_files(self):\n manifest_db = self.database_handle.get_manifest_db()\n\n if manifest_db is not False:\n for db_row in self.database_handle.get_manifest_db():\n absolute_path = self.get_iphone_content_file_from_fileID(db_row[0])\n file... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse all indexed files (gather information like paired devices) | def parse_indexed_files(self):
self.storage_master['paired_devices'] = self.get_paired_devices()
self.storage_master['voicemail_information'] = self.get_voicemail_information()
self.storage_master['sms_message_information'] = self.get_sms_message_information() | [
"def _readIndexFiles(self):\n if self.haveIndexFiles:\n return\n\n self.log.debug(\"read index files\")\n self.haveIndexFiles = True # just try once\n\n if self.andConfig is None:\n self.andConfig = getConfigFromEnvironment()\n\n self.multiInds = AstrometryN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set initial scores and values. Play game. | def __init__(self):
self.player_score = 0
self.computer_score = 0
self.player_choice = None
self.computer_choice = None
self.play_again = True
self.play_game() | [
"def initial_game_values():\n player.number_of_cities()\n player.matrix()\n player.number_of_managers()\n player.available_days()\n player.input_potential_profit()\n class_assignment(player.potential_profit)\n player.hometown()\n connected_cities()",
"def resetScores(self):\n self.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assign rock, paper, scissors to computer. | def input_computer(self):
options = ["rock", "paper", "scissors"]
self.computer_choice = random.choice(options)
print("The computer chose " + self.computer_choice) | [
"def computer_choose(computer):\n if computer == 0:\n print(\"Computer choose : Rock\")\n elif computer == 1:\n print(\"Computer choose : Paper\")\n elif computer == 2:\n print(\"Computer choose : Scissor\")",
"def computer(self, computer):\n \n self._computer = compute... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. | def validate_configuration(
self, configuration: Optional[ExpectationConfiguration]
) -> None:
super().validate_configuration(configuration)
configuration = configuration or self.configuration
# # Check other things in configuration.kwargs and raise Exceptions if needed
# t... | [
"def validate_configuration(\n self, configuration: Optional[ExpectationConfiguration]\n ) -> None:\n\n super().validate_configuration(configuration)\n if configuration is None:\n configuration = self.configuration\n\n # # Check other things in configuration.kwargs and rais... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process the line and extract the duration and count | def proc_dur_count(line):
parts = line.split(",")
dur, count = int(parts[0]), int(parts[22])
# we are now looking for the minimum duration and the max count,
# so subtract from the max count value
min_cnt = 1000 - count
item = {'step': 0, 'data': tuple([dur, min_cnt]), 'dur': dur,
'c... | [
"def proc_dur_srv_count(line):\n parts = line.split(\",\")\n dur, srv = int(parts[0]), int(parts[23])\n # we are now looking for the minimum duration and the max count,\n # so subtract from the max count value\n srv = 1000 - srv\n item = {'step': 0, 'data': tuple([dur, srv]), 'dur': dur, 'srv_cnt'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process the line and extract the duration and srv_count | def proc_dur_srv_count(line):
parts = line.split(",")
dur, srv = int(parts[0]), int(parts[23])
# we are now looking for the minimum duration and the max count,
# so subtract from the max count value
srv = 1000 - srv
item = {'step': 0, 'data': tuple([dur, srv]), 'dur': dur, 'srv_cnt': srv,
... | [
"def proc_dur_count(line):\n parts = line.split(\",\")\n dur, count = int(parts[0]), int(parts[22])\n # we are now looking for the minimum duration and the max count,\n # so subtract from the max count value\n min_cnt = 1000 - count\n item = {'step': 0, 'data': tuple([dur, min_cnt]), 'dur': dur,\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify the location of the master and get the time step and size | def verify_master(self):
req = requests.get(self.master_url + "/step", timeout=SERVER_TIMEOUT)
req.raise_for_status()
entry = req.json()
self.step = entry['step']
self.step_size = entry['step_size']
self.win_size = entry['step_window']
self.start_time = entry['sta... | [
"def verify_master(self):\n\n req = requests.get(self.master_url + \"/step\", timeout=SERVER_TIMEOUT)\n req.raise_for_status()\n entry = req.json()\n self.step = entry['step']\n self.step_size = entry['step_size']\n self.start_time = entry['start_time']\n self.window... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to read in the streaming entries, process the skyline, and send results to the master | def run(self):
print ("Worker is now running at step {} with step_size {} starting "
"at time {}".format(self.step, self.step_size, self.start_time))
# read in the entries for this step
processed, last_proc = 0, 0
if RECORD_ALL:
self.sky_size = open('skyline-si... | [
"def run(self):\n print (\"Worker is now running at step {} with step_size {} starting \"\n \"at time {}\".format(self.step, self.step_size, self.start_time))\n # read in the entries for this step\n processed = 0\n for line in self.inputf.xreadlines():\n entry = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Upload the changes to the skyline to the master node | def upload_data(self):
self.logger.debug("Starting to upload data")
# find the difference in old and new skyline (skyline updates
# to send to master
added, removed = self.find_skyline_diff()
url = self.master_url + "/update_master"
headers = {'content-type': 'applicatio... | [
"def upload_data(self):\n\n url = self.master_url + \"/update_master\"\n headers = {'content-type': 'application/json'}\n params = {'worker_id': self.worker_id}\n upload_data = {'step': self.step, 'data': self.skyline_updates,\n 'worker_id': self.worker_id}\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the local skyline based on points from the master/central node's skyline To get the skyline, we will query the master server a total of WORKER_REQUERIES times and wait WORKER_MASTER_WAIT seconds before declaring failure/ raising an exception We will perform the following activities here 1) update local skyline b... | def get_master_updates(self):
self.logger.debug("Starting to get master updates")
params = {'worker_id': self.worker_id}
for x in range(WORKER_REQUERIES):
url = "{}/get_skyline/{}".format(self.master_url, self.step)
req = requests.get(url, timeout=SERVER_TIMEOUT, params=p... | [
"def get_master_updates(self):\n params = {'worker_id': self.worker_id}\n for x in range(WORKER_REQUERIES):\n url = \"{}/get_skyline/{}\".format(self.master_url, self.step)\n req = requests.get(url, timeout=SERVER_TIMEOUT, params=params)\n\n # if we got a successful re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expire old points from the skyline | def expire_points(self):
self.logger.debug("Starting to expire points for step {}"
"(anything less than {})"
"".format(self.step, self.step - self.win_size))
has_expired = False
to_see = self.sky.skyline.qsize()
# while not self.sky.sk... | [
"def clearPoints(self):\n self._points = list()\n self._objectChanged(True,False,False)",
"def reset_points(self):\n self._container['points'] = {}",
"def delPoint(self):\n if len(self.view.pointlist) > 0:\n self.view.pointlist[len(self.view.pointlist) - 1].join()\n sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the local skyline based on this point | def update_skyline(self, point):
added = self.sky.update_sky_for_point(point)
return added
# self.logger.debug("Added: {} skyline for point: {}"
# "".format(added, point)) | [
"def updatePoints(self, x, y):",
"def updateCurve(*args, **kwargs):\n \n pass",
"def project(self, skycoord):\n raise NotImplementedError",
"def updatelines(self):\n if self.wavefunction is not None:\n self.rewavefunctionlines.set_ydata(real(self.wavefunction))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unpack samples, resulting in torch Tensor with shape (batch_size, ) for each field | def unpack_samples(samples: Tuple[np.ndarray, ...], device: torch.device) -> Tuple[
TensorType[..., "batch"], TensorType[..., "batch"], TensorType[..., "batch"], TensorType[
..., "batch"], TensorType[..., "batch", torch.uint8]]:
states = torch.from_numpy(np.moveaxis(samples[0], 0, -1)).to(device)
ac... | [
"def _unpack_batch_channel(data, old_shape, unpack_transpose=False):\n if unpack_transpose:\n data = op.transpose(data, axes=(0, 4, 1, 5, 2, 3))\n data = op.reshape(data, newshape=old_shape)\n return data",
"def decode_batch(batch, inputs):\n inputs['filename'] = batch[0]\n inputs['image'] =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that searches all specified search fields, and mathces the 5 best documents in the corpus with the input query string. | def index_searcher(dirname="webapp/static/model/textsim/indexdir",
query_string=None,
top_n=5,
search_fields=['full_text',
'aanleiding',
't_knel',
'opl',
... | [
"def search_query(self, query):\n \n def topN(similarities, N=5):\n return np.argsort(similarities)[::-1][:N]\n \n words = query.split(\" \")\n tokens_ids = []\n for word in words:\n try:\n token_id = self.tokens_mapping[word]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts a restapi.Replica() to a Shapefiles replica input restapi.Replica() object, must be generated from restapi.FeatureService.createReplica() out_folder full path to folder location where new files will be stored. | def exportReplica(replica, out_folder):
if not hasattr(replica, 'replicaName'):
print('Not a valid input! Must be generated from restapi.FeatureService.createReplica() method!')
return
# attachment directory and gdb set up
att_loc = os.path.join(out_folder, 'Attachments')
if not os.pat... | [
"def mongodb2shape(mongodb_server, mongodb_port, mongodb_db, mongodb_collection, output_shape):\n print ' Converting a mongodb collection to a shapefile '\n connection = Connection(mongodb_server, mongodb_port)\n print 'Getting database MongoDB %s...' % mongodb_db\n db = connection[mongo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts geometry input to restapi.Geometry object | def __init__(self, geometry, **kwargs):
self._inputGeometry = geometry
if isinstance(geometry, self.__class__):
geometry = geometry.json
spatialReference = None
self.geometryType = None
for k, v in kwargs.iteritems():
if k == SPATIAL_REFERENCE:
... | [
"def clean_geometry(geometry):\n if geometry.is_valid:\n return geometry\n\n if isinstance(geometry, Polygon):\n return geometry.buffer(0)\n\n return geometry",
"def mappingGeometry(feature=QgsFeature):\n geo = feature.geometry().exportToGeoJSON(precision=17)\n return json.loads(geo)"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns an envelope geometry object as JSON | def envelopeAsJSON(self, roundCoordinates=False):
if self.geometryType != ESRI_ENVELOPE:
flds = [XMIN, YMIN, XMAX, YMAX]
if roundCoordinates:
coords = map(int, [float(i) for i in self.envelope().split(',')])
else:
coords = self.envelope().split... | [
"def get_envelope(geoms):\n return MultiPoint(geoms).envelope",
"def get_aoi_geometry_as_geojson(self):\n aoi_geojson = db.engine.execute(self.geometry.ST_AsGeoJSON()).scalar()\n return geojson.loads(aoi_geojson)",
"def ST_AsGeoJSON(geos):\n return arctern.ST_AsGeoJSON(geos)",
"def seriali... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns geometry as shapefile._Shape() object | def asShape(self):
shp = shapefile._Shape(shp_helper.shp_dict[self.geometryType.split('Geometry')[1].upper()])
if self.geometryType != ESRI_POINT:
shp.points = self.json[JSON_CODE[self.geometryType]]
else:
shp.points = [[self.json[X], self.json[Y]]]
# check if mu... | [
"def ReadGeometry(self, *args):\n return _TopTools.TopTools_ShapeSet_ReadGeometry(self, *args)",
"def location(self):\n # Construct a geoJSON input for shapely.\n coords = {'coordinates': self['coordinates'], 'type': 'Point'}\n shape = asShape(coords)\n return shape",
"def geo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate average gps value of latitude, longitude, altitude, and time | def gpsAverage(x, y):
value = satellite.gpsValue(x, y, "altitude") + satellite.gpsValue(x, y, "longitude") + satellite.gpsValue(x, y, "latitude") + satellite.gpsValue(x, y, "time")
average = value / 4
return average | [
"def get_average_speed(parse_tree):\n raw_log = parse_tree\n acc_entries = raw_log.getElementsByTagName(GPS)\n if len(acc_entries)==0:\n return -1\n speed_sum = 0\n for acc in acc_entries:\n speed_sum = speed_sum + float(acc.attributes[SPEED].value)\n return (speed_sum/len(acc_entrie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate difference of average gps values of current position and destination position | def distance(current, destination):
currentAverage = gpsAverage(current[0], current[1])
destinationAverage = gpsAverage(destination[0], destination[1])
distance = math.sqrt((currentAverage**2) + (destinationAverage**2))
return distance | [
"def gpsAverage(x, y):\n\n\n value = satellite.gpsValue(x, y, \"altitude\") + satellite.gpsValue(x, y, \"longitude\") + satellite.gpsValue(x, y, \"latitude\") + satellite.gpsValue(x, y, \"time\")\n average = value / 4\n return average",
"def cal_mean_current_location(name_tuple_list):\r\n lan = []\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove the doctype "Custom Link" that was used to add Custom Links to the Dashboard since this is now managed by Customize Form. Update `parent` property to the DocType and delte the doctype | def execute():
frappe.reload_doctype("DocType Link")
if frappe.db.has_table("Custom Link"):
for custom_link in frappe.get_all("Custom Link", ["name", "document_type"]):
frappe.db.sql(
"update `tabDocType Link` set custom=1, parent=%s where parent=%s",
(custom_link.document_type, custom_link.name),
)
... | [
"def get_link_doctype(self):\n\t\tif self.fieldtype == \"Link\":\n\t\t\treturn self.options\n\n\t\tif self.fieldtype == \"Table MultiSelect\":\n\t\t\ttable_doctype = self.options\n\n\t\t\tlink_doctype = frappe.db.get_value(\n\t\t\t\t\"DocField\",\n\t\t\t\t{\"fieldtype\": \"Link\", \"parenttype\": \"DocType\", \"par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the job w/o content or plan is pseudo job. check the members in Job | def is_pseudo_job(self, job_id):
return job_id in Job._PSEUDO_JOB | [
"def has_jobs():\n if count_jobs() > 0:\n return True\n return False",
"def is_job(self) -> bool:\n return bool(_CURRENT_JOB.get(None))",
"def _check_job(job):\n if job not in JOBS:\n raise NotImplementedError('The job %s is not valid input '\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate a dictionary key for plan decision currently we set "@" as the key of plan dictionary [USAGE] Job.encode_plan_key("foo job", Jobs.FAILED) | def encode_plan_key(self, job_id, state):
return "%s@%s" % (state, job_id) | [
"def plan_key(self):\n return self.__plan_key",
"def lesson_key(lessonplan_name = DEFAULT_LESSONPLAN_NAME):\n return ndb.Key('Lesson', lessonplan_name)",
"def Add_Key(apig,usageplan_id: str,key_id: str,key_type='API_KEY'):\n\n\t\t\t\ttry:\n\t\t\t\t\treturn apig.client.create_usage_plan_key(usagePlanId... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
job could be organized into tree structure and encapisulated into bigger block. information may needed to be shared in the block. so we apply config inherit just before execution to keep the parent config fresh. | def _inherit_config(self, source_job):
for k, v in source_job.config.items():
# skip the global configuration item if it's already set in local
# inherit it, if not
if self.config.get(k) is not None:
continue
self._set_config(k, v, set_as_local=Tru... | [
"def _update_config(self, config_file, disable_parent_task_update=False, *args, **kwargs):\n config = interface.get_config(config_file)\n #Update global configuration here for printing everything in run() function\n #self.global_config = update(self.global_config, config)\n if not config... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the assigned the output value by corresponding key. this will search local first, then global configs | def get_output(self, key):
return self._get_config(key) | [
"def get_config_value(key,base=u'default',default=None):\n if base in LOCAL and key in LOCAL[base]:\n return LOCAL[base][key]\n if base in GLOBAL and key in GLOBAL[base]:\n return GLOBAL[base][key]\n else:\n return default\n return None",
"def get_value(self, key: str):\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check whether the execution content is implemented in the job. 1. user_defined_method (UDM) should be override 2. UDMshould follow the practice must return at least one Job state. all planned inputs (key in need_input) should be used in the UDM (get_input). vice versa | def _is_valid(self):
is_valid = True
if not self.is_ready:
msg = "'%s' is not executable (overriding is needed)" % (self.id)
self.log(Logger.ERRO, msg)
is_valid = False
if self._user_defined_method.__class__.__name__ != 'function':
msg = "callback ... | [
"def _check_job(job):\n if job not in JOBS:\n raise NotImplementedError('The job %s is not valid input '\n 'for the ParallelProcessing job '\n 'manager. Accepted jobs: %r.'\n % (job, list... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get next job id by previous job id and its executing result multiple results is possible in ParallelJobBlock e.g. ParaJ > [SubJ1, SubJ2] | def _get_next(self, prev_job_id, state):
plan_key = Job.encode_plan_key(prev_job_id, state)
job_id = self.plan.get(plan_key)
return job_id | [
"def get_next_job_number():\n _clear_dead_jobs()\n i = 1\n while i in get_jobs():\n i += 1\n return i",
"def next_job(self) -> Job:\n if not self.queued_jobs:\n return None\n\n for job in sorted(self.queued_jobs.values()):\n if self.check_can_job_run(job.job_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
normalize the id of given Job nodes, including converting spaces to underscores differentiate the pseudo job name (by adding job id as prefix) | def _normalize_edge(self, from_job_id, to_job_id):
self_id = self.id.replace(' ', '_')
norm_ids = []
for id in [from_job_id, to_job_id]:
id = id.replace(' ','_')
# make INIT_JOB and LAST_JOB be unique (concatenate to job id)
if id == Job.INIT_JOB or id == Job... | [
"def _task_id_to_job_id(task_id):\n return 'job_' + '_'.join(task_id.split('_')[1:3])",
"def to_wiki_id(node_name):\n return node_name.replace('_', '-')[3:]",
"def normalizeNodeName(nodeName):\n # chars to be removed from nodeName\n REPLACE_CHARS = 'node'\n\n return str(nodeName).... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
recursively parse the job plan and record the unique flow edges (pairwise job node) this method is the body of recursive edge collection. for this collection task, sequence is not important; just make sure we could go through all the plan edge. | def _get_plan_edges(self, depth=0):
edges = []
if 0 != depth:
from_job_id_, to_job_id_ = self._normalize_edge(Job.INIT_JOB, self.id)
edges.append([to_job_id_, from_job_id_, '->START'])
for plan_key, to_job_id in self.plan.items():
# get edges for this JobBlock... | [
"def flow_generator(self):\n self.graph_leaves = [i for i in list(self.double_linked_graph.keys()) if\n self.double_linked_graph[i].leaf is True]\n self.graph_roots = [i for i in list(self.double_linked_graph.keys()) if\n self.double_linked_graph[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get job (JobNode or JobBlock) by id only its own job | def get_job(self, job_id):
return self.jobs.get(job_id) | [
"def get_job_by_id(self, job_id: str) -> SparkJob:\n # FIXME: this doesn't have to be a linear search but that'll do for now\n jobs = _list_jobs(\n emr_client=self._emr_client(),\n job_type=None,\n table_name=None,\n active_only=False,\n )\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get job (JobNode or JobBlock) by id, recursively find from children | def find_job(self, target_job_id):
result = None
for job_id, job in self.jobs.items():
if job_id == target_job_id:
result = job
return result
if not job.plannable: continue # continue
result = job.find_job(tar... | [
"def find_job(self, job_id: JobID) -> Tuple[Job, \"JobQueue\"]:\n if job_id in self.queued_jobs:\n return self.queued_jobs[job_id], self.queued_jobs\n elif job_id in self.running_jobs:\n return self.running_jobs[job_id], self.running_jobs\n # elif job_id in self.completed_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
we add JobNode or JobBlock as subjob into JobBlock all the subjob are store in a dictionary with its id as key | def add_sub_job(self, job):
job_id = job.id
self.jobs[job_id] = job | [
"def __schedule_subjob (self, subjob):\n for i in self.bigjob_list:\n bigjob = i[\"bigjob\"]\n lock = i[\"lock\"]\n lock.acquire()\n free_cores = i[\"free_cores\"]\n bigjob_url = bigjob.pilot_url\n state = bigjob.get_state_detail()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
list the detail description including input/output for the plan. it traverse all the job (no pseudo job) and print profile; recursively handle the children if block job is found | def _show_desc(self, depth=0, symbol_table={}):
block_indent = "\t"*depth
# show node id
symbol = self._get_symbol(symbol_table, self.id)
msg = "%s%s.[%s]" % (block_indent, symbol, self.id.upper()) # MARK
self.log(Logger.INFO, msg)
# show node profile in multi-lines
... | [
"def print_job_info(job):\n print_console()\n print_console(job.center(80, \"=\"))\n print_console()\n print_console(\" last state: %s\" % (jobs[job].state))\n parse_submit_file(jobs[job])\n\n # Handle subdag jobs from the dag file\n if jobs[job].is_subdag is True:\n print_console(\" Thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
before starting the whole process, rather than during the runtime, we want to verify the job plan to check whether all the job id is correctly registered with a job instance. (for JobBlock) and whether it is correctly overrided. (for JobNode) _is_valid is a common interface of JobNode and JobBlock. this method scan the... | def _is_valid(self):
checked_list = [] # prevent duplicated checking
is_process_valid = True
max_len = 50
# check whether plan is properly set
if 0 == len(self.plan):
# empty plan, give warning
self.log(Logger.INFO, "%s%s[%s]" % (self.id,
... | [
"def verify_plan(self, plan):\n current = deque(plan)\n location = self.start\n heading = 0\n empty_cells = list()\n while current:\n step = current.popleft()\n heading = self.decode_rotation(heading, step[0])\n transform = self.decode_heading(head... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add the given job ids in the plan in a parallel way | def add_papallel_plan(self, *job_ids):
# create parallel job plan for documentation not for execution
for job_id in job_ids:
self.add_plan(Job.INIT_JOB, Job.START, job_id)
self.add_plan(job_id, Job.DONE, Job.LAST_JOB) | [
"def add_jobs(self, jobs):\n for j in jobs:\n self.add_job(j)",
"def jobs_add(self):\n\n try:\n cart = self.cart\n\n c = get_cursor()\n c.execute(\"\"\"\n select lp.lab_line_id, ls.lab_shipping_id\n from (line_item as li, prod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compare the data, raise error if it fails. | def compare_data(data1, data2):
# Maybe we can do this fast ...
try:
if data1 == data2:
return
except Exception:
pass
# Otherwise, dive in
deep_compare(data1, data2) | [
"def compareData(self, data, compareContent=False):\n return False",
"def _is_compatible(self, other, raise_error=False):\n problems = []\n if not isinstance(other, DataArray):\n return False\n if self.shape != other.shape:\n problems.append(\"shape of data must b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert data, by saving to fname, invoking the runner, and reading back. If something goes wrong, the files are saved as error.xx, otherwiser the files are cleaned up. | def convert_data(fname1, fname2, data1):
try:
save(fname1, data1)
invoke_runner(fname1, fname2)
data2 = load(fname2)
return data2
except Exception:
rename_as_error(fname1, fname2)
print(data1)
raise
finally:
remove(fname1, fname2) | [
"def run(self):\n self.go_path()\n self.create_placeholder_array()\n self.read_write()\n np.save(self.target_file_name,self.data)",
"def main():\n\n arguments = arg_parser.parse_args()\n\n input_path = arguments.input_path\n output_format = arguments.output_format\n\n input... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load from json or bsdf, depending on the extension. | def load(fname):
if fname.endswith('.json'):
with open(fname, 'rt', encoding='utf-8') as f:
return json.load(f)
elif fname.endswith('.bsdf'):
return bsdf.load(fname)
else:
assert False | [
"def smart_load(self, name):\n\n ext = os.path.splitext(self.file_paths[name])[1]\n\n if ext == '.yaml':\n return self.yaml_load(name)\n elif ext == '.json':\n return self.json_load(name)\n\n return self.load(name)",
"def _read_spec(src):\n extension = os.path.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rename files to error.xx. | def rename_as_error(*filenames):
for fname in filenames:
try:
os.replace(fname, os.path.dirname(fname) + '/error.' + fname.rsplit('.')[-1])
except Exception:
pass | [
"def _renameFile(self, filename):\n\n tempfilename = re.split('-\\d+\\.', filename)\n if len(tempfilename) > 1:\n filename = '.'.join(tempfilename)\n return filename",
"def collision_rename(file_name):\r\n if os.path.isdir(file_name):\r\n return '%s.renamed' % file_name\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a Function object representing a Polynomial function. | def CreatePolynomial(p, p_fit = None, p_bounds = None):
return CreateFunction(
Polynomial, p, p_fit = p_fit, p_bounds = p_bounds
) | [
"def poly(coefs):\r\n # your code here (I won't repeat \"your code here\"; there's one for each function)\r\n \r\n while coefs[-1] == 0:\r\n coefs = coefs[:-1]\r\n \r\n def name_part(n,c):\r\n sign = '' if c<0 else '+' \r\n if c ==0:\r\n return None\r\n else:\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the site elevation from the center of the earth. | def normalize_site_elevation(elevation_sea_level):
elevation_units = elevation_sea_level[-1:].lower()
elevation_sea_level = float(elevation_sea_level[:-1])
if elevation_units == 'm':
normalized_elevation_km = elevation_sea_level/1000.0 # km above sea level
normalized_elevation_km /... | [
"def distance_to_earth(self):\n if self.distance_module is not None:\n return 10 ** ((self.distance_module + 5) / 5)\n elif self.parallax is not None:\n return 1/self.parallax\n else:\n raise ValueError(\"There is no way to find out the distance to earth for thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Position Sensitive Region of Interest (ROI) Max pooling function. This function computes position sensitive max of input spatial patch with the given region of interests. Each ROI is splitted into | def ps_roi_max_pooling_2d(
x, rois, roi_indices, outsize,
spatial_scale, group_size
):
return PSROIMaxPooling2D(outsize, spatial_scale,
group_size)(x, rois, roi_indices) | [
"def _pool_roi(feature_map, roi, pooled_height, pooled_width):\n\n # Compute the region of interest\n feature_map_height = int(feature_map.shape[0])\n feature_map_width = int(feature_map.shape[1])\n\n h_start = tf.cast(feature_map_height * roi[0], 'int32')\n w_start = tf.cast(feat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check bijection between a project's samples and its submission scripts. | def validate_submission_scripts(project, _):
scripts_by_sample = {s.name: _find_subs(project, s) for s in project.samples}
assert len(project.samples) == len(scripts_by_sample)
assert all(1 == len(scripts) for scripts in scripts_by_sample.values()) | [
"def verify_run_against_sample_sheet(illumina_data,sample_sheet):\n # Get predicted outputs\n predicted_projects = CasavaSampleSheet(sample_sheet).predict_output()\n # Loop through projects and check that predicted outputs exist\n verified = True\n for proj in predicted_projects:\n # Locate pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Collect by sample name any flag files within a project. | def _collect_flags(project):
acc = {}
for s in project.samples:
fs = fetch_sample_flags(project, s)
if fs:
acc[s.name] = fs
return acc | [
"def gather_files():\n return glob.glob(\"input/*.json\")",
"def acquire_files():\n sample_measurements = []\n sample_names = []\n dir_path = os.getcwd()\n for file in os.listdir(dir_path):\n if file.lower().endswith(\".spe\"):\n \"Ignore the background and reference spectra\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Count the number of files immediately within folder that match predicate(s). | def _count_files(p, *preds):
return sum(1 for f in os.listdir(p)
if os.path.isfile(f) and all(map(lambda p: p(f), preds))) | [
"def processPath(wildPath, criteria, disposition):\n count = 0\n for f in glob.glob(wildPath):\n if criteria(f):\n disposition(f)\n count += 1\n return count",
"def count_mp3_files_below(adir_path):\n matches = []\n for root, dirnames, filenames in os.walk(adir_path):\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
From array of conductors, accumulate submission count. | def _count_submissions(conductors):
return sum(c.num_cmd_submissions for c in conductors) | [
"def _increment_reviewer_counts(self):\n from reviewboard.accounts.models import LocalSiteProfile\n\n groups = list(self.target_groups.values_list('pk', flat=True))\n people = list(self.target_people.values_list('pk', flat=True))\n\n Group.incoming_request_count.increment(self.target_gro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find submission script paths associated with a project. | def _find_subs(project, sample=None):
name_patt = "{}*.sub".format("*" + sample.name if sample else "")
return glob.glob(os.path.join(project.submission_folder, name_patt)) | [
"def get_paths_triggering_build(config_settings=None):",
"def _find_missing_script_paths(self) -> list:\r\n results: list = []\r\n\r\n for psc_path in self.psc_paths:\r\n if self.options.game_type == 'fo4':\r\n object_name = PathHelper.calculate_relative_object_name(psc_pat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a flag file. | def _mkflag(sample, prj, flag):
fp = os.path.join(sample_folder(prj, sample), flag + ".flag")
return _mkfile(fp, "Making flag for {}".format(sample.name)) | [
"def _write_flags(flags):\n os.makedirs(flags.full_path, exist_ok=True)\n\n # pylint: disable=invalid-name\n with open(flags.json_path, 'w', encoding='utf-8') as f:\n json.dump(vars(flags), f, ensure_ascii=False, indent=4)",
"def _create_filename(self, filename):",
"def create_dir_and_save_flags... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a list of constraints from the functions in the lar_constraints object that apply syntax and validity edits. | def get_const_list(self):
#Creates an empty list to store constraint function names.
constraints = []
#Takes each function pertaining to a syntax or validity edit
#in the lar_constraints class, and adds it to the empty constraints.
for func in dir(self.lar_const):
if func[:1] in ("s", "v") and func[1:4].... | [
"def as_constraint(self, *args):\n return []",
"def constraints(self):\n json_start = [\n \"\"\"\"constraints\":[\"\"\",\n ]\n json_end = [\"],\"]\n\n all_constraints = (\n self.backbone_constraints\n + self.gaps_constraints\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies a constraint (func) to a generated row of LAR data and returns a new row in a dictionary format. | def apply_constraint(self, row, func):
#Copies the row.
row_start = row.copy()
#Uses getattr to apply the constraint in the lar_constraints class.
row = getattr(self.lar_const, func)(row)
#Logs the changes in the intial row after the constraints
#have been applied.
diff_1, diff_2 = self.get_diff(row, r... | [
"def make_clean_lar_row(self, ts_row):\n\n\t\t#Stores the stop condition and the initial number of iterations.\n\t\tstop = False\n\t\titers = 1\n\n\t\t#Makes a new row using the lar generator.\n\t\trow = self.lar_gen.make_row(lei=self.lei)\n\n\t\t#Begins a loop that creates the LAR row. The loop generates the row\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks the difference between an initial row and the row after constraints are applied | def get_diff(self, row, row_base):
#Convert initial row to set.
initial_row = set(row_base.items())
#Convert constrained row to set.
changed_row = set(row.items())
#Subtract row sets to show changes from constraint functions.
diff_1 = (changed_row - initial_row)
diff_2 = (initial_row - changed_row)
r... | [
"def row1_invariant(self, target_col):\n if self.current_position(0, 0) != (1, target_col):\n return False\n for row in range(2, self.get_height()):\n for col in range(self.get_width()):\n if self.current_position(row, col) != (row, col):\n print... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies the list of constraints generated to each row | def constraints_loop(self, constraints=[], row=None, row_base=None):
for const in constraints:
row = self.apply_constraint(row, const)
diff = self.get_diff(row, row_base)
return row | [
"def write_constraints(self, table):\n constraint_sql = super(PostgresDbWriter, self).write_constraints(table)\n for sql in constraint_sql:\n self.execute(sql)",
"def populate(self):\n for allow, sources, sinks in self.constraints:\n for src in sources:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |