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 |
|---|---|---|---|---|---|---|
Single time step of the model Survive Move Update survival probabilities for next timestep Reproduce write stats if requested (modify frequency in pararms, defaults to every timestep). | def timestep(self):
self.survive()
self.move()
self.set_survival_probability(self.vital_var)
self.reproduce()
# self.save_frame()
if self.time % self.save_state_frequency == 0:
self.save_state(self.state_file.format(self.time))
if self.time % self.save... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, action):\n self._last_base_position = self.rex.GetBasePosition()\n self._last_base_orientation = self.rex.GetBaseOrientation()\n if self._is_render:\n # Sleep, otherwise the computation takes less time than real time,\n # which will make the visualization l... | [
"0.6102125",
"0.5921656",
"0.58852",
"0.58603406",
"0.58431786",
"0.5824877",
"0.5800087",
"0.5798567",
"0.5795821",
"0.5784193",
"0.5781902",
"0.57755136",
"0.5754429",
"0.5750484",
"0.56979126",
"0.56923825",
"0.5677857",
"0.56649154",
"0.56636477",
"0.5662022",
"0.56495476... | 0.6987011 | 0 |
Go through agents and test for survival. If survived, increment age. If died, remove agent, decrement population size | def survive(self):
for ind, agent in enumerate(self.agents):
if not agent.survived(self.survival_rates):
# agent.die sets nest to unoccupied
agent.die()
# remove dead individual, this pop may be a bottleneck
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self):\n try:\n self.agents.sort(key=lambda x: x.dist)\n except Exception as e:\n print(e)\n\n for agent in self.agents:\n try:\n agent.step()\n except Exception as e:\n print(e)\n\n\n # Removes agent... | [
"0.61541635",
"0.5916979",
"0.5907109",
"0.5878333",
"0.58588606",
"0.5823883",
"0.58006656",
"0.57697964",
"0.56889236",
"0.55960274",
"0.55943537",
"0.5593866",
"0.5590175",
"0.55863774",
"0.55757755",
"0.553345",
"0.5517368",
"0.5514027",
"0.54872125",
"0.5458798",
"0.5453... | 0.79107314 | 0 |
Test each agent for fidelity, and move all that return false | def move(self):
for agent in self.agents:
if not agent.fidelity:
options = agent.get_move_options(agent.hex, self.kernel_size, None, extend=True)
target = random36.choices(population=options,weights=[x.quality**2 for x in options])
agent.move(target[0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_move(blocking):\n funcs = {\n \"up\": up,\n \"down\": down,\n \"left\": left,\n \"right\": right,\n \"attack\": attack,\n \"back\": back\n }\n passback = False\n for i in ACTIONS:\n if ACTIONS[i] and i not in blocking:\n funcs[i]()\n... | [
"0.6161989",
"0.61251265",
"0.6091814",
"0.6078851",
"0.60553473",
"0.60240245",
"0.5984092",
"0.59675986",
"0.5965552",
"0.5965552",
"0.5965552",
"0.59564024",
"0.5953386",
"0.5949078",
"0.58504",
"0.58400685",
"0.57926685",
"0.57926685",
"0.5792311",
"0.5757538",
"0.5755618... | 0.6545032 | 0 |
Select an initial nest site for a fledgling, and move it | def _fledgling_move(self,fledgling,parent_hex):
options = fledgling.get_move_options(parent_hex, self.kernel_size, None, extend=True)
target = random36.choices(population=options, weights=[x.quality**2 for x in options])
fledgling.move(target[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go_home(self):\n self.set_all_positions([0]*self.nleaflets)",
"def sit(self):\n\n\t\tself.pose.goToPosture(\"Crouch\")",
"def initial_move(self):\n\n # Make the first move based on the game we\n # are currently playing, otherwise return\n if isinstance(self.get_game_space(), Gom... | [
"0.56260705",
"0.55989385",
"0.55781645",
"0.553645",
"0.5478483",
"0.5366081",
"0.5334735",
"0.5319193",
"0.53007275",
"0.52970254",
"0.5277367",
"0.52753234",
"0.5271391",
"0.52554333",
"0.52517164",
"0.5235486",
"0.5211497",
"0.51993847",
"0.5196525",
"0.5190164",
"0.51683... | 0.5848759 | 0 |
Get average ages of all living penguins | def get_average_age(self):
return np.mean([agent.age for agent in self.agents]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_age():\n df = pd.read_csv(config.META_FQN, sep=\"\\t\")\n ages = []\n for _, row in df.iterrows():\n if row[\"asr_test\"]:\n age = row[\"Age_ses1\"]\n if not math.isnan(age):\n ages.append(age)\n\n print(\"------ Age ------\")\n print_stats(age... | [
"0.6973567",
"0.6876934",
"0.6728478",
"0.66512066",
"0.66301155",
"0.66213566",
"0.6536129",
"0.6400674",
"0.63371474",
"0.62774724",
"0.6211637",
"0.6198273",
"0.613757",
"0.6119125",
"0.60964936",
"0.6076544",
"0.6052824",
"0.6017581",
"0.60145056",
"0.5984577",
"0.5974641... | 0.762 | 0 |
Get mean of survival rates being used | def get_average_survival(self):
return np.mean(self.survival_rates) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_meanrates(self):\n return np.asarray([ n.meanrate for n in self.alln.values() ])",
"def mean_rate(df):\n mean_of_rate = dict(df.mean())\n return mean_of_rate",
"def get_mean(self):\n return self.serie.mean()",
"def get_global_mean(self, ratings):\n total_ratings = []\n ... | [
"0.68145657",
"0.6560335",
"0.6169016",
"0.61506957",
"0.61367214",
"0.6114304",
"0.60942155",
"0.6090179",
"0.60630614",
"0.60630614",
"0.605878",
"0.6050883",
"0.59474605",
"0.5946556",
"0.5938628",
"0.5919321",
"0.5854869",
"0.5831808",
"0.58269495",
"0.5812749",
"0.581274... | 0.8691425 | 0 |
Get mean reproductive probability | def get_average_repro(self):
return np.mean([agent.get_fledge_probability() for agent in self.agents]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean(self):\r\n\t\treturn sum(self.sample)/len(self.sample)",
"def mean(self):\n return sum(p * x for x, p in self.items())",
"def theoretical_effective(dataset):\n return float(sum(dataset))/len(dataset)",
"def generalized_mean(x, p, N):\n if p != 0:\n D = 1/(N)\n out = (D*sum... | [
"0.68868256",
"0.6808948",
"0.67508686",
"0.6708355",
"0.6678046",
"0.6669184",
"0.66402876",
"0.66308576",
"0.6544661",
"0.6532276",
"0.6529878",
"0.6504319",
"0.6502189",
"0.6440113",
"0.6434963",
"0.64111936",
"0.63990843",
"0.63824254",
"0.6371108",
"0.6353391",
"0.632530... | 0.6948326 | 0 |
Get average number of occupied nests at radius Discrete version of PCF | def get_average_neighbors(self,radius):
return np.mean([agent.n_neighbors(radius) for agent in self.agents]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_city_size(self):\r\n average = 0\r\n total = 0\r\n for code, node in self.vertices.items():\r\n average += node.population\r\n total += 1\r\n return average // total",
"def averageDominationCount(leaf):\n averageDominationCount = np.nanmean(leaf.ca... | [
"0.6644713",
"0.63884497",
"0.62015617",
"0.6152031",
"0.60830337",
"0.595216",
"0.5885902",
"0.5876074",
"0.586883",
"0.5839772",
"0.5774454",
"0.57740515",
"0.57552874",
"0.5729846",
"0.57219744",
"0.5719234",
"0.5684999",
"0.5654558",
"0.56372887",
"0.562645",
"0.5621094",... | 0.66898096 | 0 |
find all connected components of occupied nests (ie. subcolonies) | def connected_component(self):
t1 = datetime.datetime.now()
nodes = set(x.hex for x in self.agents)
result = []
while nodes:
node = nodes.pop()
# This set will contain the next group of nodes connected to each other.
group = {node}
# Build ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def components(self):\n comps = 0\n unexplored = self.nodes()\n while unexplored:\n comps += 1\n queue = {unexplored.pop()}\n while queue:\n new = queue.pop()\n unexplored.remove(new)\n for adjacent in new.parents() ... | [
"0.65652436",
"0.6536032",
"0.6466327",
"0.64275736",
"0.6274365",
"0.6189597",
"0.6167873",
"0.6141387",
"0.6140448",
"0.6140054",
"0.6084543",
"0.6003741",
"0.59988594",
"0.5991209",
"0.5975682",
"0.5958177",
"0.59331274",
"0.5925253",
"0.5889932",
"0.588724",
"0.5802444",
... | 0.6548019 | 1 |
Collect statistics on simulation and write to log file | def write_stats(self):
with open(self.log_file,'a') as output:
writer = csv.writer(output)
n_comps,comp_size = self.connected_component() # Calculate number of connected components (sub-colonies)
writer.writerow([self.pop_size,
self.get_average_age(),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _logging_smm(self, stats_obs, stats_sim):\n fname = 'monitoring.estimagic.smm.info'\n if self.num_evals == 1 and os.path.exists(fname):\n os.unlink(fname)\n\n with open(fname, 'a+') as outfile:\n\n fmt_ = '\\n\\n{:>8}{:>15}\\n\\n'\n outfile.write(fmt_.forma... | [
"0.6948924",
"0.6545956",
"0.6376904",
"0.63697803",
"0.6274161",
"0.625176",
"0.621739",
"0.61935246",
"0.61056155",
"0.6071852",
"0.6029723",
"0.6025564",
"0.6002629",
"0.60019064",
"0.6000082",
"0.5994448",
"0.5988879",
"0.59887284",
"0.59535253",
"0.593749",
"0.59129333",... | 0.69094115 | 1 |
Updates the mapping between discussion_id to discussion block usage key for all discussion blocks in the given course. | def update_discussions_map(context):
course_key = CourseKey.from_string(context['course_id'])
discussion_blocks = get_accessible_discussion_xblocks_by_course_id(course_key, include_all=True)
discussions_id_map = {
discussion_block.discussion_id: str(discussion_block.location)
for discussion_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_block_in_structure(self, structure, block_key, content):\n structure['blocks'][block_key] = content",
"def map_into_course(self, course_key):\r\n return BlockUsageLocator.make_relative(course_key, self.block_type, self.block_id)",
"def robust_usage_key(block_id):\r\n # if t... | [
"0.5590808",
"0.55762565",
"0.54895616",
"0.544741",
"0.5388639",
"0.53800774",
"0.52230155",
"0.51626676",
"0.5126536",
"0.47947255",
"0.4777267",
"0.4758268",
"0.47579682",
"0.47344506",
"0.4705566",
"0.4685901",
"0.46770802",
"0.46686006",
"0.46590692",
"0.4631568",
"0.459... | 0.72480994 | 0 |
Send analytics event for a sent email | def _track_notification_sent(message, context):
properties = {
'app_label': 'discussion',
'name': 'responsenotification', # This is 'Campaign' in GA
'language': message.language,
'uuid': str(message.uuid),
'send_uuid': str(message.send_uuid),
'thread_id': context['th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_email(email_dict, appointment_id):\n event_identifier = g_cal.send_invite_through_gcal(email_dict)\n models.Appointments.objects.filter(id=appointment_id).update(event_identifier=event_identifier)",
"def send_email(self, message):\n pass",
"def send_event(agent_name, agent_version):\n ... | [
"0.6482766",
"0.64171267",
"0.63462245",
"0.6277504",
"0.62671685",
"0.6202733",
"0.6197998",
"0.6167102",
"0.614271",
"0.60910344",
"0.6002518",
"0.5981753",
"0.5978569",
"0.5950977",
"0.59436125",
"0.58901495",
"0.588927",
"0.58871335",
"0.5875701",
"0.5863084",
"0.5836766"... | 0.65042865 | 0 |
Create a New Quote under a PartnerID by passing the API Fields as described in the API Docs | def create_quote(self, query_params=dict(), **kwargs):
quote = Quote(partner_id=self.partner, prefix=self.prefix)
response = quote._create(query_params, **kwargs)
quote.set_values(response)
return quote | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quote_create(request: HttpRequest) -> HttpResponse: # noqa: 201\n form = QuoteForm(request.POST or None)\n\n if form.is_valid():\n form.save()\n messages.success(request, \"Created quote.\")\n return redirect(\"quotes:quote_list\")\n\n return render(\n request,\n \"... | [
"0.6508626",
"0.6300435",
"0.60182333",
"0.5754441",
"0.55294424",
"0.5461251",
"0.5461251",
"0.54391956",
"0.54281914",
"0.5370511",
"0.536926",
"0.5358496",
"0.5356512",
"0.5340314",
"0.5337365",
"0.531263",
"0.52982354",
"0.5228273",
"0.52240545",
"0.52228206",
"0.5216454"... | 0.66437835 | 0 |
Get the Quote details when the Quote ID and Project ID is provided | def get_quote(self, quote_package_id, query_params=dict(), **kwargs):
quote = Quote(partner_id=self.partner, quote_package_id=quote_package_id, prefix=self.prefix)
response = quote._get(query_params, **kwargs)
quote.set_values(response)
return quote | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quote_detail(request: HttpRequest, pk: int) -> HttpResponse: # noqa: 201\n quote = get_object_or_404(Quote, pk=pk)\n return render(\n request,\n \"quotes/quote_detail.html\",\n {\"quote\": quote},\n )",
"def rental_quote_info(self, system_ids=None):\n\n\t\tpath = f'{self.BIKE_E... | [
"0.6451687",
"0.6327512",
"0.62766147",
"0.6097378",
"0.6055202",
"0.5864893",
"0.5855568",
"0.57556176",
"0.57294154",
"0.5585812",
"0.5577114",
"0.5542794",
"0.5516272",
"0.5514756",
"0.55081797",
"0.54752004",
"0.54615307",
"0.54244816",
"0.5422837",
"0.5340638",
"0.533963... | 0.6539118 | 0 |
Get the Booking details when the Quote Package ID and Project ID is provided | def get_booking(self, quote_package_id, query_params=dict(), **kwargs):
kwargs['quote_package_id'] = quote_package_id
booking = Bookings(partner_id=self.partner, quote_package_id=quote_package_id, prefix=self.prefix)
response = booking._get(query_params, **kwargs)
booking.set_values(res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_book_fetch(self, symbol):\n orderbook = self.orderbooks[symbol]\n asks = [[float(price), float(stats[0]) * float(stats[1])] for price, stats in orderbook['asks'].items()]\n bids = [[float(price), float(stats[0]) * float(stats[1])] for price, stats in orderbook['bids'].items()]\n ... | [
"0.57324886",
"0.57187575",
"0.5481961",
"0.53704",
"0.5337083",
"0.53226227",
"0.5265281",
"0.52612245",
"0.52574664",
"0.5209501",
"0.5187016",
"0.5173858",
"0.51481587",
"0.51389986",
"0.51005465",
"0.50961506",
"0.50832635",
"0.5074798",
"0.50564724",
"0.5048655",
"0.5046... | 0.6681743 | 0 |
Confirm the Renewal by the Client | def confirm_renewal(self, renewal_id, paid_on, query_params=dict()):
return Renewal().patch(query_params, **{
'partner_id': self.partner,
'renewal_id': renewal_id,
'paid_on': paid_on
}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_renew_user_pending_cancel(self):\n self.braintree_customer.active = True\n self.braintree_customer.pending_cancel = True\n self.braintree_customer.subscription_id = \"ValidSubscriptionID\"\n\n result = SubscriptionManager.renew(self.braintree_customer)\n self.assertEqual... | [
"0.6434462",
"0.63707983",
"0.63447464",
"0.6261101",
"0.62381214",
"0.62381214",
"0.62220305",
"0.6187549",
"0.6135051",
"0.60629225",
"0.606035",
"0.60471404",
"0.6024264",
"0.60168195",
"0.59673226",
"0.59529364",
"0.59470457",
"0.592346",
"0.5902926",
"0.58975035",
"0.586... | 0.70386636 | 0 |
Get all Policy Types. Admin API Only. Wont work with all keys | def get_policies(self, query_params=dict(), **kwargs):
policy_types = PolicyTypes(prefix=self.prefix, **kwargs)
response = policy_types._get(query_params, **kwargs)
policy_types.set_values(response)
return policy_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policies():\r\n policy = policies.values()\r\n return policy",
"def get_all(isamAppliance, count=None, start=None, filter=None, sortBy=None, check_mode=False, force=False):\n return isamAppliance.invoke_get(\"Retrieve a list of policy information point types\",\n ... | [
"0.66965675",
"0.63288736",
"0.6221632",
"0.61884075",
"0.5932949",
"0.59071225",
"0.5861642",
"0.583907",
"0.58315635",
"0.5826912",
"0.5781122",
"0.57808006",
"0.5774642",
"0.5722626",
"0.5716492",
"0.5702259",
"0.5693472",
"0.5681771",
"0.5678331",
"0.5644406",
"0.5641878"... | 0.67464477 | 0 |
Switch to the next light | def nextLight():
global light
pin.setAllOutPinsLow()
light += 1
light %= len(traffic_lights)
print traffic_colors[light]
pin.setOutPinHigh(traffic_lights[light]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go_to_next_state(self):\n pass",
"def lightning_turnon(self):\n self.turnOn()",
"def step_animation(self):\n self._light.toggle()",
"def next_turn(self):\n if self.turn == BLUE and self.ai:\n self.ai_turn = True\n self.turn = RED\n elif self.turn =... | [
"0.67792237",
"0.67568386",
"0.6355606",
"0.63430357",
"0.63318014",
"0.6330701",
"0.6322784",
"0.6320562",
"0.630915",
"0.6253104",
"0.6213994",
"0.62057287",
"0.61738336",
"0.61340743",
"0.6114648",
"0.61112833",
"0.6107483",
"0.60732424",
"0.60728264",
"0.6061286",
"0.6050... | 0.7700489 | 0 |
Call the stored procedure, `GetCourseInfo`, to get the course as a list of json for the given course id. | def get_course_info(self, course_id):
try:
results = self.__get_results('CALL GetCourseInfo({0})'.format(course_id))
return [XcCourse(result).get_json() for result in results] if results else []
except Exception as e:
logging.exception(e)
raise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_course(course_id: int, db: Session = Depends(get_db)):\n course = crud.course.get(db, obj_id=course_id)\n\n if not course:\n raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=f'Course {course_id} not found')\n\n return schemas.CourseResponseWithUsers(\n name=course.na... | [
"0.6738363",
"0.6330285",
"0.6201971",
"0.6159804",
"0.61343575",
"0.6024759",
"0.59995455",
"0.5987898",
"0.59455353",
"0.5919566",
"0.585802",
"0.58278054",
"0.58246505",
"0.5781162",
"0.5779753",
"0.57740843",
"0.5737782",
"0.56751806",
"0.567361",
"0.5601944",
"0.55961466... | 0.80542916 | 0 |
Call the stored procedure, `GetXcRunners`, to get the runner as a list of json for the given gender id. | def get_xc_runners(self, gender_id):
try:
results = self.__get_results('CALL GetXcRunners("{0}")'.format(gender_id))
return [Athlete(result).get_json() for result in results] if results else []
except Exception as e:
logging.exception(e)
raise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genders(self):\n\n return Client.gender_choices",
"def get_xc_competitors_by_year(self, year, gender_id):\n try:\n results = self.__get_results('CALL GetXcCompetitorsByYear({0}, {1})'.format(year, gender_id))\n return [Competitor(result).get_json() for result in results] if re... | [
"0.5358601",
"0.5130135",
"0.47593746",
"0.4732554",
"0.47001544",
"0.4676087",
"0.46717885",
"0.46198648",
"0.4610115",
"0.45942563",
"0.45854318",
"0.45814556",
"0.4561595",
"0.45195827",
"0.4474422",
"0.44670355",
"0.44627583",
"0.44614685",
"0.44396144",
"0.443768",
"0.44... | 0.8126147 | 0 |
Call the stored procedure, `GetXcCompetitorsByYear`, to get the competitor as a list of json for the given year and gender id. | def get_xc_competitors_by_year(self, year, gender_id):
try:
results = self.__get_results('CALL GetXcCompetitorsByYear({0}, {1})'.format(year, gender_id))
return [Competitor(result).get_json() for result in results] if results else []
except Exception as e:
logging.exc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_xc_races_by_year(self, year):\n try:\n results = self.__get_results('CALL GetXcRacesByYear({0})'.format(year))\n return [XcRace(result).get_json() for result in results] if results else []\n except Exception as e:\n logging.exception(e)\n raise",
... | [
"0.5925577",
"0.5735063",
"0.5615395",
"0.55054927",
"0.542326",
"0.54187703",
"0.541775",
"0.53866243",
"0.5250622",
"0.52398765",
"0.5204685",
"0.51605403",
"0.5159857",
"0.51408327",
"0.5121932",
"0.5110948",
"0.51003385",
"0.50979644",
"0.5097866",
"0.5044257",
"0.5036395... | 0.85262805 | 0 |
Call the stored procedure, `GetXcRacesByYear`, to get the race as a list of json for the given year. | def get_xc_races_by_year(self, year):
try:
results = self.__get_results('CALL GetXcRacesByYear({0})'.format(year))
return [XcRace(result).get_json() for result in results] if results else []
except Exception as e:
logging.exception(e)
raise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def years():\r\n # Use Pandas to perform the sql query\r\n results = db.session.query(Worldmapdata.year.distinct().label(\"year\"))\r\n year = [row.year for row in results.all()]\r\n # Return a list of the column names (sample names)\r\n return jsonify(list(year))",
"def aYears():\n a = pd.DataF... | [
"0.670161",
"0.6453107",
"0.6425528",
"0.6212915",
"0.5963288",
"0.59247774",
"0.5877735",
"0.5793807",
"0.5721308",
"0.5714984",
"0.56814474",
"0.56773907",
"0.56492054",
"0.56285757",
"0.5525697",
"0.5456403",
"0.5429012",
"0.5406371",
"0.5398752",
"0.53883004",
"0.52983856... | 0.78962576 | 0 |
Get the results as a dictionary for the given query. | def __get_results(self, query):
return self.mysql.query_multi_with_fetchall_as_dict(query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_query(query):\n global database\n res = database.conn.execute(query)\n out = res.fetchall()\n return [dict(zip(i.keys(), i)) for i in out]",
"def get(self, query):\n result = self._client.execute(query)\n data = json.loads(result)\n return data",
"def _get_query_results... | [
"0.753346",
"0.70950365",
"0.70924073",
"0.70192516",
"0.6926244",
"0.68984306",
"0.68973297",
"0.684961",
"0.674743",
"0.6745779",
"0.6724155",
"0.6697393",
"0.6659849",
"0.66502064",
"0.66457856",
"0.6613112",
"0.65866727",
"0.6545005",
"0.6428858",
"0.6416184",
"0.6405194"... | 0.7915632 | 0 |
Determine if the repository described by a metafile should be imported. | def ShouldImportRepo(
session: orm.session.Session, metafile: pathlib.Path
) -> bool:
if not (
metafile.is_file()
and pbutil.ProtoIsReadable(metafile, scrape_repos_pb2.GitHubRepoMetadata())
):
return False
meta = pbutil.FromFile(metafile, scrape_repos_pb2.GitHubRepoMetadata())
clone_dir = metafile... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dist_has_meta_data(dist: pkg_resources.Distribution) -> bool:\n return dist.has_metadata('direct_url.json')",
"def source_repo_is_related():\n return True",
"def isMetapackage(self):\n cmake_file = os.path.join(self.path, 'CMakeLists.txt')\n with open(cmake_file, 'r') as file:\n ... | [
"0.6229858",
"0.60381055",
"0.5946105",
"0.589947",
"0.5871112",
"0.5871112",
"0.57831424",
"0.5782858",
"0.5707214",
"0.56258804",
"0.56249607",
"0.55667806",
"0.5526642",
"0.5451477",
"0.5415128",
"0.5405843",
"0.5385098",
"0.5361125",
"0.53571695",
"0.5339016",
"0.53302914... | 0.80561453 | 0 |
Import contentfiles from repository. | def ImportRepo(
session: orm.session.Session,
language: scrape_repos_pb2.LanguageToClone,
metafile: pathlib.Path,
) -> None:
meta = pbutil.FromFile(metafile, scrape_repos_pb2.GitHubRepoMetadata())
clone_dir = metafile.parent / f"{meta.owner}_{meta.name}"
repo = contentfiles.GitHubRepository.GetOrAdd(session... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_files_from_repository(self) -> typing.List[upload.File]:\n with tempfile.TemporaryDirectory() as tempdir:\n self._execute_command(\n args=['git', 'clone', self.repository_folder, '.'],\n cwd=tempdir,\n )\n to_return = []\n #... | [
"0.59420145",
"0.5738775",
"0.56874174",
"0.5652583",
"0.56163985",
"0.55232906",
"0.5383715",
"0.5383337",
"0.5380151",
"0.5368662",
"0.53519666",
"0.53193086",
"0.53163546",
"0.5314042",
"0.53088176",
"0.52782017",
"0.5247766",
"0.5239256",
"0.51862264",
"0.51835287",
"0.51... | 0.6532376 | 0 |
Import contentfiles from a language specification. | def ImportFromLanguage(
db: contentfiles.ContentFiles, language: scrape_repos_pb2.LanguageToClone
) -> None:
if not language.importer:
raise ValueError("LanguageToClone.importer field not set")
with db.Session() as session:
repos_to_import = [
pathlib.Path(language.destination_directory / f)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_extra_content(self, system, course_descriptor, category, content_path, course_dir):\r\n for filepath in glob.glob(content_path / '*'):\r\n if not os.path.isfile(filepath):\r\n continue\r\n\r\n if filepath.endswith('~'): # skip *~ files\r\n conti... | [
"0.6123358",
"0.5318778",
"0.5207734",
"0.51662576",
"0.51649505",
"0.5076377",
"0.50252134",
"0.5017872",
"0.5006963",
"0.5002179",
"0.49955037",
"0.49390134",
"0.4932036",
"0.49125215",
"0.4879229",
"0.48699126",
"0.48489088",
"0.48412752",
"0.48279163",
"0.4821052",
"0.479... | 0.56946903 | 1 |
Return a connection to the language database from clone list. | def GetContentfilesDatabase(
language: scrape_repos_pb2.LanguageToClone,
) -> contentfiles.ContentFiles:
d = pathlib.Path(language.destination_directory)
d = d.parent / (str(d.name) + ".db")
return contentfiles.ContentFiles(f"sqlite:///{d}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_db():\n if not hasattr(g, 'db_conn'):\n g.db_conn = sqlite3.connect(\"pypatch.sqlite\")\n g.db_conn.row_factory = sqlite3.Row\n \n return g.db_conn",
"def obtainDatabaseConnection(self):\n\t\tself.databaseConnector = DatabaseConnector()",
"def create_master_connection(self):\n ... | [
"0.56222147",
"0.55664915",
"0.55526227",
"0.553518",
"0.5495557",
"0.54858464",
"0.5480197",
"0.54660404",
"0.5422428",
"0.54089564",
"0.5383164",
"0.5362199",
"0.535183",
"0.53476083",
"0.5333881",
"0.53325355",
"0.53325146",
"0.531719",
"0.52971196",
"0.52859896",
"0.52855... | 0.5620698 | 1 |
List available deep learning entities models, ['concat', 'bahdanau', 'luong'] | def get_available_entities_models():
return ['concat', 'bahdanau', 'luong'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_deep_model():\n return [\n 'fast-text',\n 'hierarchical',\n 'bahdanau',\n 'luong',\n 'bidirectional',\n 'bert',\n 'entity-network',\n ]",
"def deep_entities(model = 'bahdanau'):\n assert isinstance(model, str), 'model must be a string'\n ... | [
"0.7605198",
"0.6426305",
"0.6413724",
"0.6383555",
"0.62476194",
"0.6245757",
"0.61931354",
"0.61557436",
"0.6150635",
"0.61192334",
"0.60591644",
"0.6013506",
"0.6011158",
"0.6001974",
"0.60007554",
"0.59681827",
"0.5954783",
"0.59471554",
"0.5888134",
"0.5853192",
"0.58467... | 0.7711924 | 0 |
Load CRF Entities Recognition model. Returns | def crf_entities():
if not os.path.isfile(PATH_ENTITIES['crf']['model']):
print('downloading ENTITIES frozen CRF model')
download_file(
S3_PATH_ENTITIES['crf']['model'], PATH_ENTITIES['crf']['model']
)
with open(PATH_ENTITIES['crf']['model'], 'rb') as fopen:
model = p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model():\n \n _files = training_file()\n \n predictor_path = _files.model_file(LANDMARKS_WEIGHTS)\n face_rec_model_path = _files.model_file(RESNET_WEIGHTS)\n \n detector = dlib.get_frontal_face_detector()\n sp = dlib.shape_predictor(predictor_path)\n facerec = dlib.face_recognition_model_v1(face_... | [
"0.70583785",
"0.66990507",
"0.6662772",
"0.65838206",
"0.6577656",
"0.64489144",
"0.63940096",
"0.63555264",
"0.6340585",
"0.632349",
"0.63229156",
"0.6319504",
"0.6307994",
"0.62970716",
"0.6276362",
"0.6275933",
"0.6273251",
"0.6259318",
"0.62442255",
"0.621613",
"0.618410... | 0.71919906 | 0 |
Function to remove identical objects from list | def remove_duplicates(self, objects: list):
# Filter list removing duplicates
result = [
item
for index, item in enumerate(objects)
if item not in objects[index + 1 :]
]
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_identical(list):\n seen = set()\n seen_add = seen.add\n return [x for x in list if not (x in seen or seen_add(x))]",
"def rm(x, l):\n return [y for y in l if x != y]",
"def removeDuplicates(list):\n\treturn set((item for item in list))",
"def remove_duplicates(self,list_):\r\n r... | [
"0.79283035",
"0.7191116",
"0.7114873",
"0.70925844",
"0.7085928",
"0.70793587",
"0.70524126",
"0.701939",
"0.6991535",
"0.69669217",
"0.6899374",
"0.6869095",
"0.6867045",
"0.6863053",
"0.6839916",
"0.68015295",
"0.67879015",
"0.67623246",
"0.6752387",
"0.67086804",
"0.66921... | 0.765078 | 1 |
Function to save execution objects into a backup file | def save_objects(self):
try:
base_path = "/tmp/objects.bkp"
# Open backup file for write
file = open(base_path, "w")
# Remove old content from file
file.truncate()
# Write a string with the execution objects
file.write(json.dump... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pickleSave(object, filename):\n #Todo: Handle exceptions from pickle\n filehandler = open(\"obj/\" + filename + \".obj\", 'wb')\n pickle.dump(object, filehandler)",
"def save_object(o, fn):\n return dump_object(o, fn)",
"def save_backup(\n self):\n self.backup = self.data",
"def... | [
"0.685258",
"0.6827297",
"0.6746859",
"0.66959107",
"0.6675868",
"0.6652653",
"0.6648237",
"0.66142297",
"0.65917957",
"0.65888196",
"0.6580307",
"0.6565631",
"0.6546719",
"0.6534259",
"0.6532233",
"0.6510419",
"0.6472471",
"0.64600796",
"0.6452332",
"0.64505035",
"0.6448784"... | 0.74629486 | 0 |
Function to get all ancestor for given `product` on a `products` list | def get_ancestors(self, products: list, product: dict):
try:
# Get the parent_id from the given product
parent_identifier = product["parent_id"]
# Get all items
found = [item for item in products if item["id"] == parent_identifier]
found = self.remove_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAncestors():",
"def filter_products(self, products: list):\n # Get all products that has no parent\n independent = [product for product in products if product[\"parent_id\"] is None]\n # Get all products that has parent\n dependent = [\n product for product in produc... | [
"0.6628475",
"0.6406315",
"0.606797",
"0.58804446",
"0.58753794",
"0.58007526",
"0.57518226",
"0.5744265",
"0.5701307",
"0.5697971",
"0.5599974",
"0.55953765",
"0.55893946",
"0.5577976",
"0.55677366",
"0.5546268",
"0.5537941",
"0.55375606",
"0.55295056",
"0.55256253",
"0.5488... | 0.78917664 | 0 |
Function to filter all products that does not have parent products | def filter_products(self, products: list):
# Get all products that has no parent
independent = [product for product in products if product["parent_id"] is None]
# Get all products that has parent
dependent = [
product for product in products if product["parent_id"] is not Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request):\n query = super(GipsyMenu, self).get_queryset(request)\n return query.filter(parent__isnull=True)",
"def find_not_in(people, filter):\n new_people = set()\n for person in people.intersection(filter):\n new_people.update(set(person.parents) - filter)\n if len... | [
"0.6270309",
"0.5930552",
"0.57827735",
"0.57378167",
"0.5681967",
"0.565553",
"0.5588137",
"0.5534622",
"0.55331683",
"0.54777837",
"0.54390407",
"0.5393352",
"0.5374474",
"0.53462",
"0.53422874",
"0.52983016",
"0.52933013",
"0.5290616",
"0.5288695",
"0.52767336",
"0.5275052... | 0.7511012 | 0 |
Plots the statistics for a single variable over multiple runs. | def plot_stats(values, path='', experiment='', run_type='', x_var_name='', plot_agg=True, plot_runs=True, smth_wnd=10,
show=True, save=True):
if experiment is not None or experiment != '':
experiment = '_' + experiment
if path != '' and path[-1] != '/':
path = path + '/'
fig = plt.figure(figsize=(10, 5)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_results(self, a):\n import matplotlib.pyplot as plt\n fig, axes = plt.subplots(nrows=len(a.data_vars), sharex='all', sharey='all')\n for ax, var in zip(axes, a.data_vars):\n data = a[var]\n plt.sca(ax)\n data.plot(x='time', cmap=plt.cm.viridis_r, yincr... | [
"0.672182",
"0.63941985",
"0.6356872",
"0.6280865",
"0.62755036",
"0.62379146",
"0.61793387",
"0.61510396",
"0.6116657",
"0.60931695",
"0.6087636",
"0.60721606",
"0.60638034",
"0.60360867",
"0.60059965",
"0.59882677",
"0.596577",
"0.59538317",
"0.5935001",
"0.5905842",
"0.590... | 0.69137186 | 0 |
Initializes RigidBody object, with mass "jsa" matrix, and length. | def __init__(self, mass, jsa, length):
RigidBody.counter += 1
self.length = length
self.ID = RigidBody.counter
self.mass_matrix = None
self.constraints = []
self.symbolic_variables = []
self.r_i = BaseObject('r_i', self.ID)
self.r_j = BaseObject('r_j', sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n length: np.float64,\n mass: np.float64,\n starting_angle: np.float64,\n starting_angular_vely: np.float64,\n ):\n\n # Initialise physical params\n # There's only one for a 1d pendulum\n self._angular_freq = np.sqrt(mass * EARTH_GRAV... | [
"0.63810444",
"0.5819517",
"0.5787619",
"0.56900233",
"0.56341875",
"0.54643875",
"0.54200536",
"0.5418946",
"0.5418364",
"0.5370413",
"0.5369245",
"0.52942955",
"0.5277585",
"0.5276776",
"0.5263552",
"0.52584875",
"0.52394533",
"0.5224027",
"0.52200603",
"0.5204001",
"0.5186... | 0.7373871 | 0 |
Make constraints of RigidBody constraints | def rigid_body_constraints(self):
phi_1 = constant_distance(self.r_i.symbolic_coordinates -
self.r_j.symbolic_coordinates, self.length)
phi_2 = constant_distance(self.u.symbolic_coordinates, 1)
phi_3 = constant_distance(self.v.symbolic_coordinates, 1)
ph... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constraints(self):\n ...",
"def constraints(self, x):\n pass",
"def add_box_constraints(self, constraints):\n if len(constraints) == 0:\n return\n self.box_constraints = constraints\n self.matrix += constraints\n self.startBox = self.m + self.d\n ... | [
"0.6809779",
"0.63843066",
"0.6333981",
"0.629669",
"0.6282156",
"0.6225847",
"0.61297584",
"0.61000466",
"0.6092346",
"0.60751754",
"0.60451573",
"0.5988859",
"0.59809035",
"0.5951886",
"0.5925011",
"0.5912873",
"0.59012794",
"0.5877435",
"0.58611786",
"0.5838057",
"0.581875... | 0.7498295 | 0 |
Process atom blocks of ``Ctab``. | def _ctab_atom_block(number_of_lines, block_type, stream):
for _ in range(int(number_of_lines)):
line = stream.popleft()
x, y, z = line[:10].strip(), line[10:20].strip(), line[20: 30].strip()
atom_symbol = line[30:34].strip()
mass_difference = line[34:36].strip()
left = [line... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ctab_bond_block(number_of_lines, block_type, stream):\n for _ in range(int(number_of_lines)):\n line = stream.popleft()\n line_values = [line[i:i + 3].strip() for i in range(0, 21, 3)]\n line_values = [item if item != \"\" else \"0\" for item in line_values]\n yield block_type(*... | [
"0.56043977",
"0.49966583",
"0.4886775",
"0.4730874",
"0.47214916",
"0.47214916",
"0.47188404",
"0.4718281",
"0.46909532",
"0.4671544",
"0.45971352",
"0.45807776",
"0.4574275",
"0.4554366",
"0.45467803",
"0.45428547",
"0.4528519",
"0.45165607",
"0.44839764",
"0.44755435",
"0.... | 0.6861127 | 0 |
Process bond blocks of ``Ctab``. '111222tttsssxxxrrrccc' | def _ctab_bond_block(number_of_lines, block_type, stream):
for _ in range(int(number_of_lines)):
line = stream.popleft()
line_values = [line[i:i + 3].strip() for i in range(0, 21, 3)]
line_values = [item if item != "" else "0" for item in line_values]
yield block_type(*line_values) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ctab_atom_block(number_of_lines, block_type, stream):\n for _ in range(int(number_of_lines)):\n line = stream.popleft()\n x, y, z = line[:10].strip(), line[10:20].strip(), line[20: 30].strip()\n atom_symbol = line[30:34].strip()\n mass_difference = line[34:36].strip()\n l... | [
"0.5652865",
"0.5199156",
"0.513828",
"0.4969339",
"0.49605763",
"0.49438918",
"0.49381936",
"0.49196616",
"0.4901911",
"0.48796403",
"0.4855266",
"0.48392436",
"0.48317164",
"0.48262078",
"0.48214665",
"0.4807524",
"0.47871864",
"0.4778054",
"0.47591364",
"0.47451907",
"0.47... | 0.6507832 | 0 |
Process properties block of ``Ctab``. | def _ctab_property_block(stream):
line = stream.popleft()
while line != 'M END':
tokens = line.split()
if len(tokens) > 1:
name = tokens[1]
yield CtabPropertiesBlockLine(name, line)
else:
yield CtabPropertiesBlockLine(line, line)
line = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_props():\r\n section = document.add_section()\r\n new_width, new_height = section.page_height, section.page_width\r\n section.orientation = WD_ORIENT.LANDSCAPE\r\n section.page_width = 7772400\r\n section.page_height = 10058400\r\n document.add_heading('Custom Properties', level=1)\r\n... | [
"0.57288116",
"0.5674833",
"0.55675656",
"0.55302894",
"0.5494539",
"0.5424513",
"0.54218197",
"0.54015666",
"0.5381815",
"0.5380539",
"0.5380539",
"0.5380539",
"0.53094256",
"0.5260621",
"0.5256963",
"0.52518857",
"0.5251135",
"0.52257365",
"0.5201838",
"0.5194242",
"0.51715... | 0.68176633 | 0 |
Test points_on_1sphere for 4 points on axis 'y'. | def test_points_on_1sphere_4y():
points = generate.points_on_1sphere(4, 'y')
assert np.allclose(points[0], cst.quat1)
assert np.allclose(points[1], cst.quaty90)
assert np.allclose(points[2], cst.quaty) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_points_on_1sphere_8x():\n points = generate.points_on_1sphere(8, 'x')\n assert np.allclose(points[0], cst.quat1)\n assert np.allclose(points[2], cst.quatx90)\n assert np.allclose(points[4], cst.quatx)",
"def pointsOn1Sphere(numPts, rotationAxis):\n points = np.zeros((numPts, 4))\n incA... | [
"0.75946134",
"0.64270353",
"0.61539793",
"0.6153713",
"0.59386253",
"0.5851985",
"0.5690043",
"0.56262577",
"0.5624585",
"0.5609045",
"0.55600464",
"0.55498564",
"0.55336607",
"0.5532672",
"0.5526336",
"0.5485353",
"0.54836035",
"0.5453504",
"0.54223996",
"0.5416326",
"0.541... | 0.83845305 | 0 |
Test points_on_1sphere for 8 points on axis 'x'. | def test_points_on_1sphere_8x():
points = generate.points_on_1sphere(8, 'x')
assert np.allclose(points[0], cst.quat1)
assert np.allclose(points[2], cst.quatx90)
assert np.allclose(points[4], cst.quatx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_points_on_1sphere_4y():\n points = generate.points_on_1sphere(4, 'y')\n assert np.allclose(points[0], cst.quat1)\n assert np.allclose(points[1], cst.quaty90)\n assert np.allclose(points[2], cst.quaty)",
"def sphere(self, x):\r\n # return np.random.rand(1)[0]**0 * sum(x**2) + 1 * np.ra... | [
"0.72881126",
"0.6347203",
"0.61428547",
"0.60806537",
"0.6070733",
"0.6038904",
"0.59309286",
"0.5884943",
"0.57879406",
"0.5787049",
"0.576233",
"0.5760818",
"0.57485706",
"0.5745381",
"0.5727559",
"0.5725929",
"0.57205725",
"0.5677196",
"0.5628185",
"0.56025064",
"0.554890... | 0.8461061 | 0 |
You can either pass the variable, which is used in expression, or you can force the function to identify the variable automatically (change auto_identify_var to True) | def simplify(expression, auto_identify_var=False, variable="x"):
if not auto_identify_var:
var = variable
else:
var = identify_var(expression)
return Expression(expression, var=var).eval() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_simplify(expression):\n return simplify(expression, auto_identify_var=True)",
"def variable(self, val):",
"def test_by_variable():\n pass",
"def auto_vars(f: Callable):\n from objax.util.tracing import find_used_variables\n return Function(f, find_used_variables(f))",
"def is_v... | [
"0.62547314",
"0.6184702",
"0.6101477",
"0.60922503",
"0.6007122",
"0.59862494",
"0.59706074",
"0.59566545",
"0.5852164",
"0.5829749",
"0.5790611",
"0.5697308",
"0.5634246",
"0.562691",
"0.5626589",
"0.55929196",
"0.55929196",
"0.55929196",
"0.55929196",
"0.5589374",
"0.55246... | 0.66730726 | 0 |
Simplify the expression (variable will be identified automatically) | def auto_simplify(expression):
return simplify(expression, auto_identify_var=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simplify(self, expr):\n return sy.simplify(expr)",
"def _simplify(expr):\n from sympy.simplify.simplify import simplify\n return simplify(expr)",
"def simplify(expression, auto_identify_var=False, variable=\"x\"):\n \n if not auto_identify_var:\n var = variable\n else:\n ... | [
"0.75679344",
"0.73337656",
"0.7290036",
"0.69090253",
"0.6771299",
"0.66250235",
"0.6407404",
"0.64023095",
"0.63021296",
"0.61791646",
"0.6092825",
"0.6024611",
"0.5991115",
"0.59469587",
"0.5896348",
"0.5864412",
"0.58225304",
"0.58065116",
"0.57979375",
"0.5784939",
"0.57... | 0.7799628 | 0 |
Wait for a file to become stable (not recently modified) & return existence Returns False if file does not exist. Raises FileNotFoundError if file deleted during polling. When running through the two notebooks at the same time in parallel, this helps to minimize any errors caused by initiating multiple downloads/extrac... | def wait_for_file_stable(path: str, stable_secs: int=60, poll_secs: Optional[int]=None) -> bool:
if not poll_secs:
poll_secs = stable_secs / 4
try:
init_stat = os.stat(path)
except FileNotFoundError:
return False
if (time.time() - init_stat.st_mtime) < stable_secs:
print... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_ready(file_path):\n while not os.path.exists(file_path):\n time.sleep(1)\n if os.path.isfile(file_path):\n return True\n raise ValueError(\"%s isn't a file!\" % file_path)",
"def _block_until_file_present(self, file_name: str, timeout: int=None) -> bool:\n def i... | [
"0.70306",
"0.6846971",
"0.6631593",
"0.65608096",
"0.65242684",
"0.6450828",
"0.6437303",
"0.6361162",
"0.6259326",
"0.62379694",
"0.6076085",
"0.6073925",
"0.60708845",
"0.5979986",
"0.5968383",
"0.5951519",
"0.591694",
"0.58304423",
"0.5828141",
"0.580837",
"0.5807291",
... | 0.7269269 | 0 |
Download pretrained word vectors and construct an embedding matrix for tokenizer `t` Any tokens in `t` not found in the embedding vectors are mapped to allzeros. | def get_word_embeddings(t, folder, lang="en"):
vecs_url = f"https://dl.fbaipublicfiles.com/fasttext/vectors-crawl/cc.{lang}.300.vec.gz"
vecs_gz_filename = vecs_url.rpartition("/")[2]
os.makedirs(folder, exist_ok=True)
vecs_gz_filepath = os.path.join(folder, vecs_gz_filename)
tokenizer_vocab_size = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWordEmbeddingsMatrix(script_directory, embedding_file):\n translator = str.maketrans('', '', string.punctuation)\n all_words = []\n print(\"Loading vocab from text files in:\")\n for d in os.listdir(script_directory):\n print(d)\n for fname in os.listdir(\"%s/%s\" % (script_directo... | [
"0.7298131",
"0.6931239",
"0.6892255",
"0.68728644",
"0.68558",
"0.6831081",
"0.6816191",
"0.6749407",
"0.658238",
"0.65221167",
"0.6507141",
"0.6493017",
"0.64845765",
"0.64706093",
"0.64613444",
"0.6460455",
"0.64546764",
"0.64436466",
"0.6438294",
"0.64256907",
"0.6414703"... | 0.77521133 | 0 |
Taxa names to collapse are in index of DataFrame | def collapse_taxa(df: pandas.DataFrame, genus: bool = False, suffix: str = None) -> pandas.DataFrame:
if suffix is not None:
group_names = []
for name in df.index.tolist():
if suffix in name:
group_names.append(name.split(suffix)[0] + 'virus')
elif genus:
gro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reindex_subcomponent_taxa():\n pass",
"def add_taxonomy(tax_idx, pkl):\n for tax,v in tax_idx.items():\n for genome_id,genome_len in v.items():\n T = '|'.join(list(tax) + ['t__' + genome_id])\n pkl['taxonomy'][T] = ('', int(genome_len))\n return pkl",
"def taxa_dat... | [
"0.58745885",
"0.5668844",
"0.5647446",
"0.554406",
"0.553708",
"0.5405319",
"0.53859776",
"0.536365",
"0.529502",
"0.5262909",
"0.52614665",
"0.5214309",
"0.52027345",
"0.51658857",
"0.51258713",
"0.5125632",
"0.5125632",
"0.5121321",
"0.51064295",
"0.509998",
"0.5096981",
... | 0.6651062 | 0 |
Returns the action space's .action_spec(). | def action_spec(self):
return self.action_space.action_spec() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_spec(self):\n return self._action_spec",
"def action_spec(self):\r\n pass",
"def action_spec(self):\n return self._task.action_spec(self._physics_proxy)",
"def action_spec(self) -> Union[dm_env.specs.Array, Dict[str, Any]]:",
"def action_space(self):\n return self.env_spe... | [
"0.8809161",
"0.78634095",
"0.76465696",
"0.7583739",
"0.7348677",
"0.7348677",
"0.67827964",
"0.6751873",
"0.674032",
"0.6714962",
"0.6714962",
"0.6714962",
"0.6714962",
"0.6714962",
"0.6714962",
"0.67078966",
"0.6590928",
"0.65617687",
"0.6530473",
"0.6525313",
"0.65097964"... | 0.9336941 | 0 |
construct the TDI channels for the GW | def construct_TDI(self, t, Orbit):
self.make_padded_delta_l(t)
p12 = td.Phase(1,2, t, self.delta_l_padded[0,1,:])
p21 = td.Phase(2,1, t, self.delta_l_padded[1,0,:])
p13 = td.Phase(1,3, t, self.delta_l_padded[0,2,:])
p31 = td.Phase(3,1, t, self.delta_l_padded[2,0,:])
p23 = td.Phase(2,3, t, self.delta_l_padded... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args):\n moose.HHChannel.__init__(self,*args)\n self.Ek = VKDR\n self.Gbar = GKDR\n self.addField('ion')\n self.setField('ion','K')\n self.Xpower = 1 # This will create HHGate instance xGate inside the Na channel\n #self.Ypower = 0 # This will cr... | [
"0.5761025",
"0.5648041",
"0.552833",
"0.5464387",
"0.5439162",
"0.5413425",
"0.54009414",
"0.5372796",
"0.53710234",
"0.53192246",
"0.53065294",
"0.5300898",
"0.52855635",
"0.5250416",
"0.52360976",
"0.5215159",
"0.5206896",
"0.5185925",
"0.5179284",
"0.51748514",
"0.5171202... | 0.59184283 | 0 |
Get a person for a given fingerprint if one exists, otherwise, create one. | def getPerson(self, fingerprint):
if fingerprint in self.people:
p = self.people[fingerprint]
else:
p = Person.Person(fingerprint)
self.people[fingerprint] = p
return p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(person):\n lname = person.get(\"lname\", None)\n fname = person.get(\"fname\", None)\n\n # Does the person exist already?\n if lname not in PEOPLE and lname is not None:\n PEOPLE[lname] = {\n \"lname\": lname,\n \"fname\": fname,\n \"timestamp\": get_t... | [
"0.60825276",
"0.5761491",
"0.5660589",
"0.5561841",
"0.5517503",
"0.5465323",
"0.54425377",
"0.539449",
"0.53940475",
"0.5333214",
"0.5301308",
"0.52989453",
"0.52861255",
"0.52856296",
"0.52726805",
"0.5227432",
"0.5225671",
"0.52249604",
"0.5214993",
"0.5212618",
"0.520823... | 0.75852203 | 0 |
Setup the Transactions Widget | def setupWidgets(self):
self.transactionMenuWidget = TransactionMenuWidget(self)
self.transactionTableWidget = TransactionAccountTableWidget(self.transactionMenuWidget)
self.transactionMenuWidget.table = self.transactionTableWidget
return self.transactionTableWidget, self.transaction... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __create_transaction(self):\n log.debug(\"Displaying __create_transaction\")\n # Make the admin select an user\n user = self.__user_select()\n # Allow the cancellation of the operation\n if isinstance(user, CancelSignal):\n return\n # Create an inline keyboa... | [
"0.58572197",
"0.56302047",
"0.56272703",
"0.5622398",
"0.5436819",
"0.54295284",
"0.53316",
"0.5287269",
"0.5278643",
"0.5274286",
"0.523717",
"0.519974",
"0.51756734",
"0.516667",
"0.5150923",
"0.5136171",
"0.5133211",
"0.5128938",
"0.51245594",
"0.51102644",
"0.51097506",
... | 0.67058164 | 0 |
Set the toolbar for the widget | def setToolbar(self, toolbar):
self.toolbar = toolbar
self.transactionTableWidget.toolbar = toolbar | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_toolbar(self):\n raise NotImplementedError",
"def createToolBar(self):\n pass",
"def addToolBarButtons(self):",
"def toolbar_init(self):\n self.toolbar = self.iface.addToolBar(self.name)\n self.toolbar.setObjectName('mEasySearchToolBar')\n\n self.searchText = QLine... | [
"0.77686244",
"0.74758184",
"0.7378657",
"0.7309168",
"0.7283618",
"0.7246372",
"0.7229405",
"0.7197912",
"0.70929486",
"0.7062872",
"0.70209247",
"0.70029336",
"0.6999142",
"0.6946386",
"0.69310397",
"0.69114834",
"0.6887178",
"0.68804365",
"0.68129605",
"0.67939806",
"0.678... | 0.8130128 | 0 |
Return a candidate for `editables` package | def editables_candidate(environment: BaseEnvironment) -> Candidate | None:
repository = environment.project.get_repository()
return next(iter(repository.find_candidates(parse_requirement("editables"))), None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def should_install_editables(self) -> bool:\n if not self.install_self or \"editables\" in self.requested_candidates:\n return False\n # As editables may be added by the backend, we need to check the metadata\n metadata = self.self_candidate.prepare(self.environment).metadata\n ... | [
"0.64661247",
"0.5424477",
"0.5384527",
"0.5197192",
"0.5187644",
"0.49681184",
"0.49205258",
"0.48152128",
"0.4792425",
"0.47796872",
"0.47498724",
"0.47370562",
"0.47071728",
"0.46999294",
"0.4668866",
"0.46664396",
"0.4658295",
"0.46545556",
"0.46394503",
"0.46315238",
"0.... | 0.7668769 | 0 |
Return the candidate for self project | def self_candidate(self) -> Candidate:
return self.environment.project.make_self_candidate(not self.no_editable) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def candidate(self):\n return Candidate(self.lan_address, self.tunnel)",
"def __get_project_version__(self):\n api = FortifyApi(self.ssc_server, token=self.token, verify_ssl=False)\n try:\n response = api.get_project_versions() # api should support a search expression here. alas.... | [
"0.6132052",
"0.58670956",
"0.5773933",
"0.5742885",
"0.5729504",
"0.55947673",
"0.55636394",
"0.55636394",
"0.55636394",
"0.55636394",
"0.55636394",
"0.553479",
"0.55334324",
"0.55334324",
"0.55283254",
"0.55283254",
"0.55283254",
"0.55283254",
"0.55283254",
"0.55283254",
"0... | 0.74467826 | 0 |
Return whether to add editables | def should_install_editables(self) -> bool:
if not self.install_self or "editables" in self.requested_candidates:
return False
# As editables may be added by the backend, we need to check the metadata
metadata = self.self_candidate.prepare(self.environment).metadata
return an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_edit(self):\n return self._can_edit",
"def is_edit(self):\n return self._tag == 'edit'",
"def IsEditable(self):\r\n\r\n return self._edit",
"def is_editable ( self, object ):\n return self.editable",
"def is_editable ( self, object ):\n return self.editable",
"d... | [
"0.73451",
"0.7244463",
"0.71304727",
"0.68518156",
"0.68518156",
"0.67802304",
"0.6744704",
"0.6730373",
"0.664077",
"0.66321915",
"0.65577245",
"0.6522502",
"0.6461177",
"0.64094543",
"0.63957936",
"0.6336702",
"0.63033575",
"0.63018876",
"0.6287476",
"0.6285034",
"0.625816... | 0.7379553 | 0 |
Compares the candidates and return (to_add, to_update, to_remove) | def compare_with_working_set(self) -> tuple[list[str], list[str], list[str]]:
working_set = self.working_set
candidates = self.candidates.copy()
to_update: set[str] = set()
to_remove: set[str] = set()
locked_repository = self.environment.project.locked_repository
all_cand... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateCandidates(self):\n\t\tprint(\"Candidate list:\\n\")\n\t\tkeys = list(self.prune_list.keys())\n\t\ttuple_count = len(keys[0])\n\t\tprune_list = {}\n\t\ttup = []\n\t\tfor v in comb(keys, 2):\n\t\t\ta = set(v[0])\n\t\t\tb = set(v[1])\n\t\t\t\n\t\t\t# If there's as many common element in a & b as one less... | [
"0.5868624",
"0.5730036",
"0.55565125",
"0.54972184",
"0.5403647",
"0.53325695",
"0.5316182",
"0.5294268",
"0.52774125",
"0.5261165",
"0.5250778",
"0.52466774",
"0.52311504",
"0.52016383",
"0.51915073",
"0.5186809",
"0.5167677",
"0.5114967",
"0.5099343",
"0.5089879",
"0.50571... | 0.6660743 | 0 |
Synchronize the working set with pinned candidates. | def synchronize(self) -> None:
to_add, to_update, to_remove = self.compare_with_working_set()
manager = self.manager
for key in to_add:
can = self.candidates[key]
termui.logger.info("Installing %s@%s...", key, can.version)
manager.install(can)
for key ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pinned_by_index(self, ids, pinned=True):\n\n if isinstance(ids, (int, long)):\n ids = [ids]\n\n ids = [int(id) for id in ids]\n\n update_result = self.update_many({ '$and': [{ pair_data.SEQUENCE: { '$in': ids } }, { pair_data.PROPERTIES + '.' + pair_data.DISABLED: False }] }... | [
"0.5826798",
"0.55803674",
"0.5470072",
"0.54700255",
"0.5437548",
"0.54035646",
"0.53825516",
"0.53584146",
"0.5334463",
"0.5295911",
"0.5295911",
"0.5276772",
"0.52271056",
"0.5198252",
"0.5193227",
"0.5109528",
"0.5103735",
"0.5052108",
"0.5042737",
"0.5042737",
"0.5042737... | 0.6822805 | 0 |
Locking Windows workstation, doesn't work with Windows 10 `return` None | def lock():
from .os9 import OS
if OS.windows_version and (OS.windows_version != 10):
import ctypes
ctypes.windll.LockWorkStation() # todo fix Windows 10
else:
raise OSError("Locking work only on Windows < 10") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_lock(self, **kwargs: Any) -> None:\n if not await self._node.secure_lock():\n raise HomeAssistantError(f\"Unable to lock device {self._node.address}\")",
"def lock_control(self):\n raise NotImplementedError('PlatformService: Implementation incomplete')",
"def lock(self)... | [
"0.6500462",
"0.644208",
"0.6151031",
"0.61414665",
"0.61400294",
"0.6129143",
"0.60109115",
"0.6010749",
"0.59913135",
"0.5987459",
"0.5982672",
"0.5936663",
"0.59102434",
"0.5869604",
"0.5791526",
"0.5789191",
"0.5776721",
"0.5757117",
"0.57408684",
"0.57161576",
"0.5693854... | 0.8388481 | 0 |
Fix UnicodeConsoleError on old versions of Python `return` int, current code_page number | def fix_unicode_encode_error(cls, safe=False):
from .path9 import Path
from .file9 import File
from .print9 import Print
lockfile = Path.combine(Path.commands(), ".windows_codepage_lock")
if File.exist(lockfile):
cp = cls.get_cmd_code_page()
if not safe:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unilimit():\n return sys.maxunicode",
"def set_code_page(self, val=0):\n if val > 47:\n val = 47\n self.write(self.ASCII_ESC, 't', val)",
"def test_unicode_insert_error():\n# In addition, we should use vagrant or azure deployments of the scanner to Ubuntu and Windows virtual mac... | [
"0.58098614",
"0.54444087",
"0.5437193",
"0.5213224",
"0.51292795",
"0.5108142",
"0.50998247",
"0.50389427",
"0.5015508",
"0.49207443",
"0.48988217",
"0.4892291",
"0.48469642",
"0.48346668",
"0.48196748",
"0.48115703",
"0.48088402",
"0.47937372",
"0.47937372",
"0.47356668",
"... | 0.73191494 | 0 |
Creates or removes user using net user command `param username` string `param password` string `param create` boolean, True for create user `param remove` boolean, True for remove user `param retry_cnt` int, internally used to not raise RecursionError `return` None | def _user(self, username, password=None, create=False, remove=False, retry_cnt=0):
import subprocess
from .console9 import Console
retry_times = 5
if not isinstance(username, str):
raise TypeError(f"Username must be string, got {username}, of {type(username)}")
try:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeOnUserCreate(call, args=(), kwargs={}, nodeClass='*'):\n pass",
"def task_create_user(task: Task, username, password, userclass='super-user', crypt_m=crypt.METHOD_MD5):\n logger = logging.getLogger(__name__)\n logger.debug('Create user')\n hash_password = crypt.crypt(password, crypt_m)\n c... | [
"0.621386",
"0.60185933",
"0.597039",
"0.59299827",
"0.59220874",
"0.5819662",
"0.57680565",
"0.5753947",
"0.5740167",
"0.57374555",
"0.57085246",
"0.5695454",
"0.56759125",
"0.5668584",
"0.5645992",
"0.5644883",
"0.5640693",
"0.56367654",
"0.56299824",
"0.56246525",
"0.56147... | 0.80377036 | 0 |
Finds the most suitable question depending on the user's question | def question_finder(self):
with open('Questions.csv', mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
for row in csv_reader:
my_tuple = finding_best_match(row, "Questions", self.question.split(), 2)
self.percentage_list.append(my_tuple)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _choose_best_option(self):",
"def personal_best(scores):\n return max(scores)",
"def personal_best(scores):\n# return sorted(scores, reverse=True)[0]\n return max(scores)",
"def get_random_question(self):\n available_qs = self.available_qs\n if available_qs.exists():\n r... | [
"0.67314726",
"0.6299249",
"0.62579745",
"0.6185649",
"0.613042",
"0.61280864",
"0.6108952",
"0.60766846",
"0.6071969",
"0.60377866",
"0.6037455",
"0.6020379",
"0.5987506",
"0.5978658",
"0.59747875",
"0.59385544",
"0.593688",
"0.5928864",
"0.59230334",
"0.59189516",
"0.582348... | 0.64845645 | 1 |
Tests that workers can be removed and added to a placement group. | def test_placement_group(ray_start_2_cpus):
num_workers = 2
bundle = {"CPU": 1}
bundles = [bundle.copy() for _ in range(num_workers)]
placement_group = ray.util.placement_group(bundles)
wg = WorkerGroup(num_workers=num_workers, placement_group=placement_group)
wg.remove_workers([0])
wg.add_w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_workers(self):\n wr = WorkflowRuner(4)\n try:\n wr.init_workers()\n assert wr.workers_available() == 4\n wr.acquire_worker()\n assert wr.workers_available() == 3\n wr.acquire_worker()\n assert wr.active_workers()\n ... | [
"0.6219719",
"0.6109334",
"0.606699",
"0.5987546",
"0.58883995",
"0.5822692",
"0.55271554",
"0.55271554",
"0.54891574",
"0.54631734",
"0.54560745",
"0.543836",
"0.5429071",
"0.5388731",
"0.53817356",
"0.5380961",
"0.5372992",
"0.53726965",
"0.5370699",
"0.53469837",
"0.534254... | 0.6604768 | 0 |
Perform Lowess regression and determine a confidence interval by bootstrap resampling | def lowess_per_col(df, columns, bootstrap_iters=config['bootstrap_iters'], conf_interval=0.95, lowess_kw=None, clip_to_zero=True):
# add missing days in index
df = df.astype(pd.Float64Dtype()).resample('D').mean().sort_index()
df_ret = pd.DataFrame(index=df.index)
if lowess_kw is None:
lowess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_lowess(x, y, span=0.75):\n # Ensure that Inf/-Inf values are substituted\n x[where_na_like(x)] = robj.NA_Real\n y[where_na_like(x)] = robj.NA_Real\n data = robj.DataFrame({\"x\": x, \"y\": y})\n print \"x: \", x, \"y: \", y\n lowess_fit = r.lowess(data, f=span)\n print \"LOWESS FIT: \"... | [
"0.6758221",
"0.6304273",
"0.6010935",
"0.5735404",
"0.564534",
"0.5635115",
"0.5631595",
"0.5591594",
"0.5572927",
"0.55028504",
"0.54698086",
"0.54606825",
"0.54158086",
"0.54153687",
"0.5406309",
"0.539751",
"0.53848636",
"0.5379294",
"0.53744525",
"0.53711545",
"0.5337173... | 0.64970994 | 1 |
minimize energy using specified force field | def minimize( self, field = "UFF" ) :
if self._verbose : sys.stdout.write( "%s.minimize(%s)\n" % (self.__class__.__name__,field,) )
if not str( field ).upper() in ("UFF","MMFF94","MMFF94S") :
return
rc = rdkit.Chem.AllChem.EmbedMolecule( self._mol )
if rc < 0 :
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimize(self):\n prm = (self.b,self.c)\n d = self.d\n no = int(d*d)\n bounds = [(-1,1)]*no\n resG = differential_evolution(inpSc.entBias, bounds, args = prm, popsize = 40, disp = False)\n\n xOpt = resG.x\n xOpt = xOpt/(np.linalg.norm(xOpt))\n\n #Refine t... | [
"0.59199595",
"0.5730328",
"0.5722699",
"0.57207024",
"0.57192516",
"0.5717849",
"0.5659899",
"0.5603738",
"0.5585563",
"0.55796784",
"0.55714196",
"0.5560932",
"0.55557203",
"0.55506927",
"0.5547619",
"0.55321956",
"0.55314606",
"0.55159235",
"0.5508471",
"0.55071133",
"0.55... | 0.66796374 | 0 |
turn turtle through random angle and move forward by random distance | def random_move(turtle, distance):
angle = uniform(-90,90)
d = uniform(0,distance)
turtle.left(angle)
turtle.forward(d) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_walk(turtle, distance, steps):\n turtle.color(randcolor(), randcolor())\n for step in range(0,steps):\n random_move(turtle, distance)\n gohome(turtle)",
"def randomWalk(t, turns, distance=20):\n for x in range(turns):\n if x % 2 == 0:\n t.left(random.randint(-180, 180))\n ... | [
"0.78885955",
"0.72433734",
"0.7035755",
"0.6793863",
"0.67724127",
"0.6653956",
"0.6522681",
"0.64809996",
"0.64577115",
"0.6438979",
"0.6433852",
"0.6380146",
"0.6327577",
"0.6319811",
"0.6290771",
"0.62538165",
"0.6241197",
"0.6203124",
"0.6183504",
"0.61306936",
"0.612730... | 0.8367851 | 0 |
send turtle home without leaving a track. | def gohome(turtle):
turtle.penup()
turtle.goto(0,0)
turtle.pendown() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unaway(self):\n self.away()",
"def home(self):\n self.__send_short(self.MGMSG_MOT_MOVE_HOME, self.__chan, 0x00)",
"def go_home(self):\n self.move_wl(0)",
"def quit():\n #quits from python turtle graphics screen\n bye()",
"def minusToHome():\n\tif (not checkMotorsInPosition(-134.7... | [
"0.6690491",
"0.66595733",
"0.6451882",
"0.6384568",
"0.6231575",
"0.61711967",
"0.6103176",
"0.6005715",
"0.5995122",
"0.5929234",
"0.5867786",
"0.5866304",
"0.58571506",
"0.58571506",
"0.5801882",
"0.5792677",
"0.57789934",
"0.5763248",
"0.57435405",
"0.56998914",
"0.569127... | 0.6899787 | 0 |
Send turtle on random walk. | def random_walk(turtle, distance, steps):
turtle.color(randcolor(), randcolor())
for step in range(0,steps):
random_move(turtle, distance)
gohome(turtle) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomWalk(t, turns, distance=20):\n for x in range(turns):\n if x % 2 == 0:\n t.left(random.randint(-180, 180))\n else:\n t.right(random.randint(-180, 180))\n t.forward(random.randint(1,distance))\n sleep(10)",
"def random_move(turtle, distance):\n angle = u... | [
"0.66989535",
"0.6635541",
"0.6253764",
"0.6204541",
"0.6170472",
"0.61619025",
"0.60066295",
"0.6003084",
"0.592944",
"0.5927971",
"0.5923337",
"0.5908255",
"0.5890599",
"0.5831969",
"0.58243126",
"0.57797945",
"0.5777172",
"0.5768627",
"0.5757491",
"0.5730236",
"0.57047004"... | 0.7667347 | 0 |
Calls the main method of boba_blast_game. | def main():
boba_blast_game.main() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n game = Blackjack()\n game.play()",
"def main():\r\n gameclass = data.game.GameClass()\r\n gameclass.main_loop()",
"def main():\n\n name, game = select_game(vgc.KNOWN_GAMES)\n print('---- Launching: %s -----'%name)\n game.game.main()\n sys.exit(0)",
"def main(genomes, con... | [
"0.688537",
"0.68727857",
"0.6781425",
"0.67596585",
"0.6711076",
"0.6701792",
"0.6665099",
"0.6600859",
"0.6539192",
"0.6538684",
"0.65339047",
"0.65240175",
"0.64471304",
"0.6444534",
"0.6438802",
"0.6429442",
"0.64275426",
"0.64104044",
"0.63834345",
"0.63362175",
"0.63216... | 0.92944795 | 0 |
Sets the total number of segments. Total lights is segments lights_per_segment. | def set_segments(self, segments):
self.send_command(Command.SET_SEGMENT_COUNT, [segments]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_calculated_segments(self, total_lights, segments):\n self.set_segments(segments)\n self.set_lights_per_segment(int(total_lights / segments))",
"def numSegments(self):\n\n return self.getHierView().numSegments()",
"def total_segments(self):\n return self._total_segments",
"def getS... | [
"0.80265206",
"0.6519059",
"0.6458358",
"0.64582366",
"0.6218653",
"0.6186955",
"0.6182732",
"0.5820238",
"0.5799442",
"0.5766202",
"0.5680592",
"0.56646997",
"0.56240666",
"0.5577389",
"0.5569977",
"0.5512702",
"0.5462627",
"0.54069006",
"0.5402756",
"0.53012836",
"0.5269967... | 0.7344844 | 1 |
Sets the number of lights per segment. Total lights is segments lights_per_segment. | def set_lights_per_segment(self, lights_per_segment):
lights_per_segment_data = list(lights_per_segment.to_bytes(2, byteorder='little'))
self.send_command(Command.SET_LIGHTS_PER_SEGMENT, lights_per_segment_data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_calculated_segments(self, total_lights, segments):\n self.set_segments(segments)\n self.set_lights_per_segment(int(total_lights / segments))",
"def set_segments(self, segments):\n self.send_command(Command.SET_SEGMENT_COUNT, [segments])",
"def setSegmentWidth(self, width):\n for segment... | [
"0.73913884",
"0.6605677",
"0.6090696",
"0.5601844",
"0.5569968",
"0.5542519",
"0.54887503",
"0.54841375",
"0.5475378",
"0.5410733",
"0.5394781",
"0.53599715",
"0.5306414",
"0.52734154",
"0.524622",
"0.5213139",
"0.51889354",
"0.516168",
"0.516168",
"0.5159761",
"0.5147337",
... | 0.74645954 | 0 |
Helper function to automatically set the number of segments and lights per segment to reach the target total lights (rounded down to never exceed total_lights) Usually you know the total number of lights you have available on a light strip and want to split it into segments that take up the whole strip | def set_calculated_segments(self, total_lights, segments):
self.set_segments(segments)
self.set_lights_per_segment(int(total_lights / segments)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_lights_per_segment(self, lights_per_segment):\n lights_per_segment_data = list(lights_per_segment.to_bytes(2, byteorder='little'))\n self.send_command(Command.SET_LIGHTS_PER_SEGMENT, lights_per_segment_data)",
"def set_segments(self, segments):\n self.send_command(Command.SET_SEGMENT_COUNT, [seg... | [
"0.6433025",
"0.5595115",
"0.5342077",
"0.5298038",
"0.529081",
"0.51692903",
"0.5143708",
"0.5122372",
"0.51086843",
"0.50751066",
"0.50478613",
"0.4991986",
"0.4959417",
"0.49574372",
"0.4930397",
"0.48701617",
"0.48667127",
"0.48576367",
"0.4856589",
"0.48507276",
"0.48469... | 0.76291007 | 0 |
Returns a validation function for fields that just need to be cast to a particular type. | def cast_validator(caster):
def validator(value):
try:
return caster(value)
except ValueError:
raise ValidationError()
return validator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_func(fieldname):\n if fieldname.startswith('_'):\n return False\n value = getattr(class_, fieldname)\n \n return isinstance(value, type)",
"def validate(t):\n return _dispatcher[type(t)](t)",
"def _cast_field(self, cast_to, value):\n if cast_to in (in... | [
"0.6154744",
"0.61429405",
"0.59886944",
"0.577651",
"0.5650325",
"0.5647921",
"0.5646797",
"0.56325793",
"0.5558071",
"0.5545803",
"0.5538549",
"0.55111736",
"0.5508241",
"0.548497",
"0.5467585",
"0.5459245",
"0.54430234",
"0.5440437",
"0.5401599",
"0.53796715",
"0.5367094",... | 0.6692728 | 0 |
Devuelve una lista con los partidos que se pueden jugar sin que coincida alguno que este en juego | def get_partidos_espera_equipos_no_jugando_list(fase):
partidos_espera_list = get_partidos_espera_list(fase)
partidos_jugando_list = get_partidos_jugando_list(fase)
equipos_jugando = []
for partido_jugando in partidos_jugando_list:
equipos_jugando.append(partido_jugando.equipo_local)
equipos_jugando.append(part... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_partidos_con_campos_para_forzar(fase):\n\tpartidos_espera_list = get_partidos_espera_list(fase)\n\tcampos_para_forzar_list = CampoController.get_campos_para_forzar(fase)\n\tpartido_campo = []\n\tfor x in range(0, len(partidos_espera_list)):\n\t\taux = [partidos_espera_list[x], campos_para_forzar_list[x]]\n... | [
"0.6413991",
"0.6191988",
"0.60349923",
"0.60153407",
"0.5992194",
"0.59495085",
"0.588866",
"0.58527535",
"0.5836585",
"0.5836233",
"0.5734299",
"0.5733459",
"0.5731731",
"0.5705199",
"0.5682125",
"0.5680923",
"0.56652087",
"0.5656599",
"0.56458247",
"0.5629024",
"0.5614137"... | 0.6662118 | 0 |
Devuelve una lista de listas con los partidos que se pueden jugar en los campos disponibles [[partido,[campo,campo]],[partido,[campo]],[partido,[]]...] | def get_partidos_con_campos_para_forzar(fase):
partidos_espera_list = get_partidos_espera_list(fase)
campos_para_forzar_list = CampoController.get_campos_para_forzar(fase)
partido_campo = []
for x in range(0, len(partidos_espera_list)):
aux = [partidos_espera_list[x], campos_para_forzar_list[x]]
partido_campo.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Obtener_Lista(self):\n\t\treturn [self,self.Nombre+\" \"+self.Apellido,self.ID,self.Fecha, \n\t\tself.Edad,self.Test,self.Posicion,self.Prioridad,self.Progreso,self.Informe]",
"def create(data):\n \n return Partlist(\n list_id = data['id'],\n name = data['name'],\n ... | [
"0.57043856",
"0.556433",
"0.54877603",
"0.5456322",
"0.54476345",
"0.5342808",
"0.52981555",
"0.5272106",
"0.52518976",
"0.5249799",
"0.5224575",
"0.5204291",
"0.5182426",
"0.51744527",
"0.5125516",
"0.50919276",
"0.50887084",
"0.50761926",
"0.5071486",
"0.5049791",
"0.50497... | 0.6551099 | 0 |
this function setup the working editing environment. the working copy and the display copy are temporary meshes used to make and previzualize the mesh edit. if working_copy and display_copy are let as None, the function will duplicate the specified one. the original mesh is hidden during the procedure (lodVisibility) t... | def setup_working_copy(mesh, working_copy=None, display_copy=None):
original_mesh = pm.PyNode(mesh)
working_copy = pm.PyNode(working_copy) if working_copy else original_mesh.duplicate()[0]
display_copy = pm.PyNode(display_copy) if display_copy else original_mesh.duplicate()[0]
# clean intermediate dupl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_edit_target_working_copy(working_copy):\n working_copy = pm.PyNode(working_copy)\n original_mesh = working_copy.attr(WORKING_MESH_ATTR).listConnections()[0]\n display_copy = [\n node for node in original_mesh.message.listConnections()\n if node.hasAttr(DISPLAY_MESH_ATTR)][0]\n\n ... | [
"0.63739365",
"0.5783596",
"0.57017773",
"0.56759536",
"0.559187",
"0.55121773",
"0.5475678",
"0.54687613",
"0.54562217",
"0.5384936",
"0.5377562",
"0.53599006",
"0.5355762",
"0.5298754",
"0.52330977",
"0.5219615",
"0.5203588",
"0.5160811",
"0.51599705",
"0.5137761",
"0.51247... | 0.760096 | 0 |
this function's querying the working shaders transparency | def get_working_copys_transparency():
if not pm.objExists(WORKING_MESH_SHADER):
return 0.0
if not pm.objExists(DISPLAY_MESH_SHADER):
return 0.0
working_copy_shader = pm.PyNode(WORKING_MESH_SHADER)
return working_copy_shader.transparency.get()[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_shaders(self):\n raise NotImplementedError()",
"def bs_getShaders(obj):\n pm.select(obj)\n pm.windows.hyperShade(shaderNetworksSelectMaterialNodes=True)\n return pm.ls(sl=True) # Returns all shaders associated with the object (shape, face etc)",
"def needShader(self):\n retu... | [
"0.6418578",
"0.59698147",
"0.5857125",
"0.5815028",
"0.57760465",
"0.57740855",
"0.5773778",
"0.5742842",
"0.57384694",
"0.5729022",
"0.5699474",
"0.5675983",
"0.55823433",
"0.552883",
"0.5476394",
"0.53978384",
"0.5387486",
"0.53656816",
"0.5344783",
"0.5331772",
"0.5288957... | 0.6509732 | 0 |
this function return a list off all corrective blendshapes present in the history | def get_corrective_blendshapes(mesh):
original_mesh = pm.PyNode(mesh)
# retrieve the blendhspae connected to message combined to a listHistory.
# This is to keep the history order, but be sure the blendshape is
# from the good mesh in complexe setup
# (there's probably smarter way to get this info .... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_drawables(self):\n to_draw = []\n for k,v in self._to_draw.items():\n if isinstance(v,Iterable):\n for i in v:\n to_draw.append(i)\n else:\n to_draw.append(v)\n return to_draw",
"def get_all_drawables(self): \n ... | [
"0.58395505",
"0.57398987",
"0.56544673",
"0.56223506",
"0.56018806",
"0.55643356",
"0.550537",
"0.5461763",
"0.5438106",
"0.537618",
"0.5337154",
"0.5313324",
"0.5233247",
"0.52197796",
"0.52173",
"0.52135295",
"0.51914734",
"0.51755005",
"0.51694417",
"0.516461",
"0.5160937... | 0.70543814 | 0 |
this function's creating a new corrective blendshape on a mesh and add the first target | def create_blendshape_corrective_on_mesh(base, target, values=None):
base = pm.PyNode(base)
target = pm.PyNode(target)
name = base.name() + '_' + CORRECTIVE_BLENDSHAPE_NAME
corrective_blendshape = pm.blendShape(
target, base, name=name, before=True, weight=(0, 1))[0]
pm.addAttr(
co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_target_relative(blendshape, target, base):\n target = pm.PyNode(target)\n base = pm.PyNode(base)\n\n blendshape = pm.PyNode(blendshape)\n intermediate = pm.createNode('mesh')\n in_mesh = blendshape.input[0].inputGeometry.listConnections(plugs=True)[0]\n in_mesh >> intermediate.inMesh\n ... | [
"0.6711063",
"0.6658462",
"0.62921524",
"0.61332536",
"0.6096914",
"0.6069851",
"0.5827134",
"0.5790134",
"0.57406753",
"0.56382924",
"0.56141907",
"0.5613024",
"0.5524236",
"0.539814",
"0.53477067",
"0.53387904",
"0.5316562",
"0.5306251",
"0.53047395",
"0.5282351",
"0.526811... | 0.7454908 | 0 |
this function apply a target edit. To do that, it retrieve information about the setup from the working copy. Set the blendshapetarget to 0.0 and use the display copy to to calculate the relative target mesh. Connect the working mesh to the correct blendshape input target to update it. Put back the target value to his ... | def apply_edit_target_working_copy(working_copy):
working_copy = pm.PyNode(working_copy)
original_mesh = working_copy.attr(WORKING_MESH_ATTR).listConnections()[0]
display_copy = [
node for node in original_mesh.message.listConnections()
if node.hasAttr(DISPLAY_MESH_ATTR)][0]
blendshape ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_target_relative(blendshape, target, base):\n target = pm.PyNode(target)\n base = pm.PyNode(base)\n\n blendshape = pm.PyNode(blendshape)\n intermediate = pm.createNode('mesh')\n in_mesh = blendshape.input[0].inputGeometry.listConnections(plugs=True)[0]\n in_mesh >> intermediate.inMesh\n ... | [
"0.7205038",
"0.6527636",
"0.619142",
"0.61317325",
"0.61252636",
"0.60388786",
"0.60315895",
"0.5888716",
"0.5882017",
"0.5730183",
"0.5707208",
"0.5682918",
"0.5682918",
"0.5682918",
"0.562668",
"0.56239176",
"0.5605893",
"0.56057197",
"0.55445147",
"0.5492403",
"0.5480601"... | 0.7925773 | 0 |
the function is setting the target relative to the base if a blendshape exist to avoid double transformation when the target is applyied | def set_target_relative(blendshape, target, base):
target = pm.PyNode(target)
base = pm.PyNode(base)
blendshape = pm.PyNode(blendshape)
intermediate = pm.createNode('mesh')
in_mesh = blendshape.input[0].inputGeometry.listConnections(plugs=True)[0]
in_mesh >> intermediate.inMesh
intermediate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blendShapeTargetOff():\n obj = cmds.ls(selection = True)\n try:\n history = cmds.listHistory(obj)#cmds.listHistory(obj[0]) #IndexError\n bsHistory = cmds.ls(history, type = 'blendShape')\n blendNode = bsHistory[0] #assuming exists, would change this to allow multiple blendnodes on ... | [
"0.71091115",
"0.6991181",
"0.64935154",
"0.63196504",
"0.63059753",
"0.6263836",
"0.6047045",
"0.5994624",
"0.5924033",
"0.59147483",
"0.58045244",
"0.5802666",
"0.57638884",
"0.5715132",
"0.5671903",
"0.54479146",
"0.5425262",
"0.54149354",
"0.537874",
"0.5377974",
"0.53639... | 0.7834626 | 0 |
this function will apply an animation on the blendshape target index given. the value is an float array. It represent a value at frame. the array middle value is the value set at the current frame. | def apply_animation_template_on_blendshape_target_weight(
blendshape, target_index, values=None):
if values is None or not any(1 for v in values if v is not None):
return
blendshape = pm.PyNode(blendshape)
startframe = int(pm.env.time - float(len(values) / 2) + .5)
endframe = int(pm.env... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_anim(frame, self):\n self.step()\n self.im.set_data(self.array)\n self.im2.set_data(self.array2)",
"def setKeyframeBlendshapeTargetWts(*args, **kwargs)->int:\n pass",
"def animate(i):\r\n plot_x.set_data(history_samples[i][:, 0], history_samples[i][:, 1])",
"def animate(... | [
"0.5791562",
"0.57343787",
"0.566798",
"0.55785465",
"0.5510253",
"0.548536",
"0.54101354",
"0.54016936",
"0.5284448",
"0.5279103",
"0.52705723",
"0.52331376",
"0.52145934",
"0.52145934",
"0.52145934",
"0.52145934",
"0.52145934",
"0.52145934",
"0.52145934",
"0.52145934",
"0.5... | 0.68115395 | 0 |
Gets the patient's name that corresponds to the middle element of the ascending sorted dataset and removes it from the original dataset. Returns str A patient's name. | def get_root(self):
sorted_dataset = sorted(self.dataset)
sorted_middle = round(len(sorted_dataset)/2)
root_name = sorted_dataset[sorted_middle]
self.dataset.remove(root_name)
return root_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_patient(self, patient_name):\n for i in range(len(self)):\n selected_patient = self._patient_list[i]\n if patient_name == selected_patient.first_name + \" \" + selected_patient.last_name:\n self._patient_list.pop(i)\n self.calculate_avg_choleste... | [
"0.5810934",
"0.5805565",
"0.58042693",
"0.566957",
"0.5590901",
"0.5570254",
"0.5523924",
"0.54688823",
"0.54443926",
"0.54165536",
"0.5403828",
"0.54019153",
"0.5388947",
"0.538858",
"0.5374304",
"0.53670865",
"0.53654516",
"0.53612906",
"0.5355656",
"0.53492683",
"0.533418... | 0.64768195 | 0 |
Build section list iterators. This defines the 'all', SectionList, but subclasses may want to define others. If overriden, call Cell.build_subsets(self) to create the 'all' SectionList. For example, in a subclass with two dendrites, ``self.dend[0]`` and ``self.dend[1]`` already defined, | def build_subsets(self):
self.all = nrn.SectionList()
self.all.wholetree(sec=self.soma) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_subsets(self):\n\t\tself.all = h.SectionList()\n\t\tself.all.wholetree(sec=self.soma)\n\n\t\t# morphological section lists\n\t\tself.axon_list = []\n\t\tself.axosomatic_list = []\n\t\tself.apicalshaftoblique_list = []\n\t\tself.apicaltree_list = []\n\t\tself.tuft_list = []\n\t\tself.soma_list = []\n\t\ts... | [
"0.70318437",
"0.56204474",
"0.56136185",
"0.5468278",
"0.5414795",
"0.5393099",
"0.52536064",
"0.5245188",
"0.5222482",
"0.51157963",
"0.5082342",
"0.5026361",
"0.49862728",
"0.49832708",
"0.49311948",
"0.48991743",
"0.48990515",
"0.48296484",
"0.48204446",
"0.47816464",
"0.... | 0.70488995 | 0 |
Set the base location in 3D and move all other parts of the cell relative to that location. | def set_position(self, x, y, z):
for sec in self.all:
for i in range(int(nrn.n3d())):
nrn.pt3dchange(i, \
x-self.x+nrn.x3d(i), \
y-self.y+nrn.y3d(i), \
z-self.z+nrn.z3d(i), \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self):\n x = y = z = 0.0\n for cell in self.cells:\n x += (cell.x)#*n\n y += (cell.y)#*n\n z += (cell.z)#*n\n np = float(len(self.cells))\n med = numpy.array([x/np,y/np,z/np])\n \n dists = []\n for cell in self.cells:\n ... | [
"0.65602946",
"0.6332462",
"0.6299313",
"0.6214739",
"0.60842985",
"0.6001487",
"0.59758884",
"0.5973578",
"0.5970572",
"0.5963873",
"0.5901554",
"0.58950275",
"0.5894377",
"0.588724",
"0.58816975",
"0.58784765",
"0.58716166",
"0.58222115",
"0.58215046",
"0.57972425",
"0.5787... | 0.65917593 | 0 |
Make a verdict (review) about evidence (plot summary) | def verdict(evidence):
# Import Judge (clf, count_vec) combo
clf, cv = joblib.load(os.path.join(court_path, 'judge.pkl'))
# Use cv to transform the data
# print "Reviewing older cases (transforming summary)"
feats = cv.transform(evidence)
# Use clf to return a verdict
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_predictions(db_filename, predictions):\n\n db = FeverDocDB(db_filename)\n\n for line in predictions:\n\n if line['label'].upper() != \"NOT ENOUGH INFO\":\n macro_rec = evidence_macro_recall(line)\n if macro_rec[0] == 1.0:\n continue\n pages = se... | [
"0.6049976",
"0.5830405",
"0.5796718",
"0.5794875",
"0.5786259",
"0.5688207",
"0.5630599",
"0.56199",
"0.5532559",
"0.5474172",
"0.5469899",
"0.5359818",
"0.5334954",
"0.5316466",
"0.53020394",
"0.5275544",
"0.52595836",
"0.5257258",
"0.52516013",
"0.52433974",
"0.523172",
... | 0.6505017 | 0 |
Create a wrapper object. The herbstclient parameter is the path or command to the 'herbstclient' executable. | def __init__(self, herbstclient='herbstclient'):
self.herbstclient_path = herbstclient
self.env = None
self.proc = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_client(self) -> None:\n pass",
"def client():\n\n client = Client()\n return client",
"def initClient(clientPy, debug):\n\n\tcommandString = cmdStr1 + cmdStr2 + clientPy \n\t\n\tif debug == True:\n\t\tcommandString += debugOption\n\n\tcommandString += cmdStr3 + cmdStr4\n\tsenderFile = os.po... | [
"0.6017079",
"0.59248286",
"0.5667919",
"0.56208587",
"0.5585469",
"0.5585469",
"0.5585469",
"0.5585469",
"0.5585469",
"0.5575246",
"0.55486596",
"0.55400807",
"0.5516568",
"0.5498373",
"0.5455706",
"0.54545105",
"0.54495937",
"0.544281",
"0.5426879",
"0.5399682",
"0.5397584"... | 0.6631895 | 0 |
Establish a persistent pipe | def open_persistent_pipe(self):
if self.proc is not None:
return
self.proc = subprocess.Popen([self.herbstclient_path, '--binary-pipe'],
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pipe(self):\n if self._evdev:\n return None\n\n if not self.__pipe:\n target_function = self._get_target_function()\n if not target_function:\n return None\n\n self.__pipe, child_conn = Pipe(duplex=False)\n self._listener = Pr... | [
"0.64004177",
"0.639925",
"0.63690937",
"0.5897324",
"0.5832477",
"0.58320117",
"0.5791616",
"0.5727768",
"0.5722575",
"0.5649778",
"0.56113935",
"0.55713785",
"0.5493637",
"0.54625785",
"0.54212344",
"0.5419277",
"0.54097885",
"0.54049206",
"0.54004",
"0.53662795",
"0.535091... | 0.7821907 | 0 |
Parse a command (a string using shell quotes or a string list) to a string list. | def _parse_command(self, cmd):
if isinstance(cmd, list):
args = [str(x) for x in cmd]
assert args
else:
args = shlex.split(cmd)
return args | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_commands(command_list: List[str]) -> List[str]:\n return [' '.join(x.split('-')) for x in command_list]",
"def split_command(command): # pylint: disable = redefined-outer-name\n if not check(command):\n raise ValueError(\"Invalid command string %r\" % (command,))\n\n return... | [
"0.7823174",
"0.7776317",
"0.72441226",
"0.6945575",
"0.6874472",
"0.6815853",
"0.6765971",
"0.66985655",
"0.65835774",
"0.6539632",
"0.64418054",
"0.6432521",
"0.6341574",
"0.6335066",
"0.63280106",
"0.6289161",
"0.6239723",
"0.6236774",
"0.6208309",
"0.6175382",
"0.61694527... | 0.8070347 | 0 |
call the command and expect it to have exit code zero and no output on stderr. if allowed_stderr is set, then it should be a regex object (something with .match) that matches every line the command writes to stderr. | def call(self, cmd, allowed_stderr=None):
proc = self.unchecked_call(cmd)
assert proc.returncode == 0
if allowed_stderr is None:
assert not proc.stderr
else:
for line in proc.stderr.splitlines():
assert allowed_stderr.match(line)
return pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ssh_quiet(self, cmd, allow_fail=False):\n try:\n if self.logger is not None:\n self.logger.debug(\"Trying to run remote command: \" + cmd)\n subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)\n return 0\n except subprocess.CalledPro... | [
"0.6786956",
"0.65891504",
"0.6570336",
"0.65138626",
"0.6504166",
"0.64153916",
"0.63777995",
"0.6366225",
"0.63454735",
"0.63017017",
"0.6301021",
"0.62997216",
"0.62994653",
"0.6280087",
"0.6273139",
"0.62721276",
"0.62650084",
"0.6259535",
"0.6258645",
"0.62150574",
"0.61... | 0.77711564 | 0 |
return an attribute proxy | def attr(self) -> 'AttributeProxy':
return AttributeProxy(self, []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxied_attribute(local_attr, proxied_attr, doc):\n def fget(self):\n return getattr(getattr(self, local_attr), proxied_attr)\n def fset(self, value):\n setattr(getattr(self, local_attr), proxied_attr, value)\n def fdel(self):\n delattr(getattr(self, local_attr), proxied_attr)\n ... | [
"0.74008125",
"0.71626693",
"0.71133703",
"0.6959926",
"0.6743147",
"0.6652585",
"0.6652585",
"0.6642129",
"0.65956366",
"0.6556403",
"0.6556403",
"0.6554893",
"0.65547967",
"0.6539085",
"0.6531443",
"0.64536333",
"0.6447431",
"0.6447431",
"0.6397593",
"0.6384589",
"0.6371091... | 0.82309103 | 0 |
\ Sorts a sequence naturally, but returns a list of sorted the indeces and not the sorted list. >>> a = ['num3', 'num5', 'num2'] >>> b = ['foo', 'bar', 'baz'] >>> index = index_natsorted(a) >>> index [2, 0, 1] >>> Sort both lists by the sort order of a >>> [a[i] for i in index] [{u}'num2', {u}'num3', {u}'num5'] >>> [b[... | def index_natsorted(seq, key=lambda x: x, number_type=float, signed=True, exp=True):
from operator import itemgetter
item1 = itemgetter(1)
# Pair the index and sequence together, then sort by
index_seq_pair = [[x, key(y)] for x, y in py23_zip(py23_range(len(seq)), seq)]
try:
index_seq_pair.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def natsorted(lst):\n return sorted(lst, key=natsort_key)",
"def natsort(lst):\n lst.sort(key=natsort_key)",
"def sortn(xs):\n return sorted(xs, key=sortnkey)",
"def natsort(lst: List[str]) -> None:\n lst.sort(key=natsort_key)",
"def test_natsort(self):\r\n # string with alpha and numeri... | [
"0.71554726",
"0.71223307",
"0.6950294",
"0.6690802",
"0.6578798",
"0.6448411",
"0.6346569",
"0.62980795",
"0.62446755",
"0.6215318",
"0.6134285",
"0.6122267",
"0.6091542",
"0.60492563",
"0.6049212",
"0.5961093",
"0.59341216",
"0.5928587",
"0.5909965",
"0.58545345",
"0.584311... | 0.7697194 | 0 |
Return dict where "mods" key is list of mods that are required for this mod and "unknown" is list of unresolved tags | def get_required_mods(self):
mods = []
unknowntags = []
for key, value in self.dependencies.items():
if value.required_by:
if value.provided_by:
mods.append(list(value.provided_by)[0]) #Pick random'ish if more than one.
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_extras_require() -> Dict[str, List[str]]:\n extras = {\n \"testing\": [\n \"pytest==6.1.2\",\n \"pytest-cov==2.10.1\",\n ],\n \"linting\": [\n \"pylint==2.6.0\",\n \"flake8==3.8.4\",\n \"black>=20.8b1\",\n \"darglint=... | [
"0.58910346",
"0.5470786",
"0.5423106",
"0.5401923",
"0.53978574",
"0.52969414",
"0.52674496",
"0.52672464",
"0.5222401",
"0.5176825",
"0.51439786",
"0.5142653",
"0.5135256",
"0.51073176",
"0.5102951",
"0.5099079",
"0.50866705",
"0.5084013",
"0.5081186",
"0.5031833",
"0.50165... | 0.77861726 | 0 |
Check file against hash in DB, return True or False If hash fails it will return False unless approve_if_no_dbhash is set to True | def check_file(self, path, approve_if_no_dbhash=False):
if self.mod.filehash:
h = create_filehash(path)
return h == self.mod.filehash
return approve_if_no_dbhash | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_file(fpath, file_hash, algorithm='auto', chunk_size=65535):\n if (algorithm == 'sha256') or (algorithm == 'auto' and len(file_hash) == 64):\n hasher = 'sha256'\n else:\n hasher = 'md5'\n\n if str(_hash_file(fpath, hasher, chunk_size)) == str(file_hash):\n return True\n ... | [
"0.6844623",
"0.6768648",
"0.6714899",
"0.66696244",
"0.6548771",
"0.6521471",
"0.6502413",
"0.65000165",
"0.63822967",
"0.6339329",
"0.6328425",
"0.63152796",
"0.63009965",
"0.62701625",
"0.6060247",
"0.6058893",
"0.6050215",
"0.6041889",
"0.60401934",
"0.6001659",
"0.598581... | 0.817788 | 0 |
Return download urls for mod archive | def get_urls(self):
if self.mod.filename:
return [x + self.mod.filename for x in self.mod.service.get_mirrors()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_archive_urls(self):\n\n return ['https://zlib.net/']",
"def download_files(self):",
"def download(urls, dest_folder):\n pass",
"def getURLs():",
"def download(self):\r\n \r\n # RAR Files names\r\n if self.debug==0:\r\n rar_files_name = [\"K001.rar\",\"K002.rar\",\"K003.rar\",\... | [
"0.7325805",
"0.6846861",
"0.67655724",
"0.6367063",
"0.629951",
"0.6277359",
"0.6249369",
"0.6169822",
"0.61687994",
"0.6150348",
"0.61188513",
"0.61115414",
"0.6108745",
"0.6097265",
"0.605443",
"0.60416937",
"0.60264397",
"0.5982324",
"0.5973702",
"0.59617615",
"0.5953331"... | 0.71039075 | 1 |
Return random download url for mod archive | def get_url(self):
if self.mod.filename:
return self.mod.service.get_mirror() + self.mod.filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_download_url():\n return _DOWNLOAD",
"def random_url(self, max_url_len = 1024):\n prefix = 'http://'\n suffix = '.com/announce'\n\n rand_url = prefix + self.random_string(max_url_len) + suffix\n\n return rand_url",
"def _create_random_url(self):\n return self._base... | [
"0.6937896",
"0.6526714",
"0.6389202",
"0.63545066",
"0.6113859",
"0.6084389",
"0.6027039",
"0.59930044",
"0.59441596",
"0.5923969",
"0.5903869",
"0.5903465",
"0.59005666",
"0.588482",
"0.5872198",
"0.58475053",
"0.58420855",
"0.5838973",
"0.583334",
"0.58326125",
"0.5827223"... | 0.6733829 | 1 |
Return all modules not in the given category | def get_modules_not_in_category(self, category="framework"):
d = ModEntry.select().where((ModEntry.category.is_null(True)) | (ModEntry.category != category))
L.debug("There a re %s modules not in category %s", d.count(), category)
return [get_modentry(x.id, x) for x in d] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_prune_modules(self, model):\n if (len(self.leaf_modules) == 0):\n self.retrieve_leaf_modules(model)\n self.prune_modules = []\n for name, m in self.leaf_modules:\n # Skip non-prunable layers\n if (hasattr(m, 'unprunable') and m.unprunable):\n ... | [
"0.572595",
"0.54380864",
"0.53923565",
"0.5390141",
"0.5385569",
"0.5384916",
"0.5331064",
"0.52557516",
"0.5243386",
"0.52415895",
"0.5211151",
"0.52079517",
"0.5190338",
"0.5185155",
"0.51582277",
"0.51194507",
"0.51115763",
"0.51008517",
"0.5093182",
"0.50880194",
"0.5084... | 0.9049948 | 0 |
Update the service info from JSON data | def update_service_data(self, data, etag):
self.service.name = data["service"]["name"]
self.service.etag = etag
self.service.set_mirrors(data["service"]["filelocations"])
self.service.torrent = data["service"].get("torrents", "")
self.service.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n self.data_service.update()\n self._state = self.data_service.data[self._json_key]\n self._attributes = self.data_service.attributes[self._json_key]",
"def _update_from_rest_data(self) -> None:",
"def update(self, data):\n if self.service is not None:\n ... | [
"0.72956604",
"0.72252774",
"0.7100562",
"0.70823497",
"0.7081474",
"0.7056474",
"0.7056474",
"0.68808275",
"0.6792271",
"0.6709368",
"0.65237254",
"0.636663",
"0.6300244",
"0.62445045",
"0.6208185",
"0.6043377",
"0.6021284",
"0.6021284",
"0.6021284",
"0.6021284",
"0.59529555... | 0.7532239 | 0 |
Remove old dependency data and set new for given relation | def set_dependency_relation(self, modentry, dependencies, relation):
ModDependency.delete().where(ModDependency.mod == modentry, ModDependency.relation == relation).execute()
for dep in dependencies:
ModDependency.create(mod = modentry, relation = relation, dependency = dep) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_relation(self, qid, relation, qid2):\n if self._kg_symbols is not None:\n self._kg_symbols.remove_relation(qid, relation, qid2)",
"def delete_relation(wn, source, target, change_list=None):\n delete_rel(source, target, change_list)\n delete_rel(target, source, change_list)",
... | [
"0.60783786",
"0.5877068",
"0.5867672",
"0.5787807",
"0.5759382",
"0.57421607",
"0.57307947",
"0.5673872",
"0.5592808",
"0.5512539",
"0.55114365",
"0.54950035",
"0.54892606",
"0.5474868",
"0.5470765",
"0.5413691",
"0.5383489",
"0.53541964",
"0.5335916",
"0.5314704",
"0.530802... | 0.6606034 | 0 |
Create or update a mod instance in DB | def save_mod_instance(self, mod):
modentry, created = ModEntry.get_or_create(name=mod["name"], service=self.service)
# Optional entries
for field in ["version", "description", "filehash", "filesize", "homepage", "author", "category", "filename", "magnet", "torrent"]:
if mod.get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _write_to_db(self, instance: DBModelInstance) -> None:\n self.db.session.add(instance)\n self.db.session.commit()",
"def model_update(self, db):\n db.session.commit()",
"def save(self):\n if self.id:\n self.update()\n else:\n self.create()",
"def u... | [
"0.6570164",
"0.6269867",
"0.6225266",
"0.5984104",
"0.5951839",
"0.5951839",
"0.5923331",
"0.58231235",
"0.5737669",
"0.5735529",
"0.5707123",
"0.56908387",
"0.5678183",
"0.5642609",
"0.56411576",
"0.56343305",
"0.5618928",
"0.5608288",
"0.55973965",
"0.55951864",
"0.5586967... | 0.67966545 | 0 |
Initialize an embedding optionally by providing the embedding matrix and vocab | def __init__(self, matrix=None, vocab=None):
self._matrix = matrix
self.vocab = vocab
if matrix is not None:
if vocab is None:
raise TypeError(
'vocab cannot be None if matrix is provided')
if matrix.shape[0] != len(vocab):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embedding_setup(self, embedding, emb_trainable):\n if emb_trainable == True:\n emb_variable = tf.get_variable(\n name=\"embedding_matrix\", shape=embedding.shape,\n initializer = tf.constant_initializer(embedding))\n return emb_variable\n else:\n return embedding",
"def... | [
"0.7434098",
"0.7310194",
"0.7193081",
"0.71574795",
"0.70684505",
"0.6981393",
"0.693585",
"0.6899177",
"0.67508215",
"0.67227453",
"0.6717447",
"0.66839963",
"0.66708297",
"0.66597193",
"0.6621944",
"0.6582402",
"0.6554553",
"0.6519075",
"0.64847594",
"0.64706343",
"0.64647... | 0.7749194 | 0 |
Test a light unique id. | async def test_light_unique_id(hass: HomeAssistant) -> None:
already_migrated_config_entry = MockConfigEntry(
domain=DOMAIN, data={}, unique_id=MAC_ADDRESS
)
already_migrated_config_entry.add_to_hass(hass)
bulb = _mocked_bulb()
bulb.color_temp = None
with _patch_discovery(device=bulb), _... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_unique_id(hass: HomeAssistant, start_ha) -> None:\n assert len(hass.states.async_all()) == 1",
"async def test_unique_id(hass: HomeAssistant) -> None:\n assert await async_setup_component(\n hass,\n \"sensor\",\n {\n \"sensor\": [\n {\n ... | [
"0.66693693",
"0.66282916",
"0.6461055",
"0.64034516",
"0.63749355",
"0.632127",
"0.6270078",
"0.625931",
"0.6190237",
"0.6167555",
"0.60737413",
"0.60632455",
"0.60404575",
"0.60301554",
"0.5974263",
"0.5931963",
"0.59231657",
"0.59138435",
"0.59029967",
"0.5893079",
"0.5890... | 0.73686254 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.