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
Gets a phoney estimate for where the ball is depending on how far away the camera is. Returns sigma value and "measured" x,y values
def get_cam_estimate(ball_coords, cam_coords): alpha = .009 sigma = alpha * get_dist_between_2_points(ball_coords, cam_coords) x = ball_coords[0] + random.gauss(0, pow(sigma,2)) y = ball_coords[1] + random.gauss(0, pow(sigma,2)) return ((int(x), int(y)) , sigma)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigma(self):\n sigma = (\n self.radius * (cos(self.phi) - tan(self.phi) +\n tan(self.phi) * sin(self.phi)) -\n (self.stem * 2 + self.counter) * tan(self.theta) -\n self.offset) / (\n tan(self.theta) + tan(self.phi)\n )\n ...
[ "0.6618923", "0.640155", "0.61670625", "0.6017737", "0.5927646", "0.5892045", "0.58912706", "0.5884315", "0.58785874", "0.5878298", "0.58732414", "0.58582634", "0.5806936", "0.57134265", "0.5668439", "0.566091", "0.56392145", "0.5634887", "0.5629071", "0.56239283", "0.5622342...
0.6715024
0
Test equality of Vector objects using ==.
def __eq__(self,other): if self.x == other.x and self.y == other.y: return True else: return False pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testEquals(self):\n v1 = Vector(3, 4, 5)\n assert (v1 == [3, 4, 5])\n assert (v1 != [0, 2, 4])\n v2 = Vector(3.0, 4.0, 5.000)\n assert (v1 == v2)\n v3 = Vector(2, 2)\n assert v1 != v3", "def test_equal_same_reference():\n v = Vector(1.0)\n assert_true(v ...
[ "0.8612081", "0.792736", "0.77274966", "0.7585594", "0.74970955", "0.73969024", "0.7267504", "0.7043716", "0.69991934", "0.6961278", "0.6922446", "0.6902637", "0.6855736", "0.6812294", "0.68013966", "0.676672", "0.67645746", "0.6763552", "0.676131", "0.67404974", "0.67281514"...
0.0
-1
Test inequality of Vector objects using !=.
def __ne__(self,other): if self.x != other.x or self.y != other.y: return True else: return False pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_equal_same_reference():\n v = Vector(1.0)\n assert_false(v != v)", "def __ne__(self, other):\n\n if hasattr(other, 'vector'):\n return self.vector != other.vector", "def test_not_equal_with_different_type():\n assert_true(Vector(1.0) != 1.0)", "def __ne__(self, other):...
[ "0.7880954", "0.7799107", "0.76292604", "0.74168414", "0.73921937", "0.7261085", "0.7185971", "0.71613115", "0.7157501", "0.70587796", "0.70471185", "0.7038246", "0.7033083", "0.7022327", "0.7017849", "0.7017849", "0.70115477", "0.701039", "0.7008637", "0.7008637", "0.6998338...
0.0
-1
Set the y coordinate.
def setY(self, y): self.y = y pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetY(self, y):\r\n\r\n self._y = y", "def setY(self, y):\r\n\t\tself._y=y", "def set_y(self, y):\n self._y = y", "def set_y(self, y: float):\n self.y = y", "def set_y(self, new_y):\r\n self.y = new_y", "def setY(self, y):\n self.position.setY(y)", "def set_y(self,...
[ "0.9181362", "0.91690856", "0.9140436", "0.90641046", "0.8829516", "0.87577116", "0.859139", "0.85458827", "0.8503331", "0.8409407", "0.82484925", "0.82484925", "0.8077606", "0.8071067", "0.7984842", "0.7916473", "0.7916473", "0.7891215", "0.778843", "0.77801764", "0.77801764...
0.9229576
0
Return the x coordinate.
def X(self): return self.x pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_x(self):\n return self.position.x", "def Getxcoord(self):\n return self.x_coord", "def get_x(self):\n return self.coords[0]", "def get_x(self):\n return self.posX", "def get_pos_x(self):\n return self.__pos_x", "def getXCoordinate(self) -> float:\n retur...
[ "0.88956344", "0.8833777", "0.87446713", "0.8737901", "0.8594194", "0.85831034", "0.85763574", "0.84261113", "0.8422042", "0.84183", "0.8406681", "0.8369304", "0.8319206", "0.81523407", "0.8152325", "0.8080385", "0.8046004", "0.796965", "0.796656", "0.7961459", "0.7898218", ...
0.7121196
77
Return the y coordinate.
def Y(self): return self.y pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getY(self):\r\n\t\treturn self._y", "def get_y(self):\n return self.coords[1]", "def y(self):\n return self._coords[1]", "def getY(self):\n return self.y", "def getY(self):\n return self.y", "def y(self):\n return self.coords[1]", "def getY(self):\n return ...
[ "0.8921974", "0.8918842", "0.8902261", "0.89012975", "0.89012975", "0.8888897", "0.88610786", "0.88403666", "0.88019323", "0.87821954", "0.8767364", "0.87561464", "0.8670742", "0.8641636", "0.86284786", "0.8611483", "0.8588099", "0.85459596", "0.8455855", "0.84424585", "0.838...
0.8020218
57
bsr(value, bits) > value shifted right by bits This function is here because an expression in the original java source contained the token '>>>' and/or '>>>=' (bit shift right and/or bit shift right assign). In place of these, the python source code below contains calls to this function. Copyright 2003 Jeffrey Clement....
def bsr(value, bits): minint = -2147483648 if bits == 0: return value elif bits == 31: if value & minint: return 1 else: return 0 elif bits < 0 or bits > 31: raise ValueError('bad shift count') tmp = (value & 0x7FFFFFFE) // 2**bits if (valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_right(n, b):\n return (n >> b), n & ((1 << b) - 1)", "def test_bit_rshift_wrap(self):\n ops = [bitwise_operations.bit_rshift(self.test_bin_ones, 0, 40, 8, None)]\n\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins = self.as_connection.get(self.test_key)\n ex...
[ "0.6727143", "0.63353753", "0.6116032", "0.60228914", "0.60037893", "0.58917755", "0.58855736", "0.58855736", "0.5825467", "0.5758853", "0.5747889", "0.57335716", "0.5706857", "0.5706288", "0.56348604", "0.56140065", "0.560792", "0.5594745", "0.5571785", "0.5519326", "0.54975...
0.6529127
1
Parses package requirements from a Pipfile. Reformats them to match a pipstyle specifier, e.g. `"bs4" = ""` > `bs4`, and `termcolor = ">=1.23"` > `termcolor>=1.23`.
def read_pipfile() -> List[str]: pfile = configparser.ConfigParser() pfile.read('Pipfile') req_specifiers = [] for package, version in pfile['packages'].items(): # normalize strings, since Pipenv likes to add quotes on some things package = package.strip('\'"') version = version....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_requirements_from_pipfile():\n lineiter = (line.strip() for line in open('Pipfile'))\n requirements_pipfile_style = [line for line in lineiter]\n start_index = requirements_pipfile_style.index('[packages]') + 1\n end_index = requirements_pipfile_style.index('[requires]') - 1\n requirements...
[ "0.8167471", "0.6551887", "0.6245379", "0.6139017", "0.60707974", "0.605438", "0.6013819", "0.59752125", "0.59320724", "0.59152067", "0.58938396", "0.58594483", "0.58483577", "0.5810328", "0.5797439", "0.5796998", "0.57895494", "0.5787564", "0.57842386", "0.57662433", "0.5760...
0.6988868
1
Returns the area covered of the B2ACGeometricShape object.
def get_area(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n return self._ned_shape.area", "def area(self):\n return _property_op(arctern.ST_Area, self)", "def area(self):\n\n return (self.x1 - self.x0) * (self.y1 - self.y0)", "def area(self):\n\n bbox = self.bbox\n area = Box.calculate_bbox_area(bbox, bbox_type=sel...
[ "0.74955636", "0.7267737", "0.725804", "0.7219449", "0.7175316", "0.7156573", "0.7126457", "0.71073914", "0.7074115", "0.7063876", "0.70558393", "0.69951653", "0.6976647", "0.6944922", "0.6944922", "0.6944922", "0.69310975", "0.6922866", "0.6922866", "0.6921528", "0.6898708",...
0.6833943
34
Create and save a user with the given username, email, and password.
def _create_user(self, telephone,username, password, email=None, **kwargs): if not username: raise ValueError('请输入用户名') if not telephone: raise ValueError('请输入手机号') if not password: raise ValueError('请输入密码') email = self.normalize_email(email) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se...
[ "0.85970664", "0.8441464", "0.84257156", "0.84243035", "0.8407115", "0.8394773", "0.83891046", "0.83420897", "0.833554", "0.8334237", "0.83234787", "0.8288202", "0.82821107", "0.827526", "0.82698834", "0.82689965", "0.81651425", "0.8160252", "0.8157993", "0.814361", "0.813802...
0.0
-1
Return ylim for subplots.
def ylim(self): lim = [ax.get_ylim() for ax in self._subaxes] if lim == []: lim = None return lim
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ylim(self, bottom=None, top=None):\r\n for ax in self._subaxes:\r\n ax.set_ylim(bottom, top)\r\n self.figure.canvas.draw()", "def getYLimit(self):\n return self.axes.get_ylim()", "def ylim(bottom=None, top=None):\n impl.ylim(**locals())", "def get_ylim(self):\n i...
[ "0.7489316", "0.7369543", "0.72438246", "0.7230113", "0.68752676", "0.6603705", "0.6602591", "0.646319", "0.646319", "0.630308", "0.62957925", "0.62222004", "0.6215365", "0.61390114", "0.6116315", "0.60919374", "0.59923524", "0.5969142", "0.5903077", "0.58006877", "0.57827604...
0.8258679
0
Set yaxis limits on all subplots.
def ylim(self, bottom=None, top=None): for ax in self._subaxes: ax.set_ylim(bottom, top) self.figure.canvas.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_ylimits(self, ylim1, ylim2):\n self.axplot.set_ylim(ylim1, ylim2)\n self.fig.canvas.draw()\n return", "def ylim(self):\r\n lim = [ax.get_ylim() for ax in self._subaxes]\r\n if lim == []:\r\n lim = None\r\n return lim", "def __draw_yaxis(self):\n ...
[ "0.73684484", "0.7333269", "0.69522804", "0.68085486", "0.6744841", "0.6667006", "0.6617799", "0.65600276", "0.65293473", "0.64102334", "0.63932246", "0.6358978", "0.6258972", "0.62417555", "0.62233126", "0.62193394", "0.6133096", "0.6071315", "0.6061821", "0.604985", "0.6033...
0.7838847
0
Set yaxis limits on all subplots.
def yscale(self, value='linear'): for ax in self._subaxes: ax.set_yscale(value) self.figure.canvas.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ylim(self, bottom=None, top=None):\r\n for ax in self._subaxes:\r\n ax.set_ylim(bottom, top)\r\n self.figure.canvas.draw()", "def adjust_ylimits(self, ylim1, ylim2):\n self.axplot.set_ylim(ylim1, ylim2)\n self.fig.canvas.draw()\n return", "def ylim(self):\r\n ...
[ "0.78384966", "0.73671263", "0.7332558", "0.6951256", "0.68071556", "0.6744199", "0.66174483", "0.65582895", "0.6528403", "0.6411199", "0.6391981", "0.63584363", "0.62587047", "0.62414575", "0.62232125", "0.62199306", "0.61336964", "0.60706055", "0.6061948", "0.60508823", "0....
0.6666844
6
Return an estimate for a good ylim.
def auto_ylim(self, xlim=None, yscale='linear'): electrodes = [col for col in self.data.columns if col in ELECTRODES] if xlim is None: data = self.data.ix[:, electrodes] else: indices = ((self.data.index >= xlim[0]) & (s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getYLimit(self):\n return self.axes.get_ylim()", "def get_max_y(self) -> float:\n return self.pendulum2.get_max_y()", "def ylim(bottom=None, top=None):\n impl.ylim(**locals())", "def Get_CalOutY_Value(self):\r\n y = self.Get_RawOutY_Value()\r\n if(y >= self.minY and y <= se...
[ "0.71889484", "0.69473946", "0.69405967", "0.6662677", "0.6645133", "0.661116", "0.6545868", "0.6504186", "0.6350625", "0.6324434", "0.6268813", "0.62479395", "0.62359744", "0.6233223", "0.6167279", "0.61351603", "0.6117863", "0.6092668", "0.60735565", "0.60675955", "0.606419...
0.6107777
17
Ensure we can register a new user.
def test_create_user(self): url = reverse('rest_register') data = { 'email': 'skywalker@tatuin.net', 'password1': 'notshortpassword', 'password2': 'notshortpassword' } response = self.client.post(url, data, format='json') self.assertEqual(respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_user():\n pass", "def test_user_can_register(self):\n response = self.client.post(\n CONSTS.USER_REGISTER_URL,\n data=self.user_data,\n format='json'\n )\n self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n self.assertEqu...
[ "0.77832836", "0.72131884", "0.7201365", "0.71680045", "0.7090347", "0.7086237", "0.7035889", "0.7030339", "0.70163465", "0.699818", "0.69789135", "0.6951632", "0.6941562", "0.6935559", "0.6904172", "0.6900261", "0.6883108", "0.68597436", "0.6845817", "0.68406063", "0.6840606...
0.0
-1
Build string map of TFLite enum int value
def build_str_map(obj): ret = {} for field_name in dir(obj): if not field_name.startswith('_'): field_value = getattr(obj, field_name) if isinstance(field_value, int): ret[field_value] = field_name return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping_for_enum(mapping):\n return dict(mapping.keys())", "def br_enum_to_string(season):\n new_season = []\n for game in season:\n game_dict = dict()\n keys = game.keys()\n for key in keys:\n if type(game[key]) not in [str, int, float, datetime]:\n ga...
[ "0.6255643", "0.6154301", "0.60852444", "0.60017073", "0.5889652", "0.573905", "0.57121927", "0.56576395", "0.56381434", "0.56319654", "0.5614502", "0.56097114", "0.56061685", "0.55298376", "0.55173206", "0.54821765", "0.5457455", "0.54309845", "0.5390245", "0.5390238", "0.53...
0.5410821
18
Middleware to update the request based on ``XForwardedFor``.
async def dispatch( self, request: Request, call_next: Callable[[Request], Awaitable[Response]], ) -> Response: forwarded_for = list(reversed(self._get_forwarded_for(request))) if not forwarded_for: request.state.forwarded_host = None request.state.for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_middleware_sets_ip_from_forwarded_for(self):\n request = MockRequest('127.0.0.1', '83.42.13.77')\n RealIPMiddleware().process_request(request)\n\n self.assertEqual(request.user_ip,\n request.META['HTTP_X_FORWARDED_FOR'])", "def __call__(self, request):\n ...
[ "0.675305", "0.66720927", "0.6583769", "0.6583769", "0.6420732", "0.6274157", "0.6264378", "0.59661293", "0.59490556", "0.5821934", "0.5791119", "0.5673667", "0.5595943", "0.5490375", "0.54052126", "0.53991795", "0.5365721", "0.53519285", "0.53155214", "0.5290878", "0.5279590...
0.56105334
12
Retrieve the ``XForwardedFor`` entries from the request.
def _get_forwarded_for(self, request: Request) -> List[_BaseAddress]: forwarded_for_str = request.headers.getlist("X-Forwarded-For") if not forwarded_for_str or len(forwarded_for_str) > 1: return [] return [ ip_address(addr) for addr in (a.strip() for a in for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_xforwarded_for(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"insert_xforwarded_for\")", "def insert_xforwarded_for(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"insert_xforwarded_for\")", "def xforwarded_for_configs(self) -> Sequence['outputs.Get...
[ "0.6563655", "0.6563655", "0.65356636", "0.65014786", "0.6401519", "0.6311759", "0.6203623", "0.6159837", "0.6134342", "0.6125144", "0.6081709", "0.6006999", "0.597707", "0.59251946", "0.59090203", "0.58562756", "0.5829888", "0.5798456", "0.57940364", "0.5744231", "0.5712205"...
0.7719834
0
Retrieve the ``XForwardedProto`` entries from the request.
def _get_forwarded_proto(self, request: Request) -> List[str]: forwarded_proto_str = request.headers.getlist("X-Forwarded-Proto") if not forwarded_proto_str or len(forwarded_proto_str) > 1: return [] return [p.strip() for p in forwarded_proto_str[0].split(",")]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_forwarded_for(self, request: Request) -> List[_BaseAddress]:\n forwarded_for_str = request.headers.getlist(\"X-Forwarded-For\")\n if not forwarded_for_str or len(forwarded_for_str) > 1:\n return []\n return [\n ip_address(addr)\n for addr in (a.strip()...
[ "0.62977594", "0.6140308", "0.5966076", "0.58254284", "0.57169694", "0.5580521", "0.5472985", "0.5388928", "0.5374064", "0.5326867", "0.53200114", "0.51863295", "0.51466054", "0.51466054", "0.51214767", "0.5115323", "0.50630355", "0.50563455", "0.5002089", "0.5002089", "0.500...
0.8077176
0
Returns a downsampling layer followed by batch normalization (added by default) and Leaky ReLU activation function.
def downsample(filters, size, shape, apply_batchnorm=True): initializer = tf.random_normal_initializer(0., 0.02) result = tf.keras.Sequential() result.add( tf.keras.layers.Conv2D(filters, size, strides=2, padding='same', batch_input_shape=shape, kernel_initializer=initia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_downsample_layer(self, num_filter, stride):\n if stride != 1:\n downsample = tf.keras.Sequential()\n downsample.add(tf.keras.layers.Conv2D(filters=num_filter,\n kernel_size=(1, 1),\n ...
[ "0.6279705", "0.6109562", "0.6091242", "0.6091242", "0.6086898", "0.60805357", "0.60805357", "0.60708433", "0.6020613", "0.59831345", "0.5980429", "0.5975923", "0.5909551", "0.59092027", "0.5848446", "0.5841554", "0.5836774", "0.5834692", "0.58196366", "0.5803863", "0.5786710...
0.0
-1
Returns an upsampling layer followed by dropout (not added by default) and ReLU activation function.
def upsample(filters, size, shape, apply_dropout=False): initializer = tf.random_normal_initializer(0., 0.02) result = tf.keras.Sequential() result.add( tf.keras.layers.Conv2DTranspose(filters, size, strides=2, batch_input_shape=shape, padding='same', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_upsample_layer(self, in_channels=None, out_channels=None):\n if self.expand_strategy == \"upsample\":\n return nn.Upsample(scale_factor=2, mode=\"nearest\")\n elif self.expand_strategy == \"transpose_convolution\":\n return nn.ConvTranspose2d(\n in_channe...
[ "0.6654453", "0.6204926", "0.60987043", "0.604992", "0.5971261", "0.59267914", "0.58945936", "0.5885581", "0.58823377", "0.58696634", "0.58610624", "0.5857071", "0.5857071", "0.5845825", "0.58266497", "0.5809922", "0.57693434", "0.5751995", "0.57433254", "0.5734281", "0.57202...
0.52884024
76
Initialize a Blockwise Layer.
def __init__(self, parent): self._parent = parent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n base.Layer.__init__(self, **kwargs)\n self._num_output = self.spec.get('num_output', 0)\n if self._num_output <= 0:\n raise base.InvalidLayerError(\n 'Incorrect or unspecified num_output for %s' % self.name)\n self._reg = self.sp...
[ "0.6943045", "0.6763722", "0.67341447", "0.67208093", "0.67208093", "0.6680869", "0.6632589", "0.6540465", "0.6417641", "0.63440853", "0.63365215", "0.630949", "0.6272001", "0.62701", "0.62333906", "0.6207854", "0.6198415", "0.61582106", "0.6101392", "0.60637945", "0.60568553...
0.0
-1
Test if data researcher has access to the api endpoint
def test_data_researcher_access(self): self.client.login(username=self.data_researcher.username, password='test') self.verify_response(params={ 'all_blocks': True, 'course_id': str(self.course_key) })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_anything_else_is_accessible(api_client):\n\n assert api_client().get(\"/anything/else\").status_code == 200", "def is_authorized(self, request, obj=None):\r\n if request.method == 'GET':\r\n return True\r\n else:\r\n return False", "def test_api() -> bool:\r\n ...
[ "0.7084129", "0.6828772", "0.67048895", "0.6682416", "0.65986454", "0.6583272", "0.6566188", "0.6559836", "0.6559836", "0.6559836", "0.6559836", "0.65401864", "0.6470316", "0.6454227", "0.6444007", "0.6438723", "0.6426884", "0.6426884", "0.6404503", "0.63879246", "0.6377078",...
0.6005887
72
Instantiate a new Message object. No arguments are required, as everything can be set using class properties. Alternatively, I{everything} can be set using the constructor, using named arguments. The first three positional arguments can be used to quickly prepare a simple message.
def __init__(self, author=None, to=None, subject=None, **kw): super(Message, self).__init__(to=to, kw=kw) kwpop = lambda *args, **kwargs: self.kwpop(kw, *args, **kwargs) pop_deprecated = lambda name, old_name: self.pop_deprecated(kw, name, old_name) self.merge_if_set(kw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Message(self, *args, **kwargs):\n return Message(self, *args, **kwargs)", "def createMessage( self, *args, **kw ):\n return MailMessage( *args, **kw )", "def message(self, *args, **kwargs) -> Message:\n return Message(self.handle, *args, **kwargs)", "def testConstructorKwargs(self):\...
[ "0.79181224", "0.7506687", "0.7501556", "0.72638214", "0.7239061", "0.7082516", "0.7057003", "0.7057003", "0.70092994", "0.69854885", "0.69854885", "0.69854885", "0.69854885", "0.69854885", "0.69854885", "0.69854885", "0.69854885", "0.69854885", "0.69854885", "0.6984823", "0....
0.6671153
35
Returns the address of the envelope sender address (SMTP from, if not set the sender, if this one isn't set too, the author).
def envelope_sender(self): envelope_sender = None # TODO: Make this check better as soon as SMTP from and sender are # Addresses, not AddressLists anymore. if self.smtp_from != None and len(self.smtp_from) > 0: envelope_sender = self.smtp_from elif self.sender != Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender(self):\n key, alt = ('Sender', 'From') if not self.resent else \\\n ('Resent-Sender', 'Resent-From')\n value = self.get(key) or self.get(alt)\n _, addr = getaddresses([value])[0]\n return addr", "def notification_sender_email(self) -> Optional[pulumi.Input...
[ "0.73631096", "0.673388", "0.673388", "0.6719646", "0.6604917", "0.65062785", "0.6501518", "0.64463794", "0.63030577", "0.6285404", "0.62435293", "0.62144536", "0.61882967", "0.6136689", "0.6113695", "0.6112187", "0.6074151", "0.60113996", "0.5998374", "0.59926707", "0.598624...
0.8513534
0
Gets the date_value (may be None, basestring, float or datetime.datetime instance) and returns a valid date string as per RFC 2822.
def _build_date_header_string(self, date_value): if isinstance(date_value, datetime): date_value = time.mktime(date_value.timetuple()) if not isinstance(date_value, basestring): date_value = formatdate(date_value, localtime=True) return date_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date(value):\n if value in (None, ''):\n return ''\n\n if isinstance(value, str):\n value = dt_parse(value)\n\n arg = \"DATE_FORMAT\"\n try:\n return formats.date_format(value, arg)\n except AttributeError:\n raise\n try:\n return format(value, arg)\...
[ "0.70567673", "0.70380926", "0.70267284", "0.6526661", "0.6518911", "0.649481", "0.64906317", "0.64153856", "0.63990474", "0.63893837", "0.6384454", "0.63175297", "0.6307034", "0.626651", "0.6226232", "0.6178133", "0.6153579", "0.6147893", "0.6147872", "0.61286217", "0.604675...
0.67371196
3
Update the parameters of the network iteratively according to the cached gradients at each module.
def update_params(self, optim, lr): for module in self.modules: if isinstance(module, Layer): module._update_params(optim, lr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateParams(self,gradients):\n for i in xrange(len(self.params)):\n self.params[i].set_value(self.params[i].get_value()-gradients[i]/(1/self.learning_rate+self.iterations))", "def update_params(layers, param_grads, learning_rate):\n for layer, layer_backprop_grads in zip(layers, param_g...
[ "0.7417903", "0.73203826", "0.73120254", "0.7263402", "0.7262234", "0.70927393", "0.70112956", "0.7006354", "0.70061654", "0.69170314", "0.6873835", "0.68576235", "0.68220806", "0.68038905", "0.680022", "0.678554", "0.67793226", "0.6720413", "0.67188734", "0.66997236", "0.667...
0.68270534
12
Function to add item in first index or simply enqueue. Time complexity is O(n) or linear. If item is added in first index all next items should be shifted by one. Time depends upon list length.
def enqueue(self, item): self.items.insert(0, item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enqueue(self, item):\n # double size of array if necessary and recopy to front of array\n if self._N == len(self._q):\n self._resize(2*len(self._q)) # double size of array if necessary\n self._q[self._last] = item # add item\n self._last += 1\n if self._last == len(se...
[ "0.74483913", "0.70006317", "0.6990834", "0.6894542", "0.68773454", "0.6772151", "0.6758758", "0.67582047", "0.67368424", "0.67056865", "0.6677778", "0.65756977", "0.6568506", "0.6563939", "0.65510756", "0.6523978", "0.65169275", "0.64741033", "0.64361084", "0.6421537", "0.63...
0.6832605
6
Check if queue is empty or not. O(1).
def is_empty(self): if self.items: return 'not empty!' return 'empty!'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_queue(queue):\n return queue.front is None", "def is_empty(self):\n return self.queue == []", "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is...
[ "0.8787647", "0.87245506", "0.8693414", "0.8678968", "0.8678968", "0.8641385", "0.86165476", "0.8453675", "0.84076923", "0.83749175", "0.8371444", "0.8370429", "0.83545595", "0.8346489", "0.8306624", "0.8303416", "0.8244715", "0.8161971", "0.81167287", "0.81167287", "0.808342...
0.0
-1
Clean and tokenize text before feature creation. Returns list of tokens. Also return meta dict with information about preprocessing (e.g. tokens removed, length of original text, etc...)
def preprocess_text(text: str) -> Tuple[List[str], Dict]: raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self,text):\n return preprocess.get_tokens(text)", "def preprocessing(raw_text):\n words_list = tokenize(raw_text)\n words_list = remove_stop_words(words_list)\n words_list = remove_punctuations(words_list)\n words_list = lemmatization(words_list)\n return words_list", "def...
[ "0.7782326", "0.7432993", "0.7185439", "0.7161674", "0.70712733", "0.70612115", "0.7059516", "0.6990138", "0.69349235", "0.68593967", "0.6826011", "0.6825105", "0.677563", "0.67510617", "0.67510617", "0.6740675", "0.6740514", "0.67400056", "0.67363375", "0.67220014", "0.67145...
0.0
-1
JavaScript API Gets the value of the element.
def value(self) -> str: logging.info(f"get element value. {self.desc}") js = f"""return document.querySelectorAll("{self.css}")[{self.index}].value;""" return self._execute_javascript(js)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self):\n return self.element.get_attribute('value')", "def value(self):\n return self.element.get_attribute('value')", "def value(self):\n return self.element.get_attribute('value')", "def getValue(self):\n return self.text()", "def value(self):\n\n return self....
[ "0.79421747", "0.79421747", "0.79421747", "0.7688982", "0.7683594", "0.76467896", "0.7542422", "0.74224544", "0.73688155", "0.73539263", "0.7319645", "0.73004097", "0.73004097", "0.7279916", "0.7279916", "0.7272643", "0.72527665", "0.72480005", "0.72480005", "0.72480005", "0....
0.8207017
0
Gets XML representation of pipeline.
def pipeline_by_id(self, pipeline_id): response = self._session.get( path=self._session.urljoin( self.PIPELINES_RESOURCE_PATH, 'THIS_PARAMETER_IS_USELESS', # WTF?!! '{}.xml'.format(pipeline_id) ).format( base_api=self.base_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xml(self):\n return etree.tostring(self.get_etree())", "def _to_xml(self):\n lineage = etree.Element('lineage')\n procstep_list = self.proc_step.get_widgets()\n for procstep in procstep_list:\n lineage.append(procstep._to_xml())\n\n return lineage", "def ge...
[ "0.67997104", "0.6680785", "0.6533029", "0.64369345", "0.64369345", "0.63111204", "0.6080494", "0.6068516", "0.60453856", "0.60120046", "0.6008949", "0.5916967", "0.5916967", "0.58802867", "0.5861499", "0.5861258", "0.5802897", "0.57117105", "0.5703831", "0.56823856", "0.5664...
0.54386365
43
Gets XML representation of job.
def job_by_id(self, job_id): response = self._session.get( path='{base_api}/jobs/{job_id}.xml'.format( base_api=self.base_api, job_id=job_id ), headers={'Accept': 'application/xml'}, ) return response.text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n\n return ('<Job id={id} title={title} ' +\n 'complete={complete}').format(id=self.id,\n title=self.title,\n complete=self.complete,\n )"...
[ "0.6667868", "0.6432676", "0.6270865", "0.62107545", "0.62107545", "0.62107545", "0.6169856", "0.6111412", "0.6111412", "0.60111433", "0.5883167", "0.58683676", "0.58451736", "0.5801905", "0.5784461", "0.5719519", "0.5678421", "0.5626802", "0.5623943", "0.56128615", "0.557562...
0.61371833
7
Adds a unidirectional edge between two nodes
def add_unidirectional_edges(self, from_node_id, to_node_id, distance): n1, n2 = self.__create_node(from_node_id.lower(), to_node_id.lower()) # add neighbour if n2 in n1.getNeighbors(): print("Node "+n1.getId()+" is already neighbour with node "+n2.getId()) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, node1: Node, node2: Node):\n self.__add_edge(node1, node2)\n self.__add_edge(node2, node1)", "def add_bidirectional_edges( self, node1, node2, distance):\n n1, n2 = self.__create_node(node1.lower(), node2.lower())\n\n #Set neighbour between edges\n #Check if ...
[ "0.7877241", "0.7854274", "0.77367765", "0.76684695", "0.7529696", "0.75112146", "0.7496341", "0.7331441", "0.72781384", "0.7270602", "0.7185263", "0.71112907", "0.70888346", "0.7075159", "0.7073675", "0.70590246", "0.70406", "0.702738", "0.7016966", "0.7010654", "0.7007758",...
0.75606674
4
Adds a bidirectional edge between two nodes.
def add_bidirectional_edges( self, node1, node2, distance): n1, n2 = self.__create_node(node1.lower(), node2.lower()) #Set neighbour between edges #Check if 2 edges oredi a neihbor exist if n1 in n2.getNeighbors() and n2 in n1.getNeighbors(): print(n1.getId()+" and "+n2.getI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, node1, node2, weight=1.0, bidirectional=True):\n self.add_node(node1)\n self.add_node(node2)\n node1_edges = self._edges.get(node1, set())\n node1_edges.add(Edge(node1, node2, weight))\n self._edges[node1] = node1_edges\n if bidirectional:\n n...
[ "0.807166", "0.7867932", "0.7548216", "0.7475844", "0.7446775", "0.73784786", "0.7216577", "0.72158986", "0.7172897", "0.7147783", "0.713027", "0.7118485", "0.7089157", "0.70850754", "0.708479", "0.70805526", "0.705801", "0.7012476", "0.70082843", "0.69312173", "0.6927729", ...
0.8224717
0
Return a printable representation of the instance
def __unicode__(self): return u"(%s, %s)" % (self.subject_object1, self.subject_object2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return self.pretty_print(self.__dict__)", "def __str__(self):\n return repr(self)", "def __str__(self):\r\n return repr(self)", "def __str__(self):\n return self.printable()", "def __repr__(self):\n str(self)", "def __repr__(self):\n return ...
[ "0.8495958", "0.8476356", "0.8424882", "0.8340136", "0.83321846", "0.83279485", "0.83279485", "0.83279485", "0.83279485", "0.83279485", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231...
0.0
-1
Return a printable representation of the instance
def __unicode__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return self.pretty_print(self.__dict__)", "def __str__(self):\n return repr(self)", "def __str__(self):\r\n return repr(self)", "def __str__(self):\n return self.printable()", "def __repr__(self):\n str(self)", "def __repr__(self):\n return ...
[ "0.8495958", "0.8476356", "0.8424882", "0.8340136", "0.83321846", "0.83279485", "0.83279485", "0.83279485", "0.83279485", "0.83279485", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231", "0.8307231...
0.0
-1
Return a random state vector.
def rand(self): return np.random.rand(self.nx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand(self):\n self.state = (self.a * self.state + self.c)\n return self.state", "def newRandomState(x):\n\treturn x + random.uniform(-1, 1)", "def rand(self):\n return self.State.rand()", "def sample(self):\n x = self.state\n dx = self.theta * (self.mu - x) + self.sigma...
[ "0.7524336", "0.74356496", "0.7350448", "0.71346265", "0.7088853", "0.70498127", "0.70498127", "0.70498127", "0.70498127", "0.70498127", "0.7049213", "0.70253193", "0.7011552", "0.6988178", "0.69594854", "0.6952417", "0.69167227", "0.68957216", "0.68730795", "0.6869696", "0.6...
0.0
-1
Calculates log(xm) since mlog(x) will fail when m, x = 0.
def logpow(x, m): # return m * log(x) return pt.switch(pt.eq(x, 0), pt.switch(pt.eq(m, 0), 0.0, -np.inf), m * pt.log(x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logpow(x, m):\n # return m * log(x)\n return tt.switch(tt.eq(x, 0), -np.inf, m * tt.log(x))", "def log(self, x, base=2):\n if x == 0:\n return 0\n return math.log(x, base)", "def logm(self, x):\n\n if K.backend() == 'theano':\n # construct theano tensor oper...
[ "0.7899951", "0.7795391", "0.76946455", "0.7612447", "0.7505014", "0.7336194", "0.7333879", "0.7310866", "0.7243556", "0.7222918", "0.7169865", "0.71242654", "0.70531833", "0.70466876", "0.7011839", "0.6999271", "0.69981575", "0.696667", "0.69562936", "0.6946504", "0.6923862"...
0.7836792
1
Compute the log of the cumulative density function of the normal.
def normal_lcdf(mu, sigma, x): z = (x - mu) / sigma return pt.switch( pt.lt(z, -1.0), pt.log(pt.erfcx(-z / pt.sqrt(2.0)) / 2.0) - pt.sqr(z) / 2.0, pt.log1p(-pt.erfc(z / pt.sqrt(2.0)) / 2.0), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_normal_density(self, x, mean, log_std, std):\n\n variance = std.pow(2)\n log_density = -(x - mean).pow(2) / (2 * variance) - 0.5 * \\\n np.log(2 * np.pi) - log_std # num_env * frames * act_size\n log_density = log_density.sum(dim=-1, keepdim=True) # num_env * fra...
[ "0.7585078", "0.745283", "0.71648806", "0.7141148", "0.6961688", "0.69444036", "0.6902911", "0.6829274", "0.67485774", "0.6707029", "0.6698992", "0.66931343", "0.66388977", "0.6631797", "0.6630156", "0.6587571", "0.65821505", "0.65734684", "0.65679127", "0.6551097", "0.653109...
0.6139997
53
`sigma > rho` PyTensor converter
def sigma2rho(sigma): return pt.log(pt.exp(pt.abs(sigma)) - 1.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rho2sigma(rho):\n return pt.softplus(rho)", "def get_rho(sigma, delta):\n rho = torch.log(torch.expm1(delta * torch.abs(sigma)) + 1e-20)\n return rho", "def true_lrv_ar1_t_free(sigma: float):\n return (16 / 3) * (sigma ** 2)", "def _sigma(self, vect: Tensorlike):\n return 40 * vect ** ...
[ "0.73670995", "0.63704383", "0.60589725", "0.6001439", "0.59583", "0.59261966", "0.58771884", "0.58398604", "0.5734747", "0.5641124", "0.5631689", "0.5630676", "0.55984324", "0.55658203", "0.5552406", "0.55432546", "0.5453638", "0.5444881", "0.5444834", "0.5392413", "0.538885...
0.71857923
1
Calculate logarithm of normal distribution at point `x` with given `mean` and `std`
def log_normal(x, mean, **kwargs): sigma = kwargs.get("sigma") w = kwargs.get("w") rho = kwargs.get("rho") tau = kwargs.get("tau") eps = kwargs.get("eps", 0.0) check = sum(map(lambda a: a is not None, [sigma, w, rho, tau])) if check > 1: raise ValueError("more than one required kwarg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_normal_density(x, mean, log_std, std):\n\n variance = std.pow(2)\n log_density = -(x - mean).pow(2) / (2 * variance) - 0.5 *\\\n np.log(2 * np.pi) - log_std # num_env * frames * act_size\n log_density = log_density.sum(dim=-1, keepdim=True) # num_env * frames * 1\n return log_density"...
[ "0.8412", "0.83154887", "0.7637254", "0.75145966", "0.75034773", "0.74974626", "0.7448646", "0.7326321", "0.73188204", "0.72831464", "0.72667444", "0.7254195", "0.72240704", "0.722136", "0.71711576", "0.7153218", "0.70985377", "0.70972383", "0.708976", "0.7073875", "0.7050919...
0.80690265
2
Compute the log pdf of a multivariate normal distribution. This should be used in MvNormal.logp once Theano5908 is released.
def MvNormalLogp(): cov = pt.matrix("cov") cov.tag.test_value = floatX(np.eye(3)) delta = pt.matrix("delta") delta.tag.test_value = floatX(np.zeros((2, 3))) cholesky = Cholesky(lower=True, on_error="nan") n, k = delta.shape n, k = f(n), f(k) chol_cov = cholesky(cov) diag = pt.diag(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_norm_pdf(x, sigma):\n _, det_sigma = np.linalg.slogdet(sigma)\n return -0.5*np.dot(x.T, np.linalg.solve(sigma,x))[0,0] - np.log(2*np.pi) - det_sigma", "def log_marginal_likelihood_normal_pdf(self):\n noise_variance=self.params['noise_variance']['value']\n Kxx = self.C@self._Kernel(self.X,...
[ "0.742578", "0.7389992", "0.73548317", "0.7235045", "0.7188996", "0.7168316", "0.7008302", "0.6978238", "0.69598025", "0.68743074", "0.6837587", "0.6808868", "0.6791415", "0.6735486", "0.6681692", "0.66723955", "0.66648537", "0.6568828", "0.65660447", "0.6557901", "0.65457934...
0.7155108
6
Calculate the zvalue for a normal distribution.
def zvalue(value, sigma, mu): return (value - mu) / sigma
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_z_value(self, mean, sigma):\n\n if sigma == 0:\n # assign a small value for sigma if sigma = 0\n sigma = 1e-10\n warnings.warn('Standard deviation sigma should not be zero.')\n\n z_value = (mean - 2/3) / sigma\n\n return z_value", "def _get_z_score(s...
[ "0.7491566", "0.70923024", "0.7019166", "0.69114155", "0.68043256", "0.66379136", "0.6616555", "0.65794903", "0.65502775", "0.654799", "0.6504766", "0.6487515", "0.6473132", "0.64295214", "0.6402317", "0.63732934", "0.6353064", "0.6323485", "0.63001394", "0.628597", "0.628339...
0.78231
0
Convert CFNumber to python int or float.
def cfnumber_to_number(cfnumber): numeric_type = cf.CFNumberGetType(cfnumber) cfnum_to_ctype = {kCFNumberSInt8Type: c_int8, kCFNumberSInt16Type: c_int16, kCFNumberSInt32Type: c_int32, kCFNumberSInt64Type: c_int64, kCFNumberFloat32Type: c_float, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __float__(self) -> float:\n return self._translate_in_type(float, self.integer)", "def _ensure_number(value):\n assert isinstance(value, (bytes, float, int)), \"value has to be either bytes or float or int\"\n\n return int.from_bytes(value, byteorder=\"big\") if type(value) is bytes else...
[ "0.72130436", "0.72013414", "0.7003101", "0.68837637", "0.6852873", "0.67765343", "0.6735275", "0.6717703", "0.67040956", "0.6670298", "0.6632944", "0.66119903", "0.6606204", "0.6545747", "0.65346634", "0.6526652", "0.65067565", "0.6472898", "0.64569527", "0.64520144", "0.644...
0.7700084
0
Calculates the flux emitted at a specific angular point on the surface of an asteroid of size unity as a function of angular position, wavelength and the subsolar temperature. Returns flux in units of W m^3.
def calcFluxLambdaEmitted(self, theta, lambd, T_ss): return np.pi * calcPlanckLambda(lambd, self.calcT(theta, T_ss))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux(self, u):\n flu = np.zeros((3,2), dtype=np.float64)\n flu[0,0] = u[1]\n flu[1,0] = u[0] * (u[1]/u[0])**2 + 0.5 * 9.81*u[0]**2\n flu[2,0] = u[1] * u[2]/u[0] #FIXME attenzione che c'è il punto controllare se sono scalari o vettori'\n flu[0,1] = u[2]\n flu[1,1] = u[2...
[ "0.6546757", "0.6537908", "0.63220876", "0.6319376", "0.62712675", "0.6100086", "0.6066297", "0.60131335", "0.6001171", "0.59758466", "0.5934375", "0.5930147", "0.5918097", "0.588807", "0.5883347", "0.58602524", "0.58464915", "0.5766951", "0.5730851", "0.57255244", "0.5709214...
0.0
-1
Calculates the total flux emitted at the surface of an asteroid of size unity as a function of wavelength and the subsolar temperature. Returns flux in units of W m^3.
def calcTotalFluxLambdaEmitted(self, lambd, T_ss): return 4 / np.pi * integrate.quad(lambda theta, lambd, T_ss: (self.calcFluxLambdaEmitted(theta, lambd, T_ss) * self.surfaceElement(theta, 0) * np.cos(theta)), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux():\n delta = 0.01 # film thickness, [dm]\n c = pre * 10 ** 2 / (R * tem) # total concentration calculated by ideal gas equation, in [mol/L]\n D12 = 0.001626528 / pre # HCl diffusion in Air, [dm2/s] @296K\n D13 = 3e-7 # HCl gas diffusion in water, [dm2/s] @296K\n D23 = 1.5e-7 # CH4 gas...
[ "0.6753365", "0.64198846", "0.63170314", "0.6203782", "0.6197138", "0.6197138", "0.6126119", "0.6088301", "0.6029273", "0.5994214", "0.59668005", "0.5923236", "0.5906112", "0.5893819", "0.5856654", "0.5848698", "0.5836894", "0.58317304", "0.58164734", "0.5759984", "0.5759783"...
0.5407726
50
Calculates the flux emitted at a specific angular point on the surface of an asteroid of size unity towards an observer at phase angle alpha as a function of angular position, wavelength, subsolar temperature and phase angle. Returns flux in units of W m^3.
def calcFluxLambdaEmittedToObs(self, theta, lambd, T_ss, alpha): return np.pi * calcPlanckLambda(lambd, self.calcT(theta, T_ss))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux():\n delta = 0.01 # film thickness, [dm]\n c = pre * 10 ** 2 / (R * tem) # total concentration calculated by ideal gas equation, in [mol/L]\n D12 = 0.001626528 / pre # HCl diffusion in Air, [dm2/s] @296K\n D13 = 3e-7 # HCl gas diffusion in water, [dm2/s] @296K\n D23 = 1.5e-7 # CH4 gas...
[ "0.6078515", "0.5991688", "0.5820977", "0.57897455", "0.57188916", "0.5688279", "0.56839955", "0.5655894", "0.5647079", "0.56425726", "0.5635855", "0.56054276", "0.5583467", "0.55507326", "0.5523584", "0.54691243", "0.5441563", "0.5438842", "0.54289895", "0.5421126", "0.54194...
0.5339822
30
Calculates the total flux emitted at the surface of an asteroid of size unity towards an observer at phase angle alpha as a function of wavelength, subsolar temperature and phase angle. Returns flux in units of W m^3.
def calcTotalFluxLambdaEmittedToObs(self, lambd, T_ss, alpha): return 4 / np.pi * integrate.quad(lambda theta, lambd, T_ss, alpha: (self.calcFluxLambdaEmittedToObs(theta, lambd, T_ss, alpha) * self.surfaceElement(theta, 0) * np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flux():\n delta = 0.01 # film thickness, [dm]\n c = pre * 10 ** 2 / (R * tem) # total concentration calculated by ideal gas equation, in [mol/L]\n D12 = 0.001626528 / pre # HCl diffusion in Air, [dm2/s] @296K\n D13 = 3e-7 # HCl gas diffusion in water, [dm2/s] @296K\n D23 = 1.5e-7 # CH4 gas...
[ "0.63276166", "0.606548", "0.606548", "0.59364086", "0.58968854", "0.57791424", "0.56985176", "0.5680027", "0.56768924", "0.56197", "0.56148046", "0.5529453", "0.5528889", "0.55133283", "0.5503263", "0.54907244", "0.54876053", "0.54581684", "0.54388595", "0.5420971", "0.53890...
0.59229356
4
Compute the average overlap (AO) between two ranked lists of items. Items must be in rank order, starting at 1. [k] is the depth to go down to when computing the AO the maximum is the max of the lengths of the two lists, the min is 1. Proposed simultaneously by Fagin et al. [2003] and Wu and Crestani [2003], it is call...
def average_overlap(items1, items2, k = None): if k is None: k = max([len(items1), len(items2)]) assert k > 0 and k <= max([len(items1), len(items2)]), 'k is out of bounds!' agreements = [] for i in range(1, k + 1): items1_set, items2_set = set(items1[:i]), set(items2[:i]) agreem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_overlap(items1, items2, k = None):\n if k is None:\n k = max([len(items1), len(items2)])\n assert k > 0 and k <= max([len(items1), len(items2)]), 'k is out of bounds!'\n items1_set, items2_set = set(items1[:k]), set(items2[:k])\n return len(items1_set & items2_set) / len(items1_set |...
[ "0.6009777", "0.5717285", "0.5669322", "0.5544337", "0.55036193", "0.5423611", "0.54216987", "0.54212207", "0.54145044", "0.53885394", "0.53756535", "0.53626096", "0.533351", "0.53298587", "0.5288357", "0.5254569", "0.5220982", "0.52142304", "0.5198458", "0.5190491", "0.51862...
0.6905113
0
Create representation of self suitable for printing as yaml. parameter 'what' is a list of identifiers to represent. If 'what' is None (the default) create representation of everything.
def repr_for_yaml(self, what=None, resolve=False): retVal = list() all_iids = self.items_table.get_all_iids() all_vars = sorted(config_vars.keys()) if what is None: # None is all what = all_vars + all_iids defines = OrderedDict() indexes = OrderedDict() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n _dict = self._def.default.copy()\n _dict.update(self.__dict__)\n #return '%s(%r)' % (self.__class__, _dict)\n # If the yaml is too slow revert to the line above\n name = '%s <%s>' % (self.__class__.__name__, id(self))\n return yaml.dump({name: _dict}, ...
[ "0.55833966", "0.54550093", "0.5276736", "0.521372", "0.5172942", "0.5002559", "0.49622858", "0.49501857", "0.49458674", "0.4936505", "0.49297386", "0.49042726", "0.48794362", "0.48764622", "0.48618567", "0.48100471", "0.48056018", "0.47983828", "0.47775626", "0.47549424", "0...
0.5679472
0
Get begin and end indexes set from a timerange.
def get_correct_goes_index(goes_index, begin, end): difference = timedelta(seconds=1) begin = get_datetime(begin) end = get_datetime(end) found_begin = False found_end = False for index in goes_index: new_index = get_datetime(str(index)[0:19]) if ((new_index == begin or new_ind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timerange(self):\n return self._collection.range()", "def get_span(self)->set:\n return set(range(self.get_start_offset(), self.get_end_offset()))", "def range(self):\n return (self._start, self._end)", "def get_range(self, start=None, end=None):\n\n # handle the case of no da...
[ "0.6778114", "0.66460246", "0.6616168", "0.66057116", "0.6550103", "0.64347667", "0.64192355", "0.63775736", "0.63125205", "0.6302205", "0.62386745", "0.610608", "0.60608566", "0.6057528", "0.6007778", "0.5998904", "0.5998137", "0.59968376", "0.5981551", "0.59734863", "0.5949...
0.54904884
81
Singleton pattern for peewee database instance. Constructs a SqliteDatabase if it does not exist prior. Returns the SqliteDatabase once constructed.
def get(cls) -> SqliteDatabase: if cls.database_instance is None: cls.database_instance = SqliteDatabase( config.DATABASE_PATH, pragmas={"journal_mode": "wal"}, ) return cls.database_instance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_db():\n\tpath = get_path_db()\n\tif path is None:\n\t\tprint(\"\\n=> Info - Cannot fetch database yet because it has not been configured.\\n\")\n\telse:\n\t\tdb = SqliteExtDatabase(path)\n\t\treturn db", "def get_db():\n top = _app_ctx_stack.top\n if not hasattr(top, 'sqlite_db'):\n top.sqli...
[ "0.73620254", "0.7175222", "0.7175222", "0.7175222", "0.7141785", "0.71191883", "0.7109138", "0.7087931", "0.70850736", "0.7071741", "0.7071741", "0.7071741", "0.7071741", "0.7071741", "0.7071741", "0.7071741", "0.7071741", "0.7071741", "0.7071741", "0.7071741", "0.7071741", ...
0.8196329
0
Serializes the child of this BaseModel to JSON.
def to_json(self) -> str: return json.dumps(model_to_dict(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n return json.dumps(self.as_dict())", "def serialize(self) -> str:\n return json.dumps(self.__dict__)", "def _toJSON(self):\n\n return json.encode(self.__toJSON())", "def serialize(self):\n raise NotImplementedError(\"Abstract class, implemented in sub class\"...
[ "0.667417", "0.66610754", "0.66419256", "0.64992315", "0.6489627", "0.64782655", "0.64669305", "0.6433289", "0.64069647", "0.64069647", "0.64069647", "0.64069647", "0.64069647", "0.64069647", "0.64069647", "0.64069647", "0.64069647", "0.6399876", "0.6399876", "0.6393897", "0....
0.6854023
0
Returns video duration (as timedelta) using OpenCV
def read_video_info_cv2(vid_fp: str): cap = cv2.VideoCapture(vid_fp) total_frames = cap.get(cv2.CAP_PROP_FRAME_COUNT) total_seconds = int(total_frames / cap.get(cv2.CAP_PROP_FPS)) cap.release() return timedelta(seconds=total_seconds) # cap.set(cv2.CAP_PROP_POS_AVI_RATIO, 1) # total_ms = cap....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duration():\r\n elapsed_time, duration = video_time()\r\n return duration", "def elapsed_time():\r\n elapsed_time, duration = video_time()\r\n return elapsed_time", "def video_duration(self):\n # type: () -> int\n return self._video_duration", "def get_duration(self):\n frame...
[ "0.8259263", "0.7512502", "0.7271129", "0.7127531", "0.6799536", "0.6612964", "0.6509056", "0.64787006", "0.6435783", "0.6413952", "0.6412262", "0.6336171", "0.63134027", "0.631048", "0.6238117", "0.62136626", "0.62011087", "0.6194046", "0.61937916", "0.61890733", "0.6168518"...
0.77084607
1
Calculates the mean and 95% confidence interval of the roaming distance per weekday.
def get_roaming_distance_mean_per_weekday(cab_data): try: roaming_distance_mean_per_weekday = ( cab_data .pipe(_select_columns, ['occupancy', 'time', 'cab_id', 'distance']) .pipe(_select_vacant) .pipe(_add_day) .pipe(_add_weekday) .pip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_roaming_distance_per_weekday_metrics(df):\n\n roaming_distance_per_weekday_metrics = (\n df\n .groupby('weekday')\n .agg(mean_distance=('day_roam_distance', 'mean'),\n std_distance=('day_roam_distance', 'std'))\n .assign(upper_95_distance=lambda x: x['mean_distan...
[ "0.6948139", "0.554181", "0.55189836", "0.55054134", "0.54950476", "0.5418375", "0.5390302", "0.5371563", "0.53683645", "0.53584164", "0.53312075", "0.5328421", "0.5328396", "0.53222406", "0.5318221", "0.53150386", "0.52963", "0.5291772", "0.5281941", "0.52799726", "0.5271637...
0.61115235
1
gets a list of tokenized texts and preprocesses each of the token lists
def prepocess_pos_tagged_texts(tweet_tokens): return [TextPreprocessor.additional_text_preprocessing_with_pos(json.loads(t)) for t in tweet_tokens]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocessing(raw_text):\n words_list = tokenize(raw_text)\n words_list = remove_stop_words(words_list)\n words_list = remove_punctuations(words_list)\n words_list = lemmatization(words_list)\n return words_list", "def tokenize(text, token):\n text = [token(x) for x in text]\n return tex...
[ "0.74095976", "0.7375498", "0.73507947", "0.73410153", "0.7318783", "0.73187006", "0.7307356", "0.72655404", "0.72542626", "0.7253257", "0.71934545", "0.71731776", "0.71676636", "0.71464986", "0.70897746", "0.70891565", "0.7086362", "0.70761913", "0.7044039", "0.702031", "0.7...
0.6566285
82
replaces constructs like '80 M ' with '80 million
def replace_million(text): for match in re.finditer(r'(£|\$)([0-9]+(\.|,))?[0-9]+(m|M) ', text): match_text = match.group(0) new_text = match_text.replace('m', ' million').replace('M', ' million') text = text.replace(match_text, new_text) for match in re.finditer(r'(£...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(string):\n units = {'s':1, 'm':60, 'h':60*60, 'd':24*60*60, 'M':30*24*60*60}\n string = string.replace(' ','')\n p = re.compile('(\\d+)\\s*(\\w+)')\n num, unit = p.match(string).groups()\n num = float(num)\n return num * units[unit]", "def format_large_numbers(text):\n\n text = re.sub(r\...
[ "0.6089818", "0.60644346", "0.5999596", "0.59422946", "0.5825716", "0.57636595", "0.5745309", "0.57207096", "0.56344724", "0.5610153", "0.5605744", "0.5543562", "0.553194", "0.55287933", "0.5495954", "0.5449485", "0.5444823", "0.54323506", "0.54193074", "0.5396418", "0.536349...
0.78205675
0
Adds the response from sending to `req` to this instance's cache.
def add_response(self, req, resp): if self._cache is None: return signature = sign(req.allocateQuotaRequest) with self._cache as c: now = self._timer() item = c.get(signature) if item is None: c[signature] = CachedItem( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addToCache(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')", "def cache_response(self, request, response, body=None):\r\n # From httplib2: Don't cache...
[ "0.6607025", "0.65451145", "0.65306133", "0.6466761", "0.63960433", "0.635653", "0.6326779", "0.6148613", "0.6111312", "0.6053187", "0.5909691", "0.58960056", "0.58675075", "0.58621925", "0.58597624", "0.58584046", "0.580072", "0.5647853", "0.56301427", "0.5598802", "0.557375...
0.7467969
0
Check the first name
def test_data_returns_values_in_source_record(): # Given sources = [] source = Source("I001", "Test", "Person", "Pub", "Abbr") sources.append(source) model = SourcesModel(sources) # When pointer = model.data(model.index(0, SourcesModelColumns.POINTER)) title = model.data(model.index(0,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_first_name(self) :\n\t\tformatted_name = get_formatted_name('janis','joplin')\n\t\tself.assertEqual(formatted_name,'Janis Joplin')", "def clean_first_name(self):\n\n if self.cleaned_data['first_name'] == 'Steve':\n raise ValidationError(\"Steve is a terrible name.\")\n\n return ...
[ "0.78721845", "0.78536946", "0.75807714", "0.75135154", "0.7482623", "0.74272287", "0.74116176", "0.74116176", "0.7410134", "0.72174627", "0.71941096", "0.7168601", "0.7168601", "0.7159287", "0.7147488", "0.713357", "0.713357", "0.70993817", "0.7075098", "0.70622", "0.7053104...
0.0
-1
Check the first name
def test_autocomplete_name_includes_relevant_data(): # Given sources = [] source = Source("I001", "Test", "Person", "Pub", "Abbr") sources.append(source) model = SourcesModel(sources) index = model.index(0, SourcesModelColumns.AUTOCOMPLETE) # When descriptive_name = model.data(index) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_first_name(self) :\n\t\tformatted_name = get_formatted_name('janis','joplin')\n\t\tself.assertEqual(formatted_name,'Janis Joplin')", "def clean_first_name(self):\n\n if self.cleaned_data['first_name'] == 'Steve':\n raise ValidationError(\"Steve is a terrible name.\")\n\n return ...
[ "0.78721845", "0.78536946", "0.75807714", "0.75135154", "0.7482623", "0.74272287", "0.74116176", "0.74116176", "0.7410134", "0.72174627", "0.71941096", "0.7168601", "0.7168601", "0.7159287", "0.7147488", "0.713357", "0.713357", "0.70993817", "0.7075098", "0.70622", "0.7053104...
0.0
-1
Check the first name
def test_autocomplete_name_no_comma_if_no_author(): # Given sources = [] source = Source("I001", "Test", "", "Pub", "Abbr") sources.append(source) model = SourcesModel(sources) index = model.index(0, SourcesModelColumns.AUTOCOMPLETE) # When descriptive_name = model.data(index) # T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_first_name(self) :\n\t\tformatted_name = get_formatted_name('janis','joplin')\n\t\tself.assertEqual(formatted_name,'Janis Joplin')", "def clean_first_name(self):\n\n if self.cleaned_data['first_name'] == 'Steve':\n raise ValidationError(\"Steve is a terrible name.\")\n\n return ...
[ "0.78721845", "0.78536946", "0.75807714", "0.75135154", "0.7482623", "0.74272287", "0.74116176", "0.74116176", "0.7410134", "0.72174627", "0.71941096", "0.7168601", "0.7168601", "0.7159287", "0.7147488", "0.713357", "0.713357", "0.70993817", "0.7075098", "0.70622", "0.7053104...
0.0
-1
Check the first name
def test_update_list_changes_data(qtbot): # Given model = SourcesModel() assert model.rowCount() == 0 sources = [] source = Source("I001", "Test", "Person", "Pub", "Abbr") sources.append(source) # When with qtbot.waitSignals([model.modelAboutToBeReset, model.modelReset]): model...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_first_name(self) :\n\t\tformatted_name = get_formatted_name('janis','joplin')\n\t\tself.assertEqual(formatted_name,'Janis Joplin')", "def clean_first_name(self):\n\n if self.cleaned_data['first_name'] == 'Steve':\n raise ValidationError(\"Steve is a terrible name.\")\n\n return ...
[ "0.78721845", "0.78536946", "0.75807714", "0.75135154", "0.7482623", "0.74272287", "0.74116176", "0.74116176", "0.7410134", "0.72174627", "0.71941096", "0.7168601", "0.7168601", "0.7159287", "0.7147488", "0.713357", "0.713357", "0.70993817", "0.7075098", "0.70622", "0.7053104...
0.0
-1
Initialize paths to test data.
def setUp(self): self.epath = 'flyeye/tests/fixtures' self.dpath = join(self.epath, 'disc.silhouette')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n\n self.test_data_path = 'testing/test_data/'", "def initialize_paths():\n\t_check_env()\n\t\n\tdata_dir = os.getenv(_DATA_DIRECTORY_ENV_KEY)\n\t_paths[_DATA_DIRECTORY_KEY] = data_dir\n\t_paths[_DATABASE_PATH_KEY] = os.path.join(data_dir, 'everything.db')\n\t_paths[_MEDIA_DIRECTORY_KEY] ...
[ "0.7805315", "0.77132314", "0.74002326", "0.71728826", "0.701336", "0.6997882", "0.69027567", "0.6863648", "0.68477726", "0.683999", "0.6838236", "0.6774866", "0.66698486", "0.6631192", "0.6627708", "0.6615241", "0.6588989", "0.6543264", "0.654031", "0.65385973", "0.6538481",...
0.66584104
13
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant.
def precision(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1))) precision = true_positives / (predicted_positives + K.epsilon()) return precision
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)", "def comp...
[ "0.74886096", "0.7288583", "0.71586555", "0.7152147", "0.70646256", "0.69859505", "0.6964119", "0.6953444", "0.69115317", "0.6834742", "0.68163294", "0.68082", "0.6803787", "0.6803787", "0.6803787", "0.6803787", "0.6803787", "0.6803787", "0.678442", "0.6753822", "0.6753822", ...
0.67563534
25
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected.
def recall(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + K.epsilon()) return recall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t...
[ "0.76048744", "0.74474627", "0.74044037", "0.7280602", "0.7209331", "0.7165615", "0.7157494", "0.71449864", "0.71449864", "0.71449864", "0.71449864", "0.71449864", "0.71449864", "0.71315587", "0.7100786", "0.7096806", "0.7096806", "0.7096806", "0.7096806", "0.7096806", "0.709...
0.70626116
41
Returns the target connector
def target_connector(self): catalog = plone.api.portal.get_tool('portal_catalog') if not self.context.target_connector: return None uid = self.context.target_connector brains = catalog(UID=uid) if not brains: return None return brains[0].getObject(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connector(self):\n if '_connector' not in self.__dict__:\n from meerschaum.connectors.parse import parse_instance_keys\n conn = parse_instance_keys(self.connector_keys)\n if conn:\n self._connector = conn\n else:\n return None\n ...
[ "0.72617215", "0.6874389", "0.6723173", "0.66188866", "0.63883203", "0.63334686", "0.63330626", "0.6332892", "0.6332446", "0.62914294", "0.6264262", "0.6256718", "0.6234147", "0.6224818", "0.6224818", "0.6224818", "0.6224818", "0.6209229", "0.6208931", "0.6204063", "0.6170707...
0.7769214
0
Checks if the handler given is a python logging handler
def _is_file_handler(settings): FILE_HANDLERS = [ "logging.FileHandler", "logging.handlers.WatchedFileHanlder", "logging.handlers.BaseRotatingHandler", "logging.handlers.RotatingFileHandler", "logging.handlers.TimedRotatingFileHandler", ] if settings["class"] in FILE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_log_handler(logger, handler):\n found = False\n if handler.name is None:\n logger.warning(\"Request to validate Handler with no name assigned to Logger may result in duplicate Handlers\")\n for h in logger.handlers:\n if h.name == handler.name:\n found = True\n b...
[ "0.7572654", "0.6650882", "0.64622563", "0.60899866", "0.59798044", "0.5954337", "0.5941885", "0.590424", "0.5841012", "0.57851744", "0.5773176", "0.57414395", "0.5668969", "0.5606005", "0.55735576", "0.5546503", "0.550019", "0.5471278", "0.5467758", "0.5464901", "0.5338712",...
0.701584
1
Gets the block of this ShardingDescriptor.
def block(self): return self._block
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetBlock(self):\n return self._block", "def getBlock(self):\n return self.block.getWorld().getWorld().getBlockAt(self.block.getChunkCoordinates().getX(), self.block.getChunkCoordinates().getY(), self.block.getChunkCoordinates().getZ())", "def _get_block(self, pos):\n return _get_mc().getBl...
[ "0.77434874", "0.7276125", "0.7069824", "0.70385814", "0.6906551", "0.6857931", "0.68110883", "0.67387944", "0.6673568", "0.6583339", "0.65679836", "0.6497697", "0.6437027", "0.6381966", "0.630643", "0.62157804", "0.6210359", "0.6180415", "0.6177731", "0.6161168", "0.6160969"...
0.67555547
7
Gets the shard of this ShardingDescriptor.
def shard(self): return self._shard
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shard(self):\n return self._shard or self._pubg.shard", "def shard(self):\n return self._shard or self._pubg.shard", "def shard(self, shard: str) -> str:\n return self.shards(shard)[shard]", "def get_marathon_shard(self) -> Optional[int]:\n return self.config_dict.get(\"marath...
[ "0.7583757", "0.7583757", "0.72581464", "0.6743312", "0.6335181", "0.62900907", "0.59414566", "0.59328645", "0.5925991", "0.5825259", "0.57900214", "0.56138045", "0.5563828", "0.5563828", "0.5479832", "0.54783493", "0.54718035", "0.5464915", "0.5430645", "0.5424801", "0.53827...
0.83095074
0
Sets the shard of this ShardingDescriptor.
def shard(self, shard): self._shard = shard
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_shard(self, shard_id):\n\n q = self._clone()\n q._shard_id = shard_id\n return q", "def shard(self):\n return self._shard", "def shard(self):\n return self._shard or self._pubg.shard", "def shard(self):\n return self._shard or self._pubg.shard", "def shard(...
[ "0.70981085", "0.57531655", "0.54469067", "0.54469067", "0.5302504", "0.5275912", "0.5187082", "0.5170718", "0.5137663", "0.50790477", "0.5045073", "0.50435185", "0.49664935", "0.49664935", "0.49608743", "0.49571973", "0.4890183", "0.48827276", "0.4856828", "0.4843455", "0.48...
0.81660736
1
Get a list of registered outcomes.
def get_registered_outcomes(self): return tuple(self._outcomes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_outcomes(self):\n return [r.outcome for r in self.values()]", "def outcomes(self):\n return self._outcomes", "def outcomes(self):\n return self._get_child_page_of_type(LearningOutcomesPage)", "def get_outcomes(num_die_sides):\n outcomes = []\n\n for value in range(1, num_di...
[ "0.7865927", "0.76783913", "0.6910861", "0.6452454", "0.6219828", "0.6124545", "0.6114586", "0.58568496", "0.58140385", "0.5783376", "0.5778654", "0.56923556", "0.5672136", "0.56580436", "0.5612964", "0.56127524", "0.55676734", "0.55633765", "0.55527395", "0.554113", "0.55142...
0.80368775
0
Write the setup.py of a target. Must be run after writing the contents to the chroot.
def write_setup(self, root_target, chroot): # NB: several explicit str conversions below force non-unicode strings in order to comply # with setuptools expectations. setup_keywords = root_target.provides.setup_py_keywords package_dir = {b'': self.SOURCE_ROOT} packages, namespace_packages, resourc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_setup(project_name, root_dir):\r\n setup_path = get_file_path(root_dir, None, \"setup.py\") #Get the path for setup.py\r\n setup_content = get_setup_text(project_name)\r\n \r\n setup_file = open(setup_path, 'w')\r\n setup_file.write(setup_content)\r\n setup_file.close()\r\n print_fil...
[ "0.78367716", "0.6960136", "0.61482453", "0.6049324", "0.5919469", "0.58234656", "0.57658184", "0.5753103", "0.574947", "0.5727261", "0.5724334", "0.5702915", "0.5696603", "0.56957155", "0.5665949", "0.56400406", "0.5608588", "0.55815005", "0.5569494", "0.5549162", "0.5541621...
0.7492044
1
Test creation with assessment or task does not exist or not loaded
def test_create_with_not_loaded_targets(self, benchmark_config): cfg_invalid_assess = copy.deepcopy(benchmark_config) cfg_invalid_assess["targets"][0]["assess"]["idontexist"] = {"repetitions": 2} with OrionState(benchmarks=cfg_invalid_assess) as cfg: with pytest.raises(NotImplement...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exist(self):\n with self.assertRaises(IncompetentQiitaDeveloperError):\n MetadataTemplate.exists(self.study)", "def test_create_run(self):\n pass", "def test_exists_false(self):\n self.assertFalse(PrepSample.exists('Not_a_Sample', self.prep_template))", "def test_exis...
[ "0.68006283", "0.6718425", "0.66599035", "0.66514003", "0.6556511", "0.6553005", "0.65479565", "0.6493211", "0.647975", "0.6459695", "0.64263165", "0.6425159", "0.6421069", "0.6397912", "0.63957447", "0.6389944", "0.63878745", "0.6386961", "0.6366882", "0.63254195", "0.630567...
0.6188104
36
The document referenced by the field should be referenced.
def test_to_json(self): result = json.loads(UserReferenceNoAutoSave.objects.to_json()) self.assertListEqual(result, self.data_ref_users)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field(self):\n return self.reference.field", "def field_ref(self) -> Optional[str]:\n return pulumi.get(self, \"field_ref\")", "def get_document(self):\n return self.document", "def _getForDocument (self):\n return self.__forDocument", "def get_reference(self):\t\t\n\t\tretu...
[ "0.6717498", "0.661168", "0.6353911", "0.632464", "0.62897855", "0.6269489", "0.6269489", "0.6269356", "0.6260735", "0.6209555", "0.61666733", "0.6162808", "0.6109474", "0.60762084", "0.6072807", "0.6065001", "0.6047796", "0.59556717", "0.5953771", "0.5918631", "0.5890014", ...
0.0
-1
Get units for this dimension
def get_units(self, obj: Dimension) -> [Unit]: try: return obj.units() except KeyError as e: logging.error(str(e)) return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def units(self):\n return self._units", "def units(self):\n return self._units", "def units(self):\n return self.__class__.get_setting_units(self.key, **self.get_kwargs())", "def unit_of_measurement(self):\n return self._units", "def units(self):\n pass", "def get_units...
[ "0.8416265", "0.8416265", "0.8102911", "0.8088423", "0.80496645", "0.79461956", "0.78997254", "0.78886104", "0.7874107", "0.78550273", "0.785411", "0.783738", "0.7825817", "0.7692756", "0.76852196", "0.76770425", "0.7666032", "0.7634778", "0.7598663", "0.75817645", "0.7569166...
0.766516
17
Computes a new learning rate (learn_rate) for the agent based on ``self.learn_rate_decay_mode``.
def updateLearnRate( self, phi, phi_prime, eligibility_trace, discount_factor, nnz, terminal ): if self.learn_rate_decay_mode == "dabney": # We only update learn_rate if this step is non-terminal; else phi_prime becomes # zero and the dot product below becomes very large, cr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_learning_rate(self) -> None:\n self.epsilon = self.initial_epsilon / (1. + self.rate_decay * self.n_it)\n return", "def update_learning_rate(self) -> None:\n self.epsilon = self.initial_epsilon / (1. + self.rate_decay * self.n_it)\n return", "def learning_rate_fn():\n st...
[ "0.74117327", "0.74117327", "0.73653096", "0.7282592", "0.72536147", "0.72200483", "0.72187227", "0.7206259", "0.7179045", "0.71668476", "0.7130153", "0.7105896", "0.7104434", "0.70564616", "0.70272994", "0.7022707", "0.6999465", "0.6988827", "0.6926499", "0.69180346", "0.687...
0.7128788
11
Counts down using 1 to min list length+1 indexing and calculates the mean average precision
def calculate_mean_average_precision(class_name='', current_neuron_index=current_neuron_index, acts=acts, verbose=verbose, minx=0.000000001): # current_neuron = acts.get_activations_for_neuron(current_neuron_index) # get the neuron's data x_data = current_neuron.vector # get the activations without classes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_avg (mylist, N):\n import numpy as np\n \n cumsum = np.cumsum(np.insert(mylist, 0, 0))\n return (cumsum[N:] - cumsum[:-N]) / float(N)", "def centered_average(some_list):\n # Tihs funstion will return average value of list but ignore the largest and smallest number.\n sorted(some_lis...
[ "0.72028774", "0.71003616", "0.70358604", "0.7025029", "0.7003392", "0.6988039", "0.6960753", "0.69208586", "0.6919574", "0.68940306", "0.6865455", "0.68541783", "0.6820655", "0.6796251", "0.6788845", "0.6783548", "0.6772852", "0.67516625", "0.6748478", "0.6732323", "0.672639...
0.6333015
59
Counts down using 1 to min list length+1 indexing and calculates the mean average precision
def calculate_average_precision(class_name='', current_neuron_index=current_neuron_index, acts=acts, no_files_in_label=no_files_in_label, verbose=verbose, minx='',Q_stop=''): # current_neuron = acts.get_activations_for_neuron(current_neuron_index) # get the neuron's data x_da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_avg (mylist, N):\n import numpy as np\n \n cumsum = np.cumsum(np.insert(mylist, 0, 0))\n return (cumsum[N:] - cumsum[:-N]) / float(N)", "def centered_average(some_list):\n # Tihs funstion will return average value of list but ignore the largest and smallest number.\n sorted(some_lis...
[ "0.72028774", "0.71003616", "0.70358604", "0.7025029", "0.7003392", "0.6988039", "0.6960753", "0.69208586", "0.6919574", "0.68940306", "0.6865455", "0.68541783", "0.6820655", "0.6796251", "0.6788845", "0.6783548", "0.6772852", "0.67516625", "0.6748478", "0.6732323", "0.672639...
0.0
-1
Wrapper function to calculate the average precision when we have lots of zeros
def calculate_average_precision_incl_zeros(test_class, local_list='', x_data='', selected_activations='', current_neuron_index=current_neuron_index,acts=acts,verbose=verbose): if local_list == '': # if you don't pass it in, get the data local_list, selected...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_precision(r):\n r = np.asarray(r) != 0\n out = [precision_at_k(r, k + 1) for k in range(r.size) if r[k]]\n if not out:\n return 0.\n return np.mean(out)", "def average_precision(r):\n r = np.asarray(r) != 0\n out = [precision_at_k(r, k + 1) for k in range(r.size) if r[k]]\n if ...
[ "0.7830643", "0.76902956", "0.76902956", "0.72265667", "0.71731555", "0.705396", "0.6899335", "0.68233114", "0.6804713", "0.67869073", "0.6786465", "0.67715895", "0.67715895", "0.66878515", "0.6670562", "0.66532713", "0.6627304", "0.6562283", "0.65242934", "0.6505691", "0.649...
0.6574474
17
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, MultiConcatInfo): return False return self.__dict__ == other.__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): return not self == other
{ "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.0
-1
String representation of the class instance.
def __str__(self): return 'Tokenizer({type}, {value})'.format( type=self.type, value=repr(self.value) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out", "def __repr__(self):\n outl = 'class :'+self.__class__.__name_...
[ "0.81528825", "0.810694", "0.80485237", "0.7923295", "0.7921949", "0.7921949", "0.7921949", "0.7921949", "0.7921949", "0.7921295", "0.7910681", "0.79043895", "0.79043895", "0.79043895", "0.78848475", "0.78608793", "0.7854687", "0.78356767", "0.7828303", "0.7778142", "0.777691...
0.0
-1
Change the age limit and update the list
def set_limit(self, limit): self.limit = limit self._prune()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_age(self, newage):\n self.age = newage", "def max_age(self, max_age):\n self._max_age = max_age", "def setAge(self, age):\r\n self.age = age", "def _age_changed(self, value):\r\n # update internal data\r\n self._age = value", "def max_age(self, max_age):\n\n ...
[ "0.6704046", "0.6666972", "0.6644926", "0.6640926", "0.65479463", "0.65296185", "0.6529369", "0.65138876", "0.64941657", "0.64941657", "0.6465131", "0.64448273", "0.6385047", "0.62916017", "0.625086", "0.6127694", "0.60917455", "0.6047239", "0.6041119", "0.60013735", "0.59121...
0.5228891
45
Convert the data to a normal list
def to_list(self): return list(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_list(self, data):\n\n temp = []\n for item in data:\n if len(item) > 2:\n i = 0\n while i < len(item):\n temp.append(item[i:min(i+2, len(item))])\n i += 2\n else:\n temp.append(item)\n ...
[ "0.72799987", "0.7278574", "0.72407997", "0.7230224", "0.7115344", "0.7086034", "0.69437695", "0.6918134", "0.6901256", "0.68893063", "0.68696356", "0.6869144", "0.68458605", "0.6839517", "0.6834532", "0.6826479", "0.67936456", "0.6793599", "0.67728835", "0.67169946", "0.6667...
0.81269825
0
Clean our tweets using regex. Remove weird characters and links.
def clean_text(text): cleanedup = text.lower() return re.sub("(@[A-Za-z0-9]+)|(#[A-Za-z0-9]+)|([^0-9A-Za-z \t])|(\w+:\/\/\S+)", "", cleanedup)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_tweet(tweet):\n\n pattern = r'http\\S+|pic.\\S+|@[a-zA-Z0-9_]+|#[a-zA-Z0-9_]+|[‘’“”’–—…]|\\xa0'\n return re.sub(pattern, '', tweet)", "def clean_tweet(tweet): \n #Remove URL\n tweet = re.sub('\\w+:\\/{2}[\\d\\w-]+(\\.[\\d\\w-]+)*(?:(?:\\/[^\\s/]*))*', ' ', tweet) \n #Remove user\n ...
[ "0.84219414", "0.83359104", "0.82979167", "0.82394314", "0.7982481", "0.7969785", "0.79214466", "0.78721297", "0.78099835", "0.7793539", "0.7793539", "0.7771681", "0.774794", "0.7740484", "0.77186424", "0.76957214", "0.76356393", "0.76234305", "0.75391275", "0.74440205", "0.7...
0.7217687
26
All the features should be in the features register.
def test_registry(): assert(CQT.get_id() in msaf.base.features_registry.keys()) assert(PCP.get_id() in msaf.base.features_registry.keys()) assert(Tonnetz.get_id() in msaf.base.features_registry.keys()) assert(MFCC.get_id() in msaf.base.features_registry.keys()) assert(Tempogram.get_id() in msaf.base...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_features(self) :\n raise NotImplementedError", "def findFeatures(self):\n\t\tpass", "def enableAllFeatures(self):\n self.logger.debug('Enabling all features in all feature classes')\n for featureClassName in self.getFeatureClassNames():\n self.enabledFeatures[featureClassName] = [...
[ "0.78374416", "0.76767546", "0.7469113", "0.7349155", "0.7309751", "0.7266849", "0.7266689", "0.6984151", "0.69206196", "0.6912054", "0.6890018", "0.68580675", "0.68498456", "0.68290204", "0.6804327", "0.67770475", "0.670522", "0.6693841", "0.66857773", "0.6672707", "0.662861...
0.6215909
53
Return color palette from a given scheme
def get_color_palette( scheme: ColorScheme | ColorSchemeShort, palette: int | str ) -> ColorPalette: if isinstance(palette, int): palette = number_to_name(scheme, palette) mod = get_palette_module(scheme) return getattr(mod, palette)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_palette(self) -> Palette:\n return Palette[self.colour_combo.get().upper()]", "def _get_peirce_colour_scheme():\n\n this_colour_map_object = pyplot.cm.Blues\n this_colour_norm_object = matplotlib.colors.BoundaryNorm(\n LEVELS_FOR_PEIRCE_CONTOURS, this_colour_map_object.N)\n\n rgba_...
[ "0.70786625", "0.69059485", "0.6833632", "0.6786311", "0.6746632", "0.67323136", "0.66644156", "0.6538229", "0.65265095", "0.6519304", "0.6495517", "0.648358", "0.6437483", "0.63493925", "0.63164395", "0.6296777", "0.6282252", "0.62815785", "0.62762725", "0.6230058", "0.62144...
0.7758972
0
Return the domain policy.
def list_domain_policy(self, _): FILETIME_TIMESTAMP_FIELDS = { "lockOutObservationWindow": (60, "mins"), "lockoutDuration": (60, "mins"), "maxPwdAge": (86400, "days"), "minPwdAge": (86400, "days"), "forceLogoff": (60, "mins") } FOREST_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_policy(self):\n\n return", "def policy(self) -> pulumi.Output['outputs.ServicePolicy']:\n return pulumi.get(self, \"policy\")", "def policy(self) -> Optional[str]:\n return pulumi.get(self, \"policy\")", "def get_policy(self):\n return self.agent.get_policy()", "def poli...
[ "0.71584046", "0.7124709", "0.7114782", "0.7037519", "0.7015653", "0.7015653", "0.7015653", "0.6982405", "0.6967254", "0.68876976", "0.679687", "0.679687", "0.679687", "0.6790002", "0.67771", "0.67659557", "0.67659557", "0.6688316", "0.6688316", "0.65851307", "0.65851307", ...
0.69250053
9
Return the list of Group policy objects.
def list_gpo(self, _): results = self.engine.query(self.engine.GPO_INFO_FILTER(), ["cn", "displayName"]) for gpo in results: print("{cn}: {name}".format(cn=gpo["cn"], name=gpo["displayName"]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_group_policies(self, group_name, marker=None, max_items=None):\r\n params = {'GroupName' : group_name}\r\n if marker:\r\n params['Marker'] = marker\r\n if max_items:\r\n params['MaxItems'] = max_items\r\n return self.get_response('ListGroupPolicies', pa...
[ "0.6820933", "0.6765566", "0.6320396", "0.62198114", "0.60648185", "0.59725827", "0.59391737", "0.58800286", "0.58800286", "0.58707017", "0.58509564", "0.5849724", "0.58346593", "0.5784841", "0.5774335", "0.57719874", "0.574514", "0.56709456", "0.56708425", "0.56602335", "0.5...
0.0
-1
List the authentication policies configured in the Active Directory.
def list_auth_policies(self, kwargs): verbose = kwargs.get("verbose", False) attributes = ALL if verbose else ["cn", "objectClass"] self.display( self.engine.query( self.engine.AUTH_POLICIES_FILTER(), attributes, base=','.join(["CN=AuthN Policy Config...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_policies(self):\n client = self.connect(VAULT_TOKEN)\n return client.list_policies()", "def list_policies(self):\n return self.con.list_policies(\n Scope='Local'\n )", "def policies(self):\n return self._data.get('policies')", "def policies(self):\n ...
[ "0.72849435", "0.70449686", "0.6701386", "0.66214895", "0.6546823", "0.64185375", "0.63081646", "0.62317467", "0.62317467", "0.6131787", "0.61192256", "0.61073345", "0.61073345", "0.6064667", "0.6038211", "0.6010348", "0.5998391", "0.59846205", "0.59724295", "0.59188837", "0....
0.8040366
0
Add `user` to `group`.
def action_add_to_group(self, kwargs): user = kwargs["user"] group = kwargs["group"] if self.engine.add_user_to_group(user, group): info(f"User {user} sucessfully added to {group}") else: error(f"Unable to add {user} to {group}, check privileges or dn")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user_to_group(user, group):\n Command.run(['usermod', '-a', '-G', user, group])", "def add_to_group(user: User, group: Group) -> Result:\n if user.pw_name in group.gr_mem:\n return Result(State.unchanged)\n command([\"/usr/sbin/addgroup\", user.pw_name, group.gr_name])\n group.gr_m...
[ "0.8697254", "0.8595252", "0.8389054", "0.80865586", "0.7991722", "0.7947402", "0.7795021", "0.7704493", "0.7641521", "0.75610435", "0.7524669", "0.7419996", "0.74008846", "0.7341089", "0.73084277", "0.72363085", "0.7196415", "0.7171899", "0.713689", "0.7079735", "0.70770496"...
0.81125003
3
Returns dict with default app of site
def get_default_app(site): collection = site.Collection for i in range(collection.Count): prop = collection[i].Properties if prop["path"].Value == "/": result = dict() result["applicationPool"] = collection[i].Properties["applicationPool"].Value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_application():\n try:\n path, name = settings.ASGI_APPLICATION.rsplit(\".\", 1)\n except (ValueError, AttributeError):\n raise ImproperlyConfigured(\"Cannot find ASGI_APPLICATION setting.\")\n try:\n module = importlib.import_module(path)\n except ImportError:\n ...
[ "0.6673111", "0.6491351", "0.6459286", "0.6441911", "0.64014465", "0.6388948", "0.6287382", "0.6286357", "0.62150127", "0.61904275", "0.6100807", "0.608777", "0.6072634", "0.60458755", "0.60317475", "0.60145515", "0.6009598", "0.5984199", "0.5978482", "0.5973094", "0.5963709"...
0.7991052
0
Populates a protobuf model from a dictionary.
def dict_to_protobuf(pb_klass_or_instance, values, type_callable_map=REVERSE_TYPE_CALLABLE_MAP, \ strict=True): if isinstance(pb_klass_or_instance, Message): instance = pb_klass_or_instance else: instance = pb_klass_or_instance() return _dict_to_protobuf(instance, values, type_callable_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.63854116", "0.61806536", "0.6163513", "0.6163513", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", "0.61552805", ...
0.0
-1
Converts this object to a json string
def to_json(self): return _convert_list_to_json(self.properties)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json(self) -> str:\n return json.dumps(asdict(self))", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> ...
[ "0.8863865", "0.88475925", "0.88475925", "0.88475925", "0.88475925", "0.88475925", "0.88475925", "0.88475925", "0.88475925", "0.88475925", "0.8706972", "0.86729354", "0.86729354", "0.8671925", "0.8666713", "0.8656854", "0.8652593", "0.8645529", "0.8631205", "0.86138016", "0.8...
0.0
-1
Static method to translate an image dict into a image model.
def transform(data): if 'name' not in data or 'engine' not in data: return None return Image( name=data['name'], engine=data['engine'], id=data['id'] if 'id' in data else '', parameters=data['parameters'] if 'parameters' in data else {}, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dikt) -> 'ImageData':\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, dikt) -> \"ImageUpload\":\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, dikt) -> \"SapDataIm\":\n return util.deserialize_model(dikt, cls)", "def addImg(in_dict):\...
[ "0.6945973", "0.68697536", "0.57698345", "0.57576877", "0.56775665", "0.5677011", "0.5626081", "0.5620618", "0.5592171", "0.5587613", "0.5567338", "0.5543028", "0.5477308", "0.546878", "0.5465573", "0.5458197", "0.54422987", "0.54414344", "0.5424831", "0.5416388", "0.54127145...
0.6286582
2
Test that passing bad data into the post method returns bad request response.
def test_record_emotions_post_invalid_data_image_returns_bad_request(self): from emotion_emotions.views import RecordEmotions request = self.request.post('', data={'image': 'FAKE'}) request.user = self.dan view = RecordEmotions(request=request) response = view.post(request) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_invalid_data_question(self):\n\n response = self.post_question(self.invalid_question)\n\n self.assertEqual(response.status_code, 400)", "def testInvalidData(self):\n data = {\n \"title\": 32,\n \"rent\": 700\n }\n\n response = self.client.pos...
[ "0.7926113", "0.7921885", "0.7845744", "0.77989596", "0.7695387", "0.7666464", "0.76314694", "0.7615459", "0.76126415", "0.7592168", "0.7585458", "0.7567806", "0.7519811", "0.75180626", "0.75070894", "0.74908704", "0.74808395", "0.7460269", "0.7439978", "0.74223423", "0.74136...
0.0
-1
Test that passing bad data into the post method returns bad request response.
def test_record_emotions_post_invalid_data_keys_returns_bad_request(self): from emotion_emotions.views import RecordEmotions request = self.request.post('', data={'face': 'data:base64,FAKE'}) request.user = self.dan view = RecordEmotions(request=request) response = view.post(requ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_invalid_data_question(self):\n\n response = self.post_question(self.invalid_question)\n\n self.assertEqual(response.status_code, 400)", "def testInvalidData(self):\n data = {\n \"title\": 32,\n \"rent\": 700\n }\n\n response = self.client.pos...
[ "0.79263353", "0.7922944", "0.78462344", "0.7798835", "0.7695336", "0.7665166", "0.76306325", "0.7615403", "0.7611605", "0.7591419", "0.75853825", "0.75698894", "0.75193375", "0.75181186", "0.75056124", "0.7490886", "0.74799466", "0.7460827", "0.7440127", "0.7422171", "0.7415...
0.0
-1
Test that passing bad image into the post method returns bad request response.
def test_record_emotions_post_bad_image_to_api_returns_bad_request(self): from emotion_emotions.views import RecordEmotions request = self.request.post('', data={'image': 'data:base64,FAKE'}) request.user = self.dan with patch.object(RecordEmotions, 'get_emotion_data', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_image(self):\n with open('apps/upload/__init__.py', 'rb') as f:\n r = post(self.client, 'upload.up_image_async', {'image': f},\n args=['questions.Question', 1])\n\n eq_(400, r.status_code)\n json_r = json.loads(r.content)\n eq_('error', js...
[ "0.8292355", "0.82917565", "0.82409483", "0.81842923", "0.8170253", "0.8157902", "0.8156477", "0.81154734", "0.807839", "0.80757165", "0.7951839", "0.7810697", "0.75786287", "0.747128", "0.70160943", "0.70036095", "0.6999951", "0.6999061", "0.6946313", "0.6938462", "0.6914447...
0.76418674
12
Raises an AssertionError if two array_like objects are not equal. Given two array_like objects, check that the shape is equal and all elements of these objects are equal. An exception is raised at shape mismatch or conflicting values. In contrast to the standard usage in numpy, NaNs are compared like numbers, no assert...
def assertArrayEqual(self, actual, desired, msg=""): np.testing.assert_array_equal(x=actual, y=desired, err_msg=msg, verbose=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allequal(a, b, flavor=\"numpy\"):\n\n # print(\"a-->\", repr(a))\n # print(\"b-->\", repr(b))\n if not hasattr(b, \"shape\"):\n # Scalar case\n return a == b\n\n if ((not hasattr(a, \"shape\") or a.shape == ()) and\n (not hasattr(b, \"shape\") or b.shape == ())):\n r...
[ "0.7455845", "0.74123824", "0.7393286", "0.73536354", "0.7296088", "0.7286683", "0.7258548", "0.7119014", "0.70943934", "0.7064725", "0.7013488", "0.68885064", "0.6855286", "0.68502074", "0.6845137", "0.6792537", "0.67528343", "0.6709025", "0.668448", "0.66675526", "0.6632160...
0.6390319
35