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
r""" Returns a saved state dict or none.
def get_saved_state( self ): try: return torch.load("{}/model.torch".format( self.config.neuron.full_path )) except Exception as e: logger.exception('Failed to reload model with error: {}', e) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_state_to_dict(self):\n return self.__dict__.copy()", "def __getstate__(self):\n state: Dict[str, Any] = deepcopy(self.__dict__)\n del state['__db']\n return state", "def __getstate__(self):\n with self.override_evaluator(None):\n loaded_from = self.__loade...
[ "0.7658194", "0.74543995", "0.73400223", "0.73151165", "0.7293509", "0.7267155", "0.7230697", "0.7130385", "0.71279794", "0.7095217", "0.707815", "0.70776665", "0.70526725", "0.70258474", "0.6978084", "0.69323516", "0.6908197", "0.690799", "0.6882391", "0.6842115", "0.6842115...
0.7108806
9
r""" Sets the mechanism weights on chain.
def set_mechanism_weights( self ): try: uids = self.metagraph.uids did_set = self.subtensor.set_weights( wallet = self.wallet, uids = uids, weights = self.mechanism_weights, wait_for_inclusion = True ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setWeights(self, w):\n raise NotImplementedError", "def set_weights(self, weights):\r\n self.weights = weights", "def setweights(self, weights):\n # I call it weights because it is the relative weights of the atoms, not\n # because I'm confusing weight and mass\n self.we...
[ "0.7504997", "0.7358669", "0.727765", "0.72202337", "0.71728086", "0.71233875", "0.7105213", "0.7072411", "0.70382416", "0.7021747", "0.7001062", "0.69854206", "0.6956045", "0.6946109", "0.6885775", "0.6844246", "0.6844246", "0.6844246", "0.6843235", "0.68431693", "0.6839158"...
0.84285563
0
update the asteroid location, according to screen size sand given speed.
def move(self): min_x = self.__screen.SCREEN_MIN_X min_y = self.__screen.SCREEN_MIN_Y delta_x = self.__screen.SCREEN_MAX_X - min_x delta_y = self.__screen.SCREEN_MAX_Y - min_y # new location formula according to pdf. new_x = (self.__x_speed + self.__x - min_x) % ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.rect.y -= self.y_speed # Pawns move up the screen at the speed specified", "def update(self):\r\n # Desplaza el bloque un píxel hacia abajo. s\r\n if self.rect.left < 50 or self.rect.right > 600:\r\n self.speed[0] = -self.speed[0]\r\n if self.rect....
[ "0.67158186", "0.6462171", "0.633909", "0.6295045", "0.6289532", "0.62571937", "0.62465733", "0.6228916", "0.6224609", "0.621673", "0.61947966", "0.61831945", "0.6138558", "0.61355627", "0.6118052", "0.6113071", "0.608893", "0.6080925", "0.60793006", "0.6063403", "0.60581553"...
0.6077792
19
return item's data() value
def data(value): return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPyData(self, item):\r\n\r\n return item.GetData()", "def data(self, index):\n return self._itemData", "def data(self, index):\n return self._itemData.name", "def get_data(self):\n return self.data", "def get_data(self):\n return self.data", "def get_data(self):\n...
[ "0.8027007", "0.797708", "0.76455134", "0.75722086", "0.75722086", "0.75722086", "0.7485524", "0.74617684", "0.74617684", "0.74617684", "0.74589837", "0.74589837", "0.74589837", "0.74589837", "0.7443318", "0.7437306", "0.7437306", "0.7437306", "0.7423022", "0.7423022", "0.740...
0.6806409
91
Returns the Mushi API application instance.
def create_app(debug=False): app = factory.create_app(__name__, __path__, debug) # set the default json encoder app.json_encoder = JSONDatetimeEncoder # set the error handlers app.errorhandler(ApiError)(handle_api_exception) app.errorhandler(AuthenticationError)(handle_403) app.errorhandle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app(self):\n if self._application is None:\n self._application = Application(client=self)\n return self._application", "def get_app(self):\n return Application()", "def application(self, application_api_key):\r\n return Application(self, application_api_key)", "def ...
[ "0.76315826", "0.75180835", "0.7246059", "0.7161497", "0.6836229", "0.68347675", "0.6807005", "0.6783179", "0.67538637", "0.6733027", "0.67282665", "0.6711077", "0.6711077", "0.6701158", "0.668382", "0.6676493", "0.66736853", "0.6653394", "0.66316706", "0.65987253", "0.656819...
0.0
-1
Return rgb color normalized (from 0 to 1).
def get_rgb_normalized(r, g, b, a=1.0): if r <= 1 and g <= 1 and b <= 1: return r, g, b, a return r / 255.0, g / 255.0, b / 255.0, a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rgb_normalized(r, g, b, a=1.0):\n return r / 255.0, g / 255.0, b / 255.0, a", "def generate_normalized_rgb(self):\n \n r,g,b=(Numeric.zeros(256),Numeric.zeros(256),Numeric.zeros(256))\n for i in Numeric.arange(256):\n r_,g_,b_=self.colfct(i/255.0) # these are from [0...
[ "0.8072177", "0.7929757", "0.74721897", "0.7368328", "0.73331195", "0.7198139", "0.7183639", "0.71806806", "0.7089179", "0.7072852", "0.70422107", "0.703616", "0.6942206", "0.69259834", "0.6878581", "0.67863244", "0.67666256", "0.67647815", "0.6764415", "0.6761445", "0.675824...
0.7844115
2
Initialize the layer. Most of args are the same as tf.keras.layers.DepthwiseConv2D except it has an extra parameter "dilated" to indicate whether to use dilated conv to simulate large kernel_size size. If dilated=True, then dilation_rate is ignored.
def __init__(self, kernel_size, strides, dilated=False, **kwargs): self._channel_axis = -1 self._dilated = dilated self.kernels = kernel_size self._conv_kwargs = { 'strides': strides, 'dilation_rate': kwargs.get('dilation_rate', (1, 1)), 'kernel_initi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _DepthwiseConv2D(self, name, filter_size, is_causal=False, qdomain=None):\n p = self.params\n conv_builder_params = conv_layers.Builder.Params()\n if p.norm_layer_tpl:\n conv_builder_params.norm_layer_tpl = p.norm_layer_tpl\n conv_builder = conv_builder_params.Instantiate()\n return conv_bu...
[ "0.67333204", "0.67199266", "0.6454356", "0.636314", "0.6349992", "0.6329895", "0.63211644", "0.6307581", "0.6293697", "0.6279428", "0.6271192", "0.6259153", "0.62518847", "0.6245861", "0.61893433", "0.61730474", "0.6160912", "0.6134608", "0.61209995", "0.6074331", "0.6051888...
0.6737787
1
Get the indices of binned times from different segments of the observation. This is a generator, yielding the boundaries of each segment and the corresponding indices in the time array
def generate_indices_of_segment_boundaries_binned(times, gti, segment_size, dt=None): gti = np.asarray(gti) times = np.asarray(times) startidx, stopidx = bin_intervals_from_gtis(gti, segment_size, times, dt=dt) if dt is None: dt = 0 for idx0, idx1 in zip(startidx, stopidx): yield ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_indices_of_segment_boundaries_unbinned(times, gti, segment_size):\n gti = np.asarray(gti)\n times = np.asarray(times)\n\n start, stop = time_intervals_from_gtis(gti, segment_size)\n\n assert is_sorted(times), \"Array is not sorted\"\n\n startidx = np.asarray(np.searchsorted(times, start...
[ "0.81385136", "0.74454594", "0.73748314", "0.6589845", "0.6483112", "0.63857484", "0.6343811", "0.6235033", "0.6141872", "0.6137866", "0.6117819", "0.6050756", "0.58365744", "0.57531977", "0.5718293", "0.57018137", "0.5695246", "0.5675361", "0.5644452", "0.56322515", "0.55986...
0.822498
0
Determines the position in realspace for the given vector, in multiples of the unitcell vectors.
def v_abc(self, a, b, c): # The 'unitcell' coordinate system assumes: # a-axis lies along x-axis # b-axis is in x-y plane # c-axis is vertical (or at a tilt, depending on beta) # Convert from (unitcell) Cartesian to (unitcell) fractional coordinates r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_vector(vector):\n return vector / np.linalg.norm(vector)", "def cal_unit_vec(vector):\n return vector / np.linalg.norm(vector)", "def unit_vector(self,vector):\n return vector / np.linalg.norm(vector)", "def unit_vector(self, vector):\n return vector / np.linalg.norm(vector)"...
[ "0.6790064", "0.6786649", "0.6752192", "0.6736442", "0.66772586", "0.66772586", "0.66772586", "0.66561145", "0.66505545", "0.6649365", "0.6649365", "0.6649365", "0.6649365", "0.6649365", "0.6649365", "0.6649365", "0.6649365", "0.6649365", "0.6649365", "0.6649365", "0.6648856"...
0.0
-1
Returns the realspace position for the vector, in the experimental coordinate system (which includes whatever rotations have been set).
def v_abc_exp(self, a, b, c): vlen, v_vector = self.v_abc(a,b,c) x, y, z = v_vector x, y, z = self.rotate_q_exp(x, y, z) return (vlen, (x, y, z) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector(self) -> Vector:\n return self._normal * self._distance_from_origin", "def get_virtual_x_position(self):\n x_real = (\n (self.get_x_position() - self.get_origin_x_position()) *\n sin(self.get_origin_direction() * pi / 180)\n )\n y_real = (\n ...
[ "0.6305339", "0.62474257", "0.6213889", "0.62063015", "0.61432284", "0.61204785", "0.6076696", "0.6065789", "0.59801143", "0.5969837", "0.5958947", "0.59346515", "0.59331965", "0.59091336", "0.590473", "0.5871445", "0.5854228", "0.5845941", "0.5839444", "0.58291596", "0.58102...
0.0
-1
Converts angles into an appropriate rotation matrix.
def rotation_elements(self, eta, phi, theta): # Three-axis rotation: # 1. Rotate about +z by eta (follows RHR; rotation is mathematical and thus counter-clockwise) # 2. Tilt by phi with respect to +z (rotation about y-axis) then # 3. rotate by theta in-place (rotation about z-ax...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_matrices_from_angles(angles):\n\n angles = np.atleast_1d(angles)\n npts = len(angles)\n\n sina = np.sin(angles)\n cosa = np.cos(angles)\n\n R = np.zeros((npts, 2, 2))\n R[:, 0, 0] = cosa\n R[:, 1, 1] = cosa\n\n R[:, 0, 1] = -sina\n R[:, 1, 0] = sina\n\n return R", "def ...
[ "0.7780914", "0.77337813", "0.76302224", "0.76302224", "0.76302224", "0.7617995", "0.76034105", "0.75379497", "0.75379497", "0.7400807", "0.7252997", "0.711589", "0.7103795", "0.7100147", "0.6974231", "0.69118786", "0.6866845", "0.68428785", "0.6841802", "0.6841802", "0.68312...
0.0
-1
Rotates the qvector in the way given by the internal rotation_matrix, which should have been set using "set_angles" or the appropriate pargs (eta, phi, theta).
def rotate_q_exp(self, qx, qy, qz): # qx, qy, qz = self.rotate_q_exp(qx, qy, qz) q_vector = np.array( [[qx],[qy],[qz]] ) q_rotated = np.dot( self.rotation_matrix_exp, q_vector ) qx = q_rotated[0,0] qy = q_rotated[1,0] qz = q_rotated[2,0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qrotate(points, axis, theta):\n q = Quaternion.rotator(axis, theta)\n return q.rotate(points)", "def make_q_rot_matrix(self, angles):\n #For other instruments, this method may be different.\n (phi, kappa, omega) = self.get_phi_kappa_omega(angles)\n\n #In Q space, detector c...
[ "0.7486976", "0.71783274", "0.7070145", "0.7048958", "0.7041417", "0.7033555", "0.7026915", "0.7026915", "0.70042187", "0.70042187", "0.6999041", "0.67515516", "0.67481565", "0.6706793", "0.6648917", "0.66243094", "0.6550054", "0.65333575", "0.64983845", "0.6470293", "0.64654...
0.62568456
34
The intrinsic delta and beta are those scaled for the density of the material. Thus they are a 'peratom' contribution.
def get_xray_delta_beta_intrinsic(self, energy=13.0): delta, beta = self.get_xray_delta_beta(energy) delta *= self.atomic_weight/self.density beta *= self.atomic_weight/self.density return delta, beta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xray_delta_beta_intrinsic(self, energy=13.0):\n \n delta, beta = self.get_xray_delta_beta(energy)\n \n delta *= self.get_molecular_weight()/self.get_density()\n beta *= self.get_molecular_weight()/self.get_density()\n \n return delta, beta", "def g...
[ "0.6842238", "0.6057587", "0.5976162", "0.59087837", "0.58436227", "0.57800454", "0.5772805", "0.57682574", "0.57206523", "0.5704588", "0.5700537", "0.56717736", "0.56309444", "0.5624023", "0.56205976", "0.56133217", "0.5594726", "0.5585502", "0.55696523", "0.5555894", "0.552...
0.6807886
1
Returns this element's f1 and f2 values, for the given energy.
def get_f1_f2(self, energy=13.0): try: f1 = self.xray_properties[energy][0] f2 = self.xray_properties[energy][1] except KeyError: # Interpolate instead #energy_close = min(self.xray_properties.keys(), key=lambda k: abs(k-energy)) keys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def F(self):\n return self.generic_getter(get_F_potential, \"F\", \"convert_energy\")", "def energy_func(self):\n return (\n self.inl[0].m.val_SI * (\n self.outl[0].h.val_SI - self.inl[0].h.val_SI) +\n self.inl[1].m.val_SI * (\n self.outl[1].h.val...
[ "0.6997422", "0.65318495", "0.6317625", "0.6314279", "0.61470693", "0.60946673", "0.60393214", "0.5963418", "0.5884862", "0.5882164", "0.58085567", "0.57599235", "0.5748945", "0.5729654", "0.569984", "0.5682066", "0.56560487", "0.5649355", "0.55843437", "0.55585176", "0.55504...
0.7952233
0
The intrinsic delta and beta are those scaled for the density of the material. Thus they are a 'peratom' contribution.
def get_xray_delta_beta_intrinsic(self, energy=13.0): delta, beta = self.get_xray_delta_beta(energy) delta *= self.get_molecular_weight()/self.get_density() beta *= self.get_molecular_weight()/self.get_density() return delta, beta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xray_delta_beta_intrinsic(self, energy=13.0):\n \n delta, beta = self.get_xray_delta_beta(energy)\n delta *= self.atomic_weight/self.density\n beta *= self.atomic_weight/self.density\n \n return delta, beta", "def get_beta(self):\n\n return np.matmul(self....
[ "0.68078154", "0.60589826", "0.5974901", "0.5910188", "0.5845013", "0.57789737", "0.57726866", "0.5765987", "0.5719541", "0.5703098", "0.57008743", "0.5672412", "0.56303936", "0.5623782", "0.56214833", "0.5613943", "0.55956405", "0.5583803", "0.5569064", "0.55572116", "0.5528...
0.6842051
0
Tests create media type
def test_add_media_type(self): # check if documentalist has access to create new media-types self.login_documentalist() response = self.client.get('/multimedia/media-type/new' ) # 403 = unauthorized self.assertEqual(response.status_code, 403) self.client.logout() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fetch_or_create_requires_file_type():\n pytest.raises(ValueError, media.fetch_or_create_media_item, b'spam')", "def test_type_image(image):\n resource = models.MediaResource(image=image)\n\n assert resource.type == models.MediaResource.TYPE_IMAGE", "def test_list_media_type(self):\n\n ...
[ "0.71429414", "0.6677166", "0.6592191", "0.6467624", "0.6429305", "0.6406042", "0.6370587", "0.63356155", "0.63356155", "0.6265432", "0.6203261", "0.6162893", "0.6155528", "0.6093387", "0.60590714", "0.604928", "0.60404843", "0.5978288", "0.5938957", "0.5870291", "0.5843269",...
0.79913294
0
Return the requested duration (in milliseconds) encoded in the gif file.
def _get_duration(self): try: dur = self.im.info["duration"] / 1000.0 except KeyError: dur = DEFAULT_DURATION / 1000.0 return dur
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_frame_rate(gif=''):\n\n # identify -format \"Frame %s: %Tcs\\n\" ~/test.gif - frame life in centiseconds - how very odd.\n frame_rate_str = subprocess.check_output([\n 'identify',\n '-format',\n '%T\\n',\n gif\n ])\n # If we failed to get a frame lifetime from imag...
[ "0.65521395", "0.64156765", "0.6347927", "0.6300428", "0.62722605", "0.6203097", "0.61976093", "0.6196824", "0.6174943", "0.6164094", "0.6163623", "0.6126314", "0.6042789", "0.60365427", "0.602783", "0.60250014", "0.6007763", "0.5978441", "0.59772915", "0.59731764", "0.597247...
0.70833486
0
Converts everything into a neat email address
def unify_mail(email, primary_domain=None): if email is None: return '' email = email.strip() if email == '': return '' if '@' not in email: user = email domain = None else: (user, domain) = email.split('@') if not domain or domain in MAIL_DOMAINS: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_email_address(self):\n return \"%s.%s@%s\" % (uuid.uuid4(), self.mailbox, \"mailosaur.io\")", "def email(self):\n return '{}.{}@email.com'.format(self.fname,self.lname)", "def email(self):\n return \"{}.{}@company.com\".format(self.first, self.last)", "def generate_email(nam...
[ "0.7189875", "0.69836456", "0.69762295", "0.6924633", "0.68997216", "0.6854964", "0.684078", "0.6816215", "0.6749997", "0.67385113", "0.6719771", "0.65444314", "0.6515943", "0.64918524", "0.64764446", "0.6449037", "0.6447131", "0.64407635", "0.6428475", "0.6395255", "0.638003...
0.6489782
14
Return a KafkaClient fixture
def kafka_client(kafka_broker, request): (client,) = kafka_broker.get_clients(cnt=1, client_id='%s_client' % (request.node.name,)) yield client client.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kafka_admin_client(kafka_admin_client_factory):\n yield kafka_admin_client_factory()", "def make_kafka_server(\n kafka_bin: str,\n zookeeper_fixture_name: str,\n kafka_port: Optional[int] = None,\n kafka_config_template: str = KAFKA_SERVER_CONFIG_TEMPLATE,\n teardown_fn: Callable[[Popen], A...
[ "0.6467988", "0.6430207", "0.64101166", "0.62831724", "0.61256367", "0.60472345", "0.6038839", "0.5986476", "0.5957818", "0.5952596", "0.5886126", "0.5879947", "0.5858388", "0.58266234", "0.5804392", "0.57995164", "0.5771578", "0.57611746", "0.5748662", "0.5744194", "0.573985...
0.5795311
16
Return a KafkaAdminClient fixture
def kafka_admin_client(kafka_admin_client_factory): yield kafka_admin_client_factory()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kafka_admin_client_factory(kafka_broker):\n _admin_client = [None]\n\n def factory(**kafka_admin_client_params):\n params = {} if kafka_admin_client_params is None else kafka_admin_client_params.copy()\n _admin_client[0] = next(kafka_broker.get_admin_clients(cnt=1, **params))\n retur...
[ "0.696133", "0.6161714", "0.61330146", "0.61100334", "0.5975113", "0.5946764", "0.5934449", "0.592319", "0.5885137", "0.5855481", "0.584699", "0.584699", "0.58407384", "0.5834578", "0.58336115", "0.5819117", "0.5800654", "0.5762008", "0.5755142", "0.573877", "0.57275176", "...
0.7404837
0
Return a KafkaAdminClient factory fixture
def kafka_admin_client_factory(kafka_broker): _admin_client = [None] def factory(**kafka_admin_client_params): params = {} if kafka_admin_client_params is None else kafka_admin_client_params.copy() _admin_client[0] = next(kafka_broker.get_admin_clients(cnt=1, **params)) return _admin_cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kafka_admin_client(kafka_admin_client_factory):\n yield kafka_admin_client_factory()", "def test_client_factory():\n\tapp = make_app(blueprints.api_server, settings.TestingConfig)\n\treturn app.test_client()", "def test_create_client(self):\n pass", "def create_client(self) -> None:\n pass",...
[ "0.785013", "0.66675484", "0.64317244", "0.61067593", "0.6098917", "0.60793346", "0.59817463", "0.596553", "0.5941451", "0.59240556", "0.59180766", "0.5905756", "0.5897066", "0.58537436", "0.58478934", "0.58478934", "0.5834724", "0.5803091", "0.57998455", "0.57970864", "0.576...
0.7571933
1
Retourne un representation de l'alphabet en chaine de character Utilisation a = Alphabet(['1','2']) >print(a) {'1', '2'}
def __str__(self): return str(self.__alphabet)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAlphabet(self):\n return self.alpha", "def getAlphabet(self):\n return self.alpha", "def getAlphabet(self):\n return self.alpha", "def get_alphabet(self):\n return self.alphabet", "def GetAlphabet(self):\n alphabet = list(self._charAlphabet) #Creates a list of the ...
[ "0.7725361", "0.7725361", "0.7725361", "0.76313186", "0.7380487", "0.7264944", "0.7264944", "0.7208773", "0.6925614", "0.68998957", "0.68875504", "0.6828855", "0.6823014", "0.67651135", "0.66897255", "0.65668386", "0.6537231", "0.6473991", "0.6461187", "0.64385056", "0.640640...
0.7293637
5
This test is used to verify check email endpoint for an exisisting email Negative scenario
def test_check_email_endpoint_existing_email(self): print("Create a new user") kwargs= {'return_response_obj': True} response = self.test_create_user_endpoint(**kwargs) email_id = json.loads(response.text)["data"]["user"]["email"] kwargs = {'email_id': email_id} response...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_email_exisitance(client):\n response=client.post(\"/signin\",data=dict(email='njayaandrew@yahoo.com', password=TestSignin.password), content_type=\"multipart/form-data\")\n data=json.loads(response.data)\n assert response.status_code==401\n assert data[\"error\"] == \"The user ...
[ "0.7949241", "0.79252005", "0.7894219", "0.7785605", "0.77097386", "0.7707512", "0.76966375", "0.753197", "0.7493049", "0.7436697", "0.7406956", "0.73997164", "0.7365545", "0.73617697", "0.73611104", "0.7341542", "0.7275649", "0.72691673", "0.72599787", "0.7254665", "0.725176...
0.8058846
0
This test is used to verify check email endpoint when client_id ans client secret is incorrect Negative
def test_check_email_endpoint_incorrect_client_id_and_client_secret(self): print("Incorrect Client ID") kwargs = {"client_id": self.test_args["client_id"], "return_response_obj": True, "return_failure_response": True} response = self.test_check_email_endpoint(**kwargs) print("Verify Res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_email_exisitance(client):\n response=client.post(\"/signin\",data=dict(email='njayaandrew@yahoo.com', password=TestSignin.password), content_type=\"multipart/form-data\")\n data=json.loads(response.data)\n assert response.status_code==401\n assert data[\"error\"] == \"The user ...
[ "0.78077406", "0.7734107", "0.7268673", "0.72185075", "0.72138053", "0.7180917", "0.7178894", "0.71177065", "0.7114795", "0.70473605", "0.7017131", "0.6998371", "0.69487613", "0.69196194", "0.6912732", "0.69071394", "0.6900321", "0.6896202", "0.6869497", "0.6867559", "0.68668...
0.83071864
0
This test is used to verify check email endpoint by passing blank values to mandatory fields Negative
def test_check_email_endpoint_with_blank_values(self): print("Blank email id") kwargs = {"email_id": "", "return_response_obj": True, "return_failure_response": True} response = self.test_check_email_endpoint(**kwargs) print("Verify Response body") expected_result = self.test_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_blank_email(self):\n rv = self.signup('Bo', 'Theo', '', 'Bo1995', 'Bo1995')\n self.assertIn(b'Field must be between 6 and 30 characters long.', rv.data)", "def test_blank_email(self):\n response = self.register({\n 'first_name': \"David\",\n 'last_name'...
[ "0.79054666", "0.7902672", "0.7839084", "0.78227824", "0.7731462", "0.76797086", "0.74924177", "0.7476559", "0.7473797", "0.74543387", "0.74537224", "0.741722", "0.74171895", "0.73903954", "0.72823536", "0.7269874", "0.7207287", "0.72027266", "0.7165835", "0.714406", "0.71416...
0.77567637
4
This test is used to verify update user endpoint with existing email
def test_update_user_endpoint_existing_email(self, **kwargs): print("Create a new user and capture the email") kwargs['return_response_obj'] = True response = self.test_create_user_endpoint(**kwargs) email_id = json.loads(response.text)["data"]["user"]["email"] kwargs = {'email_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_user_endpoint_new_email(self):\n print(\"Generate a new email and check if email is not allocated\")\n email_id = Workflows.generate_new_email(suffix=self.global_config[\"email_id_suffix\"])\n kwargs = {'email_id': email_id, 'return_response_obj': True,\n 'url'...
[ "0.8202847", "0.81161", "0.8069643", "0.8038906", "0.79035074", "0.78956586", "0.78889686", "0.78236496", "0.7797676", "0.77734125", "0.7714368", "0.76982194", "0.76861954", "0.7674051", "0.76693356", "0.7655052", "0.76290035", "0.7617921", "0.7590175", "0.7562273", "0.754620...
0.85094595
0
This test is used to verify change password endpoint Positive scenario
def test_change_password_endpoint(self, **kwargs): print("Create a new user") things_to_edit = {"return_response_obj": True} response = self.test_create_user_endpoint(**things_to_edit) response = json.loads(response.text) print("Capture Authorization token") token_type =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_password_change_provided(self):\n token = str((jwt.encode(\n {\"email\": \"bagendadeogracious@gmail.com\"}, \n settings.SECRET_KEY)).decode('utf-8')\n )\n self.client.post(self.registration_url, valid_user, format='json')\n response = self.client.patch(\n ...
[ "0.8567106", "0.83504146", "0.83164936", "0.8177658", "0.81060314", "0.80760676", "0.8070329", "0.79092443", "0.78967357", "0.7880961", "0.7847211", "0.7817811", "0.78075725", "0.7778189", "0.76918364", "0.7685238", "0.7676653", "0.76392126", "0.7598744", "0.7520892", "0.7482...
0.7913716
7
This test is used to verify change password endpoint by passing invalid current password
def test_change_password_invalid_current_password(self): kwargs = {"current_password": self.test_args["invalid_current_password"], "return_response_obj": True, "return_failure_response": True} response = self.test_change_password_endpoint(**kwargs) print("Verify Response body"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_password(self):\n pass", "def test_password_change_provided(self):\n token = str((jwt.encode(\n {\"email\": \"bagendadeogracious@gmail.com\"}, \n settings.SECRET_KEY)).decode('utf-8')\n )\n self.client.post(self.registration_url, valid_user, form...
[ "0.8515729", "0.8488998", "0.83531064", "0.8282066", "0.8182565", "0.8080611", "0.8046905", "0.8040673", "0.78913337", "0.78832734", "0.7866185", "0.78522265", "0.7791602", "0.7790109", "0.77737576", "0.7746982", "0.7726434", "0.7724689", "0.77162486", "0.7663617", "0.7648244...
0.86620104
0
Load YAML config file
def _load_yaml_config(config_file): if type(config_file) is file: Config.CONFIG.update(yaml.load(config_file) or {}) return Config.CONFIG else: try: with open(config_file, 'r') as f: return yaml.load(f) except IOError as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(path):\n return yaml.load(open('config.yaml', 'r'), Loader=yaml.SafeLoader)", "def load_config():\n proj_dir = os.path.dirname(os.path.abspath(__file__))\n config_path = os.path.join(proj_dir, \"config.yml\")\n conf = yaml.safe_load(open(config_path))\n return conf", "def load_co...
[ "0.8168804", "0.8066424", "0.8012176", "0.799784", "0.7996935", "0.7977649", "0.7950955", "0.79488474", "0.7948729", "0.7938631", "0.78517526", "0.7830641", "0.7728726", "0.77236736", "0.7700356", "0.76859444", "0.7648791", "0.75909126", "0.75898683", "0.75895035", "0.7579526...
0.7453671
26
Returns node with the minimum value in the BST
def min(self): return self._min(self.root)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_min(self) -> TreeNode:\n node = self.root\n while True:\n if not node.left:\n return node\n node = node.left", "def find_min(self):\n return min(self.nodes, key=int)", "def find_smallest(node):\n smallest = node.value\n\n while no...
[ "0.8433944", "0.8191482", "0.8181227", "0.8165668", "0.80850726", "0.8017712", "0.7997986", "0.7962061", "0.795777", "0.7950276", "0.7946971", "0.79100764", "0.7875316", "0.7827737", "0.78173417", "0.7729374", "0.76871645", "0.76868963", "0.7670392", "0.7653884", "0.7625973",...
0.7777729
15
Returns node with the maximum value in the BST
def max(self): return self._max(self.root)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_maximum_value(self):\n if self.root: \n self.max_val = self.root.value\n else:\n return 'No tree found'\n def inner(root):\n if root.left:\n inner(root.left)\n\n if root.right:\n inner(root.right)\n\n if self.max_val < root.value:\n self.max_val = roo...
[ "0.86233157", "0.83441174", "0.82677275", "0.8265895", "0.81471795", "0.8060073", "0.805976", "0.8045105", "0.8042413", "0.7930072", "0.78824604", "0.77937746", "0.7761002", "0.773209", "0.7699632", "0.7663091", "0.7657293", "0.7596182", "0.7588312", "0.7581886", "0.7566499",...
0.7583785
19
Convert prior_boxes to (xmin, ymin, xmax, ymax) representation for comparison to point form ground truth data.
def point_form(boxes): return torch.cat((boxes[:, :2] - boxes[:, 2:]/2, # xmin, ymin boxes[:, :2] + boxes[:, 2:]/2), 1) # xmax, ymax
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_prior_boxes(self):\n # value of k for each feature map to create k^2 boxes for each feature map\n feature_map_dims = {'conv4_3': 38, 'conv7': 19, 'conv8_2': 10, 'conv9_2': 5}\n\n # scale for boxes across different feature maps. boxes for inner feature maps\n # are scaled much...
[ "0.6726663", "0.6653922", "0.6432989", "0.633271", "0.6246847", "0.6212919", "0.6060282", "0.5925352", "0.5917206", "0.5833656", "0.58164275", "0.58093137", "0.58093137", "0.5796058", "0.5778322", "0.576133", "0.57139504", "0.5711806", "0.56847596", "0.5669615", "0.564618", ...
0.6390835
3
Convert prior_boxes to (cx, cy, w, h) representation for comparion to centersize form ground truth data.
def center_size(boxes): return torch.cat([(boxes[:, :2] + boxes[:, 2:])/2, # cx, cy boxes[:, :2] - boxes[:, 2:]], 1) # w, h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_prior_boxes(self):\n # value of k for each feature map to create k^2 boxes for each feature map\n feature_map_dims = {'conv4_3': 38, 'conv7': 19, 'conv8_2': 10, 'conv9_2': 5}\n\n # scale for boxes across different feature maps. boxes for inner feature maps\n # are scaled much...
[ "0.7374022", "0.7326064", "0.6342216", "0.6257686", "0.62412053", "0.61695564", "0.61678135", "0.61265343", "0.61133426", "0.60963017", "0.6063608", "0.60421574", "0.6033133", "0.59699094", "0.58964854", "0.5884155", "0.58711904", "0.5870083", "0.58572745", "0.58516526", "0.5...
0.0
-1
Compute the jaccard overlap of twe sets of boxes. The jaccard overlap is simply the intersection over union of twe boxes. Here we operate on ground truth boxes and default boxes.
def jaccard(box_a, box_b): inter = intersect(box_a, box_b) area_a = ((box_a[:, ]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overlap_similarity(box, other_boxes):\n return jaccard(np.expand_dims(box, axis=0), other_boxes).squeeze(0)", "def find_jaccard_overlap(set_1, set_2, order='xyxy'):\n\n if order == 'xywh':\n set_1 = change_box_order(set_1, 'xywh2xyxy')\n set_2 = change_box_order(set_2, 'xywh2xyxy')\n\n ...
[ "0.68345183", "0.657788", "0.657788", "0.657739", "0.657739", "0.6550106", "0.6485113", "0.6426238", "0.6369778", "0.63132095", "0.63132095", "0.63132095", "0.6289972", "0.62888616", "0.62888616", "0.61993724", "0.61575437", "0.61359394", "0.61146283", "0.60713524", "0.60702"...
0.60367596
25
Test form_right_clipping_plane(). Use 4 points to fit the right clipping plane. In the camera coordinate frame, y is down the imager, x is across the imager, and z is along the optical axis. The focal length is the distance to the center
def test_right_clipping_plane() -> None: fx_px = 10.0 width_px = 30 pinhole_camera = _create_pinhole_camera( fx_px=fx_px, fy_px=0, cx_px=0, cy_px=0, height_px=30, width_px=width_px, cam_name="ring_front_center", ) right_plane = pinhole_camera.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_left_clipping_plane() -> None:\n fx_px = 10.0\n width_px = 30\n\n pinhole_camera = _create_pinhole_camera(\n fx_px=fx_px,\n fy_px=0,\n cx_px=0,\n cy_px=0,\n height_px=30,\n width_px=width_px,\n cam_name=\"ring_front_center\",\n )\n left_plane...
[ "0.70028496", "0.6992108", "0.6724239", "0.6661372", "0.6509162", "0.63045657", "0.6168998", "0.58504635", "0.58159643", "0.56910944", "0.56652755", "0.563311", "0.55804574", "0.5578635", "0.5539653", "0.5524319", "0.55084354", "0.55034214", "0.5502194", "0.54950863", "0.5474...
0.80956537
0
Ensure that the ray direction for each pixel (in camera coordinate frame) is computed correctly. Compare all computed rays against nonvectorized variant, for correctness. Larger scale test, for every pixel in a 50 x 100 px image in (height, width).
def test_compute_pixel_ray_directions_vectorized_entireimage() -> None: fx = 10 fy = 10 img_w = 100 img_h = 50 pinhole_camera = _create_pinhole_camera( fx_px=fx, fy_px=fy, cx_px=img_w / 2, cy_px=img_h / 2, height_px=img_h, width_px=img_w, cam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compute_pixel_rays() -> None:\n u = 12\n v = 2\n img_w = 20\n img_h = 10\n fx = 10\n fy = 10\n\n ray_dir = _compute_pixel_ray_direction(u, v, fx, fy, img_w, img_h)\n\n gt_ray_dir: NDArrayFloat = np.array([2.0, -3.0, 10.0])\n gt_ray_dir /= np.linalg.norm(gt_ray_dir)\n\n assert...
[ "0.725949", "0.66578966", "0.621776", "0.61876464", "0.522609", "0.52056795", "0.52053064", "0.5192967", "0.5142679", "0.51148987", "0.5074596", "0.50551766", "0.5017593", "0.50018764", "0.49879944", "0.496282", "0.49534547", "0.49372903", "0.49181724", "0.49146187", "0.49146...
0.7130783
1
Test reverse sigmoid for binary classifier.
def test_reverse_sigmoid_binary(self): (_, _), (x_test, _) = self.mnist classifier = get_image_classifier_kr_tf_binary() preds = classifier.predict(x_test[0:1]) postprocessor = ReverseSigmoid(beta=1.0, gamma=0.1) post_preds = postprocessor(preds=preds) classifier_predict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reverse_sigmoid_beta_binary(self):\n (_, _), (x_test, _) = self.mnist\n classifier = get_image_classifier_kr_tf_binary()\n preds = classifier.predict(x_test[0:1])\n postprocessor = ReverseSigmoid(beta=0.75, gamma=0.1)\n post_preds = postprocessor(preds=preds)\n\n ...
[ "0.78990364", "0.760895", "0.75331205", "0.74585223", "0.74484307", "0.699357", "0.6968584", "0.6935798", "0.6930077", "0.680307", "0.6727016", "0.66423", "0.6558688", "0.6543832", "0.652409", "0.6485436", "0.6471774", "0.6467463", "0.64494693", "0.6440559", "0.64106804", "...
0.8420727
0
Verify that a^y = a^r (a^secret)^c (mod p).
def verify(self, y): left = self.sgroup.exponentiate(self.a, y) right = (self.x * self.sgroup.exponentiate(self.b, self.c)) % self.sgroup.p is_ok = (left == right) return is_ok
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Verify(M, p, q, g, r, s, y, N):\n outlen = 512\n if( 0 < r < q and 0 < s < q):\n w = modularInverse(s, q)\n z = Hash(M) >> (outlen - N)\n u1 = z*w % q\n u2 = r*w % q\n v = (squareAndMultiply(g, u1, p) * squareAndMultiply(y, u2, p) % p) % q\n if(r == v):\n ...
[ "0.6196317", "0.61118704", "0.61078364", "0.5966074", "0.595295", "0.59299934", "0.5922854", "0.5917", "0.5915387", "0.5862844", "0.58382857", "0.58365726", "0.5820697", "0.58107007", "0.58041817", "0.58005756", "0.57852733", "0.5775942", "0.57718134", "0.57621175", "0.575625...
0.60875076
3
Creates and returns a CartoContext object to work with Panda Dataframes
def cc(self): # TODO: The CartoContext documentaton says that SSL must be disabled sometimes if an on # premise host is used. # We are not taking this into account. It would need to create a requests.Session() # object, set its SSL to false and pass it to the CartoContext init. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_dataframe(self, serie, metadata=None):\n header = self.get_data_header(serie, dataset='cnv')\n df = self.get_data_in_frame(serie, header, dataset='cnv')\n df = self.df_handler.map_column_names_of_dataframe(df)\n\n return df", "def run(self) -> DataFrame:\n with self....
[ "0.6026852", "0.5974217", "0.58925956", "0.5769029", "0.57194245", "0.56998223", "0.5542827", "0.5490549", "0.54387313", "0.54381967", "0.5422838", "0.5410168", "0.5399561", "0.5397757", "0.53658277", "0.5333152", "0.5244197", "0.5244039", "0.5242619", "0.5231892", "0.5188277...
0.5593443
6
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=True, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8193267", "0.80943453", "0.80284286", "0.8018051", "0.79932356", "0.79901975", "0.79797465", "0.79750663", "0.795993", "0.79564947", "0.79366505", "0.79336995", "0.7933488", "0.79303867", "0.79252106", "0.7923493", "0.7923058", "0.79224193", "0.79219115", "0.79209906", "0....
0.7883082
36
In the document itself we only store information for the words contained in the document, but we also need to be able to get a dict with all the words in it for ease of creating a matrix later
def get_full_word_dict(self, all_words): full_dict = dict(self.words) for word in all_words: if word not in full_dict: full_dict[word] = 0 return full_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_document(text):\n words = preprocess(text)\n postings = {}\n for word, ix in words:\n if word in postings:\n wordinfo = postings[word]\n else:\n wordinfo = {\"frequency\": 0, \"indexes\": []}\n postings[word] = wordinfo\n wordinfo[\"frequen...
[ "0.7167694", "0.711093", "0.70931387", "0.70122695", "0.7007467", "0.6901294", "0.6675801", "0.66325355", "0.6612295", "0.6589775", "0.6579378", "0.65563107", "0.6529008", "0.6500303", "0.6495014", "0.64451945", "0.64169616", "0.64067775", "0.6363871", "0.63599414", "0.634956...
0.0
-1
Return True iff this Event is equal to . Two events are equal iff they have the same timestamp.
def __eq__(self, other): return self.timestamp == other.timestamp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other: Event) -> bool:\n return self.timestamp == other.timestamp", "def __eq__(self, other):\n if self is other:\n return True\n elif type(self) != type(other):\n return False\n else:\n return self._start_time == other._start_time \\\...
[ "0.8605195", "0.7451189", "0.7438941", "0.73378026", "0.73249805", "0.7315657", "0.7178449", "0.717657", "0.71551526", "0.71209514", "0.7077555", "0.70606625", "0.70065", "0.68910795", "0.68679833", "0.6834845", "0.678818", "0.6762164", "0.6741362", "0.6740453", "0.6717907", ...
0.77249676
1
Return True iff this Event is not equal to .
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: Event) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other):\n if not isinstance(other, SafetyEvent):\n return True\n\n return self.to_dict() != other.to_dict()", "def __ne__(self, other):\n if not isinstance(other, EventType):\n ...
[ "0.88128227", "0.814215", "0.80395323", "0.73534673", "0.73293585", "0.73109776", "0.73001015", "0.72489184", "0.72489184", "0.7241441", "0.7238608", "0.7238608", "0.72373456", "0.72349524", "0.7233768", "0.7227581", "0.7219877" ]
0.0
-1
Return a string representation of this event.
def __str__(self): raise NotImplementedError("Implemented in a subclass")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self._event)", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self):\n return '{}'.format(self._...
[ "0.8760086", "0.7921973", "0.7921973", "0.7614405", "0.76137275", "0.7540913", "0.7464034", "0.7434992", "0.7398156", "0.7377259", "0.7130863", "0.7039281", "0.70127857", "0.69814324", "0.6976205", "0.6922966", "0.6910238", "0.69091386", "0.689699", "0.689699", "0.689699", ...
0.0
-1
Return a string representation of this event.
def __str__(self): return "{} -- {}: Request a driver".format(self.timestamp, self.rider.identifier)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self._event)", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self):\n return '{}'.format(self._...
[ "0.8760086", "0.7921973", "0.7921973", "0.7614405", "0.76137275", "0.7540913", "0.7464034", "0.7434992", "0.7398156", "0.7377259", "0.7130863", "0.7039281", "0.70127857", "0.69814324", "0.6976205", "0.6922966", "0.6910238", "0.69091386", "0.689699", "0.689699", "0.689699", ...
0.0
-1
Return a string representation of this event.
def __str__(self): return "{} -- {}: Request a rider".format(self.timestamp, self.driver.identifier)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self._event)", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self):\n return '{}'.format(self._...
[ "0.87605715", "0.79225385", "0.79225385", "0.7614253", "0.7614019", "0.75402796", "0.7464256", "0.74343187", "0.7398412", "0.73768336", "0.7131615", "0.7038698", "0.701129", "0.6979806", "0.6974554", "0.6924325", "0.69085896", "0.6907355", "0.6894737", "0.6894737", "0.6894737...
0.0
-1
Return a string representation of this event.
def __str__(self): return "{} -- {}: Cancel the request".format(self.timestamp, self.rider.identifier)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self._event)", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self):\n return '{}'.format(self._...
[ "0.87606734", "0.792234", "0.792234", "0.76142377", "0.7614173", "0.7540242", "0.74643946", "0.74345285", "0.73982257", "0.73766965", "0.7131568", "0.7039081", "0.7011566", "0.69796216", "0.69744706", "0.69244444", "0.690843", "0.6907243", "0.68947774", "0.68947774", "0.68947...
0.0
-1
Return a string representation of this event.
def __str__(self): return "{} -- {}: Pick up {}".format(self.timestamp, self.driver.identifier, self.rider.identifier)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self._event)", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self):\n return '{}'.format(self._...
[ "0.8760086", "0.7921973", "0.7921973", "0.7614405", "0.76137275", "0.7540913", "0.7464034", "0.7434992", "0.7398156", "0.7377259", "0.7130863", "0.7039281", "0.70127857", "0.69814324", "0.6976205", "0.6922966", "0.6910238", "0.69091386", "0.689699", "0.689699", "0.689699", ...
0.0
-1
Return a string representation of this event.
def __str__(self): return "{} -- {}: Drop off {}".format(self.timestamp, self.driver.identifier, self.rider.identifier)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self._event)", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self) -> str:\n return f\"tcod.event.{self.__class__.__name__}.{self.name}\"", "def __repr__(self):\n return '{}'.format(self._...
[ "0.87605715", "0.79225385", "0.79225385", "0.7614253", "0.7614019", "0.75402796", "0.7464256", "0.74343187", "0.7398412", "0.73768336", "0.7131615", "0.7038698", "0.701129", "0.6979806", "0.6974554", "0.6924325", "0.69085896", "0.6907355", "0.6894737", "0.6894737", "0.6894737...
0.0
-1
Get the queryset. Since we want to enable aid preview, we have special cases depending
def get_queryset(self): category_qs = Category.objects \ .select_related('theme') \ .order_by('theme__name', 'name') base_qs = Aid.objects \ .select_related('perimeter', 'author') \ .prefetch_related('financers', 'instructors') \ .prefetch_rel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self, request, queryset):\n\n return queryset", "def get_queryset(self):\n return None", "def get_queryset(self):\n return None", "def get_queryset(self):\n if self.queryset is None:\n return self.model.objects.all()\n return self.queryset", "d...
[ "0.726463", "0.71866924", "0.71866924", "0.70888424", "0.7072873", "0.70642406", "0.6984934", "0.6984729", "0.695602", "0.69309545", "0.6923369", "0.6913429", "0.68478334", "0.6846613", "0.68347883", "0.68238026", "0.6805389", "0.67947704", "0.6745639", "0.67407197", "0.67284...
0.69157547
11
Gets the sample_rate of this DiarizeAudio. Sample rate of the audio file.
def sample_rate(self): return self._sample_rate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sampling_rate(self):\n with audioread.audio_open(self.path) as f:\n return f.samplerate", "def sample_rate(self, sr=None):\n return self._sample_rate", "def samplerate(self):\n return self.sound.samplerate", "def sampling_rate(self):\n return self.track.sampling_rat...
[ "0.85575104", "0.7629647", "0.758621", "0.7480864", "0.7480175", "0.73027724", "0.72383213", "0.7195255", "0.7056587", "0.7033708", "0.7027626", "0.7008648", "0.7001884", "0.6976768", "0.69524306", "0.69495827", "0.6908444", "0.6689346", "0.66129386", "0.6601145", "0.6528635"...
0.78369594
2
Gets the language_code of this DiarizeAudio. Language spoken in the audio file.
def language_code(self): return self._language_code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def language_code(self) -> str:\n return pulumi.get(self, \"language_code\")", "def audio_language(self):\n # type: () -> string_types\n return self._audio_language", "def language(self) -> str:\n if self.language_code in CODE_TO_LANGUAGE:\n return CODE_TO_LANGUAGE[self.l...
[ "0.77740663", "0.77326375", "0.76588917", "0.74462914", "0.7398473", "0.727751", "0.726176", "0.726176", "0.726176", "0.726176", "0.7199617", "0.7196284", "0.7178778", "0.7178778", "0.71396863", "0.70835274", "0.70835274", "0.7042694", "0.70426714", "0.7040953", "0.70409405",...
0.77795273
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, DiarizeAudio): 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.808826", "0.808826", "0.8054592", "0.79827315", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "...
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
Finds the channel id of the given channel name. Returns a channel ID in str format.
def find_channel_id(self, channel_name): if not channel_name: raise AttributeError(f"{self.find_channel_id.__name__}: Channel ID or Channel Name not given") for channel in self.channels: if channel_name == channel['name']: return channel['id'] raise NameE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_channel_id(self, channel_name):\n if self.team_id is None:\n raise RuntimeError(\"Please set team_id before calling\"\n \"get_channel_id\")\n channels = []\n i = 0\n ch = self.get_channels()\n while ch:\n channels.extend...
[ "0.78945357", "0.77928394", "0.76928824", "0.7528464", "0.72845674", "0.72845674", "0.72845674", "0.72845674", "0.7082955", "0.6877657", "0.68703485", "0.6846514", "0.67728543", "0.67431206", "0.66902554", "0.6677634", "0.66003025", "0.66003025", "0.66003025", "0.66003025", "...
0.8211297
0
Delete messages generated by any bot
def delete_bot_messages(self, channel_name=None, channel_id=None): self.delete_messages( channel_name=channel_name, channel_id=channel_id, confirmation_override=True, restrict={'type': 'subtype', 'values': ['bot_message']} )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def delete_bot_msg(self, channel):\n await channel.purge(limit=100, check=self.is_me)", "def delete(bot, message_id, chat_id):\n\n bot.delete_message(chat_id, message_id)", "def delete(self):\n for i, message in enumerate(self.owner.messages):\n if message == self.body:\n ...
[ "0.7780338", "0.766387", "0.7496178", "0.72341657", "0.7114733", "0.70645875", "0.7053617", "0.6977062", "0.6874578", "0.68496853", "0.68484", "0.6779448", "0.67624426", "0.67098045", "0.6693621", "0.66767555", "0.6667951", "0.6657434", "0.6642479", "0.6642452", "0.6636642", ...
0.7089851
5
Given the ip string is 127.0.0.1 When testing ip_str_is_valid Then validity is True
def test_localhost_is_valid(self): val = gnome.gh.EventSourceValidator() validity = val.ip_str_is_valid('127.0.0.1') self.assertTrue(validity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_ipaddress(str_ip: str) -> bool:\n try:\n ipaddress.ip_address(str_ip)\n return True\n except ValueError:\n return False", "def is_valid_ip(ip):\n ...", "def valid_ip(ip_addr):\n try:\n inet_aton(ip_addr)\n return True\n\n except error:\n ret...
[ "0.83980674", "0.80797416", "0.7858158", "0.7715801", "0.76552", "0.7644597", "0.7590711", "0.7550455", "0.7507537", "0.7504932", "0.743212", "0.7431319", "0.7418083", "0.7413053", "0.74031454", "0.7347391", "0.73068506", "0.7261161", "0.72592837", "0.7256984", "0.7214293", ...
0.74725926
10
Given the ip string is valid When testing ip_str_is_valid Then validity is True
def test_good_addresses_are_valid(self): val = gnome.gh.EventSourceValidator() for addr in GOOD_MOCK_ADDRESSES: validity = val.ip_str_is_valid(addr) self.assertTrue(validity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_ipaddress(str_ip: str) -> bool:\n try:\n ipaddress.ip_address(str_ip)\n return True\n except ValueError:\n return False", "def is_valid_ip(ip):\n ...", "def test_re_ip(self, ip_address: str, is_valid_ip: bool):\n self.assertEqual(bool(re_ip.search(ip_address)),...
[ "0.85545254", "0.80473465", "0.80222505", "0.7788867", "0.7767202", "0.7647142", "0.7609007", "0.7567017", "0.7559222", "0.7557896", "0.7526455", "0.7493877", "0.74845773", "0.74712473", "0.7468627", "0.74335146", "0.7423984", "0.73761994", "0.726248", "0.7207197", "0.7196224...
0.654953
55
Given the ip string is not valid When testing ip_str_is_valid Then validity is False
def test_bad_addresses_are_invalid(self): val = gnome.gh.EventSourceValidator() for addr in BAD_MOCK_ADDRESSES: validity = val.ip_str_is_valid(addr) self.assertFalse(validity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_ipaddress(str_ip: str) -> bool:\n try:\n ipaddress.ip_address(str_ip)\n return True\n except ValueError:\n return False", "def is_valid_ip(ip):\n ...", "def test_re_ip(self, ip_address: str, is_valid_ip: bool):\n self.assertEqual(bool(re_ip.search(ip_address)),...
[ "0.84212345", "0.7908629", "0.7846345", "0.7613299", "0.7599163", "0.75588775", "0.7533539", "0.74877214", "0.74761754", "0.74393827", "0.7374914", "0.73662376", "0.7366006", "0.73492956", "0.7348403", "0.7346533", "0.73458296", "0.72802514", "0.72390854", "0.7180324", "0.712...
0.66268235
48
Given the milestone does not exist When I call repo.ensure_milestone_exists Then a new milestone is created
def test_creates_milestone_if_not_exist(self): repo = gnome.gh.repo_from_callback(MockCallback()) repo.milestone_exists = MagicMock(return_value=False) repo.create_milestone = MagicMock() repo.ensure_milestone_exists('foo') repo.create_milestone.assert_called()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_issue_create_milestone(self):\n pass", "def test_false_if_milestone_not_exists(self):\n repo = gnome.gh.repo_from_callback(MockCallback())\n repo._milestones = (MockFooMilestoneWrapper(),)\n self.assertFalse(repo.milestone_exists('bar'))", "def test_true_if_milestone_exists...
[ "0.7710748", "0.766045", "0.7627024", "0.7617671", "0.745573", "0.7440926", "0.7257685", "0.7112544", "0.7103778", "0.69653094", "0.6903944", "0.6743343", "0.65183854", "0.6457748", "0.63489753", "0.6290784", "0.610689", "0.60893166", "0.58880687", "0.58703375", "0.5862941", ...
0.79421127
0
Given a malestone already has a specified due date When I call repo.ensure_milestone_has_due_date Then the due date is not updated
def test_do_nothing_if_date_OK(self): DATE = '2012-10-09T23:39:01Z' repo = gnome.gh.repo_from_callback(MockCallback()) repo.milestone_exists = MagicMock(return_value=True) mm = gnome.gh.Milestone('some/repo', '_milestone') mm.get_due_date = MagicMock(return_value=DATE) m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_if_wrong_date(self):\n DATE = '2012-10-09T23:39:01Z'\n WRONG_DATE = '2030-10-09T23:39:01Z'\n repo = gnome.gh.repo_from_callback(MockCallback())\n repo.milestone_exists = MagicMock(return_value=True)\n mm = gnome.gh.Milestone('some/repo', '_milestone')\n mm....
[ "0.77602226", "0.74205506", "0.7200938", "0.69586426", "0.6744125", "0.661255", "0.65505385", "0.646638", "0.6348943", "0.62677795", "0.6183409", "0.6156582", "0.6140203", "0.600472", "0.59503156", "0.5905819", "0.59007436", "0.58876324", "0.5866793", "0.5855363", "0.57928056...
0.74818784
1
Given a milestone exists with a due date And the due date is not the specified due date When I call repo.ensure_milestone_has_due_date Then the due date is updated
def test_update_if_wrong_date(self): DATE = '2012-10-09T23:39:01Z' WRONG_DATE = '2030-10-09T23:39:01Z' repo = gnome.gh.repo_from_callback(MockCallback()) repo.milestone_exists = MagicMock(return_value=True) mm = gnome.gh.Milestone('some/repo', '_milestone') mm.get_due_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_do_nothing_if_date_OK(self):\n DATE = '2012-10-09T23:39:01Z'\n repo = gnome.gh.repo_from_callback(MockCallback())\n repo.milestone_exists = MagicMock(return_value=True)\n mm = gnome.gh.Milestone('some/repo', '_milestone')\n mm.get_due_date = MagicMock(return_value=DATE)...
[ "0.7672749", "0.7636564", "0.7391658", "0.7126366", "0.6833399", "0.66380584", "0.65008646", "0.6181164", "0.6152323", "0.6123797", "0.6035817", "0.5970235", "0.59584934", "0.58637094", "0.5783218", "0.57732266", "0.57675564", "0.57532823", "0.57521147", "0.57211685", "0.5714...
0.79526496
0
Given a milestone, when I call repo.create_milestone; idempotency.
def test_do_nothing_if_already_exists(self): # I call that Haiku "then nothing happens" repo = gnome.gh.repo_from_callback(MockCallback()) repo._milestones = (MockFooMilestoneWrapper(),) create_milestone_mock = MagicMock() repo._repo.create_milestone = create_milestone_mock ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_issue_create_milestone(self):\n pass", "def test_creates_milestone_if_not_exist(self):\n repo = gnome.gh.repo_from_callback(MockCallback())\n repo.milestone_exists = MagicMock(return_value=False)\n repo.create_milestone = MagicMock()\n repo.ensure_milestone_exists('foo...
[ "0.79608655", "0.6963737", "0.6761919", "0.67429", "0.6681787", "0.6630424", "0.6572352", "0.6553374", "0.648948", "0.63352513", "0.6325548", "0.629504", "0.6290621", "0.6201444", "0.60996014", "0.60572934", "0.60470885", "0.60196316", "0.60124946", "0.59155345", "0.5881283",...
0.6469897
9
Given I have a valid callback payload When I initiate a Milestone Then no errors are raised
def test_repo_validation(self): repo = gnome.gh.repo_from_callback(MockCallback()) repo._repo.create_milestone = MagicMock() gh_milestone = MockMilestoneFoo() try: mlstn = gnome.gh.Milestone(repo, gh_milestone) was_error = False except: was_err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_issue_create_milestone(self):\n pass", "def test_true_if_milestone_exists(self):\n repo = gnome.gh.repo_from_callback(MockCallback())\n repo._milestones = (MockFooMilestoneWrapper(),)\n self.assertTrue(repo.milestone_exists('foo'))", "def on_milestone(self, payload):\n ...
[ "0.6447205", "0.61837476", "0.60797346", "0.5923869", "0.58718747", "0.58694124", "0.5819093", "0.5789703", "0.5783767", "0.5751128", "0.57165015", "0.56623805", "0.56358165", "0.56259555", "0.56120163", "0.56016225", "0.55688924", "0.5555831", "0.551793", "0.55048764", "0.54...
0.66486484
0
Returns a copy of the fuzzy instance Returns Union[list, dict] A copy of the fuzzy instance
def copy(self) -> AF: if self._base == OrderedDict: kopied = dict(self) else: kopied = self._base.copy(self) return self.__class__(kopied, use_fuzzy=self.use_fuzzy, dottable=self._dottable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return udict(self)", "def __iter__(self) -> 'Dictionary':\n return copy.deepcopy(self)", "def copy(self):\n return defaultdict.copy(self)", "def to_original(self) -> Union[list, dict]:\n return self._base(self)", "def __init__(self, cutoff: float = 0.6):\r\n ...
[ "0.5589884", "0.55804646", "0.55547327", "0.5540765", "0.54704154", "0.5377071", "0.5309006", "0.5291203", "0.52695376", "0.5240639", "0.52266026", "0.5219126", "0.5208229", "0.51648337", "0.5159458", "0.5122366", "0.50988287", "0.5051912", "0.50502396", "0.50452906", "0.5026...
0.58321214
0
Offspring list should be a list of tuples (parent_a, offspring, parent_b), where parent_b is optional. Result will be in [0,100]. 0 is equivalent to random oversampling, 100 is maximum dissimilarity.
def diversion_score(X, offspring_list): similarity_sum = 0 if len(offspring_list[0]) == 2: offspring_list = [(parent_a, offspring, parent_a) for (parent_a, offspring) in offspring_list] for (parent_a, offspring, parent_b) in offspring_list: similarity_sum += max(icc(parent_a, offspring)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_offspring(self):\n parents = self._select_parents()\n offspring = self._crossover(*parents)\n if (random.uniform(0, 1) < self.mutation_rate):\n self._mutate(offspring)\n return offspring", "def create_offspring_min(population, parent_sel, tsp, num_offspring):\n ...
[ "0.6604597", "0.6543342", "0.5939163", "0.58297104", "0.5808753", "0.5794668", "0.5737248", "0.56576973", "0.56217694", "0.5550536", "0.55129933", "0.5503283", "0.55004895", "0.5497907", "0.5479645", "0.5471308", "0.5470691", "0.54491854", "0.5423416", "0.54137176", "0.540637...
0.5392727
21
Return a friendly HTTP greeting.
def hello(): return 'Hello World!'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_greeting(name):\n\n greeting = (f\"Hello, {name.title()}. It's nice to meet you!\")\n return greeting", "def welcome():\n return 'Welcome to Flask!'", "def greeting_message(name):\n print('My name is ' + name)", "def Welcome():\n return (\n f\"Welcome to the Surf's Up API!\...
[ "0.6785658", "0.6718835", "0.67086893", "0.66817635", "0.6662773", "0.6637097", "0.6633533", "0.66266304", "0.6556931", "0.65360993", "0.64784324", "0.64777356", "0.64686126", "0.64640325", "0.6443602", "0.6435352", "0.640118", "0.64006835", "0.6374869", "0.6374869", "0.63681...
0.0
-1
Unsigned right shift operator
def rshift(val: int, n: int) -> int: return (val % 0x100000000) >> n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _right_shift_scalar(x, y):\n return inner.bit_right_shift(x, y)", "def __rshift__(self, other):\r\n # TODO: extend to secret offset\r\n if not isinstance(other, int):\r\n return NotImplemented\r\n\r\n return self.__floordiv__(1<<other)", "def ROL(byte, count):\n return (...
[ "0.71998733", "0.69719565", "0.6742955", "0.67332065", "0.67332065", "0.67275214", "0.67081684", "0.6685824", "0.6636615", "0.6626784", "0.6617559", "0.66112953", "0.6558842", "0.6531386", "0.6514137", "0.64463454", "0.61896306", "0.6106762", "0.6084897", "0.6010447", "0.5976...
0.6484917
15
Initialize hallucinated model by default.
def default( cls, environment, base_model=None, model_kind="dynamics", transformations=None, *args, **kwargs, ): if transformations is None: # hallucinated_scale = np.concatenate( # (environment.action_scale, np.ones(env...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model(self):\n pass", "def init_model(self):\n pass", "def initialize(self, model):\n pass", "def initialize(self):\n\n # --------- BEGIN YOUR CODE ----------\n\n # This is exactly the same as Human.initialize, just copy the code over\n\n # --------- E...
[ "0.7765978", "0.75678986", "0.7447622", "0.67837715", "0.6748732", "0.6748732", "0.67332536", "0.66250724", "0.6538347", "0.65050733", "0.6500862", "0.64593184", "0.6448302", "0.6447082", "0.6436469", "0.6401808", "0.63941073", "0.6373198", "0.6371562", "0.6363391", "0.636339...
0.0
-1
Test that issues are omitted when severity does not match.
def test_obtain_issues_exclude_wrong_severity(self, mock_url_read): mock_url_read.side_effect = [LAST_SCAN, '{"reportId": 22}', '{"status": {"value": "Created"}}', SAST_REPORT.format(false_positive=False, severity='Low')] self.__report.obtain_issues(['id'], 'high') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_severity_remove_error_bad_severity(self):\n test_name = sys._getframe().f_code.co_name\n rv, output = self._execute('severity remove bad_severity')\n self.assertEqual(2, rv)\n self.assertEqual(self.expected_results[test_name], output)", "def test_severity_order_error_bad_seve...
[ "0.67255086", "0.6670507", "0.66348845", "0.61109936", "0.589228", "0.587225", "0.5809899", "0.580242", "0.57801867", "0.57800055", "0.577609", "0.5771563", "0.5762748", "0.5716014", "0.57057106", "0.57042366", "0.56757283", "0.5672432", "0.5657414", "0.56401885", "0.5631925"...
0.68441534
0
Test if a number is a odd number using bit operator.
def is_odd_faster(number: int) -> bool: return number & 1 != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_odd(n):\n return n & 1", "def is_odd(x):\n\n return (x & 1) == 1", "def is_odd(number):\r\n return number % 2 != 0", "def is_even(x):\n\n return (x & 1) == 0", "def __odd_or_even(number):\n if(number % 2) == 0:\n return 0\n else:\n return 1", "def is_odd(number):\n ...
[ "0.8603087", "0.8428876", "0.8192449", "0.8111147", "0.8070046", "0.8060643", "0.80580163", "0.79892653", "0.7944483", "0.77504367", "0.77473146", "0.77392644", "0.76711553", "0.7618814", "0.7355893", "0.7334817", "0.7331323", "0.73193866", "0.729272", "0.7284692", "0.7242756...
0.8109838
4
Factory method to instantiate a `File` bypassing the `Media` wrapper.
def from_dataset( cls, ds: pycldf.Dataset, row_or_object: typing.Union[dict, orm.Media]) -> 'File': return cls( MediaTable(ds), row_or_object.data if isinstance(row_or_object, orm.Media) else row_or_object)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_file_factory(name, size=None, url=None, path=None):\n mock_file = mock.MagicMock(spec=FieldFile)\n mock_file._committed = True\n mock_file.file_name = name\n mock_file.name = name\n mock_file.base_name = os.path.splitext(name)[0]\n mock_file.__unicode__.return_value = name\n\n def __e...
[ "0.6558845", "0.6530003", "0.6512259", "0.6489726", "0.630012", "0.620555", "0.61910844", "0.61793584", "0.61793584", "0.61634773", "0.6150061", "0.6088523", "0.60425526", "0.59462607", "0.5944848", "0.59270185", "0.589444", "0.5893154", "0.5870454", "0.584857", "0.5829126", ...
0.55791074
38
Returns a list of leaf nodes in the RTree. Note that RTree nodes are simply containers for child entries, which contain the actual data. If you want to get the actual data elements, you probably want to use get_leaf_entries instead.
def get_leaves(self) -> List[RTreeNode[T]]: leaves = [] fn = partial(_append_if_leaf, leaves) # noinspection PyTypeChecker self.traverse_level_order(fn) return leaves
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_leaf_nodes(self):\n leaf_nodes = []\n for i in range(8):\n node = self.children[i]\n if node:\n if node.is_leaf():\n leaf_nodes.append(node)\n else:\n leaf_nodes.extend(node.get_leaf_nodes())\n re...
[ "0.79662937", "0.7822224", "0.77706593", "0.7601358", "0.75453776", "0.74101144", "0.7348666", "0.72657436", "0.717363", "0.7075963", "0.7060972", "0.68969953", "0.6876006", "0.6851262", "0.68333286", "0.6822573", "0.6669306", "0.66495156", "0.6642721", "0.6601206", "0.658904...
0.75679785
4
Returns an iterable of the leaf entries in the RTree which contain the data.
def get_leaf_entries(self) -> Iterable[RTreeEntry[T]]: for leaf in self.get_leaves(): for entry in leaf.entries: yield entry
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_leaf(self):\n for elem in self[1:]:\n if isinstance(elem, Tree):\n for elem2 in elem.iter_leaf:\n yield elem2\n else:\n yield elem", "def get_leafs(self) -> list:\n return self._leafs[:]", "def leaf_nodes(self, data=T...
[ "0.71633124", "0.706189", "0.6944471", "0.69087213", "0.68963164", "0.6799614", "0.6784264", "0.670551", "0.66650796", "0.6600624", "0.6592839", "0.65850675", "0.6518744", "0.64899933", "0.64844227", "0.64480126", "0.64329004", "0.64218956", "0.6354724", "0.6352588", "0.63185...
0.7920885
0
Return a copy of my_dict with only the given keys.
def select_keys(my_dict: Dict, keys: Sequence) -> Dict: keyset = set(keys) return {k: v for k, v in my_dict.items() if k in keyset}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only_some_keys(dic, *keys):\n ret = {}\n for key in keys:\n ret[key] = dic[key] # Raises KeyError.\n return ret", "def _filter_keys(d: dict, keys: set) -> dict:\n return {key: d[key] for key in keys if key in d}", "def exclude_keys(dictionary: Mapping, keys: Sequence[Hashable]) -> ...
[ "0.7236426", "0.7121861", "0.71005243", "0.6947047", "0.69264513", "0.68991506", "0.68243486", "0.6748393", "0.6746759", "0.67436665", "0.6715544", "0.6697055", "0.6685839", "0.6666035", "0.6651076", "0.65436476", "0.6532411", "0.6493947", "0.64548147", "0.6387798", "0.632481...
0.73262054
0
Return first value from the given dictionary.
def dict_first(my_dict: Dict) -> Any: return list(my_dict.values())[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_entity_value(entities, entity):\n if entity not in entities:\n return None\n val = entities[entity][0]['value']\n if not val:\n return None\n return val['value'] if isinstance(val, dict) else val", "def first(data, key):\n for i in data:\n if key(i):\n ...
[ "0.73396343", "0.706079", "0.6960734", "0.69362134", "0.6895504", "0.6859315", "0.6812511", "0.67927915", "0.6728435", "0.6630065", "0.6630065", "0.6630065", "0.6630065", "0.6603006", "0.6569779", "0.65552396", "0.6452988", "0.6452959", "0.6446777", "0.64249283", "0.63708454"...
0.82724667
0
Enable the mock, printed output will be available through .getvalue
def enable(self): self.out = StringIO() self._stdout = sys.stdout sys.stdout = self.out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_output_block():\n return Mock()", "def setUp(self):\n self.actualstdout = sys.stdout\n sys.stdout = StringIO.StringIO()", "def setUp(self):\n\t\tself.output = self.switchstdout()", "def test_export_custom(self): # pylint: disable=no-self-use\n mock_record_str = Mock(str)\...
[ "0.6419308", "0.62958485", "0.62358326", "0.6006155", "0.59824055", "0.59554476", "0.5940539", "0.59085524", "0.58610404", "0.5860603", "0.58394444", "0.5815543", "0.58014065", "0.5756926", "0.5756536", "0.573307", "0.57268435", "0.5669715", "0.5667333", "0.565613", "0.565436...
0.6574138
0
Initialize the model by setting up the layers.
def __init__(self): super(biLSTM, self).__init__() # Words self.embedding = nn.Embedding(config.VOCAB, config.EMBED_DIM) self.embedding.shape = torch.Tensor(config.BATCH_SIZE, 5*config.EMBED_DIM) self.lstm_words = nn.LSTM(5*config.EMBED_DIM, config.HIDDEN_DIM, num_layer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_layers(self):\n self._init_predictor()\n if self.use_edge_fusion:\n self._init_edge_module()", "def initialisation(self):\n self.create_variables()\n self.create_placeholders()\n self.build_model()\n self.reset_lr(None, True)\n self.build_loss...
[ "0.7877656", "0.740135", "0.73939556", "0.73799825", "0.72304994", "0.72242755", "0.7183698", "0.7181406", "0.7175707", "0.71491647", "0.70773673", "0.70694804", "0.7036073", "0.70194495", "0.7018242", "0.69936645", "0.6969751", "0.6949472", "0.69274527", "0.6899944", "0.6853...
0.0
-1
render the template for the entire main index
def main_index_template(links: List[Link], finished: bool=True, template: str=MAIN_INDEX_TEMPLATE) -> str: return render_legacy_template(template, { 'version': VERSION, 'git_sha': GIT_SHA, 'num_links': str(len(links)), 'status': 'finished' if finished else 'running', 'date_u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self):\n return render_template('main/index.html')", "def index(self):\n\t\treturn render_template('index.html')", "def index():\n return render_template('0-index.html')", "def index():\r\n return render_template('index.html')", "def index(self) -> HTMLBody:\n\t\treturn rende...
[ "0.8672477", "0.8532363", "0.8284499", "0.8260605", "0.822163", "0.821161", "0.8121039", "0.8110467", "0.8110467", "0.8103265", "0.8102184", "0.8102184", "0.8088343", "0.8088343", "0.80405676", "0.80137557", "0.80137557", "0.80137557", "0.80137557", "0.80137557", "0.80137557"...
0.0
-1
Evaluates to True only if the subject has a referral instance with a referral code to avoid exporting locator information on someone who is not yet been referred.
def ready_to_export_transaction(self): try: SubjectReferral = models.get_model('bcpp_subject', 'subjectreferral') subject_referral = SubjectReferral.objects.get(subject_visit=self.subject_visit) if subject_referral.referral_code: return True except Sub...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accepting_referral_patients(self):\n return self._accepting_referral_patients", "def ref_known_flag(self):\n if CredentialApplication.objects.filter(\n reference_email__iexact=self.reference_email,\n reference_contact_datetime__isnull=False).exclude(\n ...
[ "0.6175379", "0.6041582", "0.5941692", "0.5861591", "0.57034063", "0.5561761", "0.5513164", "0.54298824", "0.5372512", "0.5334468", "0.53260505", "0.52954566", "0.5240541", "0.5181526", "0.5170337", "0.51694036", "0.516801", "0.51543057", "0.5149848", "0.51485145", "0.5103085...
0.64402753
0
For each path in ``paths``, yield each of its continuous subpaths. If a subpath appears in multiple paths, it will be yielded only once.
def unique_split_paths(paths): seen_paths = set() for path in paths: splits = path.split(".") split_length = len(splits) for i in xrange(1, split_length + 1): join = ".".join(splits[:i]) if join not in seen_paths: seen_paths.add(join) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _walk_paths(self, paths):\r\n for path in sorted(paths):\r\n if os.path.isdir(path):\r\n for dir_name, _, filenames in sorted(os.walk(path)):\r\n for filename in filenames:\r\n filename = os.path.join(dir_name, filename)\r\n yield os.path.relpath(filename, path), f...
[ "0.67101735", "0.65846455", "0.6527582", "0.62891436", "0.6266062", "0.6181241", "0.6145993", "0.61155343", "0.5946886", "0.5885951", "0.58676374", "0.58649844", "0.58606076", "0.58426374", "0.58377975", "0.58375734", "0.5799647", "0.5789534", "0.57820004", "0.577701", "0.572...
0.66211045
1
Show image and mask
def show_mask(image, mask): plt.subplot(1,2,1) plt.title('image') plt.imshow(image) plt.subplot(1,2,2) plt.title('mask') plt.imshow(mask) plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_image(self, mask=np.ones((32, 32), dtype=bool)):\n image = np.copy(self.__image)\n image[~mask] = 0\n plt.imshow(image, aspect=\"auto\")\n plt.show()", "def display(self, raw_img=True):\n cv2.imshow('mask', self.__mask)\n if raw_img:\n cv2.imshow('raw...
[ "0.79815054", "0.7675059", "0.75897855", "0.7151778", "0.7057993", "0.6985492", "0.6928993", "0.6910137", "0.6870259", "0.68673766", "0.67836076", "0.6773023", "0.6770777", "0.672948", "0.67251325", "0.67230326", "0.6719405", "0.668861", "0.66885364", "0.6680464", "0.6680058"...
0.8337113
0
Sets up User for every test
def setUp(self): self.place = Place()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n\n self.user_1 = User.objects.create_user(\n first_name=\"John\",\n last_name=\"Kenedy\",\n username=\"johnny\",\n password=\"Phrase908\",\n email=\"johnny@gmail.com\",\n )\n self.user_2 = User.objects.create_user(\n ...
[ "0.8490846", "0.8310915", "0.8294649", "0.82900846", "0.8267219", "0.8267085", "0.8242975", "0.8239721", "0.8231389", "0.82086176", "0.81774026", "0.8175148", "0.8164746", "0.8154354", "0.81538707", "0.80955994", "0.8086286", "0.8082901", "0.8052457", "0.80480516", "0.8048051...
0.0
-1
Return True if the given word is isogram, else return False
def is_isogram(word): word = [char.lower() for char in word if char.isalpha()] for char in word: if word.count(char) > 1: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_isogram(s):\n return len(s) == len(set(s.lower()))", "def is_isogram(string) -> bool:\n\n clean_string = ''.join(char.lower()\n for char in string\n if char not in [' ', '-'])\n for char in clean_string:\n if clean_string.count(char) > 1:...
[ "0.7393521", "0.7320594", "0.7164876", "0.70053095", "0.69800115", "0.69224507", "0.65922606", "0.6505847", "0.6485036", "0.64451647", "0.64428127", "0.6417361", "0.6409973", "0.6353182", "0.6335794", "0.6311961", "0.62835467", "0.6265405", "0.6251391", "0.6198926", "0.619134...
0.82826686
0
Derivative of penalty function at signed distance d
def gPenalty(d): return -1/(d+0.2)**2 if d > -0.1 else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_gradient_penalty_dra(D, X):\n # Random weight term for interpolation\n alpha = Tensor(np.random.random(size=X.shape))\n\n interpolates = alpha * X + \\\n ((1 - alpha) * (X + 0.5 * X.std() * torch.rand(X.size()).cuda()))\n interpolates = Variable(interpolates, requires_grad=True)\n\n ...
[ "0.67249644", "0.65796465", "0.65788347", "0.6508573", "0.64842063", "0.6454683", "0.6432639", "0.6338636", "0.62835574", "0.6279349", "0.6264606", "0.62619257", "0.6242987", "0.62063235", "0.61714613", "0.6166012", "0.61608636", "0.6135637", "0.6084165", "0.6071399", "0.6070...
0.67943496
0
Add a solid to the environment dictionary
def add_solid(self, solid_name): return self.__add_solid(solid_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add_solid(self, solid_name, chk_dict=None):\n if self._solid_name_check(solid_name, chk_dict=chk_dict) == EnvironmentDict._VALID:\n if chk_dict is None:\n chk_dict = self._e_dict\n chk_dict['solids'][solid_name] = {}\n return self", "def add_composite_soli...
[ "0.71929383", "0.61194015", "0.6014379", "0.5917399", "0.5798238", "0.5767467", "0.56309277", "0.5564688", "0.5500625", "0.5454283", "0.5385326", "0.5317856", "0.52489984", "0.5232812", "0.52111936", "0.5202245", "0.5170851", "0.5153372", "0.5101543", "0.50994664", "0.5084666...
0.597575
3
Add a solid to the environment dictionary
def __add_solid(self, solid_name, chk_dict=None): if self._solid_name_check(solid_name, chk_dict=chk_dict) == EnvironmentDict._VALID: if chk_dict is None: chk_dict = self._e_dict chk_dict['solids'][solid_name] = {} return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_composite_solid(self, solid_name, child_solid_name):\n # add_composite_solid('load_cereals', 'read_cereals')\n # results in\n # environment_dict = {\n # 'solids': {\n # 'load_cereals': {\n # 'solids': {\n # 'read_csv':...
[ "0.61194015", "0.6014379", "0.597575", "0.5917399", "0.5798238", "0.5767467", "0.56309277", "0.5564688", "0.5500625", "0.5454283", "0.5385326", "0.5317856", "0.52489984", "0.5232812", "0.52111936", "0.5202245", "0.5170851", "0.5153372", "0.5101543", "0.50994664", "0.50846666"...
0.71929383
0
Add a composite solid to the environment dictionary
def add_composite_solid(self, solid_name, child_solid_name): # add_composite_solid('load_cereals', 'read_cereals') # results in # environment_dict = { # 'solids': { # 'load_cereals': { # 'solids': { # 'read_csv': {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add_solid(self, solid_name, chk_dict=None):\n if self._solid_name_check(solid_name, chk_dict=chk_dict) == EnvironmentDict._VALID:\n if chk_dict is None:\n chk_dict = self._e_dict\n chk_dict['solids'][solid_name] = {}\n return self", "def add_composite_soli...
[ "0.67898226", "0.653966", "0.61502546", "0.58715105", "0.5857697", "0.5254307", "0.52406853", "0.5232969", "0.5219034", "0.5204596", "0.51328", "0.51290596", "0.5119428", "0.5106272", "0.5086297", "0.5086297", "0.50430673", "0.50329405", "0.50126684", "0.49949488", "0.4984710...
0.7221303
0
Read a JSON file from the "fixtures" directory.
def read_json_fixture(filename: str) -> Dict[str, str]: fixture_path = Path(__file__).resolve().parents[0] / f"fixtures/{filename}" with open(fixture_path, mode="r") as f: data = json.load(f) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_json_fixture(filename: str) -> Any:\n return json.loads(load_fixture(f\"jellyfin/{filename}\"))", "def __load_json(self, path):\n try:\n with Path(path).open('r') as f:\n return json.load(f)\n except ValueError as ve:\n six.raise_from(ValueError(\"er...
[ "0.7927645", "0.76608217", "0.7218705", "0.71996886", "0.7188205", "0.7113512", "0.7085031", "0.7052283", "0.7033731", "0.6987805", "0.6985032", "0.69712424", "0.6970192", "0.69670963", "0.69654125", "0.6959683", "0.6957125", "0.6955158", "0.6914491", "0.6905901", "0.6903639"...
0.8265361
0
Generate a random string of fixed length
def short_url_gen(stringLength=5): letters = string.ascii_letters + string.digits return ''.join(random.choice(letters) for i in range(stringLength))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",...
[ "0.8680464", "0.8573714", "0.85486245", "0.85297275", "0.85209286", "0.84331024", "0.8432044", "0.84157014", "0.84120053", "0.8389201", "0.8345882", "0.8343962", "0.83406156", "0.83348686", "0.83240855", "0.82986933", "0.82911193", "0.8281826", "0.82818025", "0.82811046", "0....
0.0
-1
Saves the given dictionary of serials to a file
def save_dic(dic): json.dump(dic, open("resources/files/serials.csv", "w")) # w = writer(open("resources/files/serials.csv", "w", newline="\n")) # w.writerow(['Return Name', 'Serials']) # for name, serials in dic.items(): # lst = [] # if name == "Return Name": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_file():\n dict_from_file.update(temp_dict)\n plik=open('data.txt', 'w')\n for key in dict_from_file.keys():\n plik.write(key)\n plik.write(\" \")\n plik.write(str(dict_from_file[key][0]))\n plik.write(' ')\n plik.write(dict_from_file[key][1].replace(' ','_'))...
[ "0.6935603", "0.69188", "0.68413275", "0.6655667", "0.6588878", "0.65765744", "0.6527208", "0.6474665", "0.6474656", "0.6466567", "0.6454954", "0.64065444", "0.6392219", "0.6383138", "0.6381531", "0.6365475", "0.63336074", "0.63312453", "0.63303477", "0.6314856", "0.63030714"...
0.7513983
0
Applies a Coherenceenhancing filter onto an img
def coherenceFilter(img, sigma=11, str_sigma=11, blend=0.5, iter_n=4): h, w = img.shape[:2] tmp = img.copy() for i in xrange(iter_n): gray = cv2.cvtColor(tmp, cv2.COLOR_BGR2GRAY) eigen = cv2.cornerEigenValsAndVecs(gray, str_sigma, 3) eigen = eigen....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_filter(self, image):\n pass", "def apply_filter(image: np.ndarray) -> np.ndarray:\n # choose filters to apply\n return clahe(image)", "def __enhance_image(self, img):\n\n blue = self.g.clahe.apply(img[:,:,0])\n green = self.g.clahe.apply(img[:,:,1])\n red = s...
[ "0.7258055", "0.7201932", "0.711102", "0.679388", "0.6672614", "0.65973204", "0.6456236", "0.6401097", "0.63895607", "0.6332441", "0.6326217", "0.63224226", "0.63135487", "0.6266105", "0.6185825", "0.6174301", "0.61501044", "0.61242676", "0.61152065", "0.60922337", "0.6086551...
0.65705633
6
Imfill Creates a mask for an image by removing holes, Isolates shape of object
def imfill(img, threshVal = 220): tmp = grayscale(img) ret, thresh = cv2.threshold(tmp, threshVal, 255, cv2.THRESH_BINARY_INV) flood = thresh.copy() h, w = thresh.shape[:2] mask = np.zeros((h+2,w+2), np.uint8) cv2.floodFill(flood, mask, (0,0), 255) invert = cv2.bi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_blind_pores(im):\n holes = find_disconnected_voxels(im)\n im[holes] = False\n return im", "def fillHoles(img):\n out,contour,hierarchy = cv2.findContours(img,cv2.RETR_CCOMP,cv2.CHAIN_APPROX_NONE)\n i=0\n for cnt in contour:\n cv2.drawContours(img,contour,i,255,-1)\n ...
[ "0.7038291", "0.6969876", "0.6879363", "0.67171913", "0.6667967", "0.66605085", "0.65741223", "0.652283", "0.6509893", "0.6445537", "0.6302485", "0.62223357", "0.61688906", "0.6139052", "0.61300457", "0.6125854", "0.6083809", "0.60632926", "0.60614365", "0.603653", "0.6008488...
0.68429846
3
Displays an image using MatPlotLib Useful for displaying all images and Magnitude Spectrums
def matplotlibDisplay(img, title="Image", colorFlag = 'gray'): plt.imshow(img, colorFlag) plt.title(title) plt.xticks([]) plt.yticks([]) plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showimage(image):\n mplt.figure()\n mplt.imshow(image)\n mplt.show()", "def imshow(img):\n imadd(img)\n plt.ion()\n plt.show()", "def show(image):\n fig = pyplot.figure()\n ax = fig.add_subplot(1,1,1)\n imgplot = ax.imshow(image, cmap=mpl.cm.Greys)\n imgplot.set_interpolation(...
[ "0.78140026", "0.7570606", "0.74435496", "0.74429226", "0.7431646", "0.7431646", "0.7431646", "0.7408267", "0.7359493", "0.73032165", "0.722859", "0.7189208", "0.71416754", "0.7140487", "0.7112482", "0.71057785", "0.70950377", "0.7014", "0.6937272", "0.69371027", "0.6907234",...
0.7365132
8
Returns a dictionary into two lists of [[key][values]]
def dictToLst(dictionary): keys = [] values = [] for key, value in dictionary.iteritems(): keys.append(key) values.append(value) return [keys, values]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _key_vals(dict_):\n return [(key, val) for key, val in dict_.iteritems()]", "def dict_to_keys_and_values(dictionary: dict, key_name: str = \"Key\", value_name: str = \"Value\") -> list:\n result = [{key_name: key, value_name: dictionary[key]} for key in dictionary]\n return result", "def dict_to_l...
[ "0.69043493", "0.68097615", "0.67338127", "0.67141587", "0.66156745", "0.6610708", "0.6562489", "0.6557644", "0.6480007", "0.6480007", "0.64730704", "0.6439208", "0.6439208", "0.6411941", "0.6399124", "0.6339745", "0.6311308", "0.6288613", "0.6267422", "0.6252127", "0.6192328...
0.6998897
0
Returns the Min value and Location
def findMin(img): d = minMaxLoc(img) return {"minVal":d["minVal"], "minLoc":d["minLoc"]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(self):\n return self._min_coords", "def find_min(self):\n return self.min", "def find_min(self):\n return self.min", "def MinimumValue(self):\n return self._fitness[self._minIndex]", "def getmin(self):\n\n return self.X", "def getMinX(self):\n return self...
[ "0.7909452", "0.7412526", "0.7412526", "0.73267895", "0.73072314", "0.728868", "0.7238544", "0.72364086", "0.72212857", "0.7208255", "0.71908945", "0.71838945", "0.7171491", "0.71705645", "0.71448535", "0.7138294", "0.7138294", "0.71369004", "0.71369004", "0.71298826", "0.708...
0.7232217
8
Returns the Aspect Ratio (Ratio of width to height of bounding rectangle)
def aspectRatio(cnt): x, y, w, h = cv2.boundingRect(cnt) return float(w) / h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aspectRatio(self):\n self._updateExtents()\n return self.mAspectRatio", "def ratio(self):\n return float(self.max_width) / self.max_height", "def aspect_ratio(self) -> float:\n return self._aspect_ratio", "def image_aspect_ratio(self, index):\n\t\tbbox \t= self.annotations['bb...
[ "0.7916214", "0.7800925", "0.77383006", "0.7686938", "0.7310509", "0.7222565", "0.7061374", "0.7019629", "0.69670105", "0.69009423", "0.68502164", "0.68471354", "0.67362237", "0.66252244", "0.6564315", "0.64727515", "0.64190793", "0.63887256", "0.6363414", "0.6290365", "0.615...
0.78069955
1
Returns the Extent (Ratio of contour area to bounding rectangle area)
def extent(cnt): area = cv2.contourArea(cnt) x, y, w, h = cv2.boundingRect(cnt) rect_area = w*h return float(area)/rect_area
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __CalculateExtend(self, contour):\r\n area = self.__CalculateArea(contour)\r\n boundingBox = self.__CalculateBoundingBox(contour)\r\n return area / (boundingBox[2] * boundingBox[3])", "def aspectRatio(cnt):\n\tx, y, w, h = cv2.boundingRect(cnt)\n\treturn float(w) / h", "def get_extent(...
[ "0.7234319", "0.65271884", "0.6443647", "0.6393077", "0.6385325", "0.63503885", "0.62913525", "0.61773664", "0.615298", "0.61409366", "0.6138268", "0.61366475", "0.6111907", "0.6089793", "0.60725474", "0.605492", "0.60501754", "0.60130423", "0.5998493", "0.59757054", "0.59743...
0.76852393
0
Returns the Solidity (Ratio of area to convex hull area)
def solidity(cnt): area = cv2.contourArea(cnt) hull = cv2.convexHull(cnt) hull_area = cv2.contourArea(hull) return float(area) / hull_area
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2", "def get_coverage_area(self) -> float:\n return math.sqrt(self.norm_hull.volume)", "def area(self) -> npt.NDArray[np.float_]:\n points = self._normalized_projection()\n a = sum(det(points[..., [0, i, i + 1], :]) ...
[ "0.67079383", "0.6676389", "0.64362097", "0.6429818", "0.64248466", "0.63985616", "0.63680375", "0.6361342", "0.6305637", "0.62844884", "0.625831", "0.62430024", "0.6170367", "0.6154476", "0.6146491", "0.6146491", "0.61230654", "0.6121946", "0.6118461", "0.6115014", "0.609086...
0.72119516
0
Returns the Equivalent Diameter (Circle whose area is same as cnt area)
def equivalentDiameter(cnt): return np.sqrt(4 * (cv2.contourArea(cnt)) / np.pi)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perimeter(cnt):\n\treturn cv2.arcLength(cnt, True)", "def getCircleDiameter(self):\n segments = []\n for (i, p1) in enumerate(self.points):\n for p2 in self.points[i+1:]:\n segments.append(Segment(p1, p2))\n s = max(segments, key=lambda s: s.length)\n ret...
[ "0.74359304", "0.72954243", "0.71917015", "0.71417886", "0.71417886", "0.7113245", "0.6894399", "0.6878331", "0.68414986", "0.67992294", "0.67008525", "0.66192067", "0.66009945", "0.65998214", "0.6599036", "0.65988356", "0.65755826", "0.656971", "0.6510862", "0.64852905", "0....
0.78985435
0