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 |
|---|---|---|---|---|---|---|
Changes the query into a blacklist object | def to_object(cls, query_dict: Dict):
blacklist_token = TokenBlackList()
blacklist_token.id = query_dict.get("id")
blacklist_token.token = query_dict.get("token")
return blacklist_token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_blacklist(self):\n blacklist = {}\n for b in TransifexBlacklist.objects.filter(domain=self.app.domain, app_id=self.app.id).all():\n blacklist.setdefault(b.domain, {})\n blacklist[b.domain].setdefault(b.app_id, {})\n blacklist[b.domain][b.app_id].setdefault(b.... | [
"0.6502428",
"0.6085175",
"0.6066217",
"0.5927129",
"0.5723195",
"0.56740177",
"0.56622916",
"0.5618572",
"0.55632913",
"0.55205286",
"0.5502366",
"0.5495288",
"0.5448463",
"0.5372528",
"0.5353875",
"0.5301453",
"0.5279362",
"0.52424043",
"0.5235201",
"0.5227753",
"0.5216295"... | 0.6298505 | 1 |
Creates a vote table | def migrate(cls)->None:
database.cursor.execute("""CREATE TABLE IF NOT EXISTS votes(
id serial PRIMARY KEY,
question integer,
user_id integer,
value integer
)""")
database.connection.commit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_vote(self):\n con = psycopg2.connect(**self.config)\n cur = con.cursor(cursor_factory=RealDictCursor)\n try:\n query = \"INSERT INTO votes(user_id, answer_id, vote) VALUES(%s, %s, %s)\"\n cur.execute(query, (self.user_id, self.answer_id, self.vote_value))\n ... | [
"0.72537965",
"0.6347137",
"0.6347058",
"0.62431365",
"0.6229676",
"0.61238784",
"0.6106518",
"0.5941983",
"0.59268236",
"0.58737713",
"0.5819705",
"0.5805557",
"0.57593477",
"0.57249165",
"0.5707544",
"0.5687241",
"0.5686213",
"0.56618017",
"0.5659684",
"0.56508785",
"0.5649... | 0.7260595 | 0 |
Changes a query statement to a vote object | def to_object(cls, query_dict: Dict):
vote = Vote()
vote.question = query_dict.get("question")
vote.user = query_dict.get("user_id")
vote.value = query_dict.get("value")
vote.id = query_dict.get("id")
return vote | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_vote(self):\n if not self.answer_id:\n return False\n try:\n con = psycopg2.connect(**self.config)\n cur = con.cursor(cursor_factory=RealDictCursor)\n query = \"UPDATE votes SET vote=%s WHERE answer_id=%s AND user_id=%s\"\n cur.execute... | [
"0.59683233",
"0.5880749",
"0.58050936",
"0.56936055",
"0.5522925",
"0.5483632",
"0.5411588",
"0.53385174",
"0.5293469",
"0.5277768",
"0.5243413",
"0.52347285",
"0.5223527",
"0.5154025",
"0.513131",
"0.5100512",
"0.5087843",
"0.507277",
"0.5037075",
"0.5037075",
"0.5037075",
... | 0.6335785 | 0 |
Creates and displays the new book dialog | def new_book():
new_book_view = NewBookDialog()
new_book_form_args = [
("Book ID : ", 0.2),
("Title : ", 0.35),
("Author : ", 0.50),
("Status(Avail/issued) : ", 0.65)
]
new_book_view.create_components(new_book_form_args)
new_book_view.mainloop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_book():\n return_book_tk = ReturnBookDialog()\n entries_args = [\n (\"Book ID : \", 0.5),\n ]\n return_book_tk.create_components(entries_args)\n return_book_tk.mainloop()",
"def issue_book():\n issue_book_tk = IssueBookDialog()\n entries_args = [\n (\"Book ID : \", 0... | [
"0.75677246",
"0.7259914",
"0.7053564",
"0.69849026",
"0.6955645",
"0.6869542",
"0.6770506",
"0.6567847",
"0.63779676",
"0.6302822",
"0.6275217",
"0.62329596",
"0.62172896",
"0.620906",
"0.6150532",
"0.6101028",
"0.6086634",
"0.6072151",
"0.60621595",
"0.5918835",
"0.5801447"... | 0.90585357 | 0 |
Create and displays delete book dialog | def delete():
add_book_tk = DeleteBookDialog()
entries_args = [
("Book ID : ", 0.5),
]
add_book_tk.create_components(entries_args)
add_book_tk.mainloop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_book():\n new_book_view = NewBookDialog()\n new_book_form_args = [\n (\"Book ID : \", 0.2),\n (\"Title : \", 0.35),\n (\"Author : \", 0.50),\n (\"Status(Avail/issued) : \", 0.65)\n ]\n new_book_view.create_components(new_book_form_args)\n new_book_view.mainloop()"... | [
"0.7224615",
"0.69042754",
"0.6800048",
"0.66359586",
"0.65127826",
"0.6475461",
"0.6376675",
"0.63395935",
"0.6288275",
"0.61189127",
"0.60997295",
"0.60176045",
"0.6012929",
"0.5949892",
"0.59315914",
"0.59211504",
"0.59164464",
"0.5821796",
"0.574409",
"0.56680983",
"0.566... | 0.8708323 | 0 |
Creates and displays the issue book dialog | def issue_book():
issue_book_tk = IssueBookDialog()
entries_args = [
("Book ID : ", 0.2),
("Issued To : ", 0.4)
]
issue_book_tk.create_components(entries_args)
issue_book_tk.mainloop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_book():\n new_book_view = NewBookDialog()\n new_book_form_args = [\n (\"Book ID : \", 0.2),\n (\"Title : \", 0.35),\n (\"Author : \", 0.50),\n (\"Status(Avail/issued) : \", 0.65)\n ]\n new_book_view.create_components(new_book_form_args)\n new_book_view.mainloop()"... | [
"0.6667982",
"0.62041503",
"0.61285585",
"0.6013697",
"0.5752049",
"0.559286",
"0.54231405",
"0.5406232",
"0.52631855",
"0.5243814",
"0.52180356",
"0.51995844",
"0.5178735",
"0.51081455",
"0.51078814",
"0.51062286",
"0.5081688",
"0.50712204",
"0.50687456",
"0.5065774",
"0.505... | 0.8727966 | 0 |
Creates and displays the return book dialog | def return_book():
return_book_tk = ReturnBookDialog()
entries_args = [
("Book ID : ", 0.5),
]
return_book_tk.create_components(entries_args)
return_book_tk.mainloop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_book():\n new_book_view = NewBookDialog()\n new_book_form_args = [\n (\"Book ID : \", 0.2),\n (\"Title : \", 0.35),\n (\"Author : \", 0.50),\n (\"Status(Avail/issued) : \", 0.65)\n ]\n new_book_view.create_components(new_book_form_args)\n new_book_view.mainloop()"... | [
"0.7280143",
"0.6832027",
"0.6583196",
"0.63116056",
"0.57023233",
"0.5699411",
"0.5669833",
"0.5582593",
"0.5578923",
"0.554704",
"0.5537643",
"0.551354",
"0.5502598",
"0.54679507",
"0.54604983",
"0.54595494",
"0.54554695",
"0.54478306",
"0.54423785",
"0.538152",
"0.53546685... | 0.86650276 | 0 |
Creates and displays the book list dialog | def list_books():
view_book_tk = BooklistDialog()
view_book_tk.create_components()
view_book_tk.mainloop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_book():\n new_book_view = NewBookDialog()\n new_book_form_args = [\n (\"Book ID : \", 0.2),\n (\"Title : \", 0.35),\n (\"Author : \", 0.50),\n (\"Status(Avail/issued) : \", 0.65)\n ]\n new_book_view.create_components(new_book_form_args)\n new_book_view.mainloop()"... | [
"0.7511117",
"0.6877433",
"0.68005514",
"0.6707956",
"0.6416034",
"0.6386007",
"0.6356187",
"0.62019783",
"0.6129462",
"0.6067433",
"0.6005865",
"0.59071875",
"0.5831534",
"0.58007747",
"0.5748633",
"0.57402396",
"0.5701962",
"0.56376714",
"0.5613135",
"0.5612722",
"0.5590351... | 0.86163336 | 0 |
mag2flux is a function to convert AB magnitude to flam. | def mag2flux(mag,emag,wave):
flam = 10**(-0.4 * (mag + 2.406 + 5.*np.log10(wave)))
eflam = flam * np.log(10.) * 0.4 * emag
return flam,eflam | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mag_to_flux(mag, mag_zp):\n return 10 ** (-0.4 * (mag - mag_zp))",
"def magtoflux(_mag, _id):\n return math.pow(10, -0.4*(_mag + VegaToAB[_id] - 8.9))",
"def mag2Flux(mag, unit='maggy'):\n flux = 10.0 ** (-0.4 * mag)\n\n if unit.lower().strip() == 'jy':\n return flux * 3631.0\n\n if u... | [
"0.7661163",
"0.76591533",
"0.7333106",
"0.72614634",
"0.7211719",
"0.70236474",
"0.6988646",
"0.69357157",
"0.6924593",
"0.683043",
"0.6827836",
"0.67973167",
"0.6711155",
"0.64483994",
"0.63337207",
"0.6265689",
"0.61794144",
"0.6156138",
"0.61506623",
"0.6146087",
"0.61387... | 0.77937734 | 0 |
This is an extremely fast approach to datetime parsing. For large data, the same dates are often repeated. Rather than reparse these, we store all unique dates, parse them, and use a lookup to convert all dates. | def lookup(s):
dates = {date:pd.to_datetime(date) for date in s.unique()}
return s.map(dates) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_parser(dates):\n\n #splitting the dates(containing datetime data) list and returning only the datetime\n return([item.split()[0] for item in dates])\n pass",
"def fix_dates(line, date_names, headers):\n date_idxs = [headers.index(date_name) for date_name in date_names]\n for date_idx in d... | [
"0.67357934",
"0.62497675",
"0.6154008",
"0.6127208",
"0.60856044",
"0.6052707",
"0.6017208",
"0.60166144",
"0.6015556",
"0.5990067",
"0.597251",
"0.59648377",
"0.5945007",
"0.58950764",
"0.5867583",
"0.5825158",
"0.57935846",
"0.5774747",
"0.57724506",
"0.5764889",
"0.574258... | 0.6379375 | 1 |
Function to add OU noise to the action for exploration | def add_noise(self, action, step, noise_scale = 0.1):
#noise_scale *= 1/((step+1)**0.5)
action += noise_scale * np.random.randn(self.act_dim)
action = np.clip(action, -self.act_limit, self.act_limit)[0]
return action | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_with_noise(self, observation):\n if self.replay_buffer.size > self.warmup_size:\n action = self.action(observation)\n else:\n action = self.random_action(observation)\n noise = np.clip(np.random.randn(self.action_dim) * self.sigma,\n -sel... | [
"0.625405",
"0.618869",
"0.59336203",
"0.5845028",
"0.5840156",
"0.5697378",
"0.5685795",
"0.56381315",
"0.5515624",
"0.5483727",
"0.5480744",
"0.543956",
"0.5392059",
"0.53851455",
"0.5377592",
"0.5348284",
"0.53475535",
"0.533144",
"0.53048897",
"0.5295868",
"0.5267099",
... | 0.6733656 | 0 |
This function closes all the running environments | def close(self):
self.env.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_env(self):\n self.env.close()",
"def terminate(self):\n super(ReacherEnv, self).close()",
"def close(self):\n logging.info(\"closing SmartBotEnv\")\n super(gym.Env, self).close()",
"def close_all(cls):\n for sess in cls._session_registry.values():\n ses... | [
"0.76627684",
"0.7487623",
"0.7287174",
"0.6945162",
"0.69032234",
"0.68103516",
"0.67547697",
"0.6749574",
"0.67066413",
"0.67006475",
"0.66823053",
"0.66276664",
"0.6606506",
"0.6530487",
"0.64881",
"0.64486605",
"0.64477766",
"0.64251876",
"0.64243454",
"0.64160746",
"0.64... | 0.7708157 | 0 |
Renders n episodes using the current policy network | def render_episode(self, n=1):
for i in range(n):
state = self.env.reset()
total_reward = 0
done = False
while not done:
time.sleep(0.0001)
self.env.render()
action = self.select_action(state)
next_state, reward, done, _ = self.env.step(action)
state = next_state
total_reward += re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_episode(env, policy):\n\n episode_reward = 0\n ob = env.reset()\n for t in range(100):\n env.render()\n time.sleep(0.5) \n a = policy[ob]\n ob, rew, done, _ = env.step(a)\n episode_reward += rew\n if done:\n break\n assert done\n env.r... | [
"0.6692261",
"0.6429705",
"0.6326336",
"0.611608",
"0.602928",
"0.60010785",
"0.59297884",
"0.5808117",
"0.5795637",
"0.57400113",
"0.5737407",
"0.5648403",
"0.5634786",
"0.5634786",
"0.5629822",
"0.5629453",
"0.5601572",
"0.55763614",
"0.5560587",
"0.55336034",
"0.5533146",
... | 0.69334227 | 0 |
The Cloud SQL charset value. | def charset(self) -> str:
return pulumi.get(self, "charset") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def charset(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"charset\")",
"def charset(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"charset\")",
"def charset(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"charset\")",
"def charset(self):\n ... | [
"0.7655354",
"0.7655354",
"0.74394107",
"0.7378591",
"0.6875573",
"0.6809618",
"0.66948724",
"0.6511739",
"0.638755",
"0.63792366",
"0.62944776",
"0.62939924",
"0.6271712",
"0.626414",
"0.6260002",
"0.61940587",
"0.61940587",
"0.61930704",
"0.61044776",
"0.60993606",
"0.60976... | 0.7819781 | 0 |
The Cloud SQL collation value. | def collation(self) -> str:
return pulumi.get(self, "collation") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collation(self) -> Optional[str]:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> ... | [
"0.8259287",
"0.8153705",
"0.80996335",
"0.80996335",
"0.7659596",
"0.68911797",
"0.670639",
"0.64089656",
"0.60281724",
"0.59352213",
"0.57849586",
"0.5730767",
"0.5675355",
"0.5572144",
"0.5428307",
"0.5390299",
"0.5383137",
"0.5351167",
"0.53033125",
"0.5221688",
"0.521594... | 0.8421332 | 1 |
Retrieves a resource containing information about a database inside a Cloud SQL instance. | def get_database(database: Optional[str] = None,
instance: Optional[str] = None,
project: Optional[str] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDatabaseResult:
__args__ = dict()
__args__['database'] = database
__args__['instance'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_database(self, instance, name):\n return instance.get_database(name)",
"def get_database(self, database, instance=None):\n return self._get(_database.Database, database)",
"def get_db(self):\n self.logger.info('in get_db()')\n try:\n return self.client[self.db_nam... | [
"0.7144928",
"0.7055207",
"0.70509905",
"0.6934732",
"0.69012326",
"0.6749272",
"0.66674757",
"0.6563351",
"0.6534917",
"0.6470718",
"0.64540935",
"0.6443958",
"0.6440152",
"0.6412776",
"0.64113146",
"0.6279033",
"0.6275454",
"0.6275454",
"0.6273516",
"0.6264288",
"0.6248671"... | 0.7393007 | 0 |
Get the APOD(Astronomical Picture of the day) data | def get_apod_data(api_key: str, download: bool = False, path: str = ".") -> dict:
url = "https://api.nasa.gov/planetary/apod"
return requests.get(url, params={"api_key": api_key}).json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def explore_FAAM_aerosol_data():\n # -- PCASP\n dsPCASP = get_FAAM_mineral_dust_calibration(instrument='PCASP',\n rtn_values=False)\n # -- CDP\n dsCDP = get_FAAM_mineral_dust_calibration(instrument='CDP',\n rtn_... | [
"0.59009635",
"0.5657097",
"0.5565384",
"0.5556446",
"0.55365324",
"0.5414477",
"0.5413029",
"0.5324717",
"0.5319235",
"0.5307204",
"0.52683306",
"0.52426034",
"0.52313936",
"0.5226201",
"0.5210116",
"0.51927495",
"0.5180551",
"0.5176998",
"0.517675",
"0.5172728",
"0.51656044... | 0.5878473 | 1 |
Get the data of a particular query from NASA archives | def get_archive_data(query: str) -> dict:
url = "https://images-api.nasa.gov/search"
return requests.get(url, params={"q": query}).json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAMsFromQuery(query):\n string = \"\"\"curl -X POST -H \"Content-Type: application/json\" -d '{{\"query\": \"{query}\"}}' tni-test.cern.ch/search/search\"\"\".format(query=query)\n result = json.loads(os.popen(string).read())\n return result",
"def as_query(as_number):\n response = get(BASE_API... | [
"0.6441405",
"0.6274045",
"0.6148951",
"0.6019121",
"0.59822804",
"0.5893941",
"0.5851716",
"0.578288",
"0.5747291",
"0.57457644",
"0.57382286",
"0.5729979",
"0.5717775",
"0.56797",
"0.5667498",
"0.56542295",
"0.561929",
"0.55957085",
"0.559312",
"0.5591682",
"0.5589367",
"... | 0.7600029 | 0 |
Capacity is the static size of the array. fillValue is placed at each position. | def __init__(self, capacity, fillValue = None):
self._items = list()
self._fillValue = fillValue
self._DEFAULT_CAPACITY = capacity
self._logicalSize = 0 #as required by exercise 1
for count in xrange(capacity):
self._items.append(self._fill... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, capacity, fillValue=None):\r\n self._items = list()\r\n for count in range(capacity):\r\n self._items.append(fillValue)",
"def __init__(self, capacity, fillValue=None):\r\n self._items = list()\r\n self._logicalSize = 0\r\n # Track the capacity and... | [
"0.72756517",
"0.7070662",
"0.69123954",
"0.68207943",
"0.6160506",
"0.6125096",
"0.6075469",
"0.603681",
"0.6020266",
"0.5992947",
"0.5944047",
"0.5909096",
"0.5896172",
"0.58946216",
"0.5862521",
"0.58049583",
"0.57762265",
"0.5775138",
"0.57401764",
"0.5713871",
"0.5699855... | 0.7228704 | 1 |
Increase the physical size of the array. elements will be the number of elements to grow the list by. | def _grow(self):
limit = 0
#Iterating through the list to find the number of elements
for i in xrange(len(self)):
if self._items[i] != self._fillValue:
#There's an element at index i, so update the limit
limit = i
#Only grow ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _resize_list(self, new_size: int):\n for _ in range((new_size + 1) - len(self)):\n self.append(0)",
"def grow(self):\r\n\r\n old = self._data\r\n self._capacity = 2 * self._capacity\r\n self._data = [0] * self._capacity\r\n\r\n for i in range(self._size):\r\n\r\n... | [
"0.723754",
"0.7006949",
"0.69387287",
"0.68290293",
"0.6684258",
"0.66072136",
"0.6519302",
"0.63932407",
"0.6314337",
"0.631109",
"0.6308263",
"0.6292862",
"0.6267555",
"0.6264283",
"0.6260355",
"0.6213809",
"0.6206599",
"0.61833245",
"0.61793137",
"0.6166329",
"0.6139168",... | 0.73504925 | 0 |
Remove an item from the list at position targetIndex | def _remove(self, targetIndex):
if 0 <= targetIndex and targetIndex < len(self):
limit = 0
for i in xrange(len(self)):
if self._items[i] != self._fillValue:
#There's an element at index i, so update the limit
limit = i
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_number_from_list(self, target:list, value:int, position:int)->None:\n target[position].remove(value)",
"def remove_from_list(self,list_,index):\r\n try:\r\n return list_.pop(self._index_to_int(index))\r\n except IndexError:\r\n self._index_error(list_,index)... | [
"0.755241",
"0.74490976",
"0.72779137",
"0.70214707",
"0.6954867",
"0.69424415",
"0.6905567",
"0.684145",
"0.6736705",
"0.6699253",
"0.6649684",
"0.66303796",
"0.66280454",
"0.66235954",
"0.65876687",
"0.65836215",
"0.65818614",
"0.65666896",
"0.65627414",
"0.65624344",
"0.65... | 0.7958847 | 0 |
Replace the existing value of the self.data attribute with new_data parameter. | def set_data(self, new_data):
self.data = new_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setData(self,newData):\r\n pass",
"def setData(self,newdata):\n self.record(inspect.currentframe())\n if np.shape(newdata) == np.shape(self.data):\n self.data = np.copy(newdata)",
"def _update_data(self, data, update_original=False):\n self._data.update(dict((key, sel... | [
"0.79708254",
"0.77804124",
"0.7759733",
"0.77236235",
"0.77044475",
"0.7677274",
"0.7677114",
"0.7594061",
"0.75861555",
"0.75861555",
"0.75861555",
"0.75591713",
"0.748598",
"0.7440727",
"0.7426882",
"0.7426882",
"0.73479205",
"0.7342873",
"0.73273635",
"0.7314341",
"0.7314... | 0.86256135 | 0 |
Return the self.next attribute | def get_next(self):
return self.next | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next(self):\n return self.__next",
"def next(self):\r\n return self.__next",
"def next(self) -> object:\n return self._next",
"def next(self):\n return self._next",
"def getNext(self):\n\t\t\treturn self.next",
"def next(self):\n return self.my_next",
"def... | [
"0.89772123",
"0.8973727",
"0.8845099",
"0.87910503",
"0.8781539",
"0.8774889",
"0.87595576",
"0.85931236",
"0.847898",
"0.847898",
"0.847898",
"0.847898",
"0.847898",
"0.847898",
"0.847898",
"0.8216983",
"0.8215373",
"0.8215373",
"0.8215373",
"0.81972444",
"0.81638587",
"0... | 0.9051597 | 1 |
Replace the existing value of the self.next attribute with new_next parameter. | def set_next(self, new_next):
self.next = new_next | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setNext(self, next):\n\t\t\tself.next = next",
"def setNext(self, nextNode):\n self.__next = nextNode",
"def set_next(self, node):\r\n self.__next = node",
"def set_next(self, node):\n self.__next = node",
"def set_next(node, value):\n node['next'] = value",
"def setNe... | [
"0.8221679",
"0.79532444",
"0.7746553",
"0.7710341",
"0.75647426",
"0.75467986",
"0.7499936",
"0.7499936",
"0.7002299",
"0.68179524",
"0.6663745",
"0.6420746",
"0.62972397",
"0.62633955",
"0.62383527",
"0.62383527",
"0.6170943",
"0.61351043",
"0.6118974",
"0.61031634",
"0.608... | 0.86737543 | 0 |
Return the self.previous attribute | def get_previous(self):
return self.previous | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPrevious(self):\n return self.__previous__",
"def previous(self):\n return self.my_previous",
"def prev(self):\n return self.__prev",
"def get_prev(self):\n return self.prev",
"def previous(self):\n\n pass",
"def getPrev(self):\n\t\t\treturn self.prev",
"def ge... | [
"0.91499484",
"0.9087153",
"0.90305394",
"0.8968154",
"0.8755418",
"0.87482905",
"0.8730422",
"0.82957596",
"0.8263751",
"0.8260773",
"0.8050477",
"0.7934981",
"0.7931946",
"0.78943276",
"0.775058",
"0.77408016",
"0.7727495",
"0.7704065",
"0.76102555",
"0.76044416",
"0.757480... | 0.9177642 | 0 |
Replace the existing value of the self.previous attribute with new_previous parameter. | def set_previous(self, new_previous):
self.previous = new_previous | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPrev(self, prev):\n\t\t\tself.prev = prev",
"def prev(self, prev):\n\n self._prev = prev",
"def set_prev(self, p) -> None:\n self.prev = p",
"def prev(self,p):\n assert type(p) is type(self)\n self.__prev = p",
"def previous(self, _event):\n self.set_val(self.val -... | [
"0.7485387",
"0.7345779",
"0.70232517",
"0.67961776",
"0.67961144",
"0.6632646",
"0.6509174",
"0.64484227",
"0.64224696",
"0.63190126",
"0.62682027",
"0.6267136",
"0.6227941",
"0.62051636",
"0.6194809",
"0.6149025",
"0.6143375",
"0.6099491",
"0.6030055",
"0.6028772",
"0.59858... | 0.8530623 | 0 |
Checks if group "group" contains a sprite with bottom "bottom" | def group_has_bottom(group: pygame.sprite.Group, bottom: int):
for sprite in group:
if sprite.rect.bottom == bottom:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_bottom_sprites(group: pygame.sprite.Group):\r\n bottom = max(map(lambda sprt: sprt.rect.bottom, group), default=RESOLUTION[1])\r\n return list(filter(lambda sprt: sprt.rect.bottom == bottom, group))",
"def checkBottom(self):\n exposed = True\n for sprite in self.overlapping_sprites:... | [
"0.7531233",
"0.7388793",
"0.72969383",
"0.673616",
"0.66741395",
"0.66741395",
"0.6610362",
"0.6590212",
"0.6354262",
"0.63413304",
"0.6324987",
"0.61557347",
"0.61441636",
"0.6143327",
"0.6131096",
"0.611867",
"0.60630614",
"0.6060846",
"0.6043869",
"0.603344",
"0.58899593"... | 0.909547 | 0 |
Returns the bottom of the lowest (on the screen) sprite in the group | def group_bottom(group: pygame.sprite.Group):
return max(map(lambda sprt: sprt.rect.bottom, group), default=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_bottom_sprites(group: pygame.sprite.Group):\r\n bottom = max(map(lambda sprt: sprt.rect.bottom, group), default=RESOLUTION[1])\r\n return list(filter(lambda sprt: sprt.rect.bottom == bottom, group))",
"def _rect_bottom(self):\n\treturn min(self.y, self.y + self.h)",
"def group_top(group: pygame... | [
"0.73001444",
"0.72404194",
"0.7028626",
"0.6935661",
"0.68792474",
"0.68075174",
"0.6570141",
"0.64901865",
"0.6404709",
"0.6368164",
"0.63623774",
"0.63623774",
"0.6303562",
"0.61939776",
"0.61793435",
"0.6111214",
"0.61104757",
"0.6104443",
"0.6100537",
"0.60762507",
"0.60... | 0.8172834 | 0 |
Returns a list of the group's sprites which have the lowest (on the screen) bottom | def group_bottom_sprites(group: pygame.sprite.Group):
bottom = max(map(lambda sprt: sprt.rect.bottom, group), default=RESOLUTION[1])
return list(filter(lambda sprt: sprt.rect.bottom == bottom, group)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_bottom(group: pygame.sprite.Group):\r\n return max(map(lambda sprt: sprt.rect.bottom, group), default=0)",
"def group_has_bottom(group: pygame.sprite.Group, bottom: int):\r\n for sprite in group:\r\n if sprite.rect.bottom == bottom:\r\n return True\r\n return False",
"def g... | [
"0.7760479",
"0.7043942",
"0.68440634",
"0.6351416",
"0.62923205",
"0.61345696",
"0.5933899",
"0.5900068",
"0.5883255",
"0.5833827",
"0.5833827",
"0.58016676",
"0.57473546",
"0.5719199",
"0.56806684",
"0.5658385",
"0.56184375",
"0.55891573",
"0.5564049",
"0.55321896",
"0.5473... | 0.8334129 | 0 |
Returns the highest (on the screen) top of the group's sprites whose rects have the same centerx as "rect.centerx" and lower (on the screen) centery than "rect.centery" | def group_top(group: pygame.sprite.Group, rect: pygame.Rect):
same_centerx_lower_centery = filter(lambda sprt: sprt.rect.centerx == rect.centerx
and sprt.rect.centery >= rect.centery, group)
return min(map(lambda sprt: sprt.rect.top, same_centerx_lower_cen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rect_top(self):\n\treturn max(self.y, self.y + self.h)",
"def absolute_collide_bottomright(self):\n x,y = self.position\n rect = self.collide_rect\n return (x+rect.width/2, y)",
"def absolute_collide_topleft(self):\n x,y = self.position\n rect = self.collide_rect\n ... | [
"0.7039691",
"0.6915761",
"0.6821774",
"0.6605683",
"0.62852794",
"0.6066323",
"0.6051855",
"0.5955852",
"0.5951763",
"0.5937266",
"0.58950734",
"0.58910495",
"0.5854065",
"0.58135986",
"0.57965654",
"0.57935864",
"0.57926077",
"0.5782943",
"0.5777361",
"0.57640344",
"0.57552... | 0.82293385 | 0 |
Captures and writes all binomial taxonomy to a CSV file. Loads a NSR Taxonomy export CSV file into a Pandas Dataframe, utf8 encoded. All taxonomic names for specieslevel records are sent to taxonParser() to parse them into their elementary components. Indexes and writes returned species to a CSV file. | def nsrTaxonomy():
# Input file
taxonomyFile = pd.read_csv(args.indir+"/"+args.infile1, header=2,
sep="\t", encoding="utf8")
# Parse taxonomic names into their elementary components
taxonomy = taxonomyFile.loc[taxonomyFile['rank'] == 'soort']
taxonList = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv_export(df_to_export, norm_term, strain_info):\n \n # Makes a list of unique and sorted 'Condition' values to use for the iteration processes.\n i_term = 0\n cond_list = df_to_export.index.get_level_values('Condition')\n cond_list = sorted(list(set(cond_list)))\n \n # Checks for presenc... | [
"0.5702724",
"0.55545807",
"0.5554409",
"0.54113585",
"0.5403077",
"0.5315795",
"0.5292656",
"0.5282144",
"0.52489036",
"0.5242535",
"0.5241261",
"0.52355945",
"0.5230077",
"0.5208896",
"0.52020806",
"0.5177541",
"0.5136121",
"0.50950235",
"0.5084901",
"0.5080631",
"0.5075711... | 0.71761936 | 0 |
Captures and writes all binomial synonyms to a CSV file. Loads a NSR Synonyms export CSV file into a Pandas Dataframe, utf8 encoded. All synonyms with respective taxons of scientific notation are sent to taxonParser() to parse them into their elementary components. Returned synonyms and taxons are paired in a dictionar... | def nsrSynonyms():
# Input file
synonymsFile = pd.read_csv(args.indir+"/"+args.infile2, header=2,
sep="\t", encoding="utf8")
# Parse taxonomic names into their elementary components
synonyms = synonymsFile.loc[synonymsFile['language'] == 'Scientific']
synonymDi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nsrTaxonomy():\r\n # Input file\r\n taxonomyFile = pd.read_csv(args.indir+\"/\"+args.infile1, header=2,\r\n sep=\"\\t\", encoding=\"utf8\")\r\n\r\n # Parse taxonomic names into their elementary components\r\n taxonomy = taxonomyFile.loc[taxonomyFile['rank'] == 'soort']... | [
"0.6672599",
"0.55780566",
"0.54087925",
"0.5307529",
"0.5231768",
"0.5217651",
"0.51196796",
"0.5058816",
"0.50280565",
"0.50155824",
"0.50028706",
"0.49995756",
"0.49774954",
"0.49601024",
"0.4906587",
"0.49037987",
"0.4895481",
"0.48916432",
"0.48725006",
"0.48614877",
"0.... | 0.7668329 | 0 |
Extracts the unique genera from both taxonomy and synonym lists. Combines the scientific names of obtained taxonomy and synonyms to one list, filtering out empty lines. Selects all unique genera. | def nsrGenera(taxonList, synonymList):
species = list(filter(None, sorted(taxonList + synonymList)))
generaList = [i.split()[0] for i in species]
generaList = list(dict.fromkeys(generaList))
return generaList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_taxids(organism_names):\r\n\r\n taxids = []\r\n\r\n for organism in organism_names:\r\n handle = Entrez.esearch(db=\"Taxonomy\", term=organism)\r\n record = Entrez.read(handle)\r\n print(record[\"IdList\"])\r\n try:\r\n taxids.append(record[\"IdList\"][0])\r\n ... | [
"0.58483475",
"0.57564956",
"0.5713733",
"0.5597223",
"0.5593349",
"0.5575435",
"0.55501765",
"0.55426663",
"0.5528878",
"0.5526709",
"0.55139065",
"0.54433954",
"0.5410595",
"0.5390813",
"0.5350315",
"0.5333672",
"0.53171206",
"0.5239787",
"0.52290946",
"0.52280146",
"0.5227... | 0.73842555 | 0 |
Parse any taxonomic name into its elementary components. Used library is a pure Python adaptation of the GBIF Java nameparser library. Taxonomic names are parsed into their elementary components. Genus, specific epithet, and authors are concatenated for all binomial names and returned. For any name that can not be pars... | def taxonParser(taxon):
parser = TaxonParser(taxon)
scientific_name = ""
try:
parsed_name = parser.parse()
if parsed_name.isBinomial() is True:
scientific_name = str(parsed_name.genus) + " " + str(parsed_name.specificEpithet)
if str(parsed_name.combinationAut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_name(name):\n def getnames_form3(a):\n \"\"\"\n Case with two commas: the name is of the format\n von Last, Jr, First\n like in: von Hicks, III, Michael\n \"\"\"\n full_last = a[0].strip()\n full_first = a[2].strip()\n junior = a[1].strip()\n von, last = get_vonlast(full_las... | [
"0.6360899",
"0.6200196",
"0.60890275",
"0.55495",
"0.5527125",
"0.5445628",
"0.5413253",
"0.5326616",
"0.5256787",
"0.5185995",
"0.518358",
"0.51712435",
"0.51481044",
"0.5144318",
"0.5130854",
"0.5105667",
"0.50930095",
"0.50883645",
"0.50816786",
"0.507001",
"0.50672054",
... | 0.6824206 | 0 |
Obtains public sequence data for a list of genera. Downloads records using BOLD's Public Data Portal API. Base URL for data retrieval is appended to each genus from the NSR genera list. Genera are retrieved one genus at a time and saved as TSV file. | def boldExtract(genera):
# Prepare Web Service Endpoint for BOLD's Public Data Portal API
# Appending BOLD's base URL to each genera from the NSR list
base_url = 'http://v4.boldsystems.org/index.php/API_Public/combined?taxon='
source_urls = list(map(lambda x: "{}{}{}".
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getData(constrain):\n\n dat_AGS = chunks(AGS, 100)\n for num, ags_c in enumerate(dat_AGS):\n to_download = DOWNLOAD_LINK.format(ags_id=ags_c, constrain=constrain)\n to_download = to_download.replace(\" \", \"\")\n download_name = \"../Data/Gemeinden/{}-{}.csv\".format(\n c... | [
"0.5800757",
"0.5773918",
"0.57562923",
"0.5750273",
"0.5563472",
"0.55576056",
"0.55207396",
"0.54966235",
"0.5475936",
"0.54077",
"0.5405006",
"0.5378282",
"0.5350513",
"0.5308301",
"0.5304789",
"0.52950597",
"0.5282003",
"0.5281811",
"0.52625406",
"0.52540594",
"0.5246961"... | 0.6815853 | 0 |
Match obtained sequence records to the reference species names. Iterates over every output file from BOLD and compares sequence data to the list of species from the NSR. Subgenera will be filtered out creating a file with as many accepeted names as possible. Mismatches against the NSR are copied to a seperate list. | def boldNSR(species, synonyms, syn_dict, zip_path):
# Loop over each genus(file) downloaded from BOLD
print('Comparing sequence data to list of species...')
# Open genera file from zip
with zipfile.ZipFile(zip_path) as z:
for file in z.namelist():
if not os.path.isdir(file):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fusion(first_fh, fused_fh, compare_file):\r\n # initialize\r\n ha_seq = \"\"\r\n ha_header = \"\"\r\n # parse through file\r\n for line in first_fh:\r\n # if a > is found assume it is header\r\n if line[0] == \">\":\r\n # ha_header = line\r\n # if the header i... | [
"0.657185",
"0.63003784",
"0.62847185",
"0.6195106",
"0.6094556",
"0.5979735",
"0.5977736",
"0.59631824",
"0.5948652",
"0.5921627",
"0.5895784",
"0.5850595",
"0.5828448",
"0.58186305",
"0.5787035",
"0.5777826",
"0.57607555",
"0.57314503",
"0.5728363",
"0.56948674",
"0.5692737... | 0.65645623 | 1 |
Test function with a size ten dictionary containing numbers for both key and value pairs | def test_dict_size_ten_all_number(self):
argument = {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10}
actual = file_io.top_ten(argument)
expected = [[10, 10], [9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]
self.assertEqual(actual, expected) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dict_size_more_than_ten_all_number(self):\n argument = {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13}\n actual = file_io.top_ten(argument)\n expected = [[13, 13], [12, 12], [11, 11], [10, 10], [9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4]]\n ... | [
"0.7428896",
"0.73088276",
"0.71915066",
"0.71915066",
"0.70924616",
"0.7024522",
"0.6956752",
"0.66140836",
"0.65810573",
"0.6534106",
"0.6453248",
"0.6424824",
"0.63760996",
"0.6365938",
"0.63520414",
"0.62804943",
"0.62247354",
"0.619552",
"0.6137762",
"0.6125678",
"0.6091... | 0.7599657 | 0 |
Test function with a size more than ten dictionary containing numbers for both key and value pairs | def test_dict_size_more_than_ten_all_number(self):
argument = {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13}
actual = file_io.top_ten(argument)
expected = [[13, 13], [12, 12], [11, 11], [10, 10], [9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4]]
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dict_size_ten_all_number(self):\n argument = {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10}\n actual = file_io.top_ten(argument)\n expected = [[10, 10], [9, 9], [8, 8], [7, 7], [6, 6], [5, 5], [4, 4], [3, 3], [2, 2], [1, 1]]\n self.assertEqual(actual, expected)"... | [
"0.7614029",
"0.7342805",
"0.7342805",
"0.72277486",
"0.71852154",
"0.7098983",
"0.70393574",
"0.6593105",
"0.65192807",
"0.64581764",
"0.64380145",
"0.63122326",
"0.6304356",
"0.6300816",
"0.6247299",
"0.6188655",
"0.61788714",
"0.6161872",
"0.6160645",
"0.608894",
"0.607777... | 0.7710664 | 0 |
Test function with a size one dictionary uses string for key value | def test_dict_size_one_all_str(self):
argument = {'nothing': 0}
with self.assertRaises(IndexError):
file_io.top_ten(argument) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_has_correct_number_of_keys_and_values(self):\n self.has_correct_number_of_keys_and_values(2, 1)",
"def test_has_correct_number_of_keys_and_values(self):\n self.has_correct_number_of_keys_and_values(2, 1)",
"def test_dict_size_ten_all_str(self):\n argument = {'one': 1, 'two': 2, 't... | [
"0.70188236",
"0.70188236",
"0.6950544",
"0.6758833",
"0.6706267",
"0.65683424",
"0.6438115",
"0.6435873",
"0.64104575",
"0.640265",
"0.6377627",
"0.63164216",
"0.6295011",
"0.624693",
"0.6229202",
"0.6220044",
"0.6176435",
"0.61740553",
"0.61090565",
"0.6105293",
"0.60660094... | 0.7261736 | 0 |
Test function with a size ten dictionary uses string for key value | def test_dict_size_ten_all_str(self):
argument = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8,
'nine': 9, 'ten': 10}
actual = file_io.top_ten(argument)
expected = [[10, 'ten'], [9, 'nine'], [8, 'eight'], [7, 'seven'], [6, 'six'], [5,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dict_size_more_than_ten_all_str(self):\n argument = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8,\n 'nine': 9, 'ten': 10, 'eleven': 11, 'twelve': 12}\n actual = file_io.top_ten(argument)\n expected = [[12, 'twelve'], [11, '... | [
"0.75439656",
"0.72854453",
"0.712414",
"0.70542884",
"0.701452",
"0.6870465",
"0.6870465",
"0.6845746",
"0.66824174",
"0.6412695",
"0.6405524",
"0.63852924",
"0.636289",
"0.63548374",
"0.6281254",
"0.6265659",
"0.618129",
"0.6162142",
"0.612183",
"0.61054075",
"0.6082548",
... | 0.76705295 | 0 |
Test function with a size more than ten dictionary uses string for key value | def test_dict_size_more_than_ten_all_str(self):
argument = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8,
'nine': 9, 'ten': 10, 'eleven': 11, 'twelve': 12}
actual = file_io.top_ten(argument)
expected = [[12, 'twelve'], [11, 'eleven'],... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dict_size_ten_all_str(self):\n argument = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8,\n 'nine': 9, 'ten': 10}\n actual = file_io.top_ten(argument)\n expected = [[10, 'ten'], [9, 'nine'], [8, 'eight'], [7, 'seven'], [6, 's... | [
"0.7523811",
"0.73937875",
"0.7080752",
"0.69418883",
"0.69108796",
"0.69108796",
"0.683805",
"0.6698485",
"0.6509626",
"0.6506673",
"0.62264967",
"0.62199855",
"0.6180996",
"0.6169288",
"0.61430913",
"0.6127582",
"0.60833216",
"0.60657233",
"0.60472697",
"0.6046481",
"0.6046... | 0.75499564 | 0 |
Cloud top pressure in Pascal | def cloudsPressure(self):
return self._cloud_pressure | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loading(self, pressure):\n kp = self.params[\"K\"] * pressure\n return self.params[\"n_m\"] * kp / (1.0 + kp)",
"def spreading_pressure(self, pressure):\n return self.params[\"n_m\"] * numpy.log(1.0 + self.params[\"K\"] * pressure)",
"def execQ3():\n frame = pan.DataFrame(data, colu... | [
"0.60050863",
"0.5955188",
"0.59254307",
"0.5898914",
"0.5860521",
"0.58439153",
"0.58358765",
"0.5831083",
"0.5817319",
"0.5815479",
"0.57994914",
"0.5794241",
"0.57684875",
"0.57684875",
"0.5762985",
"0.576154",
"0.57427794",
"0.5741556",
"0.57241565",
"0.5706314",
"0.56990... | 0.6195289 | 0 |
Retrieves and preprocesses most recent recording. | def prepro_last():
print("Processing most recent recording...")
recent_recording = pr.prepare.get_last_brainwaves()
prep_df = pr.prepare.trim_df(recent_recording)
rebuilt_df = pr.build_frame.restructure_df(prep_df)
filtered_df = pr.build_frame.filter_restructure(rebuilt_df)
return filtered_df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current(self):\n\t\treturn self.reading_set.latest(field_name='time')",
"def get_last_sample(self) -> InternalSample:",
"def getLatestMeasurement(self): \n return self.measurement[len(self.measurement)-1]",
"def getrecord():\n global nrecord, totrecords, EOF\n \n nrecord = nrecord ... | [
"0.6189799",
"0.61433953",
"0.6040859",
"0.60281664",
"0.6017128",
"0.58430445",
"0.58274335",
"0.56971407",
"0.5686214",
"0.5681591",
"0.56796926",
"0.5624033",
"0.56178355",
"0.55976206",
"0.5586698",
"0.55721146",
"0.554477",
"0.5542349",
"0.5531062",
"0.55217874",
"0.5511... | 0.71573514 | 0 |
V.CopyAllocate(vtkDataSetAttributes, int, int, int) | def CopyAllocate(self, vtkDataSetAttributes, p_int, p_int_1, p_int_2):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CopyData(self, p_int, vtkDataSetAttributes, p_int_1, vtkDataSetAttributes_1, p_int_2):\n ...",
"def allocate(self):\n raise NotImplementedError",
"def allocatememory(self):\n\n for key, value in self._dentsvertsdata.items():\n value.allocatememory()",
"def Copy(self) -> Ba... | [
"0.6992319",
"0.546672",
"0.52427363",
"0.5094521",
"0.5079889",
"0.50560284",
"0.50531226",
"0.5052474",
"0.5050119",
"0.5006714",
"0.4980308",
"0.49746576",
"0.49197483",
"0.49036723",
"0.48867267",
"0.48819607",
"0.48699552",
"0.48477024",
"0.4846793",
"0.481765",
"0.48155... | 0.871829 | 0 |
V.CopyData(int, vtkDataSetAttributes, int, vtkDataSetAttributes, int) | def CopyData(self, p_int, vtkDataSetAttributes, p_int_1, vtkDataSetAttributes_1, p_int_2):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CopyAllocate(self, vtkDataSetAttributes, p_int, p_int_1, p_int_2):\n ...",
"def copy (a_data) :\n return a_data.copy()",
"def _copy_data_from(self, original):\n raise NotImplementedError()",
"def PassData(self, other):\n for this,that in zip(self.DataSet, other.DataSet):\n ... | [
"0.74625564",
"0.6150516",
"0.6099264",
"0.59510577",
"0.59254605",
"0.59254605",
"0.59254605",
"0.59254605",
"0.59254605",
"0.59254605",
"0.59254605",
"0.56435746",
"0.562825",
"0.5609516",
"0.5609516",
"0.5596466",
"0.5592277",
"0.558508",
"0.55710214",
"0.5566171",
"0.5560... | 0.9043012 | 0 |
V.InterpolatePoint(int, vtkDataSetAttributes, vtkIdList, [float, ...], vtkDataSetAttributes, int) | def InterpolatePoint(self, p_int, vtkDataSetAttributes, vtkIdList, *float, **kwargs):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolatePoints(pts, numBetween):\n if numBetween <= 0:\n return pts\n #create new vector w/ original points distributed evenly\n numPts = len(pts) + (len(pts)-1)*numBetween\n densePts = np.zeros((numPts,3))\n densePts[0::numBetween+1] = pts\n \n #create interpolated points\n for idx in range(0, n... | [
"0.5961111",
"0.5932727",
"0.5855994",
"0.57339114",
"0.57036537",
"0.5693999",
"0.56915617",
"0.5678384",
"0.56705415",
"0.5670223",
"0.5665663",
"0.5631813",
"0.56292033",
"0.56224096",
"0.55849636",
"0.5580839",
"0.5562568",
"0.5553769",
"0.5549495",
"0.553494",
"0.5530364... | 0.9026541 | 0 |
Prints nicely. If this is a list of lists, some alignment is attempted. lst The list to print index If this is a list, whether to mark line numbers. max_width Maximum width for a field in an alignment. spaces Number of spaces between fields ret Return the string or print it | def out(lst, max_width=100, index=False, spaces=3, ret=False):
# Not even a list - just print
if not isinstance(lst, (list,tuple)):
print lst
return
# List of lists of same size
strs = []
if all([isinstance(l, (list,tuple)) for l in lst]) and all([len(l) == len(lst[0]) for l in lst]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tabular_formatted_printing(data_list):\n n = len(data_list)\n max = 0\n for i in range(0,n):\n if int(len(data_list[i][0])) > max:\n max = len(data_list[i][0])\n for i in range(0,n):\n if int(len(data_list[i][0])) < max:\n space = max - len(data_list[i][0])\n ... | [
"0.69114107",
"0.65663284",
"0.6407533",
"0.63565636",
"0.61842084",
"0.61093855",
"0.60211277",
"0.601355",
"0.6009066",
"0.59296656",
"0.5894452",
"0.58618444",
"0.5821699",
"0.5820922",
"0.58189845",
"0.57326204",
"0.57260805",
"0.57031673",
"0.57018644",
"0.56838995",
"0.... | 0.82583123 | 0 |
Scan and return all found entries. | def all(self):
self.scan()
return self.entries | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan(self):\n return",
"def do_scan(self, arg):\n results = self._table.scan()\n for item in results[\"Items\"]:\n self._print(_pretty(item))",
"def scan_devices(self):\n self._update_info()\n\n return self.last_results",
"def scan(self) -> Collection[int]:\n... | [
"0.6618253",
"0.64930534",
"0.6439168",
"0.6415952",
"0.6382884",
"0.6315697",
"0.631492",
"0.62107915",
"0.62107915",
"0.6202505",
"0.6171117",
"0.61267275",
"0.61118233",
"0.6102693",
"0.60302335",
"0.59939873",
"0.5901928",
"0.58880365",
"0.5875472",
"0.58604515",
"0.58571... | 0.80179703 | 0 |
Seta o valor da coordenada em pos para val | def __setitem__(self, pos, val):
self._coords[pos] = val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_xy(self, x, y, val):\r\n\t\tself.grid[y, x] = val",
"def setCoordinateValue(self,coordVal):\n gridkey = self.__createkey__()\n self.grid[gridkey] = coordVal\n return self.getCoordinate()",
"def _update_val_from_pos(self, pos):\n idx = np.argmin(np.abs(self.val - pos))\n ... | [
"0.7302606",
"0.6907237",
"0.68805325",
"0.6879361",
"0.6859891",
"0.6814367",
"0.6766377",
"0.6683029",
"0.6678713",
"0.6669274",
"0.66338664",
"0.66182196",
"0.6613527",
"0.66022056",
"0.6599706",
"0.6591444",
"0.65845966",
"0.658102",
"0.6559027",
"0.6538624",
"0.6538624",... | 0.7358148 | 0 |
Check check_difference_between_two_lists by verifying ValueError | def test_check_difference_between_two_lists():
# same lists, no error
list1 = list2 = [0, 1, 2]
util.check_difference_between_two_lists(list1, list2, name="same case")
# diff lists with same unique numbers
list_1 = [0, 1, 2]
list_2 = [1, 2, 0]
with pytest.raises(ValueError) as err_info:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_difference_between_two_lists(list1: list, list2: list):\n\n list1_unique = sorted(set(list1) - set(list2))\n list2_unique = sorted(set(list2) - set(list1))\n if len(list2_unique) != 0 or len(list1_unique) != 0:\n raise ValueError(\n \"two lists are not identical\\n\"\n ... | [
"0.7240455",
"0.6620935",
"0.65858465",
"0.64900094",
"0.64680755",
"0.6467949",
"0.6426586",
"0.6401121",
"0.6348438",
"0.6346294",
"0.63159406",
"0.62389773",
"0.6238065",
"0.6197776",
"0.61073464",
"0.6103893",
"0.60867274",
"0.60650724",
"0.60532224",
"0.6008054",
"0.5986... | 0.8337964 | 0 |
loads given .bo file. returns a vector of segments. | def load_segments(filename):
coordinates_struct = struct.Struct('4d')
segments = []
adjuster = CoordinatesHash()
with open(filename, "rb") as bo_file:
packed_segment = bo_file.read(32)
while packed_segment:
coordinates = coordinates_struct.unpack(packed_segment)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self):\n if self.__fname == '':\n print('You must pass in a file name to load!')\n return []\n\n ext = os.path.splitext(self.__fname)[1]\n first_pt = None\n if len(self.__fea.points) > 0:\n first_pt = self.__fea.points[0]\n if ext == '.dx... | [
"0.5900475",
"0.5879555",
"0.58756703",
"0.5855116",
"0.584221",
"0.58177173",
"0.5789613",
"0.57204425",
"0.5663764",
"0.5635572",
"0.56024337",
"0.55957645",
"0.54793763",
"0.5448357",
"0.54481804",
"0.54481804",
"0.5434695",
"0.54312044",
"0.5424282",
"0.542233",
"0.539574... | 0.63551354 | 0 |
data is a m x n matrix, where the rows are the observations and the columns the features. run is an index that gives marks the "Gapclustering_run_.txt" file | def gap(data, run=1, nrefs=20, mink=1, kstep=1, maxlim=False, maxtime=60,file_save_data='Gap_Statistics_report.txt'):
time1 = time.time()
shape = data.shape
tops = data.max(axis=0)
bots = data.min(axis=0)
dists = sp.matrix(sp.diag(tops-bots))
rands = sp.random.random_sample(size=(*shape, nrefs))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n# The following codes loads the data set into a 2D np array called data\n\twith open('complete_data.csv') as features_file:\n\t\tcsv_reader = csv.DictReader(features_file, delimiter = ',')\n\t\tdata = []\n\t\tcounter = 0\n\t\tfor row in csv_reader:\n\t\t\tprint(\"csv_reader row:\", row)\n\t\t\t# if(... | [
"0.57895446",
"0.54188",
"0.5406485",
"0.5342878",
"0.52870375",
"0.52667403",
"0.52480936",
"0.5247069",
"0.52243215",
"0.5199296",
"0.5159883",
"0.5146983",
"0.5145327",
"0.5117339",
"0.5095137",
"0.5088495",
"0.50653875",
"0.5057226",
"0.5055521",
"0.5045982",
"0.50324535"... | 0.612289 | 0 |
Get turtle t to draw a rectangle of width w and height h. | def draw_rectangle(t, w, h):
for i in range(2):
t.forward(w)
t.left(90)
t.forward(h)
t.left(90) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_rect(r):\n for i in range(2):\n turtle.fd(r.width)\n turtle.lt(90)\n turtle.fd(r.height)\n turtle.lt(90)",
"def draw_rect(r):\n for i in range(2):\n turtle.fd(r.width)\n turtle.lt(90)\n turtle.fd(r.height)\n turtle.lt(90)",
"def draw_rect(t... | [
"0.7062672",
"0.7062672",
"0.6959145",
"0.69441265",
"0.6907819",
"0.68890625",
"0.6817093",
"0.6723248",
"0.6708164",
"0.6708164",
"0.666543",
"0.6654854",
"0.662959",
"0.65807384",
"0.65609956",
"0.6301627",
"0.6282792",
"0.6277282",
"0.62672454",
"0.62549835",
"0.625186",
... | 0.764659 | 0 |
Hash a cycle, useful for comparing sets of cycles. This checks the sorted set of each of the nodes in the cycle. This is not a perfect check, but it's useful so that we can create a set of these hashes, and check that they all match. It's not perfect, since D > A > B will be the same as B > A > D, but since this is onl... | def chash(cycles):
return {"".join(sorted(set(x))) for x in cycles} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __hash__(self) -> int:\n # Turn the steps into a set first, so that permuting the steps doesn't change the equality.\n self.simplify()\n return hash(tuple(sorted(self.steps_set)))",
"def flow_graph_hash(graph):\n assert isinstance(graph, BasicGraph)\n sources = graph.nodes(in_degre... | [
"0.64172703",
"0.61482006",
"0.6146306",
"0.6101125",
"0.60406435",
"0.5977896",
"0.5901282",
"0.5901282",
"0.58114797",
"0.5772286",
"0.5754933",
"0.5726816",
"0.5677515",
"0.5647263",
"0.5644115",
"0.5621142",
"0.5602213",
"0.5575135",
"0.55253434",
"0.55200005",
"0.5519742... | 0.6433626 | 0 |
Load raw ratings from an interactions file for a given genre. | def load_ratings_raw(data_dir: Path, genre: str) -> pd.DataFrame:
input_file = data_dir / f"goodreads_interactions_{genre}.json.gz"
return pd.DataFrame(
_iterate_ratings_raw(input_file),
columns=["User_id", "Book_id", "Month", "Rating"],
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_ratings():\n res = {}\n with open(RATINGS_PATH, newline='', encoding=RATINGS_ENCRYPTION) as csvfile:\n spamreader = csv.reader(csvfile)\n for i, row in enumerate(spamreader):\n if i:\n title = row[3]\n res[title] = imdbData(row)\n return res"... | [
"0.65179425",
"0.6085656",
"0.59477943",
"0.57912624",
"0.575343",
"0.56851345",
"0.56723857",
"0.5645598",
"0.54821867",
"0.5447881",
"0.5358234",
"0.53525656",
"0.5332979",
"0.526753",
"0.52433664",
"0.52011",
"0.51165444",
"0.50991356",
"0.5054806",
"0.50105697",
"0.500724... | 0.6887241 | 0 |
From a list of numpy arrays, it generates the proper NN output. | def format_for_nn_classification(imgs_np: list):
tot_num_streams = len(imgs_np)
nn_array = []
for cur_img_idx in range(tot_num_streams):
temp = np.expand_dims(np.expand_dims(imgs_np[cur_img_idx], axis=0), axis=4)
nn_array.append(temp)
return nn_array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_numpy(n, training_data_list, onodes=10, epochs=5):\n\n # train the neural network\n print(\"Training...\")\n\n for e in range(epochs):\n print(\"Epoch:\", e)\n # go through all records in the training data set\n for record in training_data_list:\n # split the teco... | [
"0.65080637",
"0.63258296",
"0.6130325",
"0.6038325",
"0.5860426",
"0.5828803",
"0.5790959",
"0.57801294",
"0.57010484",
"0.5689164",
"0.56098694",
"0.5606582",
"0.559896",
"0.55766803",
"0.5574774",
"0.5573401",
"0.5568114",
"0.5525799",
"0.5510565",
"0.5499428",
"0.54782706... | 0.67091095 | 0 |
Fonction qui prend un fichier mp3 calcule les features pour 2 extraits de chaque fichier tires aleatoirement. | def compute_chunk_features(mp3_file):
# On convertit le fichier mp3 en un fichier wav mono, 1avec un sample rate de 10000Hertz: on utilise
# On utilise l'application sox "c:/Program Files (x86)/sox-14.4.0/sox"
sox_command = "./sox-14.4.0/sox"
out_file = 'temp.wav'
#cmd = sox_command % (out_file, mp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_chunk_features(mp3_file):\n # Extract MP3 file to a mono, 10kHz WAV file\n sox_command = \"/usr/local/bin/sox\"\n out_file = 'temp.wav'\n #cmd = sox_command % (out_file, mp3_file)\n temp2 = subprocess.call([sox_command, mp3_file,'-r 10000','-c 1',out_file])\n # Read in chunks of data ... | [
"0.66566014",
"0.640998",
"0.62653506",
"0.6106396",
"0.5860669",
"0.5697305",
"0.56513053",
"0.5628306",
"0.56180674",
"0.56041425",
"0.55933195",
"0.5557549",
"0.5519982",
"0.54920673",
"0.5469561",
"0.5469015",
"0.544028",
"0.53898615",
"0.5283769",
"0.52705014",
"0.526887... | 0.68116784 | 0 |
Set a given key in the cache to a value. This will create the key if it does not exist. | def set(key, value):
return Cache.cache_connector.set(key, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self, key, value):\n # Initialize key variables\n result = self.cache.set(key, value)\n\n # Return\n return result",
"def put(self, key, value):\n if key is None or value is None:\n raise TypeError\n\n index = self.__get_cache_set_index(key)\n c... | [
"0.8529784",
"0.81145626",
"0.80993396",
"0.80337924",
"0.7959192",
"0.77210766",
"0.7659227",
"0.7642793",
"0.76405346",
"0.749319",
"0.74862456",
"0.74862456",
"0.7390793",
"0.73831314",
"0.7363419",
"0.7306339",
"0.7206181",
"0.7195886",
"0.7186438",
"0.7181423",
"0.714299... | 0.8335758 | 1 |
Saves the graph in JSON format to a file | def save_to_json(self, file_name: str) -> bool:
nodes = []
edges = []
for k, v in self.dw_graph.get_all_v().items():
k1 = self.dw_graph.get_nodes(k)
a_node = {"pos": k1.position, "id": k}
nodes.append(a_node)
for edge in self.dw_graph.all_out_edges... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, filename):\n self.graph.save(filename)\n with open(filename + \".json\", \"w\") as f:\n f.write(json.dumps(self.params))",
"def write_graph_to_file(self, path):\n graph = nx.Graph()\n for node in self.graph.nodes(data=True):\n new_node = deepcopy(n... | [
"0.8043047",
"0.7579656",
"0.7571227",
"0.7486637",
"0.73712486",
"0.7365108",
"0.72972155",
"0.7273542",
"0.72216403",
"0.7200791",
"0.7197121",
"0.71822995",
"0.7116085",
"0.711295",
"0.711083",
"0.71041805",
"0.7100359",
"0.7090944",
"0.70828015",
"0.7069639",
"0.7068036",... | 0.7786036 | 1 |
Finds the Strongly Connected Component(SCC) that node id1 is a part of. For each node in the graph we perform a BFS from that node, then we perform BFS only the graph is inverted, the intersection of lists will represent the strongly connected component. O(V+E) | def connected_component(self, id1: int) -> list:
list1 = []
list2 = []
if id1 in self.dw_graph.nodes:
list1 = self.bfs(id1, False)
list2 = self.bfs(id1, True)
list3 = []
temp=set(list2)
for value in list1 :
if value in temp:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connected_component(self, id1: int) -> list:\n self.__set_all_nodes_unvisited()\n res = self.__tarjan(self.get_graph().get_all_v().get(id1))\n\n for scc in res:\n if id1 in scc:\n return scc\n return []",
"def connected_component(self, id1: int) -> list:\... | [
"0.73408175",
"0.69718456",
"0.66337836",
"0.6416412",
"0.62669075",
"0.6257904",
"0.624665",
"0.6233962",
"0.621759",
"0.6188759",
"0.61778134",
"0.6106977",
"0.60784614",
"0.59857744",
"0.59388864",
"0.59345144",
"0.592531",
"0.58835804",
"0.5850792",
"0.58301294",
"0.57432... | 0.7455152 | 0 |
Plots the graph. If the nodes have a position, the nodes will be placed there. Otherwise, they will be placed in a random but elegant manner. | def plot_graph(self) -> None:
nodes_on_graph = self.dw_graph.get_all_v()
for k, v in nodes_on_graph.items():
if v.position is None:
x_rand = random.uniform(0.5, self.dw_graph.v_size())
y_rand = random.uniform(0.5, self.dw_graph.v_size())
v.pos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_graph(self) -> None:",
"def plot_nodes(self, node_list):\n points = Marker()\n #visualizations points and lines..\n points.header.frame_id = \"map\"\n points.header.stamp = rospy.get_rostime()\n points.ns = \"markers\"\n points.id = 0\n points.type = poi... | [
"0.71362174",
"0.6977103",
"0.6917496",
"0.68423486",
"0.6772331",
"0.6615073",
"0.6607835",
"0.65936774",
"0.65219015",
"0.65065324",
"0.64958465",
"0.6480208",
"0.6478137",
"0.6361574",
"0.63404465",
"0.62827706",
"0.6266448",
"0.62615883",
"0.6238941",
"0.6221895",
"0.6214... | 0.75397635 | 0 |
Performs breathd first search on the graph. if flag is set to true we perform BFS as if the graph if inverted. Otherwise BFS is run normally. | def bfs(self, start_node: int, flag: bool) :
for n in self.dw_graph.get_all_v().values():
n.visited = False
queue = [self.dw_graph.nodes[start_node]]
self.dw_graph.nodes[start_node].visited = True
node_list = [start_node]
while queue:
current = queue.pop()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def breadthFirstSearch(problem):\n \"*** YOUR CODE HERE ***\"\n fringe = util.Queue()\n return GraphSearch(problem, 'bfs').search(fringe)",
"def breadthFirstSearch(problem):\n \"*** YOUR CODE HERE ***\"\n\n \"\"\"\n ALGORITHM FOR bFS \n Create a queue Q\n enqueue root node to Q\n while... | [
"0.7043006",
"0.6586793",
"0.65860933",
"0.65740776",
"0.64679086",
"0.64172",
"0.64092493",
"0.6378661",
"0.6374802",
"0.6347823",
"0.63308054",
"0.6317698",
"0.62980086",
"0.6249498",
"0.6227919",
"0.6226172",
"0.6216912",
"0.6212686",
"0.61914986",
"0.6168095",
"0.61560595... | 0.6854293 | 1 |
Open current node in (x)emacs Provied by xemacs.py plugin | def open_in_emacs_command(event):
c = event.get('c')
if c:
open_in_emacs_helper(c, c.p) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_editor(event):\n event.current_buffer.open_in_editor(event.cli)",
"def open_and_raise(filename, line, col):\n\n buffer = GPS.EditorBuffer.get(GPS.File(filename))\n GPS.MDI.get_by_child(buffer.current_view()).raise_window()\n buffer.current_view().goto(buffer.at(line, col))",
"def load_... | [
"0.6505492",
"0.61277086",
"0.58447474",
"0.5693338",
"0.56475",
"0.5646836",
"0.55818087",
"0.5557941",
"0.5536325",
"0.54865175",
"0.5471582",
"0.5407639",
"0.54012334",
"0.5341129",
"0.533871",
"0.5318484",
"0.52790904",
"0.52360004",
"0.522553",
"0.52156353",
"0.521491",
... | 0.7765873 | 0 |
Return email_str if valid, raise an exception in other case. | def email(email_str):
if is_valid_email(email_str):
return email_str
else:
raise ValueError('{} is not a valid email'.format(email_str)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_valid(email_string):\n if not email_string:\n raise WrongInput(\"Input cannot be blank\")\n if not isinstance(email_string, str):\n raise WrongInput(\"Invalid email address\")\n\n if '@' not in email_string or '.' not in email_string:\n raise WrongInput('Invalid email addres... | [
"0.7672539",
"0.7605011",
"0.7390302",
"0.7372924",
"0.7113327",
"0.7093605",
"0.708094",
"0.7071259",
"0.70710975",
"0.695137",
"0.69224083",
"0.6910104",
"0.69016534",
"0.68393576",
"0.6808891",
"0.6796755",
"0.67321604",
"0.6725741",
"0.67098516",
"0.6651723",
"0.6648271",... | 0.8189841 | 0 |
Test that hotel search works | def test_hotel_search(self):
test_params = {
'DEBUG': False,
'TESTING': True
}
app = create_app(settings_override=test_params).test_client
params = {
"city": "Las Vegas",
"checkin": "2018-05-27",
"checkout": "2018-05-28"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search(self):\n from importCsv.models import City, Hotel\n path = reverse(\"search\")\n user = mixer.blend(User, is_staff=True, is_superuser=True)\n city = mixer.blend(City, abbrev=\"tes\", name=\"test\")\n mixer.blend(Hotel, city=city, data=\"testData\", name=\"test hot... | [
"0.7387407",
"0.7166668",
"0.7067505",
"0.7067505",
"0.7067505",
"0.6942963",
"0.6832196",
"0.6639134",
"0.6610713",
"0.6603533",
"0.6590838",
"0.65724033",
"0.6566449",
"0.65024674",
"0.64805067",
"0.6444512",
"0.64100224",
"0.6380994",
"0.63514537",
"0.63284093",
"0.6311588... | 0.7625502 | 0 |
Sets the bribe amount for a character. | def set_bribe(self, bribe_amount):
self.bribe = bribe_amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_amount(self, amount):\n self.amount = amount",
"def set_capital(self, amount):\n self.starting_capital = amount",
"def set_credit_amount(self, credit_amount):\n self.set_value_into_input_field(self.credit_amount_textbox_locator, credit_amount)",
"def _set_instructed_amount_33B(se... | [
"0.64244103",
"0.6312083",
"0.6303162",
"0.62656564",
"0.6237788",
"0.61397785",
"0.6122521",
"0.6122521",
"0.6122521",
"0.6122521",
"0.6122521",
"0.6122521",
"0.6122521",
"0.6122521",
"0.6122521",
"0.6101654",
"0.6089398",
"0.6057624",
"0.6030912",
"0.5962641",
"0.5879347",
... | 0.7745055 | 0 |
If a conversation string has been set prints the conversation to the player. | def talk(self):
if self.conversation is not None:
print("[" + self.name + " says]: " + self.conversation)
else:
print(self.name + " doesn't want to talk to you") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_cli(conversations, alt_speaker, human_speaker):\n for speaker, speech in conversations:\n if speaker == END_OF_CONVO:\n print(\"-\" * 20 + \"END OF CONVERSATION\" + \"-\" * 20)\n elif speaker == alt_speaker:\n print(\"%-15s: %s\" % (speaker[:15], speech))\n ... | [
"0.6658465",
"0.6178085",
"0.6088421",
"0.6004269",
"0.59598935",
"0.59103334",
"0.59070855",
"0.59038496",
"0.58600634",
"0.5846848",
"0.5816828",
"0.5813256",
"0.5757715",
"0.57322603",
"0.57313013",
"0.56998277",
"0.56838024",
"0.5683442",
"0.56452155",
"0.5630078",
"0.562... | 0.70861715 | 0 |
Sets an enemies weakness for use when fighting them. | def set_weakness(self, weakness):
self.weakness = weakness | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setHardness(self, hardness):\n self.__hardness = hardness\n self.scene.setShaderInput(\"props\", self.__ambient, self.__hardness, 0, 1)",
"def weaknessChecker(self, hasWeakness):\n attack_penalty = 2 if hasWeakness else 0\n\n return attack_penalty",
"def light_attack(self, enemy):\n ... | [
"0.6457995",
"0.6165343",
"0.6018487",
"0.60109675",
"0.5889369",
"0.56564623",
"0.55699444",
"0.55660456",
"0.54974777",
"0.5465783",
"0.5441274",
"0.54131854",
"0.53929704",
"0.5372842",
"0.53466755",
"0.53080034",
"0.52585685",
"0.52529514",
"0.5249914",
"0.52493405",
"0.5... | 0.6913265 | 0 |
Returns the set weakness of an enemy. | def get_weakness(self):
return self.weakness | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weaknessChecker(self, hasWeakness):\n attack_penalty = 2 if hasWeakness else 0\n\n return attack_penalty",
"def getHardness(self, hardness):\n return self.__hardness",
"def getDefense(self):\n\t\treturn(self.maneuverability * self.protection)",
"def offense(self):\n #return self.s... | [
"0.6829042",
"0.64108074",
"0.6180926",
"0.60351866",
"0.56942403",
"0.5679706",
"0.5554356",
"0.5514769",
"0.54973966",
"0.5496704",
"0.54803246",
"0.54474527",
"0.5419932",
"0.5392366",
"0.5364172",
"0.53577",
"0.53269047",
"0.5311586",
"0.5301878",
"0.52729005",
"0.5264704... | 0.66509145 | 1 |
This function allows the player to fight an enemy. If he has the correct item, the enemy is defeated and the victory counter in incremented. Otherwise, the returned value will end the game. | def fight(self, combat_item):
if combat_item == self.weakness:
print("You fend " + self.name + " off with the " + combat_item )
Character.victory_count +=1
return True
else:
print(self.name + " crushes you, puny adventurer")
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attack(self, enemy):\r\n best_weapon = None\r\n max_damage = 0\r\n # Searches your inventory for your highest damaging weapon\r\n for i in self._inventory:\r\n if isinstance(i, items.Weapon):\r\n if i._damage > max_damage:\r\n best_weapon... | [
"0.73023725",
"0.7119186",
"0.7007012",
"0.67700773",
"0.6709821",
"0.6642674",
"0.6632597",
"0.65806234",
"0.6557113",
"0.6517825",
"0.6494324",
"0.649073",
"0.64349115",
"0.6424632",
"0.63064563",
"0.6239304",
"0.6199379",
"0.6171521",
"0.613434",
"0.61199886",
"0.6093773",... | 0.76108617 | 0 |
Allows the player to attempt a bribe of an enemy. Success increases the victory counter. Failure leads to a fight with the enemy. | def attempt_bribe(self, bribe_amount):
if bribe_amount >= self.bribe:
print("You have bribed " + self.name + "with " + str(bribe_amount) + " gold.")
Character.victory_count +=1
return True
else:
print(self.name + "was not impressed with your bribe an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def playerAttack(self, enemy):\n print(\"You are attacking the enemy.\")\n accuracyNum = random.randrange(0, 10) / 10\n if accuracyNum <= self.accuracy:\n enemy.hp = enemy.hp - self.ap\n print(\"The enemy HP now is: \" + str(enemy.hp))\n else:\n print(\"... | [
"0.68775684",
"0.6731881",
"0.6525757",
"0.64237124",
"0.63591766",
"0.62403625",
"0.62238127",
"0.62110966",
"0.6187337",
"0.6165002",
"0.6156522",
"0.61011827",
"0.60958004",
"0.60684764",
"0.60509324",
"0.6038208",
"0.60349286",
"0.6020963",
"0.6006396",
"0.599429",
"0.597... | 0.67346454 | 1 |
Sets the gift needed for a friend character. | def set_gift(self, gift_name):
self.gift = gift_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_damage():\n\n global character\n character['Damage'] = randint(1, 6)",
"async def _forcesetgender(self, ctx, *args):\n if len(args) < 2:\n await ctx.send(\"Include both a name and a gender!\")\n return\n\n god = database.getGodName(args[0], ctx.guild.id)\n ... | [
"0.5870756",
"0.5683692",
"0.54332036",
"0.54275256",
"0.5402585",
"0.5094512",
"0.5079681",
"0.50593126",
"0.50358963",
"0.5034555",
"0.50138766",
"0.5001107",
"0.49965438",
"0.49908543",
"0.4982959",
"0.49759075",
"0.49700886",
"0.4932639",
"0.49175462",
"0.4915319",
"0.491... | 0.71853125 | 0 |
Returns the gift needed for a friend character. | def get_gift(self):
return self.gift | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_damage():\n\n return character['Damage']",
"def get_friends(character, _info):\n return map(get_character, character.friends)",
"def get_gift_conversation(self):\r\n return self.gift_conversation",
"def give(self):\n if self.location.character:\n item = input(f\"What do... | [
"0.5969157",
"0.5879219",
"0.5726694",
"0.5626463",
"0.5576555",
"0.55666816",
"0.55642915",
"0.55449605",
"0.5438081",
"0.5416212",
"0.5415723",
"0.5371199",
"0.5294017",
"0.52715874",
"0.52180815",
"0.5189289",
"0.5167674",
"0.51110566",
"0.5106873",
"0.5085752",
"0.5081529... | 0.65834814 | 0 |
Sets the gift conversation for a friend character | def set_gift_conversation(self, conversation_string):
self.gift_conversation = conversation_string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_conversation(self, conversation):\r\n self.conversation = conversation",
"def set_gift(self, gift_name):\r\n self.gift = gift_name",
"def set_character(self, character):\n self.character = character",
"def conversation(self, conversation):\n\n self._conversation = conversa... | [
"0.62589055",
"0.5958753",
"0.5796381",
"0.56427866",
"0.54611236",
"0.5414976",
"0.53638905",
"0.52746314",
"0.52133864",
"0.51326025",
"0.5058784",
"0.5043021",
"0.50421846",
"0.5039094",
"0.5031889",
"0.4999358",
"0.49292138",
"0.49278685",
"0.4919593",
"0.4902919",
"0.490... | 0.69341916 | 0 |
Gets a friend characters gift conversation. | def get_gift_conversation(self):
return self.gift_conversation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_friends(character, _info):\n return map(get_character, character.friends)",
"def fetch_conversation_starter():\n\n url = 'https://www.conversationstarters.com/generator.php'\n\n try:\n response = requests.get(url)\n html_content = response.text\n soup = BeautifulSoup(html_co... | [
"0.58839846",
"0.56891435",
"0.54840857",
"0.5479905",
"0.5456572",
"0.5369547",
"0.5356098",
"0.5339004",
"0.52776635",
"0.51407397",
"0.51281244",
"0.5115167",
"0.51092404",
"0.50819564",
"0.5071373",
"0.50563943",
"0.5042947",
"0.5012859",
"0.49636632",
"0.49397695",
"0.49... | 0.69646615 | 0 |
Returns a bitarray of the requested row, starting from offset. | def getRow(self, n, offset=0):
return self._c[n + offset*self.height::self.height] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row_to_array(r):\n a = np.ma.array([i for i in r.as_void()])\n return a",
"def getByteRow(self, int: int) -> typing.List[int]:\n ...",
"def tx_as_binary(self, tx: pd.Series) -> np.array:\n tx_items_indexes = [\n self.__item_map[(attribute, tx[attribute])]\n for att... | [
"0.59560263",
"0.59333193",
"0.55000675",
"0.5390923",
"0.53428185",
"0.53305465",
"0.5317268",
"0.5274468",
"0.5269332",
"0.5245176",
"0.5223817",
"0.5217292",
"0.5216318",
"0.521481",
"0.521481",
"0.52140635",
"0.5186756",
"0.518278",
"0.5169955",
"0.5155058",
"0.51405805",... | 0.6140267 | 0 |
Returns a bitarray of the requested column, starting from offset. | def getCol(self, n, offset=0):
return self._c[(n*self.__height + offset):((n+1) * self.__height)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_col(self, y):\n colrange = self._col_range(y)\n col = []\n\n for i in colrange:\n col.append(self._read_bit(i))\n\n return col",
"def get_column_offsets(self):\n offsets = [x + self.bitcell_array_inst.lx() for x in self.bitcell_array.get_column_offsets()]\n ... | [
"0.6265687",
"0.62398607",
"0.5663601",
"0.5645953",
"0.5600698",
"0.55636734",
"0.54829437",
"0.5459227",
"0.5454153",
"0.5450655",
"0.5450495",
"0.5449891",
"0.54187745",
"0.54068595",
"0.53789526",
"0.5348315",
"0.5333947",
"0.5326166",
"0.5322707",
"0.5305193",
"0.5281067... | 0.6364678 | 0 |
Overwrites a column with data, starting from offset. | def writeCol(self, col, data, offset=0):
for d in data:
if offset > self.__height: break
self._c[col*self.__height + offset] = d
offset += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_column( self, delta = 1, ):\n self.ix_row = 0\n self.ix_col += delta",
"def set_offset(self, offset):\r\n for b in self.buf:\r\n b.set_offset(offset)",
"def _modify_columns(self, cols, X, y=None):",
"def offset(self, offset):\n self._offset += offset",
"def add... | [
"0.625269",
"0.61162394",
"0.6112901",
"0.6104277",
"0.61029327",
"0.60511184",
"0.59505105",
"0.59306467",
"0.58862907",
"0.58735293",
"0.5822764",
"0.5798777",
"0.57800525",
"0.57800525",
"0.57634544",
"0.5737165",
"0.5737165",
"0.57301915",
"0.5726658",
"0.5699598",
"0.569... | 0.66072476 | 0 |
Overwrites a row with data, starting from offset. | def writeRow(self, row, data, offset=0):
for d in data:
if offset > self.__width: break
self._c[row + offset*self.__height] = d
offset += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateRow(self, index: int) -> None:\n ...",
"def update_old_row(self, data):\n for key, value in data.items():\n _column = self._labels.index([v['display'] for k, v in self.headers.items() if k == key].pop())\n cell = self.item(self._opt_row, _column)\n _cell_d... | [
"0.64052135",
"0.637103",
"0.6283994",
"0.6170701",
"0.6162284",
"0.61389726",
"0.61281395",
"0.61134833",
"0.60994077",
"0.6078145",
"0.6066744",
"0.6039798",
"0.5997509",
"0.597921",
"0.5977887",
"0.59284174",
"0.5920256",
"0.58867157",
"0.58554363",
"0.58529353",
"0.582950... | 0.7204479 | 0 |
clear all cookies after driver init | def clear_cookies(self):
self.base_driver.delete_all_cookies() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_all_cookies():",
"def tearDown(self):\n self.driver.delete_all_cookies()",
"def after_scenario(context, scenario):\n context.driver.delete_all_cookies()",
"def clear(self):\n if not self.__loaded:\n self.__load()\n \n self.setAllCookies([])\n self.__... | [
"0.83174515",
"0.8032926",
"0.7502241",
"0.7378926",
"0.7141705",
"0.7035107",
"0.68740743",
"0.6753293",
"0.67505974",
"0.6643917",
"0.6628503",
"0.6589891",
"0.6564409",
"0.652177",
"0.6443883",
"0.64055115",
"0.6211396",
"0.6194772",
"0.6163155",
"0.61439544",
"0.6109568",... | 0.8466408 | 0 |
Add cookie by dict | def add_cookies(self, cookies):
self.base_driver.add_cookie(cookie_dict=cookies) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addCookie(k, v, expires=None, domain=None, path=None, max_age=None, comment=None, secure=None):",
"def setCookie(self, key, value):\n self.PDFreactorConfiguration.in1[\"cookies\"].append([key, value])",
"def set_cookie( cookies, name, morsel, **kwargs ) :",
"def set_cookie( name, value, **kwargs )... | [
"0.77416134",
"0.68151766",
"0.68082726",
"0.67685044",
"0.67278844",
"0.6484043",
"0.6482737",
"0.6431638",
"0.63745916",
"0.6293565",
"0.6278675",
"0.6192497",
"0.61849684",
"0.6125525",
"0.61146086",
"0.6014893",
"0.5983633",
"0.59448576",
"0.5919524",
"0.5910882",
"0.5909... | 0.7032236 | 1 |
to locate element by selector | def locate_element(self, selector):
if "," not in selector:
return self.base_driver.find_element_by_id(selector)
selector_by = selector.split(",")[0].strip()
selector_value = selector.split(",")[1].strip()
if selector_by == "i" or selector_by == 'id':
element = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_element(self, selector):\n return self.driver.find_element_by_css_selector(selector)",
"def elements_by_selector(self, selector):\n pass",
"def _find_within(self, selector):\r\n return self.q(css=self.thread_selector + \" \" + selector)",
"def get_element(self, selector):\n ... | [
"0.750873",
"0.69686186",
"0.6775619",
"0.6627008",
"0.6552687",
"0.64948165",
"0.64569074",
"0.64387476",
"0.6424324",
"0.6383012",
"0.6277258",
"0.6228479",
"0.6212733",
"0.6163926",
"0.60298616",
"0.601789",
"0.59536326",
"0.5920582",
"0.58742386",
"0.58619976",
"0.5840708... | 0.7376927 | 1 |
Gets the element to display,The return result is true or false. | def get_display(self, selector):
el = self.locate_element(selector)
return el.is_displayed() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_element_display(self, selector):\n return True if self.get_element(selector).is_displayed() else False",
"def is_element_visible(self):\n if self.web_element.is_displayed():\n return True\n else:\n return False",
"def elementIsVisible(self, element_tuple):\n ... | [
"0.71987784",
"0.71025276",
"0.69039357",
"0.67635214",
"0.6721053",
"0.6602099",
"0.6592456",
"0.6552643",
"0.652752",
"0.63737696",
"0.6346352",
"0.6144911",
"0.60620564",
"0.6044386",
"0.6042275",
"0.6029004",
"0.60273486",
"0.60212374",
"0.600898",
"0.5907094",
"0.5903807... | 0.7745109 | 0 |
to click the selector by the right button of mouse | def right_click(self, selector):
el = self.locate_element(selector)
ActionChains(self.base_driver).context_click(el).perform() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_click(self):\n self.scroll_to()\n ActionChains(self.driver).context_click(self._element).perform()",
"def RightClick(self):\n self._PressRightButton()\n self._ReleaseAllButtons()",
"def right_click(coords=(0, 0)):\n _perform_click_input(button='right', coords=coords)",
"def r... | [
"0.7589356",
"0.7419877",
"0.73587143",
"0.7248984",
"0.71691877",
"0.70594174",
"0.68929875",
"0.6721219",
"0.669948",
"0.6656237",
"0.6649105",
"0.65732515",
"0.6479658",
"0.64630044",
"0.6438488",
"0.6408268",
"0.63866496",
"0.63663316",
"0.63373077",
"0.6310737",
"0.62897... | 0.80836046 | 0 |
Light up all pixels matching the filter function | def light(brightness, filter):
brightness = clamp(MIN_BRIGHTNESS, round(brightness), MAX_BRIGHTNESS)
for col in range(DISPLAY_WIDTH):
for row in range(DISPLAY_HEIGHT):
if filter(col, row):
microbit.display.set_pixel(col, row, brightness) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filterToLight( bmp, savefile = '' ):\n for h in range(bmp.height):\n for w in range(bmp.width):\n HSL = RGBtoHSL( bmp.pixels[h][w] )\n lit = int(255*HSL[2]) # convert to 0-255 range\n bmp.pixels[h][w] = (lit,lit,lit)\n if( savefile != '' ):\n bmp.save(sav... | [
"0.6891016",
"0.68488",
"0.67291045",
"0.6430749",
"0.64030194",
"0.6372767",
"0.6336315",
"0.62558776",
"0.62437797",
"0.62408644",
"0.6200323",
"0.6101064",
"0.60830146",
"0.6074623",
"0.6044741",
"0.6038731",
"0.60351336",
"0.6012789",
"0.600557",
"0.59790415",
"0.59558946... | 0.71111244 | 0 |
Light up a whole column to max brightness | def light_column(column):
def filter_column(col, row):
"""For a given pixel position, turn on if it matches our column
"""
return col == column
light(MAX_BRIGHTNESS, filter_column) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def light_row(row):\n def filter_row(col, rw):\n \"\"\"For a given pixel position, turn on if it matches our row\n \"\"\"\n return rw == row\n light(MAX_BRIGHTNESS, filter_row)",
"def light(brightness, filter):\n brightness = clamp(MIN_BRIGHTNESS, round(brightness), MAX_BRIGHTNESS)\... | [
"0.76078856",
"0.6945851",
"0.6617249",
"0.64432704",
"0.642737",
"0.6395285",
"0.6388527",
"0.63622737",
"0.6360574",
"0.6344589",
"0.63406736",
"0.6260235",
"0.6238927",
"0.6171015",
"0.61625445",
"0.6068428",
"0.60669845",
"0.6063754",
"0.60487926",
"0.60204375",
"0.597457... | 0.7521941 | 1 |
Light up a whole row to max brightness | def light_row(row):
def filter_row(col, rw):
"""For a given pixel position, turn on if it matches our row
"""
return rw == row
light(MAX_BRIGHTNESS, filter_row) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def light(brightness, filter):\n brightness = clamp(MIN_BRIGHTNESS, round(brightness), MAX_BRIGHTNESS)\n for col in range(DISPLAY_WIDTH):\n for row in range(DISPLAY_HEIGHT):\n if filter(col, row):\n microbit.display.set_pixel(col, row, brightness)",
"def high_bri(self):\r\n... | [
"0.69859385",
"0.6736835",
"0.6583448",
"0.6555438",
"0.6454424",
"0.64512384",
"0.6360312",
"0.6352109",
"0.63032365",
"0.6284204",
"0.62675476",
"0.6253658",
"0.6240474",
"0.6236994",
"0.6142814",
"0.6122663",
"0.6115525",
"0.6078735",
"0.6057735",
"0.602981",
"0.6024077",
... | 0.79181546 | 0 |
Reduce every pixel by 1 brightness level This means as we draw new things, the old ones will fade away | def fade_display():
for col in range(5):
for row in range(5):
brightness = microbit.display.get_pixel(col, row)
# reduce by one, but make sure it's still in 0 to 9
brightness = clamp(MIN_BRIGHTNESS, brightness - 1, MAX_BRIGHTNESS)
microbit.display.set_pixel(co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def darker(image):\r\n # Demonstrate looping over all the pixels of an image,\r\n # changing each pixel to be half its original intensity.\r\n for pixel in image:\r\n pixel.red = pixel.red // 2\r\n pixel.green = pixel.green // 2\r\n pixel.blue = pixel.blue // 2",
"def _update_bright... | [
"0.6887192",
"0.665536",
"0.6603987",
"0.6461574",
"0.63710016",
"0.63430524",
"0.6336505",
"0.6335074",
"0.6331814",
"0.62729317",
"0.627287",
"0.6259551",
"0.6238727",
"0.6233219",
"0.6171424",
"0.61481863",
"0.6145583",
"0.612978",
"0.6111944",
"0.6100383",
"0.6072154",
... | 0.66885334 | 1 |
Push buttons, touch pins, see if you can light up the whole display! | def four_buttons():
a_is_pressed = microbit.button_a.is_pressed()
b_is_pressed = microbit.button_b.is_pressed()
# let's call the two pin-buttons c and d:
c_is_pressed = pin_is_touched(1)
d_is_pressed = pin_is_touched(2)
if a_is_pressed:
light_row(2)
paint_box(right=1)
if b_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_button_pressed():\n return btn_pin.value() == 0",
"def button_func(self, pin):\n if self.current_button_num == self.len_sponge_routers - 1:\n self.current_button_num = 0\n else:\n self.current_button_num += 1\n print(self.current_button_num)\n current_r... | [
"0.6276128",
"0.5955059",
"0.59120685",
"0.59119076",
"0.58717036",
"0.58541137",
"0.5791489",
"0.57337594",
"0.57161903",
"0.5688397",
"0.5686411",
"0.5609548",
"0.5571813",
"0.55562514",
"0.55335015",
"0.55035555",
"0.5494923",
"0.5493798",
"0.5484819",
"0.5437424",
"0.5434... | 0.6741598 | 0 |
Gets the balance of the given account in AVAX | def get_avax_balance(self, account: ChecksumEvmAddress) -> FVal:
result = self.covalent.get_token_balances_address(account)
if result is None:
balance = from_wei(FVal(self.w3.eth.get_balance(account)))
else:
balance = ZERO
for entry in result:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balance(self, account_number: int): \n return self._accounts[account_number][1]",
"def get_account_balance(account):\n balance = 0\n\n for address in get_addresses_by_account(account):\n balance += get_address_balance(address)\n\n return float(balance)",
"def get_account_balan... | [
"0.806241",
"0.80304515",
"0.7921982",
"0.7740125",
"0.75775844",
"0.74301744",
"0.74073714",
"0.73871225",
"0.73293626",
"0.72908586",
"0.7191737",
"0.7147341",
"0.70692456",
"0.7060021",
"0.7008519",
"0.7006617",
"0.69725066",
"0.6969023",
"0.6936924",
"0.6920266",
"0.69081... | 0.81331736 | 0 |
Returns a dict with keys being accounts and balances in AVAX | def get_multiavax_balance(
self,
accounts: Sequence[ChecksumEvmAddress],
) -> dict[ChecksumEvmAddress, FVal]:
balances = {}
for account in accounts:
balances[account] = self.get_avax_balance(account)
return balances | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_account_balances(self):\n params = clean_locals(locals())\n date_time_sent = datetime.datetime.utcnow()\n response = self.request('GetAccountBalances', params, secure=True)\n data = self.process_response(response, date_time_sent, None)\n return parse_account_balance(data.... | [
"0.6900857",
"0.66585994",
"0.6576144",
"0.6524038",
"0.6448435",
"0.6421623",
"0.6266799",
"0.62185144",
"0.6146161",
"0.6106262",
"0.610595",
"0.60648024",
"0.6064307",
"0.6015364",
"0.5989538",
"0.5985346",
"0.590431",
"0.58352405",
"0.58172023",
"0.579525",
"0.5772174",
... | 0.7731859 | 0 |
Performs an eth_call to an ethereum contract | def call_contract(
self,
contract_address: ChecksumEvmAddress,
abi: list,
method_name: str,
arguments: Optional[list[Any]] = None,
) -> Any:
contract = self.w3.eth.contract(address=contract_address, abi=abi)
try:
method = getat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tx_call(self, keypair, function, arg,\n amount=10,\n gas=CONTRACT_DEFAULT_GAS,\n gas_price=CONTRACT_DEFAULT_GAS_PRICE,\n fee=DEFAULT_FEE,\n vm_version=CONTRACT_DEFAULT_VM_VERSION,\n tx_ttl=DEFAULT_TX_TTL):\n\n if n... | [
"0.67550564",
"0.6428693",
"0.59243745",
"0.57380104",
"0.5717516",
"0.5717516",
"0.55876184",
"0.55853045",
"0.5546766",
"0.5462893",
"0.5381598",
"0.53517586",
"0.5346199",
"0.53041065",
"0.5251297",
"0.5225768",
"0.5198967",
"0.5188985",
"0.5185238",
"0.5167641",
"0.514848... | 0.7135408 | 0 |
Execute all the ryven nodes in the order of data flow. | def run_all(self):
# print("running all nodes")
executed = set()
node_update_states = {node: node.block_updates for node in self.flow_view.node_items}
def traverse_upwards(node):
# Traverse upwards to the top of data flow graph
if node in executed:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n if self.next_state == \"initialize_rexarm\":\n self.initialize_rexarm()\n\n if self.next_state == \"idle\":\n self.idle()\n\n if self.next_state == \"estop\":\n self.estop()\n\n if self.next_state == \"execute_tp\":\n self.exe... | [
"0.642234",
"0.6172765",
"0.61726207",
"0.616546",
"0.6124462",
"0.604741",
"0.6033541",
"0.6001715",
"0.6001555",
"0.5941209",
"0.59295356",
"0.5928059",
"0.5913213",
"0.5883966",
"0.5812059",
"0.57280314",
"0.57203645",
"0.57191515",
"0.5711388",
"0.5701455",
"0.5701455",
... | 0.7522372 | 0 |
Shows the flow view. | def show(self):
if not self.init_run and self.flow_auto_update:
self.run_all()
self.init_run = True
self.flow_view.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show(self) -> None:\n show(self._layout)",
"def debug_view(self):\n\n self.view.show()",
"def show(self):\n self.Show()",
"def show(self):\n self._impl.show()",
"def show(self):\r\n self.wf.Show()",
"def show(self):\r\n\t\tself.frame.Show(True)",
"def show(self):\... | [
"0.7422463",
"0.7082522",
"0.70687854",
"0.7014551",
"0.6822111",
"0.66616946",
"0.66565996",
"0.6651967",
"0.66497356",
"0.6603554",
"0.6514715",
"0.6514338",
"0.6469389",
"0.6454927",
"0.64074004",
"0.63911587",
"0.63750094",
"0.6352742",
"0.63098603",
"0.6304212",
"0.63021... | 0.7938837 | 0 |
Adds a connection between two ryven nodes. | def add_connection(
self, port1: ryvencore.NodePort.NodeOutput, port2: ryvencore.NodePort.NodeInput
) -> ryvencore.Connection.DataConnection:
ryven_connection = self.script.flow.connect_nodes(port1, port2)
if not ryven_connection:
return
# Add connection in compas graph
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_connection(self, n1: Node, n2: Node):\n if n2.node_id in n1.get_connections_ids() or n1.node_id in n2.get_connections_ids():\n return\n n1.add_child(n2)\n n2.add_child(n1)",
"def connect(self, node1, node2):\n self.neighbour1 = node1\n self.neighbour2 = node2... | [
"0.74744534",
"0.7035947",
"0.7024715",
"0.70114225",
"0.6965084",
"0.6958533",
"0.6944122",
"0.6897327",
"0.6821068",
"0.680157",
"0.6738871",
"0.66698116",
"0.6661608",
"0.6642136",
"0.65965754",
"0.6562806",
"0.6531372",
"0.6442183",
"0.6376743",
"0.63594854",
"0.63417023"... | 0.7223123 | 1 |
Count number of lemmas, theorems and corollarys | def add_number_of_lemmas(self):
self.lemmas = 0
for t in self.thys:
with open(t, 'r') as f:
for l in f:
if l.startswith("lemma") or l.startswith("corollary") or \
l.startswith("theorem"):
self.lemmas += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_terms(equat_orig):\n\tterms = 0\n\tfor pow_group in equat_orig:\n\t\tif pow_group:\n\t\t\tfor _ in pow_group:\n\t\t\t\tterms += 1\n\tprint(f'\\033[1;95mTerms in the polynom: \\033[0m{terms}')",
"def get_proportion_of_unique_lemmas(self):\n lemmas = self.blob.words.lemmatize()\n return len... | [
"0.6594891",
"0.6079608",
"0.59840477",
"0.5946501",
"0.5897403",
"0.58781976",
"0.58646435",
"0.58304507",
"0.5825613",
"0.5816639",
"0.5805408",
"0.57794863",
"0.57794863",
"0.57706714",
"0.5768236",
"0.57669747",
"0.576134",
"0.5755625",
"0.5731528",
"0.5721517",
"0.571918... | 0.71006244 | 0 |
Updates all club stats. Returns an array of 'totals' ClubStats instances, one per club. | def update_all_club_stats():
LOG.info("Updating all Club stats")
clubs = Club.objects.only('pk', 'name')
clubstats = []
for club in clubs:
club_totals = update_club_stats_for_club(club)
clubstats.append(club_totals)
return clubstats | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_club_stats_for_club(club):\n LOG.info(\"Updating Club stats for {}\".format(club))\n s_entries = ClubStats.objects.filter(club=club)\n\n # A dictionary for Club Stats entries, keyed by the team id\n s_lookup = {}\n\n totals = None\n # Reset all the entries\n for stat in s_entries:\n... | [
"0.7372738",
"0.5427892",
"0.53171176",
"0.5102313",
"0.5064504",
"0.50610644",
"0.50403863",
"0.49543762",
"0.49240914",
"0.49070802",
"0.4889584",
"0.48840013",
"0.4880676",
"0.4870618",
"0.48644617",
"0.48627377",
"0.4825766",
"0.48174918",
"0.4813405",
"0.48101968",
"0.48... | 0.8627742 | 0 |
Updates the Club Stats entries for the specified opposition club. Returns the totals ClubStat instance for the specified club. | def update_club_stats_for_club(club):
LOG.info("Updating Club stats for {}".format(club))
s_entries = ClubStats.objects.filter(club=club)
# A dictionary for Club Stats entries, keyed by the team id
s_lookup = {}
totals = None
# Reset all the entries
for stat in s_entries:
stat.rese... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_all_club_stats():\n LOG.info(\"Updating all Club stats\")\n clubs = Club.objects.only('pk', 'name')\n\n clubstats = []\n for club in clubs:\n club_totals = update_club_stats_for_club(club)\n clubstats.append(club_totals)\n\n return clubstats",
"def rate_club(user, club):\n... | [
"0.70028555",
"0.5369185",
"0.5151354",
"0.48897886",
"0.48666605",
"0.47648612",
"0.47296625",
"0.4717106",
"0.46785805",
"0.46546876",
"0.46398255",
"0.4627607",
"0.46204957",
"0.46181107",
"0.45707706",
"0.45473942",
"0.4518063",
"0.45050904",
"0.44696677",
"0.44387135",
"... | 0.77575177 | 0 |
Executes a utask locally inmemory. | def execute(self, task_argument, job_type, uworker_env):
uworker_input = utasks.tworker_preprocess_no_io(self.module, task_argument,
job_type, uworker_env)
if uworker_input is None:
return
uworker_output = utasks.uworker_main_no_io(self.module, uwork... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def executor(host):\n try:\n exec_call(sssh(host))\n except Exception as msg:\n print('%s' % str(msg))\n pass",
"def execute(\n cmd,\n showout=False,\n cwd=None,\n shell=\"/bin/bash\",\n timeout=600,\n asynchronous=False,\n env=None,\n replace_env=False,\n die=False,\n):\n ... | [
"0.57533836",
"0.55996877",
"0.55957216",
"0.557422",
"0.5485157",
"0.54563415",
"0.5409671",
"0.5363411",
"0.5326224",
"0.53230757",
"0.5288659",
"0.52880055",
"0.52670574",
"0.52653265",
"0.52626306",
"0.5242534",
"0.5235665",
"0.5210992",
"0.52054167",
"0.51614887",
"0.515... | 0.5959228 | 0 |
Executes postprocessing of a utask. | def execute(self, task_argument, job_type, uworker_env):
# These values are None for now.
del job_type
del uworker_env
input_path = task_argument
utasks.tworker_postprocess(input_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _RunPostProcess(self, threadpool, step, decode_out_obj, dec_metrics,\n global_step, buffered_decode_out, postprocess_futures):\n if threadpool:\n # Run postprocess on separate CPU thread.\n postprocess_futures.append(\n threadpool.apply_async(\n self._Pos... | [
"0.62747073",
"0.591948",
"0.58465326",
"0.57980436",
"0.5624203",
"0.5612275",
"0.55396414",
"0.54367703",
"0.54245114",
"0.54152566",
"0.53906363",
"0.53749937",
"0.53389305",
"0.53280145",
"0.52629447",
"0.5260051",
"0.52594",
"0.52552426",
"0.52552426",
"0.52552426",
"0.5... | 0.6225096 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.