query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Converts this instance of Actions to a df. | def to_df(self) -> pd.DataFrame:
data = []
for action in self.actions:
data.append(action.to_df())
df = pd.read_json(json.dumps(data), orient="list")
return df[self.fields] | [
"def to_df(self):\r\n return pd.DataFrame.from_dict(self.get_params())",
"def to_df(self):\n return pd.DataFrame([dict(self)])",
"def to_df(self):\r\n return pd.DataFrame([dict(self)])",
"def to_dataframe(self):\n return pd.DataFrame(self.to_dict())",
"def to_df(self) -> pd.DataF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert this instance of Actions to markdown/HTML. | def to_md(self):
soup = BeautifulSoup(f"<div id={self.action_id}></div>", "html.parser")
for action in self.actions:
table = soup.new_tag("table")
soup.div.append(table)
for meta_field in Action._meta_fields:
table[meta_field] = action.__getattribute__... | [
"def as_markdown(self) -> str:\n output = f\"## {self.title}\\n\\n\"\n output += f\"* {self.time}\\n* {self.feed}\\n* {self.link}\\n\\n\"\n output += f\"{self.summary}\\n\\n---\"\n return output",
"def to_markdown(self):\n # TODO: Create a TEMPLATE for markdown export and make t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create and populate an Actions instance from a Markdown Document. | def read_from_md(cls, md_doc: MarkdownDocument) -> "Actions":
md_data = re.findall(fr'<div id="{cls.action_id}">+[\s\S]+<\/div>', md_doc)
assert len(md_data) == 1, f"multiple divs with id={cls.action_id} were found"
md_data = md_data[0]
soup = BeautifulSoup(md_data, "html.parser")
... | [
"def _parse_markdown(self):\n renderer = MyRenderer()\n md = mistune.Markdown(renderer=renderer)\n md.render(self._markdown_text)\n self._bash_commands = renderer._bash_commands",
"def __init__(self, doc, artDirection, path=None, mdText=None, startPage=1,\n name=None, **kwar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create and populate an Actions instance from a dataframe. | def read_from_df(df: pd.DataFrame) -> "Actions":
actions = Actions()
for i, row in df.iterrows():
action = Action.create_from_row(row)
actions.append(action)
return actions | [
"def to_df(self) -> pd.DataFrame:\n data = []\n for action in self.actions:\n data.append(action.to_df())\n df = pd.read_json(json.dumps(data), orient=\"list\")\n return df[self.fields]",
"def create_from_row(cls, row: pd.Series) -> \"Action\":\n fields = [\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the requested journal | def load(name):
jrn_path = build_path(name)
if not os.path.exists(jrn_path):
print(f'... journal file \'{jrn_path}\' does not exist ...')
print('... initializing new journal ...')
with open(jrn_path, 'w') as file:
pass
return []
else:
print(f'... loading j... | [
"def load(journal: Journal, file: Path) -> None:",
"def fetch_journal(journal_id):\n return fetch_data(\"/journals/%s\" % (journal_id))",
"def get_journal(self):\n bibjson = self.bibjson()\n\n # first, get the ISSNs associated with the record\n pissns = bibjson.get_identifiers(bibjson.P_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save journal and exit program | def save_exit(name, data):
jrn_path = build_path(name)
print(f'... saving new journal entries to {jrn_path} ...')
with open(jrn_path, 'w') as file:
for line in data:
file.write(line + '\n')
print('... save complete ...') | [
"def atexit_operations(self):\n\n # input history\n self.savehist()\n\n # Cleanup all tempfiles left around\n for tfile in self.tempfiles:\n try:\n os.unlink(tfile)\n except OSError:\n pass\n\n # save the \"persistent data\" catc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
we sum each column of the inverted image. The columns should show up as peaks in the sums uses scipy.signal.find_peaks to find those peaks and use them as column indexes | def createColumnImages(img, basename, directory):
files = []
temp_img = convertToGrayscale(img)
temp_img = invert(temp_img)
temp_img = dilateDirection(temp_img)
sums = np.sum(temp_img, axis = COLUMNS)
sums[0] = 1000 # some random value so that find_peaks properly detects the peak for t... | [
"def sum_region_fluxes(imvals,peak_indices,radius=4.0):\n fluxes = np.zeros(peak_indices.shape[0])\n x_flux = np.zeros(peak_indices.shape[0])\n y_flux = np.zeros(peak_indices.shape[0])\n pixcount = np.zeros(peak_indices.shape[0])\n # radius to extract in pixels - \n rr = radius\n for k in range... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Encodes the datset using the specified tokenizer | def encode(batch, tokenizer):
return tokenizer.batch_encode_plus(batch['sentence'], padding='max_length') | [
"def encode_data_to_token_ids(raw_data_path, encoded_path, vocabulary_path, targetSet,\n tokenizer=None, normalize_digits=True):\n if not gfile.Exists(encoded_path):\n print(\"Tokenizing data in %s\" % raw_data_path)\n vocab, _ = initialize_vocabulary(vocabulary_path)\n with codecs.op... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fills up the car's Fuel | def fill_up(self):
self.fuel = self.gas_tank_size | [
"def fill_tank(self):\r\n self.fuel_level = self.fuel_capacity",
"def recharge_fuel(self):\n self.__fuel = Player.FUEL_MAX_VALUE",
"def cargo_fuel(self, cargo_fuel):\n\n self._cargo_fuel = cargo_fuel",
"def _calculate_fuel_simple(self):\n self._fuel_simple = (self.mass // 3) - 2",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove the amount of fuel, based on distance driven | def drive(self, kilometres_driven):
self.fuel -= (self.litres_per_kilometre * kilometres_driven) | [
"def drive(self, distance):\n if random.randint(0, 100) < self.reliability:\n if distance > self.fuel:\n distance = self.fuel\n self.fuel = 0\n else:\n self.fuel -= distance\n self.odometer += distance\n else:\n p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the number of kilometers that the car could drive with the current amount of fuel | def kilometres_available(self):
return self.fuel / self.litres_per_kilometre | [
"def car_cost(self,car,car_stations):\n car_cost = car.capacity # Aqui le deberiamos aumentar el peso\n #de acuerdo a la capacidad del carro y la cantidad de lugares \n #en la estacion\n return car_stations",
"def calculate_fuel(mass):\r\n return mass // 3 - 2",
"def fuel_calc(mas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test delete cascade of client | def test_client_delete_cascade(self):
assert 12 == self.session.query(Invoice).count()
assert 24 == self.session.query(Iitem).count()
assert 48 == self.session.query(Citem).count()
assert 12 == self.session.query(Contract).count()
assert 4 == self.session.query(Employee).count()... | [
"def test_delete_client(self):\n pass",
"def test_client_nationlity_delete(self):\n pass",
"def test_05_delete_client(self):\n try:\n for k, v in self.test_data.items():\n client = Client()\n test_str = v.split(',')\n client.user_id = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SPM HRF function from sum of two gamma PDFs This function is designed to be partially compatible with SPMs `spm_hrf.m` function. The SPN HRF is a peak gamma PDF (with location `peak_delay` and dispersion `peak_disp`), minus an undershoot gamma PDF (with location `under_delay` and dispersion `under_disp`, and divided by... | def spm_hrf_compat(t,
peak_delay=6,
under_delay=16,
peak_disp=1,
under_disp=1,
p_u_ratio = 6,
normalize=True,
):
if len([v for v in [peak_delay, peak_disp, under_delay, under_disp]
... | [
"def gamma_difference_hrf(tr, oversampling=16, time_length=32., onset=0.,\n delay=6, undershoot=16., dispersion=1.,\n u_dispersion=1., ratio=0.167):\n dt = tr / oversampling\n time_stamps = np.linspace(0, time_length, float(time_length) / dt)\n time_stamps -=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SPM canonical HRF, HRF values for time values `t` This is the canonical HRF function as used in SPM. It | def spmt(t):
return spm_hrf_compat(t, normalize=True) | [
"def dspmt(t):\n t = np.asarray(t)\n return spmt(t) - spmt(t - 1)",
"def compute_thermal(t_0, t_p, r_0):\n V_0 = m * r_0 ** 3.0\n g_p = alpha * -g * t_p\n B_0 = g_p * V_0\n\n z_end = 3.17 * (B_0 / N2) ** (1/4)\n r_end = ((4*a*B_0) / (3 * m**2 * N2))**(1/4)\n return (z_end, r_end)",
"def ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SPM canonical HRF derivative, HRF derivative values for time values `t` This is the canonical HRF derivative function as used in SPM. It is the numerical difference of the HRF sampled at time `t` minus the values sampled at time `t` 1 | def dspmt(t):
t = np.asarray(t)
return spmt(t) - spmt(t - 1) | [
"def derivative(f, t):\n dfdt = np.empty_like(f)\n\n for i in range(2):\n t_i = t[i]\n t1 = t[0]\n t2 = t[1]\n t3 = t[2]\n t4 = t[3]\n t5 = t[4]\n h1 = t1 - t_i\n h2 = t2 - t_i\n h3 = t3 - t_i\n h4 = t4 - t_i\n h5 = t5 - t_i\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SPM canonical HRF dispersion derivative, values for time values `t` This is the canonical HRF dispersion derivative function as used in SPM. It is the numerical difference between the HRF sampled at time `t`, and values at `t` for another HRF shape with a small change in the peak | def ddspmt(t):
return (spmt(t) - _spm_dd_func(t)) / 0.01 | [
"def spm_dispersion_derivative(tr, oversampling=16, time_length=32., onset=0.):\n dd = .01\n dhrf = 1. / dd * (gamma_difference_hrf(tr, oversampling, time_length,\n onset, dispersion=1. + dd) -\n spm_hrf(tr, oversampling, time_length, onset))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Give a laika GPSTime object for the given time string | def gpstime_fromstr(timestr: str) -> GPSTime:
return GPSTime.from_datetime(datetime.strptime(timestr, "%Y-%m-%d")) | [
"def parse_time(s: str):\n return utils.parsers.parse_eng_unit(s, base_unit='s', default=1e-12)",
"def parse_time(s):\n return time.gmtime(float(s))",
"def parse_time(time_str):\n return time.strptime(time_str, '%H:%M')",
"def get_time(text_time):\n # return Observer.datetime_to_astropy_time(dt.da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens a RINEX file and looks in the headers for the station's position | def station_location_from_rinex(rinex_path: str) -> Optional[types.ECEF_XYZ]:
xyz = None
lat = None
lon = None
height = None
with open(rinex_path, "rb") as filedat:
for _ in range(50):
linedat = filedat.readline()
if b"POSITION XYZ" in linedat:
xyz = ... | [
"def __read_header(self):\n\n filename = self.directory + 'SeisHeader_sem2d.hdr'\n try :\n f = open(filename, 'r')\n except:\n msg = 'No Header file <SeisHeader_sem2d.hdr> in directory'\n print(msg)\n answer = input(\"Do you want to continue [Y/N] : \")\n if answer.upper() == 'Y':\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create new connections entry for a new pca | def addPCA(self,pcaId):
self.openConnections[pcaId]=set() | [
"def add_conn(self, a1, a2):\n if self.use_pconn:\n raise ValueError(\"Can not add bonds to systems with pconn - well, we can fix this ;) \")\n self.conn[a1].append(a2)\n self.conn[a2].append(a1)\n d,v,imgi = self.get_distvec(a1,a2)\n self.pconn[a1].append(images[imgi])... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove open connections for a pca | def removePCA(self,pcaId):
if pcaId in self.openConnections:
del self.openConnections[pcaId] | [
"def delete_connections():\n for c in db.connections:\n del db.connections[c]",
"def pruneConnections(self):\n for k,v in self.hadoops.iteritems():\n if(not v.closed):\n #check staleness\n if((timeflt() - v.ts) > PRUNE_TIMEOUT):\n print(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds a user with a authentification token | def addUser(self,username,token):
self.user_tokens[username] = token | [
"def insertNewUser(self,user, access_token):\n newUser = UserToken(username=user, user_key = access_token.key, user_secret = access_token.secret)\n newUser.put()",
"def create_user_and_set_token_credentials(self):\n user = User.objects.create_user(**self.user_data)\n access_token = use... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add websocket to user and group sets | def addWebSocket(self,webSocket,group,user):
self.webSocketLocks[webSocket]=threading.Lock()
self.openConnections[group].add(webSocket)
self.openConnections[user].add(webSocket) | [
"def __init__(self, websocket, name, group=None):\n\t\tself.websocket = websocket\n\t\tself.name = name\n\t\tself.group = group\n\t\tself.session = utilities.random_string(32)\n\t\tself.uid = utilities.random_string(32)\n\t\tself.active = 1\n\n\t\tshared.users.append(self)",
"def associate_user(message, websocket... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove websocket from groups | def removeWebSocket(self,webSocket,group,user):
if group in self.openConnections and webSocket in self.openConnections[group]:
self.openConnections[group].remove(webSocket)
if user in self.openConnections and webSocket in self.openConnections[user]:
self.openConnections[user].rem... | [
"def remove_mailing_list_group(sender, instance, **kwargs):\n\tname = instance.name\n\treturn requests.delete(\"https://api.mailgun.net/v3/lists/{}@arenbergorkest.be\".format(name),auth=('api', settings.MAILGUN_API_KEY))",
"def websocket_group(self):\n return Group(\"room-%s\" % str(self.id))",
"def remo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send update to a websocket pca group | def sendUpdate(self,update,pcaId):
l = asyncio.new_event_loop()
l.run_until_complete(self.__async_sendUpdate(update,pcaId)) | [
"async def __async_sendUpdate(self,update,pcaId):\n message = {\n \"type\": \"state\",\n \"message\": update,\n \"origin\" : pcaId,\n }\n if pcaId in self.openConnections and self.openConnections[pcaId]:\n #await asyncio.wait([user.send(json.dumps(mes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send update to a websocket pca group | async def __async_sendUpdate(self,update,pcaId):
message = {
"type": "state",
"message": update,
"origin" : pcaId,
}
if pcaId in self.openConnections and self.openConnections[pcaId]:
#await asyncio.wait([user.send(json.dumps(message)) for user in s... | [
"def sendUpdate(self,update,pcaId):\n l = asyncio.new_event_loop()\n l.run_until_complete(self.__async_sendUpdate(update,pcaId))",
"def sendLogUpdate(self,update,pcaId):\n l = asyncio.new_event_loop()\n l.run_until_complete(self.__async_sendLogUpdate(update,pcaId))",
"def sendUpdate(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send logupdate to a pca group | def sendLogUpdate(self,update,pcaId):
l = asyncio.new_event_loop()
l.run_until_complete(self.__async_sendLogUpdate(update,pcaId)) | [
"async def __async_sendLogUpdate(self,logmessage,pcaId):\n message = {\n \"type\": \"log\",\n \"message\": logmessage,\n \"origin\": pcaId\n }\n if pcaId in self.openConnections and self.openConnections[pcaId]:\n await asyncio.wait([self.__async_send(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send logupdate to a pca group | async def __async_sendLogUpdate(self,logmessage,pcaId):
message = {
"type": "log",
"message": logmessage,
"origin": pcaId
}
if pcaId in self.openConnections and self.openConnections[pcaId]:
await asyncio.wait([self.__async_send(user,message,self.we... | [
"def sendLogUpdate(self,update,pcaId):\n l = asyncio.new_event_loop()\n l.run_until_complete(self.__async_sendLogUpdate(update,pcaId))",
"def update_patch_log(patchmodule):\n\tdataent.get_doc({\"doctype\": \"Patch Log\", \"patch\": patchmodule}).insert(ignore_permissions=True)",
"def update(self, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send iformation about a permission timeout to a user | def permissionTimeout(self,user):
l = asyncio.new_event_loop()
l.run_until_complete(self.__async_permissionTimeout(user)) | [
"async def __async_permissionTimeout(self,userGroup):\n message = {\n \"type\": \"permissionTimeout\",\n }\n if userGroup in self.openConnections and self.openConnections[userGroup]:\n await asyncio.wait([user.send(json.dumps(message)) for user in self.openConnections[user... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send iformation about a permission timeout to a user | async def __async_permissionTimeout(self,userGroup):
message = {
"type": "permissionTimeout",
}
if userGroup in self.openConnections and self.openConnections[userGroup]:
await asyncio.wait([user.send(json.dumps(message)) for user in self.openConnections[userGroup]]) | [
"def permissionTimeout(self,user):\n l = asyncio.new_event_loop()\n l.run_until_complete(self.__async_permissionTimeout(user))",
"def timout_user(self, nickname, channel, duration=600):\n\n self.send_message(\"/timeout {} {}\".format(nickname, duration), channel)",
"def conversation_timeout... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disables database tracking, prevents database events from being sent to the client. | def disable(self) -> Awaitable[Dict]:
return self.client.send("Database.disable", {}) | [
"def DisablePerfTracking():\n\tEnablePerfTracking(False)",
"def _now_disable(error=False):\n PROVIDER.teardown()\n PROVIDER.store(partial=error)",
"def _unrestricted(self) -> Database:\n return self.db",
"def disable_cached_db_connections():\n with _global_db_cache_lock:\n keys = list(_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a cient's PEM certificate in cert_string, return True if we allow the client access or False if we deny access. The allow/deny decision is based on comparing the certificate's Subject Alternative Name to a configured whitelist of allowed names. | def authorized_certificate(cert_string):
# parse the certificate data
try:
cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
cert_string)
except Exception, e:
print "Failed to parse certificate: %s" % (str(e))
return Fals... | [
"def validate_cert(self, cert: \"cryptography.x509.Certificate\") -> bool:\n return names_of(cert, lower=True).issubset(\n self.authorized_identifiers(lower=True)\n )",
"def is_self_signed_certificate(cert_path):",
"def verify_cert_url(cert_url):\n if cert_url is None:\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints a nice representation of the robot's room | def print_room(room):
for row in room:
for cell in row:
if cell == "obstacle":
print("O", end="")
elif cell == "robot":
print("R", end="")
elif cell == "empty":
print(" ", end="")
elif cell == "dirt":
... | [
"def print_room(room):\r\n cls()\r\n print(\"\\n\" + room[\"name\"].upper() + \"\\n\")\r\n wrap_print(room[\"description\"] + print_room_items(room) + print_room_entities(room))",
"def __str__(self):\n return('\\nRoom:\\n'\n f' Name: { self.name }.\\n'\n ' Dimensions:\\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the robot's row and column in the room | def robot_location(room):
for r in range(WIDTH):
for c in range(WIDTH):
if room[r][c] == "robot":
return (r, c) | [
"def position_robot(self):\n x = 0\n y = 0\n while y < len(self.lignes_labyrinthe):\n if self.robot in self.lignes_labyrinthe[y]:\n while x < len(self.lignes_labyrinthe[y]):\n if self.robot in self.lignes_labyrinthe[y][x]:\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Randomly moves robot around room for steps steps | def random_walk(room, steps):
# Track the robot location
visits = []
for _ in range(WIDTH):
row = [0] * WIDTH
visits.append(row)
for i in range(steps):
direction = random.choice(DIRECTIONS)
room = move_robot(room, direction)
print("After {} steps, r... | [
"def random_walk(turtle, distance, steps):\n turtle.color(randcolor(), randcolor())\n for step in range(0,steps):\n random_move(turtle, distance)\n gohome(turtle)",
"def __random_movement(self):\n\t\tself.__steps += 1 \t\t# Increment after every frame\n\t\t# When __steps greater than threshold reverse the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find discordant SNPs between two or three individuals. | def find_discordant_snps(
self, individual1, individual2, individual3=None, save_output=False
):
self._remap_snps_to_GRCh37([individual1, individual2, individual3])
df = individual1.snps
# remove nulls for reference individual
df = df.loc[df["genotype"].notnull()]
... | [
"def get_shared_motif(dnas):\n shared_motif = ''\n sample = dnas[0]\n sample_length = len(sample)\n\n for i in range(sample_length):\n for j in range(sample_length-i+1):\n if j > len(shared_motif) and all(sample[i:i+j] in dna for dna in dnas):\n shared_motif = sample[i:i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the shared DNA between individuals. Computes the genetic distance in centiMorgans (cMs) between SNPs using the specified genetic map. Applies thresholds to determine the shared DNA. Plots shared DNA. Optionally determines shared genes (i.e., genes transcribed from the shared DNA). All output is saved to the output... | def find_shared_dna(
self,
individuals=(),
cM_threshold=0.75,
snp_threshold=1100,
shared_genes=False,
save_output=True,
genetic_map="HapMap2",
):
# initialize all objects to be returned to be empty to start
one_chrom_shared_dna = pd.DataFrame()... | [
"def draw_map():\n \n m1 = Chem.MolFromSmiles('c1ccccc1O')\n m2 = Chem.MolFromSmiles('c1ccccc1N')\n \n # Morgan Fingerprint (with normalization)\n # Can also be used with APFingerprint or TTFingerprint\n fig1, maxweight = SimilarityMaps.GetSimilarityMapForFingerprint(m1, m2, SimilarityMaps.GetM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shrinks learning rate by a specified factor. | def adjust_learning_rate(optimizer, shrink_factor):
print("\nDECAYING learning rate.")
for param_group in optimizer.param_groups:
param_group['lr'] = param_group['lr'] * shrink_factor
print("The new learning rate is %f\n" % (optimizer.param_groups[0]['lr'],)) | [
"def adjust_learning_rate(optimizer, shrink_factor):\r\n\r\n print(\"\\nDECAYING learning rate.\")\r\n for param_group in optimizer.param_groups:\r\n param_group['lr'] = param_group['lr'] * shrink_factor\r\n print(\"The new learning rate is %f\\n\" % (optimizer.param_groups[0]['lr'],))",
"def adju... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs histogram equalization of a given grayscale or RGB image. | def histogram_equalize(im_orig):
if im_orig.ndim == 3:
return _histogram_equalize_rgb(im_orig)
return _histogram_equalize_grayscale(im_orig) | [
"def histogram_equalization(img):\n\n if len(img.shape) == 3:\n img_copy = np.copy(img)\n\n blue = img_copy[:,:,0]\n blue = histogram_equalize(blue)\n\n green = img_copy[:,:,1]\n green = histogram_equalize(green)\n\n red = img_copy[:,:,2]\n red = histogram_equaliz... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prefix to append the observation with. | def observation_prefix(self) -> str:
return "Observation: " | [
"def append_prefix(self, prefix):\n self._prefix_stack.append(prefix)\n return Record._add_prefix_context()",
"def prefix(self, value):\n self._prefix = value",
"def add_prefix(value, arg):\n return arg + str(value)",
"def prependChromosomeName(tabfile,prefix):\n prefix_str = str(pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prefix to append the llm call with. | def llm_prefix(self) -> str:
return "Thought:" | [
"def calcPrefix(self, log_level=logging.INFO):\r\n return self._indents * 4 * \" \" + self._level_masking[log_level] + \" \"",
"def add_prefix(value, arg):\n return arg + str(value)",
"def _join_mgm_lfn(self, mgm, lfn):\n if not mgm.endswith('/'): mgm += '/'\n return mgm + lfn",
"async... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Construct an agent from an LLM and tools. | def from_llm_and_tools(
cls,
llm: BaseLanguageModel,
tools: Sequence[BaseTool],
callback_manager: Optional[BaseCallbackManager] = None,
prefix: str = PREFIX,
suffix: str = SUFFIX,
format_instructions: str = FORMAT_INSTRUCTIONS,
input_variables: Optional[Li... | [
"def from_llm_and_tools(\n cls,\n llm: BaseLanguageModel,\n tools: Sequence[BaseTool],\n callback_manager: Optional[BaseCallbackManager] = None,\n system_message: str = PREFIX,\n human_message: str = SUFFIX,\n input_variables: Optional[List[str]] = None,\n out... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert the class properties defined in the enum_class into list of names | def as_name_list(cls, lower=True, **kwargs):
return cls.enum_class.as_name_list(lower=lower, **kwargs) | [
"def enum_names(self):\n return [enum.name for enum in self]",
"def enumchoices(cls):\n if not isenum(cls):\n return tuple()\n return tuple(choice.name for choice in cls)",
"def enum_sprint(en):\n return list(en.__members__.keys())",
"def GetAll(cls):\n for prop_key in dir(cls):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiate the class from a bitwise value. This is commonly used by serializer's to_representation since the internal value saved is an integer and we convert that integer value into actual BitFlag class so we can access each flags later on | def from_value(cls, value):
value = value if value else 0
try:
flags = [flag.name for flag in cls.enum_class if flag.value & value]
except TypeError:
flags = [flag.name for flag in cls.enum_class if flag.name == value]
return cls(*flags) | [
"def __init__(self, value=None, bits=32, signed=True):\n\n # Check for legality and set the number of bits\n if type(bits) is not int:\n raise TypeError(\"number of bits for a value must be an integer\")\n if bits < 1:\n raise ValueError(\"number of bits for a value must b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lower health of turret due to shell hit input amount of damage | def Hit(self, damage):
self.health -= damage | [
"def take_damage(self):\n self.health -= 1",
"def take_damage(self, amount):\n # Ensure Tower's health is non-negative.\n if self.health > amount:\n self.health -= amount\n else:\n self.health = 0",
"def take_damage(self, dmg):\n self.hp = self.hp - dmg\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Increment barrel angle by increment | def Incrbarrel(self, increment):
self.barrel += increment | [
"def adjAngle(self, amt): \r\n\r\n self.angle = self.angle + radians(amt)\r\n self.redraw()",
"def adjAngle(self, amt):\n \n self.angle = self.angle+radians(amt)\n self.redraw()",
"def rel_angle(self, angle):\n steps = int(angle / 360 * self.steps_per_rev)\n self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Increment shell power by increment | def Incrpower(self, increment):
self.power += increment | [
"def incr1(cmd):\n add(cmd, 1, 1)\n s.write(cmd)",
"def increment(self) -> global___Expression:",
"def increment_power_on_count(self):\n self._power_on_count += 1",
"def increment(self, value=1):\r\n self._counter += value",
"def increment(number):\n return number + 1",
"def increment(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw the turret on screen at xcoord | def DrawTurret(self):
pygame.draw.rect(self.displaysurf, self.color, (int(self.x_coord - T_W1 / 2), WINHEIGHT - T_H1 - GR_HEIGHT, T_W1, T_H1), 0)
pygame.draw.rect(self.displaysurf, self.color, (int(self.x_coord - T_W2 / 2), WINHEIGHT - (T_H2 + T_H1) - GR_HEIGHT, T_W2, T_H2), 0)
self.barrel_endx ... | [
"def specialfire_draw(self, window):\n self.specialfire_x = self.x + 10\n window.blit(self.specialfire_image, (self.specialfire_x, self.specialfire_y))",
"def draw(self,x=0,y=0):\n\t\tself.center = x,y\n\t\tr\t\t= max(Person.WIDTH>>1,1)\n\t\tself.canvas.coords('node_'+self.identifier, x-r,y-r,x+r,y+... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a requested geometry, apply all applicable resistance and return the nearest acceptable geometry. | def resist(self, geometry, gravity=Gravity.Center):
def apply_resistance(geometry, gravity, direction, resistance):
if is_positive_direction(direction):
if gravity[cardinal_axis(direction)] < 0:
return geometry - Rectangle(*direction) * resistance
... | [
"def nearest(\n self,\n geometry,\n return_all=True,\n max_distance=None,\n return_distance=False,\n exclusive=False,\n ):\n raise NotImplementedError",
"def simplify(self, tolerance, preserve_topology=...): # -> BaseGeometry:\n ...",
"def find_geometr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute applicable resistance in the given cardinal direction. | def compute_resistance(self, geometry, gravity, direction):
return 0 | [
"def get_resistance(self):\n adc = ADC(self.pin)\n value = adc.read()\n if value == 0:\n return -1\n\n return (4095./value - 1.) * self.RLOAD",
"def get_resistance(self):\n adc = ADC(self.pin)\n value = adc.read()\n if value == 0:\n return -1\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run experiments defined by `config` serially. | def run_experiment(experiment_name: str = None,
output_path: str = '/tmp/sweep',
start_count: int = 0,
end_count: int = int(1e6),
ignore_errors: bool = False,
agent_module: str = None,
config: Dict[str, Any... | [
"def run_experiments():\n n_runs = 100\n for experiment in experiments.values():\n if not path.exists('./outputs/'+experiment.name):\n print(\"Running experiment: \", experiment.name + \".\")\n experiment.full_run(\n n_runs_per_device=n_runs,\n n_proc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the contact_id of this PostPurchaseInvoicesPurchaseInvoice. | def contact_id(self, contact_id):
if self.local_vars_configuration.client_side_validation and contact_id is None: # noqa: E501
raise ValueError("Invalid value for `contact_id`, must not be `None`") # noqa: E501
self._contact_id = contact_id | [
"def contact(self, contact):\n\n self.logger.debug(\"In 'contact' setter.\")\n\n self._contact = contact",
"def contact_no(self, contact_no):\n\n self._contact_no = contact_no",
"def contact(self, contact):\n\n self._contact = contact",
"def owner_contactid(self, owner_contactid):\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the postponed_accounting of this PostPurchaseInvoicesPurchaseInvoice. | def postponed_accounting(self, postponed_accounting):
self._postponed_accounting = postponed_accounting | [
"def paid_on(self, paid_on):\n\n self._paid_on = paid_on",
"def planned_purge_date(self, planned_purge_date):\n\n self._planned_purge_date = planned_purge_date",
"def billing(self, billing):\n\n self._billing = billing",
"def stripe_invoices(self, stripe_invoices):\n\n self._stripe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the _import of this PostPurchaseInvoicesPurchaseInvoice. | def _import(self, _import):
self.__import = _import | [
"def import_operation(self, import_operation):\n\n self._import_operation = import_operation",
"def import_date(self, import_date):\n self._import_date = import_date",
"def import_charges(self, import_charges):\n\n self._import_charges = import_charges",
"def imported(self, imported):\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the contact_name of this PostPurchaseInvoicesPurchaseInvoice. | def contact_name(self, contact_name):
self._contact_name = contact_name | [
"def contact_first_name(self, contact_first_name):\n\n self._contact_first_name = contact_first_name",
"def contact_full_name(self, contact_full_name):\n\n self._contact_full_name = contact_full_name",
"def contact_name(self) -> str:\n return pulumi.get(self, \"contact_name\")",
"def cont... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the contact_reference of this PostPurchaseInvoicesPurchaseInvoice. | def contact_reference(self, contact_reference):
self._contact_reference = contact_reference | [
"def contact(self, contact):\n\n self.logger.debug(\"In 'contact' setter.\")\n\n self._contact = contact",
"def contact(self, contact):\n\n self._contact = contact",
"def billing_contact(self, billing_contact):\n\n self._billing_contact = billing_contact",
"def contact_phone(self, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the vendor_reference of this PostPurchaseInvoicesPurchaseInvoice. | def vendor_reference(self, vendor_reference):
self._vendor_reference = vendor_reference | [
"def vendor(self, vendor):\n\n self._vendor = vendor",
"def vendor_id(self, vendor_id):\n\n self._vendor_id = vendor_id",
"def vendorid(self, vendorid):\n\n self._vendorid = vendorid",
"def vendor_id(self, vendor_id):\n self._vendor_id = vendor_id",
"def vendor_name(self, vendor_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the total_quantity of this PostPurchaseInvoicesPurchaseInvoice. | def total_quantity(self, total_quantity):
self._total_quantity = total_quantity | [
"def total_sold_quantity(self, total_sold_quantity):\n\n self._total_sold_quantity = total_sold_quantity",
"def trash_item_quantity(self, trash_item_quantity):\n\n self._trash_item_quantity = trash_item_quantity",
"def total_amount(self, total_amount):\n\n self._total_amount = total_amount"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the net_amount of this PostPurchaseInvoicesPurchaseInvoice. | def net_amount(self, net_amount):
self._net_amount = net_amount | [
"def net_income(self, net_income):\n self._net_income = net_income",
"def base_currency_net_amount(self, base_currency_net_amount):\n\n self._base_currency_net_amount = base_currency_net_amount",
"def netincome_multiple(self, netincome_multiple):\n\n self._netincome_multiple = netincome_mul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the tax_amount of this PostPurchaseInvoicesPurchaseInvoice. | def tax_amount(self, tax_amount):
self._tax_amount = tax_amount | [
"def items_tax_amount(self, items_tax_amount):\n\n self._items_tax_amount = items_tax_amount",
"def base_tax_amount(self, base_tax_amount):\n\n self._base_tax_amount = base_tax_amount",
"def tax(self, tax):\n\n self._tax = tax",
"def tax_number(self, tax_number):\n\n self._tax_numb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the total_amount of this PostPurchaseInvoicesPurchaseInvoice. | def total_amount(self, total_amount):
self._total_amount = total_amount | [
"def total_tax(self, total_tax):\n\n self._total_tax = total_tax",
"def total_paid(self, total_paid):\n\n self._total_paid = total_paid",
"def total_charges_amount(self, total_charges_amount):\n\n self._total_charges_amount = total_charges_amount",
"def total_discount(self, total_discount... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the exchange_rate of this PostPurchaseInvoicesPurchaseInvoice. | def exchange_rate(self, exchange_rate):
self._exchange_rate = exchange_rate | [
"def set_exchange_rate(self, exchange_rate):\n self.set_value_into_input_field(self.exchange_rate_textbox_locator, exchange_rate, True)",
"def set_exchange_rate_date(self, exchange_rate_date):\n self.set_value_into_input_field(self.exchange_rate_date_locator, exchange_rate_date)",
"def update_exch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the inverse_exchange_rate of this PostPurchaseInvoicesPurchaseInvoice. | def inverse_exchange_rate(self, inverse_exchange_rate):
self._inverse_exchange_rate = inverse_exchange_rate | [
"def exchange_rate(self, exchange_rate):\n\n self._exchange_rate = exchange_rate",
"def set_inverse_display(self, inverse):\n self.check_int(inverse, 0, 1)\n self.__send_command([0xa6 | inverse])",
"def invert_if_negative(self, invert_if_negative):\n self._invert_if_negative = invert... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the base_currency_net_amount of this PostPurchaseInvoicesPurchaseInvoice. | def base_currency_net_amount(self, base_currency_net_amount):
self._base_currency_net_amount = base_currency_net_amount | [
"def base_currency(self, base_currency):\n\n self._base_currency = base_currency",
"def net_amount(self, net_amount):\n\n self._net_amount = net_amount",
"def base_discount_amount(self, base_discount_amount):\n\n self._base_discount_amount = base_discount_amount",
"def base_currency_tax_a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the base_currency_tax_amount of this PostPurchaseInvoicesPurchaseInvoice. | def base_currency_tax_amount(self, base_currency_tax_amount):
self._base_currency_tax_amount = base_currency_tax_amount | [
"def base_tax_amount(self, base_tax_amount):\n\n self._base_tax_amount = base_tax_amount",
"def base_price_incl_tax(self, base_price_incl_tax):\n\n self._base_price_incl_tax = base_price_incl_tax",
"def base_currency_withholding_tax_amount(self, base_currency_withholding_tax_amount):\n\n se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the base_currency_total_amount of this PostPurchaseInvoicesPurchaseInvoice. | def base_currency_total_amount(self, base_currency_total_amount):
self._base_currency_total_amount = base_currency_total_amount | [
"def base_row_total(self, base_row_total):\n\n self._base_row_total = base_row_total",
"def base_discount_amount(self, base_discount_amount):\n\n self._base_discount_amount = base_discount_amount",
"def base_currency(self, base_currency):\n\n self._base_currency = base_currency",
"def bas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the status_id of this PostPurchaseInvoicesPurchaseInvoice. | def status_id(self, status_id):
self._status_id = status_id | [
"def source_status_id(self, source_status_id: int):\n\n self._source_status_id = source_status_id",
"def set_status(self, status):\n self.status = status\n self.save()",
"def status_ids(self, status_ids):\n\n self._status_ids = status_ids",
"def incident_status_id(self, incident_st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the tax_address_region_id of this PostPurchaseInvoicesPurchaseInvoice. | def tax_address_region_id(self, tax_address_region_id):
self._tax_address_region_id = tax_address_region_id | [
"def region_id(self, region_id):\n self._region_id = region_id",
"def region_id(self, region_id: str):\n\n self._region_id = region_id",
"def tax_id(self, tax_id):\n\n self._tax_id = tax_id",
"def __setRegion__(self, x):\n\n self.region = x",
"def tax_id(self, tax_id: str):\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the withholding_tax_rate of this PostPurchaseInvoicesPurchaseInvoice. | def withholding_tax_rate(self, withholding_tax_rate):
self._withholding_tax_rate = withholding_tax_rate | [
"def withholding_tax_amount(self, withholding_tax_amount):\n\n self._withholding_tax_amount = withholding_tax_amount",
"def base_currency_withholding_tax_amount(self, base_currency_withholding_tax_amount):\n\n self._base_currency_withholding_tax_amount = base_currency_withholding_tax_amount",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the withholding_tax_amount of this PostPurchaseInvoicesPurchaseInvoice. | def withholding_tax_amount(self, withholding_tax_amount):
self._withholding_tax_amount = withholding_tax_amount | [
"def withholding_tax_rate(self, withholding_tax_rate):\n\n self._withholding_tax_rate = withholding_tax_rate",
"def amount_including_tax(self, amount_including_tax):\n if amount_including_tax is None:\n raise ValueError(\"Invalid value for `amount_including_tax`, must not be `None`\")\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the base_currency_withholding_tax_amount of this PostPurchaseInvoicesPurchaseInvoice. | def base_currency_withholding_tax_amount(self, base_currency_withholding_tax_amount):
self._base_currency_withholding_tax_amount = base_currency_withholding_tax_amount | [
"def base_tax_amount(self, base_tax_amount):\n\n self._base_tax_amount = base_tax_amount",
"def base_price_incl_tax(self, base_price_incl_tax):\n\n self._base_price_incl_tax = base_price_incl_tax",
"def base_currency_tax_amount(self, base_currency_tax_amount):\n\n self._base_currency_tax_am... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the invoice_lines of this PostPurchaseInvoicesPurchaseInvoice. | def invoice_lines(self, invoice_lines):
if self.local_vars_configuration.client_side_validation and invoice_lines is None: # noqa: E501
raise ValueError("Invalid value for `invoice_lines`, must not be `None`") # noqa: E501
self._invoice_lines = invoice_lines | [
"def invoice_ids(self, invoice_ids):\n\n self._invoice_ids = invoice_ids",
"def invoice_line_m(self, invoice_line_m):\n\n self._invoice_line_m = invoice_line_m",
"def invoices(self, invoices):\n\n\n self._invoices = invoices",
"def stripe_invoices(self, stripe_invoices):\n\n self._... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the tax_analysis of this PostPurchaseInvoicesPurchaseInvoice. | def tax_analysis(self, tax_analysis):
self._tax_analysis = tax_analysis | [
"def taxi(self, taxi):\n\n self._taxi = taxi",
"def tax(self, tax):\n\n self._tax = tax",
"def tax_on_tax_algorithm(self, tax_on_tax_algorithm):\n\n self._tax_on_tax_algorithm = tax_on_tax_algorithm",
"def income_tax(self, income_tax):\n self._income_tax = income_tax",
"def taxes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show all items that are done | def show_done():
#conncetion to the database
conn = sqlite3.connect('todo.db')
c = conn.cursor()
#if status of task is 0 it means task is completed.
c.execute("SELECT Task_id, Description FROM task WHERE status LIKE 0")
result = c.fetchall()
c.close()
return render_template("show_done.h... | [
"def display_completed_items(self):\n self.root.ids.priceOrCompletedLabel.text = 'Showing completed items'\n self.root.ids.entriesBox.clear_widgets()\n\n for item in self.item_list.items:\n if item.completed == 'c':\n # create a button for each item entry\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize scoreboard with given maximum capacity. All entries are initially None | def __init__(self, capacity=10):
self._board = [None] * capacity # list of 10 None elements
self._n = 0 # number of actual entries | [
"def __init__(self,capacity = 10):\n self._board = [None] * capacity # reserve space for future scores\n self._n = 0 # number of actual entries",
"def __init__(self, capacity=10):\n\n self._board = [None] * capacity \n self._n = 0",
"def __init__(self, cap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adding entry to high scores. | def add(self, entry):
score = entry.get_score()
# Does the new entry qualify as high score.
# The high score is True if board not full or score is higher than last entry
good = self._n < len(self._board) or score > self._board[-1].get_score()
if good:
if self._n < l... | [
"def add(self, entry):\n score = entry.get_score()\n good = self._n < len(self._board) or score > self._board[-1].get_score()\n\n if good:\n if self._n < len(self._board):\n self._n += 1 \n \n j = self._n - 1\n while j > 0 and self._boa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Describes an InputArgument instance. | def _describe_input_argument(self, argument, **options):
default = argument.get_default()
if default is not None and (not isinstance(default, list) or len(default)):
default = '<comment> [default: %s]</comment>' % self._format_default_value(default)
else:
default = ''
... | [
"def _describe_input_definition(self, definition, **options):\n definition_options = definition.get_options()\n definition_arguments = definition.get_arguments()\n total_width = self._calculate_total_width_for_options(definition_options)\n\n for argument in definition_arguments:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Describes an InputOption instance. | def _describe_input_option(self, option, **options):
accept_value = option.accept_value()
default = option.get_default()
if accept_value and default is not None and (not isinstance(default, list) or len(default)):
default = '<comment> [default: %s]</comment>' % self._format_default_v... | [
"def option_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"option_name\")",
"def convert_input_to_option(self, input):\n assert isinstance(input, Input)\n option = click.Option(\n param_decls=[\n '--%s' % input.name.replace('_', '-'),\n ],\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Describes an InputDefinition instance. | def _describe_input_definition(self, definition, **options):
definition_options = definition.get_options()
definition_arguments = definition.get_arguments()
total_width = self._calculate_total_width_for_options(definition_options)
for argument in definition_arguments:
total_... | [
"def definition(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"definition\")",
"def setDefinition(self, definition):\n\n InputDefinition.setDefinition(self, definition);\n\n return self;",
"def input(self, description):\n if isinstance(description, (int, long)):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Describes a Command instance. | def _describe_command(self, command, **options):
command.get_synopsis(True)
command.get_synopsis(False)
command.merge_application_definition(False)
self._write_text('<comment>Usage:</comment>', **options)
for usage in [command.get_synopsis(True)] + command.get_aliases() + comman... | [
"def command(self):\n\n raise NotImplementedError()",
"def test_description(dump_command):\n assert dump_command.description == py3odb.cli.dump.DumpCommand.help_text",
"def __init__(self, command, target: str):\n self.command = command\n self.target = target",
"def get_command_descript... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Describes an Application instance. | def _describe_application(self, application, **options):
described_namespace = options.get('namespace')
description = ApplicationDescription(application, described_namespace)
raw_text = options.get('raw_text')
if raw_text:
width = self._get_column_width(description.get_comma... | [
"def _test_application(self):\n \n return Application(\n appeui=int('0x0A0B0C0D0A0B0C0D', 16),\n name='app',\n domain='fluentnetworks.com.au',\n appnonce=int('0xC28AE9',16),\n appkey=int('0x017E151638AEC2A6ABF7258809CF4F3C',16),\n fport... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Formats command aliases to show them in the command description. | def _get_command_aliases_text(self, command):
text = ''
aliases = command.get_aliases()
if aliases:
text = '[{}] '.format('|'.join(aliases))
return text | [
"def add_aliases_formatting(self, aliases):\n ...",
"def cmd_alias(self, client, data, cmd=None):\n if not data:\n client.message('missing data, try %s!%shelp alias' % (ORANGE, RESET))\n return\n\n bclient = self.lookup_client(data, client)\n if not bclient:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Formats input option/argument default value. | def _format_default_value(self, default):
return json.dumps(default) | [
"def fmt_option_val(option):\n if option is None:\n return \"\"\n return str(option)",
"def Format(self, args):\n del args # Unused in Format\n return 'default'",
"def argument(arg, default):\n return \"{0}={1}\".format(arg, default) if default else arg",
"def fmt_option_key... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
How much time is left until the event is due. A float representing a number of fractional seconds. | def time_remaining(self) -> float:
return self.event.time - time.time() | [
"def remaining(self):\n if self.time is None:\n remain = float(self.timeout)\n else:\n remain = self.timeout - (time.time() - self.time)\n if remain < 0.0:\n remain = 0.0\n return remain",
"def time_left(self) -> float:\n return self.time... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define the CherryPy messages to listen for and start running the scheduler. This plugin owns the scheduler prefix. | def start(self) -> None:
self.bus.subscribe("cache:ready", self.revive)
self.bus.subscribe("scheduler:add", self.add)
self.bus.subscribe("scheduler:persist", self.persist)
self.bus.subscribe("scheduler:remove", self.remove)
self.bus.subscribe("scheduler:upcoming", self.upcoming)
... | [
"def start(self) -> None:\n self.bus.subscribe(\"registry:ready\", self.get_triggers)\n self.bus.subscribe(\"registry:added\", self.refresh_triggers)\n self.bus.subscribe(\"registry:updated\", self.refresh_triggers)\n\n cherrypy.process.plugins.Monitor.start(self)",
"def start(self):\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts numpy special values to the corresponding GDX versions. Parmeters | def convert_np_to_gdx_svs(df, num_dims):
# converts a single value; NANs are assumed already handled
def convert_approx_eps(value):
# eps values are not always caught by ==, use is_np_eps which applies
# a tolerance
if is_np_eps(value):
return SPECIAL_VALUES[4]
retur... | [
"def _convert_dataarray_attributes_xderivative(attrs,grid_location=None):\n new_attrs = attrs.copy()\n if attrs.has_key('long_name'):\n new_attrs['long_name'] = 'x-derivative of ' + attrs['long_name']\n if attrs.has_key('short_name'):\n new_attrs['short_name'] = 'd_' + attrs['short_name'] + '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility function for identifying None or NaN (which are indistinguishable in pandas). | def pd_isnan(val):
return val is None or val != val | [
"def na_value():\n return None",
"def checkfornan(chosen_df):\n if not chosen_df.isnull().values.any():\n raise ValueError('NaN in DataFrame')",
"def check_null(df):\n return df.isnull().sum()",
"def handleNone(df):\n df = df.dropna()\n df = df.reset_index()\n return(df)",
"def is_n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility function for equating the GDX special values that map to None or NaN (which are indistinguishable in pandas). | def gdx_isnan(val,gdxf):
return val in [SPECIAL_VALUES[0], SPECIAL_VALUES[1]] | [
"def pd_isnan(val):\n return val is None or val != val",
"def na_value():\n return None",
"def test_global_na_reps(self):\n df = pd.DataFrame(np.random.rand(10, 10))\n ix = np.random.randint(0, df.shape[0], size=(5,))\n ix = np.unique(ix)\n for i in xrange(ix.shape[0]):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load special values Needs to be called after gdxcc is loaded. Populates the module attributes SPECIAL_VALUES, GDX_TO_NP_SVS, and NP_TO_GDX_SVS. | def load_specials(gams_dir_finder):
global SPECIAL_VALUES
global GDX_TO_NP_SVS
global NP_TO_GDX_SVS
H = gdxcc.new_gdxHandle_tp()
rc = gdxcc.gdxCreateD(H, gams_dir_finder.gams_dir, gdxcc.GMS_SSSIZE)
if not rc:
raise Exception(rc[1])
# get special values
special_values = gdxcc.dou... | [
"def test_register_standard_variables(self):\n pass",
"def _load_parameter(self):",
"def _setup_special_names(self):\n special_names = []\n dynamic_params = tuple(set(self._fget_params_list + self._fset_params_list))\n # Check whether class variables of DynamicProperty type are prese... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given the passed in year int, return the date Mother's Day is celebrated assuming it's the 2nd Sunday of May. | def get_mothers_day_date(year):
day = date(year=year, month=5, day=1)
while 1:
if day.weekday() == 6:
day += timedelta(days=7)
break
day += timedelta(days=1)
return day | [
"def get_mothers_day_date(year):\n return date(year, 5, 1) + rd.relativedelta(weekday=rd.SU(+2))",
"def get_mothers_day_date(year):\r\n start_date = parse(f\"Jan {year}\").date()\r\n for date in rrule(YEARLY, dtstart=start_date, bymonth=5, byweekday=SU, bysetpos=2):\r\n if date.year == year:\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return items for the query string | def get_items_for_query(self, query_str):
raise NotImplementedError() | [
"def build_item_query(request):\r\n params = _copy_nomulti(request.GET)\r\n # some different ordering may be more optimal here /\r\n # some index could be specifically created.\r\n # Also this could be rewritten to use ebpub.db.schemafilter\r\n filters = [_schema_filter,\r\n _id_filter,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change paint brush size. | def changeSize(self, value):
self.layer.brush_size = value | [
"def brush_size(self, new_value: int) -> None:\n # get the brush size context and set its value\n with self._brush_size.get_lock():\n # if the brush size is different, queue a cursor update\n if self._brush_size.value != new_value:\n self.is_cursor_change = True\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle contiguous state of label layer. | def change_contig(self, state):
if state == Qt.Checked:
self.layer.contiguous = True
else:
self.layer.contiguous = False | [
"def toggleLabel(self):\r\n if self._label:\r\n if self._showLabel:\r\n self._label.grid(row = 0, column = 1)\r\n self._showLabel = False\r\n else:\r\n self._label.grid_remove()\r\n self._showLabel = True\r\n \r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle ndimensional state of label layer. | def change_ndim(self, state):
if state == Qt.Checked:
self.layer.n_dimensional = True
else:
self.layer.n_dimensional = False | [
"def toggleLabel(self):\r\n if self._label:\r\n if self._showLabel:\r\n self._label.grid(row = 0, column = 1)\r\n self._showLabel = False\r\n else:\r\n self._label.grid_remove()\r\n self._showLabel = True\r\n \r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update brush size for the label layer. | def _on_brush_size_change(self, event=None):
with self.layer.events.brush_size.blocker():
value = self.layer.brush_size
value = np.clip(int(value), 1, 40)
self.brushSizeSlider.setValue(value) | [
"def changeSize(self, value):\n self.layer.brush_size = value",
"def updateWidthFromLabel(self):\n prevWidth = self.rect().width()\n width = self.text.boundingRect().width() + \\\n CurrentTheme.VERSION_LABEL_MARGIN[0] - 4\n r = self.rect()\n r.setX(r.x()+(prevWidth-wi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return input and output datastore dictionaries, generated based on syntactically valid initial configurations located at init_path. | def create_DAOs_from_config_file(self, init_path: str) -> (dict, dict):
# with open(init_path, 'r') as stream:
# try:
# parsed_DS_init = yaml.safe_load(stream)
# # print(parsed_DS_init)
# input_datastore_interfaces = self._get_DAOs(parsed_DS_init[... | [
"def init_objects(config_dict):\n # only testing purposes\n obj_list = dict()\n obj_list['input_cfg'] = config_dict\n return obj_list",
"def init_dict_flat_to_init_dict(init_dict_flat):\n\n init_dict = dict()\n\n init_dict[\"GENERAL\"] = dict()\n init_dict[\"GENERAL\"][\"num_periods\"] = init... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For booking the room using Customer and Room. | def booking(self, customer, room):
self.room[room] = customer
return True | [
"def room_of(self, guest_name):\n pass",
"def test_update_function_room_booking(self):\n pass",
"async def room(self, event):\n await self.send_json({\n 'type': 'room',\n 'action': event[\"action\"],\n 'room': event[\"room\"]\n })",
"def make_hard_b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
r"""Extract the mixture terms from a `Subtensor` applied to stacked `RandomVariable`\s. | def get_stack_mixture_vars(
node: Apply,
) -> Optional[List[TensorVariable]]:
if not isinstance(node.op, subtensor_ops):
return None # pragma: no cover
joined_rvs = node.inputs[0]
# First, make sure that it's some sort of concatenation
if not (joined_rvs.owner and isinstance(joined_rvs.ow... | [
"def _sample_mixture(self, parms):\n K = self.args['n_mixtures']\n\n pi_logits = tf.slice(parms, begin=[0, 0, 2 * K], size=[-1, -1, K])\n\n samp = tf.random_uniform(tf.shape(pi_logits), minval=1e-5, maxval=1 - 1e-5)\n samp = tf.log(-tf.log(samp)) # scale the samples to (-infty, infty)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
r"""Identify mixture subgraphs and replace them with a placeholder `Op`. The basic idea is to find ``stack(mixture_comps)[I_rv]``, where ``mixture_comps`` is a ``list`` of `RandomVariable`\s and ``I_rv`` is a `RandomVariable` with a discrete and finite support. From these terms, new terms ``Z_rv[i] = mixture_comps[i][i... | def mixture_replace(fgraph, node):
rv_map_feature = getattr(fgraph, "preserve_rv_mappings", None)
if rv_map_feature is None:
return None # pragma: no cover
out_var = node.default_output()
if out_var not in rv_map_feature.rv_values:
return None # pragma: no cover
mixture_res = ... | [
"def get_stack_mixture_vars(\n node: Apply,\n) -> Optional[List[TensorVariable]]:\n if not isinstance(node.op, subtensor_ops):\n return None # pragma: no cover\n\n joined_rvs = node.inputs[0]\n\n # First, make sure that it's some sort of concatenation\n if not (joined_rvs.owner and isinstance... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
graph is a snap.PNEANet network (directed edges, attributes allowed for edges and nodes) k is an integer, the desired number of seed nodes returns a Python set of node ids selected from graph according to an algorithm | def select_seeds(self, graph, k):
raise NotImplementedError
return set() | [
"def instantiate_k_graph(k):\n k_graph = nx.Graph()\n nodes = range(1, k + 1)\n k_graph.add_nodes_from(nodes)\n for i in nodes:\n for j in nodes:\n if i != j:\n k_graph.add_edge(i, j, weight=1)\n return k_graph",
"def __generate_random_nodes(self,k=3):\n if k... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes a digest for the dataset. Called if the user doesn't supply a digest when constructing the dataset. | def _compute_digest(self) -> str:
return compute_numpy_digest(self._features, self._targets) | [
"def digestFunction(self, data):\n import hashlib\n return hashlib.sha1(data).digest();",
"def digest(self, *args):\n return self._hash.digest(*args)",
"def digest(self):\n # we cache it because it requested twice: from `exists` and from `dumps`\n if self._digest is None:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |