query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Ensure the client is authorized to use the grant type requested. It will allow any of the four grant types (`authorization_code`, `password`, `client_credentials`, `refresh_token`) by default. Implemented `allowed_grant_types` for client object to authorize the request. It is suggested that `allowed_grant_types` should...
def validate_grant_type(self, client_id, grant_type, client, request, *args, **kwargs): if self._usergetter is None and grant_type == 'password': log.debug('Password credential authorization is disabled.') return False default_grant_types = ( 'authorization_code', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_grant_types(self):\n return [\n 'authorization_code', 'implicit', 'password', 'client_credentials', 'refresh_token'\n ]", "def client_authentication_required(self, request, *args, **kwargs):\n\n if request.grant_type == 'password':\n client = self._clientget...
[ "0.745238", "0.6576533", "0.6502792", "0.6370241", "0.62872404", "0.6151221", "0.577233", "0.5751498", "0.57352394", "0.5733579", "0.5722159", "0.5720734", "0.5693377", "0.565943", "0.56394255", "0.5605096", "0.5585128", "0.55732614", "0.5561852", "0.5553588", "0.554979", "...
0.7331455
1
Finalize all values that are the only choice for a unit. Go through all the units, and whenever there is a unit with a value that only fits in one box, assign the value to this box.
def only_choice(values): for unit in unitlist: for digit in '123456789': dplaces = [box for box in unit if digit in values[box]] if len(dplaces) == 1: values[dplaces[0]] = digit return values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only_choice(values):\n # TODO: Copy your code from the classroom to complete this function\n for unit in unitlist:\n #print (unit)\n #solved_boxes = [box for box in unit if len(values[box]) == 1]\n #unsolved_boxes = [box for box in unit if len(values[box]) > 1]\n #print (unit,...
[ "0.6150231", "0.5738263", "0.5612684", "0.55671245", "0.55313694", "0.55124116", "0.5460923", "0.5458567", "0.5450281", "0.54491603", "0.54196334", "0.5417317", "0.5387141", "0.53616154", "0.5312416", "0.5276738", "0.5255516", "0.52453786", "0.52410394", "0.5200773", "0.51741...
0.5256388
17
Calculate area of triangle with sides a, b, and c.
def herons_formula(a, b, c): print("sqrt(s*(s-a)*(s-b)*(s-c)) with s = (a + b + c)/2") s = (a + b + c) / 2 return math.sqrt(s * (s-a) * (s-b) * (s-c))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_triangle_area(a,b,c):\n ab = np.sqrt( ((a-b)**2).sum() )\n ac = np.sqrt( ((a-c)**2).sum() )\n bc = np.sqrt( ((b-c)**2).sum() )\n \n s = (ab+ac+bc)/2\n area = np.sqrt(s*(s-ab)*(s-bc)*(s-ac))\n \n return area", "def triangleArea(a: Vec3, b: Vec3, c: Vec3) -> float:\n return c...
[ "0.8707014", "0.8446816", "0.84040123", "0.83360595", "0.80462134", "0.79517245", "0.7889585", "0.7841665", "0.783617", "0.7832635", "0.7754367", "0.7746417", "0.7578557", "0.7559723", "0.7534772", "0.74892944", "0.7450029", "0.7432971", "0.737474", "0.7364372", "0.7356242", ...
0.0
-1
Area of equilateral triangle.
def area_equilat(side): return side/2 * math.sqrt(side**2 - (side/2)**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_triangle(w, h):\n return w * h / 2", "def triangle_area(base, height):\n return (base * height) / 2", "def area_triangle(triangle):\n return 0.5 * length_vector(normal_triangle(triangle, False))", "def triangle_area(side1: number, side2: number, side3: number) -> number:\n s = (side1+sid...
[ "0.8302037", "0.776063", "0.77455914", "0.76391226", "0.75598156", "0.75291485", "0.7506781", "0.74642456", "0.7459708", "0.7405107", "0.7384183", "0.73796403", "0.7336258", "0.730668", "0.7265377", "0.7238968", "0.72369176", "0.7202182", "0.71670985", "0.7164735", "0.7097452...
0.7484318
7
Method to construct a Fraction object
def __init__(self, n, d): # Check that n and d are of type int: if type(n) != int or type(d) != int: raise ValueError('requires type int') # Check that denominator is non-zero: if d == 0: raise ZeroDivisionError('requires non-zero denominator') # If we get h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__( self, *arg ):\r\n\t\tif ( len( arg ) == 2 ):\r\n\t\t\t# if one of the arguments is a fraction:\r\n\t\t\tif ( type( self ) in ( type( arg[ 0 ] ), type( arg[ 1 ] ) ) ):\r\n\t\t\t\t# future division is broken, so simple division doesn't work here.\r\n\t\t\t\tif ( type( self ) == type( arg[ 0 ] ) == type...
[ "0.7901632", "0.7786098", "0.7696744", "0.7402292", "0.73904914", "0.72636247", "0.7200349", "0.7002542", "0.6868905", "0.6861123", "0.6796404", "0.66952467", "0.6583011", "0.65698177", "0.6533053", "0.6511377", "0.6495087", "0.6458756", "0.64302367", "0.64014834", "0.63651",...
0.7033577
7
Returns a string representation of the fraction object (self)
def __str__(self): return str(self.num) + '/' + str(self.denom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self) -> str:\n return str(self._numerator) + \"/\" + str(self._denominator)", "def __repr__( self ):\r\n\t\treturn ( \"%s/%s\" % ( self.numerator, self.denominator ) )", "def __repr__(self):\n return str(self.numerator) + '/' + str(self.denominator)", "def __str__(self):\n if se...
[ "0.83075756", "0.80808526", "0.7942937", "0.7827898", "0.7768366", "0.7708409", "0.760703", "0.76025724", "0.753252", "0.7486484", "0.74396133", "0.7428725", "0.7073817", "0.68771744", "0.68412226", "0.6716249", "0.67055494", "0.6670884", "0.6598366", "0.6540925", "0.65391463...
0.7710733
5
Returns new Fraction representing self other
def __mul__(self, other): new_num = self.num * other.num new_denom = self.denom * other.denom return Fraction(new_num, new_denom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __sub__(self, other):\n # type: (object) -> Fraction\n dx = other\n if type(other) is float:\n dx = dectofr(other)\n return Fraction(self.numerator * dx.denominator - self.denominator * dx.numerator,\n self.denominator * dx.denominator)", "def __a...
[ "0.7831241", "0.75289005", "0.7511988", "0.7479586", "0.7475998", "0.7384123", "0.7350274", "0.733086", "0.7296599", "0.7295542", "0.72864217", "0.7259906", "0.716091", "0.7151089", "0.71311355", "0.7082944", "0.6973155", "0.6969914", "0.69401383", "0.6921401", "0.68968135", ...
0.7491739
3
Return an intermediate color. Fraction can be any rational number, but only the 01 range produces gradients.
def IntermediateColor(startcol, targetcol, frac): if frac < 0: frac = 0 if frac >= 1.0: frac = 1.0 sc = MakeColorTuple(startcol) tc = MakeColorTuple(targetcol) dR = tc[0] - sc[0] dG = tc[1] - sc[1] dB = tc[2] - sc[2] R = sc[0] + dR * frac G = sc[1] + dG * frac B = sc[2] + dB * frac return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __div__(self, number):\n r = self.r / number\n g = self.g / number\n b = self.b / number\n return Color(r, g, b)", "def getColor(self,number):\n if number >= 0:\n ret = cs.hsv_to_rgb(0,0,1-abs(number/self.maxp))\n else:\n ret = cs.hsv_to_rgb(0,abs(number/self.maxn)...
[ "0.5833291", "0.5552239", "0.53860223", "0.53849834", "0.53825516", "0.5352407", "0.53093183", "0.52881867", "0.52496135", "0.52286565", "0.5213995", "0.5176316", "0.5176063", "0.5169203", "0.51677614", "0.51584524", "0.51574683", "0.5100809", "0.5077907", "0.50718504", "0.50...
0.68814224
0
Test the basic funcitonality of the Product's models.
def test_products_basic(self): self.assertEqual(self.cat1.name, 'meat') self.assertEqual(self.cat1.slug, 'meat') self.assertEqual(self.cat1.description, 'The meat category.') self.assertIsNone(self.cat1.parent) self.assertEqual(len(self.product1.categories.all()), 1) sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Product(self):\n self.assertEquals(self.prod_1.pk, 1)\n self.assertEquals(self.prod_1.ean, '3350033118072')\n self.assertEquals(self.prod_1.name, 'test 1')\n self.assertEquals(self.prod_1.nutriscore, 'u')\n self.assertEquals(self.prod_1.category, 'cat 1')", "def test_p...
[ "0.7642455", "0.7505372", "0.74464047", "0.72802496", "0.71165633", "0.7100682", "0.70702803", "0.7066337", "0.6856038", "0.6855514", "0.6820375", "0.6761214", "0.67492986", "0.6743371", "0.6724428", "0.671036", "0.66997254", "0.6699382", "0.6658594", "0.6651892", "0.6651892"...
0.66491926
30
Test various helper methods of the Product model.
def test_product_helpers(self): # get_all_images() testing images = self.product1.get_all_images() self.assertGreater(len(images), 0, 'Image list is empty') self.assertEqual(len(images), 2) self.assertIn(self.another_product_image, images) self.assertIn(self.prod_img, ima...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_product(self):\n self.assertEqual(self.test_product.name, self.test_product_name)\n self.assertEqual(self.test_product.price, self.test_product_price)", "def test_Product(self):\n self.assertEquals(self.prod_1.pk, 1)\n self.assertEquals(self.prod_1.ean, '3350033118072')\n ...
[ "0.80607295", "0.7791203", "0.73878694", "0.735065", "0.7333988", "0.72442627", "0.7178971", "0.7140733", "0.70073634", "0.7001393", "0.6985354", "0.6983885", "0.6983885", "0.6983885", "0.6983885", "0.6983885", "0.6983885", "0.6983885", "0.6983885", "0.6983885", "0.6983885", ...
0.73489344
4
Attach the model to GPUs
def attachToGPUs(self, gpus): if hasattr(self, 'agent'): self.agent.attachToGPUs(gpus) if hasattr(self, 'mutate') and self.mutate: self.mutate.attachToGPUs(gpus) if hasattr(self, 'crover') and self.crover: self.crover.attachToGPUs(gpus) self.gpus = gp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_to_device(self):\n if self.device_ids is not None and len(self.device_ids) > 1:\n if not isinstance(self.model, torch.nn.DataParallel):\n self.model = torch.nn.DataParallel(self.model, self.device_ids)\n\n self.model = self.model.to(self.device)\n self.crit...
[ "0.6876537", "0.65696925", "0.6548642", "0.6482636", "0.64282715", "0.64139986", "0.62929046", "0.62711996", "0.6268525", "0.62641346", "0.6253802", "0.6249486", "0.6166706", "0.61333823", "0.6132139", "0.61159354", "0.6101927", "0.6034017", "0.6034017", "0.60139996", "0.6007...
0.66027933
1
Returns the current state of the agent Returns torch.nn.Module The current state of the agent
def getModel(self): return deepcopy(self.agent.state_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_agent_state(self):\n return self.world_state", "def get_state(self):\n return self.env.sim.get_state()", "def agent(self):\n return self.__agent", "def getPacmanState( self ):\n return self.data.agentStates[0].copy()", "def get_state(self):\n return list(_modeller.mod...
[ "0.71958417", "0.66712666", "0.6558878", "0.6302177", "0.6298521", "0.6172331", "0.6171939", "0.6171939", "0.6171939", "0.60555655", "0.6050613", "0.59588134", "0.59569836", "0.5915228", "0.5879314", "0.58714974", "0.58668995", "0.5850756", "0.58201134", "0.58201134", "0.5820...
0.6041406
11
Sets the id of this CrfItemRpc.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setID(self, id):\n self._id = id\n return self.callRemote('setID', id)", "def set_id(self, id):\n self.data['id'] = id", "def set_id(self, id):\n self.__id = id", "def set_id(self, id_):\n\n self.id_ = id_", "def id(self, id):\n \n self._id = id", "def...
[ "0.6911864", "0.6909904", "0.6811842", "0.6787368", "0.66714025", "0.66714025", "0.66714025", "0.66714025", "0.66714025", "0.6631745", "0.6631745", "0.6631745", "0.6631745", "0.6631745", "0.6631745", "0.6631745", "0.6631745", "0.6631745", "0.6631745", "0.6631745", "0.6631745"...
0.0
-1
Sets the study_id of this CrfItemRpc.
def study_id(self, study_id): self._study_id = study_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def study(self, study):\n self.logger.debug(\"In 'study' setter.\")\n\n self._study = study", "def study_code(self, study_code):\n\n self._study_code = study_code", "def set_student_id(self, student_id):\n self._student_id = student_id", "def set_study_system_attr(self, study_id: ...
[ "0.63807076", "0.59472966", "0.5872104", "0.58435434", "0.5735083", "0.5629751", "0.5616284", "0.55533546", "0.5472447", "0.5427948", "0.53395945", "0.53395945", "0.53333676", "0.52422816", "0.5195198", "0.5140106", "0.5117407", "0.506955", "0.50130934", "0.49262726", "0.4921...
0.77889985
2
Sets the crf_id of this CrfItemRpc.
def crf_id(self, crf_id): self._crf_id = crf_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_crf_id(self, event_crf_id):\n\n self._event_crf_id = event_crf_id", "def crf_version_id(self, crf_version_id):\n\n self._crf_version_id = crf_version_id", "def crf_version_id(self, crf_version_id):\n\n self._crf_version_id = crf_version_id", "def setID(self, idf):\n self...
[ "0.6356794", "0.6255529", "0.6255529", "0.5820464", "0.57493466", "0.57493466", "0.56965256", "0.56921816", "0.5678255", "0.5638115", "0.55864465", "0.5538089", "0.5516851", "0.5511642", "0.5488604", "0.54884267", "0.54238987", "0.53729045", "0.53578365", "0.53578365", "0.535...
0.7801135
1
Sets the variable_name of this CrfItemRpc.
def variable_name(self, variable_name): self._variable_name = variable_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setVarName(self, theName):\n self._name = theName\n return self", "def set_name(self, item_name):\r\n self.name = item_name", "def put_node_variable_name(self, name, index):\n # 1 - based indexing!\n assert index <= self._f.dimensions[\"num_nod_var\"]\n\n self._f.varia...
[ "0.6548444", "0.62853295", "0.617554", "0.6129973", "0.6129973", "0.6079619", "0.60313314", "0.59095305", "0.59087133", "0.5906855", "0.587623", "0.587623", "0.587623", "0.587623", "0.587623", "0.587623", "0.587623", "0.587623", "0.587623", "0.587623", "0.587623", "0.587623...
0.7012576
1
Sets the ad_lookup_code_by_item_data_type_id of this CrfItemRpc.
def ad_lookup_code_by_item_data_type_id(self, ad_lookup_code_by_item_data_type_id): self._ad_lookup_code_by_item_data_type_id = ad_lookup_code_by_item_data_type_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_data_type(self, item_data_type):\n\n self._item_data_type = item_data_type", "def add_code(self, id, code):\n self.codes[id] = code", "def SetItemType(self, item, ct_type):\r\n\r\n item.SetType(ct_type)\r\n self.CalculatePositions()\r\n self.Refresh()", "def data_t...
[ "0.54274464", "0.50521946", "0.4994738", "0.4810951", "0.47869876", "0.4734086", "0.46980342", "0.4626301", "0.45758647", "0.4565225", "0.4557128", "0.4537789", "0.45164058", "0.45164058", "0.45164058", "0.4473355", "0.44600686", "0.44580275", "0.44397393", "0.4434796", "0.44...
0.83074796
0
Sets the data_type_id of this CrfItemRpc.
def data_type_id(self, data_type_id): self._data_type_id = data_type_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_data_type(self, item_data_type):\n\n self._item_data_type = item_data_type", "def data_type_id(self, value: str):\n self._data_type_id = value", "def set_data_type(data_type):\n data_type_type = DataTypeUtil.getDtypeFromContext(data_type)\n DataTypeUtil.setDTypeForContext(data_type...
[ "0.72723645", "0.7078575", "0.67569816", "0.66312945", "0.65267724", "0.6373302", "0.6240512", "0.60841703", "0.60716516", "0.60530573", "0.60190254", "0.5869092", "0.57710564", "0.5678447", "0.5678447", "0.5619083", "0.56178635", "0.5606965", "0.55656075", "0.55539507", "0.5...
0.7684608
0
Sets the data_type_string of this CrfItemRpc.
def data_type_string(self, data_type_string): self._data_type_string = data_type_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_data_type(self, item_data_type):\n\n self._item_data_type = item_data_type", "def set_data_type(data_type):\n data_type_type = DataTypeUtil.getDtypeFromContext(data_type)\n DataTypeUtil.setDTypeForContext(data_type_type)", "def type(self, string):\n\n\t\tself._interface.type(string)", "...
[ "0.71118796", "0.6589961", "0.6464009", "0.6399756", "0.63436127", "0.6314165", "0.6298145", "0.6297469", "0.61214966", "0.6028082", "0.60236156", "0.5888019", "0.58589035", "0.5858658", "0.5836808", "0.57976294", "0.57976294", "0.57624316", "0.5760694", "0.56875175", "0.5657...
0.83396924
0
Sets the label_plain_text of this CrfItemRpc.
def label_plain_text(self, label_plain_text): self._label_plain_text = label_plain_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_label_text (self, text):\n if text: self.label.set_label(text)", "def set_label_text(self, text: str) -> None:\n self._label_text.set(text)\n self.update_label_text()", "def set_label(self, text):\n self._label = text", "def setText(self, text):\n assert self.isLabe...
[ "0.6851019", "0.68392956", "0.6787444", "0.66226286", "0.65382075", "0.6460145", "0.62413436", "0.6084049", "0.60085934", "0.59952736", "0.59930325", "0.59860396", "0.59771776", "0.59534377", "0.59521174", "0.59521174", "0.5931614", "0.58719736", "0.58561003", "0.5852327", "0...
0.81519586
1
Sets the rc_oid of this CrfItemRpc.
def rc_oid(self, rc_oid): self._rc_oid = rc_oid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crf_version_oid(self, crf_version_oid):\n\n self._crf_version_oid = crf_version_oid", "def set_cid(self, cid):\n self.__cid = cid", "def set_cid(self, cid):\n self.__cid = cid", "def iccid(self, iccid):\n\n self._iccid = iccid", "def crf_id(self, crf_id):\n\n self._cr...
[ "0.6007159", "0.5636485", "0.5636485", "0.56305575", "0.55835646", "0.55835646", "0.55415916", "0.5469513", "0.52852285", "0.5249084", "0.5214636", "0.511817", "0.5108705", "0.5076036", "0.5056598", "0.50301063", "0.5027331", "0.5007495", "0.49467227", "0.491437", "0.48587614...
0.79975885
0
Sets the default_value of this CrfItemRpc.
def default_value(self, default_value): self._default_value = default_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default(self, default):\n\n self._set_field(\"value\", default)", "def set_value_to_default(self):\n self.setValue(self.default_value)", "def default_value(self, value: Any) -> None:\n self.sdc_resource.set_input_default_value(self, value)\n self._default_value = value", "def ...
[ "0.71896154", "0.70259583", "0.7019124", "0.69738114", "0.6879283", "0.67939246", "0.67191625", "0.6638264", "0.66231376", "0.65814316", "0.65693367", "0.65622616", "0.65382713", "0.64609945", "0.64391345", "0.64168626", "0.6411277", "0.6378181", "0.6378181", "0.62938476", "0...
0.7148724
3
Sets the left_alignment of this CrfItemRpc.
def left_alignment(self, left_alignment): self._left_alignment = left_alignment
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_left(self, left):\n self.left = left", "def left(self, left):\n\n self._left = left", "def left(self, left):\n\n self._left = left", "def SetValueLeft(self, *args, **kwargs):\n pass", "def SetAlignment(self, l):\r\n\r\n self.alignment = l", "def leftMargin(self,...
[ "0.66617054", "0.65751326", "0.65751326", "0.650113", "0.6469978", "0.6222979", "0.6205633", "0.6200068", "0.616866", "0.60980946", "0.6025313", "0.5990549", "0.5952081", "0.5935559", "0.58997107", "0.5855069", "0.5841286", "0.5817101", "0.5790614", "0.5765689", "0.57304657",...
0.8502322
1
Sets the soft_validation of this CrfItemRpc.
def soft_validation(self, soft_validation): self._soft_validation = soft_validation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetValid(self, valid):\r\n\r\n self._valid = valid", "def SetValid(self, valid):\r\n\r\n self._valid = valid", "def setValid(self):\n self.valid = True", "def add_validation_flag(self):\n self.is_validation = \\\n tf.placeholder_with_default(False, [], 'is_validatio...
[ "0.5569359", "0.5569359", "0.5355849", "0.51938117", "0.47854725", "0.47718513", "0.4768643", "0.47646073", "0.47646073", "0.47646073", "0.47646073", "0.4745074", "0.47241434", "0.46101728", "0.45964906", "0.45442423", "0.4537055", "0.4537055", "0.45145965", "0.44930062", "0....
0.8213891
1
Sets the calc_field_equation of this CrfItemRpc.
def calc_field_equation(self, calc_field_equation): self._calc_field_equation = calc_field_equation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_eqn(self, calc_diff_eqn) :\r\n self.calc_diff_eqn = calc_diff_eqn", "def setCathodeField(self, field):\n self.calc_level = min(self.calc_level, CALC_B_MAP - 1)\n return self.solenoid.setCathodeField(field) # to reset solenoid calc", "def setnodeequation(self, node_p=None, eqn=None...
[ "0.5986817", "0.54941064", "0.5185355", "0.51526856", "0.51470023", "0.5018794", "0.4937843", "0.49082237", "0.48269215", "0.47911897", "0.47718498", "0.47511774", "0.46386972", "0.45983073", "0.45698503", "0.4542221", "0.45315984", "0.44926414", "0.44925195", "0.44865978", "...
0.8604317
1
Sets the group_id of this CrfItemRpc.
def group_id(self, group_id): self._group_id = group_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_group(self, group):\n self._group = group", "def set_group(self, group: str) -> None:\n self.group = group", "def group_id(self, group_id: int):\n if group_id is None:\n raise ValueError(\"Invalid value for `group_id`, must not be `None`\") # noqa: E501\n\n self....
[ "0.70160383", "0.69628024", "0.6946824", "0.6810983", "0.6760174", "0.67245066", "0.67065126", "0.6705655", "0.66906995", "0.66906995", "0.66906995", "0.664391", "0.65100795", "0.64564383", "0.6456075", "0.6305166", "0.62262404", "0.62043995", "0.6168643", "0.6094413", "0.609...
0.77553326
5
Sets the item_form_metadata_id of this CrfItemRpc.
def item_form_metadata_id(self, item_form_metadata_id): self._item_form_metadata_id = item_form_metadata_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_metadata_oid(self, item_metadata_oid):\n\n self._item_metadata_oid = item_metadata_oid", "def form_id(self, form_id):\n\n self._form_id = form_id", "def content_metadata_id(self, content_metadata_id):\n\n self._content_metadata_id = content_metadata_id", "def addMetaDataToItem(s...
[ "0.6074369", "0.58157575", "0.533627", "0.52323186", "0.5148497", "0.5148497", "0.5148497", "0.5114203", "0.5043071", "0.5022942", "0.5022942", "0.50081176", "0.5005859", "0.49673423", "0.49554864", "0.4884898", "0.4878688", "0.48538136", "0.48457968", "0.48377246", "0.478013...
0.84816015
0
Sets the measurement_unit of this CrfItemRpc.
def measurement_unit(self, measurement_unit): self._measurement_unit = measurement_unit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measurement_unit_string(self, measurement_unit_string):\n\n self._measurement_unit_string = measurement_unit_string", "def set_unit(self,unit):\n self.unit = unit", "def measurement_unit_name(self, measurement_unit_name):\n\n self._measurement_unit_name = measurement_unit_name", "def...
[ "0.6934508", "0.68823713", "0.653158", "0.63187003", "0.6187228", "0.6078049", "0.6078049", "0.606968", "0.6032217", "0.5872297", "0.58709675", "0.5853942", "0.5847092", "0.57580173", "0.56787544", "0.5669761", "0.5668834", "0.56567985", "0.5651917", "0.5651917", "0.5651917",...
0.7638329
0
Sets the measurement_unit_string of this CrfItemRpc.
def measurement_unit_string(self, measurement_unit_string): self._measurement_unit_string = measurement_unit_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measurement_unit(self, measurement_unit):\n\n self._measurement_unit = measurement_unit", "def measurement_unit_name(self, measurement_unit_name):\n\n self._measurement_unit_name = measurement_unit_name", "def set_unit(self,unit):\n self.unit = unit", "def unit(self,unit_str,unit_sca...
[ "0.69342524", "0.6766529", "0.618177", "0.5950563", "0.5881299", "0.5649154", "0.5590759", "0.55730164", "0.55730164", "0.55730164", "0.54654497", "0.54591984", "0.54122525", "0.5395756", "0.5375829", "0.5375829", "0.5371614", "0.53650004", "0.5358523", "0.5346713", "0.530544...
0.8108998
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, CrfItemRpc): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, CrfItemRpc): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Resets game stats for a user.
def post(self, request): user = UserValidator.validate_user(request.user.id) if user is None: return JsonResponse({ "message": "Invalid credentials.", }, status=400) try: body = request.POST.dict() game_str = body["game"].lower()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_user_module_score(self, user):\r\n self.set_user_module_score(user, None, None)", "def reset_stats(self):\n print(\"Reseting stats\")\n self.player_lives = self.ai_stts.player_lives\n self.score = 0\n self.level = 1", "def reset_stats(self):\n self.lives_left...
[ "0.73424584", "0.7254314", "0.7055046", "0.6924792", "0.69240695", "0.69219595", "0.68962747", "0.68628097", "0.6854392", "0.6842977", "0.67965555", "0.67965555", "0.6786569", "0.675496", "0.6624978", "0.65335876", "0.65319127", "0.64257956", "0.6368572", "0.6346359", "0.6346...
0.0
-1
Retrieves a scoreboard from the database for all users.
def get(self, request): queries = request.GET.dict() user = UserValidator.validate_user(request.user.id) if user is None: return JsonResponse({ "message": "Invalid credentials.", }, status=400) if user is None: return JsonResponse({ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all(self):\n cursor = self._connection.cursor()\n cursor.execute('SELECT * FROM scores ORDER BY level')\n all_scores = cursor.fetchall()\n return all_scores", "def get_user_scores(self, request):\n user = User.query(User.name == request.user_name).get()\n if not...
[ "0.68092585", "0.64024997", "0.64024997", "0.6362251", "0.6313973", "0.6241851", "0.60268027", "0.60023355", "0.5988399", "0.5982592", "0.5973822", "0.5959069", "0.5931531", "0.5922311", "0.59027916", "0.5896153", "0.58547866", "0.5821343", "0.5743743", "0.56955147", "0.56940...
0.5977742
10
Function that returns an array of dicitionaries that contain hourly precipitation.
def getHourlyPrecip(self, keyword): weather_data = self.getHourlyWeatherFromCSV(keyword, "f", "precipitation") precip_values = [] # Array that will contain all the precipitation data precip_data = {} # Dictionary of precipitation data # Getting precipiation data for data in weather_data: precip_data["x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hourly_table(self):\n htable = [0 for i in range(24)]\n for i in range(self.dataset.shape[0]):\n stime = time.localtime(np.int32(self.dataset[i][2]))\n evtime = stime[3]\n htable[evtime] += 1\n return htable", "def create_time_dicts(\n Spc:Dict) -> Lis...
[ "0.6463559", "0.613909", "0.6093991", "0.6042487", "0.5925016", "0.59128934", "0.5906665", "0.58405197", "0.5784834", "0.57635444", "0.57629764", "0.57609385", "0.57319915", "0.5725505", "0.5692133", "0.5651405", "0.5644695", "0.56426203", "0.56286174", "0.56097394", "0.55815...
0.6634811
0
Function that returns an array of dicitionaries that contain hourly humidity.
def getHourlyHumidity(self, keyword): weather_data = self.getHourlyWeatherFromCSV(keyword, "f", "humidity") humidity_values = [] # Array that will contain all the humidity data humidity_data = {} # Dictionary of humidity data # Getting humidity data for data in weather_data: humidity_data["x"] = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hourly_table(self):\n htable = [0 for i in range(24)]\n for i in range(self.dataset.shape[0]):\n stime = time.localtime(np.int32(self.dataset[i][2]))\n evtime = stime[3]\n htable[evtime] += 1\n return htable", "def get_zakopane_hourly_weather():\n zako...
[ "0.69876075", "0.6550981", "0.6545936", "0.64920527", "0.6491686", "0.6342034", "0.6323228", "0.621158", "0.6209409", "0.61248916", "0.6116892", "0.6090638", "0.6089367", "0.58852756", "0.5849867", "0.58365566", "0.58288854", "0.5820347", "0.57117563", "0.57063645", "0.567520...
0.7200092
0
called by the UserPassesTestMixin to verify the user has permissions to use this view
def test_func(self): self.rol_nu, self.functie_nu = rol_get_huidige_functie(self.request) return self.rol_nu == Rollen.ROL_RKO
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view(self, user):\r\n return True", "def test_should_render_with_permission(self) -> None:\n self.assertTrue(self.action.should_render(\n context=self._create_request_context(\n user=self.create_user())))", "def test_func(self):\n return self.request.user....
[ "0.7965206", "0.76659435", "0.76298976", "0.7598314", "0.75752974", "0.75072837", "0.74036145", "0.7306036", "0.7242765", "0.7231282", "0.7213383", "0.71765584", "0.71753776", "0.7168052", "0.71354675", "0.71217483", "0.7111363", "0.70701325", "0.7055857", "0.7005347", "0.699...
0.0
-1
Create an Nbin discrete colormap from the specified input map
def discrete_cmap(N, base_cmap=None): # Note that if base_cmap is a string or None, you can simply do # return plt.cm.get_cmap(base_cmap, N) # The following works for string, None, or a colormap instance: base = plt.cm.get_cmap(base_cmap) color_list = base(np.linspace(0, 1, N)) cmap_name = base.name + str(N) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discrete_cmap(N, base_cmap=None):\n base = plt.get_cmap(base_cmap)\n color_list = base(np.linspace(0, 1, N))\n cmap_name = base.name + str(N)\n return base.from_list(cmap_name, color_list, N)", "def discrete_cmap(N, base_cmap=None):\n # see https://gist.github.com/jakevdp/91077b0cae40f8f8244a\...
[ "0.7242805", "0.71656674", "0.68781185", "0.68781185", "0.68781185", "0.6861819", "0.6861819", "0.6861819", "0.6861819", "0.6861682", "0.6854892", "0.684856", "0.67342144", "0.66580445", "0.6597808", "0.65941465", "0.65885794", "0.6582792", "0.6508348", "0.64398456", "0.64053...
0.6901114
2
Reutrn square magnitude of distance between two vectors using cubic periodic boundry conditions
def sq_drij_c(r_i,r_j,latticevec): dr_pbc = delta_r_c(r_i,r_j,latticevec) sq_dr = np.dot( dr_pbc,dr_pbc) return sq_dr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(v1, v2):\r\n return magnitude(*subtract(v2, v1))", "def _vector_dist(self, vec1, vec2):\r\n return sqrt(sum([(float(v1) - float(v2)) ** 2 for v1, v2 in\r\n zip(vec1, vec2)]))", "def dist(v1: vect2d, v2: vect2d) -> float:\n d = ((v2.x - v1.x)**2 + (v2.y - v1.y)**2...
[ "0.7170656", "0.69511014", "0.67425454", "0.6718942", "0.66979134", "0.6645551", "0.6612918", "0.65757054", "0.6573481", "0.6559422", "0.65465415", "0.65376735", "0.6466167", "0.64429617", "0.6439637", "0.642974", "0.64206535", "0.6398421", "0.63980985", "0.6396248", "0.63950...
0.0
-1
Get the object as a dictionary for backwards compatibility. This method does not make a deep copy of the objects.
def as_dict(self, key: str, output_type=torch.Tensor, dtype=None) -> dict: if output_type not in (torch.Tensor, np.ndarray): raise ValueError(f"output_type must be torch.Tensor or np.ndarray, got {output_type}.") return { key: self.get_array(output_type=output_type, dtype=dtype),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict(self):\n return objToDict(self)", "def to_obj(self):\n return dict()", "def to_dict(self) -> dict:\n return self.__dict__.copy()", "def realized(self):\n result = {\"Object\": True}\n for key in self.__dict__:\n if isinstance(self.__dict__[key], Object):...
[ "0.80097765", "0.78671485", "0.78469497", "0.7836796", "0.77461374", "0.7720491", "0.76937306", "0.76652414", "0.7660919", "0.75706804", "0.754214", "0.75160575", "0.74929184", "0.7490038", "0.7486664", "0.74120426", "0.7409967", "0.7409967", "0.7409967", "0.7409967", "0.7409...
0.0
-1
Get the affine. Defaults to ``torch.eye(4, dtype=torch.float64)``
def affine(self) -> torch.Tensor: return self.meta.get(MetaKeys.AFFINE, self.get_default_affine())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affine(self):\n return self._affine", "def affine(self):\n return self._affine", "def affine_matrix(self) -> np.ndarray:\n return self._forward_link._inverse_tf_matrix", "def affine_matrix(self) -> np.ndarray:\n return self._tf_matrix", "def identity(self):\r\n return...
[ "0.73244977", "0.73244977", "0.7034071", "0.6716834", "0.6285688", "0.61694545", "0.60546416", "0.6044253", "0.6030682", "0.60299814", "0.60090077", "0.5996965", "0.5986905", "0.5977513", "0.5952649", "0.58663064", "0.5840154", "0.5812988", "0.57664084", "0.5730047", "0.56989...
0.8271803
0
Get the currently expected spatial shape as if all the pending operations are executed. For tensors that have more than 3 spatial dimensions, only the shapes of the top 3 dimensions will be returned.
def peek_pending_shape(self): res = None if self.pending_operations: res = self.pending_operations[-1].get(LazyAttr.SHAPE, None) # default to spatial shape (assuming channel-first input) return tuple(convert_to_numpy(self.shape, wrap_sequence=True).tolist()[1:]) if res is Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape(self) -> Optional[tuple]:\n return self._shape", "def shape(self):\n for component in ('x', 'y', 'z', 'r', 't'):\n arr = getattr(self, component)\n if arr is not None:\n return arr.shape\n return ()", "def get_shape(tensor):\n return tensor...
[ "0.65158755", "0.6501008", "0.63225687", "0.62908447", "0.6276678", "0.6248002", "0.6236132", "0.619782", "0.6171303", "0.61683255", "0.6165676", "0.6165676", "0.61600304", "0.61270195", "0.61270195", "0.6123402", "0.611571", "0.6104924", "0.6095529", "0.60923743", "0.6088928...
0.76483154
0
Returns a copy of the MetaTensor instance.
def clone(self, **kwargs): new_inst = MetaTensor(self.as_tensor().clone(**kwargs)) new_inst.__dict__ = deepcopy(self.__dict__) return new_inst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self, **kwargs):\n return Tensor(self.data, **kwargs)", "def copy(self) -> \"SampleMetadata\":\n return type(self)(\n samples=self.__internal_samples.copy(),\n axis=0,\n metadata=self.metadata,\n name=self.name,\n )", "def shallow_copy(s...
[ "0.7466796", "0.6973937", "0.68706995", "0.68373454", "0.6730053", "0.6699722", "0.63855034", "0.62816685", "0.6239763", "0.6237276", "0.6225124", "0.6209906", "0.61651164", "0.61292535", "0.60899", "0.6055746", "0.6036911", "0.6025888", "0.6019292", "0.6019292", "0.5975815",...
0.7911877
0
Invokes the patch function code.
def _patch_implementation(self, original, *args, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch(self, *args, **kwargs):\n return self.handle_patch_request()", "def patch(self, *args, **kwargs):\n self.request(\"patch\", *args, **kwargs)", "def patch_hook():\n\n patch_apply(\"package_to_be_patched.foobar.target_function2\", patch_function)", "def simulate_patch(app, path, **kw...
[ "0.7181833", "0.6972852", "0.69465077", "0.69131327", "0.67479265", "0.6711913", "0.6524039", "0.6466874", "0.64268315", "0.6370807", "0.6356285", "0.6292822", "0.62594974", "0.6226834", "0.62267226", "0.6209166", "0.620355", "0.6179677", "0.61324805", "0.61216265", "0.605775...
0.59173274
24
Return a list of mats that do not contain K4.
def check_k4(list_of_mats, n): four_list = list(itertools.combinations([i for i in range(n)], 4)) coordinate_list = [list(itertools.combinations(four, 2)) for four in four_list] possible_mats = [] for mats in list_of_mats: flag = 0 for coordinate in coordinate_list: if sum([m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_sets(session, player):\n excluded_sets = set(session.taken.keys())\n for grouping in session.exclusives:\n if player.sets.intersection(grouping):\n excluded_sets.update(grouping)\n return [s for s in session.sets if s not in excluded_sets]", "def get_mutations_we_miss(qua...
[ "0.60540164", "0.60038203", "0.60009027", "0.5851803", "0.5758202", "0.567645", "0.56455743", "0.5608117", "0.5584816", "0.5528558", "0.5528176", "0.54567647", "0.5434467", "0.5423819", "0.54065424", "0.539741", "0.53750074", "0.53735214", "0.53254944", "0.53253543", "0.53239...
0.54695964
11
Generate a single batch from the current cursor position in the data.
def _next_batch(self): batch = np.zeros(shape=(self._batch_size, vocabulary_size), dtype=np.float) for b in range(self._batch_size): # same id, same index of second dimension batch[b, char2id(self._text[self._cursor[b]])] = 1.0 self._cursor[b] = (self._cursor[b] + 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _next_batch(self):\n batch = np.zeros(shape=(self._batch_size, vocabulary_size), dtype=np.float)\n for b in range(self._batch_size):\n batch[b, char2id(self._text[self._cursor[b]])] = 1.0\n self._cursor[b] = (self._cursor[b] + 1) % self._text_size\n return batch", "...
[ "0.66667616", "0.66667616", "0.6660024", "0.65867865", "0.658619", "0.65626955", "0.6516139", "0.64412314", "0.64412314", "0.63997316", "0.63963693", "0.6388216", "0.6380586", "0.6371006", "0.6334705", "0.63271517", "0.6289895", "0.6276686", "0.6248467", "0.6226875", "0.62233...
0.67493474
0
Turn a 1hot encoding or a probability distribution over the possible characters back into its (most likely) character representation.
def characters(probabilities): # argmax for the most likely character return [id2char(c) for c in np.argmax(probabilities, 1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onehot_to_chars(self, one_hot_seq):\n gen_ints = [np.where(r==1)[0][0] for r in one_hot_seq]\n gen_chars = self.int_to_char(gen_ints)\n return gen_chars", "def onehot_to_string(self, one_hot_seq):\n gen_ints = [np.where(r==1)[0][0] for r in one_hot_seq]\n gen_char_list = self.int_to_...
[ "0.7793053", "0.73569626", "0.72267234", "0.71690375", "0.7035013", "0.6954102", "0.6875", "0.6755982", "0.6725703", "0.67028934", "0.6617573", "0.65835214", "0.64702904", "0.64271295", "0.64073384", "0.6341615", "0.6338018", "0.6328194", "0.63187355", "0.6297755", "0.6252730...
0.58290714
48
Sample one element from a distribution assumed to be an array of normalized probabilities.
def sample_distribution(distribution): # 取一部分数据用于评估,所取数据比例随机 r = random.uniform(0, 1) s = 0 for i in range(len(distribution)): s += distribution[i] if s >= r: return i return len(distribution) - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_one(self):\n # x = self.mean + self.sigma * np.random.normal()\n x = self.dist.sample(1)\n return x", "def sample(self, probabilities):\n return self.sample_bernoulli(probabilities)", "def sample(probs):\n\n probs = probs / probs.sum()\n return np.random.choice(np.arang...
[ "0.7231382", "0.69920933", "0.686515", "0.6848672", "0.6785502", "0.6785502", "0.6785502", "0.65051377", "0.6477911", "0.6473931", "0.64216405", "0.64014477", "0.6375856", "0.63238806", "0.6275407", "0.6253217", "0.6243228", "0.6218153", "0.6218153", "0.62175065", "0.6217285"...
0.57278574
81
Turn a (column) prediction into 1hot encoded samples.
def sample(prediction): p = np.zeros(shape=[1, vocabulary_size], dtype=np.float) p[0, sample_distribution(prediction[0])] = 1.0 return p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_one_hot(a):\n a = a[:, 0]\n a = a.astype(int)\n A = np.zeros((len(a), config.num_classes))\n A[np.arange(len(a)), a] = 1\n return A", "def one_hot_encode(df, col):\n return pd.get_dummies(df, columns=[col], drop_first=True)", "def one_hot_converter(column):\n # encode class ...
[ "0.7741421", "0.77376133", "0.77311134", "0.7605853", "0.7539538", "0.7496446", "0.7495923", "0.74907154", "0.74843967", "0.7442956", "0.7310723", "0.7310169", "0.7302923", "0.72990006", "0.72776663", "0.72555137", "0.72271734", "0.7222733", "0.72105426", "0.7184412", "0.7152...
0.0
-1
Generate a random column of probabilities.
def random_distribution(): b = np.random.uniform(0.0, 1.0, size=[1, vocabulary_size]) return b / np.sum(b, 1)[:, None]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(self, probabilities):\n return self.sample_bernoulli(probabilities)", "def sample(probs):\n\n probs = probs / probs.sum()\n return np.random.choice(np.arange(len(probs)), p=probs.flatten())", "def random_distribution():\n b = np.random.uniform(0.0, 1.0, size=[1, vocabulary_size])\n re...
[ "0.6374406", "0.6367189", "0.62448347", "0.62448347", "0.6099934", "0.60623235", "0.6043567", "0.6032514", "0.60292464", "0.6012624", "0.5984736", "0.59398454", "0.59206384", "0.58835787", "0.5838801", "0.5838801", "0.5836376", "0.57978", "0.5753392", "0.57325506", "0.5689183...
0.621208
4
Asks user to specify a city, month, and day to analyze.
def get_filters(): print('Hello! Let\'s explore some US bikeshare data!\n') # get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs city = () valid_city = ["chicago", "new york city", "washington"] while city == (): user_city = inpu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.667024", "0.65349954", "0.6459213", "0.6374199", "0.63475233", "0.6309238", "0.6286008", "0.625863", "0.62317747", "0.6213412", "0.6204763", "0.61802983", "0.6172001", "0.6167731", "0.61582506", "0.6157104", "0.61433566", "0.6129859", "0.6104191", "0.6102047", "0.609084", ...
0.61526835
16
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): df = pd.read_csv(CITY_DATA[city]) # similar to practiceQ3, load data file into a dataframe df['Start Time'] = pd.to_datetime(df['Start Time']) # similar to practiceQ3, convert the "Start Time" column to to_datetime YY # similar to practiceQ3, extract month and day of week ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81320685", "0.8108889", "0.8045821", "0.8042514", "0.80090284", "0.80071104", "0.79991937", "0.7998333", "0.7988789", "0.797905", "0.79737365", "0.79610896", "0.7956163", "0.7947432", "0.79463065", "0.7908287", "0.7908229", "0.7904569", "0.7900715", "0.78930074", "0.788921...
0.7537176
85
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() df['Start Time'] = pd.to_datetime(df['Start Time']) # convert the "Start Time" column to datetime YY print(df['month']) # display the most common month popular_month = df['month'].mode()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.0
-1
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # display most commonly used start station popular_start_station = df['Start Station'].mode()[0] print('\nMost popular start station:\n', popular_start_station) # display most commo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7446617", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198...
0.7021536
73
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # display total travel time # travel time is in seconds in the csv files. sum the travel times, then convert from sec to min YY duration_total_min = df['Trip Duration'].sum()/60 print('\nTotal tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.7664856
76
Converts dataframe entries into a list of lists, to maintain consistency with the format of other data used in the analysis
def convert_df_to_list(dividend_df): dividend_list = [] date_list = dividend_df.head(len(dividend_df)).index.strftime('%Y-%m-%d').tolist() dividend_val_list = dividend_df.tolist() for i in range (len(dividend_val_list)): dividend_list.append([date_list[i], dividend_val_list[i]]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataframe_to_list(df: pandas.DataFrame) -> list:\n return json.loads(df.to_json(orient=\"records\"))", "def as_list(df: pandas.DataFrame, row=-1) -> list:\n if df is None:\n return []\n if row >= 0:\n rec = []\n for col in range(0, 13):\n rec.append(df.iat[row, col])\...
[ "0.730984", "0.72403586", "0.6837504", "0.67379206", "0.67332923", "0.67246866", "0.65977573", "0.6580051", "0.65614426", "0.6543524", "0.6418984", "0.6390095", "0.62969214", "0.6269897", "0.62307125", "0.6204004", "0.6198425", "0.6192114", "0.6180179", "0.6166215", "0.615152...
0.679799
3
Wraps the original decoder helper function to append the attention context.
def _att_next_inputs(time, outputs, state, sample_ids, name=None): finished, next_inputs, next_state = helper.next_inputs( time=time, outputs=outputs, state=state, sample_ids=sample_ids, name=name) # Input-feeding a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, encoder_state, context, context_lens):\n attn = self.attention(context, encoder_state.squeeze(0), context_lens)\n return attn", "def _prepare_attended_output(self,\n decoder_hidden_state: torch.Tensor,\n state: Dict[s...
[ "0.6490527", "0.5778334", "0.5678051", "0.56027395", "0.5542547", "0.54593205", "0.54099184", "0.5336561", "0.5321487", "0.5320484", "0.5295615", "0.52940625", "0.5289901", "0.5288307", "0.527136", "0.52188194", "0.52167493", "0.5197112", "0.51877797", "0.5174573", "0.5137656...
0.0
-1
Plot a confusion matrix of the predicted labels and the true labels for the test set species. The export is probably better for viewing than the matplotlib view.
def plot_confusion_matrix( Y_pred, Y_true, config, target_names=None, species_dict=None, title="Confusion matrix", cmap=None, normalize=False, scores=False, score_size=12, save=None, ): # Remove predictions if true labels are not in test set. missings = list( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotConfusionMatrix(y, pred, title, labels, outfile, cmap=plt.cm.Blues):\n \n cm = confusion_matrix(y, pred);\n ncm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n accuracy = accuracy_score(y, pred)\n \n fig = plt.figure(figsize=(10, 10))\n plt.imshow(ncm, interpolation='nearest',...
[ "0.75911516", "0.74269354", "0.72838706", "0.7277989", "0.71897584", "0.7164294", "0.71596324", "0.7126898", "0.7112279", "0.70958483", "0.7089717", "0.70813483", "0.70667386", "0.7041925", "0.70248234", "0.70126534", "0.69977295", "0.6988617", "0.69840145", "0.69784576", "0....
0.7191913
4
r"""Default weight initializer for all generator models. Models that require custom weight initialization can override this method
def _weight_initializer(self): for m in self.modules(): if isinstance(m, nn.ConvTranspose2d): nn.init.kaiming_normal_(m.weight) elif isinstance(m, nn.BatchNorm2d): nn.init.constant_(m.weight, 1.0) nn.init.constant_(m.bias, 0.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_weight_initializer(self):\n self.biases = [np.random.randn(y, 1) for y in self.sizes[1:]]\n self.weights = [np.random.randn(y, x)/np.sqrt(x)\n for x, y in zip(self.sizes[:-1], self.sizes[1:])]", "def init_weights_(self):\n raise NotImplementedError", "def...
[ "0.79438937", "0.78011465", "0.7741538", "0.7670633", "0.7603961", "0.75709236", "0.7519254", "0.74756426", "0.7462055", "0.7427889", "0.7386948", "0.72429323", "0.71512026", "0.7125343", "0.702615", "0.70235306", "0.6980606", "0.69723755", "0.6955039", "0.69512033", "0.69388...
0.75409186
6
r"""Default weight initializer for all disciminator models. Models that require custom weight initialization can override this method
def _weight_initializer(self): for m in self.modules(): if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight) elif isinstance(m, nn.BatchNorm2d): nn.init.constant_(m.weight, 1.0) nn.init.constant_(m.bias, 0.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_weight_initializer(self):\n self.biases = [np.random.randn(y, 1) for y in self.sizes[1:]]\n self.weights = [np.random.randn(y, x)/np.sqrt(x)\n for x, y in zip(self.sizes[:-1], self.sizes[1:])]", "def _weight_initializer(self):\n for m in self.modules():\n ...
[ "0.7866824", "0.7774491", "0.7758249", "0.7671128", "0.7610582", "0.76029897", "0.74462485", "0.7385242", "0.7379879", "0.7360368", "0.7357841", "0.7272886", "0.72396696", "0.72342914", "0.71598744", "0.713976", "0.71141", "0.7112334", "0.7097547", "0.7054244", "0.70178837", ...
0.7860829
1
Test to make sure a ticket which has already been sold can't be resold unless the owner marks it for sale
def test_buyTicket_AlreadySold(): assert not testUser2.buyTicket(testTicket1) assert testTicket1 in testUser1.inventory assert testTicket1 not in testUser2.inventory assert not testTicket1.for_sale assert testUser2.wallet == 500
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_buyTicket_NotForSale():\n old_venue_balance = testVenue.wallet\n assert not testUser2.buyTicket(testTicket2)\n assert testTicket2 not in testUser2.inventory\n assert not testTicket1.for_sale\n assert testUser2.wallet == 500\n assert testVenue.wallet == old_venue_balance", "def test_val...
[ "0.7288074", "0.6752858", "0.6630722", "0.65845925", "0.6513129", "0.650699", "0.6440309", "0.642398", "0.6413303", "0.63476056", "0.6291786", "0.62573767", "0.6256726", "0.6212813", "0.6209236", "0.6204787", "0.6172133", "0.61710596", "0.61401135", "0.6136614", "0.61074334",...
0.7809714
0
Test to make sure you can't purchase a ticket not for sale
def test_buyTicket_NotForSale(): old_venue_balance = testVenue.wallet assert not testUser2.buyTicket(testTicket2) assert testTicket2 not in testUser2.inventory assert not testTicket1.for_sale assert testUser2.wallet == 500 assert testVenue.wallet == old_venue_balance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_noTicket():\n assert testUser1.buyTicket(None) == False", "def test_buyTicket_AlreadySold():\n assert not testUser2.buyTicket(testTicket1)\n assert testTicket1 in testUser1.inventory\n assert testTicket1 not in testUser2.inventory\n assert not testTicket1.for_sale\n assert testUser2.wa...
[ "0.77117753", "0.7637331", "0.7400361", "0.72487754", "0.7203155", "0.7156651", "0.71263564", "0.7095128", "0.7088714", "0.7087936", "0.70712763", "0.70455307", "0.7027923", "0.690337", "0.6882359", "0.68524826", "0.68398476", "0.6835652", "0.68294644", "0.6769182", "0.676878...
0.78358793
0
Ensure that the creation of a new movie object is not allowed for not authenticated users.
def test_create_movie_not_authenticated(self): data = { 'title': 'The Mask', 'release_year': 1994 } response = self.client.post(self.url, data, format='json') self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_video_create_anonymous(self):\n response = self.client.post(\"/api/videos/\")\n self.assertEqual(response.status_code, 401)\n self.assertFalse(models.Video.objects.exists())", "def test_not_creator_cannot_update(self):\n\n logged_user = utils.create_user_and_authenticate(...
[ "0.671903", "0.6286038", "0.6188675", "0.6176152", "0.6167834", "0.6139604", "0.6135774", "0.6106595", "0.6097984", "0.6072456", "0.60644823", "0.60622823", "0.6036793", "0.6016531", "0.5973718", "0.59700394", "0.59597915", "0.5955421", "0.5908756", "0.5898483", "0.58813095",...
0.73922145
0
Ensure that the update of a movie object is not allowed for not authenticated users.
def test_update_movie_not_authenticated(self): data = {'title': 'The Mask 2'} response = self.client.patch(self.url, data, format='json') self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_should_not_be_allowed(self):\n response = self.client.put(self.get_url(), {})\n self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)", "def test_post_update_unauthorized(self):\n url = reverse('post-detail', kwargs={'pk': self.post.id})\n user_url...
[ "0.6605428", "0.64377487", "0.64276636", "0.6374926", "0.6316321", "0.62332815", "0.621346", "0.6212316", "0.62085897", "0.6121107", "0.6072681", "0.60704005", "0.60604197", "0.60599035", "0.60375136", "0.6014261", "0.600959", "0.5995299", "0.59438574", "0.5876327", "0.585679...
0.7432093
0
Attempts to convert the given date string to a datetime.datetime object otherwise returns the input `date_string`
def _parse_date(date_string: str) -> Union[datetime.datetime, str]: for date_format in KNOWN_DATE_FORMATS: try: date = datetime.datetime.strptime(date_string, date_format) return date except ValueError: continue return date_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_from_string(date_string):\n try:\n return datetime.datetime.strptime(date_string, date_format)\n except Exception as e:\n print(\"Got exception parsing date {} with format {} {}\"\n .format(date_string, date_format, e))", "def date_from_string(date):\n _type = type(...
[ "0.8281641", "0.8183171", "0.8109039", "0.8007696", "0.80035657", "0.7994572", "0.7939067", "0.7914784", "0.7907773", "0.7888757", "0.77592826", "0.77592826", "0.7715171", "0.76996195", "0.7666756", "0.7662666", "0.7651084", "0.7646723", "0.7614165", "0.7609397", "0.75867504"...
0.80035734
4
Returns the message that we map into the GA4GH protocol message. For many exceptions we can simply set the message statically for a given class, and this message will be returned by default. For more elaborate messages that must be contructed at run time, we can override this method and use state held in instance varia...
def getMessage(self): return self.message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_message(self):\n return self.__message", "def message(self):\n if not python_utils.is_string(self._message):\n raise NotImplementedError(\n 'self.message must be assigned a value in __init__')\n return self._message", "def get_message(self):\n retu...
[ "0.6827955", "0.67246217", "0.665366", "0.665366", "0.6646244", "0.6520563", "0.6517846", "0.6485652", "0.6443103", "0.63925076", "0.6273588", "0.6273272", "0.6273272", "0.6273272", "0.6273272", "0.6273272", "0.6273272", "0.6199023", "0.61701936", "0.615498", "0.61398077", ...
0.61779916
19
Split a Path2D into multiple Path2D objects where each one has exactly one root curve.
def split(path): # avoid a circular import by referencing class of path Path2D = type(path) # save the results of the split to an array split = [] # get objects from cache to avoid a bajillion # cache checks inside the tight loop paths = path.paths discrete = path.discrete polygons...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_path(self, path):\n# import pdb;pdb.set_trace()\n if len(path) < 2:\n return [path]\n\n paths = [[path[0]]]\n for i in range(1, len(path)-1):\n p0 = path[i-1]\n p1 = path[i]\n p2 = path[i+1]\n v1 = p0 - p1\n v2 ...
[ "0.6195983", "0.565036", "0.5556326", "0.553719", "0.54967225", "0.54963195", "0.5379182", "0.525305", "0.5249551", "0.5211067", "0.5206247", "0.5139166", "0.51292324", "0.51076293", "0.5085478", "0.50777566", "0.50749373", "0.50722826", "0.5064399", "0.5063709", "0.50508505"...
0.7682899
0
Gets the default Y range values according to the transform param
def get_y_default(self, transform): return self._handlers_by_class[transform.__class__].get_y_default(transform)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_y_limits(self, transform):\n return self._handlers_by_class[transform.__class__].get_y_limits(transform)", "def get_ylim(self):\n if isinstance(self._frame, root.TH1F):\n return (self._frame.GetMinimum(), self._frame.GetMaximum())\n else:\n return (self._frame.G...
[ "0.6880868", "0.65471107", "0.64696336", "0.6431864", "0.6316628", "0.6307572", "0.6288991", "0.61986685", "0.61986685", "0.6146175", "0.60902715", "0.60775876", "0.59848", "0.5938091", "0.5913424", "0.58769774", "0.5853324", "0.5829609", "0.58284444", "0.58262676", "0.582459...
0.7613629
0
Gets the Y axis limits values of the corresponding transform
def get_y_limits(self, transform): return self._handlers_by_class[transform.__class__].get_y_limits(transform)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ylim(self):\n if isinstance(self._frame, root.TH1F):\n return (self._frame.GetMinimum(), self._frame.GetMaximum())\n else:\n return (self._frame.GetYaxis().GetXmin(), self._frame.GetYaxis().GetXmax())", "def getYLimit(self):\n return self.axes.get_ylim()", "de...
[ "0.7892102", "0.78365016", "0.7468317", "0.6990941", "0.6933403", "0.6882724", "0.6799309", "0.678695", "0.678695", "0.67554957", "0.66665363", "0.6513531", "0.6502306", "0.6496561", "0.64958876", "0.6466566", "0.6449399", "0.6446912", "0.6425134", "0.637918", "0.63652426", ...
0.83933055
0
Gets the axis labels information of the corresponding transform to show it when graphing
def get_axis_labels(self, transform): return self._handlers_by_class[transform.__class__].get_axis_labels()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def axesNames(self, data, info):\n return []", "def getAxisLabel(self, dim=0):\n return self.__axis_labels__[dim]", "def axesnames(self):\n return self._axesnames", "def labels(self):\n return self.label(self.p_y_given_x)", "def names(self):\n labels = [\n \"$X...
[ "0.64331275", "0.64320606", "0.6318705", "0.630041", "0.62415504", "0.61871034", "0.6155055", "0.6092563", "0.6073711", "0.60591954", "0.6030437", "0.6008552", "0.5996544", "0.5972787", "0.59502023", "0.5930357", "0.5930357", "0.5873515", "0.58603597", "0.584908", "0.57713145...
0.8094402
0
Returns string with spaces replaced by underscores
def _get_slug(str): return str.replace(" ", "_")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def underscore(text):\n # return '__'+text.replace(' ','__') + '__'\n return text.replace(' ', '__')", "def descorize(s):\n return s.replace(\"_\", \" \")", "def unscorize(s):\n return s.replace(\" \", \"_\")", "def sanitize(s):\n s = s.replace(\"_\", \"\\\\_\")\n return s", "def pre_unde...
[ "0.85036457", "0.82173324", "0.79002523", "0.7712458", "0.76904744", "0.7670745", "0.7524853", "0.7523088", "0.7348006", "0.7331303", "0.7300442", "0.7252202", "0.7251133", "0.7204409", "0.7146332", "0.713771", "0.7123947", "0.710754", "0.7098836", "0.70323837", "0.699316", ...
0.64406925
56
Draw a number of images and their predictions
def display_classes(png, images, classes, ncol=4): fig = plt.figure() nrow = len(images) / ncol if len(images) % ncol > 0: nrow = nrow + 1 def draw(i): plt.subplot(nrow,ncol,i) plt.imshow(images[i].reshape(28,28), cmap='gray', interpolation='none') plt.title('Predicted: %s' % classes[i]) [ draw(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_predictions(self, images, preds, targets):\n\n class_names = ['angry', 'happy', 'sad']\n images = images[:8]\n preds = preds[:8]\n targets = targets[:8]\n\n # determine size of the grid based for the given batch size\n num_rows = int(torch.tensor(len(images))...
[ "0.7453203", "0.73096824", "0.71576315", "0.7115452", "0.7062802", "0.70624876", "0.7032798", "0.6975675", "0.6972506", "0.69536066", "0.69395304", "0.6914672", "0.68592745", "0.68427026", "0.68203497", "0.67965275", "0.67648077", "0.67632174", "0.67362535", "0.6711209", "0.6...
0.67994046
15
Uses bonds.json to produce a list, with each element being a list of pairs (toAtomIndex, bond order)
def stordir_to_connectivity(self, stordir): output,suffix = [],'/chargemol_analysis/final/bonds.json' with open(stordir+suffix,'r') as f: bond_dicts = json.load(f) n = len(self.stordir_to_atoms(stordir)) for i in range(n): newatom = [] for bond in bond_dicts: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_bonds_list(structure, ops_dict):\n\n if ops_dict['compute-bonds']:\n raw_bonds = compute_bonds(structure, ops_dict)\n else:\n raw_bonds = []\n\n bonds = update_bonds(raw_bonds, structure.bonds)\n\n return bonds", "def extract_bonds(self):\n atom_types = self.contents['Su...
[ "0.67041737", "0.60807246", "0.5817543", "0.57692236", "0.5686415", "0.5679137", "0.56729937", "0.5626626", "0.56039923", "0.56039923", "0.56039923", "0.5595774", "0.5493287", "0.54891944", "0.54884493", "0.54763854", "0.5429814", "0.5413516", "0.5377904", "0.5374588", "0.535...
0.6054992
2
r""" Function to partition the rows at a decisionNode. This will return a dictionary where keys are the attribute value of the column based on which partition is happening whereas value is the list of rows having that particular attribute value
def perform_partition(rows, partition_attribute): data_partitions = defaultdict(list) for row in rows: data_partitions[row[partition_attribute]].append(row) return data_partitions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partition(x):\r\n\r\n # INSERT YOUR CODE HERE\r\n elements,counts = np.unique(x,return_counts = True)\r\n partitioned_dict = {}\r\n\r\n for row in elements:\r\n partitioned_dict[row] = []\r\n for index, item in enumerate(x):\r\n if item == row:\r\n partitione...
[ "0.6172423", "0.6138492", "0.59874946", "0.5703261", "0.5695859", "0.5654481", "0.5558454", "0.54919076", "0.5484068", "0.545629", "0.52830833", "0.52796566", "0.527258", "0.5265376", "0.52508956", "0.52362716", "0.5203436", "0.519827", "0.51912856", "0.51491034", "0.51200885...
0.6982177
0
Convert from metres per second to kilometres per hour.
def _mps_to_kph(self) -> None: if self.units == "m/s": self.units = "km/h" self.value = ((self.value * 360) / 100).__round__(2) else: msg = ( "Not a valid unit conversion, expected units to be in 'm/s' but instead " + f"units were in {s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def si_to_kmh(vals):\n return vals * 3600.0 / 1000.0", "def si_to_mph(vals):\n return vals * 3600.0 / meters_per_mile", "def kmh_to_ms(speed_in_kmh):\n meters_per_second = speed_in_kmh * 1000 / 3600\n return meters_per_second", "def sec_to_hm(t):\n t = int(t)\n s = t % 60\n t...
[ "0.70011294", "0.69206196", "0.6882445", "0.6710847", "0.6569927", "0.6511546", "0.6488699", "0.6480719", "0.64334565", "0.6330102", "0.6322818", "0.6194684", "0.6146735", "0.60993713", "0.60589224", "0.6037695", "0.6036903", "0.6036892", "0.59867257", "0.59847504", "0.598290...
0.6729627
3
Convert from metres per second to miles per hour.
def _mps_to_mph(self) -> None: if self.units == "m/s": self.units = "mph" self.value = (self.value * 2.236936).__round__(2) else: msg = ( "Not a valid unit conversion, expected units to be in 'm/s' but instead " + f"units were in {self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meters_to_miles(meters):\n miles = meters / 1609.344\n return miles", "def si_to_mph(vals):\n return vals * 3600.0 / meters_per_mile", "def kilometers_to_miles(km):\n #convert km to miles:\n return km*0.621371", "def kilometer_to_miles(kilometers: float) -> float:\n kilometers = float(k...
[ "0.7061753", "0.68285376", "0.66993976", "0.6554829", "0.6431596", "0.6349281", "0.63148355", "0.62682796", "0.6246572", "0.6207273", "0.6195181", "0.6155799", "0.6135055", "0.6116334", "0.6097469", "0.6090478", "0.6033809", "0.600784", "0.5949629", "0.59237736", "0.59086484"...
0.658693
3
Return intervals between specified time periods.
def intervals_between(self, start: dt.datetime, end: dt.datetime) -> List[Interval]: relevant_intervals: List[Interval] = [] for interval in self.intervals: if start <= interval.start_time < end: relevant_intervals.append(interval) return relevant_intervals
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_intervals(self) -> List[Tuple[datetime.datetime, datetime.datetime]]:\n if self.granularity == 'HOUR':\n days = max(min((self.bounds[1] - self.bounds[0]).days,\n self.GRANULARITIES['HOUR'][1]),\n self.GRANULARITIES['HOUR'][0])\n ...
[ "0.71997386", "0.71134514", "0.7088042", "0.70750344", "0.69683117", "0.67887634", "0.67071116", "0.6684604", "0.64738655", "0.64073616", "0.63970983", "0.6300294", "0.62635726", "0.6246997", "0.62060344", "0.61935496", "0.61610997", "0.6131245", "0.6128161", "0.60988605", "0...
0.717961
1
Set up a cohorted course
def setUp(self): super().setUp() # create course with cohorts self.manual_cohort_name = "ManualCohort1" self.auto_cohort_name = "AutoCohort1" self.course_fixture = CourseFixture(**self.course_info).install() self.setup_cohort_config(self.course_fixture, auto_cohort_group...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_cohort(self):\r\n course = modulestore().get_course(self.toy_course_key)\r\n self.assertEqual(course.id, self.toy_course_key)\r\n self.assertFalse(course.is_cohorted)\r\n\r\n user = User.objects.create(username=\"test\", email=\"a@b.com\")\r\n other_user = User.objec...
[ "0.67376953", "0.6507354", "0.632316", "0.6217576", "0.6188431", "0.6060006", "0.60140043", "0.5847302", "0.58092344", "0.57975006", "0.5786021", "0.5756937", "0.574838", "0.5686025", "0.5666365", "0.5643146", "0.56192887", "0.56070566", "0.5603696", "0.55804735", "0.5576551"...
0.6704507
1
Collect control curve path from FR_CONTROLCURVE environment.
def get_control_curve_path(): return __get_environ_path('FR_CONTROLCURVE')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_curve_data(control_points):\n spline = CSpline(control_points)\n t_extrapolation = 1 # how far to draw the straight lines past the\n t_min = 0 - t_extrapolation\n t_max = len(control_points) // 3 - 1 + t_extrapolation\n return np.array(\n [\n s...
[ "0.5951237", "0.5833568", "0.5666048", "0.56425357", "0.5575856", "0.556776", "0.5339969", "0.53348845", "0.52649623", "0.52501017", "0.5211717", "0.51152426", "0.51091015", "0.51089084", "0.5074501", "0.50725436", "0.5041768", "0.50399154", "0.5039824", "0.502146", "0.501650...
0.8215724
0
Get all left nodes. It can be used for generating training examples from gold RST tree
def getedunode(tree): # Post-order depth-first traversal post_nodelist = postorder_DFT(tree, []) # EDU list edulist = [] for node in post_nodelist: if (node.lnode is None) and (node.rnode is None): edulist.append(node) return edulist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left_view(self)->list:\n\t\tqueue=[]\n\t\tleft=[]\n\t\tqueue.append(self)\n\t\twhile(len(queue)>0):\n\t\t\tfor i in range(len(queue)):\n\t\t\t\tif(i==0):\n\t\t\t\t\tleft.append(queue[0].data)\n\t\t\t\tnode=queue[0]\n\t\t\t\tqueue.pop(0)\n\t\t\t\tif(node.left!=None):\n\t\t\t\t\tqueue.append(node.left)\n\t\t\t\t...
[ "0.7168673", "0.68385863", "0.6522896", "0.65085864", "0.6503525", "0.6472779", "0.6428576", "0.6368648", "0.63449377", "0.6280077", "0.62585723", "0.6256838", "0.6254882", "0.62265044", "0.62195337", "0.6218359", "0.61967367", "0.61967367", "0.61893284", "0.6162175", "0.6158...
0.0
-1
Returns the full parquet path as an output for the Luigi Task (e.g. impc/dr15.2/parquet/mgi_strain_parquet)
def output(self): return ImpcConfig().get_target(f"{self.output_path}mgi_strain_parquet")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_path(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"full_path\")", "def path(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"path\")", "def path(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"path\")", "def path(self) -> pulumi.Output[Optio...
[ "0.6417673", "0.64109874", "0.6385963", "0.6385963", "0.6091211", "0.60321474", "0.6003638", "0.59587616", "0.59319067", "0.5918944", "0.5910044", "0.58045495", "0.57698244", "0.57698244", "0.57698244", "0.57698244", "0.57698244", "0.57698244", "0.57698244", "0.57698244", "0....
0.6568904
0
Return the configurationID attribute.
def read_configurationID(self): # PROTECTED REGION ID(CspSubElementSubarray.configurationID_read) ENABLED START # return self.component_manager.config_id # PROTECTED REGION END # // CspSubElementSubarray.configurationID_read
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"config_id\")", "def config_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"config_id\")", "def access_configuration_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"access_configuration_id\")", "...
[ "0.82370573", "0.7737147", "0.77217585", "0.76358694", "0.76358694", "0.7568858", "0.7535651", "0.7334281", "0.72816044", "0.7275274", "0.7192606", "0.7192606", "0.7192606", "0.7192606", "0.70532554", "0.69606674", "0.69488955", "0.69488955", "0.69281024", "0.68077296", "0.68...
0.7454224
7
Return the outputDataRateToSdp attribute.
def read_outputDataRateToSdp(self): # PROTECTED REGION ID(CspSubElementSubarray.outputDataRateToSdp_read) ENABLED START # return self._sdp_output_data_rate # PROTECTED REGION END # // CspSubElementSubarray.outputDataRateToSdp_read
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDataRate(self):\n \n return self.DataRate", "def data_rate(self):\n return self._data_rate", "def get_samp_rate(self):\n return _uhd_swig.usrp_sink_get_samp_rate(self)", "def get_samp_rate(self):\n return _uhd_swig.usrp_sink_sptr_get_samp_rate(self)", "def get_samp_rat...
[ "0.6707482", "0.6489517", "0.6398907", "0.6321757", "0.61910206", "0.6110366", "0.6103157", "0.5940593", "0.5923892", "0.5896416", "0.5879235", "0.5805911", "0.57724947", "0.5763296", "0.57288975", "0.572569", "0.57214093", "0.571555", "0.5711583", "0.5692358", "0.56816053", ...
0.84580344
0
Return the configureScanMeasuredDuration attribute.
def read_configureScanMeasuredDuration(self): # PROTECTED REGION ID(CspSubElementSubarray.configureScanMeasuredDuration_read) ENABLED START # return self._cmd_measured_duration["configurescan"] # PROTECTED REGION END # // CspSubElementSubarray.configureScanMeasuredDuration_read
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_duration(self):\n return self.config.get('record_duration', 5)", "def Duration(self):\r\n\t\treturn self._get_attribute('duration')", "def Duration(self):\n\t\treturn self._get_attribute('duration')", "def duration(self):\n return self._get(\"duration\")", "def duration(self):\n ...
[ "0.7202693", "0.70240694", "0.70075905", "0.68735164", "0.6856001", "0.67686915", "0.6694812", "0.6684578", "0.6641244", "0.66278255", "0.6613843", "0.65864927", "0.65847886", "0.6583338", "0.6583338", "0.6583338", "0.6583338", "0.6583338", "0.6583338", "0.6583338", "0.658333...
0.8384339
0
Return the assignResourcesMaximumDuration attribute.
def read_assignResourcesMaximumDuration(self): # PROTECTED REGION ID(CspSubElementSubarray.assignResourcesMaximumDuration_read) ENABLED START # return self._cmd_maximum_duration["assignresources"] # PROTECTED REGION END # // CspSubElementSubarray.assignResourcesMaximumDuration_read
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_releaseResourcesMaximumDuration(self):\n # PROTECTED REGION ID(CspSubElementSubarray.releaseResourcesMaximumDuration_read) ENABLED START #\n return self._cmd_maximum_duration[\"releaseresources\"]\n # PROTECTED REGION END # // CspSubElementSubarray.releaseResourcesMaximumDuration_...
[ "0.78109205", "0.72739524", "0.7138984", "0.6935195", "0.6896527", "0.67632854", "0.6711347", "0.6554828", "0.6544752", "0.65009564", "0.64280707", "0.63779575", "0.6362045", "0.63423127", "0.63414633", "0.63414633", "0.62800616", "0.62800616", "0.62800616", "0.62800616", "0....
0.8670386
0
Set the assignResourcesMaximumDuration attribute.
def write_assignResourcesMaximumDuration(self, value): # PROTECTED REGION ID(CspSubElementSubarray.assignResourcesMaximumDuration_write) ENABLED START # self._cmd_maximum_duration["assignresources"] = value # PROTECTED REGION END # // CspSubElementSubarray.assignResourcesMaximumDuration_writ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_assignResourcesMaximumDuration(self):\n # PROTECTED REGION ID(CspSubElementSubarray.assignResourcesMaximumDuration_read) ENABLED START #\n return self._cmd_maximum_duration[\"assignresources\"]\n # PROTECTED REGION END # // CspSubElementSubarray.assignResourcesMaximumDuration_read...
[ "0.75009114", "0.7108825", "0.6145865", "0.61266935", "0.6116267", "0.60174865", "0.57958454", "0.57427925", "0.566168", "0.5619999", "0.5619999", "0.5618733", "0.5592099", "0.55780536", "0.55541605", "0.55413616", "0.55209076", "0.55188483", "0.55049014", "0.5501352", "0.549...
0.80570424
0
Return the assignResourcesMeasuredDuration attribute.
def read_assignResourcesMeasuredDuration(self): # PROTECTED REGION ID(CspSubElementSubarray.assignResourcesMeasuredDuration_read) ENABLED START # return self._cmd_measured_duration["assignresources"] # PROTECTED REGION END # // CspSubElementSubarray.assignResourcesMeasuredDuration_read
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_releaseResourcesMeasuredDuration(self):\n # PROTECTED REGION ID(CspSubElementSubarray.releaseResourcesMeasuredDuration_read) ENABLED START #\n return self._cmd_measured_duration[\"releaseresources\"]\n # PROTECTED REGION END # // CspSubElementSubarray.releaseResourcesMeasuredDurat...
[ "0.7476577", "0.6948954", "0.6907984", "0.6897158", "0.675196", "0.66170627", "0.6498312", "0.64068395", "0.6399724", "0.6399567", "0.6365093", "0.6300124", "0.6272323", "0.62619096", "0.62527406", "0.62527406", "0.62527406", "0.62527406", "0.62527406", "0.62527406", "0.62527...
0.86240077
0
Return the releaseResourcesMaximumDuration attribute.
def read_releaseResourcesMaximumDuration(self): # PROTECTED REGION ID(CspSubElementSubarray.releaseResourcesMaximumDuration_read) ENABLED START # return self._cmd_maximum_duration["releaseresources"] # PROTECTED REGION END # // CspSubElementSubarray.releaseResourcesMaximumDuration_read
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_assignResourcesMaximumDuration(self):\n # PROTECTED REGION ID(CspSubElementSubarray.assignResourcesMaximumDuration_read) ENABLED START #\n return self._cmd_maximum_duration[\"assignresources\"]\n # PROTECTED REGION END # // CspSubElementSubarray.assignResourcesMaximumDuration_read...
[ "0.7682274", "0.73281056", "0.725378", "0.7169169", "0.701878", "0.6726816", "0.6675424", "0.6605734", "0.66047144", "0.65419525", "0.63711715", "0.63539124", "0.63503057", "0.6339228", "0.63348955", "0.63322926", "0.63050246", "0.62923634", "0.6281969", "0.6272967", "0.62523...
0.8497974
0
Set the releaseResourcesMaximumDuration attribute.
def write_releaseResourcesMaximumDuration(self, value): # PROTECTED REGION ID(CspSubElementSubarray.releaseResourcesMaximumDuration_write) ENABLED START # self._cmd_maximum_duration["releaseresources"] = value # PROTECTED REGION END # // CspSubElementSubarray.releaseResourcesMaximumDuration_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_assignResourcesMaximumDuration(self, value):\n # PROTECTED REGION ID(CspSubElementSubarray.assignResourcesMaximumDuration_write) ENABLED START #\n self._cmd_maximum_duration[\"assignresources\"] = value\n # PROTECTED REGION END # // CspSubElementSubarray.assignResourcesMaximumDur...
[ "0.75299424", "0.6939129", "0.6757534", "0.612519", "0.6047337", "0.60134304", "0.59227794", "0.58768404", "0.58768404", "0.5868205", "0.58474535", "0.5841381", "0.584001", "0.5809971", "0.5737153", "0.57150954", "0.57150954", "0.57150954", "0.5703288", "0.5703288", "0.56474"...
0.8002245
0
Return the releaseResourcesMeasuredDuration attribute.
def read_releaseResourcesMeasuredDuration(self): # PROTECTED REGION ID(CspSubElementSubarray.releaseResourcesMeasuredDuration_read) ENABLED START # return self._cmd_measured_duration["releaseresources"] # PROTECTED REGION END # // CspSubElementSubarray.releaseResourcesMeasuredDuration_read
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_assignResourcesMeasuredDuration(self):\n # PROTECTED REGION ID(CspSubElementSubarray.assignResourcesMeasuredDuration_read) ENABLED START #\n return self._cmd_measured_duration[\"assignresources\"]\n # PROTECTED REGION END # // CspSubElementSubarray.assignResourcesMeasuredDuration_...
[ "0.7594611", "0.7134477", "0.7123656", "0.6845334", "0.6835566", "0.6818994", "0.6794545", "0.67108697", "0.66936487", "0.6689381", "0.6623013", "0.66056925", "0.66056925", "0.66056925", "0.66056925", "0.66056925", "0.66056925", "0.66056925", "0.66056925", "0.6603101", "0.659...
0.83992296
0
If question doesn't exist then returns a 404 not found.
def test_no_question(self): set_up_user(self) self.assertFalse(self.user.is_superuser) url = reverse('polls:detail', args=(1,)) response = self.client.get(url) self.assertEqual(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_existent_question(self):\n\n res = self.app.get('/api/v1/questions/'+str(56))\n self.assertEqual(res.status_code, 404)", "def page_not_found(_):\n return ANSWER_PAGE_NOT_FOUND, 404", "def not_found():\n return HttpError(404)", "def test_getting_one_question_with_invalid_quest...
[ "0.79275346", "0.7313007", "0.7061561", "0.70375925", "0.7035321", "0.6886876", "0.6670767", "0.6621834", "0.65660423", "0.655537", "0.65444857", "0.6534985", "0.65286964", "0.65286964", "0.65286964", "0.65286964", "0.65286964", "0.65286964", "0.65286964", "0.651732", "0.6517...
0.6367173
33
The detail view of a question with a pub_date in the future returns a 404 not found.
def test_future_question(self): set_up_user(self) self.assertFalse(self.user.is_superuser) future_question = create_question(question_text='Future question.', days=5) url = reverse('polls:detail', args=(future_question.id,)) response = self.client.get(url) self.assertEqu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detail_view_with_a_future_question(self):\n future_question = create_question(question_text='Future question.',\n days=5)\n response = self.client.get(reverse('polls:detail',\n args=(future_question.id,)))\n se...
[ "0.7497403", "0.74237365", "0.74019724", "0.73198754", "0.6882057", "0.68441385", "0.6839886", "0.67736185", "0.6773186", "0.6660648", "0.66365445", "0.6574521", "0.65514135", "0.6519076", "0.64934474", "0.64890075", "0.6472224", "0.6458119", "0.64206684", "0.640955", "0.6402...
0.633631
24
The detail view of a question with a pub_date in the past displays the question's text.
def test_past_question(self): set_up_user(self) self.assertFalse(self.user.is_superuser) past_question = create_question(question_text='Past Question.', days=-5) url = reverse('polls:detail', args=(past_question.id,)) response = self.client.get(url) self.assertContains(r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detail_view_with_a_past_question(self):\n past_question = create_question(question_text='Past Question.',\n days=-5)\n response = self.client.get(reverse('polls:detail',\n args=(past_question.id,)))\n self.assert...
[ "0.691903", "0.6845292", "0.67884105", "0.6770274", "0.6731518", "0.64019763", "0.6229556", "0.6197519", "0.617866", "0.6127842", "0.6079946", "0.6074095", "0.6053201", "0.6010866", "0.59842235", "0.5944553", "0.59162587", "0.5892784", "0.58596855", "0.58578676", "0.5836897",...
0.5791905
22
The detail view of a question without Choices returns a 404 not found.
def test_question_without_choices(self): set_up_user(self) self.assertFalse(self.user.is_superuser) question_no_choices = create_question_without_choices(question_text="Question wihout Choices.", days=-1) url = reverse('polls:detail', args=(question_no_choices.id,)) response = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detail(request, question_id):\n question = get_object_or_404(Question, pk=question_id)\n return render(request, 'problemfinder/details.html', {'question': question})", "def test_detail_view_with_a_future_question(self):\n future_question = create_question(question_text='Future question.',\n ...
[ "0.71154344", "0.70191014", "0.6883976", "0.6875943", "0.68702626", "0.6863", "0.6714542", "0.65973854", "0.6511097", "0.65051717", "0.6497616", "0.6369757", "0.63285625", "0.6231346", "0.6128514", "0.6120124", "0.6074971", "0.6070548", "0.6070548", "0.6070548", "0.60498476",...
0.6200416
14
For admins, if question doesn't exist then returns a 404 not found.
def test_no_question_for_admin(self): set_up_super_user(self) self.assertTrue(self.user.is_superuser) url = reverse('polls:detail', args=(1,)) response = self.client.get(url) self.assertEqual(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_existent_question(self):\n\n res = self.app.get('/api/v1/questions/'+str(56))\n self.assertEqual(res.status_code, 404)", "def test_getting_one_question_with_invalid_questionId(self):\n response = self.get_one_question_with_invalid_questionId()\n self.assertEqual(response....
[ "0.711784", "0.6504001", "0.64876986", "0.64723796", "0.6407077", "0.6331296", "0.6318913", "0.6249131", "0.62066907", "0.6195382", "0.6114018", "0.6107865", "0.6055043", "0.60343975", "0.6030388", "0.6012463", "0.59605753", "0.595454", "0.5865508", "0.58496404", "0.5849237",...
0.68937933
1
For admins, the detail view of a question with a pub_date in the future returns a the question's text.
def test_future_question_for_admin(self): set_up_super_user(self) self.assertTrue(self.user.is_superuser) future_question = create_question(question_text='Future question.', days=5) url = reverse('polls:detail', args=(future_question.id,)) response = self.client.get(url) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return \"question_text: \" + self.question_text \\\n + \"\\npub_date:\" + self.pub_date.__str__()", "def test_detail_view_with_a_past_question(self):\n past_question = create_question(question_text='Past Question.',\n days=...
[ "0.6683269", "0.6405031", "0.63917655", "0.63736093", "0.6339363", "0.6066158", "0.59450716", "0.5847778", "0.58125436", "0.5796782", "0.57940537", "0.5760645", "0.5739646", "0.5713765", "0.5704408", "0.5694761", "0.56631625", "0.5650233", "0.56304246", "0.5626378", "0.560301...
0.6245921
5
For admins, the detail view of a question with a pub_date in the past displays the question's text.
def test_past_question_for_admin(self): set_up_super_user(self) self.assertTrue(self.user.is_superuser) past_question = create_question(question_text='Past Question.', days=-5) url = reverse('polls:detail', args=(past_question.id,)) response = self.client.get(url) self.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detail_view_with_a_past_question(self):\n past_question = create_question(question_text='Past Question.',\n days=-5)\n response = self.client.get(reverse('polls:detail',\n args=(past_question.id,)))\n self.assert...
[ "0.6654251", "0.6551169", "0.6546888", "0.64981866", "0.6403105", "0.60974413", "0.5978801", "0.59736556", "0.594772", "0.59222794", "0.5906418", "0.5845687", "0.580533", "0.5777674", "0.56844366", "0.56818074", "0.5666687", "0.56340367", "0.562149", "0.5601977", "0.5598254",...
0.63057643
5
For admins, the detailview of a question without Choices returns a 404 not found.
def test_question_without_choices_for_admin(self): set_up_super_user(self) self.assertTrue(self.user.is_superuser) question_no_choices = create_question_without_choices(question_text="Question wihout Choices.", days=-1) url = reverse('polls:detail', args=(question_no_choices.id,)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_question_for_admin(self):\n set_up_super_user(self)\n self.assertTrue(self.user.is_superuser)\n\n url = reverse('polls:detail', args=(1,))\n response = self.client.get(url)\n self.assertEqual(response.status_code, 404)", "def test_no_question(self):\n set_up_...
[ "0.7173288", "0.6686307", "0.62881786", "0.6212242", "0.6194035", "0.6141864", "0.61249363", "0.60965824", "0.6087543", "0.60861367", "0.5962173", "0.5895455", "0.58402735", "0.58342826", "0.58056766", "0.5738396", "0.57204473", "0.5702456", "0.5698904", "0.56868136", "0.5654...
0.62408864
3
Filter to remove undesirable tokens from the list.
def filter_tokens(x): if x in _STOP_WORDS: return False if not re.search(r'\w', x): # Does not contain at least one word character return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean_ignored(self, tokens):\n return list(filter(lambda t : t.token_value not in self._ignored, tokens))", "def filter_tokens(self, tokens):\n # TODO get hyphenated words\n filtered = [w.lower() for w in tokens\n if len(w) > self.MIN_WORD_LENGTH\n ...
[ "0.7641354", "0.725415", "0.69645905", "0.69185525", "0.6581219", "0.64749396", "0.641715", "0.6382379", "0.6284491", "0.62648135", "0.6214528", "0.6208088", "0.61867833", "0.61248773", "0.6118234", "0.606565", "0.6049697", "0.60487807", "0.60462594", "0.60399985", "0.603011"...
0.55683523
65
Onehotencode a sequence of nucleotide bases into an n x 4 matrix.
def embed_nucleotide_seq(seq): encoded_seq = encode_sequence(seq) ohe_mat = np.zeros([len(seq), 4]) for i in range(len(seq)): ohe_mat[i, encoded_seq[i]] = 1.0 return ohe_mat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode_dna(dna_str, pad=None, base_order='ATCG'):\n dna_str = dna_str.upper()\n if pad is not None:\n M = pad\n else:\n M = len(dna_str)\n dna_arr = np.zeros((M, 4))\n for i in range(len(dna_str)):\n idx = base_order.index(dna_str[i])\n dna_arr[i, idx] = 1\n ...
[ "0.7288033", "0.72256637", "0.72085834", "0.7127483", "0.71206766", "0.7023484", "0.6970436", "0.69018143", "0.6899087", "0.6722315", "0.6715902", "0.67091674", "0.6704166", "0.66994077", "0.66926754", "0.66704047", "0.66678244", "0.6641903", "0.66199684", "0.65666616", "0.65...
0.0
-1
Given a binary vector, pad all instances of 1's with pad_len 1's on either side to create blocks of >= 2pad_len + 1 consecutive 1's.
def pad_binary_signal(x, pad_len=10): n = len(x) one_idx = np.arange(n)[x == 1] if len(one_idx) == 0: return x y = np.zeros(n) for idx in one_idx: start = max(idx - pad_len, 0) end = min(idx + pad_len + 1, n) y[start:end] = 1.0 return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_sequence(seq):\n seq_split = seq.strip().split(\"1\")\n last = seq_split[0]\n new_seq = last + \"1\"\n inc_added = 0\n out_added = 0\n for i in range(1, len(seq_split)-1):\n current = seq_split[i]\n\n # break up the intial sequences that leak information by adding padding\n ...
[ "0.6521439", "0.6397242", "0.63849115", "0.61514133", "0.6150783", "0.611182", "0.6102601", "0.6099215", "0.6020623", "0.600172", "0.5980226", "0.59765154", "0.5955084", "0.5941587", "0.5880511", "0.58745563", "0.58662134", "0.5857701", "0.5832661", "0.5802941", "0.57985437",...
0.78287786
0