query
stringlengths
9
9.05k
document
stringlengths
10
222k
negatives
listlengths
19
20
metadata
dict
Try to resolve a path as a level within a hierarchical ref.
def resolve_ref_hierarchy(self, path): project, ref, refPrefix = self.resolve_partial_ref_prefix(path) if not ref: return None refTime = iso8601.parse_date(ref.commit['committed_date']).timestamp() return Entity( EntityType.REF_LEVEL, path, ...
[ "def pathlookup(obj_or_path_tuple, depth=None, include_origin=True):", "def resolve_level(target_level, cwd=None):\n if cwd is None:\n cwd = os.getcwd()\n this_level = level(cwd)\n this_idx = levels.index(this_level)\n target_idx = levels.index(target_level)\n pl = [\".\"]\n for i in rang...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List the first level of refs of a project. If the project contains hierarchical refs then only the first level of those is returned. For example, a repository containing the branches "master", "feature/abc" and "feature/def" will have this function return the list ["master", "feature"].
def list_project_refs(self, entity): refs = [] for ref in self.cache.list_project_refs(entity.objects['project'], self.tagRefs): # If ref name is hierarchical then only return first level if '/' in ref.name: refs.append(ref.name.split('/')[0]) else: ...
[ "def list_project_refs(self, project, includeTags):\n\n refs = project.branches.list(all=True)\n\n if includeTags:\n refs += project.tags.list(all=True)\n\n return refs", "async def get_tree(\n self, ref: str or None = None\n ) -> [\"AIOGitHubAPIRepository...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List the files and directories in a repository subdirectory.
def list_repository_directory(self, entity): members = [] # There is no directory object if this is the repository root path = '' if 'directory' in entity.objects: path = entity.objects['directory']['path'] for entry in self.cache.get_repository_tree(entity.objects...
[ "def list_dir(self, path):", "def listdir(self, subdir=''):\n\n try:\n subdir = subdir.decode()\n except AttributeError:\n pass\n subdir = subdir.rstrip('\\\\')\n # cmd = '\"%s\" \"%s\" 0 ' % (self.ndc_path, self.filename)\n cmd = [\n self.ndc_pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get position of given number
def __getpos__(self, num): return self.num_to_pos[num]
[ "def get_position(self, number):\n for rowidx, row in enumerate(self.numbers):\n for colidx, num in enumerate(row):\n if num == number:\n return rowidx, colidx", "def find_next_number(line, pos=0):\n m = number_re.search(line[pos:])\n if m:\n span =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Depthfirst graph traversal, extracts clumps (nodes) and tunnels (edges). Graph must have at least one point that is a junction.
def find_structure(self): cave_graphs = [] starting_point = None # firse initalize points for point in self.points.values(): neighbors = self.get_neighbors(point) if len(neighbors) != 2 and point.node is None: starting_point = point ...
[ "def construct_junction_graph(self) -> Graph[Cell]:\n if self.maze is None:\n raise ValueError('No current maze to construct a junction graph from!')\n\n junction_graph = Graph()\n visited = defaultdict(bool)\n\n def cell_visitor(cell: Cell) -> None:\n visited[cell]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This test changes the netbios name of the server and then verifies that this results in the server's domain SID changing. The new SID is stored in a global variable so that we can perform additional tests to verify that SIDs are rewritten properly in group_mapping.tdb. old_netbiosname is stored so that we can reset con...
def test_056_netbios_name_change_check_sid(request): depends(request, ["service_cifs_running"], scope="session") global new_sid global old_netbiosname results = GET("/smb/") assert results.status_code == 200, results.text old_netbiosname = results.json()["netbiosname"] old_sid = results.jso...
[ "def test_058_change_netbios_name_and_check_groupmap(request):\n depends(request, [\"SID_CHANGED\", \"ssh_password\"], scope=\"session\")\n payload = {\n \"netbiosname\": old_netbiosname,\n }\n results = PUT(\"/smb/\", payload)\n assert results.status_code == 200, results.text\n sleep(5)\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create testgroup and verify that groupmap entry generated with new SID.
def test_057_create_new_smb_group_for_sid_test(request): depends(request, ["SID_CHANGED", "ssh_password"], scope="session") global group_id payload = { "name": "testsidgroup", "smb": True, } results = POST("/group/", payload) assert results.status_code == 200, results.text gr...
[ "def test_create_group(self):\n pass", "def test_verify_that_you_can_create_a_new_group():", "def test_create_resource_group(self):\n pass", "def test_add_group(self):\n pass", "def test_new_group(self, inventoryloader):\n inventoryloader.add_group(u'newgroup')\n assert 'n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Verify that changes to netbios name result in groupmap sid changes.
def test_058_change_netbios_name_and_check_groupmap(request): depends(request, ["SID_CHANGED", "ssh_password"], scope="session") payload = { "netbiosname": old_netbiosname, } results = PUT("/smb/", payload) assert results.status_code == 200, results.text sleep(5) cmd = "midclt call ...
[ "def test_056_netbios_name_change_check_sid(request):\n depends(request, [\"service_cifs_running\"], scope=\"session\")\n global new_sid\n global old_netbiosname\n\n results = GET(\"/smb/\")\n assert results.status_code == 200, results.text\n old_netbiosname = results.json()[\"netbiosname\"]\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a C constant value in decimal or hex. Return None if the input isn't a constant.
def convert_value(value): # print "Attempting to match value: %s" % value m = re.match('^(0(x|X)[0-9a-fA-F]+|[0-9]+)$', value) if m is None: return None value = m.group(1) if value.startswith("0x") or value.startswith("0X"): return int(value[2:], 16) else: return int(value)
[ "def test_parse_constant_unsigned(self):\n self.assertEqual(\n self.parser.parse_value(self._tokenize('0x80000000')), 0x80000000)\n if self.arch.bits == 64:\n self.assertEqual(\n self.parser.parse_value(self._tokenize('0x8000000000000000')),\n 0x8000...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is called when the handler should emit the record. By default, SocketHandler will silently drop a message if it cannot send it. Because this is not desired in our case, we will use a queue that will act as a buffer if the message is not sent
def emit(self, record): self.buffer.append(record) while len(self.buffer) != 0: nextRecord = self.buffer.popleft() super().emit(nextRecord) if self.sock is None: # If we failed to send the record self.buffer.appendleft(nextRecord) br...
[ "def emit(self, record):\r\n if self._closing:\r\n return\r\n\r\n if self._buffer is None:\r\n self._NewBatch()\r\n\r\n self._inner_handler.emit(record)\r\n if self._buffer.tell() >= self._max_buffer_bytes:\r\n self.flush()\r\n elif not self._flush_timeout:\r\n deadline = self._st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for rest_v20_dd_systems_systemid_stats_capacity_get
def test_rest_v20_dd_systems_systemid_stats_capacity_get(self): pass
[ "def getOverallSystemCapacity(self):\n response, body = self.http.get('/capacity')\n return body", "def test_retrieve_context_topology_node_available_capacity_available_capacity(self):\n response = self.client.open(\n '/restconf/config/context/topology/{uuid}/node/{node_uuid}/avail...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
make node without archiving, create temp table, take full backup, check that temp table not present in backup catalogue
def test_exclude_temp_tables(self): fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node(base_dir="{0}/{1}/node".format(module_name, fname), set_replication=True, initdb_params=['--data-checksu...
[ "def test_backup_compact(self):\n gen = BlobGenerator(\"ent-backup\", \"ent-backup-\", self.value_size, end=self.num_items)\n self._load_all_buckets(self.master, gen, \"create\", 0)\n self.backup_create()\n self.backup_cluster_validate()\n self.backup_compact_validate()", "def b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if this intersatellite link could transmit data (stateindependent).
def couldTransmit(self, data, receiver, txLocation, rxLocation, context): return super(InterSatelliteLink, self).couldTransmit(data, receiver) \ and txLocation.isOrbit() \ and rxLocation.isOrbit() \ and (abs(txLocation.sector - rxLocation.sector) <= 1 ...
[ "def couldReceive(self, data, transmitter, txLocation, rxLocation, context):\n return super(InterSatelliteLink, self).couldReceive(data, transmitter) \\\n and txLocation.isOrbit() \\\n and rxLocation.isOrbit() \\\n and (abs(txLocation.sector - rxLocation.sector) <...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if this intersatellite link could receive data (stateindependent).
def couldReceive(self, data, transmitter, txLocation, rxLocation, context): return super(InterSatelliteLink, self).couldReceive(data, transmitter) \ and txLocation.isOrbit() \ and rxLocation.isOrbit() \ and (abs(txLocation.sector - rxLocation.sector) <= 1 ...
[ "def _has_received_data(self):\r\n return not self._bytes_received == self.bytes_received_on_connection", "def DataAvailable(self) -> bool:", "def couldTransmit(self, data, receiver, txLocation, rxLocation, context):\n return super(InterSatelliteLink, self).couldTransmit(data, receiver) \\\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The basic idea here is to represent the file contents as a long string and iterate through it characterbycharacter (the 'ind' variable points to the current character). Whenever we get to a new tree, we call the function again (recursively) to read it in.
def readTree(text, ind, verbose=False): if verbose: print("Reading new subtree", text[ind:][:10]) # consume any spaces before the tree while text[ind].isspace(): ind += 1 if text[ind] == "(": if verbose: print("Found open paren") tree = [] ind += 1 ...
[ "def read_file(filename):\r\n p = None\r\n fd = open(filename)\r\n for c in fd:\r\n c = c.strip()\r\n p = Node(int(c), p)\r\n return p", "def tree_decode(buf):\r\n ofs = 0\r\n while ofs < len(buf):\r\n z = buf.find('\\0', ofs)\r\n assert(z > ofs)\r\n spl = buf[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
queries the given url and places in the params and headers into the request if present.
def query(url, params=None, headers_param=None): if params is None: params = {} logging.info("url={0}\tparams={1}".format(url, params)) headers = { 'Referer': url, "Content-Type": "text/xml; charset=UTF-8", # implement after checking if this doesn't kill the other scripts 'U...
[ "def get(self, url, headers=None):\n pass", "def _process_query(self, url, query=None, add_authtok=True):\n if add_authtok:\n if self.authtok == '':\n self._error('No auth token, must login first')\n return False\n if query is None:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make the functions for adding filters and add them to the namespace automatically.
def _make_functions(namespace): for fil in registry.filters: func_name = camel2enthought(fil.id) class_name = fil.id if func_name.endswith('_filter'): func_name = func_name[:-7] class_name = class_name[:-6] class_name = class_name + 'Factory' # Don't ...
[ "def create_filters(self):", "def load_custom_filters(environment):\n\n # TODO deprecate ipaddr_index and netmask for the better ipnet ones\n filter_list = {\n 'dpkg_arch': filter_dpkg_arch,\n 'storage_size_num': filter_storage_size_num,\n 'ipnet_hostaddr': filter_ipnet_hostaddr,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends start cmd to RPKI Validator
def _start_validator(self): logging.info("Starting RPKI Validator") utils.run_cmds((f"cd {self.rpki_package_path} && " f"./{self.rpki_run_name}"))
[ "def start_execution(self):\n self.send_message(\"control.start\",None)", "async def start_validators(self):\n if self.is_client():\n return\n\n await sleep(random.random() * 3)\n\n cmd = \"/home/martijn/stellar-core/stellar-core run\"\n out_file = open(\"stellar.out\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads all trust anchors
def load_trust_anchors(self): utils.write_to_stdout(f"{datetime.now()}: Loading RPKI Validator\n", logging.root.level) time.sleep(60) while self._get_validation_status() is False: time.sleep(10) utils.write_to_stdout(".", logging.root.level)...
[ "def trust_anchors(self):\n\n if self.__trust_anchors is not None:\n return self.__trust_anchors\n\n user_set_ta_loc = True\n rel_dir = self.get_property(\"trust-anchor-directory\")\n if rel_dir[0] == \"/\":\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the validity dict for the RPKI Validator to decode results I could have this as a class attribute but too messy I think.
def get_validity_dict() -> dict: return {"VALID": ROA_Validity.VALID.value, "UNKNOWN": ROA_Validity.UNKNOWN.value, "INVALID_LENGTH": ROA_Validity.INVALID_BY_LENGTH.value, "INVALID_ASN": ROA_Validity.INVALID_BY_ORIGIN.value}
[ "def get_preflight_validation_fails(self):\n return self.get_as_dict_array(ShipyardDbAccess.SELECT_VALIDATIONS)", "def getVitalValidityDictionary (self):\n if not self.isVitalValid():\n return None\n \n sdVitalValidity = self._getVitalValidityMarker()\n return sdV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Installs RPKI validator with our configs. This might break in the future, but we need to do it this way for now to be able to do what we want with our own prefix origin table.
def install(**kwargs): config_logging(kwargs.get("stream_level", logging.DEBUG), kwargs.get("section")) utils.delete_paths([RPKI_Validator_Wrapper.rpki_package_path, RPKI_Validator_Wrapper.temp_install_path]) RPKI_Validator_Wrapper._download_v...
[ "def _start_validator(self):\n\n logging.info(\"Starting RPKI Validator\")\n utils.run_cmds((f\"cd {self.rpki_package_path} && \"\n f\"./{self.rpki_run_name}\"))", "def setup_validator(self, validator_account: str):\n self.register_account_with_locked_gold(validator_acc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Downloads validator into proper location
def _download_validator(): rpki_url = ("https://ftp.ripe.net/tools/rpki/validator3/beta/generic/" "rpki-validator-3-latest-dist.tar.gz") arin_tal = ("https://www.arin.net/resources/manage/rpki/" "arin-ripevalidator.tal") # This is the java version they us...
[ "def _download(self):\n self._system.download(\"http://geant4.web.cern.ch/geant4/support/source/\" + self._tar_name)", "async def validate_and_import_directory(self, **kwargs) -> str:", "def validate(self, client):\n # Put a temporary file to make sure the normal storage paths work.\n self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configure rpki validator to run off absolute paths This is necessary due to script being called from elsewhere In other words not from inside the RPKI dir.
def _config_absolute_paths(path): # Since I am calling the script from elsewhere these must be # absolute paths prepend = "rpki.validator.data.path=" replace = "." # Must remove trailing backslash at the end replace_with = RPKI_Validator_Wrapper.rpki_package_path[:-1] ...
[ "def validate(self):\n self.tool.options.make_absolute(self.working_directory)\n r = self.tool.validate()\n self.tool.options.make_absolute(self.working_directory)\n return r", "def _start_validator(self):\n\n logging.info(\"Starting RPKI Validator\")\n utils.run_cmds((f\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves an xy slice at a wavelength specified by the cube's primary wavelength plus the given offset.
def _choose_wavelength_slice(self, offset): if 'WAVE' not in self.axes_wcs.wcs.ctype: raise cu.CubeError(2, "Spectral dimension not present") if self.data.ndim == 4: raise cu.CubeError(4, "Can only work with 3D cubes") axis = -2 if self.axes_wcs.wcs.ctype[0] in ['TIME', ...
[ "def _choose_x_slice(self, offset):\n arr = None\n axis = 0\n length = self.data.shape[axis]\n if isinstance(offset, int) and offset >= 0 and offset < length:\n arr = self.data.take(offset, axis=axis)\n\n if isinstance(offset, u.Quantity):\n unit = self.axes_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves a lambday slice at an x coordinate specified by the cube's primary wavelength plus the given offset.
def _choose_x_slice(self, offset): arr = None axis = 0 length = self.data.shape[axis] if isinstance(offset, int) and offset >= 0 and offset < length: arr = self.data.take(offset, axis=axis) if isinstance(offset, u.Quantity): unit = self.axes_wcs.wcs.cunit...
[ "def _choose_wavelength_slice(self, offset):\n if 'WAVE' not in self.axes_wcs.wcs.ctype:\n raise cu.CubeError(2, \"Spectral dimension not present\")\n if self.data.ndim == 4:\n raise cu.CubeError(4, \"Can only work with 3D cubes\")\n\n axis = -2 if self.axes_wcs.wcs.ctype[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a given frequency chunk to a SunPy Map. Extra parameters are passed on to Map.
def slice_to_map(self, chunk, snd_dim=None, *args, **kwargs): if self.axes_wcs.wcs.ctype[1] == 'WAVE' and self.data.ndim == 3: error = "Cannot construct a map with only one spatial dimension" raise cu.CubeError(3, error) if isinstance(chunk, tuple): item = slice(cu.pi...
[ "def si_this_map_OLD(map):\n # Find out the value units and convert this and data to SI\n units = 1.0 * u.Unit(map.meta['bunit']).to(u.Tesla) * u.Tesla\n data = deepcopy(map.data) * units.value\n\n # ATM I don't convert the x-axis and y-axis to SI\n\n # Modify the map header to reflect all these chan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For a timelambday cube, returns a lightcurve with curves at the specified wavelength and given ycoordinate. If no y is given, all of them will be used (meaning the lightcurve object could contain more than one timecurve.)
def slice_to_lightcurve(self, wavelength, y_coord=None, x_coord=None): if self.axes_wcs.wcs.ctype[0] not in ['TIME', 'UTC']: raise cu.CubeError(1, 'Cannot create a lightcurve with no time axis') if self.axes_wcs.wcs.ctype[1] != 'WAVE': raise cu.Cube...
[ "def get_light_curve(self):\n lc_settings = self.config.light_curve\n log.info(\"Computing light curve.\")\n energy_edges = self._make_energy_axis(lc_settings.energy_edges).edges\n\n if lc_settings.time_intervals.start is None or lc_settings.time_intervals.stop is None:\n log....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For a cube containing a spectral dimension, returns a sunpy spectrum. The given coordinates represent which values to take. If they are None, then the corresponding axis is summed.
def slice_to_spectrum(self, *coords, **kwargs): if 'WAVE' not in self.axes_wcs.wcs.ctype: raise cu.CubeError(2, 'Spectral axis needed to create a spectrum') axis = -1 if self.axes_wcs.wcs.ctype[0] == 'WAVE' else -2 pixels = [cu.pixelize(coord, self.axes_wcs, axis) for coord in coords...
[ "def get_spectrum_from_cube(self, nx=None, ny=None, pixel_window=0, title=\"Spectrum\"):\n if nx == None : nx = self.shape[2] // 2\n if ny == None : ny = self.shape[1] // 2\n pixel_halfwindow = pixel_window // 2\n subcube = self[:, ny - pixel_halfwindow: ny + pixel_halfwindow + 1, \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For a timelambday cube, given a ycoordinate, returns a sunpy spectrogram. Keyword arguments are passed on to Spectrogram's __init__.
def slice_to_spectrogram(self, y_coord, x_coord=None, **kwargs): if self.axes_wcs.wcs.ctype[0] not in ['TIME', 'UTC']: raise cu.CubeError(1, 'Cannot create a spectrogram with no time axis') if self.axes_wcs.wcs.ctype[1] != 'WAVE': raise cu.CubeError...
[ "def createSpectrogram(canvas, *args, **kw):\n return canvas._create('spectrogram', args, kw)", "def get_spectrum_from_cube(self, nx=None, ny=None, pixel_window=0, title=\"Spectrum\"):\n if nx == None : nx = self.shape[2] // 2\n if ny == None : ny = self.shape[1] // 2\n pixel_halfwindow = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For a hypercube, return a 3D cube that has been cut along the given axis and with data corresponding to the given chunk.
def slice_to_cube(self, axis, chunk, **kwargs): if self.data.ndim == 3: raise cu.CubeError(4, 'Can only slice a hypercube into a cube') item = [slice(None, None, None) for _ in range(4)] if isinstance(chunk, tuple): if cu.iter_isinstance(chunk, (u.Quantity, u.Quantity)):...
[ "def handle_slice_to_cube(hypcube, item):\n if isinstance(item, int):\n chunk = item\n axis = 0\n else:\n chunk = [i for i in item if isinstance(i, int)][0]\n axis = item.index(chunk)\n return hypcube.slice_to_cube(axis, chunk)", "def getitem_3d(cube, item):\n axes = cube.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts this cube into a SpectralCube. It will only work if the cube has exactly three dimensions and one of those is a spectral axis.
def convert_to_spectral_cube(self): if self.data.ndim == 4: raise cu.CubeError(4, "Too many dimensions: Can only convert a " + "3D cube. Slice the cube before converting") if 'WAVE' not in self.axes_wcs.wcs.ctype: raise cu.CubeError(2, 'Spectral axi...
[ "def xarray2spectralcube(da: xr.DataArray) -> sc.SpectralCube:\n header = fits.Header.fromstring(da.header.item())\n data = da.values\n\n return sc.SpectralCube.read(fits.ImageHDU(data, header))", "def get_spectrum_from_cube(self, nx=None, ny=None, pixel_window=0, title=\"Spectrum\"):\n if nx == N...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a numpy array containing the time values for the cube's time dimension, as well as the unit used.
def time_axis(self): if self.axes_wcs.wcs.ctype[0] not in ['TIME', 'UTC']: raise cu.CubeError(1, 'No time axis present') delta = self.axes_wcs.wcs.cdelt[0] crpix = self.axes_wcs.wcs.crpix[0] crval = self.axes_wcs.wcs.crval[0] start = crval - crpix * delta stop...
[ "def time_array(self) -> numpy.array:\n\t\tNSamples = int(0)\n\t\tif self.hdr.comm_type == 0:\n\t\t\tNSamples = self.hdr.wave_array_1 # data returned as signed chars\n\t\telif self.hdr.comm_type == 1:\n\t\t\tNSamples = int(self.hdr.wave_array_1/2) # data returned as shorts\n\t\tt0 = self.hdr.horiz_of...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether the wcs system and the array are wellaligned.
def _array_is_aligned(self): rot_matrix = self.axes_wcs.wcs.pc return np.allclose(rot_matrix, np.eye(self.axes_wcs.wcs.naxis))
[ "def isaligned(a: np.ndarray, alignment: int) -> bool:\n return (a.ctypes.data % alignment) == 0", "def is_aligned(self):\n\n return self._bits == 0", "def isAligned(self):\n\n return self._aligned", "def has_wcs(self):\n if self.header is None:\n return False\n\n req...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse case excel file.
def manual_case_parser(self): data = self.excel_parser() result = self.process_module_field(data) self.add_class_name_field(result) self.process_multi_step_field(result) return result
[ "def parse_xlsx(self):\n data_tmp = pandas.read_excel(self.filepath)\n rows_read = self.parse_data(data_tmp)\n print('created: ' + str(rows_read) + ' Questions with answers')", "def test_parse_sample_sheet(self):\n pass", "def parse_excel(infile):\n wb = openpyxl.load_workbook(inf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the "ClassName" filed.
def add_class_name_field(data): for case in data: case_id = case['No.'] filed_list = case_id.split('_') filed_list = list(map(lambda x: x.title(), filed_list)) case['ClassName'] = ''.join(filed_list)
[ "def addHTMLClass(self, className):\n self.parent.addHTMLClass(className)", "def add_class(self):\n try:\n self.db.add_class(self.subject_text.get(), self.class_text.get())\n self.rmv_windows_class_subj()\n self.show_list_us()\n except ValueError:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validation of the implementaiton of periodic angle axis in Magnetic (MagFEMM) and Force (ForceMT) modules
def test_FEMM_periodicity_angle(): SPMSM_015 = load(join(DATA_DIR, "Machine", "SPMSM_015.json")) assert SPMSM_015.comp_periodicity() == (9, False, 9, True) simu = Simu1(name="test_FEMM_periodicity_angle", machine=SPMSM_015) # Definition of the enforced output of the electrical module I0_rms = 25...
[ "def test_mag_form_fac_case1():\n ion = MagneticFormFactor('Fe')\n formfac, _temp = ion.calc_mag_form_fac()[0], ion.calc_mag_form_fac()[1:]\n del _temp\n assert (abs(np.sum(formfac) - 74.155233575216599) < 1e-12)", "def test_mag_form_fac():\n ion = MagneticFormFactor('Fe')\n formfac, _temp = ion...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the RGB value, and optionally brightness, of a single pixel. If you don't supply a brightness value, the last value will be kept.
def set_pixel(x, r, g, b, brightness=None): if brightness is None: brightness = pixels[x][3] else: brightness = int(float(MAX_BRIGHTNESS) * brightness) & 0b11111 pixels[x] = [int(r) & 0xff, int(g) & 0xff, int(b) & 0xff, brightness]
[ "def set_brightness(self, value: int, /) -> None:", "def setRed(pixel, value):\n if isinstance(pixel, Pixel) and isNumeric(value):\n oldColor = pixel.getRGB()\n pixel.setRGB( (value, oldColor[1], oldColor[2]) )\n elif not isinstance(pixel, Pixel):\n raise TypeError(\"setRed: expected a Pixel as...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Waits for wait_seconds seconds before setting stop_signal.
def sleep_and_set_stop_signal_task(stop_signal, wait_seconds): timer = Timer(wait_seconds, stop_signal.set) timer.daemon = True timer.start()
[ "def wait(self, seconds):\n print(\"Suspend test execution on \" + str(seconds) + \" seconds.\")\n time.sleep(int(seconds))", "def sleep_for(seconds: float) -> None:\n if seconds <= 0.0:\n return\n\n rest = seconds\n while rest > 0.0:\n if rest > 1.0:\n sleep = 1.0\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Duplicate one to one fields.
def __duplicate_o2o_fields(self, duplicate): for f in self._meta.related_objects: if f.one_to_one: if any( [ f.name in self._clone_o2o_fields and f not in self._meta.concrete_fields, self._clo...
[ "def __duplicate_m2o_fields(self, duplicate):\n fields = set()\n\n for f in self._meta.concrete_fields:\n if f.many_to_one:\n if any(\n [\n f.name in self._clone_m2o_or_o2m_fields,\n self._clone_excluded_m2o_or_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Duplicate one to many fields.
def __duplicate_o2m_fields(self, duplicate): fields = set() for f in self._meta.related_objects: if f.one_to_many: if any( [ f.get_accessor_name() in self._clone_m2o_or_o2m_fields, self._clone_excluded_m2o_o...
[ "def __duplicate_m2o_fields(self, duplicate):\n fields = set()\n\n for f in self._meta.concrete_fields:\n if f.many_to_one:\n if any(\n [\n f.name in self._clone_m2o_or_o2m_fields,\n self._clone_excluded_m2o_or_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Duplicate many to one fields.
def __duplicate_m2o_fields(self, duplicate): fields = set() for f in self._meta.concrete_fields: if f.many_to_one: if any( [ f.name in self._clone_m2o_or_o2m_fields, self._clone_excluded_m2o_or_o2m_fields ...
[ "def __duplicate_o2m_fields(self, duplicate):\n fields = set()\n\n for f in self._meta.related_objects:\n if f.one_to_many:\n if any(\n [\n f.get_accessor_name() in self._clone_m2o_or_o2m_fields,\n self._clone_e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Duplicate many to many fields.
def __duplicate_m2m_fields(self, duplicate): fields = set() for f in self._meta.many_to_many: if any( [ f.name in self._clone_m2m_fields, self._clone_excluded_m2m_fields and f.name not in self._clone_excluded_m2m_fi...
[ "def __duplicate_m2o_fields(self, duplicate):\n fields = set()\n\n for f in self._meta.concrete_fields:\n if f.many_to_one:\n if any(\n [\n f.name in self._clone_m2o_or_o2m_fields,\n self._clone_excluded_m2o_or_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the business_account of this UserResponse.
def business_account(self, business_account): self._business_account = business_account
[ "def business_id(self, business_id):\n\n self._business_id = business_id", "def business_id(self, business_id):\n self._business_id = business_id", "def business_email(self, business_email):\n\n self._business_email = business_email", "def business_owner(self, business_owner):\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the individual_account of this UserResponse.
def individual_account(self, individual_account): self._individual_account = individual_account
[ "def user_account(self, user_account):\n self._user_account = user_account", "def SetUserAccount(self, user_account):\n if user_account.store_number not in self._user_accounts:\n # TODO: refactor the use of store number.\n self._user_accounts[user_account.store_number] = {}\n\n user_account...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the registration_marketplace_id of this UserResponse.
def registration_marketplace_id(self, registration_marketplace_id): self._registration_marketplace_id = registration_marketplace_id
[ "def marketplace_id(self, marketplace_id):\n\n self._marketplace_id = marketplace_id", "def save(self, *args, **kwargs):\n self.registration_response_key = self.registration_response_key or None\n return super().save(*args, **kwargs)", "def registration_id(self, registration_id):\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert a pygame surface into string
def surface_to_string( surface ): return pygame.image.tostring( surface, 'RGB' )
[ "def surface_to_string(surface):\r\n return pygame.image.tostring(surface, 'RGB')", "def surface_to_string(surface): \n return pygame.image.tostring(surface, 'RGB')", "def tostring(surface, format, flipped=False):\r\n surf = surface._c_surface\r\n if surf.flags & sdl.SDL_OPENGL:\r\n raise No...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert a pygame surface into a cv image
def pygame_to_cvimage( surface ): cv_image = cv.CreateImageHeader( surface.get_size(), cv.IPL_DEPTH_8U, 3 ) image_string = surface_to_string( surface ) cv.SetData( cv_image, image_string ) return cv_image
[ "def pygame_to_cvimage(surface): \n \n #cv_image = np.zeros(surface.get_size, np.uint8, 3) \n image_string = surface_to_string(surface) \n image_np = np.fromstring(image_string, np.uint8).reshape(480, 640, 3) \n frame = cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB) \n return frame", "def pygame_t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert cvimage into a pygame image
def cvimage_to_pygame( image ): #image_rgb = cv.CreateMat(image.height, image.width, cv.CV_8UC3) #cv.CvtColor(image, image_rgb, cv.CV_BGR2RGB) return pygame.image.frombuffer( image.tostring(), cv.GetSize( image ), "P" )
[ "def __cvimage_to_pygame(self, cv_imagen):\n cv_imagen = cv2.cvtColor(cv_imagen, cv2.COLOR_BGR2RGB)\n return pygame.image.frombuffer(cv_imagen.tostring(), cv_imagen.shape[1::-1],\"RGB\")", "def cvimage_to_pygame(image):\n return pygame.image.frombuffer(image.tostring(), image.shape[1::-1],\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a cvimage into grayscale
def cvimage_grayscale( cv_image ): grayscale = cv.CreateImage( cv.GetSize( cv_image ), 8, 1 ) cv.CvtColor( cv_image, grayscale, cv.CV_RGB2GRAY ) return grayscale
[ "def greyscale(image):\n return cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)", "def grayscale_image(input_image):\n return cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY)", "def rgb2gray(image):\n return np.dot(image[..., :3], [0.299, 0.587, 0.114])", "def rgb2gray(img):\n\n r = img[:, :, 0]\n g = img...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the last gfxinfo dump from the frame collector's raw output.
def gfxinfo_get_last_dump(filepath): record = '' with open(filepath, 'r') as fh: fh_iter = _file_reverse_iter(fh) try: while True: buf = next(fh_iter) ix = buf.find('** Graphics') if ix >= 0: return buf[ix:] + record...
[ "def frame(self):\n try:\n AppHelper.runConsoleEventLoop(installInterrupt=True)\n return str(self._delegate.frame.representations()[0].TIFFRepresentation().bytes())\n except:\n return None", "def grabRawFrame(self):\r\n \r\n self.surface = self.capture....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the instantaneous average velocity averaged over all cars
def global_average_speed(cars): velocities = [car.velocity for car in cars] average_speed = sum(velocities)/len(cars) return average_speed
[ "def class_average_speed(cars):\n # Sort by class name\n class_sorted = sorted(cars, key=lambda car: type(car).__name__)\n class_velocities = []\n class_names = []\n # Group the cars of same class and average their velocities, save class names\n for key, group in groupby(cars, key=lambda car: type...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the instantaneous average velocity for each class of cars Return class_velocity list of average velocities for class in class_names class_names list of class names of active cars
def class_average_speed(cars): # Sort by class name class_sorted = sorted(cars, key=lambda car: type(car).__name__) class_velocities = [] class_names = [] # Group the cars of same class and average their velocities, save class names for key, group in groupby(cars, key=lambda car: type(car).__nam...
[ "def global_average_speed(cars):\n velocities = [car.velocity for car in cars]\n average_speed = sum(velocities)/len(cars)\n return average_speed", "def __get_class_mean(self, vectors, class_index_list, vect_dim):\n vect_mean = []\n for each in class_index_list:\n label_count = l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the nodal sum of values defined on elements.
def nodalSum(val,elems,work,avg): nodes = unique1d(elems) for i in nodes: wi = where(elems==i) vi = val[wi] if avg: vi = vi.sum(axis=0)/vi.shape[0] else: vi = vi.sum(axis=0) val[wi] = vi
[ "def nodalSum2(val,elems,tol):\n nodes = unique1d(elems)\n for i in nodes:\n wi = where(elems==i)\n vi = val[wi]\n ai,ni = average_close(vi,tol=tol)\n ai /= ni.reshape(ai.shape[0],-1)\n val[wi] = ai", "def sum_elements(arr):\n return sum(arr)", "def sum(self) -> float...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the nodal sum of values defined on elements.
def nodalSum2(val,elems,tol): nodes = unique1d(elems) for i in nodes: wi = where(elems==i) vi = val[wi] ai,ni = average_close(vi,tol=tol) ai /= ni.reshape(ai.shape[0],-1) val[wi] = ai
[ "def nodalSum(val,elems,work,avg):\n nodes = unique1d(elems)\n for i in nodes:\n wi = where(elems==i)\n vi = val[wi]\n if avg:\n vi = vi.sum(axis=0)/vi.shape[0]\n else:\n vi = vi.sum(axis=0)\n val[wi] = vi", "def su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the focal_device_id of this TopologyAttachmentResultDto.
def focal_device_id(self, focal_device_id): self._focal_device_id = focal_device_id
[ "def device_id(self, value):\n self._device_id = value", "def device_id(self, device_id):\n self._device_id = device_id", "def device_id(self, device_id):\n\n self._device_id = device_id", "def set_device_id(self, device_id: str) -> None:\n self._ha_device_id = device_id", "def s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the link_data of this TopologyAttachmentResultDto.
def link_data(self, link_data): self._link_data = link_data
[ "def meta_data_link(self, meta_data_link):\n self._meta_data_link = meta_data_link", "def link(self, link):\n\n self._link = link", "def link(self, link):\n self._link = link", "def update(self, linkData):\n for field, value in linkData.items():\n if field == 'flags':\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the node_data of this TopologyAttachmentResultDto.
def node_data(self, node_data): self._node_data = node_data
[ "def set_data(node, value):\n node['data'] = value", "def SetNode(self, node):\n self.node = node.Parameters[\"Image\"].binding", "def set_node(self, node):\n self.__node = node", "def set_node(self, node):\r\n if node is None:\r\n if self.xmlnode.hasProp(\"node\"):\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Downloads data from the GDC. Combine the smaller files (~KB range) into a grouped download. The API now supports combining UUID's into one uncompressed tarfile using the ?tarfile url parameter. Combining many smaller files into one download decreases the number of open connections we have to make
def download(parser, args): successful_count = 0 unsuccessful_count = 0 big_errors = [] small_errors = [] total_download_count = 0 validate_args(parser, args) # sets do not allow duplicates in a list ids = set(args.file_ids) for i in args.manifest: if not i.get('id'): ...
[ "def download(size):\n files = glob(f'{size}_chunk/{FILE_BASE}_rdn_*[!.hdr]') \\\n + glob(f'{size}_chunk/{FILE_BASE}_loc_*[!.hdr]') \\\n + glob(f'{size}_chunk/{FILE_BASE}_obs_*[!.hdr]')\n\n if len(files) != 3:\n Logger.info('Downloading data')\n\n req = requests.get(URLS[size])...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The percentage of rate limit.
def rate_limit_percentage(self) -> Optional[float]: return pulumi.get(self, "rate_limit_percentage")
[ "def get_percent(self):\n if not (self.votes and self.score):\n return 0\n return 100 * (self.get_rating() / self.field.range)", "def _getPercentage(self):\n\t\treturn float(self.value)/float(self.maxvalue-self.minvalue)", "def percentage_used(self):\n max_usage = self._attrs['li...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The call rate limit Cognitive Services account.
def call_rate_limit(self) -> 'outputs.CallRateLimitResponse': return pulumi.get(self, "call_rate_limit")
[ "def get_rate_limit(self):\n resp = self._session.get(self.API_ROOT + \"/rate_limit\")\n log.info(resp.text)", "def get_rate_limit():\n return getattr(g, \"_rate_limit\", None)", "def set_rate_limits(self):\n\n resp = self.api.request(\"application/rate_limit_status\")\n resp.resp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the capabilities of the cognitive services account. Each item indicates the capability of a specific feature. The values are readonly and for reference only.
def capabilities(self) -> Sequence['outputs.SkuCapabilityResponse']: return pulumi.get(self, "capabilities")
[ "def capabilities(self) -> Mapping[str, str]:\n return pulumi.get(self, \"capabilities\")", "def capabilities(self):\n\n class Capabilities(ct.Structure):\n _fields_ = [(\"Size\", ct.c_ulong),\n (\"AcqModes\", ct.c_ulong),\n (\"ReadModes\", ct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The commitment plan associations of Cognitive Services account.
def commitment_plan_associations(self) -> Sequence['outputs.CommitmentPlanAssociationResponse']: return pulumi.get(self, "commitment_plan_associations")
[ "def get_commitment_plan_association_output(commitment_plan_association_name: Optional[pulumi.Input[str]] = None,\n commitment_plan_name: Optional[pulumi.Input[str]] = None,\n resource_group_name: Optional[pulumi.Input[str]] = None,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The deletion date, only available for deleted account.
def deletion_date(self) -> str: return pulumi.get(self, "deletion_date")
[ "def deleted_date(self):\n return self._deleted_date", "def deleted_time(self) -> str:\n return pulumi.get(self, \"deleted_time\")", "def get_delete_time(self):\n return self._dtime", "def deleted_date(self, deleted_date):\n \n self._deleted_date = deleted_date", "def deco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The private endpoint connection associated with the Cognitive Services account.
def private_endpoint_connections(self) -> Sequence['outputs.PrivateEndpointConnectionResponse']: return pulumi.get(self, "private_endpoint_connections")
[ "def private_endpoint(self) -> 'outputs.PrivateEndpointResponse':\n return pulumi.get(self, \"private_endpoint\")", "def get_connection(self, endpoint):\r\n if endpoint:\r\n return self.endpoints.get(endpoint)\r\n else:\r\n return self.conn", "def private_endpoint(self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The scheduled purge date, only available for deleted account.
def scheduled_purge_date(self) -> str: return pulumi.get(self, "scheduled_purge_date")
[ "def planned_purge_date(self):\n return self._planned_purge_date", "def scheduled_update_date(self) -> str:\n return pulumi.get(self, \"scheduled_update_date\")", "def deletion_date(self) -> str:\n return pulumi.get(self, \"deletion_date\")", "def deleted_date(self):\n return self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sku change info of account.
def sku_change_info(self) -> 'outputs.SkuChangeInfoResponse': return pulumi.get(self, "sku_change_info")
[ "def sku(self, sku):\n\n self._sku = sku", "def change_account(self, account):\r\n check_account = Account(account, steem_instance=self.steem)\r\n self.account = check_account[\"name\"]\r\n self.refresh()", "def changeRoleInfo(self, role, info):", "def update(self, request, pk):\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The api properties for special APIs.
def api_properties(self) -> Optional['outputs.ApiPropertiesResponse']: return pulumi.get(self, "api_properties")
[ "def api_metadata_properties(self) -> Optional[pulumi.Input['GatewayApiMetadataPropertiesArgs']]:\n return pulumi.get(self, \"api_metadata_properties\")", "def api_access(self):\n return self._api_access", "def test_get_api_resources(self):\n pass", "def api(self):\r\n return self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The flag to enable dynamic throttling.
def dynamic_throttling_enabled(self) -> Optional[bool]: return pulumi.get(self, "dynamic_throttling_enabled")
[ "def throttle(self, enabled = True):\n\n self.throttled = enabled\n\n # If we are leaving the throttled mode, make sure the read watch\n # is installed and we are reading data from the socket.\n if not enabled:\n self.readmode()", "def test_change_default_throttling_settings...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(Metrics Advisor Only) The Azure AD Client Id (Application Id).
def aad_client_id(self) -> Optional[str]: return pulumi.get(self, "aad_client_id")
[ "def client_app_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"client_app_id\")", "def client_id(self) -> str:\n return pulumi.get(self, \"client_id\")", "def client_id(self) -> str:", "def client_id(self):\n return self._client_id", "def client_app_id(self) -> Optional[pulu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(QnAMaker Only) The Azure Search endpoint id of QnAMaker.
def qna_azure_search_endpoint_id(self) -> Optional[str]: return pulumi.get(self, "qna_azure_search_endpoint_id")
[ "def qna_azure_search_endpoint_key(self) -> Optional[str]:\n return pulumi.get(self, \"qna_azure_search_endpoint_key\")", "def endpoint_id(self) -> str:\n return pulumi.get(self, \"endpoint_id\")", "def endpoint_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"endpoint_id\")", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(QnAMaker Only) The Azure Search endpoint key of QnAMaker.
def qna_azure_search_endpoint_key(self) -> Optional[str]: return pulumi.get(self, "qna_azure_search_endpoint_key")
[ "def qna_azure_search_endpoint_id(self) -> Optional[str]:\n return pulumi.get(self, \"qna_azure_search_endpoint_id\")", "def endpoint_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"endpoint_name\")", "def _api_query(self):\n return f'?key={self.api_key}'", "def _get_query_ap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(QnAMaker Only) The runtime endpoint of QnAMaker.
def qna_runtime_endpoint(self) -> Optional[str]: return pulumi.get(self, "qna_runtime_endpoint")
[ "def name(self):\n return \"onnxruntime\"", "def runtime(ctx):\n output(ctx.obj.server.runtime(ctx.obj.find_server(ctx.obj.server_name)['uuid']))", "def test_api_v1_audits_runtime_host_get(self):\n pass", "def get_sparql_endpoint(self) -> str:\n\t\treturn self.__project_config[\"sparqlEndpoin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(Bing Search Only) The flag to enable statistics of Bing Search.
def statistics_enabled(self) -> Optional[bool]: return pulumi.get(self, "statistics_enabled")
[ "def query_insights_enabled(self) -> bool:\n return pulumi.get(self, \"query_insights_enabled\")", "def set_search_flag(self):\n self.search_flag = True", "def get_use_slow_search(self):\n\n return self.__use_slow_search", "def statistics(self, **_):\n raise NotImplementedE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(Personalization Only) The storage account connection string.
def storage_account_connection_string(self) -> Optional[str]: return pulumi.get(self, "storage_account_connection_string")
[ "def rdb_storage_connection_string(self) -> str:\n return pulumi.get(self, \"rdb_storage_connection_string\")", "def account_connection_string(self) -> str:\n return pulumi.get(self, \"account_connection_string\")", "def rdb_storage_connection_string(self) -> Optional[pulumi.Input[str]]:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(Metrics Advisor Only) The super user of Metrics Advisor.
def super_user(self) -> Optional[str]: return pulumi.get(self, "super_user")
[ "def user(self):\n return self._forced_user", "def get_current_user(self):\r\n return None", "def superuser():", "def user(self):\n return self._user", "def caller_user(self):\n return self._caller_user", "def user(self):\n return self.created_by", "def get_current_use...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(Metrics Advisor Only) The website name of Metrics Advisor.
def website_name(self) -> Optional[str]: return pulumi.get(self, "website_name")
[ "def site_name(self):\n return self._site_name", "def website(self):\n self._validate_status()\n return self.details.get('website')", "def Site(self) -> str:", "def get_website(self, name):\n return self.store.website.id", "def _get_browser_name(self):\n return self._curre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The renewal period in seconds of Call Rate Limit.
def renewal_period(self) -> Optional[float]: return pulumi.get(self, "renewal_period")
[ "def update_period(self):\n return self._update_period / 1000.", "def rate_limiting_resettime(self):\n if self.__requester.rate_limiting_resettime == 0:\n self.get_rate_limit()\n return self.__requester.rate_limiting_resettime", "def max_age(self):\n api_option = timedelta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cognitive Services account commitment quota.
def quota(self) -> 'outputs.CommitmentQuotaResponse': return pulumi.get(self, "quota")
[ "def online_quota(self):\r\n return self.max_contributions - self.num_tickets_total", "def account_space(access_token):\n client = dropbox.client.DropboxClient(access_token)\n account_info = client.account_info()\n quota_info = account_info['quota_info']\n total = quota_info['quota']\n used ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The Azure resource id of the commitment plan.
def commitment_plan_id(self) -> Optional[str]: return pulumi.get(self, "commitment_plan_id")
[ "def plan_id(self) -> str:\n return self._plan_id", "def plan_id(self):\n return self._plan_id", "def plan_id(self) -> Optional[str]:\n return pulumi.get(self, \"plan_id\")", "def azure_resource_id(self) -> str:\n return pulumi.get(self, \"azure_resource_id\")", "def resource_id(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The location of of the commitment plan.
def commitment_plan_location(self) -> Optional[str]: return pulumi.get(self, "commitment_plan_location")
[ "def plan(self) -> str:\n return pulumi.get(self, \"plan\")", "def commitment_plan_id(self) -> Optional[str]:\n return pulumi.get(self, \"commitment_plan_id\")", "def plan(self):\n return self._plan", "def _course_location(self):\r\n return \"location:{org}+{number}+{run}+course+{r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cognitive Services account commitment period.
def last(self) -> 'outputs.CommitmentPeriodResponse': return pulumi.get(self, "last")
[ "def completion_period_end(self) -> datetime:\n return self._completion_period_end", "def current_effective_deadline(cls) -> float:", "def notify_commitment_end():\n members = ActionMember.objects.filter(completion_date=datetime.date.today(),\n action__type=\"c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The list of ProvisioningIssue.
def provisioning_issues(self) -> Sequence[str]: return pulumi.get(self, "provisioning_issues")
[ "def issues(self):\n return list(map(GitHubIssue, self._items))", "def suspected_issues(self) -> List[IssueLink]:\n return [IssueLink(j, self._api) for j in self.json.get(\"suspected_issues\", [])]", "def issues(self) -> Iterable[Issue]:\n # Make request\n issues = self.shards_xml(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The call rate limit Cognitive Services account.
def call_rate_limit(self) -> 'outputs.CallRateLimitResponse': return pulumi.get(self, "call_rate_limit")
[ "def get_rate_limit(self):\n resp = self._session.get(self.API_ROOT + \"/rate_limit\")\n log.info(resp.text)", "def get_rate_limit():\n return getattr(g, \"_rate_limit\", None)", "def set_rate_limits(self):\n\n resp = self.api.request(\"application/rate_limit_status\")\n resp.resp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deployment model version upgrade option.
def version_upgrade_option(self) -> Optional[str]: return pulumi.get(self, "version_upgrade_option")
[ "def bump_version(session: nox.Session) -> None:\n session.install(\"-e\", \".\")\n session.run(\"python\", \"admin/bump_version.py\")", "def update_version(self, version):", "def upgrade_version(self):\n return self._upgrade_version", "async def upgrade(self, job, release_name, options):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deployment active capacity. This value might be different from `capacity` if customer recently updated `capacity`.
def active_capacity(self) -> int: return pulumi.get(self, "active_capacity")
[ "def available_capacity(self) -> Capacity:\n return self._available_capacity", "def capacity(self):\n return self._capacity", "def capacity(self) -> Capacity:\n raw = self._call('GET', 'capacity')\n return Capacity.parse_raw(raw)", "def capacity(self):\n\t\treturn self.monitor.get_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Version of the Key from KeyVault
def key_version(self) -> Optional[str]: return pulumi.get(self, "key_version")
[ "def cosmosdb_key_vault_key_versionless_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"cosmosdb_key_vault_key_versionless_id\")", "def version_template(self) -> pulumi.Output['outputs.CryptoKeyVersionTemplateResponse']:\n return pulumi.get(self, \"version_template\")", "def ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The list of virtual network rules.
def virtual_network_rules(self) -> Optional[Sequence['outputs.VirtualNetworkRuleResponse']]: return pulumi.get(self, "virtual_network_rules")
[ "def virtual_network_rules(self) -> pulumi.Output[Sequence['outputs.VirtualNetworkRuleResponse']]:\n return pulumi.get(self, \"virtual_network_rules\")", "def virtual_network_rules(self) -> Optional[Sequence['outputs.EventhubNamespaceSpecNetworkRuleVirtualNetworkRules']]:\n return pulumi.get(self, \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maps the region to the regional custom subdomain.
def customsubdomain(self) -> Optional[str]: return pulumi.get(self, "customsubdomain")
[ "def set_region(slug):\n _local.region = slug", "def get_subdomains(self):\n if self.subdomains is None:\n sub_name = self.filename.split('.')[0] + '_physical_region.xml'\n file = self.mesh_folder_path + '/' + sub_name\n self.subdomains = df.MeshFunction('size_t', self.m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the count of downgrades.
def count_of_downgrades(self) -> Optional[float]: return pulumi.get(self, "count_of_downgrades")
[ "def count_of_upgrades_after_downgrades(self) -> Optional[float]:\n return pulumi.get(self, \"count_of_upgrades_after_downgrades\")", "def count_of_nodes_down(self):\n\n tinctest.logger.info(\"Counting the number of nodes down\")\n sqlcmd = \"select count(*) from gp_segment_configuration wher...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the count of upgrades after downgrades.
def count_of_upgrades_after_downgrades(self) -> Optional[float]: return pulumi.get(self, "count_of_upgrades_after_downgrades")
[ "def count_of_downgrades(self) -> Optional[float]:\n return pulumi.get(self, \"count_of_downgrades\")", "def count_of_nodes_down(self):\n\n tinctest.logger.info(\"Counting the number of nodes down\")\n sqlcmd = \"select count(*) from gp_segment_configuration where status = 'd'\"\n (num...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the last change date.
def last_change_date(self) -> Optional[str]: return pulumi.get(self, "last_change_date")
[ "def last_change(self):\n return self._last_change", "def get_last_changeset(self):\n return self.repository.changesets.get(date=self.last_changed)", "def svn_info_t_last_changed_date_get(svn_info_t_self): # real signature unknown; restored from __doc__\n pass", "def previous_date(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ignore missing vnet service endpoint or not.
def ignore_missing_vnet_service_endpoint(self) -> Optional[bool]: return pulumi.get(self, "ignore_missing_vnet_service_endpoint")
[ "def ignore_missing_v_net_service_endpoint(self) -> Optional[bool]:\n return pulumi.get(self, \"ignore_missing_v_net_service_endpoint\")", "def ignore_missing_v_net_service_endpoint(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"ignore_missing_v_net_service_endpoint\")", "def i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a list containing files in current working directory
def get_all_files(cwd): return os.listdir(cwd)
[ "def getFiles(self):\n\t\treturn os.listdir(self.getPath())", "def file_list(self):\n return [\n x\n for x in os.listdir(self.absolute_process_folder)\n if os.path.isfile(os.path.join(self.absolute_process_folder, x))\n ]", "def get_files(self) -> list:\n fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a list of folder name
def folder_name(self): folders = [] for folder in self.folders: folders.append(folder) return folders
[ "def get_folder_list(args):\n\tif not args.folders:\n\t\treturn None\n\n\tif os.path.isfile(args.folders):\n\t\treturn [x.strip() for x in list(open(args.folders, 'r'))]\n\n\telse:\n\t\treturn [x.strip() for x in args.folders.split(',')]", "def get_folder_content(self) -> List[str]:\n return os.listdir(sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a list of folder type
def folder_type(self): types = [] for type in self.folders_type: types.append(type) return types
[ "def get_folder_files(folder, types):\n files_grabed = []\n for file_type in types:\n files_grabed.extend(glob.glob(os.path.join(folder, file_type)))\n return files_grabed", "def listTypes(cls):\n typeList = os.listdir(cls._allConfigs)\n typeList = set(typeList) - set([\".ropeproject...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test the ability to gather sequence
def testGetSequence(): #a few of hand-tested genome positions test_data = [ ('1',500,520,'GTCTGACCTGAGGAGAACTGT'), ('2',500,520,'CCCGACCCCGACCCCGACCCA'), ('3',50000,50020,'TCTTCTTTTATGAAAAAGGAT'), ('4',50000,50020,'AGAGCCCTGCAATTTGAAGAT'), ('5',100000,100020,'AATGTTCACCAGTATATTTTA'), ...
[ "def test_input_type_seq(self, _run_mock):\n hhblits = self.tool(input_type=hhsuite.QueryType.SEQUENCE)\n self.assertEqual(set(hhblits.REQUIRED), set([\"name\", \"sequence\"]))\n hhblits.run({\"sequence\": self.SEQUENCE, \"name\": self.SEQ_NAME})\n self.verify_common(\"hhblits\", hhblits...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API return string and HTTP Bad Request (400) issued when project type is not valid.
def invalid_project_tye_msg(proj_type): return {"error": f"Project type {proj_type} is not valid, please use one of the following: " f"{', '.join(project_types)}"}, 400
[ "def api_response(project_type, result):\n if project_type not in project_types:\n return invalid_project_tye_msg(project_type)\n return result", "def test_create_project_invalid(self):\n payload = {'name': '', 'organization': self.ngo}\n res = self.client.post(PROJECT_URL, payload)\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wrapper to return the desired api response only if the specified project type is valid
def api_response(project_type, result): if project_type not in project_types: return invalid_project_tye_msg(project_type) return result
[ "def get_api_from_project_type():\n # incident uses a different API endpoint\n if 'INCIDENT' in if_config_vars['project_type']:\n return 'incidentdatareceive'\n elif 'DEPLOYMENT' in if_config_vars['project_type']:\n return 'deploymentEventReceive'\n else: # MERTIC, LOG, ALERT\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to check for XPath validity. Tries to create an etree ETXPath instance from the query. If this fails, the XPathSyntaxError is excepted to return a False. Returns True otherwise
def is_valid_query(query): try: etree.ETXPath(query) return True except etree.XPathSyntaxError: return False
[ "def isPathOK(xpath: str) -> bool:\n try:\n parsePath(xpath)\n except XpathError:\n return False\n return True", "def assertXpathsExist(self, node, xpaths):\n expressions = [etree.XPath(xpath) for xpath in xpaths]\n for expression in expressions:\n if not expression...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
First checks if the request is a simple dictionary with string keys and string values. If so, the queries in the request message are saved to disk
def process_queries(req, save_dir, replace_allowed): create_dir_if_not_exists(save_dir) req_obj = json.loads(req.data) result_dict = dict() if not all(map(lambda x: all(map(lambda y: isinstance(y, str), x)), req_obj.items())): return {"message": f"Not all query names or values are strings"}, 400...
[ "def save_request(self, request):\n request_dict = self.process_request(request)\n self.ser.info(pickle.dumps(request_dict))\n self.ser.info(REQUEST_UNIQUE_STRING)", "def test_query_dict_for_request_in_method_post(self):\n self.request.POST = QueryDict(\"foo=bar\")\n response = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }