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
Perform a single decoder step (1 word) prev_embed (batch_size x 1 x hidden_size) is the forward hidden state of the previous time step encoder_hidden (batch_size x seq_len x num_directionshidden_size) is the output of the encoder
def forward_step(self, prev_embed, encoder_hidden, src_mask, proj_key, hidden): # compute context vector using attention mechanism #we only want the hidden, not the cell state of the lstm CZW, hence the hidden[0] query = hidden[0][-1].unsqueeze(1) # [#layers, B, D] -> [B, 1, D] context...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decoding_layer_train(encoder_state, dec_cell, dec_embed_input, \n target_sequence_length, max_summary_length, \n output_layer, keep_prob):\n # TODO: Implement Function\n trainig_helper = tf.contrib.seq2seq.TrainingHelper(dec_embed_input, target_sequence_len...
[ "0.6969199", "0.6780015", "0.6675828", "0.6631871", "0.6631257", "0.6518986", "0.6500232", "0.64466816", "0.6433351", "0.6405943", "0.6390436", "0.633874", "0.6307271", "0.6290631", "0.62883985", "0.62649786", "0.62553316", "0.6223786", "0.61469346", "0.6134336", "0.60945153"...
0.73808
0
Unroll the decoder one step at a time. trg_embed is (batch_len x trg_max_seq_len x hidden_layer_size) encoder_hidden is (batch_len x src_max_seq_len x num_directionshidden_layer_size) encoder_final is a tuple of final hidden and final cell state. each state is (num_layers x batch x num_directionshidden_layer_size) src_...
def forward(self, trg_embed, encoder_hidden, encoder_final, src_mask, trg_mask, hidden=None, max_len=None): # the maximum number of steps to unroll the RNN #print("czw src mask", src_mask.size()) #print("czw trg embed", trg_embed.size())...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self):\n decoder_input = Input(shape=self.input_decoder_shape, batch_shape=self.input_batch_decoder_shape)\n ppg_input = Input(shape=self.input_ppg_shape, batch_shape=self.input_batch_ppg_shape)\n\n if self.hparams.Masking is True:\n mask_decoder_input = Masking(mask_valu...
[ "0.70889604", "0.6934026", "0.67979854", "0.6792283", "0.67251056", "0.66641283", "0.66246325", "0.65491724", "0.6515589", "0.6503188", "0.6498985", "0.6467742", "0.6402877", "0.63937545", "0.634613", "0.63212204", "0.6301298", "0.62883705", "0.6271386", "0.62639296", "0.6234...
0.8374908
0
Sets the host_name of this ServiceStatus.
def host_name(self, host_name): self._host_name = host_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hostname(self, hostname):\n\n self._hostname = hostname", "def hostname(self, hostname):\n\n self._hostname = hostname", "def set_hostname(self, hostname):\n raise NotImplementedError()", "def host(self, host: str):\n\n self._host = host", "def hostname(self, hostname):\n ...
[ "0.67096794", "0.67096794", "0.66622794", "0.65415365", "0.6456235", "0.6440934", "0.6440934", "0.6440934", "0.6440934", "0.64354765", "0.63991666", "0.6360109", "0.6351895", "0.63264483", "0.63041633", "0.62698", "0.6248818", "0.6149412", "0.61444885", "0.6125043", "0.596784...
0.78330445
1
Sets the request_count of this ServiceStatus.
def request_count(self, request_count): self._request_count = request_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_count(self, count):\n self._count = count", "def setCount(self, num):\n self.count=num", "def increment_requests_count(self, type):\n if type not in self._requests_count:\n self._requests_count[type] = 0\n self._requests_count[type] += 1", "def processor_count(s...
[ "0.61143875", "0.6090169", "0.60757643", "0.5920229", "0.580981", "0.57419944", "0.56955624", "0.56955624", "0.56955624", "0.56955624", "0.5691956", "0.5671192", "0.5636765", "0.56350935", "0.56350935", "0.5632811", "0.562519", "0.5617782", "0.5617782", "0.55696195", "0.55079...
0.81824696
0
Sets the max_memory_mb of this ServiceStatus.
def max_memory_mb(self, max_memory_mb): self._max_memory_mb = max_memory_mb
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_max_memory(self, mem: int) -> None:\n self.set_db_conf(\"maxmemory\", mem)", "def set_max_vm_mem(self, nMemSize):\n\t\tcall_sdk_function('PrlDispCfg_SetMaxVmMem', self.handle, nMemSize)", "def max_mb_ram_per_machine(self, max_mb_ram_per_machine):\n\n self._max_mb_ram_per_machine = max_mb_...
[ "0.7073272", "0.7004983", "0.6462245", "0.6370692", "0.63446045", "0.63059026", "0.6232075", "0.617325", "0.6105947", "0.6081569", "0.60103244", "0.59372926", "0.59331614", "0.5927879", "0.5899012", "0.5885115", "0.5861812", "0.5763049", "0.57599", "0.57453775", "0.5719504", ...
0.81979513
0
Sets the max_concurrent_requests of this ServiceStatus.
def max_concurrent_requests(self, max_concurrent_requests): self._max_concurrent_requests = max_concurrent_requests
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setMaxPendingRequests(self, maxPendingRequests):\n\n internals.blpapi_SessionOptions_setMaxPendingRequests(\n self.__handle,\n maxPendingRequests)", "def concurrent_requests(self, concurrent_requests):\n\n self._concurrent_requests = concurrent_requests", "def set_max_ev...
[ "0.67567164", "0.6361955", "0.59952843", "0.57208276", "0.56680435", "0.56667686", "0.5640322", "0.55707616", "0.5503928", "0.5464154", "0.5450268", "0.54443735", "0.54264", "0.5422357", "0.5411949", "0.5378406", "0.5376556", "0.5368424", "0.5341753", "0.5307853", "0.5299601"...
0.8375866
0
Sets the total_rejected_requests of this ServiceStatus.
def total_rejected_requests(self, total_rejected_requests): self._total_rejected_requests = total_rejected_requests
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_blocked_requests(self, total_blocked_requests):\n\n self._total_blocked_requests = total_blocked_requests", "def total_failed_per_group(self, total_failed_per_group):\n\n self._total_failed_per_group = total_failed_per_group", "def get_unaccepted_event_requests_count(self, staff_id):\n ...
[ "0.7080497", "0.5535078", "0.55186355", "0.5461105", "0.53644174", "0.5330559", "0.5257207", "0.5160343", "0.5119552", "0.5104305", "0.50554967", "0.5015153", "0.49821526", "0.49313498", "0.48860386", "0.48786807", "0.4848378", "0.47964743", "0.4773091", "0.47444278", "0.4735...
0.8934723
0
Sets the total_blocked_requests of this ServiceStatus.
def total_blocked_requests(self, total_blocked_requests): self._total_blocked_requests = total_blocked_requests
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_rejected_requests(self, total_rejected_requests):\n\n self._total_rejected_requests = total_rejected_requests", "def add_blocked(self, value: int = None):\n\n if value == 0:\n raise ValueError(\"You really want to increment of 0?\")\n\n if value is None:\n sel...
[ "0.6566967", "0.5396077", "0.5297246", "0.52390385", "0.51381385", "0.51212424", "0.5116383", "0.5092819", "0.50399786", "0.49869522", "0.4946165", "0.49331447", "0.4909148", "0.48940417", "0.48823512", "0.4861306", "0.48602244", "0.48420015", "0.48412412", "0.48167238", "0.4...
0.8625694
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ServiceStatus): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, ServiceStatus): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
'''SQL column builder. from functools import wraps A helper for building column list in SQL syntax from python dict.
def sql_column_builder(data=None): tmp = [] for key, value in data.iteritems(): if isinstance(value, basestring): tmp.append("{key}='{value}'".format(key=key, value=value)) else: tmp.append("{key}={value}".format(key=key, value=value)) column_string = ', '.join(tmp) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_sql_columns(self, a_list):\n result = \"\"\n \n cpt = 0\n for elem in a_list:\n if cpt == 0:\n result += \"%s\" % (elem)\n else:\n result += \", %s\" % (elem)\n cpt += 1\n\n return result", "def _get_sql...
[ "0.67807853", "0.66856354", "0.65132517", "0.64714044", "0.6190388", "0.6172441", "0.61274326", "0.6062334", "0.5939377", "0.5905875", "0.58950096", "0.58154285", "0.581016", "0.58065414", "0.580445", "0.5800673", "0.57771593", "0.57626414", "0.5741479", "0.57309246", "0.5730...
0.8546293
0
Check if two Region instances are equal.
def __eq__(self, other): return self._region == other._region
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if not isinstance(other, CloudEndureRegion):\n return False\n\n return self.__dict__ == other.__dict__", "def IsEqual(*args, **kwargs):\n return _gdi_.Region_IsEqual(*args, **kwargs)", "def __eq__(self, other):\n if isinstance(other, RegionData)...
[ "0.7864402", "0.7787087", "0.75920194", "0.74086547", "0.7237488", "0.66368544", "0.6634616", "0.65976477", "0.659385", "0.658856", "0.65766656", "0.65721995", "0.65358686", "0.65358686", "0.6526185", "0.64969856", "0.6484689", "0.64641416", "0.64622414", "0.64618933", "0.644...
0.825039
0
Check if two Gene instances are equal.
def __eq__(self, other): return self._dna == other._dna and \ self._exons == other._exons
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n # for each gene in each chromosome\n for g in range(len(self.genes)):\n # if any gene values don't match, then the chromosomes aren't equal\n if self.genes[g].value != other.genes[g].value:\n return False\n # everything matched, s...
[ "0.7819744", "0.75125605", "0.69709164", "0.69576013", "0.6909625", "0.6874633", "0.6785772", "0.6766592", "0.6696838", "0.66950536", "0.66942203", "0.66814595", "0.66709864", "0.66570055", "0.66462976", "0.6591731", "0.6591731", "0.6591731", "0.6591483", "0.65827036", "0.657...
0.7268082
2
Constructs and returns a test suite of cases from all test modules defined in this module's __all__ variable.
def suite(): ts = unittest.TestSuite() for test_module in __all__: m = importlib.import_module("pyroclast.test." + test_module) for n in dir(m): c = getattr(m, n) if is_test_case(c): s = unittest.TestLoader().loadTestsFromTestCase(c) ts.addTests(s) return ts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suite():\n # Get a list of all files.\n files = glob.glob(os.path.join(os.path.dirname(os.path.abspath(\n inspect.getfile(inspect.currentframe()))), \"test*.py\"))\n files = [os.path.splitext(os.path.basename(_i))[0] for _i in files]\n\n modules = []\n # try to import all files.\n for ...
[ "0.78410727", "0.7657286", "0.7657286", "0.7582346", "0.75773495", "0.7544948", "0.74069035", "0.74026066", "0.73379177", "0.7321415", "0.73033285", "0.726702", "0.7266676", "0.7262271", "0.7256015", "0.7245873", "0.7235659", "0.72243345", "0.72036093", "0.7196796", "0.717564...
0.85730284
0
Loads image from meta.img_path. Assigns the image to the field img of the same meta instance.
def read_img(components): img_buf = open(components[0], 'rb').read() if not img_buf: raise Exception('image not read, path=%s' % components[0]) arr = np.fromstring(img_buf, np.uint8) img = cv2.imdecode(arr, cv2.IMREAD_COLOR) components[1], components[2] = img.shape[:2] components[10] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_img(self, img):\n self.img = img", "def load_image(self, **kwargs):\n ...", "def load_image_i(self, img_tk):\n\n self.p2_label_img.configure(image=img_tk)\n self.p2_label_img.image = img_tk", "def set_image(self, path):\r\n \r\n image = self._load_image(path)...
[ "0.65896696", "0.65654665", "0.6556515", "0.65114117", "0.6465773", "0.64174324", "0.64172107", "0.63148886", "0.6219367", "0.6163937", "0.6163144", "0.6103026", "0.60713416", "0.6067176", "0.60460585", "0.6040969", "0.6030812", "0.6013024", "0.60048234", "0.59502465", "0.591...
0.0
-1
Helper function to create a stack of scaled down mask.
def create_all_mask(mask, num, stride): scale_factor = 1.0 / stride small_mask = cv2.resize(mask, (0, 0), fx=scale_factor, fy=scale_factor, interpolation=cv2.INTER_CUBIC) small_mask = small_mask[:, :, np.newaxis] return np.repeat(small_mask, num, axis=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_scale(im, inst_masks, mask, boxes, classes, scale):\n # scale = np.random.uniform(down, upper)\n h, w, c = im.shape\n if scale > 1:\n \"\"\"\"\"\"\n max_offx = (scale - 1.) * w\n max_offy = (scale - 1.) * h\n offx = int(np.random.uniform() * max_offx)\n offy =...
[ "0.6273027", "0.594023", "0.59224164", "0.58978224", "0.5841739", "0.58046967", "0.57616365", "0.5736646", "0.56548226", "0.5598127", "0.55944496", "0.55847204", "0.5582744", "0.55684257", "0.5530907", "0.5479517", "0.54603654", "0.54520875", "0.5434665", "0.54328823", "0.543...
0.6056436
1
Saves the game, agents, and optimizer states to the checkpointing path under `.tar` name
def save_checkpoint(self, name=''): self.checkpoint_path.mkdir(exist_ok=True) if name: path = self.checkpoint_path / f'{name}_{self.epoch}.tar' else: path = self.checkpoint_path / f'{self.epoch}.tar' torch.save(self.get_state(), path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_checkpoint(args,state, is_best, filename=\"checkpoint.pth.tar\"):\n directory = \"runs/%s-net/\" % (args.name)\n\n if not os.path.exists(directory):\n os.makedirs(directory)\n\n\n epoch = state['epoch']\n\n filename = directory + filename\n torch.save(state, filename)\n\n if is_be...
[ "0.7547621", "0.75138193", "0.74672616", "0.74232984", "0.74192643", "0.740148", "0.7398397", "0.7343494", "0.7317097", "0.73160833", "0.72893983", "0.71876013", "0.7154306", "0.714963", "0.71022433", "0.70916885", "0.7041963", "0.7019319", "0.7006334", "0.7002361", "0.697886...
0.737383
7
Compute the origin of a shot.
def get_shot_origin(shot) -> np.ndarray: pose = pygeometry.Pose([shot.rx, shot.ry, shot.rz], [shot.tx, shot.ty, shot.tz]) return pose.get_origin()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_origin(self):\n return self.coord_cls(x=0, y=0, system=self)", "def get_origin(self):\n return self.coord_cls(x=0, y=0, z=0, system=self)", "def origin(self):\r\n\r\n return self.ox, self.oy, self.oz", "def get_origin(self):\n return self.zero", "def move_origin(self, x,...
[ "0.74015635", "0.7379656", "0.7343961", "0.711925", "0.69956106", "0.68915874", "0.682126", "0.6772908", "0.6751326", "0.66870844", "0.6634526", "0.6619875", "0.65981114", "0.6572752", "0.6499958", "0.6499958", "0.6499958", "0.6374626", "0.6367334", "0.6319005", "0.6284699", ...
0.77475744
0
Fetch all files for a sample from a version that are tagged with any of the sample tags.
def get_sample_files_from_version(self, version_obj: Version, sample_id: str) -> Iterable[Path]: file_obj: File for file_obj in version_obj.files: if not self.include_file_sample(file_obj, sample_id=sample_id): continue yield Path(file_obj.full_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tag_batch(self, tag, filenames):\n data = self.get_tags_batch([tag], filenames)\n result = []\n for d in data:\n d.pop(\"SourceFile\")\n result.append(next(iter(d.values()), None))\n return result", "def get_list_of_copied_sample_files(self, repo, changes...
[ "0.59716314", "0.59647614", "0.5958345", "0.5894525", "0.5866366", "0.57679766", "0.5709461", "0.55495083", "0.55262893", "0.5504375", "0.5458664", "0.54581875", "0.540898", "0.53510624", "0.5348459", "0.5347458", "0.5322054", "0.53116226", "0.52435493", "0.5232899", "0.52006...
0.62420756
0
Set the customer_id for this upload
def set_customer_id(self, case_obj: Family) -> None: self._set_customer_id(case_obj.customer.internal_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer_id(self, customer_id: str):\n self._customer_id = customer_id", "def customer_id(self, customer_id):\n\n self._customer_id = customer_id", "def customer_id(self, customer_id):\n\n self._customer_id = customer_id", "def customer_id(self, customer_id):\n\n self._custome...
[ "0.8187232", "0.8090406", "0.8090406", "0.8090406", "0.8090406", "0.7372197", "0.7100708", "0.7050809", "0.7050809", "0.694933", "0.694933", "0.67336524", "0.66792417", "0.66611135", "0.66329956", "0.65690595", "0.6565796", "0.640496", "0.6262492", "0.6232912", "0.6080381", ...
0.7468703
5
A basic tokenizer to tokenize text into tokens
def _basic_tokenizer(line,normalize_digits=False): _DIGIT_RE = re.compile(r"\d+") ## find digits words = [] tokens = list(jieba.cut(line.strip().lower())) if normalize_digits: for token in tokens: m = _DIGIT_RE.search(token) if m is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n sentence = Sentence(text)\n return sentence.tokens()", "def identity_tokenizer(text):\n return text", "def sentence_tokenizer(text):\n return sent_tokenize(text)", "def tokenize(text):\n wt = nltk.RegexpTokenizer(pattern=r'\\s+', gaps=True)\n tokens = wt.tokenize(text)...
[ "0.80268854", "0.7995472", "0.7860666", "0.78192043", "0.77828735", "0.77602094", "0.7742723", "0.7720027", "0.76858824", "0.76781535", "0.7674793", "0.76304036", "0.7626671", "0.7615727", "0.7601826", "0.7597635", "0.75913364", "0.75721973", "0.75626993", "0.7546677", "0.752...
0.0
-1
Returns torch.utils.data.DataLoader for custom coco dataset.
def get_loader(root, path, vocab_con,transform, batch_size, shuffle, num_workers): # COCO caption dataset clef = ClefDataset(root=root, csv= path, vocab_concept= vocab_con, transform=transform) # Data loader for COCO dataset # This wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _custom_data_loader(self) -> DataLoader:\n dataloaders = DataLoader(self.dataset, batch_size=1)\n return dataloaders", "def train_dataloader(self) -> DataLoader:\n return self._custom_data_loader()", "def init_loader(dataset):\n if dataset == 'chaos':\n return ChaosLoader()\n...
[ "0.7068867", "0.6700325", "0.6609198", "0.6598869", "0.6422404", "0.63506544", "0.63122624", "0.63081515", "0.6259346", "0.62435836", "0.6241007", "0.61782414", "0.6158319", "0.61521894", "0.6139885", "0.6126699", "0.6124809", "0.6089955", "0.6081112", "0.60792625", "0.601715...
0.67355895
1
A simple linear feedforward (affine)
def affine_forward(x, w, b): N = x.shape[0] # reshape input into rows output = x.reshape([N, -1]).dot(w) + b cache = (x, w, b) return output, cache
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affine_forward(X, W, b):\n return np.dot(X, W) + b", "def affine_forward(x, w, b):\n #raise NotImplementedError\n #######################################################################\n # #\n # ...
[ "0.73111427", "0.7268895", "0.70415723", "0.7010928", "0.69653493", "0.69330513", "0.68651676", "0.6861124", "0.6861066", "0.6854439", "0.6844228", "0.68302107", "0.67133963", "0.67133963", "0.67133963", "0.67133963", "0.6567666", "0.64814675", "0.6460504", "0.64277875", "0.6...
0.6930279
6
Return the output tensor name for inference (transform).
def _get_inference_output_name(self): inference_output_name = 'output' if len(self['inference_output'].get_shape().as_list()) > 0: inference_output_name = 'inference_output' return inference_output_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._tf.name", "def GetTensorName(tensor):\n return GetTensorNameCC(_stringify_tensor(tensor))", "def tensor_flow_name(self):\n # Just to make sure we don't include characters that aren't allowed in TF\n # opnames, we strip all the non-word characters from the tag.\n ta...
[ "0.71943957", "0.6838516", "0.6792948", "0.67437446", "0.6703312", "0.66152024", "0.6613341", "0.65301657", "0.64931595", "0.6359819", "0.63123155", "0.62659276", "0.6231458", "0.62231416", "0.6192364", "0.61825097", "0.6157697", "0.61337495", "0.6102408", "0.6102408", "0.610...
0.8008316
0
Returns whether or not we can load.
def can_load(self, step: 'TensorflowV1ModelStep', context: 'ExecutionContext'): meta_exists = os.path.exists(os.path.join(context.get_path(), "{0}.ckpt.meta".format(step.get_name()))) index_exists = os.path.exists(os.path.join(context.get_path(), "{0}.ckpt.index".format(step.get_name()))) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_load(cls, filename):\n return False", "def canLoad(self):\n #xxx should be corrected to work on all subclass hierarchy\n return 'load' in self.__class__.__dict__", "def can_load(self):\n\n try:\n return self._get_nearest_entry_with_artifact() is not None\n ...
[ "0.81307876", "0.7544025", "0.754182", "0.723258", "0.71941495", "0.7036526", "0.6990482", "0.6806889", "0.6790433", "0.66640794", "0.65187746", "0.65032345", "0.6498021", "0.6454086", "0.6445891", "0.6427192", "0.6412058", "0.6366171", "0.6277149", "0.62423056", "0.6232357",...
0.6032092
25
Returns the face of the mesh triangles which which will be facing outwards, either ``GL_CCW`` or ``GL_CW``. This will differ depending on the meshtodisplay transformation matrix. This method is only used in 3D rendering.
def frontFace(self): if not self.threedee: return gl.GL_CCW # Only looking at the mesh -> display # transform, thus we are assuming that # the MVP matrix does not have any # negative scales. xform = self.opts.getTransform('mesh', 'display') if npla....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def faces(self):\n\n if self._faces is None:\n if self._vertices is None:\n return None\n self.triangulate()\n return self._faces", "def face(self):\n\n return self.faceup", "def getLeftFace(self, mesh):\n\n faces = reorderFaces(self.facesAround,...
[ "0.6344681", "0.6338219", "0.6013597", "0.5952125", "0.5836936", "0.57727253", "0.5719348", "0.5600704", "0.5571279", "0.5497146", "0.54584366", "0.5386774", "0.53693545", "0.5314351", "0.5294819", "0.5275278", "0.5243907", "0.5239935", "0.5221624", "0.5220163", "0.521938", ...
0.7187213
0
Generates a batch of images from Diffusion from a list of prompts.
def generate_tpu(self, prompts: List[str]): from flax.training.common_utils import shard # pylint:disable=g-import-not-at-top,g-importing-member import jax # pylint:disable=g-import-not-at-top import time # pylint:disable=g-import-not-at-top import numpy as np # pylint:disable=g-import-not-at-top ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generating(\n self,\n prompt,\n width=512,\n height=512,\n guidance_scale=7.5,\n num_images_per_prompt=1,\n num_inference_steps=50,\n generator=None,\n **kwargs,\n ):\n pipe = self.get_pipe(\"generate\")\n images = pipe(\n ...
[ "0.6863782", "0.6578029", "0.5754029", "0.57111746", "0.566734", "0.56322396", "0.5625035", "0.5585756", "0.55282676", "0.5526209", "0.5523417", "0.540099", "0.5390461", "0.5390461", "0.53881466", "0.5383595", "0.5379922", "0.53760517", "0.53645545", "0.5320725", "0.5320141",...
0.65636754
2
Verifies whether the current test role equals the admin role.
def is_admin(): # TODO(felipemonteiro): Make this more robust via a context is admin # lookup. return CONF.patrole.rbac_test_role == CONF.identity.admin_role
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_admin(self):\n return Role.query.get(2) in self.roles", "def test_admin(self):\r\n \r\n self.assertEqual(False, self.user.isAdmin)", "def is_admin(self) -> bool:\n\n return current_app.config[\"AUTH_ROLE_ADMIN\"] in [\n role.name for role in self.get_user_roles()\n...
[ "0.72475004", "0.70728326", "0.699523", "0.68984133", "0.6852451", "0.676047", "0.67451644", "0.6695397", "0.6632829", "0.6613536", "0.66063076", "0.6585458", "0.6563243", "0.6547598", "0.6528736", "0.6518195", "0.6513885", "0.64934456", "0.64929634", "0.6479242", "0.64621687...
0.7829923
0
function is_kind_of_class Checks if an object is an instance of, or if the object is an instance of a class that inherited from, the specified class.
def is_kind_of_class(obj, a_class): if isinstance(obj, a_class) is True: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_kind_of_class(obj, a_class):\n return isinstance(obj, a_class)", "def is_kind_of_class(obj, a_class):\n return isinstance(obj, a_class)", "def is_kind_of_class(obj, a_class):\n return isinstance(obj, a_class)", "def is_kind_of_class(obj, a_class):\n return isinstance(obj, a_class)", "def...
[ "0.8564378", "0.8564378", "0.8564378", "0.8564378", "0.8564378", "0.8564378", "0.8557369", "0.8549485", "0.8549485", "0.8546138", "0.85379946", "0.849904", "0.849504", "0.84919655", "0.7630834", "0.75058615", "0.7478233", "0.7474689", "0.74709916", "0.74454826", "0.74367934",...
0.84293073
14
This provides information on the World Manufacturer Identifier for a specific WMI code.
def decode_wmi(self, wmi): return self.get('vehicles/DecodeWMI/{}'.format(wmi))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_manufacturer_id(self):\n return self._manufacturer", "def _manufacturer(self, mac_address):\n # Initialize key variables\n manufacturer = ''\n\n # Process data\n mac_oui = mac_address[0:6]\n if mac_oui in self.oui:\n manufacturer = self.oui[mac_oui]\n\...
[ "0.6960894", "0.68602335", "0.6815984", "0.6689108", "0.6623454", "0.6557198", "0.6490838", "0.6448918", "0.63880366", "0.61879325", "0.6118435", "0.6054914", "0.6000768", "0.59323746", "0.59044856", "0.57410955", "0.5668272", "0.56207013", "0.55891824", "0.5578701", "0.55621...
0.5233363
47
This returns all the Makes in the vPIC dataset for a specified vehicle type whose name is LIKE the vehicle type name in vPIC Dataset. Vehicle Type name can be a partial name, or a full name for more specificity (e.g., "Vehicle", "Moto", "Low Speed Vehicle", etc.)
def get_makes_by_vehicle_type(self, veh_type='car'): return self.get('vehicles/GetMakesForVehicleType/{}'.format(veh_type))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vehicle_types_for_make_by_name(self, make):\n return self.get('vehicles/GetVehicleTypesForMake/{}'.format(make))", "def search_by_type(type):\n conn = get_db()\n try:\n cur = conn.cursor()\n try:\n type = type.replace(\"@\", \"@@\")\n type = type.replace(\...
[ "0.65482736", "0.5844169", "0.54995334", "0.535191", "0.5306488", "0.5282756", "0.5259599", "0.52595747", "0.5253013", "0.5251376", "0.52321184", "0.5226248", "0.51903707", "0.5042028", "0.503804", "0.48731795", "0.4849342", "0.483773", "0.47962976", "0.47726777", "0.4757014"...
0.69205314
0
Patch elasticsearch class and create client object.
def setUp(self): self.patcher = patch('esis.es.Elasticsearch') self.elasticsearch_cls = self.patcher.start() self.client = Client(host='localhost', port=9200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_es_client(conf):\n return elasticsearch_client(conf)", "def create_es_wrapper() -> ElasticsearchWrapper:\n\n global _instance\n if _instance is None:\n es_client = Elasticsearch(hosts=settings.elasticsearch)\n _instance = ElasticsearchWrapper(es_client)\n\n return _instance...
[ "0.6657839", "0.6403895", "0.62187284", "0.6212", "0.6198701", "0.6093606", "0.6083465", "0.6078236", "0.6054726", "0.60475117", "0.6013452", "0.59203243", "0.589203", "0.58807987", "0.58381015", "0.5822817", "0.57842386", "0.57437044", "0.5736904", "0.5665591", "0.5631253", ...
0.7405969
0
Returns set of TypeTerm's are used in known Product Types of this dict. This is useful for filter out terms that cannot be used for types lookup anyway.
def get_type_term_set(self): term_set = self._term_set if term_set is None: term_set = set() type_tuples = self.get_type_tuples() for p_type in type_tuples: term_set.update(p_type) self._term_set = term_set return term_set
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_types(self):\n return self._product_types", "def product_types(self):\n return list(self._product_type_plugins.keys())", "def type_set(self) -> Set[str]:\n typs = {self.type}\n for s in self.segments:\n typs |= s.type_set()\n return typs", "def getTyp...
[ "0.6861626", "0.6640805", "0.65320474", "0.652012", "0.6244081", "0.6085966", "0.6075513", "0.5994219", "0.5984916", "0.5928692", "0.5907441", "0.5889537", "0.58626306", "0.5835914", "0.58352953", "0.581579", "0.5774917", "0.57439816", "0.5734383", "0.5726964", "0.5717317", ...
0.74778223
0
>>> replace_re_group("nothing","(?P","groupvalue") 'nothing' >>> replace_re_group("the (?Psimple) test","(?P","groupvalue") 'the groupvalue test' >>> replace_re_group("the (?P nested (test)>)","(?P","groupvalue") 'the groupvalue'
def replace_re_group(expr, group, pattern): r = "" lg = len(group) while expr: idx = expr.find(group) if idx == -1: return r + expr # No more groups found r += expr[:idx] expr = expr[idx + lg:] level = 1 # Level of parenthesis nesting while expr:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capture_group(text: AnsibleUnsafeText, re_pattern: str, group=0) -> str:\n match_group = ''\n try:\n match_group = re.search(re_pattern, str(text)).group(group)\n except AttributeError as ae:\n print(type(ae).__name__)\n traceback.print_stack()\n return to_text(match_group)", ...
[ "0.6593277", "0.6489525", "0.6396811", "0.6387711", "0.6321706", "0.60989994", "0.5958348", "0.5743117", "0.5735624", "0.5734024", "0.5698079", "0.5568889", "0.5562935", "0.5538265", "0.5537848", "0.55067766", "0.544808", "0.54361475", "0.5404344", "0.53924847", "0.5362473", ...
0.71829563
0
Convert string value to seconds. Available acronyms are h, d, w, m, y
def to_seconds(v): m = 1 if v.endswith("h"): v = v[:-1] m = 3600 elif v.endswith("d"): v = v[:-1] m = 24 * 3600 elif v.endswith("w"): v = v[:-1] m = 7 * 24 * 3600 elif v.endswith("m"): v = v[:-1] m = 30 * 24 * 3600 elif v.endswith("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSeconds(self, s):\n duration = 0\n \n for i in s.split('-'):\n if 'h' in i: duration = duration + int(i.split('h')[0])*3600\n if 'm' in i: duration = duration + int(i.split('m')[0])*60\n if 's' in i: duration = duration + int(i.split('s')[0])\n ...
[ "0.7481081", "0.73768425", "0.7375146", "0.73248255", "0.7315954", "0.7225096", "0.71773547", "0.7078408", "0.70449007", "0.6982861", "0.6982393", "0.6944802", "0.6926858", "0.6926858", "0.69196755", "0.6901901", "0.6871831", "0.68634576", "0.68211997", "0.678375", "0.6781553...
0.7504235
0
Construct a Ray from a direction and a position from the origin. The direction will be forced normal.
def __init__(self, direction, position): self.direction = normalize(direction) self.position = np.array(position)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reflect(self, ray):\n normal = self.normal(ray.position)\n if normal.dot(ray.direction) > 0:\n normal = -normal\n return Ray(\n ray.direction - 2 * dot(ray.direction, normal) * normal, ray.position)", "def __init__(self, initial_direction, initial_position,\n initial_element=None, j...
[ "0.6094331", "0.6072586", "0.5836509", "0.5808292", "0.5669642", "0.56333095", "0.55816907", "0.55351573", "0.55220306", "0.54981846", "0.5494609", "0.5490973", "0.5414771", "0.5083932", "0.5082023", "0.5044048", "0.5037309", "0.50122684", "0.5010806", "0.49667916", "0.493328...
0.56025743
6
Return True if the surface is reflective. Otherwise, return False.
def is_reflective(self): return self._reflective
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isInvertible(self):\n return bool(self.isSquare() and self.determinant())", "def is_visible(self):\n return self.real > 0", "def is_vector(self):\n return len(self.coeffs.shape[self.sdim:]) == 1", "def is_dip(self):\n if (\n self.dip\n and not self.deleted\n ...
[ "0.5975583", "0.5958553", "0.593509", "0.59215015", "0.5842063", "0.5780237", "0.5759116", "0.5748275", "0.56818694", "0.5663717", "0.56506705", "0.5635382", "0.5600092", "0.55912817", "0.5591185", "0.55707014", "0.5544581", "0.5533953", "0.5533953", "0.5533891", "0.5525742",...
0.68020517
0
Construct a plane from a normal vector and the position to a point on the plane.
def __init__(self, normal, position, name=None, reflective=False): _Surface.__init__(self, name, reflective) self._normal = normalize(normal) self._position = np.array(position)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_vector(cls, vector) -> 'Plane':\n v = Vector(vector)\n return Plane(v.normalize(), v.magnitude)", "def project_point_plane(point, plane):\n base, normal = plane\n normal = normalize_vector(normal)\n vector = subtract_vectors(point, base)\n snormal = scale_vector(normal, dot_vec...
[ "0.73509693", "0.7324766", "0.69126976", "0.67388016", "0.6710477", "0.6689925", "0.6630524", "0.66234905", "0.6538876", "0.65205795", "0.6479206", "0.6419508", "0.6409488", "0.6409488", "0.6386841", "0.6385874", "0.6317552", "0.6284574", "0.6277295", "0.6247903", "0.62441146...
0.57828563
49
Translate the surface by the displacement with fixed orientation.
def translate(self, displacement): self._position = self._position + np.array(displacement)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, displacement):\n self._center = self._center + np.array(displacement)\n self._position = self._position + np.array(displacement)", "def translate(self, displacement):\n\n self.center = (self.center[0] + displacement[0],\n self.center[1] + displacement[1])", "def m...
[ "0.706072", "0.69921255", "0.6790597", "0.6546623", "0.6503694", "0.64819634", "0.6434932", "0.6248682", "0.6246855", "0.6092307", "0.5986529", "0.5949149", "0.59347296", "0.5893499", "0.58854103", "0.5804666", "0.57444006", "0.574371", "0.57372546", "0.5703373", "0.5683703",...
0.64265233
7
Return the normal vector.
def normal(self, position): return self._normal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal(self) -> Vector:\n return self._normal", "def Normal(self):\n return Vector(self.normal)", "def getNormalVector(self):\n vector = self.unit_vector\n vector.rotate(math.pi / 2)\n return vector", "def normal(self) -> Vector:\n return normalize(cross(self.d1,...
[ "0.89155966", "0.8721422", "0.8546165", "0.8448357", "0.8303889", "0.8216004", "0.81904435", "0.7936671", "0.7916474", "0.79132324", "0.78811854", "0.7842582", "0.7682277", "0.76702005", "0.7590145", "0.7583683", "0.7582449", "0.7524974", "0.7523906", "0.7491076", "0.74849105...
0.7856742
11
Return true if the position is below the surface w.r.t. the normal.
def contains(self, position): return (position - self._position).dot(self.normal(position)) < 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_upper(self):\n return self.z < 0", "def near_way(self):\r\n\r\n prey_position = np.array(self.prey.position)\r\n actual_position = np.array(self.previous_data[-1])\r\n previous_position = np.array(self.previous_data[-2])\r\n\r\n difference_actual = np.linalg.norm(prey_po...
[ "0.648721", "0.64868283", "0.61766976", "0.6155492", "0.6095029", "0.6042511", "0.6020704", "0.59912974", "0.5977119", "0.59096", "0.5896698", "0.58637303", "0.58486336", "0.5827253", "0.58237433", "0.58047825", "0.5784277", "0.57801455", "0.57412136", "0.573523", "0.5730213"...
0.64155066
2
Return true if the position is inside the volume of the sphere.
def contains(self, position): return np.linalg.norm(position - self._center) < self._radius
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isInside(self, position, maxDimLens):\n dim = len(position);\n deltas = [0] * dim;\n distSqr = 0;\n for i in range(0, dim):\n deltas[i] = math.fabs(position[i] - self.mSample[i]);\n if math.fabs(maxDimLens[i] - deltas[i]) < deltas[i]:\n deltas[i]...
[ "0.6791304", "0.6772017", "0.67717576", "0.66854215", "0.66486347", "0.6569301", "0.6551375", "0.6481873", "0.64661866", "0.63763255", "0.63541865", "0.63310975", "0.63143206", "0.62849367", "0.62598807", "0.6236428", "0.62132627", "0.62098604", "0.6189123", "0.6181488", "0.6...
0.7594988
0
Translate the surface by the displacement with fixed orientation.
def translate(self, displacement): self._center = self._center + np.array(displacement) self._position = self._position + np.array(displacement)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, displacement):\n\n self.center = (self.center[0] + displacement[0],\n self.center[1] + displacement[1])", "def move(self, surface):\n\t\tself.position = wrap_position(self.position + self.velocity, surface)", "def translate ( self, dx, dy, dz):\n self.x = sel...
[ "0.69921255", "0.6790597", "0.6546623", "0.6503694", "0.64819634", "0.6434932", "0.64265233", "0.6248682", "0.6246855", "0.6092307", "0.5986529", "0.5949149", "0.59347296", "0.5893499", "0.58854103", "0.5804666", "0.57444006", "0.574371", "0.57372546", "0.5703373", "0.5683703...
0.706072
0
Return the normal at the point on the surface.
def normal(self, point): point = self._center - np.array(point) # if abs(point.dot(point) - self._radius**2) > 1e-15: # raise RayTraceError( # 'Cannot compute normal. Point is too far from surface ({}).'.format( # (abs(point.dot(point) - self._radius**2)))) return normalize(point /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal(self, point):\n return self._normal.dup()", "def surface_norm(self, pt):\n\n return self.normal.normalize()", "def normal(self) -> Vec:\n # The three points are in clockwise order, so compute differences\n # in the clockwise direction, then cross to get the normal.\n ...
[ "0.79712397", "0.7914931", "0.7724645", "0.75636697", "0.7543766", "0.75437653", "0.7505781", "0.74931777", "0.73829144", "0.72767013", "0.7120286", "0.70970136", "0.709", "0.7061142", "0.7041461", "0.70261645", "0.6999432", "0.6990783", "0.6901572", "0.6883833", "0.68721473"...
0.7954546
1
Return the timetillboundary and boundary of the next intersection.
def next_hit(self, ray): hit_candidates = [(i.time_to_bound(ray), i) for i in self._bounds] try: # WARNING - A hard cut on 'times' smaller than 10^-9 is made to exclude # a beam reinteracting with the same barrier. This cuts out any legitimate # interactions closer than 1nm of the beam positio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_overlap_time(begin_at_infected, end_at_infected, begin_at_contact, end_at_contact):\n\n\tbegin_at_infected = begin_at_infected\n\tbegin_at_contact = begin_at_contact\n\tend_at_infected = end_at_infected\n\tend_at_contact = end_at_contact\n\treturn (min(end_at_infected, end_at_contact) - max(begin_at_infect...
[ "0.64409894", "0.60239434", "0.5994862", "0.5825851", "0.57350826", "0.56367064", "0.56018925", "0.5597462", "0.55608046", "0.5495273", "0.5462936", "0.54623806", "0.545466", "0.545466", "0.5436905", "0.54272056", "0.5408006", "0.5398319", "0.53973675", "0.5369602", "0.536444...
0.5581006
8
Return the beam segment ray.
def ray(self): return self._ray
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rayIntersection(self, ray):\n #t = \"what we are trying to find\"\n l = -ray.mDirection\n l0 = ray.mOrigin\n n = self.mNormal\n p0 = self.mDistance * n\n #p = l0 + l * t\n\n if l.dot(n) > 0:\n v = p0 - l0\n t = -(v.dot(n) / l.dot(n))\n ...
[ "0.6191178", "0.6171554", "0.6156284", "0.60893786", "0.5974034", "0.5947297", "0.5877041", "0.5869074", "0.5855643", "0.58341885", "0.57774925", "0.57609934", "0.57491297", "0.5718796", "0.5703341", "0.5601157", "0.55530953", "0.5526175", "0.5515779", "0.54727244", "0.544434...
0.72490925
0
Push single item to iterator at current point in iteration. Calling next() on iterator will return item in the next iterator.
def push(self, item): self._cursor_stack.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, item):\n self._tail_iters.append(iter([item]))", "def push(self, item):\n if hasattr(item, \"__iter__\"):\n self.items.extend(item)\n else:\n self.items.append(item)", "def add_next(self, item, index):\n if index in self.d_buffer.keys():\n ...
[ "0.74171233", "0.70699495", "0.6910868", "0.6678504", "0.667791", "0.6500593", "0.6442878", "0.6442878", "0.6442878", "0.6442878", "0.6442878", "0.64124095", "0.64100504", "0.63595873", "0.6352962", "0.63435537", "0.63379693", "0.63334715", "0.6329619", "0.6324044", "0.630437...
0.6503116
5
Peek next element without consuming iterator. Pass the number of steps to check how many steps forward it will peek. It raises StopIteration or return the default value if iterator is already consumed.
def peek(self, steps=0, *, default=NOT_GIVEN): if steps == 0: try: value = self._next() except StopIteration: if default is NOT_GIVEN: raise return default else: self._cursor_stack.append(valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _peek(iter: Iterable, index: int) -> Optional[any]:\r\n if index < len(iter):\r\n return iter[index]\r\n return None", "def peek(self):\n if self.peek_num is None:\n self.peek_num = self.iterator.next()\n return self.peek_num\n return self.peek_num", "def co...
[ "0.6565379", "0.61074543", "0.6033162", "0.6032214", "0.6028781", "0.5986056", "0.5975407", "0.5895364", "0.5856415", "0.5851012", "0.5779738", "0.57535213", "0.57516485", "0.57281566", "0.569198", "0.569198", "0.569198", "0.5681788", "0.5626081", "0.5608215", "0.5578372", ...
0.7366466
0
Push single item to iterator at current point in iteration. Calling next() on iterator will return item in the next iterator.
def push(self, item): self._tail_iters.append(iter([item]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, item):\n if hasattr(item, \"__iter__\"):\n self.items.extend(item)\n else:\n self.items.append(item)", "def add_next(self, item, index):\n if index in self.d_buffer.keys():\n return\n if len(self) == self.size:\n self.pop_firs...
[ "0.70685345", "0.6910672", "0.667531", "0.6675184", "0.6501217", "0.6498237", "0.6440441", "0.6440441", "0.6440441", "0.6440441", "0.6440441", "0.64101857", "0.6407327", "0.63624144", "0.6350007", "0.6341936", "0.63360375", "0.6332655", "0.6330578", "0.63215184", "0.63025403"...
0.7415915
0
Computes the accuracy over the k top predictions for the specified values of k
def accuracy(output, target, topk=(1,)): with torch.no_grad(): 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: c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)", "def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua...
[ "0.8331214", "0.8284662", "0.82381004", "0.8229767", "0.82202226", "0.81864446", "0.81847763", "0.8175173", "0.8171541", "0.81699467", "0.81664646", "0.81645083", "0.81637454", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "...
0.7893114
60
Overloads the parameters iterator function so only variable 'requires_grad' set to True are iterated over.
def parameters(self, requires_grad_only=True): filter_cond = lambda param: param.requires_grad if requires_grad_only else True return (param for param in super().parameters() if filter_cond(param))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_requires_grad(self, requires_grad):\n for parameter in self.parameters():\n parameter.requires_grad = requires_grad", "def set_requires_grad(self, requires_grad):\n for parameter in self.parameters():\n parameter.requires_grad = requires_grad", "def params_with_grad(...
[ "0.7065462", "0.7065462", "0.6981177", "0.68589026", "0.6773993", "0.660333", "0.64560425", "0.6452415", "0.64516294", "0.64108855", "0.63925046", "0.6380659", "0.63576025", "0.63520265", "0.63169414", "0.62741923", "0.62708586", "0.6261778", "0.62184954", "0.6180963", "0.615...
0.6626576
5
Overloads the parameters iterator function so only variable 'requires_grad' set to True are iterated over.
def named_parameters(self, memo=None, prefix='', requires_grad_only=True): filter_cond = lambda param: param.requires_grad if requires_grad_only else True return ((name, param) for (name, param) in super().named_parameters() if filter_cond(param))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_requires_grad(self, requires_grad):\n for parameter in self.parameters():\n parameter.requires_grad = requires_grad", "def set_requires_grad(self, requires_grad):\n for parameter in self.parameters():\n parameter.requires_grad = requires_grad", "def params_with_grad(...
[ "0.70659053", "0.70659053", "0.69814664", "0.6859007", "0.67740387", "0.66261065", "0.66049397", "0.6456732", "0.6453299", "0.6449511", "0.640885", "0.6391922", "0.63791955", "0.63564926", "0.63514733", "0.63181025", "0.6276157", "0.6271183", "0.62635595", "0.6219102", "0.617...
0.6103122
25
Get the front element.
def peek(self): if self.mystack2: # print("mystack2 is ", self.mystack2) return self.mystack2[-1] else: while self.mystack1: self.mystack2.append(self.mystack1.pop()) return self.mystack2[-1] if self.mystack2 else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass", "def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1", "def front(self):\n return self.queue[0] if not self.empty() else None", "def peek_front(...
[ "0.82009244", "0.79261875", "0.7852642", "0.7791182", "0.77886623", "0.75723046", "0.752337", "0.7510604", "0.7478953", "0.7379256", "0.7379256", "0.734284", "0.7323573", "0.7320296", "0.7291721", "0.72772557", "0.7269801", "0.72657627", "0.7253295", "0.72355044", "0.72213495...
0.0
-1
Returns whether the queue is empty.
def empty(self): return not self.mystack1 and not self.mystack2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.__queue) > 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return self.queue == []", "def ...
[ "0.9270249", "0.92506766", "0.923635", "0.923635", "0.9155843", "0.9098441", "0.9095006", "0.90922606", "0.90731245", "0.9053733", "0.89205354", "0.89137155", "0.8877591", "0.88436323", "0.88436323", "0.8835949", "0.88038146", "0.8758203", "0.87577534", "0.87310195", "0.86462...
0.0
-1
Returns whether the stack is empty.
def empty(self) -> 'bool': # print(self.que_one) # print(self.que_two) if not self.que_one and not self.que_two: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_stack) == 0", "def is_empty(self):\n return len(self.stack) == 0", "def empty(self) -> bool:\n return len(self.stack) == 0", "def isEmpty(self):\n return len(self.stack) == 0", "def empty(self):\n return len(self.stack) == 0", "...
[ "0.9207258", "0.91276956", "0.90185934", "0.9000551", "0.89481044", "0.89481044", "0.8914844", "0.8904091", "0.8881541", "0.88791907", "0.8867761", "0.87955654", "0.8768181", "0.8748518", "0.87393755", "0.8728073", "0.8719241", "0.87090814", "0.87090814", "0.85431594", "0.850...
0.0
-1
Returns whether the stack is empty.
def empty(self) -> bool: return self.que == []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_stack) == 0", "def is_empty(self):\n return len(self.stack) == 0", "def empty(self) -> bool:\n return len(self.stack) == 0", "def isEmpty(self):\n return len(self.stack) == 0", "def empty(self):\n return len(self.stack) == 0", "...
[ "0.9207258", "0.91276956", "0.90185934", "0.9000551", "0.89481044", "0.89481044", "0.8914844", "0.8904091", "0.8881541", "0.88791907", "0.8867761", "0.87955654", "0.8768181", "0.8748518", "0.87393755", "0.8728073", "0.8719241", "0.87090814", "0.87090814", "0.85431594", "0.850...
0.0
-1
numpy Vector/matrix friendly sigmoid function
def sigmoid(self, x, a=1.0, b=1.0, c=0.0, d=0.0, e=1.0): return a / (b + np.exp(-e*(x-c))) + d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(x: np.ndarray \n ) -> np.ndarray:\n return 1/(1+np.exp(-x))", "def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + np.exp(-x))", "...
[ "0.81339896", "0.7982278", "0.7920161", "0.7920161", "0.7920161", "0.7920161", "0.7920161", "0.7920161", "0.79157984", "0.79130244", "0.79046243", "0.79027396", "0.78831655", "0.78809214", "0.7873999", "0.7861118", "0.7861118", "0.7854806", "0.78468496", "0.7821382", "0.78072...
0.0
-1
Test mapping when one container is missing a required group.
def test_required_group_missing(self): bar_inst1 = Bar('my_bar1', list(range(10)), 'value1', 10) msg = "Bar 'my_bar1' is missing required value for attribute 'foo'." with self.assertWarnsWith(MissingRequiredBuildWarning, msg): builder = self.mapper.build(bar_inst1, self.manager) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_h5py_group(self):\n with self.assertRaises(TypeError):\n self.map_digis(None)", "def test_group_not_found(self):\n with self.assertRaises(GroupNotFoundException):\n self._storage.get_group(\"group1\")", "def test_optional_group_not_empty(self):\n\n self.m...
[ "0.6901956", "0.63897735", "0.6258039", "0.62422234", "0.615087", "0.6130689", "0.58748657", "0.58745253", "0.5866679", "0.5851542", "0.5819196", "0.58082134", "0.580506", "0.58015233", "0.57863396", "0.5748334", "0.57234603", "0.5704771", "0.5684365", "0.5659706", "0.5656621...
0.61017394
6
Critical density of the Universe at an input `redshift` in units of solar masses. For simplicity, PyAutoLens internally uses only certain units to perform lensing cosmology calculations. This function therefore returns only the value of the astropy function it wraps, omitting the units instance.
def cosmic_average_density_from(self, redshift: float) -> float: cosmic_average_density_kpc = ( self.critical_density(z=redshift).to("solMass / kpc^3").value ) kpc_per_arcsec = self.kpc_per_arcsec_from(redshift=redshift) return cosmic_average_density_kpc * kpc_per_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosmic_average_density_solar_mass_per_kpc3_from(self, redshift: float) -> float:\r\n cosmic_average_density_kpc = (\r\n self.critical_density(z=redshift).to(\"solMass / kpc^3\").value\r\n )\r\n\r\n return cosmic_average_density_kpc", "def velocity_dispersion_from(\r\n s...
[ "0.5736522", "0.5468514", "0.5261506", "0.5197402", "0.5194858", "0.5136482", "0.510527", "0.5055507", "0.50442594", "0.50073904", "0.49917948", "0.49832353", "0.4973439", "0.49464872", "0.49387696", "0.49341616", "0.4932079", "0.49188194", "0.4904719", "0.48829317", "0.48655...
0.63098997
0
Critical density of the Universe at an input `redshift` in units of solar masses per kiloparsecs3. For simplicity, PyAutoLens internally uses only certain units to perform lensing cosmology calculations. This function therefore returns only the value of the astropy function it wraps, omitting the units instance.
def cosmic_average_density_solar_mass_per_kpc3_from(self, redshift: float) -> float: cosmic_average_density_kpc = ( self.critical_density(z=redshift).to("solMass / kpc^3").value ) return cosmic_average_density_kpc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosmic_average_density_from(self, redshift: float) -> float:\r\n\r\n cosmic_average_density_kpc = (\r\n self.critical_density(z=redshift).to(\"solMass / kpc^3\").value\r\n )\r\n\r\n kpc_per_arcsec = self.kpc_per_arcsec_from(redshift=redshift)\r\n\r\n return cosmic_average...
[ "0.64371884", "0.53388387", "0.529253", "0.52564305", "0.52206063", "0.52093744", "0.51663804", "0.51166064", "0.5063379", "0.5059959", "0.5028908", "0.5023926", "0.49665996", "0.49444568", "0.49265274", "0.49237964", "0.49156985", "0.49134538", "0.48927638", "0.48891136", "0...
0.6215723
1
sets the id of the news entry
def set_id(self, id): self.data['id'] = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id_=None):\n if id_ is None:\n self.id = id(self)\n else:\n self.id = id_", "def _set_id(self, value):\n pass", "def set_id(self, id):\n self.__id = id", "def setID(self, idf):\n self.id = idf", "def setID(self, idNb):\n self....
[ "0.6828751", "0.6761383", "0.67586935", "0.67472947", "0.6734875", "0.6717437", "0.67069846", "0.67035455", "0.6681602", "0.6681589", "0.6681589", "0.6681589", "0.6681589", "0.6681589", "0.6681589", "0.6681589", "0.6681589", "0.6681589", "0.6681589", "0.6681589", "0.6681589",...
0.6995008
0
Adds the title and uppercase version of all words to STOP_WORDS.
def add_extra_words(): with open(ES_STOPWORDS_FILE, "r", encoding="utf-8") as temp_file: for word in temp_file.read().splitlines(): STOP_WORDS.add(word) with open(EN_STOPWORDS_FILE, "r", encoding="utf-8") as temp_file: for word in temp_file.read().splitlines(): STOP_WOR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_stop_words():\n stop_words_list = [\"uk\", \"ceo\", \"apple\", \"wal\", \"st\", \"q1\", \"q2\", \"q3\", \"q4\",\n \"bp\", \"wednesday\", \"tuesday\", \"monday\", \"thursday\", \"friday\", \"sept\", \"johnson\", \"inc\",\n \"david\", \"amazon.com\"]\n\n ...
[ "0.707975", "0.70270795", "0.6941437", "0.68861854", "0.681929", "0.679386", "0.67089653", "0.668478", "0.668478", "0.668478", "0.6642815", "0.6623371", "0.6576504", "0.6553525", "0.6529611", "0.650215", "0.6486574", "0.64779896", "0.64553416", "0.64553416", "0.64553416", "...
0.7616774
0
Return a fresh copy graph with the same data structure. A fresh copy has no nodes, edges or graph attributes. It is the same data structure as the current graph. This method is typically used to create an empty version of the graph.
def fresh_copy(self): return OrderedGraph()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n cls = self.__class__\n new_graph = cls.__new__(cls)\n new_graph._nodes = self._nodes[:]\n new_graph._node_wip = self._node_wip[:]\n new_graph._edges = self._edges[:]\n if self._sorted_nodes:\n new_graph._sorted_nodes = self._sorted_nodes[:]\n ...
[ "0.84219307", "0.83663255", "0.83062893", "0.8250601", "0.8203087", "0.8103278", "0.79537326", "0.79145586", "0.79142976", "0.79041946", "0.7901522", "0.77018166", "0.76641226", "0.7524745", "0.75172186", "0.75008947", "0.7400445", "0.73858595", "0.7326366", "0.72857517", "0....
0.8160918
5
Return a fresh copy graph with the same data structure. A fresh copy has no nodes, edges or graph attributes. It is the same data structure as the current graph. This method is typically used to create an empty version of the graph.
def fresh_copy(self): return OrderedDiGraph()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n cls = self.__class__\n new_graph = cls.__new__(cls)\n new_graph._nodes = self._nodes[:]\n new_graph._node_wip = self._node_wip[:]\n new_graph._edges = self._edges[:]\n if self._sorted_nodes:\n new_graph._sorted_nodes = self._sorted_nodes[:]\n ...
[ "0.8420824", "0.8365685", "0.83049476", "0.82497627", "0.8202765", "0.8159696", "0.81026006", "0.79131204", "0.79130584", "0.7903769", "0.78999126", "0.77008337", "0.7663082", "0.7524527", "0.7516381", "0.7499562", "0.73998064", "0.73850435", "0.7325789", "0.728422", "0.71828...
0.7952445
7
Return a fresh copy graph with the same data structure. A fresh copy has no nodes, edges or graph attributes. It is the same data structure as the current graph. This method is typically used to create an empty version of the graph.
def fresh_copy(self): return OrderedMultiGraph()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n cls = self.__class__\n new_graph = cls.__new__(cls)\n new_graph._nodes = self._nodes[:]\n new_graph._node_wip = self._node_wip[:]\n new_graph._edges = self._edges[:]\n if self._sorted_nodes:\n new_graph._sorted_nodes = self._sorted_nodes[:]\n ...
[ "0.84214675", "0.83658355", "0.8306031", "0.8249845", "0.8202703", "0.81601024", "0.81031305", "0.7952771", "0.79137266", "0.7913162", "0.79040235", "0.7701961", "0.76640254", "0.7524447", "0.751674", "0.750044", "0.7399624", "0.73853135", "0.73256195", "0.72850287", "0.71834...
0.7900664
11
Return a fresh copy graph with the same data structure. A fresh copy has no nodes, edges or graph attributes. It is the same data structure as the current graph. This method is typically used to create an empty version of the graph.
def fresh_copy(self): return OrderedMultiDiGraph()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n cls = self.__class__\n new_graph = cls.__new__(cls)\n new_graph._nodes = self._nodes[:]\n new_graph._node_wip = self._node_wip[:]\n new_graph._edges = self._edges[:]\n if self._sorted_nodes:\n new_graph._sorted_nodes = self._sorted_nodes[:]\n ...
[ "0.84212935", "0.8365541", "0.8305631", "0.8250085", "0.82028264", "0.816014", "0.81027246", "0.7952815", "0.7913063", "0.79037225", "0.79009056", "0.7701285", "0.76630205", "0.7523658", "0.75167346", "0.750041", "0.7399628", "0.7385654", "0.7326312", "0.7285566", "0.71832746...
0.7913884
8
Set the center on the view to the senter of the flowsheet The center of the flowsheet is determined from extreme locations of the nodes.
def center(self): cp = self.dat.flowsheet.getCenter() self.centerOn(cp[0], cp[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_center(self):\n sl_center = np.array(\n [self.sl_list[k].mean_pos for k in range(self.nb_sl)]\n )\n sl_nb_pts = np.array(\n [self.sl_list[k].nb_points for k in range(self.nb_sl)]\n )\n sl_wcenter = [sl_center[k] * sl_nb_pts[k] for k in range(self.nb...
[ "0.69523156", "0.68890136", "0.68816787", "0.68740904", "0.6835087", "0.67948747", "0.67948747", "0.67784035", "0.6750598", "0.6750598", "0.6750598", "0.67261076", "0.66637397", "0.6605356", "0.6603063", "0.65918773", "0.65791875", "0.6560546", "0.65551025", "0.653111", "0.64...
0.8061834
0
Plots the cumulative quantiles along with a scatter plot of observations.
def cumulative_quantiles_plot( samples, plot_width=960, plot_height=480, show_samples=True ): plot = bp.figure(plot_width=960, plot_height=480) names = samples.columns.levels[0] _colors = { name: color for name, color in zip(names, colors.colors(len(names))) } def draw(group): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_cdf(self, **options):\n plt.plot(self.xs, self.ps, **options)", "def plot(self, ax=None, ylabel=\"CDF(x)\", xlabel=\"y\", upper_quantile=.25, lower_quantile=.75, force_recomputation=False, show=False, outputname=None, color=\"C2\", plot_cCDF=False):\n \n \"\"\"If data set is empty, ...
[ "0.6480232", "0.6239808", "0.6182467", "0.61039776", "0.6094828", "0.5893651", "0.5855495", "0.5839857", "0.58190364", "0.58065814", "0.57932925", "0.5782105", "0.5743036", "0.5734393", "0.57228744", "0.5700729", "0.5695588", "0.5687981", "0.5663579", "0.56196505", "0.5613191...
0.7104273
0
Create a plotly graph locally as an HTML document or string.
def plot(figure_or_data, show_link=True, link_text='Export to plot.ly', validate=True, output_type='file', include_plotlyjs=True, filename='temp-plot.html', auto_open=True, image=None, image_filename='plot_image', image_width=800, image_height=600): if output_type not in ['div', 'file']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, _=None, filename=\"SME.html\", **kwargs):\n # Here we \"hack\" plotly to use base64 encoded data\n # since we have a lot of data to look at\n # this reduces the file size by about a factor 3\n # zipping it would provide another factor 2\n if filename.endswith(\".ht...
[ "0.679223", "0.67849326", "0.66687316", "0.6390206", "0.63864034", "0.6373333", "0.6360069", "0.6243555", "0.6032301", "0.6000186", "0.5980495", "0.5906017", "0.5902987", "0.58614886", "0.58324695", "0.5827365", "0.5819732", "0.58169335", "0.5796467", "0.5795816", "0.5780062"...
0.6640358
3
Returns the string representation of the proxy used.
def Proxy(self): return self._proxy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getProxyName(self):\n return self.proxyName", "def proxy(self):\n return self.get('proxy', None)", "def proxy_host(self) -> ConfigNodePropertyString:\n return self._proxy_host", "def getproxysockname(self):\r\n return self.__proxysockname", "def get_proxy():\n res...
[ "0.7139966", "0.6801072", "0.6794877", "0.6779459", "0.6777351", "0.67767555", "0.67767555", "0.6754784", "0.66551405", "0.6607475", "0.6555551", "0.6486769", "0.64747715", "0.64695466", "0.64648116", "0.64499325", "0.6388234", "0.63070273", "0.62525475", "0.616892", "0.61523...
0.6161361
20
Returns the string representing the Domain URL which is required to retrieve the information being investigated.
def URL(self): return self._sourceurl
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domain(self):\n return get_tld(self.url, fail_silently=True)", "def domain(self):\n return self._get('domain', '/domain/', self.DOMAIN_DATA)", "def domain(self):\n return self['domain']", "def domain(self) -> str:\n return pulumi.get(self, \"domain\")", "def domain(self) -> ...
[ "0.79086447", "0.7720846", "0.74773824", "0.7447763", "0.7447763", "0.74225754", "0.73539925", "0.73244125", "0.7322398", "0.7322398", "0.7242937", "0.7186858", "0.7169622", "0.7150315", "0.70917654", "0.70605576", "0.70549375", "0.7045601", "0.7045601", "0.70344806", "0.7015...
0.0
-1
Returns the string representing the Error Message.
def ErrorMessage(self): return self._errormessage
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_message(self) -> str:\n return self._error_message", "def error_message(self):\n # type: () -> string_types\n return self._error_message", "def error_message(self) -> str:\n return pulumi.get(self, \"error_message\")", "def error_message(self) -> str:\n return pul...
[ "0.8715514", "0.86882985", "0.8610572", "0.8610572", "0.8610572", "0.8506367", "0.8466283", "0.84255916", "0.8367896", "0.8318581", "0.8238673", "0.81212854", "0.80014986", "0.7999241", "0.79918236", "0.7987822", "0.79599774", "0.78860587", "0.78704005", "0.78704005", "0.7870...
0.7587303
35
Determines if PostData was set for this specific site. Returns the dict representing the PostHeaders using the _postdata instance variable or returns None if the instance variable is empty or not set.
def PostData(self): if self._postdata is None: return None if len(self._postdata) == 0: return None return self._postdata
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_data(request):\n if is_post(request):\n return request.POST\n return None", "def __getData(self, post, is_question):\n page = {'entity':'question' if is_question else 'answer'}\n try:\n page['title'] = stripHtml(post.find('div', 'lia-message-subject').h1.renderConte...
[ "0.5305585", "0.52151334", "0.51798886", "0.5088963", "0.5038492", "0.50245345", "0.49905387", "0.497489", "0.48960695", "0.4741161", "0.468527", "0.46661943", "0.46616688", "0.46216428", "0.4614731", "0.4614731", "0.4563082", "0.45551315", "0.45462132", "0.4533801", "0.45312...
0.6618721
0
Determines if post data was required for this specific site. If postdata is set, this ensures %TARGET% is stripped if necessary.
def PostData(self, postdata): if len(postdata) > 0: for key in postdata: if postdata[key] == "%TARGET%": postdata[key] = self._target self._postdata = postdata else: self._postdata = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(self):\n return self.post_processor in PostProcessor.valid_list()", "def _filter_post(post):\n\n return True", "def get_as_source(self):\n if self.as_source:\n return True\n if self.allow_source_from_get and self.request.GET.get('src', False):\n re...
[ "0.5359993", "0.5346201", "0.53065115", "0.5280513", "0.5230612", "0.52005696", "0.5187851", "0.51838547", "0.504217", "0.5031495", "0.4922698", "0.49035954", "0.48535368", "0.48302683", "0.48148128", "0.48025036", "0.4801166", "0.48001438", "0.47760928", "0.47676784", "0.471...
0.62356067
0
Determines if a method (GET or POST) was established for this specific site. Defaults to GET
def Method(self): if self._method is None: return "GET" if len(self._method) == 0: return "GET" return self._method
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Method(self, method):\n if not self.PostData:\n self._method = \"GET\"\n return\n if len(method) > 0:\n if method.upper() == \"GET\" or method.upper() == \"POST\":\n self._method = method.upper()\n return\n\n self._method = \"G...
[ "0.75635976", "0.7357781", "0.726872", "0.72525144", "0.7188877", "0.71883714", "0.7163842", "0.71323234", "0.69945306", "0.6738737", "0.6635378", "0.66118854", "0.65660936", "0.642897", "0.6399314", "0.6391906", "0.6367677", "0.6315911", "0.62245566", "0.6220642", "0.6200616...
0.7398864
1
Ensures the method type is set to either GET or POST. By default GET is assigned
def Method(self, method): if not self.PostData: self._method = "GET" return if len(method) > 0: if method.upper() == "GET" or method.upper() == "POST": self._method = method.upper() return self._method = "GET"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_method(self, method):\r\n method = method.upper()\r\n if method not in ['GET', 'POST']:\r\n method = 'POST'\r\n return method", "def get_method(self):\n default_method = \"POST\" if self.data is not None else \"GET\"\n return getattr(self, 'method', default_method)...
[ "0.74105114", "0.7407985", "0.71566236", "0.69178337", "0.6908245", "0.67906976", "0.6734323", "0.6590922", "0.6429892", "0.6397371", "0.6217319", "0.6213421", "0.61995846", "0.6152464", "0.6150256", "0.6146974", "0.6144766", "0.61141807", "0.6092046", "0.6075735", "0.5996569...
0.81574565
0
Get or create a new logger. This newly created logger will have the handler and level that was passed, but if it already exists it's not changed. We also wrap the logger in an adapter so we can easily extend its functionality.
def _get_or_create_logger(self, name, level, handler=None): # logging.getLogger creates a logger if it doesn't exist, # so we need to check before calling it if handler and not self._log_exists(name): logger = logging.getLogger(name) logger.addHandler(handler) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logger_with_context(logger: logging.Logger, **ctx) -> LoggerAdapter:\n return LoggerAdapter(logger, dict(ctx=ctx))", "def get_logger(*, logger_name):\n\n logger = logging.getLogger(logger_name)\n\n logger.setLevel(logging.INFO)\n\n logger.addHandler(get_console_handler())\n logger.addHandl...
[ "0.7133684", "0.7032485", "0.70108587", "0.69675606", "0.69428074", "0.6914743", "0.69070345", "0.6897019", "0.6893938", "0.6893086", "0.686731", "0.68576175", "0.681974", "0.6818613", "0.6807231", "0.6797505", "0.67921656", "0.6783108", "0.67599016", "0.6741625", "0.6718331"...
0.8102379
0
Split list or generator by chunks with fixed maximum size.
def chunk_list(iterable: Iterable[T], size: int) -> Iterable[List[T]]: iterable = iter(iterable) item = list(itertools.islice(iterable, size)) while item: yield item item = list(itertools.islice(iterable, size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_chunk(list, chunk_size):\n for i in range(0, len(list), chunk_size):\n yield list[i:i + chunk_size]", "def split_to_chunks(of_list, chunk_size):\n assert of_list is not None\n\n for i in range(0, len(of_list), chunk_size):\n yield of_list[i:i + chunk_size]", "def chunks...
[ "0.8029146", "0.7866675", "0.7706884", "0.7705638", "0.7693641", "0.7636561", "0.759437", "0.7518479", "0.74862957", "0.74771607", "0.74649835", "0.74636126", "0.74614024", "0.742523", "0.7384342", "0.7381355", "0.7377896", "0.7340886", "0.73281103", "0.7326142", "0.73247826"...
0.0
-1
Draw detected bounding boxes.
def vis_detections(im, class_name, dets, thresh=0.8): global num inds = np.where(dets[:, -1] >= thresh)[0] if len(inds) == 0: return frame = im im = im[:, :, (2, 1, 0)] #fig, ax = plt.subplots(figsize=(12, 12)) #ax.imshow(im, aspect='equal') for i in inds: bbox = dets[i, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bounding_boxes(self, bounding_boxes, output):\n for i, bb in enumerate(bounding_boxes):\n\n if bb[2] > output.shape[1] or bb[3] > output.shape[0] or bb[0] < 0 or bb[1] < 0:\n continue\n cv2.rectangle(\n np.asarray(output), (bb[0], bb[1]), (bb[2], ...
[ "0.77598673", "0.7638101", "0.7510348", "0.72977304", "0.7150563", "0.7103931", "0.7101873", "0.7083905", "0.7020769", "0.6993739", "0.6974172", "0.69637305", "0.6859061", "0.68521667", "0.68319523", "0.6830371", "0.6809837", "0.6805064", "0.67750585", "0.6774759", "0.6742592...
0.0
-1
return spin operators for the spin at position. with only = "", a dictionary with entries Ix, Iy, Iz, Ip, Im is returned. if only is a key of that dictionary, only the matrix representation of the specified operator is returned.
def getSpinOperators(basis, position, only = ""): Iz = np.diag([b.Iz(position) for b in basis]) #Iplus and Iminus are defined as #I+ |I,M> = [I(I+1) - M(M+1)]^0.5 |I, M+1> #I- |I,M> = [I(I+1) - M(M-1)]^0.5 |I, M-1> #Iplus return Iz
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_operator(key):\n # Check for simple operators\n if key.startswith('re_'):\n operator = np.real\n newkey = key[3:]\n elif key.startswith('im_'):\n operator = np.imag\n newkey = key[3:]\n elif key.startswith('abs_'):\n operator = np.abs\n newkey = key[4:]...
[ "0.6678933", "0.55626637", "0.5474227", "0.54608226", "0.54563135", "0.5422534", "0.5388054", "0.537671", "0.53572994", "0.5349381", "0.53020555", "0.53020555", "0.53020555", "0.529534", "0.5279458", "0.52203685", "0.5192929", "0.5138817", "0.51284856", "0.511319", "0.5109030...
0.69203335
0
Returns a LinearOperator using eigenvalues and eigenvectors as given by sparse.linalg.eigen. This LinearOperator can be seen as an approximation of the operator on which the eigen function has been run. Inputs
def eigen_operator(shape, e, v, **kargs): def matvec(x): k = [np.dot(x.T, vi) for vi in v] return np.sum([ki * ei * vi for ki, ei, vi in zip(k, e, v)], axis=0) return LinearOperator(shape, matvec=matvec, rmatvec=matvec, **kargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_eigenproblem_solver(self, A, M, num, problem_type, method_type, which, tol, maxit, shift_invert):\n # XXX TODO: This import should actually happen at the top, but on some\n # systems it seems to be slightly non-trivial to install\n # slepc4py, and since we don't...
[ "0.6471827", "0.63047266", "0.6207193", "0.60965955", "0.60938126", "0.60121226", "0.59789973", "0.5941303", "0.5834583", "0.56577486", "0.5643125", "0.56209755", "0.56108844", "0.5596537", "0.55823183", "0.55808496", "0.556371", "0.5560485", "0.5551935", "0.55268985", "0.550...
0.722874
0
Returns a 3D gaussian function with the given parameters
def gaussian3d(center_z, center_x, center_y, height, width_z, width_x, width_y): width_x = float(width_x) width_y = float(width_y) width_z = float(width_z) return lambda z,x,y: height*np.exp( -(((center_z-z)/width_z)**2 + ((center_x-x)/width_x)**2 + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gauss3(x,a1,c1,w1,a2,c2,w2,a3,c3,w3):\n return gaussian(x,a1,c1,w1)+gaussian(x,a2,c2,w2)+gaussian(x,a3,c3,w3)", "def gaussian3d(l, sigma=1.0):\n\n ax = np.arange(-l//2 + 1.0, l//2 + 1.0)\n xx, yy, zz = np.meshgrid(ax, ax, ax)\n\n kernel = np.exp(-(xx**2 + yy**2 + zz**2)/(2.0*sigma**2))\n\n ret...
[ "0.73642", "0.7021302", "0.68343", "0.6534918", "0.64060897", "0.6329809", "0.61930066", "0.61684626", "0.61375004", "0.61375004", "0.61375004", "0.60913557", "0.60905373", "0.60829175", "0.6072532", "0.6052405", "0.6048814", "0.6014103", "0.5983202", "0.59682137", "0.5943405...
0.78389746
0
Closes the conenction to the server.
async def close(self) -> None: assert self._client is not None await self._client.close() self._client = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeConnecetion(self):\n client.close()", "def server_close(self):\n\t\tself.socket.close()", "def close(self):\n self.control_conn.sendall('CLOSE'.encode())", "def close_connection(self):\n\n self._connection.close()\n print(\"Closed connection....\")", "def close(self):\n ...
[ "0.8058159", "0.7863372", "0.7856422", "0.77991384", "0.7746718", "0.7709212", "0.7700577", "0.7692921", "0.7692519", "0.76925087", "0.7680899", "0.7651755", "0.76077545", "0.76054543", "0.76054543", "0.76054543", "0.76054543", "0.76054543", "0.76054543", "0.75987077", "0.759...
0.0
-1
Receives a player's color and returns their General
def get_general(self, color): for piece in self._active_pieces[color]: if type(piece) is General: return piece
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player(self):\n return self._color", "def get_opponent_color(self, mycolor):\n if mycolor == ChessGame.BLACK:\n return ChessGame.WHITE\n elif mycolor == ChessGame.WHITE:\n return ChessGame.BLACK\n else:\n raise NotImplementedError()", "def getPet...
[ "0.72289145", "0.686527", "0.669872", "0.66786665", "0.6642646", "0.66236687", "0.66029984", "0.65610754", "0.6542995", "0.64548784", "0.6379941", "0.6379941", "0.6379941", "0.6379941", "0.6336708", "0.6333549", "0.6319794", "0.63022846", "0.6290927", "0.6285306", "0.62555426...
0.61507404
28
Initiates the Piece object for the designated player at the designated location on the game board.
def __init__(self, color, location): self._color = color self._piece_type = None self._location = location
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, board, position, player, piece_type):\n self.board = board\n self.position = position\n self.player = player\n self.piece_behavior = piece_type", "def __init__(self, player):\n self._piece_type = 'pawn'\n self._value = 2 if player == \"white\" else -2\...
[ "0.7369072", "0.6755652", "0.64940494", "0.64635086", "0.6440044", "0.63020295", "0.6297643", "0.62879086", "0.6278679", "0.6266741", "0.62431675", "0.6222203", "0.62182754", "0.6205422", "0.6190671", "0.61836106", "0.6157939", "0.6155256", "0.61341935", "0.6118258", "0.60878...
0.0
-1
Returns _color data member value.
def get_color(self): return self._color
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_color(self):\n return self.__color", "def _get_color(self):\n return self.__color", "def _get_color(self):\n return self.__color", "def _get_color(self):\n return self.__color", "def get_color(self):\r\n return self.__color", "def get_color(self):\r\n return self._color...
[ "0.8376114", "0.8376114", "0.8376114", "0.8376114", "0.83480686", "0.8335768", "0.8198367", "0.81914383", "0.81914383", "0.8164497", "0.8097534", "0.80700284", "0.804404", "0.804404", "0.80084455", "0.80084455", "0.80084455", "0.79912156", "0.7982103", "0.7914775", "0.7887134...
0.79757
19
Check if hash of passwords are equal hash(self.password)=hash(password)
def password_is_correct(self, password): return Bcrypt().check_password_hash(self.password, password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_password_match(self):\r\n\r\n tst = User()\r\n tst._password = self.test_hash\r\n\r\n self.assertTrue(\r\n tst._password == self.test_hash, \"Setting should have hash\")\r\n self.assertTrue(\r\n tst.password == self.test_hash, \"Getting should have hash\")...
[ "0.77653253", "0.7730096", "0.75776136", "0.74381065", "0.7389964", "0.7245792", "0.7238476", "0.72016066", "0.71889377", "0.7167593", "0.71634805", "0.7163377", "0.715206", "0.71175146", "0.71130484", "0.7101497", "0.70774394", "0.7023976", "0.70046425", "0.6996388", "0.6984...
0.69659066
24
Returns a representation of a activity instance
def __repr__(self): return "<Activities: {}>".format(self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activity():\n return {\n \"type\": \"class\",\n \"base\": None,\n \"is_abstract\": True,\n \"is_document\": True,\n \"pstr\": (\"{}\", (\"canonical_name\",)),\n \"properties\": [\n (\n \"alternative_names\",\n \"str\",\n ...
[ "0.74904555", "0.7374664", "0.7041148", "0.68767494", "0.6654494", "0.63959736", "0.63094676", "0.6303493", "0.627519", "0.62664264", "0.6261078", "0.5980647", "0.59064794", "0.5896446", "0.58883405", "0.5884998", "0.58688504", "0.5849311", "0.58141786", "0.57516664", "0.5736...
0.74235255
1
Sets the type of this AuthenticityCheckResultItem.
def type(self, type): if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 self._type = type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self._type = type", "def set_auth_type(self, auth_type):\n pass", "def set_type(self, type: int):\r\n self.type = type\r\n self.canvas.itemco...
[ "0.6594546", "0.6594546", "0.6442677", "0.63364863", "0.6222679", "0.62077117", "0.62077117", "0.6201682", "0.6176816", "0.61493254", "0.6144453", "0.6144453", "0.6144453", "0.6144453", "0.6144453", "0.6144453", "0.6144453", "0.6144453", "0.6144453", "0.6144453", "0.6144453",...
0.5675595
77
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, AuthenticityCheckResultItem): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, AuthenticityCheckResultItem): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
mute the sound. status is just a override.
def mute(self, status=None): if status is not None: st = status else: st = not status.volume_muted self._socket_client.receiver_controller.set_volume_muted(st)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mute(self, status=None):\n if status is None:\n status = not self.status.volume_muted\n\n self._socket_client.receiver_controller.set_volume_muted(status)", "def mute(self, value: bool) -> None:\n self.audio_mixer.setmute(value)\n self.update_status()", "def mute():\n...
[ "0.79011047", "0.77795583", "0.75733083", "0.75358844", "0.73930043", "0.72407174", "0.716834", "0.7087595", "0.706618", "0.70261353", "0.69888914", "0.6970083", "0.68739045", "0.6839842", "0.6749241", "0.6728343", "0.6677621", "0.6664756", "0.66239315", "0.6607038", "0.65938...
0.80609
0
Initialises the current and the max val fields for this display bar.
def _initFields(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, min_val, max_val):\n self.values = (min_val, max_val)", "def __init__(self, min_val, max_val):\n self.values = (min_val, max_val)", "def __init__(self, min_val, max_val):\n self.values = (min_val, max_val)", "def __init__(self, min_val, max_val):\n self.values =...
[ "0.6614599", "0.6614599", "0.6614599", "0.6614599", "0.62974113", "0.6202602", "0.6170325", "0.61686224", "0.61104923", "0.60626036", "0.6053629", "0.60061437", "0.5998231", "0.59694487", "0.5918838", "0.5909775", "0.5883775", "0.5883775", "0.5878681", "0.58129126", "0.581193...
0.0
-1
Add a vertex to the graph.
def add_vertex(self, vertex_id): # creates a vertex with an empty list as their neighboring vertices self.vertices[vertex_id] = set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, vertex):\n raise NotImplementedError", "def add_vertex(self, vertex):\n if isinstance(vertex, Vertex):\n self.vertices.append(vertex)\n return\n raise TypeError('Is not vertex instance!')", "def add_vertex(self, vertex_name: n):\n new_verte...
[ "0.87015903", "0.84329987", "0.8422056", "0.840923", "0.83646226", "0.8317027", "0.825337", "0.808519", "0.8081489", "0.8038682", "0.8035422", "0.78834563", "0.78711975", "0.7838118", "0.7838118", "0.77608305", "0.7757061", "0.77158874", "0.7711681", "0.76663774", "0.76616603...
0.73652923
31
Add a directed edge to the graph.
def add_edge(self, v1, v2): # add the 2nd node to the list of edges for the first node if v1 in self.vertices and v2 in self.vertices: self.vertices[v1].add(v2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, edge):\n src = edge.get_source()\n dest = edge.get_destination()\n #weightEdge = WeightedEdge(src, dest, edge.get_total_distance(), edge.get_outdoor_distance())\n if not (src in self.edges and dest in self.edges):\n raise ValueError('Node not in graph')\n ...
[ "0.78169996", "0.77789694", "0.7618847", "0.761851", "0.75694674", "0.7547367", "0.7483565", "0.7437083", "0.74284625", "0.7422367", "0.741715", "0.7337182", "0.73281914", "0.7266331", "0.7227267", "0.7212267", "0.71977764", "0.7194343", "0.71735585", "0.7168542", "0.7152955"...
0.6677459
53
Get all neighbors (edges) of a vertex.
def get_neighbors(self, vertex_id): # TODO return self.vertices[vertex_id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors_in(self, vertex):\n return list(self.neighbor_in_iterator(vertex))", "def neighbors_out(self, vertex):\n return list(self.neighbor_out_iterator(vertex))", "def get_neighbours(self, vertex):\n output = []\n \n if vertex in self.adjacency_list:\n for ne...
[ "0.8146008", "0.78266084", "0.78112674", "0.7634123", "0.76183206", "0.7559868", "0.7391218", "0.73310196", "0.729323", "0.729323", "0.729323", "0.729323", "0.729323", "0.729323", "0.7279731", "0.71649474", "0.7128683", "0.7083494", "0.7077735", "0.7033856", "0.69887614", "...
0.73596346
7
A function to return the calculated "brightness" of a color.
def brightness(r, g, b): return sqrt(pow(r, 2) * .241 + pow(g, 2) * .691 + pow(b, 2) * .068) / 255
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_color_brightness(self, color):\n d0, _, _ = self._get_color_dominance_indices(color)\n return color[d0]/MAX", "def brightness(rgb):\n # return (min(rgb) + max(rgb)) / 2\n return rgb_to_hls(rgb)[1] * 255", "def _get_brightness_component(self, color):\n brightness = self._get_...
[ "0.87519854", "0.78865486", "0.76600325", "0.76410246", "0.7552168", "0.7489598", "0.74625653", "0.7305102", "0.7246516", "0.72328055", "0.72298247", "0.72019804", "0.718939", "0.716885", "0.7130277", "0.70961905", "0.70601827", "0.70310134", "0.70298374", "0.700138", "0.6981...
0.75901306
4
Get the dominant colors of an image.
def extract_cluster_color_values(hist, centroids, ignore_background=False): colors = [] for (percent, color) in zip(hist, centroids): rgb = [] total = 0 for c in color: c = round(float(c)) total += c rgb.append(c) if ignore_background: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dominant_color(image):\n image = image.convert('RGBA')\n # Shrink the image, so we don't spend too long analysing color\n # frequencies. We're not interpolating so should be quick.\n image.thumbnail((200, 200))\n max_score = 0.0\n dominant_color = None\n\n for count, (r, g, b, a) in im...
[ "0.79686916", "0.7367852", "0.7304908", "0.71927786", "0.71834433", "0.7108218", "0.66008735", "0.6480664", "0.6372689", "0.6372689", "0.6207156", "0.6143511", "0.6007459", "0.59870464", "0.5914479", "0.5819323", "0.5805314", "0.579411", "0.5755989", "0.5694166", "0.56892407"...
0.51782346
66
Get the dominant colors of an image.
def plot_colors(hist, centroids): bar = np.zeros((50, 300, 3), dtype="uint8") startX = 0 for (percent, color) in zip(hist, centroids): # plot the relative percentage of each cluster endX = startX + (percent * 300) cv2.rectangle(bar, (int(startX), 0), (int(endX), 50), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dominant_color(image):\n image = image.convert('RGBA')\n # Shrink the image, so we don't spend too long analysing color\n # frequencies. We're not interpolating so should be quick.\n image.thumbnail((200, 200))\n max_score = 0.0\n dominant_color = None\n\n for count, (r, g, b, a) in im...
[ "0.79686916", "0.7367852", "0.7304908", "0.71927786", "0.71834433", "0.7108218", "0.66008735", "0.6480664", "0.6372689", "0.6372689", "0.6207156", "0.6143511", "0.6007459", "0.59870464", "0.5914479", "0.5819323", "0.5805314", "0.579411", "0.5755989", "0.5694166", "0.56892407"...
0.0
-1
Get the dominant colors of an image.
def get_dominant_colors(img, save_path=None, n=3): # bg,_ = determine_background(img_path) # if its string open it if isinstance(img, str): if os.path.isfile(img): img = cv2.imread(img) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) else: print("Error: imag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dominant_color(image):\n image = image.convert('RGBA')\n # Shrink the image, so we don't spend too long analysing color\n # frequencies. We're not interpolating so should be quick.\n image.thumbnail((200, 200))\n max_score = 0.0\n dominant_color = None\n\n for count, (r, g, b, a) in im...
[ "0.79686916", "0.7367852", "0.7304908", "0.71927786", "0.71834433", "0.66008735", "0.6480664", "0.6372689", "0.6372689", "0.6207156", "0.6143511", "0.6007459", "0.59870464", "0.5914479", "0.5819323", "0.5805314", "0.579411", "0.5755989", "0.5694166", "0.56892407", "0.5673699"...
0.7108218
5