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
train function. runs the model on the train data.
def train(self): y_list = [] y_hat_list = [] for ex_dict in ut.EXAMPLES_LIST: y_list.append(ex_dict[1]) y_hat_list.append(self.predict(ex_dict[0])) acc = ut.compute_accuracy(y_hat_list, y_list) return acc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def train(self, training_data):\n pass", "def train():\n pass", "def train(self, data):\n pass", "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def trai...
[ "0.8352137", "0.8218357", "0.8174869", "0.81545186", "0.81523323", "0.80512273", "0.80430055", "0.8004875", "0.79240125", "0.7869158", "0.7859723", "0.78384733", "0.7826459", "0.7811651", "0.7722775", "0.764744", "0.764744", "0.764744", "0.764744", "0.764744", "0.76102465", ...
0.0
-1
test func. runs the model on the test data.
def test(self): y_list = [] y_hat_list = [] for ex_dict in ut.TEST_LIST: y_list.append(ex_dict[1]) y_hat_list.append(self.predict(ex_dict[0])) acc = ut.compute_accuracy(y_hat_list, y_list) return y_hat_list, acc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_model():\n pass", "def testModel( self, classTest, classPred):", "def evaluate(self, test_data):\n result = self.model.run(test_data)\n self._save_result(result)", "def test_training(self):\n\t\tpass", "def runtest(self):", "def test_predictor():", "def run_tests():\n sourc...
[ "0.7939359", "0.75355", "0.7429812", "0.72728753", "0.7245385", "0.71761847", "0.717419", "0.706351", "0.70390844", "0.6995146", "0.69640917", "0.69229054", "0.6912081", "0.6902356", "0.68842983", "0.6846401", "0.6827048", "0.6820484", "0.6810831", "0.6786037", "0.6763651", ...
0.0
-1
Returns an object with a date and value key
def get_rating_object(tup): return { # Split into list, cast into integer tuple, unpack values "date": date(*map(int, tup[0].split("/"))), # Cast to int "value": int(tup[1]) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_returner_dict(ict):\n if \"date\" in ict.keys():\n return ict[\"date\"]\n\n if \"updated_at\" in ict.keys():\n return ict[\"updated_at\"]", "def get_entry_date(input):\n if input and \"date\" in input.keys():\n return input[\"date\"], input[\"date\"] + timedelta(minutes=1)\...
[ "0.65873224", "0.62849426", "0.6171362", "0.6121679", "0.6089129", "0.6075831", "0.5969787", "0.59522283", "0.5899934", "0.5889765", "0.58323175", "0.5825535", "0.5823314", "0.5815788", "0.5810556", "0.57937735", "0.5766198", "0.5716365", "0.5716365", "0.5716365", "0.5660642"...
0.5890355
9
Returns a double, the average number of days between the rating objects specified in the list parameter.
def get_diffs_of_ratings(l): if len(l) <= 1: return str(None) total = 0.0 for v in range(0, len(l)-1): total = total + float((l[v+1]["date"] - l[v]["date"]).days) return str(float(total / (len(l)-1)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avg(list):\n return sum(list) / len(list)", "def dishlist_avg_cal(n:list)->float:\r\n all_cal = dishlist_cal(n)\r\n return sum(all_cal)/len(all_cal)", "def average_rating(business_list):\n\tratings = []\n\ttry:\n\t\tfor b in business_list:\n\t\t\tratings.append(b['rating'])\n\texcept KeyError:\n\t...
[ "0.68933636", "0.66389376", "0.6581203", "0.65615976", "0.65188193", "0.6491516", "0.64800775", "0.64580154", "0.6454823", "0.6444565", "0.6435506", "0.64231765", "0.64099354", "0.63959163", "0.6393575", "0.63914645", "0.63865495", "0.63710004", "0.6341628", "0.6338856", "0.6...
0.6772968
1
Cleans/Processes dataset Indicated columns are dropped Column names are cleaned NA member_id rows are dropped
def process_wounds(): wounds = pd.read_csv( f"{raw_data}\\wounds.csv", parse_dates=["Date Time Occurred", "Date Healed"] ) cols_to_drop = ["Participant"] wounds.drop(cols_to_drop, axis=1, inplace=True) wounds.columns = clean_table_columns(wounds.columns) wounds.dropna(subset=["member_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(df):", "def data_cleaning(df):\n df = df.dropna(how='all')\n \n return df", "def cleaning_data():\n\n data.drop([\"Unnamed: 0\"], axis = 1, inplace = True)\n data.columns = map(str.upper, data.columns)\n return data", "def clean_data():\n pd.set_option('display.max_columns', No...
[ "0.7117499", "0.7005925", "0.68842274", "0.68184763", "0.6786479", "0.6730669", "0.66629475", "0.66428536", "0.6615427", "0.66104126", "0.65803903", "0.65725803", "0.6566018", "0.6536402", "0.6514791", "0.649878", "0.64963984", "0.6341292", "0.6275764", "0.6273969", "0.626333...
0.0
-1
read optical flow from Middlebury .flo file
def read_flow(filename): f = open(filename, 'rb') magic = np.fromfile(f, np.float32, count=1) data2d = None if 202021.25 != magic: print 'Magic number incorrect. Invalid .flo file' raise ValueError else: w = np.fromfile(f, np.int32, count=1)[0] h = np.fromfile(f, np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readFlow(fn):\n with open(fn, 'rb') as f:\n magic = np.fromfile(f, np.float32, count=1)\n if 202021.25 != magic:\n print('Magic number incorrect. Invalid .flo file')\n return None\n else:\n w = np.fromfile(f, np.int32, count=1)\n h = np.fromfi...
[ "0.69454867", "0.6825181", "0.6419488", "0.6273423", "0.62524235", "0.61040115", "0.5770221", "0.5716468", "0.5614053", "0.5561235", "0.54988915", "0.54963934", "0.5491575", "0.54424614", "0.54424614", "0.5430062", "0.53820395", "0.5370581", "0.5340542", "0.5327158", "0.53171...
0.6149313
5
Load the groups of maps from disk and pass them on. Returns
def next(self): from . import containers # Exit this task if we have eaten all the file groups if len(self.maps) == 0: raise pipeline.PipelineStopIteration group = self.maps.pop(0) map_stack = None # Iterate over all the files in the group, load them into...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_groups(filename):\r\n with open(filename, 'rb') as f:\r\n saved_data = pickle.load(f)\r\n return saved_data", "def load():\n with open('groups.pkl', \"rb\") as f:\n while True:\n try:\n groups = yield pickle.load(f)\n except EOFError:\n ...
[ "0.71233", "0.69272316", "0.66794384", "0.66552407", "0.66202474", "0.66162264", "0.63269204", "0.6258608", "0.61424434", "0.6083753", "0.6035069", "0.601032", "0.5999741", "0.5984736", "0.59748757", "0.59748757", "0.5970814", "0.596345", "0.5949846", "0.59451145", "0.5866744...
0.58243775
23
Load the given files in turn and pass on. Returns
def process(self): from caput import memh5 # Garbage collect to workaround leaking memory from containers. # TODO: find actual source of leak import gc gc.collect() if len(self.files) == 0: raise pipeline.PipelineStopIteration # Fetch and remove t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_files_to_compare(self):\n self.first_source_data = load_path(self.path1)\n self.second_source_data = load_path(self.path2)", "def LoadBatch(filename):", "def read_files(self):\n for f in self.filenames:\n self.games.extend(pgn.loads(open(f).read()))", "def load_data_f...
[ "0.6850166", "0.65181124", "0.6457848", "0.6373063", "0.6358262", "0.63367456", "0.62863064", "0.6255783", "0.62493247", "0.6170194", "0.616997", "0.6162526", "0.615439", "0.6130812", "0.60998523", "0.6091496", "0.6089366", "0.601343", "0.5997618", "0.59721476", "0.59679097",...
0.0
-1
Return list of files specified in the parameters.
def setup(self): if not isinstance(self.files, (list, tuple)): raise RuntimeError("Argument must be list of files.") return self.files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFileList(*args, filespec: AnyStr=\"\", folder: AnyStr=\"\", **kwargs)->List[AnyStr]:\n pass", "def listFiles(self):\n pass", "def getFiles(directory, showName, extension):\n os.chdir(directory)\n \n list = []\n \n for file in glob.glob(\"*\"+showName+\"*.\"+extension):\n ...
[ "0.7737809", "0.7670469", "0.72622687", "0.7222471", "0.7222006", "0.7141934", "0.71256304", "0.7106082", "0.706683", "0.7065874", "0.70655364", "0.7050463", "0.70307785", "0.6981904", "0.6974049", "0.6974049", "0.6974049", "0.6974049", "0.69573295", "0.6954552", "0.69471765"...
0.0
-1
Set the list of files to load.
def setup(self, files): if not isinstance(files, (list, tuple)): raise RuntimeError("Argument must be list of files.") self.files = files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setfiles(self, filelist):\r\n self._filelist=filelist\r\n self._energy=self.readenergy(filelist)", "def load_files(self, filenames):\n self.filenames = filenames\n self.slider.setRange(0, len(self.filenames) - 1)\n self.slider.setSliderPosition(0)\n self.update_image()", "...
[ "0.73231435", "0.69058603", "0.6728127", "0.6700729", "0.66641843", "0.6648889", "0.6603299", "0.6600663", "0.6465014", "0.6455134", "0.6442191", "0.6424365", "0.6413909", "0.6399806", "0.636362", "0.63412595", "0.63355416", "0.6235698", "0.6206581", "0.62050563", "0.61724335...
0.66804683
4
Write out the data file. Assumes it has an MPIDataset interface.
def next(self, data): if "tag" not in data.attrs: tag = self.count self.count += 1 else: tag = data.attrs["tag"] fname = "%s_%s.h5" % (self.root, str(tag)) data.to_hdf5(fname) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, filename, data):\n raise NotImplementedError", "def write_data():", "def writeto(self, fileout):\n \n dump_pkl(self.data, fileout)", "def write(self, file):\n #write header\n self.ID.write(file)\n if (self.write_size): \n self.size.write(fi...
[ "0.70760417", "0.6967587", "0.6932236", "0.68128157", "0.6765629", "0.66699415", "0.6632731", "0.66030324", "0.65869176", "0.6584542", "0.6499914", "0.64965516", "0.6451832", "0.64421976", "0.6440108", "0.6392151", "0.6392151", "0.6378035", "0.6377129", "0.6351838", "0.632411...
0.0
-1
Load the beam transfer matrices. Returns
def setup(self): import os from drift.core import beamtransfer if not os.path.exists(self.product_directory): raise RuntimeError("BeamTransfers do not exist.") bt = beamtransfer.BeamTransfer(self.product_directory) tel = bt.telescope try: ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_matrices(self):\n self.wine_matrix = np.array(self.parse_file_into_array('winequality-red.csv', ';'))\n self.cancer_matrix = np.array(self.parse_file_into_array('breast-cancer-wisconsin.data', ','))", "def load_data(self, data_path, use_plus_minus_feats):\n loaded = np.load(data_pat...
[ "0.6444574", "0.5614101", "0.5545424", "0.5501657", "0.54312", "0.5426587", "0.5379299", "0.5376951", "0.5375422", "0.5370969", "0.5355206", "0.5354961", "0.53432345", "0.5305712", "0.5304582", "0.52721643", "0.52576506", "0.52432853", "0.52384704", "0.52315706", "0.5215489",...
0.0
-1
Load the beam transfer matrices. Returns
def setup(self): import os from drift.core import manager if not os.path.exists(self.product_directory): raise RuntimeError("Products do not exist.") # Load ProductManager and Timestream pm = manager.ProductManager.from_config(self.product_directory) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_matrices(self):\n self.wine_matrix = np.array(self.parse_file_into_array('winequality-red.csv', ';'))\n self.cancer_matrix = np.array(self.parse_file_into_array('breast-cancer-wisconsin.data', ','))", "def load_data(self, data_path, use_plus_minus_feats):\n loaded = np.load(data_pat...
[ "0.6441797", "0.5614659", "0.5542956", "0.5501366", "0.5431425", "0.54276216", "0.537962", "0.53753656", "0.53739345", "0.5370095", "0.53538334", "0.53538305", "0.53439856", "0.53054017", "0.5304288", "0.52689856", "0.52556485", "0.5242395", "0.523755", "0.52311736", "0.52142...
0.0
-1
Load truncation parameters from config or container defaults.
def _get_params(self, container): if container in TRUNC_SPEC: self.log.info("Truncating from preset for container {}".format(container)) for key in [ "dataset", "weight_dataset", "fixed_precision", "variance_increase", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setupConfigAnnotation(self):\n annotations = IAnnotations(self)\n settings = annotations.get(\"PLOMINOFIELDCONFIG\", None)\n if not settings:\n annotations[\"PLOMINOFIELDCONFIG\"] = PersistentDict()", "def _load_hyperopt_config(self, config: Dict[str, Any]) -> Dict[str, Any]:...
[ "0.5405735", "0.5393666", "0.5269585", "0.5220231", "0.5169489", "0.5156765", "0.5130496", "0.5035296", "0.50338167", "0.5030548", "0.49979058", "0.49922258", "0.498201", "0.4959689", "0.4950035", "0.49354002", "0.4933724", "0.49333996", "0.4876323", "0.485839", "0.48395112",...
0.7070541
0
Truncate the incoming data. The truncation is done in place.
def process(self, data): # get truncation parameters from config or container defaults self._get_params(type(data)) if self.weight_dataset is None: self.weight_dataset = [None] * len(self.dataset) for dset, wgt in zip(self.dataset, self.weight_dataset): old_shap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _truncate(self):\n dif = len(self) - self._maxLen\n if dif > 0:\n #return\n self[:dif] = []", "def truncate_data(self, width):\n times_from_mid = self.time - self.midtime\n idxs = np.abs(times_from_mid) < 0.5 * width * self.duration\n self.time = self....
[ "0.7612281", "0.70021963", "0.6984658", "0.67359823", "0.6635857", "0.64927536", "0.64104086", "0.62186086", "0.62107646", "0.6184132", "0.61748177", "0.6172634", "0.60797894", "0.6047497", "0.6047497", "0.5997909", "0.5997909", "0.5930729", "0.591268", "0.5890818", "0.577899...
0.53309244
56
Return a telescope object out of the input (either `ProductManager`, `BeamTransfer` or `TransitTelescope`).
def get_telescope(obj): from drift.core import telescope try: return get_beamtransfer(obj).telescope except RuntimeError: if isinstance(obj, telescope.TransitTelescope): return obj raise RuntimeError("Could not get telescope instance out of %s" % repr(obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_beamtransfer(obj):\n from drift.core import manager, beamtransfer\n\n if isinstance(obj, beamtransfer.BeamTransfer):\n return obj\n\n if isinstance(obj, manager.ProductManager):\n return obj.beamtransfer\n\n raise RuntimeError(\"Could not get BeamTransfer instance out of %s\" % re...
[ "0.59094083", "0.55723965", "0.52075577", "0.49067524", "0.4869637", "0.47760263", "0.46497482", "0.46300894", "0.45779586", "0.45738086", "0.4571514", "0.4460605", "0.44365323", "0.4436234", "0.44346416", "0.44056034", "0.43759432", "0.43554714", "0.4353904", "0.43461516", "...
0.7030609
0
Return a BeamTransfer object out of the input (either `ProductManager`, `BeamTransfer`).
def get_beamtransfer(obj): from drift.core import manager, beamtransfer if isinstance(obj, beamtransfer.BeamTransfer): return obj if isinstance(obj, manager.ProductManager): return obj.beamtransfer raise RuntimeError("Could not get BeamTransfer instance out of %s" % repr(obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n\n import os\n\n from drift.core import beamtransfer\n\n if not os.path.exists(self.product_directory):\n raise RuntimeError(\"BeamTransfers do not exist.\")\n\n bt = beamtransfer.BeamTransfer(self.product_directory)\n\n tel = bt.telescope\n\n ...
[ "0.5573253", "0.50620794", "0.49997687", "0.4947898", "0.48023778", "0.48023617", "0.47191608", "0.47186506", "0.46855393", "0.46065444", "0.4585532", "0.4478559", "0.4471264", "0.445144", "0.44428593", "0.44386634", "0.4436773", "0.44343606", "0.44192073", "0.44131085", "0.4...
0.76120263
0
The main function that finds all solutions for a single clue. Uses parser to find all possible parse trees, then calls the solving function for each parsing tree according to its clue type. Returns an ordered list of all possible solutions with score > MIN_SOLUTION VALUE
def solve(clue, solution_format): # Define parser grammar_str = GrammarDefinitions.define_grammar(clue) grammar = nltk.CFG.fromstring(grammar_str) parser = nltk.ChartParser(grammar) solutions = [] # Get all possible solutions for tree in parser.parse(clue): _handle_abbreviations(tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showSolution(bestTree)->list:\r\n bestSon = bestTree\r\n solved = bestTree.value\r\n minDepth = bestTree.depth\r\n solution = []\r\n while bestSon.sons:\r\n #print(bestSon.state)\r\n solution.append(bestSon.state)\r\n bestSon = getBestSon(bestSon, minDepth)\r\n #print(bes...
[ "0.6172393", "0.6126036", "0.61067355", "0.59318", "0.5886695", "0.5886695", "0.5886695", "0.58592933", "0.5837581", "0.57652533", "0.570048", "0.5684845", "0.56494737", "0.56355613", "0.56352055", "0.5631747", "0.5605624", "0.5603883", "0.55791163", "0.5574826", "0.5563982",...
0.6631623
0
Solver for double synonym clues
def _solve_double_synonym(parse_tree, solution_format=None): def _get_value(solution_list, word): # Gets the value of a word in a solution list for solution in solution_list: if solution[0] == word: return solution[1] return 0 # Get the two synonym parts ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def test_synonym(self): \n pass", "def test_syndome_LUT(self):\r\n syns = []\r\n errvecs = golay._make_3bit_errors()\r\n for errvec in errvecs:\r\n syn = tuple(numpy.mod(numpy.dot(errvec, golay.DEFAULT_H.T), 2))\r\n syns.append(syn)\r\n ...
[ "0.60946655", "0.60578865", "0.60223013", "0.5942013", "0.58613205", "0.58297867", "0.58198977", "0.5809236", "0.571314", "0.57117873", "0.5688526", "0.56218284", "0.56218284", "0.55990916", "0.5592245", "0.557801", "0.55571336", "0.55550945", "0.55278677", "0.5526694", "0.55...
0.7369051
0
Solver for anagram clues
def _solve_anagram(parse_tree, solution_format=None): anag, syn = _get_parts_ignore_EQU(parse_tree) # Get the anagramed word anag_word = anag[0] if not anag_word.label() == 'ANAG_WORD': anag_word = anag[1] anag_word = _create_sentence(anag_word, space=False) syn_sent = _create_sentence...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(s):", "def anagram(s):\n minchanges = 0\n\n if len(s) % 2 == 1:\n return -1\n else:\n word1 = s[0:len(s) // 2]\n word2 = s[len(s) // 2:]\n print(word1, word2)\n c1 = Counter(word1)\n for letter in word2:\n if c1[letter] > 0:\n ...
[ "0.66833496", "0.65617925", "0.6440984", "0.63482744", "0.6340745", "0.62304044", "0.6203706", "0.6193661", "0.6119746", "0.6078559", "0.60522294", "0.60006964", "0.5970734", "0.5944802", "0.59298414", "0.592687", "0.58776724", "0.5774756", "0.57737607", "0.57636297", "0.5762...
0.6842031
0
Solver for reversal clues
def _solve_reverse(parse_tree, solution_format=None): reverse, syn = _get_parts_ignore_EQU(parse_tree) # Get the reversed word reverse_word = reverse[0] if not reverse_word.label() == 'REV_WORD': reverse_word = reverse[1] reverse_word = _create_sentence(reverse_word, space=False, abbr=True...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def solve(self):\n ...", "def solve(self):\n pass", "def solve(self):\n pass", "def get_sol(self):", "def solve(self):\n self.enforce_node_consistency()\n self.ac3()\n return self.backtrack(dict())", "def solve(self):\n self.enforce_n...
[ "0.67602247", "0.6317653", "0.6291992", "0.6291992", "0.58932245", "0.5867568", "0.5867568", "0.5867568", "0.5853736", "0.58426094", "0.5819637", "0.58142674", "0.5767709", "0.57423395", "0.5735607", "0.57318306", "0.57278645", "0.57273644", "0.57223094", "0.57167876", "0.571...
0.5862509
8
Solver for enclosure clues
def _solve_enclosure(parse_tree, solution_format=None): enclose, syn = _get_parts_ignore_EQU(parse_tree) # Get enclosing and inserted words enc_word = enclose[0] ins_word = enclose[2] enc_word = _create_sentence(enc_word, space=False, abbr=True) ins_word = _create_sentence(ins_word, space=False...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def solve(self):\n ...", "def solve(self):\n pass", "def solve(self):\n pass", "def get_sol(self):", "def solve(self):\n\n # Assign variables to each quantity being solved.\n r_lookup, lookup, num = {}, {}, 0\n for element in self.elements:\n ...
[ "0.72661936", "0.6979131", "0.6883607", "0.6883607", "0.6763482", "0.6393582", "0.63930887", "0.6284085", "0.62618613", "0.621953", "0.6006027", "0.598754", "0.59189796", "0.5890026", "0.5859848", "0.5859848", "0.5850623", "0.5777722", "0.57628524", "0.5760397", "0.5760397", ...
0.5279109
99
Solver for insertion clues
def _solve_insertion(parse_tree, solution_format=None): insert, syn = _get_parts_ignore_EQU(parse_tree) # Get inserted and enclosing words ins_word = insert[0] enc_word = insert[2] ins_word = _create_sentence(ins_word, space=False, abbr=True) enc_word = _create_sentence(enc_word, space=False, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def solve(num_wizards, num_constraints, wizards, constraints):\n\n # print(num_wizards)\n # print(num_constraints)\n # print(wizards)\n # print(constraints)\n # node_set = set(wizards)\n \n\n\n def cost(sol,num_constraints,constraints):\n constraints_satisfied = 0\...
[ "0.61935043", "0.6052085", "0.58307177", "0.5684423", "0.5684423", "0.5677976", "0.56567764", "0.56496036", "0.558152", "0.55741924", "0.55183244", "0.55002755", "0.54804087", "0.54685974", "0.54493546", "0.53306746", "0.53248656", "0.5314975", "0.5243742", "0.52383006", "0.5...
0.58429676
2
Given an enclosing word and an inserted word, calculates the match score for each possible insertion of the second in the first
def _get_all_insertions(synonym, enc_word, ins_word, solution_format=None): words = [enc_word[0:i] + ins_word + enc_word[i:] for i in range(1, len(enc_word))] if solution_format is not None: words = [solution_format.add_spaces(word) for word in words if solution_format.check(word)] solutions = [(wo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score_function(word1, word2):\n if word2 == '':\n return len(word1)\n elif word1 == '':\n return len(word2)\n elif word1 == word2:\n return 0\n elif word1[0] == word2[0]:\n return 0 + score_function(word1[1:], word2[1:])\n else:\n add_char = 1 + score_function...
[ "0.6938082", "0.67501044", "0.664985", "0.66156524", "0.6437491", "0.6388", "0.63633657", "0.6323432", "0.63137937", "0.61882997", "0.6159928", "0.6151686", "0.6133492", "0.61209613", "0.611938", "0.61158586", "0.60796326", "0.6054395", "0.603592", "0.60226154", "0.60208946",...
0.0
-1
Solver for hidden word clues
def _solve_hidden_word(parse_tree, solution_format=None): hidden, syn = _get_parts_ignore_EQU(parse_tree) # Get the hiding word hiding_word = hidden[0] if not hiding_word.label() == 'HID_WORD': hiding_word = hidden[1] hiding_word = _create_sentence(hiding_word, space=False) syn_sent =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_clues(self):\r\n print(\"\\n************Searching Clues************\\n\")\r\n for word_id in self.words.keys():\r\n if not self.words[word_id].see and not self.words[word_id].wth:\r\n clue = pop_backslash(self.words[word_id].clue)\r\n temp = word_d...
[ "0.62825", "0.621615", "0.59519327", "0.59129626", "0.59106004", "0.5901776", "0.58596104", "0.5811822", "0.5787408", "0.5749001", "0.5749001", "0.5701069", "0.5651413", "0.56111234", "0.56057537", "0.5567448", "0.5547416", "0.55322987", "0.552673", "0.552673", "0.55166656", ...
0.6624858
0
Given a parse tree with 2 parts, with a possible EQU part in the middle, finds the synonym part and the other part
def _get_parts_ignore_EQU(parse_tree): first_part = parse_tree[0] second_part = parse_tree[1] if second_part.label() == 'EQU': second_part = parse_tree[2] if first_part.label() == 'SYN': syn = first_part other = second_part else: syn = second_part other = fir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _solve_double_synonym(parse_tree, solution_format=None):\n def _get_value(solution_list, word):\n # Gets the value of a word in a solution list\n for solution in solution_list:\n if solution[0] == word:\n return solution[1]\n\n return 0\n\n # Get the two syn...
[ "0.6501454", "0.59847134", "0.57638747", "0.56675124", "0.56613374", "0.54569155", "0.54319113", "0.5426494", "0.539753", "0.5339401", "0.53225523", "0.5321102", "0.5310823", "0.5307761", "0.52566755", "0.5253671", "0.5250814", "0.5199034", "0.51778674", "0.5174493", "0.51710...
0.6401357
1
Given a partial tree, connects all words into one string (spaces added if space=True) In case this might contain abbreviation, the tree would look different, so abbr should be True.
def _create_sentence(parse_tree, space=True, abbr=False): word = parse_tree[0][0] if abbr: word = word[0] if len(parse_tree) == 1: return word else: if space: return word + " " + _create_sentence(parse_tree[1], space=space, abbr=abbr) else: return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _join_expanded_node(expanded_node):\n sorted_expanded_node = sorted(expanded_node, key=lambda x: x[0])\n return \" \".join([word for address, word in sorted_expanded_node])", "def all_words(root,word = [],level=0,alpha_size=21):\n # If node is leaf node, it indicates end of string\n i...
[ "0.63241714", "0.59670556", "0.58251095", "0.5706153", "0.57025576", "0.5625008", "0.55807376", "0.5510879", "0.5498444", "0.5445535", "0.5403236", "0.53683877", "0.53352714", "0.53322303", "0.53150856", "0.53094614", "0.5264888", "0.5251927", "0.5235628", "0.52081066", "0.52...
0.57676345
3
Parses the abbreviation file to find all possible abbreviations, then calls helper function to update the tree
def _handle_abbreviations(parse_tree): path = os.path.join(GrammarDefinitions.FOLDER, GrammarDefinitions.ABBREVIATION_FILE) with open(path, "r") as f: lines = f.read().splitlines() abbr_dict = {line.split(GrammarDefinitions.ABBR_SEP)[0]: line.split(GrammarDefinitions.ABBR_SEP)[1] for line in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _replace_abbreviation(parse_tree, abbr_dict):\n if not isinstance(parse_tree, nltk.Tree):\n # Reached a leaf\n return\n\n if parse_tree.label() == 'ABBR':\n # Replace word with its abbreviation\n word = parse_tree[0]\n parse_tree.set_label('WORD')\n parse_tree[0]...
[ "0.6594188", "0.64209026", "0.6191263", "0.6113771", "0.59502375", "0.59138536", "0.58576477", "0.5774968", "0.56978416", "0.5646811", "0.5631029", "0.5490518", "0.54843515", "0.54673076", "0.54151493", "0.5384615", "0.53294075", "0.51091653", "0.5101626", "0.50498986", "0.50...
0.7767338
0
Updates the given tree by replacing the word with its abbreviated form
def _replace_abbreviation(parse_tree, abbr_dict): if not isinstance(parse_tree, nltk.Tree): # Reached a leaf return if parse_tree.label() == 'ABBR': # Replace word with its abbreviation word = parse_tree[0] parse_tree.set_label('WORD') parse_tree[0] = abbr_dict[w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abbreviate(match_tree, statement):\n\n result = statement\n current_node = match_tree\n for position, letter in enumerate(statement.upper()):\n current_node = current_node.get(letter)\n if not isinstance(current_node, dict):\n if isinstance(current_node, str):\n ...
[ "0.64932525", "0.60075444", "0.6002033", "0.5950056", "0.5884344", "0.5873636", "0.58596784", "0.5755214", "0.5720153", "0.57188857", "0.5702307", "0.57001936", "0.5692823", "0.56882954", "0.5668327", "0.5638983", "0.5637053", "0.5602583", "0.55859566", "0.55837816", "0.55621...
0.75555784
0
Creates a common python list of object, no matter what information are supported by the parsed xml file for test results junit().
def parse(self): def parse_testcase(xml_object): testcase = xml_object tc_dict = { "classname": testcase.attrib.get("classname", "unknown"), "file": testcase.attrib.get("file", "unknown"), "line": int(testcase.attrib.get("line", -1)), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self):\n try:\n data = etree.parse(self.resultfilename).getroot()\n except OSError:\n data = []\n\n testresults = []\n for testcase in data:\n category = Category.OK\n status = 'ok'\n module = testcase.get('classname')...
[ "0.6335188", "0.5985103", "0.59026104", "0.5846985", "0.57126236", "0.56514776", "0.5649591", "0.56286633", "0.5615803", "0.5615803", "0.5605953", "0.55911666", "0.5566683", "0.5566683", "0.5559948", "0.55295116", "0.54831856", "0.54688597", "0.54634106", "0.54622257", "0.544...
0.6112433
1
Produce a deepcopy of the current timing data (no risk of interference with active timing or other operaitons).
def get_times(): if f.root.stopped: return copy.deepcopy(f.root.times) else: t = timer() times = collapse.collapse_times() f.root.self_cut += timer() - t return times
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pure_data_copy(self):\n import copy\n data=copy.copy(self)\n data.xp = data.xp.get_pure_data_copy()\n data.timetable = data.timetable.get_pure_data_copy() \n return data", "def get_snapshot(self):\n data = {\n \"t\": self.sim.t,\n \"time\": ...
[ "0.6639168", "0.6453072", "0.6333998", "0.62160635", "0.62112194", "0.5905207", "0.5840254", "0.58312976", "0.58196926", "0.57917005", "0.57815856", "0.57566667", "0.5745111", "0.5699135", "0.5627263", "0.56236315", "0.56159997", "0.56139135", "0.5610615", "0.55917543", "0.55...
0.0
-1
Manual assignment of a collection of (stopped) Times objects as a parallel subdivision of a running timer.
def attach_par_subdivision(par_name, par_times): t = timer() if not isinstance(par_times, (list, tuple)): raise TypeError("Expected list or tuple for param 'par_times'.") for times in par_times: if not isinstance(times, Times): raise TypeError("Expected each element of param 'par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __set_time_elements(*args):\n args[0].TimeState.delay_elements = args[1]\n args[0].TimeState.set_delay_elements()", "def attach_subdivision(times):\n t = timer()\n if not isinstance(times, Times):\n raise TypeError(\"Expected Times object for param 'times'.\")\n assert times.total > 0.,...
[ "0.62573314", "0.6033236", "0.5865843", "0.5819078", "0.579982", "0.578757", "0.56507623", "0.5608748", "0.5587022", "0.55639225", "0.55407816", "0.55256355", "0.55256355", "0.55256355", "0.5518789", "0.5510289", "0.5480487", "0.54784924", "0.5468466", "0.54679537", "0.546644...
0.54004014
27
Manual assignment of a (stopped) times object as a subdivision of running timer. Use cases are expected to be very limited (mainly provided as a oneTimes variant of attach_par_subdivision).
def attach_subdivision(times): t = timer() if not isinstance(times, Times): raise TypeError("Expected Times object for param 'times'.") assert times.total > 0., "Attached subdivision has total time 0, appears empty." name = times.name f.r.self_agg += times.self_agg if name not in f.t.sub...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_interval_sub(self, time_step, nsteps):\n world.subtime = TimeAxis(0.0, int(nsteps), float(time_step))\n print(\"Setting subtime\")", "def __set_time_elements(*args):\n args[0].TimeState.delay_elements = args[1]\n args[0].TimeState.set_delay_elements()", "def time_interval_prop(self, time_s...
[ "0.6630454", "0.6081781", "0.5878871", "0.5870936", "0.5784389", "0.57493865", "0.5726583", "0.5696444", "0.56729144", "0.5598866", "0.558305", "0.5582902", "0.55632716", "0.54817516", "0.54677033", "0.5444429", "0.5438984", "0.54319745", "0.5367586", "0.53596765", "0.5350131...
0.6671484
0
Serialize and / or save a Times data object using pickle (cPickle).
def save_pkl(filename=None, times=None): if times is None: if not f.root.stopped: times = collapse.collapse_times() else: times = f.root.times else: if isinstance(times, (list, tuple)): for t in times: if not isinstance(t, Times): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self): \n with open(self.path+self.name, \"wb\") as pfile:\n pickle.dump(self.pyObj, pfile)", "def pickle(self,data,filename):\n pickle.dump(data, open(filename, 'wb'))", "def saveData(self): \n self.spIndex.close()\n output = open(PublicTransit.PICK...
[ "0.63484544", "0.60688585", "0.60613865", "0.60561633", "0.5997063", "0.5942309", "0.59148747", "0.590097", "0.58997315", "0.5889424", "0.58798075", "0.58791673", "0.5864843", "0.5844835", "0.5821112", "0.5819759", "0.580201", "0.5794824", "0.57903945", "0.57628703", "0.57584...
0.6815023
0
Normalizes OData request payload
def _build_payload(self, query): def _normalize_payload(payload): if isinstance(payload, ClientObject) or isinstance(payload, ClientValue): return payload.to_json(self._default_json_format) elif isinstance(payload, dict): return {k: _normalize_payload(v) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizeData(self, data):\n return _normalizeData(data)", "def normalizeData(self, data):\n return _normalizeData(data)", "def normalize_dataset(self):", "def _normalize_data_to_send(info):\n # Remove the parts of the data that are unbounded in size.\n info = copy.deepcopy(info)\n ...
[ "0.61284226", "0.61284226", "0.5774344", "0.57267433", "0.5654591", "0.55901545", "0.5548912", "0.54671437", "0.5320251", "0.5320097", "0.53039527", "0.5299607", "0.52769536", "0.5241324", "0.5238242", "0.52313703", "0.52067167", "0.5179294", "0.5160118", "0.5150837", "0.5125...
0.48169824
52
This method validates the input file. Returns true if the JSON is valid, false otherwise.
def validate_input(update_file): try: json.load(open(update_file)) print "\nValid JSON" return True except ValueError: print "\nInvalid JSON" exit(-1) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_input(update_file):\n try:\n json.load(open(update_file))\n #print \"Valid JSON\"\n return True\n except ValueError:\n print \"Invalid JSON. Exiting.\"\n exit(-1)\n return False", "def valid_is_json(self):\n return self.file_name.endswith('.json...
[ "0.81748825", "0.7770329", "0.76431674", "0.7455964", "0.7199138", "0.71282756", "0.7009667", "0.6992463", "0.69263047", "0.6873297", "0.68528163", "0.68223625", "0.6743427", "0.6640722", "0.661942", "0.66073275", "0.65818256", "0.6577986", "0.651692", "0.65011466", "0.649889...
0.823358
0
This method will attempt to enumerate all buckets. NEVER DO THIS EXCEPT DURING INITIAL TROUBLESHOOTING
def list_all_buckets(riak_host,riak_port): url='http://%s:%s/buckets?buckets=true' % (riak_host,riak_port) r=requests.get(url) print json.dumps(r.json(), sort_keys=True, indent=4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_buckets():\n pass", "def list_buckets():\n for bucket in BUCKET_MANAGER.all_buckets():\n print(bucket)", "def test_get_buckets(self):\n pass", "def list_buckets(self):\n msg = \"list_buckets not implemented\"\n raise NotImplementedError(msg)", "def test_000_list_b...
[ "0.70552385", "0.67575353", "0.66606206", "0.6565206", "0.6550554", "0.65227455", "0.6427794", "0.63869715", "0.63031363", "0.6285628", "0.61275065", "0.61203843", "0.6112329", "0.6099542", "0.60019106", "0.59359163", "0.59240943", "0.5843373", "0.58405674", "0.5830708", "0.5...
0.5854802
17
This method will attempt to enumerate all keys for a given bucket. NEVER DO THIS EXCEPT DURING INITIAL TROUBLESHOOTING
def list_all_keys(riak_host,riak_port,bucket): url='http://%s:%s/buckets/%s/keys?keys=true' % (riak_host,riak_port,bucket) #print url r=requests.get(url) print json.dumps(r.json(), sort_keys=True, indent=4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys(self, bucket, user=None):\n raise NotImplementedError('TODO')", "def iterkeys(self):\n\n for bucket in self.buckets.itervalues():\n for key in bucket.iterkeys():\n yield key", "def bucket_lister(bucket, prefix='', delimiter='', marker='', headers=None):\r\n m...
[ "0.7052264", "0.6707792", "0.6634113", "0.65546584", "0.64856684", "0.6361074", "0.6353042", "0.63117075", "0.62654686", "0.62642795", "0.6262174", "0.62522525", "0.6190531", "0.60471284", "0.6026226", "0.60245275", "0.60095507", "0.59610164", "0.59507036", "0.5926867", "0.59...
0.6350213
7
This method prints the current contents of a riak bucket when passed a valid url
def get_current_contents(url): r=requests.get(url) print json.dumps(r.json(), sort_keys=True, indent=4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PrintBucketInfo(self, bucket_uri, listing_style, headers=None, debug=0):\n bucket_objs = 0\n bucket_bytes = 0\n if listing_style == ListingStyle.SHORT:\n print bucket_uri\n else:\n try:\n for obj in self.CmdWildcardIterator(\n bucket_uri.clone_replace_name('*'), ResultTy...
[ "0.6069273", "0.60255677", "0.59204245", "0.5901043", "0.58166885", "0.5768245", "0.5719148", "0.5704775", "0.5666827", "0.5666827", "0.5653638", "0.56262296", "0.5598052", "0.55743444", "0.5523159", "0.5508009", "0.55066514", "0.55027604", "0.5455372", "0.5428352", "0.540960...
0.57620263
6
This method prints the current contents of an api_key riak bucket when passed a valid url
def get_current_key(url): r=requests.get(url) #return json.dumps(r.json(), sort_keys=True, indent=4) return json.dumps(r.json(), sort_keys=True, indent=4, separators=(',', ': '))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_keys(riak_host,riak_port,bucket):\n url='http://%s:%s/buckets/%s/keys?keys=true' % (riak_host,riak_port,bucket)\n #print url\n r=requests.get(url)\n print json.dumps(r.json(), sort_keys=True, indent=4)", "def get_from_api(url, *, verbose=False):\n vprint = lambda *a, **kwa: print(*a, ...
[ "0.59069735", "0.5775815", "0.56716317", "0.5670298", "0.5502804", "0.54711944", "0.54018843", "0.5394873", "0.5385831", "0.536729", "0.5343384", "0.5342679", "0.5339456", "0.5331075", "0.53242856", "0.53214943", "0.5316168", "0.53113574", "0.527582", "0.5245839", "0.52193", ...
0.6079053
0
This method saves the current contents of the riak bucket/key to be updated into a file called .original
def save_current_contents(url,update_file): r=requests.get(url) save_file=update_file+'.original' json.dump(r.json(), open(save_file,'w')) print "\nSaved contents of: \n\n\t%s \n\nto \n\n\t%s\n" % (url,save_file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _s3_stash(self):\n s3_url = 's3://{}/{}'.format(BUCKET, self.atom_file)\n bucketpath = BUCKET.strip(\"/\")\n bucketbase = BUCKET.split(\"/\")[0]\n parts = urlparse.urlsplit(s3_url)\n mimetype = 'application/xml' \n \n conn = boto.connect_s3()\n\n try:\n ...
[ "0.6037694", "0.59927624", "0.57073236", "0.56520575", "0.56048256", "0.5596014", "0.55929804", "0.55929804", "0.5570519", "0.5558988", "0.5556693", "0.5535628", "0.5512414", "0.5506305", "0.5484331", "0.5482167", "0.54426193", "0.54200596", "0.54176253", "0.54065824", "0.539...
0.6019954
1
This method performs the update/put of the specified bucket and key using the passed json input file. The current contents of the bucket are saved.
def do_update(url,indexHeaders,update_file): updateUrl=url.replace("buckets","riak") indexHeaders['content-type'] = 'application/json' r=requests.post(url, data=json.dumps(update_file), headers=indexHeaders)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_object(self, bucket_name, key, data):\n url = self.__key_url(bucket_name, key)\n resp = self.infinispan_client.put(url, data=data,\n auth=self.basicAuth,\n headers=self.headers)\n logger.debug(resp)", "...
[ "0.67305326", "0.67065084", "0.6650527", "0.6560699", "0.64503276", "0.6271223", "0.6260937", "0.62335885", "0.62213606", "0.61827993", "0.6107075", "0.6043181", "0.60399926", "0.6023759", "0.6021778", "0.5972299", "0.5967671", "0.59629846", "0.59620744", "0.5949854", "0.5920...
0.6346544
5
Export the accumulate QA info
def export_QA(qa: QA): # TODO: implement log.info("assess_quality.export_QA: not yet implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_qa(self):\n #- QA level outputs\n #qa_outfile = {}\n qa_outfig = {}\n for PA in self.palist:\n for QA in self.qalist[PA]:\n #qa_outfile[QA] = self.io_qa(QA)[0]\n qa_outfig[QA] = self.io_qa(QA)[1]\n \n #- mak...
[ "0.62779266", "0.5807726", "0.5701978", "0.5490575", "0.548842", "0.5469755", "0.5413337", "0.54031056", "0.5353437", "0.5329075", "0.52541536", "0.5240437", "0.5219163", "0.52120894", "0.5197329", "0.5191597", "0.5154738", "0.51318127", "0.51313466", "0.51085216", "0.5108008...
0.7101214
0
Computes boundary indices for each of the splits in split_probs.
def _compute_split_boundaries(split_probs, n_items): if len(split_probs) > n_items: raise ValueError( 'Not enough items for the splits. There are {splits} ' 'splits while there are only {items} items'.format( splits=len(split_probs), items=n_items ) ) total_probs = sum(p ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_split_indices(self):\n\n cumsum = np.cumsum(\n np.concatenate((np.array([0], dtype=np.int8), self.split_sizes)))\n \n fold_inds = np.array(\n [(cumsum[n], cumsum[n + 1]) for n in range(self.n_splits)])\n\n return fold_inds", "def indices_of_split(self, s...
[ "0.6504778", "0.6373539", "0.5991977", "0.59512573", "0.58468676", "0.58247024", "0.58247024", "0.5623608", "0.55173296", "0.54587805", "0.5435856", "0.54219145", "0.53155714", "0.53145355", "0.5306709", "0.5304065", "0.5301914", "0.5295978", "0.52721083", "0.52459157", "0.52...
0.7075934
0
Split items to train/dev/test, so all items in group go into same split. Each group contains all the samples from the same speaker ID. The samples are splitted between train, validation and testing so that samples from each speaker belongs to exactly one split.
def _get_inter_splits_by_group(items_and_groups, split_probs, split_number): groups = sorted(set(group_id for item_id, group_id in items_and_groups)) rng = np.random.RandomState(split_number) rng.shuffle(groups) split_boundaries = _compute_split_boundaries(split_probs, len(groups)) group_id_to_split = {} f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_dev(self):\n\t\tprint(\"Splitting test set into dev and test set\")\n\n\t\told_length = len(self.X[\"test\"])\n\t\tindices = list(range(old_length))\n\n\t\tnp.random.seed(0)\n\t\tnp.random.shuffle(indices)\n\t\t\n\t\tsplit = int(len(indices) * 0.5)\n\n\t\tsplit_indices = {\"test\": indices[:split], \"dev...
[ "0.71623456", "0.6617794", "0.6545615", "0.65136385", "0.6460266", "0.6431915", "0.63877124", "0.63793963", "0.6359528", "0.63103324", "0.6294245", "0.6264392", "0.62345576", "0.62252283", "0.6203761", "0.61943793", "0.61911535", "0.6172929", "0.61283726", "0.6106689", "0.609...
0.0
-1
Test parsing and streaming of DPTValue1Ucount 50.
def test_value_50(self): self.assertEqual(DPTValue1Ucount().to_knx(50), (0x32,)) self.assertEqual(DPTValue1Ucount().from_knx((0x32,)), 50)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unit(self):\n self.assertEqual(DPTSignedRelativeValue.unit, \"\")\n self.assertEqual(DPTPercentV8.unit, \"%\")\n self.assertEqual(DPTValue1Count.unit, \"counter pulses\")", "def test_with_status_data(self):\r\n\r\n with open(os.path.join(RESOURCE_PATH, 'ND161646.PD0'), 'rb') ...
[ "0.65973496", "0.61154234", "0.60894555", "0.5885825", "0.5680461", "0.5545329", "0.5519853", "0.5479107", "0.54342437", "0.53747666", "0.5368387", "0.53356916", "0.5330443", "0.53220665", "0.532082", "0.52951694", "0.5269306", "0.5266885", "0.52651095", "0.52512425", "0.5247...
0.66703874
0
Test parsing and streaming of DPTValue1Ucount 255.
def test_value_max(self): self.assertEqual(DPTValue1Ucount().to_knx(255), (0xFF,)) self.assertEqual(DPTValue1Ucount().from_knx((0xFF,)), 255)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_50(self):\n self.assertEqual(DPTValue1Ucount().to_knx(50), (0x32,))\n self.assertEqual(DPTValue1Ucount().from_knx((0x32,)), 50)", "def test_unit(self):\n self.assertEqual(DPTSignedRelativeValue.unit, \"\")\n self.assertEqual(DPTPercentV8.unit, \"%\")\n self.asser...
[ "0.67056155", "0.631558", "0.6267815", "0.5858477", "0.5822282", "0.5758016", "0.56248516", "0.561795", "0.5597454", "0.55848616", "0.5476851", "0.53409237", "0.530719", "0.5269258", "0.52683234", "0.5258315", "0.52361274", "0.5220925", "0.5200943", "0.5164981", "0.5155284", ...
0.6720798
0
Test parsing and streaming of DPTValue1Ucount 0.
def test_value_min(self): self.assertEqual(DPTValue1Ucount().to_knx(0), (0x00,)) self.assertEqual(DPTValue1Ucount().from_knx((0x00,)), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unit(self):\n self.assertEqual(DPTSignedRelativeValue.unit, \"\")\n self.assertEqual(DPTPercentV8.unit, \"%\")\n self.assertEqual(DPTValue1Count.unit, \"counter pulses\")", "def test_value_50(self):\n self.assertEqual(DPTValue1Ucount().to_knx(50), (0x32,))\n self.asser...
[ "0.65742433", "0.6063547", "0.6014494", "0.5983357", "0.57647645", "0.5689636", "0.5639485", "0.5594808", "0.5583179", "0.55746424", "0.5439922", "0.5422113", "0.5407889", "0.5406917", "0.53917974", "0.5373599", "0.53290766", "0.53238535", "0.5318", "0.52924883", "0.5290578",...
0.6662104
0
Test parsing of DPTValue1Ucount with wrong value (underflow).
def test_to_knx_min_exceeded(self): with self.assertRaises(ConversionError): DPTValue1Ucount().to_knx(DPTValue1Ucount.value_min - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_min(self):\n self.assertEqual(DPTValue1Ucount().to_knx(0), (0x00,))\n self.assertEqual(DPTValue1Ucount().from_knx((0x00,)), 0)", "def test_from_knx_wrong_value(self):\n with self.assertRaises(ConversionError):\n DPTValue1Ucount().from_knx((0x256,))", "def test_fro...
[ "0.66430473", "0.65788555", "0.6345036", "0.63011754", "0.62446314", "0.6172727", "0.6139013", "0.5989837", "0.5946955", "0.5930045", "0.59022975", "0.5796947", "0.57517916", "0.5694532", "0.5599999", "0.55728513", "0.55712885", "0.5526123", "0.5521623", "0.55063385", "0.5474...
0.57302237
13
Test parsing of DPTValue1Ucount with wrong value (overflow).
def test_to_knx_max_exceeded(self): with self.assertRaises(ConversionError): DPTValue1Ucount().to_knx(DPTValue1Ucount.value_max + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_knx_wrong_value(self):\n with self.assertRaises(ConversionError):\n DPTValue1Ucount().from_knx((0x256,))", "def test_value_min(self):\n self.assertEqual(DPTValue1Ucount().to_knx(0), (0x00,))\n self.assertEqual(DPTValue1Ucount().from_knx((0x00,)), 0)", "def test_uni...
[ "0.6605722", "0.65791065", "0.64690846", "0.63336855", "0.62942255", "0.6279501", "0.62152576", "0.6180856", "0.6159583", "0.61054754", "0.6093372", "0.6059035", "0.59029233", "0.58780617", "0.58492506", "0.57691437", "0.574576", "0.574576", "0.56977135", "0.56756204", "0.566...
0.57946146
15
Test parsing of DPTValue1Ucount with wrong value (string).
def test_to_knx_wrong_parameter(self): with self.assertRaises(ConversionError): DPTValue1Ucount().to_knx("fnord")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_uss_num_bad_values(self):\n for val in self.bad_values:\n self.assertRaises(line_format_errors.FieldParseError,\n lambda: self.line._parse_uss_num(val))", "def test_unit(self):\n self.assertEqual(DPTSignedRelativeValue.unit, \"\")\n self.asser...
[ "0.6505707", "0.6373843", "0.6372432", "0.6268583", "0.62656677", "0.6227337", "0.6173566", "0.61697394", "0.6120558", "0.60757333", "0.606843", "0.60362804", "0.60135466", "0.5993069", "0.5965824", "0.5962902", "0.5954549", "0.59497184", "0.58848035", "0.5879634", "0.5850198...
0.5491689
54
Test parsing of DPTValue1Ucount with wrong value (3 byte array).
def test_from_knx_wrong_parameter(self): with self.assertRaises(ConversionError): DPTValue1Ucount().from_knx((0x01, 0x02, 0x03))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_knx_wrong_value(self):\n with self.assertRaises(ConversionError):\n DPTValue1Ucount().from_knx((0x256,))", "def test_from_knx_wrong_parameter2(self):\n with self.assertRaises(ConversionError):\n DPTValue1Ucount().from_knx(\"0x23\")", "def test_value_min(self):\...
[ "0.6574174", "0.64003175", "0.63059187", "0.6276057", "0.6197245", "0.6195625", "0.61819005", "0.6062769", "0.600046", "0.5978124", "0.5972343", "0.5937288", "0.57631", "0.5702879", "0.566235", "0.5638889", "0.56113666", "0.5604449", "0.56010675", "0.55782485", "0.557578", ...
0.6430515
1
Test parsing of DPTValue1Ucount with value which exceeds limits.
def test_from_knx_wrong_value(self): with self.assertRaises(ConversionError): DPTValue1Ucount().from_knx((0x256,))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_min(self):\n self.assertEqual(DPTValue1Ucount().to_knx(0), (0x00,))\n self.assertEqual(DPTValue1Ucount().from_knx((0x00,)), 0)", "def test_value_max(self):\n self.assertEqual(DPTValue1Ucount().to_knx(255), (0xFF,))\n self.assertEqual(DPTValue1Ucount().from_knx((0xFF,)),...
[ "0.6418932", "0.633995", "0.60887456", "0.60097504", "0.5899993", "0.58869195", "0.5875206", "0.577937", "0.5753048", "0.57470715", "0.5724356", "0.5703249", "0.5686941", "0.5644697", "0.56209826", "0.56093055", "0.55792356", "0.55781907", "0.5557171", "0.5544843", "0.5543713...
0.5518648
23
Test parsing of DPTValue1Ucount with wrong value (array containing string).
def test_from_knx_wrong_parameter2(self): with self.assertRaises(ConversionError): DPTValue1Ucount().from_knx("0x23")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_uss_num_bad_values(self):\n for val in self.bad_values:\n self.assertRaises(line_format_errors.FieldParseError,\n lambda: self.line._parse_uss_num(val))", "def test_uss_num_good_values(self):\n for input_val, output_val in self.known_values:\n ...
[ "0.64697146", "0.61905485", "0.6125916", "0.6093", "0.60590595", "0.60514253", "0.60386145", "0.6020416", "0.59949565", "0.59723514", "0.5926353", "0.58925855", "0.5874658", "0.5870202", "0.5863102", "0.5860344", "0.5836023", "0.582747", "0.5825986", "0.5784446", "0.577219", ...
0.5871998
13
Test parsing of DPTTariff with wrong value (overflow).
def test_from_knx_max_exceeded(self): with self.assertRaises(ConversionError): DPTTariff().from_knx((0xFF,))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nonsense_decimal(self):\n test_passes = False\n try:\n self.parser.extract_zt(\"ZT.\")\n test_passes = False\n except Exception as e:\n test_passes = True\n self.assertTrue(test_passes)", "def validate_tariff(self):\n\t\treturn True", "def t...
[ "0.6723091", "0.6319212", "0.5926528", "0.5925495", "0.58749855", "0.5870267", "0.5810937", "0.57904863", "0.57482463", "0.5747621", "0.5714481", "0.5709603", "0.5658411", "0.5625314", "0.5606641", "0.55434126", "0.554246", "0.55323154", "0.5525947", "0.55253166", "0.5515092"...
0.6114475
2
Returns the eopatch with the new grouping of the LPIS data. A column "GROUP_1_ID", is also added, with the ID associated to the groups. col_cropN_lpis is the name of the column of the crop type in the lpis dataframe. col_cropN_lpistogroup is the name of the column of the crop type in the csv file specified by self.lpis...
def execute(self, eopatch, col_cropN_lpis, col_cropN_lpistogroup): # Group LPIS classes lpis = eopatch.vector_timeless["LPIS_{}".format(self.year)] mapping = pd.read_csv(self.lpis_to_group_file, sep=";") result = pd.merge(lpis, mapping, how="left", left_on=[col_cropN_lpis], right_on=[col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def putHaplotypeGroupIntoDB(self, session, input_fname, tg_ecotypeid2row, max_snp_typing_error_rate, snp_id_ls):\n\t\tsys.stderr.write(\"Constructing haplotype groups ...\\n\")\n\t\tpattern_ecotypeid = re.compile(r'(?<=\\))\\d+')\n\t\treader = csv.reader(open(input_fname), delimiter=figureOutDelimiter(input_fname)...
[ "0.54248655", "0.52833027", "0.52409554", "0.51482445", "0.5124294", "0.50936604", "0.5087704", "0.5087017", "0.5085758", "0.50673145", "0.5042352", "0.50204813", "0.5016356", "0.49944848", "0.4958095", "0.49487063", "0.49047828", "0.49024466", "0.48803094", "0.48635092", "0....
0.7963392
0
Split dataset into train and test data
def train_test_split_eopatches(patch_array, test_ratio, features_dict, labels_dict): # define EOPatches for training and testing trainIDs = list(range(len(patch_array))) testIDs = trainIDs[0::test_ratio] # take every xth patch for testing for elem in trainIDs: if elem in testIDs: t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)", "def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_s...
[ "0.8715163", "0.8671336", "0.8420628", "0.8248627", "0.8183213", "0.8146104", "0.8093698", "0.8087583", "0.8075708", "0.8037415", "0.80204433", "0.8016", "0.8002609", "0.79591835", "0.79122245", "0.78805375", "0.7857199", "0.78511673", "0.78495", "0.78276145", "0.77810913", ...
0.0
-1
Split dataset into train and test data
def train_test_split_eopatch(patch_array, features_dict, labels_dict): # Set the features and the labels for train and test sets for eopatch in patch_array: features = np.array([eopatch.data[features_dict]]) for eopatch in patch_array: labels = np.array([eopatch.mask_timeless[labels_dict]])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)", "def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_s...
[ "0.8715228", "0.867129", "0.8421134", "0.8248853", "0.8183687", "0.8146796", "0.8093657", "0.8088005", "0.8075957", "0.80384034", "0.80211496", "0.80177146", "0.80029935", "0.79595435", "0.7912857", "0.7880697", "0.7858649", "0.78521097", "0.7849592", "0.78286815", "0.7782076...
0.0
-1
mask out labels that are not in both train and test data and also mask out samples where features include NaN values
def masking(X_train, X_test, y_train, y_test): # create mask to exclude NaN-values from train data mask_train = np.zeros(X_train.shape[0], dtype=np.bool) for i, subfeat in enumerate(X_train): if True in np.isnan(subfeat): mask_train[i] = True else: mask_train[i] = Fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def omit_nans(self, data, label):\n maskarray=np.full(data.shape[0], True)\n masker=np.unique(np.argwhere(np.isnan(data))[:,0])\n maskarray[masker]=False\n traindata=data[maskarray,:,:,:]\n trainlabel=label[maskarray]\n return traindata, trainlabel", "def filter_nan_samp...
[ "0.7626387", "0.6600071", "0.63293505", "0.62641454", "0.62288636", "0.61516243", "0.608271", "0.6056829", "0.6002692", "0.599427", "0.59860575", "0.59836817", "0.5916399", "0.5898351", "0.5887911", "0.5840369", "0.5840369", "0.581876", "0.58088595", "0.5802163", "0.5787612",...
0.75027907
1
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues, ylabel='True label', xlabel='Predicted label', filename=None): np.set_printoptions(precision=2, suppress=True) if normalize: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8195649", "0.8095532", "0.803007", "0.8019817", "0.7994959", "0.7991904", "0.79818887", "0.79766536", "0.7961735", "0.7957412", "0.79385704", "0.7935568", "0.79352015", "0.7932079", "0.79270303", "0.7925357", "0.79243845", "0.7923781", "0.792341", "0.79226786", "0.7918532"...
0.0
-1
Returns mapping between Geopedia's crop index and crop id for Slovenia.
def get_slovenia_crop_geopedia_idx_to_crop_id_mapping(): gpd_session = GeopediaSession() to_crop_id = list(GeopediaFeatureIterator(layer='2036', gpd_session=gpd_session)) to_crop_id = [{'crop_geopedia_idx': code['id'], **code['properties']} for code in to_crop_id] to_crop_id = pd.DataFrame(to_crop_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_austria_crop_geopedia_idx_to_crop_id_mapping():\n gpd_session = GeopediaSession()\n to_crop_id = list(GeopediaFeatureIterator(layer='2032', gpd_session=gpd_session))\n to_crop_id = [{'crop_geopedia_idx': code['id'], **code['properties']} for code in to_crop_id]\n to_crop_id = pd.DataFrame(to_cr...
[ "0.75980484", "0.75025374", "0.5695294", "0.5330386", "0.52470756", "0.5175866", "0.5105939", "0.5084242", "0.5022458", "0.50011927", "0.49794403", "0.49425364", "0.48705566", "0.48659784", "0.48595893", "0.48556918", "0.48154962", "0.48137003", "0.4780601", "0.47703573", "0....
0.8482437
0
Returns mapping between Geopedia's crop index and crop id for Austria.
def get_austria_crop_geopedia_idx_to_crop_id_mapping(): gpd_session = GeopediaSession() to_crop_id = list(GeopediaFeatureIterator(layer='2032', gpd_session=gpd_session)) to_crop_id = [{'crop_geopedia_idx': code['id'], **code['properties']} for code in to_crop_id] to_crop_id = pd.DataFrame(to_crop_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_slovenia_crop_geopedia_idx_to_crop_id_mapping():\n gpd_session = GeopediaSession()\n to_crop_id = list(GeopediaFeatureIterator(layer='2036', gpd_session=gpd_session))\n to_crop_id = [{'crop_geopedia_idx': code['id'], **code['properties']} for code in to_crop_id]\n to_crop_id = pd.DataFrame(to_c...
[ "0.77784413", "0.776725", "0.5600029", "0.54075384", "0.5386751", "0.52513653", "0.521203", "0.5181957", "0.5152261", "0.5145004", "0.51417464", "0.5124304", "0.5023551", "0.5006278", "0.49717915", "0.4945458", "0.4932558", "0.49104485", "0.49027997", "0.48968828", "0.4886672...
0.85902876
0
Returns mapping between Geopedia's crop index and crop id for Austria.
def get_danish_crop_geopedia_idx_to_crop_id_mapping(): gpd_session = GeopediaSession() to_crop_id = list(GeopediaFeatureIterator(layer='2050', gpd_session=gpd_session)) to_crop_id = [{'crop_geopedia_idx': code['id'], **code['properties']} for code in to_crop_id] to_crop_id = pd.DataFrame(to_crop_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_austria_crop_geopedia_idx_to_crop_id_mapping():\n gpd_session = GeopediaSession()\n to_crop_id = list(GeopediaFeatureIterator(layer='2032', gpd_session=gpd_session))\n to_crop_id = [{'crop_geopedia_idx': code['id'], **code['properties']} for code in to_crop_id]\n to_crop_id = pd.DataFrame(to_cr...
[ "0.8590341", "0.7777967", "0.55995166", "0.5406844", "0.5386515", "0.5250449", "0.52115846", "0.5181277", "0.5151335", "0.5144841", "0.51434386", "0.5124106", "0.5024576", "0.50069875", "0.49709794", "0.4945706", "0.4932167", "0.49089321", "0.4904205", "0.48967505", "0.488521...
0.77669185
2
See Task's docs for the explanation of what is done.
def _fix_slovenian_lpis(self, eopatch): eopatch.vector_timeless[self.feature].rename(index=str, columns={"SIFRA_KMRS": "crop_geopedia_idx"}, inplace=True) eopatch.vector_timeless[self.feature] = pd.merge(eopatch.vector_timeless[self.feature], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_done(self) -> None:\n pass", "def task():", "def _work(self):\n return \"Task Done\"", "def task():\n pass", "def task():\n pass", "def taskCompleted(self) -> None:\n ...", "def taskCompleted(self) -> None:\n ...", "def task_done(self):\n self.__data[...
[ "0.82386553", "0.7563888", "0.74738455", "0.7442565", "0.7442565", "0.7423436", "0.7423436", "0.7390882", "0.7277639", "0.72640425", "0.7255059", "0.7245628", "0.72235", "0.72235", "0.7144731", "0.71438885", "0.71137834", "0.70728517", "0.70728517", "0.70479167", "0.7043934",...
0.0
-1
See Task's docs for the explanation of what is done.
def _fix_austrian_lpis(self, eopatch): eopatch.vector_timeless[self.feature] = pd.merge(eopatch.vector_timeless[self.feature], self.mapping, on='SNAR_BEZEI')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_done(self) -> None:\n pass", "def task():", "def _work(self):\n return \"Task Done\"", "def task():\n pass", "def task():\n pass", "def taskCompleted(self) -> None:\n ...", "def taskCompleted(self) -> None:\n ...", "def task_done(self):\n self.__data[...
[ "0.82387906", "0.7566016", "0.7473968", "0.7443576", "0.7443576", "0.74233943", "0.74233943", "0.7391527", "0.72773564", "0.72633433", "0.72552836", "0.7246756", "0.7225533", "0.7225533", "0.7146467", "0.7144274", "0.71132636", "0.70735073", "0.70735073", "0.70464575", "0.704...
0.0
-1
See Task's docs for the explanation of what is done.
def _fix_danish_lpis(self, eopatch): eopatch.vector_timeless[self.feature].rename(index=str, columns={"CropName": "crop_geopedia_idx"}, inplace=True) eopatch.vector_timeless[self.feature] = pd.merge(eopatch.vector_timeless[self.feature], self.mapp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_done(self) -> None:\n pass", "def task():", "def _work(self):\n return \"Task Done\"", "def task():\n pass", "def task():\n pass", "def taskCompleted(self) -> None:\n ...", "def taskCompleted(self) -> None:\n ...", "def task_done(self):\n self.__data[...
[ "0.82381403", "0.7564784", "0.74732625", "0.7443405", "0.7443405", "0.7422492", "0.7422492", "0.7391623", "0.7276497", "0.72642094", "0.7255191", "0.7246073", "0.72239846", "0.72239846", "0.71451586", "0.71425253", "0.7114694", "0.7072317", "0.7072317", "0.7047504", "0.704338...
0.0
-1
Query oVirt for hosts and place them in env.hosts
def query(oquery='', sure='no', ovirt=None): hosts = oVirtObjectType.all_types['host'].query(ovirt, oquery) env.hosts = [host.address for host in hosts] puts(yellow( "Got %d hosts: \n\t" % len(env.hosts) + '\n\t'.join(env.hosts) )) if sure != 'yes' and not env.parallel: if pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_hosts(self):\n ...", "def list_hosts():\n task_run(\"/bin/hostname -f\",RING_1_dev__allnodes)", "def iter_hosts():\n environmentdef = _get_environmentdef()\n\n for host in environmentdef.hosts():\n # fabric needs the host if we're calling from main()\n with this_hostname(h...
[ "0.71519107", "0.68191886", "0.6781512", "0.6779192", "0.67747766", "0.6615469", "0.6611653", "0.65831035", "0.6563107", "0.6526407", "0.6524256", "0.6518464", "0.6516803", "0.6516803", "0.65129817", "0.6509997", "0.6502699", "0.6498704", "0.6484243", "0.6476118", "0.64731044...
0.70534045
1
List walks, or create a new walks.
def walk_list_api(request): if request.method == 'GET': walks = Walk.objects.filter(user=request.user).order_by("-date") serializer = WalkSerializer(walks, many=True) return Response(serializer.data) elif request.method == 'POST': serializer = WalkSerializer(data=request.data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk(self):\n pass", "def _generate_walks(self):\n return parallel_generate_walks(\n self.d_graph,\n self.walk_length,\n self.num_walks,\n 'Single process!',\n self.sampling_strategy,\n self.NUM_WALKS_KEY,\n self.WALK_...
[ "0.5646791", "0.5542716", "0.55225664", "0.5464238", "0.54215646", "0.528533", "0.52653676", "0.511849", "0.5058529", "0.5012877", "0.4977857", "0.49737927", "0.4950848", "0.4932711", "0.4876913", "0.48244464", "0.48208708", "0.4789596", "0.4759153", "0.47326207", "0.47326207...
0.56819975
0
Python script to read information from a public API returns employess an their completed tasks
def main(): number = sys.argv[1] url_user = "https://jsonplaceholder.typicode.com/users/{}".format(number) url_tasks = ("https://jsonplaceholder.typicode.com/users/{}/todos". format(number)) response = requests.get(url_tasks) tasks = response.json() user_info = requests.get(url_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTasks(server, appId, maxNumberTasks, completedOnly, oper = 0, fileName = 'data/jsonTasksInfo.dat'):\n if oper == 0:\n if completedOnly == 1:\n JSONdata = urllib2.urlopen(url=server+\"/api/task?app_id=\"+ \\\n str(appId)+\"&state=completed&limit=\"+ \\\n str...
[ "0.6383334", "0.6324897", "0.60697365", "0.60460687", "0.6041132", "0.6039913", "0.6039841", "0.6021158", "0.59782183", "0.594846", "0.5938907", "0.590392", "0.58827335", "0.58718795", "0.5845513", "0.58447444", "0.5832608", "0.5792506", "0.5783988", "0.57403696", "0.5719636"...
0.68217677
0
Return the first empty board space.
def ChooseAction(board, player): # list of all possible initial actions possible_actions = list(i for i in range(16) if board[i] == 0) # default action chosen_move = min(possible_actions) # Dict to keep track of searched utilities and transposed/symmetric boards utilities trans_map = {} # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_empty_space(board: list) -> tuple:\n board_length = len(board)\n for i in range(board_length):\n for j in range(board_length):\n if board[i][j] == 0:\n return (i,j)", "def getBlank(self):\n return self.tiles[-1]", "def firstEmptyCell(board):\r\n for i i...
[ "0.7228956", "0.72194856", "0.71157676", "0.70752555", "0.7033004", "0.7023246", "0.69070786", "0.6800406", "0.67626697", "0.67131233", "0.67107725", "0.6703432", "0.6672965", "0.6548556", "0.6537903", "0.65232265", "0.64945805", "0.64092594", "0.6404099", "0.63550234", "0.63...
0.0
-1
Given a state in a game, calculate the best move by searching forward all the way to the terminal states.
def min_max_dec(possible_actions, board, player): max_move = None max_u = None alpha = None beta = None trans_map = {} for a in possible_actions: next_state, next_player = ApplyAction(a, copy.copy(board), player) if str(next_state) not in trans_map: u = best_utility(next_state, next_player, alpha, b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best_move(state: GameState) -> None:", "def find_best_move(state) -> None:\n C: float = 2 ** 0.5 # Start with sqrt(2)\n idx: int = -1\n win_ratio: float = 0\n\n # First create the root node for the game\n root = State(None, None, state)\n root = expand(root)\n root = run_each_move(r...
[ "0.86593556", "0.7661473", "0.7622619", "0.75274277", "0.75215596", "0.73920614", "0.73836887", "0.7380424", "0.7089991", "0.70826083", "0.70650315", "0.70334923", "0.702504", "0.6907222", "0.6841861", "0.6832756", "0.68116426", "0.6809587", "0.6802957", "0.6794307", "0.67721...
0.0
-1
Put one token in the appropriate space.
def ApplyAction(action, board, player): # default next player next_player = -player # ensure move is an int not a string action = int(action) board[action] = player # determine if adjacent squares to action are surrounded check_pos = action+1 if is_surrounded(check_pos, board,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_token(self,token):\n\t\tif not token:\n\t\t\tlogging.error(\"Token cannot be empty!\")\n\t\t\texit()\n\n\t\tself.tokens.append(token.lower())\n\t\t#self.user_defined_token = token.lower()", "def place_token(self, x, y, player):\n pass", "def wrapspace(text, token):\n\n # Wildcards have no...
[ "0.6519636", "0.64898586", "0.6479388", "0.64415634", "0.63102734", "0.6257991", "0.6152137", "0.6017201", "0.6010566", "0.59733546", "0.59363115", "0.59293514", "0.5919438", "0.5919438", "0.59010226", "0.5834218", "0.5832736", "0.57661647", "0.5702237", "0.5663479", "0.56570...
0.0
-1
Pads episodes to all be the same length by repeating the last exp.
def pad(episodes): max_len = max(len(episode) for episode in episodes) mask = torch.zeros((len(episodes), max_len), dtype=torch.bool) padded_episodes = [] for i, episode in enumerate(episodes): padded = episode + [episode[-1]] * (max_len - len(episode)) padded_episodes.append(padded) mask[i, :len(ep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(seq, n):\n return", "def _add_target_n_step_q_to_episode(self, episode):\n horizon = len(episode)\n for t in range(horizon):\n end_idx = min(t + self.n, horizon)\n discount = self.gamma ** (end_idx - t)\n mask = episode[end_idx - 1][\"nonterminal\"]\n ...
[ "0.62974507", "0.58488435", "0.58399844", "0.56710404", "0.56123376", "0.555278", "0.55409425", "0.55328083", "0.54572415", "0.5408101", "0.5379053", "0.53634495", "0.5328769", "0.5322512", "0.53201896", "0.5319856", "0.5299281", "0.52867496", "0.52844036", "0.5275552", "0.52...
0.6246594
1
Runs a single episode on the environment following the policy.
def run_episode(env, policy, experience_observers=None, test=False): # Optimization: rendering takes a lot of time. def maybe_render(env, action, reward, timestep): if test: render = env.render() render.write_text("Action: {}".format(str(action))) render.write_text("Reward: {}".format(reward))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_episode(self, mode=0, eps=0.):\n if mode==0:\n eps = 0.\n done = False\n score = 0 \n \n while not done:\n state = self.env_info.vector_observations[0] # get the current state\n action = self.agent.act(state, eps=eps) ...
[ "0.76647586", "0.75265527", "0.7446451", "0.7296921", "0.7284399", "0.72290254", "0.71253014", "0.7124329", "0.7113471", "0.711132", "0.7066778", "0.69308335", "0.6915585", "0.69102883", "0.68798035", "0.68423396", "0.67618114", "0.668217", "0.66798794", "0.6679265", "0.66760...
0.70803934
10
Returns the environment class specified by the type.
def get_env_class(environment_type): if environment_type == "vanilla": return city.CityGridEnv elif environment_type == "distraction": return city.DistractionGridEnv elif environment_type == "map": return city.MapGridEnv elif environment_type == "cooking": return cooking.CookingGridEnv elif en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_environment_class_by_name(environment_type):\n for cls in util.iter_subclasses(Environment):\n if cls.tool_name == environment_type:\n return cls\n raise EnvironmentUnavailable(\n f\"Unknown environment type '{environment_type}'\")", "def get_environment_class(conf, python)...
[ "0.82389814", "0.7236929", "0.67771494", "0.6746536", "0.65948284", "0.6437139", "0.6344269", "0.63292193", "0.6256534", "0.6174284", "0.61565256", "0.60773396", "0.5924187", "0.5919927", "0.58619225", "0.57948107", "0.57791364", "0.5763649", "0.57397777", "0.5733595", "0.573...
0.8176247
1
Add a value to the sketch.
def add(self, val): key = self.get_key(val) self.store.add(key) # Keep track of summary stats self._count += 1 self._sum += val if val < self._min: self._min = val if val > self._max: self._max = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_value(self, value):\n self.value = value", "def append_value(self, value):\n self.value += value", "def add(self, value):\n pass", "def add(self, value):", "def add(self, value):\n self.arr.append(value)", "def add(self, value):\n self._resolve_copies()\n ...
[ "0.77562946", "0.7472587", "0.7318282", "0.72282714", "0.71423835", "0.695267", "0.6935588", "0.69271195", "0.69076866", "0.6858983", "0.6736842", "0.6711433", "0.6589619", "0.65422803", "0.64677376", "0.64545023", "0.6430716", "0.6359177", "0.63571227", "0.63571227", "0.6344...
0.5986063
57
Two sketches can be merged only if their gamma and min_values are equal.
def mergeable(self, other): return self.gamma == other.gamma and self.min_value == other.min_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canBeMergedWith(self, other):", "def _merge_sanity_check(self, other):\n if self._fields is not None and (\n set(self.query.values_select) != set(other.query.values_select)\n or set(self.query.extra_select) != set(other.query.extra_select)\n or set(self.query.annotatio...
[ "0.561305", "0.5554772", "0.55113935", "0.5468042", "0.54112643", "0.5404954", "0.5348093", "0.53448844", "0.5326112", "0.53066695", "0.5288724", "0.5269989", "0.51783633", "0.51139086", "0.5101292", "0.5095481", "0.507951", "0.50213623", "0.5012159", "0.4999083", "0.4995614"...
0.7373218
0
Takes a list of revision dicts and extracts globals, includes, and pages Expects revision dict to be sorted already Returns 3tuple
def extract_data(data, rev=0): globs = {'_pages' : {}} includes = [] pages = [] pages_list = [] for datum in data: globs.update(datum.get('globals', {})) includes += datum.get('includes', []) datum_pages = datum.get('pages', []) for page in datum_pages: if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_revision_pages(url_text):\n\trevision_links = []\n\tgrammar_indices = [m.start() for m in re.finditer(\"grammar\", url_text.lower())]\n\t# print(\"Grammar indices:\",grammar_indices)\n\n\tfor i in range(len(grammar_indices)):\n\t\tgrammar_index = grammar_indices[i] \n\t\tprev_index = url_text[:grammar_ind...
[ "0.58713603", "0.5255621", "0.5184779", "0.5133159", "0.5087633", "0.50743926", "0.5060516", "0.50166947", "0.49424127", "0.49343994", "0.49080712", "0.48932", "0.48899907", "0.4886464", "0.48854086", "0.48630324", "0.48628467", "0.48229107", "0.48138183", "0.4796315", "0.478...
0.7212066
0
1 > spleen, 3 > left kidney, 4 > gallbladder, 5 > esophagus 6 > liver, 7 > stomach, 11 > pancreas, 14 > duodenum
def convert_tcia_labels(mask, keep_all_label=False): mask[np.isin(mask, [14])] = 0 # Remove duodenum label = [1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1] # no right kidney if keep_all_label: label += [0,0] return mask, label
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fo_shizzle_my_nizzle(n): \n if n < 0:\n n = \"fo\"\n elif n >= 1 and n < 50: \n n = \"shizzle\"\n elif n >= 50 and n <= 100:\n n = \"my\"\n elif n % 2 == 0 and n % 3 == 0 and n > 100:\n n = \"nizzle\"\n else:\n n = \"\"\n return n", "def solution(self):\n ...
[ "0.5961289", "0.57007194", "0.5665112", "0.56513536", "0.56026876", "0.55827665", "0.55325526", "0.552477", "0.5503733", "0.546128", "0.5445984", "0.54206806", "0.5409947", "0.5400704", "0.53799486", "0.5364139", "0.5361406", "0.53584707", "0.5339072", "0.5305817", "0.5295436...
0.0
-1
1 spleen, 6 liver, 11 pancreas
def convert_medical_decathlon_labels(mask, cohort, keep_all_label=False): label = 12*[0] if keep_all_label: label += [0,0] if cohort == 'liver': mask[mask == 2] = 6 mask[mask == 1] = 6 label[6] = 1 elif cohort == 'pancreas': mask[mask == 2] = 11 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reemplaza_tildes(palabra):", "def affiche_plateau(plateau):\n remplissage = ' ' * 30\n print(remplissage, end='')\n for i in range(1, 7, 2):\n print(\" \" + str(i), sep='', end='')\n print()\n for i in range(get_nb_lignes(plateau[0])):\n print(remplissage, end='')\n if i %...
[ "0.6889607", "0.648981", "0.61234885", "0.6100312", "0.59595793", "0.5941458", "0.5847579", "0.5844933", "0.58387846", "0.58319885", "0.5828353", "0.5821314", "0.5816315", "0.5805892", "0.5794173", "0.5782808", "0.5778222", "0.57483304", "0.57463837", "0.57396597", "0.5730707...
0.0
-1
1 spleen, 2 right kidney, 3 left kidney, 4 gall bladder, 5 esophagus 6 liver, 7 stomach, 8 aorta, 9 inferior vena cava, 10 portal and splenic vein, 11 pancreas, 12 left adrenal gland, 13 right adrenal gland.
def load_learn2reg(self, patient): start = time.time() ct_path = self.folder + 'img/' + patient + end array = load_sitk(ct_path)[np.newaxis, ...].astype(float)# Add 1 dimension array = array[:, ::-1, ::-1, :] if self.load_mask: if self.pseu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hangman_figure(attempt_left):\n if attempt_left == N_TURNS:\n print('___________')\n print('|')\n print('|')\n print('|')\n print('|')\n print('|')\n print('|')\n print('|')\n print('|_____')\n if attempt_left == N_TURNS - 1:\n print('...
[ "0.53578615", "0.53493005", "0.5348243", "0.5291687", "0.528967", "0.5280485", "0.52631533", "0.52626497", "0.52135915", "0.52076775", "0.5184838", "0.51696646", "0.5135104", "0.51240534", "0.5113022", "0.51092434", "0.5107674", "0.5095507", "0.50915027", "0.50757784", "0.505...
0.0
-1
1 > spleen, 3 > left kidney, 4 > gallbladder, 5 > esophagus 6 > liver, 7 > stomach, 11 > pancreas, 14 > duodenum
def load_tcia_pancreas(self, patient): start = time.time() ct_path = self.folder + 'nifti/' + patient + end array = load_sitk(ct_path)[np.newaxis, ...].astype(float)# Add 1 dimension # Correction of the orientation array = array[:, ::-1, ::-1, ::-1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fo_shizzle_my_nizzle(n): \n if n < 0:\n n = \"fo\"\n elif n >= 1 and n < 50: \n n = \"shizzle\"\n elif n >= 50 and n <= 100:\n n = \"my\"\n elif n % 2 == 0 and n % 3 == 0 and n > 100:\n n = \"nizzle\"\n else:\n n = \"\"\n return n", "def solution(self):\n ...
[ "0.596013", "0.5699823", "0.56656635", "0.56514853", "0.56017965", "0.5583126", "0.55336237", "0.5523108", "0.55034256", "0.5462615", "0.54474133", "0.54238445", "0.5409785", "0.5402162", "0.5380286", "0.5365057", "0.5361857", "0.5359248", "0.5339483", "0.53059673", "0.529754...
0.0
-1
1 kidney (left and right); 2 tumor
def load_kits(self, patient): start = time.time() ct_path = self.folder + patient + '/imaging' + end array = load_sitk(ct_path)[np.newaxis, ...].astype(float)# Add 1 dimension # Corection of orientation array = array[:, ::-1, ::-1, ::-1] if self.pseudo_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right_child(self, pos): \n return (2 * pos) + 1", "def boundary_op_n(v):\r\n h = list(v.dic.keys())[0]\r\n p = len(h) - 1\r\n s = P_chains([],[])\r\n if (p != 0) and (isinstance(h, str) != True) and (isinstance(h, frozenset) != True) and (isinstance(h, ImmutableMatrix) != True):\r\n ...
[ "0.5672551", "0.56521153", "0.5564578", "0.5561289", "0.5561289", "0.55153245", "0.54989326", "0.5496743", "0.54880667", "0.54845977", "0.5477298", "0.54354954", "0.5426299", "0.54248595", "0.54067", "0.538001", "0.5370772", "0.5370066", "0.5360813", "0.5335627", "0.53286135"...
0.0
-1
r"""Computes fingerprints of the input strings.
def _sdca_fprint(input, name=None): result = _op_def_lib.apply_op("SdcaFprint", input=input, name=name) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fingerprint(self, algorithm):", "def hash_all(strs, digest=None):\r\n digest = digest or hashlib.sha1()\r\n for s in strs:\r\n digest.update(s)\r\n return digest.hexdigest()", "def compute_fingerprint(self):\n\t\t# initialize tensorflow session\n\t\tsess = tf.InteractiveSession()\n\t\tclf_image = wb_...
[ "0.670117", "0.57371354", "0.55651414", "0.5493191", "0.54896253", "0.5443566", "0.543582", "0.5407759", "0.5404549", "0.53830826", "0.5371627", "0.53708583", "0.5342098", "0.5332482", "0.53251714", "0.5275193", "0.5273674", "0.5261942", "0.52594906", "0.52541286", "0.524208"...
0.0
-1
r"""Distributed version of Stochastic Dual Coordinate Ascent (SDCA) optimizer for linear models with L1 + L2 regularization. As global optimization objective is stronglyconvex, the optimizer optimizes the dual objective at each step. The optimizer applies each update one example at a time. Examples are sampled uniforml...
def _sdca_optimizer(sparse_example_indices, sparse_feature_indices, sparse_feature_values, dense_features, example_weights, example_labels, sparse_indices, sparse_weights, dense_weights, example_state_data, loss_type, l1, l2, num_loss_parti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize_sgd(beta, X, y, num_iterations, step_size):\n \n N = X.shape[0]\n P = X.shape[1]\n costs = []\n #variable step size\n if step_size == 'rm': #Robbins–Monro rule\n t0 = 2\n C = 1\n alpha = 0.5\n for i in range(num_iterations): \n j = random.ran...
[ "0.58430123", "0.57700384", "0.559415", "0.55526096", "0.5507653", "0.5500585", "0.54425055", "0.5425867", "0.5423508", "0.5412528", "0.54118615", "0.5398304", "0.53416395", "0.534044", "0.53132707", "0.52848023", "0.5283411", "0.5282129", "0.5275689", "0.5273703", "0.5230695...
0.68696374
0
r"""Applies L1 regularization shrink step on the parameters.
def _sdca_shrink_l1(weights, l1, l2, name=None): result = _op_def_lib.apply_op("SdcaShrinkL1", weights=weights, l1=l1, l2=l2, name=name) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l1_regularizer(scale):\n if isinstance(scale, numbers.Integral):\n raise ValueError('scale cannot be an integer: %s' % scale)\n if isinstance(scale, numbers.Real):\n if scale < 0.:\n raise ValueError('Setting a scale less than 0 on a regularizer: %g' %\n ...
[ "0.6826777", "0.61285764", "0.6045434", "0.59946656", "0.59823173", "0.5980362", "0.59782636", "0.5918527", "0.58867913", "0.57994086", "0.57767415", "0.57330287", "0.57198095", "0.56476456", "0.55648047", "0.5526961", "0.5520416", "0.5410303", "0.5392533", "0.5335324", "0.53...
0.61554843
1
Creates a new column called "state_name" which has the corresponding state name.
def convert_names(self): names_map = { "AL": "Alabama", "CT": "Conn", "CA": "Cali", "CO": "Colo", "DC": "District of Columbia" } self["state_name"] = self["abbrev"].map(names_map)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_name(self):\n return self.state.name if self.state else None", "def _state_name(self):\n return '{}_{}'.format(self.function_name, self.STATE_CONFIG_SUFFIX)", "def state_name(self):\n return task_states.to_str(self.state)", "def test_state_name(self):\n state = State('te...
[ "0.59332365", "0.5794769", "0.57316923", "0.56383705", "0.56352866", "0.5583133", "0.55823433", "0.5517401", "0.5467954", "0.5395791", "0.5355729", "0.53275317", "0.5282603", "0.52656084", "0.5245819", "0.5232131", "0.5232131", "0.52084243", "0.51937133", "0.514762", "0.51289...
0.57571137
2
This class holds the windows which shows the create experiment widget.
def __init__(self,currentExperiment): super(AmoebaCreateExperimentWindow,self).__init__() self.currentExperiment = currentExperiment #Create the window self.subWindow = QMdiSubWindow() self.widget = AmoebaCreateExperiment(self.subWindow,self.currentExperiment) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createWidgets(self):\n raise NotImplementedError", "def showUI(cls):\r\n win = cls()\r\n win.create()\r\n return win", "def build_window(self):\n\n main_frame = tk.Frame(self.root)\n main_frame.pack(fill='both')\n\n self.open_machine_learner_window_button = ...
[ "0.73238564", "0.70476335", "0.7020338", "0.69660527", "0.6964482", "0.695962", "0.6924835", "0.67237866", "0.6702971", "0.6695231", "0.6694868", "0.6665668", "0.666019", "0.6648684", "0.6624867", "0.6576935", "0.6558816", "0.6556843", "0.6536284", "0.65104073", "0.6472229", ...
0.7192625
1
This function shows the window which holds the widget.
def show(self): if AMOEBA_CREATE_EXPERIMENT_DEBUG: print "Show Window." self.subWindow.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_window(self):\n self.show()", "def show(self, window):\r\n\r\n return", "def show(self):\n self.wid.show()", "def show(self):\n self._window.show()", "def show(self):\n self.Show()", "def show(self):\n # * displays the window, after using either the icon...
[ "0.8502241", "0.8415356", "0.8357775", "0.79170626", "0.77707803", "0.7727727", "0.75549763", "0.7479209", "0.74743026", "0.74242014", "0.73494244", "0.7291545", "0.7291496", "0.7277171", "0.7250763", "0.7220816", "0.7209948", "0.7197237", "0.71558094", "0.71508753", "0.71490...
0.71113247
21
This function is triggered when the user tries to close the window. I'm not sure it fully works.
def closeEvent(self, event): print "Window closed" event.ignore() print "Hide window." self.subWindow.hide()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __window_close(self):\n pass", "def ev_windowclose(self, event: WindowEvent) -> None:", "def __onclosing(self):\n self.window.destroy()", "def onCloseWindow(self, event):\r\n\r\n self.Destroy()", "def ev_windowclose(self, event: tcod.event.WindowEvent) -> T | None:", "def closeEv...
[ "0.88118833", "0.8732062", "0.83870757", "0.8189104", "0.8009371", "0.80067825", "0.7978525", "0.7954626", "0.7857697", "0.77236134", "0.772265", "0.7715848", "0.76946735", "0.76637465", "0.7650199", "0.7618164", "0.75708306", "0.7559188", "0.75585526", "0.7537625", "0.753376...
0.7644354
15
This class stores the sub UIs involved in creating experiments, it also provides the basic control and framework for the revealing and hiding the correct UIs.
def __init__(self,subWindow,currentExperiment): super(AmoebaCreateExperiment,self).__init__() self.stage = 0 self.currentExperiment = currentExperiment #self.XMLWriter = ExperimentXMLWriter() self.XMLWriter = Amoeba_experiment() if AMOEBA_CREATE_EXPERIMENT_DEBUG: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ui(self, parent):\n view = View(\n Item(name=\"text\",\n show_label=False,\n editor=ImageTraitEditor(\n image=ImageResource(self.obj.name,\n search_path=[self.obj.parent.absolute_path]) )),\n id=\"puddle...
[ "0.62471116", "0.59212595", "0.58168197", "0.5744645", "0.57158315", "0.57158315", "0.5714117", "0.571169", "0.56999123", "0.56376207", "0.56022507", "0.5516006", "0.5484253", "0.5476682", "0.5469117", "0.5456683", "0.54334265", "0.5423621", "0.54227364", "0.5418681", "0.5391...
0.5426657
17
This function handles the showing and hiding of UIs when the program is being run.
def next_pressed(self): if AMOEBA_CREATE_EXPERIMENT_DEBUG: print "Next pressed." #Check stage. if self.stage==0: self.ShowAllInstruments.retrieve_selected() self.XMLWriter.instruments = self.ShowAllInstruments.retrieve_selected() if len(self.XMLWr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_gui():\n pass", "def show_gui():\n pass", "def isUIused():\n return False", "def showDisplay(self, type=\"DEFAULT\"):\n gd = mamba.getDisplayer() # <- trick to ensure the root windows is created and hidden\n if type==\"DEFAULT\":\n # First if there is any di...
[ "0.68529445", "0.6712458", "0.6654804", "0.65738904", "0.6489169", "0.6392772", "0.6144045", "0.6099471", "0.6089309", "0.59926564", "0.59250045", "0.5883586", "0.58749723", "0.5853369", "0.5846495", "0.5838198", "0.58305126", "0.5829298", "0.5809941", "0.58038217", "0.580006...
0.0
-1
Test prefix. Printed every test
def setUp(self): print("New test by Nikolay Melnik")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tests_results(self):\n\n for test in self.test_report:\n for detail in test:\n print detail + ': ', test[detail]", "def test(got, expected):\r\n if got == expected:\r\n prefix = \" OK \"\r\n else:\r\n prefix = \" X \"\r\n print(\"%s got: %s expec...
[ "0.668197", "0.6677865", "0.6658674", "0.65337527", "0.63311327", "0.62027156", "0.61702615", "0.6143053", "0.6114684", "0.61015594", "0.60133135", "0.6003737", "0.5984142", "0.59417367", "0.5937343", "0.59372973", "0.592105", "0.59095734", "0.59049034", "0.58890426", "0.5883...
0.0
-1
Testing Tuna is not null
def test_Tuna(self): tuna = Tuna("1", "2", "3", "4") self.assertIsNotNone(tuna)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testIsNullTrueAgain(self):\n val = is_null('') \n self.assertTrue(val)", "def test_non_thesis(non_thesis):\n assert non_thesis is None", "def nulltest():", "def testIsNullTrue(self):\n val = is_null(\"\") \n self.assertTrue(val)", "def is_null(space, w_obj):\n ...
[ "0.66639656", "0.6589096", "0.6544759", "0.6537418", "0.65249217", "0.6464309", "0.6438317", "0.6438317", "0.6416694", "0.6395729", "0.6372581", "0.6337188", "0.63306767", "0.6319348", "0.6262661", "0.62500733", "0.61865604", "0.6135527", "0.6083987", "0.6083987", "0.6083662"...
0.6774843
0
Testing Tuna's setTunasFeatures method works
def test_setTunaFeatures(self): tuna = Tuna() array = ["1", "2", "3", "4"] tuna.setTunaFeatures(array) self.assertEqual(tuna.getTunaFeatures(), array)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_getTunaFeatures(self):\n tuna = Tuna(\"1\", \"2\", \"3\", \"4\")\n array = [\"1\", \"2\", \"3\", \"4\"]\n self.assertEqual(tuna.getTunaFeatures(), array)", "def _initialize_with_tune_context(self, context: \"TuneContext\") -> None:\n raise NotImplementedError", "def prepare...
[ "0.6467389", "0.6120855", "0.5748472", "0.5742488", "0.5711489", "0.56948525", "0.56849676", "0.5643649", "0.5622461", "0.5612863", "0.5570076", "0.5564452", "0.5562412", "0.5538345", "0.5495508", "0.5485487", "0.54830647", "0.5479651", "0.5453535", "0.54154104", "0.5412377",...
0.75750804
0
Testing Tuna's getTunasFeatures method works
def test_getTunaFeatures(self): tuna = Tuna("1", "2", "3", "4") array = ["1", "2", "3", "4"] self.assertEqual(tuna.getTunaFeatures(), array)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_setTunaFeatures(self):\n tuna = Tuna()\n array = [\"1\", \"2\", \"3\", \"4\"]\n tuna.setTunaFeatures(array)\n self.assertEqual(tuna.getTunaFeatures(), array)", "def findFeatures(self):\n\t\tpass", "def test__extract_features(self):\n text_sample = \"I really really l...
[ "0.71556205", "0.6340565", "0.61837447", "0.5806672", "0.5796584", "0.57937485", "0.57770115", "0.57497746", "0.5737169", "0.5710892", "0.5675815", "0.5668341", "0.5659601", "0.55376226", "0.5520661", "0.55035144", "0.5499606", "0.5498502", "0.54887605", "0.5487713", "0.54858...
0.7249121
0
Create "can_approve_estimated_completion_date" permission and add it to the "Admin" group.
def add_permissions(apps, schema_editor): Permission = apps.get_model("auth", "Permission") Group = apps.get_model("auth", "Group") ContentType = apps.get_model("contenttypes", "ContentType") permission, created = Permission.objects.get_or_create( codename="can_approve_estimated_completion_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_authorize(cls, user, obj):\n if not obj.delivery.deadline.assignment_group.is_examiner(user):\n raise PermissionDenied()", "def write_authorize(cls, user, obj):\n if not models.AssignmentGroup.published_where_is_examiner(user).filter(id=obj.deadline.assignment_group.id):\n ...
[ "0.61045885", "0.5988743", "0.5814144", "0.5738462", "0.5411797", "0.5401533", "0.5399722", "0.5363404", "0.53633904", "0.53270596", "0.52686125", "0.523226", "0.52310044", "0.5126954", "0.51135796", "0.5107107", "0.5074804", "0.5071565", "0.50627375", "0.5031271", "0.5008885...
0.76646936
0
Remove "can_approve_estimated_completion_date" permission and remove it from the "Admin" group.
def remove_permissions(apps, schema_editor): Permission = apps.get_model("auth", "Permission") Group = apps.get_model("auth", "Group") permission = Permission.objects.get( codename="can_approve_estimated_completion_date", ) admin_group = Group.objects.get(name="Administrator") admin_g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delPermission(self,request):\n request.needAuthType(request.ADMIN)\n request.checkArgs(\"admin_username\",\"perm_name\")\n request.getAuthNameObj().canDo(\"CHANGE ADMIN PERMISSIONS\")\n perm_actions.getActionManager().deletePermission(request[\"admin_username\"],request[\"perm_name\...
[ "0.63204193", "0.60559267", "0.5868938", "0.5853292", "0.5768508", "0.5714673", "0.5648865", "0.56440014", "0.5544115", "0.55229086", "0.55072224", "0.54663765", "0.5419387", "0.5413648", "0.53388613", "0.5335905", "0.53285515", "0.5316271", "0.5315049", "0.5301109", "0.52911...
0.81578374
0
Prevent values being changed.
def __setattr__(self, name, value): raise AttributeError("You cannot modify attributes on a %s" % self.__class__.__name__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore_value_changes(self):\n return self._parent.ignore_value_changes", "def ignore_value_changes(self, value):\n self._parent.ignore_value_changes = value", "def allow_values_only(self, allow_values_only):\n\n self._allow_values_only = allow_values_only", "def modifyNotValuableComp...
[ "0.72520024", "0.7134793", "0.6745022", "0.6565378", "0.6425409", "0.63827246", "0.6363821", "0.62904686", "0.62816423", "0.62450707", "0.6216821", "0.61870974", "0.6140225", "0.60032874", "0.5918717", "0.5918717", "0.5918717", "0.5873133", "0.585663", "0.58394444", "0.583944...
0.0
-1
export GPU for AD
def export_gpu(entity=None): status = False exportGrp = config.geoGrp res = entity.task_res() libPath = entity.libPath() if res: abcName = entity.libName(config.libName.get('gpu'), res, ext='abc') # name without ext basename = os.path.splitext(abcName)[0] gpuName = '{0}/{1}'.format(libPath, abcNam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetGPU():\n return option['device_id']", "def create_gpu_device_if_present():\n d = dpctl.SyclDevice(\"gpu,cpu\")\n print(\"Selected \" + (\"GPU\" if d.is_gpu else \"CPU\") + \" device\")", "def add_gpu_and_mpi_marks():\n pass", "def create_gpu_device():\n d1 = dpctl.SyclDevice(\"gpu\")\n ...
[ "0.62095964", "0.6097989", "0.59566474", "0.5911981", "0.585888", "0.5828839", "0.57508516", "0.57136184", "0.5679205", "0.56655836", "0.5627468", "0.55777365", "0.55777365", "0.5537934", "0.55370134", "0.55342036", "0.54773647", "0.5465165", "0.54110056", "0.53959876", "0.53...
0.70596236
0