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
Combine a date and time series into a datetime series
def combine_date_and_time(date_series, time_series): datetimes = [] for date, time in zip(date_series.values, time_series.values): dt = datetime.datetime.combine(date, time) datetimes.append(dt) return datetimes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_date(ts):\n date_part = ts.loc[:,2:7] #extract time columns\n #convert to list for ease of lambda operation\n date_part_list = date_part.values.tolist() \n convertor = lambda x: datetime.datetime(x[0],x[1],x[2],x[3],x[4],x[5])\n date_final = pd.DataFrame(map(convertor, date_part_list))\n ...
[ "0.6690251", "0.64297044", "0.63708097", "0.6199974", "0.6154839", "0.5948333", "0.5878307", "0.58688885", "0.58253103", "0.57180977", "0.57071996", "0.5706575", "0.57005525", "0.5697078", "0.56892425", "0.56753874", "0.5667902", "0.5571444", "0.5561407", "0.55581594", "0.555...
0.7901773
0
Sets the campaign attribute with a TrackedCampaign
def _set_campaign(self, campaign): if isinstance(campaign, str): campaign = TrackedCampaign.objects.create(name=campaign) campaign.save() self.campaign = campaign
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def campaign(self, campaign):\n\n self._campaign = campaign", "def campaign_id(self, campaign_id):\n\n self._campaign_id = campaign_id", "def _set_campaign_email(self, campaign_email):\n if isinstance(campaign_email, str):\n campaign_email = TrackedCampaignEmail.objects.create(\...
[ "0.76138467", "0.6983273", "0.6518364", "0.61656684", "0.58719707", "0.56679845", "0.5522959", "0.54619855", "0.54393065", "0.5430588", "0.53633666", "0.5260498", "0.51866364", "0.5150679", "0.49631113", "0.49532366", "0.4945168", "0.49379367", "0.49379367", "0.49362108", "0....
0.82205564
0
Sets the campaign email attribute with a TrackedCampaignEmail
def _set_campaign_email(self, campaign_email): if isinstance(campaign_email, str): campaign_email = TrackedCampaignEmail.objects.create( campaign=self.campaign, name=campaign_email ) campaign_email.save() self.campaign_email = campaign_email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self, email):\n\n self._email = email", "def email(self, email):\n\n self._email = email", "def email(self, email):\n\n self._email = email", "def email(self, email):\n\n self._email = email", "def email(self, email):\n\n self._email = email", "def email(self,...
[ "0.68453455", "0.68453455", "0.68453455", "0.68453455", "0.68453455", "0.68453455", "0.68453455", "0.68453455", "0.68453455", "0.68453455", "0.67462665", "0.67301506", "0.67204374", "0.67204374", "0.6564566", "0.6497094", "0.64135027", "0.6374813", "0.6343598", "0.63301057", ...
0.82044697
0
construct listnode from list
def constructListNode(input_list): root = ListNode(0) curr = root for i in range(len(input_list)): curr.next = ListNode(input_list[i]) curr = curr.next return root.next
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_list(L):\n n = None\n for i in xrange(len(L)-1, -1, -1):\n n = Node(x=L[i], nxt=n)\n return n", "def from_list(L):\n n = None\n for i in xrange(len(L)-1, -1, -1):\n n = Node(x=L[i], nxt=n)\n return n", "def construct(lst):\n t = Tree()\n t.root = lst[0]\n for n...
[ "0.7085481", "0.7085481", "0.6954116", "0.6855161", "0.6806374", "0.669958", "0.65430635", "0.64513195", "0.64501", "0.637373", "0.6358718", "0.63154924", "0.63041776", "0.625221", "0.6247209", "0.6197867", "0.61962134", "0.616456", "0.6163744", "0.6108713", "0.61009425", "...
0.7184248
0
Return the name of this camera.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n friendly_camera_name = self._cam_name.replace('_', ' ')\n return f\"{friendly_camera_name} {self._obj_name}\".title()", "def name(self) -> str:\n return self.camera_info[\"device_name\"]", "def name(self):\n return self._scene_name", "def name(self):\n\t\treturn ...
[ "0.86631787", "0.8536238", "0.7493173", "0.7183577", "0.71381986", "0.7096534", "0.70536137", "0.703101", "0.70261574", "0.70229435", "0.70229435", "0.70229435", "0.7022467", "0.7017471", "0.70168525", "0.70163584", "0.7012957", "0.7012957", "0.7012957", "0.7011892", "0.70003...
0.0
-1
Return the camera state attributes.
def extra_state_attributes(self): return {"file_path": self._file_path}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\n return {\n ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION,\n ATTR_CAMERA_TYPE: self._camera_type,\n }", "def device_state_attributes(self):\r\n return self.attributes", "def state_attributes(self):\n return self._attributes", "def ...
[ "0.79429895", "0.77826995", "0.7642746", "0.7642746", "0.7628107", "0.7626915", "0.75690836", "0.75690836", "0.75635165", "0.75365305", "0.75365305", "0.75365305", "0.75365305", "0.75365305", "0.75365305", "0.75365305", "0.75365305", "0.75365305", "0.75365305", "0.75365305", ...
0.0
-1
Close the underlying connection.
def close(self): self._conn.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_connection(self):\n self._conn.close()", "def close(self) -> None:\n self._connection.close()", "def close_connection(self) -> None:\n self.connection.close()", "def close(self):\n with self.connlock:\n self.conn.do_close()", "def close(self):\n self....
[ "0.8285707", "0.8189774", "0.81770855", "0.81583154", "0.8151474", "0.81504655", "0.8141118", "0.8141118", "0.81265265", "0.8102914", "0.80942947", "0.8076253", "0.8051391", "0.8051391", "0.8051391", "0.8051391", "0.8051391", "0.8051391", "0.8051391", "0.80510116", "0.7890429...
0.8033591
20
Return a named logger. Note, this should be called one time per named logger.
def get_logger(name="LazySusan"): level = get_level() _configure(level) logger = logging.getLogger(name) logger.setLevel(level) return logger
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger(self, name):\n logger, _ = get_stdout_logger(name, verbosity=self.verbosity)\n return logger", "def get_logger(name: str) -> logging.Logger:\n \n return logging.getLogger(name)", "def get_logger(name):\n return logging.getLogger(name)", "def get_logger(name):\n # ...
[ "0.8175648", "0.81264216", "0.81133986", "0.80860823", "0.7990692", "0.79511476", "0.78802633", "0.7810913", "0.7807408", "0.7762477", "0.77155733", "0.7662459", "0.76285887", "0.7627138", "0.7623923", "0.76119804", "0.75923353", "0.7577212", "0.75675213", "0.7560183", "0.752...
0.7826045
7
Write the page json from the object to a file. Default, is "./{id}.json"
def to_json_file(self, json_file: str = None) -> None: if self.json: if not json_file: json_file = f"{self.id}.json" with open(json_file, "w") as f: f.write(self.json)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def write(self, data, filename):\n logger.debug(\"JSON Page %s\", filename)\n fullpath = os.path.join(self.dirname, filename)\n basedir = os.path.dirname(fullpath)\n if not os.path.exists(basedir):\n os.makedirs(basedir)\n\n with open(fullpath, \"w\") as file_han...
[ "0.71592754", "0.6833297", "0.67917055", "0.67768204", "0.67322016", "0.6731662", "0.6730556", "0.67143846", "0.67031", "0.6699947", "0.66907924", "0.6682108", "0.66777307", "0.66752225", "0.66697663", "0.6647426", "0.6646725", "0.66161305", "0.6606894", "0.6582861", "0.65573...
0.6961622
1
Return count of sockets available on server.
def sockets(self): available_sockets = len(self._binding_data) return int(available_sockets)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n with self.register_lock:\n return len(self.sockets)", "def sockets(self):\n return int(self.num_cpu_sockets) # type: ignore", "def sock_avail(self):\n return self.channel.recv_ready()", "def net_get_connections ():\n\tdata = commands.getoutput(\"netstat -...
[ "0.7883007", "0.7327394", "0.7202165", "0.6952546", "0.693161", "0.6775371", "0.671451", "0.6702394", "0.66273606", "0.6617147", "0.65317357", "0.6472401", "0.63660204", "0.6344401", "0.6336294", "0.63216335", "0.63208437", "0.6297188", "0.62590337", "0.6244281", "0.6228095",...
0.77470624
1
Return count of sockets available on server.
def sockets(self): return int(self.num_cpu_sockets) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n with self.register_lock:\n return len(self.sockets)", "def sockets(self):\n available_sockets = len(self._binding_data)\n return int(available_sockets)", "def sock_avail(self):\n return self.channel.recv_ready()", "def net_get_connections ():\n\tdat...
[ "0.7883007", "0.77470624", "0.7202165", "0.6952546", "0.693161", "0.6775371", "0.671451", "0.6702394", "0.66273606", "0.6617147", "0.65317357", "0.6472401", "0.63660204", "0.6344401", "0.6336294", "0.63216335", "0.63208437", "0.6297188", "0.62590337", "0.6244281", "0.6228095"...
0.7327394
2
The systemgenerated, unique ID of the data repository association.
def association_id(self) -> Optional[str]: return pulumi.get(self, "association_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_id(self) -> str:\n return f\"{self.entry_id}_{self.module_id}_{self.data_id}\"", "def unique_id(self):\n return self._id", "def unique_id(self):\n return self._id", "def unique_id(self) -> str:\n return self._unique_id", "def unique_id(self) -> str:\n return se...
[ "0.7724802", "0.7620581", "0.7620581", "0.7493994", "0.7493994", "0.7493994", "0.7493994", "0.7493994", "0.7493994", "0.7493994", "0.7493994", "0.7438622", "0.7418471", "0.74085134", "0.74085134", "0.74085134", "0.74085134", "0.74085134", "0.74085134", "0.74085134", "0.740851...
0.0
-1
For files imported from a data repository, this value determines the stripe count and maximum amount of data per file (in MiB) stored on a single physical disk. The maximum number of disks that a single file can be striped across is limited by the total number of disks that make up the file system.
def imported_file_chunk_size(self) -> Optional[int]: return pulumi.get(self, "imported_file_chunk_size")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_files(self):\n\n return 10 ** self.int_len(self.cnt_files())", "def max_disk_size(self) -> str:\n return pulumi.get(self, \"max_disk_size\")", "def bytes_limit_per_file(self) -> Optional[float]:\n return pulumi.get(self, \"bytes_limit_per_file\")", "def max_disk_size(self) -> pul...
[ "0.70459324", "0.7011306", "0.67932034", "0.6741541", "0.65640527", "0.65068614", "0.6503016", "0.65024894", "0.6467011", "0.6451823", "0.634329", "0.6325226", "0.62655145", "0.6264661", "0.6264661", "0.62432986", "0.6232645", "0.620567", "0.62037367", "0.6188706", "0.6188706...
0.0
-1
The Amazon Resource Name (ARN) for a given resource. ARNs uniquely identify Amazon Web Services resources. We require an ARN when you need to specify a resource unambiguously across all of Amazon Web Services. For more information, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
def resource_arn(self) -> Optional[str]: return pulumi.get(self, "resource_arn")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"resource_arn\")", "def resource_arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"resource_arn\")", "def resource_arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"resource_arn\")", "def resource...
[ "0.7686082", "0.7686082", "0.7686082", "0.7686082", "0.7686082", "0.7686082", "0.7686082", "0.7644795", "0.7601367", "0.7198263", "0.7198263", "0.7198263", "0.7198263", "0.7198263", "0.70990056", "0.70990056", "0.70990056", "0.70990056", "0.70990056", "0.70990056", "0.7099005...
0.7413056
9
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(r): r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" r.headers["Pragma"] = "no-cache" r.headers["Expires"] = "0" r.headers['Cache-Control'] = 'public, max-age=0' return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m...
[ "0.8222435", "0.82216024", "0.82216024", "0.82216024", "0.82216024", "0.81946385", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232", "0.816232",...
0.71272135
67
Get the configuration of the redis section
def _get_redis(self, config): expected_options = {'host', 'port', 'db_id'} _warn_on_extra(set(config.options('redis')) - expected_options - self.defaults, 'redis section option(s)') get = partial(config.get, 'redis') getint = partial(config.getint, 'redis') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redis_config(self):\n def func(server):\n return server.config()\n self.__run_redis_cmd(func)", "def get_config_on_json(self):\n # load section CONFIG from data\n try:\n return self.json_data[\"CONFIG\"]\n except:\n constant.get_error(consta...
[ "0.7516124", "0.68976754", "0.67556787", "0.66636854", "0.66512835", "0.66428995", "0.6630258", "0.658256", "0.6566579", "0.65402466", "0.65308243", "0.6468643", "0.6364659", "0.63538796", "0.630654", "0.6296195", "0.6290233", "0.6275894", "0.6275894", "0.6275894", "0.6275894...
0.71769285
1
Get a metric descriptor from metric type. If the metric is not found, try listing all metrics from project and grab the corresponding matches.
def get(self, metric_type): name = f'{self.project}/metricDescriptors/{metric_type}' try: return self.client.get_metric_descriptor(name=name) except exceptions.NotFound: metric_type = self.get_approx(metric_type) name = f'{self.project}/metricDescriptors/{metr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_metric_descriptor(self, metric_type):\n return MetricDescriptor._fetch(self, metric_type)", "def get_type_by_metric(metric):\n for item in PROMETHEUS_METRICS_LIST:\n if item['name'] == metric:\n return item['type']\n return \"\"", "def get_metric(metric_key: str) -> Met...
[ "0.7450521", "0.63232946", "0.62064254", "0.618154", "0.6181043", "0.6139923", "0.6025394", "0.59385884", "0.5914183", "0.5872485", "0.57211083", "0.5708873", "0.5705698", "0.56462723", "0.56176186", "0.5576296", "0.5568428", "0.55285054", "0.55132914", "0.54455554", "0.54061...
0.7855862
0
Ensure JWT refresh view using JSON POST fails if no orig_iat is present on the payload.
def test_jwt_refresh_json_no_orig_iat(self): self.payload.pop('orig_iat') data = { 'token': utils.jwt_encode_handler(self.payload) } response = self.client.post( '/refresh-token/', json.dumps(data), content_type='application/json' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_jwt_refresh_with_expired_token(self):\n\n # We make sure that the refresh token is not in the window\n # allowed by the expiration delta. This is much easier using\n # freezegun.\n orig_iat = datetime.utcfromtimestamp(self.payload['orig_iat']) -\\\n settings.JWT_REFR...
[ "0.7056336", "0.6595873", "0.64955956", "0.62678105", "0.6222239", "0.610046", "0.6050554", "0.6036501", "0.60080194", "0.59941053", "0.58761543", "0.58587664", "0.5809193", "0.5738857", "0.543565", "0.5434432", "0.53859794", "0.5380962", "0.53533185", "0.5347213", "0.5327276...
0.86965156
0
Add a new experience to memory.
def add(self, state, action, reward, next_state, done): e = self.experience(state, action, reward, next_state, done) self.memory.append(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)", "def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st...
[ "0.79568833", "0.79042006", "0.78795445", "0.7577913", "0.7570969", "0.74478436", "0.7361023", "0.72697705", "0.721816", "0.71451885", "0.7106998", "0.7101183", "0.69837016", "0.68905056", "0.68842727", "0.6755663", "0.6712557", "0.6677425", "0.64961654", "0.6488678", "0.6486...
0.71984994
16
Get the current list of participating validator nodes.
def get_current_validator_list(genesis_file: str, seed: str = DEFAULT_CHAOS_SEED, pool_name: str = DEFAULT_CHAOS_POOL, wallet_name: str = DEFAULT_CHAOS_WALLET_NAME, wallet_key: str = DEFAULT_CHAOS_WALLET_KEY, timeout: str = DEFAULT_CHAOS_GET_VALIDATOR_INFO_TIMEOUT) -> List[str]: output_dir = get_cha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_peer_nodes(self):\n return list(self.__peer_nodes)", "def get_peer_nodes(self):\n return list(self.__peer_nodes)", "def get_node_list(self):\n return self.node_list", "def get_node_list(self):\n return []", "def get_node_list(self):\n return [[node] for node in se...
[ "0.67082375", "0.67082375", "0.66853976", "0.64211947", "0.6380634", "0.61560124", "0.6059788", "0.60549957", "0.6053366", "0.60452557", "0.6014061", "0.6002553", "0.5987007", "0.59784824", "0.59771466", "0.5971373", "0.5971219", "0.5971219", "0.5971219", "0.596872", "0.59664...
0.7021979
0
Compute the padding to obtain the same output shape when using convolution, considering the case when the stride is unitary
def same_padding(k, d=1, dims=2): #Convert i, k and d to tuples if they are int k = tuple([k for j in range(dims)]) if type(k) == int else k d = tuple([d for j in range(dims)]) if type(d) == int else d return tuple([int(0.5*(d[j]*(k[j]-1))) for j in range(dims)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_padding(kernel_size, stride, dilation):\n return -((-kernel_size - (kernel_size - 1) * (dilation - 1)) // stride + 1) // 2", "def compute_conv(in_size, kernel, stride, padding):\n return (in_size + 2 * padding - kernel) // stride + 1", "def _get_same_padding_conv_nd(\n image_size: list[int], ...
[ "0.81379676", "0.80382735", "0.78556925", "0.76689255", "0.765149", "0.7561516", "0.748254", "0.7454831", "0.74427456", "0.7438163", "0.7432097", "0.74233544", "0.73600054", "0.7354283", "0.730166", "0.72396237", "0.723874", "0.7215517", "0.71951425", "0.7179034", "0.7148489"...
0.0
-1
Initialize layer from downsampling operation, i.e. convolution or pooling
def from_conv(cls, module): kernel_size = unpack_all_equal_tuple(module.kernel_size) stride = unpack_all_equal_tuple(module.stride) return cls(kernel_size, stride)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _downsample_layer(self, layer):\n\n pool_object = get_keras_layer(\n type=self.config['pooling_type'],\n num_dims=self.config['num_dims']\n )\n layer = pool_object(\n pool_size=(2,) * self.config['num_dims'],\n data_format=self.config['data_forma...
[ "0.6913139", "0.67660147", "0.67233723", "0.66071856", "0.6423581", "0.6250583", "0.61859137", "0.61233044", "0.6107255", "0.60512346", "0.6014526", "0.59816", "0.59753937", "0.59701735", "0.5938807", "0.59332174", "0.59331286", "0.59237146", "0.59225905", "0.59090364", "0.59...
0.0
-1
Initialize layer from upsampling operation, i.e. transposed convolution or upsampling
def from_up(cls, module): stride = unpack_all_equal_tuple(module.stride) return cls(1, 1 / stride)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def up_sampling_block(A, B, up, channel, kernel_width, stride, initializer, hidden_activation):\n A = Concatenate()([A, B])\n A = UpSampling2D(up)(A)\n B = UpSampling2D(up)(B)\n A = Conv2D(channel, kernel_width, stride,\n padding=\"same\", kernel_initializer=initializer)(A)\n A = Layer...
[ "0.6923253", "0.69218874", "0.6818047", "0.6659082", "0.6492162", "0.6487058", "0.6485198", "0.6463172", "0.64596844", "0.63398516", "0.627715", "0.6270097", "0.62611514", "0.6238734", "0.62180984", "0.6186973", "0.6160294", "0.6139081", "0.61371285", "0.60954225", "0.6088185...
0.0
-1
y_i = (x_i max(x)) / sum(x max(x))
def softmax(X): _X = X - np.max(X, axis=1).reshape(-1, 1) ep = np.exp(_X) return ep / np.sum(ep, axis=1).reshape(-1, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(y):\n maxy = np.amax(y)\n e = np.exp(y - maxy)\n return e / np.sum(e)", "def softmax(x):\n e_x = np.exp(x - np.max(x))\n return (e_x / e_x.sum()) * 100", "def getMaxima(x, y):\n# mx_x = (np.abs(np.min(x)) + np.max(x)) / 2\n# mx_y = (np.abs(np.min(y)) + np.max(y)) / 2\n# ...
[ "0.66231376", "0.6584254", "0.6552811", "0.65326923", "0.65318584", "0.65139127", "0.65036035", "0.6451018", "0.64187455", "0.63277066", "0.63207334", "0.63207334", "0.63207334", "0.63207334", "0.6316125", "0.63119686", "0.63071096", "0.63039446", "0.63035685", "0.63035685", ...
0.0
-1
Turn the display off (quickly)
def noDisplay(self): self.displaycontrol &= ~self.LCD_DISPLAYON self.write_lcd(self.LCD_DATA_E1, self.LCD_DISPLAYCONTROL | self.displaycontrol) self.write_lcd(self.LCD_DATA_E2, self.LCD_DISPLAYCONTROL | self.displaycontrol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _turn_off(self):\n self._turn_display('OFF')", "def turn_display_off(turn_off):\n if turn_off:\n send_command(0xAE)\n else:\n send_command(0xAF)", "def blank_screen_and_hide_control_buttons(self):\n event_logger.debug(\"Blanking display\")\n rpi_utils.toggle_screen_...
[ "0.8856843", "0.8412049", "0.7483442", "0.72966456", "0.7261764", "0.72428066", "0.7166616", "0.7156268", "0.7139055", "0.71075845", "0.70731074", "0.70666957", "0.7063937", "0.7046198", "0.7012098", "0.69468945", "0.69421524", "0.6921769", "0.6918248", "0.6895559", "0.689243...
0.76472205
2
This will 'left justify' text from the cursor
def noAutoscroll(self): self.displaymode &= ~self.LCD_ENTRYSHIFTINCREMENT self.write_lcd(LCD_DATA_E1, self.LCD_ENTRYMODESET | self.displaymode) self.write_lcd(LCD_DATA_E2, self.LCD_ENTRYMODESET | self.displaymode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def justify(self, value):\n pos = 0\n upper = value.upper()\n\n if upper == 'L':\n pos = 0\n elif upper == 'C':\n pos = 1\n elif upper == 'R':\n pos = 2\n\n self.write(self.ASCII_ESC, 'a', pos)", "def setTextJustification(justify='left'):...
[ "0.63633335", "0.6269329", "0.616541", "0.6104415", "0.60599357", "0.6014967", "0.5803564", "0.5749061", "0.56000566", "0.5594751", "0.55739135", "0.556712", "0.55283976", "0.54926807", "0.5490422", "0.548964", "0.5482094", "0.5475019", "0.5450602", "0.54383737", "0.5430408",...
0.0
-1
If we're logged in, add user_id to Flask global. Must execute before do_login
def add_user_to_g(): if CURRENT_USER in session: g.user = User.query.get(session[CURRENT_USER]) else: g.user = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_request():\n g.user = None\n if 'user_id' in session:\n g.user = User.query.get(session['user_id'])", "def setup_user():\n if 'auth_user' in flask.session:\n user = models.User.query.get(flask.session['auth_user'])\n if user is None:\n # old bad cookie, no good...
[ "0.732737", "0.7215247", "0.72011894", "0.7155324", "0.70082337", "0.68890995", "0.6827153", "0.67601204", "0.6757661", "0.67527354", "0.6681287", "0.66776884", "0.66543275", "0.6649007", "0.6607986", "0.65651846", "0.6546369", "0.6527202", "0.6463552", "0.6463552", "0.640135...
0.570892
78
Determines whether a natural number is a prime number
def esprimo(n): toret = False if x == 2: toret = True elif x % 2 == 0: toret = False else: for i in range(3, x, 2): if x % i == 0: break else: toret = True # Se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isprime(n):\r\n\treturn is_prime(n)", "def isprime(n):\n\treturn is_prime(n)", "def is_prime(n):\n return mr_prime(n)", "def is_prime_number(number_):\n flag = 0\n for values in range(2, number_//2):\n if number_ % values == 0:\n flag += 1\n if flag == 1:\n return Tru...
[ "0.8353696", "0.8339246", "0.82764", "0.82354355", "0.80573803", "0.8038324", "0.80336785", "0.8012925", "0.7995696", "0.79837555", "0.7971778", "0.7966673", "0.79583603", "0.7953041", "0.79518825", "0.79514825", "0.7948169", "0.7933214", "0.7895023", "0.7887138", "0.78808403...
0.0
-1
Get diseases from data.
def get_diseases(self): self.diseases = self.data.groupby('topic')['topic'].count()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diseases(self):\n\t\treturn Disease.DiseasesByPatient(self.id, self.host)", "def read_disease_data():\n for disease in Disease.diseases_data:\n Disease.add_disease(disease['name'], disease['symptoms'], disease['is_bacterial'], disease['is_viral'],\n disease['i...
[ "0.7602041", "0.70704067", "0.6278454", "0.61278915", "0.61105394", "0.6056795", "0.5896745", "0.57967997", "0.56891006", "0.5655829", "0.5583274", "0.5517157", "0.55137116", "0.55046386", "0.5489524", "0.548908", "0.5456091", "0.5446277", "0.5432133", "0.5417041", "0.5406351...
0.65060306
2
Plots heatmaps for interacting parameter simulations.
def plot_interacting_sims(data, param1, param2, plot_log=False, show=False, save_fig=False, file_path=fp.sims_interacting, file_name='InteractingSims'): # Calculate ratios ratios = calc_interacting_param_ratios(data) if plot_log: ratios = np.log10(ratios) vmin, vm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_heatmap(self):\n data = []\n for j in range(len(self.generations[0])):\n row = []\n for i in range(len(self.generations)):\n row.append(self.generations[i][j].fitness)\n data.append(row)\n data = np.array(data)\n\n # Display l...
[ "0.6893149", "0.68267107", "0.65392464", "0.6511935", "0.6436356", "0.64247864", "0.6419553", "0.6417323", "0.64020175", "0.63990474", "0.6364756", "0.62776893", "0.624668", "0.6227586", "0.62059456", "0.61971486", "0.6195211", "0.6191534", "0.6186919", "0.6176175", "0.617365...
0.69784695
0
Plot correlations between BandRatio measures and spectral features.
def plot_param_ratio_corr(data, x_labels=FEATURE_LABELS, y_labels=BAND_NAMES, yrotation=45, show=True, save_fig=False, file_path=fp.eeg_corrs, file_name="corrplot"): if not np.all(data): raise RuntimeError("No data - cannot proceed.") fig, ax2 = plt....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_corr_plot():\r\n fig = plt.figure(figsize=(12, 12))\r\n ax = fig.add_subplot", "def plot_correlations(data):\n\n from matplotlib import cm\n \n cols = data.columns.tolist()\n fig = plt.figure(figsize=(12,12))\n ax = fig.add_subplot(111)\n \n # Plot absolute value of pairwise ...
[ "0.68772805", "0.6604266", "0.6560752", "0.6556923", "0.64814806", "0.6425908", "0.6351134", "0.63001156", "0.6282062", "0.62816", "0.6200966", "0.61904573", "0.61819565", "0.61695856", "0.6167202", "0.61330146", "0.6131847", "0.6074394", "0.60681933", "0.6067012", "0.6012357...
0.6477444
5
Same as `plot_param_ratio_corr`, but for the exponent.
def plot_param_ratio_corr_exp(exp, cbar=False, show=False, save_fig=False, file_path=fp.eeg_corrs, file_name="exp_corrplot"): fig, ax1 = plt.subplots(figsize=(2.5, 1.75)); ax1 = sns.heatmap(exp[0].reshape((1, 1)), cmap="bwr", annot=True, fmt='1.2f', cbar=cbar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_param_ratio_corr(data, x_labels=FEATURE_LABELS, y_labels=BAND_NAMES,\n yrotation=45, show=True, save_fig=False,\n file_path=fp.eeg_corrs, file_name=\"corrplot\"):\n\n if not np.all(data):\n raise RuntimeError(\"No data - cannot proceed.\")\n\n ...
[ "0.5915757", "0.56985974", "0.54354197", "0.5414556", "0.52763444", "0.5252095", "0.5211293", "0.51424766", "0.51359105", "0.50648236", "0.506257", "0.5061359", "0.50328195", "0.50101334", "0.49962807", "0.49611908", "0.49496818", "0.49281394", "0.48951095", "0.4867644", "0.4...
0.67388546
0
Add a collection of line segments (2D or 3D) to an axes instance.
def lines(axes, pos0, pos1, reflen=None, colors='k', linestyles='solid', cmap=None, norm=None, zorder=0, **kwargs): if not pos0.shape == pos1.shape: raise ValueError('Incompatible lengths of coordinate arrays.') dim = pos0.shape[1] assert dim == 2 or dim == 3 if dim == 2: Col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiline(xs, ys, c, ax=None, **kwargs):\n # Find axes\n ax = plt.gca() if ax is None else ax\n\n # Create LineCollection\n segments = [np.column_stack([x, y]) for x, y in zip(xs, ys)]\n lc = LineCollection(segments, **kwargs)\n\n # Set coloring of line segments\n # NOTE: I get an error if...
[ "0.6578541", "0.65345615", "0.6211205", "0.6159715", "0.6066546", "0.5941651", "0.5806025", "0.5766726", "0.5751014", "0.5727431", "0.56496495", "0.5639578", "0.56311834", "0.5630371", "0.56019443", "0.55558044", "0.555042", "0.55379856", "0.55355805", "0.55008256", "0.544900...
0.66703176
0
Return all the hoppings of the system and of the leads as an iterator.
def sys_leads_hoppings(sys, num_lead_cells=2): syst = sys # for naming consistency inside function bodies hoppings = [] lead_cells = [] if isinstance(syst, builder.Builder): hoppings.extend(((hop, None, 0) for hop in syst.hoppings())) def lead_hoppings(lead): sym = lead.sy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for i in range(len(self.ks)):\n yield self.get_neighs([i]), self.get_sp_rel_pos([i]),\\\n [self.ks[i]], self.iss", "def __iter__(self):\n for x in self.innings:\n yield x", "def Hrep_generator(self):\n for H in self.Hrepresentation...
[ "0.59931445", "0.59457046", "0.5934279", "0.58962834", "0.5853671", "0.5853671", "0.5843535", "0.5737299", "0.57090455", "0.56713057", "0.5670644", "0.5648436", "0.563323", "0.56134367", "0.56121486", "0.56035", "0.5574987", "0.5542815", "0.5530956", "0.55275536", "0.5494585"...
0.6272989
0
Return a Tensor for a batch of image input
def neural_net_image_input(image_shape): return tf.placeholder(tf.float32, shape=[None]+list(image_shape), name="x")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_batch():\n return np.zeros((2, 1, 4, 4))", "def process_batch_input_for_RNN(self, batch_input):\n batch_input_ = tf.transpose(batch_input, perm=[2, 0, 1])\n x = tf.transpose(batch_input_)\n return x", "def preds(self, input_batch):\n raw_output = self._create_network(tf.cast(input_...
[ "0.6982396", "0.697684", "0.69677955", "0.69143456", "0.67242986", "0.67011863", "0.6678814", "0.6667556", "0.66644204", "0.66474915", "0.65924495", "0.65809345", "0.65522945", "0.6539906", "0.64710915", "0.647023", "0.64531785", "0.6436162", "0.64322406", "0.64031476", "0.63...
0.6586891
11
Flatten x_tensor to (Batch Size, Flattened Image Size)
def flatten(x_tensor): with tf.name_scope('input_reshape'): x = x_tensor.get_shape().as_list()[1] y = x_tensor.get_shape().as_list()[2] z = x_tensor.get_shape().as_list()[3] image_shaped_input = tf.reshape(x_tensor, [-1, x*y*z]) return image_shaped_input
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(x_tensor):\n # TODO: Implement Function\n b, w, h, d = x_tensor.get_shape().as_list()\n img_size = w * h * d\n return tf.reshape(x_tensor, [-1, img_size])", "def flatten(self, x_tensor):\n shape = x_tensor.get_shape().as_list()\n assert len(shape) >= 4, 'shape of image is no...
[ "0.8305385", "0.8138931", "0.7952496", "0.78986716", "0.76843333", "0.76617396", "0.76617396", "0.76214653", "0.7620596", "0.7620596", "0.7609458", "0.7570018", "0.71380526", "0.69518363", "0.6933166", "0.6928874", "0.69268334", "0.69091326", "0.687546", "0.6792262", "0.66869...
0.7993852
2
Apply a output layer to x_tensor using weight and bias
def output(x_tensor, num_outputs, name="output"): with tf.name_scope(name): return tf.layers.dense(x_tensor, num_outputs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_layer_activation(x):\n return x", "def output(x_tensor, num_outputs):\n shape = x_tensor.get_shape().as_list()\n weight = tf.Variable(tf.truncated_normal([shape[-1], num_outputs], stddev=0.1))\n bias = tf.Variable(tf.zeros(num_outputs))\n return tf.add(tf.matmul(x_tensor, weight), bias)...
[ "0.73880553", "0.7379001", "0.73780525", "0.6867772", "0.6791421", "0.67592424", "0.6727423", "0.67101616", "0.6686149", "0.66421616", "0.66083896", "0.66023237", "0.65648735", "0.6524778", "0.6484271", "0.6477665", "0.64373136", "0.64364195", "0.6411001", "0.6399274", "0.637...
0.6698643
8
Create a convolutional neural network model
def conv_net(x, keep_prob): # Apply 1, 2, or 3 Convolution and Max Pool layers # Play around with different number of outputs, kernel size and stride # Function Definition from Above: # conv2d_maxpool(x_tensor, conv_num_outputs, conv_ksize, conv_strides, pool_ksize, pool_strides) tf.summary.im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modelbuilder():\n model = Sequential()\n # Add a convolution layer with with a sigmoid activation function\n model.add(layers.Conv2D(1, (2, 2), strides=(1, 1), activation='sigmoid', padding='same', input_shape=(256, 256, 3)))\n model.compile(optimizer='adam', loss='mse', metrics=['accuracy'])\n ...
[ "0.75759804", "0.75662863", "0.75616914", "0.7515004", "0.7484576", "0.73029715", "0.72210497", "0.7213281", "0.7211336", "0.70952636", "0.70872176", "0.70740753", "0.70739937", "0.7005373", "0.69838446", "0.6977015", "0.6968334", "0.696391", "0.69364005", "0.6928159", "0.692...
0.0
-1
Attach a lot of summaries to a Tensor (for TensorBoard visualization).
def variable_summaries(var): with tf.name_scope('summaries'): mean = tf.reduce_mean(var) tf.summary.scalar('mean', mean) with tf.name_scope('stddev'): stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean))) tf.summary.scalar('stddev', stddev) tf.summary.scalar('max', tf.reduce_max(var)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()", "def build_summaries(self):\n\n # Loss summary.\n tf.summary.scalar('loss', self.loss)\n\n merged = tf.summary.merge_all()\n self.summary_op = merged\n ...
[ "0.707166", "0.69701505", "0.69701505", "0.68012226", "0.67878616", "0.6741309", "0.6666931", "0.6656891", "0.6621081", "0.66090554", "0.6596744", "0.65847844", "0.6579689", "0.6551655", "0.6501369", "0.6459547", "0.6415795", "0.6295147", "0.62726593", "0.6272205", "0.6264144...
0.5549624
87
Tests removing projects from a team user group
def test_remove_projects_from_group(client): group = client.remove_projects_from_group( TEAM_ID, GROUP_ID, ["638597985c913f818559f3.17106287", "404021655ce68d0f36ad23.02802891"] ) assert group.team_id == TEAM_ID assert group.group_id == GROUP_ID assert "638597985c913...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_project(self):\n pass", "def test_remove_project_member(self):\n pass", "def test_delete_project(self):\n pass", "def test_delete_project(self):\n pass", "def test_teams_remove_user_from_team_v2(self):\n pass", "def test_delete_team(self):\n pass"...
[ "0.79891574", "0.7781788", "0.740629", "0.740629", "0.72829795", "0.7204606", "0.716091", "0.7146413", "0.7146413", "0.7133802", "0.7133802", "0.71277714", "0.71050334", "0.70733446", "0.7046719", "0.7040827", "0.70291287", "0.6986133", "0.6974486", "0.69699675", "0.6936761",...
0.82599634
0
Tests removing a member from a team user group
def test_remove_member_from_group(client): group = client.remove_members_from_group(TEAM_ID, GROUP_ID, 35555) assert group.team_id == TEAM_ID assert group.group_id == GROUP_ID assert 35555 not in group.members
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_members_from_group(client):\n group = client.remove_members_from_group(TEAM_ID, GROUP_ID, [52911, 35555])\n assert group.team_id == TEAM_ID\n assert group.group_id == GROUP_ID\n assert 52911 not in group.members\n assert 35555 not in group.members", "def test_delete_team_member(sel...
[ "0.83057624", "0.8243199", "0.80481976", "0.8006758", "0.7955663", "0.7873631", "0.78012747", "0.7648809", "0.76298857", "0.7577432", "0.7575087", "0.7575087", "0.7544642", "0.7544642", "0.75342923", "0.75144684", "0.74594504", "0.7458361", "0.7418204", "0.73729044", "0.73328...
0.8584106
0
Tests removing members from a team user group
def test_remove_members_from_group(client): group = client.remove_members_from_group(TEAM_ID, GROUP_ID, [52911, 35555]) assert group.team_id == TEAM_ID assert group.group_id == GROUP_ID assert 52911 not in group.members assert 35555 not in group.members
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_member_from_group(client):\n group = client.remove_members_from_group(TEAM_ID, GROUP_ID, 35555)\n assert group.team_id == TEAM_ID\n assert group.group_id == GROUP_ID\n assert 35555 not in group.members", "def test_teams_remove_user_from_team_v2(self):\n pass", "def test_delus...
[ "0.85436517", "0.79600537", "0.79434794", "0.7927054", "0.7829721", "0.7829721", "0.78111917", "0.77350307", "0.76964575", "0.76964575", "0.7617453", "0.7507476", "0.74874574", "0.7481964", "0.7426865", "0.7424679", "0.7388678", "0.7380556", "0.73545545", "0.73545545", "0.734...
0.86245066
0
Tests for failure when posting to the jobs view with authentication.
def test_unathenticated_on_post(self, mock_create, mock_msg_mgr): url = '/%s/jobs/' % self.api response = self.client.post(url, data=self.json_data, format='json') self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN, response.content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authenticated_user_post_request_failure(self):\n\n res = self.client.post(PROCEDURE_URL, self.payload, format='json')\n\n self.assertEqual(res.status_code, status.HTTP_403_FORBIDDEN)", "def test_unauthenticated_user_post_request_failure(self):\n\n res = self.client.post(PROCEDURE_UR...
[ "0.7062535", "0.68907195", "0.6885851", "0.682816", "0.6743592", "0.66056603", "0.65919375", "0.6590777", "0.6530976", "0.65104836", "0.6506073", "0.6481868", "0.64651704", "0.6434691", "0.64219385", "0.6344984", "0.6342694", "0.63135535", "0.630707", "0.6306685", "0.6301699"...
0.7399698
0
Tests successfully calling POST jobs view to queue a new job with a job type configuration
def test_successful_configuration(self, mock_create, mock_msg_mgr): json_data = { "input" : { 'version': '6', 'files': {'input_a': [self.source_file.id]}, 'json': {} }, "job_type_id" : self.job_type1.pk, "configurat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_job(self):\n body = UnitTesterJobCreateReq()\n response = self.client.open(\n '/v1/job',\n method='POST',\n data=json.dumps(body),\n content_type='application/json')\n self.assert200(response,\n 'Response body is :...
[ "0.7874177", "0.72237116", "0.7020212", "0.6854706", "0.6828025", "0.6814109", "0.6792814", "0.6765872", "0.6723848", "0.6714926", "0.66690063", "0.6652907", "0.6630368", "0.66243637", "0.6591203", "0.65337723", "0.65024704", "0.6496728", "0.6493483", "0.6492324", "0.6486785"...
0.6418603
30
Tests successfully calling POST jobs view to queue a new job with a job type configuration
def test_invalid_configuration(self): config = copy.deepcopy(self.configuration) config['version'] = 'BAD' json_data = { "input" : { 'version': '6', 'files': {'input_a': [self.source_file.id]}, 'json': {} }, "jo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_job(self):\n body = UnitTesterJobCreateReq()\n response = self.client.open(\n '/v1/job',\n method='POST',\n data=json.dumps(body),\n content_type='application/json')\n self.assert200(response,\n 'Response body is :...
[ "0.78750724", "0.72232294", "0.7020715", "0.6856077", "0.68294907", "0.68141365", "0.6792085", "0.67661196", "0.67233115", "0.671573", "0.6669526", "0.665389", "0.663036", "0.6624836", "0.65925753", "0.65349627", "0.6503242", "0.6497989", "0.64939517", "0.6492833", "0.6487515...
0.0
-1
Tests creating a new seed job type with a mount referenced in configuration but not interface.
def test_create_seed_missing_mount(self): url = '/%s/job-types/' % self.api manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST) manifest['job']['name'] = 'my-job-no-mount' manifest['job']['interface']['mounts'] = [] config = copy.deepcopy(self.configuration) #TOD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_seed_job_type(self):\n\n url = '/%s/job-types/' % self.api\n manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST)\n manifest['job']['name'] = 'my-new-job'\n\n json_data = {\n 'icon_code': 'BEEF',\n 'is_published': True,\n 'docker_image...
[ "0.76392204", "0.7331149", "0.71244127", "0.7043642", "0.7030162", "0.6976633", "0.68316984", "0.65601784", "0.6413352", "0.62300986", "0.6183064", "0.6148942", "0.6084777", "0.60613924", "0.6031164", "0.59884447", "0.5979086", "0.59624445", "0.59482163", "0.57588047", "0.575...
0.8275159
0
Tests creating a job type with partial GPU resource.
def test_create_seed_partial_gpu_resource(self): url = '/%s/job-types/' % self.api manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST) manifest['job']['resources']['scalar'].append({'name': 'gpus', 'value': 1.1 }) json_data = { 'icon_code': 'BEEF', 'is_pub...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_seed_missing_mount(self):\n\n url = '/%s/job-types/' % self.api\n manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST)\n manifest['job']['name'] = 'my-job-no-mount'\n manifest['job']['interface']['mounts'] = []\n\n config = copy.deepcopy(self.configuration)\...
[ "0.60723585", "0.6057607", "0.5913958", "0.5913958", "0.5898015", "0.5852572", "0.5801169", "0.5785675", "0.57483697", "0.5725066", "0.57226443", "0.5686164", "0.56551105", "0.5651964", "0.55958486", "0.5556871", "0.5555656", "0.5477532", "0.5448404", "0.5340549", "0.53265566...
0.7960225
0
Tests editing an existing seed job type and automatically updating recipes.
def test_edit_seed_job_type_and_update(self, mock_create, mock_msg_mgr): url = '/%s/job-types/' % self.api manifest = copy.deepcopy(job_test_utils.MINIMUM_MANIFEST) manifest['job']['packageVersion'] = '1.0.1' json_data = { 'icon_code': 'BEEF', 'is_published': Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_edit_seed_job_type(self):\n\n url = '/%s/job-types/' % self.api\n\n # Create original job\n manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST)\n _ = job_test_utils.create_seed_job_type(manifest=manifest, max_scheduled=2,\n ...
[ "0.81842685", "0.73413455", "0.7107221", "0.6583987", "0.64824474", "0.6461304", "0.6325567", "0.6158022", "0.60970724", "0.6055784", "0.59063226", "0.58675337", "0.58617043", "0.58579785", "0.58347833", "0.5818397", "0.57932633", "0.5780653", "0.57779866", "0.5764836", "0.57...
0.7694319
1
Tests validating a new job type.
def test_successful(self): manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST) json_data = { 'manifest': manifest, 'configuration': self.configuration } url = '/%s/job-types/validation/' % self.api response = self.client.generic('POST', url, json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_seed_job_type(self):\n\n url = '/%s/job-types/' % self.api\n manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST)\n manifest['job']['name'] = 'my-new-job'\n\n json_data = {\n 'icon_code': 'BEEF',\n 'is_published': True,\n 'docker_image...
[ "0.723856", "0.71158105", "0.68406963", "0.6807165", "0.67090386", "0.6649865", "0.65892065", "0.65102017", "0.64844936", "0.6396589", "0.633824", "0.62192804", "0.6214928", "0.6173756", "0.61065197", "0.6082194", "0.6057175", "0.6057098", "0.602485", "0.6021146", "0.5960048"...
0.6421493
9
Tests validating a new job type with a valid configuration.
def test_successful_configuration(self): url = '/%s/job-types/validation/' % self.api manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST) json_data = { 'manifest': manifest, 'configuration': self.configuration } response = self.client.generic('POST...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_seed_job_type(self):\n\n url = '/%s/job-types/' % self.api\n manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST)\n manifest['job']['name'] = 'my-new-job'\n\n json_data = {\n 'icon_code': 'BEEF',\n 'is_published': True,\n 'docker_image...
[ "0.7134642", "0.6953501", "0.6948372", "0.66355145", "0.64982677", "0.6495057", "0.64632875", "0.6430286", "0.64149153", "0.6376788", "0.6334916", "0.630562", "0.62463266", "0.6100859", "0.6098912", "0.6096698", "0.60396206", "0.6036438", "0.6035248", "0.5982708", "0.59761775...
0.6990869
1
Tests validating a new job type with a mount referenced in manifest but not configuration.
def test_missing_mount(self): url = '/%s/job-types/validation/' % self.api manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST) config = copy.deepcopy(self.configuration) config['mounts'] = {} json_data = { 'manifest': manifest, 'configuration': conf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_seed_missing_mount(self):\n\n url = '/%s/job-types/' % self.api\n manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST)\n manifest['job']['name'] = 'my-job-no-mount'\n manifest['job']['interface']['mounts'] = []\n\n config = copy.deepcopy(self.configuration)\...
[ "0.77034205", "0.75372714", "0.68291485", "0.65946376", "0.6209426", "0.61843187", "0.61725724", "0.60452473", "0.60439664", "0.586217", "0.5859187", "0.5821242", "0.58150715", "0.575811", "0.570125", "0.56663406", "0.5549309", "0.5495656", "0.5489298", "0.5470538", "0.544415...
0.7535911
2
Tests validating a new job type with a setting referenced in manifest but not configuration.
def test_missing_setting(self): url = '/%s/job-types/validation/' % self.api manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST) config = copy.deepcopy(self.configuration) config['settings'] = {} json_data = { 'manifest': manifest, 'configuration': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_seed_missing_setting(self):\n url = '/%s/job-types/' % self.api\n manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST)\n manifest['job']['name'] = 'my-job-no-setting'\n manifest['job']['interface']['settings'] = []\n config = copy.deepcopy(self.configuration...
[ "0.7316615", "0.6921988", "0.6893932", "0.67550915", "0.6594161", "0.65127385", "0.6435525", "0.6276296", "0.62110454", "0.61712074", "0.61238915", "0.61195177", "0.6020272", "0.60135084", "0.597919", "0.59704816", "0.58727884", "0.5815547", "0.57999295", "0.57591754", "0.573...
0.72118706
1
Tests validating a new job type with media types not specified
def test_empty_media(self): manifest = copy.deepcopy(job_test_utils.COMPLETE_MANIFEST) manifest['job']['interface']['inputs']['files'][0]['mediaTypes'] = [] config = copy.deepcopy(self.configuration) json_data = { 'manifest': manifest, 'configuration': config ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mimetypes(self):\n field = TypedFileField(required=False, type_whitelist=self.good_types, use_magic=False)\n\n for t in self.good_types:\n name = 'somefooname'\n file = UploadedFile(name=name, size=1, content_type=t)\n assert field.clean(file) is file\n\n ...
[ "0.6556515", "0.6492207", "0.6403893", "0.634156", "0.63308465", "0.63289565", "0.6316567", "0.6293613", "0.61929864", "0.61182165", "0.60781485", "0.6050145", "0.60117364", "0.59424496", "0.594226", "0.5934616", "0.59020036", "0.58884007", "0.5885912", "0.5880606", "0.586640...
0.7604199
0
Return the last updated at.
def get_last_updated_at(self): return self.last_updated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_updated(self):\n return self._last_updated", "def last_update(self):\n return self._last_update", "def last_update(self):\n return self._last_update", "def updated_at(self) -> str:\n return pulumi.get(self, \"updated_at\")", "def last_updated_time(self) -> str:\n ...
[ "0.832315", "0.8285082", "0.8285082", "0.82616824", "0.82501084", "0.8236918", "0.8228391", "0.8228391", "0.8228391", "0.82221276", "0.8216972", "0.81940615", "0.8193912", "0.8180323", "0.8177852", "0.8177852", "0.7975151", "0.7972462", "0.7955524", "0.7902072", "0.7902072", ...
0.8872946
0
Return if update is due
def should_update(self): if self.last_updated is None: return True now = dt_util.utcnow() update_due_at = self.last_updated.replace(tzinfo=pytz.UTC) + datetime.timedelta(minutes=2) return now > update_due_at
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def needs_update(self):\n now = time.time()/60\n return (self.last_update_time_in_minutes+self.timeout) < now", "def needs_update(self) -> bool:\n return False", "def should_update(self) -> bool:\n if CoronaCaseRaw.objects.all().count() == 0:\n return True\n last_u...
[ "0.7477646", "0.72940886", "0.726589", "0.72572637", "0.71963775", "0.70316005", "0.7030253", "0.70166487", "0.7000936", "0.6986575", "0.6942744", "0.6942744", "0.6942744", "0.6942744", "0.6942744", "0.6942744", "0.6942744", "0.6930518", "0.691262", "0.6848018", "0.6802799", ...
0.80324763
0
True if the customer is on the mailing list.
def get_receive_mail(self): return self.__mail
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_customer(self):\n return self.customer is not None", "def get_is_workshop_contact(self, obj):\n user = self.context['request'].user\n if not user.is_authenticated:\n return False\n # pylint: disable=no-member\n profile = UserProfile.objects.get(user=user)\n ...
[ "0.625032", "0.6242539", "0.6146902", "0.6045338", "0.5888994", "0.58639693", "0.57913667", "0.57574534", "0.57183003", "0.57161397", "0.56964856", "0.56706697", "0.56545794", "0.56545126", "0.5594598", "0.5589392", "0.55694026", "0.5555309", "0.5545143", "0.55422497", "0.552...
0.0
-1
Set the customer to receive mail.
def set_receive_mail(self): self.__mail = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer_email(self, customer_email):\n self._customer_email = customer_email", "def set_receive_no_mail(self):\n self.__mail = False", "def send(self, email):\n client = self.clients[email.addressee]\n client.receive(email)", "def reply_to_email_address(self, val: EmailAddres...
[ "0.68477094", "0.6692235", "0.6144909", "0.6067829", "0.59754276", "0.5912679", "0.5891554", "0.5886647", "0.5854606", "0.5824143", "0.5824143", "0.5824143", "0.5824143", "0.5824143", "0.5824143", "0.5824143", "0.5824143", "0.5824143", "0.5824143", "0.5798914", "0.5788865", ...
0.7814865
0
function that sanitizes the word; the new one is made out of lowercase letters, with no special characters
def cleanWord(word): newWord = [letter.lower() for letter in word if letter.isalpha()] return "".join(newWord)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_word(word):\n\n return word.lower()", "def good_word(self, word):\r\n return word.strip().lower()", "def clean_word(self, word):\n return self.filter_pattern.sub(u'', word.lower())", "def process_word(word: str) -> str:\r\n return re.compile(r\"[\\W_]+\").sub(\"\", word.lowe...
[ "0.8072788", "0.801075", "0.78258234", "0.775214", "0.7739441", "0.7684654", "0.7583506", "0.75010467", "0.74785316", "0.7453251", "0.74348897", "0.7426722", "0.7387961", "0.73865765", "0.7382011", "0.73748505", "0.7346464", "0.7281933", "0.72702575", "0.7255493", "0.72537535...
0.8149033
0
UNIT_MAC_ADDRESS Register Decoder [register[0]lsb=octet 0 [register[0]]msb=octet 1 [register[1]]lsb=octet 2 [register[1]]msb=octet 3 [register[2]]lsb=octet 4 [register[2]]msb=octet 5
def test_unit_mac_address_decode(self): octet0 = 0xFF octet1 = 0xFE octet2 = 0xFB octet3 = 0xFA octet4 = 0xF7 octet5 = 0xF6 decode = MidniteClassicModbusRegisters.UNIT_MAC_ADDRESS['decode'] registers = [] registers.append((octet1 << 8) | octet0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eth_addr(a):\n if isinstance(a, bytes):\n a = a.decode(\"latin\")\n string = \"%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\"\n mac = string % (ord(a[0]), ord(a[1]), ord(a[2]),\n ord(a[3]), ord(a[4]), ord(a[5]))\n return mac", "def _mac_addr(address):\n return ':'.join('%02x' % ord(...
[ "0.6269726", "0.61748576", "0.6128788", "0.60488796", "0.59923536", "0.5981707", "0.59033936", "0.58985364", "0.58804274", "0.5858329", "0.57723445", "0.57420295", "0.57420295", "0.57420295", "0.57420295", "0.57008517", "0.569561", "0.56954783", "0.56885636", "0.568357", "0.5...
0.75703514
0
Returns whether t is the mirror image of s.
def equal_mirror(t, s): if t is None and s is None: return True if t is None or s is None: return False if t.value != s.value: return False return equal_mirror(t.left, s.right) and equal_mirror(t.right, s.left)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_symmetric(t):\n return t is None or equal_mirror(t.left, t.right)", "def op_mirror():\n mir = np.array([[1, 0, 0, 0],\n [0, 1, 0, 0],\n [0, 0, -1, 0],\n [0, 0, 0, -1]])\n return mir", "def mirror(self):\n self.__mirror = not self._...
[ "0.6540976", "0.6229064", "0.60574174", "0.6020641", "0.5898828", "0.58954555", "0.5646771", "0.5583662", "0.55832696", "0.554391", "0.5518999", "0.54967046", "0.54027903", "0.5395745", "0.53739166", "0.53451914", "0.53015715", "0.5296708", "0.5271289", "0.526143", "0.5253863...
0.6785623
0
Returns True if user_obj has any permissions in the given app_label.
def has_module_perms(self, user_obj, app_label): if not user_obj.is_active: return False for perm in self.get_all_permissions(user_obj): if perm.partition(':')[0] == app_label: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_module_perms(self, user_obj, app_label):\n if not user_obj.is_active:\n return False\n for perm in self.get_all_permissions(user_obj):\n if perm[:perm.index('.')] == app_label:\n return True\n return False", "def has_module_perms(self, user_obj, a...
[ "0.8334002", "0.83035064", "0.8126325", "0.76737654", "0.76737654", "0.76737654", "0.7240652", "0.7240652", "0.7219812", "0.7219812", "0.7219812", "0.7185739", "0.7185739", "0.7147702", "0.71442753", "0.7129628", "0.7125414", "0.69528574", "0.67746526", "0.6771788", "0.671836...
0.8357148
0
Create a new K_i 1form which is a subclass of sp.Expr.
def __new__(cls, index: int) -> Expr: return Expr.__new__(cls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_ExpressionDomain(K1, a, K0):\n return K1.from_sympy(a.ex)", "def from_AlgebraicField(K1, a, K0):\n return None", "def g(t1):\n if isinstance(t1, IdentExp) and self.st.has_key(t1.name):\n ninfo = self.st[t1.name]\n if ninfo[...
[ "0.60819924", "0.56950134", "0.5455957", "0.5454403", "0.53961927", "0.5385411", "0.53205115", "0.5313881", "0.5301945", "0.5283174", "0.52755", "0.5263905", "0.5225127", "0.5212662", "0.5202932", "0.51696295", "0.51377547", "0.5116334", "0.5107391", "0.51052475", "0.5054672"...
0.5798519
1
A K 1form is considered < another ONLY if the first has a lower index.
def __lt__(self, other: object) -> bool: if not isinstance(other, K): return NotImplemented return self.index < other.index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __lt__(self, other):\n return self.index < other.index", "def __lt__(self, other):\n return self.weight() < other.weight()", "def __lt__(self, other):\n\t\t# Numpy internally checks if the dimensions of self and other match\n\t\ttry:\n\t\t\treturn self.val < other.val\n\t\texcept:\n\t\t\tretu...
[ "0.767236", "0.726257", "0.7154725", "0.7119674", "0.71133405", "0.7093407", "0.70493263", "0.7045782", "0.7036397", "0.69932616", "0.69872814", "0.698478", "0.6964432", "0.694746", "0.6933484", "0.68929505", "0.68795276", "0.68761593", "0.68419296", "0.6841636", "0.6841636",...
0.73524624
1
A K 1form is considered > another ONLY if the first has a larger index.
def __gt__(self, other: object) -> bool: if not isinstance(other, K): return NotImplemented return self.index > other.index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gt__(self, other):\n return self._key > other._key", "def __gt__(self, other):\n return self.element() > other.element()", "def __gt__(self, other):\n return self.weight() > other.weight()", "def __ge__(self, other):\n return self._key >= other._key", "def __gt...
[ "0.67352456", "0.6663886", "0.6582782", "0.6521015", "0.6498984", "0.6478044", "0.6442183", "0.6432497", "0.6388376", "0.6383662", "0.6377195", "0.63403666", "0.6332116", "0.6307671", "0.62987167", "0.62496984", "0.62478805", "0.6238999", "0.62358934", "0.62301874", "0.621768...
0.72446746
0
Sympy method used when stringtype printing an expression.
def _sympystr(self, printer: StrPrinter, *args: Any) -> str: return self.__str__()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.symptoms", "def _repr_(self):\n ending = \"\"\n if str(self.t)!='t':\n ending = ' with t=%s'%(self.t)\n return \"%s-Bounded Quotient of Symmetric Functions over %s\"%(self.k, self.base_ring())+ending", "def _repr_(self):\n if self.p...
[ "0.63241726", "0.6306856", "0.62558675", "0.6226104", "0.61919534", "0.61719775", "0.6159256", "0.6106977", "0.61055726", "0.6094441", "0.6040651", "0.6003904", "0.5997042", "0.59798014", "0.5957182", "0.5933474", "0.59155375", "0.59113604", "0.59102625", "0.59102625", "0.590...
0.7750228
0
calc market buy price basically the price will be the bottom edge of the order book if there is enough volume on the board. if there is not enough volume, the price will be slip two tick.
def calc_market_order_sell(self, time, order_volume): rec = self.select_order_book_price_with_retry(time) if rec is None: return None sell_min, sell_volume, buy_max, buy_volume = rec if order_volume * 1.5 < buy_volume: # 2 means enough margin return buy_max ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_market_order_buy(self, time, order_volume):\n rec = self.select_order_book_price_with_retry(time)\n if rec is None:\n return None\n\n sell_min, sell_volume, buy_max, buy_volume = rec\n\n if order_volume * 1.5 < sell_volume: # 1.5 means enough margin\n retu...
[ "0.7644379", "0.73252493", "0.71064645", "0.6861299", "0.6836203", "0.6740187", "0.6721955", "0.6717904", "0.67110115", "0.6676819", "0.6629624", "0.65691185", "0.6565536", "0.65240175", "0.6506088", "0.6482311", "0.6455748", "0.6454343", "0.64360243", "0.6399607", "0.6397912...
0.7431583
1
Format a URL for use with the pScheduler API where the host name may include a port.
def api_url_hostport(hostport=None, path=None, protocol=None ): (host, port) = api_host_port(hostport) return api_url(host=host, port=port, path=path, protocol=protocol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_url(self):\n return 'http://{}:{}'.format(self.host, self.port)", "def url(self):\n return 'http://%s:%d' % (self._host, self._port)", "def MakeUrl(host, port=80, location=''):\n return \"http://{shost}{sdelimiter}{sport}/{slocation}\".format(\\\n shost=host,\n sdeli...
[ "0.6722662", "0.66572356", "0.66373", "0.66078824", "0.6596613", "0.65629095", "0.64684093", "0.6434053", "0.6409403", "0.63907", "0.63250756", "0.6320055", "0.6301745", "0.6298575", "0.62772787", "0.6273409", "0.62430626", "0.6210198", "0.6202425", "0.61951447", "0.6181695",...
0.69047576
0
Returns the n least indices from a numpy array.
def least_indices(array: np.ndarray, n: int) -> tuple: flat = array.ravel() indices = np.argpartition(flat, n)[:n] indices = indices[np.argsort(flat[indices])] return np.unravel_index(indices, array.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_min_indexes(num_list, number):\n result = []\n\n num_list = np.array(num_list)\n result = np.argpartition(num_list, number)[:number]\n\n return result", "def _atleastnd(array, n):\n return array[tuple((n - array.ndim) * [None] + [...])]", "def indices_of_top_k(arr, k):\n return np.s...
[ "0.6699951", "0.6369801", "0.6351531", "0.63482475", "0.6337745", "0.6283196", "0.62770814", "0.62731004", "0.6174572", "0.6059975", "0.6046586", "0.6008829", "0.597345", "0.5922383", "0.5922142", "0.5830239", "0.5806125", "0.5806125", "0.5806125", "0.5800424", "0.5784073", ...
0.8411042
0
Computes the precision for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].view(-1).float().sum(0) res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.76427615", "0.74189496", "0.7418079", "0.72710466", "0.72456723", "0.72446615", "0.7237539", "0.72213703", "0.7210107", "0.7058935", "0.6852219", "0.6786084", "0.67836976", "0.6768417", "0.67273885", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0....
0.0
-1
Make sure search.js is available.
def test_searchjs_is_available(self): portal = self.layer['portal'] resreg = getattr(portal, 'portal_registry') from Products.CMFPlone.interfaces import IResourceRegistry resources_ids = resreg.collectionOfInterface( IResourceRegistry, prefix="plone.resources").keys() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_search(self):\n self._raise_not_supported()", "def test_ajax_search(self):\r\n # first let's add a bookmark we can search on\r\n self._get_good_request()\r\n search_res = self.testapp.get(\r\n '/admin/results/google',\r\n headers={\r\n 'X...
[ "0.5830815", "0.5661299", "0.5634201", "0.54015934", "0.54015934", "0.54015934", "0.5390908", "0.53033394", "0.5271931", "0.5219346", "0.51868314", "0.5176507", "0.51090026", "0.50862396", "0.5069168", "0.5049332", "0.5044209", "0.5027725", "0.50236493", "0.49876714", "0.4981...
0.65277934
0
Get the config file path
def config_file(self): return self[CONFIG_FILE_KEY]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_config_filepath(self):\n\t\tif self.configfilepath is None:\n\t\t\treturn os.path.join(self.workdir, \"config.txt\")\n\t\telse:\n\t\t\treturn self.configfilepath", "def configPath(self):\n return os.path.dirname(__file__)", "def get_config_path(config):\n section = config.sections()[0]\n ...
[ "0.85868555", "0.8523847", "0.8487589", "0.8456098", "0.8432063", "0.8420124", "0.83868843", "0.8269511", "0.81340516", "0.8096346", "0.8094171", "0.79818237", "0.79137003", "0.7890298", "0.7819886", "0.779162", "0.77871495", "0.77624655", "0.7731405", "0.7686212", "0.7675738...
0.82458407
8
Get an individual sample object from the project. Will raise a ValueError if the sample is not found. In the case of multiple samples with the same name (which is not typically allowed), a warning is raised and the first sample is returned
def get_sample(self, sample_name): samples = self.get_samples([sample_name]) if len(samples) > 1: _LOGGER.warning("More than one sample was detected; " "returning the first") try: return samples[0] except IndexError: raise V...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sample_by_id():\n sample_id = demisto.getArg('id')\n r = req('GET', SUB_API + 'samples/' + sample_id)\n sample = sample_to_readable(r.json().get('data'))\n md = tableToMarkdown('ThreatGrid - Sample', [sample], [\n 'ID', 'Filename', 'State', 'Status', 'MD5', 'SHA1', 'SHA256', 'OS', 'Submi...
[ "0.6783552", "0.64806545", "0.64798176", "0.6444538", "0.6350471", "0.6228321", "0.62184", "0.61716473", "0.6165317", "0.615692", "0.6146812", "0.6091206", "0.6089562", "0.60834223", "0.5920894", "0.58156663", "0.581385", "0.5785201", "0.575101", "0.57384306", "0.5726337", ...
0.84053683
0
Creates a new Line from a point and a direction vector
def createNew(cls, x0, y0, z0, a, b, c): p0 = Vector(x0, y0, z0) d = Vector(a, b, c) return cls(p0, d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createFromPointAndVector(cls, point, vector, **kwargs):\n return cls(point, vector.angle, **kwargs)", "def line_to(self, point: Onion[Tuple[float, float], Point2D, Point3D, Point]):\n start_point = self.last_point\n end_point = _point_2d(point)\n self._segments.append(Line3D.creat...
[ "0.6815035", "0.67762303", "0.66951627", "0.6677982", "0.65358514", "0.6486385", "0.64352816", "0.64182884", "0.64173704", "0.64090496", "0.6398139", "0.639303", "0.6359721", "0.6332509", "0.62868625", "0.62791145", "0.6259376", "0.6256764", "0.62513655", "0.62213624", "0.618...
0.0
-1
Creaates a new Line from two points on the line
def createTwoPoints(cls, x1, y1, z1, x2, y2, z2): d = Vector(x2 - x1, y2 - y1, z2 - z1) p0 = Vector(x1, y1, z1) return cls(p0, d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_line(point_1, point_2):\r\n A = point_1.y - point_2.y\r\n B = point_2.x - point_1.x\r\n C = point_1.y * B + point_1.x * A\r\n return np.matrix([[A],[B],[-C]])", "def create_line(self, x1, y1, x2, y2, style=None, parent=None):\n attrs = {'d': 'M %5f %5f L %5f %5f' % (x1, y1, x2, y2...
[ "0.7899847", "0.75599235", "0.747116", "0.72926456", "0.7283897", "0.72287744", "0.7198576", "0.7019089", "0.6949199", "0.6890133", "0.6878132", "0.68514836", "0.6763256", "0.67233336", "0.6718874", "0.6718318", "0.66828096", "0.6665806", "0.66650134", "0.66547966", "0.664058...
0.62220514
61
Creaates a new Line from two points on the line
def createThreePoints(cls, x1, y1, z1, x2, y2, z2, x3, y3, z3): d = np.array([x2 - x1, y2 - y1, z2 - z1]) p0 = np.array([x1, y1, z1]) return cls(p0, d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_line(point_1, point_2):\r\n A = point_1.y - point_2.y\r\n B = point_2.x - point_1.x\r\n C = point_1.y * B + point_1.x * A\r\n return np.matrix([[A],[B],[-C]])", "def create_line(self, x1, y1, x2, y2, style=None, parent=None):\n attrs = {'d': 'M %5f %5f L %5f %5f' % (x1, y1, x2, y2...
[ "0.7899847", "0.75599235", "0.747116", "0.72926456", "0.7283897", "0.72287744", "0.7198576", "0.7019089", "0.6949199", "0.6890133", "0.6878132", "0.68514836", "0.6763256", "0.67233336", "0.6718874", "0.6718318", "0.66828096", "0.6665806", "0.66650134", "0.66547966", "0.664058...
0.0
-1
Returns a normal unit vector to the plane by crossing the two direction vectors
def normal(self) -> Vector: return normalize(cross(self.d1, self.d2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal_vector(origin, vectors):\n return np.cross(vectors[0] - origin, vectors[1] - origin)", "def plane_equation(point_a, point_b, point_c):\n v1 = np.subtract(point_a, point_c)\n v2 = np.subtract(point_a, point_b)\n normal = np.cross(v1, v2)\n # print 'b4 norm', normal\n unit_normal = nor...
[ "0.79587084", "0.7533136", "0.7469607", "0.72210085", "0.7160066", "0.7125642", "0.71110463", "0.70975286", "0.7069419", "0.7015354", "0.699165", "0.69284326", "0.6860229", "0.68145454", "0.67635846", "0.6712413", "0.6694899", "0.6546803", "0.65047336", "0.6492596", "0.648341...
0.7678387
1
Returns True if the point is in the plane, and False otherwise.
def isInPlane(self, p) -> bool: # Testing for zero is done with math.isclose, to avoid rounding/floating point errors. # Since we are testing near zero, abs_tol is set to 1e-09 return math.isclose( math.fabs( dot( self.normal(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_point_on_plane(self, point, plane):\n _dist = point.dot(plane[:3]) + plane[3]\n if _dist <= epsilon:\n print('OK => point on plane')\n else:\n print('NO => point not on plane')", "def is_point_on_plane(point, plane, tol=0.0):\n d = distance_point_plane(point...
[ "0.7954878", "0.7732451", "0.7634303", "0.7125201", "0.7125201", "0.7115368", "0.70533705", "0.7017655", "0.6967094", "0.69556975", "0.69418865", "0.6887939", "0.685035", "0.68368244", "0.6745507", "0.6722026", "0.6715575", "0.6660624", "0.66094464", "0.6609434", "0.66033906"...
0.8154762
0
Returns the cross product of v1 and v2
def cross(v1: Vector, v2: Vector) -> Vector: # Function is fucked TODO if len(v1.coords) != 3 or len(v2.coords) != 3: raise ValueError("Vectors have to be 3 fucking D, nøøb") x = v1.y * v2.z - v1.z * v2.y y = v1.z * v2.x - v1.x * v2.z z = v1.x * v2.y - v1.y * v2.x return Vector(x, y, z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_product(v1, v2):\n return cg3d_vector.CG3dVector(\n v1[1] * v2[2] - v2[1] * v1[2],\n v1[2] * v2[0] - v2[2] * v1[0],\n v1[0] * v2[1] - v2[0] * v1[1]\n )", "def cross(v1, v2):\n return np.cross(v1, v2)", "def get_cross2d(v1, v2):\n return v1[0]*v2[1] - v1[1]*v2[0]", "...
[ "0.8836206", "0.8598363", "0.8200351", "0.81112856", "0.793102", "0.78326195", "0.76785076", "0.767486", "0.75726616", "0.75629556", "0.7525718", "0.74057496", "0.73896706", "0.7378521", "0.73637885", "0.73448867", "0.7316983", "0.7315272", "0.7226312", "0.7180984", "0.717917...
0.7711393
6
Returns True if self and other have same dimensions
def equal_size(self, other): if not isinstance(other, Matrix): raise ValueError("Can only compare two matrices") return other.m == self.m and other.n == self.n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return (isinstance(other, self.__class__) and\n self._input_dims == other._input_dims and\n self._output_dims == other._output_dims)", "def __eq__(self, other):\n if self.get_dimensions() == other.get_dimensions():\n is_equal = (np...
[ "0.80113983", "0.78637797", "0.7596701", "0.75813335", "0.7556219", "0.7554189", "0.7521945", "0.73847556", "0.7377276", "0.7280874", "0.7275362", "0.7254235", "0.7247695", "0.7175492", "0.71704185", "0.711962", "0.711626", "0.7103731", "0.7096644", "0.7059979", "0.704843", ...
0.78446364
2
The minimum possible distance from the target to a point in this ball
def min_distance(self, target): difference = self.pivot - target return max(math.sqrt(np.dot(difference, difference)) - self.radius, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetDistanceFromTarget(self):\n return abs(int(self.position[0] - self.target_position[0])) + abs(int(self.position[1] - self.target_position[1]))", "def find_minimum_path_cost(cls, start_point: Coordination, current_point: Coordination) -> int:\n return abs(start_point.x - current_point.x) + ab...
[ "0.71056867", "0.69011074", "0.6862825", "0.6780019", "0.67667633", "0.676105", "0.6746076", "0.67248785", "0.67235637", "0.67166865", "0.67166865", "0.67166865", "0.67166865", "0.67166865", "0.67166865", "0.67166865", "0.6631932", "0.6581884", "0.6561773", "0.6548339", "0.65...
0.8214852
0
Converts 'pixel' values (015) into the 4BPP format. If its a 16x16 Tile, interleaves the 8x8 subtiles.
def pack(self, data): #Need exception handling for packing incorrectly sized data tile_fmt = Struct(32 * 'c') tile_iter = tile_fmt.iter_unpack(data) vals = [Tile._tile_to_bitplanes(b''.join(tile)) for tile in tile_iter] self.data = b''.join(vals) if self.dimensions == 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pixelcode(self):\n\n maxX, maxY = self.size()\n result = bitmap((2*maxX, 2*maxY))\n for x in range(maxX):\n for y in range(maxY):\n pixel = self.get(x,y)\n result.set(2*x,2*y, pixel)\n result.set(2*x,2*y+1, not pixel)\n ...
[ "0.57446426", "0.5660707", "0.5606068", "0.5488529", "0.5485934", "0.53451556", "0.52073056", "0.5155469", "0.5108598", "0.5093933", "0.50916094", "0.5070422", "0.504833", "0.50416523", "0.5036689", "0.5036689", "0.5035291", "0.5028214", "0.50253576", "0.50063944", "0.4990180...
0.48106438
43
A private method. Converts the 4 bytes of bitplanes 14 for a given row into a row of pixel values
def _make_row_of_pixels(bitplane_rows): mask = int(b'00000001') row_of_pixels = [] for _ in range(0, 8): masked = [value & mask for value in bitplane_rows] bitplane_rows = [value >> 1 for value in bitplane_rows] bitplane_values = masked[3] << 3 | masked[2] << ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ht1632_data(self, matrix_row, matrix_col):\n start_row = matrix_row * 8\n stop_row = start_row + 8\n start_col = matrix_col * 16\n stop_col = start_col + 16\n return [\n self.pixel(col, row)\n for col in range(start_col, stop_col)\n for ro...
[ "0.60835254", "0.60070217", "0.56323963", "0.5579506", "0.55026233", "0.5452631", "0.5439869", "0.54370487", "0.5407903", "0.5399096", "0.53655875", "0.53536403", "0.5319791", "0.5261793", "0.52583045", "0.5249799", "0.52224034", "0.52151835", "0.52092916", "0.5205361", "0.51...
0.7027028
0
Returns the slice of the x values in the borders of lower to upper
def get_xrange(self) -> np.array: # todo: ensure this functions work as well for y_values lower, upper = self.get_xrange_indices() return self.x[lower, upper + 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xrange(self):\n return self.xvec[0], self.xvec[-1]", "def get_borders(self):\r\n return (self.tiles[0][0], self.tiles[-1][-1])", "def get_bounds(self):\n bottom_right = np.asarray([self.coords[k][0] for k in range(self.dim)])\n upper_left = np.asarray([self.coords[k][-1] for...
[ "0.7116615", "0.6489076", "0.6488109", "0.6477216", "0.63534915", "0.6346397", "0.63440883", "0.6324725", "0.62734646", "0.62409675", "0.6197077", "0.61946166", "0.6194017", "0.6142385", "0.6110951", "0.60656", "0.6042238", "0.6031381", "0.602991", "0.6027184", "0.6023213", ...
0.6865429
1
Returns the index of the spectrum's x value closest to the given x_value
def get_nearest_index(self, x_value: float) -> int: return int(np.argmax(self.x >= x_value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closest(array, value):\n idx = (np.abs(array-value)).argmin()\n return idx", "def find_nearest_idx(array: np.array, value: float) -> int:\n return (np.abs(array - value)).argmin()", "def find_nearest(array,value):\n idx = (np.abs(array-value)).argmin()\n return idx", "def find_nearest(arra...
[ "0.7193644", "0.7150365", "0.7055422", "0.70537055", "0.6955951", "0.6950862", "0.6950862", "0.681054", "0.6778951", "0.6697718", "0.6683862", "0.66723967", "0.66723967", "0.6669862", "0.6662467", "0.6594271", "0.6594126", "0.6536172", "0.651837", "0.64548606", "0.6416207", ...
0.7975915
0
Compute and return the maximum number of times that an outcome is repeated in a sequence.
def max_repeats(seq): max_item = 0 item_count = [seq.count(item) for item in seq] try: max_item = max(item_count) except ValueError: "arg is an empty sequence" return max_item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(n, array):\n\n counters = [0] * n\n\n # Current greatest value calculated so far\n max_count = 0\n\n for i in range(len(array)):\n if array[i] == n + 1:\n # max_count = max(counters)\n counters = [max_count] * n\n else:\n counters[array[i] - 1] += 1\n\n # To avoid calcula...
[ "0.66128737", "0.64712507", "0.6384586", "0.62839323", "0.62302214", "0.61802876", "0.61464226", "0.6130533", "0.61256", "0.6094303", "0.608199", "0.60044867", "0.6001028", "0.59532756", "0.5933321", "0.5933166", "0.592306", "0.5917714", "0.5910626", "0.59005713", "0.5859659"...
0.75281435
0
Relative Error. Calculating the relative error after approximating the derivative.
def rel_error(deriv, orig): return abs(orig - deriv) / abs(orig)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relative_error(x, y):\n return np.max(np.abs(x - y) / (np.maximum(1e-8, np.abs(x) + np.abs(y))))", "def calculate_error(self):\n self.network.index_nodes()\n self._calculate_dist()\n _, relative_error = self._relative_error()\n _, absolute_error = self._absolute_error()\n\n ...
[ "0.7002748", "0.68029606", "0.6756413", "0.66861445", "0.6677277", "0.6546871", "0.6546871", "0.6507089", "0.6325637", "0.6307579", "0.62953246", "0.6278389", "0.62690276", "0.62503904", "0.6243922", "0.62411505", "0.6216003", "0.61763114", "0.6157595", "0.61513627", "0.61403...
0.79668355
0
Get current datetime, month and day.
def get_date_pred(): date_now = dt.datetime.now() date_pred = [date_now - dt.timedelta(days=1)+dt.timedelta(days=i) for i in range(8)] month_pred = [item.month for item in date_pred] day_pred = [item.day for item in date_pred] return date_pred,month_pred,day_pred
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDate():\n current_time = datetime.datetime.now()\n day = current_time.day\n month = current_time.month\n year = current_time.year\n date = \"{dd}-{mm}-{yyyy}\".format(dd=day,mm=month,yyyy=year)\n return date", "def get_curr_year_month_date(self):\n return self.curr_year, self.curr...
[ "0.7333077", "0.7051306", "0.7046178", "0.69151866", "0.6912624", "0.68534875", "0.6850725", "0.6817092", "0.67979425", "0.6781454", "0.67629653", "0.67429596", "0.67121583", "0.66709596", "0.66521484", "0.660681", "0.65697086", "0.6503899", "0.6492846", "0.64700073", "0.6442...
0.0
-1
Start the client in a separate thread (nonblocking). This only has an effect if ``callable`` was set to `True` when initializing the client.
def start(self): if self._callable: self._is_running = True self._run_client()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def async_thread_call(fun, *args, **kwargs):\n t = Thread(\n target=_decorated_mp,\n args=(host(), port(), fun) + args,\n kwargs=kwargs)\n\n t.start()\n return t", "def threaded_call(self, thread_callable, result_callable, *args, **kwargs):\n thread_args = (thread_callable, ...
[ "0.6141838", "0.6057861", "0.59711367", "0.58784795", "0.57511634", "0.56575465", "0.5640221", "0.5562342", "0.5533273", "0.54995334", "0.54700834", "0.5466534", "0.54614997", "0.54494286", "0.5409379", "0.54008806", "0.5396998", "0.5360414", "0.53350174", "0.53307813", "0.53...
0.7465892
0
Whether the client is currently running.
def is_running(self): return self._is_running
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_running(self):\n\t\treturn self._running", "def is_running(self):\n\t\treturn self in _running", "def is_running(self):\n return self.running", "def is_running(self):\n return self.running", "def is_running(self):\n return self.running", "def is_running(self):\n return ...
[ "0.8290451", "0.827312", "0.8218995", "0.8218995", "0.8218995", "0.81724805", "0.81724805", "0.81672233", "0.8130093", "0.81268543", "0.8097921", "0.8071789", "0.80423975", "0.8023615", "0.8013505", "0.80053294", "0.79968977", "0.79892176", "0.7978779", "0.7950599", "0.792622...
0.8148527
9
Remove all logger bindings.
def clear(self) -> None: self.loggers.clear() self.topics.clear() self.bindings = BindFlag(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_loggers(self) -> \"Logger\":\n\n for logger, level in self.get_next_logger():\n logger.handlers.clear()\n\n delattr(self, f\"{level}_logger\")\n setattr(self, f\"{level}_logger\", None)", "def shut_down_logger(self):\n handlers = self.logger.handlers[:]\...
[ "0.7735314", "0.7238356", "0.7187282", "0.70959723", "0.6855077", "0.68328255", "0.68328255", "0.6795753", "0.6746925", "0.6710175", "0.66560286", "0.6642112", "0.6486889", "0.6465616", "0.63839597", "0.63325053", "0.6316204", "0.6294162", "0.6269843", "0.6223002", "0.6193672...
0.70741093
4
Populates the SQLAlchemy model from a python dictionary of the database structure.
def from_structure(self, structure): session = meta.Session() try: for resource_s in structure['resources']: log.debug("Importing: {0!r}".format(resource_s)) # First build up a list of group_ids for this resource that will correspond ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, session: \"FigoSession\", data_dict: dict) -> \"ModelBase\":\n return cls(session, **data_dict)", "def from_dict(self, dictionary):\n for column in self.__table__.columns.keys():\n value = dictionary.get(column, None)\n if value:\n setattr(sel...
[ "0.66094905", "0.6561508", "0.64928675", "0.63194597", "0.61999404", "0.6137899", "0.61052674", "0.6092039", "0.6091429", "0.60472214", "0.5995456", "0.59925824", "0.59787244", "0.5974147", "0.5957498", "0.59562784", "0.59562784", "0.59562784", "0.59562784", "0.59562784", "0....
0.0
-1
Returns the ground distance in metres between two LocationGlobal objects. This method is an approximation, and will not be accurate over large distances and close to the
def get_distance_metres(aLocation1, aLocation2): dlat = aLocation2.lat - aLocation1.lat dlong = aLocation2.lon - aLocation1.lon dlong *= math.cos( aLocation2.lat * math.pi / 180.0 ) return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_distance_metres(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aLocation2.lon - aLocation1.lon\n return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5", "def get_distance_metres(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aL...
[ "0.66186285", "0.66186285", "0.66186285", "0.66186285", "0.66186285", "0.65900946", "0.6587256", "0.6519813", "0.6266732", "0.62152517", "0.61653936", "0.6108386", "0.6068071", "0.6046107", "0.6002903", "0.594496", "0.5856215", "0.5854083", "0.57995534", "0.5740883", "0.57030...
0.6561412
7
Grassman distance between subspaces spanned by Y1 and Y2.
def compute_grassman_distance(Y1, Y2): Q1, _ = jnp.linalg.qr(Y1) Q2, _ = jnp.linalg.qr(Y2) _, sigma, _ = jnp.linalg.svd(Q1.T @ Q2) sigma = jnp.round(sigma, decimals=6) return jnp.linalg.norm(jnp.arccos(sigma))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self,coord_1, coord_2):\n return np.sqrt(np.sum((np.array(coord_1)-np.array(coord_2))**2))", "def distance_2d(pt1, pt2):\r\n return geometry.gmXyDistance(pt1, pt2)", "def distance(self, x2, y2):\r\n return math.sqrt((x2 - self.x) ** 2 + (y2 - self.y) ** 2)", "def calculate_dista...
[ "0.63750035", "0.6364339", "0.63368714", "0.63318604", "0.63260245", "0.6126886", "0.6106294", "0.6103109", "0.60844976", "0.6077597", "0.6038072", "0.6026896", "0.6014907", "0.60019726", "0.59889084", "0.59801686", "0.5971128", "0.59675956", "0.5966837", "0.5964724", "0.5956...
0.7337582
0
Allow relations if a model in the auth is involved.
def allow_relation(self, obj1, obj2, **hints): if obj1._meta.app_label in self.route_app_labels or obj2._meta.app_label in self.route_app_labels: return True return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_relation(self, obj1, obj2, **hints):\n return True", "def allow_relation(self, obj1, obj2, **hints):\n if self.isAdminApp(obj1) or self.isAdminApp(obj2):\n return True\n return None", "def allow_relation(self, obj1, obj2, **hints):\n\n result = (obj1._meta.model_na...
[ "0.7274707", "0.72074753", "0.70620376", "0.70593643", "0.70005584", "0.6937552", "0.6831612", "0.67932534", "0.6692975", "0.66282403", "0.65909636", "0.6573764", "0.6546737", "0.6481673", "0.63839835", "0.6359388", "0.6336396", "0.63229865", "0.6288271", "0.62351304", "0.620...
0.6619627
10
Shoot each triplet of bullets
def shoot_boolet(self): angle = self.angle for i in range(3): bullet = BulletAlienDos(self.main_game, shooter=self.shooter) bullet.vector[0] = 0 bullet.vector[1] = 1 bullet.normalized_vector = bullet.vector.normalize() bullet.normalized_vector ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shoot_bullets(self):\n\t\tBullet(self.birb.rect.x + 75, self.birb.rect.y + 35, self)", "def shootBullets(gunRects, bullets, mario):\n X, Y, VX, VY, DIR, STATE = 0, 1, 2, 3, 4, 5\n GUNSTATE, GUNCOUNT, GUNTYPE = 4, 5, 6\n BULLVX, BULLVY = 4, 5\n for gun in gunRects: # Going through each gun\n ...
[ "0.79569995", "0.7628294", "0.7338545", "0.7304998", "0.7265435", "0.71602637", "0.71326596", "0.705564", "0.69539404", "0.69408464", "0.69084615", "0.68753916", "0.68536586", "0.67735136", "0.6758498", "0.6705009", "0.66809344", "0.66642654", "0.65737426", "0.65737426", "0.6...
0.7984867
0
Mocks the consent.get_many function
def consent_get_many_mock(monkeypatch): mock = Mock() monkeypatch.setattr('datahub.company.consent.get_many', mock) yield mock
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_many(self, requests_mock, accepts_marketing, emails):\n matcher = requests_mock.post(\n f'{settings.CONSENT_SERVICE_BASE_URL}'\n f'{consent.CONSENT_SERVICE_PERSON_PATH_LOOKUP}',\n json={\n 'results': [\n {\n ...
[ "0.70563656", "0.62410563", "0.6048828", "0.5961752", "0.5884879", "0.5862552", "0.58443093", "0.58289975", "0.5828924", "0.5818068", "0.5818068", "0.5791438", "0.578489", "0.5782873", "0.5721536", "0.5701437", "0.56985384", "0.5693188", "0.5687945", "0.5663806", "0.56526726"...
0.8288459
0
Get all the id of courses which user is student
def get_all_student_courses(cls, user): member_record = CourseMember.objects.filter(user=user) member_teacher = member_record.filter(type = 3) student_list = [] for member in member_teacher: if member.course.pk not in student_list: student_list.append(member....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_campus_students(session, school):\n # Parameter to avoid getting staff users\n parameters = {'filter[staff?]': False}\n users = get_all_pages(session, f'/campus/{school}/users', 100, params=parameters)\n ids = []\n\n for user in users:\n # Check that the user is not anonymized by chec...
[ "0.7203225", "0.66299814", "0.6559162", "0.6548188", "0.64768285", "0.64467734", "0.643163", "0.636934", "0.63494414", "0.62324303", "0.61804605", "0.6110142", "0.61097056", "0.6091193", "0.6053416", "0.60518885", "0.6037809", "0.60351974", "0.60121375", "0.59662294", "0.5923...
0.7367765
0
Check user is teacher of course
def is_teacher_of(cls, user_id, course_id): return (cls.get_highest_course_privilege(user_id, course_id) < 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_teacher(uid=None):\n user = get_user(uid=uid)\n return user.get(\"teacher\", False)", "def is_teacher_leads(self, teacher_email):\n if not self.is_course_exists():\n print(\"Course with name - {} does not exist\".format(self._course_name))\n return\n course = self...
[ "0.79875153", "0.70364565", "0.67953515", "0.65655226", "0.65536416", "0.646244", "0.6434678", "0.6421935", "0.6334794", "0.6289663", "0.6239344", "0.61987686", "0.6141132", "0.6140396", "0.6043962", "0.6042014", "0.60153824", "0.59822667", "0.59713054", "0.5961152", "0.59465...
0.80501544
0
If len(xs) is odd, the median is the middle element
def _median_odd(xs: List[float]) -> float: return sorted(xs)[len(xs) // 2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def median(nums):\r\n count = len(nums)\r\n mid = count // 2\r\n if count % 2:\r\n return nums[mid]\r\n else:\r\n return (nums[mid - 1] + nums[mid]) / 2", "def median(x):\n length = len(x)\n\n if length == 0:\n return None\n\n center = length // 2\n\n ...
[ "0.81119084", "0.79590565", "0.7945483", "0.78034836", "0.7730942", "0.77275085", "0.77168965", "0.77095324", "0.7686096", "0.76572627", "0.7650494", "0.76356673", "0.7597743", "0.75814843", "0.7570954", "0.75554997", "0.7508157", "0.7488256", "0.74513394", "0.7423707", "0.74...
0.79402
3
If len(xs) is even, it's the average of the middle two elements
def _median_even(xs: List[float]) -> float: sorted_xs = sorted(xs) hi_midpoint = len(xs) // 2 # e.g. length 4 => hi_midpoint 2 return (sorted_xs[hi_midpoint - 1] + sorted_xs[hi_midpoint]) / 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avg(arr):\n return sum(arr) / float(len(arr))", "def average(lst):\n return sum(lst)/len(lst)", "def mean(xs):\n ave = 0\n for xs_split in xs:\n num = float(xs_split)\n print(xs_split)\n ave = ave+num\n average = ave/len(xs)\n return average", "def avg(l):\n retu...
[ "0.7064355", "0.7018793", "0.696159", "0.69408447", "0.6870554", "0.6860346", "0.6825491", "0.6806577", "0.6790866", "0.67725855", "0.67409027", "0.67254007", "0.6693766", "0.6644633", "0.66137445", "0.6602777", "0.65871716", "0.6575268", "0.6569375", "0.6558978", "0.6535161"...
0.7045297
1