query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
get master monitor pid
def get_pid(ssh): pid_file_path = data_dir.MM_PID_DIR+"master_monitord.pid" #獲得master_monitord.pid之檔案路徑 cmd = "sudo cat %s" % pid_file_path #組合cat指令 s_stdin, s_stdout, s_stderr = ssh.exec_command(cmd) #透過ssh執行指令 return s_stdout.read() #pid, error = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE).communicate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_host_master_id(self):\r\n return self._handler.get_host_master_id()", "def get_pid(self):\n if self.status():\n file = open(os.path.join(self.data_dir, 'postmaster.pid'))\n pid = int(file.readline())\n return pid\n else:\n return None", "...
[ "0.7282652", "0.67779243", "0.6716466", "0.6713761", "0.66976947", "0.66976947", "0.66508067", "0.65205395", "0.6470929", "0.642866", "0.64118284", "0.6406304", "0.6406304", "0.63952607", "0.6325486", "0.6319568", "0.63080573", "0.62192404", "0.62192404", "0.62192404", "0.619...
0.690566
1
temp start for master monitor
def temp_start(): sh_file_path = data_dir.ROOT_DIR+"mm_initial.sh" cmd = "sudo %s" % sh_file_path subprocess.Popen(cmd.split(), stdout=subprocess.PIPE).communicate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start():", "def start():", "def start():", "def start():", "def start_monitoring(self):\n pass", "def start(self):\n self.monitor_lc.start(self.interval)", "def __init__(self, master):\n super().__init__()\n self.master = master\n self.proc = None\n sel...
[ "0.71045166", "0.71045166", "0.71045166", "0.71045166", "0.662394", "0.6591161", "0.65272325", "0.6475052", "0.6429651", "0.64166564", "0.6392345", "0.63734674", "0.63614297", "0.63614297", "0.633983", "0.633983", "0.633983", "0.633983", "0.633983", "0.633983", "0.633983", ...
0.6206484
29
Fetch a html page from url and store in store_path
def get_page_and_store(url, cache_path=None): page = urllib2.urlopen(url).read() if cache_path is not None: open(cache_path, 'w').write(page) return page
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetchUrl(self, url):\n self.driver.get(url)\n html = self.driver.page_source\n return html", "def processUrl(self, url: str) -> dict:\n site = self.sf.urlFQDN(url)\n cookies = None\n\n # Filter out certain file types (if user chooses to)\n if list(filter(lambd...
[ "0.63946897", "0.62761647", "0.62544036", "0.6150826", "0.61108017", "0.6092718", "0.60736644", "0.6055679", "0.60108894", "0.5974012", "0.59731984", "0.58925676", "0.5850709", "0.5833227", "0.58093405", "0.5793539", "0.57740086", "0.5772137", "0.57652396", "0.57540506", "0.5...
0.68053216
0
Return list of urls of infobox pages
def get_infobox_urls(mapping_page): pattern = re.compile('index\.php/Mapping_en:Infobox_[-\w\./]+') return pattern.findall(mapping_page)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getURLs():", "def list(self, request ):\n\t\tinUrl = request.query_params.get('url', None )\n\t\t#if inUrl is None:\n\t\t#\tinUrl = 'https://google.com'\n\t\tserializer = PageInfoSerializer( instance = PageInfo(url=inUrl), many=False )\n\t\treturn Response( serializer.data )", "def get_urls():\r\n r...
[ "0.707302", "0.68563527", "0.6789511", "0.67732596", "0.66887313", "0.6289862", "0.62286484", "0.6220867", "0.6209303", "0.6187336", "0.6129483", "0.6121491", "0.6111746", "0.61112785", "0.60911447", "0.60744447", "0.60727453", "0.60689384", "0.6068492", "0.60557705", "0.6024...
0.76755244
0
Return class of the infobox, given the HTML DBpedia infobox_page class is in CamelCase (possibly with colon and space), exactly as appear in the infobox_page
def get_class(infobox_page): pattern = re.compile('OntologyClass:[-\w: ]+') wiki_class = pattern.findall(infobox_page) if len(wiki_class) == 0: return None else: return wiki_class[0].replace('OntologyClass:', '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_page_type_get_infobox(\n html: Tag) -> Tuple[PageType, Optional[Dict[str, Tag]]]:\n infoboxes = html.find_all('table', class_='infobox')\n if len(infoboxes) == 1:\n infobox_dict = parse_infobox(infoboxes[0])\n # Check if movie\n image_caption = infobox_dict.get('_image_c...
[ "0.6260306", "0.5738476", "0.53829914", "0.5331526", "0.5307376", "0.5158402", "0.50680715", "0.50504017", "0.49873435", "0.49439368", "0.49332327", "0.48963484", "0.48814535", "0.48814535", "0.48280013", "0.48041573", "0.4792899", "0.47661728", "0.47534335", "0.4744808", "0....
0.69977725
0
Return pairs of (infobox, class) infobox format is lower case with hyphen (e.g. 'aflplayer2') class format is as returbed by get_class.
def get_infobox_class_pairs(from_cache=True): infobox_urls = [] infobox_class_pairs = [] for i, mapping_url in enumerate(MAPPINGS_URLS): cache_path = HTML_CACHE_PATH_PREFIX + 'main_mapping_en_' + str(i+1) + '.html' if from_cache: mapping_page = open(cache_path, 'r').read() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_classes(self):\n out_classes = ()\n classes = super(NamedEntityRecognizerModel, self).get_classes()\n\n for c in classes:\n out_classes += (c[:2],)\n\n return ((self.outside_class, self.outside_class_display),) + out_classes", "def convert_from_cls_format(cls_boxes,...
[ "0.5774047", "0.5668328", "0.5668328", "0.5668328", "0.5538742", "0.5415243", "0.5384948", "0.5378459", "0.52978235", "0.52891785", "0.5135255", "0.5103369", "0.5069673", "0.50657797", "0.5051091", "0.50464505", "0.5031448", "0.5025389", "0.49898514", "0.4987515", "0.496683",...
0.6894431
0
distribute targets[lo, hi) into nbucket even partitions the distribution is used by nbucket processes for parallel computation
def dist(targets, lo, hi, nbucket): distribution = [] for _ in range(nbucket): distribution.append([]) for i in range(lo, hi): if 0 <= i and i < len(targets): distribution[i % nbucket].append(targets[i]) return distribution
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buckets(data, n):\n # Shuffle all datasets to get a more consistent workload for all threads.\n random.shuffle(data)\n\n for i in range(0, len(data), n):\n yield data[i:i + n]", "def distribute_discrete(sizes, groups, pow=1.0):\n chunks = np.array(sizes, dtype=np.int64)\n weights = np.p...
[ "0.60612345", "0.5802914", "0.5703838", "0.5630621", "0.56188554", "0.5605208", "0.5581452", "0.5499443", "0.5498334", "0.54717845", "0.5436709", "0.54261446", "0.5330848", "0.53118753", "0.5299507", "0.5260812", "0.5231849", "0.51845485", "0.51622194", "0.5148257", "0.514585...
0.7943863
0
run tweets collection on a list of users using one set of apikey, (apikey, users) as args the list of users is run sequentially establish a new database connection for each user, and commit insertions and close connection when done
def runner(args): apikey, users = args api = collect.mk_api(apikey) for user in users: db_connection = db.mk_connection() collect.collect_user_tweets(api, user, collect.mk_sql_insert_handler(db_connection)) db.close_connection(db_connection)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TweetsRealTime(dbname, user, password, table_name, APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET, loop_gathering = False, search_terms = [\"Happy\"]):\n try:\n \"\"\"Be careful with the following global variables. They are necessary to make this script run from the main function\n Th...
[ "0.62722933", "0.6248243", "0.61886966", "0.6075609", "0.6019225", "0.59416574", "0.5891333", "0.58175486", "0.57583445", "0.57216036", "0.5684764", "0.5676086", "0.56157917", "0.5606975", "0.5600138", "0.55862385", "0.55794513", "0.5542012", "0.55383205", "0.5537845", "0.552...
0.86470985
0
Returns (indent,rest) depending on line indentation
def separeIndent(self,line): p=0 while p<len(line) and line[p] in string.whitespace: p=p+1 rest=line[p:] return line[:p],rest
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_indent(line):\n if is_blank(line):\n return 0\n\n stripped = line.lstrip(' ')\n if stripped.startswith('- '):\n stripped = stripped[2:].lstrip(' ')\n # This is a list item\n\n return len(line) - len(stripped)", "def get_function_indent(line: str) -> int:\n first_functi...
[ "0.6844012", "0.6561831", "0.65578353", "0.64595574", "0.6439283", "0.6341889", "0.6288154", "0.628526", "0.6260362", "0.62497234", "0.6222218", "0.62192994", "0.62021357", "0.6173746", "0.6167052", "0.6164297", "0.6146771", "0.6128034", "0.60974324", "0.6087453", "0.60744375...
0.714444
0
Main class for spot detection and image filtering, including SNR metric and detection profile analysis.
def __init__(self, verbose=1, data=None, shape=(512, 512, 35)): if shape is not None and data is not None: if data.shape != shape: data = resize(data, shape, mode='constant') self.image_raw = data self.image_filtered = None self.spots = [] self.SNR = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n dir_path =r'/Users/dustin/CS/projects/ship_detector/data/ships-in-satellite-imagery/shipsnet/'\n\n data_array, label_array = read_images(dir_path)\n\n array_info(data_array, label_array)\n\n image_info(data_array[0,:], plot_image=False)\n\n split_ratios = [0.8, 0.1, 0.1] #splitt...
[ "0.61488354", "0.60028964", "0.59256756", "0.5876566", "0.582332", "0.5813336", "0.57806224", "0.572001", "0.5710131", "0.56793225", "0.5668328", "0.5666524", "0.5656944", "0.56526953", "0.5558499", "0.55367804", "0.55338776", "0.55285794", "0.54841477", "0.54770577", "0.5469...
0.536956
26
Loads the image from disk, returns image with axis in the natural order (deep last). Data format should be numpy.uint8. Time complexity goes square if numpy.uint16, especially for segmentation.
def load(self, path, shape=(1024, 1024, 35), dtype='uint16'): valid_dtypes = ['uint8', 'uint16'] if dtype not in valid_dtypes: raise ValueError('dtype should be either one of %s' % ', '.join(valid_dtypes)) im = io.imread(path) im = numpy.rollaxis(im, 0, 3) if im.sha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loader(path):\n img = np.load(path)\n img = img[1:4]\n if np.random.choice((True, False)):\n img = img[:, :, ::-1]\n img = np.array(img)\n if np.random.choice((True, False)):\n img = img[:, ::-1, :]\n img = np.array(img)\n\n img = img.transpose((1, 2, 0)) # pytorch i...
[ "0.6431803", "0.6287837", "0.62287796", "0.619413", "0.6191195", "0.61317974", "0.6061726", "0.5990384", "0.59458464", "0.5924528", "0.58976215", "0.5853149", "0.5837823", "0.58332664", "0.58236", "0.5814487", "0.581173", "0.581148", "0.5806939", "0.5799971", "0.5781366", "...
0.65080833
0
Filters by first convolving the background with a gaussian filter. Then substract the obtained image to the origin and finally refilter with another Gaussian filter with a variance 10 times smaller. Variance specified in utils module.
def filter(self, op=GaussianFilter): if self._verbose > 0: print("Filtering...") # Import from utils specified params. params = get_filtering_params() negative = self.image_raw - op(sigma=params['sigma_bgd']).convolve(self.image_raw) self.image_filtered = op(sigma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smooth_gauss(image, variance=2, kernel_size=(9, 9)):\n return cv2.GaussianBlur(image, kernel_size, variance)", "def differenceOfGausssians(image,sigma0, sigma1,window_size, roi, out = None):\n return (vigra.filters.gaussianSmoothing(image,sigma0,window_size=window_size,roi = roi)-vigra.filters.gaussian...
[ "0.69585425", "0.65215564", "0.64743555", "0.630799", "0.62878084", "0.6255153", "0.6228166", "0.6222164", "0.62092054", "0.62084013", "0.62078834", "0.6186285", "0.61779565", "0.61562985", "0.6127383", "0.6112547", "0.6106225", "0.606717", "0.6064921", "0.60606796", "0.60201...
0.70931846
0
DEPRECATED, replaced by detect_and_fit for simplicity and speed issues. Detect spots with a specified detector (from the spotdetector.py module) and the detection params from utils module. Spots are identified by their position, i.e. 'x.y.z'.
def _detect_spots(self, detector=LocalMax, **kwargs): if self._verbose > 0: print("Detecting...", end="") spots = detector(**kwargs).locate(self.image_filtered) # Spots are identified by their position: self.spots = [Spot(tuple(s)) for s in spots] if self._verbose >...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spot_detection(data, roi_size=6, blobs=None, processes=None, **kwargs):\n\n if blobs is None:\n blobs = blob_detection(data, **kwargs)\n\n if processes is not None and processes > 1:\n with Pool(processes) as pool:\n spots = pool.map(functools.partial(__spot_detection, data=data,...
[ "0.6162223", "0.56548464", "0.5607804", "0.5593707", "0.54353815", "0.5421498", "0.52761436", "0.5211606", "0.50746685", "0.50697035", "0.5038055", "0.50195175", "0.5013972", "0.5009768", "0.4988007", "0.4983076", "0.49769273", "0.49657902", "0.49529868", "0.49395737", "0.492...
0.7540299
0
TODO Should return the variance of the PSF in order to compute correctly the filters of the fiter method.
def get_sigma_psf(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fr(self):\n return np.sum([filt.fr for filt in self.filters], axis=0)", "def conditional_variance(self, F):\n raise NotImplementedError", "def find_backstats(f_arr, sigma, niter):\n ave = f_arr.mean()\n std = f_arr.std()\n for i in range(niter):\n mask = (abs(f_arr - ave) < si...
[ "0.64628994", "0.6301386", "0.6119714", "0.597342", "0.58740425", "0.587181", "0.58567435", "0.5807307", "0.57649577", "0.5743164", "0.5728937", "0.5687465", "0.56679213", "0.56647855", "0.565778", "0.56465715", "0.5632417", "0.56073457", "0.56051135", "0.5602647", "0.5599155...
0.58290756
7
DEPRECATED Jump to next paragraph. This method goes through all the detected spots and fit a specified spot_model separately to each of them. TODO DONE If a model can not be safely fit to the spot, then the spot is deprecated and deleted from the spots list. Spot_models are built in the fitters module. Extract_cube com...
def fit_spots(self, spot_model=Mixture, kind='individual'): model = spot_model() # print(model) # if model.kind == 'individual': # # loop = self.spots # # # to_delete = [] # if self._verbose > 0: # loop = tqdm.tqdm(loop, desc=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _detect_spots(self, detector=LocalMax, **kwargs):\n if self._verbose > 0:\n print(\"Detecting...\", end=\"\")\n\n spots = detector(**kwargs).locate(self.image_filtered)\n\n # Spots are identified by their position:\n self.spots = [Spot(tuple(s)) for s in spots]\n i...
[ "0.63233507", "0.6011749", "0.5599055", "0.54401183", "0.5310215", "0.5199169", "0.50872684", "0.50812757", "0.50468516", "0.50031716", "0.49997303", "0.49940717", "0.49932045", "0.49635676", "0.49512917", "0.49268216", "0.48976818", "0.48886847", "0.4885543", "0.48546764", "...
0.7950176
0
assign spots and models and stuff to each subcell sgemented within the mother image.
def assign(self): for s in self.spots: if self.cells[s[:2]] == 0: label = find_nearest_region(self.cells, *s[:2]) else: label = self.cells[s[:2]] s.region = label
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_grids(self, core_size, patch_shape, psf_model_shape):\n # core foo\n ravel_size = patch_shape[0] * patch_shape[1]\n self.core_shape = (core_size, core_size)\n xcenter = (patch_shape[0] - 1) / 2\n ycenter = (patch_shape[1] - 1) / 2\n buff = (core_size - 1) / 2\n ...
[ "0.5968", "0.56540424", "0.5632347", "0.5628717", "0.5580567", "0.55111766", "0.5511018", "0.5462333", "0.54537827", "0.54336035", "0.54239994", "0.5421881", "0.5404425", "0.53897464", "0.5314474", "0.5307525", "0.5289391", "0.52812016", "0.5277636", "0.5267836", "0.52582806"...
0.54490584
9
This method is intended at segmenting the nucleis in DAPIimage on Mask images (not FISH). However basic, it seems to give a rather good. approximation. The workflow is MIP > local grad > Otsu thresholding > Connected components labelling > Filtering components based on their size (using either handthreshold or KMeans t...
def segment(self, sg=NucleiSegmenter()): # mask_path = self.name.replace('w1', 'w3').replace('561', '405') # cell_mask = io.imread(mask_path) # self.mask = numpy.swapaxes(cell_mask, 0, 2) with warnings.catch_warnings(): warnings.simplefilter('ignore') if self._ver...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_nuclei3D_5(instack, sigma1=3, sigma_dog_small=5, sigma_dog_big=40, seed_window=(70,100,100),\n erosion_length=5, dilation_length=10, sensitivity=0.5, size_min=1e4, \n size_max=5e5, circularity_min=0.5, display=False):\n\n\n def smart_dilate(stack, labelmas...
[ "0.73299015", "0.6700284", "0.6588071", "0.6206197", "0.61541283", "0.60890365", "0.6068497", "0.6058113", "0.60470617", "0.603688", "0.6011224", "0.6002645", "0.59923077", "0.5974445", "0.59183335", "0.58174556", "0.5809067", "0.578748", "0.57815266", "0.5739608", "0.5718258...
0.7139125
1
Simply counting the number of spots per label does not work properly as some region do not have closed boundaries (for instance the segmented boundary has a 'C' shape but the cell is round. In this case spots will not be labeled as belonging to the 'C' region but they actually belong to the underlying cell which is bad...
def split(self): sub_images = [] for region in regionprops(self.cells): minr, minc, maxr, maxc = region.bbox sub_image = self.image_raw[max(0, minr - 10):maxr, max(0, minc - 10):maxc, :] sub_images.append(FQimage(data=sub_image)) return sub_images
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_labels(self) -> int:\n raise NotImplementedError", "def num_regions(image_data):\n if len(image_data.shape) > 2:\n image_data = skimage.color.rgb2gray(image_data)\n _, num_labels = ndimage.label(image_data)\n return num_labels", "def getCounts(self):\n ret = [0]*len(self.numToLabe...
[ "0.682998", "0.6528378", "0.64730394", "0.6329554", "0.62994987", "0.62716216", "0.62716216", "0.6205675", "0.6174312", "0.6141889", "0.6122885", "0.6083993", "0.6075714", "0.6058736", "0.6044446", "0.60386395", "0.60246855", "0.60045266", "0.5996402", "0.5978908", "0.5903851...
0.0
-1
This method is intended at segmenting the nucleis in DAPIimage on Mask images (not FISH). However basic, it seems to give a rather good. approximation. The workflow is MIP > local grad > Otsu thresholding > Connected components labelling > Filtering components based on their size (using either handthreshold or KMeans t...
def segment(self, sg=CytoSegmenter()): # mask_path = self.name.replace('w1', 'w3').replace('561', '405') # cell_mask = io.imread(mask_path) # self.mask = numpy.swapaxes(cell_mask, 0, 2) with warnings.catch_warnings(): warnings.simplefilter('ignore') if self._verbo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_nuclei3D_5(instack, sigma1=3, sigma_dog_small=5, sigma_dog_big=40, seed_window=(70,100,100),\n erosion_length=5, dilation_length=10, sensitivity=0.5, size_min=1e4, \n size_max=5e5, circularity_min=0.5, display=False):\n\n\n def smart_dilate(stack, labelmas...
[ "0.7328707", "0.7139187", "0.6587395", "0.6208488", "0.61546457", "0.6090403", "0.6068972", "0.60600775", "0.6048197", "0.6036108", "0.6010402", "0.6003973", "0.59924054", "0.59749573", "0.5919334", "0.5818136", "0.5809985", "0.5788729", "0.5781936", "0.57384485", "0.5718974"...
0.67011607
2
Get arguments from CLI
def get_args(): parser = argparse.ArgumentParser( description='Arguments for talking to vCenter') parser.add_argument('-s', '--host', required=True, action='store', help='vSpehre service to connect to') parser.add_argument('-o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cli_arguments(self):\n pass", "def get_args():\n\n parser = get_argument_parser()\n args = parser.parse_args()\n\n return args", "def parse_cli_args():\r\n parser = argparse.ArgumentParser(\r\n description=\"list all installed packages\")\r\n\r\n parser.add_argument(\"-v\",...
[ "0.83995515", "0.7696954", "0.7674078", "0.7656369", "0.75491726", "0.7546294", "0.7523218", "0.7521475", "0.7514517", "0.75119865", "0.74877495", "0.74807847", "0.74693704", "0.7466727", "0.74665916", "0.74520636", "0.74513096", "0.7427955", "0.7422721", "0.74211824", "0.740...
0.700868
72
Perform sensitivity analysis (via backpropagation; Simonyan et al. 2014) to determine the relevance of each image pixel for the classification decision. Return a relevance heatmap over the input image.
def sensitivity_analysis(model, image_tensor, device, postprocess='abs'): if postprocess not in [None, 'abs', 'square']: raise ValueError("postprocess must be None, 'abs' or 'square'") # Forward pass. X = torch.from_numpy(image_tensor) # convert numpy or list to tensor X.unsqueeze_(0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sensitivity(y_test, y_pred):\n\tmatrix = confusion_matrix(y_test, y_pred)\n\treturn matrix[0][0] / (matrix[0][0] + matrix[0][1])", "def main():\n # initialize the class labels and set the seed of the pseudorandom\n # number generator so we can reproduce our results\n labels = [\"dog\", \"cat\", \"pa...
[ "0.62368286", "0.60717547", "0.5930693", "0.58902764", "0.58234394", "0.5802739", "0.5779326", "0.5775463", "0.57620656", "0.5677118", "0.5666969", "0.56534714", "0.56438595", "0.56366694", "0.56218135", "0.56197983", "0.5616983", "0.56108636", "0.5610154", "0.5609649", "0.56...
0.66770697
0
Perform sensitivity analysis at subject level, i.e. get average relevance map across all image frames.
def SenAna_sub(model, img_sub, device, postprocess='abs'): if postprocess not in [None, 'abs', 'square']: raise ValueError("postprocess must be None, 'abs' or 'square'") # Forward pass. img_shape = img_sub.shape relevance_map = np.zeros(img_shape) for i in range(img_shape[0]): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sensitivity_analysis(model, image_tensor, device, postprocess='abs'):\r\n if postprocess not in [None, 'abs', 'square']:\r\n raise ValueError(\"postprocess must be None, 'abs' or 'square'\")\r\n \r\n # Forward pass.\r\n X = torch.from_numpy(image_tensor) # convert numpy or list to tensor\r\...
[ "0.6191744", "0.56979555", "0.55885917", "0.5446296", "0.5407041", "0.53730994", "0.5334738", "0.5328659", "0.52817476", "0.5266641", "0.5250934", "0.5232172", "0.5223908", "0.52186453", "0.5196671", "0.51927745", "0.51793593", "0.5172395", "0.5154605", "0.5135515", "0.512539...
0.5537867
3
This is the main page of our website.
def index(name=None): return render_template('tree.html', name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n return render_template(\"index.html\", title=\"Home\", heading=\"Dublin Bus\")", "def main_page():\n return render_template(\"index.html\")", "def index():\n return render_template(\n 'main/index.html',\n title='Main page'\n )", "def main_page():\n return render_t...
[ "0.8140115", "0.80469155", "0.7960196", "0.7864964", "0.7812475", "0.77935606", "0.77392304", "0.7707471", "0.7697759", "0.7618798", "0.7606769", "0.76046544", "0.7594974", "0.7594974", "0.7594974", "0.7594974", "0.7594974", "0.7594974", "0.7594974", "0.7594974", "0.7594974",...
0.0
-1
In this function, the server receive data from the front end, call the preprocessing program and after constructing the model, it returns the plan generated by our model back to the front end.
def receiveData(): preference = request.get_json() program = preference.pop('program') enroll_yr = preference.pop('enroll_yr') enroll_sem = preference.pop('enroll_sem') spec = 0 if 'spec' in preference: spec = int(preference['spec']) preference.pop('spec') program_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_process(\n self,\n model,\n client_plans,\n client_config,\n server_config,\n server_averaging_plan,\n client_protocols=None,\n ):\n process = FLProcess(\n model=model,\n client_plans=client_plans,\n client_confi...
[ "0.5819126", "0.5687763", "0.56812865", "0.5644644", "0.56177247", "0.56124663", "0.5591375", "0.55907804", "0.5575372", "0.55574733", "0.55520725", "0.55112386", "0.5506368", "0.5506181", "0.5499399", "0.54953074", "0.54870474", "0.5463988", "0.5453932", "0.544917", "0.54310...
0.6357549
0
This function obtains data from the table in our GUI when updating it. After receiving the table, the MiniZinc model would be called and replan the courses.
def returnTheTable(): preference = request.get_json() # Obtain the list containing replaced courses and the to-be-updated plan replaced = preference.pop('replaced') oldPlan = dict() readPlan = open('plan.txt') try: content = str(readPlan.read()) courses = content.split(' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_course(self):\r\n self.course = modulestore().get_course(self.course.id)", "def refresh_table(self):\n selection_index = self._lb_tables.GetSelection()\n if selection_index != -1:\n table_id = self._tables[selection_index][0]\n \n #remake table ui...
[ "0.61419713", "0.6002335", "0.5974986", "0.5882579", "0.58677083", "0.5769657", "0.5767029", "0.5742593", "0.5692034", "0.5499051", "0.54903704", "0.5464179", "0.5461997", "0.54431784", "0.54431045", "0.5406274", "0.53638023", "0.53550744", "0.5337333", "0.53190416", "0.53004...
0.64010185
0
Reading files storing our generated plan, this function converts it into regular lists in Python.
def readmyJson(filename): file_object = open(str(filename)+'.txt') plan = dict() try: file_context = str(file_object.read()) courses = file_context.split(' ')[:-1] plan1 = dict() plan2 = dict() plan3 = dict() plan4 = dict() plan1['semester'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadFromFile(self, filename):\n\t\treturn []", "def convert_input_to_list():\n\n f = open('pizza_source.txt', 'r')\n file_to_list = f.read().split('\\n')\n\n return file_to_list", "def toList(filename):\n pt_portname = Word(alphanums+'_')\n pt_portname_bus = Word(alphanums+\"_[]*\")\n\n p...
[ "0.6385733", "0.63671833", "0.6102488", "0.6067877", "0.5976521", "0.5949301", "0.59312946", "0.59158355", "0.58860725", "0.5880982", "0.5867598", "0.58486027", "0.58367854", "0.5829913", "0.57935774", "0.5785669", "0.5780333", "0.5749427", "0.5747511", "0.57466996", "0.57354...
0.0
-1
Load dbs and run gevent wsgi server
def serve_forever(self): from socketio.server import SocketIOServer server = SocketIOServer((self.args.interface, int(self.args.port)), self.application, resource="socket.io", policy_server=False) logger.info("Start socket.io server...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n run(reloader=DEBUG, server='eventlet', port=self.port)\n self.link_db.sync()\n self.user_db.sync()", "def serve() -> None: # pragma: no cover-behave\n logging.getLogger().setLevel(logging.INFO)\n database = init_database()\n init_bottle(database)\n server_port...
[ "0.68082136", "0.67535186", "0.65146065", "0.6503572", "0.63217366", "0.630049", "0.6287485", "0.6275346", "0.6272326", "0.625591", "0.6253286", "0.6194248", "0.61628866", "0.6152949", "0.6152293", "0.6127516", "0.61266613", "0.6093812", "0.60896564", "0.6079513", "0.60565466...
0.0
-1
Upload the contents of the target path to the pit.
def bury(project, name, version, local_path, force=False, ignore_exists=False): pit = get_default_pit() pit.bury(project, name, version, local_path, force, ignore_exists)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(self, file_path, file_name, output_path):", "def upload_file(name):\n subprocess.check_output(cmd_preamble + [\"cp\", name, f\"jot://{name}\"])", "def put_upload(self):\n # print \"starting upload...\", self.current_upload['filepath']\n self.touch()\n self.log(\"STARTING...
[ "0.7228012", "0.71022946", "0.6974475", "0.69378227", "0.68915975", "0.6773394", "0.63902754", "0.6332826", "0.62621516", "0.6197293", "0.6171918", "0.61360425", "0.6104908", "0.60731167", "0.6060642", "0.60279083", "0.59939873", "0.5986423", "0.59808147", "0.59753656", "0.59...
0.0
-1
Download the contents of the target dataset from the pit.
def dig(project, name, version, local_path): pit = get_default_pit() pit.dig(project, name, version, local_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(self):\n\n with open(self.dataset_path) as dataset_file:\n dataset = json.load(dataset_file)\n\n path = \"\".join([POST_HIT_PATH, dataset[\"dataset\"][\"data_path\"]])\n if not os.path.exists(path):\n os.makedirs(path)\n\n protocole = ...
[ "0.7569829", "0.7471258", "0.69428766", "0.6886398", "0.6870167", "0.6866422", "0.68050295", "0.6768909", "0.6762442", "0.667008", "0.66425467", "0.66425467", "0.6577672", "0.6554534", "0.64999145", "0.64999145", "0.6493207", "0.6434562", "0.642262", "0.64218813", "0.64191025...
0.0
-1
Runs a sample via the external program
def execute(filepath, method): cmd = ['./iengine', method, filepath] proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return proc.communicate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_sample(smp: sample.Sample,\n run_dir: Text,\n summary_file: Optional[Text] = None,\n generate_sample_ns: Optional[int] = None):\n start = time.time()\n # Create a script named 'run.sh' for rerunning the sample.\n args = [\n SAMPLE_RUNNER_MAIN_PATH,\n '...
[ "0.7039004", "0.69691503", "0.6754269", "0.66021514", "0.64470756", "0.63908726", "0.6333897", "0.6333897", "0.6333897", "0.6333897", "0.6304337", "0.62838846", "0.628046", "0.61999387", "0.61989176", "0.61883205", "0.61804163", "0.61766267", "0.61084574", "0.60725385", "0.60...
0.0
-1
Runs all the tests in the experiment with the given file and number of samples
def run_tests(file, samples): # Get the script dir, name and check if the file given exists test_dir = os.path.dirname(os.path.realpath(__file__)) script_name = os.path.basename(__file__) if not os.path.isfile(os.path.join(test_dir, file)): sys.stderr.write('{0}: file \'{1}\' not found\n'.format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_run(self):\n files = [\n (\"AS1-1.phy_r8s.txt\", \"AS1-1.phy_r8s.txt_2.5.txt\"),\n (\"AS1-3.phy_r8s.txt\", \"AS1-3.phy_r8s.txt_2.5.txt\"),\n (\"AS1-4.phy_r8s.txt\", \"AS1-4.phy_r8s.txt_2.5.txt\"),\n ]\n for file_pair in files:\n input_file =...
[ "0.7284664", "0.7053512", "0.67617613", "0.6700593", "0.66708344", "0.6572991", "0.6553279", "0.6417811", "0.6270118", "0.62472415", "0.6210755", "0.6205478", "0.61505103", "0.6144112", "0.6141312", "0.61252826", "0.6122838", "0.60793597", "0.60695887", "0.6057799", "0.605173...
0.7327586
0
R""" equality comparison between this and another Classifier, simply checks if A B == 0
def __eq__(self,other): return (self - other == 0.)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_equal(self, a, b):\n return a.X[0] == b.X[0]", "def __eq__(self, other):\n if isinstance(other, DenseUnit):\n return (Counter(self.dimension) == Counter(other.dimension) and Counter(self.points) == Counter(\n other.points))\n return False", "def __eq__(self...
[ "0.7100766", "0.6762525", "0.67273325", "0.6711093", "0.66767555", "0.663195", "0.6626179", "0.6616397", "0.6603185", "0.65802336", "0.6551513", "0.6542839", "0.6533325", "0.64744145", "0.6461463", "0.64576995", "0.63981915", "0.6391639", "0.6390027", "0.63806355", "0.6377198...
0.7466905
0
R""" inequality comparison between this and another Classifier, simply checks if A B > 0
def __ne__(self,other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gt__(self, other):\n return self.x ** 2 + self.y ** 2 > other.x ** 2 + other.y ** 2", "def __gt__(self, other):\n return self.weight > other.weight", "def __gt__(self, other):\n return self.eval_score < other.eval_score", "def __gt__(self, other):\n return self.weight() ...
[ "0.7323742", "0.7207339", "0.7196521", "0.717408", "0.7116371", "0.7098813", "0.70613265", "0.7005404", "0.700271", "0.69787747", "0.69742733", "0.6962742", "0.6956827", "0.6956827", "0.6939363", "0.6920388", "0.69108945", "0.69108945", "0.6898756", "0.6889111", "0.68718845",...
0.0
-1
R""" hashable representation of the Classifier, as specified by the constructor
def __str__(self): return self.s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __hash__(self):\n return hash(self.get_all_features())", "def __hash__(self):\n return hash(self.label())", "def __hash__(self):\n\t\treturn hash(repr(self))", "def __hash__(self):\n return self.to_hash()", "def __hash__(self):\n return hash((self.benchmark, self.name))", ...
[ "0.67334926", "0.663478", "0.66191804", "0.660375", "0.65917057", "0.6585809", "0.6570759", "0.6570759", "0.6570759", "0.6570759", "0.654316", "0.654316", "0.654316", "0.65003777", "0.6478812", "0.6478812", "0.6478812", "0.6458316", "0.6457815", "0.6400872", "0.6387801", "0...
0.0
-1
R""" builds Graph from adjacency matrix and computes necessary quantities for NGA
def build(self,A,k=5): # instantiate a Crayon::Graph object self.cpp = _crayon.neighborhood(A,k) # retrieve adjacency matrix self.adj = self.cpp.adj() # compute its Graphlet Degree Vector self.gdv = self.cpp.gdv() # convert node-wise to graph-wise graphlet frequen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formAdjacencyMatrix(self):\n self.adjacencyMatrix = dict()\n for i in self.node:\n self.adjacencyMatrix[i] = dict()\n for j in self.node:\n self.adjacencyMatrix[i][j] = 0\n \n for ij in self.link:\n self.adjacencyMatrix[self.link[ij].tail][self.link[ij]...
[ "0.67532814", "0.64988476", "0.64876366", "0.6424131", "0.6363142", "0.62694705", "0.62283415", "0.6193805", "0.6173798", "0.61569476", "0.6143427", "0.6110704", "0.60779506", "0.60086936", "0.5990248", "0.5969466", "0.5962597", "0.5958743", "0.59578896", "0.5952252", "0.5946...
0.6144701
10
R""" difference between this and another Graph, just the norm between graphwide Graphlet Degree Vectors
def __sub__(self,other): return np.linalg.norm(self.ngdv-other.ngdv)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm(self):", "def gradient_other(self):\n # This is just the difference in the feature values\n return self.fvs", "def __abs__(self):\n return Vector.createFromPoint(self).norm", "def fangle_degr(self):\r\n\r\n return self._versor_1.angle_degr(self._versor_2)", "def sym_difference(...
[ "0.61547583", "0.6145987", "0.592434", "0.5875257", "0.5720956", "0.56777096", "0.5639697", "0.56370777", "0.56287086", "0.55806684", "0.55758834", "0.556339", "0.55611145", "0.5552496", "0.555196", "0.5551724", "0.5530757", "0.55174506", "0.5510223", "0.55084956", "0.5496642...
0.6748099
0
R""" locate an object's signature in the Library
def find(self,item): sig = str(item) try: return self.index[sig] except: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup(obj):\n return dir(obj)", "def lookup(obj):\n return dir(obj)", "def lookup(obj):\n return dir(obj)", "def lookup(obj):\n return dir(obj)", "def lookup(obj):\n return dir(obj)", "def lookup(obj):\n return dir(obj)", "def lookup(obj):\n return dir(obj)", "def lookup(obj...
[ "0.60193497", "0.60193497", "0.60193497", "0.60193497", "0.60193497", "0.60193497", "0.60193497", "0.60193497", "0.60193497", "0.5988574", "0.5891176", "0.58475125", "0.58107734", "0.5743812", "0.5677242", "0.56071585", "0.5572421", "0.55614096", "0.5528128", "0.5528128", "0....
0.0
-1
R""" adds an object to the library and returns its index
def encounter(self,item,count=1,size=0,add=True): sig = str(item) try: idx = self.index[sig] self.counts[idx] += count self.sizes[idx] = max(self.sizes[idx],size) except: idx = len(self.items) self.sigs.append(sig) self.item...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(obj):", "def add_object(self, content, object_id = None):\n if object_id is None:\n return AlgoliaUtils_request(self.client.headers, self.write_hosts, \"POST\", \"/1/indexes/%s\" % self.url_index_name, self.client.timeout, content)\n else:\n return AlgoliaUtils_request...
[ "0.6829263", "0.6479402", "0.6470321", "0.6455719", "0.64542603", "0.6431802", "0.6206476", "0.61791706", "0.61472774", "0.61263347", "0.610543", "0.6044889", "0.6034701", "0.5991397", "0.599041", "0.59839153", "0.5946132", "0.58834016", "0.5879999", "0.58713293", "0.58620995...
0.0
-1
R""" merges other Library objects into this one
def collect(self,others,counts=True,sizes=True): if type(others) != list: others = list([others]) if type(others[0]) != type(self): raise TypeError('Library.collect expects a list of Library objects, but got %s != %s'%(str(type(others[0])),str(type(self)))) # iterate over...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mergeWith(self, others):", "def _merge(self):\n raise NotImplementedError", "def merge(self, obj):\n pass", "def merge(cls, analyses):\r\n raise NotImplementedError()", "def merge(): #Status: WIP\r\n pass", "def union(self, other: Catalog) -> Catalog:\n cat = self.copy()...
[ "0.71231306", "0.7114547", "0.70312214", "0.6568482", "0.6554816", "0.62556356", "0.6229603", "0.61884946", "0.61838907", "0.61720073", "0.6165181", "0.6121329", "0.6101816", "0.59864503", "0.5971035", "0.5970318", "0.5952884", "0.59496933", "0.5948893", "0.593101", "0.592352...
0.5418754
60
R""" builds the GraphLibrary from neighborhoods
def build(self,neighborhoods,k=5): g_idx = np.zeros(len(neighborhoods),dtype=np.int) for i, nn in enumerate(neighborhoods): G = Graph(nn,k) g_idx[i] = self.encounter(G) for i, sig in enumerate(self.sigs): if sig not in self.lookup: self.lookup[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_graph(self):\n pass", "def build_graph(self):\n pass", "def build_graph(self):\n\t\tself._create_placeholders()\n\t\tself._create_embedding()\n\t\tself._create_recurrent_layers()\n\t\tself._create_de_embedding()\n\t\tself._create_loss()\n\t\tself._create_optimizer()\n\t\tself._create_s...
[ "0.64713144", "0.6390506", "0.6251868", "0.6238143", "0.62126094", "0.6179312", "0.6168436", "0.61585855", "0.61355734", "0.6126878", "0.6122993", "0.60826135", "0.60792905", "0.5959465", "0.5944761", "0.5919414", "0.5903653", "0.58958435", "0.58561826", "0.58410925", "0.5815...
0.6859379
0
extended_euclidean_algorithm(a, b) The result is the largest common divisor for a and b.
def extended_euclidean_algorithm(a, b): if a == 0: return b, 0, 1 else: g, y, x = extended_euclidean_algorithm(b % a, a) return g, x - (b // a) * y, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_algorithm(a, b):\n if a == 0: return b\n if b == 0: return a\n r = a % b\n return euclidean_algorithm(b, r)", "def extended_euclidean_algorithm(a, b):\n s, old_s = 0, 1\n t, old_t = 1, 0\n r, old_r = b, a\n\n while r != 0:\n quotient = old_r // r\n old_r, r = r...
[ "0.83563834", "0.8242443", "0.7883765", "0.7874354", "0.78629833", "0.77744085", "0.77626127", "0.77376217", "0.7703958", "0.7693146", "0.76605105", "0.7453624", "0.7439825", "0.7404717", "0.7386229", "0.7382866", "0.73674756", "0.73155385", "0.73059714", "0.7270737", "0.7218...
0.8602561
0
modular_inverse(e, z) Calculates modular multiplicative inverse for e and t.
def modular_inverse(e, z): g, x, y = extended_euclidean_algorithm(e, z) if g != 1: raise Exception('Modular inverse does not exist') else: return x % z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modular_inverse(self):\n i = gmpy2.invert(self.c2, self.n)\n mx = pow(self.c1, self.a, self.n)\n my = pow(i, int(-self.b), self.n)\n self.m= mx * my % self.n", "def modular_inverse(a, mod):\n r_prev, u_prev, v_prev, r, u, v = a, 1, 0, mod, 0, 1\n while r != 0:\n ...
[ "0.73496014", "0.6930735", "0.6873958", "0.6728242", "0.66591424", "0.6651403", "0.66340345", "0.6575672", "0.6552733", "0.654498", "0.64918435", "0.6366117", "0.6332576", "0.6314671", "0.6263555", "0.6190621", "0.61679864", "0.61214244", "0.609041", "0.6076969", "0.6060829",...
0.84206843
0
The set of arguments for constructing a AccountAlias resource.
def __init__(__self__, *, account_alias: pulumi.Input[str]): pulumi.set(__self__, "account_alias", account_alias)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n args: AccountAliasArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...", "def create_account_alias(self, alias):\r\n params = {'AccountAlias': alias}\r\n return self.get_response('CreateAc...
[ "0.72993934", "0.6169554", "0.6145651", "0.588593", "0.5716692", "0.56227475", "0.5395486", "0.52956265", "0.5279719", "0.52618945", "0.524898", "0.5238233", "0.51872164", "0.51108646", "0.509766", "0.50521654", "0.503893", "0.50093853", "0.4945501", "0.49094927", "0.4880025"...
0.608309
3
An account alias associated with a customer's account.
def account_alias(self) -> pulumi.Input[str]: return pulumi.get(self, "account_alias")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_alias(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"account_alias\")", "def get_account_alias(self):\r\n return self.get_response('ListAccountAliases', {},\r\n list_marker='AccountAliases')", "def account_alias_resource_id(self) -> pulumi.Out...
[ "0.7883774", "0.75032926", "0.70096886", "0.6901152", "0.663217", "0.6561262", "0.6561262", "0.6388388", "0.6385573", "0.6365307", "0.6309277", "0.6309277", "0.62986344", "0.6257074", "0.6257074", "0.62428296", "0.6241097", "0.620877", "0.60629225", "0.6019607", "0.6019607", ...
0.78406376
1
An AWS Support App resource that creates, updates, reads, and deletes a customer's account alias.
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, account_alias: Optional[pulumi.Input[str]] = None, __props__=None): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_alias_resource_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"account_alias_resource_id\")", "def __init__(__self__,\n resource_name: str,\n args: AccountAliasArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...", "...
[ "0.5721044", "0.544179", "0.5398485", "0.524895", "0.5184875", "0.5086217", "0.5057101", "0.50028294", "0.4993718", "0.49638596", "0.49638563", "0.49206716", "0.49190345", "0.49002412", "0.4848771", "0.48416877", "0.48250598", "0.47928467", "0.4737615", "0.46753982", "0.46729...
0.45544288
30
An AWS Support App resource that creates, updates, reads, and deletes a customer's account alias.
def __init__(__self__, resource_name: str, args: AccountAliasArgs, opts: Optional[pulumi.ResourceOptions] = None): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_alias_resource_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"account_alias_resource_id\")", "def create_account_alias(self, alias):\r\n params = {'AccountAlias': alias}\r\n return self.get_response('CreateAccountAlias', params)", "def account_alias(self) -> pulumi...
[ "0.5721863", "0.539991", "0.52493685", "0.5185072", "0.50867456", "0.50587976", "0.50040096", "0.49955353", "0.49649015", "0.4962699", "0.4920891", "0.49197406", "0.48996067", "0.48474464", "0.48399547", "0.48251143", "0.4793121", "0.4738738", "0.4676235", "0.4674404", "0.467...
0.5441419
1
Get an existing AccountAlias resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'AccountAlias': opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = AccountAliasArgs.__new__(AccountAliasArgs) __props__.__dict__["accou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_account(self, account_id, **kwargs):\r\n\r\n if 'mask' not in kwargs:\r\n kwargs['mask'] = 'status'\r\n\r\n return self.account.getObject(id=account_id, **kwargs)", "def get_account_alias(self):\r\n return self.get_response('ListAccountAliases', {},\r\n ...
[ "0.57623905", "0.5468993", "0.5423683", "0.5413363", "0.5407908", "0.5336177", "0.52379334", "0.5185594", "0.51565856", "0.51535463", "0.5095249", "0.50847876", "0.50281215", "0.49911034", "0.49316874", "0.49263456", "0.49024594", "0.49007356", "0.48846614", "0.48834765", "0....
0.7493493
0
An account alias associated with a customer's account.
def account_alias(self) -> pulumi.Output[str]: return pulumi.get(self, "account_alias")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_alias(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"account_alias\")", "def get_account_alias(self):\r\n return self.get_response('ListAccountAliases', {},\r\n list_marker='AccountAliases')", "def account_alias_resource_id(self) -> pulumi.Outp...
[ "0.78406376", "0.75032926", "0.70096886", "0.6901152", "0.663217", "0.6561262", "0.6561262", "0.6388388", "0.6385573", "0.6365307", "0.6309277", "0.6309277", "0.62986344", "0.6257074", "0.6257074", "0.62428296", "0.6241097", "0.620877", "0.60629225", "0.6019607", "0.6019607",...
0.7883774
0
Unique identifier representing an alias tied to an account
def account_alias_resource_id(self) -> pulumi.Output[str]: return pulumi.get(self, "account_alias_resource_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_alias(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"account_alias\")", "def account_alias(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"account_alias\")", "def account_id(self) -> str:\n return self._account_id", "def account_id(self) -> str:\n ret...
[ "0.7159028", "0.7086017", "0.66211665", "0.6494042", "0.6494042", "0.6494042", "0.6494042", "0.6494042", "0.6494042", "0.6494042", "0.6494042", "0.63838947", "0.63640165", "0.63252497", "0.63003075", "0.62900585", "0.62604374", "0.6224986", "0.6224986", "0.6224986", "0.621517...
0.7182103
0
Empty entry point to the Lambda function invoked from the edge.
def lambda_handler(event, context): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lambda_handler(event, context):\n return dispatch(event)", "def test_lambda_support_no_parameters_no_body(self):\n self.assert_contains_lambda_expression_in_m(\n parse.parse(setup_java_class(\"() -> {};\")))", "def default_event_handler(event):\n pass", "def lambda_handler(event, ...
[ "0.6477498", "0.59714395", "0.5928787", "0.5917701", "0.5867142", "0.5849005", "0.5807291", "0.56738883", "0.5651294", "0.56336075", "0.5581271", "0.5554514", "0.555258", "0.55266166", "0.55265856", "0.5456136", "0.54127485", "0.54027086", "0.53797555", "0.5375195", "0.537328...
0.65870404
1
resolution Desired resolution of the project stream
def __init__(self, resolution): # Initialize the base class, so that the object can run on its own # thread. super(LocalDisplay, self).__init__() # List of valid resolutions RESOLUTION = {'1080p' : (1920, 1080), '720p' : (1280, 720), '480p' : (858, 480)} if resolution not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getResolution(self):\n return self.resolution", "def change_resolution(self):", "def resolution(self) -> int:\n return self.options.resolution", "def get_resolution(self):\n return self.__resolution", "def resolution(self):\n return self._resolution", "def resolution(self)...
[ "0.7440761", "0.7309691", "0.7291586", "0.7136645", "0.71202034", "0.6943327", "0.69418615", "0.69369626", "0.68965393", "0.683637", "0.68249285", "0.6707512", "0.66832954", "0.6653172", "0.65854955", "0.64261687", "0.6290788", "0.6283138", "0.62802684", "0.62653756", "0.6245...
0.5249472
53
Overridden method that continually dumps images to the desired FIFO file.
def run(self): # Path to the FIFO file. The lambda only has permissions to the tmp # directory. Pointing to a FIFO file in another directory # will cause the lambda to crash. result_path = '/tmp/results.mjpeg' # Create the FIFO file if it doesn't exist. if not os.path.exi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self):\n f, ds = self.opendset()\n #\n # Now add the images\n #\n start_time = time.clock() # time this\n nframes = 0 # number completed\n print_every = 1; marker = \" .\";\n print('Frames written (of %s):' % self.ntowrite, end=\"\")\n for i ...
[ "0.6086267", "0.5621595", "0.5617087", "0.5570438", "0.54464054", "0.5442008", "0.5366749", "0.536561", "0.535214", "0.53362095", "0.533295", "0.5329943", "0.5294227", "0.5289876", "0.52644956", "0.5258685", "0.5244741", "0.52429", "0.52389085", "0.522314", "0.5192509", "0....
0.5981502
2
Method updates the image data. This currently encodes the numpy array to jpg but can be modified to support other encodings. frame Numpy array containing the image data of the next frame in the project stream.
def set_frame_data(self, frame): ret, jpeg = cv2.imencode('.jpg', cv2.resize(frame, self.resolution)) if not ret: raise Exception('Failed to set frame data') self.frame = jpeg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_frame_data(self, frame):\n ret, jpeg = cv2.imencode('.jpg', cv2.resize(frame, self.resolution))\n \n if not ret:\n raise Exception('Failed to set frame data')\n self.frame = jpeg", "def _write_frame(self : \"animation\",\n frame : \"np.ndarray\"\...
[ "0.7208118", "0.66432834", "0.6403263", "0.6372892", "0.63293654", "0.631112", "0.63068485", "0.62924564", "0.61214113", "0.6091055", "0.607973", "0.60394657", "0.5955175", "0.5935915", "0.58978486", "0.58809006", "0.58774006", "0.5766277", "0.56740296", "0.566615", "0.564626...
0.7251213
1
Run the DeepLens inference loop frame by frame
def infinite_infer_run(): try: # This cat-dog model is implemented as binary classifier, since the number # of labels is small, create a dictionary that converts the machine # labels to human readable labels. model_type = 'classification' output_map = {0: 'dog', 1: 'cat'} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop_over_frames(self):\n while Rescue_PI.run_program:\n self.grab_next_frame()\n self.set_dimensions_for_frame()\n self.create_frame_blob()\n self.extract_face_detections()\n for i in range(0, self.detections.shape[2]):\n self.extrac...
[ "0.6336105", "0.63183016", "0.62164974", "0.6207791", "0.61121464", "0.6077845", "0.60773385", "0.60439396", "0.60370135", "0.5874364", "0.5873513", "0.5855923", "0.5849908", "0.5848853", "0.5842768", "0.58283395", "0.57712567", "0.57294315", "0.5708104", "0.56961703", "0.567...
0.7098092
0
Empty entry point to the Lambda function invoked from the edge.
def lambda_handler(event, context): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lambda_handler(event, context):\n return dispatch(event)", "def test_lambda_support_no_parameters_no_body(self):\n self.assert_contains_lambda_expression_in_m(\n parse.parse(setup_java_class(\"() -> {};\")))", "def default_event_handler(event):\n pass", "def lambda_handler(event, ...
[ "0.6476532", "0.597203", "0.59268284", "0.5917011", "0.5866253", "0.58485323", "0.5809084", "0.5671117", "0.565327", "0.5632782", "0.5579186", "0.555291", "0.55512804", "0.55272305", "0.55262905", "0.5456578", "0.5411757", "0.54025686", "0.5380574", "0.5376376", "0.5373923", ...
0.6586704
0
resolution Desired resolution of the project stream
def __init__(self, resolution): # Initialize the base class, so that the object can run on its own # thread. super(LocalDisplay, self).__init__() # List of valid resolutions RESOLUTION = {'1080p' : (1920, 1080), '720p' : (1280, 720), '480p' : (858, 480)} if resolution not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getResolution(self):\n return self.resolution", "def change_resolution(self):", "def resolution(self) -> int:\n return self.options.resolution", "def get_resolution(self):\n return self.__resolution", "def resolution(self):\n return self._resolution", "def resolution(self)...
[ "0.7438992", "0.7309076", "0.7289659", "0.71351075", "0.7118628", "0.69423735", "0.694106", "0.6935281", "0.68947667", "0.6836624", "0.6823465", "0.67072207", "0.66823065", "0.66520596", "0.65844727", "0.64250505", "0.6288648", "0.6281759", "0.62791735", "0.6264699", "0.62436...
0.5249326
54
Overridden method that continually dumps images to the desired FIFO file.
def run(self): # Path to the FIFO file. The lambda only has permissions to the tmp # directory. Pointing to a FIFO file in another directory # will cause the lambda to crash. result_path = '/tmp/results.mjpeg' # Create the FIFO file if it doesn't exist. if not os.path.exi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self):\n f, ds = self.opendset()\n #\n # Now add the images\n #\n start_time = time.clock() # time this\n nframes = 0 # number completed\n print_every = 1; marker = \" .\";\n print('Frames written (of %s):' % self.ntowrite, end=\"\")\n for i ...
[ "0.60862434", "0.56221074", "0.56188005", "0.5569967", "0.5447164", "0.54424405", "0.5368459", "0.53658414", "0.5350943", "0.5336924", "0.5334824", "0.53289527", "0.5295503", "0.5289459", "0.5263552", "0.5259393", "0.52459735", "0.52434576", "0.5239576", "0.52247936", "0.5192...
0.5982548
3
Method updates the image data. This currently encodes the numpy array to jpg but can be modified to support other encodings. frame Numpy array containing the image data of the next frame in the project stream.
def set_frame_data(self, frame): ret, jpeg = cv2.imencode('.jpg', cv2.resize(frame, self.resolution)) if not ret: raise Exception('Failed to set frame data') self.frame = jpeg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_frame_data(self, frame):\n ret, jpeg = cv2.imencode('.jpg', cv2.resize(frame, self.resolution))\n \n if not ret:\n raise Exception('Failed to set frame data')\n self.frame = jpeg", "def _write_frame(self : \"animation\",\n frame : \"np.ndarray\"\...
[ "0.72074133", "0.66426784", "0.6403696", "0.6373772", "0.6328509", "0.6311963", "0.63089526", "0.62927353", "0.6120985", "0.60910094", "0.60802954", "0.6040295", "0.59539485", "0.5935913", "0.5899413", "0.5882713", "0.58772403", "0.5768093", "0.5674097", "0.5664655", "0.56475...
0.72505695
0
Run the DeepLens inference loop frame by frame
def infinite_infer_run(): try: # This cat-dog model is implemented as binary classifier, since the number # of labels is small, create a dictionary that converts the machine # labels to human readable labels. model_type = 'classification' output_map = {0: 'dog', 1: 'cat'} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infinite_infer_run():\n try:\n # This cat-dog model is implemented as binary classifier, since the number\n # of labels is small, create a dictionary that converts the machine\n # labels to human readable labels.\n model_type = 'classification'\n output_map = {0: 'dog', 1:...
[ "0.7097146", "0.6336648", "0.62160623", "0.62068063", "0.6112241", "0.607721", "0.60762167", "0.6043751", "0.603685", "0.5873643", "0.58728683", "0.58558875", "0.5849006", "0.58485246", "0.5842208", "0.5827897", "0.5769749", "0.5729246", "0.57062304", "0.56958604", "0.5674159...
0.63172555
2
Used to reload data for tests
def reload(self, favorite_drinks): self.favorite_drinks = favorite_drinks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload(self):", "def reload(self):", "def reload_cache(self):\n self.data = self.read_data_cache()", "def reloadData(self):\n self.dto.readFromData()\n print(\"Record reloaded.\")", "def test_reload_method(self):\n prev_dict = storage.all()\n\n storage.reload()\n\n ...
[ "0.75429684", "0.75429684", "0.7531943", "0.74796635", "0.7398157", "0.7389913", "0.7331104", "0.69099814", "0.68960696", "0.68960696", "0.68960696", "0.68661875", "0.6840311", "0.6810718", "0.68071824", "0.6772844", "0.6753891", "0.6747354", "0.6736269", "0.67287046", "0.667...
0.0
-1
Gets the fav drinks for a given user id.
def get_fav_drinks(self, user_id): assert type(user_id) == str return next((fd.get('drink_id') for fd in self.favorite_drinks if fd.get('user_id')==user_id), None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_favorites(self, user_id=None):\n if not user_id:\n user_id = self.user_id\n\n favorite_decks = self.data_source.get_favorites(user_id)\n\n return favorite_decks", "def add_fav_drinks(self, user_id, drinks): \n assert type(user_id) == str\n assert type(drinks)...
[ "0.7683676", "0.7625044", "0.7077731", "0.6953718", "0.6094342", "0.59908515", "0.59745145", "0.59438324", "0.5888048", "0.5862097", "0.57868314", "0.5751655", "0.56791073", "0.56489706", "0.56454253", "0.56270546", "0.561332", "0.5574944", "0.5572457", "0.5544575", "0.550032...
0.88145494
0
Incrementally generates fav drink ids.
def __generate_id(self): ids = [int(fd.get('id')) for fd in self.favorite_drinks] return str(max(ids)+1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_next_id(cls):\n cls.next_id += 1", "def incr_circuit_fav_count(self, circuit_id):\n key = ':'.join(\n [CIRCUIT_NMBR_FAVS_1, \n str(circuit_id), \n CIRCUIT_NMBR_FAVS_2]\n ) \n self.RS.incr(key)", "def new_id(self):\n self.next += ...
[ "0.6040626", "0.5970284", "0.5897605", "0.5723138", "0.5417529", "0.5353754", "0.5269767", "0.5263355", "0.52627593", "0.5222546", "0.52203166", "0.5219099", "0.51929504", "0.5167325", "0.51630044", "0.5160587", "0.51526725", "0.515147", "0.51489604", "0.514435", "0.5135074",...
0.6941434
0
Adds a list of drinks to the user's favorite_tr_drinks. At least one drink needs to exist in the drinks object.
def add_fav_drinks(self, user_id, drinks): assert type(user_id) == str assert type(drinks) == list fav_drinks = self.get_fav_drinks(user_id) user_check = self.users.get_user_name(user_id) drinks_check = [self.drinks.get_drinks_by_flavor_and_type(d.get('flavor'), d.get('type')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_fav_drink(self, user_id, drink_id):\n assert type(user_id) == str\n assert type(drink_id) == str \n\n existing_drink = False if self.drinks.get_drink_by_id(drink_id) is None else True\n existing_user = False if self.users.get_user_name(user_id) is None else True\n if n...
[ "0.7802421", "0.6467667", "0.6065164", "0.5909702", "0.58994406", "0.5785789", "0.57702625", "0.56755793", "0.56145716", "0.5599154", "0.55618584", "0.55594814", "0.5455796", "0.5450204", "0.5390807", "0.5324672", "0.53246087", "0.5250622", "0.5193845", "0.5191468", "0.517942...
0.80658937
0
Adds a single existing drink id to a user's fav_drinks.
def add_fav_drink(self, user_id, drink_id): assert type(user_id) == str assert type(drink_id) == str existing_drink = False if self.drinks.get_drink_by_id(drink_id) is None else True existing_user = False if self.users.get_user_name(user_id) is None else True if not existing...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_fav_drinks(self, user_id, drinks): \n assert type(user_id) == str\n assert type(drinks) == list\n\n fav_drinks = self.get_fav_drinks(user_id)\n user_check = self.users.get_user_name(user_id)\n drinks_check = [self.drinks.get_drinks_by_flavor_and_type(d.get('flavor'), d.ge...
[ "0.8466836", "0.7160987", "0.69984883", "0.6947171", "0.6840639", "0.6773383", "0.66296184", "0.65369165", "0.64328474", "0.6358613", "0.614724", "0.6010638", "0.59958446", "0.5963398", "0.59074044", "0.58854777", "0.5838287", "0.58275396", "0.580626", "0.5790011", "0.5785827...
0.90073866
0
Removes a single drink id from a given user's favorite_tr_drinks
def delete_fav_drink(self, user_id, drink_id): assert type(user_id) == str assert type(drink_id) == str drinks = self.get_fav_drinks(user_id) user_check = self.users.get_user_name(user_id) if drinks is not None and drink_id in drinks: drinks.remove(drink_id) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_from_fav(request, favorite_id):\n # Gets a favorite designated by favorite_id or returns 404\n favorite = get_object_or_404(Favorite, pk=favorite_id)\n favorite.delete()\n\n print(\"{}, {} a été supprimé des favoris\".format(\n favorite.products.name, favorite.products.bra...
[ "0.7396384", "0.7170701", "0.71676636", "0.7118096", "0.69414896", "0.69243777", "0.68612635", "0.68539405", "0.68146366", "0.6617351", "0.6581387", "0.64681506", "0.6427771", "0.6424399", "0.64004254", "0.63968754", "0.63752973", "0.6372094", "0.63381314", "0.6281305", "0.62...
0.85434836
0
Creates and displays a simple frame containing the RichTextPanel.
def showEditorWindow(parent, title, allowEditting = True): frame = wx.Frame(parent, -1, title, size=(630, 320), style = wx.DEFAULT_FRAME_STYLE) panel = RichTextPanel(allowEditting, frame, -1) #frame.Fit() #frame.SetMinSize(frame.GetSize()) frame.Show() return panel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MakeFrame(self, name, parent=None, pos=None, size=(900,700), style=wx.DEFAULT_FRAME_STYLE, visible = True):\n if pos is None:\n pos = self._CheckBoundaries(size)\n\n\n frame = self.mf.MainFrame(self, name, parent, pos, size, style, self.text_editor)\n self.frame_position = (pos[...
[ "0.60286325", "0.5938992", "0.59213364", "0.58199555", "0.5770706", "0.5710505", "0.5705657", "0.57053775", "0.5688911", "0.567008", "0.563585", "0.5622285", "0.5615228", "0.56087345", "0.5592374", "0.55808675", "0.55758315", "0.5544468", "0.55370015", "0.5525293", "0.5516264...
0.7123116
0
Checks that all values are the right type. Any field that is not of the right type will be turned pink. Returns failed, data, kMin, kMax failed is True if validation fails and false otherwise.
def Validate(self): hklmin = self.hklmin_txtCtrl.GetValue() hklmax = self.hklmax_txtCtrl.GetValue() hklsteps = self.hkl_steps_ctrl.GetValue() wmin = self.wmin_txtCtrl.GetValue() wmax = self.wmax_txtCtrl.GetValue() wsteps = self.w_steps_ctrl.GetValue() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, test_data):\n if not isinstance(test_data, np.number):\n raise ValidationError('Invalid type/value.', 'numpy.number',\n type(test_data))\n if self.max_value is not None and test_data > self.max_value:\n raise ValidationError('M...
[ "0.682052", "0.6482925", "0.64325356", "0.63312966", "0.62685317", "0.62335557", "0.61600655", "0.61239487", "0.6113155", "0.6071614", "0.5993872", "0.59750754", "0.59742504", "0.5972048", "0.5933964", "0.59315145", "0.59265804", "0.5908004", "0.59059256", "0.5900711", "0.588...
0.5665979
56
Indicates that we are beginning a new frame for the GIF. A new Figure object is created, using specifications provided to the Gif's constructor. Note that you are constrained to make one frame at a timefor every start_frame, there must be a end_frame without another start_frame in between.
def start_frame(self): # Check whether we're supposed to make a frame on this iteration: if self.frame_count % self.stride != 0: return # Check whether we're already making a frame. if self.in_scope: print("The Gif object for {} has encountered 'start_frame' tw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_frame(\n self : \"animation\",\n frame : \"matplotlib.figure.Figure\",\n facecolor : \"str\" = 'white'\n ):\n self._make_animation_from_raw_list([frame], facecolor=facecolor)", "def __init__(self, gif_fps=None, color_depth=None, gif_loop=None, height=Non...
[ "0.6030946", "0.5884757", "0.58019", "0.57871383", "0.5710823", "0.56462824", "0.5613234", "0.5611469", "0.5561925", "0.5536683", "0.54781246", "0.54582393", "0.54582393", "0.54582393", "0.54582393", "0.5429345", "0.54275835", "0.5406712", "0.5402544", "0.5368462", "0.5358913...
0.806977
0
Render, save, and close this frame.
def end_frame(self, **kwargs): # Check whether we're supposed to make a frame on this iteration: if self.frame_count % self.stride != 0: self.frame_count += 1 return # Check whether we're still making another frame if not self.in_scope: prin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self, mode='human', close=False):\n pass", "def render(self, mode='human', close=False):\n return None", "def render(self, mode='human', close=False):\n pass", "def render(self, mode='human', close=False):\n raise NotImplementedError()", "def render(self, mode='human', cl...
[ "0.66230905", "0.6464972", "0.64479846", "0.64456826", "0.6407934", "0.6390916", "0.6093952", "0.60881656", "0.6055577", "0.60275567", "0.60221434", "0.59916115", "0.5883493", "0.58563817", "0.5838641", "0.57937443", "0.57549465", "0.5720512", "0.57189316", "0.5712864", "0.56...
0.55559295
31
Call this when all the desired frames have been created. It creates the GIF and cleans up all temporary files
def close(self): sp.call(["convert", "{}_*".format(self.tmp_prefix), self.filename]) sp.call("rm {}_*".format(self.tmp_prefix), shell=True) sp.call(["rmdir", self.tmp_dir])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n generated_gif = self.generate()\n with open(self.out_filename, 'wb') as out_fd:\n out_fd.write(generated_gif)", "def gif(self, num_games, slow_mult=2, delete_pics=True,\n kill_limit_per_game=1000):\n slow_mult = int(slow_mult)\n gif_name = \"gifs...
[ "0.65921307", "0.6496693", "0.64092875", "0.63711464", "0.6329664", "0.631813", "0.62686867", "0.62586194", "0.62410015", "0.6000662", "0.59209293", "0.58944106", "0.58942246", "0.58450377", "0.582313", "0.5817807", "0.5783316", "0.5769878", "0.5761749", "0.5734152", "0.57281...
0.0
-1
Insert adds into view
def loadAdds(self, adds): self._view.insertJobs(adds)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self):\n pass", "def add_view(self, request):\r\n instance_form = self.get_minimal_add_form()\r\n form = instance_form(request.POST, request.FILES, prefix=self.base_url())\r\n\r\n new_instance = None\r\n if form.is_valid():\r\n new_instance = form.save()\r...
[ "0.66635454", "0.6642952", "0.6474754", "0.6460738", "0.6424587", "0.6319112", "0.6304205", "0.6254193", "0.62180334", "0.61617136", "0.61133635", "0.60724163", "0.6065484", "0.6065484", "0.6065484", "0.6052044", "0.6051227", "0.59908056", "0.5980053", "0.59290934", "0.592654...
0.0
-1
Getting new users position in menu
def get_next_status(self, peer, button_name): data_base = DataSource(r'src/controllers') self[peer][0] = data_base.sql_select( 'Buttons', ['next_stat'], {'current_stat': self[peer][0], 'button_name': button_name} )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def menu():\n user_id = session[\"user_id\"]\n if not user_id:\n session.clear()\n redirect(\"/\")\n database = db.db_connect()\n user = g.user\n return render_template(\"menu.html\", username=user[\"username\"])", "def create_menu():", "def menu_players(self):\n title = \"B...
[ "0.6050909", "0.58708", "0.5854476", "0.5778326", "0.57558185", "0.57505405", "0.57342744", "0.5681419", "0.562184", "0.56002814", "0.55990875", "0.5566924", "0.5560256", "0.54969656", "0.5483196", "0.5474878", "0.54618496", "0.5409296", "0.54044414", "0.5400652", "0.53986657...
0.0
-1
Gets the current turn.
def turn(self): return repr(self._turn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_turn(self):\n return self._turn", "def get_current_turn(self):\n return self.turns.latest('number')", "def get_turn(self):\n return self._turn", "def get_turn(self):\n return self.__turn_info['turn']", "def turn(self):\n return self._turn", "def _get_tur...
[ "0.9102479", "0.89146316", "0.8668383", "0.86156356", "0.82422864", "0.7869278", "0.7869158", "0.76774615", "0.76720285", "0.76034266", "0.7541837", "0.72796386", "0.6801409", "0.66345716", "0.6573095", "0.651851", "0.6497247", "0.64773226", "0.63095003", "0.6290294", "0.6270...
0.7111209
12
Gets the current score.
def score(self): return { 'black': self._score[self.BLACK], 'white': self._score[self.WHITE], }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getScore(self):\r\n return self._score", "def get_score(self):\n return self.score", "def get_score(self):\n return self.score", "def get_score(self):\n return self.score", "def get_score(self):\n return self._score", "def get_score(self):\n return self._scor...
[ "0.88067", "0.87906307", "0.87906307", "0.87906307", "0.87651336", "0.87651336", "0.87651336", "0.87487924", "0.8696853", "0.8663151", "0.85436064", "0.85083526", "0.8468651", "0.8233672", "0.8226216", "0.8146496", "0.813406", "0.81187105", "0.7922282", "0.7850026", "0.779664...
0.0
-1
Gets color of next turn.
def _next_turn(self): return self.TURNS[self._turn is self.BLACK]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_color(self):\n if self._color_cycle is None:\n return self._theme.color\n return next(self._color_cycle)['color']", "def getnextcolor(self):\n self.usedcc = [line.get_c() for line in self.axes.lines]\n for c in self.cc:\n if c not in self.usedcc:\n ...
[ "0.79528934", "0.75258994", "0.74831784", "0.7417561", "0.7411886", "0.70126635", "0.69257647", "0.6913246", "0.68589276", "0.6847375", "0.6847375", "0.6847375", "0.6847375", "0.68344563", "0.6832075", "0.6830577", "0.67883253", "0.67688566", "0.6761714", "0.6761714", "0.6721...
0.71218157
5
Makes a move at the given location for the current turn's color.
def move(self, x, y): # Check if coordinates are occupied if self[x, y] is not self.EMPTY: raise BoardError('Cannot move on top of another piece!') # Store history and make move self._push_history() self[x, y] = self._turn # Check if any pieces have been tak...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_move(self, move, color):\n\n (x, y) = move\n\n # Add the piece to the empty square.\n assert self[x][y] == 0\n self[x][y] = color", "def execute_move(self, move, color):\n\n #Much like move generation, start at the new piece's square and\n #follow it on all 8...
[ "0.71479887", "0.68326885", "0.67734224", "0.65604776", "0.647113", "0.64681226", "0.6463581", "0.6450284", "0.64005244", "0.63930154", "0.6391586", "0.6350185", "0.6347738", "0.6341436", "0.6331971", "0.62790394", "0.6263025", "0.62131864", "0.6184838", "0.6168041", "0.61507...
0.0
-1
Checks if move is suicidal.
def _check_for_suicide(self, x, y): if self.count_liberties(x, y) == 0: self._pop_history() raise BoardError('Cannot play on location with no liberties!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_suicide(self, delta: Delta) -> bool:\r\n # Get our adjacent squares\r\n adj_squares: List[Square] = \\\r\n self._get_adjacent_squares(delta.move_target.pos)\r\n for adj_square in adj_squares:\r\n # Don't place next to corners.\r\n if (adj_square.state ==...
[ "0.68408823", "0.68345565", "0.6789393", "0.67085266", "0.6641279", "0.65877664", "0.6558807", "0.648562", "0.64681184", "0.6466117", "0.64368737", "0.6385535", "0.63544244", "0.626648", "0.62624514", "0.62543315", "0.61974555", "0.61947954", "0.61647415", "0.6151188", "0.614...
0.0
-1
Checks if board state is redundant.
def _check_for_ko(self): try: if self._array == self._history[-2][0]: self._pop_history() raise BoardError('Cannot make a move that is redundant!') except IndexError: # Insufficient history...let this one slide pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_board_lost(self):\n\n return bool(self.all_ship_locations) and bool(\n not self.all_ship_locations.difference(self.shot_locations)\n )", "def board_is_empty():\n if STATE[-1].strip() == '-' * 7:\n return True\n else:\n return False", "def board_tiles_availabi...
[ "0.6836097", "0.6822597", "0.65648544", "0.64576447", "0.643155", "0.6421589", "0.6411428", "0.6360843", "0.6298382", "0.62719166", "0.62538", "0.6252111", "0.62425023", "0.6237739", "0.622352", "0.621938", "0.6211046", "0.6204052", "0.61950725", "0.61891603", "0.6170325", ...
0.5775984
93
Checks if any pieces were taken by the last move at the specified coordinates. If so, removes them from play and tallies resulting points.
def _take_pieces(self, x, y): scores = [] for p, (x1, y1) in self._get_surrounding(x, y): # If location is opponent's color and has no liberties, tally it up if p is self._next_turn and self.count_liberties(x1, y1) == 0: score = self._kill_group(x1, y1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_piece(self, selected_piece_coords, destination_coords):\n \n if selected_piece_coords[0] < 0 or destination_coords[0] < 0:\n return False\n if selected_piece_coords[1] >= 9 or destination_coords[1] >= 9:\n return False\n \n if self.is_piece(dest...
[ "0.6773014", "0.6335512", "0.6143053", "0.6076701", "0.59248286", "0.59242046", "0.5872021", "0.5846961", "0.58341914", "0.57833284", "0.5782987", "0.5755233", "0.5743178", "0.5738274", "0.5737019", "0.5727717", "0.5703718", "0.57021785", "0.570015", "0.5699829", "0.5686726",...
0.59573925
4
Iterates the turn counter.
def _flip_turn(self): self._turn = self._next_turn return self._turn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _increment_turn(self):\r\n\r\n self.turn_number += 1", "def incTurn(self):\n self.turnOn = (self.turnOn+1)%self.turns", "def iterate(self):", "def _turn_cycle(self):\r\n\r\n #Get current player\r\n cur_player = self.get_current_player()\r\n\r\n #Get board states for current player\r\n ...
[ "0.6649224", "0.64053893", "0.61842614", "0.6079973", "0.59045935", "0.58469933", "0.579149", "0.5747146", "0.5741801", "0.5721963", "0.57125974", "0.5704911", "0.56864333", "0.5648936", "0.5644986", "0.5641016", "0.5635795", "0.5632369", "0.56173664", "0.5617186", "0.5609047...
0.0
-1
Returns the game state as a named tuple.
def _state(self): return self.State(self.copy._array, self._turn, copy(self._score))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def represent_state(state):\n return tuple(state[0]), tuple(state[1]), tuple(state[2])", "def get_values(state):\n keys = ['player_ammo', 'player_block', 'player_prev',\n 'comp_ammo', 'comp_block', 'comp_prev']\n return tuple([state[key] for key in keys])", "def get_state(cls):\n ...
[ "0.6909933", "0.68733317", "0.6768659", "0.6647277", "0.6600728", "0.65770715", "0.65657896", "0.65657896", "0.6532193", "0.6439445", "0.6439445", "0.6439445", "0.6417478", "0.64101326", "0.6405179", "0.6387363", "0.6379392", "0.6330388", "0.6323701", "0.63162386", "0.6297785...
0.0
-1
Loads the specified game state.
def _load_state(self, state): self._array, self._turn, self._score = state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_state(self, state):\n raise NotImplemented", "def load_game(self, path):\n temp_stack = self.state_stack\n try:\n file = open(path, 'rb')\n self.state_stack = pic.load(file)\n for i in self.state_stack.states:\n i.on_load()\n ...
[ "0.7649141", "0.7451061", "0.7330499", "0.7289742", "0.7068645", "0.7026647", "0.7026647", "0.69424325", "0.6931369", "0.6918463", "0.6913766", "0.6794537", "0.6794537", "0.6776786", "0.67008126", "0.6692883", "0.66900843", "0.6631727", "0.66024214", "0.65920967", "0.6591523"...
0.7310206
3
Pushes game state onto history.
def _push_history(self): self._history.append(self._state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def storeState(self):\n\n self.action_history[self.trial] = self.action\n self.ball_history[self.trial] = self.ballcolor", "def update_history(self, move):\r\n player_number = self.player_numbers[self.current_player]\r\n heaps = tuple(self.heaps)\r\n self.history.append([player...
[ "0.6968883", "0.6701469", "0.6685477", "0.66748035", "0.6566776", "0.6524166", "0.65231085", "0.6444915", "0.63551337", "0.6299285", "0.6295774", "0.62556654", "0.6236586", "0.62092465", "0.6204507", "0.61990005", "0.6162195", "0.6140269", "0.6104237", "0.60969216", "0.608120...
0.831839
0
Pops and loads game state from history.
def _pop_history(self): current_state = self._state try: self._load_state(self._history.pop()) return current_state except IndexError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_new_gamestate(self):", "def new_game(self):\n old_state = self.rstate\n del old_state\n self.rstate = self.rsimulator.new_game()", "def reset_state_history(self):\n self.state_history = []", "def undo(self):\n if (0 == len(self._undoStack)):\n raise Value...
[ "0.6477058", "0.63318163", "0.62972474", "0.62654704", "0.6068052", "0.60675156", "0.60423017", "0.5992579", "0.5983971", "0.5978606", "0.59785825", "0.59690744", "0.5935602", "0.5877124", "0.5856809", "0.5821736", "0.5818696", "0.58089757", "0.5758095", "0.57310545", "0.5720...
0.69553375
0
Reapplies one move that was undone.
def redo(self): try: self._push_history() self._load_state(self._redo.pop()) except IndexError: self._pop_history() raise BoardError('No undone moves to redo!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unmakeMove(self, move):", "def _unmove(self):\n (start, end) = self.history.pop()\n self._board[start] = self._board[end]\n self._board[end] = 0\n self.winner = None\n self.player_turn = CheckersGame.opposite[self.player_turn]", "def undo_move(self):\n # general id...
[ "0.68075985", "0.66581744", "0.6648951", "0.63692915", "0.62567514", "0.6161926", "0.6056539", "0.6045198", "0.5970923", "0.5951305", "0.59279054", "0.58641297", "0.585729", "0.58350563", "0.57913196", "0.57823396", "0.5765564", "0.57227105", "0.5717053", "0.5694018", "0.5682...
0.6263852
4
Adds points to the current turn's score.
def _tally(self, score): self._score[self._turn] += score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_score(self, points):\n self.score += points", "def increase(self, points):\n self.score += points", "def add_score(self, points: int) -> None:\n self.__score += points\n\n for rank in self.__ranks.keys():\n if self.__score >= rank:\n self.__level = ...
[ "0.82465965", "0.8213478", "0.8010674", "0.76527965", "0.7553832", "0.7547882", "0.7457966", "0.7424316", "0.738649", "0.7102877", "0.7016956", "0.70149374", "0.69400513", "0.6886917", "0.6861296", "0.6857188", "0.6841483", "0.67725563", "0.67561966", "0.6701551", "0.6639484"...
0.6411936
34
Same thing as Array.__getitem__, but returns None if coordinates are not within array dimensions.
def _get_none(self, x, y): try: return self[x, y] except ArrayError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, index):\n x, y = index\n if 0 <= x < self.width and 0 <= y < self.height:\n return self.cells[x + y * self.width]\n else:\n return None", "def __getitem__(self, pos):\n if (self.master.__class__.__name__ == 'OneDimGrid') or (issubclass(self....
[ "0.6713357", "0.6549222", "0.6549222", "0.65480006", "0.6530882", "0.6258413", "0.6224236", "0.6155776", "0.5970968", "0.59563416", "0.592938", "0.59288377", "0.59217894", "0.5912077", "0.5912077", "0.5891601", "0.58608264", "0.5762777", "0.5749256", "0.57162493", "0.5684842"...
0.69117695
0
Gets information about the surrounding locations for a specified coordinate. Returns a tuple of the locations clockwise starting from the top.
def _get_surrounding(self, x, y): coords = ( (x, y - 1), (x + 1, y), (x, y + 1), (x - 1, y), ) return filter(lambda i: bool(i[0]), [ (self._get_none(a, b), (a, b)) for a, b in coords ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_allowed_positions(coordXY, grid):\n\n\tsurrounding_coord = []\n\ttesting_coord = []\n\n\t# Get the coordinates of the external square\n\tfor i in range(coordXY[0] - 1, coordXY[0] + 2, 2):\n\t\tfor j in range(coordXY[1] - 1, coordXY[1] +2, 1):\n\t\t\tif (i,j) == coordXY:\n\t\t\t\tpass\n\t\t\telif i < 0 or j...
[ "0.59596604", "0.58594525", "0.582257", "0.5809534", "0.57916594", "0.577245", "0.56088185", "0.55754143", "0.5539363", "0.55352014", "0.5510887", "0.5510782", "0.54977924", "0.548646", "0.5474126", "0.54684633", "0.5423838", "0.5408791", "0.53864664", "0.53790015", "0.537021...
0.6087281
0
Recursively traverses adjacent locations of the same color to find all locations which are members of the same group.
def _get_group(self, x, y, traversed): loc = self[x, y] # Get surrounding locations which have the same color and whose # coordinates have not already been traversed locations = [ (p, (a, b)) for p, (a, b) in self._get_surrounding(x, y) if p is loc an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grasps_within_pile(color_mask):\n hue_counts, hue_pixels = get_hsv_hist(color_mask)\n\n individual_masks = []\n\n #color to binary\n focus_mask = color_to_binary(color_mask)\n\n #segment by hsv\n for block_color in hue_counts.keys():\n #same threshold values for number of objects\n ...
[ "0.62518436", "0.6219405", "0.5994733", "0.5941772", "0.57764816", "0.57504255", "0.57399064", "0.56628907", "0.56418866", "0.5627706", "0.56172466", "0.5478914", "0.5477339", "0.54491454", "0.5443947", "0.5414975", "0.536038", "0.5335464", "0.5306588", "0.53047246", "0.52826...
0.7293468
0
Gets the coordinates for all locations which are members of the same group as the location at the given coordinates.
def get_group(self, x, y): if self[x, y] not in self.TURNS: raise BoardError('Can only get group for black or white location') return self._get_group(x, y, set())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_group(self, x, y, traversed):\n loc = self[x, y]\n\n # Get surrounding locations which have the same color and whose\n # coordinates have not already been traversed\n locations = [\n (p, (a, b))\n for p, (a, b) in self._get_surrounding(x, y)\n i...
[ "0.6462822", "0.63127977", "0.61076945", "0.61076945", "0.6055107", "0.6042654", "0.58765554", "0.58044577", "0.57817185", "0.5771915", "0.5763249", "0.57624805", "0.57501143", "0.5735072", "0.5734714", "0.5725384", "0.57155395", "0.5710691", "0.566784", "0.5665563", "0.56566...
0.0
-1
Kills a group of black or white pieces and returns its size for scoring.
def _kill_group(self, x, y): if self[x, y] not in self.TURNS: raise BoardError('Can only kill black or white group') group = self.get_group(x, y) score = len(group) for x1, y1 in group: self[x1, y1] = self.EMPTY return score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, pieces):\n for piece in pieces:\n self.board[piece.row][piece.col] = None\n if piece.get_player() is Player.white:\n self.num_white_pieces -= 1\n if piece.is_king():\n self.num_white_kings -= 1\n\n elif piece....
[ "0.60348535", "0.57435024", "0.54608136", "0.5445019", "0.542634", "0.54196596", "0.5302651", "0.5200759", "0.5154724", "0.5072169", "0.50539815", "0.5046292", "0.49920136", "0.49912956", "0.49609512", "0.4869226", "0.4835175", "0.48231968", "0.479942", "0.47956777", "0.47943...
0.6882954
0
Recursively traverses adjacent locations of the same color to find all surrounding liberties for the group at the given coordinates.
def _get_liberties(self, x, y, traversed): loc = self[x, y] if loc is self.EMPTY: # Return coords of empty location (this counts as a liberty) return set([(x, y)]) else: # Get surrounding locations which are empty or have the same color # and whos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_group(self, x, y, traversed):\n loc = self[x, y]\n\n # Get surrounding locations which have the same color and whose\n # coordinates have not already been traversed\n locations = [\n (p, (a, b))\n for p, (a, b) in self._get_surrounding(x, y)\n i...
[ "0.70040894", "0.5795467", "0.5597785", "0.5448913", "0.54436564", "0.54422367", "0.54193276", "0.5357743", "0.53455037", "0.5341227", "0.53019035", "0.5227822", "0.52242845", "0.5224116", "0.519014", "0.5165992", "0.51538765", "0.51497793", "0.51192147", "0.51059824", "0.510...
0.63835096
1
Gets the coordinates for liberties surrounding the group at the given coordinates.
def get_liberties(self, x, y): return self._get_liberties(x, y, set())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_coordinates(self):\n\n raise NotImplementedError", "def find_coordinates(self):\n\n raise NotImplementedError", "def _get_liberties(self, x, y, traversed):\n loc = self[x, y]\n\n if loc is self.EMPTY:\n # Return coords of empty location (this counts as a liberty)...
[ "0.6346268", "0.6346268", "0.6195149", "0.61933935", "0.5853526", "0.58173347", "0.5792962", "0.577737", "0.57709426", "0.5755077", "0.57405645", "0.57377154", "0.57211405", "0.5712904", "0.570466", "0.56980073", "0.5694925", "0.5686481", "0.56641304", "0.56468636", "0.563257...
0.0
-1
Gets the number of liberties surrounding the group at the given coordinates.
def count_liberties(self, x, y): return len(self.get_liberties(x, y))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getArea(rob):\r\n def dfs(visit, i, j):\r\n visit.add((i, j))\r\n for k in range(4):\r\n newi, newj = i + x[k], j + y[k]\r\n if (newi, newj) in visit or not rob.move(k):\r\n continue\r\n dfs(visit, newi, newj)\r\n rob.move((k + 2) % 4)\r\n visit = set()\r\n dfs(visit, 0, 0)\...
[ "0.5703384", "0.56963116", "0.5542732", "0.55277985", "0.5469277", "0.5424882", "0.53873706", "0.53670955", "0.536483", "0.5318496", "0.5308205", "0.5293582", "0.5269632", "0.5248836", "0.5221797", "0.52110815", "0.51962906", "0.5194603", "0.516675", "0.51180094", "0.511654",...
0.62602663
0
Paginates through all the data relevant to `resource`, yielding each set as it comes back.
def gen_resources(resource: Callable, **list_params) -> Generator[List, None, None]: print("Generating resources.") if "maxResults" not in list_params.keys(): list_params["maxResults"] = DEFAULT_MAX_RESULTS next_page_token = None while True: if next_page_token: list_params["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_all_data(self, resource):\n response = self._get_raising('{}{}?per_page=100&page=1'.format(\n self.GH_API_ENDPOINT, resource\n ))\n yield from response.json()\n while 'next' in response.links:\n response = self._get_raising(response.links['next']['url'])\n...
[ "0.7537248", "0.7424232", "0.6589033", "0.65499216", "0.6500705", "0.64761", "0.6470934", "0.64616317", "0.63749623", "0.63749623", "0.6349994", "0.631617", "0.62604225", "0.62479585", "0.62373406", "0.61875826", "0.6186147", "0.61649334", "0.6153979", "0.61291134", "0.612031...
0.68887866
2
Makes requests to retrieve all resources for `res_ids`, yielding each batch.
def gen_resources_for_ids( resource: Callable, res_ids: List[str], **list_params ) -> Generator[List, None, None]: print("Generating resources for ids.") total = len(res_ids) res_counter = 0 if "maxResults" not in list_params.keys(): list_params["maxResults"] = DEFAULT_MAX_RESULTS m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch(self, reqs):\n return self.connection.batch_(reqs)", "async def run_requests(self):\n loop = asyncio.get_event_loop()\n tasks = []\n async with aiohttp.ClientSession(connector=self.connector) as session:\n\n for index, id in enumerate(self.ids):\n i...
[ "0.6522907", "0.64874965", "0.6366794", "0.6343513", "0.6326583", "0.62781847", "0.6265821", "0.61405367", "0.61308616", "0.6080425", "0.6056786", "0.59915185", "0.5963366", "0.5945424", "0.5931578", "0.5926348", "0.5803143", "0.5787222", "0.5737144", "0.57251173", "0.5688712...
0.75606394
0
Generates `commentThreads` for the `videos`, yielding on every video.
def gen_comment_threads_for_videos( self, videos: List ) -> Generator[List, None, None]: print("Requesting comment threads for videos.") for video in videos: threads = self.get_comment_threads_for_video(video["id"]) yield threads return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_comments(comments):\n API_KEY = secrets.YT_KEY\n youtube = build('youtube', 'v3', developerKey=API_KEY)\n request = youtube.commentThreads().list(\n part='replies',\n videoId=comments,\n textFormat=\"plainText\"\n )\n\n response = request.execute()\n\n video = respons...
[ "0.6485952", "0.63381004", "0.61707836", "0.6121679", "0.59488356", "0.59478843", "0.5864268", "0.57775325", "0.57679206", "0.57674754", "0.57524395", "0.57088053", "0.56520087", "0.55044687", "0.5464832", "0.54541576", "0.53520346", "0.52295196", "0.521179", "0.51633495", "0...
0.8944976
0
Compute VAE loss as combinatoin of reconstruction loss and KL divergence
def compute_loss(self, logits, targets, mu, sigma): logits_flat = tf.reshape(logits, [self.batch_size, self.height*self.width*self.cdim]) targets_flat = tf.reshape(targets, [self.batch_size, self.height*self.width*self.cdim]) #encode_decode_loss = targets_flat * tf.log(1e-10 + logits_flat) + (1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vae_loss(x, t_decoded):\r\n return K.mean(reconstruction_loss(x, t_decoded))", "def _vae_loss(self, x, x_generated):\n x = K.flatten(x)\n x_generated = K.flatten(x_generated)\n reconstruction_loss = self.input_shape[0] * self.input_shape[1] * \\\n bina...
[ "0.7339578", "0.71916056", "0.71916056", "0.71916056", "0.71916056", "0.7074793", "0.70546997", "0.69675297", "0.69305056", "0.69149876", "0.6874881", "0.68348026", "0.6730781", "0.6481481", "0.6437163", "0.6425949", "0.641782", "0.6408178", "0.6326205", "0.6325659", "0.63184...
0.0
-1
Build the model graph
def model_fn(self, data, reuse=False): # Define placeholders for input and z self.z = tf.placeholder(tf.float32, [self.batch_size, self.n_z]) # Gloabl step self.global_step = tf.Variable(0, name='global_step', trainable=False) # Create data ops self.data = data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_graph(self):\n self._build_model()\n if self.mode == 'train':\n self._build_train_op()", "def _build_graph(self):\n pass", "def build_graph(self):\n pass", "def build_graph(self):\n\t\tself._create_placeholders()\n\t\tself._create_embedding()\n\t\tself._create...
[ "0.83601487", "0.8333967", "0.8304374", "0.8128838", "0.80725634", "0.8037274", "0.80014527", "0.7735923", "0.7655694", "0.7436586", "0.7408484", "0.740535", "0.7378424", "0.7371491", "0.73200303", "0.7317881", "0.72788835", "0.7230021", "0.7229976", "0.7225142", "0.72162503"...
0.0
-1
Generate a sample image
def generate(self): z_sample = np.random.normal(0, 1,[self.batch_size, self.n_z]) gen_images = self.sess.run(self.gen_img, feed_dict={self.z: z_sample}) return gen_images
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_damaging(image):\r\n return crease_image(blotch_image(image, 100, True), 10, False)", "def make_sample_image(state_info, sample, epoch):\n\n img_path = utils.make_directory(os.path.join(utils.default_model_dir, 'image'))\n sample_hat, _, _, _ = state_info.forward(sample)\n sample, sample_h...
[ "0.7443671", "0.71894586", "0.7135982", "0.69358623", "0.68702227", "0.68625444", "0.6740236", "0.66976255", "0.66649115", "0.65966654", "0.65534407", "0.65440124", "0.6530151", "0.64749414", "0.6447424", "0.6444018", "0.63804406", "0.63804406", "0.6368764", "0.6368764", "0.6...
0.63499844
22