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 |
|---|---|---|---|---|---|---|
Test Vimeo iframe tag generation | def test_vimeo(disable_vimeo_api_query):
sample = ".. vimeo:: VID\n :height: 400\n :width: 600"
html = get_html_from_rst(sample)
assert_html_contains(
html,
"iframe",
attributes={
"src": ("https://player.vimeo.com/" "video/VID"),
"height": "400",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_embed_ok(self):\n self.go200('minus_upload')\n self.formfile('minus_upload', 'file', AUDIO_FILE)\n self.fv('minus_upload', 'id_embed_video', YOUTUBE_URL) \n self.submit200()\n self.notfind(\"Невірний\")\n self.show()\n self.find(\"youtube_video\")\n ... | [
"0.6765384",
"0.6609938",
"0.6272188",
"0.6248358",
"0.6134915",
"0.59213513",
"0.5919659",
"0.57093745",
"0.5658802",
"0.5614822",
"0.5593409",
"0.5576847",
"0.552594",
"0.5473205",
"0.54101515",
"0.5403207",
"0.5376431",
"0.53059375",
"0.52948874",
"0.52918184",
"0.52411723... | 0.7844545 | 0 |
A base config of LocaleBorg. | def localeborg_base():
LocaleBorg.reset()
assert not LocaleBorg.initialized
LocaleBorg.initialize({}, "en")
assert LocaleBorg.initialized
assert LocaleBorg().current_lang == "en"
try:
yield
finally:
LocaleBorg.reset()
assert not LocaleBorg.initialized | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config(settings):\n\n #T = current.T\n\n # Pre-Populate\n settings.base.prepopulate.append(\"locations/TH\")\n\n # Uncomment to restrict to specific country/countries\n settings.gis.countries.append(\"TH\")\n\n # -------------------------------------------------------------------------\n #... | [
"0.64866304",
"0.61988604",
"0.61988604",
"0.61805487",
"0.60943705",
"0.60545963",
"0.6005034",
"0.5965607",
"0.5960212",
"0.593771",
"0.5922106",
"0.5899246",
"0.5899246",
"0.58565474",
"0.5805839",
"0.57934225",
"0.5767726",
"0.57531476",
"0.57386273",
"0.5731498",
"0.5722... | 0.6423912 | 1 |
Create html output from rst string | def get_html_from_rst(rst):
compiler = nikola.plugins.compile.rest.CompileRest()
compiler.set_site(FakeSite())
return compiler.compile_string(rst)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rst_to_html(input_string, source_path=None, destination_path=None,\n input_encoding='unicode', doctitle=1, initial_header_level=1):\n overrides = {'input_encoding': input_encoding,\n 'doctitle_xform': doctitle,\n 'initial_header_level': initial_header_level,\n ... | [
"0.709398",
"0.66510856",
"0.6648247",
"0.6646475",
"0.65572613",
"0.65189904",
"0.64840823",
"0.64663064",
"0.63909996",
"0.62470186",
"0.6201088",
"0.61976624",
"0.61944747",
"0.61944747",
"0.61889017",
"0.61869967",
"0.61695504",
"0.6117476",
"0.6104067",
"0.6102414",
"0.6... | 0.72522247 | 0 |
Test if HTML document includes an element with the given attributes and text content. The HTML is parsed with lxml for checking against the data you provide. The method takes an element argument, a string representing the name of an HTML tag, like "script" or "iframe". We will try to find this tag in the document and p... | def assert_html_contains(html, element, attributes=None, text=None):
html_doc = lxml_html.parse(StringIO(html))
try:
tag = next(html_doc.iter(element))
except StopIteration:
raise Exception("<{0}> not in {1}".format(element, html))
if attributes:
arg_attrs = set(attributes.item... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_contains_text(self, text, element_tag=\"*\"):\n return self.wait_until_element_find(locator_type=By.XPATH,\n locator=f\".//{element_tag}[contains(text(), '{text}')]\")",
"def element(tag, attrib={}, text=None):\n ele = Element(tag, attrib)\n if ... | [
"0.57328683",
"0.5658947",
"0.53158635",
"0.5221668",
"0.5220453",
"0.514926",
"0.5106635",
"0.50902253",
"0.50742674",
"0.50740737",
"0.50482595",
"0.5032578",
"0.50092673",
"0.49938992",
"0.49458674",
"0.49129403",
"0.48839796",
"0.48828787",
"0.4844136",
"0.48328614",
"0.4... | 0.76333463 | 0 |
Disable query of the vimeo api over the wire Set Vimeo.request_size to False for avoiding querying the Vimeo api over the network. | def disable_vimeo_api_query():
before = vimeo.Vimeo.request_size
vimeo.Vimeo.request_size = False
try:
_reload(nikola.plugins.compile.rest)
yield
finally:
vimeo.Vimeo.request_size = before | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_rate_limit_forward(self):\n self.headers = {\n 'Content-Type': 'application/json; charset=utf-8',\n 'X-Algolia-API-Key': self.api_key,\n 'X-Algolia-Application-Id': self.application_id,\n 'User-Agent': ('Algolia Search for python %s' % VERSION)\n ... | [
"0.51495045",
"0.48969105",
"0.4848587",
"0.4836588",
"0.48320383",
"0.48153383",
"0.47671932",
"0.47585866",
"0.47426912",
"0.4658645",
"0.46517655",
"0.46517655",
"0.46517655",
"0.46294478",
"0.46228823",
"0.455569",
"0.45410028",
"0.4495744",
"0.44896275",
"0.44370815",
"0... | 0.8127371 | 0 |
Create a new ellipsoid | def newEllipsoid(**kwds):
# invoke the foundry to get to the class with the implementation
ellipsoid = core.ellipsoid()
# instantiate one and return it
return ellipsoid(**kwds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createEllipsoid( position=(0,0,0), radius=(1,1,1), colour=(0.6,0.6,0.6), samplesY = 20, samplesXZ = 20, exponentBottom = 2, exponentTop = 2, exponentSide = 2 ):\r\n \r\n if exponentBottom < 2.0 or exponentTop < 2.0 or exponentSide < 2.0 :\r\n raise ValueError( 'Exponents for ellipsoid must all be ... | [
"0.6899035",
"0.6276094",
"0.6101649",
"0.60961974",
"0.6080594",
"0.6074945",
"0.59764946",
"0.59272504",
"0.5871167",
"0.58074254",
"0.5727118",
"0.5713009",
"0.56693137",
"0.5612375",
"0.55892706",
"0.5580605",
"0.55348873",
"0.5517559",
"0.54463154",
"0.5418912",
"0.54049... | 0.78283316 | 0 |
Render an inventory menu, which displays the items in the inventory, and the letter to select them. Will move to a different position based on where the player is located, so the player can always see where they are. | def render_inventory_menu(console: Console, engine: Engine) -> None:
console.draw_frame(80, 0, 20, 43, "INVENTORY", True,
fg=(255, 255, 255),
bg=(0, 0, 0))
number_of_items_in_inventory = len(engine.player.inventory.items)
width = 20
# number_of_items_in_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inventory(game):\n\n # Offset for displaying list on-screen\n x, y = 6, 2\n # Currently selected item\n selection = 0\n # Max number of items shown at once\n max_items = 10\n # Number of items scrolled through so far\n scrolled = 0\n # Offset for messages\n x_msg, y_msg = 2, max_i... | [
"0.73191905",
"0.7254777",
"0.6703341",
"0.6687684",
"0.6648477",
"0.6551185",
"0.6543395",
"0.6526214",
"0.6485202",
"0.6290936",
"0.62841386",
"0.6232132",
"0.61900747",
"0.61900747",
"0.6124227",
"0.61190903",
"0.60794646",
"0.6059572",
"0.60148025",
"0.60062957",
"0.59947... | 0.80878377 | 0 |
Create latitudelongitudegrid for specified channel data. A latitudelogitude grid is created from geolocation information from 11 x 11 boxes corresponding to the image data. The resolution and dimension of the image and latitudelogitude grid depend on the specified channel. | def get_latlon_grid(self, channel="1"):
ImageDimension = namedtuple("ImageDimension", ["lon", "lat"])
imagedimension = ImageDimension(
*self._convert_metastr(self.meta[f"IMAGEDATAINFORMATION{channel}"], tuple)[
:2
]
)
lat, lon = self.read_coordina... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_grid(dataset):\n top_left_lat = dataset[\"a\"][0]\n top_left_lng = dataset[\"a\"][1]\n top_right_lng = dataset[\"c\"][1]\n bot_left_lat = dataset[\"b\"][0]\n\n lng_row = []\n lat_col = []\n i = top_left_lng\n while i < top_right_lng:\n lng_row.append(round(i, 5))\n i ... | [
"0.6088046",
"0.6063031",
"0.60484874",
"0.59672564",
"0.5802529",
"0.57952696",
"0.57486963",
"0.5746483",
"0.5738083",
"0.5723963",
"0.5699488",
"0.5683187",
"0.5678278",
"0.5609553",
"0.56036705",
"0.55991954",
"0.5596098",
"0.55732584",
"0.5553073",
"0.5535441",
"0.553266... | 0.76141745 | 0 |
Estimate the cloud top height according to Baum et al., 2012 | def get_cloudtopheight(self):
bt = self.get_brightnesstemperature("14")
cloudmask = self.retrieve_cloudmask()
latitude = self.scenecenter.latitude
month = self.datetime.month
return cloudtopheight_IR(bt, cloudmask, latitude, month, method="modis") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cloud_top_height(\n r,\n azimuth,\n elevation,\n st_sweep,\n ed_sweep,\n refl,\n eth_thld=0,\n noise_thld=-2,\n min_range=15e3,\n verbose=False,\n):\n earth_radius = 6371000\n\n na0 = st_sweep[1]\n nsweep = len(st_sweep)\n cloudtop = np.zeros((na0, len(r))) + np.NaN\n ... | [
"0.6496436",
"0.64250344",
"0.63014233",
"0.63014233",
"0.63014233",
"0.62734956",
"0.62678087",
"0.6001903",
"0.59957576",
"0.5945909",
"0.5942711",
"0.59399575",
"0.59399575",
"0.5902483",
"0.5877307",
"0.58730364",
"0.58112586",
"0.5736717",
"0.573274",
"0.5731176",
"0.571... | 0.7790907 | 0 |
Estimate the date time per scanline. Based on the approximate recording time for one ASTER image a date time array is constructed along the flight direction and depending on the sensor resolution. | def dt_estimate_scanlines(self, sensor="vnir"):
dtdelta = datetime.timedelta(seconds=8, milliseconds=849)
scanlines = {"vnir": 4200, "swir": 2100, "tir": 700}
return np.linspace(-0.5, 0.5, scanlines[sensor]) * dtdelta + self.datetime | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_info(input_file):\n original_path = os.getcwd() #set original directory\n save_path = input_file['save_path']\n planet = input_file['exoplanet'] #set exoplanet name\n print '\\nObtain the images .... \\n'\n print 'Change to ', save_path\n os.chdir(save_path) #change to save directory whe... | [
"0.5989216",
"0.59813",
"0.58474916",
"0.58234465",
"0.5804293",
"0.57660073",
"0.56493163",
"0.5617467",
"0.55724144",
"0.55497277",
"0.54996896",
"0.5426524",
"0.5376058",
"0.52915376",
"0.52908814",
"0.52493185",
"0.5246039",
"0.5241682",
"0.52151155",
"0.5198376",
"0.5192... | 0.6219165 | 0 |
Calculate sensor zenith and azimuth angles. Angles are derived for each pixel depending on the channel and the corresponding ASTER subsensor ("VNIR", "SWIR", "TIR"), as well as on the subsensor geometry and settings. | def sensor_angles(self, channel="1"):
if channel != "3B":
sensor = self.channel2sensor[channel]
else:
sensor = "VNIRB"
# Angular data from ASTER metadata data.
S = float(self.meta["MAPORIENTATIONANGLE"])
FOV = {"VNIR": 6.09, "VNIRB": 5.19, "SWIR": 4.9, "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def azizen(self):\n # x0,y0 array pixel coordinates relative to cx,cy\n# ndy0,ndx0=img.shape\n ndy0=self.ndy0\n ndx0=self.ndx0\n x0,y0=np.meshgrid(np.linspace(0,ndx0-1,ndx0)-self.cx,np.linspace(0,ndy0-1,ndy0)-self.cy)\n r0=np.sqrt(x0**2+y0**2)/self.pr0 # fractional radial ... | [
"0.64948094",
"0.61391693",
"0.6111236",
"0.5870285",
"0.58365667",
"0.58314174",
"0.5796266",
"0.5782998",
"0.57819575",
"0.57208097",
"0.56575197",
"0.56436014",
"0.5569998",
"0.5560468",
"0.55492103",
"0.55328006",
"0.5520764",
"0.5502953",
"0.5488787",
"0.5469046",
"0.545... | 0.73898125 | 0 |
Moist adiabatic lapse rate in [K/km]. | def lapserate_moist_adiabate():
return 6.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lam(freq):\n return C / freq",
"def lam(E):\n return (12398.4/E)*1e-10",
"def acc_rate(L_acc, R, M):\n mdot = 1.25*L_acc*u.W*R*u.R_sun/(G*M*u.M_sun)\n mdot = mdot.decompose().to(u.M_sun/u.yr)\n return(mdot/(u.M_sun/u.yr))",
"def lapse(self):\n pass",
"def lapserate(t, z, sigma, la... | [
"0.67962",
"0.65155506",
"0.633966",
"0.63099146",
"0.6259203",
"0.6259203",
"0.61408263",
"0.60732925",
"0.6028457",
"0.60240525",
"0.60038674",
"0.59975666",
"0.596127",
"0.58910197",
"0.5885583",
"0.5871205",
"0.58628464",
"0.5851471",
"0.58435106",
"0.581123",
"0.579676",... | 0.716511 | 0 |
Translate geocentric to geodetic latitudes. | def geocentric2geodetic(latitude):
return np.rad2deg(np.arctan(1.0067395 * np.tan(np.deg2rad(latitude)))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cr2lonlat_for_geotif(path):\n old_cs, new_cs, gta, local_vars = _create_xform(path)\n transform = osr.CoordinateTransformation(old_cs, new_cs)\n\n def composite(c, r):\n \"\"\"xform from (c, r) to (lon, lat)\"\"\"\n x, y = gta * (c, r)\n lat, lon = transform.TransformPoint(x, y)[:... | [
"0.6625019",
"0.6440781",
"0.6332487",
"0.6251425",
"0.62414336",
"0.61743146",
"0.6173315",
"0.6170592",
"0.6166276",
"0.615443",
"0.61447704",
"0.6036489",
"0.59269917",
"0.5913509",
"0.58950084",
"0.5847361",
"0.58101594",
"0.5802549",
"0.57882667",
"0.57486916",
"0.573002... | 0.7091259 | 0 |
Constructor Copy the Pitcher object into the PitcherGameEntry fields | def __init__(self):
super(PregamePitcherGameEntry, self).__init__()
self.predicted_draftkings_points = 0
self.draftkings_salary = 0
# Season stats
self.season_bf = 0
self.season_ip = 0
self.season_so = 0
self.season_wins = 0
self.season_losses = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, player):\n self._piece_type = 'pawn'\n self._value = 2 if player == \"white\" else -2\n self._summary = 'W-Pw' if player == \"white\" else 'B-Pw'\n\n self._directions = []\n if player == \"white\":\n self._directions.append([(-1, 1)])\n se... | [
"0.61979926",
"0.618096",
"0.6179797",
"0.60220015",
"0.59239674",
"0.592135",
"0.588046",
"0.5850027",
"0.58463913",
"0.5770918",
"0.57358724",
"0.57344246",
"0.57330227",
"0.57256836",
"0.57162654",
"0.57162297",
"0.5712789",
"0.571192",
"0.5684267",
"0.5645466",
"0.5638088... | 0.6979371 | 0 |
Calculate the predicted points per dollar for this player. Return 0 if the Draftkings salary is equal to zero | def points_per_dollar(self):
if float(self.draftkings_salary) == 0.0:
return 0.0
return float(self.predicted_draftkings_points) / float(self.draftkings_salary) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dollars_per_point(self):\n if float(self.predicted_draftkings_points) == 0.0:\n return 0.0\n\n return float(self.draftkings_salary) / float(self.predicted_draftkings_points)",
"def score(self, predictions):\n return 0.",
"def predict(self):\n if ((self.kf.x[6] + self.... | [
"0.7366089",
"0.6308235",
"0.6148629",
"0.6024777",
"0.6016563",
"0.6001432",
"0.5949691",
"0.59205437",
"0.5876416",
"0.58619565",
"0.5852512",
"0.5852342",
"0.5832806",
"0.5832806",
"0.5832806",
"0.5832806",
"0.5832806",
"0.5832806",
"0.5831876",
"0.5831876",
"0.5831876",
... | 0.8419467 | 0 |
Calculate the predicted points per dollar for this player. Return 0 if the Draftkings salary is equal to zero | def dollars_per_point(self):
if float(self.predicted_draftkings_points) == 0.0:
return 0.0
return float(self.draftkings_salary) / float(self.predicted_draftkings_points) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def points_per_dollar(self):\n if float(self.draftkings_salary) == 0.0:\n return 0.0\n\n return float(self.predicted_draftkings_points) / float(self.draftkings_salary)",
"def score(self, predictions):\n return 0.",
"def predict(self):\n if ((self.kf.x[6] + self.kf.x[2]) <... | [
"0.8419284",
"0.63081765",
"0.6148541",
"0.6024131",
"0.6016389",
"0.600038",
"0.59496975",
"0.5920287",
"0.58757573",
"0.5860934",
"0.58529276",
"0.58520406",
"0.58322114",
"0.58322114",
"0.58322114",
"0.58322114",
"0.58322114",
"0.58322114",
"0.58312875",
"0.58312875",
"0.5... | 0.73660153 | 1 |
Check if given value is correct for gender number in ID code. | def is_valid_gender_number(gender_number: int) -> bool:
if gender_number in range(1, 7):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_gender_number(gender_number: int) -> bool:\n if gender_number in range(1, 7):\n return True\n else:\n return False",
"def is_id_valid(id_code: str) -> bool:\n if is_valid_gender_number(int(id_code[0:1])):\n if is_valid_year_number(int(id_code[1:3])):\n if is_... | [
"0.7719618",
"0.69450635",
"0.68326753",
"0.6717552",
"0.6647802",
"0.6626832",
"0.66216373",
"0.6605458",
"0.6395822",
"0.6375869",
"0.62992686",
"0.62555933",
"0.6241217",
"0.62064004",
"0.61805654",
"0.6166287",
"0.61211264",
"0.6119617",
"0.6110498",
"0.597888",
"0.596039... | 0.7697313 | 1 |
Check if given value is correct for month number in ID code. | def is_valid_month_number(month_number: int) -> bool:
if 0 < month_number <= 12:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_month (val):\n if len(val) == 2 and count_digits(val) == 2:\n month = int(val)\n return month > 0 and month < 13\n return False",
"def is_valid_month_number(month_number: int) -> bool:\n if month_number in range(13):\n return True\n else:\n return False",
"d... | [
"0.78509146",
"0.752391",
"0.7422335",
"0.68609554",
"0.68215",
"0.67081577",
"0.67009896",
"0.668985",
"0.6498707",
"0.6488282",
"0.6337808",
"0.6278733",
"0.62254703",
"0.62079597",
"0.6181568",
"0.61379164",
"0.61099625",
"0.6058875",
"0.60411596",
"0.60232794",
"0.6012972... | 0.75445867 | 1 |
Check if given value is correct for birth number in ID code. | def is_valid_birth_number(birth_number: int):
if birth_number in range(1, 1000):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_birth_number(birth_number: int):\n if birth_number in range(1, 1000):\n return True\n else:\n return False",
"def is_id_valid(id_code: str) -> bool:\n if id_code.isdigit():\n if len(str(id_code)) == 11:\n id_code = str(id_code)\n gender_number = in... | [
"0.7669592",
"0.743413",
"0.7362",
"0.7126994",
"0.7036078",
"0.6768026",
"0.67309767",
"0.6512103",
"0.62461853",
"0.6227174",
"0.6126266",
"0.6124072",
"0.6095114",
"0.60267437",
"0.6023427",
"0.5990033",
"0.59776306",
"0.5961712",
"0.5954568",
"0.5948722",
"0.59220415",
... | 0.7672838 | 0 |
Check if given value is correct for control number in ID code. Use algorithm made for creating this number. | def is_valid_control_number(id_code: str) -> bool:
check_numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1]
check_sum = 0
for i in range(10):
check_sum += int(id_code[i]) * check_numbers[i]
check_sum = check_sum % 11
if check_sum == 10:
check_numbers = [3, 4, 5, 6, 7, 8, 9, 1, 2, 3]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_control_number(id_code: str) -> bool:\n sum = 1 * int(id_code[:1]) + 2 * int(id_code[1:2]) + 3 * int(id_code[2:3]) + 4 * int(id_code[3:4]) + 5 * \\\n int(id_code[4:5]) + 6 * int(id_code[5:6]) + 7 * int(id_code[6:7]) + 8 * int(id_code[7:8]) + 9 *\\\n int(id_code[8:9]) + 1 * int(id_code... | [
"0.81619936",
"0.66532516",
"0.64845574",
"0.63289493",
"0.6275811",
"0.6214823",
"0.615628",
"0.6125417",
"0.6085542",
"0.60341203",
"0.6012941",
"0.6002289",
"0.5977511",
"0.59405285",
"0.59047055",
"0.5871564",
"0.58661366",
"0.58425516",
"0.5841846",
"0.5836206",
"0.58245... | 0.7822165 | 1 |
Get possible information about the person. Use given ID code and return a short message. Follow the template This is a born on in . | def get_data_from_id(id_code: str) -> str:
if is_id_valid(str(id_code)):
gender_number = int(id_code[0:1])
day = id_code[5:7]
month = id_code[3:5]
year = id_code[1:3]
gender = get_gender(gender_number)
full_year = str(get_full_year(gender_number, int(year)))
l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_from_id(id_code: str) -> str:\n if is_valid_control_number(id_code):\n return f\"This is a {get_gender(int(id_code[0:1]))} born on {id_code[5:7]}.{id_code[3:5]}.\" \\\n f\"{get_full_year(int(id_code[0:1]), int(id_code[1:3]))} in {get_birth_place(int(id_code[7:10]))}\"\n else... | [
"0.67674786",
"0.63826096",
"0.62162644",
"0.6213492",
"0.6179912",
"0.61221534",
"0.61090523",
"0.6090255",
"0.6041029",
"0.5957511",
"0.5955492",
"0.59419584",
"0.5927061",
"0.59135956",
"0.5903609",
"0.5898696",
"0.5882936",
"0.5875469",
"0.5861774",
"0.57998204",
"0.57787... | 0.6758885 | 1 |
Check if given ID code is valid and return the result (True or False). Complete other functions before starting to code this one. You should use the functions you wrote before in this function. | def is_id_valid(id_code: str) -> bool:
if id_code.isdigit():
if len(str(id_code)) == 11:
id_code = str(id_code)
gender_number = int(id_code[0:1])
day = int(id_code[5:7])
month = int(id_code[3:5])
year = id_code[1:3]
birth_number = id_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_id_valid(id_code: str) -> bool:\n if is_valid_gender_number(int(id_code[0:1])):\n if is_valid_year_number(int(id_code[1:3])):\n if is_valid_month_number(int(id_code[3:5])):\n if is_valid_day_number(int(id_code[0:1]), int(id_code[1:3]), int(id_code[3:5]), int(id_code[5:7])... | [
"0.8171919",
"0.7009382",
"0.6951882",
"0.6747619",
"0.6607008",
"0.65469337",
"0.6338607",
"0.6239265",
"0.6221646",
"0.6215547",
"0.6168626",
"0.6168274",
"0.6131262",
"0.6069979",
"0.60399467",
"0.5967491",
"0.5936222",
"0.5933184",
"0.5914988",
"0.5883124",
"0.5848718",
... | 0.78821236 | 1 |
Reads in a raw SANS datafile and returns a SansData | def read_sample(myfilestr="MAY06001.SA3_CM_D545"):
detdata,metadata=data.readNCNRData(myfilestr) #note that it should be None for the default
return SansData(detdata, metadata) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self):\n # open the .SPE file\n with open(self._input_file_path, 'rb') as f:\n lines = f.readlines()\n # Create an empty dictionary for the metadata\n metadata_dictionary = {}\n\n # Search through the file for the needed metadata\n metad... | [
"0.5751052",
"0.5526093",
"0.5446301",
"0.5305193",
"0.5246388",
"0.5217913",
"0.5203776",
"0.517204",
"0.51438344",
"0.51111645",
"0.504678",
"0.50407815",
"0.50394773",
"0.50265765",
"0.49560547",
"0.49271512",
"0.49130988",
"0.4911392",
"0.48963708",
"0.48891187",
"0.48800... | 0.6675515 | 0 |
Given a SansData object, normalize the data to the provided monitor | def monitor_normalize(sansdata,mon0=1e8):
monitor=sansdata.metadata['run.moncnt']
result=sansdata.data*mon0/monitor
res=SansData()
res.data=result
res.metadata=deepcopy(sansdata.metadata)
res.qx=copy(sansdata.qx)
res.qy=copy(sansdata.qy)
res.theta=copy(sansdata.theta)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monitor_normalize(ylist,yerrlist,monlist,monitor=None):\n mon0=monlist[0]\n if monitor!=None:\n mon0=N.float64(monitor)\n y_in=N.array([],'float64')\n yerr_in=N.array([],'float64')\n mon_in=N.array(monlist,'float64')\n correction=mon0/mon_in #assumes that none of the monitor rates give... | [
"0.5822043",
"0.5605835",
"0.5605835",
"0.550023",
"0.5351501",
"0.5344585",
"0.53409696",
"0.53238094",
"0.53121114",
"0.52463055",
"0.5191288",
"0.50953764",
"0.5043982",
"0.5043982",
"0.5034275",
"0.50148374",
"0.49886858",
"0.49828744",
"0.49824554",
"0.49549466",
"0.4941... | 0.748248 | 0 |
Given a SansData object and an sensitivity map generated from a div, correct for the efficiency of the detector. Recall that sensitivities are generated by taking a measurement of plexiglass and dividing by the mean value | def correct_detector_efficiency(sansdata,sensitivity):
result=sansdata.data/sensitivity #Could be done more elegantly by defining a division method on SansData
res=SansData()
res.data=result
res.metadata=deepcopy(sansdata.metadata)
res.qx=copy(sansdata.qx)
res.qy=copy(sansdata.qy)
res.theta=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _call(self, dataset):\n # first cast to floating point dtype, because noise is most likely\n # floating point as well and '+=' on int would not do the right thing\n # XXX should we already deepcopy here to keep orig dtype?\n if not N.issubdtype(dataset.samples.dtype, N.float):\n ... | [
"0.58871394",
"0.58342505",
"0.5490516",
"0.53566873",
"0.53259766",
"0.532161",
"0.5320019",
"0.52899104",
"0.52503693",
"0.52484775",
"0.52450603",
"0.5235667",
"0.5226603",
"0.5213607",
"0.5213607",
"0.5200309",
"0.5169606",
"0.51651996",
"0.5151721",
"0.5133345",
"0.50679... | 0.7324558 | 0 |
Given a SansData object, the transmissions and blocked beam, correct for the blocked beam. | def correct_blocked_beam(sample,blocked_beam,transmission):
#it would probably be more pleasant to have keyword arguments and to check
#for their presence so that a user of the class doesn't have to know the
#function signature. The advantage of the current method is that an error is
#automatically rais... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataPtoTB(self,u):\n n = self.ues[u].prbs\n [tbSbits,mod,bits,mcs__] = self.setMod(u,n)\n if self.schType[0:2]=='PF':\n if len(self.ues[u].pastTbsz)>self.promLen:\n self.ues[u].pastTbsz.popleft()\n self.ues[u].pastTbsz.append(self.ues[u].tbsz)\n\n ... | [
"0.554512",
"0.5537147",
"0.52834463",
"0.51064193",
"0.49272564",
"0.49100593",
"0.48409185",
"0.47785255",
"0.4760839",
"0.4692016",
"0.46784097",
"0.46771446",
"0.46669835",
"0.46640566",
"0.46454644",
"0.46390733",
"0.4620003",
"0.46098214",
"0.45902753",
"0.4568258",
"0.... | 0.63880956 | 0 |
Given a SansData of sample and empty cell that have been corrected, subtract them | def correct_background(sample,empty_cell):
result=sample-empty_cell
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtract(self,*datas):\n\t\tdatas = list(datas)\n\t\tresult = datas.pop(0)\n\t\tfor data in datas:\n\t\t\tresult -= data\n\t\treturn result",
"def demeaned(self):\n return self.data - self.mean",
"def calculate_correction(filedic):\n lanczos_cera = xr.open_mfdataset(filedic['lanczos(CERA)'], comb... | [
"0.54819214",
"0.53857255",
"0.52367604",
"0.5233917",
"0.5160762",
"0.5151851",
"0.5135383",
"0.51290405",
"0.5119795",
"0.5117193",
"0.5094258",
"0.50864136",
"0.50637335",
"0.5048496",
"0.50484747",
"0.5044647",
"0.5031895",
"0.49805743",
"0.49659047",
"0.49646086",
"0.493... | 0.59561723 | 0 |
given a SansData with q,qx,qy,and theta images defined, correct for the fact that the detector is flat and the eswald sphere is curved. | def correct_solid_angle(sansdata):
result=sansdata.data*(np.cos(sansdata.theta)**3)
res=SansData()
res.data=result
res.metadata=deepcopy(sansdata.metadata)
res.qx=copy(sansdata.qx)
res.qy=copy(sansdata.qy)
res.theta=copy(sansdata.theta)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_plot_cspad(geometry, fname_data, amp_range=(0,0.5)):\n #rad1 = 93\n #rad2 = 146\n rad1 = 655\n rad2 = 670\n\n # get pixel coordinate index arrays:\n xyc = xc, yc = 500, 500# None\n\n #rows, cols = geometry.get_pixel_coord_indexes(xy0_off_pix=None)\n rows, cols = geometry.get_pixel... | [
"0.5458695",
"0.54385436",
"0.54376864",
"0.54037213",
"0.5400784",
"0.53430015",
"0.5339209",
"0.5277438",
"0.52107674",
"0.51346415",
"0.5127246",
"0.5106323",
"0.50951827",
"0.50790733",
"0.50697833",
"0.5069102",
"0.5069075",
"0.5034315",
"0.50341034",
"0.5032487",
"0.502... | 0.59291625 | 0 |
a sample chain of corrections | def chain_corrections():
#read the files
sample_4m=read_sample(map_files('sample_4m'))
empty_cell_4m=read_sample(map_files('empty_cell_4m'))
empty_4m=read_sample(map_files('empty_4m'))
transmission_sample_cell_4m=read_sample(map_files('trans_sample_4m'))
transmission_empty_cell_4m=read_samp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiple_testing_correction(pvalues, correction_type=\"FDR\"):\n from numpy import array, empty\n pvalues = array(pvalues)\n sample_size = pvalues.shape[0]\n qvalues = empty(sample_size)\n if correction_type == \"Bonferroni\":\n # Bonferroni correction\n qvalues = sample_size * pva... | [
"0.6057315",
"0.5711097",
"0.55673796",
"0.55620474",
"0.5417592",
"0.54044276",
"0.53824866",
"0.537402",
"0.53574383",
"0.5350013",
"0.533185",
"0.5309343",
"0.5293897",
"0.52858984",
"0.5236561",
"0.51909345",
"0.51909345",
"0.51909345",
"0.5171807",
"0.5168166",
"0.516816... | 0.6975479 | 0 |
print all customers with the current time and id in CSV format. | def print_customers(self):
self.current_time = self.get_time()
return f'Supermarket("{self.customers}", "{self.current_time}")' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_customers(self):\n output = ''\n for i in range(len(self.customers)):\n output += f'Customer no. {self.customers[i].id} is in {self.customers[i].state[0]} section\\n'\n #print(output)\n with open('oneday.csv','a') as outfile:\n for i in range(len(self.cus... | [
"0.81062955",
"0.6655075",
"0.6352781",
"0.62912863",
"0.60612553",
"0.5880387",
"0.57283247",
"0.57257265",
"0.57104826",
"0.57089424",
"0.57023174",
"0.57002157",
"0.56671035",
"0.5645103",
"0.55245644",
"0.55160266",
"0.5500443",
"0.54647124",
"0.54565537",
"0.54498583",
"... | 0.7301803 | 1 |
removes every customer that is not active any more. | def remove_existing_customers(self):
# remove the customers which are not active (.is_active )
self.to_move = False
#for cust in self.customers:
# print(cust.state)
self.customers = [cust for cust in self.customers if cust.state != 'checkout']
#if cust.to_move():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_existing_customers(self):\n\n for i in range(len(self.customers)):\n if self.customers[i].is_active() == False:\n self.customers[i]= 'out'\n self.customers = [item for item in self.customers if item!='out' ]",
"def test_list_active_users(_list_active_customers):... | [
"0.82049865",
"0.6386044",
"0.6291869",
"0.6194914",
"0.592139",
"0.58056027",
"0.57563466",
"0.5755537",
"0.57454765",
"0.57091147",
"0.56706625",
"0.56473964",
"0.5646159",
"0.56140465",
"0.5576211",
"0.5538074",
"0.55353266",
"0.5534561",
"0.5497937",
"0.54871404",
"0.5482... | 0.8266712 | 0 |
Remove a record with a given id from the table. | def remove(table, id_):
record = common.find_id(table, id_[0])
if record in table:
table = common.remove_record(table, record)
return table | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(table, id_):\n table, successful = common.remove_record(table, id_)\n\n if not successful:\n ui.print_error_message('Error!')\n\n return table",
"def delete_record(self, id_: str) -> None:\n instance = self._get(id_)\n self._delete_from_db(instance)",
"def delete_record... | [
"0.81783557",
"0.80144393",
"0.76164657",
"0.74314255",
"0.72872585",
"0.7254864",
"0.7076816",
"0.70399606",
"0.70388323",
"0.6974754",
"0.6938418",
"0.69027793",
"0.68908036",
"0.68530244",
"0.6843683",
"0.6818457",
"0.6817199",
"0.6812474",
"0.68037313",
"0.6790502",
"0.67... | 0.8055196 | 1 |
Gets from user number of option to change, checks amount of options and data type. | def data_to_change():
title = "Which part of record You want to change?"
exit_message = "Back to main menu."
list_options = ["Name: ", "Manufacturer: ", "purchase_date: ", "Durability: "]
ui.print_menu(title, list_options, exit_message)
correct_input = False
while correct_input is not True:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_user_options(self, unit):\n print(unit)\n print(\"Options:\")\n for option in unit.options:\n print(option)\n\n user_input = input(\">> \")\n\n # santise and create list of options\n user_input2 = user_input.lower()\n user_input2 = user_input2.tr... | [
"0.6109273",
"0.5759657",
"0.5718883",
"0.56589204",
"0.564493",
"0.5580262",
"0.55578375",
"0.5543662",
"0.5488127",
"0.5485002",
"0.54364794",
"0.5422494",
"0.54208136",
"0.5390141",
"0.5380995",
"0.53581625",
"0.5320768",
"0.53116024",
"0.5275301",
"0.5272488",
"0.52625513... | 0.6790623 | 0 |
Function creates dictionary with manufacturers as keys and average durability as items. | def get_average_durability_by_manufacturers(table):
average_durability = {}
for i in range(len(table)):
table[i][4] = int(table[i][4])
manufacturers = [name[2] for name in table]
single_manufacturers = list(set(manufacturers))
for i in range(len(single_manufacturers)):
durabilit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dictionary_of_metrics(items):\n\n 'Initialize dict'\n d = {}\n\n # Add 'mean' key to the dict with the value of the mean calculate by using\n # np.mean rounded to 2 decimal places\n d['mean'] = round(np.mean(items), 2)\n\n # Add 'median' key to the dict with the value of the median calculate ... | [
"0.62205356",
"0.6133951",
"0.60828346",
"0.5995681",
"0.59609073",
"0.5912523",
"0.5870187",
"0.585864",
"0.58151513",
"0.578834",
"0.5743187",
"0.5695257",
"0.5681986",
"0.566855",
"0.56393546",
"0.5633156",
"0.56207067",
"0.56056833",
"0.5551199",
"0.5515151",
"0.55144024"... | 0.76331353 | 0 |
>>> rabbits(5, 3) 19 | def rabbits(n, k):
prev, nxt = 1, 1
for _ in range(2, n):
prev, nxt = nxt, prev * k + nxt
return nxt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getrandbits(k: int) -> int:\n ...",
"def wabbits(n, k):\n a, b = 1, 1\n for i in range(3, n+1):\n a, b = b, a*k + b\n return b",
"def brc(x):\n N = len(x)\n y = np.zeros(N, dtype=complex)\n width = int(np.log2(N))\n for ii in np.arange(N):\n idx = '{:0{width}b}'.format... | [
"0.69049716",
"0.6712664",
"0.6257662",
"0.61311364",
"0.6127669",
"0.6073873",
"0.60225457",
"0.5979457",
"0.5917172",
"0.58916944",
"0.5890116",
"0.58509326",
"0.5836016",
"0.5782625",
"0.5778634",
"0.5744973",
"0.57054263",
"0.56547755",
"0.56413364",
"0.5639942",
"0.56231... | 0.73654777 | 0 |
Regular users shouldn't be able to see NOT_AVAILABLE partners in the listview. | def test_visibility_of_not_available_2(self):
partner = PartnerFactory(status=Partner.NOT_AVAILABLE)
list_url = reverse('partners:list')
editor = EditorFactory()
request = RequestFactory().get(list_url)
request.user = editor.user
response = PartnersListView.as_view()(re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_visibility_of_not_available_4(self):\n partner = PartnerFactory(status=Partner.NOT_AVAILABLE)\n list_url = reverse('partners:list')\n\n editor = EditorFactory()\n editor.user.is_staff = True\n editor.user.save()\n\n request = RequestFactory().get(list_url)\n ... | [
"0.76659733",
"0.6714052",
"0.6487925",
"0.62944084",
"0.5986907",
"0.5925319",
"0.58944327",
"0.5888781",
"0.58874387",
"0.57836556",
"0.5779557",
"0.57709605",
"0.57709605",
"0.57578605",
"0.5687641",
"0.566961",
"0.56255096",
"0.5606502",
"0.5585355",
"0.55832815",
"0.5574... | 0.7699841 | 0 |
Staff users should see NOT_AVAILABLE partner pages in the list view. | def test_visibility_of_not_available_4(self):
partner = PartnerFactory(status=Partner.NOT_AVAILABLE)
list_url = reverse('partners:list')
editor = EditorFactory()
editor.user.is_staff = True
editor.user.save()
request = RequestFactory().get(list_url)
request.user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_visibility_of_not_available_2(self):\n partner = PartnerFactory(status=Partner.NOT_AVAILABLE)\n list_url = reverse('partners:list')\n\n editor = EditorFactory()\n\n request = RequestFactory().get(list_url)\n request.user = editor.user\n response = PartnersListView... | [
"0.7749784",
"0.7010356",
"0.6788804",
"0.5911307",
"0.5898411",
"0.5891466",
"0.5821455",
"0.573191",
"0.56296486",
"0.56160283",
"0.5600137",
"0.5589843",
"0.55867755",
"0.5571438",
"0.5567003",
"0.55596405",
"0.5555837",
"0.55491287",
"0.55423224",
"0.55357367",
"0.5519836... | 0.7749647 | 1 |
The default manager should return AVAILABLE and WAITLIST partners, but not NOT_AVAILABLE. | def test_default_manager(self):
partner = PartnerFactory(status=Partner.AVAILABLE)
partner2 = PartnerFactory(status=Partner.NOT_AVAILABLE)
partner3 = PartnerFactory(status=Partner.WAITLIST)
all_partners = Partner.objects.all()
assert partner in all_partners
assert partne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available(self):\n\t\traise NotImplementedError",
"def test_visibility_of_not_available_2(self):\n partner = PartnerFactory(status=Partner.NOT_AVAILABLE)\n list_url = reverse('partners:list')\n\n editor = EditorFactory()\n\n request = RequestFactory().get(list_url)\n reques... | [
"0.5561422",
"0.54804593",
"0.54126763",
"0.53765243",
"0.5312262",
"0.5265359",
"0.52632576",
"0.52573335",
"0.5208918",
"0.5208326",
"0.51736754",
"0.5170593",
"0.5153752",
"0.51494473",
"0.51482457",
"0.51438534",
"0.51438534",
"0.51438534",
"0.5139675",
"0.51355535",
"0.5... | 0.6756728 | 0 |
The any_waitlisted context on RequestApplicationView should True if there are waitlisted Partners. | def test_request_application_view_context_1(self):
# Set up request.
req_url = reverse('applications:request')
editor = EditorFactory()
request = RequestFactory().get(req_url)
request.user = editor.user
# Ensure there is at least one waitlisted partner.
partner ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_application_view_context_2(self):\n # Set up request.\n req_url = reverse('applications:request')\n\n editor = EditorFactory()\n request = RequestFactory().get(req_url)\n request.user = editor.user\n\n # Ensure there are no waitlisted partners.\n fo... | [
"0.65983224",
"0.6206553",
"0.5711998",
"0.5529839",
"0.5529052",
"0.54388237",
"0.5368983",
"0.5355158",
"0.532243",
"0.5276433",
"0.5247194",
"0.50149375",
"0.5010246",
"0.49794883",
"0.49715558",
"0.49658874",
"0.49549156",
"0.4880058",
"0.48733827",
"0.48630413",
"0.48575... | 0.69799984 | 0 |
The any_waitlisted context on RequestApplicationView should False if there are not waitlisted Partners. | def test_request_application_view_context_2(self):
# Set up request.
req_url = reverse('applications:request')
editor = EditorFactory()
request = RequestFactory().get(req_url)
request.user = editor.user
# Ensure there are no waitlisted partners.
for partner in P... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_application_view_context_1(self):\n # Set up request.\n req_url = reverse('applications:request')\n\n editor = EditorFactory()\n request = RequestFactory().get(req_url)\n request.user = editor.user\n\n # Ensure there is at least one waitlisted partner.\n ... | [
"0.6960705",
"0.6218048",
"0.5808824",
"0.5664902",
"0.56613207",
"0.54783285",
"0.54593587",
"0.53600484",
"0.5333338",
"0.52819437",
"0.5218338",
"0.5130079",
"0.50323087",
"0.5031903",
"0.50049317",
"0.49963278",
"0.49766374",
"0.49620152",
"0.49250045",
"0.4918239",
"0.49... | 0.67606765 | 1 |
Posting to the toggle waitlist view sets an AVAILABLE partner to WAITLIST. | def test_toggle_waitlist_1(self):
# Create needed objects.
editor = EditorFactory()
coordinators = get_coordinators()
coordinators.user_set.add(editor.user)
UserProfileFactory(user=editor.user, terms_of_use=True)
partner = PartnerFactory(status=Partner.AVAILABLE)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_toggle_waitlist_2(self):\n # Create needed objects.\n editor = EditorFactory()\n coordinators = get_coordinators()\n coordinators.user_set.add(editor.user)\n UserProfileFactory(user=editor.user, terms_of_use=True)\n\n partner = PartnerFactory(status=Partner.WAITLI... | [
"0.7558113",
"0.65328646",
"0.5433371",
"0.53213185",
"0.52467173",
"0.51282156",
"0.509953",
"0.5091204",
"0.5043268",
"0.4991013",
"0.4983952",
"0.4963802",
"0.49538127",
"0.4937576",
"0.49288344",
"0.48964024",
"0.48799095",
"0.4864928",
"0.48648843",
"0.48552614",
"0.4843... | 0.7505038 | 1 |
Posting to the toggle waitlist view sets a WAITLIST partner to AVAILABLE. | def test_toggle_waitlist_2(self):
# Create needed objects.
editor = EditorFactory()
coordinators = get_coordinators()
coordinators.user_set.add(editor.user)
UserProfileFactory(user=editor.user, terms_of_use=True)
partner = PartnerFactory(status=Partner.WAITLIST)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_toggle_waitlist_1(self):\n # Create needed objects.\n editor = EditorFactory()\n coordinators = get_coordinators()\n coordinators.user_set.add(editor.user)\n UserProfileFactory(user=editor.user, terms_of_use=True)\n\n partner = PartnerFactory(status=Partner.AVAILA... | [
"0.7670878",
"0.6666528",
"0.56722414",
"0.55193806",
"0.5351408",
"0.5345447",
"0.5301888",
"0.52788526",
"0.5212124",
"0.51382023",
"0.50874275",
"0.50684017",
"0.50450104",
"0.504299",
"0.5028085",
"0.5021842",
"0.5020913",
"0.5017552",
"0.49849492",
"0.49838495",
"0.49824... | 0.77193904 | 0 |
Only coordinators can post to the toggle waitlist view. | def test_toggle_waitlist_access(self):
# Create needed objects.
editor = EditorFactory()
coordinators = get_coordinators()
coordinators.user_set.add(editor.user)
UserProfileFactory(user=editor.user, terms_of_use=True)
partner = PartnerFactory(status=Partner.AVAILABLE)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_act(self, **kwargs):\n return True",
"def test_toggle_waitlist_1(self):\n # Create needed objects.\n editor = EditorFactory()\n coordinators = get_coordinators()\n coordinators.user_set.add(editor.user)\n UserProfileFactory(user=editor.user, terms_of_use=True)\n\... | [
"0.549368",
"0.5480025",
"0.5450405",
"0.53964716",
"0.53499454",
"0.52849954",
"0.52098906",
"0.51941323",
"0.5193125",
"0.517576",
"0.5156091",
"0.5128045",
"0.51259947",
"0.508918",
"0.50775003",
"0.5053379",
"0.5033265",
"0.49727577",
"0.49623498",
"0.49541065",
"0.493176... | 0.629319 | 0 |
This builds your guide. | def build_guide(self, **kwargs):
# This builds your guide master and updates your options
self.create_guide_master(**kwargs)
prefix = self.prefix
options = self.options
mirror_value = self.mirror_value
num_joints = options.get('numberJoints')
single_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_guide(self, **kwargs):\n\n # This builds your guide master and updates your options\n self.create_guide_master(**kwargs)\n\n prefix = self.prefix\n options = self.options\n mirror_value = self.mirror_value\n\n number_mid_ctrl = options.get('numberMidCtrls')\n ... | [
"0.68431896",
"0.678747",
"0.6215074",
"0.6041127",
"0.6009198",
"0.5988244",
"0.59658515",
"0.5965333",
"0.5948795",
"0.5916978",
"0.5916978",
"0.5844977",
"0.5844977",
"0.5844977",
"0.5744313",
"0.57021093",
"0.567816",
"0.55941284",
"0.55941284",
"0.5589465",
"0.557288",
... | 0.70145535 | 0 |
This builds your anim rig. | def build_rig(self):
# create rig part top nodes
self.create_part_master()
# Get all the relevant part info
prefix = self.prefix
options = self.options
anim_ctrls = self.anim_ctrls
bind_jnts = self.bind_joints
hooks ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_anim(self):\n pass",
"def _animation_init(self):\n\n self.animation_ax.set_xlim(self.plant.workspace_range[0][0],\n self.plant.workspace_range[0][1])\n self.animation_ax.set_ylim(self.plant.workspace_range[1][0],\n ... | [
"0.68172234",
"0.6228986",
"0.6166067",
"0.6068071",
"0.6007271",
"0.59737676",
"0.5954252",
"0.5947862",
"0.5921581",
"0.59017247",
"0.5882105",
"0.5882105",
"0.5882105",
"0.5882105",
"0.5882105",
"0.5882105",
"0.5882105",
"0.5882105",
"0.5882105",
"0.5882105",
"0.5882105",
... | 0.6249442 | 1 |
Scale the uv map | def scale_uv(mesh_name, scale):
mesh = bpy.data.meshes[mesh_name]
if len(mesh.uv_layers) == 0:
return
uv_layer = mesh.uv_layers[0].data
for uv_index in range(0, len(uv_layer)):
uv = uv_layer[uv_index].uv
uv *= scale | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale_uv(self):\n self.u = [i * self.scale * self.scaleratio for i in self.u]\n self.v = [i * self.scale for i in self.v]",
"def uvmap(self, p):\n pass",
"def scale(self):",
"def scale(self, up):\n s = 1.1 if up else 0.9\n self.scaling_matrix = np.dot(\n self... | [
"0.7357069",
"0.6755092",
"0.6652019",
"0.6457699",
"0.6367943",
"0.6347549",
"0.63283706",
"0.63200384",
"0.6318271",
"0.6299888",
"0.6261653",
"0.6241084",
"0.6219343",
"0.6149372",
"0.61320066",
"0.6128101",
"0.611614",
"0.61115736",
"0.6097453",
"0.60815555",
"0.6070723",... | 0.7055414 | 1 |
Ensures the Windows SDK CIPD package is installed. Returns the directory where the SDK package has been installed. | def _ensure_sdk(self, sdk_dir, sdk_version):
with self.m.context(infra_steps=True):
pkgs = self.m.cipd.EnsureFile()
pkgs.add_package('chrome_internal/third_party/sdk/windows', sdk_version)
self.m.cipd.ensure(sdk_dir, pkgs)
return sdk_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_windows_sdk_path():\n try:\n import _winreg as winreg\n except ImportError:\n import winreg\n sub_key = r\"Software\\Microsoft\\Microsoft SDKs\\Windows\"\n with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, sub_key) as key:\n name = \"CurrentInstallFolder\"\n return winr... | [
"0.6401396",
"0.6207446",
"0.6125756",
"0.6043662",
"0.5965605",
"0.5891769",
"0.5888167",
"0.5864345",
"0.58358866",
"0.56869674",
"0.5660783",
"0.56440717",
"0.5564829",
"0.554222",
"0.5531126",
"0.54845786",
"0.5455155",
"0.54525137",
"0.54060125",
"0.539242",
"0.53684103"... | 0.7078877 | 0 |
Loads an array of variant configuration from the json file found at file_path. | def load_configuration(file_path):
with open(file_path, 'r') as file:
data = json.load(file)
configurations = []
for configuration_data in data:
configuration : Configuration = _from_json(configuration_data, Configuration)
configurations.append(configurati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_file(config_path):\n return load_json_file(config_path)",
"def _load_config(path) -> dict:\n with open(path, \"r\") as F:\n return json.load(F)",
"def load_configuration(self, path):\n with open(path) as conf_file:\n if path.name not in self.configuration:\n... | [
"0.6971127",
"0.69440037",
"0.6884107",
"0.6781495",
"0.67147934",
"0.667997",
"0.667997",
"0.65955895",
"0.6577272",
"0.6541512",
"0.6484831",
"0.64210993",
"0.64185685",
"0.6390585",
"0.63819486",
"0.63698316",
"0.6301179",
"0.62971544",
"0.62971544",
"0.6258191",
"0.624744... | 0.7119346 | 0 |
Initialize credential_id for rp_id | def cred_init(self, rp_id: str) -> (bytes, ec.EllipticCurvePrivateKey):
rp_id_hash = sha256(rp_id.encode())
private_key = ec.generate_private_key(ec.SECP256R1(), default_backend())
# This may look like a cryptography but it's not.
# Never try to use it in a real project.
aesgcm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credential_id(self, credential_id):\n\n self._credential_id = credential_id",
"def m_credential_create(node_name, credential_hash, participantDID):\n pass",
"def credential_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"credential_id\")",
"def __init__(__self__, *,\... | [
"0.6536802",
"0.60312885",
"0.6001469",
"0.5769102",
"0.5769102",
"0.5753552",
"0.5738852",
"0.57326597",
"0.56390107",
"0.56390107",
"0.56390107",
"0.56072253",
"0.5601717",
"0.5592435",
"0.5564139",
"0.5392016",
"0.5382046",
"0.5379748",
"0.537696",
"0.5374538",
"0.5370657"... | 0.7190321 | 0 |
Extract private key from `credential_id` | def cred_extract(self, rp_id: str, credential_id: bytes) -> Optional[ec.EllipticCurvePrivateKey]:
rp_id_hash = sha256(rp_id.encode())
aesgcm = AESGCM(self.master_key)
aad = rp_id_hash
nonce = sha256(aad + self.master_key)[4:16]
try:
data = aesgcm.decrypt(nonce, cred... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _decode_credential_from_json(self, cred_entry):\n raw_key = cred_entry['key']\n key = util.dict_to_tuple_key(raw_key)\n credential = None\n credential = Credentials.new_from_json(\n json.dumps(cred_entry['credential']))\n return (key, credential)",
"def _get_cred... | [
"0.68223524",
"0.67248297",
"0.6414652",
"0.6405547",
"0.6249193",
"0.6206796",
"0.6136057",
"0.6110275",
"0.60591227",
"0.6022507",
"0.6018188",
"0.6018188",
"0.5972394",
"0.59510946",
"0.59510946",
"0.5943873",
"0.5943873",
"0.5943873",
"0.5943873",
"0.5943873",
"0.5943873"... | 0.74674255 | 0 |
1) Delete test databases if exist 2) Create databases 3) Create required indices | def reset_databases(self):
for db in self.test_dbs:
if self.db_exists(db):
self.drop_database(db)
# leave some time for synchonization between nodes
time.sleep(3)
self.create_database(db)
self.create_index(db) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup():\n with get_session() as s:\n colls = s.db.collection_names()\n for coll in colls:\n if coll == 'system.indexes':\n continue\n s.db[coll].drop_indexes()\n s.db[coll].drop()\n\n s.db.command({'dropDatabase':1})",
"def setUp(self):... | [
"0.7574131",
"0.684399",
"0.6734331",
"0.673097",
"0.66940784",
"0.6657578",
"0.6650568",
"0.6650193",
"0.6626488",
"0.6620688",
"0.66095597",
"0.6592092",
"0.65408206",
"0.64800084",
"0.64629656",
"0.64561844",
"0.64100367",
"0.6370233",
"0.63569957",
"0.63499886",
"0.634998... | 0.76330584 | 0 |
Wait for the given database to reach the target doc count or until the timeout setting is reached | def wait_for_doc_count(self, db_name, expected, timeoutInMin):
timeout = time.time() + timeoutInMin * 60
while (time.time() < timeout):
doc_count = self.get_doc_count(db_name)
if doc_count < int(expected):
time.sleep(5)
else:
print ("{} doc count = {}".format(db_name, doc_count))
return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db():\n raise TimeoutError",
"def wait_for_data_in_ct_table(ct_table_name, no_of_records, database=None, timeout_sec=50):\n logger.info('Waiting for no_data_event to be updated in %s seconds ...', timeout_sec)\n start_waiting_time = time()\n stop_waiting_time = start_waiting_time + timeout_sec\n ... | [
"0.6410089",
"0.60500443",
"0.5847077",
"0.58316916",
"0.57926905",
"0.57169855",
"0.56730956",
"0.56220376",
"0.5602724",
"0.5562018",
"0.55521774",
"0.5537189",
"0.5532466",
"0.5527219",
"0.5509803",
"0.5502426",
"0.5425657",
"0.54245543",
"0.53881073",
"0.5335665",
"0.5312... | 0.7432831 | 0 |
Start of the progress bar. | def start_progress_bar(self):
self.progress["value"] = self.progress_step | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self):\n super(ProgressBar, self).start()\n self.display()",
"def start_progress(title):\n global progress_x\n sys.stdout.write(title + \": [\" + \"-\" * 40 + \"]\" + chr(8) * 41)\n sys.stdout.flush()\n progress_x = 0\n return 0",
"def startprogress(title):\n global pr... | [
"0.84644544",
"0.7360849",
"0.7187556",
"0.69703597",
"0.6866065",
"0.6785758",
"0.6686456",
"0.6678523",
"0.6637322",
"0.6601717",
"0.6573703",
"0.6573703",
"0.6573342",
"0.6567026",
"0.6436477",
"0.64347017",
"0.64345366",
"0.6433723",
"0.6412171",
"0.63984936",
"0.6395387"... | 0.8612583 | 0 |
The methods launching profile manager. | def open_profile_menager():
reload(edc_profile_manager)
edc_profile_manager.ProfileManager() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_profile(self):\n self.create_shelf_dir(self.profile.tc_temp_path)\n\n # run the App\n return self.run(self.profile.args)",
"def do_startup(self):\n logger.debug('::startup')\n Gio.Application.do_startup(self)\n action = Gio.SimpleAction.new('quit', None)\n ... | [
"0.6487095",
"0.64159983",
"0.6362631",
"0.6362483",
"0.63468903",
"0.6290468",
"0.62839806",
"0.61374724",
"0.61283094",
"0.60122097",
"0.5997306",
"0.5942564",
"0.5931187",
"0.59181505",
"0.5880621",
"0.5835219",
"0.58169043",
"0.58116317",
"0.58025575",
"0.57861656",
"0.57... | 0.7265884 | 0 |
The window with message informing that the profile has not been chosen.. | def error_no_profile():
tkMessageBox.showerror("Błąd, Nie wybrano profilu.",
"Należy dokonać wyboru profilu do filtrowania danych, "
"szczegóły poszczególnych profili można znaleść w Menadżeże Profili") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_new_profile_action(self):\n\n from skymodman.interface.dialogs.new_profile_dialog \\\n import NewProfileDialog\n\n popup = NewProfileDialog(combobox_model=self.model)\n\n # display popup, wait for close and check signal\n if popup.exec_() == popup.Accepted:\n ... | [
"0.60111976",
"0.5979644",
"0.59226364",
"0.59226364",
"0.5883023",
"0.585029",
"0.5767785",
"0.5765628",
"0.5716058",
"0.5645765",
"0.5643315",
"0.56378037",
"0.56148696",
"0.5578284",
"0.55710596",
"0.5567733",
"0.5566435",
"0.5530853",
"0.55275816",
"0.55181766",
"0.551687... | 0.73912215 | 0 |
The window with message informing that the files have not been chosen. | def error_no_files():
tkMessageBox.showerror(" Błąd, Nie wybrano nazw plików. ",
"Przed konwersją danych należy wybrać plik wejściowy zawierające dane Excel "
"oraz podać nazwy dla 3 plików wyjściowych w których program zapisze dane.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_file_error(self: object) -> None:\n messagebox.showerror(\"No file selected\", \"Please select a file\")",
"def warnFileNotPresent(self, filename, tag=\"first\"):\n# QtGui.QMessageBox.warning(self, \"Warning\", \"Could not locate %s file in sequence: %s\" % (tag, filename))\n\n messa... | [
"0.76047754",
"0.67630136",
"0.6434396",
"0.6433696",
"0.63150847",
"0.6094756",
"0.6042425",
"0.59891903",
"0.59801596",
"0.5976444",
"0.59606284",
"0.5944457",
"0.59243125",
"0.5890828",
"0.5882095",
"0.5822424",
"0.5805673",
"0.5746979",
"0.5735084",
"0.5728376",
"0.572784... | 0.71279687 | 1 |
The window with message informing that excel data filtration was finished. | def work_finished():
tkMessageBox.showinfo("Yes...", "Dokonano konwersji danych. \n Życzę miłego dnia.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_Output_CWA_excel_Now_button_clicked(self):\n # self.lineEdit.setText(result['Cname'])\n # self.lineEdit_2.setText(result['Sclass'])\n # self.lineEdit_3.setText(result['ClassTime'])\n # self.lineEdit_4.setText(result['Tno'])\n # self.lineEdit_6.setText(result['Date'])\n ... | [
"0.55716294",
"0.5556446",
"0.54925954",
"0.54401356",
"0.5409193",
"0.5361284",
"0.5341569",
"0.5292472",
"0.527907",
"0.5241114",
"0.5237859",
"0.5234971",
"0.51284236",
"0.51071846",
"0.5106603",
"0.50970507",
"0.5093958",
"0.50916535",
"0.5089211",
"0.50814736",
"0.503825... | 0.5682716 | 0 |
set parameter of related views. Will be available in related views kwargs as well as in request.query_params of request object passed to the related view | def set_related_params(self,request,responsedata):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_params(self, **kwargs):\n ...",
"def set(self, request, _object):\n\n value = request._get_parameter_value(self)\n value.object = _object",
"def setup_view(self, view, request, *args, **kwargs):\n view.request = request\n view.args = args\n view.kwargs = kwargs... | [
"0.6631366",
"0.6505121",
"0.6098712",
"0.60158235",
"0.6001763",
"0.59468704",
"0.5930036",
"0.5877166",
"0.586522",
"0.5807379",
"0.5790245",
"0.5777525",
"0.57682747",
"0.5722823",
"0.5694298",
"0.5686609",
"0.5677271",
"0.56698656",
"0.56684977",
"0.5616305",
"0.5608574",... | 0.75178146 | 0 |
it gets the final response after related views have been executed and final response has been appended. | def get_final_response(self,request,response):
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_response(self, data):",
"def main_response(self, data):",
"def handleResponseEnd(self):\r\n try:\r\n if not self._finished:\r\n reactor.callInThread(\r\n self.resource.cacheContent,\r\n self.father,\r\n self._res... | [
"0.66825056",
"0.66825056",
"0.65470517",
"0.65332025",
"0.6531433",
"0.6514031",
"0.6514031",
"0.6451953",
"0.62591517",
"0.6247269",
"0.62386",
"0.6179077",
"0.61765116",
"0.61480224",
"0.6142756",
"0.6116396",
"0.6116396",
"0.610012",
"0.60400885",
"0.6033069",
"0.6033069"... | 0.8038238 | 0 |
to update kwargs with query params with greater priority of kwargs. | def updatekwargs(self,request):
updated_dict={}
if isinstance(request.query_params,QueryDict):
updated_dict = {k:','.join(v) for k,v in request.query_params.iterlists()}
else:
updated_dict = request.query_params
updated_dict.update(self.kwargs)
self.kwarg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __update_params(self,**kwargs):\n updatedArgSet = set(self._updateParamsArgs) & kwargs.viewkeys()\n if len(updatedArgSet) > 0:\n args = self._subDictionary(self._updateParamsArgs)\n newArgs = self._onParamsUpdate(**args)\n updatedArgs =dict()\n for k in... | [
"0.68662506",
"0.68000084",
"0.6720413",
"0.64425296",
"0.63728446",
"0.6354257",
"0.6348046",
"0.63343126",
"0.62960684",
"0.6291026",
"0.62539774",
"0.62418306",
"0.6237482",
"0.61691016",
"0.61404216",
"0.61181504",
"0.6115815",
"0.6114842",
"0.6102069",
"0.6084299",
"0.60... | 0.7752384 | 0 |
get requested views from request.query_params.relview | def get_requested_views(self,request,returnformat):
relview_key = getattr(self,'relview_key','relview')
reqviews = request.query_params.get(relview_key)
if reqviews is None:
# if no relview is passed in query_params then fetch
# from its attribute relview which is set in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_requested_views(self,request,returnformat):\n if isinstance(request,Request):\n relview_key = getattr(self,'relview_key','relview')\n reqviews = request.query_params.get(relview_key)\n if reqviews is None:\n # if no relview is passed in query_params th... | [
"0.75398153",
"0.6885467",
"0.67272025",
"0.6463465",
"0.64211583",
"0.6304628",
"0.61412376",
"0.59954315",
"0.5932171",
"0.59282255",
"0.5863362",
"0.5801414",
"0.57248193",
"0.56478566",
"0.5637953",
"0.5636953",
"0.5582375",
"0.5578582",
"0.5537936",
"0.5492978",
"0.54502... | 0.8181199 | 0 |
Overridden generics.ListAPIView list method to provide additional functionality of related views data fetching and applied filters addition | def list(self,request,*args,**kwargs):
response=super(ListAPIView,self).list(request,*args,**kwargs)
#add applied_filters to the response which is set when filter_queryset method is called
response=self.addAppliedFilters(response)
#fetch data from the related views
return self.fe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self, request, *args, **kwargs):\n queryset = self.filter_queryset(self.get_queryset())\n\n page = self.paginate_queryset(queryset)\n\n if page is not None:\n serializer = self.get_serializer(page, many=True)\n else:\n serializer = self.get_serializer(quer... | [
"0.66712135",
"0.66708434",
"0.6605466",
"0.6597969",
"0.6391783",
"0.63200647",
"0.6303749",
"0.6296388",
"0.6233774",
"0.6208628",
"0.6208628",
"0.6180615",
"0.6162589",
"0.60989046",
"0.60909146",
"0.6077781",
"0.60466784",
"0.6036895",
"0.6025789",
"0.60160166",
"0.599088... | 0.8497571 | 0 |
Add the filters applied to the view to response using the view applied_filters attribute accessible with filters key | def addAppliedFilters(self,response):
if hasattr(self,'applied_filters') and self.applied_filters:
if not isinstance(response.data,(list,tuple)):
response.data['filters']=self.applied_filters
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_filters(self, filters, queryset, view):\n return filters",
"def filter_queryset(self, request, queryset, view):\n applicable_filters, applicable_exclusions = self.build_filters(view, filters=self.get_request_filters(request))\n return self.apply_filters(\n queryset=que... | [
"0.7354717",
"0.667946",
"0.6549934",
"0.6452416",
"0.63936824",
"0.6259591",
"0.62048525",
"0.6121124",
"0.6069148",
"0.6029197",
"0.602686",
"0.5989809",
"0.5984785",
"0.59195393",
"0.5910779",
"0.589759",
"0.5881149",
"0.58608884",
"0.58586997",
"0.5766401",
"0.5728919",
... | 0.7728048 | 0 |
Overridden generics.RetrieveAPIView retrieve method to provide additional functionality of related views data fetching | def retrieve(self,request,*args,**kwargs):
response=super(RetrieveAPIView,self).retrieve(request,*args,**kwargs)
return self.fetch_related(request,response,*args,**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self,request,*args,**kwargs):\n response=super(ListAPIView,self).list(request,*args,**kwargs)\n #add applied_filters to the response which is set when filter_queryset method is called\n response=self.addAppliedFilters(response)\n #fetch data from the related views\n retu... | [
"0.63180983",
"0.6271143",
"0.6262152",
"0.61606055",
"0.6104434",
"0.6103744",
"0.5973601",
"0.59641504",
"0.5953272",
"0.595036",
"0.5892447",
"0.58868515",
"0.58571994",
"0.58081573",
"0.58045816",
"0.57812613",
"0.57354194",
"0.57099235",
"0.5706479",
"0.5698495",
"0.5677... | 0.75602394 | 0 |
get requested views from request.query_params.relview | def get_requested_views(self,request,returnformat):
if isinstance(request,Request):
relview_key = getattr(self,'relview_key','relview')
reqviews = request.query_params.get(relview_key)
if reqviews is None:
# if no relview is passed in query_params then fetch
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_requested_views(self,request,returnformat):\n relview_key = getattr(self,'relview_key','relview')\n reqviews = request.query_params.get(relview_key)\n if reqviews is None:\n # if no relview is passed in query_params then fetch\n # from its attribute relview which ... | [
"0.8181199",
"0.6885467",
"0.67272025",
"0.6463465",
"0.64211583",
"0.6304628",
"0.61412376",
"0.59954315",
"0.5932171",
"0.59282255",
"0.5863362",
"0.5801414",
"0.57248193",
"0.56478566",
"0.5637953",
"0.5636953",
"0.5582375",
"0.5578582",
"0.5537936",
"0.5492978",
"0.545028... | 0.75398153 | 1 |
getCommandcodeBegin(self) get commandcode of equal | def getCommandcode(self):
commandcode = "EQUAL ({name})({operand})".format(name=self.name, operand=self.operand) # commandcode
return commandcode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCommandcode(self):\n commandcode = \"RETURN ({})\".format(self.value) # commandcode\n return commandcode",
"def get_opcode(self, code):\r\n opcode = int(str(code)[-2:])\r\n return opcode",
"def getCommandcode(self):\n commandcode = \"NOTEQUAL ({name})({operand})\".f... | [
"0.7032623",
"0.6300401",
"0.6291931",
"0.6258772",
"0.6234073",
"0.62185633",
"0.60434276",
"0.60129374",
"0.60129374",
"0.60129374",
"0.60129374",
"0.5997079",
"0.5997079",
"0.5997079",
"0.5997079",
"0.59708613",
"0.59281605",
"0.5927773",
"0.59086716",
"0.5907003",
"0.5863... | 0.7237698 | 0 |
getCommandcode(self) get commandcode of notequal | def getCommandcode(self):
commandcode = "NOTEQUAL ({name})({operand})".format(name=self.name, operand=self.operand) # commandcode
return commandcode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCommandcode(self):\n commandcode = \"EQUAL ({name})({operand})\".format(name=self.name, operand=self.operand) # commandcode\n return commandcode",
"def getCommandcode(self):\n commandcode = \"RETURN ({})\".format(self.value) # commandcode\n return commandcode",
"def get... | [
"0.7822171",
"0.7172279",
"0.6577299",
"0.6502084",
"0.63764507",
"0.624266",
"0.61364263",
"0.6077417",
"0.6077417",
"0.6077417",
"0.6077417",
"0.60731703",
"0.597658",
"0.593947",
"0.5884544",
"0.587268",
"0.58147097",
"0.57888204",
"0.57867324",
"0.57867324",
"0.57867324",... | 0.72049737 | 1 |
Default label to variable sanitizer | def default_label_sanitizer(s: str) -> str:
out: str = unidecode.unidecode(s)
# Remove invalid characters
out = re.sub(r"[^0-9a-zA-Z_]", "_", out)
# Remove leading characters until we find a letter or underscore
out = re.sub(r"^[^a-zA-Z_]+", "_", out)
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalisesym(self, label):\n return label",
"def label(cls) -> str:\n return \"!lobotomy.inject_string\"",
"def labelit(self, varname):\n \n if not varname:\n return \"\"\n return self.vardict[varname].VariableLabel or varname",
"def _sanitize(label):\n re... | [
"0.69953954",
"0.64760643",
"0.6292452",
"0.6212991",
"0.61776036",
"0.6132622",
"0.6126845",
"0.6105335",
"0.6084726",
"0.6064179",
"0.6062096",
"0.6052943",
"0.6052943",
"0.6052943",
"0.6052943",
"0.6052943",
"0.60412693",
"0.6037096",
"0.59761727",
"0.5971269",
"0.59562",
... | 0.68001777 | 1 |
Default form field formatter. | def default_field_formatter(variable_name: str, field: Field) -> str:
return "{{ " + f"form.{variable_name}" + " }}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_formatter(self, data):\n return data",
"def get_formatter(self, **kwargs):\n config = dict([\n (attr, getattr(self, attr))\n for attr in [\n \"include_sign\",\n \"group_with_commas\",\n \"num_decimal_places\",\n ... | [
"0.7187935",
"0.70637",
"0.6649078",
"0.6408993",
"0.64057606",
"0.6197929",
"0.61766225",
"0.6136049",
"0.61069214",
"0.60933304",
"0.6063252",
"0.60615337",
"0.603526",
"0.60306907",
"0.59651566",
"0.59344953",
"0.5922895",
"0.59220624",
"0.59166",
"0.5905437",
"0.58920133"... | 0.7441752 | 0 |
Transform a list of pairs to a list of actors. | def pairs_to_actors(pairs):
return [Actor(*pair) for pair in pairs] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairs_from_list(lights):\n length = len(lights)\n half = int(length / 2)\n offset = 0\n\n centre = None\n if length % 2 == 1:\n centre = lights[half]\n offset = 1\n\n left = lights[:half]\n\n rh_start = half + offset\n right = reversed(lights[rh_start:])\n\n pairs = lis... | [
"0.5782867",
"0.5387652",
"0.5387652",
"0.5387652",
"0.5387652",
"0.5346582",
"0.5274743",
"0.52624696",
"0.5250782",
"0.5221431",
"0.5221431",
"0.52203953",
"0.51859194",
"0.5179453",
"0.5176561",
"0.51732695",
"0.51001984",
"0.50953776",
"0.50728834",
"0.5027792",
"0.493496... | 0.846847 | 0 |
Return the hourly commit within interval according to split(). | def periodic_commit(start, length, split):
return start + split() * length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hourly(self):\n pass",
"def get_complete_hourly_prices(coin_symbol: str, base: str):\n all_prices = []\n delta = 0\n while True:\n answer = get_90d_of_hourly_prices(coin_symbol, base, datetime.now() - timedelta(days=delta))\n if not answer:\n break\n delta ... | [
"0.5435816",
"0.5409003",
"0.53277653",
"0.52740836",
"0.5237635",
"0.5216642",
"0.52152014",
"0.51716673",
"0.51509416",
"0.5150764",
"0.51459396",
"0.51287174",
"0.5128181",
"0.5123661",
"0.51183033",
"0.5014516",
"0.49912217",
"0.4985853",
"0.49793667",
"0.4973036",
"0.496... | 0.58374655 | 0 |
Generate message according to ticket and phase. | def message_of(cfg, ticket, phase):
return cfg["message_template"] % (ticket, text(cfg, phase)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_message_tgs(info, ticket_tgs, client_addr):\n c_v_session_key = info.prepend_length(info.generate__des_key())\n AD_C = info.prepend_length(client_addr[0] + \":\" + str(client_addr[1]))\n ID_C = info.prepend_length(info.ID_C)\n ID_V = info.prepend_length(info.ID_V)\n Lifetime4 = info.pre... | [
"0.59553707",
"0.5945532",
"0.5706949",
"0.562352",
"0.56116676",
"0.5494644",
"0.5407777",
"0.54006296",
"0.53899044",
"0.5383889",
"0.53615665",
"0.5286938",
"0.52592003",
"0.5203707",
"0.5189929",
"0.51773334",
"0.51652193",
"0.51474714",
"0.510892",
"0.51081985",
"0.51065... | 0.80429244 | 0 |
Create empty repository as per config. | def create_repository(cfg):
if os.path.isdir(cfg["repo_dir"]):
shutil.rmtree(cfg["repo_dir"], ignore_errors=True)
return Repo.init(cfg["repo_dir"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repository_create_hosted():\n pass",
"def create(self):\n if os.path.isdir(self.repodir):\n if os.listdir(self.repodir):\n raise EmtError('%s is not empty' % self.repodir)\n else:\n os.makedirs(self.repodir)\n self.git_cmd('init')\n self.ini... | [
"0.66948557",
"0.6504964",
"0.64604133",
"0.6446928",
"0.64212257",
"0.6381512",
"0.6348716",
"0.63030165",
"0.6298837",
"0.62934303",
"0.61910295",
"0.6154405",
"0.6127809",
"0.60999084",
"0.6055417",
"0.60173297",
"0.5971328",
"0.59708107",
"0.5959201",
"0.59128726",
"0.590... | 0.70395553 | 0 |
Commit datetime string representation generator from range concept. | def commit_datetime_string_gen(cfg):
repo_end_time = calendar.timegm(time.gmtime())
first_commit_time = repo_end_time - (cfg["repo_age_in_days"] * SECONDS_PER_DAY)
for raw_date in range(first_commit_time, repo_end_time, SECONDS_PER_HOUR):
commit_time = periodic_commit(raw_date, SECONDS_PER_HOUR, ran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_range(self) -> str:\n return build_sequence(filter(None, (self.uids, self.sequence)))",
"def do_time_range(parser, token):\r\n chunks = token.split_contents()\r\n if not len(chunks) >= 3:\r\n raise template.TemplateSyntaxError, \"%r tag requires two or three arguments\" % token.con... | [
"0.6324533",
"0.56947076",
"0.56797504",
"0.55976844",
"0.55973476",
"0.55576396",
"0.5536649",
"0.54804605",
"0.54670656",
"0.5458674",
"0.54278266",
"0.54063386",
"0.5388316",
"0.5360843",
"0.5335496",
"0.53224176",
"0.526309",
"0.52590555",
"0.5253629",
"0.52532643",
"0.52... | 0.62148494 | 1 |
Plan feature in model and start development on branch. | def start_feature(repo, cfg, model, developer_gen):
model = model_plan_feature(cfg, model, developer_gen)
repo.head.reference = repo.create_head(model.ticket)
repo.head.reset(index=True, working_tree=True)
return repo, model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_plan_feature(cfg, model, developer_gen):\n model.ticket = cfg[\"ticket_id_template\"] % (choose_in(1, cfg[\"repo_age_in_days\"]),)\n model.planned = choose_in(1, cfg[\"max_commits_per_branch\"])\n model.developer = next(developer_gen)\n return model",
"def main(argv):\n cfg = defaults(ar... | [
"0.68359864",
"0.58938617",
"0.58637154",
"0.5632829",
"0.56046027",
"0.5525671",
"0.5336109",
"0.52671415",
"0.5255504",
"0.52485037",
"0.52481985",
"0.51825285",
"0.5128954",
"0.5123314",
"0.5110367",
"0.5108799",
"0.51068956",
"0.5064",
"0.5064",
"0.50550956",
"0.50466096"... | 0.7742167 | 0 |
Note the commit in model and update repo. | def add_commit(repo, cfg, model, developer_gen, date):
model, kwargs = model_note_change(model, developer_gen, date)
msg = message_of(
cfg, model.ticket if model.ticket is not None else "", "general_commit_words"
)
repo.index.commit(msg, **kwargs)
return repo, model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit(self):\n run('git', 'add', '.')\n run('git', 'commit', '-a', '-m', 'updates')",
"def commit(self):\n pass",
"def commit(self):\n pass",
"def commit(self):\n pass",
"def commit(self):\n pass",
"def commit(self):\n pass",
"def commit(self):\n ... | [
"0.67854685",
"0.67172647",
"0.67172647",
"0.67172647",
"0.67172647",
"0.67172647",
"0.66994685",
"0.66824937",
"0.66407114",
"0.6613476",
"0.6555489",
"0.633415",
"0.6278688",
"0.6192139",
"0.6180403",
"0.6174244",
"0.6102314",
"0.6092508",
"0.6061488",
"0.60460293",
"0.6030... | 0.67881685 | 0 |
Merge the feature in repo and groom the model. | def merge_feature(repo, cfg, model, date):
repo.index.merge_tree(
repo.heads.master, base=repo.merge_base(repo.heads.master, repo.head)
)
kwargs = {
**author_committer_facts(model, date),
**dict(head=True, parent_commits=(repo.heads.master.commit, repo.head.commit)),
}
repo.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_merge(self):\n fc1 = self.read_feature()\n fc2 = self.read_feature('Aegean_Sea')\n\n # add a feature already in the feature collection\n fc1.merge(fc1)\n assert len(fc1.features) == 1\n\n # add a new feature to the feature collection\n fc1.merge(fc2)\n ... | [
"0.5925487",
"0.5871774",
"0.56310546",
"0.5571225",
"0.5482358",
"0.5413151",
"0.54008734",
"0.52660817",
"0.525594",
"0.52470225",
"0.5214082",
"0.51863486",
"0.51595527",
"0.51502156",
"0.51408935",
"0.5114687",
"0.5093232",
"0.508917",
"0.50817585",
"0.50575614",
"0.50278... | 0.75115246 | 0 |
! Constructor for the base Solver class. optimization The optimization problem created by calling the build method of the OptimizationBuilder class. error_on_fail When True, after solve() is called, if the solver did not converge then a RuntimeError is thrown. Default is False. An instance of the Solver class. | def __init__(self, optimization: Optimization, error_on_fail: bool = False):
## Instance of the optimization problem.
self.opt = optimization
## Initial guess for the optimization problem (set using reset_initial_seed).
self.x0 = cs.DM.zeros(optimization.nx)
## Parameter vecto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __solve(self) -> None:\n pyo.TransformationFactory(\"contrib.detect_fixed_vars\").apply_to(self.model) # type: ignore\n pyo.TransformationFactory(\"contrib.deactivate_trivial_constraints\").apply_to(self.model) # type: ignore\n\n # initialise the solver object\n self._logger.debug... | [
"0.6444551",
"0.63010585",
"0.61774766",
"0.6126776",
"0.61203647",
"0.61035085",
"0.60220695",
"0.59948343",
"0.5970983",
"0.5967244",
"0.5966598",
"0.5946401",
"0.5936177",
"0.592915",
"0.59242135",
"0.58939874",
"0.58902633",
"0.5882722",
"0.5832006",
"0.5809041",
"0.57980... | 0.81089073 | 0 |
! Optimization type. The type of the optimization problem. | def opt_type(self) -> type:
return type(self.opt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_opt_problem(nn_type):\n if nn_type == 'cnn':\n constraint_checker = CNNConstraintChecker(50, 1e8, 5, 5, 200, 1024, 8)\n init_points = get_initial_cnn_pool()\n func_caller = FunctionCaller(cnn_syn_func1, NNDomain(None, None))\n elif nn_type.startswith('mlp'):\n constraint_checker = MLPConstrai... | [
"0.62327963",
"0.60769403",
"0.60206985",
"0.58406436",
"0.5788869",
"0.57278967",
"0.5710115",
"0.5690223",
"0.5668474",
"0.56331706",
"0.5623142",
"0.5569626",
"0.5553283",
"0.5552492",
"0.5550468",
"0.5549044",
"0.5513961",
"0.5422052",
"0.5415799",
"0.5412332",
"0.5394518... | 0.60863376 | 1 |
! Reset initial seed for the optimization problem. x0 The initial seed. | def reset_initial_seed(self, x0: Dict[str, ArrayType]) -> None:
self.x0 = self.opt.decision_variables.dict2vec(x0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_initial_seed(self, x0) -> None:\n super().reset_initial_seed(x0)\n self.minimize_input[\"x0\"] = self.x0.toarray().flatten()",
"def generate_initial_state(self, x):\n\n if self.initial_state is None:\n x[:] = 0\n return x\n else:\n x[:] = sel... | [
"0.8737879",
"0.67843056",
"0.6593212",
"0.6503656",
"0.6454457",
"0.6383516",
"0.6311529",
"0.630171",
"0.6265005",
"0.6239627",
"0.62309265",
"0.6227303",
"0.61286354",
"0.6122613",
"0.6122158",
"0.60998493",
"0.6077699",
"0.6073097",
"0.60562795",
"0.60562795",
"0.60531366... | 0.7988302 | 1 |
! Reset the parameters for the optimization problem. p Specifies the parameters. | def reset_parameters(self, p: Dict[str, ArrayType]) -> None:
self.p = self.opt.parameters.dict2vec(p)
self._p_dict = self.opt.parameters.vec2dict(self.p) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reset_parameters(self):\n self._solver_input[\"P\"] = cvxopt.matrix(2.0 * self.opt.P(self.p).toarray())\n self._solver_input[\"q\"] = cvxopt.matrix(self.opt.q(self.p).toarray().flatten())\n if self.opt_type in CONSTRAINED_OPT:\n if self.opt.nk > 0:\n self._solver... | [
"0.7103715",
"0.6991918",
"0.6981577",
"0.6940896",
"0.6735711",
"0.6692552",
"0.6684609",
"0.6678689",
"0.6568796",
"0.6533821",
"0.65149695",
"0.64510334",
"0.6446362",
"0.6434186",
"0.6359053",
"0.63516587",
"0.63430274",
"0.6332555",
"0.6315924",
"0.6302281",
"0.6243164",... | 0.7288989 | 0 |
! Solve the optimization problem. A dictionary containing the solution. | def solve(self) -> Dict:
solution = self.opt.decision_variables.vec2dict(self._solve())
if self._error_on_fail and (not self.did_solve()):
raise RuntimeError("Solver failed!")
# Add full model state to the solution dictionary
for model in self.opt.models:
for d ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve(self, **kwargs) -> OptimizationResult:\n raise NotImplementedError",
"def solve(self, current_state: dict) -> dict:",
"def solve(self):",
"def solve_optimisation(model, exe_path, project_dir, poses) -> None:\n opt = SolverFactory(\n 'ipopt',\n executable=exe_path\n )\n\n ... | [
"0.7301385",
"0.6871695",
"0.674346",
"0.6738864",
"0.66965175",
"0.6695165",
"0.660309",
"0.65572757",
"0.65572757",
"0.64989126",
"0.6495357",
"0.6457791",
"0.6448608",
"0.6446663",
"0.6431411",
"0.63752735",
"0.6357446",
"0.6332625",
"0.63058853",
"0.6269354",
"0.62642485"... | 0.7083221 | 1 |
! Indicate the violated constraints. x The values for the decision variables. p The values for the parameters. Several lists that contain information regarding which constraints are violated. | def violated_constraints(
self, x: Dict[str, ArrayType], p: Dict[str, ArrayType]
) -> Tuple:
x = self.opt.decision_variables.dict2vec(x)
p = self.opt.parameters.dict2vec(p)
@dataclass
class ViolatedConstraint:
label: str
ctype: str
diff: c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constraints(self, x):\n pass",
"def check_constraints(Px,pk1,pk2,mu1,mu2,mu3):\n # Constraint 1: Check polarisation basis probabilities are valid.\n if (Px >= 1.0 or Px <= 0.0):\n print(\"Error! Constraint 1 < Px < 0: \", Px)\n exit(1)\n # Constraint 2: Check probability of puls... | [
"0.6426779",
"0.6170062",
"0.57802975",
"0.5764853",
"0.5730316",
"0.55354714",
"0.5497718",
"0.5469907",
"0.54452014",
"0.54144084",
"0.54126674",
"0.53736746",
"0.537083",
"0.5302913",
"0.5219222",
"0.5168163",
"0.5164424",
"0.5158632",
"0.5148973",
"0.513843",
"0.5124698",... | 0.7703603 | 0 |
! Interpolate a trajectory traj The trajectory to be interpolated where the columns correspond to the states over time. T The time duration of the trajectory. An interpolated function. | def interpolate(traj: cs.DM, T: float, **interp_args) -> interp1d:
assert isinstance(
traj, cs.DM
), f"traj is incorrect type, got '{type(traj)}', expected casadi.DM'"
t = np.linspace(0, T, traj.shape[1])
return interp1d(t, traj.toarray(), **interp_args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolate_timeseries(self, x, t, **kw):\n v, t_v = self.timeseries(x, rmnans=True)\n kw.update(dict(bounds_error=False))\n interpolant = sp.interpolate.interp1d(t_v, v, **kw)\n return interpolant(t)",
"def linear_interpolate_value_at_time(t0, v0, t1, v1, t):\n return v0 + lin... | [
"0.645355",
"0.61542463",
"0.6043273",
"0.60258955",
"0.59383374",
"0.5892053",
"0.58805996",
"0.58428943",
"0.57802105",
"0.5755275",
"0.5744183",
"0.5701931",
"0.5685706",
"0.5674853",
"0.56703764",
"0.5618757",
"0.5603903",
"0.55692244",
"0.5563093",
"0.5556694",
"0.555216... | 0.6698821 | 0 |
! Returns true when the solver solved the previous problem, false otherwise. This is an abstract method. Result of whether the solver succeeded or not. | def did_solve(self) -> bool:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def did_solve(self) -> bool:\n return self._solution.info.status == \"solved\"",
"def did_solve(self):\n return self._solution.success",
"def did_solve(self) -> bool:\n return self._stats[\"success\"]",
"def is_solvable(self):\n self_copy = deepcopy(self)\n return self_copy... | [
"0.77462107",
"0.77255",
"0.7467203",
"0.7388036",
"0.7289115",
"0.7209088",
"0.7142447",
"0.71113646",
"0.6873382",
"0.6865059",
"0.68046784",
"0.67686045",
"0.6765212",
"0.6664564",
"0.6664564",
"0.6664564",
"0.665332",
"0.6645049",
"0.65861714",
"0.6569115",
"0.6560621",
... | 0.7794785 | 0 |
! Evaluates the cost function for given decision variables x and parameters p. x The values for the decision variables. p The values for the parameters. The cost that results from x and p. | def evaluate_cost(
self, x: Dict[str, ArrayType], p: Dict[str, ArrayType]
) -> CasADiArrayType:
x = self.opt.decision_variables.dict2vec(x)
p = self.opt.parameters.dict2vec(p)
return self.opt.f(x, p) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_cost(self, params, **kwargs):\n raise NotImplementedError",
"def evaluate_cost_terms(\n self, x: Dict[str, ArrayType], p: Dict[str, ArrayType]\n ) -> List:\n\n x = self.opt.decision_variables.dict2vec(x)\n p = self.opt.parameters.dict2vec(p)\n\n @dataclass\n ... | [
"0.6875914",
"0.6735483",
"0.6607919",
"0.65051496",
"0.64269185",
"0.6375905",
"0.63624954",
"0.63512516",
"0.63113904",
"0.62978935",
"0.6296104",
"0.6264986",
"0.62552166",
"0.6251208",
"0.6240915",
"0.6239294",
"0.6222501",
"0.6177374",
"0.6175696",
"0.6130165",
"0.609639... | 0.741476 | 0 |
! Evaluates each cost term for given decision variables and parameters. x The values for the decision variables. p The values for the parameters. List corresponding to each cost term evalauted at x, p. | def evaluate_cost_terms(
self, x: Dict[str, ArrayType], p: Dict[str, ArrayType]
) -> List:
x = self.opt.decision_variables.dict2vec(x)
p = self.opt.parameters.dict2vec(p)
@dataclass
class CostTerm:
label: str
cost: float
def __str__(self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_cost(\n self, x: Dict[str, ArrayType], p: Dict[str, ArrayType]\n ) -> CasADiArrayType:\n x = self.opt.decision_variables.dict2vec(x)\n p = self.opt.parameters.dict2vec(p)\n return self.opt.f(x, p)",
"def eval_cost(self, params, **kwargs):\n raise NotImplementedE... | [
"0.721565",
"0.65479606",
"0.6323528",
"0.6112096",
"0.605941",
"0.60492057",
"0.59148633",
"0.59125096",
"0.5883655",
"0.58525085",
"0.5816622",
"0.5812202",
"0.576337",
"0.5744233",
"0.573798",
"0.57278824",
"0.56974936",
"0.56958956",
"0.5695721",
"0.569557",
"0.5688815",
... | 0.8016866 | 0 |
! Setup the optimization solver. solver_name The name of the solver to be used. solver_options Solver options passed to the solver. For details, see | def setup(self, solver_name: str, solver_options: Dict = {}):
# Setup problem
x = self.opt.decision_variables.vec()
p = self.opt.parameters.vec()
problem = {
"x": x,
"p": p,
"f": self.opt.f(x, p),
}
# Setup constraints
## Low... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_solver(self):\n option = Options()\n if logger.getEffectiveLevel() == logging.DEBUG:\n # option.printLevel = PrintLevel.HIGH\n option.printLevel = PrintLevel.NONE\n else:\n option.printLevel = PrintLevel.NONE\n self.solver_minimizing = SQProble... | [
"0.74249095",
"0.67771596",
"0.67073375",
"0.66630006",
"0.6459805",
"0.63141966",
"0.627811",
"0.6217816",
"0.62000686",
"0.6156034",
"0.61203367",
"0.6076768",
"0.600414",
"0.6000106",
"0.5990672",
"0.5988505",
"0.59504825",
"0.58804995",
"0.58746856",
"0.5870907",
"0.58551... | 0.7781433 | 0 |
! True when the solver succeeded, False otherwise. Boolean indicating success of solver. | def did_solve(self) -> bool:
return self._stats["success"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def did_solve(self):\n return self._solution.success",
"def did_solve(self) -> bool:\n return self._solution.info.status == \"solved\"",
"def has_solution(self) -> bool:\n pass",
"def did_solve(self) -> bool:\n pass",
"def solveOneStep(self):\n ### Student code goes here\... | [
"0.7067127",
"0.6976514",
"0.6906094",
"0.6893781",
"0.6678232",
"0.6579035",
"0.63947487",
"0.63604105",
"0.6359685",
"0.6338862",
"0.63223594",
"0.63223594",
"0.63223594",
"0.6285663",
"0.627599",
"0.6262388",
"0.62505686",
"0.616309",
"0.6159712",
"0.6082403",
"0.60639143"... | 0.7201746 | 0 |
! Setup solver. use_warm_start When true, the initial seed x0 is used as a warm start. Default is True. settings Settings that are passed to OSQP. Default is {}. The instance of the solve (i.e. self). | def setup(self, use_warm_start, settings={}):
assert self.opt_type in QP_COST, "OSQP cannot solve this type of problem"
self.use_warm_start = use_warm_start
self._setup_input = settings
if self.opt_type in CONSTRAINED_OPT:
self._setup_input["u"] = np.inf * np.ones(self.opt.nk... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(self, solver_settings: Dict = {}):\n assert self.opt_type in QP_COST, \"CVXOPT cannot solve this problem\"\n\n ## Input to the solver\n self._solver_input = solver_settings\n\n self._reset_parameters()\n return self",
"def setup_solver(self):\n option = Options... | [
"0.6558982",
"0.6286072",
"0.6053042",
"0.6030017",
"0.5909029",
"0.5721629",
"0.5692769",
"0.5599076",
"0.55969036",
"0.5596008",
"0.55756867",
"0.5505776",
"0.55011123",
"0.5500232",
"0.54910296",
"0.5485339",
"0.5484214",
"0.5458595",
"0.5456336",
"0.5439466",
"0.5437253",... | 0.78621745 | 0 |
! Returns True when the problem was solved. Boolean indicating if the solver converged. | def did_solve(self) -> bool:
return self._solution.info.status == "solved" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def did_solve(self):\n return self._solution.success",
"def did_solve(self) -> bool:\n return self._stats[\"success\"]",
"def did_solve(self):\n return self._solution[\"status\"] == \"optimal\"",
"def did_solve(self) -> bool:\n pass",
"def converged(self) -> bool:",
"def conve... | [
"0.7626083",
"0.7582729",
"0.7577563",
"0.7572323",
"0.73576117",
"0.73576117",
"0.73576117",
"0.73108906",
"0.7260244",
"0.7226423",
"0.7170689",
"0.70954806",
"0.7050868",
"0.69759893",
"0.6931749",
"0.68873924",
"0.6871832",
"0.68437505",
"0.6831438",
"0.679917",
"0.676906... | 0.7977091 | 0 |
! Number of iterations it took the solver to converge. Number of iterations. | def number_of_iterations(self) -> int:
return self._solution.info.iter | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_iterations(self) -> int:\n pass",
"def number_of_iterations(self):\n return self._solution[\"iterations\"]",
"def number_of_iterations(self):\n return self._solution.nit",
"def number_of_iterations(self) -> int:\n return self._stats[\"iter_count\"]",
"def iteration... | [
"0.77124375",
"0.7194317",
"0.71833915",
"0.6858536",
"0.6782175",
"0.652002",
"0.648363",
"0.63899773",
"0.63899773",
"0.63322115",
"0.62597173",
"0.6249974",
"0.6233827",
"0.6233827",
"0.6233827",
"0.61024827",
"0.60953677",
"0.59812546",
"0.5980235",
"0.5978103",
"0.588771... | 0.78494585 | 0 |
! Setup the cvxopt solver interface. solver_settings Settings passed to the CVXOPT solver. The instance of the solve (i.e. self). | def setup(self, solver_settings: Dict = {}):
assert self.opt_type in QP_COST, "CVXOPT cannot solve this problem"
## Input to the solver
self._solver_input = solver_settings
self._reset_parameters()
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(self, solver_name: str, solver_options: Dict = {}):\n # Setup problem\n x = self.opt.decision_variables.vec()\n p = self.opt.parameters.vec()\n\n problem = {\n \"x\": x,\n \"p\": p,\n \"f\": self.opt.f(x, p),\n }\n\n # Setup const... | [
"0.6741288",
"0.6668914",
"0.6225039",
"0.59971553",
"0.598382",
"0.5691549",
"0.5664084",
"0.5635914",
"0.56130964",
"0.5586613",
"0.5578955",
"0.55714655",
"0.5536691",
"0.5519575",
"0.5506151",
"0.54988086",
"0.54008114",
"0.54007083",
"0.5390446",
"0.53623044",
"0.5329943... | 0.7961874 | 0 |
Setup the Scipy solver. method Type of solver. Default is "SLSQP". tol Tolerance for termination. When tol is specified, the selected minimization algorithm sets some relevant solverspecific tolerance(s) equal to tol. For detailed control, use solverspecific options. options A dictionary of solver options. The instance... | def setup(
self,
method: str = "SLSQP",
tol: Union[None, float] = None,
options: Union[None, Dict] = None,
):
# Input check
if self.opt_type in CONSTRAINED_OPT and (
method not in ScipyMinimizeSolver.methods_handle_constraints
):
raise... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_solver(self):\n option = Options()\n if logger.getEffectiveLevel() == logging.DEBUG:\n # option.printLevel = PrintLevel.HIGH\n option.printLevel = PrintLevel.NONE\n else:\n option.printLevel = PrintLevel.NONE\n self.solver_minimizing = SQProble... | [
"0.6477532",
"0.63090336",
"0.62966573",
"0.628272",
"0.62646425",
"0.60118777",
"0.5974712",
"0.5958667",
"0.5844108",
"0.57841927",
"0.5779486",
"0.57777077",
"0.57302105",
"0.5727623",
"0.56519526",
"0.5578283",
"0.5549459",
"0.55332226",
"0.55141824",
"0.5475442",
"0.5449... | 0.7787004 | 0 |
! Reset initial seed for the optimization problem. x0 The initial seed. | def reset_initial_seed(self, x0) -> None:
super().reset_initial_seed(x0)
self.minimize_input["x0"] = self.x0.toarray().flatten() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_initial_seed(self, x0: Dict[str, ArrayType]) -> None:\n self.x0 = self.opt.decision_variables.dict2vec(x0)",
"def generate_initial_state(self, x):\n\n if self.initial_state is None:\n x[:] = 0\n return x\n else:\n x[:] = self.initial_state(size=(sel... | [
"0.7988302",
"0.67843056",
"0.6593212",
"0.6503656",
"0.6454457",
"0.6383516",
"0.6311529",
"0.630171",
"0.6265005",
"0.6239627",
"0.62309265",
"0.6227303",
"0.61286354",
"0.6122613",
"0.6122158",
"0.60998493",
"0.6077699",
"0.6073097",
"0.60562795",
"0.60562795",
"0.60531366... | 0.8737879 | 0 |
! Returns True when the problem was solved. Boolean indicating if the solver converged. | def did_solve(self):
return self._solution.success | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def did_solve(self) -> bool:\n return self._solution.info.status == \"solved\"",
"def did_solve(self) -> bool:\n return self._stats[\"success\"]",
"def did_solve(self):\n return self._solution[\"status\"] == \"optimal\"",
"def did_solve(self) -> bool:\n pass",
"def converged(sel... | [
"0.7977091",
"0.7582729",
"0.7577563",
"0.7572323",
"0.73576117",
"0.73576117",
"0.73576117",
"0.73108906",
"0.7260244",
"0.7226423",
"0.7170689",
"0.70954806",
"0.7050868",
"0.69759893",
"0.6931749",
"0.68873924",
"0.6871832",
"0.68437505",
"0.6831438",
"0.679917",
"0.676906... | 0.7626083 | 1 |
Draw "Game over" across the screen. | def draw_game_over(self):
output = "Game Over!"
arcade.draw_text(output, 250, 400, arcade.color.BLACK, 54)
output = "Click to restart"
arcade.draw_text(output, 330, 200, arcade.color.BLACK, 24) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_game_over(self):\n arcade.draw_rectangle_filled(SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2,\n SCREEN_WIDTH // 2,\n SCREEN_HEIGHT // 1.5, arcade.color.BRONZE)\n arcade.draw_rectangle_filled(SCREEN_WIDTH // 2, 410, 600, 140, ... | [
"0.8934364",
"0.8627453",
"0.8380253",
"0.83757025",
"0.82515734",
"0.8104014",
"0.8089572",
"0.7997276",
"0.7861335",
"0.7776214",
"0.77578104",
"0.7752009",
"0.76158357",
"0.75062186",
"0.7455096",
"0.7430902",
"0.74242336",
"0.74191856",
"0.73100394",
"0.72854185",
"0.7242... | 0.9028957 | 0 |
Login to keycloak and return token | def get_token(self, request_data):
data = {
"grant_type": "password",
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET,
"username": request_data.get("username"),
"password": request_data.get("password"),
}
# create keycloak uri f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login(self):\n r = self._login_token()",
"def login():\n\n if not config.requires_auth():\n abort(403,\n \"authentication not permitted since service is in insecure mode\")\n\n info = request.get_json() or {}\n username = info.get('username')\n password = info.get('pass... | [
"0.7417756",
"0.72780955",
"0.69483435",
"0.6918456",
"0.6906847",
"0.68530303",
"0.6837997",
"0.6831651",
"0.6775747",
"0.6758572",
"0.6721111",
"0.6658082",
"0.6657504",
"0.6647679",
"0.6645076",
"0.664235",
"0.662512",
"0.662396",
"0.6620616",
"0.66099817",
"0.6600765",
... | 0.7308726 | 1 |
Make a POST request to Keycloak | def keycloak_post(self, endpoint, data):
url = URI + "/auth/admin/realms/" + REALM + endpoint
headers = self.headers or self.get_keycloak_headers()
response = requests.post(url, headers=headers, json=data)
if response.status_code >= 300:
raise AppException.KeyCloakAdminExcept... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_post_request(self, url, data):\n auth = (self.AUTH_ID, self.AUTH_TOKEN)\n headers = {'content-type': 'application/json'}\n return requests.post(url, data=data, auth=auth, headers=headers)",
"def _post(self, *args, **kwargs):\n return self._request('post', *args, **kwargs)",
... | [
"0.667645",
"0.66198164",
"0.6501933",
"0.6406782",
"0.6370854",
"0.63279456",
"0.62768614",
"0.62191147",
"0.61914456",
"0.6173238",
"0.6134342",
"0.60690194",
"0.60622585",
"0.6061434",
"0.60564816",
"0.60508764",
"0.60361385",
"0.6034236",
"0.6029803",
"0.6023713",
"0.6019... | 0.6761658 | 0 |
Method for setting up the fullname | def fullname(self):
return '{} {}'.format(self.fname,self.lname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_fullname(self, value):\n self.fullname = value",
"def set_fullname(self, value):\n raise NotImplementedError('set_fullname')",
"def full_name(self,first_name):\n full_name = self.first_name + ' ' + self.last_name\n return full_name",
"def fullname(self):\n return self.fname... | [
"0.799368",
"0.7541357",
"0.7510396",
"0.74507093",
"0.73845243",
"0.73845243",
"0.73845243",
"0.73819816",
"0.7323252",
"0.7312589",
"0.7297851",
"0.7267998",
"0.7216746",
"0.7216746",
"0.7216746",
"0.7205875",
"0.71811813",
"0.716795",
"0.716795",
"0.7139923",
"0.71317744",... | 0.75518876 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.