query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Execure a move. This should be called after set_move with a similar value of rel. | def do_move(self, rel=True):
cmd = self.MGMSG_MOT_MOVE_ABSOLUTE
if rel:
cmd = self.MGMSG_MOT_MOVE_RELATIVE
self.__send_short(cmd, self.__chan, 0x00) | [
"def execute_move(self, game_state):\n game_state.pacs_pos[self.pac_id] = self.next_move",
"def movePlungerRel(self, rel_position):\n if rel_position < 0:\n cmd_string = 'D{0}'.format(abs(rel_position))\n else:\n cmd_string = 'P{0}'.format(rel_position)\n self.sim... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the raw status field. | def get_raw_status(self):
self.__param_lock.acquire()
status = self.__status
self.__param_lock.release()
return status | [
"def get_status_raw(self):\n payload = {'access_token': self._lr_object.access.token}\n url = SECURE_API_URL + \"api/v2/status/raw/\"\n return self._lr_object._get_json(url, payload)",
"def get_status(self):\n if self.is_void:\n return u'void'\n\n return self.status_d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the current home state of the motor. Returns 0 if the motor is correctly homed. 1 if the motor requires homing. 2 if the homing procedure is currently running. | def get_home_state(self):
raw_status = self.get_raw_status()
is_home = raw_status & self.STATUS_HOMED
is_homing = raw_status & self.STATUS_HOMING
if is_homing:
return 2
if not is_home:
return 1
return 0 | [
"def home(self, force=False, verbose=False):\r\n if not self.needs_home():\r\n self.print_msg(\"Warning: the device does not need homing.\")\r\n if not force:\r\n self.print_msg(\" - skip homing...\")\r\n return\r\n\r\n if verbose:\r\n se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the motor is currently moving. | def is_moving(self):
is_moving = self.get_raw_status() & self.STATUS_MOVING
return bool(is_moving) | [
"def isMoving(self):\n return int(self.send('S')) != 0",
"def get_is_moving(self):\r\n return self._arm.get_is_moving()",
"def is_moving(self):\n return self.gripper_io.get_signal_value(\"is_moving\")",
"def is_moving(self):\n return self.steps < self.max_steps",
"def _ismoving(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the motor is at its lower limit. | def is_lower_limit(self):
is_lower = self.get_raw_status() & self.STATUS_LLIM
return bool(is_lower) | [
"def motor_lowerLimitOn(self):\n return self.args[8]",
"def motor_lowerLimitOn(self):\n return self.args[4]",
"def voltage_low(self, status: Status) -> bool:\n return status.motor_voltage is not None and status.motor_voltage < MOTOR_VOLTAGE_CUTOFF",
"def motor_lowerLimit(self):\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the motor is at its upper limit. | def is_upper_limit(self):
is_upper = self.get_raw_status() & self.STATUS_ULIM
return bool(is_upper) | [
"def motor_current_limit_reached(self):\n status_bits = self._status_bits\n mask = 0x01000000\n return bool(status_bits & mask)",
"def close_to_exceeding(self) -> bool:\n mean = self.current / self.num_cuts\n if self.max_frames is not None:\n return self.current + mea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For every transcript in list of transcripts, extract those transcripts that are unique and have an FPKM equal to fpkm_threshold. | def process_transcripts(transcript_file, dict_of_transcripts, fpkm_threshold):
dictionary_of_unique_transcripts = {}
list_transcripts = dict_of_transcripts[transcript_file]
for transcript in list_transcripts:
exon_ids = ''
for exon in transcript.exons:
exon_ids += str(exon.start)... | [
"def filter_data(data: List[dict], corpus: dict):\n\n corpus_doc_ids = list(corpus.keys())\n data_to_keep = []\n for d in data:\n evidence_docs = get_evidence_docs(d)\n for evidence_doc in evidence_docs:\n if evidence_doc in corpus_doc_ids:\n data_to_keep.append(d)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function adds all residues of an coords file to This is a very crude functio at the moment! It only takes positions of a residue and merges them! if there are residues with the same name, this might lead to problems, as clean_posiresnumbyname function is not | def add_residue_positions(self, coords: object):
positions = coords.POSITION.content
self.POSITION.content.extend(positions)
self.clean_posiResNums()
self.get_residues(verbose=True) | [
"def setResNameCheckCoords(self):\n exit = False\n localDir = os.path.abspath('.')\n if not os.path.exists(self.tmpDir):\n os.mkdir(self.tmpDir)\n #if not os.path.exists(os.path.join(tmpDir, self.inputFile)):\n copy2(self.absInputFile, self.tmpDir)\n os.chdir(sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get_system_information This function utilizes a dictionary containing all residues and atom numbers (e.g. cnf.get_residues()) and modifies them such, that the result can be used to set up a standard REEDS gromos_simulation | def get_system_information(self, not_ligand_residues: List[str] = [],
ligand_resn_prefix: (str or List[str]) = None,
solvent_name: str = "SOLV") -> \
(Dict[str, Dict[int, int]], namedtuple, namedtuple, namedtuple, namedtuple):
... | [
"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\")",
"async def system_info(self):\n _LOGGER.debug(\"Sending system information\")\n creds = parse_credentials(self.core.service.credentials)\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clean_posiResNums This function recount the Residue number with respect to residue name and residue number. Warnings only in "Position_BLOCK! Returns None | def clean_posiResNums(self) -> None:
position_copy = self.POSITION
pos = position_copy.content
tmpN = ""
tmpID = 0
tmpOldID = pos[0].resID
for p in pos:
# print(p)
# print(tmpN,tmpID)
if p.resName == tmpN and p.resID == tmpOldID: # sa... | [
"def residue_num(res, models='auto'):\n if models == 'auto':\n models = len(res.get_parent().get_parent().get_parent()) > 1\n\n if has_ins_code(res):\n rnum = str(res.get_parent().id) + str(res.id[1]) + res.id[2]\n else:\n rnum = str(res.get_parent().id) + str(res.id[1])\n if models... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates the center of geometry for asingle molecule or the selected Atoms Returns list cog | def center_of_geometry(self, selectedAtoms:list=None) -> list:
if ("POSITION" in dir(self)):
cogx = 0.0
cogy = 0.0
cogz = 0.0
if selectedAtoms is None:
iterator = self.POSITION.content
else:
iterator = []
... | [
"def get_centerofgravity(self):\r\n atoms=self.get_atoms()\r\n AtomicMass=1\r\n XYZ_M=[0,0,0]\r\n MassofAA=0\r\n for i in atoms:\r\n XYZ_M[0]+=i.Coordinates[0]*AtomicMass\r\n XYZ_M[1]+=i.Coordinates[1]*AtomicMass\r\n XYZ_M[2]+=i.Coordinates[2]*Atom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
supress_atomPosition_singulrarities This function adds a very small deviation to the position of an atom, dependent on the atom number. This might be needed to avoid singularities in gromosXX. Returns None | def supress_atomPosition_singulrarities(self) -> None:
if ("POSITION" in dir(self)):
for ind, atom in enumerate(self.POSITION.content):
atom.xp = atom.xp + 10 ** (-7) * ind
atom.yp = atom.yp - 10 ** (-7) * ind
atom.zp = atom.zp - 10 ** (-7) * ind | [
"def _fix_particle_sigmas(self, system):\n for force in system.getForces():\n if force.__class__.__name__ == 'NonbondedForce':\n for index in range(system.getNumParticles()):\n [charge, sigma, epsilon] = force.getParticleParameters(index)\n if s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
write_possrespec This function writes out a gromos file, containing a atom list. that is to be position restrained! Raises not Implemented error, if a input variant of the residues | def write_possrespec(self, out_path: str, residues: dict or list, verbose: bool = False) -> str:
posres_class = self.gen_possrespec(residues=residues, verbose=verbose)
posres_class.write(out_path)
return out_path | [
"def generate_POSCAR(formu,mat_list,my_ordered_elements,my_ordered_numbers,revise_dos):\n out_name='POSCAR.'+formu\n out_name='POSCAR_files/'+out_name.replace(' ','')\n openfile = open(out_name,'wt')\n openfile.write(formu+'\\n')\n openfile.write(str(1.0)+'\\n')\n for str_lines in mat_list:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
translate cnf to pdb. Returns str pdb str. | def get_pdb(self)->str:
# 2) CONSTUCT PDB BLOCKS
# ref: https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html
pdb_format = "ATOM {:>5d} {:<4}{:1}{:<4} {:1}{:>3d}{:1} {:>7.3f} {:>7.3f} {:>7.3f} {:>5}{:>6}{:<3}{:>2} {:>2d}"
dummy_occupancy = dummy_bfactor = dummy_ch... | [
"def to_pdb_line(self) -> str:\n format_string = (\n \"{:<6.6s}{:5s} {:^4.4s}{:^1.1s}{:<4.4s}{:^1.1s}{:>4d} {:1.1s} \"\n \"{: 8.3f}{: 8.3f}{: 8.3f}{: 6.2f}{: 6.2f} {:<4.4s}{:>2.2s}\"\n \"{:>2.2s}\\n\"\n )\n\n atom_serial_format = \"{: 5d}\"\n if sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
translate cnf to xyz Returns str in xyz format | def get_xyz(self)->str:
xyz_str = str(len(self.POSITION)) + "\n"
xyz_str += "# "+str(self.TITLE.content[0])
xyz_str += "# exported wit PyGromosTools\n"
xyz_format = "{:<3}\t{:> 3.9f} {:> 3.9f} {:> 3.9f}\n"
for position in self.POSITION:
xyz_line = xyz_format.form... | [
"def _xyz_from_ccdata(self, index: int) -> str:\n\n atomcoords = self.ccdata.atomcoords[index]\n existing_comment = \"\" if \"comments\" not in self.ccdata.metadata \\\n else self.ccdata.metadata[\"comments\"][index]\n\n # Create a comment derived from the filename and the index.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function converts a cnf to a trajectory with a single frame Returns Trc Trc with informations from Cnf(self) | def cnf2trc(self) -> Trc:
#create empty Trc
trc = Trc(input_value=None)
#set normal blocks
trc.TITLE = self.TITLE
#create dict for pd DataFrame
dict = {}
if hasattr(self,"TIMESTEP"):
dict["TIMESTEP_step"] = self.TIMESTEP.step
di... | [
"def reshape_to_tcn(self, frames):\n reshaped = frames.reshape((*frames.shape[:-3], self.im_size))\n return reshaped",
"def convert_tcr(self):\n\n def read_text(file_name, event_a_id, event_b_id):\n idx_val = {\"span1\": [], \"span2\": [], \"signal\": []}\n parsed_doc = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the item at the current position, and advances the position. | def __next__(self):
try:
t = self.items[self.pos]
except IndexError:
raise EOF()
self.pos += 1
return t | [
"def next(self):\r\n rv = self.current\r\n self.pos = (self.pos + 1) % len(self.items)\r\n return rv",
"def next_item(self) -> Any:\n self.current_item = self._cycle_dict[self.current_item]\n return self.current_item",
"def current(self):\r\n return self.items[self.pos]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an instance of klass (a Token class) with the current position and the supplied items as parameters, then accumulates the instance into the self.tokens accumulator. | def emit(self, klass, items):
token = klass(self.pos, items)
self._last_emitted_pos = self.pos
self.tokens += [token] | [
"def build_tokens(self):\n self.advance()\n while self.__token != \"\":\n self.__tokens.append(self.token_type())\n self.advance()",
"def _make_tokens(self, count, token_type=None):\n if token_type:\n for _ in range(count):\n yield (self._make_t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get pvalues of the comparison of groups1 to groups2. | def pval_pairs(self, groups0, groups1):
idx0, idx1 = self._get_group_idx(groups0=groups0, groups1=groups1)
return self._pval_pairs(idx0=idx0, idx1=idx1) | [
"def p_value(set1, set2):\n\ts, p = stats.ttest_ind(set1, set2)\n\treturn p",
"def qval_pairs(self, groups0, groups1, method=\"fdr_bh\"):\n idx0, idx1 = self._get_group_idx(groups0=groups0, groups1=groups1)\n return self._qval_pairs(idx0=idx0, idx1=idx1, method=method)",
"def group_and_vote_fracti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get qvalues of the comparison of groups1 to groups2. | def qval_pairs(self, groups0, groups1, method="fdr_bh"):
idx0, idx1 = self._get_group_idx(groups0=groups0, groups1=groups1)
return self._qval_pairs(idx0=idx0, idx1=idx1, method=method) | [
"def Evalue_blast1_vs_blast2(ome1_oprlike, ome2_oprlike) :\n\t#dico qui contiendra les valeurs de Evalues du blast1 et du blast2\n\t#dico_comparison = {}\n\t#dico des ome de blast1 et de blast2\n\tdico1 = dico_oprlike(ome1_oprlike)\n\tdico2 = dico_oprlike(ome2_oprlike)\n\t#header\n\tprint \"ome\\tcontig\\tEvalue1\\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return log10 transformed and cleaned pvalues. NaN pvalues are set to one and pvalues below log10_threshold in log10 space are set to log10_threshold. | def log10_pval_pairs_clean(self, groups0, groups1, log10_threshold=-30):
pvals = np.reshape(self.pval_pairs(groups0=groups0, groups1=groups1), -1)
pvals = np.nextafter(0, 1, out=pvals, where=pvals == 0)
log10_pval_clean = np.log(pvals) / np.log(10)
log10_pval_clean[np.isnan(log10_pval_cl... | [
"def log10_qval_pairs_clean(self, groups0, groups1, log10_threshold=-30):\n qvals = np.reshape(self.qval_pairs(groups0=groups0, groups1=groups1), -1)\n qvals = np.nextafter(0, 1, out=qvals, where=qvals == 0)\n log10_qval_clean = np.log(qvals) / np.log(10)\n log10_qval_clean[np.isnan(log1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return log10 transformed and cleaned qvalues. NaN pvalues are set to one and qvalues below log10_threshold in log10 space are set to log10_threshold. | def log10_qval_pairs_clean(self, groups0, groups1, log10_threshold=-30):
qvals = np.reshape(self.qval_pairs(groups0=groups0, groups1=groups1), -1)
qvals = np.nextafter(0, 1, out=qvals, where=qvals == 0)
log10_qval_clean = np.log(qvals) / np.log(10)
log10_qval_clean[np.isnan(log10_qval_cl... | [
"def log10(self):\n if self.check_stack(1, \"log10\"):\n value = self.stack.pop()\n if value > 0:\n self.add_stack(math.log10(value))\n else:\n print(\"Number out of domain for logarithm\")\n self.stack.append(value)",
"def log10... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get log fold changes of the comparison of group1 and group2. | def log_fold_change_pairs(
self,
groups0,
groups1,
base=np.e
):
idx0, idx1 = self._get_group_idx(groups0=groups0, groups1=groups1)
return self._log_fold_change_pairs(idx0=idx0, idx1=idx1, base=base) | [
"def _diff_fold_change(diff, exp_counts, config, out_file):\n assert len(diff[\"control\"]) == 1\n assert len(diff[\"experimental\"]) == 1\n thresh = float(config[\"analysis\"][\"fold_change\"])\n cname = diff[\"control\"][0]\n ename = diff[\"experimental\"][0]\n c_counts = _read_count_file(exp_co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testspecific log fold changevalues accessor for the comparison of groups1 to groups2. | def _log_fold_change_pairs(self, idx0, idx1, base):
assert np.all([x < self._pval.shape[1] for x in idx0])
assert np.all([x < self._pval.shape[1] for x in idx1])
if base == np.e:
return self._logfc[idx0, :, :][:, idx1, :]
else:
return self._logfc[idx0, :, :][:, id... | [
"def log_fold_change_pairs(\n self,\n groups0,\n groups1,\n base=np.e\n ):\n idx0, idx1 = self._get_group_idx(groups0=groups0, groups1=groups1)\n return self._log_fold_change_pairs(idx0=idx0, idx1=idx1, base=base)",
"def test_diverged(self):\n me... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is not available in lazy results evaluation as it would require all pairwise tests to be performed. | def _test(self, **kwargs):
raise ValueError("This function is not available in lazy results evaluation as it would "
"require all pairwise tests to be performed.") | [
"def pval(self, **kwargs):\n raise ValueError(\"This function is not available in lazy results evaluation as it would \"\n \"require all pairwise tests to be performed.\")",
"def test_parallel_resistors(self):\r\n self.assertEqual(calc.evaluator({}, {}, '1||1'), 0.5)\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is not available in lazy results evaluation as it would require all pairwise tests to be performed. | def pval(self, **kwargs):
raise ValueError("This function is not available in lazy results evaluation as it would "
"require all pairwise tests to be performed.") | [
"def _test(self, **kwargs):\n raise ValueError(\"This function is not available in lazy results evaluation as it would \"\n \"require all pairwise tests to be performed.\")",
"def test_parallel_resistors(self):\r\n self.assertEqual(calc.evaluator({}, {}, '1||1'), 0.5)\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Populates a town with people, each with an occupation. | def populate_town(self, people=50):
#1.5 acres farm needed per person
#farmer could farm 20-40 (30) acres
#30/1.5 = 20 people per farm
people_to_assign = people
farms_needed = (self.population + people)/20 + 1
if people_to_assign >= farms_needed:
self... | [
"def populate_homes(self, breakdown):\n #check!#\n\n ###your code here###\n tot=self.nx*self.ny\n for n in range(len(breakdown)):\n breakdown[n]=int(round(tot*breakdown[n]))\n for i in range(breakdown[n]):\n new_home=self.empty_homes.pop(random.randra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Close the serial device | def close(self):
logging.debug("Closing serial device")
ret = os.close(self.fd)
return ret | [
"def serial_close(self):\n self.dongle.close()",
"def close(self):\n self._simple_serial.close()",
"def _close(self):\n \n # Close device\n logger.debug(\"%s: Serial port closing started...\" % \\\n self.__class__.__name__)\n self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle the pin high for the time specified | def toggle_pin(self, pin=TIOCM_DTR, time=1000):
logging.debug("Set pin high")
ioctl(self.fd, TIOCMBIS, struct.pack('I', pin))
sleep(float(time) / 1000.)
logging.debug("Set pin low")
ioctl(self.fd, TIOCMBIC, struct.pack('I', pin)) | [
"def pin_toggle(self, pin):\n port_num = self._convert_pin_port(pin)\n if port_num:\n port_state = gpio.HIGH\n if gpio.input(port_num) == gpio.HIGH:\n port_state = gpio.LOW\n gpio.setcfg(port_num, gpio.OUTPUT)\n gpio.output(port_num, port_stat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a boto3 session by reading the config file at CONFIG_PATH. A boto3.Session(...) creates a session that represents an AWS user that can create/read/update/delete AWS resources. | def create_session():
with open(CONFIG_PATH) as config_file:
config_json = json.load(config_file)
return boto3.Session(
aws_access_key_id=config_json['awsAccessKeyId'],
aws_secret_access_key= config_json['awsSecretAccessKey'],
region_name=config_json['awsRegionNam... | [
"def get_boto3_session():\n # profile_name = util.get_connection_profile(connection, \"aws\")\n # try:\n # session = boto3.Session(profile_name=profile_name)\n # except botocore.exceptions.ProfileNotFound:\n # raise RuntimeError(f\"[AWS] No such profile: {profile_name} (aws configure --profil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return arena dict by name. | def get_arena(self, name):
for arena in self.arenas:
if arena["name"] == name:
return arena
return None | [
"def get_dict(name):\n return dict_container[name]",
"def findAllocation(name):\n return Allocation(Cuebot.getStub('allocation').Find(\n facility_pb2.AllocFindRequest(name=name), timeout=Cuebot.Timeout).allocation)",
"def async_get_area_by_name(self, name: str) -> AreaEntry | None:\n normali... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load file menu actions Arguments | def loadFileMenuActions(window):
menuActions = []
load_spectrum_option = QAction(
QIcon(f"{BUTTONS_PATH}/load_image.png"),
"&Load Spectrum",
window)
load_spectrum_option.setStatusTip("Load Spectrum")
load_spectrum_option.triggered.connect(window.openFile)
menuActions.append(... | [
"def LoadMenu(*args, **kwargs):\n return _xrc.XmlResource_LoadMenu(*args, **kwargs)",
"def callbackMenuLoad(self, *args):\n\n filePath = ''\n fileExtension = 'dat'\n fileFilter = '<format de fichier .%s>' % fileExtension\n\n # afficher l'interface de sélection de fichiers\n try: # 'fileDial... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load spectral extraction menu actions Arguments | def loadSpectralExtractionActions(window):
menuActions = []
extract_spectrum_option = QAction(
QIcon(f"{BUTTONS_PATH}/extract_spectrum.jpg"),
"&Extract Spectrum",
window)
extract_spectrum_option.setStatusTip("Extract Spectrum")
extract_spectrum_option.triggered.connect(window.ex... | [
"def loadFileMenuActions(window):\n menuActions = []\n\n load_spectrum_option = QAction(\n QIcon(f\"{BUTTONS_PATH}/load_image.png\"),\n \"&Load Spectrum\",\n window)\n load_spectrum_option.setStatusTip(\"Load Spectrum\")\n load_spectrum_option.triggered.connect(window.openFile)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load spectrum menu actions Arguments | def loadSpectrumActions(window):
menuActions = []
save_spectrum_option = QAction(
QIcon(f"{BUTTONS_PATH}/save.png"),
"&Save Spectrum",
window)
save_spectrum_option.setStatusTip("Save Spectrum")
save_spectrum_option.triggered.connect(window.saveSpectrum)
save_spectrum_option.... | [
"def loadSpectralExtractionActions(window):\n menuActions = []\n\n extract_spectrum_option = QAction(\n QIcon(f\"{BUTTONS_PATH}/extract_spectrum.jpg\"),\n \"&Extract Spectrum\",\n window)\n extract_spectrum_option.setStatusTip(\"Extract Spectrum\")\n extract_spectrum_option.triggere... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET request on /teams/fbs endpoint. | async def get_teams_fbs(
self,
payload: Union[dict, List[dict]],
concurrent_tasks: Optional[int] = 10,
sort: Optional[str] = None,
) -> Union[List[Dict[str, Any]], List[List[Dict[str, Any]]]]:
return await self._get("/teams/fbs", payload, concurrent_tasks, sort) | [
"def get_teams(self):\n url = 'teams'\n result = self.get(url)\n return result.get('teams', result)",
"def test_api_can_get_teams(self):\n result = self.client().get('/games/1/teams')\n self.assertEqual(result.status_code, 200)\n self.assertEqual(list(ast.literal_eval(res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET request on /teams/matchup endpoint. | async def get_teams_matchup(
self,
payload: Union[dict, List[dict]],
concurrent_tasks: Optional[int] = 10,
sort: Optional[str] = None,
) -> Union[List[Dict[str, Any]], List[List[Dict[str, Any]]]]:
return await self._get("/teams/matchup", payload, concurrent_tasks, sort) | [
"def test_get_requests_for_team_by_owner(self):\n\n params = {'teamID': self.team.id}\n response = self.client.get(reverse('api:user-team-requests-get-requests-for-team'), params)\n self.assertEqual(response.status_code, status.HTTP_200_OK)\n self.assertEqual(len(response.data.get('resul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes a system by id. | def command_rm(self, system_id, *system_ids):
# Intentionally reading the first system_id separately,
# because it's required. The others are optional.
# This ensures that we'll generate an error if someone tries to call
# this without the required argument.
system_ids = (system_... | [
"def test_rest_v10_dd_systems_systemid_mtrees_id_delete(self):\n pass",
"def command_unmount(self, system_id, *system_ids):\n system_ids = (system_id,) + system_ids\n has_failed = False\n for system_id in system_ids:\n try:\n system = SystemModel.create_by_id(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists the available/mounted/unmounted sftp systems. | def command_ls(self, list_what):
if list_what in ('available', 'mounted', 'unmounted'):
callback = getattr(self.environment, 'get_%s_ids' % list_what)
lst = callback()
else:
lst = []
if len(lst) != 0:
print(("\n".join(lst))) | [
"def _get_mounted_fs (self):\n try:\n lines = [line.strip(\"\\n\").split(\" \") for line in open (\"/etc/mtab\", \"r\").readlines()]\n return [mount for mount in lines if mount[2]==\"fuse.sshfs\"]\n except:\n print \"Could not read mtab\"",
"def _get_mounted_fs(self)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mounts the specified sftp system, unless it's already mounted. | def command_mount(self, system_id, *system_ids):
system_ids = (system_id,) + system_ids
has_failed = False
for system_id in system_ids:
try:
system = SystemModel.create_by_id(system_id, self.environment)
controller = SystemControllerModel(system, self.... | [
"def do_mount (self,source):\n user, host, path = self._split_ssh_source (source)\n mp = self._get_possible_mountpoint (user, host)\n if not os.path.exists (mp):\n os.mkdir (mp)\n sshfs = \"%s@%s:%s\" % (user, host, path)\n \n status = os.system ('sshfs -p %d -o ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unmounts the specified sftp system. | def command_unmount(self, system_id, *system_ids):
system_ids = (system_id,) + system_ids
has_failed = False
for system_id in system_ids:
try:
system = SystemModel.create_by_id(system_id, self.environment)
controller = SystemControllerModel(system, sel... | [
"def unmount(self):\n \n template = \"\"\"umount {local_path}\"\"\"\n\n arguments = {\n 'local_path': self.local_path,\n }\n\n command = template.format(**arguments)\n\n r = envoy.run(command, timeout=30)\n\n LOGGER.debug(\"CIFS command: {}\".format(comman... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mounts all sftp file systems known to sftpman. | def command_mount_all(self):
has_failed = False
for system_id in self.environment.get_unmounted_ids():
try:
system = SystemModel.create_by_id(system_id, self.environment)
controller = SystemControllerModel(system, self.environment)
controller.m... | [
"def _populate_tmpfs_mounts(self):\n with open(MOUNTS_FILE, 'r') as mounts:\n for line in mounts.readlines():\n (mount, fstype) = line.split()[1:3]\n if fstype == 'tmpfs':\n fullpath = os.path.join(self.mpoint, mount[1:])\n if not... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unmounts all sftp file systems known to sftpman. | def command_unmount_all(self):
has_failed = False
for system_id in self.environment.get_mounted_ids():
try:
system = SystemModel.create_by_id(system_id, self.environment)
controller = SystemControllerModel(system, self.environment)
controller.u... | [
"def remove_mounts():\n for I in get_mtab().keys():\n if not os.path.isfile(I):\n continue\n\n shutil.copy2(I, I + \".tmp\")\n subprocess.check_call([\"umount\", I])\n os.rename(I + \".tmp\", I)",
"def do_umount_all(self):\n for source, mountpoint, fstype, opts, p1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a corpus of articles from the given directory. | def extract_corpus(corpus_dir = "articles"):
corpus = {}
num_documents = 0
for filename in os.listdir(corpus_dir):
with open(os.path.join(corpus_dir, filename)) as f:
corpus[filename] = re.sub("[^\w]", " ", f.read()).split()
return corpus | [
"def read_corpus(dir):\n corpus = {}\n file_names = glob.glob(f\"{dir}/*\")\n for file_name in file_names:\n name = os.path.splitext(os.path.basename(file_name))[0]\n text = \" \".join(open(file_name, \"rt\").readlines())\n text = text.replace(\"\\n \\n\", \" \")\n text = text.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the articles most relevant to a given document, limited to at most k results. Uses the normal document distance score. | def get_relevant_articles_doc_dist(self, title, k):
inner_product=0
distances=list()
for article in self.corpus_dic:
if not article==title:
angle=self.angle_finder(self.corpus_dic[title], self.corpus_dic[article])
distances.append((article, math.acos(a... | [
"def find_k_neighbours(docs, target, k):\n distance_list = list()\n\n # for each doc, find the similarity and update the distance list.\n for i in xrange(len(docs)):\n doc = docs[i]\n distance_list.append((i, cosine_similarity(doc, target)))\n\n # sort the list and pick top k results.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the articles most relevant to a given query, limited to at most k results. | def search(self, query, k):
docs={}
for term in set(query.split(' ')):
for article in self.tf_idf:
if term in self.tf_idf[article]:
if article in docs:
docs[article]+=self.tf_idf[article][term]
else:
... | [
"def search_top_k(self, query, k):\r\n result = []\r\n for item in self.training_set:\r\n d = utilities.calculate_distance(query, item[:-1])\r\n result.append((d, item))\r\n if len(result) > k:\r\n # replace\r\n result.sort(key = lambda (x... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a dict, keyed by consumer type string code, of internal consumer type ID. | def get_consumer_type_map():
global _CONSUMER_TYPE_MAP
if _CONSUMER_TYPE_MAP is not None:
return _CONSUMER_TYPE_MAP
tbl = db.get_table('consumer_types')
sel = sa.select([tbl.c.id, tbl.c.code])
sess = db.get_session()
_CONSUMER_TYPE_MAP = {r[1]: r[0] for r in sess.execute(sel)}
return... | [
"def _cim_scope_code_type():\n return {\n 'name' : 'cim_scope_code_type',\n 'is_open' : False,\n 'doc' : 'This would cover quality issues with the CIM itself',\n 'members' : [\n ('dataset', None),\n ('software', None),\n ('service', None),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calcula la matriz ensambladora de ecuaciones DME() Parametros | def DME(nodes, elements):
nels = elements.shape[0]
IELCON = np.zeros([nels, 2], dtype=np.integer)
DME_mat = np.zeros([nels, 6], dtype=np.integer)
neq, IBC = eqcounter(nodes)
nnodes = 2
for i in range(nels):
for j in range(nnodes):
IELCON[i, j] = elements[i, j+3]
... | [
"def comp_moments(self):\n rr3dr = self.rr**3*np.log(self.rr[1]/self.rr[0])\n rr4dr = self.rr*rr3dr\n sp2mom0,sp2mom1,cs,cd = [],[],np.sqrt(4*np.pi),np.sqrt(4*np.pi/3.0)\n for sp,nmu in enumerate(self.sp2nmult):\n nfunct=sum(2*self.sp_mu2j[sp]+1)\n mom0 = np.zeros((nfunct))\n d = np.zeros((nfunct,3))\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calcula las fuerzas de empotramiento para una viga de luz L con carga uniformemente distribuida de intensidad W | def empotramiento(W , l ):
F = W*l/2.0
M = W*(l**2)/12.0
return F , M | [
"def calcularFitness(individuo):\n return peorVal - calcularConflictos(individuo)",
"def calcular_lucro_trade_ate_data(investidor, data):\n trades = OperacaoAcao.objects.exclude(data__isnull=True).filter(investidor=investidor, tipo_operacao='V', destinacao='T', data__lt=data).order_by('data')\n lucro_acu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method, responding to a GET request, lists a specific configuration section stored in a database whenever an unique checksum string is provided. Otherwise list of all configuration sections is returned in a response. | def get(self, request, checksum=None):
if checksum is not None:
try:
config = HaProxyConfigModel.objects.get(checksum=checksum)
serializer = HaProxyConfigModelSerializer(config)
except HaProxyConfigModel.DoesNotExist:
raise core_exceptions.... | [
"def get(self, request):\n result = HaProxyConfigModel.objects.all()\n result.query.group_by = ['section', 'section_name']\n\n if not result:\n raise core_exceptions.DoesNotExistException()\n\n result = sorted(result, key=methodcaller('get_section_weight'))\n serializer... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method is responding to a POST request, which in turn creates a new configuration section, after successful pass of a input validation. Processed section is stored in a database if it contains correct information. | def post(self, request):
section = request.DATA.get('section', None)
section_name = request.DATA.get('section_name', None)
configuration = request.DATA.get('configuration', None)
named_sections = settings.HAPROXY_CONFIG_NAMED_SECTIONS
if section in named_sections and not all([x ... | [
"def createSection():\n # first check if everything we need is there\n data = request.json\n if \"agenda_id\" in data and \"section_name\" in data:\n if connectMongo.getAgendaById(data.get(\"agenda_id\")).found:\n if \"position\" in data:\n responseWrapper = connectMongo.cr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method, responding to a GET request, fetches most currently posted sections of every type. Fetched sections are send serialized in a response to a client, thus providing preview of a final configuration. | def get(self, request):
result = HaProxyConfigModel.objects.all()
result.query.group_by = ['section', 'section_name']
if not result:
raise core_exceptions.DoesNotExistException()
result = sorted(result, key=methodcaller('get_section_weight'))
serializer = HaProxyCon... | [
"def get_info_all(self):\n sections = [\"URL\", \"INST\", \"HS_ADMIN\"]\n lResponse = []\n for section in sections:\n lResponse.append(self.get_info(section))\n return lResponse",
"def get_sections(self,):\n self.logger.info(\"\\t[+] get_sections [+]\")\n try:\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method, responding to a POST request, creates a new configuration, which is stored in a file specified by the HAPROXY_CONFIG_PATH variable defined in a settings file specific to a api_haproxy application. Objects from a database are retrieved with a same logic as in the HaProxyConfigGenerateView.get method and formatte... | def post(self, request):
result = HaProxyConfigModel.objects.all()
result.query.group_by = ['section', 'section_name']
if not result:
raise core_exceptions.DoesNotExistException()
result = sorted(result, key=methodcaller('get_section_weight'))
config = ""
tr... | [
"def post(self, request):\n section = request.DATA.get('section', None)\n section_name = request.DATA.get('section_name', None)\n configuration = request.DATA.get('configuration', None)\n\n named_sections = settings.HAPROXY_CONFIG_NAMED_SECTIONS\n if section in named_sections and ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method is calling 'haproxy' command to validate newly generated configuration in a location provided by the HAPROXY_CONFIG_DEV_PATH variable. This method expects previous run of a generation method. Validation is performed by a command specified in the HAPROXY_VALIDATION_CMD variable, which output is then parsed and se... | def get(self, request):
haproxy_executable = getattr(settings, 'HAPROXY_EXECUTABLE', None) or 'haproxy'
haproxy_validation_cmd = getattr(settings, 'HAPROXY_VALIDATION_CMD', None)
haproxy_dev_conf = settings.HAPROXY_CONFIG_DEV_PATH
if not haproxy_validation_cmd:
haproxy_valid... | [
"def _check_config_fired(self):\n self.config_is_valid = True\n print(\n \"\\n############################################\\n\"\n \"# Check configuration\\n\"\n \"############################################\\n\"\n )\n if not os.path.exists(self.input_dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method is calling 'haproxy' command to deploy specified configuration file and reload a HAProxy daemon. Production file listed in the HAPROXY_CONFIG_PATH variable is replaced with a file listed in the HAPROXY_CONFIG_DEV_PATH variable, the one generated with a HaProxyConfigGenerateView. Replaced production file is renam... | def post(self, request):
haproxy_executable = getattr(settings, 'HAPROXY_EXECUTABLE', None) or 'haproxy'
haproxy_reload_cmd = getattr(settings, 'HAPROXY_RELOAD_CMD', None)
haproxy_restart_cmd = getattr(settings, 'HAPROXY_RESTART_CMD', None)
haproxy_dev_config = settings.HAPROXY_CONFIG_DE... | [
"def process_haproxy(self):\n # configure haproxy\n self.configure_haproxy()",
"def reload_config():\n subprocess.run([SUPERVISOR_CMD, \"reload\"])",
"def _update_config(self) -> None:\n # update amtool config file\n amtool_config = yaml.safe_dump({\"alertmanager.url\": f\"http://localhos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a generator of random transformation parameters. | def random_params_gen(self) -> TransformParams:
while True:
do_hor_flip = self.horizontal_flip and (np.random.random() < 0.5)
do_vert_flip = self.vertical_flip and (np.random.random() < 0.5)
yield TransformParams(do_hor_flip=do_hor_flip,
do_... | [
"def random_transform_generator(prng=None, **kwargs):\n\n if prng is None:\n # RandomState automatically seeds using the best available method.\n prng = np.random.RandomState()\n\n# print('- Generator initiated - ')\n# idx = 0\n while True:\n yield random_transform(prng=prng, **kw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a marginsize border around the image, used for providing context. | def add_context_margin(image, margin_size, **pad_kwargs):
return np.pad(image,
((margin_size, margin_size),
(margin_size, margin_size),
(0, 0)), **pad_kwargs) | [
"def add_border(input_img):\n print('\\n Adding border')\n left = 50\n top = left\n right = left\n bottom = 500\n border = (left, top, right, bottom)\n bimg = ImageOps.expand(input_img, border=border, fill='White')\n print('\\n Border: Done')\n return bimg",
"def add_margin(\n pil_im... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add padding to make sure that the image is larger than (min_size min_size). This time, the image is aligned to the top left corner. | def pad_to_square(image, min_size, **pad_kwargs):
h, w = image.shape[:2]
if h >= min_size and w >= min_size:
return image
top = bottom = left = right = 0
if h < min_size:
top = (min_size - h) // 2
bottom = min_size - h -... | [
"def expand_rect_padding(img_path, padding_x, padding_top, padding_bottom, out_path):\n pil_image_frame = Image.open(img_path)\n im_width, im_height = pil_image_frame.size \n \n n_width = im_width + 2 * padding_x\n n_height = im_height + padding_top + padding_bottom\n \n old_size = (im_width, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the current yield of Thom's solar panels %%solar | def solar(self, _mask, _target, _args):
return self.get_sensor("pv_yield_now") | [
"def get_vsolar(self):\n return self.read_register(4098, 1, 3)",
"def radiacion_solar(radiacion):\n return radiacion*0.0864",
"def solar_meter(self):\n return self._solar_meter",
"def curRPM(speed):\n circum = math.pi * 2 * tireRadius\n return speed / (circum * gearRatio)",
"def NextG... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return threadwise and filewise progress. | def fetch_progress(self):
threads = len(opts.thread)
files = len(self.files)
t_width = len(str(threads))
f_width = len(str(files))
t_progress = f"[{self.pos: >{t_width}}/{threads}]"
f_progress = f"[{self.count: >{f_width}}/{files}]"
if self.count:
pr... | [
"def getProgress(self):",
"def get_progress(self):\n raise NotImplementedError",
"def get_sync_progress(self):\n\n if self.total_batches > 0:\n self.progress = round((self.batches_completed / self.total_batches) * 100, 2)\n LOGGER.info(\n f\"{self.stream} SYNC:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert string provided by argparse to a positive int. | def positive_int(string):
try:
value = int(string)
if value <= 0:
raise ValueError
except ValueError:
error = f"invalid positive int value: {string}"
raise argparse.ArgumentTypeError(error)
return value | [
"def type_positive_int(num):\n try:\n n = int(num)\n except ValueError or TypeError:\n message = \"Input is not a positive integer.\"\n raise argparse.ArgumentTypeError(message)\n\n if n >= 0:\n return n\n else:\n message = \"%d is not a positive integer.\" % n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert string provided by argparse to list path. | def valid_list(string):
path = os.path.abspath(string)
try:
with open(path, "r") as f:
_ = f.read(1)
except FileNotFoundError:
raise argparse.ArgumentTypeError(f"{path} does not exist!")
except (OSError, UnicodeError):
raise argparse.ArgumentTypeError(f"{path} is not ... | [
"def cfgPathToList( arg ):\n from types import StringTypes\n listPath = []\n if type( arg ) not in StringTypes:\n return listPath\n while arg.find( '/' ) == 0:\n arg = arg[1:]\n return arg.split( '/' )",
"def args_to_input_file_list(arg):\n # Check if the input file is a directory.\n if os.path.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert string provided by argparse to an archive path. | def valid_archive(string):
path = os.path.abspath(string)
try:
with open(path, "r") as f:
_ = f.read(1)
except FileNotFoundError:
pass
except (OSError, UnicodeError):
raise argparse.ArgumentTypeError(f"{path} is not a valid archive!")
return path | [
"def format_archive_path(name, archive_path): \n if archive_path != '' and archive_path is not None:\n archive_path = archive_path + '/' + name\n else:\n archive_path = name\n return archive_path",
"def path_as_archived( wav_file_path, archive_dir ):\n return os.path.join( archive_dir, os.pat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Log file's hash in the archive. | def log_hash(md5):
with open(opts.archive, "a") as f:
print(md5, file=f) | [
"def _hash_file_content(self, path):\n hasher = hashlib.sha1()\n with open(path, 'rb') as file:\n buffer = file.read(self.hash_block_size)\n while len(buffer) > 0:\n hasher.update(buffer)\n buffer = file.read(self.hash_block_size)\n return has... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clean output directory of any partially downloaded (.part) files. | def clean():
for f in [f for f in os.listdir() if f.endswith(".part")]:
os.remove(f) | [
"def clean(self):\n print(\"Cleaning outputs in %s\" % self.args.output)\n files = glob.glob(self.args.output + \"*.pkl\")\n for f in files:\n if os.path.exists(f):\n os.remove(f)",
"def clean():\n possible_outputs = (\n '{}.html'.format(CONFIG['FULL_PROJEC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates the digest used to do the actual signing. Signing keys can have variable length and tend to be quite long, which makes them notwellsuited for use in crypto algorithms. The digest is essentially the result of running the signing key through a PBKDF, yielding a constantlength hash that can be used for crypto. | def get_digest(self):
# type: () -> Digest
hashes_per_fragment = FRAGMENT_LENGTH // Hash.LEN
key_fragments = self.iter_chunks(FRAGMENT_LENGTH)
# The digest will contain one hash per key fragment.
digest = [0] * HASH_LENGTH * len(key_fragments)
for (i, fragment) in enumerate(key_fragments): # ... | [
"def _produce_key(self, passphrase):\n from hashlib import sha256\n pp = bytes(passphrase, 'utf-8')\n hash_alg = sha256(pp)\n for i in range(self._get_key_stretches()):\n d = hash_alg.digest()\n hash_alg.update(d + pp)\n return hash_alg.digest()",
"def gene... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the geoposition of the weather stations and simulated stations to redis | def add_locs(lat, lon, lat_range, lon_range):
redis_server = SETTINGS['REDIS_IP']
redis_session = redis.StrictRedis(host=redis_server,\
port=6379, db=0)
redis_session.geoadd("all_loc", lon, lat, str(str(lon) + "," + str(lat)))
for lat_i in lat_range:
for lon_j in lon_range:
redis_session.geoadd("all_loc... | [
"def _to_redis(self):\n\n # OSM ways and nodes tables\n self._gdf_to_redis(self._bbid + \"_ways\", self._ways, geometry='geometry')\n self._df_to_redis(self._bbid + \"_nodes\", self._nodes)\n\n # graph to graph nodes and edges tables (storing only ids and edge lengths)\n gdf_nodes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes station geoposition from redis | def delete_loc(lat, lon):
redis_server = SETTINGS['REDIS_IP']
redis_session = redis.StrictRedis(host=redis_server,\
port=6379, db=0)
redis_session.zrem("all_loc", str(str(lon), str(lat))) | [
"def delete_placemarks():\n redis_pipe = redis_conn.pipeline()\n for key in redis_conn.scan_iter(match='placemark*'):\n redis_pipe.delete(key)\n response = redis_pipe.execute()\n\n return response",
"def delete_station(pool, latitude, longitude, station_type):\n\n connection = pool.connectio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run `func` in a daemon process without result return. Note, the decorator intercept the `detach` argument from the `func`. | def detachable(func):
@wraps(func)
def _wrapper(*args, **kwargs):
detach = kwargs.get('detach', False)
if detach is True:
process = Process(target=func, args=args, kwargs=kwargs,
daemon=True, name=f'daemon_for_{func.__qualname__}')
process.s... | [
"def run_async_daemon(func):\n @wraps(func)\n def async_func(*args, **kwargs):\n func_hl = Thread(target=func, args=args, kwargs=kwargs)\n func_hl.daemon = True\n func_hl.start()\n return func_hl\n\n return async_func",
"def _daemonize(func, args, cfg):\n class _Daemonizer(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mask array values matching given conditions. | def mask(self, data):
masking_conditions = self.config.get('mask', None)
if masking_conditions is not None:
mask = np.isnan(data)
masking_conditions = to_list(masking_conditions)
for condition in masking_conditions:
if isinstance(condition, Number):
... | [
"def _mask_values(self, array, masked_values):\n if masked_values is not None:\n try:\n for mv in masked_values:\n array[array == mv] = np.nan\n except ValueError:\n pass\n\n return array",
"def apply_mask(arr, mask):\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse vmin and vmax values from the `self.config`. | def _parse_vrange(self, data):
vmin = self.config.get('vmin', np.nanmin(data))
vmax = self.config.get('vmax', np.nanmax(data))
vrange = self.config.get('vrange', None)
# Parse vmin, vmax
if isinstance(vmin, str):
vmin = np.nanquantile(data, q=float(vmin))
if ... | [
"def parse_vmin_vmax(container, field, vmin, vmax):\n field_dict = container.fields[field]\n field_default_vmin, field_default_vmax = get_field_limits(field)\n if vmin is None:\n if \"valid_min\" in field_dict:\n vmin = field_dict[\"valid_min\"]\n else:\n vmin = field_de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display data as a matrix. | def matrix(self, data):
matrix_keys = ['cmap', 'vmin', 'vmax']
matrix_config = self.config.filter(keys=matrix_keys, prefix='matrix_')
vmin, vmax = self._parse_vrange(data)
matrix_config['vmin'] = vmin
matrix_config['vmax'] = vmax
matrix = self.ax.matshow(data, **matrix_... | [
"def show_matrix(self):\n print str(self.matrix)",
"def show(self):\n return self.matrix",
"def _render_matrix(self):",
"def showMatrix(self, frame, matrix, label=''): \n M = self.matrix2Table(matrix)\n mtable = self.showTable(frame, M, label)\n return mtable",
"def dis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display a combination of loss curve, its smoothed version and learning rate with nice defaults. | def loss(self, data):
loss, smoothed, lr = data
curves = []
curve_keys = ['color', 'linestyle', 'linewidth', 'alpha']
if loss is not None:
loss_name = self.config.get('label', f"loss #{self.index + 1}")
loss_label = f'{loss_name} ⟶ {loss[-1]:2.3f}'
... | [
"def plot_loss_curve(self):\n sns.set_style(\"darkgrid\")\n plt.plot(self.train_losses, label='Train')\n plt.plot(self.val_losses, label='Validation')\n plt.title(\"Loss curve\")\n plt.xlabel('Epochs')\n plt.ylabel('Losses')\n plt.legend()\n plt.show()",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Indicator that subplot has no layers. | def empty(self):
return len(self.layers) == 0 | [
"def is_empty(self):\n return len(self.layers) == 1 and self.layer.is_empty()",
"def test_no_arguments(self):\n fig = plt.figure()\n ax = fig.add_subplot(projection='ternary')\n lines = ax.plot()\n assert lines == []",
"def draw_empty(subplt, row, col, wellnum, e): # pragma: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get dictionary with default parameters corresponding to given mode. | def get_defaults(cls, mode):
mode_defaults = getattr(cls, f"{mode.upper()}_DEFAULTS")
defaults = PlotConfig({**cls.COMMON_DEFAULTS, **mode_defaults})
return defaults | [
"def get_default_config():\r\n def_dict = dict()\r\n for option in options.values():\r\n option.add_def_dict(def_dict)\r\n return def_dict",
"def get_defaults(self):\n default_dict = {}\n args, varargs, keyword, defaults = inspect.getargspec(self.exec_obj)\n if defaults:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add text to subplot. A convenient method for adding text in box (usually on empty subplot). | def add_text(self, text, size=10, x=0.5, y=0.5, ha='center', va='center', bbox='default', **kwargs):
if bbox == 'default':
bbox = {'boxstyle': 'square', 'fc': 'none'}
return self.ax.text(x=x, y=y, s=text, size=size, ha=ha, va=va, bbox=bbox, **kwargs) | [
"def text_plot(self, subplot, lines, rows=30):\n subplot.axis('off')\n line_height = 1.0 / rows\n if (len(lines) > rows):\n line_height = 1.0 / len(lines)\n y = 1.0\n for line in lines:\n y -= line_height\n subplot.text(0.1, y, line)",
"def subpl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate that tuple data item is provided with correct plot mode and convert its objects to arrays. | def parse_tuple(data, mode):
if mode not in ('curve', 'loss'):
msg = "Tuple is a valid data item only in modes ('curve', 'loss')."
raise ValueError(msg)
return tuple(None if item is None else np.array(item) for item in data) | [
"def test_regular_plot_list(self):\n\n data_tups = catalogue._data_tuples_from_fnames(input_path=data_path)\n data_storage = data_path + 'test_1.pkl'\n catalogue.regular_plot_list(data_tups, storage_location=data_storage)\n plot_tups = handling.pickled_data_loader(data_path, 'test_1')\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate input data and put it into a doublenested list. First level of nestedness corresponds to subplots indexing. Second level of nestedness corresponds to layers indexing. | def parse_data(cls, data, combine, mode):
data_list = []
if data is None:
data_list = []
elif isinstance(data, tuple):
data_list = [[cls.parse_tuple(data=data, mode=mode)]]
elif isinstance(data, np.ndarray):
data_list = [[cls.parse_array(data=data, mo... | [
"def _empty_nested_list(\n data: Union[np.ndarray, List[Any], Tuple[Any, ...], Dict[str, Any]]\n) -> Union[List[Any], Tuple[Any, ...], Dict[str, Any]]:\n if isinstance(data, dict):\n return {k: _empty_nested_list(data[k]) for k in data}\n elif isinstance(data, tuple):\n return tuple(_empty_nested_list(x)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Infer default figure height/width ratio from shapes of provided data. | def infer_figure_ratio(mode, n_subplots, data, ncols, nrows, xlim, ylim, transpose):
if mode == 'image':
if not isinstance(xlim, list):
xlim = [xlim] * n_subplots
if not isinstance(ylim, list):
ylim = [ylim] * n_subplots
widths = []
... | [
"def _figsize(profiles, height):\n shape = profiles.data.shape[1:]\n count = profiles.data.shape[0]\n hw_ratio = shape[1] / shape[0]\n width = height * hw_ratio * count\n return (width, 1.1 * height)",
"def infer_figure_size(cls, mode, n_subplots, data, ncols, nrows, ratio, scale,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Infer default figure size from shapes of provided data. | def infer_figure_size(cls, mode, n_subplots, data, ncols, nrows, ratio, scale,
max_fig_width, xlim, ylim, transpose, subplot_width, **kwargs):
_ = kwargs
if ratio is None:
ratio = cls.infer_figure_ratio(mode, n_subplots, data, ncols, nrows, xlim, ylim, transpose)
... | [
"def _figsize(profiles, height):\n shape = profiles.data.shape[1:]\n count = profiles.data.shape[0]\n hw_ratio = shape[1] / shape[0]\n width = height * hw_ratio * count\n return (width, 1.1 * height)",
"def test_size_property(self):\n fig = plt.figure(figsize =(1,2))\n visualizer = Vi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get object bounding box in inches. | def get_bbox(self, obj):
renderer = self.figure.canvas.get_renderer()
transformer = self.figure.dpi_scale_trans.inverted()
return obj.get_window_extent(renderer=renderer).transformed(transformer) | [
"def boundingBox(self):\n pmodel = (glm.vec3(1, -self.y_sign, 0)\n * self.model.pos * self.transform.scale)\n x, y, _ = self.transform.pos + pmodel\n y += -self.y_sign * self.font.table['ascent'] * self.transform.scale[1]\n return x, y, self.pixwidth(), self.pixheight()",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Look through subplots annotation objects and add figsize corrections for their widths and heights. | def adjust_figsize(self):
extra_width = 0
extra_height = 0
if 'suptitle' in self.figure_objects:
suptitle_obj = self.figure_objects['suptitle']
suptitle_height = self.get_bbox(suptitle_obj).height
extra_height += suptitle_height
ax_widths = []
... | [
"def get_subplots_adjust(self):\n\n self.axes.position[0] = int(self.ws_fig_label + self.labtick_y + \\\n self.title_slush_left) / self.fig.size[0]\n\n self.axes.position[1] = \\\n self.axes.position[0] + \\\n int(self.axes.size[0] * self.ncol + \\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get dictionary with default parameters corresponding to given mode. | def get_defaults(cls, mode):
mode_defaults = getattr(cls, f"{mode.upper()}_DEFAULTS")
defaults = PlotConfig({**cls.COMMON_DEFAULTS, **mode_defaults})
return defaults | [
"def get_default_config():\r\n def_dict = dict()\r\n for option in options.values():\r\n option.add_def_dict(def_dict)\r\n return def_dict",
"def get_defaults(self):\n default_dict = {}\n args, varargs, keyword, defaults = inspect.getargspec(self.exec_obj)\n if defaults:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw figure again by creating dummy figure and using its manager to display original figure. | def redraw(self):
dummy_figure = plt.figure()
new_manager = dummy_figure.canvas.manager
new_manager.canvas.figure = self.figure
self.figure.set_canvas(new_manager.canvas)
plt.show(block=False) | [
"def redraw(self, **kwargs):\n #src_dict = self.data_sources\n #self.remove_sources(src_dict.keys())\n self.renderers = {}\n #self.renderers = {}\n self.figure = self.draw_figure(**kwargs)\n #self.add_sources(src_dict)\n # todo does the old figure linger on?\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the algorithm type used. | def algorithm(self) -> str:
return self.auth_type.name | [
"def algorithm_name(self):\n return self._algorithm_name",
"def key_algorithm(self) -> str:\n return pulumi.get(self, \"key_algorithm\")",
"def key_algorithm(self) -> Optional[pulumi.Input['KeyKeyAlgorithm']]:\n return pulumi.get(self, \"key_algorithm\")",
"def compute_type(self) -> str:\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The scope property of the JWT. | def scope(self) -> t.Optional[t.Union[str, int, dict]]:
return self.claims.get("scope") | [
"def scope(self) -> str:\n return pulumi.get(self, \"scope\")",
"def scope(self) -> Sequence[str]:\n return pulumi.get(self, \"scope\")",
"def scope(self):\n try:\n return json.loads(self._scope)\n except ValueError:\n return None",
"def get_scope(self, ):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Signs this JWT, setting the ``iat`` to be the current time when this function is called. Attributes of ``iss``, ``exp``, and ``max_age`` are also set based on the | def sign(self, auth_data: AuthData) -> str:
self.claims = auth_data.extend_claims(self.token_type, self.claims)
if self.token_type == TokenType.REFRESH and "scope" in self.claims:
self.claims.pop("scope")
elif self.token_type == TokenType.AUTH and "rid" in self.claims:
se... | [
"def validate_iat(self, now, leeway):\n if 'iat' in self:\n iat = self['iat']\n if not _validate_numeric_time(iat):\n raise InvalidClaimError('iat')\n if iat > (now + leeway):\n raise InvalidTokenError(\n description='The token... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether this JWT has been signed. | def is_signed(self) -> bool:
return self.signed is not None | [
"def authn_request_signed(self) -> bool:\n return pulumi.get(self, \"authn_request_signed\")",
"def is_signing(self):\n return self.signing_algorithm_info is not None",
"def sign_request(self) -> Optional[bool]:\n return pulumi.get(self, \"sign_request\")",
"def sign_success(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if double precision is supported on specified device. | def is_dbl_supported(device=None):
dev = device if device is not None else get_device()
res = ct.c_bool(False)
safe_call(backend.get().af_get_dbl_support(ct.pointer(res), dev))
return res.value | [
"def mixed_precision_enabled():\n policy = tf.keras.mixed_precision.global_policy()\n return \"float16\" in policy.name",
"def test_double_precision(self):\n conn = self.database.connection()\n cursor = conn.cursor()\n dialect = self.database.dialect()\n dbapi = self.database.dba... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the raw device pointer of an array | def get_device_ptr(a):
ptr = ct.c_void_p(0)
safe_call(backend.get().af_get_device_ptr(ct.pointer(ptr), a.arr))
return ptr | [
"def _array_interface_ptr(array: Any, storage: dtypes.StorageType) -> int:\n if hasattr(array, 'data_ptr'):\n return array.data_ptr()\n if storage == dtypes.StorageType.GPU_Global:\n return array.__cuda_array_interface__['data'][0]\n return array.__array_interface__['data'][0]",
"def _get_d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This functions is deprecated. Please use lock_array instead. | def lock_device_ptr(a):
import warnings
warnings.warn("This function is deprecated. Use lock_array instead.", DeprecationWarning)
lock_array(a) | [
"def unlock_device_ptr(a):\n import warnings\n warnings.warn(\"This function is deprecated. Use unlock_array instead.\", DeprecationWarning)\n unlock_array(a)",
"def lock(self):\n raise NotImplementedError",
"def lock_blocks(self) -> int:",
"def freeze_array(array):\n array.flags.writeable ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This functions is deprecated. Please use unlock_array instead. | def unlock_device_ptr(a):
import warnings
warnings.warn("This function is deprecated. Use unlock_array instead.", DeprecationWarning)
unlock_array(a) | [
"def lock_device_ptr(a):\n import warnings\n warnings.warn(\"This function is deprecated. Use lock_array instead.\", DeprecationWarning)\n lock_array(a)",
"def freeze_array(array):\n array.flags.writeable = False\n return array",
"def unlock(lock):\n lock.release()",
"def svn_client_unlock(a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allocate a buffer on the device with specified number of bytes. | def alloc_device(num_bytes):
ptr = ct.c_void_p(0)
c_num_bytes = c_dim_t(num_bytes)
safe_call(backend.get().af_alloc_device(ct.pointer(ptr), c_num_bytes))
return ptr.value | [
"def netapi32_NetApiBufferAllocate(jitter):\n ret_ad, args = jitter.func_args_stdcall([\"ByteCount\", \"Buffer\"])\n raise RuntimeError('API not implemented')\n jitter.func_ret_stdcall(ret_ad, ret_value)",
"def netapi32_NetapipBufferAllocate(jitter):\n ret_ad, args = jitter.func_args_stdcall([\"ByteCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allocate a buffer on the host with specified number of bytes. | def alloc_host(num_bytes):
ptr = ct.c_void_p(0)
c_num_bytes = c_dim_t(num_bytes)
safe_call(backend.get().af_alloc_host(ct.pointer(ptr), c_num_bytes))
return ptr.value | [
"def netapi32_NetApiBufferAllocate(jitter):\n ret_ad, args = jitter.func_args_stdcall([\"ByteCount\", \"Buffer\"])\n raise RuntimeError('API not implemented')\n jitter.func_ret_stdcall(ret_ad, ret_value)",
"def netapi32_NetapipBufferAllocate(jitter):\n ret_ad, args = jitter.func_args_stdcall([\"ByteCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allocate a buffer on the host using pinned memory with specified number of bytes. | def alloc_pinned(num_bytes):
ptr = ct.c_void_p(0)
c_num_bytes = c_dim_t(num_bytes)
safe_call(backend.get().af_alloc_pinned(ct.pointer(ptr), c_num_bytes))
return ptr.value | [
"def alloc_host(num_bytes):\n ptr = ct.c_void_p(0)\n c_num_bytes = c_dim_t(num_bytes)\n safe_call(backend.get().af_alloc_host(ct.pointer(ptr), c_num_bytes))\n return ptr.value",
"def netapi32_NetapipBufferAllocate(jitter):\n ret_ad, args = jitter.func_args_stdcall([\"ByteCount\", \"Buffer\"])\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Free the device memory allocated by alloc_device | def free_device(ptr):
cptr = ct.c_void_p(ptr)
safe_call(backend.get().af_free_device(cptr)) | [
"def free_device_memory(self):\n pass",
"def free_device_memory(self):\n\n err_code = _cudanet.free_device_memory(self.p_mat)\n if err_code:\n raise generate_exception(err_code)",
"def free(self):\n for device_buffer in self.device_buffers.values():\n device... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Free the host memory allocated by alloc_host | def free_host(ptr):
cptr = ct.c_void_p(ptr)
safe_call(backend.get().af_free_host(cptr)) | [
"def ggml_cuda_host_free(ptr: ffi.CData) -> None:\n ...",
"def ggml_metal_host_free(data: ffi.CData) -> None:\n ...",
"def host_cleanup(self) -> None:\n pass",
"def free_device_memory(self):\n pass",
"def _unallocate_addresses_for_host(self, host):\n hostname = host.hostname\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Free the pinned memory allocated by alloc_pinned | def free_pinned(ptr):
cptr = ct.c_void_p(ptr)
safe_call(backend.get().af_free_pinned(cptr)) | [
"def free_int_mem(self):\n self.lib.FreeInternalMemory()",
"def free(p):\n return _nfc.free(p)",
"def free_device_memory(self):\n pass",
"def __del__(self):\n ffi.entry_free(self._entry_p)",
"def ggml_cuda_host_free(ptr: ffi.CData) -> None:\n ...",
"def ggml_allocr_free(alloc: ffi.C... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initializes class variables pipe, session, and mako lookup Args | def __init__(self, lookup):
self.lookup = lookup
self.pipe = pipe.Pipe()
self.session = app.settings.SESSION_KEY | [
"def __init__(self, **args):\n self.pageConfig = { 'contentType': '', # For plain CGI need: 'Content-type: text/html\\n\\n'\n 'pageName': '',\n 'pageTitle': '',\n 'pageHeaderSnippets': '',\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets current url from cherrypy | def url(self):
return app.settings.cherrypy.url() | [
"def get_current_url():\n return current_url",
"def get_url(self):\n return self.__current_url",
"def url(self) -> str:\n self.log.step('py.url - Get the current page URL')\n return self.webdriver.current_url",
"def get_current_url():\n if current_app.config.get('SERVER_NAME') and (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs update on all tasks, running the timed events | def _update_all_tasks(self) -> None:
for task in self.tasks:
task.update() | [
"def update_tasks():\n num_updated = 0\n for tasktype in __config[\"tasks\"]:\n filt = make_filter(tasktype)\n tasks = __todoist.items.all(filt)\n for task in tasks:\n updated = False\n if \"actions\" in tasktype.keys():\n for action in tasktype[\"acti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |