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 |
|---|---|---|---|---|---|---|
Iterate through managers list, prints each element as a string. | def get_personnel():
if len(man) == 0:
print("There are no managers")
else:
for i in man:
print(str(i)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_monomers():\n appnames = tuple(all_registered_appnames())\n appcount = len(appnames)\n plural = (appcount == 1) and \"app\" or \"apps\"\n print(f\"MONOMERS ({appcount} {plural} total):\")\n \n for appname in appnames:\n monos = dict(monomers[appname])\n... | [
"0.6252884",
"0.610752",
"0.61016834",
"0.61016834",
"0.60729903",
"0.60582215",
"0.60165703",
"0.59737",
"0.59569675",
"0.59118223",
"0.5847787",
"0.5819437",
"0.5795079",
"0.57728106",
"0.5766482",
"0.5750638",
"0.5732159",
"0.5704896",
"0.5678308",
"0.56509674",
"0.5650967... | 0.666529 | 0 |
Given the hours, calculates the amount this employee type will earn. | def pay(hours):
try:
hourly = 17.47
if hours == 0:
print("With 0 hours, they will earn nothing")
elif hours == 1:
print(f"The hourly rate for a manager is ${hourly}")
else:
print(f"With {hours} hours, a manag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pay(hours):\r\n try:\r\n hourly = 15.37\r\n if hours == 0:\r\n print(\"With 0 hours they will earn nothing\")\r\n elif hours == 1:\r\n print(f\"The hourly rate for an office worker is ${hourly}\")\r\n else:\r\n prin... | [
"0.68307066",
"0.64425325",
"0.643534",
"0.634114",
"0.628409",
"0.61665064",
"0.6116077",
"0.6025837",
"0.60247964",
"0.5988453",
"0.59496003",
"0.5947865",
"0.5923548",
"0.59066564",
"0.5859694",
"0.58593255",
"0.5808306",
"0.5781644",
"0.56576455",
"0.56540054",
"0.5643374... | 0.6741567 | 1 |
Move name from managers list to executives list, provided name is in the managers list. | def promote(name):
try:
if name in man:
man.remove(name)
exe.append(name)
exe.sort()
else:
print(f"{name} cannot be promoted from a manager, as they are not in the personnel list")
except TypeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promote(name):\r\n try:\r\n if name in exe:\r\n exe.remove(name)\r\n ceo.append(name)\r\n ceo.sort()\r\n else:\r\n print(f\"{name} cannot be promoted from an executive, as they are not in the personnel list\")\r\n\r\n ... | [
"0.6799091",
"0.6449266",
"0.64097726",
"0.6078374",
"0.5545875",
"0.5280572",
"0.5264899",
"0.5253104",
"0.51870227",
"0.5122377",
"0.49214664",
"0.49172524",
"0.4863017",
"0.48626837",
"0.48379445",
"0.4784517",
"0.4777999",
"0.47508428",
"0.47269666",
"0.4702841",
"0.46952... | 0.7220668 | 0 |
Move name from executive list to ceo list, provided name is in the executives list. | def promote(name):
try:
if name in exe:
exe.remove(name)
ceo.append(name)
ceo.sort()
else:
print(f"{name} cannot be promoted from an executive, as they are not in the personnel list")
except TypeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def demote(name):\r\n try:\r\n if name in exe:\r\n exe.remove(name)\r\n man.append(name)\r\n man.sort()\r\n else:\r\n print(f\"{name} cannot be demoted from an executive, as they are not in the personnel list\")\r\n\r\n ... | [
"0.63475263",
"0.58927596",
"0.58558637",
"0.58131975",
"0.5599672",
"0.54062706",
"0.5389489",
"0.5251097",
"0.5090513",
"0.5040514",
"0.49223033",
"0.48889342",
"0.4886266",
"0.48409668",
"0.47251746",
"0.4696322",
"0.4688076",
"0.4674998",
"0.46230176",
"0.46049705",
"0.46... | 0.7279381 | 0 |
Given the years, calculates the amount this employee type will earn. | def pay(years):
try:
salary = 173633
if years == 0:
print('In 0 years, they will earn nothing')
elif years == 1:
print(f"The annual salary for a CEO is ${salary}")
else:
print(f"With {years} years, a CEO will... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def years_to_pay(self) -> float:\n return round(self.term / self.term_multiplier * self.n_periods / 12, 1)",
"def calculate_revenue(self, years: int) -> float:\n revenue = self.capital * ((1.0 + self.interest) ** years - 1.0)\n return revenue",
"def getagefromyear(year=None):\n if year ... | [
"0.67077875",
"0.65627754",
"0.6500383",
"0.6423832",
"0.6146844",
"0.59964305",
"0.5978257",
"0.5955244",
"0.5947901",
"0.5880461",
"0.58530015",
"0.58334976",
"0.58162695",
"0.57643235",
"0.5735848",
"0.57255983",
"0.5685024",
"0.5679952",
"0.56681406",
"0.5659132",
"0.5631... | 0.65896666 | 1 |
Print a message that the CEO cannot be promoted. | def promote(name):
print('A CEO cannot be promoted') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def demote(name):\r\n print(\"A CEO cannot be demoted\")",
"def print_critical(message):\n print(message)\n raise SystemExit(-1)",
"def print_player_error(self, **kwargs):\n source_entity = kwargs[action.SOURCE_ENTITY]\n item = self._get_item_on_floor(source_entity)\n if (not ... | [
"0.62933224",
"0.6129365",
"0.57604915",
"0.56947964",
"0.561742",
"0.5611254",
"0.5548263",
"0.5528011",
"0.5479344",
"0.543295",
"0.54255694",
"0.5387419",
"0.5387191",
"0.5374762",
"0.5373162",
"0.5359307",
"0.5353184",
"0.5340337",
"0.5332272",
"0.5322204",
"0.531735",
... | 0.69067633 | 0 |
Print a message that a CEO cannot be demoted. | def demote(name):
print("A CEO cannot be demoted") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promote(name):\r\n print('A CEO cannot be promoted')",
"async def reject(message: discord.Message, warning: str, delete_delay: int = 2, warning_duration: int = 5) -> None:\n if delete_delay > 0: await message.delete(delay=delete_delay)\n await message.channel.send(embed=helpers.error_emb... | [
"0.58198625",
"0.5720836",
"0.54575914",
"0.5405494",
"0.52955663",
"0.52742076",
"0.5215705",
"0.52097803",
"0.5203702",
"0.518074",
"0.51737434",
"0.5157735",
"0.5143892",
"0.51376987",
"0.5123996",
"0.51179236",
"0.51157004",
"0.5114862",
"0.5113545",
"0.5105113",
"0.51041... | 0.7094386 | 0 |
Print a message that a CEO cannot be hired. | def hire(name):
print("A CEO cannot be hired outright") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fire(name):\r\n print('A CEO cannot be fired')",
"def fail_new_beer(name):\n return 'Doublon, la biere : %s' %name + ' existe deja'",
"def failure(self, message=''):\n print(colored(message, 'red'))",
"def print_critical(msg):\n print('CRITICAL - %s' % (msg))\n sys.exit(2)",
"def... | [
"0.6407955",
"0.5963119",
"0.5913325",
"0.5821641",
"0.5817571",
"0.57749784",
"0.57664555",
"0.5749528",
"0.57298166",
"0.56857145",
"0.5682629",
"0.5664522",
"0.56436753",
"0.5615903",
"0.5595582",
"0.55120486",
"0.5508115",
"0.54907507",
"0.5489876",
"0.5459184",
"0.545136... | 0.7087908 | 0 |
Print a message that a CEO cannot be fired. | def fire(name):
print('A CEO cannot be fired') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_factory_invalid_action(cls, action_name):\n print(\n f\"{cls.ERROR_PREFIX} {cls.FACTORY_INVALID_ACTION} {action_name}.\"\n )",
"def failure(self, message=''):\n print(colored(message, 'red'))",
"def error(self, message):\n print message",
"def show_error(title... | [
"0.6442648",
"0.6181874",
"0.60026073",
"0.59337175",
"0.5917736",
"0.59003633",
"0.5854378",
"0.5811001",
"0.5733128",
"0.5728627",
"0.5728414",
"0.5721356",
"0.5713644",
"0.57133466",
"0.56921875",
"0.5688832",
"0.5648379",
"0.56296235",
"0.56256557",
"0.561545",
"0.5603365... | 0.706275 | 0 |
The set of CUBA keys that this accumulator contains. | def keys(self):
if self._cubas is None:
data = self.data
self._cubas = set(
CUBA[data.GetArray(index).GetName()]
for index in range(data.GetNumberOfArrays()))
return set(self._cubas) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keys(self):\n\n return self.keys_set",
"def keys(self):\n # TODO: Collect all keys in each of the buckets\n all_keys = [] # Will store all the key\n for bucket in self.buckets:\n for key in bucket:\n if key is not None:\n all_keys.appen... | [
"0.7422273",
"0.7372165",
"0.73570746",
"0.7244071",
"0.72251546",
"0.70172894",
"0.6974989",
"0.694818",
"0.6946693",
"0.69436264",
"0.69395095",
"0.6937438",
"0.6937438",
"0.6910157",
"0.69095975",
"0.6880431",
"0.6871188",
"0.68554133",
"0.684116",
"0.6836931",
"0.68326217... | 0.7688187 | 0 |
Schedules an action to be executed at duetime. | def schedule_absolute(
self,
duetime: typing.AbsoluteTime,
action: typing.ScheduledAction[_TState],
state: Optional[_TState] = None,
) -> abc.DisposableBase:
if self._is_disposed:
raise DisposedException()
dt = self.to_datetime(duetime)
si: Sched... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_absolute(self, duetime: typing.AbsoluteTime, action: typing.ScheduledAction,\n state: typing.TState = None) -> typing.Disposable:\n\n duetime = self.to_datetime(duetime)\n return self._wxtimer_schedule(duetime, action, state)",
"def schedule_relative(self, duet... | [
"0.6679517",
"0.65476936",
"0.6524948",
"0.6458947",
"0.64376324",
"0.62642324",
"0.6220926",
"0.61742574",
"0.6154292",
"0.6114845",
"0.6040552",
"0.5912185",
"0.58487225",
"0.5818994",
"0.5806722",
"0.57969946",
"0.57876927",
"0.57546717",
"0.5694023",
"0.5659819",
"0.56274... | 0.658744 | 1 |
Checks if there is an event loop thread running. | def _has_thread(self) -> bool:
with self._condition:
return not self._is_disposed and self._thread is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_running(self):\n return self._event_loop is not None and self._event_loop.is_running()",
"def check_event_loop():\n loop = asyncio.get_event_loop()\n if loop.is_closed():\n asyncio.set_event_loop(asyncio.new_event_loop())",
"def is_main_thread():\n if not _dispatcher:\... | [
"0.7801305",
"0.7420869",
"0.70738405",
"0.69490856",
"0.68206227",
"0.67392266",
"0.6709847",
"0.6700045",
"0.66817075",
"0.6659588",
"0.65847415",
"0.656617",
"0.65424824",
"0.651439",
"0.64835995",
"0.6444736",
"0.6444714",
"0.6418379",
"0.6368198",
"0.6296596",
"0.6272898... | 0.750815 | 1 |
Gets all the users that are staff (is_staff = True) and sends them as context ('employees'). | def index(request):
context = {'employees': User.objects.select_related('profile').filter(is_staff=True).order_by('first_name')}
return render(request, 'Employees/index.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_all_employees():\n if not g.user:\n flash(\"Please login to access\", \"danger\")\n return redirect(\"/\")\n if g.user.is_admin == False:\n flash (\"Unauthorized\", \"danger\")\n return redirect(\"/login\")\n\n employees = Employee.query.all()\n \n \n ## rig... | [
"0.69020844",
"0.65482",
"0.6486206",
"0.6264102",
"0.62267137",
"0.6115697",
"0.609464",
"0.6041237",
"0.60136414",
"0.597273",
"0.597273",
"0.597273",
"0.5961706",
"0.59365946",
"0.5935259",
"0.5909961",
"0.5890758",
"0.58600503",
"0.5857997",
"0.5843577",
"0.58424115",
"... | 0.6958563 | 0 |
Create addresses from the specified CardanoShelley object. If the Bip object is at address index level, only one address will be computed. | def __FromShelleyObj(self,
shelley_obj: CardanoShelley,
addr_num: int,
addr_off: int) -> None:
for i in range(addr_num):
shelley_obj_addr = shelley_obj.AddressIndex(i + addr_off)
self._AddAddr(HdWalletCardanoShell... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_addresses(self):\n \n from ambry.geo.geocoders import DstkGeocoder\n\n facilities = self.partitions.find(table='facilities')\n\n def address_gen():\n for row in facilities.query(\"SELECT * FROM facilities\"):\n address = \"{}, {}, {} {}\".format(row['... | [
"0.5849662",
"0.55695933",
"0.54823846",
"0.5367325",
"0.51950896",
"0.5157803",
"0.5117506",
"0.5085979",
"0.49941707",
"0.49604782",
"0.4954247",
"0.49228752",
"0.48470742",
"0.4822212",
"0.47913137",
"0.47707623",
"0.47375193",
"0.4729624",
"0.47206724",
"0.4704728",
"0.46... | 0.71985775 | 0 |
How deep is the interior of the well, in mm? Default here to what Opentrons provides. | def well_depth(self):
return self.well.well_depth if self.well is not None else infinity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def well_depth(self):\n pass",
"def molar_mass_dry_air():\n return 28.9647",
"def get_outbreak_size(self,normed=True):\n if normed:\n return 1. - self.s()\n else:\n return self.G.number_of_nodes() - self.number_of_susceptibles()",
"def get_well_depth_image(self):... | [
"0.64439917",
"0.6365774",
"0.6331369",
"0.60004693",
"0.59831846",
"0.59803826",
"0.5937719",
"0.58800304",
"0.5846281",
"0.5818007",
"0.5785567",
"0.57715946",
"0.57701075",
"0.5754127",
"0.57531124",
"0.57340646",
"0.5728767",
"0.57212013",
"0.57212013",
"0.57212013",
"0.5... | 0.6698067 | 0 |
what is the diameter of this well at it's top | def well_diameter_at_top(self):
return self.radius_from_liquid_depth(self.well_depth) * 2 # a generic impl; subclasses can optimize | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_diameter(self) -> float:\r\n \r\n return (self.box[3] - self.box[1] + self.box[2] - self.box[0]) / 2",
"def diameter(self):\n return self.radius * 2",
"def diameter(self):\n return self.radius * 2",
"def height(self) -> int:",
"def height(self) -> int:",
"def height(s... | [
"0.7239062",
"0.7008213",
"0.7008213",
"0.70022166",
"0.70022166",
"0.70022166",
"0.69961596",
"0.6860503",
"0.6860503",
"0.68428093",
"0.6456967",
"0.64403546",
"0.6433487",
"0.63548803",
"0.634957",
"0.6323592",
"0.63139",
"0.6297628",
"0.62559617",
"0.62246484",
"0.6214853... | 0.73795515 | 0 |
best calc'n of depth from the given volume. may be an interval | def liquid_depth_from_volume(self, volume):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optical_depth(self, dispersion):\n\n from ..calculations import optical_depth, tau_peak\n\n if isinstance(dispersion, Quantity):\n dispersion = dispersion.to(angstrom)\n\n elif hasattr(dispersion, 'unit'):\n if dispersion.unit is not None:\n dispersion ... | [
"0.6201366",
"0.609453",
"0.60882413",
"0.6058525",
"0.58145845",
"0.5803058",
"0.57640165",
"0.57197446",
"0.57185847",
"0.56784654",
"0.5662603",
"0.56545395",
"0.5591705",
"0.5573432",
"0.55517125",
"0.5545486",
"0.5491205",
"0.54074633",
"0.53804183",
"0.5373919",
"0.5365... | 0.74125123 | 0 |
External height of the tube, in mm | def external_tube_height(self):
assert not self.is_tube # tube subclasses should override
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height(self) -> int:",
"def height(self) -> int:",
"def height(self) -> int:",
"def getHeight(self):\r\n height = 1\r\n if self.orientation == \"v\":\r\n height = self.size\r\n return height",
"def height(self) -> int:\r\n return self.rect_uv.h",
"def height(sel... | [
"0.748241",
"0.748241",
"0.748241",
"0.74563205",
"0.74075335",
"0.72509897",
"0.7190522",
"0.71308833",
"0.7129929",
"0.7110673",
"0.7093124",
"0.70528394",
"0.7020453",
"0.70012414",
"0.6978714",
"0.6953356",
"0.69391465",
"0.6897342",
"0.6897342",
"0.6887968",
"0.68819606"... | 0.77360415 | 0 |
how high does this well extend about the reference plane of this rack | def height_above_reference_plane(self, space_below_reference_plane, rack):
if self.is_tube:
return max(0, self.external_tube_height - space_below_reference_plane, self.rim_lip_height)
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def brain_weight_oz(self):\r\n return Heart.heart_weight_oz(self) # Used method from Heart Class\r",
"def high(self):",
"def acW(self):\n return self.fuselageLength * self.posFraction",
"def hit(self):\n self.hp -= 1\n self.image = self._create_surface((244, 158, 66)) # Orange\... | [
"0.65409535",
"0.6142989",
"0.61165625",
"0.61015797",
"0.6005339",
"0.59894276",
"0.5937099",
"0.5885842",
"0.5885842",
"0.5885842",
"0.58306473",
"0.577934",
"0.57570297",
"0.5724785",
"0.57183796",
"0.56835294",
"0.5683054",
"0.56600565",
"0.5657513",
"0.5655132",
"0.56543... | 0.6386079 | 1 |
How deep is the interior of the well, in mm? | def well_depth(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def well_depth(self):\n return self.well.well_depth if self.well is not None else infinity",
"def molar_mass_dry_air():\n return 28.9647",
"def local_thickness(im):\n from skimage.morphology import cube\n if im.ndim == 2:\n from skimage.morphology import square as cube\n dt = spim.dis... | [
"0.61638224",
"0.572728",
"0.5704006",
"0.56285834",
"0.5620537",
"0.55761904",
"0.55473566",
"0.5481321",
"0.5452228",
"0.5429192",
"0.5426034",
"0.5392432",
"0.5371758",
"0.53546184",
"0.52937627",
"0.52834785",
"0.5280932",
"0.5280516",
"0.52797145",
"0.52683413",
"0.52610... | 0.6089318 | 1 |
Returns the coordinates of the topcenter of the well in absolute coordinate space | def top_coords_absolute(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def origin(self):\r\n\r\n return self.ox, self.oy, self.oz",
"def initialCoordinates():\r\n return (-250,-250)",
"def easting(self):\r\n x, y = self.lonlat2xy(self.longitude, self.latitude)\r\n return x",
"def getTelescopeCoords(self):\n return self.header['ANT_X'],self.header[... | [
"0.6483149",
"0.63898844",
"0.6351912",
"0.632665",
"0.63087434",
"0.6235155",
"0.6218325",
"0.6218325",
"0.6212128",
"0.61498666",
"0.60702974",
"0.60362214",
"0.5983286",
"0.5982924",
"0.5977643",
"0.5948003",
"0.5945058",
"0.59397167",
"0.59327954",
"0.5909233",
"0.5907949... | 0.6593078 | 0 |
This method should be implemented for some local variables initialization | def init_locals(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_vars(self):\n # type: () -> None\n raise NotImplementedError",
"def __init__():",
"def initialise(self):",
"def _init(self):",
"def x_init(self):\n pass",
"def init(self) -> None:",
"def __init__(self):\n\n self.var = None",
"def __init__(self):\n self.vari... | [
"0.6876197",
"0.6674017",
"0.6635439",
"0.65695757",
"0.6556148",
"0.650132",
"0.64394325",
"0.64271647",
"0.64148045",
"0.6413897",
"0.64086676",
"0.64053833",
"0.64053833",
"0.64053524",
"0.64053524",
"0.64053524",
"0.64053524",
"0.64023983",
"0.63911945",
"0.63762283",
"0.... | 0.70256335 | 0 |
In this method should be implemented packet transformation for resend it to neighbours packet object of FabnetPacketRequest class object of FabnetPacketRequest class or None for disabling packet resend to neigbours | def before_resend(self, packet):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spoof_packet(packet):",
"def setupPacket(self):\n return None",
"def _do_some_logic(self, packet):\n\n\n pass",
"def process(self, packet, role):\n t0 = None\n try:\n rcode = self.operator_cl.register_request(packet.message_id, packet.method, packet.sender)\n ... | [
"0.5932818",
"0.588603",
"0.580345",
"0.56156653",
"0.5522125",
"0.5470777",
"0.5423352",
"0.54165554",
"0.5408718",
"0.53808874",
"0.5372224",
"0.53673595",
"0.53673595",
"0.53265727",
"0.5248986",
"0.5235855",
"0.52343464",
"0.5233157",
"0.5224169",
"0.5216612",
"0.5191889"... | 0.5902516 | 1 |
In this method should be implemented logic that should be executed after response send If ret_packet is None this method is not called packet object of FabnetPacketRequest class ret_packet object of FabnetPacketResponse class | def after_process(self, packet, ret_packet):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _do_some_logic(self, packet):\n\n\n pass",
"def setupPacket(self):\n return None",
"def receive_packet(self, packet):\n\t\treturn",
"async def extra_make_response(self, pkt, source):\n if False:\n yield None",
"def before_resend(self, packet):\n pass",
"def afte... | [
"0.6833189",
"0.66585237",
"0.6207017",
"0.61543447",
"0.6068887",
"0.60534704",
"0.59951174",
"0.59699667",
"0.595274",
"0.5943402",
"0.59359103",
"0.5856997",
"0.5827214",
"0.5797615",
"0.57782245",
"0.57621187",
"0.5746954",
"0.574171",
"0.573711",
"0.5725794",
"0.57124186... | 0.6910123 | 0 |
return object of BaseOperation for method | def get_operation_obect(self, method):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operation(self):\n pass",
"def to_op(self):\n raise NotImplementedError",
"def __call__(self):\r\n new_node = Node()\r\n new_node.op = self\r\n return new_node",
"def __call__(self):\r\n new_node = Op.__call__(self)\r\n return new_node",
"def __call__(se... | [
"0.6850059",
"0.66648144",
"0.65556395",
"0.6542843",
"0.6506697",
"0.64761317",
"0.6402812",
"0.6312497",
"0.6288506",
"0.6246451",
"0.6246451",
"0.6220128",
"0.6130779",
"0.6129697",
"0.61268127",
"0.61117816",
"0.61117816",
"0.61117816",
"0.61070263",
"0.6100783",
"0.60916... | 0.76091534 | 0 |
Initiate new operation over fabnet network | def _init_network_operation(self, operation, parameters):
message_id = self.operator.async_remote_call(None, operation, parameters, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _start_oef_node(self, network_node):",
"def run(self, floating_network=None):\n floating_network = self.neutron.find_network(floating_network,\n external=True)\n floating_ip = self.neutron.create_floatingip(\n floating_network=float... | [
"0.6271065",
"0.593901",
"0.5848814",
"0.58323175",
"0.58234704",
"0.5789192",
"0.5782749",
"0.5746765",
"0.57200325",
"0.5688804",
"0.5665452",
"0.5639571",
"0.56213385",
"0.5619089",
"0.56003696",
"0.55727243",
"0.5553154",
"0.5539826",
"0.5525178",
"0.5519042",
"0.5504413"... | 0.6458107 | 0 |
Cache response from node for using it from other operations objects | def _cache_response(self, packet):
self.operator.update_message(packet.message_id, packet.from_node, packet.ret_parameters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cached():\n ##from pprint import pprint\n # let's restrict this to the api server, to avoid shenanigans\n root_relative_url = request.env.request_uri.split('/cached/')[-1]\n ##pprint('ROOT-RELATIVE URL: ')\n ##pprint(root_relative_url)\n fetch_url = '%s://%s/%s' % (request.env.wsgi_url_scheme... | [
"0.65638196",
"0.65279585",
"0.6384009",
"0.63635147",
"0.6208617",
"0.61718655",
"0.6162742",
"0.611302",
"0.60719055",
"0.606641",
"0.60478437",
"0.6006957",
"0.599878",
"0.5992815",
"0.59559417",
"0.5949405",
"0.59384143",
"0.59003174",
"0.58669674",
"0.5831748",
"0.578038... | 0.65463936 | 1 |
Get cached response from some node | def _get_cached_response(self, message_id, from_node):
return self.operator.get_message_item(message_id, from_node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cached():\n ##from pprint import pprint\n # let's restrict this to the api server, to avoid shenanigans\n root_relative_url = request.env.request_uri.split('/cached/')[-1]\n ##pprint('ROOT-RELATIVE URL: ')\n ##pprint(root_relative_url)\n fetch_url = '%s://%s/%s' % (request.env.wsgi_url_scheme... | [
"0.6512094",
"0.64381534",
"0.6387111",
"0.6281077",
"0.6278804",
"0.62678593",
"0.62569755",
"0.6256389",
"0.6210525",
"0.6159354",
"0.6145123",
"0.6134104",
"0.61254245",
"0.6125291",
"0.60925615",
"0.60709924",
"0.6047879",
"0.60464764",
"0.6028001",
"0.6015",
"0.6013168",... | 0.7049661 | 0 |
return a list of (fully qualified) cache filenames | def _list_dir(self):
return [os.path.join(self.cache_dir, fn)
for fn in os.listdir(self.cache_dir)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cachepath(self):\n return [self.fs.cachepath(uri) for uri in self.uri]",
"def _get_all_cache_files(self):\n files = set()\n dir_tree = os.walk(self.config.get('cachedir', self.CACHEDIR))\n for dirpath, _, filenames in dir_tree:\n for file_name in filenames:\n ... | [
"0.79384536",
"0.7361651",
"0.72407615",
"0.7107985",
"0.6998645",
"0.69196266",
"0.6814354",
"0.6794441",
"0.6794441",
"0.67595124",
"0.6747671",
"0.6716637",
"0.6716637",
"0.65908664",
"0.65897655",
"0.6549052",
"0.6486357",
"0.64747965",
"0.6465193",
"0.6444582",
"0.639242... | 0.7569422 | 1 |
Returns a specific gold annotation from the bank and returns it information | def get_bank_annotation(bank_id, bank_annotations_path):
df = pd.read_csv(bank_annotations_path)
df = df.set_index('bank_id')
annotation_id = df.loc[bank_id, 'annotation_id']
question_id = df.loc[bank_id, 'question_id']
question_text = df.loc[bank_id, 'question_text']
decomposition_accepted = df... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_bank_annotation(bank_annotations_path):\n df = pd.read_csv(bank_annotations_path)\n df = df.set_index('bank_id')\n bank_size = len(df.index)\n random_bank_id = random.randint(1,bank_size)\n annotation_id = df.loc[random_bank_id, 'annotation_id']\n question_id = df.loc[random_bank_id, '... | [
"0.5668529",
"0.56389076",
"0.5419936",
"0.53085446",
"0.51771075",
"0.5167307",
"0.51036835",
"0.51017505",
"0.50751287",
"0.49428058",
"0.4928604",
"0.49165657",
"0.49060178",
"0.48499832",
"0.48114362",
"0.48081738",
"0.47833946",
"0.4734522",
"0.47318086",
"0.47268197",
"... | 0.62116945 | 0 |
Picks a random gold annotation from the bank and returns it information | def random_bank_annotation(bank_annotations_path):
df = pd.read_csv(bank_annotations_path)
df = df.set_index('bank_id')
bank_size = len(df.index)
random_bank_id = random.randint(1,bank_size)
annotation_id = df.loc[random_bank_id, 'annotation_id']
question_id = df.loc[random_bank_id, 'question_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomLeggings():\n return random.choice(LEGGINGS)",
"def random(self) -> Gadza:\n return choice(self.gadzas)",
"def choose_banner(banners):\n # simple random\n n = random.randint(0, len(banners)-1)\n return banners[n]",
"def p_banner():\n return random.choice([banner, b... | [
"0.6257304",
"0.60382557",
"0.57549554",
"0.5727264",
"0.5720103",
"0.5638524",
"0.56320137",
"0.56180143",
"0.56108093",
"0.56108093",
"0.55772424",
"0.55739284",
"0.5544307",
"0.5511054",
"0.55089",
"0.5497481",
"0.5488842",
"0.54494494",
"0.5442217",
"0.5434941",
"0.543145... | 0.6865096 | 0 |
Creates a HITInfo object for a generation/validation HIT of an annotation | def get_hit_info(annotation_log=None, bank_annotations=None, annotation_id=None, hit_type=None, hit_id=None):
assert(hit_type in ["gen", "val"])
assert(annotation_id != None or hit_id != None)
hit_info = None
df = pd.read_csv(annotation_log)
df = df.set_index('annotation_id')
hit_already_in_log ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_hit(client, hit_info):\n hit_id = \"\"\n hit_type = hit_info.type\n assert(hit_type in ['gen', 'val'])\n if hit_type == 'gen':\n hit = create_generation_hit(client, hit_info)\n else:\n hit = create_validation_hit(client, hit_info)\n hit_id = hit['HIT']['HITId']\n # for... | [
"0.72401625",
"0.6949758",
"0.6870816",
"0.5675915",
"0.54159564",
"0.5322355",
"0.5236185",
"0.5235167",
"0.5181402",
"0.5149954",
"0.50717485",
"0.48816466",
"0.48788348",
"0.48475456",
"0.48305497",
"0.48177925",
"0.47843954",
"0.47587487",
"0.47451633",
"0.47388893",
"0.4... | 0.72403646 | 0 |
Publishes to MTurk all HITs from the annotation log and saves their HIT ids | def publish_hits_to_mturk(annotation_log=None, bank_annotations=None, client=None, create_json=False, json_dir=None):
# get all the gen & val annotation_ids to be published from the annotation log
df = pd.read_csv(annotation_log)
df = df.set_index('annotation_id')
# get all gen annotation ids to be publ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, data):\n activities = [json.loads(activity['Json']) for activity in data]\n\n for i in range(len(activities)):\n activities[i]['created_at'] = to_datetime(activities[i]['created_at'])\n\n with Elastic(index='wink', doc_type='activity') as elastic:\n elastic... | [
"0.57871777",
"0.54236436",
"0.5260172",
"0.5140843",
"0.51354283",
"0.51130503",
"0.5097508",
"0.5054504",
"0.5047928",
"0.50407946",
"0.50273776",
"0.50168645",
"0.50128305",
"0.49875066",
"0.49793884",
"0.49748507",
"0.4969023",
"0.49628836",
"0.49325883",
"0.49043155",
"0... | 0.77661234 | 0 |
Publishes to MTurk a new HIT based on the HITInfo | def create_hit(client, hit_info):
hit_id = ""
hit_type = hit_info.type
assert(hit_type in ['gen', 'val'])
if hit_type == 'gen':
hit = create_generation_hit(client, hit_info)
else:
hit = create_validation_hit(client, hit_info)
hit_id = hit['HIT']['HITId']
# for Sandbox HITs
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish_hits_to_mturk(annotation_log=None, bank_annotations=None, client=None, create_json=False, json_dir=None):\n # get all the gen & val annotation_ids to be published from the annotation log\n df = pd.read_csv(annotation_log)\n df = df.set_index('annotation_id')\n # get all gen annotation ids t... | [
"0.63557893",
"0.61584926",
"0.5786252",
"0.56609",
"0.5553926",
"0.54426825",
"0.5439537",
"0.53828263",
"0.53110677",
"0.52799046",
"0.52686787",
"0.5241735",
"0.52039623",
"0.5185886",
"0.5109641",
"0.5088464",
"0.5085825",
"0.5081296",
"0.5075279",
"0.50720626",
"0.503065... | 0.628853 | 1 |
Publishes to MTurk a new generation HIT based on the HITInfo | def create_generation_hit(client, hit_info):
# create HIT layout
layout = layouts.create_gen_hit_layout(hit_info.annotation_id, hit_info.question_id, HIT_LAYOUT_DIR, HIT_LAYOUT_GEN)
# create HIT requirements
#### Debug - threshold of 84 required in get_qualification_requirements
hit_requirements = q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_hit(client, hit_info):\n hit_id = \"\"\n hit_type = hit_info.type\n assert(hit_type in ['gen', 'val'])\n if hit_type == 'gen':\n hit = create_generation_hit(client, hit_info)\n else:\n hit = create_validation_hit(client, hit_info)\n hit_id = hit['HIT']['HITId']\n # for... | [
"0.66189384",
"0.6484285",
"0.55768126",
"0.54209566",
"0.5394467",
"0.535616",
"0.53495324",
"0.53034985",
"0.5236751",
"0.5227366",
"0.5192338",
"0.51523226",
"0.5113906",
"0.51116395",
"0.51067865",
"0.5043895",
"0.5022687",
"0.4991991",
"0.4980789",
"0.49633652",
"0.49610... | 0.7017777 | 0 |
Publishes to MTurk a new validation HIT based on the HITInfo | def create_validation_hit(client, hit_info):
# create HIT layout
bank_info = hit_info.bank_annotation
layout = layouts.create_val_hit_layout(hit_info.annotation_id, hit_info.question_id, hit_info.question_text, \
hit_info.decomposition, bank_info.bank_id, bank_info.questio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_generation_hit(client, hit_info):\n # create HIT layout\n layout = layouts.create_gen_hit_layout(hit_info.annotation_id, hit_info.question_id, HIT_LAYOUT_DIR, HIT_LAYOUT_GEN)\n # create HIT requirements\n #### Debug - threshold of 84 required in get_qualification_requirements\n hit_requir... | [
"0.5867097",
"0.5786331",
"0.57524693",
"0.54256475",
"0.540409",
"0.538043",
"0.52623844",
"0.5210809",
"0.5201162",
"0.51104283",
"0.504877",
"0.5000939",
"0.49618253",
"0.4923262",
"0.49066305",
"0.48890546",
"0.48809943",
"0.48573306",
"0.48535314",
"0.48463002",
"0.48376... | 0.69410753 | 0 |
Creates an id_number for only super users. This is for database entry | def create_id_number(self):
id_number = get_random_string(8).lower()
if User.objects.filter(id_number=id_number).first():
self.create_id_number()
return id_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_new_id(self) -> str:\n user = self.get_template(list_entries=False)\n return user.id",
"def get_accessible_user_id(self):\n ### DATABASE CODE GOES HERE\n return 1",
"def __getNewUserID(self):\n return db_main.getHandle().seqNextVal(\"users_user_id_seq\")",
"def make... | [
"0.66291505",
"0.64762205",
"0.60808724",
"0.6048973",
"0.59998745",
"0.59799665",
"0.59667194",
"0.59461564",
"0.5932352",
"0.59134597",
"0.5890549",
"0.5871769",
"0.58707327",
"0.5803153",
"0.5747899",
"0.57330525",
"0.57296544",
"0.5721195",
"0.5707484",
"0.5658953",
"0.56... | 0.7571509 | 0 |
Processing a single Tweet and updating our datasets | def process_tweet(tweet):
global start_date
global end_date
global geo_enabled_tweets
global retweets
# Check for filters before processing any further
if args.filter and tweet.source:
if not args.filter.lower() in tweet.source.lower():
return
tw_date = tweet.created_at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweet_processor(self, tweets):\n with Timer() as timer:\n detection_count = self.tweet_processor_fct(tweets) or 0\n # Increment the total number of detections.\n self.redis.hincrby(self.metadata_cache_key, 'detection',\n detection_count)\n\n... | [
"0.69327897",
"0.685648",
"0.6694965",
"0.66861695",
"0.66328",
"0.6583072",
"0.6536225",
"0.64631647",
"0.64331144",
"0.6402631",
"0.63784033",
"0.6348701",
"0.63263834",
"0.63116586",
"0.6302683",
"0.6280121",
"0.6275172",
"0.62739486",
"0.62506014",
"0.6196873",
"0.6185201... | 0.70498806 | 0 |
Process a single friend | def process_friend(friend):
friends_lang[friend.lang] += 1 # Getting friend language & timezone
if friend.time_zone:
friends_timezone[friend.time_zone] += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friend(tcp, udp, userId, data):\n\n # from server get address of potential friend\n tcp.sendMessage('SEARCH ' + data[0])\n address = tcp.receiveMessage().split()[-2:]\n address = (address[0], int(address[1]))\n\n # send friend request\n if address:\n udp.sendto('FRIEND ' + userId, address)\n print ... | [
"0.6485085",
"0.61370707",
"0.5814758",
"0.5723697",
"0.56239754",
"0.56239754",
"0.56239754",
"0.55920976",
"0.55756235",
"0.55756235",
"0.5551387",
"0.5537789",
"0.55188006",
"0.5515051",
"0.5484197",
"0.54730654",
"0.5460136",
"0.5455987",
"0.54533607",
"0.544724",
"0.5437... | 0.6500388 | 0 |
Prints nice charts based on a dict {(key, value), ...} | def print_charts(dataset, title, weekday=False):
chart = []
keys = sorted(dataset.keys())
mean = numpy.mean(list(dataset.values()))
median = numpy.median(list(dataset.values()))
if args.json is False:
export_string(title)
for key in keys:
if (dataset[key] >= median * 1.33):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_histo(dict, orient=\"horiz\", label=\"counts\", title=\"title\"):\n plt.clf()\n plt.cla()\n if orient==\"horiz\":\n bar_fun = plt.barh \n bar_ticks = plt.yticks\n bar_label = plt.xlabel\n elif orient==\"vert\":\n bar_fun = plt.bar\n ... | [
"0.6482049",
"0.6480956",
"0.6468091",
"0.64523757",
"0.6440396",
"0.6396588",
"0.63776916",
"0.6323281",
"0.62485397",
"0.6248092",
"0.6206808",
"0.6156151",
"0.61307836",
"0.61298263",
"0.611579",
"0.60737646",
"0.6045167",
"0.6038874",
"0.60288465",
"0.600128",
"0.600068",... | 0.65659285 | 0 |
Cleans line comments and empty lines. | def __clean_line_comments(self):
self.lines = [l for l in self.lines if not l.startswith("//") and len(l) != 0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_comments(self):\n new_lines = list()\n for line in self.lines:\n if ((not line.startswith(\"//\")) & (not line.isspace()) &\n (not line.startswith(\"/*\") & (not line.startswith(\"*/\")))):\n line = Parser.strip_line(line)\n new_li... | [
"0.79874223",
"0.6803405",
"0.67893976",
"0.67589444",
"0.65428233",
"0.6525192",
"0.6521202",
"0.6488208",
"0.6414032",
"0.6409241",
"0.64026684",
"0.62769747",
"0.62644196",
"0.62411034",
"0.6195091",
"0.6184523",
"0.6152337",
"0.61434567",
"0.6126434",
"0.61213666",
"0.609... | 0.81201124 | 1 |
Read the HoyuJyun vocabulary. | def hyou_reader():
with open(HYOU_FILE_PATH, 'r') as voc_file:
voc_list = []
lesson_list = []
voc_match = [
re.compile(r"^(\S+)\s*((\S*))\s*〔(\S*)〕\s*(\S+)"),
re.compile(r"^(\S+)\s*((\S*))\s*(\S+)"),
re.compile(r"^(\S+)\s*〔(\S+)〕\s*(\S+)"),
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_vocabulary(self):\n vocab_file = open(vocabulary_path, \"r\")\n self.vocab_list = vocab_file.read().split(\"\\n\")\n vocab_file.close()\n print(\"[INFO] Reading vocabulary...\")\n print(self.vocab_list[0:15])",
"def read_dictionary():\n # model = 'en_core_web_sm'\n ... | [
"0.6393649",
"0.6051204",
"0.5981608",
"0.5953455",
"0.59275913",
"0.5887852",
"0.5868068",
"0.5858034",
"0.5775898",
"0.5738882",
"0.5707452",
"0.5657088",
"0.56556284",
"0.5634628",
"0.56306815",
"0.5618039",
"0.5592048",
"0.5591303",
"0.55451834",
"0.5514621",
"0.551234",
... | 0.60739726 | 1 |
Build a BPF filter for DroneBridge raw protocol v2 | def attach_filter(sock, byte_comm_id, byte_direction, byte_port):
# first byte of dst_mac must be 0x01, we overwrite it here to be sure
u32_port = int.from_bytes(b'\x00\x00\x00'+byte_port, byteorder='big', signed=False)
u32_direction_comm = int.from_bytes(b'\x00\x00' + byte_direction + byte_comm_id, byteord... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attach_filter(node):\n ifname = node.name + \"-eth2\"\n\n logging.info(\"attaching filter to node %r\" % node)\n\n node.cmd(\"tc qdisc del dev %s clsact\" % ifname)\n\n node.cmd(\"tc qdisc add dev %s clsact\" % ifname )\n node.cmd(\"rm bpf_fifo; mkfifo bpf_fifo\")\n # this is when\n node.c... | [
"0.6238354",
"0.61859477",
"0.5644258",
"0.5324774",
"0.532127",
"0.5313818",
"0.53030795",
"0.5192934",
"0.5151721",
"0.4962258",
"0.49549353",
"0.49517238",
"0.49430647",
"0.49372083",
"0.4885433",
"0.48652998",
"0.48598874",
"0.4803426",
"0.47985667",
"0.47965682",
"0.4792... | 0.6230084 | 1 |
Transform a PIL Image into a Cairo ImageSurface. | def pil2cairo(im):
# assert sys.byteorder == 'little', 'We don\'t support big endian'
# if im.mode != 'RGBA':
# im = im.convert('RGBA')
# arr = np.array(im)
# height, width, channels = arr.shape
# surface = cairo.ImageSurface.create_for_data(arr, cairo.FORMAT_RGB24, width, height)
# re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_cairo_surface(surface):\n b = BytesIO()\n\n surface.write_to_png(b)\n b.seek(0)\n data = b.read()\n\n ip_img = display.Image(data=data, format='png', embed=True)\n return ip_img._repr_png_()",
"def from_image(img):\n canvas = Canvas(100, 100)\n canvas.img = img\n if not can... | [
"0.623977",
"0.5772151",
"0.56999326",
"0.5656409",
"0.55367196",
"0.5512225",
"0.5314761",
"0.5310866",
"0.5280075",
"0.52146375",
"0.5213104",
"0.5130811",
"0.512966",
"0.5108946",
"0.5108315",
"0.51068354",
"0.50894177",
"0.5088219",
"0.50576216",
"0.5052814",
"0.50260353"... | 0.7208936 | 0 |
Returns a string usable for lambdifying. | def lambdarepr(expr, **settings):
return LambdaPrinter(settings).doprint(expr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n names = [self.name]\n names += [_callable_name(transform) for transform in self.transforms]\n return ' | '.join(names) + f' -> {self.shape} {self.dtype}'",
"def expression(self):\n\n result = u\"{}({}\".format(self.function.lower(),\n ... | [
"0.595262",
"0.5826555",
"0.57832825",
"0.57720155",
"0.56565857",
"0.56236696",
"0.5618103",
"0.5592923",
"0.5571303",
"0.55488133",
"0.5536845",
"0.55026376",
"0.5499025",
"0.5492451",
"0.5413251",
"0.5371463",
"0.5345338",
"0.533052",
"0.5319168",
"0.53166324",
"0.52988034... | 0.6419241 | 0 |
Attempt to update the display. If ``animate_time`` has elapsed since previews animation frame then move the characters over by 1 index. Must be called in the main loop of user code. | def update(self, force: bool = False) -> None:
_now = time.monotonic()
if force or self._last_animate_time + self.animate_time <= _now:
if len(self.full_text) <= self.max_characters:
super()._set_text(self.full_text, self.scale)
self._last_animate_time = _now
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walking(self):\r\n if (self.current_time - self.animate_timer) > 125:\r\n if self.frame_index == 0:\r\n self.frame_index += 1\r\n elif self.frame_index == 1:\r\n self.frame_index = 0\r\n self.animate_timer = self.current_time",
"def main(s... | [
"0.6292605",
"0.61800736",
"0.6115695",
"0.5952931",
"0.59328413",
"0.5874481",
"0.5805918",
"0.57754314",
"0.5709934",
"0.57036567",
"0.5620251",
"0.5577814",
"0.5536179",
"0.5520112",
"0.5519289",
"0.5518162",
"0.55137604",
"0.54957",
"0.5489928",
"0.5469653",
"0.5448239",
... | 0.6263611 | 1 |
Returns a list of variabels to restore for the specified list method. It is supposed that variable name starts with the method's scope (a prefix returned by _method_scope function.) | def variabels_to_restore(scope=None, strip_scope=False):
if scope:
variable_map = {}
variables_to_restore = slim.get_variables_to_restore(include=[scope])
for var in variables_to_restore:
if strip_scope:
var_name = var.op.name[len(scope) + 1:]
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables(self):\n return [self.item]",
"def get_all_variables(self):\n return []",
"def get_variables_to_restore():\n# checkpoint_exclude_scopes=[\"distance-module\", \"InceptionV4/Logits\"]\n checkpoint_exclude_scopes=[\"DeInceptionV4\"]\n exclusions = [scope.strip() for s... | [
"0.60258776",
"0.6006314",
"0.59230494",
"0.5592203",
"0.5555549",
"0.55382496",
"0.55180925",
"0.5517383",
"0.5485563",
"0.5485563",
"0.5485563",
"0.5480257",
"0.5478412",
"0.5476064",
"0.54620343",
"0.54337436",
"0.5365489",
"0.5339208",
"0.5336621",
"0.5335185",
"0.5325799... | 0.6136607 | 0 |
Must define the directory, file and group. if the guiDataObj is defined, then the copy constructor uses only these fields and NOT any of the data. if initDefault dict is defined, it laods the values from disk/persistent memory | def __init__( self, persistentDir= None, persistentFile= None, \
prefGroup= None, guiDataObj= None, \
initDefaultDict= None, groupSubCat= None ):
if guiDataObj is not None:
assert groupSubCat is not None, "When using copy constructor must define groupSubCat"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, directory, fName, data_instance):\n self.fName = fName\n self.data_instance = data_instance\n self.directory = directory",
"def __init__(self, data_path=root.joinpath(\"data\")):\n self.data_path = data_path",
"def initDefault(self):\n #--Package Only\n ... | [
"0.6415151",
"0.63158953",
"0.61949384",
"0.6151756",
"0.61285174",
"0.611787",
"0.6075368",
"0.604674",
"0.60185677",
"0.601614",
"0.59776855",
"0.5952329",
"0.58911014",
"0.5877904",
"0.583232",
"0.5822164",
"0.5808175",
"0.5804738",
"0.575756",
"0.57296145",
"0.5722518",
... | 0.78706753 | 0 |
1. determine which defaults have not been loaded from pref file 2. keep track of the loaded by adding to _loadedDefaults 3. load them, BUT only overwrite in the self dictionary if that field DNE in self already. Send warning if not | def storeUnloadedDefaultsOnly( self ):
unStoredKeys= [ aKey
for aKey in self._defDict.keys()
if aKey not in self._loadedDefaults ]
if len( unStoredKeys ) == 0:
return
# keep track of what has been loaded
[ self._... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadDefaults(self,defaults):\n for key in defaults.keys():\n if key not in self.data:\n self.data[key] = defaults[key]",
"def loadDefaults(self):\n # (025) Merged into settings.RawSettings.\n pass",
"def load_from_defaults(self):\n default_settings = im... | [
"0.6818212",
"0.6604279",
"0.61217785",
"0.6056712",
"0.60090715",
"0.5976927",
"0.5972797",
"0.5753665",
"0.5725995",
"0.5713475",
"0.5682823",
"0.55551094",
"0.5531651",
"0.54862463",
"0.54781115",
"0.5438292",
"0.5438292",
"0.5396519",
"0.53370726",
"0.53370726",
"0.533707... | 0.7746999 | 0 |
save a list if no list provided save all properties without an underscore | def save( self, propList= None ):
if propList is None:
# props which do not begin with underscore
propList= [ aKey
for aKey in self.__dict__.keys()
if aKey.split("_")[0].strip() != "" ]
elif type( propList ) == type( st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_all(self, obj_list):\n\n for obj in obj_list:\n self.save(obj)",
"def save_to_file(cls, list_objs):\n the_list = []\n if list_objs is not None:\n for stuff in list_objs:\n new_stuff = stuff.to_dictionary()\n the_list.append(new_stu... | [
"0.6322764",
"0.62147653",
"0.6112076",
"0.60580385",
"0.6045953",
"0.6026134",
"0.6015944",
"0.5993287",
"0.59870976",
"0.597141",
"0.5953817",
"0.59261477",
"0.59230185",
"0.59114754",
"0.5885859",
"0.58791906",
"0.58754736",
"0.5852007",
"0.58097017",
"0.5790052",
"0.57790... | 0.66288584 | 0 |
Make a new pair. >>> pair = Pair('A', 'B') >>> pair.names ('A', 'B') >>> pair = Pair('B', 'A') >>> pair.names ('A', 'B') | def __init__(self, name_a: str, name_b: str) -> None:
self.names = tuple(sorted((name_a, name_b))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_pairs(innames):\n names = copy.deepcopy(innames)\n pairs = []\n if len(names) % 2 == 1:\n m = random.randint(0, len(names) - 1)\n singleton = names[m]\n del names[m]\n else:\n singleton = None\n while len(names) > 0:\n i = 0\n j = 0\n while i... | [
"0.59383357",
"0.57082015",
"0.5686393",
"0.5542588",
"0.5537846",
"0.5395129",
"0.5353524",
"0.5336511",
"0.5290121",
"0.5184155",
"0.5171694",
"0.5162376",
"0.51315147",
"0.51133937",
"0.51064354",
"0.51047575",
"0.508709",
"0.5076582",
"0.5071997",
"0.5054983",
"0.5035915"... | 0.6045644 | 0 |
Return if pairs are equal. >>> Pair('A', 'B') == Pair('B', 'A') True >>> Pair('A', 'B') == Pair('A', 'A') False | def __eq__(self, other: 'Pair') -> bool:
return self.names == other.names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_equal(self, codon_pair: 'CodonPair') -> bool:\n return self.sequence == codon_pair.sequence",
"def __eq__(self, other: 'PairwiseInfo') -> bool:\n\n return (\n self.their_did == other.their_did and\n self.their_verkey == other.their_verkey and\n self.my_did ==... | [
"0.7250911",
"0.69399416",
"0.6566681",
"0.6540947",
"0.6491572",
"0.64901346",
"0.648855",
"0.6461358",
"0.6317612",
"0.63122255",
"0.6292389",
"0.6234777",
"0.62025297",
"0.61583334",
"0.6155708",
"0.61519843",
"0.61383545",
"0.61297846",
"0.6116349",
"0.6087816",
"0.607251... | 0.75284827 | 0 |
Return if a current pair is before other pair. >>> Pair('A', 'B') >> Pair('B', 'B') < Pair('A', 'C') False | def __lt__(self, other: 'Pair') -> bool:
return self.names < other.names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, secondPoint):\n return self.value < secondPoint.value",
"def __lt__(self, other):\n return self.__le__(other) and self.__ne__(other)",
"def lt(self, x, y):\n return self.le(x,y) and x != y",
"def __lt__(self, other):\n selfList = sorted(list([self.start, self.... | [
"0.63696724",
"0.6363717",
"0.6354985",
"0.633129",
"0.63007474",
"0.6297404",
"0.62679976",
"0.62563485",
"0.62158",
"0.61886114",
"0.6167188",
"0.6164004",
"0.61614245",
"0.6158149",
"0.6157265",
"0.6147101",
"0.61470485",
"0.61470485",
"0.6146412",
"0.61447775",
"0.6129172... | 0.7353058 | 0 |
Return the literal of a pair. >>> repr(Pair('A', 'B')) "Pair('A', 'B')" | def __repr__(self) -> str:
return 'Pair({!r}, {!r})'.format(*self.names) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_pair(pair):\n logger.info('format pair...')\n formatted_pair = pair[0] + ', ' + pair[1] + '\\n'\n logger.debug('formatted_pair: ' + formatted_pair)\n return formatted_pair",
"def tuple_to_string(letter_word_pair):\n letter, word = letter_word_pair\n return '{letter}: {word}'.... | [
"0.63724804",
"0.62095463",
"0.58915025",
"0.5874253",
"0.57802963",
"0.56206805",
"0.56206805",
"0.5592388",
"0.55742466",
"0.55693716",
"0.55169034",
"0.55080456",
"0.5485911",
"0.5480038",
"0.5469646",
"0.5444116",
"0.5442278",
"0.54416555",
"0.5436006",
"0.5420553",
"0.54... | 0.7832186 | 0 |
Get interior angle value | def interior_angle(self):
if self.interior_angle_l is not None:
return self.interior_angle_l
else:
self.interior_angle_l = ((self.vert_count - 2)*180)/math.pi
return self.interior_angle_l | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(self) -> int:",
"def angle(self) -> float:\n ...",
"def angle(self):\n return 0",
"def getAngle(self):\n return self.articulateEncoder.getDistance()+self.angleOffset",
"def angle(self):\n return self._angle",
"def angle(self):\n return self._angle",
"def ang... | [
"0.7833495",
"0.7530638",
"0.7379965",
"0.7257647",
"0.72365487",
"0.72365487",
"0.72365487",
"0.7187466",
"0.71803194",
"0.7161552",
"0.7160657",
"0.7136208",
"0.7104937",
"0.7098264",
"0.7065363",
"0.7065363",
"0.702953",
"0.7011377",
"0.7004417",
"0.7001069",
"0.69856656",... | 0.85560936 | 0 |
Get edge length value | def edge_length(self):
if self.edge_length_l is not None:
return self.edge_length_l
else:
self.edge_length_l = (2 * self.radius * math.sin(math.pi / self.vert_count))
return self.edge_length_l | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def e_size(self) -> int:\n return self.edgesize",
"def get_edge_size(self):\n return self._edge_size",
"def edge_length_total(G):\n return sum(d[\"length\"] for u, v, d in G.edges(data=True))",
"def get_edge_size(self):\n range_start = self._edge_map[self._partid - 1] if self._partid ... | [
"0.77358437",
"0.7695899",
"0.76848274",
"0.74519974",
"0.7379913",
"0.7359527",
"0.7328054",
"0.7255417",
"0.7211621",
"0.71249443",
"0.70803636",
"0.6923324",
"0.6893363",
"0.689159",
"0.6891115",
"0.68657696",
"0.6857565",
"0.6857381",
"0.6854342",
"0.68521446",
"0.684734"... | 0.8516439 | 0 |
Return string for RegularPoly | def __repr__(self):
return (f'RegularPoly({self.vert_count}, {self.radius})') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def charpoly_berk(self):\n return self.rep.charpoly()",
"def strUniPoly(poly, symbol=\"X\", asc=True):\n return termorder.UnivarTermOrder(cmp).format(poly, symbol, asc)",
"def __repr__(self):\n return 'Polygon({%s})' % \", \".join(str(line) for line in self.lines)",
"def _poly_desc(self, W, ... | [
"0.67377347",
"0.6208078",
"0.58423275",
"0.5837491",
"0.58325016",
"0.5826567",
"0.5816582",
"0.5812712",
"0.58050966",
"0.5718363",
"0.5676934",
"0.5650606",
"0.5649617",
"0.552211",
"0.54934114",
"0.54900336",
"0.54626334",
"0.54414064",
"0.54381406",
"0.5429557",
"0.53680... | 0.691711 | 0 |
Check for the equality of RegularPoly | def __eq__(self,other):
if isinstance(other, RegularPoly):
return(self.vert_count == other.vert_count and self.radius == other.radius)
else:
raise NotImplementedError('Incorrect data type') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _poly_exactly_equal(a,b):\n for a_hole, b_hole in zip(a.holes, b.holes):\n if not np.array_equal(a_hole, b_hole):\n return False\n for a_part, b_part in zip(a.parts, b.parts):\n if not np.array_equal(a_part, b_part):\n return False\n return True",
"def testPolya(s... | [
"0.736144",
"0.70391667",
"0.66051674",
"0.6349923",
"0.6331158",
"0.6175746",
"0.616643",
"0.61637473",
"0.6129612",
"0.6091394",
"0.60838616",
"0.6066773",
"0.6064791",
"0.6023531",
"0.5997945",
"0.59947085",
"0.5965461",
"0.59455305",
"0.589931",
"0.5879208",
"0.58631957",... | 0.73823357 | 0 |
Check for the greater than ineqaulity for RegularPoly | def __gt__(self,other):
if isinstance(other, RegularPoly):
return(self.vert_count > other.vert_count)
else:
raise NotImplementedError('Incorrect data type') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testPolya(self):\n self.assertTrue(irreducible.polya(self.f5))\n self.assertEqual(False, irreducible.polya(self.f5 + 1))",
"def test_ge_1():\n a = FixedPoint(1, 'Q2.8')\n assert a > 0.9",
"def check(self):\n self.lower_bound(5e-4)\n self.upper_bound(5e2)",
"def test_gt_1... | [
"0.6364086",
"0.6142087",
"0.6059953",
"0.60569644",
"0.60563856",
"0.6047793",
"0.5967373",
"0.5947255",
"0.5947255",
"0.5927318",
"0.58668095",
"0.5862688",
"0.5848821",
"0.5832662",
"0.5813921",
"0.5802421",
"0.5791159",
"0.5740359",
"0.5737285",
"0.5736835",
"0.5735975",
... | 0.69490325 | 0 |
Initialise molecule with pdb filename and code (set to pdbfile if missing). The molecule is read from pdbfile. | def __init__(self, pdbfile, pdbcode=None, includeH=True):
self.initialized = False
self.load (pdbfile, pdbcode, includeH=includeH) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_molecule_from_pdb(self, fpath):\n try:\n self.mol_graph = Chem.MolFromPDBFile(fpath)\n except Exception:\n raise LoadingError(f'{fpath} could not be loaded')\n if self.mol_graph is None:\n raise LoadingError(f'{fpath} could not be loaded')\n if ... | [
"0.7134093",
"0.6872284",
"0.65933144",
"0.64551723",
"0.64339787",
"0.6430436",
"0.63828295",
"0.62818027",
"0.61496055",
"0.6094512",
"0.603374",
"0.6030746",
"0.59087443",
"0.5907269",
"0.5879479",
"0.58437234",
"0.5764426",
"0.57622194",
"0.5746508",
"0.56595564",
"0.5659... | 0.7473328 | 0 |
Returns number of coordinates in molecule | def numCoords(self):
return self.nCoords | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ncoordinates(self):\n return _coordsys.coordsys_ncoordinates(self)",
"def get_position_count(self):\n return self.positions.count()",
"def get_number_of_atoms_to_optimize(self):\n v = self.c.get(simulation_cell=True)\n return len(v.data.stoichiometry)",
"def get_location_count... | [
"0.712937",
"0.68896955",
"0.6682992",
"0.6658044",
"0.6623628",
"0.66059047",
"0.659789",
"0.65699583",
"0.65676206",
"0.65655607",
"0.653029",
"0.6512143",
"0.6508083",
"0.64939696",
"0.64515364",
"0.644996",
"0.6441561",
"0.64376885",
"0.6404287",
"0.63998467",
"0.63998467... | 0.7566637 | 0 |
Returns number of residues in molecule | def numResidues(self):
resIDs = set (self.resnum)
return len (resIDs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numResidues(self):\n\n\t\tnres = 0\n\t\tfor chain in self.chain:\n\t\t\tnres += chain.numResidues()\n\n\t\treturn nres",
"def numResidues(self):\n\n return self.getHierView().numResidues()",
"def numResidues(self):\n\n return len(set(self._getResindices()))",
"def count_standard_residues(se... | [
"0.73842514",
"0.71384543",
"0.70287377",
"0.69197226",
"0.6806228",
"0.6750955",
"0.67200917",
"0.6663484",
"0.661888",
"0.65879613",
"0.658607",
"0.65720725",
"0.6533644",
"0.6491914",
"0.6457449",
"0.6451429",
"0.63130355",
"0.63130355",
"0.6307892",
"0.63019127",
"0.62926... | 0.72534335 | 1 |
Return residue information for a list of residue IDs or a list of atom IDs Information returned is dictionary with resID, resName, and list of atomIDs | def getResidueInformation(self, resIDs=None, atomIDs=None):
if resIDs is None:
resIDs = set ()
else:
resIDs = set (resIDs)
if atomIDs is not None:
for i in atomIDs:
resIDs.add (self._atomInfo[i]["residue"])
return self.getResidueIn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAtomInformation(self, resIDs=None, atomIDs=None):\n if atomIDs is None:\n atomIDs = set ()\n else:\n atomIDs = set (atomIDs)\n\n if resIDs is not None:\n for i in resIDs:\n atomIDs.update (self._residueInfo[i]['atomID'])\n retur... | [
"0.7150378",
"0.6973033",
"0.6774828",
"0.6747408",
"0.6537516",
"0.6406143",
"0.6402196",
"0.62607646",
"0.623107",
"0.6205784",
"0.61555",
"0.61223894",
"0.6087088",
"0.6075565",
"0.60619724",
"0.6034659",
"0.6003091",
"0.5999701",
"0.5997308",
"0.59484065",
"0.59321785",
... | 0.8144457 | 0 |
Return atom information for a list of residue IDs or a list of atom IDs Information returned is dictionary with atomID, name, symbol, coords, key and resID | def getAtomInformation(self, resIDs=None, atomIDs=None):
if atomIDs is None:
atomIDs = set ()
else:
atomIDs = set (atomIDs)
if resIDs is not None:
for i in resIDs:
atomIDs.update (self._residueInfo[i]['atomID'])
return self.getAtom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getResidueInformation(self, resIDs=None, atomIDs=None):\n if resIDs is None:\n resIDs = set ()\n else:\n resIDs = set (resIDs)\n\n if atomIDs is not None:\n for i in atomIDs:\n resIDs.add (self._atomInfo[i][\"residue\"])\n return s... | [
"0.75477123",
"0.6537882",
"0.63082254",
"0.6229611",
"0.6229209",
"0.6195589",
"0.6054145",
"0.59476566",
"0.5862807",
"0.5848148",
"0.58311504",
"0.5748749",
"0.569974",
"0.5685269",
"0.5678484",
"0.5678161",
"0.56374925",
"0.5617807",
"0.5608143",
"0.56007165",
"0.5597202"... | 0.77814454 | 0 |
Calcs sym. (3,3)matrix of main moment ( sum(y_i2+z_i2) sum(x_iy_i) sum(x_iz_i) ) ( sum(x_iy_i) sum(x_i2+z_i2) sum(y_iz_i) ) ( sum(x_iz_i) sum(y_iz_i) sum(x_i2+y_i2) ) and determines its eigen vectors. | def calc_main_axis(self):
#Clarify why the above step has been done
c0, c1, c2 = self.calc_geom_center ()
M = numpy.zeros ((3, 3), dtype=float)
M = [[0] * 3, [0] * 3, [0] * 3]
for x in self.atomcoords:
xi = x[0] - c0
yi = x[1] - c1
zi = x[2] - ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method3(self):\n cres=0.\n Ux_aloc=np.zeros((self.kS.Nx+1,self.kS.Ny+1),dtype=complex)\n Uy_aloc=np.zeros((self.kS.Nx+1,self.kS.Ny+1),dtype=complex)\n for ix in range(self.kS.Nx+1):\n for iy in range(self.kS.Ny+1):\n mat1=self.ALDM[ix ,iy, ... | [
"0.6341056",
"0.6197778",
"0.59098166",
"0.59077257",
"0.58390164",
"0.5824663",
"0.5816554",
"0.5794238",
"0.5787328",
"0.5775547",
"0.5767559",
"0.5702664",
"0.563582",
"0.5630446",
"0.5605044",
"0.5571747",
"0.55618626",
"0.55518264",
"0.5531558",
"0.5525319",
"0.5518729",... | 0.6783769 | 0 |
Apply transformation matrix to coordinates of molecule and return transformed coordinates. The molecule is unchanged. | def transform_molecule(self, transf_mat):
#Understand how the transformation is working
transf_molecule = []
for ind in self.atomcoords:
transf_coord = [0.0, 0.0, 0.0]
for i in (0, 1, 2):
transf_coord[0] = transf_coord[0] + transf_mat[0][i] * ind[i]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform( self, matrix3 ):\n self._coords = matrix3._matrix * self._coords\n return self",
"def apply_affine_transform(self, M):\n vertices = []\n for x,y in self.get_vertices():\n vertices.append(tuple(np.dot(M, [x, y, 1])[:2]))\n return type(self)(vertices, p... | [
"0.6766421",
"0.66744083",
"0.6652479",
"0.6443399",
"0.6402928",
"0.640192",
"0.6360943",
"0.6344729",
"0.6343382",
"0.62832785",
"0.62220734",
"0.62128997",
"0.6193657",
"0.6186517",
"0.6173619",
"0.61700153",
"0.6169294",
"0.6146787",
"0.61384815",
"0.61177623",
"0.6104963... | 0.67684996 | 0 |
Extracts a specific configuration section whos first line starts with your variable. Because we search if the title startswith your variable you could have multiple results so instead of always returning the first one, I give the option to return all | def get_config_section(self, title_startswith, return_all=True):
for section in self._config_sections:
if section[0].startswith(title_startswith):
if return_all:
yield section
else:
return section | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_config(config_key, group_name, search_text):\n matches = re.search(r'' + config_key + ' = \"(?P<' + group_name + '>.*)\"', search_text)\n if matches:\n return matches.group(group_name)\n else:\n return None",
"def get_parameter(par_name):\r\n config_file = open('./config.txt'... | [
"0.5681403",
"0.54952323",
"0.53923774",
"0.5318122",
"0.5291142",
"0.52247816",
"0.52173156",
"0.517183",
"0.50630736",
"0.5021582",
"0.49848035",
"0.49616316",
"0.49546444",
"0.49223867",
"0.49145496",
"0.4904096",
"0.48864162",
"0.4884662",
"0.48668957",
"0.48382285",
"0.4... | 0.71269023 | 0 |
True/False if in the global configuration the string is found. The line must NOT start with a space so if it is nested it will not be found | def has_global_config(self, config_string):
for line in self.running_config:
if config_string in line and not line.startswith(' '):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(self, line):\n if not isinstance(line, str):\n raise TypeError(\"Parameter 'line' not a 'string', is {0}\".format(type(line)))\n if line in self.contents:\n return line\n return False",
"def has_string(filepath, string):\n with open(filepath) as yaml_file:\... | [
"0.61785513",
"0.6121305",
"0.6017945",
"0.59900945",
"0.5799036",
"0.57977706",
"0.5792259",
"0.5782413",
"0.5749751",
"0.5704194",
"0.56794244",
"0.56708986",
"0.5640279",
"0.560435",
"0.5594872",
"0.55927074",
"0.5586909",
"0.55645937",
"0.5553554",
"0.5543993",
"0.5517022... | 0.69191134 | 0 |
Clean up the improperly escaped JSON returned by qstat | def clean_qstat_json(stream):
string_entry_re = re.compile(r'^\s*"(?P<key>.+)":"(?P<value>.+)"(?P<comma>,?)$')
lines = []
for line in stream.splitlines():
match = string_entry_re.match(line)
if match is not None:
fixed_value = json.dumps(match.group('value'))
line =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitise_json_error(error_dict):\n ret = copy.copy(error_dict)\n chop = len(JSON_ERROR)\n ret['detail'] = ret['detail'][:chop]\n return ret",
"def clear_json_quotes(json_data):\n lines = []\n for line in json_data.splitlines():\n if ':' in line:\n key, value = line.split('... | [
"0.58127475",
"0.58018494",
"0.57606757",
"0.5627643",
"0.56097245",
"0.55536044",
"0.55436516",
"0.5471536",
"0.5471227",
"0.54569983",
"0.5403549",
"0.5363076",
"0.53333116",
"0.52593404",
"0.5210553",
"0.5209999",
"0.5202776",
"0.51790303",
"0.51768774",
"0.5170841",
"0.51... | 0.7180396 | 0 |
This will reset the locations of all the agents who are currently interacting with the stochastic process | def reset_agent_locations(self):
self.transitions_left = self.T-1
self.x_agent = np.repeat(self.xT.reshape(1, self.dimensions), self.n_agents, axis=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.agents.reset()\n self._cur_obs, self._cur_lm = self.parallel_env.reset()\n self.agent_cum_rewards = np.zeros((len(self.agents), self.n_states, 1))\n self.agent_contiguous_states = np.full((len(self.agents), self.n_states), True)",
"def specific_reset(self) -> N... | [
"0.7500764",
"0.7330627",
"0.72445875",
"0.72088563",
"0.71489906",
"0.6944563",
"0.6922787",
"0.6870471",
"0.67991346",
"0.67327976",
"0.6704113",
"0.66960305",
"0.66872007",
"0.6682197",
"0.66569406",
"0.6539876",
"0.6512471",
"0.65107286",
"0.6501732",
"0.6496618",
"0.6479... | 0.74308413 | 1 |
Function creates and returns path to solution | def get_dir(solution: Solution, path: Path) -> Path:
return (
path
/ solution.language
/ solution.kyu
/ solution.title.replace(r'/\<>:"|?*', "")
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def BuildPath(DSLModel, table):\n folders = [\n DSLModel['GENERAL']['target_folder'],\n \"%s%s%s\" % (DSLModel['GENERAL']['target_folder'], os.sep, table['name'])\n ]\n for folder in folders:\n if not os.path.exists(folder):\n os.mkdir(folder)\n init_path = folde... | [
"0.6480136",
"0.60615504",
"0.60379106",
"0.5990965",
"0.5974058",
"0.59727556",
"0.5942542",
"0.5925447",
"0.5899446",
"0.58858216",
"0.5830768",
"0.58306986",
"0.5823139",
"0.57621247",
"0.57315177",
"0.57084495",
"0.57054764",
"0.570454",
"0.5698335",
"0.56767386",
"0.5675... | 0.6710517 | 0 |
Function creates file and write some content to it | def create_file(path: Path, content: str) -> None:
path.touch()
with path.open("w") as f:
f.write(content) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_file(self, name: str, content: str) -> None:\n file_path = self.path + os.path.sep + name\n with open(file_path, \"w+\") as file:\n file.write(content)\n file.close()",
"def create_file(self, content=\"\"):\n if (self.exists()):\n raise IOError(\"A... | [
"0.81397223",
"0.78380775",
"0.7491962",
"0.74819976",
"0.7467785",
"0.7405345",
"0.7390489",
"0.7324247",
"0.730875",
"0.72912717",
"0.72764987",
"0.72707933",
"0.72646177",
"0.7242832",
"0.72225344",
"0.71979415",
"0.719566",
"0.7162214",
"0.7141205",
"0.7122208",
"0.710518... | 0.7869145 | 1 |
Function writes solutions to files and create directories for them | def write_solutions_to_files(
solutions: List[Solution], path: Path, folder_name: str = "CodeWars"
) -> None:
stat = {}
path = path / folder_name
for solution in solutions:
if solution.kyu in stat:
stat[solution.kyu] += 1
else:
stat[solution.kyu] = 1
path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_to_conll_directory_structure(results: List[Dict], path: str):\n\n folder_structure = Path(path)\n for result in results:\n # Remove any forbidden character from the filename\n try:\n escaped_name = escape_filename(result[\"name\"])\n except BaseException:\n ... | [
"0.67715126",
"0.6248275",
"0.6196573",
"0.6157633",
"0.6144774",
"0.613035",
"0.6127758",
"0.61199534",
"0.61120516",
"0.6079349",
"0.60743326",
"0.6067717",
"0.60656357",
"0.6047686",
"0.60429007",
"0.60218495",
"0.60103655",
"0.60049367",
"0.5994313",
"0.59871346",
"0.5986... | 0.7535135 | 0 |
Compute the fragments resulting from the digestion | def compute_digest(self, part):
return StickyEndFragment.list_from_record_digestion(part, self.enzymes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_fragments(self):\n self.fragments = []\n for part in self.parts:\n for fragment in self.compute_digest(part):\n # The part is not a fragment if it hasn't been cut at all and\n # therefore doesn't have sticky ends. Exclude from fragments.\n ... | [
"0.6959769",
"0.6288708",
"0.62087476",
"0.62087476",
"0.62087476",
"0.6094342",
"0.6051384",
"0.59718543",
"0.5800067",
"0.5754928",
"0.57386017",
"0.5703846",
"0.5703846",
"0.56684077",
"0.5662424",
"0.5616061",
"0.55703056",
"0.55697423",
"0.55557424",
"0.5499034",
"0.5499... | 0.6887775 | 1 |
Compute the (stickyended) fragments resulting from the digestion of the mix's parts by the mix's enzyme. Note that all fragments receive an annotation (feature) of type "source" that will show in the genbank of final constructs. | def compute_fragments(self):
self.fragments = []
for part in self.parts:
for fragment in self.compute_digest(part):
# The part is not a fragment if it hasn't been cut at all and
# therefore doesn't have sticky ends. Exclude from fragments.
if n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_digest(self, part):\n return StickyEndFragment.list_from_record_digestion(part, self.enzymes)",
"def _fragment_seq(self, seq):\r\n num_fragments = self.Params['num_fragments']\r\n results = []\r\n start = 0\r\n for i in range(num_fragments):\r\n # My note... | [
"0.52510023",
"0.5149558",
"0.51282275",
"0.5073293",
"0.503008",
"0.49953097",
"0.4897387",
"0.48972395",
"0.48961145",
"0.4820046",
"0.48167",
"0.48150924",
"0.4814345",
"0.4802644",
"0.4779491",
"0.4779285",
"0.4767211",
"0.47554776",
"0.47322446",
"0.47106734",
"0.4698113... | 0.6292074 | 0 |
Return a Type2S compatible RestrictionLigationMix. If enzyme is "auto", it will be autoselected among BsmBI, BsaI, etc. | def generate_type2s_restriction_mix(parts, enzyme="auto", name="type2s_mix"):
if enzyme == "auto":
enzyme = autoselect_enzyme(parts)
return RestrictionLigationMix(
parts=parts,
enzymes=[enzyme],
fragment_filters=[NoRestrictionSiteFilter(str(enzyme))],
name=name,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __switch_restriction_type(self, categoryType):\n switch = {\n \"user\": self.userRestrictions,\n \"role\": self.roleRestrictions,\n \"channel\": self.channelRestrictions\n }\n return switch[categoryType]",
"def _handlespecials(self, secondary, typeset, ab... | [
"0.4884875",
"0.4809251",
"0.4754863",
"0.46297017",
"0.4623802",
"0.46120605",
"0.45946866",
"0.45043266",
"0.44917428",
"0.4374362",
"0.43525815",
"0.43378565",
"0.43378466",
"0.43344432",
"0.43110946",
"0.43069512",
"0.43010023",
"0.42973557",
"0.42955977",
"0.42727768",
"... | 0.7280072 | 0 |
Updates the position of every particle in the simulation | def update_particles(self):
for particle in self.particles:
particle.update_coordinates(self.bounds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self):\r\n for index in range(self.size):\r\n self.values[index] = self.values[index] + self.velocities[index]\r\n \r\n # Adjust values to keep particle inside boundaries.\r\n if self.values[index] < Particle.MIN_VALUE:\r\n self.values[inde... | [
"0.7324033",
"0.7315507",
"0.72283435",
"0.715461",
"0.70083815",
"0.6917084",
"0.69167185",
"0.6906512",
"0.69033587",
"0.67947924",
"0.67667013",
"0.6631071",
"0.66136414",
"0.6581417",
"0.65502197",
"0.6522706",
"0.65128857",
"0.6485951",
"0.6483328",
"0.6470195",
"0.64489... | 0.81058353 | 0 |
Draws all particles in the simulation | def draw_particles(self):
for particle in self.particles:
particle.draw() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_particles(self):\n for particle in self.particles:\n particle.update_coordinates(self.bounds)",
"def visualize(title, particles):\n\n plt.figure(figsize=(10,10))\n plt.title(\"Best configuration for \" + str(len(particles)) + \" particles\", size=25)\n plt.xlabel(\"xcoordina... | [
"0.683532",
"0.67019093",
"0.6604524",
"0.65906036",
"0.6534299",
"0.65119964",
"0.64401567",
"0.64401567",
"0.64401567",
"0.64401567",
"0.64401567",
"0.64401567",
"0.64401567",
"0.64401567",
"0.64121217",
"0.6393175",
"0.63187057",
"0.62595946",
"0.6196687",
"0.6175146",
"0.... | 0.8870028 | 0 |
Tries to retrieve an error message in case of error. | def get_error_message(self):
try:
return api.Api.get_error_message(self._session)
except exceptions.UnknownException:
return "<error message irrecoverable>" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_error_message(self):\n return self.error_message.get_error_message()",
"def error_message(self) -> Optional[str]:\n return pulumi.get(self, \"error_message\")",
"def error_message(self) -> Optional[str]:\n return pulumi.get(self, \"error_message\")",
"def error_message(self) -> O... | [
"0.7628588",
"0.76048464",
"0.76048464",
"0.76048464",
"0.76048464",
"0.76048464",
"0.76048464",
"0.76048464",
"0.74385816",
"0.74385816",
"0.74385816",
"0.74359477",
"0.74359477",
"0.7426397",
"0.73023534",
"0.7301262",
"0.7284961",
"0.72373664",
"0.71742094",
"0.7165162",
"... | 0.7638758 | 0 |
receives an array of lines from a txt file and returns an array of entry names | def getEntryNames(self,lines):
lines = self.stripText(lines)
#check if the first line is a count, ignore if it is
try:
linecount = parseNum(lines[0])
lines.pop(0)
except ValueError:
pass
return lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_names_list(file_path):\r\n\tnames_list = []\r\n\twith open(file_path) as file:\r\n\t for line in file:\r\n\t cline = line.rstrip().split()\r\n\t #row_id = cline[0]\r\n\t row_name = cline[1:]\r\n\t #names_list.append((row_id, \" \".join(row_name)))\r\n\t names_list.app... | [
"0.6910503",
"0.65771973",
"0.65146756",
"0.6485303",
"0.64273196",
"0.63842595",
"0.62274516",
"0.61713105",
"0.6166394",
"0.6159927",
"0.6137855",
"0.61020416",
"0.6081132",
"0.60642207",
"0.6059126",
"0.60428405",
"0.6033241",
"0.60113585",
"0.60039145",
"0.5996565",
"0.59... | 0.6910591 | 0 |
0x is hex, 0b is binary, 0 is octal. Otherwise assume decimal. | def parseNum(num):
num = str(num).strip()
base = 10
if (num[0] == '0') & (len(num) > 1):
if num[1] == 'x':
base = 16
elif num[1] == 'b':
base = 2
else:
base = 8
return int(num, base) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oct2dec(x):\n return int(x, 8)",
"def hex2oct(x):\n # moreZero = random.choice(range(10))\n moreZero = 0\n return oct(int(x, 16)).zfill(moreZero + len(oct(int(x, 16)))).strip('L')",
"def decimal_binary(num):\n\treturn \"{:08b}\".format(num)",
"def hex2oct(x):\n return oct(int(x, 16))[_oct_... | [
"0.64075613",
"0.6215741",
"0.6181376",
"0.6174665",
"0.61329657",
"0.5964508",
"0.5894812",
"0.58856773",
"0.5880079",
"0.5860254",
"0.57740873",
"0.57585174",
"0.57051873",
"0.56802815",
"0.56550217",
"0.5572038",
"0.54981416",
"0.5470686",
"0.5456558",
"0.54528594",
"0.544... | 0.6301472 | 1 |
Dummy dataset from directory | def dir_dataset():
return TabularDataset.from_path('tests/data/dummy_tabular', sep=',') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dataset_from_dir(dir_dataset):\n dummy = \"malesuada. Integer id magna et ipsum cursus vestibulum. Mauris magna.\"\n assert dir_dataset[0][0] == dummy\n assert dir_dataset[0][1] == '8'\n\n dummy = \"Sed molestie. Sed id risus quis diam luctus lobortis. Class\"\n assert dir_dataset[100][0] =... | [
"0.7194964",
"0.6927574",
"0.6810881",
"0.67431825",
"0.6693449",
"0.6671517",
"0.65843475",
"0.65596455",
"0.6546283",
"0.652645",
"0.64785117",
"0.64360887",
"0.6372455",
"0.63443136",
"0.6198113",
"0.6169361",
"0.6162819",
"0.61460835",
"0.61185616",
"0.610153",
"0.6089764... | 0.77207047 | 0 |
Test dataset is invalid as it has different columns | def test_invalid_dataset():
train = (("Lorem ipsum dolor sit amet", 3, 4.5),
("Sed ut perspiciatis unde", 5.5))
with pytest.raises(ValueError):
TabularDataset(train) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_dataset2():\n train = ((\"Lorem ipsum dolor sit amet\", 3, 4.5),\n (\"Sed ut perspiciatis unde\", 4, 5.5))\n val = ((\"ipsum quia dolor sit\", 3.5),)\n with pytest.raises(ValueError):\n TabularDataset(train, val)",
"def validate_dataset(self):\n pass",
"def t... | [
"0.7512068",
"0.7381182",
"0.7345962",
"0.73354626",
"0.70911366",
"0.70565444",
"0.7027851",
"0.6974138",
"0.69408023",
"0.6928401",
"0.6908162",
"0.6891141",
"0.68760514",
"0.6805177",
"0.6763268",
"0.67498577",
"0.6745198",
"0.6732854",
"0.6682164",
"0.6654148",
"0.6638168... | 0.75121814 | 0 |
Test dataset missing either val or test | def test_incomplete_dataset():
train = (("Lorem ipsum dolor sit amet", 3, 4.5),
("Sed ut perspiciatis unde", 4, 5.5))
t = TabularDataset(train)
assert len(t.val) == 0
assert len(t.test) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_dataset2():\n train = ((\"Lorem ipsum dolor sit amet\", 3, 4.5),\n (\"Sed ut perspiciatis unde\", 4, 5.5))\n val = ((\"ipsum quia dolor sit\", 3.5),)\n with pytest.raises(ValueError):\n TabularDataset(train, val)",
"def test_valid_dataset():\n train = ((\"Lorem ips... | [
"0.7137519",
"0.6921596",
"0.6840556",
"0.6723769",
"0.65736294",
"0.6567936",
"0.65126985",
"0.6471666",
"0.64417756",
"0.642831",
"0.6427554",
"0.6397418",
"0.6389928",
"0.6386678",
"0.635364",
"0.6350452",
"0.6347745",
"0.62659067",
"0.6257714",
"0.6222885",
"0.61743414",
... | 0.72785425 | 0 |
Test caching the dataset | def test_cache_dataset():
train = (
("Lorem ipsum dolor sit amet", 3, 4.5),
("Sed ut perspiciatis unde", 5, 5.5),
("Lorem ipsum dolor sit amet", 3, 4.5),
("Sed ut perspiciatis unde", 5, 5.5),
("Lorem ipsum dolor sit amet", 3, 4.5),
("Sed ut per... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_local_cache():",
"def _retrieveCachedData(self):",
"def testGetCachedModelsData(self):\n models = models_logic.getModelsData()\n models2 = models_logic._getModelsData()\n self.assertEqual(models, models2)",
"def test_dataset(self):\n self.assertIsInstance(self.dataset, LazyDataset)\n... | [
"0.7373115",
"0.7216221",
"0.70952666",
"0.69685024",
"0.68897957",
"0.6672142",
"0.6656872",
"0.6628021",
"0.66166323",
"0.6604893",
"0.65532225",
"0.65411603",
"0.65386087",
"0.6490696",
"0.6489177",
"0.64826524",
"0.6477721",
"0.6472047",
"0.6454929",
"0.64453644",
"0.6443... | 0.80463225 | 0 |
Test loading a dataset from file | def test_dataset_from_file(train_dataset):
dummy = "justo. Praesent luctus. Curabitur egestas nunc sed libero. Proin sed"
assert train_dataset[0][0] == dummy
assert train_dataset[0][1] == '6' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_load_dataset():\n\n # Given\n dataset_file_name = core.config.app_config.TESTING_DATA_FILE\n\n # When\n subject = utils.load_dataset(filename=dataset_file_name)\n\n # Then\n assert isinstance(subject, pd.DataFrame)\n assert subject.shape == (5940, 41)",
"def test_full_dataset_from_f... | [
"0.81178737",
"0.7572304",
"0.74137664",
"0.73800063",
"0.7332739",
"0.71190196",
"0.7118904",
"0.7094424",
"0.70366365",
"0.69988334",
"0.69861263",
"0.6976379",
"0.6933953",
"0.6909137",
"0.68575734",
"0.6812866",
"0.6811275",
"0.67873716",
"0.67685354",
"0.6760691",
"0.674... | 0.8289094 | 0 |
Test autogenerating val and test sets from a dir | def test_dataset_autogen_dir_val_test(autogen_dataset_dir):
train_dummy = "egestas blandit. Nam nulla magna, malesuada vel, convallis in, cursus"
val_dummy = "turpis egestas. Aliquam fringilla cursus purus. Nullam scelerisque neque sed"
test_dummy = "nibh. Aliquam ornare, libero at auctor ullamcorper, nisl ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dataset_autogen_dir_with_test(autogen_dataset_dir_with_test):\n train_dummy = \"Donec non justo. Proin non massa non ante bibendum ullamcorper.\"\n val_dummy = \"nibh. Aliquam ornare, libero at auctor ullamcorper, nisl arcu iaculis\"\n test_dummy = \"a sollicitudin orci sem eget massa. Suspendiss... | [
"0.63870126",
"0.6308055",
"0.62773407",
"0.61572057",
"0.6116161",
"0.6100844",
"0.60989815",
"0.6098027",
"0.60950744",
"0.60588115",
"0.60375345",
"0.60348296",
"0.60099953",
"0.6002345",
"0.5969505",
"0.5959352",
"0.5892902",
"0.58928853",
"0.5879887",
"0.58510256",
"0.58... | 0.6764676 | 0 |
Test autogenerating val set from a dir with given test and different ratios | def test_dataset_autogen_dir_val_test_ratios(autogen_dataset_dir_ratios):
train_dummy = "Aenean euismod mauris eu elit. Nulla facilisi. Sed neque. Sed"
val_dummy = "ut quam vel sapien imperdiet ornare. In faucibus. Morbi vehicula."
test_dummy = "nibh. Aliquam ornare, libero at auctor ullamcorper, nisl arcu ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dataset_autogen_dir_val_test_ratios_with_test(autogen_dataset_dir_ratios_with_test):\n train_dummy = \"Donec egestas. Aliquam nec enim. Nunc ut erat. Sed nunc\"\n val_dummy = \"nibh. Aliquam ornare, libero at auctor ullamcorper, nisl arcu iaculis\"\n test_dummy = \"a sollicitudin orci sem eget ma... | [
"0.72599345",
"0.6591266",
"0.64512855",
"0.6245318",
"0.62413335",
"0.61997986",
"0.61820275",
"0.6170518",
"0.61303353",
"0.6044009",
"0.60395783",
"0.60286623",
"0.59710795",
"0.59501",
"0.5890054",
"0.5815091",
"0.5806323",
"0.57230973",
"0.5686882",
"0.56834006",
"0.5658... | 0.7174194 | 1 |
Test dataset is immutable | def test_dataset_setitem(train_dataset):
with pytest.raises(Exception):
train_dataset[0] = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setitem__(self):\n raise ValueError(\"Dataset objects are immutable\")",
"def test(self, dataset) -> None:\n raise NotImplementedError()",
"def __delitem__(self):\n raise ValueError(\"Dataset objects are immutable\")",
"def test_write(self):\n data2 = self.data.copy()\n ... | [
"0.71460634",
"0.6865465",
"0.67172766",
"0.66917646",
"0.64983195",
"0.64720744",
"0.64435196",
"0.6439189",
"0.6431224",
"0.63972193",
"0.63824093",
"0.63445646",
"0.62604547",
"0.62170357",
"0.61522806",
"0.61310345",
"0.6125228",
"0.61163086",
"0.61118364",
"0.6106437",
"... | 0.6922113 | 1 |
Loop through the board and find position where there is empty square (0 = empty) and return position | def find_empty_squares(board):
for i in range(len(board)):
for j in range(len(board[0])):
if board[i][j] == 0:
return (i,j) #row , column
#if there are no blank squres
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_empty(self):\n num_rows = len(self.board)\n num_cols = len(self.board[0])\n\n for i in range(num_rows):\n for j in range(num_cols):\n if self.board[i][j] == 0:\n return (i, j)",
"def findEmpty(grid):\n for x in range(len(grid.board)):\n for y in range(len(grid.boa... | [
"0.82490176",
"0.79800963",
"0.7958425",
"0.78399754",
"0.78382415",
"0.7802007",
"0.7783275",
"0.76683545",
"0.7661243",
"0.758047",
"0.7540548",
"0.74784946",
"0.7398503",
"0.7355691",
"0.73444676",
"0.7339144",
"0.7170152",
"0.7149667",
"0.7123986",
"0.7098115",
"0.7083824... | 0.8234963 | 1 |
Put classifier options here as data attributes. Options include the type of gradients, regularizer weight, etc... Also put trainable classifier parameters here. The function fit below will learn these parameters | def __init__(self, options):
# option[0] = true means use all instances to calculate the w, w0.
# option[0] = false means use SDG to calculate the w, w0.
self.gradients_type = options[0]
self.X_train = options[1]
self.y_train = options[2]
self.X_test = options[3]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(self, data):\n self.labels = np.array(data['class'])\n self.num_classes = len(data['class'].unique())\n self.all_classes = np.sort(np.unique(self.labels))\n # populating the features dataframe\n feat_df = data[['value']].copy()\n feat_df['length'] = feat_df['value'... | [
"0.6174732",
"0.61628854",
"0.6149476",
"0.61287147",
"0.600993",
"0.5987867",
"0.5982189",
"0.59467703",
"0.5943305",
"0.59382117",
"0.5916383",
"0.59139675",
"0.5907929",
"0.5907929",
"0.5907929",
"0.5907929",
"0.5907929",
"0.5907929",
"0.5907929",
"0.5907929",
"0.5907929",... | 0.63509476 | 0 |
Split data using crossvalid | def split_data_crossvalid(data):
X_trainfolder = []
X_testfolder = []
y_trainfolder = []
y_testfolder = []
data = data[data[:, 0].argsort()]
number_one = np.count_nonzero(data[:, :1])
data_one = data[np.where(data[:, 0] == 1)]
data_zero = data[np.where(data[:, 0] == 0)]
one_ratio = r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def splitTrainValidate(df, perc_training = 0.8):\n train = df.sample(frac=perc_training)#, random_state=200)\n validate = df.drop(train.index)\n return (train, validate)",
"def train_test_split(data, validate_size=0.3):\r\n\r\n split = len(data) * (1 - validate_size)\r\n split = int(split)\r\n ... | [
"0.68448794",
"0.67563826",
"0.67532885",
"0.67182785",
"0.66650224",
"0.6663142",
"0.65856904",
"0.65571773",
"0.6491096",
"0.647133",
"0.6460884",
"0.6445687",
"0.6437842",
"0.6434093",
"0.6432713",
"0.6332842",
"0.6314032",
"0.6311728",
"0.62737423",
"0.62258565",
"0.62253... | 0.71939325 | 0 |
Makes sure the table's schema is not different from the one in the database. This might happen if you try to load a query into a table which already exists and has a different schema. | def verify_table(self):
metadata = MetaData()
metadata.reflect(bind = StatusSource.engine)
mine = str(self.table.columns)
verified = str(metadata.tables[self.tablename].columns)
if mine != verified:
raise DbException("Table '%s' in the database has schema %s whereas t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_table(self):\r\n metadata = MetaData()\r\n metadata.reflect(bind = DbInsertStatusHandler.engine)\r\n mine = str(self.table.columns)\r\n verified = str(metadata.tables[self.tablename].columns)\r\n if mine != verified:\r\n raise DbException(\"Table '%s' in the... | [
"0.7315855",
"0.71018374",
"0.6478678",
"0.63780713",
"0.6374487",
"0.6295386",
"0.6252026",
"0.6188901",
"0.61775535",
"0.6118451",
"0.61183685",
"0.6109127",
"0.60954785",
"0.6059003",
"0.60547656",
"0.6028563",
"0.6028498",
"0.6022504",
"0.6017053",
"0.5977142",
"0.5971494... | 0.72868764 | 1 |
Write a script for each configuration. | def write_scripts(self, out, ref, file1, file2):
for config in self.configurations:
program_folder = os.path.join(out, self.out)
config.write_Strelka_script(program_folder, self.path2exe, ref, file1, file2, self.template_config)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_scripts(self, out, ref, file1, file2):\n for config in self.configurations:\n program_folder = os.path.join(out, self.out)\n config.write_Virmid_script(program_folder, self.path2exe, ref, file1, file2)\n return None",
"def write_scripts(self, out, ref, file1, file2):... | [
"0.66551846",
"0.66281176",
"0.65822375",
"0.64648294",
"0.63713336",
"0.6296705",
"0.61539024",
"0.6127153",
"0.6027238",
"0.60052764",
"0.5977918",
"0.5944761",
"0.594466",
"0.5922986",
"0.5922004",
"0.58734614",
"0.58713573",
"0.58563054",
"0.58387333",
"0.5813227",
"0.575... | 0.6889735 | 0 |
Write a script for each configuration. | def write_scripts(self, out, ref, file1, file2):
for config in self.configurations:
program_folder = os.path.join(out, self.out)
config.write_Virmid_script(program_folder, self.path2exe, ref, file1, file2)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_scripts(self, out, ref, file1, file2):\n for config in self.configurations:\n program_folder = os.path.join(out, self.out)\n config.write_Strelka_script(program_folder, self.path2exe, ref, file1, file2, self.template_config)\n return None",
"def write_scripts(self, o... | [
"0.68889606",
"0.66269445",
"0.65812343",
"0.6464048",
"0.63705516",
"0.62990373",
"0.6153519",
"0.61278",
"0.60243785",
"0.6005693",
"0.5977837",
"0.59471023",
"0.5943744",
"0.5920994",
"0.5918582",
"0.58721596",
"0.5871096",
"0.5853196",
"0.5839268",
"0.58133847",
"0.575741... | 0.6654359 | 1 |
Add a configuration (CaVEMan requires a specific add configuration). | def add_configuration(self, params):
config_index = len(self.configurations)+1
# '-g' is a mandatory argument of CaVEMan (Location of tsv ignore regions file)
# Other programs do not require (or even support) this type of file
# Therefore, this benchmark framework makes this file an opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(ctx, option, value):\n properties = option.split(\".\")\n section = properties[0]\n option = properties[1]\n cfg = ctx.obj['cfg']\n if not cfg.has_section(section):\n cfg.add_section(section)\n cfg.set(section, option, value)\n with open(config_path(), 'w') as fp:\n cfg.w... | [
"0.6856017",
"0.6800043",
"0.6703802",
"0.6563964",
"0.65386564",
"0.649925",
"0.64899886",
"0.64574206",
"0.6403177",
"0.64015955",
"0.6327982",
"0.6312104",
"0.6308469",
"0.6271278",
"0.62437373",
"0.6228997",
"0.6166103",
"0.6128435",
"0.6106378",
"0.6010965",
"0.60036975"... | 0.704914 | 0 |
Returns string representation of instance's vector clock. | def vector_clock_to_string(vector_clock):
return " ".join(map(str, vector_clock)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n struct_repr = \", \".join([\n \"velocity_north_m_s: \" + str(self.velocity_north_m_s),\n \"velocity_east_m_s: \" + str(self.velocity_east_m_s),\n \"velocity_down_m_s: \" + str(self.velocity_down_m_s)\n ])\n\n return f\"S... | [
"0.6610332",
"0.6346966",
"0.6257302",
"0.62292564",
"0.6190859",
"0.61635774",
"0.611468",
"0.60891485",
"0.60139275",
"0.5986794",
"0.5986516",
"0.59781504",
"0.5972218",
"0.59496164",
"0.593425",
"0.5913154",
"0.5911753",
"0.59056216",
"0.59056216",
"0.58397394",
"0.581564... | 0.77909863 | 0 |
Returns list representation of a vector clock string. | def vector_clock_from_string(vector_clock_str):
return map(int, vector_clock_str.split()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vector_clock_to_string(vector_clock):\n return \" \".join(map(str, vector_clock))",
"def get_timestamped_strings(self):\n ret_list = []\n i = 0\n while i < len(self.__string_list):\n ret_list.append(self.__timestamp_list[i].strftime(\"%Y-%m-%d %H:%M:%S\")+\" \"+self.__strin... | [
"0.70133",
"0.60832995",
"0.60250175",
"0.59068",
"0.5850859",
"0.5796242",
"0.57788795",
"0.5663541",
"0.5638931",
"0.5581328",
"0.5551795",
"0.5547354",
"0.5484512",
"0.5477995",
"0.5456404",
"0.54546463",
"0.5432998",
"0.54109836",
"0.5403661",
"0.5394659",
"0.53903794",
... | 0.6796751 | 1 |
Returns sync of two vector clocks. Synced vector clock is the max along each index of both. | def sync_vector_clocks(vector_clock_1, vector_clock_2):
return [max(i,j) for i,j in zip(vector_clock_1, vector_clock_2)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_synchronization(self):\n return self.client.call('GET', self.name + 'time-synchronization')",
"def sync(schedule):\n\t# Process the buses from the schedule in the form of \n\t# buses = [(offset,busid), (offset,busid), ...(offset,busid)], which is\n\t# buses = [(v0,m0),(v1,m1), ... (vn,mn)]\n\tbus... | [
"0.5416491",
"0.53805757",
"0.53406554",
"0.5250166",
"0.5238258",
"0.5198678",
"0.5196959",
"0.51699257",
"0.5096831",
"0.5093914",
"0.50732654",
"0.5056318",
"0.49853855",
"0.49777696",
"0.4950728",
"0.49410853",
"0.4924181",
"0.49199313",
"0.48798198",
"0.48497033",
"0.484... | 0.82308435 | 0 |
Returns (ip, port) tuple for current time server. Returns False if current time server doesn't exist or is down. | def get_time_server_host(self):
if self.am_leader:
return self.host
if not self.time_server_set:
return False
try:
return self.global_time_server.get_host()
except socket.error:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_time_server(self):\n processes = self.get_processes()\n if processes:\n server = processes.itervalues().next()\n host = server.get_leader()\n if host:\n self.global_time_server = xmlrpclib.ServerProxy(\"http://%s:%d\"%(host[0], host[1]))\n ... | [
"0.6847027",
"0.63060564",
"0.60590905",
"0.60009223",
"0.59854466",
"0.5951974",
"0.5917213",
"0.59144336",
"0.5847239",
"0.5819647",
"0.5780489",
"0.5731247",
"0.5716491",
"0.57000166",
"0.5697347",
"0.5674426",
"0.56710035",
"0.5652073",
"0.56456965",
"0.56451917",
"0.5618... | 0.72449154 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.