query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Prior for the bias parameters. | def bias_prior(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_bias_params(self, rng):\n return self.bias_prior.sample(rng)",
"def get_bias(self):",
"def lnprior(self):\n \n return",
"def get_prior(self):\n assert self._prior in self._priors, 'Unsupported prior! Check the _priors attribute for a list of priors.'\n if self._pri... | [
"0.7145243",
"0.6913281",
"0.6774351",
"0.6748974",
"0.6702403",
"0.66862303",
"0.6614578",
"0.6571075",
"0.6492967",
"0.6490462",
"0.6465384",
"0.64598596",
"0.6449114",
"0.64464784",
"0.64464784",
"0.64464784",
"0.64464784",
"0.64291316",
"0.6426328",
"0.64180917",
"0.64042... | 0.888852 | 0 |
Compute log likelihood of given human data under the current reward and bias model parameters. | def log_likelihood(self, data, reward_model, bias_params): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_likelihood_grad_rew(self, data, reward_model, bias_params):",
"def log_likelihood_grad_bias(self, data, reward_model, bias_params):",
"def log_likelihood(self) -> tf.Tensor:\n # K⁻¹ + GᵀΣ⁻¹G = LLᵀ.\n l_post = self._k_inv_post.cholesky\n num_data = self.observations_index.shape[0]\n... | [
"0.78685486",
"0.78272873",
"0.71328354",
"0.71232325",
"0.689875",
"0.68901944",
"0.68160665",
"0.68139684",
"0.6778106",
"0.6777299",
"0.6750175",
"0.6704991",
"0.6681085",
"0.6667924",
"0.6667924",
"0.6596229",
"0.6587814",
"0.6576514",
"0.6561429",
"0.65394455",
"0.649330... | 0.87329894 | 0 |
Compute gradient of log likelihood of human data with respect to reward parameters only. | def log_likelihood_grad_rew(self, data, reward_model, bias_params): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_likelihood_grad_bias(self, data, reward_model, bias_params):",
"def log_prior_grad(self, inputs):",
"def _log_likelihood_gradients(self):\r\n return np.hstack((self.kern.dK_dtheta(dL_dK=self.dL_dK, X=self.X), self.likelihood._gradients(partial=np.diag(self.dL_dK))))",
"def _log_likelihood_grad... | [
"0.74109095",
"0.72840357",
"0.714863",
"0.70513284",
"0.6923464",
"0.6859511",
"0.6782552",
"0.6782552",
"0.67566955",
"0.67507035",
"0.6724112",
"0.6722855",
"0.67147183",
"0.6659342",
"0.6651546",
"0.662774",
"0.66266847",
"0.6626404",
"0.6584056",
"0.6572389",
"0.6559762"... | 0.7899014 | 0 |
Compute gradient of log likelihood of human data with respect to bias parameters only. | def log_likelihood_grad_bias(self, data, reward_model, bias_params): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_likelihood_grad_rew(self, data, reward_model, bias_params):",
"def log_likelihood_gradient(y, tx, w):\n return tx.T.dot(sigmoid(tx.dot(w))-y)",
"def grad_llh(self, params):\n grad = np.clip(self.grad_log_likelihood(params[0], params[1], params[2:]), SMALLEST_NUMBER,\n LA... | [
"0.76194763",
"0.74954695",
"0.73947114",
"0.7375283",
"0.7323246",
"0.7295111",
"0.7181905",
"0.7095969",
"0.7060406",
"0.70076036",
"0.7004792",
"0.6936586",
"0.6926218",
"0.688459",
"0.68763715",
"0.6863551",
"0.6863551",
"0.6850708",
"0.6848207",
"0.68268096",
"0.6816318"... | 0.7864791 | 0 |
Convert a motor step position to absolute mm. | def step2mm(step):
return step / KST101.STEPS_PER_MM | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mm2step(pos):\n return pos * KST101.STEPS_PER_MM",
"def convertDistance(self, mm):\n\t\treturn mm/(self.microstep)",
"def mm_to_m(millimeters):\n return millimeters / 1000.0",
"def m_to_mm(meters):\n return meters * 1000.0",
"def m_to_mm(): \n # Set blender unit in mm\n bpy.cont... | [
"0.6836627",
"0.6787957",
"0.5954462",
"0.58978343",
"0.58848786",
"0.58125484",
"0.5806784",
"0.5804882",
"0.57508826",
"0.57389694",
"0.57245016",
"0.56991845",
"0.5651881",
"0.56379604",
"0.56360954",
"0.5566998",
"0.55438864",
"0.5540775",
"0.55354816",
"0.551437",
"0.549... | 0.69749653 | 0 |
Convert an absolute position to a number of steps. | def mm2step(pos):
return pos * KST101.STEPS_PER_MM | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backtrack_steps():\n\n # Initialize position and number of steps\n x = 0\n n_steps = 0\n\n # Walk until we get to positive 1\n while x < 1:\n x += 2 * np.random.randint(0, 2) - 1\n n_steps += 1\n\n return n_steps",
"def steps(self, length):\n steps = max(1, round(self.l... | [
"0.62912285",
"0.6290479",
"0.624973",
"0.6219855",
"0.615608",
"0.6034702",
"0.5901351",
"0.5886287",
"0.5763119",
"0.57621735",
"0.5735802",
"0.5679249",
"0.5640305",
"0.5630983",
"0.5620864",
"0.5608275",
"0.5586191",
"0.557012",
"0.5564659",
"0.55549425",
"0.55468184",
... | 0.6365761 | 0 |
Open serial port and connect to controller. port should be a serial device node (or serial port name on Windows. If debug is set to true, raw messages are printed to stdout. dst is the motor address, defaults to value for directly attached motor. Inbuilt source assumes this is running on a PC (0x01). This also assumes ... | def __init__(self, port='/dev/ttyUSB0', debug=False, dst=0x50):
# Motor parameters
self.__pos = -1
self.__status = 0xFFFFFFFF
self.__param_lock = threading.Lock()
#
self.__chan = 0x01 # Controller only has one channel, number 1.
self.__debug = debug
self.__src = 0x01 # 0x01 = PC Controll... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_serial(port):\n try:\n ser_port = serial.Serial(port, 9600)\n except:\n raise SerialPortError(\"Error opening \" + port)\n\n print(\"Serial port \"+ser_port.name+\" opened.\")\n return ser_port",
"def open_port():\n global steering_port\n\n try:\n steering_port = s... | [
"0.5667997",
"0.5558157",
"0.55456114",
"0.550317",
"0.5421739",
"0.54124653",
"0.5412042",
"0.5405952",
"0.5341815",
"0.5338311",
"0.53338",
"0.53052425",
"0.5295491",
"0.5289718",
"0.5260456",
"0.5241889",
"0.5239296",
"0.5236732",
"0.5217837",
"0.52106035",
"0.51890135",
... | 0.6983535 | 0 |
Sends a single "short format" (6byte) message to the controller. msg_id is the 2byte message code with byte parameters param1 & 2. Returns nothing. | def __send_short(self, msg_id, param1, param2):
data_out = struct.pack("<HBBBB", msg_id, param1, param2,
self.__dst, self.__src)
if self.__debug:
print ">>> %s" % binascii.hexlify(data_out)
self.__ser.write(data_out)
self.__ser.flush() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_protocol_message(self, msg):\n self.conn.send(msg + \"\\0\")",
"def sendPacket(self, msg:bytes) -> int:\n\n datalen = len(msg) # get data size in bytes\n assert (datalen <= 0xFFF)\n assert (self.deviceAddress <= 0xFF)\n zerobyte = b'\\x00' if (datalen % 2) else b''\n ... | [
"0.6049728",
"0.59328616",
"0.59312874",
"0.59099066",
"0.57913965",
"0.57736427",
"0.57736427",
"0.57736427",
"0.5744338",
"0.5736397",
"0.57175946",
"0.5715378",
"0.57068986",
"0.56846434",
"0.568048",
"0.563515",
"0.56222993",
"0.5615702",
"0.5608957",
"0.55918753",
"0.557... | 0.7714202 | 0 |
Send long sends a packet in the "longformat" (>6byte) format to the controller. msg_id is the 2byte ID code and data should be the raw payload to include. | def __send_long(self, msg_id, data):
# Long format packets have the upper bit of DST set.
data_out = struct.pack("<HHBB", msg_id, len(data),
self.__dst | 0x80, self.__src)
data_out += data
if self.__debug:
print ">>> %s" % binascii.hexlify(data_out)
self.__ser.write(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_long_long(data):\n s_type = \"=%s\" % get_type(\"long_long\")\n return struct.unpack(s_type, data.read(8))[0]",
"def send_msg(self, type, data):\n data = json.dumps(\n {\n \"job\": self._job_id,\n \"idx\": self._job_idx,\n \"tool\": se... | [
"0.60224205",
"0.59574765",
"0.58575726",
"0.57680976",
"0.5708324",
"0.56113696",
"0.55034435",
"0.54983294",
"0.5484324",
"0.5446402",
"0.54245865",
"0.5422365",
"0.5403513",
"0.53701437",
"0.5355218",
"0.53366846",
"0.5335766",
"0.5308729",
"0.53047377",
"0.53045106",
"0.5... | 0.8467898 | 0 |
Decodes a status message payload from the controller and updates the local state of the motor. This function is thread safe. | def __decode_status(self, data):
chan, pos, _, status = struct.unpack("<HllL", data)
if chan != self.__chan:
# Unknown channel, ignore
return
self.__param_lock.acquire()
self.__pos = pos
self.__status = status
self.__param_lock.release() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle(self):\n global latest_status\n data = self.request[0]\n socket = self.request[1]\n logging.info(\"Received {} bytes from {}\".format(len(data), self.client_address[0]))\n jss = interface.joystick_status_pb2.JoystickStatus()\n jss.ParseFromString(data)\n ... | [
"0.609398",
"0.5986228",
"0.57838595",
"0.5703276",
"0.56833404",
"0.56696856",
"0.56654906",
"0.5652155",
"0.5643733",
"0.56151146",
"0.56150764",
"0.5607576",
"0.55890584",
"0.5584113",
"0.5579622",
"0.55616206",
"0.5556814",
"0.5479576",
"0.5468244",
"0.54333353",
"0.54331... | 0.67806643 | 0 |
Enable/disable automatic sending of update messages. Freq sets the frequency of the messages (if enabling, otherwise parameter is ignored. | def en_update_msg(self, enable=True, freq=64):
if enable:
self.__send_short(self.MGMSG_HW_START_UPDATEMSGS, freq, 0x00)
else:
self.__send_short(self.MGMSG_HW_STOP_UPDATEMSGS, 0x00, 0x00) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_update_rate(self, delay_ms):\n self._log_msg_start(\"Setting NMEA message update rate\")\n self._ubx.send(\"CFG-RATE\", measRate=delay_ms, navRate=1, timeRef=1)",
"def set_frequency(miner: Miner, login, frequency):\n #default for S9 is 550\n #\"bitmain-freq\" : \"550\",\n commands ... | [
"0.57071173",
"0.5684532",
"0.56566525",
"0.53899705",
"0.53813714",
"0.5358479",
"0.52614623",
"0.5256853",
"0.5252812",
"0.5252042",
"0.5252042",
"0.5221537",
"0.5211524",
"0.5197722",
"0.51940465",
"0.51871365",
"0.51857275",
"0.5181154",
"0.5165403",
"0.5124927",
"0.51157... | 0.70607775 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_rel(self):\n pass",
"def move(self, rel_pos):\n self.pos = (self.pos[0] + rel_pos[0] * GRID, self.pos[1] + rel_pos[1] * GRID)",
"def move(): #py:move\n RUR._move_()",
"def move(self, *args, **kw):\n return self.execute_action('move', *args, **kw)",
"def move(self, move):\n ... | [
"0.6706781",
"0.64782554",
"0.6448168",
"0.6394091",
"0.6314303",
"0.6187355",
"0.6050017",
"0.5999839",
"0.5980091",
"0.5956632",
"0.5852136",
"0.5849431",
"0.58426493",
"0.58276975",
"0.5789708",
"0.5768117",
"0.57660466",
"0.57549787",
"0.57521296",
"0.57473844",
"0.572272... | 0.7348788 | 0 |
Get the raw status field. | def get_raw_status(self):
self.__param_lock.acquire()
status = self.__status
self.__param_lock.release()
return status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n return STATUS[self.fields['status']]",
"def GetStatus(self):\r\n return self.status",
"def _get_status(self):\n return self.__status",
"def _get_status(self):\n return u'%s' % (self.get_status_display())",
"def get_status(self):\n return self.status",
"def g... | [
"0.7672218",
"0.7490699",
"0.748032",
"0.744804",
"0.7430829",
"0.7430829",
"0.7430829",
"0.74069136",
"0.73661876",
"0.7363749",
"0.7335432",
"0.7310167",
"0.72708374",
"0.72313976",
"0.7231174",
"0.72055376",
"0.7177862",
"0.7118792",
"0.7111588",
"0.70912224",
"0.70912224"... | 0.7841977 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.6728964",
"0.66477424",
"0.6576938",
"0.6454927",
"0.62516576",
"0.61408323",
"0.6023963",
"0.6016287",
"0.5984723",
"0.5843357",
"0.5824486",
"0.5806002",
"0.57836825",
"0.57819766",
"0.5762052",
"0.57460904",
"0.57270026",
"0.5700083",
"0.5627339",
"0.5616919",
"0.561579... | 0.8504266 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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(self):\n return self.dp.state()==PyTango.DevState.MOVING",
... | [
"0.8021455",
"0.7990758",
"0.78967416",
"0.7811878",
"0.77514744",
"0.77400964",
"0.76786697",
"0.73820573",
"0.7361447",
"0.72986686",
"0.72636473",
"0.7260419",
"0.7147643",
"0.71316934",
"0.7110344",
"0.6996685",
"0.69554687",
"0.6842992",
"0.6811508",
"0.6785885",
"0.6743... | 0.8182077 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isHittingLow(self):\n return not self.limLow.get()",
"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 + mean > self.max_frames\n if self.max_samples is not None:\n return self... | [
"0.7111168",
"0.6894667",
"0.6603497",
"0.6460002",
"0.642731",
"0.6356296",
"0.6354876",
"0.631837",
"0.6280892",
"0.62306154",
"0.62204295",
"0.62128323",
"0.61114717",
"0.60777235",
"0.6061501",
"0.60444105",
"0.6014288",
"0.5981819",
"0.5979248",
"0.59686404",
"0.59686404... | 0.7909452 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 + mean > self.max_frames\n if self.max_samples is not None:\n return self.current + mean > self.max_samples\n if self.max_duration is... | [
"0.7283233",
"0.69914913",
"0.681479",
"0.66958755",
"0.66958755",
"0.66477823",
"0.6385735",
"0.63390577",
"0.6277312",
"0.62617755",
"0.62288636",
"0.6198326",
"0.618619",
"0.6174306",
"0.6163272",
"0.6152993",
"0.61480314",
"0.61414504",
"0.60653096",
"0.60301304",
"0.6024... | 0.80463856 | 0 |
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)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.5474152",
"0.53931856",
"0.51991236",
"0.51955795",
"0.51059824",
"0.504715",
"0.5040894",
"0.5038213",
"0.5025281",
"0.50172275",
"0.5015048",
"0.50134563",
"0.50024605",
"0.49699536",
"0.49690533",
"0.49685767",
"0.4957348",
"0.49563438",
"0.49430314",
"0.49390745",
"0.4... | 0.75607777 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.6989692",
"0.6045173",
"0.5687943",
"0.556472",
"0.54778844",
"0.53248304",
"0.5318578",
"0.53016603",
"0.5264302",
"0.526215",
"0.52523136",
"0.5228131",
"0.52134407",
"0.5178666",
"0.51702243",
"0.51615196",
"0.5113447",
"0.50961626",
"0.50368816",
"0.502931",
"0.4999245... | 0.7207554 | 0 |
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):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_system_information(self):\n\t\tsys = platform.uname()\n\t\treturn {\n\t\t\t'hostname': sys.node,\n\t\t\t'operating_system': sys.system,\n\t\t\t'version': sys.version,\n\t\t\t'release': sys.release,\n\t\t\t'processor' : sys.processor,\n\t\t\t'processor_type': sys.machine,\n\t\t}",
"async def get_system_in... | [
"0.62201935",
"0.61952335",
"0.61621404",
"0.6096401",
"0.60581416",
"0.5896032",
"0.5846188",
"0.5841926",
"0.5791068",
"0.57858485",
"0.575557",
"0.5681759",
"0.55713755",
"0.55659604",
"0.5556994",
"0.55544233",
"0.5472976",
"0.54291767",
"0.5414624",
"0.5406574",
"0.53898... | 0.62407875 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def residueNumber(self,i):\n assert(i >= 0 and i < self.nAtoms())\n assert(self._c_structure is not NULL)\n return freesasa_structure_atom_res_number(self._c_structure,i)",
"def get_residues(self, verbose: bool = False) -> Dict[str, Dict[str, int]]:\n\n if (\"POSITION\" in dir(self)):... | [
"0.54806143",
"0.5467313",
"0.5323949",
"0.53003657",
"0.5220275",
"0.50426644",
"0.4976055",
"0.49757478",
"0.49686876",
"0.4938878",
"0.4907939",
"0.48652396",
"0.4852481",
"0.48385173",
"0.48221973",
"0.48175365",
"0.48135212",
"0.47854954",
"0.47852686",
"0.47689292",
"0.... | 0.83161217 | 0 |
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 = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_center(self, mole_object):\r\n if mole_object.plugin_type == \"PyMOL\":\r\n sel = PymolPlugin.PymolPlugin().get_model('all')\r\n cnt = len(sel.atom)\r\n\r\n else:\r\n sel = ChimeraPlugin.ChimeraPlugin().select()\r\n cnt = len(ChimeraPlugin.Chime... | [
"0.64384604",
"0.64240164",
"0.6396276",
"0.6276426",
"0.6274493",
"0.62386316",
"0.60990924",
"0.60602385",
"0.60351795",
"0.59752095",
"0.5972493",
"0.5969629",
"0.5923083",
"0.5916472",
"0.5883609",
"0.58717513",
"0.58654094",
"0.5863337",
"0.58604956",
"0.585273",
"0.5849... | 0.7474768 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_atom_pos(single_parm):\n atom_ind = single_parm[0]\n parm_dict = single_parm[1]\n fitting_parms = single_parm[2]\n\n all_atom_guesses = parm_dict['atom_pos_guess']\n closest_neighbors_mat = parm_dict['nearest_neighbors']\n cropped_clean_image = parm_dict['cropped_cleaned_image']\n\n fi... | [
"0.5567808",
"0.47983155",
"0.47869268",
"0.47782075",
"0.47572154",
"0.4728968",
"0.47010562",
"0.46949974",
"0.46936944",
"0.46822193",
"0.46695724",
"0.46373466",
"0.4623459",
"0.46191993",
"0.46191993",
"0.4606818",
"0.4603816",
"0.45934492",
"0.4574338",
"0.45543566",
"0... | 0.6868359 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_pos(sposcar,ngrid,nspecies,filename):\n pos=np.dot(sposcar[\"lattvec\"],sposcar[\"positions\"])\n ntot=ngrid[0]*ngrid[1]*ngrid[2]*nspecies\n np_icell=np.empty((3,ntot),dtype=np.intc)\n car=pos\n np_ispecies=np.empty(ntot,dtype=np.intc)\n icell=np_icell\n ispecies=np_ispecies\n\n f=StringI... | [
"0.61136675",
"0.5874919",
"0.56104356",
"0.5561035",
"0.5542855",
"0.5438236",
"0.53706586",
"0.5369195",
"0.53598624",
"0.53355455",
"0.5257049",
"0.5247643",
"0.52388114",
"0.5236639",
"0.523591",
"0.52207756",
"0.51882654",
"0.5184576",
"0.5148897",
"0.5122964",
"0.509873... | 0.7970044 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_pdb(self):\n pdb_atoms = []\n for _atom in self.atoms:\n record = _atom.record\n natom = _atom.natom\n atom = _atom.atom\n altloc = ''\n res = _atom.res\n chain = _atom.chain\n nres = _atom.nres\n icode = '... | [
"0.57953185",
"0.5684213",
"0.5374553",
"0.53705657",
"0.529177",
"0.5290548",
"0.5254291",
"0.52341276",
"0.51741534",
"0.5124759",
"0.51020104",
"0.5077708",
"0.5071282",
"0.5050877",
"0.5046464",
"0.504372",
"0.5019011",
"0.49949872",
"0.49287426",
"0.49232158",
"0.4895052... | 0.6165448 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xyz(self):\n\n string = \"\"\n\n # add each atom to the string\n for atom in self.get_atoms():\n string += atom.to_xyz() + \"\\n\"\n\n return string",
"def convert_abc_to_xyz(self, abc):\n abc = np.array(abc)\n xyz = np.dot(abc, self.lattice)\n r... | [
"0.61606437",
"0.61329573",
"0.59665906",
"0.59416085",
"0.5713473",
"0.5598736",
"0.55588543",
"0.55588543",
"0.5537819",
"0.54977095",
"0.54774463",
"0.5474219",
"0.54727614",
"0.54525155",
"0.54187363",
"0.5417712",
"0.5397866",
"0.53959227",
"0.5394153",
"0.5378981",
"0.5... | 0.62685484 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 = minidom.parse(self.dir_path + \"tcr/TemporalPart/{}\".format(file_name))\n elements = parsed_doc.getElementsByTagName('TEXT'... | [
"0.5528274",
"0.51578975",
"0.515771",
"0.5142484",
"0.5117852",
"0.5114951",
"0.5109448",
"0.5106702",
"0.5102137",
"0.5074416",
"0.50572336",
"0.50565565",
"0.5051526",
"0.5041289",
"0.49972454",
"0.49968633",
"0.49704018",
"0.4965646",
"0.49431568",
"0.4937722",
"0.4928139... | 0.7474333 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _advance(self):\n if self._is_at_end():\n return None\n self.current += 1\n return self.source[self.current - 1]",
"def __call__(self, pos):\n return self.__getitem__(pos)",
"def __call__(self, pos):\n return self.__getitem__(pos)",
"def get_next_item(self):\... | [
"0.7241278",
"0.7150545",
"0.7150545",
"0.70804334",
"0.69068307",
"0.68747944",
"0.68480456",
"0.67571187",
"0.67375535",
"0.666056",
"0.66197217",
"0.661842",
"0.65994555",
"0.6536404",
"0.6513105",
"0.650324",
"0.6502467",
"0.6481742",
"0.6467846",
"0.64601415",
"0.6449924... | 0.7214316 | 1 |
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] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.tokens = []",
"def tokens(self):\r\n return Tokens(self)",
"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_typ... | [
"0.6240776",
"0.5975236",
"0.5945143",
"0.5810352",
"0.5737252",
"0.57093227",
"0.56705254",
"0.5573425",
"0.5449878",
"0.53810465",
"0.5329023",
"0.53147113",
"0.5298192",
"0.5280129",
"0.52289265",
"0.521732",
"0.5207287",
"0.5170753",
"0.51586235",
"0.51586235",
"0.5158623... | 0.7436431 | 0 |
Testspecific log fold changevalues accessor for the comparison of groups1 to groups2. | def _log_fold_change_pairs(self, idx0, idx1, base):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 _log_fold_change_pairs(self, idx... | [
"0.69949895",
"0.6249793",
"0.60541356",
"0.5950781",
"0.5831604",
"0.5442597",
"0.5283183",
"0.52102995",
"0.5209725",
"0.51603204",
"0.5132638",
"0.50683683",
"0.50646645",
"0.5033776",
"0.5007502",
"0.4876957",
"0.48738617",
"0.48519972",
"0.48444983",
"0.484306",
"0.48336... | 0.62507975 | 1 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.5887026",
"0.5634521",
"0.55544746",
"0.55433834",
"0.5521364",
"0.54367167",
"0.541822",
"0.5405748",
"0.53385043",
"0.52774316",
"0.52555025",
"0.52445984",
"0.5217019",
"0.5214697",
"0.5193801",
"0.518301",
"0.5155996",
"0.5144684",
"0.5144482",
"0.5121882",
"0.5114323"... | 0.6568186 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other: 'MultiChoiceQuestionGroup') -> DataFrame:\n results = {}\n for key in self._item_dict.keys():\n results[key] = self[key] > other[key]\n return DataFrame(results)",
"def greater_than_operator(ds1, ds2):\n ds3 = ds1 > ds2\n ds3.tolist()\n return ds3"... | [
"0.5950169",
"0.5713799",
"0.56885576",
"0.5662691",
"0.54738563",
"0.5414415",
"0.5407598",
"0.5345762",
"0.53275406",
"0.5284371",
"0.524276",
"0.524276",
"0.52120084",
"0.52021897",
"0.51830614",
"0.5174119",
"0.51637983",
"0.51424766",
"0.51424766",
"0.51181096",
"0.51093... | 0.6123498 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.6721832",
"0.60570866",
"0.6054759",
"0.57944065",
"0.5742798",
"0.56683254",
"0.5653473",
"0.55523425",
"0.55154806",
"0.5372939",
"0.5205264",
"0.5200696",
"0.51965046",
"0.51178384",
"0.50550556",
"0.5038743",
"0.5023422",
"0.50188255",
"0.5012847",
"0.496152",
"0.49394... | 0.73783726 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log10_pval_pairs_clean(self, groups0, groups1, log10_threshold=-30):\n pvals = np.reshape(self.pval_pairs(groups0=groups0, groups1=groups1), -1)\n pvals = np.nextafter(0, 1, out=pvals, where=pvals == 0)\n log10_pval_clean = np.log(pvals) / np.log(10)\n log10_pval_clean[np.isnan(log1... | [
"0.62440205",
"0.5855789",
"0.58411497",
"0.5606895",
"0.5597653",
"0.5523522",
"0.550068",
"0.5472139",
"0.5409403",
"0.53412914",
"0.52233386",
"0.50801784",
"0.5006181",
"0.49927557",
"0.49737132",
"0.49394414",
"0.4917243",
"0.47931045",
"0.47849223",
"0.47834745",
"0.476... | 0.7250843 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _log_fold_change_pairs(self, idx0, idx1, base):\n pass",
"def _log_fold_change_pairs(self, idx0, idx1, base):\n assert np.all([x < self._pval.shape[1] for x in idx0])\n assert np.all([x < self._pval.shape[1] for x in idx1])\n if base == np.e:\n return self._logfc[idx0, ... | [
"0.6063504",
"0.5822839",
"0.5764267",
"0.57543284",
"0.569422",
"0.5648094",
"0.5633152",
"0.51640725",
"0.5130856",
"0.51138204",
"0.5054738",
"0.50521475",
"0.49892077",
"0.49743864",
"0.49691403",
"0.4909984",
"0.49077317",
"0.4853413",
"0.48247337",
"0.47925228",
"0.4767... | 0.7028719 | 0 |
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.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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_lazy_evaluation(self):\n pass",
"def qval(self, **kwargs):\n raise ValueError(\"Thi... | [
"0.68190515",
"0.67816985",
"0.64405423",
"0.6246265",
"0.60033935",
"0.5933881",
"0.59069157",
"0.5833615",
"0.5831289",
"0.58307564",
"0.57850736",
"0.57371837",
"0.57363296",
"0.5729571",
"0.5723311",
"0.5720319",
"0.57197857",
"0.56935716",
"0.568678",
"0.5664584",
"0.564... | 0.767913 | 0 |
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.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test(self, **kwargs):\n raise ValueError(\"This function is not available in lazy results evaluation as it would \"\n \"require all pairwise tests to be performed.\")",
"def test_lazy_evaluation(self):\n pass",
"def qval(self, **kwargs):\n raise ValueError(\"Th... | [
"0.767965",
"0.67819685",
"0.64407974",
"0.62455046",
"0.60024786",
"0.5934688",
"0.59057575",
"0.5833469",
"0.5831336",
"0.5830571",
"0.5785499",
"0.5738272",
"0.5737215",
"0.572943",
"0.57231826",
"0.57191765",
"0.5719",
"0.56933194",
"0.56870496",
"0.56643707",
"0.5648838"... | 0.6819115 | 1 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_occupations():\n for occupation_name, specialties in OCCUPATIONS.items():\n success, result = create_occupation({'name': occupation_name})\n\n validate(success, result)\n\n occupation = result\n\n for specialty_name in specialties:\n success, result = create_spe... | [
"0.6099018",
"0.6092921",
"0.5860446",
"0.58407235",
"0.56971127",
"0.56194526",
"0.55925125",
"0.55564386",
"0.5347061",
"0.53099865",
"0.52961487",
"0.5290489",
"0.52625406",
"0.5249729",
"0.52434844",
"0.52290046",
"0.5179298",
"0.5162534",
"0.5154311",
"0.5132511",
"0.512... | 0.7828526 | 0 |
Close the serial device | def close(self):
logging.debug("Closing serial device")
ret = os.close(self.fd)
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self._simple_serial.close()",
"def close_serial(self):\n if(self.serial):\n self.serial.flush()\n self.serial.close()\n self.serial = False",
"def _close(self):\n \n # Close device\n logger.debug(\"%s: Serial port closin... | [
"0.82155323",
"0.8199249",
"0.81679004",
"0.815901",
"0.8053842",
"0.7989517",
"0.76777536",
"0.76272464",
"0.73756504",
"0.7364761",
"0.7363494",
"0.7278512",
"0.7275632",
"0.72599506",
"0.7213969",
"0.7199315",
"0.7198055",
"0.71659005",
"0.71346027",
"0.7127289",
"0.710208... | 0.8438286 | 0 |
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)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.6745799",
"0.6598046",
"0.65327895",
"0.644801",
"0.6269877",
"0.6264534",
"0.6255492",
"0.6200961",
"0.6131442",
"0.60642034",
"0.606246",
"0.602131",
"0.59948635",
"0.59294283",
"0.59090596",
"0.5857671",
"0.58339113",
"0.5758011",
"0.57565904",
"0.57458687",
"0.5739431"... | 0.7708897 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_boto_session(account):\n aws_access_key_id = account['aws_access_key_id']\n aws_secret_access_key = account['aws_secret_access_key']\n region = account['region']\n #aws_profile = account['aws_profile']\n\n\n session = boto3.Session(\n aws_access_key_id=aws_access_key_id,\n a... | [
"0.6723705",
"0.64949846",
"0.63132095",
"0.62416464",
"0.6064402",
"0.6064096",
"0.60370153",
"0.60361356",
"0.60361356",
"0.59886265",
"0.59638715",
"0.59492457",
"0.58807033",
"0.5781234",
"0.57436913",
"0.5711317",
"0.5711043",
"0.56896317",
"0.56576616",
"0.5604097",
"0.... | 0.8641417 | 0 |
Return arena dict by name. | def get_arena(self, name):
for arena in self.arenas:
if arena["name"] == name:
return arena
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findAllocation(name):\n return Allocation(Cuebot.getStub('allocation').Find(\n facility_pb2.AllocFindRequest(name=name), timeout=Cuebot.Timeout).allocation)",
"def get(self,name):\n return self.dp2(self.name+'Alloc',name)",
"def get(self,name):\n return self.dp2(self.name+'Alloc',name)",
... | [
"0.59147125",
"0.5811709",
"0.5811709",
"0.56101286",
"0.55041265",
"0.5475139",
"0.54715896",
"0.54715896",
"0.54121643",
"0.53521794",
"0.5339359",
"0.529696",
"0.52848184",
"0.5262293",
"0.52473336",
"0.5247159",
"0.5233753",
"0.5225977",
"0.5217891",
"0.521665",
"0.519145... | 0.8245569 | 0 |
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(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadPathMenuAction(self):\n logger.info('loadPathMenuAction')\n fname = QtWidgets.QFileDialog.getOpenFileName(self, 'Open file', '',\"Files (*.csv *.xlsx)\")\n fname = fname[0] # fname is a tuple\n print(f'fname: \"{fname}\"')\n if os.path.isfile(fname):\n self.lo... | [
"0.6513444",
"0.62792724",
"0.6096473",
"0.60934764",
"0.60544956",
"0.60436904",
"0.6032227",
"0.6030907",
"0.5921004",
"0.59160626",
"0.5876743",
"0.58733654",
"0.5851678",
"0.58037984",
"0.5792986",
"0.5790104",
"0.5785466",
"0.57752913",
"0.57744217",
"0.5754925",
"0.5750... | 0.66369814 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 ... | [
"0.63700765",
"0.6351123",
"0.6004237",
"0.59744203",
"0.5931581",
"0.5714404",
"0.56869215",
"0.5645037",
"0.5631729",
"0.5611608",
"0.5565992",
"0.5548684",
"0.5545018",
"0.5535152",
"0.5486934",
"0.54709697",
"0.54601026",
"0.54305273",
"0.5421801",
"0.54137635",
"0.539586... | 0.7097667 | 0 |
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.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.7021571",
"0.67444897",
"0.64807343",
"0.6375863",
"0.5699944",
"0.5699944",
"0.5699944",
"0.5699944",
"0.56131715",
"0.5571277",
"0.5567187",
"0.5564271",
"0.5556916",
"0.5540164",
"0.54787254",
"0.54609734",
"0.54609734",
"0.54609734",
"0.54609734",
"0.54509544",
"0.5404... | 0.6894064 | 1 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_teams():\n name = request.args.get(\"name\", None)\n\n # Search team by name\n if name:\n team = TeamController.get(filters={\"Team\": {\"name\": name}})\n return jsonify(format_team(team)), 200\n\n # Otherwise list of the teams\n teams = TeamController.list()\n return json... | [
"0.6434604",
"0.6388267",
"0.61762327",
"0.61720395",
"0.61568964",
"0.61185724",
"0.6083314",
"0.60724604",
"0.60503757",
"0.59976184",
"0.5965227",
"0.59227645",
"0.5918189",
"0.591341",
"0.5913042",
"0.5910191",
"0.59081984",
"0.5908014",
"0.58412045",
"0.5820166",
"0.5804... | 0.6853774 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.6436351",
"0.63695014",
"0.6290565",
"0.62604076",
"0.62179047",
"0.6205",
"0.60908794",
"0.6068217",
"0.60678715",
"0.60678715",
"0.6051561",
"0.60466087",
"0.59898",
"0.5942221",
"0.5898359",
"0.5892962",
"0.5886576",
"0.58747",
"0.5863409",
"0.5815811",
"0.5747765",
"... | 0.69581914 | 0 |
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_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def delete(self):\r\n\r\n data = await self.request.json()\r\n system_uuid = data.get(\"sys_id\")\r\n sys_del = System.get(System.uuid == system_uuid)\r\n if not sys_del:\r\n response_obj = {\"status\": \"failed\", \"reason\": \"System not Present\"}\r\n retu... | [
"0.6333648",
"0.6226871",
"0.6135284",
"0.61089414",
"0.60413456",
"0.5698818",
"0.56903267",
"0.5560196",
"0.55223936",
"0.5522197",
"0.5488577",
"0.5478271",
"0.5478271",
"0.5478271",
"0.5478271",
"0.5478271",
"0.5472883",
"0.5452223",
"0.5442338",
"0.54351175",
"0.5414097"... | 0.711104 | 0 |
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))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_devices_lsscsi(self):\n\n try:\n message = \"Find SCSI Devices\"\n if self._include_enclosures:\n command = \"lsscsi --generic --transport | egrep 'disk|0x14|enclo'\"\n else:\n command = \"lsscsi --generic --transport | fgrep 'disk|0x14'... | [
"0.618497",
"0.59659976",
"0.5865614",
"0.5833882",
"0.5820731",
"0.5782082",
"0.5773592",
"0.57398087",
"0.57355237",
"0.5712046",
"0.57105076",
"0.57015556",
"0.5694169",
"0.5676211",
"0.5673057",
"0.5666127",
"0.5650673",
"0.5635907",
"0.561596",
"0.5612603",
"0.5606489",
... | 0.6110974 | 1 |
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.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _do_mount(self, cmd, ensure):\n try:\n self._execute(*cmd, run_as_root=True)\n except exception.ProcessExecutionError as exc:\n if ensure and 'already mounted' in exc.stderr:\n LOG.warn(_LW(\"%s is already mounted\"),\n self.gluster_man... | [
"0.6566437",
"0.6467762",
"0.6217779",
"0.6216195",
"0.61498344",
"0.6120859",
"0.6107448",
"0.599617",
"0.5975429",
"0.5970755",
"0.59640074",
"0.59001434",
"0.5896858",
"0.5870929",
"0.58417314",
"0.57515603",
"0.5739245",
"0.5727063",
"0.57201284",
"0.57085544",
"0.5702070... | 0.64753705 | 1 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unmount(self, mount_point):\n self.fs.remove_nfs_share()\n self.fs.status()\n if self.fs.state == service_states.RUNNING or self.fs.state == service_states.SHUTTING_DOWN:\n log.debug(\"Unmounting volume-based FS from {0}\".format(mount_point))\n if self.fs._is_mounted... | [
"0.6581808",
"0.6491647",
"0.6454659",
"0.6251959",
"0.6224045",
"0.62143457",
"0.6203037",
"0.61537445",
"0.6114408",
"0.5686773",
"0.56794316",
"0.56646806",
"0.56576675",
"0.5613799",
"0.5497836",
"0.54458624",
"0.5376853",
"0.5282214",
"0.52707547",
"0.5253421",
"0.522183... | 0.7079284 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mounts(self) -> list[str]:\n _args: list[Arg] = []\n _ctx = self._select(\"mounts\", _args)\n return _ctx.execute_sync(list[str])",
"def mount_nfs_share(self, share_config):\n remote_host = share_config.get('remote_host')\n remote_dir = share_config.get('remote_dir')\n ... | [
"0.5953714",
"0.5914771",
"0.5831599",
"0.58311796",
"0.57717586",
"0.5672395",
"0.56632507",
"0.56205845",
"0.56113344",
"0.560519",
"0.5598684",
"0.5583874",
"0.55831623",
"0.55426544",
"0.5529732",
"0.5500472",
"0.54955465",
"0.54947764",
"0.5494164",
"0.54322326",
"0.5423... | 0.6358994 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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(system_id, self.environment)\n controller = SystemControllerModel(... | [
"0.6472145",
"0.6396423",
"0.6367086",
"0.6021979",
"0.5951132",
"0.5794788",
"0.5780824",
"0.57449716",
"0.5741651",
"0.57306755",
"0.56483984",
"0.5579352",
"0.556834",
"0.54927665",
"0.5474522",
"0.5457742",
"0.53874606",
"0.5376814",
"0.53024745",
"0.5300906",
"0.5278201"... | 0.7123945 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_corpus():\n all_text = []\n\n for _, _, files in os.walk(DATA_DIRECTORY):\n for f in files:\n with open(os.path.join(DATA_DIRECTORY, f), 'r') as article:\n # Quotation marks rarely come out as pairs in finished chains.\n # So we remove them before addin... | [
"0.7253252",
"0.7209412",
"0.69147074",
"0.68913954",
"0.6539011",
"0.6514319",
"0.62478197",
"0.6155796",
"0.6103806",
"0.60568833",
"0.6045933",
"0.60252535",
"0.59213716",
"0.5892855",
"0.58163637",
"0.5783298",
"0.57804555",
"0.57762396",
"0.57349795",
"0.570724",
"0.5700... | 0.73968977 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top_k(weight_query, doc_dict, k):\n \n # find fraction of all inlinks to doc_id\n total_num_inlinks = 0\n frac_inlinks = {}\n with open(num_inlinks_file) as f:\n doc_ids_set = doc_dict.keys()\n for i, line in enumerate(f):\n total_num_inlinks += int(line.strip())\n ... | [
"0.7151031",
"0.67771554",
"0.67097217",
"0.6657147",
"0.66031384",
"0.6587237",
"0.6466546",
"0.62512887",
"0.62252647",
"0.61595297",
"0.61159575",
"0.6114601",
"0.60471696",
"0.6041649",
"0.59941673",
"0.5989598",
"0.5938736",
"0.59220326",
"0.5905752",
"0.5878527",
"0.585... | 0.71278286 | 1 |
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:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topArticles():\n c = db.cursor()\n c.execute(\"select titles.title, tophits.hits\\\n from tophits, titles\\\n where tophits.path = titles.slug\\\n order by hits desc limit 3;\")\n results = c.fetchall()\n c.close()\n return results",
"def query_article():\r\n conn, cur ... | [
"0.6321517",
"0.6279716",
"0.61921644",
"0.60427564",
"0.6033009",
"0.6025279",
"0.6020433",
"0.5995133",
"0.59836006",
"0.5961271",
"0.5954709",
"0.5876232",
"0.5865966",
"0.58478934",
"0.5786858",
"0.57654583",
"0.57542443",
"0.5742749",
"0.5724587",
"0.5723642",
"0.5714418... | 0.6559466 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 ... | [
"0.6008549",
"0.5957679",
"0.56259274",
"0.54564923",
"0.5407847",
"0.53947175",
"0.53768367",
"0.53703624",
"0.533935",
"0.53291124",
"0.5319731",
"0.53171265",
"0.5306671",
"0.52690893",
"0.5248343",
"0.52283514",
"0.5219412",
"0.52171385",
"0.5178109",
"0.51610243",
"0.513... | 0.79115963 | 0 |
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]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DM(self, masses=None):\n N = len(self.diameters)\n rs = self.rs\n d = self.ndim\n M = np.zeros((d * N, d * N))\n\n for i in range(N):\n sigi = self.diameters[i]\n for j in range(i):\n rijvec = rs[i, :] - rs[j, :]\n rijvec = ... | [
"0.6329051",
"0.6210076",
"0.61589414",
"0.6007523",
"0.5959302",
"0.5913893",
"0.5909286",
"0.58626336",
"0.58174753",
"0.58128446",
"0.5774221",
"0.5751773",
"0.5743788",
"0.5735388",
"0.57345796",
"0.5699472",
"0.56839186",
"0.56667924",
"0.5664855",
"0.5659393",
"0.565214... | 0.70379823 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def desp_inicial(x): #Definición del desplazamiento inicial de la cuerda\r\n return np.exp(-1000*(x - longitud/2)**2)",
"def calculo(self):\n return self.peso / (self.altura * self.altura)",
"def iniciar():\n \n for sala in range(3):\n for fila_letra in range(21):\n ... | [
"0.6208886",
"0.609836",
"0.6062026",
"0.59592056",
"0.5947472",
"0.5926843",
"0.5910801",
"0.58664674",
"0.5863342",
"0.5861819",
"0.58336264",
"0.5825455",
"0.5816266",
"0.5803645",
"0.5786322",
"0.5775233",
"0.57579565",
"0.5752779",
"0.5740127",
"0.573192",
"0.57301676",
... | 0.7148577 | 0 |
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.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.62403286",
"0.56234366",
"0.55312985",
"0.539092",
"0.53848994",
"0.5349132",
"0.5306232",
"0.5242164",
"0.5234569",
"0.5225853",
"0.5217837",
"0.52105284",
"0.51794785",
"0.5155643",
"0.51431656",
"0.5136061",
"0.5097865",
"0.5092379",
"0.5079582",
"0.50626695",
"0.503856... | 0.66351825 | 0 |
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 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.6725969",
"0.6464853",
"0.644296",
"0.62473387",
"0.6089448",
"0.6043572",
"0.5871184",
"0.5782022",
"0.5725459",
"0.57011575",
"0.5677405",
"0.5675833",
"0.5635416",
"0.5621919",
"0.56195873",
"0.559577",
"0.54171246",
"0.5346842",
"0.5346291",
"0.53360975",
"0.53126884",... | 0.68659496 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sections():\n return Section.objects.all()",
"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(self):\n\n try:\... | [
"0.6188991",
"0.6131551",
"0.6037649",
"0.5948555",
"0.57247794",
"0.5720335",
"0.5681312",
"0.565332",
"0.56390315",
"0.56283927",
"0.56221765",
"0.5592725",
"0.5589349",
"0.5589226",
"0.5560772",
"0.5557963",
"0.5531877",
"0.55259585",
"0.55259585",
"0.5521563",
"0.55128056... | 0.6444927 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 ... | [
"0.7492306",
"0.6734212",
"0.64854056",
"0.6450921",
"0.64481264",
"0.6123364",
"0.57858616",
"0.57519007",
"0.573925",
"0.57196426",
"0.5629057",
"0.5629057",
"0.5549501",
"0.54814905",
"0.5459496",
"0.5450508",
"0.54333293",
"0.5412263",
"0.54030377",
"0.54023594",
"0.53716... | 0.7631742 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self, request):\n haproxy_executable = getattr(settings, 'HAPROXY_EXECUTABLE', None) or 'haproxy'\n haproxy_reload_cmd = getattr(settings, 'HAPROXY_RELOAD_CMD', None)\n haproxy_restart_cmd = getattr(settings, 'HAPROXY_RESTART_CMD', None)\n haproxy_dev_config = settings.HAPROXY_... | [
"0.5667137",
"0.56011283",
"0.5591421",
"0.55883235",
"0.55883235",
"0.5551753",
"0.5311261",
"0.5295119",
"0.52656406",
"0.5260334",
"0.52442765",
"0.52212113",
"0.52199805",
"0.52113765",
"0.5185396",
"0.5135968",
"0.51334864",
"0.5130904",
"0.5129695",
"0.51038015",
"0.509... | 0.62813944 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload_config():\n subprocess.run([SUPERVISOR_CMD, \"reload\"])",
"def test_config_reload(self):\n server = self.start_server(\"hello world\", 200)\n try:\n self.setup_dynamic()\n\n cfg_file = \"test.yml\"\n\n self.write_dyn_config(\n cfg_file,... | [
"0.58359826",
"0.56984",
"0.5663765",
"0.5602141",
"0.55664796",
"0.5563094",
"0.54461473",
"0.5435206",
"0.5401629",
"0.53983617",
"0.53780055",
"0.5357909",
"0.53575015",
"0.5312825",
"0.52859896",
"0.5267541",
"0.52499473",
"0.522094",
"0.5200656",
"0.51870495",
"0.5161361... | 0.75664705 | 0 |
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_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_params(self, randomize=True):\n pass",
"def get_params(degrees, translate, scale_ranges, shears, img_size):\n angle = np.random.uniform(degrees[0], degrees[1])\n if translate is not None:\n max_dx = translate[0] * img_size[0]\n max_dy = translate[1] * img_s... | [
"0.6691546",
"0.6328596",
"0.62700427",
"0.61893535",
"0.6151235",
"0.6089783",
"0.6080706",
"0.6080518",
"0.60701746",
"0.6050777",
"0.6039089",
"0.6033836",
"0.6028342",
"0.5992769",
"0.59566844",
"0.5852374",
"0.5842919",
"0.5822105",
"0.58180034",
"0.5779154",
"0.5763288"... | 0.72567004 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_border(original_img,border_size):\r\n new_image=SimpleImage.blank(2 * border_size + original_img.width ,2 * border_size + original_img.height )\r\n\r\n \"\"\"\r\n Task 2: Creating black border\r\n \r\n \"\"\"\r\n for y in range(new_image.height):\r\n for x in range(new_image.width)... | [
"0.6509651",
"0.6417757",
"0.6322382",
"0.6270739",
"0.6252455",
"0.6143277",
"0.6137266",
"0.6049669",
"0.6046908",
"0.6022713",
"0.6003035",
"0.5953789",
"0.58436203",
"0.5841631",
"0.5831432",
"0.58227783",
"0.5812526",
"0.5805172",
"0.579966",
"0.57697856",
"0.57392627",
... | 0.7104247 | 0 |
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 -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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, ... | [
"0.66704255",
"0.63966334",
"0.63014215",
"0.62734103",
"0.62662476",
"0.62223077",
"0.61933887",
"0.61294687",
"0.6101516",
"0.6078033",
"0.6063685",
"0.5999932",
"0.5992063",
"0.5885428",
"0.5766061",
"0.5747359",
"0.57435596",
"0.57005745",
"0.56847334",
"0.56829435",
"0.5... | 0.658283 | 1 |
Get the current yield of Thom's solar panels %%solar | def solar(self, _mask, _target, _args):
return self.get_sensor("pv_yield_now") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vsolar(self):\n return self.read_register(4098, 1, 3)",
"def getSolar():\n ina = INA219(address=int('0x44', 16))\n sol_bus_v = ina.getBusVoltage_V()\n sol_shunt_mv = ina.getShuntVoltage_mV()\n sol_curr_ma = ina.getCurrent_mA()\n sol_volt_v = (ina.getBusVoltage_V() + ina.getShuntVolt... | [
"0.63032496",
"0.5552821",
"0.5403807",
"0.5316095",
"0.517491",
"0.51014036",
"0.5095199",
"0.50801754",
"0.5067749",
"0.50648355",
"0.5048093",
"0.5048093",
"0.5034657",
"0.5023012",
"0.5020465",
"0.50044537",
"0.49975526",
"0.49975526",
"0.49975526",
"0.49765056",
"0.49645... | 0.604875 | 1 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getProgress(self):",
"def progress(self):\n return self.runProgress",
"def progress(self):\n return self.runProgress",
"def get_progress(self):\n\t\treturn call_sdk_function('PrlJob_GetProgress', self.handle)",
"def GetProgress(self):\n return self.new_progress",
"def get_progress(se... | [
"0.7222213",
"0.6851995",
"0.6851995",
"0.67559695",
"0.67393136",
"0.66488534",
"0.6636145",
"0.66144556",
"0.65944254",
"0.6563615",
"0.6514536",
"0.645056",
"0.6436701",
"0.64291596",
"0.64291596",
"0.64291596",
"0.64291596",
"0.6427224",
"0.6396373",
"0.63448334",
"0.6309... | 0.7387987 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def positive_int(arg):\n try:\n n = int(arg)\n assert n > 0\n return n\n except (ValueError, AssertionError):\n raise argparse.ArgumentTypeError('%s is not a positive integer' % arg)",
"def _pos_int(value):\n try:\n value_int = int(value)\n ... | [
"0.7681833",
"0.7234904",
"0.72265464",
"0.7197883",
"0.7188313",
"0.7177815",
"0.7159357",
"0.7076082",
"0.7001156",
"0.6993816",
"0.69618225",
"0.69496393",
"0.691581",
"0.6885346",
"0.68682706",
"0.68420994",
"0.6830663",
"0.6800901",
"0.6761565",
"0.67024887",
"0.6690808"... | 0.7954573 | 0 |
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 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.69539857",
"0.6451224",
"0.61884904",
"0.60714847",
"0.60518765",
"0.58130485",
"0.5646879",
"0.5635517",
"0.56154025",
"0.5584135",
"0.55784845",
"0.555513",
"0.5550358",
"0.54860425",
"0.54695076",
"0.5451658",
"0.5445985",
"0.539641",
"0.53946924",
"0.53903645",
"0.5386... | 0.66611814 | 1 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_as_archived( wav_file_path, archive_dir ):\n return os.path.join( archive_dir, os.path.basename( wav_file_path ) )",
"def archive_path(self):\n return os.path.join(self.destination_directory, self.__archive_name__)",
"def file_or_dir(string: str) -> str:\n path = Path(string)\n\n if pa... | [
"0.6129519",
"0.5704163",
"0.5690393",
"0.56112576",
"0.545358",
"0.53399587",
"0.53149766",
"0.52935505",
"0.524696",
"0.5081674",
"0.50731564",
"0.5038358",
"0.503345",
"0.50317794",
"0.50254077",
"0.50245583",
"0.50245583",
"0.50177157",
"0.5014116",
"0.49785918",
"0.49689... | 0.70374644 | 0 |
Log file's hash in the archive. | def log_hash(md5):
with open(opts.archive, "a") as f:
print(md5, file=f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _actual_hash(self):\n return hash_of_file(join(self._temp_path, self._downloaded_filename()))",
"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 ... | [
"0.6729975",
"0.6628595",
"0.6575332",
"0.6538387",
"0.6515972",
"0.63827455",
"0.6349315",
"0.6292721",
"0.6279556",
"0.6267647",
"0.6253589",
"0.6222778",
"0.62101406",
"0.6204525",
"0.62010854",
"0.61828303",
"0.6141658",
"0.6140468",
"0.61335915",
"0.6116119",
"0.61152744... | 0.7584223 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_folder(self):\n # Remove the 1st output\n # Remove the 2nd output\n # Remove the calibrated output\n try:\n os.remove(\"output1.csv\")\n except:\n pass\n try: \n os.remove(\"output2.csv\")\n except:\n ... | [
"0.7156941",
"0.7044507",
"0.7019804",
"0.69555634",
"0.6929709",
"0.6704748",
"0.6630157",
"0.6579093",
"0.6548383",
"0.648042",
"0.64498675",
"0.64352155",
"0.6434159",
"0.63882387",
"0.63826346",
"0.6339727",
"0.63320976",
"0.63217694",
"0.6310085",
"0.63005227",
"0.629593... | 0.7678481 | 0 |
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): # ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 dige... | [
"0.67405194",
"0.62486494",
"0.617681",
"0.6067078",
"0.6066259",
"0.60640377",
"0.60640377",
"0.60640377",
"0.60533994",
"0.6005925",
"0.5967693",
"0.5964048",
"0.5964048",
"0.5952651",
"0.5932788",
"0.5916166",
"0.5897117",
"0.58803266",
"0.5868812",
"0.58439136",
"0.584038... | 0.6309193 | 1 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __save_all():\n \n # Use directory listing from stilt-web data. Ignore stations that\n # may be in the queue but are not finished yet.\n allStations = [s for s in os.listdir(CPC.STILTPATH) if os.path.exists(CPC.STILTPATH + s)]\n\n \n # read lis of ICOS stations\n icosStations = cps... | [
"0.58511627",
"0.56509686",
"0.56482005",
"0.54196817",
"0.5374002",
"0.53103495",
"0.5305322",
"0.527654",
"0.52756226",
"0.52215713",
"0.52076447",
"0.52011615",
"0.5188555",
"0.5181619",
"0.5154061",
"0.5150314",
"0.5137551",
"0.5136873",
"0.511172",
"0.5076474",
"0.506175... | 0.5720205 | 1 |
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))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_station(pool, latitude, longitude, station_type):\n\n connection = pool.connection()\n try:\n initial_value = str(station_type.value)\n\n if len(initial_value)==6:\n pattern = \"{}_____\".format(initial_value[0])\n elif len(initial_value)==7:\n pattern = ... | [
"0.62629634",
"0.60515696",
"0.5921267",
"0.5803427",
"0.5762468",
"0.57237226",
"0.56292945",
"0.56234115",
"0.5609528",
"0.55792594",
"0.5558843",
"0.5542548",
"0.55411583",
"0.55355954",
"0.551682",
"0.5483498",
"0.5467039",
"0.5462422",
"0.5411243",
"0.54018617",
"0.53947... | 0.76991034 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_threaded(func):\n\tdef wrapper(*args, **kwargs):\n\t\tt=threading.Thread(target=func, args=args, daemon=True)\n\t\tt.start()\n\t\treturn t\n\treturn wrapper",
"def __init__(self, func, func_arg=None, pidfile=None, stdin=None, stdout=None, stderr=None, uid=None, gid=None, umask=None, working_directory=Non... | [
"0.59063864",
"0.57455873",
"0.57180834",
"0.56619036",
"0.55565745",
"0.54979205",
"0.54754674",
"0.547256",
"0.538667",
"0.5365159",
"0.53397226",
"0.5289039",
"0.5286036",
"0.52180165",
"0.5209933",
"0.52076864",
"0.5202534",
"0.5185509",
"0.51681274",
"0.5101328",
"0.5039... | 0.84451884 | 0 |
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):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_mask(self, array):\n # assert that the array and Mask.data are of the same size\n assert array.shape == self.shape, \"array and mask should be of the same shape\"\n\n array_copy = array.copy()\n\n # Applying mask\n # apply func_true where Mask.data is True\n arra... | [
"0.68884504",
"0.6524658",
"0.6461629",
"0.6438463",
"0.6308311",
"0.6174998",
"0.61717814",
"0.6124314",
"0.61143506",
"0.61106086",
"0.6101257",
"0.60421824",
"0.5942766",
"0.5927954",
"0.5918451",
"0.590757",
"0.584515",
"0.5843726",
"0.5840796",
"0.5800418",
"0.57931817",... | 0.68603146 | 1 |
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 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.71322656",
"0.61736685",
"0.6138492",
"0.61076105",
"0.5750814",
"0.568952",
"0.56617624",
"0.55941033",
"0.55059963",
"0.5463449",
"0.539009",
"0.5383637",
"0.5322304",
"0.53115046",
"0.5298138",
"0.5298138",
"0.5298138",
"0.5298138",
"0.52651274",
"0.52602386",
"0.525540... | 0.75941694 | 0 |
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_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayAsMatrix(lists):\r\n for lst in lists:\r\n print(lst)",
"def PrintMatrix(self):\n # loop through the rows\n for i in range(self.rows):\n # intialise the matrix\n mat = []\n # loop through the column\n for j in range(self.cols):\n ... | [
"0.6923901",
"0.6834514",
"0.6786784",
"0.67798805",
"0.6691211",
"0.666952",
"0.63159776",
"0.63054544",
"0.6273648",
"0.62679046",
"0.6151623",
"0.61450595",
"0.61378247",
"0.6128617",
"0.6126734",
"0.61020434",
"0.61020434",
"0.60916257",
"0.6078156",
"0.6074055",
"0.60215... | 0.7433391 | 0 |
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}'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_loss_values(model, figure_size = (18, 5)):\r\n\r\n # Check that the model is not a Non-Parametric model\r\n if 'kaplan' in model.name.lower() :\r\n error = \"This function cannot only take as input a Non-Parametric model\"\r\n raise NotImplementedError(error)\r\n\r\n if 'simulati... | [
"0.69252026",
"0.6853247",
"0.67892003",
"0.6626671",
"0.656507",
"0.6550817",
"0.6533426",
"0.6485394",
"0.6469382",
"0.64647764",
"0.64586174",
"0.6443694",
"0.63998497",
"0.6375449",
"0.6358307",
"0.633523",
"0.63232523",
"0.6311238",
"0.6242471",
"0.6238472",
"0.6234998",... | 0.72205526 | 0 |
Indicator that subplot has no layers. | def empty(self):
return len(self.layers) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_arguments(self):\n fig = plt.figure()\n ax = fig.add_subplot(projection='ternary')\n lines = ax.plot()\n assert lines == []",
"def oiDataIsNull(self):\n self.charts_1.getGV().hide()\n self.charts_2.getGV().hide()",
"def isscalar(self):\n return not s... | [
"0.65501446",
"0.62779915",
"0.6195725",
"0.6091727",
"0.60703593",
"0.60156053",
"0.5949347",
"0.5874869",
"0.58582",
"0.5817451",
"0.57758826",
"0.5755941",
"0.57396364",
"0.570806",
"0.5685906",
"0.5680052",
"0.56657314",
"0.5643927",
"0.5640388",
"0.56380016",
"0.56324893... | 0.658061 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDefaultParameterValues(self):\r\n dct = {}\r\n self.initializeRoadRunnerModel()\r\n self.roadrunnerModel.reset()\r\n for parameterName in self.parametersToFit:\r\n dct[parameterName] = self.roadrunnerModel.model[parameterName]\r\n return dct",
"def defaults() ... | [
"0.6622207",
"0.65702045",
"0.6535674",
"0.6516511",
"0.64357203",
"0.64187336",
"0.6382547",
"0.6349992",
"0.6341253",
"0.62935245",
"0.6264641",
"0.6236438",
"0.61953825",
"0.6156402",
"0.6131508",
"0.6121125",
"0.6118047",
"0.60627514",
"0.6037397",
"0.60161936",
"0.599709... | 0.7112436 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def figtext(self, x, y, s='text', fontsize=9, halign='left'):\n plt.figtext(x=x, y=y, s=s, fontsize=self.ftsize1, horizontalalignment=halign)",
"def subplotLabel(axs):\n for ii, ax in enumerate(axs):\n ax.text(-0.2, 1.2, ascii_uppercase[ii], transform=ax.transAxes, fontsize=16, fontweight=\"bold... | [
"0.69198513",
"0.6532367",
"0.64458",
"0.6441209",
"0.6327722",
"0.6327722",
"0.63151264",
"0.62899375",
"0.62591666",
"0.6157965",
"0.6092315",
"0.6053249",
"0.6026087",
"0.6019728",
"0.6001217",
"0.5991999",
"0.598995",
"0.5858364",
"0.58347195",
"0.5834376",
"0.5803389",
... | 0.6927356 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_array(data, mode):\n if data.ndim == 1:\n if mode == 'image':\n return data.reshape(-1, 1)\n if mode == 'curve':\n return (range(len(data)), data)\n if mode == 'loss':\n return (data, None)\n\n if data.ndim == 3:\... | [
"0.6024037",
"0.5952245",
"0.5923267",
"0.5890367",
"0.5852105",
"0.5826286",
"0.57980806",
"0.5752113",
"0.57256114",
"0.5707672",
"0.5705703",
"0.5657866",
"0.5624849",
"0.56109244",
"0.5584846",
"0.5547544",
"0.55464506",
"0.5542138",
"0.55336475",
"0.5533631",
"0.55329055... | 0.6731612 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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)... | [
"0.58749235",
"0.5354056",
"0.5168519",
"0.512949",
"0.5050655",
"0.5018904",
"0.50103253",
"0.500941",
"0.49912065",
"0.49835318",
"0.49733475",
"0.49632737",
"0.49273327",
"0.49136162",
"0.48843756",
"0.48757097",
"0.48755848",
"0.48745632",
"0.48717594",
"0.48655945",
"0.4... | 0.55995214 | 1 |
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 = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 ... | [
"0.6323186",
"0.61019343",
"0.57060575",
"0.5685654",
"0.5659959",
"0.5640933",
"0.56351674",
"0.5612571",
"0.5591093",
"0.55602455",
"0.5520204",
"0.5471229",
"0.5397019",
"0.5391396",
"0.53784883",
"0.53668356",
"0.5360551",
"0.5352041",
"0.533851",
"0.53053576",
"0.5290935... | 0.6751351 | 0 |
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)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_shape():\n return DATA_SHAPE",
"def shape_for_keras(data):\n raise NotImplementedError",
"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 * ... | [
"0.62517804",
"0.617083",
"0.60301036",
"0.58663535",
"0.58491355",
"0.5836512",
"0.5836512",
"0.5768574",
"0.57175446",
"0.5714138",
"0.56961554",
"0.5679267",
"0.5672688",
"0.5663388",
"0.5655146",
"0.5646504",
"0.5632036",
"0.56301653",
"0.5621582",
"0.5607704",
"0.5594008... | 0.6339096 | 0 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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()",
... | [
"0.7321456",
"0.7208627",
"0.7094755",
"0.70528084",
"0.70528084",
"0.7015852",
"0.7013305",
"0.6966215",
"0.69601953",
"0.6880392",
"0.6877142",
"0.6863765",
"0.68466276",
"0.67882174",
"0.67840785",
"0.67840785",
"0.67565984",
"0.6751967",
"0.67462975",
"0.6729085",
"0.6721... | 0.73806584 | 0 |
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 = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self, fig):\n info = self._params\n renderer = fig._get_renderer()\n with getattr(renderer, \"_draw_disabled\", nullcontext)():\n kwargs = get_tight_layout_figure(\n fig, fig.axes, get_subplotspec_list(fig.axes), renderer,\n pad=info['pad'],... | [
"0.6662974",
"0.6229096",
"0.61987996",
"0.6125594",
"0.60366124",
"0.5990623",
"0.5913773",
"0.58432406",
"0.58332056",
"0.5785872",
"0.5716991",
"0.57129467",
"0.5681252",
"0.5642167",
"0.5632248",
"0.56309456",
"0.55950654",
"0.5587224",
"0.5568333",
"0.5490849",
"0.547720... | 0.78887 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDefaultParameterValues(self):\r\n dct = {}\r\n self.initializeRoadRunnerModel()\r\n self.roadrunnerModel.reset()\r\n for parameterName in self.parametersToFit:\r\n dct[parameterName] = self.roadrunnerModel.model[parameterName]\r\n return dct",
"def defaults() ... | [
"0.6622207",
"0.65702045",
"0.6535674",
"0.6516511",
"0.64357203",
"0.64187336",
"0.6382547",
"0.6349992",
"0.6341253",
"0.62935245",
"0.6264641",
"0.6236438",
"0.61953825",
"0.6156402",
"0.6131508",
"0.6121125",
"0.6118047",
"0.60627514",
"0.6037397",
"0.60161936",
"0.599709... | 0.7112436 | 1 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 ... | [
"0.6705805",
"0.66425973",
"0.66406214",
"0.6566678",
"0.6566678",
"0.6518515",
"0.64205587",
"0.6349148",
"0.6329965",
"0.6329109",
"0.625048",
"0.6214673",
"0.6198184",
"0.618865",
"0.61733115",
"0.6170787",
"0.6162327",
"0.61386096",
"0.6123261",
"0.6107689",
"0.61049265",... | 0.7352086 | 0 |
Returns the algorithm type used. | def algorithm(self) -> str:
return self.auth_type.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def algorithm(self) -> str:\n return pulumi.get(self, \"algorithm\")",
"def algorithm(self) -> str:\n return pulumi.get(self, \"algorithm\")",
"def get_algorithm(self):\n return self.alg",
"def Algorithm(self):\n return self._get_attribute('algorithm')",
"def algorithm(self) -> ... | [
"0.73712695",
"0.73712695",
"0.7366377",
"0.7222097",
"0.7169573",
"0.7169573",
"0.7085291",
"0.70408636",
"0.7021254",
"0.70163536",
"0.6950663",
"0.6751433",
"0.665729",
"0.6654943",
"0.65989757",
"0.6505121",
"0.6428941",
"0.6413624",
"0.6378026",
"0.63343865",
"0.63339645... | 0.7648903 | 0 |
The scope property of the JWT. | def scope(self) -> t.Optional[t.Union[str, int, dict]]:
return self.claims.get("scope") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope(self) -> str:\n return pulumi.get(self, \"scope\")",
"def scope(self) -> Optional[str]:\n return pulumi.get(self, \"scope\")",
"def scope(self) -> Optional[str]:\n return pulumi.get(self, \"scope\")",
"def scope(self) -> Optional[str]:\n return pulumi.get(self, \"scope\"... | [
"0.7590331",
"0.7413749",
"0.7413749",
"0.7413749",
"0.7413749",
"0.7413749",
"0.6989864",
"0.6989864",
"0.69863224",
"0.6900574",
"0.6883524",
"0.68134326",
"0.67946464",
"0.67265135",
"0.67265135",
"0.6635984",
"0.6635984",
"0.6525317",
"0.6506014",
"0.6478972",
"0.645331",... | 0.81905013 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.56882745",
"0.55038434",
"0.54871476",
"0.5448722",
"0.53673",
"0.5223715",
"0.52132475",
"0.5197368",
"0.5126093",
"0.50656086",
"0.5057942",
"0.5017213",
"0.50117755",
"0.5006386",
"0.50006413",
"0.49948454",
"0.49900514",
"0.49659505",
"0.49401104",
"0.49147078",
"0.491... | 0.56607395 | 1 |
Returns whether this JWT has been signed. | def is_signed(self) -> bool:
return self.signed is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid(self):\n return self.is_signed and not self.is_expired",
"def authenticated(self):\n return self.token is not None",
"def is_authenticated(self):\n return bool(get_auth_token())",
"def check(self, request, consumer, token, signature):\r\n built = self.sign(request, co... | [
"0.67773134",
"0.67657745",
"0.67343867",
"0.66329306",
"0.6559227",
"0.6557845",
"0.64588183",
"0.6397874",
"0.6384703",
"0.6366098",
"0.6342457",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649"... | 0.74498427 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_double_precision(self):\n conn = self.database.connection()\n cursor = conn.cursor()\n dialect = self.database.dialect()\n dbapi = self.database.dbapi()\n query = dialect.translate('DROP TABLE test_double_precision')\n try:\n cursor.execute(query)\n ... | [
"0.62825966",
"0.6154215",
"0.6102526",
"0.60997707",
"0.6032154",
"0.6001461",
"0.5818658",
"0.58046407",
"0.57864696",
"0.57706934",
"0.57445765",
"0.5733833",
"0.5710603",
"0.5570003",
"0.5558303",
"0.5552022",
"0.5540408",
"0.55288553",
"0.55039096",
"0.54692036",
"0.5455... | 0.7576221 | 0 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_device():\n c_dev = ct.c_int(0)\n safe_call(backend.get().af_get_device(ct.pointer(c_dev)))\n return c_dev.value",
"def dataPointer( cls, instance ):\n try:\n return long(instance.__array_interface__['data'][0])\n except AttributeError:\n insta... | [
"0.6149462",
"0.6083934",
"0.60753775",
"0.6059077",
"0.6059077",
"0.6059077",
"0.6059077",
"0.6059077",
"0.6051239",
"0.60167783",
"0.59694695",
"0.5934218",
"0.5870799",
"0.57828134",
"0.5776091",
"0.5770843",
"0.57103986",
"0.5691612",
"0.5680142",
"0.564842",
"0.5645468",... | 0.7616781 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.