query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Open an image file as a Pillow image object.
def handle_image_file(file: _FileLike) -> Image.Image: try: im = Image.open(file) return im except IOError as e: raise HTTPException(500, detail=str(e))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image(file_path):\r\n return Image.open(file_path)", "def open_image(image_path, mode=\"RGB\"):\n print(\"Opening image file in '%s'.\" % image_path)\n return Image.open(image_path).convert(mode)", "def open_image(filename):\n\n dataset = gdal.Open(filename, gdal.GA_ReadOnly)\n if datas...
[ "0.759027", "0.73065186", "0.718372", "0.7101412", "0.70892704", "0.6963195", "0.694717", "0.69382864", "0.68608856", "0.6837533", "0.6731151", "0.6718459", "0.6677456", "0.66101444", "0.65950394", "0.65664005", "0.6510118", "0.6501636", "0.6369527", "0.63234633", "0.6295427"...
0.6875218
8
Fetch an image from a given URL.
def fetch_image(url: str) -> Image.Image: r = httpx.get(url) if not r.status_code == httpx.codes.OK: raise HTTPException(r.status_code, detail=r.reason_phrase) f = BytesIO(r.content) im = handle_image_file(f) return im
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_image(img_url):\n\n r = requests.get(img_url)\n return r.content", "def _download_img_from_url(self, img_url):\r\n response = requests.get(img_url)\r\n img = Image.open(BytesIO(response.content))\r\n print(\"Downloaded image from url\")\r\n return img", "def getImage...
[ "0.8507021", "0.80610484", "0.79975206", "0.7953096", "0.79118997", "0.7878863", "0.7840954", "0.7823508", "0.77485085", "0.77150685", "0.7658794", "0.76583415", "0.7470759", "0.7440883", "0.7416042", "0.74151766", "0.73907363", "0.73734015", "0.7324511", "0.7323661", "0.7306...
0.8826489
0
Test case for command_trigger_webhook_post Launch a command via a Trigger
def test_command_trigger_webhook_post(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_webhook_endpoint_generates_telegram_command_event(\n hass: HomeAssistant,\n webhook_platform,\n hass_client: ClientSessionGenerator,\n update_message_command,\n) -> None:\n client = await hass_client()\n events = async_capture_events(hass, \"telegram_command\")\n\n response = aw...
[ "0.6756358", "0.63620687", "0.6353586", "0.6080397", "0.60362595", "0.5910809", "0.59053904", "0.58640003", "0.58217233", "0.57251173", "0.5721428", "0.5700421", "0.5697234", "0.5693077", "0.56879246", "0.5658715", "0.5656193", "0.5644521", "0.5596793", "0.5591541", "0.554928...
0.88001287
0
Initialize adaptive histogram equalization
def __init__(self, active: bool): self.clahe = cv2.createCLAHE(clipLimit=3.0, tileGridSize=(8, 8)) self.active = active
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equalise_hist(image, bin_count=256):\n # TODO: your histogram equalization code\n #define arrays\n image = img_as_ubyte(image)\n row,col = image.shape\n new_image = np.zeros((row,col),dtype='uint8') \n\n # compute the value of each grayscale,and save in image_hist \n image_hist = np.bincount(image.flatt...
[ "0.64742666", "0.64495724", "0.623169", "0.6206092", "0.6172548", "0.615209", "0.60600775", "0.6026051", "0.60240495", "0.5974756", "0.594645", "0.5923977", "0.59031487", "0.5899694", "0.5876003", "0.5854515", "0.58174914", "0.5769434", "0.57519495", "0.5749652", "0.57370484"...
0.0
-1
Generator function that returns collection members.
def _get_collection(self, collection_uri, request_headers=None): # get the collection status, headers, thecollection = self._rest_get(collection_uri) if status != 200: msg = self._get_extended_error(thecollection) raise exception.IloError(msg) while status < 300: # verify expected type # Don't limit to version 0 here as we will rev to 1.0 at some # point hopefully with minimal changes ctype = self._get_type(thecollection) if (ctype not in ['Collection.0', 'Collection.1']): raise exception.IloError("collection not found") # if this collection has inline items, return those # NOTE: Collections are very flexible in how the represent # members. They can be inline in the collection as members # of the 'Items' array, or they may be href links in the # links/Members array. The could actually be both. Typically, # iLO implements the inline (Items) for only when the collection # is read only. We have to render it with the href links when an # array contains PATCHable items because its complex to PATCH # inline collection members. if 'Items' in thecollection: # iterate items for item in thecollection['Items']: # if the item has a self uri pointer, # supply that for convenience. memberuri = None if 'links' in item and 'self' in item['links']: memberuri = item['links']['self']['href'] yield 200, None, item, memberuri # else walk the member links elif ('links' in thecollection and 'Member' in thecollection['links']): # iterate members for memberuri in thecollection['links']['Member']: # for each member return the resource indicated by the # member link status, headers, member = self._rest_get(memberuri['href']) yield status, headers, member, memberuri['href'] # page forward if there are more pages in the collection if ('links' in thecollection and 'NextPage' in thecollection['links']): next_link_uri = (collection_uri + '?page=' + str( thecollection['links']['NextPage']['page'])) status, headers, thecollection = self._rest_get(next_link_uri) # else we are finished iterating the collection else: break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self) -> Generator[str, None, None]:\n\n yield from self.__dict__[\"members\"]", "def get_members():", "def getMembers():", "def getMembers():", "def getMembers():", "def getMembers():", "def members(self) -> Generator[discord.Member, None, None]:\n for guild in self.guilds:\...
[ "0.78000563", "0.7432869", "0.68755776", "0.68755776", "0.68755776", "0.68755776", "0.67106056", "0.6568998", "0.6439682", "0.63878435", "0.637143", "0.63655144", "0.6334077", "0.6326549", "0.6291822", "0.6231462", "0.6227288", "0.62206596", "0.6170464", "0.6161556", "0.60845...
0.0
-1
Return the type of an object.
def _get_type(self, obj): typever = obj['Type'] typesplit = typever.split('.') return typesplit[0] + '.' + typesplit[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type ( self, object ):\n return self.type", "def get_type ( self, object ):\n return self.type", "def object_type(self):\n return self._object_type", "def object_type(self):\n return self._object_type", "def object_type(self):\n return self._object_type", "def o...
[ "0.8628719", "0.8628719", "0.8257007", "0.8257007", "0.8257007", "0.8257007", "0.8257007", "0.82011956", "0.82011956", "0.82011956", "0.82011956", "0.82011956", "0.82011956", "0.82011956", "0.82011956", "0.82011956", "0.82011956", "0.82011956", "0.82011956", "0.82011956", "0....
0.69202507
88
Checks if specified operation is allowed on the resource.
def _operation_allowed(self, headers_dict, operation): if 'allow' in headers_dict: if operation in headers_dict['allow']: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_allowed(self, role, operation, resource):\r\n assert not role or role in self._roles\r\n assert not resource or resource in self._resources\r\n\r\n roles = set(get_family(self._roles, role))\r\n operations = set([None, operation])\r\n resources = set(get_family(self._resou...
[ "0.735948", "0.72206527", "0.68997526", "0.6572741", "0.64294475", "0.63755685", "0.63672787", "0.6200207", "0.61940044", "0.61875075", "0.6171609", "0.61679983", "0.60811335", "0.607854", "0.604403", "0.60305333", "0.60210794", "0.60210794", "0.60156304", "0.6002486", "0.599...
0.77897847
0
Parse the ExtendedError object and retruns the message. Build a list of decoded messages from the extended_error using the message registries. An ExtendedError JSON object is a response from the with its own schema. This function knows how to parse the ExtendedError object and, using any loaded message registries, render an array of plain language strings that represent the response.
def _render_extended_error_message_list(self, extended_error): messages = [] if isinstance(extended_error, dict): if ('Type' in extended_error and extended_error['Type'].startswith('ExtendedError.')): for msg in extended_error['Messages']: message_id = msg['MessageID'] x = message_id.split('.') registry = x[0] msgkey = x[len(x) - 1] # if the correct message registry is loaded, # do string resolution if (registry in self.message_registries and msgkey in self.message_registries[registry]['Messages']): rmsgs = self.message_registries[registry]['Messages'] msg_dict = rmsgs[msgkey] msg_str = message_id + ': ' + msg_dict['Message'] for argn in range(0, msg_dict['NumberOfArgs']): subst = '%' + str(argn+1) m = str(msg['MessageArgs'][argn]) msg_str = msg_str.replace(subst, m) if ('Resolution' in msg_dict and msg_dict['Resolution'] != 'None'): msg_str += ' ' + msg_dict['Resolution'] messages.append(msg_str) else: # no message registry, simply return the msg object # in string form messages.append(str(message_id)) return messages
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_extended_error(self, extended_error):\n return self._render_extended_error_message_list(extended_error)", "def _get_resp_body_errors(self):\n\n if self._resp_body_errors and len(self._resp_body_errors) > 0:\n return self._resp_body_errors\n\n errors = []\n warnings...
[ "0.6861036", "0.57295793", "0.5393745", "0.52291447", "0.51675904", "0.50977695", "0.50927067", "0.50382864", "0.499844", "0.49484342", "0.48670247", "0.4862164", "0.48498005", "0.48152092", "0.479743", "0.4794128", "0.4794128", "0.4792617", "0.47888657", "0.4763331", "0.4752...
0.8262206
0
Gets the list of decoded messages from the extended_error.
def _get_extended_error(self, extended_error): return self._render_extended_error_message_list(extended_error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _render_extended_error_message_list(self, extended_error):\n messages = []\n if isinstance(extended_error, dict):\n if ('Type' in extended_error and\n extended_error['Type'].startswith('ExtendedError.')):\n for msg in extended_error['Messages']:\n ...
[ "0.780336", "0.66833067", "0.6297517", "0.62860835", "0.62860835", "0.60984194", "0.6095849", "0.60497504", "0.60270995", "0.59741163", "0.59682614", "0.59034014", "0.58919424", "0.58919424", "0.58919424", "0.58700424", "0.5852855", "0.57940054", "0.5786559", "0.57755375", "0...
0.7126763
1
Get the system details.
def _get_host_details(self): # Assuming only one system present as part of collection, # as we are dealing with iLO's here. status, headers, system = self._rest_get('/rest/v1/Systems/1') if status < 300: stype = self._get_type(system) if stype not in ['ComputerSystem.0', 'ComputerSystem.1']: msg = "%s is not a valid system type " % stype raise exception.IloError(msg) else: msg = self._get_extended_error(system) raise exception.IloError(msg) return system
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_system_info(self) -> Dict[str, Any]:\n assert self._client is not None\n return await self._client.invoke_method(\"system.info\")", "def get_system_info(self):\r\n method = self.public_endpoints['system_info']['method']\r\n url = self.base_url + self.public_endpoints[...
[ "0.8487843", "0.81485045", "0.7842302", "0.7782143", "0.7730701", "0.7618187", "0.7365681", "0.7167398", "0.71424323", "0.7105484", "0.7102612", "0.70674133", "0.70565844", "0.7018115", "0.7008186", "0.7008186", "0.7008186", "0.7008186", "0.7008186", "0.7008186", "0.7008186",...
0.7909569
2
Check if the bios resource exists.
def _check_bios_resource(self, properties=[]): system = self._get_host_details() if ('links' in system['Oem']['Hp'] and 'BIOS' in system['Oem']['Hp']['links']): # Get the BIOS URI and Settings bios_uri = system['Oem']['Hp']['links']['BIOS']['href'] status, headers, bios_settings = self._rest_get(bios_uri) if status >= 300: msg = self._get_extended_error(bios_settings) raise exception.IloError(msg) # If property is not None, check if the bios_property is supported for property in properties: if property not in bios_settings: # not supported on this platform msg = ('BIOS Property "' + property + '" is not' ' supported on this system.') raise exception.IloCommandNotSupportedError(msg) return headers, bios_uri, bios_settings else: msg = ('"links/BIOS" section in ComputerSystem/Oem/Hp' ' does not exist') raise exception.IloCommandNotSupportedError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def does_resource_exist(resource):\n try:\n resource.load()\n return True\n except botocore.exceptions.ClientError as e:\n if e.response['Error']['Code'] == 'ValidationError':\n return False\n else:\n raise e", "def ResourceExists(self, name):\n pass", ...
[ "0.6995172", "0.6845966", "0.67246604", "0.66229993", "0.6481578", "0.64715683", "0.63962346", "0.63410455", "0.6323303", "0.62668014", "0.6262816", "0.624901", "0.62375194", "0.623514", "0.6232769", "0.6223159", "0.6223159", "0.61314154", "0.6087281", "0.6079083", "0.6048402...
0.67197114
3
Gets the PCI devices.
def _get_pci_devices(self): system = self._get_host_details() if ('links' in system['Oem']['Hp'] and 'PCIDevices' in system['Oem']['Hp']['links']): # Get the PCI URI and Settings pci_uri = system['Oem']['Hp']['links']['PCIDevices']['href'] status, headers, pci_device_list = self._rest_get(pci_uri) if status >= 300: msg = self._get_extended_error(pci_device_list) raise exception.IloError(msg) return pci_device_list else: msg = ('links/PCIDevices section in ComputerSystem/Oem/Hp' ' does not exist') raise exception.IloCommandNotSupportedError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_pci_device_list(self):\n pass", "def _get_gpu_pci_devices(self):\n pci_device_list = self._get_pci_devices()\n\n gpu_list = []\n items = pci_device_list['Items']\n for item in items:\n if item['ClassCode'] in CLASSCODE_FOR_GPU_DEVICES:\n i...
[ "0.74077874", "0.7218372", "0.72180504", "0.72177297", "0.7194209", "0.7167658", "0.70619637", "0.69890875", "0.698407", "0.69460297", "0.6933677", "0.6915167", "0.688954", "0.68429095", "0.6825503", "0.68069667", "0.68069667", "0.68069667", "0.68069667", "0.67960405", "0.679...
0.8361106
0
Returns the list of gpu devices.
def _get_gpu_pci_devices(self): pci_device_list = self._get_pci_devices() gpu_list = [] items = pci_device_list['Items'] for item in items: if item['ClassCode'] in CLASSCODE_FOR_GPU_DEVICES: if item['SubclassCode'] in SUBCLASSCODE_FOR_GPU_DEVICES: gpu_list.append(item) return gpu_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gpu_devices(self):\n return self._gpu_devices", "def devices(self):\n\t\t\tdevices = []\n\t\t\tnum = cuda.Device.count()\n\t\t\tfor id in range(num):\n\t\t\t\tname = cuda.Device(id).name()\n\t\t\t\tmemory = cuda.Device(id).total_memory()\n\t\t\t\tdevices.append((memory, name, id))\n\t\t\treturn device...
[ "0.85350674", "0.7933002", "0.7830052", "0.7785717", "0.77419907", "0.75910795", "0.746411", "0.74347156", "0.74125063", "0.74052244", "0.73901397", "0.7388185", "0.7388185", "0.7371611", "0.73683524", "0.7368252", "0.73586226", "0.7343914", "0.73268294", "0.7308077", "0.7295...
0.7771476
4
Get the BIOS settings resource.
def _get_bios_settings_resource(self, data): try: bios_settings_uri = data['links']['Settings']['href'] except KeyError: msg = ('BIOS Settings resource not found.') raise exception.IloError(msg) status, headers, bios_settings = self._rest_get(bios_settings_uri) if status != 200: msg = self._get_extended_error(bios_settings) raise exception.IloError(msg) return headers, bios_settings_uri, bios_settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_bios_setting(self, bios_property):\n headers, bios_uri, bios_settings = self._check_bios_resource([\n bios_property])\n return bios_settings[bios_property]", "def get_current_bios_settings(self, only_allowed_settings=True):\n\n sushy_system = self._get_sushy_system()\n ...
[ "0.6687052", "0.66053444", "0.6305347", "0.62781394", "0.6151722", "0.6145869", "0.5832804", "0.56546223", "0.5652844", "0.5579022", "0.5577148", "0.55607617", "0.5531982", "0.5527874", "0.54689676", "0.5428091", "0.5396962", "0.53963387", "0.53295165", "0.53211266", "0.52970...
0.7173748
0
Check if the PATCH Operation is allowed on the resource.
def _validate_if_patch_supported(self, headers, uri): if not self._operation_allowed(headers, 'PATCH'): msg = ('PATCH Operation not supported on the resource ' '"%s"' % uri) raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_PATCH(self):\n if not self.url:\n return\n response = self.client.patch(self.url, {}, format='json')\n self.assertIn(response.status_code, [status.HTTP_405_METHOD_NOT_ALLOWED,\n status.HTTP_401_UNAUTHORIZED])", "def test_partial...
[ "0.69640553", "0.6944961", "0.6830189", "0.6657633", "0.65127224", "0.63872164", "0.6329733", "0.62977004", "0.61410993", "0.6072097", "0.5949872", "0.5900068", "0.58420664", "0.58221006", "0.5762764", "0.57505614", "0.5717169", "0.571581", "0.56980234", "0.5684516", "0.56841...
0.803524
0
Retrieves bios settings of the server.
def _get_bios_setting(self, bios_property): headers, bios_uri, bios_settings = self._check_bios_resource([ bios_property]) return bios_settings[bios_property]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_bios_settings_resource(self, data):\n try:\n bios_settings_uri = data['links']['Settings']['href']\n except KeyError:\n msg = ('BIOS Settings resource not found.')\n raise exception.IloError(msg)\n\n status, headers, bios_settings = self._rest_get(bios...
[ "0.70597833", "0.67072386", "0.66295433", "0.63893646", "0.6140606", "0.59224844", "0.58876735", "0.57552373", "0.57381696", "0.5689282", "0.5650241", "0.55698514", "0.5555418", "0.55383116", "0.54772294", "0.5444395", "0.5402679", "0.5402679", "0.53762496", "0.5365478", "0.5...
0.6843512
1
Get the hashed BIOS password.
def _get_bios_hash_password(self, bios_password): request_headers = {} if bios_password: bios_password_hash = hashlib.sha256((bios_password.encode()). hexdigest().upper()) request_headers['X-HPRESTFULAPI-AuthToken'] = bios_password_hash return request_headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_password(self):\n return self.controller.dbfilter.db.get('passwd/user-password')", "def get_user_password(text):\n return getpass.getpass(text)", "def hash_password(self, password):\n cmd = [\n \"snap\",\n \"run\",\n \"{}.hash-password\".format(self.syn...
[ "0.69720805", "0.67519724", "0.6749621", "0.6708863", "0.67022777", "0.6677505", "0.66462785", "0.66458017", "0.66124636", "0.659454", "0.6591045", "0.657617", "0.657617", "0.6572322", "0.6572243", "0.655515", "0.6551918", "0.6551918", "0.65395516", "0.6535958", "0.6509161", ...
0.62322944
50
Change the bios settings to specified values.
def _change_bios_setting(self, properties): keys = properties.keys() # Check if the BIOS resource/property exists. headers, bios_uri, settings = self._check_bios_resource(keys) if not self._operation_allowed(headers, 'PATCH'): headers, bios_uri, _ = self._get_bios_settings_resource(settings) self._validate_if_patch_supported(headers, bios_uri) request_headers = self._get_bios_hash_password(self.bios_password) status, headers, response = self._rest_patch(bios_uri, request_headers, properties) if status >= 300: msg = self._get_extended_error(response) raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_settings(self):\n\n self.sim.account.set_balance(int(self.balance_str.get()))\n\n self.sim.config.set_base_bet(int(self.base_bet_str.get()))\n self.sim.config.set_payout(float(self.payout_str.get()))\n self.sim.config.set_iterations(int(self.iterations_str.get()))\n se...
[ "0.66702175", "0.6587007", "0.6494527", "0.5839522", "0.5798138", "0.57914835", "0.5751046", "0.57356983", "0.5709629", "0.570142", "0.5681322", "0.5674938", "0.5627437", "0.55195767", "0.5518369", "0.5467664", "0.5458394", "0.54570925", "0.54484177", "0.5436495", "0.5432372"...
0.65265524
2
Get the iscsi settings resoure.
def _get_iscsi_settings_resource(self, data): try: iscsi_settings_uri = data['links']['Settings']['href'] except KeyError: msg = ('iscsi settings resource not found.') raise exception.IloCommandNotSupportedError(msg) status, headers, iscsi_settings = self._rest_get(iscsi_settings_uri) if status != 200: msg = self._get_extended_error(iscsi_settings) raise exception.IloError(msg) return headers, iscsi_settings_uri, iscsi_settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_settings(self):\n return self.request({\n \"path\": \"/\" + UUID + \"/setting\"\n })", "def get_settings(self):\n return self.settings", "def get_settings(self):\n url = \"https://api.imgur.com/3/account/{0}/settings\".format(self.name)\n return self._imgur...
[ "0.6224379", "0.5955814", "0.59340453", "0.5871603", "0.5869005", "0.5833151", "0.57728857", "0.57651824", "0.57078904", "0.57052916", "0.5703846", "0.5703846", "0.5703846", "0.5703846", "0.56948245", "0.5670498", "0.5628336", "0.56175953", "0.56175953", "0.5589727", "0.55740...
0.7113912
0
Get the Boot resource like BootSources.
def _get_bios_boot_resource(self, data): try: boot_uri = data['links']['Boot']['href'] except KeyError: msg = ('Boot resource not found.') raise exception.IloCommandNotSupportedError(msg) status, headers, boot_settings = self._rest_get(boot_uri) if status != 200: msg = self._get_extended_error(boot_settings) raise exception.IloError(msg) return boot_settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_persistent_boot_devices(self):\n # Check if the BIOS resource if exists.\n headers_bios, bios_uri, bios_settings = self._check_bios_resource()\n\n # Get the Boot resource.\n boot_settings = self._get_bios_boot_resource(bios_settings)\n\n # Get the BootSources resource\n ...
[ "0.5812557", "0.5714252", "0.5702293", "0.5645948", "0.5568216", "0.5541851", "0.5470517", "0.5470517", "0.5470517", "0.54481995", "0.54481995", "0.54481995", "0.54442555", "0.54271823", "0.5424539", "0.53723615", "0.5370766", "0.5336021", "0.530553", "0.5278246", "0.5265546"...
0.5864545
0
Get the Mappings resource.
def _get_bios_mappings_resource(self, data): try: map_uri = data['links']['Mappings']['href'] except KeyError: msg = ('Mappings resource not found.') raise exception.IloCommandNotSupportedError(msg) status, headers, map_settings = self._rest_get(map_uri) if status != 200: msg = self._get_extended_error(map_settings) raise exception.IloError(msg) return map_settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping(self):\n return self._mapping", "def get_mapping(self, ksf: str) -> InfoResMapping:\n irm = self.InfoResMapping(self, ksf)\n return irm", "def getMapping(self):\n self._process()\n return self._mapping", "def mapping(self):\n return self.request('_mapping...
[ "0.673186", "0.6723476", "0.67003196", "0.6668532", "0.6564718", "0.6539853", "0.6527213", "0.6339044", "0.63287383", "0.6280277", "0.62163085", "0.60885906", "0.607769", "0.6042368", "0.6038287", "0.60309374", "0.60278445", "0.5881427", "0.585224", "0.5841346", "0.58215725",...
0.6955971
0
Checks if patch is supported on iscsi.
def _check_iscsi_rest_patch_allowed(self): headers, bios_uri, bios_settings = self._check_bios_resource() # Check if the bios resource exists. if('links' in bios_settings and 'iScsi' in bios_settings['links']): iscsi_uri = bios_settings['links']['iScsi']['href'] status, headers, settings = self._rest_get(iscsi_uri) if status != 200: msg = self._get_extended_error(settings) raise exception.IloError(msg) if not self._operation_allowed(headers, 'PATCH'): headers, iscsi_uri, settings = ( self._get_iscsi_settings_resource(settings)) self._validate_if_patch_supported(headers, iscsi_uri) return iscsi_uri else: msg = ('"links/iScsi" section in bios' ' does not exist') raise exception.IloCommandNotSupportedError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_if_patch_supported(self, headers, uri):\n if not self._operation_allowed(headers, 'PATCH'):\n msg = ('PATCH Operation not supported on the resource '\n '\"%s\"' % uri)\n raise exception.IloError(msg)", "def check_supported_features(self):",...
[ "0.6394003", "0.6082379", "0.5752724", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.5584858", ...
0.7114112
0
Change secure boot settings on the server.
def _change_secure_boot_settings(self, property, value): system = self._get_host_details() # find the BIOS URI if ('links' not in system['Oem']['Hp'] or 'SecureBoot' not in system['Oem']['Hp']['links']): msg = (' "SecureBoot" resource or feature is not ' 'supported on this system') raise exception.IloCommandNotSupportedError(msg) secure_boot_uri = system['Oem']['Hp']['links']['SecureBoot']['href'] # Change the property required new_secure_boot_settings = {} new_secure_boot_settings[property] = value # perform the patch status, headers, response = self._rest_patch( secure_boot_uri, None, new_secure_boot_settings) if status >= 300: msg = self._get_extended_error(response) raise exception.IloError(msg) # Change the bios setting as a workaround to enable secure boot # Can be removed when fixed for Gen9 snap2 val = self._get_bios_setting('CustomPostMessage') val = val.rstrip() if val.endswith(" ") else val+" " self._change_bios_setting({'CustomPostMessage': val})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_secure_boot_mode(self, secure_boot_enable):\n sushy_system = self._get_sushy_system()\n try:\n sushy_system.secure_boot.enable_secure_boot(secure_boot_enable)\n except exception.InvalidInputError as e:\n msg = (self._('Invalid input. Error %(error)s')\n ...
[ "0.7178006", "0.69563264", "0.6825512", "0.68102604", "0.6628108", "0.61587363", "0.59844947", "0.58227813", "0.57520616", "0.5736573", "0.5724402", "0.5678746", "0.56520265", "0.56394017", "0.5624491", "0.5624137", "0.56189376", "0.5582487", "0.55506265", "0.5549751", "0.552...
0.72850573
0
Checks if the system is in uefi boot mode.
def _is_boot_mode_uefi(self): boot_mode = self.get_current_boot_mode() if boot_mode == 'UEFI': return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_bootable(self):\n return self.bootable_flag == 0x80", "def has_efi():\n return os.path.exists(\"/sys/firmware/efi\")", "def get_boot_mode():\n boot_mode = 'Legacy'\n try:\n reg_key = winreg.OpenKey(\n winreg.HKEY_LOCAL_MACHINE, r'System\\CurrentControlSet\\Control')\n reg_value = ...
[ "0.7057053", "0.69969964", "0.6908815", "0.6746094", "0.67178434", "0.6590464", "0.6447706", "0.64065146", "0.6263757", "0.6129953", "0.61029017", "0.6102866", "0.6059007", "0.6056331", "0.6024979", "0.5940045", "0.5927244", "0.590934", "0.585367", "0.5818194", "0.58100754", ...
0.8531207
0
Gets the product name of the server.
def get_product_name(self): system = self._get_host_details() return system['Model']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_name(self):\n return self._stub.List(self._message).product_name", "def product_name(self):\n return self._product_name", "def product_name(self) -> Optional[str]:\n return pulumi.get(self, \"product_name\")", "def server_name(self) -> str:\n return pulumi.get(self, \"...
[ "0.8168809", "0.7893617", "0.7663046", "0.7437491", "0.7431132", "0.7421063", "0.73451436", "0.73016155", "0.73016155", "0.71450585", "0.6981237", "0.6889687", "0.6856621", "0.67716855", "0.6767265", "0.6752493", "0.66959023", "0.66839856", "0.6644297", "0.6551729", "0.654257...
0.7758751
2
Get the status of secure boot.
def get_secure_boot_mode(self): system = self._get_host_details() if ('links' not in system['Oem']['Hp'] or 'SecureBoot' not in system['Oem']['Hp']['links']): msg = ('"SecureBoot" resource or feature is not supported' ' on this system') raise exception.IloCommandNotSupportedError(msg) secure_boot_uri = system['Oem']['Hp']['links']['SecureBoot']['href'] # get the Secure Boot object status, headers, secure_boot_settings = self._rest_get(secure_boot_uri) if status >= 300: msg = self._get_extended_error(secure_boot_settings) raise exception.IloError(msg) return secure_boot_settings['SecureBootCurrentState']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_secure_boot_mode(self):\n sushy_system = self._get_sushy_system()\n try:\n secure_boot_enabled = GET_SECUREBOOT_CURRENT_BOOT_MAP.get(\n sushy_system.secure_boot.current_boot)\n except sushy.exceptions.SushyError as e:\n msg = (self._('The Redfish co...
[ "0.7545377", "0.73338354", "0.68596", "0.6580167", "0.6284584", "0.627462", "0.62408715", "0.6210762", "0.6183254", "0.61830187", "0.61508465", "0.61405003", "0.61379737", "0.6085388", "0.6051852", "0.6020663", "0.6020096", "0.6004745", "0.59862554", "0.5939429", "0.58935285"...
0.7864809
0
Enable/Disable secure boot on the server.
def set_secure_boot_mode(self, secure_boot_enable): if self._is_boot_mode_uefi(): self._change_secure_boot_settings('SecureBootEnable', secure_boot_enable) else: msg = ('System is not in UEFI boot mode. "SecureBoot" related ' 'resources cannot be changed.') raise exception.IloCommandNotSupportedInBiosError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_secure_boot(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"enable_secure_boot\")", "def set_secure_boot_mode(self, secure_boot_enable):\n sushy_system = self._get_sushy_system()\n try:\n sushy_system.secure_boot.enable_secure_boot(secure_boot_enable)...
[ "0.76249284", "0.7167012", "0.6691933", "0.6566104", "0.6534776", "0.6505082", "0.64091456", "0.6071081", "0.6065844", "0.6018659", "0.5990192", "0.5968288", "0.5868448", "0.5822843", "0.58050734", "0.5786538", "0.5715072", "0.56919736", "0.5675299", "0.565694", "0.5639137", ...
0.6860936
2
Reset secure boot keys to manufacturing defaults.
def reset_secure_boot_keys(self): if self._is_boot_mode_uefi(): self._change_secure_boot_settings('ResetToDefaultKeys', True) else: msg = ('System is not in UEFI boot mode. "SecureBoot" related ' 'resources cannot be changed.') raise exception.IloCommandNotSupportedInBiosError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(ctx):\n\n controller = ctx.obj['controller']\n click.echo('Resetting OATH data...')\n old_id = controller.id\n controller.reset()\n\n settings = ctx.obj['settings']\n keys = settings.setdefault('keys', {})\n if old_id in keys:\n del keys[old_id]\n settings.write()\n\n ...
[ "0.64598894", "0.61968", "0.61686015", "0.6030497", "0.6030497", "0.58504564", "0.5713005", "0.5710499", "0.5703248", "0.56868505", "0.5620701", "0.5609751", "0.5601407", "0.5587413", "0.5550478", "0.55427927", "0.55306214", "0.55234766", "0.55176026", "0.5505577", "0.5487669...
0.84218895
0
Request the power state of the server.
def get_host_power_status(self): data = self._get_host_details() return data['Power'].upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _doPowerState(self, state=False):\n if state:\n self._cmdPowerOn()\n else:\n self._cmdPowerOff()", "async def power_on(self):\n ...", "def power():\n request_command(tv_command=TVCommand.power)", "def test_api_ucs_power(self):\n # first power off all s...
[ "0.72591937", "0.70166993", "0.6846167", "0.6774623", "0.67444295", "0.6627822", "0.6618059", "0.657318", "0.6498877", "0.6434031", "0.64102936", "0.6391049", "0.63899004", "0.6373958", "0.6363609", "0.63495874", "0.63292205", "0.63288325", "0.63002634", "0.62778926", "0.6276...
0.5593325
85
Perform requested power operation.
def _perform_power_op(self, oper): power_settings = {"Action": "Reset", "ResetType": oper} systems_uri = "/rest/v1/Systems/1" status, headers, response = self._rest_post(systems_uri, None, power_settings) if status >= 300: msg = self._get_extended_error(response) raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power():\n request_command(tv_command=TVCommand.power)", "def power_on(self):\n raise NotImplementedError", "def pow(self, power):\n daskD.wait(self.client.map(_call_pow, self.vecDask, power=power, pure=False))\n return self", "def power_on(self):\n pass", "def power(self...
[ "0.71487105", "0.7076449", "0.70716", "0.6828888", "0.6828583", "0.670036", "0.6691989", "0.66501945", "0.6643156", "0.6614282", "0.6602157", "0.6598427", "0.6593769", "0.6579953", "0.6551106", "0.6543305", "0.6498859", "0.6488113", "0.6479012", "0.646967", "0.6468145", "0....
0.7263758
0
Simulates a physical press of the server power button.
def _press_pwr_btn(self, pushType="Press"): power_settings = {"Action": "PowerButton", "Target": "/Oem/Hp", "PushType": pushType} systems_uri = "/rest/v1/Systems/1" status, headers, response = self._rest_post(systems_uri, None, power_settings) if status >= 300: msg = self._get_extended_error(response) raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power():\n request_command(tv_command=TVCommand.power)", "def press_pwr_btn(self):\n self._press_pwr_btn()", "async def power_on(self):\n ...", "def double_click_power(self):\n get_power_event_cmd = (\"getevent -pl 2>&1 | sed -n \"\n \"'/^add/{h}/KEY_POWER/{x...
[ "0.74329734", "0.7256616", "0.678499", "0.6608517", "0.65348643", "0.64914054", "0.6230932", "0.62221473", "0.62064654", "0.6177791", "0.61654186", "0.61310524", "0.60974616", "0.608872", "0.6059632", "0.6059632", "0.5930312", "0.58865917", "0.5870763", "0.5838959", "0.582892...
0.7021857
2
Simulates a physical press of the server power button.
def press_pwr_btn(self): self._press_pwr_btn()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power():\n request_command(tv_command=TVCommand.power)", "def _press_pwr_btn(self, pushType=\"Press\"):\n power_settings = {\"Action\": \"PowerButton\",\n \"Target\": \"/Oem/Hp\",\n \"PushType\": pushType}\n\n systems_uri = \"/rest/v1/Systems...
[ "0.74329734", "0.7021857", "0.678499", "0.6608517", "0.65348643", "0.64914054", "0.6230932", "0.62221473", "0.62064654", "0.6177791", "0.61654186", "0.61310524", "0.60974616", "0.608872", "0.6059632", "0.6059632", "0.5930312", "0.58865917", "0.5870763", "0.5838959", "0.582892...
0.7256616
1
Simulate a physical press and hold of the server power button.
def hold_pwr_btn(self): self._press_pwr_btn(pushType="PressAndHold")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def press_pwr_btn(self):\n self._press_pwr_btn()", "def power():\n request_command(tv_command=TVCommand.power)", "def _press_pwr_btn(self, pushType=\"Press\"):\n power_settings = {\"Action\": \"PowerButton\",\n \"Target\": \"/Oem/Hp\",\n \"Push...
[ "0.7387342", "0.7323632", "0.67839485", "0.6705996", "0.665293", "0.66293794", "0.6543043", "0.6536976", "0.6496271", "0.6282045", "0.6209138", "0.61596024", "0.614907", "0.61473614", "0.61369175", "0.61359274", "0.611878", "0.6076426", "0.6068141", "0.60628533", "0.6014772",...
0.7298465
2
Toggle the power button of server.
def set_host_power(self, power): power = power.upper() if (power is not None) and (power not in POWER_STATE): msg = ("Invalid input '%(pow)s'. " "The expected input is ON or OFF." % {'pow': power}) raise exception.IloInvalidInputError(msg) # Check current power status, do not act if it's in requested state. cur_status = self.get_host_power_status() if cur_status == power: LOG.debug(self._("Node is already in '%(power)s' power state."), {'power': power}) return self._perform_power_op(POWER_STATE[power])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power():\n request_command(tv_command=TVCommand.power)", "def _toggle_server(self):\r\n\t\t_logger.debug(\"Toggle server button is pressed.\")\r\n\r\n\t\tif not comm_server.is_running():\r\n\t\t\tserver_ip = self.children[\"entry_IP\"].get()\r\n\t\t\tserver_port = int(self.children[\"entry_port\"].get())\...
[ "0.7578163", "0.7492358", "0.74232733", "0.72111523", "0.7157098", "0.7149466", "0.7111762", "0.69473296", "0.6867693", "0.67997324", "0.67328346", "0.6578583", "0.65758115", "0.6563602", "0.65376586", "0.6518119", "0.6517999", "0.6457877", "0.6456714", "0.64391696", "0.64276...
0.5862777
83
Request the http boot url from system in uefi boot mode.
def get_http_boot_url(self): if(self._is_boot_mode_uefi() is True): return self._get_bios_setting('UefiShellStartupUrl') else: msg = 'get_http_boot_url is not supported in the BIOS boot mode' raise exception.IloCommandNotSupportedInBiosError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_http_boot_url(self, url):\n if(self._is_boot_mode_uefi() is True):\n self._change_bios_setting({'UefiShellStartupUrl': url})\n else:\n msg = 'set_http_boot_url is not supported in the BIOS boot mode'\n raise exception.IloCommandNotSupportedInBiosError(msg)", ...
[ "0.77584946", "0.7341055", "0.71151394", "0.65061367", "0.5847443", "0.58197343", "0.5644982", "0.5516919", "0.54772717", "0.54441345", "0.54027355", "0.53707486", "0.53131366", "0.52545315", "0.5227558", "0.5223011", "0.5216488", "0.5198572", "0.51643014", "0.5142962", "0.51...
0.81860113
0
Set url to the UefiShellStartupUrl to the system in uefi boot mode.
def set_http_boot_url(self, url): if(self._is_boot_mode_uefi() is True): self._change_bios_setting({'UefiShellStartupUrl': url}) else: msg = 'set_http_boot_url is not supported in the BIOS boot mode' raise exception.IloCommandNotSupportedInBiosError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_http_boot_uri(self, url):\n try:\n sushy_system = self._get_sushy_system()\n sushy_system.http_boot_uri.set_http_boot_uri(url)\n except sushy.exceptions.SushyError as e:\n msg = (self._('Unable to set HTTP Boot URI. Error '\n '%(error)...
[ "0.72488326", "0.7194045", "0.5525388", "0.55191153", "0.5504752", "0.5186038", "0.51711583", "0.5048918", "0.50152254", "0.49929443", "0.49760246", "0.49735522", "0.49065635", "0.48945484", "0.48868546", "0.48841438", "0.483911", "0.48351452", "0.4814122", "0.48077625", "0.4...
0.8233862
0
Set iscsi details of the system in uefi boot mode. The iSCSI initiator is identified by the MAC provided. The initiator system is set with the target details like IQN, LUN, IP, Port etc.
def set_iscsi_boot_info(self, mac, target_name, lun, ip_address, port='3260', auth_method=None, username=None, password=None): if(self._is_boot_mode_uefi() is True): iscsi_info = {} iscsi_info['iSCSITargetName'] = target_name iscsi_info['iSCSIBootLUN'] = lun iscsi_info['iSCSITargetIpAddress'] = ip_address iscsi_info['iSCSITargetTcpPort'] = int(port) iscsi_info['iSCSITargetInfoViaDHCP'] = False iscsi_info['iSCSIBootEnable'] = 'Enabled' if (auth_method == 'CHAP'): iscsi_info['iSCSIAuthenticationMethod'] = 'Chap' iscsi_info['iSCSIChapUsername'] = username iscsi_info['iSCSIChapSecret'] = password self._change_iscsi_settings(mac.upper(), iscsi_info) else: msg = 'iscsi boot is not supported in the BIOS boot mode' raise exception.IloCommandNotSupportedInBiosError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unset_iscsi_boot_info(self, mac):\n if(self._is_boot_mode_uefi() is True):\n iscsi_info = {'iSCSIBootEnable': 'Disabled'}\n self._change_iscsi_settings(mac.upper(), iscsi_info)\n else:\n msg = 'iscsi boot is not supported in the BIOS boot mode'\n raise ...
[ "0.6869196", "0.6160965", "0.5724841", "0.56476253", "0.5574767", "0.5545499", "0.54519165", "0.5236378", "0.51754254", "0.5034209", "0.5028963", "0.49785176", "0.49782223", "0.49486035", "0.49466297", "0.49353293", "0.4927631", "0.49271697", "0.4922526", "0.49185145", "0.489...
0.79104954
0
Disable iscsi boot option in uefi boot mode.
def unset_iscsi_boot_info(self, mac): if(self._is_boot_mode_uefi() is True): iscsi_info = {'iSCSIBootEnable': 'Disabled'} self._change_iscsi_settings(mac.upper(), iscsi_info) else: msg = 'iscsi boot is not supported in the BIOS boot mode' raise exception.IloCommandNotSupportedInBiosError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_secure_boot_keys(self):\n if self._is_boot_mode_uefi():\n self._change_secure_boot_settings('ResetToDefaultKeys', True)\n else:\n msg = ('System is not in UEFI boot mode. \"SecureBoot\" related '\n 'resources cannot be changed.')\n raise ex...
[ "0.608217", "0.60647833", "0.60542953", "0.60381645", "0.6015318", "0.59813994", "0.5816549", "0.57793945", "0.5776712", "0.5750608", "0.5560355", "0.5523266", "0.55037075", "0.5491119", "0.5489613", "0.54749763", "0.54649585", "0.5449469", "0.54409015", "0.539503", "0.53881"...
0.77110964
0
Retrieves the current boot mode of the server.
def get_current_boot_mode(self): boot_mode = self._get_bios_setting('BootMode') if boot_mode == 'LegacyBios': boot_mode = 'legacy' return boot_mode.upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_boot_mode():\n boot_mode = 'Legacy'\n try:\n reg_key = winreg.OpenKey(\n winreg.HKEY_LOCAL_MACHINE, r'System\\CurrentControlSet\\Control')\n reg_value = winreg.QueryValueEx(reg_key, 'PEFirmwareType')[0]\n if reg_value == 2:\n boot_mode = 'UEFI'\n except:\n boot_mode = 'Unknown'\n\n...
[ "0.77743053", "0.75218076", "0.7441925", "0.7247707", "0.7066327", "0.6706312", "0.6605948", "0.6499532", "0.64143753", "0.6414196", "0.64062566", "0.6375331", "0.6338292", "0.63119465", "0.6295608", "0.6240478", "0.6215727", "0.61063474", "0.60902596", "0.60828465", "0.60800...
0.78080875
0
Retrieves the pending boot mode of the server. Gets the boot mode to be set on next reset.
def get_pending_boot_mode(self): headers, uri, bios_settings = self._check_bios_resource(['BootMode']) _, _, settings = self._get_bios_settings_resource(bios_settings) boot_mode = settings.get('BootMode') if boot_mode == 'LegacyBios': boot_mode = 'legacy' return boot_mode.upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_boot_mode():\n boot_mode = 'Legacy'\n try:\n reg_key = winreg.OpenKey(\n winreg.HKEY_LOCAL_MACHINE, r'System\\CurrentControlSet\\Control')\n reg_value = winreg.QueryValueEx(reg_key, 'PEFirmwareType')[0]\n if reg_value == 2:\n boot_mode = 'UEFI'\n except:\n boot_mode = 'Unknown'\n\n...
[ "0.70903546", "0.69976276", "0.6860447", "0.6815118", "0.66070074", "0.62555677", "0.6129522", "0.6030498", "0.6028887", "0.6026956", "0.6023533", "0.5965988", "0.58770573", "0.5847371", "0.5799201", "0.5777145", "0.5753953", "0.57251155", "0.5688327", "0.56876516", "0.564913...
0.8131488
0
Sets the boot mode of the system for next boot.
def set_pending_boot_mode(self, boot_mode): boot_mode = boot_mode.lower() if boot_mode not in ['uefi', 'legacy']: msg = 'Invalid Boot mode specified' raise exception.IloInvalidInputError(msg) boot_properties = {'BootMode': boot_mode} if boot_mode == 'legacy': boot_properties['BootMode'] = 'LegacyBios' else: # If Boot Mode is 'Uefi' set the UEFIOptimizedBoot first. boot_properties['UefiOptimizedBoot'] = "Enabled" # Change the Boot Mode self._change_bios_setting(boot_properties)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_boot_mode(self, task, mode):\n raise exception.UnsupportedDriverExtension(\n driver=task.node.driver, extension='set_boot_mode')", "def set_bootloader_mode(self, mode):\n self.check_validity()\n\n mode = int(mode)\n\n return self.ipcon.send_request(self, BrickletInd...
[ "0.7535342", "0.7406527", "0.7319358", "0.6997932", "0.66406643", "0.6565158", "0.6410105", "0.6125415", "0.6046522", "0.60436237", "0.6038874", "0.6014684", "0.6005457", "0.6002688", "0.59916985", "0.59749866", "0.5971754", "0.59534365", "0.5944353", "0.5900143", "0.58888465...
0.7734424
0
Resets the iLO password.
def reset_ilo_credential(self, password): acc_uri = '/rest/v1/AccountService/Accounts' for status, hds, account, memberuri in self._get_collection(acc_uri): if account['UserName'] == self.login: mod_user = {} mod_user['Password'] = password status, headers, response = self._rest_patch(memberuri, None, mod_user) if status != 200: msg = self._get_extended_error(response) raise exception.IloError(msg) return msg = "iLO Account with specified username is not found." raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(ctx):\n\n controller = ctx.obj['controller']\n click.echo('Resetting OATH data...')\n old_id = controller.id\n controller.reset()\n\n settings = ctx.obj['settings']\n keys = settings.setdefault('keys', {})\n if old_id in keys:\n del keys[old_id]\n settings.write()\n\n ...
[ "0.71026045", "0.7095906", "0.65982336", "0.6317689", "0.626955", "0.622285", "0.62090886", "0.619031", "0.6150298", "0.6150298", "0.6132683", "0.6118869", "0.60761297", "0.6064993", "0.605403", "0.60505545", "0.60464615", "0.60406226", "0.601135", "0.59997255", "0.5995621", ...
0.72471446
0
Resets the BIOS settings to default values.
def reset_bios_to_default(self): # Check if the BIOS resource if exists. headers_bios, bios_uri, bios_settings = self._check_bios_resource() # Get the BaseConfig resource. try: base_config_uri = bios_settings['links']['BaseConfigs']['href'] except KeyError: msg = ("BaseConfigs resource not found. Couldn't apply the BIOS " "Settings.") raise exception.IloCommandNotSupportedError(msg) # Check if BIOS resource supports patch, else get the settings if not self._operation_allowed(headers_bios, 'PATCH'): headers, bios_uri, _ = self._get_bios_settings_resource( bios_settings) self._validate_if_patch_supported(headers, bios_uri) status, headers, config = self._rest_get(base_config_uri) if status != 200: msg = self._get_extended_error(config) raise exception.IloError(msg) new_bios_settings = {} for cfg in config['BaseConfigs']: default_settings = cfg.get('default', None) if default_settings is not None: new_bios_settings = default_settings break else: msg = ("Default Settings not found in 'BaseConfigs' resource.") raise exception.IloCommandNotSupportedError(msg) request_headers = self._get_bios_hash_password(self.bios_password) status, headers, response = self._rest_patch(bios_uri, request_headers, new_bios_settings) if status >= 300: msg = self._get_extended_error(response) raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\r\n # TODO: have reset flag such that it forces all the bottom changes\r\n self.pwm_freq = self._default[\"pwm_freq\"]\r\n self.gate_logic = self._default[\"gate_logic\"]\r\n self.max_pwm = self._default[\"max_pwm\"]\r\n self.lase_on_power_up = self._default[\"la...
[ "0.68796086", "0.66056365", "0.65619004", "0.65489376", "0.6536054", "0.6508475", "0.64923877", "0.6490318", "0.6390865", "0.6369686", "0.63630855", "0.6360946", "0.6344241", "0.6342181", "0.6341036", "0.63164306", "0.6314139", "0.62830174", "0.62667483", "0.62354726", "0.620...
0.68314517
1
Gets the ilo firmware version for server capabilities
def _get_ilo_firmware_version(self): manager, reset_uri = self._get_ilo_details() ilo_firmware_version = manager['Firmware']['Current']['VersionString'] return {'ilo_firmware_version': ilo_firmware_version}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def firmware_version(self):\n return self._get_system_status()[\"firmware\"]", "def get_ilo_firmware_version_as_major_minor(self):\n try:\n manager, reset_uri = self._get_ilo_details()\n ilo_fw_ver_str = (\n manager['Oem']['Hp']['Firmware']['Current']['VersionString...
[ "0.76318765", "0.74084985", "0.73684555", "0.7351483", "0.7309879", "0.71681994", "0.7141852", "0.696607", "0.6915562", "0.690672", "0.68797165", "0.6854152", "0.67555326", "0.6753871", "0.67471206", "0.67280734", "0.6711157", "0.6674547", "0.66333795", "0.6591106", "0.655982...
0.7568138
1
Gets the ilo firmware version for server capabilities
def get_ilo_firmware_version_as_major_minor(self): try: manager, reset_uri = self._get_ilo_details() ilo_fw_ver_str = ( manager['Oem']['Hp']['Firmware']['Current']['VersionString'] ) return common.get_major_minor(ilo_fw_ver_str) except Exception: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def firmware_version(self):\n return self._get_system_status()[\"firmware\"]", "def _get_ilo_firmware_version(self):\n\n manager, reset_uri = self._get_ilo_details()\n ilo_firmware_version = manager['Firmware']['Current']['VersionString']\n return {'ilo_firmware_version': ilo_firmware_ver...
[ "0.76303834", "0.7566883", "0.7366854", "0.73500246", "0.73084676", "0.71665615", "0.7140502", "0.6964108", "0.69159454", "0.6905643", "0.6877727", "0.6852079", "0.6753259", "0.6751832", "0.67452294", "0.6726138", "0.6709597", "0.66727823", "0.6632324", "0.65892386", "0.65594...
0.7407143
2
Return sriov enabled or not
def _is_sriov_enabled(self): return (self._get_bios_setting('Sriov') == 'Enabled')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_enabled(self):", "def swo_enabled(self):\n return self._swo_enabled", "def ms_get_rstp_enabled(self):\n self.open_route('/configure/switch_settings', \"Switch\")\n dropdown_value = page_utils.get_dropdown_value(\n self.get_page(),\n var_id='node_group_use_stp')\n return dro...
[ "0.644866", "0.63986534", "0.62832564", "0.6205629", "0.6096058", "0.6000314", "0.5948032", "0.5870357", "0.5815211", "0.5815211", "0.5815211", "0.5815211", "0.5815211", "0.5815211", "0.57979065", "0.5792855", "0.5792855", "0.5763365", "0.57592833", "0.5725535", "0.5724957", ...
0.78212315
0
Gets server properties which can be used for scheduling
def get_server_capabilities(self): capabilities = {} system = self._get_host_details() capabilities['server_model'] = system['Model'] rom_firmware_version = ( system['Oem']['Hp']['Bios']['Current']['VersionString']) capabilities['rom_firmware_version'] = rom_firmware_version capabilities.update(self._get_ilo_firmware_version()) capabilities.update(self._get_number_of_gpu_devices_connected()) if self._get_tpm_capability(): capabilities['trusted_boot'] = 'true' if self._get_cpu_virtualization(): capabilities['cpu_vt'] = 'true' if self._get_nvdimm_n_status(): capabilities['nvdimm_n'] = 'true' try: self.get_secure_boot_mode() capabilities['secure_boot'] = 'true' except exception.IloCommandNotSupportedError: # If an error is raised dont populate the capability # secure_boot pass if self._is_sriov_enabled(): capabilities['sriov_enabled'] = 'true' return capabilities
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def properties(self):\n response = self._client.get('server/properties')\n return ServerProperties.from_json(response.text)", "def properties(self):\r\n if self._properties is None:\r\n res = self._con.get(self._url, {'f':'json'})\r\n self._properties = PropertyMap(res)...
[ "0.80747217", "0.6539375", "0.6539375", "0.6380929", "0.63467556", "0.63117343", "0.61406976", "0.61178446", "0.6086679", "0.60554194", "0.59798664", "0.5967408", "0.5949758", "0.5932225", "0.58748645", "0.5870139", "0.58367234", "0.5824827", "0.57901335", "0.5786792", "0.578...
0.53765047
73
Returns the given virtual media device status and device URI
def _get_vm_device_status(self, device='FLOPPY'): valid_devices = {'FLOPPY': 'floppy', 'CDROM': 'cd'} # Check if the input is valid if device not in valid_devices: raise exception.IloInvalidInputError( "Invalid device. Valid devices: FLOPPY or CDROM.") manager, uri = self._get_ilo_details() try: vmedia_uri = manager['links']['VirtualMedia']['href'] except KeyError: msg = ('"VirtualMedia" section in Manager/links does not exist') raise exception.IloCommandNotSupportedError(msg) for status, hds, vmed, memberuri in self._get_collection(vmedia_uri): status, headers, response = self._rest_get(memberuri) if status != 200: msg = self._get_extended_error(response) raise exception.IloError(msg) if (valid_devices[device] in [item.lower() for item in response['MediaTypes']]): vm_device_uri = response['links']['self']['href'] return response, vm_device_uri # Requested device not found msg = ('Virtualmedia device "' + device + '" is not' ' found on this system.') raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vmedia_device_uri(self, device):\n\n try:\n sushy_system = self._get_sushy_system()\n uri = utils.get_subresource_path_by(sushy_system, 'VirtualMedia')\n resp = sushy_system._conn.get(uri)\n vmedia_resp = json.loads(resp.text)\n for val in vmedi...
[ "0.7345246", "0.65547144", "0.652944", "0.60734904", "0.5523844", "0.5463692", "0.5434447", "0.5412849", "0.5385215", "0.5331038", "0.5283186", "0.5263492", "0.52565235", "0.5243921", "0.5218811", "0.5213309", "0.5212679", "0.51299715", "0.50834125", "0.5077698", "0.5065594",...
0.70259494
1
Returns the virtual media drive status.
def get_vm_status(self, device='FLOPPY'): response, vm_device_uri = self._get_vm_device_status(device) # Create RIBCL equivalent response # RIBCL provides this data in VM status # VM_APPLET = CONNECTED | DISCONNECTED # DEVICE = FLOPPY | CDROM # BOOT_OPTION = BOOT_ALWAYS | BOOT_ONCE | NO_BOOT # WRITE_PROTECT = YES | NO # IMAGE_INSERTED = YES | NO response_data = {} if response.get('WriteProtected', False): response_data['WRITE_PROTECT'] = 'YES' else: response_data['WRITE_PROTECT'] = 'NO' if response.get('BootOnNextServerReset', False): response_data['BOOT_OPTION'] = 'BOOT_ONCE' else: response_data['BOOT_OPTION'] = 'BOOT_ALWAYS' if response.get('Inserted', False): response_data['IMAGE_INSERTED'] = 'YES' else: response_data['IMAGE_INSERTED'] = 'NO' if response.get('ConnectedVia') == 'NotConnected': response_data['VM_APPLET'] = 'DISCONNECTED' # When media is not connected, it's NO_BOOT response_data['BOOT_OPTION'] = 'NO_BOOT' else: response_data['VM_APPLET'] = 'CONNECTED' response_data['IMAGE_URL'] = response['Image'] response_data['DEVICE'] = device # FLOPPY cannot be a boot device if ((response_data['BOOT_OPTION'] == 'BOOT_ONCE') and (response_data['DEVICE'] == 'FLOPPY')): response_data['BOOT_OPTION'] = 'NO_BOOT' return response_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vmedia_status(self):\n\n try:\n sushy_system = self._get_sushy_system()\n vmedia_status = sushy_system.vmedia\n except sushy.exceptions.SushyError as e:\n msg = (self._('The vmedia is not found. Error '\n '%(error)s') %\n ...
[ "0.75640255", "0.69452286", "0.66328543", "0.6481011", "0.6425003", "0.637285", "0.6320982", "0.62134093", "0.6203544", "0.6191531", "0.6184872", "0.6158805", "0.61556655", "0.608565", "0.60727584", "0.60462505", "0.6010634", "0.6006689", "0.59516776", "0.5919756", "0.5866605...
0.5910968
20
Sets the Virtual Media drive status It sets the boot option for virtual media device.
def set_vm_status(self, device='FLOPPY', boot_option='BOOT_ONCE', write_protect='YES'): # CONNECT is a RIBCL call. There is no such property to set in RIS. if boot_option == 'CONNECT': return boot_option_map = {'BOOT_ONCE': True, 'BOOT_ALWAYS': False, 'NO_BOOT': False } if boot_option not in boot_option_map: msg = ('Virtualmedia boot option "' + boot_option + '" is ' 'invalid.') raise exception.IloInvalidInputError(msg) response, vm_device_uri = self._get_vm_device_status(device) # Update required property vm_settings = {} vm_settings['Oem'] = ( {'Hp': {'BootOnNextServerReset': boot_option_map[boot_option]}}) # perform the patch operation status, headers, response = self._rest_patch( vm_device_uri, None, vm_settings) if status >= 300: msg = self._get_extended_error(response) raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_vmedia(self, set_vmedia_state):\n\n if not isinstance(set_vmedia_state, bool):\n msg = ('The parameter \"%(parameter)s\" value \"%(value)s\" for '\n 'vmedia is invalid. Valid values are: True/False.' %\n {'parameter': 'ServiceEnabled',\n ...
[ "0.6145363", "0.60608554", "0.604248", "0.58181196", "0.5729332", "0.56799835", "0.56557316", "0.5576355", "0.5562009", "0.5548635", "0.5530569", "0.5530569", "0.5530569", "0.54632413", "0.54603094", "0.54399", "0.5374403", "0.53504235", "0.52688646", "0.5256338", "0.5245759"...
0.6670368
0
Notifies iLO of the location of a virtual media diskette image.
def insert_virtual_media(self, url, device='FLOPPY'): response, vm_device_uri = self._get_vm_device_status(device) # Eject media if there is one. RIBCL was tolerant enough to overwrite # existing media, RIS is not. This check is to take care of that # assumption. if response.get('Inserted', False): self.eject_virtual_media(device) # Update required property vm_settings = {} vm_settings['Image'] = url # Perform the patch operation status, headers, response = self._rest_patch( vm_device_uri, None, vm_settings) if status >= 300: msg = self._get_extended_error(response) raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_volume_after_attached_to_vm(self, info, vms):\n path = info[0]['path']\n path_list = path.split(sep='/')\n machine_path_list = [\"~\", \"Home\"]\n machine_path_list.extend(path_list[3:])\n info[0]['machine_path'] = \"/\".join(machine_path_list)\n info[0]['Attach...
[ "0.53416073", "0.50306785", "0.49840182", "0.49023584", "0.48749703", "0.48598105", "0.48007807", "0.4782172", "0.47274348", "0.46836528", "0.46513668", "0.46505046", "0.4647543", "0.46356696", "0.4622129", "0.46161428", "0.46150172", "0.46038243", "0.4593726", "0.4592042", "...
0.52932024
1
Ejects the Virtual Media image if one is inserted.
def eject_virtual_media(self, device='FLOPPY'): response, vm_device_uri = self._get_vm_device_status(device) # Check if virtual media is connected. if response.get('Inserted') is False: return # Update required property vm_settings = {} vm_settings['Image'] = None # perform the patch operation status, headers, response = self._rest_patch( vm_device_uri, None, vm_settings) if status >= 300: msg = self._get_extended_error(response) raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_removed_media(self):\r\n if self.has_media():\r\n try:\r\n image = str(self.image)\r\n os.remove(image)\r\n except OSError:\r\n raise('Failure trying to remove image from filesystem.')\r\n return True", "def eject_image(...
[ "0.685616", "0.6767739", "0.6732249", "0.66243017", "0.66243017", "0.6524107", "0.63902587", "0.6269782", "0.61779577", "0.60977596", "0.60840386", "0.6020783", "0.5993817", "0.5987346", "0.5948459", "0.59088904", "0.5899906", "0.5896522", "0.5884364", "0.58657366", "0.586572...
0.7177198
0
Get details of persistent boot devices, its order
def _get_persistent_boot_devices(self): # Check if the BIOS resource if exists. headers_bios, bios_uri, bios_settings = self._check_bios_resource() # Get the Boot resource. boot_settings = self._get_bios_boot_resource(bios_settings) # Get the BootSources resource try: boot_sources = boot_settings['BootSources'] except KeyError: msg = ("BootSources resource not found.") raise exception.IloError(msg) try: boot_order = boot_settings['PersistentBootConfigOrder'] except KeyError: msg = ("PersistentBootConfigOrder resource not found.") raise exception.IloCommandNotSupportedError(msg) return boot_sources, boot_order
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_devices(self):\n return [x for x in self.devices.keys()]", "def getbootinfo(self):\n self.mount()\n kernel = None\n inits = []\n for line in self.xlist(\"get-bootinfo\", IBASE)[1]:\n if line.startswith('+++'):\n kernel = line.split()[1]\n ...
[ "0.65933275", "0.64047486", "0.63290364", "0.62824804", "0.627704", "0.6253434", "0.6251941", "0.62083673", "0.62029696", "0.6141751", "0.61345845", "0.6098163", "0.60664326", "0.60396963", "0.6038037", "0.6015366", "0.6013724", "0.6004768", "0.6000633", "0.5989116", "0.59565...
0.78109515
0
Get current persistent boot device set for the host
def get_persistent_boot_device(self): system = self._get_host_details() try: # Return boot device if it is persistent. if system['Boot']['BootSourceOverrideEnabled'] == 'Continuous': device = system['Boot']['BootSourceOverrideTarget'] if device in DEVICE_RIS_TO_COMMON: return DEVICE_RIS_TO_COMMON[device] return device except KeyError as e: msg = "get_persistent_boot_device failed with the KeyError:%s" raise exception.IloError((msg) % e) # Check if we are in BIOS boot mode. # There is no resource to fetch boot device order for BIOS boot mode if not self._is_boot_mode_uefi(): return None # Get persistent boot device order for UEFI boot_sources, boot_devices = self._get_persistent_boot_devices() boot_string = "" try: for source in boot_sources: if (source["StructuredBootString"] == boot_devices[0]): boot_string = source["BootString"] break except KeyError as e: msg = "get_persistent_boot_device failed with the KeyError:%s" raise exception.IloError((msg) % e) if 'HP iLO Virtual USB CD' in boot_string: return 'CDROM' elif ('NIC' in boot_string or 'PXE' in boot_string or "iSCSI" in boot_string): return 'NETWORK' elif common.isDisk(boot_string): return 'HDD' else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_persistent_boot_devices(self):\n # Check if the BIOS resource if exists.\n headers_bios, bios_uri, bios_settings = self._check_bios_resource()\n\n # Get the Boot resource.\n boot_settings = self._get_bios_boot_resource(bios_settings)\n\n # Get the BootSources resource\n ...
[ "0.7050934", "0.6595496", "0.63762164", "0.63091874", "0.62937915", "0.6123704", "0.6111399", "0.60594696", "0.5930392", "0.5907175", "0.5856273", "0.57696676", "0.574115", "0.5735435", "0.569995", "0.5656506", "0.56381845", "0.56327116", "0.56295407", "0.5619154", "0.5611484...
0.65442973
2
Changes the persistent boot device order in BIOS boot mode for host
def _update_persistent_boot(self, device_type=[], persistent=False, mac=None): tenure = 'Once' new_device = device_type[0] # If it is a standard device, we need to convert in RIS convention if device_type[0].upper() in DEVICE_COMMON_TO_RIS: new_device = DEVICE_COMMON_TO_RIS[device_type[0].upper()] if persistent: tenure = 'Continuous' systems_uri = "/rest/v1/Systems/1" # Need to set this option first if device is 'UefiTarget' if new_device is 'UefiTarget': if not mac: msg = ('Mac is needed for iscsi uefi boot') raise exception.IloInvalidInputError(msg) headers, bios_uri, bios_settings = self._check_bios_resource() # Get the Boot resource and Mappings resource. boot_settings = self._get_bios_boot_resource(bios_settings) StructuredBootString = None for boot_setting in boot_settings['BootSources']: if(mac.upper() in boot_setting['UEFIDevicePath'] and 'iSCSI' in boot_setting['UEFIDevicePath']): StructuredBootString = boot_setting['StructuredBootString'] break if not StructuredBootString: msg = ('MAC provided is Invalid "%s"' % mac) raise exception.IloInvalidInputError(msg) new_boot_settings = {} new_boot_settings['Boot'] = {'UefiTargetBootSourceOverride': StructuredBootString} status, headers, response = self._rest_patch(systems_uri, None, new_boot_settings) if status >= 300: msg = self._get_extended_error(response) raise exception.IloError(msg) new_boot_settings = {} new_boot_settings['Boot'] = {'BootSourceOverrideEnabled': tenure, 'BootSourceOverrideTarget': new_device} status, headers, response = self._rest_patch(systems_uri, None, new_boot_settings) if status >= 300: msg = self._get_extended_error(response) raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_bios_boot_mode(self):\n pass", "def test_patch_bios_boot_mode(self):\n pass", "def set_boot_order(profile_obj):\n status = True\n logger._log_to_console_and_log_file(\"\")\n logger._log_to_console_and_log_file(\"### Testing the 'Boot Settings' session ###\")\n logger._...
[ "0.7011512", "0.6966963", "0.68623865", "0.65245754", "0.6446166", "0.61577415", "0.6123408", "0.608467", "0.5957088", "0.59353226", "0.5923807", "0.5921193", "0.5887735", "0.5859409", "0.58277696", "0.58038384", "0.5781227", "0.5723276", "0.57024425", "0.56310064", "0.559852...
0.6388082
5
Changes the persistent boot device order for the host
def update_persistent_boot(self, device_type=[], mac=None): # Check if the input is valid for item in device_type: if item.upper() not in DEVICE_COMMON_TO_RIS: raise exception.IloInvalidInputError("Invalid input. Valid " "devices: NETWORK, HDD," " ISCSI or CDROM.") self._update_persistent_boot(device_type, persistent=True, mac=mac)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_one_time_boot(self, device, mac=None):\n self._update_persistent_boot([device], persistent=False, mac=mac)", "def _update_persistent_boot(self, device_type=[], persistent=False,\n mac=None):\n tenure = 'Once'\n new_device = device_type[0]\n # If ...
[ "0.6520707", "0.6508391", "0.6398044", "0.623242", "0.6228627", "0.6185939", "0.6038498", "0.59571797", "0.58889556", "0.5886491", "0.5790621", "0.5788118", "0.5766241", "0.5762834", "0.57031375", "0.5653588", "0.5599488", "0.55963147", "0.5501934", "0.54900634", "0.5485925",...
0.5921619
8
Configures a single boot from a specific device.
def set_one_time_boot(self, device, mac=None): self._update_persistent_boot([device], persistent=False, mac=mac)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_device(device):\n try:\n # Gets around \"Resource busy\" errors\n device.detach_kernel_driver(0)\n except Exception:\n pass\n device.set_configuration()", "def _configure_device():\n vendor_id = 0x04D8 # These ids are microchip's libusb based device\n produc...
[ "0.715671", "0.6926375", "0.6674017", "0.65847355", "0.6503858", "0.6176356", "0.6132347", "0.6019202", "0.6009357", "0.5958234", "0.5893135", "0.58901983", "0.5786446", "0.5759376", "0.5718868", "0.569955", "0.568893", "0.56540716", "0.5607827", "0.5554028", "0.55511093", ...
0.65558326
4
Retrieves the current setting for the one time boot.
def get_one_time_boot(self): system = self._get_host_details() try: if system['Boot']['BootSourceOverrideEnabled'] == 'Once': device = system['Boot']['BootSourceOverrideTarget'] if device in DEVICE_RIS_TO_COMMON: return DEVICE_RIS_TO_COMMON[device] return device else: # value returned by RIBCL if one-time boot setting are absent return 'Normal' except KeyError as e: msg = "get_one_time_boot failed with the KeyError:%s" raise exception.IloError((msg) % e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCurrentSetting(self):\n return {}", "def get_bootvar(self):\n module = 'bootimage/oper'\n method = 'GET'\n response = self.axapi_call(module, method)\n bootdefault = response.json()['bootimage']['oper']['hd-default']\n print(self.device + ' The device is set to boot f...
[ "0.69801486", "0.68082726", "0.6772974", "0.67710704", "0.6631858", "0.6596899", "0.65748394", "0.63340545", "0.6281833", "0.6263905", "0.6256233", "0.6233154", "0.6194374", "0.614808", "0.61427236", "0.6128543", "0.61068916", "0.6082622", "0.60769004", "0.6052895", "0.604562...
0.6882444
1
Gets the firmware update service uri.
def _get_firmware_update_service_resource(self): manager, uri = self._get_ilo_details() try: fw_uri = manager['Oem']['Hp']['links']['UpdateService']['href'] except KeyError: msg = ("Firmware Update Service resource not found.") raise exception.IloCommandNotSupportedError(msg) return fw_uri
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_service_url():\n return get_config_handler().get_service_url()", "def _get_uri(plex_server):\n return plex_server.url(\n \"/:/websockets/notifications\", includeToken=True\n ).replace(\"http\", \"ws\")", "def get_http_boot_uri(self):\n try:\n sushy_system =...
[ "0.65430695", "0.64294636", "0.64230037", "0.62257314", "0.6150541", "0.60008526", "0.598782", "0.59735656", "0.593328", "0.59007615", "0.5866994", "0.58536565", "0.5798969", "0.57935137", "0.57414603", "0.5725773", "0.57218593", "0.5717393", "0.569106", "0.5676379", "0.56464...
0.80128765
0
Updates the given firmware on the server for the given component.
def update_firmware(self, file_url, component_type): fw_update_uri = self._get_firmware_update_service_resource() action_data = { 'Action': 'InstallFromURI', 'FirmwareURI': file_url, } # perform the POST LOG.debug(self._('Flashing firmware file: %s ...'), file_url) status, headers, response = self._rest_post( fw_update_uri, None, action_data) if status != 200: msg = self._get_extended_error(response) raise exception.IloError(msg) # wait till the firmware update completes. common.wait_for_ris_firmware_update_to_complete(self) try: state, percent = self.get_firmware_update_progress() except exception.IloError: msg = 'Status of firmware update not known' LOG.debug(self._(msg)) # noqa return if state == "ERROR": msg = 'Unable to update firmware' LOG.debug(self._(msg)) # noqa raise exception.IloError(msg) elif state == "UNKNOWN": msg = 'Status of firmware update not known' LOG.debug(self._(msg)) # noqa else: # "COMPLETED" | "IDLE" LOG.info(self._('Flashing firmware file: %s ... done'), file_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_firmware(self):\n self.execute_command(CMD_UPDATE_FIRMWARE)", "def update_firmware(self) -> str:", "def fusion_api_li_upgrade_firmware(self, body=None, uri=None, api=None, param='', headers=None):\n param = '/firmware'\n return self.li.update(body=body, uri=uri, api=api,...
[ "0.74276894", "0.741315", "0.714987", "0.69797605", "0.6916566", "0.6524832", "0.651543", "0.64290446", "0.6362683", "0.63187355", "0.6297764", "0.6142919", "0.6138458", "0.6109476", "0.60932076", "0.59088314", "0.58943313", "0.58743894", "0.58460486", "0.5842201", "0.5784654...
0.7226055
2
Get the progress of the firmware update.
def get_firmware_update_progress(self): try: fw_update_uri = self._get_firmware_update_service_resource() except exception.IloError as e: LOG.debug(self._('Progress of firmware update not known: %s'), str(e)) return "UNKNOWN", "UNKNOWN" # perform the GET status, headers, response = self._rest_get(fw_update_uri) if status != 200: msg = self._get_extended_error(response) raise exception.IloError(msg) fw_update_state = response.get('State') fw_update_progress_percent = response.get('ProgressPercent') LOG.debug(self._('Flashing firmware file ... in progress %d%%'), fw_update_progress_percent) return fw_update_state, fw_update_progress_percent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_firmware_update_status(self):\n\n response = self.execute_command(CMD_GET_FIRMWARE_UPDATE_STATUS)[0]\n inprogress = (response & 0x80) == 0x80\n return {\n \"inprogress\": inprogress,\n \"error\": response & 0x7f,\n }", "def GetProgress(self):\n return ...
[ "0.71777356", "0.7156413", "0.69528806", "0.69204676", "0.6803651", "0.6803651", "0.6798143", "0.67429936", "0.67102855", "0.67044973", "0.67044973", "0.67044973", "0.67044973", "0.66923326", "0.6637259", "0.6631922", "0.662532", "0.6559995", "0.65389353", "0.6411595", "0.633...
0.8577004
0
get the number of GPU devices connected.
def _get_number_of_gpu_devices_connected(self): gpu_devices = self._get_gpu_pci_devices() gpu_devices_count = len(gpu_devices) return {'pci_gpu_devices': gpu_devices_count}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_count() -> int:\n return flow._oneflow_internal.CudaGetDeviceCount()", "def num_devices(self):\n\t\t\treturn cuda.Device.count()", "def countGPUs(self):\n return libnao_gpu.CountDevices()", "def get_gpu_count():\n\n gpu_count = 0\n\n env_cuda_devices = os.environ.get('CUDA_VISIBLE_DE...
[ "0.8710016", "0.8510717", "0.8488628", "0.83665913", "0.83246", "0.79626137", "0.79313564", "0.7867789", "0.7816904", "0.76557755", "0.746821", "0.73369837", "0.71500075", "0.6916099", "0.6856592", "0.6846394", "0.68300164", "0.68286896", "0.6778741", "0.6757387", "0.66655433...
0.8072107
5
Retrieves if server is TPM capable or not.
def _get_tpm_capability(self): tpm_values = {"NotPresent": False, "PresentDisabled": True, "PresentEnabled": True} try: tpm_state = self._get_bios_setting('TpmState') except exception.IloCommandNotSupportedError: tpm_state = "NotPresent" tpm_result = tpm_values[tpm_state] return tpm_result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_available():", "def is_vtd_supported(self):\n\t\treturn bool(call_sdk_function('PrlSrvCfg_IsVtdSupported', self.handle))", "def evaluate_hardware_support(self):\n return hardware.HardwareSupport.SERVICE_PROVIDER", "def is_available(self) -> bool:\n return (\n len(self._gpu_ids...
[ "0.63089687", "0.6192992", "0.6138347", "0.5952284", "0.59215266", "0.58764535", "0.58491164", "0.58059984", "0.5796468", "0.5784329", "0.57265705", "0.56829214", "0.5666347", "0.56659436", "0.56633973", "0.5661813", "0.56546235", "0.56484747", "0.5633898", "0.55766743", "0.5...
0.7238231
0
get cpu virtualization status.
def _get_cpu_virtualization(self): try: cpu_vt = self._get_bios_setting('ProcVirtualization') except exception.IloCommandNotSupportedError: return False if cpu_vt == 'Enabled': vt_status = True else: vt_status = False return vt_status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self):\n if self.qemu.is_running():\n status = 0\n self.log.info(\"vm-status\", result=\"online\")\n for device in list(self.qemu.block_info().values()):\n self.log.info(\n \"disk-throttle\",\n device=device[\"d...
[ "0.7207931", "0.71718997", "0.70512587", "0.7005931", "0.696061", "0.67730594", "0.66261756", "0.66120964", "0.6603125", "0.65707415", "0.655431", "0.655431", "0.65318954", "0.6502956", "0.6492939", "0.647564", "0.64564735", "0.630386", "0.62673694", "0.62613034", "0.6251442"...
0.8119382
0
Get status of NVDIMM_N.
def _get_nvdimm_n_status(self): try: nvdimm_n_status = self._get_bios_setting('NvDimmNMemFunctionality') if nvdimm_n_status == 'Enabled': nvn_status = True else: nvn_status = False except exception.IloCommandNotSupportedError: nvn_status = False return nvn_status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getnumbarvar(self):\n numbarvar_ = ctypes.c_int32()\n res = __library__.MSK_XX_getnumbarvar(self.__nativep,ctypes.byref(numbarvar_))\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n numbarvar_ = numbarvar_.value\n _numbarvar_return_value = numbarvar_\...
[ "0.5753764", "0.57007307", "0.5678485", "0.56483656", "0.5635664", "0.5618904", "0.559551", "0.5575454", "0.5551961", "0.5545708", "0.5526919", "0.55176646", "0.54776466", "0.54100347", "0.54067737", "0.5321118", "0.5198335", "0.51954293", "0.51463753", "0.512988", "0.5129837...
0.81031567
0
Return a new and configurated argument parser
def build_argument_parser(): description="A simple tool to batch rename given files." parser = ArgumentParser(description=description) parser.add_argument("-i", "--input-list", required=False, help="the path to the input list file.") parser.add_argument("-p", "--glob-pattern", default=DEFAULT_GLOB_PATTERN, help="a glob pattern to filter input files.") return parser
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parser():\n parser = ArgumentParser(\n description=__doc__, formatter_class=ArgumentDefaultsHelpFormatter\n )\n parser.add_argument(\n \"-s\", \"--sentence\", dest=\"sentence\", help=\"sentence, splitted by ';'\"\n )\n return parser", "def get_parser(self):\n parser = ...
[ "0.7564569", "0.74022853", "0.73748535", "0.7330005", "0.73285943", "0.73109233", "0.7296097", "0.72469074", "0.7230259", "0.7213541", "0.7185622", "0.7110324", "0.7101994", "0.70998615", "0.7094069", "0.70916784", "0.70916784", "0.70733887", "0.70644695", "0.7051284", "0.705...
0.6929574
36
Determina numere divizibile cu k dintro lista
def get_longest_div_k(lst, k): rezultat = [] for x in lst: if x % k == 0: rezultat.append(x) return rezultat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDivisors(n):", "def divisor(k, num):\n\n if k < 0:\n raise Exception('k must be >= 0: {}'.format(k))\n\n factors = prime_factorization(num)\n result = 1\n if k == 0:\n for prime in factors:\n result *= prime + 1\n\n for prime in factors:\n result *= ((pow(pri...
[ "0.68305314", "0.66830385", "0.64528286", "0.6440956", "0.64300156", "0.6414138", "0.640048", "0.63713896", "0.6357683", "0.63318574", "0.63268465", "0.6303533", "0.62746555", "0.6266593", "0.62309676", "0.62309676", "0.61922175", "0.61922175", "0.61577624", "0.61330014", "0....
0.70152783
0
Determina daca cifrele unui numar se afala in ordine decrecatoare
def is_desc(x): while x > 9: if x % 10 > x // 10 % 10: return False x = x // 10 return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumber():", "def num(self):\n return self.num", "def get_oglindit(numar):\n if numar < 0:\n return numar\n numar_str = str(numar)\n numar_str = numar_str[::-1]\n return int(numar_str)", "def number(self):", "def nze(self) -> int:", "def nze(self) -> int:", "def valor_ab...
[ "0.73404014", "0.6625964", "0.65091646", "0.64411956", "0.6403674", "0.6403674", "0.6398264", "0.6342135", "0.6268537", "0.6255234", "0.618184", "0.61722934", "0.6116968", "0.611175", "0.6076584", "0.6033818", "0.60264623", "0.6019782", "0.6014425", "0.5991572", "0.5981616", ...
0.0
-1
Deterina numerele care au cifrele in ordine descrescatoare
def get_longest_digit_count_desc(lst): rezultat = [] for i in lst: if is_desc(i): rezultat.append(i) return rezultat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumber():", "def nze(self) -> int:", "def nze(self) -> int:", "def degre(self):\n\t\tif self.__tete:\n\t\t\treturn len(self.__tete.plus_petit().get_indeterminee())\n\t\telse:\n\t\t\t\"\"\" concession a la definition mathematique du degre du polynome nul \"\"\"\n\t\t\treturn (-1)", "def number(self):...
[ "0.6986856", "0.668469", "0.668469", "0.6638649", "0.66317236", "0.6619781", "0.643815", "0.6296097", "0.62792224", "0.624606", "0.6207371", "0.61288446", "0.61034036", "0.6069976", "0.60504335", "0.6050144", "0.6050144", "0.6035699", "0.5996552", "0.59795433", "0.59493756", ...
0.0
-1
Determina daca un numar este prim
def is_prime(x): if x < 2: return False for i in range(2, x // 2 + 1): if x % i == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disc(P):\n ans = P.resultant(P.prime()) / P[-1]\n if P.isinteger():\n ans = int(ans.round())\n if P.deg % 4 in [0, 1]:\n return ans\n else:\n return -ans", "def check_prize(correct_num):", "def getNumber():", "def getPrime(bits):\n\twhile(True)...
[ "0.65439105", "0.6336349", "0.6313672", "0.60297626", "0.5971417", "0.59622616", "0.59525704", "0.59505856", "0.5943629", "0.5943024", "0.5938789", "0.58874506", "0.58661157", "0.58579594", "0.58364916", "0.58217156", "0.5816223", "0.5807556", "0.5789509", "0.57876563", "0.57...
0.0
-1
Determina numerele care nu sunt prime
def get_longest_all_not_prime(lst): rezultat = [] for i in lst: if not is_prime(i): rezultat.append(i) return rezultat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comprobar_primo(num):\n primo = True\n for i in range(2, num):\n if num%i == 0:\n primo = False\n return primo", "def euler10(num):\n total = 0\n curr_number = 2\n while curr_number < num:\n if projecteuler.is_prime(curr_number):\n total += curr_number\n ...
[ "0.72874737", "0.71890366", "0.70929486", "0.7015428", "0.69767654", "0.6868733", "0.68496084", "0.68421936", "0.6825397", "0.6800427", "0.6788024", "0.6787027", "0.6786647", "0.6762163", "0.6752517", "0.6752517", "0.6743149", "0.67369336", "0.6724455", "0.67098033", "0.66942...
0.0
-1
Send a message when the command /start is issued.
def start(update: Update, context: CallbackContext) -> None: output = "Test" update.message.reply_text(output)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(msg: telebot.types.Message):\n logger.info(f'New /start command from id: {msg.from_user.id}.')\n\n bot.send_message(\n msg.from_user.id,\n 'Hello, welcome to TicTacDrop!',\n reply_markup=buttons.get_play_markup()\n )\n\n utils.save_user(msg.from_user)", "def start(bot, ...
[ "0.7444013", "0.7397156", "0.72363275", "0.7153408", "0.7149207", "0.7125708", "0.7041666", "0.6861407", "0.6861407", "0.6861407", "0.6861407", "0.6860805", "0.6807865", "0.6803813", "0.6761418", "0.67429066", "0.67300147", "0.6695136", "0.66893226", "0.6686253", "0.665731", ...
0.62268615
65
ReminderBot, sends you a message to remind you of stuff.
def help_command(update: Update, context: CallbackContext) -> None: update.message.reply_text('Help!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_reminder():\n\n name = config[\"email\"][\"name\"]\n user = config[\"email\"][\"user\"]\n subject = \"REMINDER: %s\" % sys.argv[1]\n body = sys.argv[2] if len(sys.argv) > 2 else \"\"\n email_helper.send(user, name, user, subject, body)", "async def remind(id, reminder):\n \n guild =...
[ "0.8080209", "0.7884799", "0.77642393", "0.7438207", "0.7399876", "0.72116685", "0.71892047", "0.71756524", "0.716907", "0.71174127", "0.69518006", "0.68498677", "0.6783447", "0.67111504", "0.66775066", "0.6611192", "0.6484514", "0.64267516", "0.6417511", "0.63394415", "0.629...
0.0
-1
Linac phasing Note that these overlays override individual klystron phases.
def bmad_linac_phasing_lines(epics): lines = [ '! Linac overall phasing', 'O_L1[phase_deg] = 0 ! K21_1 sets this directly. This is a delta on top of that.', 'O_L2[phase_deg] = '+str(epics.caget('SIOC:SYS0:ML00:CALC204')), 'O_L3[phase_deg] = '+str(epics.caget('SIOC:SYS0:ML00:AO499')) ] return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_display_from_lines(self):\n y = 1\n maxlin = CA_World.ca_display_size - 1\n limy = len(self.ca_lines) + maxlin\n for i in self.ca_lines:\n x = 1\n if limy >= maxlin:\n if SimEngine.gui_get('init') == \"Right\": # Right\n l...
[ "0.59270585", "0.58033264", "0.5608836", "0.55544627", "0.5367089", "0.53572994", "0.53372705", "0.5273966", "0.52700067", "0.5266239", "0.52600336", "0.5244795", "0.51854324", "0.5150837", "0.5133585", "0.51236475", "0.51020104", "0.50978017", "0.5095993", "0.5059783", "0.50...
0.6246182
0
Writes linac phasing lines to a Bmad file. Requires epics (or proxy object).
def write_bmad_linac_phasing_lines(filePath='linac_settings.bmad', epics=None, verbose=False): lines = bmad_linac_phasing_lines(epics) with open(filePath, 'w') as f: for l in lines: f.write(l+'\n') if verbose: print('Written:', filePath)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_tao_BC_and_LEM_lines(filePath='LEM_settings.tao', epics=None, verbose=False):\n lines = tao_BC_and_LEM_lines(epics)\n with open(filePath, 'w') as f:\n for l in lines:\n f.write(l+'\\n')\n if verbose:\n print('Written:', filePath)\n\n \n \n return lines",...
[ "0.6657263", "0.6484899", "0.5828503", "0.5651945", "0.5593861", "0.5564902", "0.54197687", "0.5337634", "0.5288988", "0.5269306", "0.52646947", "0.52209884", "0.5204748", "0.51610637", "0.5106298", "0.5046272", "0.5036513", "0.5005771", "0.49783012", "0.49764898", "0.4970320...
0.7545118
0
Linac energy set points and bunch compressor offsets
def tao_BC_and_LEM_lines(epics): bc1_e0=epics.caget('SIOC:SYS0:ML00:AO483')*1e6 bc2_e0=epics.caget('SIOC:SYS0:ML00:AO489')*1e9 l3_e0 =epics.caget('SIOC:SYS0:ML00:AO500')*1e9 # Charge in LTU q_after_horn_cutting = epics.caget('SIOC:SYS0:ML00:CALC252')*1e-12 # pC -> C bc1_offset=epics.caget('BMLN:LI21:235:MOTR')*1e-3 bc2_offset=epics.caget('BMLN:LI24:805:MOTR')*1e-3 bc1_current=epics.caget('SIOC:SYS0:ML00:AO485') bc2_current=epics.caget('SIOC:SYS0:ML00:AO195') # Catch bad settings if bc1_current==0: print('Warning: BC1 current is zero!') bc1_sigma_z = 0 else: # Assumes parabolic distribution bc1_sigma_z = q_after_horn_cutting*299792458 / sqrt(10) / bc1_current if bc2_current==0: print('Warning: BC1 current is zero!') bc2_sigma_z = 0 else: # Assumes Gaussian distribution bc2_sigma_z = q_after_horn_cutting*299792458 / sqrt(12) / bc2_current lines = [] lines.append('set dat BC1.energy[1]|meas = '+str(bc1_e0)) lines.append('set dat BC2.energy[1]|meas = '+str(bc2_e0)) lines.append('set dat L3.energy[2]|meas = '+str(l3_e0)) lines.append('set dat BC1.offset[1]|meas = '+str(bc1_offset)) lines.append('set dat BC2.offset[1]|meas = '+str(bc2_offset)) lines.append(f'! Charge after horn cutting: {q_after_horn_cutting*1e12:10.4} pC') lines.append(f'! For BC1 current {bc1_current} A') lines.append('set dat BC1.beam[1]|meas = '+str( bc1_sigma_z)) lines.append(f'! For BC2 current {bc2_current} A') lines.append('set dat BC2.beam[1]|meas = '+str( bc2_sigma_z)) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_caliblamp_offset(spec1, spec2, colname1='flux', colname2='flux',\n aperture_k=None, pixel_k=None, pixel_range=(-30, 30),\n max_order_offset=20,\n mode='normal'):\n\n if isinstance(pixel_range, int) or isinstance(pixel_range, float):\n if pixel_range <=0:\n print('...
[ "0.57638854", "0.5657205", "0.56363416", "0.56297696", "0.55647045", "0.54962194", "0.5491665", "0.5449147", "0.5436916", "0.543175", "0.541064", "0.5409078", "0.54073215", "0.5384243", "0.5368848", "0.5359744", "0.5338027", "0.53308344", "0.53248966", "0.53210336", "0.531786...
0.5448095
8
Writes tao LEM lines to a .tao file. Requires epics (or proxy object).
def write_tao_BC_and_LEM_lines(filePath='LEM_settings.tao', epics=None, verbose=False): lines = tao_BC_and_LEM_lines(epics) with open(filePath, 'w') as f: for l in lines: f.write(l+'\n') if verbose: print('Written:', filePath) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_tep_file_lines(otu_table_data, mapping_lines, tree_lines,\r\n prefs_dict):\r\n\r\n # write tree file lines\r\n lines = ['>>tre\\n']\r\n lines += [tree_lines.read()]\r\n lines += '\\n'\r\n\r\n # get otu table data\r\n if(otu_table_data.ObservationMetadata):\r\n ...
[ "0.5752286", "0.5749262", "0.5700694", "0.5613532", "0.5605334", "0.556102", "0.54216707", "0.5421532", "0.5405027", "0.53978723", "0.53960645", "0.53954494", "0.5390986", "0.5312852", "0.5277949", "0.5253673", "0.5245013", "0.5244172", "0.52176124", "0.5176581", "0.5172888",...
0.7485731
0
Create Bmadstyle settings from a CSV mapping file, and an epics interface.
def bmad_from_csv(csvfile, epics, outfile=None): df = pandas.read_csv(csvfile) pvlist = list(df['device_name'] +':'+ df['attribute'].str.strip()) # Get values df['value'] = epics.caget_many(pvlist) # Form lines lines = df['bmad_ele_name']+'[' + df['bmad_attribute'] + '] = '+ (df['bmad_factor'].astype(str)+'*'+df['value'].astype(str)) if outfile: with open(outfile, 'w') as f: for line in lines: f.write(line+'\n') print('Written:', outfile) return list(lines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_mappings_from_file(filename, organization, user, import_file_id=None):\n\n mappings = []\n if os.path.isfile(filename):\n with open(filename, 'rU') as csvfile:\n for row in csv.reader(csvfile):\n data = {\n \"from_field\":...
[ "0.60839015", "0.5907737", "0.55338466", "0.548672", "0.53889763", "0.53884614", "0.5330307", "0.53111887", "0.5284984", "0.52468073", "0.52041686", "0.5191584", "0.5108381", "0.50697786", "0.5067091", "0.5060284", "0.50485945", "0.50454515", "0.5044164", "0.50334924", "0.501...
0.50761986
13
Function for rendering HTML code of this element
def html(self): bop = ('<b>' if self._bold else '') iop = ('<i>' if self._italic else '') icl = ('</i>' if self._italic else '') bcl = ('</b>' if self._bold else '') txt = escape(self._text) s = '%s%s%s%s%s' % (bop, iop, txt, icl, bcl) return '%s' % s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __html__(self):\n return str(self)", "def rawHTMLrendered(self):", "def _repr_html_(self):\n return self.__repr__()", "def _repr_html_(self):\n return self.__repr__()", "def __html__(self):\n return self.html", "def html(self) -> str:\n if self._inner_element:\n ...
[ "0.76847166", "0.7620541", "0.7579551", "0.7579551", "0.7545735", "0.7409317", "0.7385336", "0.7385336", "0.7304668", "0.7304668", "0.72542566", "0.7233775", "0.7104469", "0.7065664", "0.70531815", "0.7014759", "0.69775945", "0.6977155", "0.69219375", "0.6887626", "0.6865015"...
0.7432328
5
Function for rendering HTML code of this element
def html(self): dis = ('disabled' if not self._enabled else '') met = ('post' if self._html_post else 'get') act = escape(self._action) txt = escape(self._text) return '<button %s formaction="%s" formmethod="%s">%s</button>' % (dis, act, met, txt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __html__(self):\n return str(self)", "def rawHTMLrendered(self):", "def _repr_html_(self):\n return self.__repr__()", "def _repr_html_(self):\n return self.__repr__()", "def __html__(self):\n return self.html", "def html(self):\n bop = ('<b>' if self._bold else '')\n ...
[ "0.76847166", "0.7620541", "0.7579551", "0.7579551", "0.7545735", "0.7432328", "0.7409317", "0.7385336", "0.7385336", "0.7304668", "0.7304668", "0.72542566", "0.7233775", "0.7104469", "0.7065664", "0.70531815", "0.7014759", "0.69775945", "0.6977155", "0.69219375", "0.6887626"...
0.61986023
86
Function for rendering HTML code of this element
def html(self): lbl = escape(self._label) dis = ('disabled' if not self._enabled else '') typ = ('password' if self._password else 'text') nam = escape(self._name) val = escape(self._value) return '%s <input name="%s" %s type="%s" value="%s" size="%i">' % (lbl, nam, dis, typ, val, self._size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __html__(self):\n return str(self)", "def rawHTMLrendered(self):", "def _repr_html_(self):\n return self.__repr__()", "def _repr_html_(self):\n return self.__repr__()", "def __html__(self):\n return self.html", "def html(self):\n bop = ('<b>' if self._bold else '')\n ...
[ "0.76847166", "0.7620541", "0.7579551", "0.7579551", "0.7545735", "0.7432328", "0.7409317", "0.7385336", "0.7385336", "0.7304668", "0.7304668", "0.72542566", "0.7233775", "0.7104469", "0.7065664", "0.70531815", "0.7014759", "0.69775945", "0.6977155", "0.69219375", "0.6887626"...
0.0
-1
Method to get the credentials from ~/.mofplusrc
def credentials_from_rc(self): mprc_filename = os.environ["HOME"]+'/.mofplusrc' with open(mprc_filename, 'r') as mprc: username = mprc.readline().split()[0] pw = mprc.readline().split()[0] return username, pw
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_credentials():\n #home_dir = os.path.expanduser('~')\n home_dir = os.path.expanduser('/home/pi/')\n credential_dir = os.path.join(home_dir, '.credentials')\n if not os.path.exists(credential_dir):\n os.makedirs(credential_dir)\n credential_path = os.path.join(credential_dir, 'gmail-py...
[ "0.739547", "0.7365536", "0.73126113", "0.73126113", "0.7311609", "0.7309989", "0.7300369", "0.7288538", "0.72769576", "0.72184205", "0.71966267", "0.71909285", "0.71909285", "0.71909285", "0.71909285", "0.71909285", "0.7185963", "0.71790165", "0.71647274", "0.71396244", "0.7...
0.857187
0
Method to get the credentials from the command line
def credentials_from_cmd(self): username = raw_input("Email:") pw = getpass.getpass() return username, pw
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _config_credentials_get():\n user = input(\"username:\")\n password = getpass.getpass()\n url = input(\"url:\")\n return user, password, url", "def get_credentials(options, environment):\n if options[\"--username\"] or options[\"--auth\"]:\n if not options[\"--username\"]:\n ...
[ "0.7299473", "0.7106037", "0.6985046", "0.6973925", "0.6960516", "0.6940761", "0.6813968", "0.67990017", "0.6796827", "0.6795659", "0.6782839", "0.67600983", "0.6745715", "0.6667258", "0.6666305", "0.66566455", "0.662464", "0.66160524", "0.65844256", "0.6557866", "0.65372974"...
0.74783903
0
Method to check if the connection to MFP is alive
def check_connection(self): try: self.mfp.add(2,2) logger.info("Connection to user API established") except xmlrpclib.ProtocolError: logger.error("Not possible to connect to MOF+. Check your credentials") exit() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_alive():\n\n ## ---------------------------------------------------------------\n \n cmd = dict()\n cmd[\"type_\"] = \"is_alive\"\n cmd[\"name_\"] = \"\"\n\n s = socket.socket(\n socket.AF_INET,\n socket.SOCK_STREAM\n )\n try:\n s.connect((getml.host, getml.port)...
[ "0.7821559", "0.7482397", "0.74798656", "0.7405552", "0.7365014", "0.73151857", "0.7309089", "0.72766185", "0.7247258", "0.7214135", "0.7205073", "0.71816295", "0.7174634", "0.71540594", "0.7139404", "0.7105354", "0.71004045", "0.7088418", "0.707445", "0.7042662", "0.7011688"...
0.69009495
31
Prints the MFP banner
def print_banner(self): print ":##::::'##::'#######::'########:::::::::::::::'###::::'########::'####:\n\ :###::'###:'##.... ##: ##.....::::'##::::::::'## ##::: ##.... ##:. ##::\n\ :####'####: ##:::: ##: ##::::::::: ##:::::::'##:. ##:: ##:::: ##:: ##::\n\ :## ### ##: ##:::: ##: ######:::'######::::'##:::. ##: ########::: ##::\n\ :##. #: ##: ##:::: ##: ##...::::.. ##.::::: #########: ##.....:::: ##::\n\ :##:.:: ##: ##:::: ##: ##::::::::: ##:::::: ##.... ##: ##::::::::: ##::\n\ :##:::: ##:. #######:: ##:::::::::..::::::: ##:::: ##: ##::::::::'####:\n\ :..:::::..:::.......:::..:::::::::::::::::::..:::::..::..:::::::::....:"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_banner(message):\n\n print(\"#############################################################################\")\n print(message)", "def banner():\n print \"\"\" \n _____ __ \n |_ _|_ _ ___ / _| __ _ \n | |/ _` / __| |_ / _` |\n | | (_| \\__ \\ _| (_| |\n |...
[ "0.7396634", "0.73954254", "0.727118", "0.72663784", "0.7056715", "0.7042273", "0.70386666", "0.700003", "0.675228", "0.6678629", "0.651769", "0.6499614", "0.6490508", "0.6374026", "0.63351125", "0.62801325", "0.62523764", "0.623986", "0.61925286", "0.61004984", "0.59268594",...
0.76449466
0
Downloads a topology in mfpx file format
def get_net(self,netname, mol = False): lines = self.mfp.get_net(netname) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_topology(topology, filename='topology.gml'):\n\n nx.write_gml(topology, filename)", "def x_download():\n\t#_loadconfig()\n\tconf = _get_config()\n\t#print conf['xplane']\n\tdownload_url = conf['xplane']['download']\n\tlocal(\"wget -P %s %s\" % (navimport.conf.work_dir(\"/xplane_zips\"), download_ur...
[ "0.5974667", "0.59448946", "0.5932634", "0.57080597", "0.54658467", "0.5453924", "0.5384024", "0.5363021", "0.5340173", "0.52313894", "0.5222386", "0.51715934", "0.51461154", "0.51413363", "0.5095243", "0.50925016", "0.5082509", "0.5045129", "0.5041606", "0.50309974", "0.5018...
0.0
-1
Returns a list of all topologies in the db
def get_list_of_nets(self): return self.mfp.get_list_of_nets()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topologies(self):\n return self._topologies", "def select_all_topologies(conn):\n cur = conn.cursor()\n cur.execute(\"SELECT * FROM topologies_topology\")\n \n rows = cur.fetchall()\n \n for row in rows:\n print(row)", "def __get_topologies(self):\n return etree.tostring(se...
[ "0.78852785", "0.7385446", "0.7182751", "0.6945609", "0.6391738", "0.63558525", "0.61613566", "0.59129083", "0.5876373", "0.58721805", "0.58037055", "0.5768942", "0.57195634", "0.5661269", "0.56598175", "0.5634624", "0.56306636", "0.56049365", "0.558728", "0.5556961", "0.5554...
0.0
-1
Returns a list of all BBS in the db
def get_list_of_bbs(self): return self.mfp.get_list_of_bbs()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_bt(self):\n return list(self.collection.find({\"sensor_type\": \"bt\"}, {\"_id\": False})) # Return a list", "def get_blists(self):\n return self.blists[:]", "def get_bus_list():\n\n\tbuses = db.session.query(Bus.bus_name).all()\n\n \n\treturn buses", "def list(cls, context, filt...
[ "0.69727236", "0.67828137", "0.6740348", "0.65534073", "0.6521765", "0.63936526", "0.6312505", "0.6268653", "0.62648267", "0.62623644", "0.6186435", "0.61633617", "0.61626595", "0.6158413", "0.6122159", "0.611637", "0.610624", "0.5955863", "0.5916003", "0.58861715", "0.588525...
0.70204824
0
Downloads a bb in mfpx file format
def get_bb(self,bbname, mol = False): lines = self.mfp.get_bb(bbname) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMpcorb(url='https://minorplanetcenter.net/iau/MPCORB/MPCORB.DAT.gz', fname='MPCORB.DAT.gz', verbose=True):\n\n #filename = wget.download(url)\n try:\n r = requests.get(url, allow_redirects=True)\n open(fname, 'wb').write(r.content)\n if (verbose):\n print('Download comp...
[ "0.5965063", "0.5833095", "0.575973", "0.5746206", "0.5630841", "0.55773723", "0.5568776", "0.5568582", "0.5568582", "0.5539128", "0.55324054", "0.55256397", "0.55006206", "0.5487703", "0.54368585", "0.5432206", "0.5420917", "0.53768295", "0.5314198", "0.5299799", "0.5299799"...
0.53111416
19
Downloads a MOF structure in mfpx file format
def get_mof_structure_by_id(self,strucid, mol = False): lines,name = self.mfp.get_mof_structure_by_id(strucid) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_model():\n logging.info(\"[genreml] Downloading model...\")\n with urllib.request.urlopen(config.FMAModelConfig.FMA_MODEL_URL) as f:\n data = f.read()\n open(config.FMAModelConfig.FMA_MODEL_PATH, 'wb').write(data)\n logging.info(\"[genreml] Model download complete\")", "def ge...
[ "0.5991313", "0.59626365", "0.55595934", "0.5496151", "0.54330605", "0.53938437", "0.53894514", "0.5371297", "0.536752", "0.5346592", "0.53392506", "0.52200156", "0.5186871", "0.51702356", "0.5167433", "0.5166752", "0.51650244", "0.51601297", "0.5158457", "0.51551956", "0.514...
0.0
-1
Returns the coordinations sequences of a topology as a list of lists.
def get_cs(self,name): return self.mfp.get_cs(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connected_components(self) -> List[list]:\n self.__set_all_nodes_unvisited()\n res = self.__tarjan()\n # res.reverse()\n return res", "def connected_components(self):\n if self._connected:\n return [self]\n G = Graph()\n G.add_vertices(list(range(se...
[ "0.6540596", "0.63142204", "0.6299031", "0.62282807", "0.61203295", "0.60599744", "0.58927417", "0.58664745", "0.58310354", "0.5793973", "0.5747925", "0.5732554", "0.57276785", "0.56795806", "0.5675118", "0.5665343", "0.565245", "0.5644378", "0.5638672", "0.5636335", "0.56352...
0.0
-1
Returns the vertex symbol of a topology as a list of strings
def get_vs(self,name): return self.mfp.get_vs(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vertices(self):\n return str(self.vert_dict.keys())", "def graph(g):\n return str(g.adjacencyList())", "def list_vertices(self):\n return list(self.graph_dict.keys())", "def __str__(self):\n vList = []\n for vertex in self:\n vList.append(vertex.name)\n ...
[ "0.6693307", "0.64824003", "0.6428527", "0.6385017", "0.61859804", "0.6184684", "0.6171001", "0.61704546", "0.6142896", "0.6142896", "0.6142896", "0.60300994", "0.60281855", "0.6027096", "0.59981346", "0.5959071", "0.5957562", "0.5946406", "0.5943226", "0.5909223", "0.59061",...
0.0
-1
Searches nets with a given coordination sequences and given vertex symbols and returns the corresponding netnames as a list of strings.
def search_cs(self, cs, vs, cfilter = True): assert type(cs) == list assert type(vs) == list nets = self.mfp.search_cs(cs, vs) rl = [] if cfilter: for i,n in enumerate(nets): if n.find('-c') != -1: rl.append(n) for i in rl: nets.remove(i) return nets
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_names(self, net):\n net_name = self.known_name[id(net)]\n\n base_lists = ['ensembles', 'nodes', 'connections', 'networks', 'probes']\n\n for k in dir(net):\n # If it's not a private attribute, a built in function \n # and not a Nengo object\n if not k....
[ "0.5345469", "0.49848792", "0.4949889", "0.49467316", "0.4918402", "0.4912904", "0.49020374", "0.48935178", "0.48827243", "0.48259458", "0.47976613", "0.47864097", "0.47622603", "0.47563088", "0.4737711", "0.4736165", "0.46989784", "0.46940482", "0.46887234", "0.4671127", "0....
0.44458896
61
Gets the scaled topo file for a given id supercell id.
def get_scaledtopo(self,id): lines = self.mfp.get_scaledtopo(id) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_to_base_id(self, id):\n if self.xy_tiling is None and self.pc_tiling is None:\n return id\n return self.get_tile_from_path(id)[1]", "def _get_feat_geo_from_file(self, id):\n path_feature, path_mask, path_geo = self._get_name_save(id)\n feature_filt_padded = torch.loa...
[ "0.5464149", "0.50709033", "0.50375205", "0.5031053", "0.48634726", "0.48348683", "0.4817579", "0.4804395", "0.47939923", "0.47609693", "0.46538952", "0.4650901", "0.46247876", "0.46213096", "0.45644408", "0.45580676", "0.4558013", "0.4542269", "0.45237747", "0.45166185", "0....
0.7465723
0
Gets the orients file for a given id supercell id.
def get_orients(self,id): lines = self.mfp.get_orients(id) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_orientations(self):\n for atom in self.invarioms:\n atom.get_orientation()", "def orient(self):\n self._read(False)\n return self._readings.orient", "def get_orientations(self, int32 dim, codim=None):\n if codim is not None:\n dim = self.tdim - codim\n...
[ "0.5392666", "0.5238473", "0.50075924", "0.47091204", "0.46686122", "0.46168557", "0.4579395", "0.45001397", "0.44533232", "0.44359028", "0.44122255", "0.44016522", "0.439454", "0.4392099", "0.43870813", "0.43759003", "0.4370313", "0.43686095", "0.43557945", "0.43431535", "0....
0.65023
0
Attach a text label above each bar in rects, displaying its height.
def autolabel(rects): for rect in rects: height = rect.get_height() ax.annotate('{}'.format(height), xy=(rect.get_x() + rect.get_width() / 2, height), xytext=(0, 3), # 3 points vertical offset textcoords="offset points", ha='center', va='bottom')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autolabel(rects, ax):\n global BAR_NUMBER_SIZE\n for rect in rects:\n height = rect.get_height()\n ax.text(rect.get_x() + rect.get_width()/2.,\n height,\n str(round(height, 1)),\n ha ='center',\n va ='bottom',\n size...
[ "0.807113", "0.79336554", "0.7861467", "0.7835557", "0.7822906", "0.77769476", "0.7776375", "0.7745001", "0.7730597", "0.7730573", "0.7708679", "0.77040344", "0.7690377", "0.7677892", "0.76754576", "0.76730984", "0.76562864", "0.7648832", "0.7645011", "0.7640306", "0.76307166...
0.7365519
43
A greenlet for handling a single client.
def _process_socket(self, client): itrans = self.inputTransportFactory.getTransport(client) otrans = self.outputTransportFactory.getTransport(client) iprot = self.inputProtocolFactory.getProtocol(itrans) oprot = self.outputProtocolFactory.getProtocol(otrans) try: while True: self.processor.process(iprot, oprot) except TTransport.TTransportException: pass except: log.error(traceback.format_exc()) itrans.close() otrans.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client():", "def handle_client(self):\n e = threading.Event()\n reg_t = threading.Thread(target=self.handle_reg_client, args=(e,))\n stream_t = threading.Thread(target=self.handle_stream_client,\n args=(e,))\n reg_t.start()\n stream_t.star...
[ "0.6872704", "0.66223794", "0.6563431", "0.6314243", "0.6278947", "0.6241105", "0.6189508", "0.61751866", "0.6150069", "0.6113049", "0.61002946", "0.607193", "0.60383105", "0.6022606", "0.5996656", "0.59760684", "0.5955252", "0.5949449", "0.59433", "0.5927668", "0.591821", ...
0.0
-1
A greenlet for handling a single client.
def _process_socket(self, client, address): log.info('func=open|client=%s:%d|pool_size=%d', address[0], address[1], len(self.pool)) client = SocketTransport(client) itrans = self.inputTransportFactory.getTransport(client) otrans = self.outputTransportFactory.getTransport(client) iprot = self.inputProtocolFactory.getProtocol(itrans) oprot = self.outputProtocolFactory.getProtocol(otrans) try: while True: self.processor.process(iprot, oprot) except TTransport.TTransportException: pass except EOFError: pass except: log.error(traceback.format_exc()) itrans.close() otrans.close() log.info('func=close|client=%s:%d', address[0], address[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client():", "def handle_client(self):\n e = threading.Event()\n reg_t = threading.Thread(target=self.handle_reg_client, args=(e,))\n stream_t = threading.Thread(target=self.handle_stream_client,\n args=(e,))\n reg_t.start()\n stream_t.star...
[ "0.6872704", "0.66223794", "0.6563431", "0.6314243", "0.6278947", "0.6241105", "0.6189508", "0.61751866", "0.6150069", "0.6113049", "0.61002946", "0.607193", "0.60383105", "0.6022606", "0.5996656", "0.59760684", "0.5955252", "0.5949449", "0.59433", "0.5927668", "0.591821", ...
0.0
-1
Retrieve the list of films in which a character appears
def getFilms(character): ret = [] for film in character.get('films'): number = int(film.rstrip('/').rpartition('/')[2]) if number not in cache: response = requests.get(film) response = response.json() title = response.get('title') cache[number] = title ret.append(cache.get(number)) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def castFilmography (movies, minAppearances):\n actors = {}\n for (k,v) in movies.items():\n for a in v[2:7]:\n actors[a] = actors.get(a, []) + [k]\n return sorted([ [k] + v for (k,v) in actors.items() if len(v) >= minAppearances ])", "def get_cards(self):\n return [Flashcard.fr...
[ "0.59737927", "0.55234385", "0.545212", "0.54288036", "0.5389295", "0.5367945", "0.5315806", "0.53116363", "0.53098303", "0.52998656", "0.52903426", "0.5223463", "0.521527", "0.5212591", "0.5199618", "0.5162614", "0.5160674", "0.51528895", "0.5130299", "0.5123009", "0.5109176...
0.6638027
0
set requires_grad to 'true' for all paramters, but save original values to resotre them later
def _get_gradients(self, batch): embedding_gradients = [] original_param_name_to_requires_grad_dict = {} for param_name, param in self.model.named_parameters(): original_param_name_to_requires_grad_dict[param_name] = param.requires_grad param.requires_grad = True hooks = self._register_embedding_gradient_hooks(embedding_gradients) loss = self.forward_step(batch) self.model.zero_grad() loss.backward() for hook in hooks: hook.remove() # restore the original requires_grad values of the parameters for param_name, param in self.model.named_parameters(): param.requires_grad = original_param_name_to_requires_grad_dict[param_name] return embedding_gradients[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_requires_grad(self, requires_grad):\n for parameter in self.parameters():\n parameter.requires_grad = requires_grad", "def set_requires_grad(self, requires_grad):\n for parameter in self.parameters():\n parameter.requires_grad = requires_grad", "def freeze_params(m):...
[ "0.76790285", "0.76790285", "0.75791013", "0.75430167", "0.74836636", "0.7409139", "0.7380558", "0.73643893", "0.72944826", "0.72131354", "0.719416", "0.71648544", "0.71418315", "0.71305335", "0.70704716", "0.7017141", "0.69882965", "0.69882965", "0.69626516", "0.6960601", "0...
0.0
-1