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 |
|---|---|---|---|---|---|---|
Print receipts related to specified Student Contain all three amounts paid mess fees, room rent, amenities charge | def print_receipt(Student):
pdf = FPDF('P', 'mm', 'A4')
pdf.add_page('P')
pdf.set_font('Times', 'B', 14)
pdf.multi_cell(0, 5, 'Student Dues Payment Receipt')
pdf.ln()
pdf.multi_cell(0, 5, ('Student ID: %s' % Student.student_ID))
pdf.ln()
pdf.multi_cell(0, 5, ('Name: %s' % Student.name)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_student_report(self):\n \n period_type = self.parameter_dict.get(\"period_type\", \"monthly\")\n insert_gender_markers = self.parameter_dict.get(\n \"insert_gender_markers\", False)\n period = [(self.start_date,self.end_date)]\n for student in self.student... | [
"0.58656114",
"0.5852727",
"0.5595382",
"0.55868745",
"0.5516554",
"0.5511955",
"0.5490234",
"0.54839575",
"0.5436576",
"0.541411",
"0.5412061",
"0.53985006",
"0.53951246",
"0.5368056",
"0.53509426",
"0.5329534",
"0.5324563",
"0.5310762",
"0.5279635",
"0.527889",
"0.5268582",... | 0.75747764 | 0 |
Print letter for Student at time of admission Contains details as provided by the Student | def issue_student_admission_letter(Student, body):
pdf = FPDF('P', 'mm', 'A4')
pdf.add_page('P')
pdf.set_font('Times', 'B', 14)
pdf.multi_cell(0, 5, 'Student Admission Letter')
pdf.ln()
pdf.multi_cell(0, 5, ('Name: %s' % Student.name))
pdf.ln()
pdf.multi_cell(0, 5, ('Address: %s' % Stu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_student(s_info):\n print('')\n print('Your information:')\n print(f'{s_info.student_id} - {s_info.first_name} {s_info.last_name}')",
"def __str__(self):\n return \"student:\"+str(self.name)+\":\"+str(self.age)+\":\"+str(self.major)",
"def __str__(self):\n return str(self.__st... | [
"0.6675286",
"0.6378189",
"0.6343893",
"0.6320618",
"0.6295893",
"0.6235386",
"0.61603206",
"0.6133385",
"0.6130784",
"0.6011712",
"0.6004627",
"0.5992418",
"0.5982091",
"0.59453845",
"0.5931745",
"0.59027773",
"0.5890217",
"0.58893615",
"0.585697",
"0.5848341",
"0.5838587",
... | 0.6613428 | 1 |
Initialize an object with loading the credentials using a credentials file and yaml key | def __init__(self, cred_file, yaml_key):
self.premium_search_args = load_credentials(cred_file,
yaml_key=yaml_key,
env_overwrite=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, passwd=None, yamlname=None): # Passwd is in the clear so be careful\n if yamlname is None:\n utilities.log.error('No json configuration was provided for iRODS: Abort')\n sys.exit(1)\n if passwd is None:\n utilities.log.error('No passwd was provided ... | [
"0.7274843",
"0.6939988",
"0.69185185",
"0.68165654",
"0.6759032",
"0.67555183",
"0.6753559",
"0.67516315",
"0.6747947",
"0.6732597",
"0.6726737",
"0.6692598",
"0.6635135",
"0.65862745",
"0.6492167",
"0.6491658",
"0.64460856",
"0.6417166",
"0.64065987",
"0.63984865",
"0.63525... | 0.728429 | 0 |
Get only the necessary fields of a tweet returns a Tweet with the needed attributes as a dict | def get_tweet_attributes(self, tw):
tw_dict = {}
tw_dict['created_at'] = tw['created_at']
tw_dict['lang'] = tw['lang']
tw_dict['text'] = tw['text']
tw_dict['entities'] = tw['entities']
tw_dict['favorite_count'] = tw['favorite_count']
tw_dict['ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweets_features(tweet):\n tweet = remove_stop_words(tweet)\n return {'TWEET': tweet}",
"def extract_user_dict_from_tweet( tweet: Tweet ):\n if tweet.other_data and len( tweet.other_data ) > 0:\n # extract the json into a dict\n j = json.loads( tweet.other_data )\n # extract the ... | [
"0.6789574",
"0.67805123",
"0.6629773",
"0.6599947",
"0.6406722",
"0.6375403",
"0.6339529",
"0.62415105",
"0.62412876",
"0.6117636",
"0.6082488",
"0.605193",
"0.60203075",
"0.5877773",
"0.58547664",
"0.5826857",
"0.57997686",
"0.57727486",
"0.5763892",
"0.57532144",
"0.573178... | 0.7178673 | 0 |
Add all graphs for displaying sensor data. | def CreateGraphs(self, sensorid):
for i in range(len(sensorid)):
# Add a graph plot to list
self.plotter[sensorid[i]] = plot.PlotCanvas(self.panel)
self.plotter[sensorid[i]].SetEnableLegend(True)
#self.plotter[sensorid[i]].SetEnableGrid(True)
#self.plo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_graphs(self):\n self.frequency_plot_graph.show()\n self.resistance_graph.show()\n self.temperature_plot_graph.show()\n self.pressure_plot_graph.show()\n self.humidity_plot_graph.show()\n self.overview_graph.show()\n self.overview_graph.setXRange(-1000, 5000... | [
"0.6879036",
"0.6579829",
"0.65368325",
"0.6452261",
"0.6339766",
"0.6261383",
"0.62553847",
"0.6229404",
"0.62257975",
"0.62213117",
"0.6219536",
"0.61914164",
"0.6187895",
"0.6159931",
"0.6148075",
"0.61305416",
"0.6126133",
"0.6087059",
"0.60675865",
"0.6028357",
"0.600044... | 0.6922832 | 0 |
Set the range of Yaxis for display | def SetYAxisRange(self, lower, upper):
self.Y_AXIS_RANGE = (lower, upper) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __draw_yaxis(self):\n self.ax.set_ylim(self.ylims)\n # set y ticks\n yticks = [*range(0, self.ymax, 5)]\n fs = self.settings.rcParams[\"axes.labelsize\"] if self.settings.otherParams[\n \"ylabel.fontsize\"] is None else self.settings.otherParams[\"ylabel.fontsize\"]\n ... | [
"0.7353007",
"0.72912204",
"0.7056452",
"0.7000773",
"0.69802177",
"0.69701964",
"0.69701964",
"0.6961962",
"0.6933012",
"0.6850009",
"0.6794499",
"0.67578864",
"0.67419934",
"0.67419934",
"0.67362744",
"0.67272717",
"0.67264444",
"0.666699",
"0.66562355",
"0.6655635",
"0.662... | 0.8293696 | 0 |
raises astropy.units.UnitsError if not a distance unit | def _convert_to_and_validate_distance_unit(unit):
if unit is not None:
unit = u.Unit(unit)
if not unit.is_equivalent(u.kpc):
raise u.UnitsError(six.u('Unit "{0}" is not a distance').format(unit))
return unit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDistanceUnits(self) -> Unit:\n ...",
"def test_get_distance() -> None:\n meters = location_util.distance(\n COORDINATES_PARIS[0],\n COORDINATES_PARIS[1],\n COORDINATES_NEW_YORK[0],\n COORDINATES_NEW_YORK[1],\n )\n\n assert meters / 1000 - DISTANCE_KM < 0.01",
... | [
"0.68959516",
"0.6531648",
"0.61516035",
"0.6054251",
"0.6039936",
"0.6039793",
"0.60213655",
"0.6009243",
"0.59936506",
"0.5992886",
"0.5975478",
"0.5958747",
"0.5953431",
"0.5900235",
"0.589641",
"0.5890246",
"0.5827913",
"0.58258593",
"0.5817387",
"0.5809252",
"0.58037347"... | 0.7658923 | 0 |
The distance modulus of this distance as a Quantity | def distmod(self):
val = 5. * np.log10(self.to(u.pc).value) - 5.
return u.Quantity(val, u.mag) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distmod(self):\n val = 5.0 * np.log10(self.to_value(u.pc)) - 5.0\n return u.Quantity(val, u.mag, copy=False)",
"def modulus(self):\n return math.sqrt(self._reNum ** 2 + self._imNum ** 2)",
"def modulus(self):\n return self._n",
"def distance_modulus(d):\n dmag = 5 * log(d) ... | [
"0.7152383",
"0.66799486",
"0.65983427",
"0.6582863",
"0.6300369",
"0.6256586",
"0.6187268",
"0.61243665",
"0.6103785",
"0.606291",
"0.5966888",
"0.58380646",
"0.58076847",
"0.57429963",
"0.5727226",
"0.56864965",
"0.5662907",
"0.565712",
"0.56445813",
"0.56345314",
"0.561879... | 0.69861215 | 1 |
Converts to the spherical representation of this point. Returns | def to_spherical(self):
return cartesian_to_spherical(self.x, self.y, self.z) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cartesian_to_spherical(self, v):\n x = Vector.x(v)\n y = Vector.y(v)\n z = Vector.z(v)\n r = Vector.length(v)\n phi = atan2(y, x)\n theta = acos(z / r)\n \n return [r, phi, theta]",
"def spherical(self, x, y):\n\t\twhile x >= self.planet.width or x < 0 o... | [
"0.7045606",
"0.66927147",
"0.6692273",
"0.668019",
"0.65737593",
"0.65737593",
"0.6492899",
"0.6417639",
"0.6404603",
"0.6351715",
"0.6329752",
"0.6121212",
"0.61188513",
"0.6074496",
"0.6060194",
"0.6014923",
"0.60014564",
"0.5973966",
"0.5957356",
"0.5955025",
"0.594932",
... | 0.81549674 | 0 |
Compute career pathways (i.e. userperformed and recommended) for each user. | def compute_pathways(users, job_graph, debug, min_likelihood_thr=0.2):
start_time = time.time()
__print_msg('Computing career pathways...', debug)
user_pathways = {}
tot_users = len(users)
i = 0
for user, user_jobs in users.items():
user_pathway = compute_user_pathway(user_jobs, j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_user_pathway(user_jobs, job_graph, debug=False):\r\n pathway = []\r\n for i, job in enumerate(user_jobs):\r\n if i == 0:\r\n continue\r\n cluster, _ = job_graph.assign_job_to_jobgraph_state(job)\r\n pathway.append(cluster)\r\n return pathway",
"def metric_path... | [
"0.5953887",
"0.59538865",
"0.56319934",
"0.56293374",
"0.55796844",
"0.55332",
"0.55092543",
"0.5428622",
"0.5426576",
"0.54115033",
"0.5401471",
"0.53886443",
"0.5361762",
"0.53074896",
"0.521614",
"0.5194592",
"0.51802075",
"0.51579696",
"0.51287794",
"0.5086181",
"0.50838... | 0.73937947 | 0 |
Compute the user pathway, given the sequence of job titles. The first job will be excluded, because it is only used to build the user's initial profile. | def compute_user_pathway(user_jobs, job_graph, debug=False):
pathway = []
for i, job in enumerate(user_jobs):
if i == 0:
continue
cluster, _ = job_graph.assign_job_to_jobgraph_state(job)
pathway.append(cluster)
return pathway | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_pathways(users, job_graph, debug, min_likelihood_thr=0.2):\r\n start_time = time.time()\r\n __print_msg('Computing career pathways...', debug)\r\n user_pathways = {}\r\n tot_users = len(users)\r\n i = 0\r\n for user, user_jobs in users.items():\r\n user_pathway = compute_user_p... | [
"0.66621715",
"0.64165413",
"0.5436636",
"0.5328678",
"0.5032977",
"0.49962577",
"0.49273804",
"0.488265",
"0.46935585",
"0.46905273",
"0.46765473",
"0.4644199",
"0.46357313",
"0.45190293",
"0.45152992",
"0.4504067",
"0.44798177",
"0.44772255",
"0.4473935",
"0.44730064",
"0.4... | 0.71870023 | 0 |
Recommend a pathway, given the sequence of job titles. | def recommend_pathway(user_jobs, job_graph, goal_state, min_likelihood_thr):
user_jobs_for_mdp = [user_jobs[0]]
mdp = MDP(job_graph, user_jobs_for_mdp, goal_state, min_likelihood_thr=min_likelihood_thr)
return mdp.solve_mdp() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recommendations(artist, title):\n rec = Recommendation(artist, title)\n if rec.find_track_info():\n rec.load_recommendations()\n return render_template('recommendations.html', title='Your Recommendations', rec=rec)\n flash('Whoops, we did not find the track \"{}\" by {}!'.format(\\\n ... | [
"0.55554616",
"0.49509117",
"0.49274385",
"0.49202466",
"0.47717598",
"0.4758381",
"0.47329575",
"0.4687782",
"0.46796837",
"0.46436214",
"0.4615047",
"0.46136823",
"0.45894393",
"0.45886946",
"0.4578933",
"0.45743513",
"0.456499",
"0.4564924",
"0.45648426",
"0.45518708",
"0.... | 0.6105465 | 0 |
Compute the percentage of times the recommended pathway is shorter than the user's one. | def metric_path_length(pathways):
num_users = len(pathways)
num_good_recommendations = 0
sum_u_path_len = 0
sum_r_path_len = 0
career_goal_reached = 0
for user, pathway_tuple in pathways.items():
u_path = pathway_tuple[0]
r_path = pathway_tuple[1]
sum_u_path_len ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def h_score(self):\n if self.estimated_moves_to_goal is None:\n self.estimated_moves_to_goal = \\\n max(nx.single_source_shortest_path_length(self.graph, self.head_node).items(), key=lambda x: x[1])[1]\n return self.estimated_moves_to_goal",
"def percent_passing(self) -> f... | [
"0.62298673",
"0.61328906",
"0.6114768",
"0.6096005",
"0.6058874",
"0.60417265",
"0.5953899",
"0.59453714",
"0.59453714",
"0.59438455",
"0.59438455",
"0.59332836",
"0.5882768",
"0.58660126",
"0.5852752",
"0.5846534",
"0.58149326",
"0.58115447",
"0.57984257",
"0.57840717",
"0.... | 0.76785594 | 0 |
Executes 'num_steps' number of generations for each island in the archipelago's list of islands | def step_through_generations(self, num_steps):
for island in self._islands:
for _ in range(num_steps):
island.execute_generational_step()
self.archipelago_age += num_steps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_generations(init_len):\n num_graphs = 0\n current_gen = [nx.path_graph(init_len)]\n complete_graph_list = current_gen.copy()\n while len(current_gen) and current_gen[0].size() < (3*init_len - 7):\n current_gen = generation_next(current_gen)\n num_graphs += show_graph_list(current_... | [
"0.622001",
"0.6160472",
"0.5919634",
"0.5737377",
"0.56605166",
"0.5636519",
"0.5605472",
"0.5555017",
"0.5548242",
"0.5515285",
"0.5510959",
"0.5510417",
"0.54903746",
"0.54616743",
"0.54526263",
"0.54507804",
"0.54276735",
"0.5407268",
"0.54053366",
"0.5392859",
"0.5392859... | 0.8080125 | 0 |
Shuffles island populations for migration and performs migration by swapping pairs of individuals between islands | def coordinate_migration_between_islands(self):
island_partners = self._shuffle_island_indices()
for i in range(self._num_islands//2):
self._shuffle_island_and_swap_pairs(island_partners, i) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def island_migration(self):\n for y in self.island_map:\n for cell in y:\n cell.migration()\n\n for y in self.island_map:\n for cell in y:\n for animal in cell.population:\n animal.has_moved = False",
"def migrate(pops, fit_pop)... | [
"0.68163073",
"0.6413612",
"0.6349531",
"0.61725616",
"0.6144668",
"0.59786785",
"0.59766847",
"0.5838693",
"0.58274037",
"0.58169585",
"0.58069676",
"0.58006257",
"0.5762604",
"0.57593423",
"0.57574344",
"0.571842",
"0.56880665",
"0.5660161",
"0.5643648",
"0.563159",
"0.5629... | 0.73018396 | 0 |
Tests that the fitness of individuals is less than or equal to the specified error tolerance | def test_for_convergence(self, error_tol):
list_of_best_indvs = []
for island in self._islands:
best_indv = island.best_individual()
list_of_best_indvs.append(best_indv)
list_of_best_indvs.sort(key=lambda x: x.fitness)
best_indv = list_of_best_indvs[0]
co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test_expected_error_bound(bellman_error_margin, optimal_res, test_res, mdp):\n test_eval = test_res.policy.evaluate_on(mdp)\n test_occ = test_eval.state_occupancy #occupancy from start state\n test_start_steps = sum(test_occ.values())\n value_diff = test_res.initial_value - optimal_res.initial_va... | [
"0.67049265",
"0.6273725",
"0.5888294",
"0.5867151",
"0.5821513",
"0.58181053",
"0.5802155",
"0.57919264",
"0.57553136",
"0.5714477",
"0.56883866",
"0.56820804",
"0.56820804",
"0.56757665",
"0.56673026",
"0.5622294",
"0.56171614",
"0.56007904",
"0.5595701",
"0.55744684",
"0.5... | 0.7107953 | 0 |
Returns the best individual if the islands converged to an acceptable fitness. Returns | def get_best_individual(self):
return self._best_indv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _best_individual(self):\n return max(self._population, key=attrgetter(\"fitness\"))",
"def best_individual(self):\n return self.population.best_individual()",
"def get_best(self) -> Chromosome:\n if not (self._best_chromosome is None): # if the best chromosome is unchanged since the l... | [
"0.80649817",
"0.75292766",
"0.71652573",
"0.6961003",
"0.6884281",
"0.6873114",
"0.67495084",
"0.66600174",
"0.6649065",
"0.6631332",
"0.6609789",
"0.6591238",
"0.65880316",
"0.6585515",
"0.65848273",
"0.65382606",
"0.65047693",
"0.64753777",
"0.6447623",
"0.6391002",
"0.633... | 0.76329255 | 1 |
This function renames parts of model to meet the specific requirements of this writer. This behaviour replaces the previous approach of subclassing the parser to produce different results depending on the which writer was intended to be used. | def rename(self):
# Remove any zero-padding from single-digit parameter names
# This reverses any change applied by one of the CUDA writers
for i in range(self.parser.comp-1, len(self.parser.parsedModel.parameterId)):
old_name = self.parser.parsedModel.parameterId[i]
num... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_model_name(self, name):\n self._name = name\n if self._zon is not None:\n self._zon.filename = f\"{name}.{self._zon.filename.split('.')[-1]}\"",
"def rename_value(model: onnx.ModelProto, old_name: str, new_name: str):\n if old_name == new_name:\n return\n logger =... | [
"0.6066185",
"0.57070076",
"0.56384206",
"0.5627522",
"0.5619943",
"0.56025624",
"0.55501103",
"0.5547868",
"0.5511047",
"0.54787534",
"0.5460824",
"0.5460824",
"0.5460381",
"0.5453813",
"0.54244596",
"0.53756005",
"0.53688747",
"0.5359618",
"0.53477144",
"0.5337874",
"0.5324... | 0.6582319 | 0 |
create or update customer | def create_or_update_customer(entity):
try:
organisation = entity.get('organisation').replace("'","")
organisation = "%s(C)"%organisation if is_supplier_or_customer_group(organisation) else organisation
name = frappe.db.get_value('Customer', organisation)
if not name:
customer = frappe.new_doc("Customer")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_customer_update(self):\n # first performe create\n id = self._create_model(\"customer\", self.customer_data, [\"name\", \"email\", \"phone\"])\n if id:\n # then performe update\n data = { \n \"name\": \"Changed the name\",\n \"email\... | [
"0.7436413",
"0.7397227",
"0.7354975",
"0.71516573",
"0.7110927",
"0.710495",
"0.7101501",
"0.70412105",
"0.69803005",
"0.69173807",
"0.686979",
"0.68632066",
"0.68632066",
"0.6809742",
"0.6789764",
"0.6761391",
"0.6745711",
"0.67418706",
"0.67362934",
"0.6710319",
"0.6705627... | 0.7588754 | 0 |
create or update the customer Contact | def create_or_update_contact(customer, entity):
name = frappe.db.get_value('Contact', { 'entity_id': entity.get('entity_id') })
if not name:
contact = frappe.new_doc('Contact')
else:
contact = frappe.get_doc("Contact", name)
if not entity.get('firstname'):
return
contact.first_name = entity.get('firstname... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_update_customer(entity):\n\ttry:\n\t\torganisation = entity.get('organisation').replace(\"'\",\"\")\n\t\torganisation = \"%s(C)\"%organisation if is_supplier_or_customer_group(organisation) else organisation\n\t\tname = frappe.db.get_value('Customer', organisation)\n\t\tif not name:\n\t\t\tcustomer =... | [
"0.7233565",
"0.68543464",
"0.66533446",
"0.6599077",
"0.6465166",
"0.64515483",
"0.64510775",
"0.6444469",
"0.6425489",
"0.6370573",
"0.63516873",
"0.6306901",
"0.62915707",
"0.62861454",
"0.62610596",
"0.6254461",
"0.6238027",
"0.62310433",
"0.62062687",
"0.61987454",
"0.61... | 0.81380326 | 0 |
create or update the address | def create_or_update_address(address, customer):
name = frappe.db.get_value('Address', { 'entity_id': address.get('entity_id') })
if not name:
addr = frappe.new_doc('Address')
addr.address_title = "{} {} {}".format(
address.get("firstname"),
address.get("lastname"),
address.get("entity_id")
)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_address(self, new_address, ):\n self.address.append(new_address)\n self.save()",
"def update_address(cls, address_data):\n address_instance = cls.objects.get(email=address_data['customer']['email'])\n address_data = address_data.get('addresses')\n for field_name, values... | [
"0.7209289",
"0.70491314",
"0.6748431",
"0.660723",
"0.66056013",
"0.6600469",
"0.65181816",
"0.65090024",
"0.64898705",
"0.64765316",
"0.6472879",
"0.6464529",
"0.6418298",
"0.6395395",
"0.63934857",
"0.63818413",
"0.6379002",
"0.6343427",
"0.634245",
"0.6290266",
"0.628957"... | 0.762756 | 0 |
Loads package name from command line arguments. | def get_package_name():
package = None
try:
package = os.environ.get('LOCAL_PART', '') + os.environ.get('LOCAL_PART_SUFFIX', '')
if not package and len(sys.argv) > 1:
package = sys.argv[-1].lower()
except Exception,e:
log.error(str(e))
finally:
return package | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_package_init(*args):\n\n if len(args) == 0:\n print 'No package name specified'\n return 1\n packname = args[0]\n\n # Setup build, install, and data directories\n util.ensure_dir_exists(package_path(packname))\n\n # Touch an empty config.py where the user can adjust setting... | [
"0.56937206",
"0.5565932",
"0.5559221",
"0.555798",
"0.5511743",
"0.5511743",
"0.549686",
"0.54937357",
"0.5469482",
"0.5469482",
"0.54630214",
"0.5454337",
"0.54044306",
"0.5401598",
"0.539499",
"0.539345",
"0.53648907",
"0.5363433",
"0.5363248",
"0.5354271",
"0.53508025",
... | 0.6878033 | 0 |
Returns keyword (from supplied package name, if any). | def get_keyword(package):
try:
substr = re.search(r'(\S+)_(\S+)', package)
if substr:
return substr.groups()
except Exception,e:
log.error(str(e))
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readable_keyword(s):\n if s and not s.startswith(\"*\") and not s.startswith(\"[\"):\n if s.count(\".\"):\n library, name = s.rsplit(\".\", 1)\n return library + \".\" + name[0:].title()\n else:\n return s\n else:\n return s",
"def read_package_vari... | [
"0.63861567",
"0.62863207",
"0.6277217",
"0.62762856",
"0.62735116",
"0.62571263",
"0.6205",
"0.6157799",
"0.59881186",
"0.5964056",
"0.5946726",
"0.591496",
"0.588399",
"0.5882375",
"0.58692354",
"0.58623904",
"0.5844938",
"0.58448356",
"0.58406734",
"0.58017486",
"0.5789892... | 0.84235466 | 0 |
Allocate a TransposedConvLayer with shared variable internal parameters. | def __init__(self, input, num_filters, filter_size, stride=(2, 2), padding=(0, 0), activation=rectify):
self.input = input
self.output = layers.TransposedConv2DLayer(self.input, num_filters, filter_size, stride=stride, crop=padding,
W=initialize_parame... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transpose(incoming, conv, nonlinearity, *args, **kwargs):\n return TransposedConv2DLayer(incoming, conv.input_shape[1],\n conv.filter_size, stride=conv.stride,\n crop=conv.pad, W=conv.W,\n flip_filters=not conv.f... | [
"0.63744015",
"0.5864105",
"0.586131",
"0.5837967",
"0.5762193",
"0.5750853",
"0.57461226",
"0.57346827",
"0.57076824",
"0.5697772",
"0.56805575",
"0.5673117",
"0.5603193",
"0.5555773",
"0.5510417",
"0.5501909",
"0.5458268",
"0.5454152",
"0.5436939",
"0.54160196",
"0.5399038"... | 0.61901104 | 1 |
Do the crawn job (see crawl function) from spider class name (eg. pyjobs_crawlers.spiders.myspider.MySpiderClass) | def crawl_from_class_name(spider_class_name, connector, spider_error_callback=None):
module_name = '.'.join(spider_class_name.split('.')[:-1])
class_name = spider_class_name.split('.')[-1]
spider_module = import_module(module_name)
spider_class = getattr(spider_module, class_name)
return crawl([sp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runSpider(spiderClass):\n\n\tprocess = CrawlerProcess({\n\t\t# 'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'\n\t})\n\n\tprocess.crawl(spiderClass)\n\tprocess.start() # the script will block here until the crawling is finished",
"def crawl(spider: str, book_id: int):\n proc = CrawlerPr... | [
"0.73961866",
"0.6965943",
"0.6719651",
"0.6231977",
"0.6110582",
"0.60992587",
"0.6060535",
"0.6008926",
"0.5995375",
"0.5984809",
"0.5936894",
"0.59176165",
"0.59090364",
"0.5877148",
"0.58751583",
"0.5838686",
"0.5806472",
"0.57944125",
"0.57699037",
"0.57601506",
"0.57359... | 0.70772463 | 1 |
Return a parsed BIOM table. | def load_biom_table(table_f):
return parse_biom_table(table_f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_table(text):\n\n text = str(text)\n try:\n text = text.split(\"<pre>\")[1]\n text = text.split(\"</pre>\")[0]\n text = text.split(\"To save this output\")[0]\n lines = text.split(\"\\n\")\n except Exception as exc:\n raise NNDCRequestError(f\"Unable to parse t... | [
"0.5795739",
"0.56989133",
"0.5626127",
"0.5613763",
"0.55284244",
"0.55272263",
"0.55172074",
"0.5440883",
"0.5421252",
"0.53791916",
"0.53787607",
"0.53451467",
"0.53356135",
"0.5328347",
"0.5308771",
"0.5279552",
"0.52757406",
"0.52719027",
"0.5256095",
"0.5256095",
"0.525... | 0.6301872 | 0 |
Return a BIOM table and the original open filehandle as a tuple. Useful when additional computation needs to be performed on the file contents, such as an MD5 sum. | def load_biom_table_with_file_contents(biom_f):
table = parse_biom_table(biom_f)
if hasattr(biom_f, 'seek'):
biom_f.seek(0)
return table, biom_f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file(self) -> tuple:\r\n hash_md5 = hashlib.md5()\r\n with open(self.yara_base_file, \"rb\") as f:\r\n file_map = f.read()\r\n get_file_dict = get_matches(self, file_map)\r\n hash_md5.update(file_map)\r\n return hash_md5.hexdigest(), get_file_dict",
"def __enter__(self) ... | [
"0.5903592",
"0.5517948",
"0.5293327",
"0.5092299",
"0.5019564",
"0.5009954",
"0.49709004",
"0.49704278",
"0.49154168",
"0.49107695",
"0.48602694",
"0.4815139",
"0.47660074",
"0.4726421",
"0.4725368",
"0.4721951",
"0.47156245",
"0.47033814",
"0.46824378",
"0.46797317",
"0.466... | 0.6167393 | 0 |
Parse a sample/observation metadata file, return a ``MetadataMap``. If ``lines`` is ``None``, this function will return ``None``. | def load_metadata(lines):
if lines is not None:
return MetadataMap.from_file(lines)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseMetadataMap(lines):\r\n return MetadataMap(*parse_mapping_file_to_dict(lines))",
"def get_sample_info(lines):\r\n mapping_data, header, comments = parse_mapping_file(lines)\r\n labels = [\"from\", \"to\", \"eweight\", \"consensus_lin\"]\r\n node_labels = [\"node_name\", \"node_disp_name\... | [
"0.8028162",
"0.5969158",
"0.58202237",
"0.57127655",
"0.56976295",
"0.56358564",
"0.5572141",
"0.55685896",
"0.556603",
"0.5544489",
"0.55414313",
"0.5443912",
"0.5436588",
"0.5433023",
"0.5427803",
"0.5423232",
"0.53913337",
"0.5390329",
"0.5361068",
"0.53360075",
"0.528676... | 0.8175402 | 0 |
Initialize the contact tag. | def __init__(
self,
tag: typing.Optional[int],
contact: typing.Optional[int],
**kwargs: typing.Dict,
) -> None:
super().__init__(**kwargs)
self.tag = tag
self.contact = contact | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, contact):\n\n\t\tself._id = UserClassroom.__ID\n\t\tself._contact = contact\n\t\tself.size = 1\n\n\t\tUserClassroom.__ID += 1",
"def __init__(self, uid=\"\", first_name=\"\", last_name=\"\", email=\"\", phone=\"\", description=\"\",\n company_uid=None, testing=False):\n\n ... | [
"0.6380634",
"0.63572264",
"0.62336594",
"0.61620253",
"0.60732037",
"0.6036036",
"0.60072947",
"0.60072947",
"0.60046685",
"0.6001961",
"0.5892605",
"0.58892137",
"0.58892137",
"0.58549345",
"0.58439875",
"0.57779026",
"0.57670283",
"0.5691324",
"0.56651187",
"0.5649181",
"0... | 0.73358494 | 0 |
Map field names to attributes. | def map_field_name_to_attribute() -> typing.Dict:
return {
"tag": "tag",
"contact": "contact",
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _attrs_map(self) -> \"dict[int, str]\":\n return {i: attr.name for i, attr in enumerate(self._attrs())}",
"def map_to_db_fields(field_attrs):\n attr_keys = field_attrs.keys()\n field_name = field_attrs[attr_keys.pop(attr_keys.index('name'))]\n field_type_raw = field_attrs[attr_keys.pop(attr_k... | [
"0.6646376",
"0.65862083",
"0.65552986",
"0.65168107",
"0.6496606",
"0.63440627",
"0.6253964",
"0.6224082",
"0.61496115",
"0.61344844",
"0.60731304",
"0.60435295",
"0.60270566",
"0.5998152",
"0.5984378",
"0.59624",
"0.59521395",
"0.59237885",
"0.5913278",
"0.59089035",
"0.589... | 0.81743294 | 0 |
Get all ContactTags associated to contact with that id | def all_in_contact(cls, contact_id: int):
for contact_tag in cls.get_all_in("contacts", contact_id):
yield contact_tag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_photo_tags(self, photo_id):\n\n query_string = '''\n select photo_tag.tag_name from photo\n join photo_tag on(photo_tag.photo_id=photo.photo_id)\n where photo.photo_id={}\n '''.format(photo_id)\n\n # so an array of tags would be ok\n tag_data = s... | [
"0.59750104",
"0.59688324",
"0.5902836",
"0.58065534",
"0.5737934",
"0.56792",
"0.5666696",
"0.56300694",
"0.56000763",
"0.5579044",
"0.55602413",
"0.5539786",
"0.5474715",
"0.54744804",
"0.54674107",
"0.546423",
"0.546423",
"0.5387576",
"0.5375769",
"0.5366009",
"0.53620964"... | 0.7933677 | 0 |
Is true when ``argument`` is an iterable collection with integerequivalent items. | def all_are_integer_equivalent_numbers(argument):
from abjad import mathtools
try:
return all(mathtools.is_integer_equivalent_number(_) for _ in argument)
except TypeError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterable(arg):\n return isinstance(arg, collections.Iterable) and not isinstance(arg, six.string_types)",
"def is_sequence_of_int(items):\n return all(isinstance(item, int) for item in items)",
"def is_iterable(arg):\n return (\n isinstance(arg, collections.Iterable)\n and no... | [
"0.6820437",
"0.68176305",
"0.6641058",
"0.6636341",
"0.6526343",
"0.6496134",
"0.6355871",
"0.6260515",
"0.62311673",
"0.62234855",
"0.6213004",
"0.61957854",
"0.6160951",
"0.6089377",
"0.6064915",
"0.6020444",
"0.60009134",
"0.5981801",
"0.5974256",
"0.596914",
"0.5965121",... | 0.75479543 | 0 |
Return poisson standard deviations for a series of counts => sqrt(count). | def poisson_sd(data: DataSeries) -> DataSeries:
return data.pow(0.5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simpson(counts):\n return 1 - dominance(counts)",
"def standard_deviation( values, sample=False ):\n return ma.sqrt( variance( values, sample ) )",
"def sampleStandardDeviation(numlist):\n\tv = sampleVariance(numlist)\n\t#print v\n\treturn math.sqrt(v)",
"def calc_standard_deviation(data: list) -> ... | [
"0.67654955",
"0.6592472",
"0.6389939",
"0.6386978",
"0.6347877",
"0.6347877",
"0.6317405",
"0.6290753",
"0.62828505",
"0.6280624",
"0.6271539",
"0.6244763",
"0.61702657",
"0.616199",
"0.6077561",
"0.6076158",
"0.6060597",
"0.6051322",
"0.60506374",
"0.6049991",
"0.60432696",... | 0.7089623 | 0 |
Ensure that we verify SSL by default. | def test_ssl_default(self):
assert security.security_settings.ssl_verify() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_ssl(self):\n self.ssl_context = ssl.SSLContext()\n # if self.config.get('ca_file', None):\n # self.ssl_context.load_verify_locations(ca_file=self.config['ca_file'])\n\n # TODO : Remove this\n\n verify_ssl = self.config[\"AUTH\"][\"verify_ssl\"]\n if isins... | [
"0.7664821",
"0.75893015",
"0.7575917",
"0.7255344",
"0.71744585",
"0.69131243",
"0.6908525",
"0.6856045",
"0.68336725",
"0.6823391",
"0.6813892",
"0.677433",
"0.6762706",
"0.6683818",
"0.6665227",
"0.6665193",
"0.66511506",
"0.6603701",
"0.66006225",
"0.6559028",
"0.6538089"... | 0.85075116 | 0 |
Create a myqlm representation of quantum channel from a qiskit representation of a quantum channel. | def qiskit_to_qchannel(representation):
qchannel = None
qiskit_data = representation.data
# Find what representation it is.
# Then create the corresponding matrix (kraus_ops|basis|matrix)from the data
# of the representation.
# Finally, create the QuantumChannel with the RepresentationType, the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qchannel_to_qiskit(representation):\n\n rep = representation.representation\n # Find what representation it is.\n # Then create the corresponding matrix and shape it like qiskit is expecting it.\n # Finally, create the qiskit representation from that matrix.\n if rep in (RepresentationType.PTM, ... | [
"0.7162368",
"0.63052386",
"0.62322587",
"0.6150985",
"0.54366237",
"0.5430608",
"0.5400934",
"0.5215017",
"0.51926947",
"0.5181921",
"0.512755",
"0.4988747",
"0.49690673",
"0.4939683",
"0.49243224",
"0.49112472",
"0.48836026",
"0.48823464",
"0.48380566",
"0.48145837",
"0.479... | 0.7086064 | 1 |
Create a qiskit representation of quantum channel from a myqlm representation of a quantum channel. | def qchannel_to_qiskit(representation):
rep = representation.representation
# Find what representation it is.
# Then create the corresponding matrix and shape it like qiskit is expecting it.
# Finally, create the qiskit representation from that matrix.
if rep in (RepresentationType.PTM, Representat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qiskit_to_qchannel(representation):\n\n qchannel = None\n qiskit_data = representation.data\n # Find what representation it is.\n # Then create the corresponding matrix (kraus_ops|basis|matrix)from the data\n # of the representation.\n # Finally, create the QuantumChannel with the Representat... | [
"0.68651897",
"0.6369858",
"0.6249039",
"0.6095439",
"0.5532425",
"0.5279432",
"0.5224014",
"0.5138072",
"0.5133675",
"0.5082203",
"0.5018223",
"0.49832156",
"0.49755138",
"0.49718896",
"0.48944896",
"0.48510703",
"0.48189393",
"0.48128456",
"0.47943678",
"0.478117",
"0.47810... | 0.6979349 | 0 |
This method reurns centence with style of furniture. >>> furniture1 = Furniture("empire", "bedroom") >>> assert(str(furniture1) == "") | def __str__(self):
return "<furniture style is " + str(self.style) + ">" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_furniture():",
"def __str__(self):\n return \"<This armchair furniture style is \" + str(self.style) + \">\"",
"def new_fountain():\n fountain = Composite()\n set_dungeon_feature_components(fountain)\n fountain.set_child(Description(\"Fountain\",\n (\"A... | [
"0.5750459",
"0.5182642",
"0.49739367",
"0.48258784",
"0.4760474",
"0.47537947",
"0.47426933",
"0.47203162",
"0.46918836",
"0.46697134",
"0.46030477",
"0.45801994",
"0.45153394",
"0.45117316",
"0.44764778",
"0.4470842",
"0.44334066",
"0.44276795",
"0.44269252",
"0.44269252",
... | 0.59496 | 0 |
This mehod returnschair`s assign. >>> chair1 = Chair("empire", "bedroom", "armchair") >>> assert(chair1.get_assign() == "bedroom") | def get_assign(self):
return self.assign | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_assign_identity(self) -> Union[str, None]:\n\n return self._get_assign_identity(enable_validation=True)",
"def __getitem__(self, name: str) -> Set[BaseAssignment]:\n ...",
"def perform_exercise_assign(args):\n FBDPCommon.callSelectionHook(args, 'trades', 'exercise_assign_selection')\n ... | [
"0.567902",
"0.5271101",
"0.5108276",
"0.5069352",
"0.50534844",
"0.50037473",
"0.4950295",
"0.49384058",
"0.4930697",
"0.49107504",
"0.4898811",
"0.48804885",
"0.48743683",
"0.48659533",
"0.4856359",
"0.4852952",
"0.48237786",
"0.48076132",
"0.47997218",
"0.47993913",
"0.478... | 0.7331236 | 0 |
Set up the Clementine platform. | def setup_platform(
hass: HomeAssistant,
config: ConfigType,
add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
host = config[CONF_HOST]
port = config[CONF_PORT]
token = config.get(CONF_ACCESS_TOKEN)
client = ClementineRemote(host, port, toke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure(self):\n\n self.platform.configure()",
"def setup(self):\n # Create your sprites and sprite lists here\n self.game: Game = Game(SCREEN_WIDTH, SCREEN_HEIGHT, TILE_SIZE, 1, grid_layers = 4)\n self.game.game_message = \"Lead the Rabbit home\"\n\n # show the menu so t... | [
"0.68824685",
"0.64926875",
"0.64503926",
"0.6356767",
"0.6356767",
"0.6356767",
"0.6356767",
"0.6356767",
"0.6356767",
"0.6356767",
"0.6356767",
"0.6356767",
"0.6356767",
"0.6356767",
"0.6356767",
"0.62709063",
"0.62343746",
"0.62263495",
"0.6225092",
"0.6217122",
"0.6190478... | 0.6602621 | 1 |
Simulate play pause media player. | def media_play_pause(self) -> None:
if self.state == MediaPlayerState.PLAYING:
self.media_pause()
else:
self.media_play() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_media_play_pause(player) -> None:\n assert player.state == STATE_OFF\n await player.async_media_play_pause()\n assert player.state == STATE_PLAYING\n await player.async_media_play_pause()\n assert player.state == STATE_PAUSED",
"def _control_pause(self):\n self.player.pause()... | [
"0.8116942",
"0.80330086",
"0.8000475",
"0.7805966",
"0.7696691",
"0.76267785",
"0.7618228",
"0.7533583",
"0.7516676",
"0.7498765",
"0.74963427",
"0.74963427",
"0.7420536",
"0.7380519",
"0.736805",
"0.73425657",
"0.73408324",
"0.72820014",
"0.7275913",
"0.7251658",
"0.7247109... | 0.8151165 | 0 |
Send media pause command to media player. | def media_pause(self) -> None:
self._attr_state = MediaPlayerState.PAUSED
self._client.pause() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_media_pause(self) -> None:\n await self._projector.send_command(PAUSE)",
"def pause(self):\n self.sendCommand(\"pause\")",
"def media_play_pause(self) -> None:\n if self.state == MediaPlayerState.PLAYING:\n self.media_pause()\n else:\n self.medi... | [
"0.809023",
"0.759442",
"0.7524616",
"0.75083613",
"0.7491196",
"0.7491196",
"0.7414291",
"0.7250745",
"0.724168",
"0.72367144",
"0.71571475",
"0.71521604",
"0.71426934",
"0.71061397",
"0.70989716",
"0.7085035",
"0.70630133",
"0.6954041",
"0.6925387",
"0.68717307",
"0.6850086... | 0.77531683 | 1 |
Send the previous track command. | def media_previous_track(self) -> None:
self._client.previous() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_previous_track(self):\n self.handleCommand(28)",
"async def async_media_previous_track(self):\n await self.local_meural.send_key_left()",
"async def async_media_previous_track(self):\n if not self._slave_mode:\n if not self._playing_mass:\n value = await... | [
"0.8249551",
"0.76196414",
"0.75633925",
"0.7422574",
"0.7405951",
"0.73070335",
"0.72534436",
"0.7235791",
"0.7137344",
"0.7100116",
"0.70965886",
"0.70518535",
"0.70392615",
"0.69184697",
"0.681314",
"0.6702323",
"0.66659826",
"0.6575856",
"0.65132546",
"0.6510637",
"0.6474... | 0.76491725 | 1 |
Name of the lambda function. | def function_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "function_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n\t\treturn self._func_name",
"def function_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"function_name\")",
"def function_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"function_name\")",
"def function_name(self) -> Optional[pulumi.Input[str]]:\n ... | [
"0.75944763",
"0.7466118",
"0.7466118",
"0.7391393",
"0.73342067",
"0.7193053",
"0.71084285",
"0.7066119",
"0.6840698",
"0.6837291",
"0.6763094",
"0.65932614",
"0.6569362",
"0.6566482",
"0.6476233",
"0.64046985",
"0.6297647",
"0.6272834",
"0.62716764",
"0.626815",
"0.6246849"... | 0.77050376 | 1 |
Get an existing Invocation resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
function_name: Optional[pulumi.Input[str]] = None,
input: Optional[pulumi.Input[str]] = None,
qualifier: Optional[pulumi.Input[str]] = None,
result: O... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n activation_key: Optional[pulumi.Input[str]] = None,\n arn: Optional[pulumi.Input[str]] = None,\n ip_address: Optional[pulumi.Input[str]] = None,\n ... | [
"0.58092475",
"0.56211823",
"0.5562653",
"0.5514351",
"0.5514051",
"0.5457251",
"0.54326993",
"0.542786",
"0.5396179",
"0.5394465",
"0.5353406",
"0.5345885",
"0.5341295",
"0.5336269",
"0.5336196",
"0.5327796",
"0.5297418",
"0.5287107",
"0.5264695",
"0.5260708",
"0.5249568",
... | 0.659338 | 0 |
Return document retrieval score. If docid doesn't exist in the list, then method returns 0 score. | def getDocScore(self, qryid, docid):
retrievedDocs = self.getDocs(qryid)
for pos in range(len(retrievedDocs)):
if docid == retrievedDocs[pos]:
return self.qryScores[qryid][pos]
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(self, index, query, doc_id):\n return 1",
"def score(self, index, query, doc_id):\n query_vec = self._get_query_representation(query, index)\n doc_vec = self._get_document_representation(doc_id, index)\n return self._similarity(query_vec, doc_vec)",
"def tf_idf_score():\n\... | [
"0.74571574",
"0.6616278",
"0.6386327",
"0.6302467",
"0.62684375",
"0.6095989",
"0.60721517",
"0.60592145",
"0.60592145",
"0.60391366",
"0.6036707",
"0.60315067",
"0.59710914",
"0.5947047",
"0.59403086",
"0.59256047",
"0.5889441",
"0.58889556",
"0.58793545",
"0.58497417",
"0.... | 0.7950941 | 0 |
Returns all the Channels that both the nick and the client has joined. | def channels(self):
return [channel for channel in self.client.channels if channel.has_nick(self)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_channels_for(self, server, nick):\n channels = []\n for channel in self.serverchans[server.lower()].values():\n if irc.strings.lower(nick) in channel.users:\n channels.append(channel)\n return channels",
"def get_channels():\n r = slack.channels.list().bo... | [
"0.7689199",
"0.69669604",
"0.66077626",
"0.64817184",
"0.6466343",
"0.63576937",
"0.6349284",
"0.63328314",
"0.63226914",
"0.6310823",
"0.62999576",
"0.6298013",
"0.628262",
"0.62560254",
"0.61833847",
"0.6165296",
"0.61439246",
"0.6142929",
"0.61309534",
"0.6128517",
"0.612... | 0.77265155 | 0 |
Ask user for an upper bound and returns a list containing an upper and lower bound | def get_bounds():
lower_bound = 0
upper_bound = input("Please enter a whole number: ")
domain = [lower_bound, upper_bound]
return domain | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bounds():\n return [0.00], [1.00]",
"def AskForNumberRange():\n\n\twhile True:\n\t\t# This OUTER loop will loop forever until the user enters correct integers for\n\t\t# lower and upper bound, such that lobound < hibound.\n\n\t\twhile True:\n\t\t\t# This INNER loop will loop forever until the ... | [
"0.682871",
"0.6680871",
"0.6663449",
"0.6461233",
"0.6457602",
"0.6383037",
"0.6375019",
"0.63575613",
"0.6352746",
"0.6348871",
"0.6233797",
"0.6187964",
"0.6147755",
"0.613873",
"0.61301994",
"0.6121017",
"0.6093464",
"0.6086115",
"0.6073772",
"0.6073625",
"0.6072353",
"... | 0.8307625 | 0 |
Test that noun_chunks raises Value Error for 'fi' language if Doc is not parsed. To check this test, we're constructing a Doc with a new Vocab here and forcing is_parsed to 'False' to make sure the noun chunks don't run. | def test_noun_chunks_is_parsed(fi_tokenizer):
doc = fi_tokenizer("Tämä on testi")
with pytest.raises(ValueError):
list(doc.noun_chunks) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_noun_chunks_is_parsed_fr(fr_tokenizer):\n doc = fr_tokenizer(\"trouver des travaux antérieurs\")\n with pytest.raises(ValueError):\n list(doc.noun_chunks)",
"def test_parse_simple_nonmember(self):\n lexed = [\n Token(\n value=\"qet\",\n token_... | [
"0.7741058",
"0.5441808",
"0.51667565",
"0.5122168",
"0.5025865",
"0.49811262",
"0.49760607",
"0.4974837",
"0.4910542",
"0.48398942",
"0.48027694",
"0.4799192",
"0.47787705",
"0.4753563",
"0.474306",
"0.47351125",
"0.47177085",
"0.47013432",
"0.4684846",
"0.46820647",
"0.4678... | 0.80459315 | 0 |
Rerun CLI command inside a tobecreated conda environment. | def _rerun_in_conda(conda_env_path):
conda_env_name = _get_or_create_conda_env(conda_env_path)
activate_path = _get_conda_bin_executable("activate")
commands = []
commands.append("source {} {}".format(activate_path, conda_env_name))
safe_argv = [shlex_quote(arg) for arg in sys.argv]
commands.app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepConda(commands_list, envName = envName):\n commands_list.append('module load conda2')\n commands_list.append('source deactivate') # Removes any pre-existing conda environments\n commands_list.append('source activate {eName}'.format(eName = envName))",
"def time_conda_run():\n from conda.testi... | [
"0.6140316",
"0.5963909",
"0.57024294",
"0.56684333",
"0.5625119",
"0.56162804",
"0.5252688",
"0.5224873",
"0.5202257",
"0.51971525",
"0.51945513",
"0.5131335",
"0.5123417",
"0.51196927",
"0.5108993",
"0.50988483",
"0.5078373",
"0.50722355",
"0.50060016",
"0.49738103",
"0.496... | 0.71491045 | 0 |
Serve a PythonFunction model saved with MLflow. If a ``run_id`` is specified, ``modelpath`` is treated as an artifact path within that run; otherwise it is treated as a local path. | def serve(model_path, run_id, port, host, no_conda):
if run_id:
model_path = _get_model_log_dir(model_path, run_id)
model_env_file = _load_model_env(model_path)
if not no_conda and model_env_file is not None:
conda_env_path = os.path.join(model_path, model_env_file)
return _rerun_in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_fn(fn_args: TrainerFnArgs):\n\n # Training set size\n TRAIN_SIZE = get_dataset_size(fn_args.train_files)\n NUM_STEPS = TRAIN_SIZE / BATCH_SIZE # number of steps per epoch for which to train model\n \n tf_transform_output = tft.TFTransformOutput(fn_args.transform_output)\n \n train_data... | [
"0.58916014",
"0.5890586",
"0.57216805",
"0.5697928",
"0.5560071",
"0.5538942",
"0.55345696",
"0.54726624",
"0.5426289",
"0.5396827",
"0.5383806",
"0.5382573",
"0.5378443",
"0.5323406",
"0.5306347",
"0.5273451",
"0.5273443",
"0.52704054",
"0.52411795",
"0.5230054",
"0.5208484... | 0.6641278 | 0 |
Load a pandas DataFrame and runs a python_function model saved with MLflow against it. Return the prediction results as a CSVformatted pandas DataFrame. If a ``runid`` is specified, ``modelpath`` is treated as an artifact path within that run; otherwise it is treated as a local path. | def predict(model_path, run_id, input_path, output_path, no_conda):
if run_id:
model_path = _get_model_log_dir(model_path, run_id)
model_env_file = _load_model_env(model_path)
if not no_conda and model_env_file is not None:
conda_env_path = os.path.join(model_path, model_env_file)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(\n config, feature_table, label_table,\n model_paths, model_summaries,\n save_preds_to_db=False, save_prefix='',\n discard_columns=[], log_dir='./results/'):\n\n # Create log directory if not exists\n if not os.path.exists(log_dir):\n os.makedirs(log_dir)\n\n # Get feature ... | [
"0.62471294",
"0.591763",
"0.589063",
"0.5767314",
"0.55636126",
"0.5445633",
"0.54294544",
"0.53925204",
"0.53252816",
"0.5324131",
"0.5243129",
"0.5235573",
"0.5235118",
"0.5224704",
"0.5215015",
"0.5210782",
"0.5205274",
"0.5199694",
"0.5183146",
"0.51796335",
"0.517105",
... | 0.68641376 | 0 |
Returns an array for the inheritance at a nuclear locus with n alleles. | def nuclear_inheritance_at_single_locus(n):
ary = np.zeros((n,n,n))
for female in range(n):
for male in range(n):
for offspring in range(n):
if female==male==offspring:
ary[female,male,offspring]=1.
if female!=male:
if (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nuclear_inheritance_at_y_locus(n):\n ary = np.zeros((n,n,n)) # female, male, offspring\n for male in range(1,n):\n ary[0,male,0] = ary[0,male,male] = 1 # one daughter, one son\n return ary",
"def basisVar(bases):\n \n var = [] # The ordered list of active coordinates ... | [
"0.68091816",
"0.56342465",
"0.54614604",
"0.5391642",
"0.5375723",
"0.53475916",
"0.53350717",
"0.531773",
"0.52842516",
"0.52697146",
"0.5118117",
"0.50960046",
"0.50157857",
"0.4984859",
"0.49818936",
"0.4934643",
"0.4923983",
"0.48903525",
"0.48903525",
"0.48512107",
"0.4... | 0.68057257 | 1 |
Returns an array for the inheritance at a ychromosome locus with n alleles (where the first allele means "no ychromosome", i.e. female). | def nuclear_inheritance_at_y_locus(n):
ary = np.zeros((n,n,n)) # female, male, offspring
for male in range(1,n):
ary[0,male,0] = ary[0,male,male] = 1 # one daughter, one son
return ary | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nuclear_inheritance_at_single_locus(n):\n ary = np.zeros((n,n,n))\n for female in range(n):\n for male in range(n):\n for offspring in range(n):\n if female==male==offspring:\n ary[female,male,offspring]=1.\n if female!=male:\n ... | [
"0.68316793",
"0.52946764",
"0.52098745",
"0.50238895",
"0.50112236",
"0.499121",
"0.4984106",
"0.4927073",
"0.49246916",
"0.487069",
"0.48361552",
"0.48348838",
"0.4824314",
"0.48227447",
"0.48155507",
"0.4785766",
"0.47687185",
"0.47678024",
"0.47588527",
"0.4755671",
"0.47... | 0.7611592 | 0 |
White balance for every channel independently | def white_balance(image, perc):
new_channel = []
for channel in cv2.split(image):
mi, ma = (np.percentile(channel, perc), np.percentile(channel, 100.0 - perc))
channel = np.uint8(np.clip((channel - mi) * 255.0 / (ma - mi), 0, 255))
new_channel.append(channel)
imWB = np.dstack(ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calibrate_white_balance(self, channel: LC):\n\n d_print(\"Warming up camera sensor...\", 1)\n\n # turn on channel light\n self.light_control(channel, 1)\n\n if channel == LC.WHITE:\n with picamera.PiCamera() as sensor:\n # set up the sensor with all its set... | [
"0.61220783",
"0.5972675",
"0.5931839",
"0.56922317",
"0.5463826",
"0.54332715",
"0.5367581",
"0.528816",
"0.5269515",
"0.523269",
"0.5217211",
"0.520652",
"0.5205482",
"0.52013135",
"0.5168077",
"0.5151404",
"0.5151039",
"0.51505965",
"0.51420283",
"0.51318866",
"0.5123756",... | 0.66862494 | 0 |
Open an audio file. write_type is "wav" or "mp3", if writing. Automatically determines the file format if reading. | def open(cls, filename, write_type = None):
from wavfile import WavFile
from mp3file import MP3File
if (write_type == None):
file_object = open(filename, "rb")
try:
layer = MP3(filename).info.layer
except:
layer = -1
if (layer == 3):
return MP3File(filena... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_wave_file(self):\n is_wave_open = False\n try:\n wv = wave.open(self.audio_file_name, mode='wb')\n is_wave_open = True\n wv.setparams((1, # 1 channel (mono)\n 2, # 2 bytes per sample * 1 channel\n self.sa... | [
"0.600975",
"0.59122187",
"0.5795555",
"0.5784565",
"0.57556313",
"0.5655955",
"0.5629821",
"0.562926",
"0.5615369",
"0.553294",
"0.5507199",
"0.54114854",
"0.536809",
"0.53627324",
"0.53616863",
"0.53572196",
"0.53521544",
"0.53502065",
"0.5343416",
"0.53366435",
"0.53349227... | 0.80431217 | 0 |
Read the file by sector, as determined by sector_size (in frames). A sector is an array of channels, each of which is an array of magnitudes. Returns a tuple containing a generator for the sectors and the number of frames not covered by the generator. | def read_sectors(self, sector_size):
in_n_sectors, in_n_extra_frames = divmod(self.get_n_frames(), sector_size)
return (self.__read_sectors_generator(sector_size, in_n_sectors), in_n_extra_frames) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sectors_for_bytes(self,count):\n return (count+self.sectorsize-1)//self.sectorsize",
"def read_chunks(\n file_object: \"IO\", chunk_size: int = None\n) -> \"Generator[Union[str, bytes], None, None]\":\n chunk_size = chunk_size if chunk_size and isinstance(chunk_size, int) else 2**24\n while T... | [
"0.5300185",
"0.52004045",
"0.5030646",
"0.50120246",
"0.500339",
"0.49684152",
"0.4958921",
"0.49562106",
"0.492392",
"0.48962128",
"0.4890391",
"0.4856208",
"0.48293597",
"0.4815566",
"0.47790107",
"0.4773855",
"0.47645763",
"0.47498384",
"0.47443956",
"0.47405732",
"0.4736... | 0.798024 | 0 |
Reorganize existing submojects one layer deeper based on the structure of tex_strings (as a list of tex_strings) | def break_up_by_substrings(self):
new_submobjects = []
curr_index = 0
for tex_string in self.tex_strings:
sub_tex_mob = SingleStringTexMobject(tex_string, **self.CONFIG)
num_submobs = len(sub_tex_mob.submobjects)
new_index = curr_index + num_submobs
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detex(tex):\n \n #tex = '\\n'.join(reformat(tex, listed=True)[1:])\n global subs\n \n for old, new in subs.iteritems():\n tex = tex.replace(old, new)\n \n return tex.strip()",
"def realize_text_and_extract_scene(scene, template, filter_objs):\n\n default_list = lambda: collection... | [
"0.5540645",
"0.5538486",
"0.55300415",
"0.55045766",
"0.54806244",
"0.545654",
"0.543825",
"0.5400212",
"0.53588676",
"0.53223515",
"0.53047854",
"0.5286626",
"0.52593404",
"0.5253145",
"0.52510726",
"0.5232758",
"0.5221223",
"0.521921",
"0.521023",
"0.52065337",
"0.5153433"... | 0.6977978 | 0 |
Returns the age stratified population used for case detection testing. Use state denominator for testing rates for the Victorian health cluster models and temporarily use Philippines regional pops for all the Philippines subregions | def get_testing_pop(agegroup_strata: List[str], country: Country, pop: Population):
testing_region = "Victoria" if country.iso3 == "AUS" else pop.region
testing_year = 2020 if country.iso3 == "AUS" else pop.year
testing_pop = inputs.get_population_by_agegroup(
agegroup_strata, country.iso3, testing_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPopulation(self):\n\n return self.p",
"def test_state(self):\n states = self.geographies.find({ 'geoid': config.SUMLEV_STATE })\n\n self.assertEqual(states.count(), 1)\n\n state = states[0]\n\n self.assertEqual(state['sumlev'], config.SUMLEV_STATE)\n self.assertEq... | [
"0.5675838",
"0.5655509",
"0.5640945",
"0.55368376",
"0.5536563",
"0.55261403",
"0.5399596",
"0.53897786",
"0.53655875",
"0.52701634",
"0.52652085",
"0.5259422",
"0.52373123",
"0.5232317",
"0.5202828",
"0.51550114",
"0.5124957",
"0.51231694",
"0.5122542",
"0.5077461",
"0.5061... | 0.66339207 | 0 |
Returns a time varying function that gives us the proportion of cases detected. | def build_detected_proportion_func(
agegroup_strata: List[str],
country: Country,
pop: Population,
testing: TestingToDetection,
case_detection: CaseDetection,
):
if testing is not None:
# More empiric approach based on per capita testing rates
assumed_tests_parameter = testing.as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self, compartment_values, computed_values, time):\n return self.detected_proportion_func(time)",
"def cond_prob(self, event, context):\n count = self.table[event, context] + self.prior\n norm = self.margin[context] + (self.prior * len(self.alphabet))\n return count / norm"... | [
"0.56486714",
"0.5399324",
"0.53938836",
"0.5349418",
"0.53207636",
"0.52834475",
"0.527038",
"0.5253039",
"0.51995337",
"0.5193554",
"0.5186247",
"0.5145516",
"0.51392543",
"0.5114639",
"0.5083481",
"0.50816566",
"0.50375867",
"0.5034541",
"0.50288093",
"0.50219774",
"0.5019... | 0.64043784 | 0 |
Responds to client's hello message with modulus and exponent | def clientHelloResp(n, e):
status = "105 Hello "+ str(n) + " " + str(e)
return status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clientHello():\r\n status = \"100 Hello message\"\r\n return status",
"def clientHello():\r\n status = \"100 Hello\"\r\n return status",
"def hello_command(chat, message, args):\n resp = \" , \".join( list(global_coin_dct.keys())[:10] )\n chat.send ( resp )",
"def greetting(self):\n ... | [
"0.6479198",
"0.6302376",
"0.6201765",
"0.6080746",
"0.59467787",
"0.59077334",
"0.57898474",
"0.57415533",
"0.5655386",
"0.5647336",
"0.5623555",
"0.5618372",
"0.55751806",
"0.5560137",
"0.5546643",
"0.5518849",
"0.55178034",
"0.54985315",
"0.54746735",
"0.5465453",
"0.54600... | 0.6584107 | 1 |
Responds to session key with nonce | def SessionKeyResp(nonce):
status = "113 Nonce "+ str(nonce)
return status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ns_authentication(conn):\n # get RSA key of Bob for decrypting\n rsa_key = rsa.import_key(\"RsaKey.asc\")\n\n # A -- {N_A, A}(K_PB) --> B\n request = rsa.decrypt(rsa_key, conn.recv(1024))\n client_nonce, client_name = request.split(',')\n print(\"Bob: recieved nonce {} from client {}\".format... | [
"0.5793612",
"0.5780483",
"0.5770326",
"0.57409924",
"0.57409924",
"0.57370645",
"0.5552399",
"0.55310404",
"0.5527948",
"0.54812276",
"0.5478223",
"0.5460246",
"0.54412866",
"0.54359895",
"0.5398782",
"0.53968924",
"0.5381679",
"0.5344254",
"0.5343409",
"0.5310444",
"0.53012... | 0.77256626 | 1 |
Generator function to keep crawling the listing pages, yielding the found movies urls. | def crawl_imdb_listing_page(url: str) -> Generator:
next_url = url
while next_url:
print(f"CRAWLING URL {next_url}")
listing_page = get_soup_for_page(next_url)
for movies_element in listing_page.find_all("div", class_="lister-item mode-simple"):
a_link = movies_element.find("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _paginate(self) -> Iterable[List[str]]:\n req = self.html\n videos_lens = self._extractor(req)\n yield videos_lens # yielding doesn't mean that is the end\n\n # The above only returns 100 or fewer links\n # as Youtube loads 100 videos at a time\n # Simulating a browser... | [
"0.68248665",
"0.65488493",
"0.64052033",
"0.63932663",
"0.63698214",
"0.6351879",
"0.6219682",
"0.61537457",
"0.6130862",
"0.60967785",
"0.606942",
"0.6053288",
"0.6021266",
"0.60047364",
"0.5937592",
"0.59219736",
"0.5912077",
"0.59039587",
"0.5858203",
"0.5830659",
"0.5826... | 0.76492673 | 0 |
Calculate methylation frequency at genomic CpG sites from the output of nanopolish callmethylation input_fn Path to a nanopolish call_methylation tsv output file fasta_index fasta index file obtained with samtools faidx. Required for coordinate sorting output_bed_fn Path to write a summary result file in BED format out... | def __init__ (self,
input_fn:"str",
fasta_index:"str"="",
output_bed_fn:"str"="",
output_tsv_fn:"str"="",
min_depth:"int"=10,
sample_id:"str"="",
strand_specific:"bool"=False,
min_llr:"float"=2,
verbose:"bool"=False,
quiet:"bool"=False):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n # files\n summary_file = sys.argv[1]\n pwms_to_tfs_file = sys.argv[2]\n expressed_tfs_file = sys.argv[3] # TODO\n\n # TODO pull in num regions to resize things? but complicated with overlaps etc\n # TODO edit edges with type of interaction\n # TODO may want to color by trajectory... | [
"0.5693103",
"0.55067265",
"0.5399869",
"0.5296353",
"0.52888024",
"0.5262818",
"0.5224499",
"0.52202576",
"0.5129552",
"0.5099409",
"0.5049172",
"0.50478584",
"0.5046293",
"0.49877012",
"0.49782598",
"0.49623838",
"0.495393",
"0.49416703",
"0.49218166",
"0.49082747",
"0.4904... | 0.6483332 | 0 |
Use Dijkstra's algorithm on the given graph with the given maximum distance This constructor assumes the graph's edges are { GWeightedEdge}s. If not, you will likely encounter a { ClassCastException}. graph the graph maxDistance the maximum distance, or null for no maximum | def __init__(self, graph: ghidra.graph.GImplicitDirectedGraph, maxDistance: float):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, graph: ghidra.graph.GImplicitDirectedGraph, maxDistance: float, metric: ghidra.graph.GEdgeWeightMetric):\n ...",
"def max_dist(graph, source):\r\n q = queue.Queue()\r\n found = {}\r\n distance = {}\r\n for vertex in graph: \r\n found[vertex] = 0\r\n distance[ve... | [
"0.7105622",
"0.65459585",
"0.62205803",
"0.6163052",
"0.60579824",
"0.59286",
"0.5803024",
"0.57847154",
"0.5700605",
"0.5692679",
"0.5679294",
"0.56565255",
"0.5653247",
"0.5653056",
"0.5608242",
"0.5604511",
"0.55991817",
"0.55969554",
"0.55812794",
"0.55636895",
"0.555433... | 0.71439725 | 0 |
Use Dijstra's algorithm on the given graph with the given maximum distance and a custom edge weight metric graph the graph maxDistance the maximum distance, or null for no maximum metric the function to compute the weight of an edge | def __init__(self, graph: ghidra.graph.GImplicitDirectedGraph, maxDistance: float, metric: ghidra.graph.GEdgeWeightMetric):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __djikstra(graph, node_name):\n predecessors = {key: None for key in graph.keys()}\n distances = {key: inf for key in graph.keys()}\n distances[node_name] = 0\n nodes_set = set(graph.values()) # type : Set[Node]\n while len(nodes_set) != 0:\n min_node = min(nodes_... | [
"0.648706",
"0.62402046",
"0.62161565",
"0.6197095",
"0.6175136",
"0.6040108",
"0.59882283",
"0.59803706",
"0.59314615",
"0.5915369",
"0.59046775",
"0.5885905",
"0.58851326",
"0.5882774",
"0.58602697",
"0.5838277",
"0.58381146",
"0.58340716",
"0.58335596",
"0.5828926",
"0.581... | 0.6478836 | 1 |
Gets an random free location neighboring an position. Returns False if there aren't any location available. | def get_free_location(position: tuple,
all_sites: np.matrix,
used_sites: List[tuple]) -> tuple:
available_locations = check_location(position, all_sites, used_sites)
if len(available_locations) > 0:
return random.choice(available_locations)
else:
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_location(self):\r\n\r\n while True:\r\n pt = (random.uniform(self.worldbox.tl[0], self.worldbox.br[0]),\r\n random.uniform(self.worldbox.tl[1], self.worldbox.br[1]))\r\n if not self.is_wall(pt) and not self.is_target(pt):\r\n return pt",
"de... | [
"0.7155066",
"0.68745834",
"0.6822648",
"0.6772478",
"0.67044556",
"0.667298",
"0.65802073",
"0.6535938",
"0.62133676",
"0.6199547",
"0.6172247",
"0.6147595",
"0.61029494",
"0.60941947",
"0.60829973",
"0.6078855",
"0.6075617",
"0.6019359",
"0.60065395",
"0.60025245",
"0.60017... | 0.7684889 | 0 |
Select olny columns that are used in this hypohesis testing. | def chose_only_hypothesis_colums(df):
lst = ['abv', 'ibu', 'gravity', 'abv_min', 'abv_max', 'ibu_min',
'ibu_max', 'srm_min', 'srm_max', 'og_min', 'fg_min', 'fg_max']
return df[lst] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_non_feature_columns():\n return ['teamid', 'op_teamid', 'matchid', 'competitionid', 'seasonid',\n 'goals', 'op_goals', 'points', 'timestamp', 'team_name', \n 'op_team_name']",
"def _these_columns_cannot_annotate_exp_cons(self):\n _cols = set([]) #\n for param_name,... | [
"0.6092054",
"0.5817742",
"0.58053917",
"0.57627535",
"0.57148385",
"0.5707492",
"0.56815207",
"0.5610355",
"0.56015986",
"0.559424",
"0.5496665",
"0.5475164",
"0.54533297",
"0.54247004",
"0.5415999",
"0.5400429",
"0.538975",
"0.53685564",
"0.5365411",
"0.535745",
"0.5348751"... | 0.6582166 | 0 |
Encode a 'Default' message into bytes. | def encode(msg: Message) -> bytes:
msg = cast(DefaultMessage, msg)
default_msg = default_pb2.DefaultMessage()
default_msg.message_id = msg.message_id
dialogue_reference = msg.dialogue_reference
default_msg.dialogue_starter_reference = dialogue_reference[0]
default_msg.dia... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _encode(self, messages, encode_empty=False):\n serialized_messages = MessagePartSerializer().dumps(messages)\n return self._encode_parts(serialized_messages, encode_empty=encode_empty)",
"def encode(self, message):\n return message.encode()",
"def _encode_message(cls, message):\n ... | [
"0.59400874",
"0.5875511",
"0.5675387",
"0.5622664",
"0.5536103",
"0.54758316",
"0.54612595",
"0.54244334",
"0.5410007",
"0.53619623",
"0.53439385",
"0.5328481",
"0.53255683",
"0.5325061",
"0.5304176",
"0.5303249",
"0.5303249",
"0.53005177",
"0.52999735",
"0.52936417",
"0.528... | 0.7586231 | 0 |
Decode bytes into a 'Default' message. | def decode(obj: bytes) -> Message:
default_pb = default_pb2.DefaultMessage()
default_pb.ParseFromString(obj)
message_id = default_pb.message_id
dialogue_reference = (
default_pb.dialogue_starter_reference,
default_pb.dialogue_responder_reference,
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_message(self, raw):\n return raw.decode('utf-8')",
"def parse_and_decode(cls, data: bytes) -> \"Message\":\n if len(data) < cls.calc_size() + 1:\n raise NotEnoughData()\n if data[0] != cls.type:\n raise InvalidType()\n\n return cls(*unpack('<' + cls.fm... | [
"0.6460779",
"0.62275463",
"0.60233516",
"0.5910059",
"0.59061134",
"0.58505297",
"0.5774515",
"0.57674026",
"0.5714803",
"0.56986344",
"0.5683915",
"0.5680897",
"0.5660629",
"0.5643898",
"0.56417495",
"0.5614412",
"0.55841964",
"0.55837613",
"0.5563051",
"0.55579466",
"0.553... | 0.6873543 | 0 |
Enabled types in a Collage as list of dicts. | def listEnabledTypes(self):
actual_type = self.request.get('portal_type', None)
collage_options = getCollageSiteOptions()
ttool = getToolByName(self.context, 'portal_types', None)
if ttool is None:
return None
return [
{
'id': pt.getId(),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_types(self):\r\n pass",
"def etypes(self): # -> list[None]:\n ...",
"def etypes(self): # -> list[str]:\n ...",
"def listFeaturableContentTypes():",
"def type_list():\n for type_ in orm.DataFlagType.select():\n click.echo(type_.name)",
"def getFeatureDicts(self... | [
"0.56451094",
"0.5577261",
"0.555166",
"0.5539778",
"0.5523393",
"0.5469926",
"0.5433368",
"0.5389394",
"0.53685445",
"0.53110236",
"0.530126",
"0.5217573",
"0.5199076",
"0.51909196",
"0.5184929",
"0.5160728",
"0.51568127",
"0.5147065",
"0.51458454",
"0.5136423",
"0.51267034"... | 0.6831915 | 0 |
Helper method to get fixed set of nodes for integration tests. | def get_nodes():
return conf.config.get_nodes(RELATIVE_PATH_FIXTURES_HOST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nodes():\n nodes_config_file = Settings.CONF_NODES_FILE\n current_nodes = load_node_names(nodes_config_file)\n\n return current_nodes",
"def get_nodes(self):\n pass",
"def get_all_nodes(self):\n # NOTE: return copy, so no one will screw\n # our list?\n return self.n... | [
"0.68265736",
"0.6614423",
"0.6519299",
"0.6489987",
"0.64040446",
"0.6392586",
"0.6377646",
"0.63355374",
"0.6334925",
"0.63303435",
"0.6282876",
"0.62619257",
"0.62289566",
"0.62216836",
"0.6215375",
"0.6202686",
"0.62020046",
"0.61830145",
"0.61665314",
"0.60890484",
"0.60... | 0.7349392 | 0 |
Generates the hosts file to be used in the test. | def generate_hosts_file(n, path="./tests/fixtures"):
if not os.path.isdir(path):
os.mkdir(path)
with open(f"{path}/hosts.txt", "w") as f:
for i in range(n):
f.write(f"{i},localhost,127.0.0.1,{5000+i}\n") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inject_hosts_files(self):\n self.log.info(\"Injecting host files\")\n hosts = dict()\n for i in self.all_nodes:\n hosts[i.name] = i.get_public_addr()\n #add the host names to etc/hosts\n orchestrator.inject_hostnames(hosts, delete=self.cluster_name)\n for i ... | [
"0.6459292",
"0.6404605",
"0.6283201",
"0.6240932",
"0.59802336",
"0.5889246",
"0.58163095",
"0.5757817",
"0.5732513",
"0.5702952",
"0.5698817",
"0.5661061",
"0.56472224",
"0.56410384",
"0.56334525",
"0.56244177",
"0.55663335",
"0.5537021",
"0.54996186",
"0.5496365",
"0.54960... | 0.77438474 | 0 |
Launches BFTList for integration testing. | async def launch_bftlist(test_name="unknown test", n=N, f=F, args={}):
generate_hosts_file(n)
nodes = get_nodes()
cmd = ". env/bin/activate && python3.7 main.py"
cwd = os.path.abspath(".")
pids = []
for node_id in nodes.keys():
env = os.environ.copy()
env["ID"] = str(node_id)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n self.tp.launch_list()\n self.tp = None",
"def run_datalab_fbs():\n\n appctxt = ApplicationContext()\n win = DataLab()\n # debug_setup(win)\n win.show()\n exit_code = appctxt.app.exec_()\n sys.exit(exit_code)",
"def test_fixture_list_runs(tmp_sample_project):\n ... | [
"0.6644642",
"0.59429514",
"0.57962817",
"0.57052195",
"0.5684194",
"0.5662194",
"0.559709",
"0.5505819",
"0.5502295",
"0.5478227",
"0.5450164",
"0.5444739",
"0.5444739",
"0.540122",
"0.5357159",
"0.53484774",
"0.5345491",
"0.5273711",
"0.52669984",
"0.526251",
"0.5246604",
... | 0.7411596 | 0 |
Kills all processes in the supplied list containing PIDs. | def kill(pids):
for pid in pids:
process = psutil.Process(pid)
for proc in process.children(recursive=True):
proc.kill()
process.kill()
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill(self,process_list,signal = 'TERM'):\n res = []\n pids = {}\n for process in process_list:\n if hasattr(process,'machine'):\n try:\n worker = self.worker_by_name[process.machine]\n except KeyError:\n worker ... | [
"0.71561825",
"0.7016703",
"0.69786996",
"0.69770545",
"0.68164593",
"0.6671434",
"0.66706276",
"0.6646426",
"0.65671927",
"0.6468347",
"0.64572406",
"0.6416643",
"0.6387647",
"0.6351313",
"0.6312249",
"0.6208457",
"0.61944294",
"0.61545175",
"0.61286503",
"0.61021495",
"0.60... | 0.7777778 | 0 |
Removes all generated state files after test and cleans up. | def cleanup():
try:
os.remove(start_state_file_path)
except FileNotFoundError:
pass
time.sleep(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown():\n for output_file_path in Path(output_dir).glob(\"test_voting_learner_cross_validate*\"):\n output_file_path.unlink()\n\n for output_file_path in Path(\".\").glob(\"test_voting_learner_cross_validate*\"):\n output_file_path.unlink()\n\n config_file_path = Path(config_dir) / \... | [
"0.7663158",
"0.7661129",
"0.76429653",
"0.76376575",
"0.75846446",
"0.7534873",
"0.7493232",
"0.74643505",
"0.7433635",
"0.74254453",
"0.7356978",
"0.73564607",
"0.73222697",
"0.7321115",
"0.72945124",
"0.7292109",
"0.72868603",
"0.72769874",
"0.72742134",
"0.7268443",
"0.72... | 0.7735382 | 0 |
Sends an HTTP request to 'player/status/' | def testSimple(self):
self.getPage("player/status/", method = "GET")
self.assertStatus(status = 200)
print 'http headers:'
for header in self.headers.items():
print header
print 'body:'
print simplejson.dumps(self.body,indent=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status():\n data = {\n 'status': 'up',\n }\n jsn = json.dumps(data)\n\n resp = Response(jsn, status=200, mimetype='application/json')\n\n return resp",
"def get_player_status(self, player):\n # (title) : Song title\n # Requested Information\n # a (artist): Art... | [
"0.6598885",
"0.65778875",
"0.64045924",
"0.6403228",
"0.61674875",
"0.6140377",
"0.61286503",
"0.6126103",
"0.6078466",
"0.60375863",
"0.6030848",
"0.5961892",
"0.59506136",
"0.5911843",
"0.5906268",
"0.58982503",
"0.5829051",
"0.58256584",
"0.5812865",
"0.5810653",
"0.57865... | 0.66533524 | 0 |
Retorna todas las llaves del arbol que se encuentren entre [keylo, keyhi] | def keys(rbt, keylo, keyhi):
try:
lstkeys = lt.newList('SINGLELINKED', rbt['cmpfunction'])
lstkeys = keysRange(rbt['root'], keylo, keyhi, lstkeys,
rbt['cmpfunction'])
return lstkeys
except Exception as exp:
error.reraise(exp, 'RBT:keys') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def caesuras(k):\n caesuras = []\n for idx, i in enumerate(k):\n if i in k[idx + 1:]:\n caesuras.append(idx)\n return caesuras",
"def keys():",
"def keysAll():",
"def triangulos_rectangulos(opcion,b,h):\n x1 =[0,0]\n ... | [
"0.54930055",
"0.5466304",
"0.54661936",
"0.5365569",
"0.53530455",
"0.534807",
"0.53398854",
"0.53104085",
"0.5282643",
"0.5281222",
"0.50924355",
"0.50345254",
"0.50326174",
"0.5031676",
"0.49859047",
"0.49760678",
"0.49699897",
"0.49666688",
"0.49497998",
"0.49482527",
"0.... | 0.56539536 | 0 |
Retorna todas los valores del arbol que se encuentren entre [keylo, keyhi] | def values(rbt, keylo, keyhi):
try:
lstvalues = lt.newList('SINGLELINKED', rbt['cmpfunction'])
lstvalues = valuesRange(rbt['root'], keylo, keyhi, lstvalues,
rbt['cmpfunction'])
return lstvalues
except Exception as exp:
error.reraise(exp, 'RBT:Value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getall(self, key):\n return self.values.get(key, [])",
"def get_values():\n a1 = insert_data(\"a1\")\n r = insert_data(\"r\")\n n = insert_data(\"n\")\n return a1, r, n",
"def get(con,key):\n # yy=atpic.log.setname(xx,'get')\n thecommand=\"get {key}\\r\\n\".format(key=key)\n # a... | [
"0.59552354",
"0.5820003",
"0.5759505",
"0.5744926",
"0.5744926",
"0.5709699",
"0.5685493",
"0.5685493",
"0.5669403",
"0.5668395",
"0.55271715",
"0.55146015",
"0.55090475",
"0.54791063",
"0.5465725",
"0.5443579",
"0.5428568",
"0.5414096",
"0.5408089",
"0.5369653",
"0.53522706... | 0.6228335 | 0 |
Rotates coordinate system from x1,z1 to x2,z2 | def rotation(x1, z1, x2, z2):
e1 = np.zeros(shape=(3, 3))
e2 = np.zeros(shape=(3, 3))
e1[0, :] = x1 / np.linalg.norm(x1)
e1[2, :] = z1 / np.linalg.norm(z1)
e1[1, :] = np.cross(e1[2, :], e1[0, :])
e2[0, :] = x2 / np.linalg.norm(x2)
e2[2, :] = z2 / np.linalg.norm(z2)
e2[1, :] = np.cross(e2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotateZ(self, *args, **kwargs):\n ...",
"def rotation(x,y,z):\r\n phi = np.arctan(z/sqrt(x**2+y**2))\r\n lamb = np.arctan2(y,x)\r\n G = np.array([[-sin(lamb), cos(lamb), 0],\r\n [-sin(phi) * cos(lamb), -sin(phi) * sin(lamb), cos(phi)],\r\n [cos(phi) * cos(lam... | [
"0.72137934",
"0.6789719",
"0.66737",
"0.6606905",
"0.6600858",
"0.65760684",
"0.65532327",
"0.65532327",
"0.65532327",
"0.65532327",
"0.6507178",
"0.64992857",
"0.64870286",
"0.6475885",
"0.6472012",
"0.6458319",
"0.6445637",
"0.6438456",
"0.6432099",
"0.643071",
"0.6415745"... | 0.77712363 | 0 |
Performs vector contraction in the form of m C n | def vect_contract(m, c, n):
a = np.tensordot(m, c, (0, 0))
mn = np.tensordot(a, n, (2, 0))
return mn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getVector(c1, c2):\n return [c1[0] - c2[0], c1[1] - c2[1], c1[2] - c2[2]]",
"def mvector(B, c):\n # for Sun Mg Potential: c=1.6281689374348\n A = np.zeros(shape=4)\n A[0] = (2 / 3) * B[0]\n A[1] = 0.5 * ((2 / sqrt(3)) * B[1] - A[0])\n A[2] = -A[0] - A[1]\n A[3] = B[2] / c\n return A",... | [
"0.6204063",
"0.6118313",
"0.6027351",
"0.59437466",
"0.5920729",
"0.58891094",
"0.58567584",
"0.58476985",
"0.58374596",
"0.58282095",
"0.5810846",
"0.5797152",
"0.5795684",
"0.5795684",
"0.5795684",
"0.5773497",
"0.5768829",
"0.56864727",
"0.5681027",
"0.56669194",
"0.56448... | 0.709335 | 0 |
Update specific memory slots If query_result is not supplied, relevance scores are not updated. | def update_ixs(self, ixs, embeddings, labels, query_result=None, global_update=True):
self.memory_embeddings[ixs] = embeddings
self.memory_labels[ixs] = labels
self.memory_age[ixs] = 0
self.memory_relevance[ixs] = 0
if global_update:
self.memory_age[self.memory_age !=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update(self, nbrs, nbrs_y, query, query_y):\n\n # Set up the graph for our shared memory variables\n new_K, new_A, new_V = self.K, self.A, self.V\n\n # Condition (1): First returned neighbour shares the same query label\n correct_query = T.eq(nbrs_y[:, 0], query_y).nonzero()[0]\n ... | [
"0.61297095",
"0.5953453",
"0.5922591",
"0.5553142",
"0.544283",
"0.5403002",
"0.5356434",
"0.5338803",
"0.5331692",
"0.5323351",
"0.5294844",
"0.5292601",
"0.5231745",
"0.52154356",
"0.51240927",
"0.50593865",
"0.5058139",
"0.5054779",
"0.50533724",
"0.5042255",
"0.50057137"... | 0.620225 | 0 |
Update class representations with new class means. | def update(self, class_means, unique_labels, logger=None):
n_added = class_means.shape[0]
class_discount = self.class_discount
to_update = unique_labels
normalized_class_means = None
normalized_class_representations = None
self.update_last_updated(unique_labels)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_class_records():\n logger.info('Fetching class ids and labels for '\n 'classes with direct instances')\n timestamp = statistics.get_current_timestamp()\n results = sparql.sparql_query(queries.QUERY_CLASSES,\n fallback=queries.QUERY_CLASSSES_FALLBA... | [
"0.6709953",
"0.61785007",
"0.6076284",
"0.595551",
"0.58957285",
"0.5783457",
"0.5720336",
"0.57154924",
"0.5688674",
"0.56453985",
"0.5566248",
"0.5520287",
"0.55193",
"0.5472117",
"0.5463804",
"0.5440467",
"0.541637",
"0.53849554",
"0.53834957",
"0.53764176",
"0.53638923",... | 0.76716536 | 0 |
Update specific memory slots If query_result is not supplied, relevance scores are not updated. | def update_ixs(self, ixs, embeddings, labels, query_result=None, global_update=True):
self.memory_embeddings[ixs] = embeddings
self.memory_labels[ixs] = labels
self.memory_age[ixs] = 0
self.memory_relevance[ixs] = 0
if global_update:
self.memory_age[self.memory_age !=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update(self, nbrs, nbrs_y, query, query_y):\n\n # Set up the graph for our shared memory variables\n new_K, new_A, new_V = self.K, self.A, self.V\n\n # Condition (1): First returned neighbour shares the same query label\n correct_query = T.eq(nbrs_y[:, 0], query_y).nonzero()[0]\n ... | [
"0.61297095",
"0.5953453",
"0.5922591",
"0.5553142",
"0.544283",
"0.5403002",
"0.5356434",
"0.5338803",
"0.5331692",
"0.5323351",
"0.5294844",
"0.5292601",
"0.5231745",
"0.52154356",
"0.51240927",
"0.50593865",
"0.5058139",
"0.5054779",
"0.50533724",
"0.5042255",
"0.50057137"... | 0.620225 | 1 |
a decorator to add backing off retry symantics to any a method that does a database transaction. When using this decorator, it is vital that any exception within the 'exceptions_eligible_for_retry' tuple above must not be handled within the wrapped function. This means that exception handlers that handle 'Exception' mu... | def db_transaction_retry_wrapper(fn):
@ft.wraps(fn)
def f(self, *args, **kwargs):
backoffGenerator = util.backoffSecondsGenerator()
try:
while True:
try:
result = fn(self, *args, **kwargs)
return result
except exceptions_eligible_for_retry:
waitInSeconds =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retry(func, *args, **kwargs):\n @functools.wraps(func)\n def wrapper(*w_args, **w_kwargs):\n w_kwargs.update(kwargs)\n return retry_function_on_deadlock(func, *w_args, **w_kwargs)\n\n return wrapper",
"def _retry(func):\n @wraps(func)\n def _retry_wrapper(self, *args, **k... | [
"0.67783445",
"0.6644641",
"0.6623299",
"0.6539066",
"0.6512475",
"0.6476035",
"0.6465493",
"0.64365405",
"0.6360299",
"0.6348828",
"0.6344524",
"0.6313005",
"0.62655896",
"0.6242453",
"0.6222092",
"0.62088233",
"0.6180234",
"0.6120076",
"0.60964835",
"0.6095427",
"0.60853565... | 0.7249463 | 0 |
Try to reuse this named connection, else create one and use that | def connection(self, name=None):
if not name:
name = threading.currentThread().getName()
if name in self:
return self[name]
self[name] = self.database.connection()
return self[name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_database_connection(self, reuse=True):\n if not self.__database_connection or not reuse:\n if self.__database_connection:\n self.__database_connection.close()\n self.__database_connection = None\n\n self.__database_connection = http.client.HTTPCo... | [
"0.6629559",
"0.6570917",
"0.6535228",
"0.6433502",
"0.6412028",
"0.63429385",
"0.6253376",
"0.62532514",
"0.6220175",
"0.6215806",
"0.6163777",
"0.6153525",
"0.6101365",
"0.60986865",
"0.6085492",
"0.6082639",
"0.60321325",
"0.6022872",
"0.6020028",
"0.60199386",
"0.60167944... | 0.6910743 | 0 |
Just like connection, but returns a tuple with a connection and a cursor | def connectionCursorPair(self, name=None):
connection = self.connection(name)
return (connection, connection.cursor()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conn_curs():\n dbname = \"abcdefgh\"\n password = \"Acka-1jfue4-snYmkall\"\n host = \"db.elephantsql.com\"\n\n connection = psycopg2.connect(dbname=dbname, user=dbname,\n password=password, host=host)\n cursor = connection.cursor()\n return connection, cursor"... | [
"0.782685",
"0.74926525",
"0.7455024",
"0.7442478",
"0.7405349",
"0.73643297",
"0.7351544",
"0.73470646",
"0.73046917",
"0.72976387",
"0.7228983",
"0.7228983",
"0.72195446",
"0.7198042",
"0.7187905",
"0.71860284",
"0.71206516",
"0.70670146",
"0.70400053",
"0.700089",
"0.69696... | 0.81536436 | 0 |
Ensure decoded correctly decodes a known encoded number. | def test_decoder(self):
from sosbeacon.utils import number_decode
encoded = 'b6'
number = number_decode(encoded)
self.assertEqual(number, 123) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(self, number: int) -> typing.Union[int, str]:\n return number",
"def test_decode_numbers(self, number, base, expected):\n self.assertEqual(positional.decode(number, base), expected)",
"def test_decoding_non_str_fails(self):\n self.assertRaises(DecodingError, base62.to_decimal, s... | [
"0.7170725",
"0.70083755",
"0.66928744",
"0.65111727",
"0.646559",
"0.6452943",
"0.63323385",
"0.63235164",
"0.62588257",
"0.6219759",
"0.61692274",
"0.61123574",
"0.61047447",
"0.6043373",
"0.6040491",
"0.5980549",
"0.5975069",
"0.59651697",
"0.59623265",
"0.5945968",
"0.591... | 0.78923905 | 0 |
Ensure decode(encode(number)) == number over a range of numbers. | def test_inverse(self):
from sosbeacon.utils import number_decode
from sosbeacon.utils import number_encode
for number in range(0, 500000, 339):
encoded = number_encode(number)
decoded = number_decode(encoded)
self.assertEqual(number, decoded) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate_num(number, lower_bound, upper_bound):\n try:\n value = int(number, 0)\n if value < lower_bound or value > upper_bound:\n raise translate_num_out_of_range(value, lower_bound, upper_bound)\n else:\n return value\n except:\n raise translate_num_er... | [
"0.6504324",
"0.6368809",
"0.6153909",
"0.612515",
"0.5986749",
"0.5916171",
"0.590891",
"0.58644295",
"0.581968",
"0.581036",
"0.5799809",
"0.57941693",
"0.579414",
"0.5778868",
"0.57601947",
"0.57461756",
"0.5717209",
"0.57090324",
"0.5706868",
"0.56949294",
"0.5694811",
... | 0.64608574 | 1 |
Ensure task batches are split and insertion is retried on TombstonedTaskError. | def test_splits_on_tombstoned(self, queue_add_mock):
from google.appengine.api import taskqueue
from sosbeacon.utils import insert_tasks
queue_add_mock.side_effect = taskqueue.TombstonedTaskError
tasks = [i for i in xrange(0, 7)]
added = insert_tasks(tasks, 'default')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_chunk_size_no_n_splits_provided(self):\n with self.assertRaises(ValueError):\n next(chunk_tasks([]))",
"def test_splits_once(self, queue_add_mock):\n from google.appengine.api import taskqueue\n from sosbeacon.utils import insert_tasks\n\n def side_effect(*args)... | [
"0.637449",
"0.62774134",
"0.60077596",
"0.5994124",
"0.5918459",
"0.57265055",
"0.56882507",
"0.56343436",
"0.558805",
"0.55751175",
"0.55216396",
"0.55209655",
"0.54577637",
"0.53927845",
"0.53148663",
"0.53103",
"0.5290059",
"0.5279151",
"0.5238429",
"0.5230983",
"0.522617... | 0.6903556 | 0 |
Ensure task batches are split and insertion is retried on TaskAlreadyExistsError. | def test_splits_on_taskexists(self, queue_add_mock):
from google.appengine.api import taskqueue
from sosbeacon.utils import insert_tasks
queue_add_mock.side_effect = taskqueue.TaskAlreadyExistsError
tasks = [i for i in xrange(0, 10)]
added = insert_tasks(tasks, 'default')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_splits_on_tombstoned(self, queue_add_mock):\n from google.appengine.api import taskqueue\n from sosbeacon.utils import insert_tasks\n\n queue_add_mock.side_effect = taskqueue.TombstonedTaskError\n\n tasks = [i for i in xrange(0, 7)]\n added = insert_tasks(tasks, 'default... | [
"0.62573755",
"0.620488",
"0.6070838",
"0.6027224",
"0.6025703",
"0.5959347",
"0.571253",
"0.5664554",
"0.5623779",
"0.5445145",
"0.53211784",
"0.5283602",
"0.52729964",
"0.52518106",
"0.5234075",
"0.5233979",
"0.52330583",
"0.51978356",
"0.51888645",
"0.518777",
"0.51753086"... | 0.6667976 | 0 |
Ensure a missing date returns the empty string. | def test_non_input(self):
from sosbeacon.utils import format_datetime
encoded = format_datetime(None)
self.assertEqual('', encoded) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_date(self, arg, line_number=0):\n try:\n dt = datetime.strptime(arg, \"%d %b %Y\")\n return dt\n except ValueError:\n raise ValueError(f\"US42 - Illegitimate date of {arg}. GEDCOM line: {line_number}\")\n else:\n return 'NA'",
"def test_b... | [
"0.66881824",
"0.6186882",
"0.61217904",
"0.61152357",
"0.60820913",
"0.6069122",
"0.6046784",
"0.60390896",
"0.60354966",
"0.602315",
"0.59958637",
"0.59915537",
"0.5989876",
"0.59784245",
"0.5972851",
"0.5956638",
"0.5951182",
"0.5942427",
"0.59409153",
"0.59297127",
"0.591... | 0.69573593 | 0 |
Ensure a missing lhs returns rhs. | def test_no_lhs(self):
from sosbeacon.utils import get_latest_datetime
lhs = None
rhs = object()
result = get_latest_datetime(lhs, rhs)
self.assertIs(rhs, result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_rhs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs = object()\n rhs = None\n\n result = get_latest_datetime(lhs, rhs)\n\n self.assertIs(lhs, result)",
"def not_equal(lhs, rhs):\n return _make.not_equal(lhs, rhs)",
"def isnone(cls, lhs, rhs):\n... | [
"0.6356365",
"0.56324995",
"0.5260674",
"0.5232673",
"0.51086223",
"0.5028781",
"0.5027332",
"0.49481612",
"0.48879817",
"0.4887651",
"0.48581392",
"0.4851787",
"0.48394328",
"0.48073387",
"0.48042664",
"0.47770894",
"0.47716808",
"0.4759484",
"0.47486883",
"0.47274226",
"0.4... | 0.6314329 | 1 |
Ensure a missing lhs returns rhs. | def test_no_rhs(self):
from sosbeacon.utils import get_latest_datetime
lhs = object()
rhs = None
result = get_latest_datetime(lhs, rhs)
self.assertIs(lhs, result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_lhs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs = None\n rhs = object()\n\n result = get_latest_datetime(lhs, rhs)\n\n self.assertIs(rhs, result)",
"def not_equal(lhs, rhs):\n return _make.not_equal(lhs, rhs)",
"def isnone(cls, lhs, rhs):\n... | [
"0.6314329",
"0.56324995",
"0.5260674",
"0.5232673",
"0.51086223",
"0.5028781",
"0.5027332",
"0.49481612",
"0.48879817",
"0.4887651",
"0.48581392",
"0.4851787",
"0.48394328",
"0.48073387",
"0.48042664",
"0.47770894",
"0.47716808",
"0.4759484",
"0.47486883",
"0.47274226",
"0.4... | 0.6356365 | 0 |
Returns the ROS time in seconds | def get_time(cls):
now = rospy.Time.now()
return now.secs + now.nsecs*(10**-9) # time in seconds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gettime():\n return libruss.russ_gettime()",
"def get_time(self):\n return self.get_timed() / 10.0",
"def _current_time_seconds(self):\n return int(round(time.time()))",
"def currentTimeSecs():\n return time.time()",
"def get_time(self) -> float:\n self.rocket.update()\n ... | [
"0.75012565",
"0.72696334",
"0.704129",
"0.704039",
"0.70382655",
"0.69805497",
"0.6978949",
"0.6969247",
"0.69403255",
"0.69107735",
"0.6896041",
"0.6878848",
"0.685984",
"0.67993206",
"0.67879426",
"0.6787236",
"0.67727417",
"0.6743631",
"0.6704049",
"0.6703564",
"0.6699629... | 0.7948383 | 0 |
Sends the goal vehicle pose to the simulator | def pub_goal_vehicle_pose(self):
header = Header()
header.stamp = rospy.Time.now()
position = Point(20.5, -10, -85)
# position = Point(20.5, -10, -85)
yaw = pi
# Converting yaw to quaternion
# See https://en.wikipedia.org/wiki/Conversion_between_quaternions_and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_destination(self):\n\n print('send the target to the robot')\n move_base_action_goal=MoveBaseActionGoal()\n move_base_action_goal.goal.target_pose.header.frame_id=\"map\"\n move_base_action_goal.goal.target_pose.pose.orientation.w=1\n move_base_action_goal.goal.target_po... | [
"0.6900186",
"0.6846976",
"0.6781664",
"0.6722921",
"0.6500318",
"0.647756",
"0.641095",
"0.63947874",
"0.6390289",
"0.6380875",
"0.6371278",
"0.6319203",
"0.61569244",
"0.6111631",
"0.60957015",
"0.6094904",
"0.6075576",
"0.6063163",
"0.6058459",
"0.60555637",
"0.6015337",
... | 0.74411386 | 0 |
A simple timevarying current field in the x direction based on a sinusoid. | def sinusoid_current(self):
t = self.get_time() # time in seconds
offset_time = t - self.start_time - self.delay_time # time offset by start/delay time
# Don't start the currents until t > start + 10
if t < self.start_time + self.delay_time:
print("Waiting for delay time to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, x):\r\n f = math.sin(self.phase_offset + self.angular_frequency*x)\r\n return self.amplitude_offset + self.amplitude*f",
"def tsx(self):\n\n self.x = self.sp\n self.set_zn(self.x)",
"def position(t, x, y):\n return x * exp(-t * y) * sin(2 * pi * t)",
"def update(s... | [
"0.6198477",
"0.6151556",
"0.6098946",
"0.5898149",
"0.5895894",
"0.5881547",
"0.5811019",
"0.57994246",
"0.57935405",
"0.5681556",
"0.5660104",
"0.5616797",
"0.5612879",
"0.56064534",
"0.55949235",
"0.5590392",
"0.5557532",
"0.5556586",
"0.55441815",
"0.5528075",
"0.552043",... | 0.627386 | 0 |
Check if uuid_to_test is a valid UUID. | def is_valid_uuid(uuid_to_test, version=4):
try:
uuid_obj = UUID(uuid_to_test, version=version)
except ValueError:
return False
return str(uuid_obj) == uuid_to_test | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_uuid(uuid_to_test, version=4):\n\ttry:\n\t\tuuid_obj = UUID(uuid_to_test, version=version)\n\t\treturn True\n\texcept:\n\t\treturn False",
"def check_uuid(uuid):\n try:\n converted = UUID(uuid, version=4)\n except ValueError:\n return False\n\n return str(converted) == uuid",
... | [
"0.8684954",
"0.8333081",
"0.8155957",
"0.80367714",
"0.8028158",
"0.79428333",
"0.77374667",
"0.7734152",
"0.7734152",
"0.76239145",
"0.7593849",
"0.7555792",
"0.7149705",
"0.71090436",
"0.69526494",
"0.6922901",
"0.66879606",
"0.66867393",
"0.66619414",
"0.6655981",
"0.6640... | 0.8562131 | 1 |
return parsed file info file_name should be a string with full path to file | def file_info(file_name, file_pattern):
match = re.compile(file_pattern).match(file_name)
if match:
basepath = match.group('basepath')
sensor = match.group('sensor')
ax = match.group('ax')
freq = match.group('freq')
date = match.group('date')
return basepath, sens... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_file_info(directory, root_path, name):\n file_path = join(directory, name)\n rel_path = relpath(file_path, root_path)\n return {\n \"name\": name,\n \"path\": file_path,\n \"dir_name\": dirname(file_path),\n \"is_file\": isfile(file_path),\n \"is_dir\": isdi... | [
"0.70860726",
"0.7010818",
"0.6978658",
"0.69049",
"0.68632764",
"0.66971594",
"0.6577073",
"0.64977664",
"0.64931035",
"0.64348495",
"0.6431073",
"0.6293928",
"0.6288821",
"0.6240199",
"0.623606",
"0.61522275",
"0.61236763",
"0.6095241",
"0.607708",
"0.60727507",
"0.6071609"... | 0.71029544 | 0 |
helper to return all possible splits this function returns all the possible splits on the given attribute on the provided dataframe | def get_possible_splits( df , attribute ):
ds = df.loc[:,attribute]
# First sort the values
ds = ds.sort_values().drop_duplicates()
# Compute averages of consecutive values
ds = ds.rolling(2).sum().divide(2)
splits = ds[1:].tolist()
# return the possible splits
return s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def splitBy(data, attribute_id):\n \n col = getColumn(data, attribute_id)\n values = set(col)\n split_data = [] \n for i in values:\n subset = [row for row in data if row[attribute_id] == i]\n split_data.append(subset)\n \n return split_data",
"def generate_splits( records, i... | [
"0.6871864",
"0.6392091",
"0.62676346",
"0.60429597",
"0.60380805",
"0.603773",
"0.5964825",
"0.5956346",
"0.5944079",
"0.5930761",
"0.58742964",
"0.58675",
"0.5851564",
"0.5841597",
"0.5820882",
"0.5810458",
"0.5741932",
"0.573894",
"0.57379395",
"0.5715522",
"0.57015127",
... | 0.81955785 | 0 |
helper function to evaluate gini value for the split This function gives Gini Value for the split generated by 'split' on 'attribute' in the given dataframe | def evaluate_split( df, attribute, split ):
mask = df[attribute] <= split
# split the dataset on the split attribute
dfl = df[mask]
dfr = df[~mask]
# calculate weighting factors for child
weighting_factor_left = float(dfl.shape[0])/df.shape[0]
weighting_factor_right = float(dfr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcGiniSplitBySplitValue(self, data, structure, colIndex, splitValue):\n dataBellow = list(filter(lambda x: float(x[colIndex]) <= splitValue, data))\n dataAbove = list(filter(lambda x: float(x[colIndex]) > splitValue, data))\n giniSplit = (len(dataBellow) / len(data)) * self.calcDataGini(... | [
"0.6597128",
"0.6406698",
"0.62779886",
"0.6191937",
"0.567172",
"0.5599756",
"0.5579262",
"0.5560474",
"0.53938425",
"0.5372687",
"0.5327218",
"0.5243013",
"0.5231648",
"0.52305394",
"0.50356853",
"0.5020019",
"0.49910983",
"0.49304187",
"0.49144533",
"0.4894045",
"0.4893178... | 0.77684784 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.