query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Transforms dict to flatten structure by join all dict keys with ``sep`` until MutableMapping occurs.
def flatten(d: MutableMapping, sep: str = ".", parent_key: str = "") -> dict: items = [] for k, v in d.items(): new_key = parent_key + sep + k if parent_key else k if isinstance(v, MutableMapping): items.extend(flatten(v, sep=sep, parent_key=new_key).items()) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten_dict(d, sep=' ', parent_key=''):\n items = []\n for k, v in d.items():\n new_key = parent_key + sep + k if parent_key else k\n if isinstance(v, collections.MutableMapping):\n items.extend(flatten_dict(v, sep=sep, parent_key=new_key).items())\n else:\n it...
[ "0.7274688", "0.7247912", "0.7196502", "0.71728605", "0.7101399", "0.7067818", "0.6829241", "0.6765176", "0.6393176", "0.627671", "0.626663", "0.618631", "0.61208874", "0.5953684", "0.5930609", "0.58431196", "0.5776763", "0.57200116", "0.5693543", "0.565999", "0.55605745", ...
0.7563938
0
Function used to test main menu console display
def main_menu_for_testing(): print(PROMPT_TEXT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printMenu():\n # tWelc = PrettyTable(['Welcome to the CLI-of the repository classifier'])\n print('Welcome to the CLI of the repository classifier')\n print(strStopper1)\n t = PrettyTable(['Action', ' Shortcut '])\n t.add_row(['Show Menu', '- m -'])\n t.add_row([' Predict repositori...
[ "0.73332584", "0.7251674", "0.7246684", "0.7195748", "0.7183804", "0.7129607", "0.71240675", "0.7081151", "0.70648426", "0.7050974", "0.7050178", "0.69434446", "0.69364333", "0.6925488", "0.6923752", "0.69177043", "0.6894282", "0.68455267", "0.6817587", "0.6811875", "0.677533...
0.8290328
0
function to get price
def getprice(): print("Get price") latest_price = get_latest_price(item_code) return latest_price
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_price(self):\r\n return self.price", "def get_price():\n \n #Teacher's code. Could not get it working.\n #price = db(db.product.name == productName).select(db.product.price)[0].price\n \n \n return (200)", "def get_price(self):\n return self.price", "def get_price(self...
[ "0.8239355", "0.8047311", "0.7972021", "0.7972021", "0.7972021", "0.7910661", "0.76940036", "0.7670304", "0.76696604", "0.7604765", "0.75826555", "0.7546183", "0.7546183", "0.754515", "0.75414306", "0.75243163", "0.75241107", "0.74605626", "0.7430736", "0.74273604", "0.742297...
0.8415335
0
This function adds an item that's neither furniture nor an applicance
def add_non_furniture_nor_appliance(itemcode, itemdescription, itemprice, itemrentalprice): newitem = Inventory(itemcode, itemdescription, itemprice, itemrentalprice) FULLINVENTORY[itemcode] = newitem.returnasdictionary()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(self, item):\n if item.price > 0:\n self.items.append(item)\n else:\n raise ItemPriceIsBad(\"zla cena\")", "def add_item(self):\n item = LibGen.create_item()\n if not self.item_exists(item.call_number):\n self.item_list[item.call_number] =...
[ "0.7027364", "0.6905118", "0.6860536", "0.66874045", "0.6638811", "0.66314757", "0.6595261", "0.65847296", "0.6537978", "0.6508621", "0.64216465", "0.6421297", "0.63848126", "0.6372808", "0.6366572", "0.63647753", "0.6332572", "0.62825865", "0.6280384", "0.6265327", "0.626143...
0.69818914
1
This function adds a new piece of furniture
def add_furniture(itemcode, description, marketprice, rentalprice): material = input("Enter item material: ") size = input("Enter item size (S,M,L,XL): ") newitem = Furniture(itemcode, description, marketprice, rentalprice , material, size) FULLINVENTORY[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_data():\n add_furniture(\"invoice_file.csv\", \"Elisa Miles\", \"LR04\", \"Leather Sofa\", 25.00)\n add_furniture(\"invoice_file.csv\", \"Edward Data\", \"KT78\", \"Kitchen Table\", 10.00)\n add_furniture(\"invoice_file.csv\", \"Alex Gonzales\", \"BR02\", \"Queen Mattress\", 17.00)", "def a...
[ "0.62475324", "0.62461716", "0.6201754", "0.59682226", "0.59502137", "0.5877744", "0.582453", "0.5818941", "0.5739219", "0.5723073", "0.570861", "0.5664113", "0.56599915", "0.56491876", "0.56121314", "0.5605458", "0.5567828", "0.55588484", "0.55379635", "0.55082446", "0.55019...
0.6665538
0
This function adds a new appliance
def add_appliance(itemcode, description, marketprice, rentalprice): itembrand = input("Enter item brand: ") itemvoltage = input("Enter item voltage: ") newitem = ElectricAppliances \ (itemcode, description, marketprice, rentalprice, itembrand, itemvoltage) FULLINVENTORY[itemcode] = ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_service_appliance_create(self, resource_dict):\n pass", "def post_service_appliance_set_create(self, resource_dict):\n pass", "def add(isamAppliance, name, chainName, requestType, description=None, tokenType=None, xPath=None, signResponses=None,\n signatureKey=None, validateReques...
[ "0.7048834", "0.6507756", "0.6488737", "0.62472814", "0.6120104", "0.6003", "0.5959248", "0.5914692", "0.5910571", "0.58569515", "0.5808944", "0.57972735", "0.57778907", "0.56965375", "0.56749684", "0.5672457", "0.5582382", "0.5528791", "0.55212736", "0.55212736", "0.54711425...
0.71400857
0
This function gets item information from user input.
def iteminfo(): itemcode = input("Enter item code: ") if itemcode in FULLINVENTORY: printdict = FULLINVENTORY[itemcode] for key, value in printdict.items(): print("{}:{}".format(key, value)) else: print("Item not found in inventory")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_info():\n item_code = get_input(\"Enter item code: \")\n if item_code in FULL_INVENTORY:\n print_dict = FULL_INVENTORY[item_code]\n output = \"\"\n for key, value in print_dict.items():\n output += (\"{}:{}{}\".format(key, value, \"\\n\"))\n else:\n output =...
[ "0.7280541", "0.70029044", "0.69306713", "0.6430006", "0.62070966", "0.6205863", "0.6202418", "0.6108849", "0.60898966", "0.6068545", "0.60520583", "0.6003607", "0.59876406", "0.5971087", "0.59572124", "0.59557474", "0.59229845", "0.58999175", "0.5898057", "0.58901256", "0.58...
0.73138
0
function to exit the program
def exitprogram(): sys.exit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exit_program():\n quit()", "def quit_program():\n sys.exit()", "def exit():\n sys.exit(1)", "def exit_program():\n print(\"Good Bye! Happy Searching...\")", "def exit_program():\n print(\"Good bye\")\n sys.exit()", "def quit():\n\tsys.exit()", "def exit(self):\n pass", ...
[ "0.8943921", "0.86412996", "0.863671", "0.85478306", "0.85065365", "0.83382404", "0.8133257", "0.810283", "0.8067112", "0.8050405", "0.8037906", "0.80265456", "0.80035913", "0.7992397", "0.7979227", "0.7921961", "0.7906636", "0.78978676", "0.78659403", "0.7806738", "0.7768188...
0.882551
1
Function for training an agent on a simplified version of blackjack with a passive dealer. noOfDecks is the number decks the agents trains with sampleSpaceSearching specifies the sampleSpaceExploitation specifies the method can be one of QL, TD, SARSA gamma is the discount factor qTable has None set as default, if usin...
def agentTraining(noOfDecks, sampleSpaceSearching, sampleSpaceExploitation, method, gamma, qTable=None): deckSize = noOfDecks*52 optimalScore = 0 # winning score and losing Score egreedyScore = 0 pO = [0,0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_q_learner(board: Board, num_rounds: int,\n ignorance_bias: float = 0,\n discount_rate: float = 0.9,\n learning_rate: float = 0.1,\n title: str = '') -> dict:\n labels = [DRAW, TabularQLearning.name, Random.name]\n outcome_c...
[ "0.5567019", "0.5432797", "0.5263155", "0.51888835", "0.50820935", "0.5081891", "0.50764287", "0.50704557", "0.498731", "0.4965759", "0.49481538", "0.492848", "0.4920138", "0.49160117", "0.4914718", "0.4903218", "0.48983887", "0.48924682", "0.48772675", "0.48746777", "0.48680...
0.71118605
0
Load T5 model to generate a summarization given a string.
def t5(model: str = 'base', **kwargs): model = model.lower() if model not in _t5_availability: raise Exception( 'model not supported, please check supported models from malaya.summarize.available_t5()' ) path = PATH_SUMMARIZE['argmax'] s3_path = S3_PATH_SUMMARIZE['argmax'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSBMLFromAntimony(self, input_string):\n import tellurium as te\n # Convert input to string.\n inputs = self.__class__._convert(input_string)\n # Try different ways to load the model\n try:\n rr = te.loada(inputs)\n except:\n rr = te.loadSBMLModel(inputs)\n sbml = rr.getSBML()\...
[ "0.5915727", "0.5872964", "0.5837303", "0.5820889", "0.5710477", "0.5653279", "0.56510633", "0.56480443", "0.55905664", "0.5564427", "0.55512595", "0.55386823", "0.5524538", "0.5513015", "0.5511393", "0.54993755", "0.54685605", "0.5464368", "0.544676", "0.54068094", "0.540332...
0.666922
0
Test navigation stops at a skip table
def test_fkey_nav_stops_on_skip(dumper, db): dumper.reader.load_db( db.create_sample( 5, fkeys=[ ("table1", "t2id", "table2", "id"), ("table2", "t3id", "table3", "id"), ("table3", "t4id", "table4", "id"), ], ) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_skip(self, d_stmt, table): \n pass", "def skip(self):\n self.click_back_button()", "def test_skip_list_no_skip(self):\n mock_sqr = SequenceRun()\n mock_sqr.instrument_run_id = TestConstant.instrument_run_id.value\n\n mock_workflow = Workflow()\n mock_workflo...
[ "0.70150274", "0.6573685", "0.63004774", "0.6106772", "0.60653186", "0.6051848", "0.59794104", "0.59083045", "0.58860916", "0.5876885", "0.5817791", "0.5769484", "0.57677996", "0.56681204", "0.5664895", "0.56210583", "0.56095314", "0.55910975", "0.5558222", "0.5557147", "0.55...
0.6938162
1
Test that table4 gets two referrers.
def test_two_referrers(dumper, db): dumper.reader.load_db( db.create_sample( 5, fkeys=[ ("table1", "t2id", "table2", "id"), ("table1", "t3id", "table3", "id"), ("table2", "t24id", "table4", "id"), ("table3", "t34id", "ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_table_reference(self):\n networktables_mock = unittest.mock.Mock()\n table_mock = unittest.mock.Mock()\n # When table is gotten from first network, table will be None,\n # from second network will return table_mock\n networktables_mock.getTable.side_effect = [None, tabl...
[ "0.6169973", "0.59606314", "0.58490497", "0.5710142", "0.56719786", "0.56025946", "0.5576208", "0.5477965", "0.54200256", "0.5417123", "0.541344", "0.54027116", "0.53939325", "0.5388289", "0.535975", "0.535975", "0.53258467", "0.5259586", "0.5230053", "0.5226761", "0.520357",...
0.75790805
0
Maps a `TextResponse` to a `ScrapyYelpItem` instance.
def _handle_search_results(self, response: TextResponse) -> ScrapyYelpItem: # get yConfig pattern = re.compile(r"""\n\s+yConfig\s+=\s+""", re.MULTILINE | re.DOTALL) soup = BeautifulSoup(response.text, "html.parser") script = soup.find("script", text=pattern) myjson = script.get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_items_from_response(self, response):\n raise NotImplementedError", "def parse(self, response):\n\n # open('temp.html', 'w').write(response.body)\n # open('temp.txt', 'w').write(\"Request: %s\\n\\nResponse: %s\\n\"\n # % (response.request.headers\n ...
[ "0.5863402", "0.5536595", "0.5519636", "0.55046314", "0.5458947", "0.5434426", "0.54264176", "0.5373678", "0.53413665", "0.5331993", "0.5331993", "0.5286654", "0.5270431", "0.5265433", "0.5265143", "0.52518946", "0.5240944", "0.5237736", "0.5213741", "0.5212441", "0.51974386"...
0.57989264
1
Creates a tximport job for all eligible experiments.
def run_tximport(): eligible_experiments = ( Experiment.objects.annotate(num_organisms=Count("organisms")) .filter(num_organisms=1, technology="RNA-SEQ", num_processed_samples=0) .prefetch_related("samples__results") ) paginator = Paginator(eligible_experiments, PAGE_SIZE) page ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_jobs(self):\n transfer_args = [\"analysis_type\", \"perturbation\", \"num_permutations\", \"permutation_test_statistic\", \"loss_function\",\n \"importance_significance_level\", \"window_search_algorithm\", \"window_effect_size_threshold\"]\n jobs = [None] * self.num...
[ "0.5502146", "0.5343556", "0.5280639", "0.5255027", "0.52541727", "0.5247221", "0.51361585", "0.5103018", "0.5095308", "0.50904", "0.50766253", "0.50722516", "0.50399065", "0.50051594", "0.49917382", "0.49794272", "0.4973701", "0.49311364", "0.49294502", "0.49134165", "0.4909...
0.7368491
0
This command just calls run_tximport. The functionality has been broken out into a separate function to make testing easy.
def handle(self, *args, **options): run_tximport()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tximport():\n eligible_experiments = (\n Experiment.objects.annotate(num_organisms=Count(\"organisms\"))\n .filter(num_organisms=1, technology=\"RNA-SEQ\", num_processed_samples=0)\n .prefetch_related(\"samples__results\")\n )\n\n paginator = Paginator(eligible_experiments, PA...
[ "0.6477963", "0.5951373", "0.59049964", "0.58939797", "0.5767353", "0.57179666", "0.561629", "0.5597503", "0.55944455", "0.55595803", "0.5530024", "0.55263394", "0.5461847", "0.5396504", "0.53551364", "0.53316545", "0.5313355", "0.5313216", "0.53054243", "0.5288276", "0.52847...
0.79056346
0
Returns all the eigenvalues such that they are no smaller than a specific fraction (specified by 'tolerance') than the leading eigenvalue. Calculation of eigenvalues is done using power method.
def runpower(matrix, n, tolerance, max_num=None, return_vector=True): calculate_next = True eigenvalue_list = [] eigenvector_list = [] leading_eigenvalue = np.nan while(calculate_next): new_eigenvalue, v = runpower_one(matrix, n) if np.isnan(leading_eigenvalue): leading_eigenvalue = new_eigenvalue eigenv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_eig(self, tolerance=None):\r\n E, V = scipy.linalg.eig(self.data)\r\n E = pd.Series(E.real, name=\"EIG\")\r\n V = pd.DataFrame(V.real)\r\n if tolerance is not None:\r\n E[E/E.max() < tolerance] = 0\r\n return E, V", "def find_single_eigen(Potential,\n ...
[ "0.6628999", "0.58906764", "0.5885283", "0.5809132", "0.578668", "0.5684383", "0.5668739", "0.55259025", "0.5502824", "0.54893297", "0.54460555", "0.5380072", "0.5377571", "0.5310267", "0.52363473", "0.5226423", "0.521577", "0.5193682", "0.5142848", "0.5103287", "0.51030314",...
0.5947329
1
Gets the generate of this V1Parameter. Generate specifies the generator to be used to generate random string from an input value specified by From field. The result string is stored into Value field. If empty, no generator is being used, leaving the result Value untouched. Optional.
def generate(self): return self._generate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self):\n return self.gen.generate()", "def get_random(self):\n base_genom = \"1\" * sum(self._size_var)\n return utils.randomise_a_string(base_genom)", "def generate_value(self, variable):\n\t\tif variable in self._generators:\n\t\t\treturn self._generators[variable]()", "de...
[ "0.64546764", "0.5576315", "0.55454814", "0.5474573", "0.54512656", "0.54429454", "0.5356392", "0.5343292", "0.53388745", "0.53147745", "0.52887416", "0.52003443", "0.51940346", "0.5169374", "0.5155545", "0.5113704", "0.4906808", "0.49024713", "0.4866895", "0.48545745", "0.48...
0.6180861
1
Sets the generate of this V1Parameter. Generate specifies the generator to be used to generate random string from an input value specified by From field. The result string is stored into Value field. If empty, no generator is being used, leaving the result Value untouched. Optional.
def generate(self, generate): self._generate = generate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setgenerate(self, generate, genproclimit=None):\n if genproclimit is None:\n return self.proxy.setgenerate(generate)\n else:\n return self.proxy.setgenerate(generate, genproclimit)", "def set_generator(self, gen):\n self.generator = gen", "def generate(self):\n ...
[ "0.6531225", "0.563057", "0.5545723", "0.54726917", "0.53758997", "0.53641516", "0.5120147", "0.5076219", "0.50427204", "0.50409055", "0.5016178", "0.49984923", "0.49915373", "0.49669093", "0.49151403", "0.49036708", "0.48348758", "0.47663215", "0.47656053", "0.47320244", "0....
0.6589432
0
Gets the required of this V1Parameter.
def required(self): return self._required
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def required(self) -> pulumi.Input[bool]:\n return pulumi.get(self, \"required\")", "def required(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"required\")", "def required(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"required\")", "def required(...
[ "0.6975728", "0.69183755", "0.69183755", "0.68999743", "0.66399527", "0.6597883", "0.6597883", "0.6591579", "0.6480089", "0.6414753", "0.6408342", "0.63553196", "0.634542", "0.6259731", "0.619959", "0.6185172", "0.6085996", "0.6053564", "0.6019357", "0.60031337", "0.5997075",...
0.72549653
1
performs bee latin on a word
def latinize_word(word): if word[0].lower() in 'bcdfghjklmnpqrstvwxyz': word = word[1:] + word[0] + 'uzz' else: word += 'buzz' return word.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makePigLatin(word): \n m = len(word)\n vowels = \"a\", \"e\", \"i\", \"o\", \"u\", \"y\" \n # short words are not converted \n if m<3 or word==\"the\":\n return word\n else:\n for i in vowels:\n if word.find(i) < m and word.find(i) != -1:\n m = word.find(...
[ "0.7014333", "0.68506026", "0.6817503", "0.68015426", "0.67063785", "0.6697197", "0.66542006", "0.66423786", "0.6613933", "0.65876013", "0.6554287", "0.65249485", "0.6509555", "0.6451943", "0.6451328", "0.62652266", "0.62107694", "0.61959195", "0.61852115", "0.6183603", "0.61...
0.755812
0
performs bee latin on a sentence
def latinize_sentence(sentence): words = sentence.split() latanized_words = [latinize_word(word) for word in words] return " ".join(latanized_words)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latinize_word(word):\n if word[0].lower() in 'bcdfghjklmnpqrstvwxyz':\n word = word[1:] + word[0] + 'uzz'\n else:\n word += 'buzz'\n return word.lower()", "def translate_leet(phrase):", "def makePigLatin(word): \n m = len(word)\n vowels = \"a\", \"e\", \"i\", \"o\", \"u\", \"y...
[ "0.6640873", "0.6486938", "0.64498246", "0.6348416", "0.62460566", "0.62244415", "0.62036693", "0.6169505", "0.6156668", "0.61367595", "0.6124818", "0.60969657", "0.6052409", "0.60199636", "0.5999959", "0.5992173", "0.59843165", "0.59512913", "0.5942349", "0.59016085", "0.588...
0.70778024
0
visualization the curves of accuracies for 4 groups of data
def ridge_cross_validation_visualization(lambdas, accuracies): colors = ['r', 'b', 'y', 'g'] labels = ['group_0', 'group_1', 'group_2', 'group_3'] for i in range(len(accuracies)): plt.semilogx(lambdas, accuracies[i], marker=".", color=colors[i], label=labels[i]) plt.xlabel("lambda") plt.ylab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poly_cross_validation_visualization(polys, accuracies):\n colors = ['r', 'b', 'y', 'g']\n labels = ['group_0', 'group_1', 'group_2', 'group_3']\n for i in range(len(accuracies)):\n plt.plot(polys, accuracies[i], marker=\".\", color=colors[i], label=labels[i])\n plt.xlabel(\"degree\")\n pl...
[ "0.6742017", "0.63184434", "0.6281022", "0.6154352", "0.6150753", "0.6112408", "0.6109629", "0.6059841", "0.60506064", "0.59791845", "0.5905144", "0.589848", "0.5877987", "0.5873221", "0.58700645", "0.5860425", "0.58550936", "0.57986194", "0.5764808", "0.5737652", "0.5733059"...
0.64134616
1
visualization the curves of accuracies for 4 groups of data
def poly_cross_validation_visualization(polys, accuracies): colors = ['r', 'b', 'y', 'g'] labels = ['group_0', 'group_1', 'group_2', 'group_3'] for i in range(len(accuracies)): plt.plot(polys, accuracies[i], marker=".", color=colors[i], label=labels[i]) plt.xlabel("degree") plt.ylabel("accur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ridge_cross_validation_visualization(lambdas, accuracies):\n colors = ['r', 'b', 'y', 'g']\n labels = ['group_0', 'group_1', 'group_2', 'group_3']\n for i in range(len(accuracies)):\n plt.semilogx(lambdas, accuracies[i], marker=\".\", color=colors[i], label=labels[i])\n plt.xlabel(\"lambda\"...
[ "0.6412988", "0.63201135", "0.6280579", "0.6154756", "0.615224", "0.61128354", "0.6112", "0.60598713", "0.60510933", "0.59793735", "0.590519", "0.5898064", "0.5879346", "0.58724684", "0.58703846", "0.5861235", "0.5856768", "0.5799494", "0.5764531", "0.5738486", "0.5734699", ...
0.67417324
0
Generate a code challenge based on the code verifier
def code_challenge(verifier): digest = hashlib.sha256(verifier).digest() return base64.urlsafe_b64encode(digest).rstrip(b'=')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_s256_code_challenge(code_verifier: str) -> str:\n code_verifier_bytes = code_verifier.encode(\"utf-8\")\n data = hashlib.sha256(code_verifier_bytes).digest()\n return base64.urlsafe_b64encode(data).rstrip(b\"=\").decode()", "def generate_challenge(self):\n return None", "def code_ver...
[ "0.69656956", "0.6586449", "0.63019806", "0.6227294", "0.6168231", "0.613077", "0.5960524", "0.59492934", "0.5901655", "0.5888677", "0.58578885", "0.5798587", "0.5792239", "0.57643", "0.56782377", "0.56432956", "0.56415486", "0.56318617", "0.56081", "0.5600885", "0.5582755", ...
0.7129563
0
Basic login page with an Authenticate with Okta button. Clicking the button creates an auth URL using the create_auth_url function
def login_page(): text = '<a href="%s">Authenticate with Okta</a>' return text % create_auth_url()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login(self):", "def click_login_button(self):", "def login():", "def login():", "def login():\n auth_state = str(uuid.uuid4())\n SESSION.auth_state = auth_state\n\n # For this sample, the user selects an account to authenticate. Change\n # this value to 'none' for \"silent SSO\" behavior, a...
[ "0.6773254", "0.67727005", "0.6651313", "0.6651313", "0.66403973", "0.6591949", "0.6591949", "0.65784377", "0.649015", "0.649015", "0.64519083", "0.64506674", "0.64501876", "0.643909", "0.64104444", "0.6405294", "0.63967144", "0.63705593", "0.6343384", "0.63431525", "0.633315...
0.8345763
0
This builds an auth url that Okta will accept for the Authorization Code Flow w/ PKCE Verification, the most secure method of auth Okta currently supports.
def create_auth_url(): state = secrets.token_hex(16) nonce = secrets.token_hex(16) credentials = { 'response_type': 'code', 'redirect_uri': REDIRECT_URI, 'client_id': CLIENT_ID, # Define your app scopes here. If you're building an OIDC app you'll # want to stick to th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genauthurl(redirect=False, scope=False):\n if not scope:\n scope = c.oauth_scope\n\n return (c.sandbox_host if c.sandbox else c.production_host) \\\n + 'oauth/v2/authenticate?client_id=' \\\n + c.client_id \\\n + '&response_type=code&scope=' \\\n + scope \\\n + (...
[ "0.71090627", "0.70726216", "0.7036695", "0.69821894", "0.698053", "0.6846295", "0.68217844", "0.67963576", "0.6780689", "0.67448413", "0.67369276", "0.6623615", "0.65924555", "0.65157264", "0.64937294", "0.6484383", "0.6441348", "0.6436343", "0.64359856", "0.6376054", "0.635...
0.8451099
0
Okta API call to get all groups in the Okta instance
def list_groups(access_token): request_url = OKTA_URL + "api/v1/groups" headers = {"Authorization": "Bearer " + access_token} group_request = requests.get(request_url, headers=headers).json() return group_request
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups(self):\n #return self.get('{}/groups'.format(ApiVersion.A1.value))\n return self.get('{}/groups'.format(ApiVersion.CM1.value))", "def get_all_groups():\n return jsonify(admin.get_all_groups(current_app.scoped_session()))", "def test_api_v1_groups_get(self):\n pass", "def getGroup()...
[ "0.7600449", "0.74905264", "0.74392587", "0.7231566", "0.71380556", "0.7119134", "0.699967", "0.6972123", "0.69673723", "0.69673723", "0.6927851", "0.69142586", "0.6852541", "0.6844132", "0.6829895", "0.6822603", "0.68164873", "0.67933", "0.67842287", "0.6769479", "0.67690927...
0.7565454
1
Handle GET requests for single bug/ticket type
def retrieve(self, request, pk=None): try: bug_type = BugType.objects.get(pk=pk) serializer = BugTypeSerializer(bug_type, context={'request': request}) return Response(serializer.data) except Exception as ex: return HttpResponseServerError(ex)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve(self, request, pk=None):\n try:\n # `pk` is a parameter to this function, and\n # Django parses it from the URL route parameter\n # http://localhost:8000/bugs/2\n #\n # The `2` at the end of the route becomes `pk`\n bug = Bug.o...
[ "0.6436556", "0.64304864", "0.60500634", "0.60193324", "0.599827", "0.5934622", "0.5885566", "0.58757126", "0.5795733", "0.5785718", "0.5673332", "0.56673497", "0.559671", "0.5555192", "0.55256176", "0.55193824", "0.55193824", "0.5492176", "0.54795", "0.5441099", "0.5439689",...
0.7118445
0
Handle GET requests to get all bug/ticket types
def list(self, request): bug_types = BugType.objects.all() # Note the additional `many=True` argument to the # serializer. It's needed when you are serializing # a list of objects instead of a single object. serializer = BugTypeSerializer( bug_types, many=True, conte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self, request):\n # Get all game records from the database\n bugs = Bug.objects.all()\n\n # Support filtering bugs by type\n # http://localhost:8000/bugs?type=1\n type = self.request.query_params.get('type', None) #pylint: disable=redefined-builtin\n if type is...
[ "0.66452366", "0.63690084", "0.61269605", "0.57734144", "0.57447815", "0.5692835", "0.5667319", "0.56542647", "0.55724263", "0.55456376", "0.54324365", "0.5426201", "0.54096943", "0.5403339", "0.53793675", "0.534718", "0.5314895", "0.5250948", "0.524005", "0.52391046", "0.523...
0.7096532
0
Handle PUT requests for a bug types
def update(self, request, pk=None): bug_type = BugType.objects.get(pk=pk) bug_type.label = request.data["label"] bug_type.save() # 204 status code means everything worked but the # server is not sending back any data in the response return Response({}, status=status.HTTP...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self):\n type_model = request.json\n\n type_model = namedtuple(\"Type\", type_model.keys())(*type_model.values())\n repository = TypeRepository(\n FLASK_APP.config[\"DBUSER\"],\n FLASK_APP.config[\"DBPASS\"],\n FLASK_APP.config[\"DBHOST\"],\n ...
[ "0.63102835", "0.6229999", "0.60756963", "0.5984236", "0.59632885", "0.5924273", "0.58936596", "0.5866505", "0.58646315", "0.58614063", "0.5861064", "0.5839266", "0.58382696", "0.5746812", "0.5740715", "0.57082105", "0.5702086", "0.5680672", "0.56777954", "0.5677687", "0.5672...
0.63931197
0
Handle DELETE requests for a single bug_types
def destroy(self, request, pk=None): try: bug_type = BugType.objects.get(pk=pk) bug_type.delete() return Response({}, status=status.HTTP_204_NO_CONTENT) except BugType.DoesNotExist as ex: return Response({'message': ex.args[0]}, status=status.HTTP_404_NO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(request):\n issue = request.issue\n tbd = [issue]\n for cls in [models.PatchSet, models.Patch, models.Comment,\n models.Message, models.Content]:\n tbd += cls.query(ancestor=issue.key)\n ndb.delete_multi(entity.key for entity in tbd)\n return HttpResponseRedirect(reverse(mine))", ...
[ "0.64564764", "0.6373948", "0.6274588", "0.6239647", "0.5946599", "0.5934323", "0.58076173", "0.57915395", "0.57902735", "0.57781965", "0.5603082", "0.559378", "0.5585142", "0.55380416", "0.5530689", "0.55264217", "0.5516012", "0.5494011", "0.5488755", "0.54810405", "0.547967...
0.74345225
0
Test case for dashboards_v2_create
def test_dashboards_v2_create(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dashboards_v2_show(self):\n pass", "def create_dashboard(self, save=True, **kwargs):\n index = self.object_index()\n if not kwargs: kwargs = dict(name=\"Test Dashboard %s\" % index, slug=\"test-dashboard-%s\" % index)\n d = Dashboard(**kwargs)\n\n if not save: return d...
[ "0.7452056", "0.736161", "0.7273888", "0.718651", "0.69337714", "0.68829465", "0.68471503", "0.6658529", "0.66442645", "0.6497651", "0.6487799", "0.6441663", "0.6433812", "0.63724405", "0.6360095", "0.6339658", "0.63390714", "0.6314269", "0.6242235", "0.62033004", "0.6202667"...
0.9285469
0
Test case for dashboards_v2_delete
def test_dashboards_v2_delete(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dashboards_v2_delete_share(self):\n pass", "def test_delete_run(self):\n pass", "def test_delete(self):\n\n self.metadata.create_or_update(data=self.create)\n\n # Find by name\n res_name = self.metadata.get_by_name(\n entity=Dashboard, fqn=self.entity.full...
[ "0.7870033", "0.71588737", "0.71584386", "0.71130913", "0.7050759", "0.7027611", "0.69915897", "0.697304", "0.6937165", "0.6871377", "0.6833329", "0.68006206", "0.67884403", "0.67685896", "0.67533255", "0.674556", "0.673318", "0.6712143", "0.6698306", "0.6679808", "0.6676828"...
0.9327164
0
Test case for dashboards_v2_delete_share
def test_dashboards_v2_delete_share(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_share(self):\n self.app.delete(url=\"/config/shares?share=80&destination=gsiftp://nowhere&vo=dteam\", status=400)\n self.app.delete(url=\"/config/shares?share=80&destination=gsiftp://nowhere&vo=dteam&source=gsiftp://source\", status=204)", "def test_dashboards_v2_share(self):\n ...
[ "0.8141491", "0.7687473", "0.76559436", "0.759245", "0.7589448", "0.7386963", "0.71861345", "0.69597507", "0.6932505", "0.69228655", "0.6674884", "0.6525926", "0.63806325", "0.63643163", "0.6339324", "0.6336379", "0.6321865", "0.6309811", "0.6267821", "0.6262817", "0.6247236"...
0.95148045
0
Test case for dashboards_v2_link
def test_dashboards_v2_link(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dashboards_v2_show(self):\n pass", "def test_link_list(self):\n response = self.client.get('/tests/dashboard/')\n self.assertEqual(response.status_code, 200)\n self.assertContains(response, \"example.com\")", "def test_dashboards_v2_share(self):\n pass", "def test_...
[ "0.76131654", "0.7419157", "0.73980486", "0.7246332", "0.6985483", "0.680978", "0.6763111", "0.6698623", "0.6686817", "0.6639568", "0.6599267", "0.6554375", "0.6539834", "0.64602804", "0.6441315", "0.63387644", "0.63197404", "0.6277576", "0.6276735", "0.6267241", "0.62201416"...
0.9311045
0
Test case for dashboards_v2_list
def test_dashboards_v2_list(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dashboards_v2_show(self):\n pass", "def test_dashboards_v2_create(self):\n pass", "def test_dashboards_v2_link(self):\n pass", "def test_dashboards_v2_update(self):\n pass", "def test_dashboards_v2_request_access(self):\n pass", "def test_list(self):\n\n ...
[ "0.7976784", "0.70586634", "0.70130754", "0.6926723", "0.6848313", "0.67208874", "0.667526", "0.66209704", "0.661279", "0.6586439", "0.65853673", "0.6522896", "0.6502332", "0.64863473", "0.6463404", "0.6429876", "0.6421786", "0.6360223", "0.63138133", "0.63138133", "0.6309319...
0.920398
0
Test case for dashboards_v2_list_shares
def test_dashboards_v2_list_shares(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dashboards_v2_share(self):\n pass", "def test_index_nas_shares(self):\n pass", "def sharelist():\n # Get field to order by for displaying shares\n if(request.args.get('orderby')):\n orderby = request.args.get('orderby')\n else:\n orderby = None\n # Get order for...
[ "0.7210791", "0.68115824", "0.6800645", "0.6644299", "0.65533495", "0.64638555", "0.6444525", "0.6443715", "0.63363105", "0.63231695", "0.6278536", "0.6275053", "0.62654924", "0.61838", "0.6182428", "0.61767966", "0.61617064", "0.61397827", "0.6107011", "0.61029583", "0.61017...
0.93466777
0
Test case for dashboards_v2_request_access
def test_dashboards_v2_request_access(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_request_views(self):\n user = User.objects.get(pk=1)\n url_names = [\n ['private_requests', {}],\n ['sent_private_requests', {}],\n ['public_requests', {}],\n ['public_applications', {}],\n ['request_write', {}],\n ['request_w...
[ "0.68400896", "0.66175485", "0.65823203", "0.6558547", "0.6439445", "0.62583804", "0.62321216", "0.62293375", "0.6223319", "0.6221193", "0.6188494", "0.6188494", "0.6151391", "0.614999", "0.6134939", "0.6133685", "0.6097226", "0.6075033", "0.60681593", "0.6057631", "0.6052637...
0.90544796
0
Test case for dashboards_v2_share
def test_dashboards_v2_share(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dashboards_v2_list_shares(self):\n pass", "def test_dashboards_v2_delete_share(self):\n pass", "def test_test_result_nas_share(self):\n pass", "def test_show_nas_share(self):\n pass", "def test_show_nas_share_by_nas(self):\n pass", "def test_test_nas_share(self...
[ "0.81515837", "0.7961826", "0.7286484", "0.72024715", "0.7133189", "0.7063388", "0.7051122", "0.6908327", "0.68763894", "0.6846673", "0.6774883", "0.672124", "0.6720135", "0.66815716", "0.6634311", "0.6622474", "0.6555711", "0.65534055", "0.65192455", "0.6357801", "0.63557094...
0.93331563
0
Test case for dashboards_v2_show
def test_dashboards_v2_show(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dashboards_v2_list(self):\n pass", "def test_dashboards_v2_create(self):\n pass", "def test_dashboards_v2_link(self):\n pass", "def dashboard():", "def test_dashboard_page(self):\r\n\r\n result = self.client.get(\"/dashboard\", follow_redirects = True)\r\n self.a...
[ "0.7950236", "0.7147505", "0.71280915", "0.7079723", "0.70487505", "0.6799904", "0.67502075", "0.6675437", "0.6622741", "0.6407807", "0.6284936", "0.6199045", "0.61881953", "0.6187196", "0.61600304", "0.61471295", "0.6143414", "0.6135355", "0.61093026", "0.6060407", "0.604707...
0.92102915
0
Test case for dashboards_v2_update
def test_dashboards_v2_update(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_dashboard(self):\n os.unlink(self.dboard._path)\n self.dboard.update_dashboard()\n self.assertTrue(os.path.isfile(self.dboard._path))", "def test_update_scenario(self):\n pass", "def test_update_case(self):\n pass", "def test_update(self):\n # this is...
[ "0.74163353", "0.7246876", "0.7155249", "0.7070719", "0.7010909", "0.7010909", "0.7010909", "0.6946631", "0.6806688", "0.6731626", "0.6626995", "0.66035193", "0.64835584", "0.64800835", "0.64792293", "0.6466244", "0.6455214", "0.64326435", "0.64298064", "0.6385786", "0.634503...
0.9138029
0
Initialise the lists where the loss of training and validation will be saved.
def on_train_begin(self, logs={}): self.losses = [] self.val_losses = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, train_list_pos, train_list_neg, val_list_pos, val_list_neg, test_list,\n database_root, store_memory=True):\n \n # Load training images (path) and labels\n print('Started loading training files...')\n if train_list_pos is not None:\n with op...
[ "0.65994763", "0.6465097", "0.6392918", "0.63773614", "0.6310239", "0.62792635", "0.627831", "0.62725335", "0.62065566", "0.61998487", "0.6142371", "0.6140989", "0.6108106", "0.6105074", "0.6105074", "0.60753036", "0.60304016", "0.6017751", "0.5976437", "0.5970623", "0.595370...
0.66101164
0
At the end of each epoch calculate NDCG of the validation set. If the model performance is improved, the model weights are saved. Update the list of validation NDCG by adding obtained value
def on_epoch_end(self, batch, logs={}): # recommend top k items based on training part of validation set top_k = self.recommend_k_items(x=self.val_tr, k=self.k, remove_seen=True) # convert recommendations from sparse matrix to dataframe top_k_df = self.mapper.map_back_sparse(top_k, kind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validation_epoch(self):\n self.model.eval()\n\n # Compute for training set\n train_loss, train_acc = compute_loss_and_accuracy(\n self.dataloader_train, self.model, self.loss_criterion\n )\n self.TRAIN_ACC.append(train_acc)\n self.TRAIN_LOSS.append(train_los...
[ "0.7111862", "0.6898532", "0.6851218", "0.68123144", "0.6795479", "0.66528374", "0.66498935", "0.6597049", "0.6589389", "0.65370405", "0.6534026", "0.6501032", "0.6459035", "0.64458483", "0.6441401", "0.6417951", "0.6396953", "0.6385522", "0.63847756", "0.6380573", "0.6367205...
0.71068394
1
Initialise a list in which the beta value will be saved at the end of each epoch.
def on_train_begin(self, logs={}): self._beta = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_epoch_end(self, epoch, logs={}):\n tmp = K.eval(self.beta)\n self._beta.append(tmp)", "def _init_belief(self):\n belief = []\n for i in range(self._num_goals):\n belief.append(1.0 / self._num_goals)\n self._last_belief_over_history = np.copy(belief)\n r...
[ "0.68749875", "0.62961", "0.62559825", "0.5885902", "0.56720376", "0.56720376", "0.562983", "0.5620607", "0.55761886", "0.55663663", "0.5500609", "0.54874396", "0.54853237", "0.5473211", "0.54376656", "0.5436764", "0.5432927", "0.5425115", "0.54232985", "0.5412888", "0.539885...
0.6715151
1
At the end of each batch the beta should is updated until it reaches the values of anneal cap.
def on_batch_end(self, epoch, logs={}): self.update_count = self.update_count + 1 new_beta = min( 1.0 * self.update_count / self.total_anneal_steps, self.anneal_cap ) K.set_value(self.beta, new_beta)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_sample_beta(self):\n c_contexts = self.context[self.iter]\n\n old_beta = self.beta[self.iter]\n new_beta = -1\n proposal_sd = .1\n while new_beta <= 0:\n new_beta = random.gauss(mu = old_beta, sigma = proposal_sd)\n \n # set up to calculate the ...
[ "0.69999826", "0.6765701", "0.67238367", "0.6695612", "0.65126884", "0.64824814", "0.6398499", "0.63762057", "0.63267255", "0.63267255", "0.62951976", "0.6279609", "0.6270113", "0.62608975", "0.6198239", "0.6196509", "0.61933327", "0.61876833", "0.6172831", "0.6165525", "0.61...
0.7020055
0
At the end of each epoch save the value of beta in _beta list.
def on_epoch_end(self, epoch, logs={}): tmp = K.eval(self.beta) self._beta.append(tmp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_batch_end(self, epoch, logs={}):\n self.update_count = self.update_count + 1\n\n new_beta = min(\n 1.0 * self.update_count / self.total_anneal_steps, self.anneal_cap\n )\n\n K.set_value(self.beta, new_beta)", "def on_train_begin(self, logs={}):\n self._beta = ...
[ "0.7203487", "0.6780926", "0.6144279", "0.6131166", "0.6131166", "0.61280113", "0.6070741", "0.604335", "0.60160035", "0.599566", "0.5945513", "0.5893457", "0.5889649", "0.58856297", "0.58414656", "0.5795734", "0.5792628", "0.5787539", "0.5787539", "0.5754466", "0.57312", "...
0.79033834
0
Returns the value of the optimal beta.
def get_optimal_beta(self): if self.annealing: # find the epoch/index that had the highest NDCG@k value index_max_ndcg = np.argmax(self.val_ndcg) # using this index find the value that beta had at this epoch return self.ls_beta[index_max_ndcg] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _beta(self):\n return _handle_ab(self.solution, self.use_const)[1]", "def pvalue_beta(self):\n return self._pvalue_beta", "def beta(self):\n return self._beta", "def beta(self):\n return self._beta", "def _pvalue_beta(self):\n return _handle_ab(self._pvalues_all, self...
[ "0.82748187", "0.79906905", "0.7712959", "0.7712959", "0.75364375", "0.72425634", "0.71843994", "0.7174616", "0.7108991", "0.7085078", "0.70444703", "0.6972543", "0.69429487", "0.6910528", "0.6876798", "0.68761104", "0.6837782", "0.6817857", "0.6811532", "0.6784588", "0.67778...
0.8362115
0
Returns the topk items ordered by a relevancy score. Obtained probabilities are used as recommendation score.
def recommend_k_items(self, x, k, remove_seen=True): # return optimal model self.model.load_weights(self.save_path) # obtain scores score = self.model.predict(x) if remove_seen: # if true, it removes items from the train set by setting them to zero seen_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_based_topk(self, items, top_k=10, sort_top_k=False):\n\n # convert item ids to indices\n item_ids = items[self.col_item].map(self.item2index)\n\n # if no ratings were provided assume they are all 1\n if self.col_rating in items.columns:\n ratings = items[self.col...
[ "0.71710426", "0.7145789", "0.6856658", "0.6834214", "0.68246776", "0.6760741", "0.6760536", "0.67306244", "0.6693146", "0.66901475", "0.6671577", "0.6577725", "0.63678414", "0.63514674", "0.6309947", "0.62948525", "0.6253606", "0.6252747", "0.62473625", "0.6206402", "0.61816...
0.7149169
1
Returns the list of NDCG at each epoch.
def ndcg_per_epoch(self): return self.val_ndcg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dnc_lists(self):\n return self._dnc_lists", "def mnDCG_torch(train_codes, train_labels, test_codes, test_labels, iDCGs, base=2, r=100):\n\n nDCGs = []\n\n for i in range(test_codes.size(0)):\n query_label, query_binary = test_labels[i, :], test_codes[i]\n _, query_result = torch.su...
[ "0.59706616", "0.58347195", "0.5763433", "0.5713475", "0.560318", "0.5591322", "0.5532446", "0.5497064", "0.5438621", "0.5413205", "0.53801537", "0.5341371", "0.5337029", "0.5322129", "0.5315924", "0.5302177", "0.5263217", "0.5255111", "0.525054", "0.517955", "0.51672983", ...
0.6804679
0
Returns weights and bias shapes at current layer
def get_shape_wb(self): return self.weights.shape, self.bias.shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weights(self):\n weights = []\n for layer in self.layers:\n weights += layer.weights\n return K.batch_get_value(weights)", "def get_weights(self):\n params = self.weights\n return K.batch_get_value(params)", "def get_weights(self):\n weights = {}\n for idx, layer in en...
[ "0.7725277", "0.73451585", "0.7242983", "0.7227592", "0.71908784", "0.71216476", "0.7120995", "0.7112772", "0.7095212", "0.7082164", "0.7063947", "0.7040394", "0.6991713", "0.6991713", "0.6991713", "0.6991713", "0.6983789", "0.69091934", "0.69083494", "0.69083494", "0.6882373...
0.78609115
0
Generate an image from the specs of the given image ID. Typically this function loads the image from a file, but in this case it generates the image on the fly from the specs in image_info.
def load_image(self, image_id): info = self.image_info[image_id] # bg_color = np.array(info['bg_color']).reshape([1, 1, 3]) # image = np.ones([info['height'], info['width'], 3], dtype=np.uint8) # image = image * bg_color.astype(np.uint8) # for shape, color, dims in info['shapes']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image(self, image_id):\n# logger.info(\"image {}\".format(image_id))\n info = self.image_info[image_id]\n if info[\"image\"] is None:\n im = self.gen_imgs[info[\"path\"]][\"input_images\"][info[\"image_index\"]]\n image = np.ones([info['height'], info['width'], 1...
[ "0.6689719", "0.6442988", "0.6313825", "0.6292514", "0.6238522", "0.6189945", "0.61293006", "0.60600907", "0.59971035", "0.5978767", "0.588666", "0.586814", "0.5838227", "0.5832879", "0.58293813", "0.57947844", "0.57874304", "0.5756098", "0.5678321", "0.5605489", "0.5602554",...
0.6806697
0
Generate instance masks for num_categories of the given image ID.
def load_mask(self, image_id): info = self.image_info[image_id] num_cards = info['cards'] # count = len(num_cards) count = 1 # there will only ever be 1 card per image (for simplicity) TODO: do multiple documents? mask = np.zeros([info['height'], info['width'], count], dtype=np.u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mask(self, image_id):\n image_info = self.image_info[image_id]\n annotations = image_info['annotations']\n instance_masks = []\n class_ids = []\n \n for annotation in annotations:\n class_id = annotation['category_id']\n mask = Image.new('1',...
[ "0.7168982", "0.68232125", "0.6819072", "0.6754465", "0.67494434", "0.66466624", "0.6646137", "0.6609447", "0.66015846", "0.65896213", "0.6575726", "0.65696466", "0.6507139", "0.6501369", "0.64992666", "0.6493003", "0.6472146", "0.6458939", "0.64004475", "0.6388024", "0.63486...
0.7008365
1
Creates random specifications of an image containing a document. Returns whether the image is real or synthetic, and a collection of specifications that can be used to draw/load the image.
def random_image(self, height, width): random_image_properties = {} # flip a coin to determine whether image should be synthetic or real if random.random() < self.prob_real: random_image_properties['real'] = True # select a random row from the list of filenames ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_image():\n\n # select random photo from sample table\n result = db.engine.execute(\"\"\"SELECT photo_id\n FROM sample\n ORDER BY rand() LIMIT 1\"\"\")\n photo_id = result.first()[0]\n\n # extract classification vector from dat...
[ "0.5536707", "0.5353945", "0.52931195", "0.52468675", "0.52267164", "0.522385", "0.5193956", "0.5187058", "0.51558185", "0.5117122", "0.5085701", "0.5085326", "0.505282", "0.5006239", "0.49907416", "0.49817717", "0.49720508", "0.49168384", "0.4916333", "0.491075", "0.48883194...
0.5619721
0
Searches a given directory for rule classes. This is done by finding all python modules in the given directory, adding them to the python path, importing them and then finding any Rule classes in those modules.
def find_rule_classes(extra_path): # Find all python files in the given path modules = [] for filename in os.listdir(extra_path): if fnmatch.fnmatch(filename, '*.py'): modules.append(os.path.splitext(filename)[0]) # No need to continue if there are no modules specified if len(m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_folder(self, folder: str, package: Optional[str]):\n\n if package is None and folder not in sys.path:\n sys.path.append(folder)\n\n for root, dirs, files in os.walk(folder):\n for filename in files:\n if filename.endswith(\".py\"):\n ...
[ "0.60243195", "0.6009814", "0.57208765", "0.56602985", "0.5587395", "0.5547079", "0.5501052", "0.5480206", "0.54665273", "0.5395016", "0.5394811", "0.5391066", "0.5391066", "0.5383296", "0.5284537", "0.5280481", "0.5244671", "0.5212649", "0.520823", "0.51745206", "0.5125402",...
0.72886485
0
Parse fb message archive csv to deepQA format.
def parse_to_deep_qa_args_parsing(subparsers): help_str = "Parse fb message archive csv to deepQA format." parser_t = subparsers.add_parser('parse_to_deep_qa', help=help_str) help_str = 'Facebook target user on which to parse trainable conversations\n' parser_t.add_argument('-u', '--user', required=Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_raw_kaggle_enron_email_csv(csv_path):\n df = pd.read_csv(csv_path)\n parsed_emails = df.message.progress_apply(parse_email)\n eml_df = pd.DataFrame(parsed_emails.tolist())\n cols_of_interest = ['Message-ID', 'To', 'From', 'Subject', 'Body', 'Date']\n return eml_df.loc[:, cols_of_interest]....
[ "0.53710026", "0.5284865", "0.5257028", "0.52457374", "0.51776564", "0.5087897", "0.5063254", "0.49887475", "0.49771076", "0.4905978", "0.48777553", "0.4877188", "0.48515117", "0.48461363", "0.48309606", "0.48213726", "0.479849", "0.47779363", "0.47627908", "0.47616512", "0.4...
0.5833118
0
This command handler adds a given address to the find list and highlights it green in the UI
def find_instr(bv: BinaryView, addr: int): # Highlight the instruction in green highlight_instr(bv, addr, HighlightStandardColor.GreenHighlightColor) # Add the instruction to the list associated with the current view bv.session_data.mui_find.add(addr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addaddr( addr ):\n\t\tif cmds:\n\t\t\tcmds.last().addrs.append( addr )\n\t\telse:\n\t\t\tlog.err( \"A command must preceed the first address\" )", "def addEntryPoint(self, address: ghidra.program.model.address.Address) -> None:\n ...", "def add(self, name, command):", "def address(self):\n ...
[ "0.5926025", "0.5588062", "0.545403", "0.54533947", "0.54483294", "0.54479635", "0.5421017", "0.5379739", "0.52859473", "0.52854913", "0.52786416", "0.5163805", "0.5124565", "0.51159567", "0.5063125", "0.50360334", "0.5029094", "0.5019052", "0.5012417", "0.5004416", "0.499608...
0.57945544
1
This command handler removes a given address from the find list and undoes the highlights
def rm_find_instr(bv: BinaryView, addr: int): # Remove instruction highlight clear_highlight(bv, addr) # Remove the instruction to the list associated with the current view bv.session_data.mui_find.remove(addr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def erase_address(self):\n self.remove_pointer_or_layer()\n if self.geocoder_source_model is not None:\n self.geocoder_source_model.clear()\n if self.dlg.geocoder_search is not None:\n self.dlg.geocoder_search.clear()\n if self.toolbar_search is not None:\n ...
[ "0.63810295", "0.6339899", "0.62490153", "0.61495376", "0.613868", "0.5986962", "0.5941955", "0.5916429", "0.5905805", "0.5874766", "0.5793062", "0.5698119", "0.5635287", "0.56186867", "0.56153876", "0.5582387", "0.5522624", "0.54473996", "0.54303586", "0.54131955", "0.538184...
0.6956781
0
This command handler adds a given address to the avoid list and highlights it red in the UI
def avoid_instr(bv: BinaryView, addr: int): # Highlight the instruction in red highlight_instr(bv, addr, HighlightStandardColor.RedHighlightColor) # Add the instruction to the list associated with the current view bv.session_data.mui_avoid.add(addr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_address(self, address_item):\r\n self.addresses_to_validate.append(address_item)", "def add_addressitem(self, addressitem):\n self.addresses.append(addressitem)", "def add_address(self, **kwargs):\n addressitem = AddressItem(**kwargs)\n self.addresses.append(addressitem)\n ...
[ "0.59650594", "0.563907", "0.5632607", "0.5576743", "0.5547767", "0.5412004", "0.53491056", "0.5297553", "0.5222477", "0.5215336", "0.52093977", "0.5197658", "0.50888634", "0.5057534", "0.49944383", "0.49597597", "0.49195448", "0.4903433", "0.49003524", "0.48980787", "0.48469...
0.6041001
0
This command handler removes a given address from the avoid list and undoes the highlights
def rm_avoid_instr(bv: BinaryView, addr: int): # Remove instruction highlight clear_highlight(bv, addr) # Remove the instruction to the list associated with the current view bv.session_data.mui_avoid.remove(addr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeEntryPoint(self, address: ghidra.program.model.address.Address) -> None:\n ...", "def erase_address(self):\n self.remove_pointer_or_layer()\n if self.geocoder_source_model is not None:\n self.geocoder_source_model.clear()\n if self.dlg.geocoder_search is not None:...
[ "0.6367441", "0.61974186", "0.6196087", "0.6192953", "0.6105584", "0.60925364", "0.59467065", "0.5884086", "0.58602846", "0.5838913", "0.5670473", "0.5574024", "0.5572308", "0.55487233", "0.5527489", "0.5472186", "0.543241", "0.54315424", "0.5409907", "0.5409907", "0.5409907"...
0.67889416
0
checks if avoid_instr is valid for a given address
def avoid_instr_is_valid(bv: BinaryView, addr: int): return addr not in bv.session_data.mui_avoid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_instr_is_valid(bv: BinaryView, addr: int):\n return addr not in bv.session_data.mui_find", "def avoid_instr(bv: BinaryView, addr: int):\n\n # Highlight the instruction in red\n highlight_instr(bv, addr, HighlightStandardColor.RedHighlightColor)\n\n # Add the instruction to the list associate...
[ "0.7461026", "0.66063714", "0.6552665", "0.6552665", "0.6552665", "0.6552665", "0.6438538", "0.63995063", "0.620169", "0.61927843", "0.6102884", "0.60821825", "0.6035035", "0.60297817", "0.5999642", "0.58997667", "0.58764726", "0.58520955", "0.57955694", "0.57746744", "0.5769...
0.8381108
0
checks if find_instr is valid for a given address
def find_instr_is_valid(bv: BinaryView, addr: int): return addr not in bv.session_data.mui_find
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avoid_instr_is_valid(bv: BinaryView, addr: int):\n return addr not in bv.session_data.mui_avoid", "def find_instr(bv: BinaryView, addr: int):\n\n # Highlight the instruction in green\n highlight_instr(bv, addr, HighlightStandardColor.GreenHighlightColor)\n\n # Add the instruction to the list asso...
[ "0.70127535", "0.65277314", "0.63166106", "0.61842954", "0.6134124", "0.60140544", "0.5900524", "0.58309144", "0.57741535", "0.57549524", "0.57232827", "0.5722138", "0.57167304", "0.56977886", "0.5696326", "0.5687746", "0.5634221", "0.5631689", "0.5600849", "0.5598173", "0.55...
0.825825
0
checks if solve is valid for a given binary view
def solve_is_valid(bv: BinaryView): return not bv.session_data.mui_is_running
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_solvable(self):\n\n self.solvable=True #status of sudoku\n for i in range(0, 9):\n for j in range(0, 9):\n if self.a[i][j]==0:\n continue\n if self.check(i, j)[self.a[i][j]]==0:\n self.solvable=False\n return False", "def solve(bo):\n find ...
[ "0.6783055", "0.6572121", "0.6492764", "0.63952005", "0.63532126", "0.62848926", "0.6138279", "0.61339545", "0.61330855", "0.61186093", "0.6107973", "0.6076713", "0.60564065", "0.6056012", "0.59276927", "0.58815366", "0.58813775", "0.58366996", "0.5820088", "0.5818768", "0.58...
0.66444063
1
Reads and parses the extension's metadata from manifest.json
def _read_manifest_json(self): with open(os.path.join(self._crx_dir, "manifest.json")) as manifest: return json.load(manifest)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_manifest(self): # -> None:\n ...", "def readManifestEntries(context):\n return GenericMetadata._readEntriesForSection(context.projectDir, GenericMetadata.MANIFEST_SECTION)", "def parse_manifest(manifest_path):\n with open(manifest_path, 'r') as f:\n data = f.read()\n if...
[ "0.70724696", "0.6742506", "0.63672876", "0.62279445", "0.61844546", "0.61542964", "0.61460596", "0.61224735", "0.6114238", "0.6024954", "0.5999081", "0.59909195", "0.59649706", "0.595101", "0.595032", "0.595032", "0.59279037", "0.5826972", "0.5825033", "0.5824823", "0.580918...
0.7371749
0
Writes an updated EV whitelist into the extension. Each new EV whitelist must be uploaded with a version number greater than the current version, so increments the version number.
def update_ev_whitelist(self, compressed_ev_whitelist): manifest = self._read_manifest_json() manifest["version"] = str(self.manifest_version() + 1) self._write_manifest_json(manifest) with open( os.path.join( self._crx_dir, "_platform_specific...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def whitelist_file(self, fkey):\n self.whitelist.update([fkey])", "def generate_new_ev_hashes_whitelist(logs_list):\n all_hashes_set = set()\n for log_url, last_acceptable_entry in logs_list.items():\n output_dir = None\n if FLAGS.output_directory:\n parsed_url = urlparse.ur...
[ "0.54389304", "0.5234202", "0.5130689", "0.49521825", "0.49447602", "0.49098116", "0.47866806", "0.47382078", "0.4735558", "0.47314942", "0.47265226", "0.4677832", "0.45875278", "0.45562053", "0.4555974", "0.454886", "0.45167238", "0.44835344", "0.44783458", "0.4459914", "0.4...
0.78350586
0
Packs the extesion to the provided destination. Note that the provided dest_file_template is a template string so the version number can be filled in. Returns the exact file name that was written.
def pack_to(self, dest_file_template): fname = dest_file_template % self.manifest_version() shutil.make_archive(fname, "zip", self._crx_dir) return fname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_packed_xwalk_app_template(self, dest_dir):\n input_file = urllib2.urlopen(self.updated_url)\n contents = input_file.read()\n input_file.close()\n file_path = os.path.join(dest_dir, self.file_name)\n if os.path.isfile(file_path):\n os.remove(file_path)\n file_dir = dest_dir + '/' + ...
[ "0.57441604", "0.56092685", "0.5163301", "0.5138728", "0.5100396", "0.50948185", "0.5087329", "0.5051477", "0.50508374", "0.5032134", "0.4999631", "0.49897978", "0.49854687", "0.49592847", "0.49119633", "0.4862216", "0.48570177", "0.4845892", "0.48393336", "0.48367664", "0.48...
0.79140556
0
Deletes the directory containing the unpacked crx.
def cleanup(self): shutil.rmtree(self._crx_dir) self._crx_dir = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __remove_base_directory__():\n p = subprocess.Popen('rm -rf {}/.wcscanner'.format(context.__BASE_PATH__), shell=True)\n p.wait()", "def RemoveCase(dirc):\n if os.path.exists(dirc):\n shutil.rmtree(dirc)\n #subprocess.call(['rm', '-r', dirc])", "def _cleanPackageDir(self, *_):\r\n ...
[ "0.69096816", "0.66502094", "0.6449684", "0.6213361", "0.6142274", "0.6091155", "0.6087996", "0.6079246", "0.6057792", "0.60309553", "0.60309553", "0.6029166", "0.5985805", "0.5983899", "0.59787726", "0.5971344", "0.59619075", "0.5960334", "0.5947627", "0.59329426", "0.592858...
0.67219335
1
Scans the provided logs_list and generates a compressed EV certs whitelist for all EV certs in all the logs.
def generate_new_ev_hashes_whitelist(logs_list): all_hashes_set = set() for log_url, last_acceptable_entry in logs_list.items(): output_dir = None if FLAGS.output_directory: parsed_url = urlparse.urlsplit(log_url) output_dir = os.path.join( FLAGS.output_di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _populate_saved_certs(self, csha1_vhlist):\n # pylint: disable=no-self-use\n certs = []\n with open(self.list_path, \"rb\") as csvfile:\n csvreader = csv.reader(csvfile)\n # idx, orig_cert, orig_key\n for row in csvreader:\n cert = Cert.fromr...
[ "0.53225005", "0.5213971", "0.520614", "0.5194939", "0.506162", "0.49856913", "0.49491197", "0.4891545", "0.48614976", "0.47973296", "0.47141868", "0.46473047", "0.4601822", "0.46013403", "0.45952836", "0.45905048", "0.45385543", "0.4528403", "0.45218074", "0.44927183", "0.44...
0.76296455
0
List all feedback or create a new feedback
def feedback_list(request, format=None): if request.method == 'GET': feedback = Feedback.objects.all() serializer = FeedbackSerializer(feedback, many=True) return Response(serializer.data) elif request.method == 'POST': serializer = FeedbackSerializer(data=request.data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dealwithfeedback(info): # type: ({}) -> None\n\n global feedback\n\n feedback.append(info)\n\n fileexists = os.path.isfile('feedback.json')\n\n if len(feedback) > 100:\n jsonstr = json.dumps(feedback, indent=2)\n with open('feedback.json', 'a+') as outfile:\n if fileexists:\n outfile.writ...
[ "0.6237278", "0.6198468", "0.6094258", "0.60516495", "0.60184664", "0.5979066", "0.5951506", "0.59354746", "0.5909839", "0.57915616", "0.5747949", "0.5739484", "0.5707926", "0.5703284", "0.5672411", "0.56520355", "0.560956", "0.55293053", "0.55161333", "0.54986656", "0.549547...
0.7132861
0
Find nearby membrane vertices for cellcell interactions
def find_nearby_membranes(all_membranes, all_membrane_map, vert_normals): membrane_tree = scipy.spatial.cKDTree(all_membranes) nearby_membranes = np.array(list(membrane_tree.query_pairs(adhesion_max_dist, p=2))) nearby_membrane_map = defaultdict(list) if nearby_membranes.shape[0] > 0: # Exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_near(self,map):\n near_cells = []\n for i in range(self.x-1, self.x+2):\n for j in range(self.y-1, self.y+2):\n if(i>=0 and i<map.size and j>=0 and j<map.size): near_cells.append(map.search(i,j))\n return near_cells", "def nearby_cells(self, cell):\n ...
[ "0.68771553", "0.6727814", "0.6498019", "0.6389951", "0.6324634", "0.6181365", "0.616691", "0.6152827", "0.614949", "0.614949", "0.614949", "0.614949", "0.614949", "0.614949", "0.6106434", "0.6025955", "0.5992333", "0.59376204", "0.59310716", "0.58893794", "0.5881518", "0.5...
0.72664905
0
Computes parameter identifiability for a PEST jco file,
def __init__(self, jco, par_info_file=None): self._Pest = Pest(jco, par_info_file=par_info_file) self.parinfo = self._Pest.parinfo self.la = errvar(jco) self.parinfo = None if par_info_file is not None: self.parinfo = pd.read_csv(par_info_file, index_col='Name') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _detect_source_params(self):\n src_obj_def = self.config[\"source\"][\"objects\"]\n id_pattern = r\"\\w+\\$([a-z_-]+)(\\$.*)?\\.xml\"\n regex_id = re.match(r'%s' % id_pattern, src_obj_def)\n # strip the last character of the first parameter when\n # others arguments are prese...
[ "0.5325641", "0.53018326", "0.51857156", "0.5135027", "0.5053131", "0.5036314", "0.50226796", "0.49960402", "0.497997", "0.4974607", "0.4959177", "0.49570066", "0.4943635", "0.4932427", "0.4931901", "0.49302655", "0.49137285", "0.49128273", "0.49114352", "0.49089065", "0.4907...
0.541428
0
Sample points in [0, 1] x [0, 1] coordinate space based on their uncertainty. The unceratinties are calculated for each point using 'uncertainty_func' function that takes point's logit prediction as input. See PointRend paper for details.
def get_uncertain_point_coords_with_randomness( coarse_logits, uncertainty_func, num_points, oversample_ratio, importance_sample_ratio ): assert oversample_ratio >= 1 assert importance_sample_ratio <= 1 and importance_sample_ratio >= 0 num_boxes = coarse_logits.shape[0] num_sampled = int(num_points ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_uncertainty(self, input_: Tensor) -> Tensor:\n raise NotImplementedError", "def uncertainty_test(test_points, models, printing=False):\n epistemic_uncer=[]\n for point in test_points:\n list_p=[]\n for i in range(len(models)):\n list_p.append(models[i].predict_pr...
[ "0.5757046", "0.57474333", "0.57057756", "0.5597606", "0.55678844", "0.55339533", "0.55218416", "0.5507908", "0.54825974", "0.5474711", "0.54265666", "0.54253626", "0.54223895", "0.53512543", "0.53508615", "0.5327295", "0.528481", "0.5279967", "0.5266379", "0.5264567", "0.525...
0.711037
0
Find `num_points` most uncertain points from `uncertainty_map` grid.
def get_uncertain_point_coords_on_grid(uncertainty_map, num_points): R, _, H, W = uncertainty_map.shape h_step = 1.0 / float(H) w_step = 1.0 / float(W) num_points = min(H * W, num_points) point_indices = torch.topk(uncertainty_map.view(R, H * W), k=num_points, dim=1)[1] point_coords = torch.zer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_maximum_from_heatmap(self, heatmap):\n assert heatmap.size(0) == 1 and heatmap.size(1) == 1\n max_map = torch.eq(heatmap, self.pool(heatmap)).float()\n heatmap = heatmap * max_map\n score = heatmap.view(-1)\n score, pos_idx = score.topk(self.max_num_people)\n mask...
[ "0.5568354", "0.5500353", "0.54967207", "0.5417804", "0.5393068", "0.53203595", "0.5317765", "0.5277394", "0.52701175", "0.52533656", "0.51807195", "0.51388156", "0.51223445", "0.5104222", "0.5097043", "0.50879663", "0.50778925", "0.5061072", "0.50303924", "0.49934766", "0.49...
0.725836
0
Get features from feature maps in `features_list` that correspond to specific point coordinates inside each bounding box from `boxes`.
def point_sample_fine_grained_features(features_list, feature_scales, boxes, point_coords): cat_boxes = Boxes.cat(boxes) num_boxes = [len(b) for b in boxes] point_coords_wrt_image = get_point_coords_wrt_image(cat_boxes.tensor, point_coords) split_point_coords_wrt_image = torch.split(point_coords_wrt_im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_landmark_to_box(self, landmarks_pos, boxes):\n for box in boxes:\n # extract box corners\n bottom, right, top, left = box\n # initialise the counter for each box\n confirmed_box = 0\n for feature_pos in landmarks_pos:\n # extra...
[ "0.5787215", "0.568632", "0.5678366", "0.5641248", "0.55818915", "0.5572869", "0.5572503", "0.55651474", "0.5563765", "0.555851", "0.555687", "0.5519348", "0.5499154", "0.5498794", "0.54886675", "0.54881775", "0.54855996", "0.5472235", "0.5452425", "0.5405928", "0.53967345", ...
0.6309408
0
We estimate uncerainty as L1 distance between 0.0 and the logit prediction in 'logits' for the foreground class in `classes`.
def calculate_uncertainty_ins_seg(logits, classes): if logits.shape[1] == 1: gt_class_logits = logits.clone() else: gt_class_logits = logits[ torch.arange(logits.shape[0], device=logits.device), classes ].unsqueeze(1) return -(torch.abs(gt_class_logits))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_uncertainty(logits):\n assert logits.shape[1] == 1\n gt_class_logits = logits.clone()\n return -(torch.abs(gt_class_logits))", "def classification_loss(self, classes_true, classes_logits):\n entropy_fn = tf.nn.sparse_softmax_cross_entropy_with_logits\n\n classes_max = tf.argmax(class...
[ "0.7212375", "0.6290193", "0.61456096", "0.6085738", "0.5995317", "0.59830344", "0.5934147", "0.5906566", "0.58899504", "0.5878762", "0.58536285", "0.5838146", "0.5837957", "0.58349437", "0.5832953", "0.58230114", "0.58190936", "0.5815933", "0.5808415", "0.580261", "0.5793901...
0.6772073
1
Forward logic of the coarse mask head.
def _forward_mask_coarse(self, features, boxes): point_coords = generate_regular_grid_point_coords( np.sum(len(x) for x in boxes), self.mask_coarse_side_size, boxes[0].device ) mask_coarse_features_list = [features[k] for k in self.mask_coarse_in_features] features_scales = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_front(self):\n self.front = (laplace(self.working_mask) > 0).astype('uint8')\n # TODO: check if scipy's laplace filter is faster than scikit's", "def cdp_forward(data, mask):\n assert mask.size(-1) == 2\n if data.ndimension() == 4:\n data = torch.stack([data, torch.zeros_like...
[ "0.6203289", "0.5901407", "0.58638525", "0.5834442", "0.5731476", "0.5727024", "0.5719588", "0.5709668", "0.56989735", "0.56976044", "0.5663397", "0.5644492", "0.56331575", "0.563122", "0.55740553", "0.55177915", "0.5512834", "0.5464642", "0.5450105", "0.5449809", "0.54311436...
0.6722677
0
For each location of the prediction `sem_seg_logits` we estimate uncerainty as the difference between top first and top second predicted logits.
def calculate_uncertainty_sem_seg(sem_seg_logits): top2_scores = torch.topk(sem_seg_logits, k=2, dim=1)[0] return (top2_scores[:, 1] - top2_scores[:, 0]).unsqueeze(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_uncertainty_ins_seg(logits, classes):\n if logits.shape[1] == 1:\n gt_class_logits = logits.clone()\n else:\n gt_class_logits = logits[\n torch.arange(logits.shape[0], device=logits.device), classes\n ].unsqueeze(1)\n return -(torch.abs(gt_class_logits))", "...
[ "0.594994", "0.5414396", "0.5307634", "0.53052497", "0.52976197", "0.52924985", "0.50994885", "0.50950146", "0.5020229", "0.5019748", "0.50088936", "0.4993926", "0.49412835", "0.49242663", "0.49199444", "0.48979837", "0.48728555", "0.4868771", "0.48595622", "0.48388445", "0.4...
0.840179
0
Store [value] under [key]. Overwrites previous value.
def put(self, key, value): self._store[key] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, key, value):\n self.__setitem__(key=key, value=value)", "def store(self, key, value):\n pass", "def put(self, key, value):\n ha = self.myhash(key)\n if key not in self.hashmap[ha][0]:\n self.hashmap[ha][0].append(key)\n self.hashmap[ha][1].append(...
[ "0.81973505", "0.8128002", "0.8042101", "0.8013556", "0.7961247", "0.79319733", "0.79319733", "0.7895864", "0.78469557", "0.78369504", "0.78105026", "0.77856314", "0.77685684", "0.7760322", "0.77592736", "0.77524114", "0.77428055", "0.7732326", "0.77093565", "0.768749", "0.76...
0.8388075
0
Store [value] in file named [key]. Overwrites previous file.
def put(self, key, value): self.execute_command('sudo -i bash -c \'echo -n "{0}" > {1}{2}\'' .format(value, self._store_path, key))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, path, key):\n raise NotImplementedError", "def store(self, key, value):\n pass", "def set(self, key, value):\n if self.db is None:\n self._init()\n self.db[key] = value\n temp = self.fname + \".tmp\"\n with open(temp, \"wb\") as fh:\n ...
[ "0.72193545", "0.7136497", "0.7131595", "0.6965466", "0.69534487", "0.6867503", "0.68295985", "0.6797941", "0.6779623", "0.6691939", "0.66411185", "0.6639804", "0.6629952", "0.6613346", "0.6574351", "0.65596837", "0.65055573", "0.6473761", "0.6454486", "0.6422892", "0.6411722...
0.7805414
0
Get value stored in file named [key] if it exist, None otherwise.
def get(self, key): output = self.execute_command( 'sudo -i bash -c \'if [ -f "{0}" ]; then cat "{0}"; else echo -n "FILE_NOT_FOUND"; fi\''.format( self._store_path + key)) value = return_fixed_output(output) return None if value == 'FILE_NOT_FOUND' else value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(key):\n\n request_dict = RequestFileCom.file_to_dict()\n\n try:\n\n return request_dict[key]\n\n except:\n\n return None", "def get_if_exist(self, data, key):\n if key in data:\n return data[key]\n return None", "def _get(self, k...
[ "0.80985266", "0.72634894", "0.68902713", "0.6884895", "0.68724364", "0.6833067", "0.67803943", "0.6661221", "0.6590411", "0.6528409", "0.65191394", "0.6507899", "0.64900947", "0.6453932", "0.6453932", "0.64375573", "0.6412565", "0.63555795", "0.63549995", "0.6327449", "0.630...
0.80617
1
Parses value read from appstack and apply expression if it is recognized as expression.
def parse_and_apply_expression(self, key, value): if RANDOM_EXPRESSION_PATTERN.match(str(value)): return self._store.get(key) or self._genarate_and_save_random(key, value) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluateValue(compiled_expression):", "def parseValue(expr):\n\n\ttry:\n\t\treturn eval(expr)\n\texcept:\n\t\treturn eval(re.sub(\"\\s+\", \",\", expr))\n\telse:\n\t\treturn expr", "def exeval(expression): \n if len(expression) <= 3: #Assuming no spaces (\" \") between each value given in the expressi...
[ "0.6470229", "0.60722643", "0.596214", "0.592786", "0.57833505", "0.5688331", "0.5682068", "0.56777084", "0.566828", "0.5648218", "0.563428", "0.5611138", "0.5605012", "0.5585041", "0.5581475", "0.5567087", "0.5548789", "0.5540649", "0.5500918", "0.5499482", "0.5476836", "0...
0.6274353
1
>>> from sklearn import svm >>> X = [[0,0],[1,1]] >>> y = [0,1] >>> clf=svm.SVC() >>> clf.fit(X,y) SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, gamma=0.0, kernel='rbf', max_iter=1, probability=False, random_state=None, shrinking=True, tol=0.001, verbose=False) >>> clf.predict([[2.,2.]]) array([1])...
def svmtrain(x,y,w=None): # xl = x.tolist() # yl = y.tolist() clf = svm.SVC(kernel='linear', C=1000) # apparently C param here really matters clf.fit(x,y) return({'w':clf.coef_, 'b':clf.intercept_,'clf':clf, 'n_support':clf.support_vectors_.shape[0]})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_svm(X, y):\n svm = SVC(C=1000000.0, gamma=0.0, kernel='rbf')\n svm.fit(X, y)\n return svm", "def svm():", "def SVM(x_train, x_test, y_train, kernel):\n svc_model = SVC(kernel=kernel)\n svc_model.fit(x_train, y_train)\n y_pred = svc_model.predict(x_test)\n return y_pred", "def e...
[ "0.7533747", "0.7447859", "0.736779", "0.70503294", "0.703637", "0.7024521", "0.70164704", "0.6983315", "0.696794", "0.6941068", "0.690354", "0.6830756", "0.6780097", "0.6758695", "0.67574143", "0.6698815", "0.6675916", "0.6675051", "0.66633236", "0.6622689", "0.66036403", ...
0.77692634
0
Checks whether an edgework view has been attached. Quits otherwise.
def check_edgework_view_attached(self) -> None: if not isinstance(self._edgework_view, EdgeworkView): raise TypeError("Edgework view not attached to bomb model.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isOn(self):\r\n return len(self.__agenda)>2", "async def check_once(self) -> None:\n attached_tool_request_message = message_definitions.AttachedToolsRequest()\n await self._messenger.send(\n node_id=NodeId.head, message=attached_tool_request_message\n )", "def __veri...
[ "0.56485087", "0.55588293", "0.55345416", "0.54767424", "0.54503304", "0.5445126", "0.540363", "0.53996265", "0.53580475", "0.53322554", "0.5300498", "0.5288948", "0.52806824", "0.52614707", "0.52474165", "0.5243736", "0.5201884", "0.51900876", "0.51637745", "0.5160954", "0.5...
0.7670907
0
Stores the reference to the BombModel's module list.
def attach_module_list(self, modules) -> None: self.modules = modules self.draw_modules()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.modules = {}", "def register_object(self, obj):\n self.modules.append(obj)", "def set_submodule_list(self, L):\n\t\tself.submodule_list = L", "def addModulesToList(self):\n\n existing = self.getExistingModules()\n\n for module in self.modulesToAdd:\n ...
[ "0.54502344", "0.5401811", "0.53207093", "0.531813", "0.5196136", "0.51787025", "0.51308244", "0.5101433", "0.5097278", "0.5093339", "0.5083976", "0.5070045", "0.50537926", "0.50515187", "0.5008612", "0.49931404", "0.49898282", "0.49889448", "0.49847013", "0.4969194", "0.4964...
0.5640377
0
Updates the amount of strikes shown on EdgeworkView.
def update_strikes(self, strikes: int) -> None: strike_str = "-" if strikes == 0 else "X" * strikes self._strike_label.config(text=strike_str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_spikes(self):\n return self._num_spikes", "def update_likes(self):\n self.nb_likes = self.likes.count()\n self.save()", "def n_spikes(self):\n return self.model.n_spikes", "def update_total(self):\r\n likes = 0.00\r\n\r\n if self.get_hamburger.get():\r\n ...
[ "0.63435316", "0.62648433", "0.6161862", "0.5987585", "0.59555614", "0.5954075", "0.58026433", "0.57910687", "0.5778128", "0.5673845", "0.5539904", "0.54992443", "0.54758793", "0.5436004", "0.54064447", "0.5395372", "0.53386974", "0.5333826", "0.5333515", "0.5323917", "0.5322...
0.7285296
0
Generates a random barcode of the form FLIM, where the are alphanumeric characters. That gives a random range of 60 million possible barcodes.
def new_barcode(num_digits=5, chars=string.digits+string.uppercase): return 'FLIM-'+(''.join([random.choice(chars) for _ in xrange(num_digits)]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_code():\n return ''.join([random.choice(string.ascii_uppercase + string.digits) for _ in range(10)])", "def code_generator():\n digits = [str(num) for num in range(10)]\n random.shuffle(digits)\n return digits[:3]", "def __generate_number_boleto_fake(self):\n numbers = \"0123456789\"...
[ "0.7138197", "0.6684884", "0.6545216", "0.65020794", "0.6493189", "0.6441008", "0.6403886", "0.6377922", "0.63652015", "0.6309812", "0.63042516", "0.62489617", "0.6127796", "0.61220354", "0.60194755", "0.6000993", "0.60008746", "0.5996696", "0.5958608", "0.5949149", "0.593747...
0.7978328
0
Reads the work order from an orders file. The file must have lines like "===ORDER 6===" to announce its orders. If multiple orders matching are found, the latest is returned. Returns None if no matching order is found.
def read_work_order(order_id, file): ptn = re.compile(r'^===ORDER ?([0-9]*)===') lines = None on = False with open(file, 'r') as fin: for line in fin: m = ptn.match(line) if m: g = m.group(1) if g and int(g)==order_id: o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_open_order():\n try:\n result = EXCHANGE.fetch_open_orders(CONF.pair, since=None, limit=3, params={'reverse': True})\n if result is not None and len(result) > 0:\n return Order(result[-1])\n return None\n\n except (ccxt.ExchangeError, ccxt.NetworkError) as error:\n ...
[ "0.6002466", "0.59328234", "0.5832117", "0.56696534", "0.55827814", "0.5560299", "0.55602473", "0.5555577", "0.5369021", "0.53069776", "0.52578515", "0.5237212", "0.52242666", "0.51921546", "0.5190782", "0.5149462", "0.51431096", "0.5098021", "0.5080498", "0.507062", "0.50608...
0.7509505
0
Starting from the given order (dict), creates a "complete order" message (another dict), containing updated material, new materials, and a new container.
def make_complete(order): order = order['work_order'] materials = order['materials'] updated_materials = [] parent_ids = [] if materials: m = materials[0] g = 'male' if m.get('gender')=='female' else 'female' updated_materials.append({'material_id': m['material_id'], 'gender'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_add_message_from_order(order):\n message = {}\n message.update({\"message-type\": \"A\"})\n message.update({\"instrument\": order.instrument})\n message.update({\"order-id\": order.order_id})\n message.update({\"price\": int(order.price)})\n message.update({\"quantity\": int(order.qua...
[ "0.63300383", "0.62251407", "0.5791366", "0.56766516", "0.5581266", "0.5563121", "0.55219877", "0.5503538", "0.54887724", "0.54887724", "0.54850537", "0.54060227", "0.539459", "0.53915787", "0.53906673", "0.5389801", "0.5374339", "0.53254914", "0.5303622", "0.5299341", "0.529...
0.7669165
0
Reads the order from a file; constructs a "complete order" message, and sends that to the given url (if a url is given).
def complete_order(order_id, filename, url, proxy): order_json = read_work_order(order_id, filename) if order_json is None: raise LookupError("No order found with id %r"%order_id) order = json.loads(order_json) message = make_complete(order) data = json.dumps(message, indent=4) print dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_work_order(order_id, file):\n ptn = re.compile(r'^===ORDER ?([0-9]*)===')\n lines = None\n on = False\n with open(file, 'r') as fin:\n for line in fin:\n m = ptn.match(line)\n if m:\n g = m.group(1)\n if g and int(g)==order_id:\n ...
[ "0.5639821", "0.53552246", "0.5313837", "0.52008885", "0.5160566", "0.5013366", "0.4970497", "0.49542394", "0.49274158", "0.4900648", "0.48840696", "0.4872676", "0.486599", "0.48646638", "0.48642996", "0.48490432", "0.48431483", "0.4770971", "0.47679904", "0.47626254", "0.475...
0.7720653
0
Set up the abelectronicsiopi binary sensors.
def setup_platform(hass, config, add_devices, discovery_info=None): pull_mode = config[CONF_PULL_MODE] invert_logic = config[CONF_INVERT_LOGIC] iopi = IOPi(config.get(CONF_I2C_ADDRESS), True) binary_sensors = [] pins = config[CONF_PINS] for pin_num, pin_name in pins.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_io(self):\n GPIO.setwarnings(False)\n GPIO.setmode( GPIO.BCM )\n pins = [ self._spi_dc ]\n for pin in pins:\n GPIO.setup( pin, GPIO.OUT )", "def __init__(self):\n GPIO.setwarnings(False)\n GPIO.cleanup() # Reset the high and low levels of the GPIO po...
[ "0.6793667", "0.6645204", "0.66079587", "0.65902257", "0.6528382", "0.6523098", "0.63139784", "0.6301251", "0.6277246", "0.61852133", "0.6171762", "0.6142651", "0.6134445", "0.6101322", "0.6059852", "0.6048807", "0.60407007", "0.60244626", "0.60103256", "0.600825", "0.6004547...
0.69536954
0
Update the GPIO state.
def update(self): self._state = self.iobus.read_pin(self.targetpin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _io_update(self,):\n\n self._toggle_pin(IOUPDATE_PIN)", "def led_toggle(self):\n if self.state == GPIO.LOW:\n self.state = GPIO.HIGH\n else:\n self.state = GPIO.LOW\n return self.update_status()", "def update(self):\n #self._light.update()\n #...
[ "0.70779395", "0.6972558", "0.692258", "0.692216", "0.6902144", "0.67584825", "0.6688324", "0.6683814", "0.66388077", "0.6561048", "0.65227646", "0.64423364", "0.641707", "0.64023364", "0.63990945", "0.6387267", "0.6381282", "0.63487107", "0.63463736", "0.62537205", "0.624532...
0.70637476
1
Liest Daten des Referenzsensor aus txt Dokument und erstellt Referenzklasse
def referenzdaten_einlesen(self): self.refdata = np.genfromtxt(self.referencefile, skip_header=1, usecols=np.asarray(self.referenzspalte)) self.Referencedata = Reference()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self):", "def _read_data(self):", "def data(self):", "def ReadItself(self, file):\n self._Descr.Load(file) # reikia pciam implementuoti vietoje semiau esanciu\n self.Sym = self._Descr.Sym()\n self.Poly = Structure.read(('TCord', self.nItem() + self.nText()), file)\n \n ...
[ "0.6263527", "0.5975981", "0.5793883", "0.57351094", "0.5720366", "0.57087195", "0.5684575", "0.5643223", "0.55116254", "0.5490272", "0.5402231", "0.5372619", "0.53693575", "0.53679836", "0.5361538", "0.5360545", "0.5340504", "0.5339676", "0.5308208", "0.52812684", "0.5281268...
0.62837356
0
Records audio frames Opens a stream to record audio through builtin mic.
def record_audio(self): stream = self.audio.open(format=DEFAULT_FORMAT, channels=DEFAULT_CHANNELS, rate=DEFAULT_RATE, input=True, frames_per_buffer=DEFAULT_CHUNK_SIZE) pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _record_audio(self) -> io.BytesIO:\n frames = io.BytesIO()\n audio_stream = self.audio_interface.open(\n channels=self.channels,\n format=self.SAMPLE_FORMAT,\n frames_per_buffer=self.chunk_size,\n input=True,\n rate=self.framerate,\n ...
[ "0.71439826", "0.69560605", "0.6740758", "0.66359484", "0.6632909", "0.6560763", "0.648113", "0.64131355", "0.62223464", "0.621021", "0.6152763", "0.61302465", "0.591177", "0.5859377", "0.57750237", "0.5720172", "0.5679814", "0.5676537", "0.5655162", "0.5654126", "0.5641427",...
0.7638854
0
Saves audio file. Saves recorded audio file in local storage in wave format.
def save_audio(self, name=DEFAULT_OUT_NAME): print("Saving...") wf = wave.open(name+'.wav', 'wb') wf.setnchannels(DEFAULT_CHANNELS) wf.setsampwidth(self.audio.get_sample_size(DEFAULT_FORMAT)) wf.setframerate(DEFAULT_RATE) wf.writeframes(b''.join(self.frames)) wf.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __save(self,audio):\n self.__openSampleFile()\n self.__sampleFile.writeframes(audio)", "def record_audio_to_file(self, time, file_name):\n sample_width, frames = self.record_audio(time)\n wf = wave.open(file_name, 'wb')\n wf.setnchannels(self.channels)\n wf.setsampwi...
[ "0.7491833", "0.7120519", "0.70096767", "0.680352", "0.67895466", "0.67576075", "0.66739964", "0.6559983", "0.6542236", "0.6534216", "0.65176934", "0.6453566", "0.64297783", "0.63997936", "0.6359886", "0.6331216", "0.6313011", "0.6307452", "0.6258471", "0.6232427", "0.6107557...
0.766077
0
Gets recorded audio frames.
def get_recorded_audio(self): return self.frames
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _record_audio(self) -> io.BytesIO:\n frames = io.BytesIO()\n audio_stream = self.audio_interface.open(\n channels=self.channels,\n format=self.SAMPLE_FORMAT,\n frames_per_buffer=self.chunk_size,\n input=True,\n rate=self.framerate,\n ...
[ "0.7399615", "0.6793954", "0.6298652", "0.62520313", "0.62166715", "0.6186448", "0.61745095", "0.6160834", "0.615553", "0.6136137", "0.6130456", "0.6061622", "0.6048909", "0.60468525", "0.60360813", "0.60330915", "0.6010399", "0.5921035", "0.59198135", "0.5769994", "0.5767380...
0.8466025
0
Parse all csv files for all available days.
def parse_csv(db: sqlite3.Connection, symbols_meta): logger.info('Parsing csv files for days.') csv_directory = settings.DATA_DIRECTORY / 'csv' # Get list of days by enumerating csv files in directory. csv_list = sorted(os.listdir(csv_directory), reverse=False) for jdx, f in enumerate(csv_list): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_all(self, dir_path):\n # each file name corresponds to another date\n input_paths = [os.path.join(dir_path, f) for f in os.listdir(dir_path)\n if os.path.isfile(os.path.join(dir_path, f)) and f.endswith('.csv')]\n\n if self.n_proc > 1:\n # Load in para...
[ "0.65530777", "0.63174915", "0.62384737", "0.621934", "0.6171925", "0.6166218", "0.61636454", "0.60876226", "0.60869896", "0.6044265", "0.5996264", "0.5934659", "0.5919819", "0.5908122", "0.5813595", "0.58086324", "0.57975185", "0.57605654", "0.57534516", "0.57303494", "0.571...
0.6830719
0
Test that well formed bad placements raise PlayerInvalidPlacement
def test_bad_placement(self): board = Board() player1 = LegitPlayer() player2 = BadPlacementPlayer() player1.start_of_game() player2.start_of_game() player_guard1 = PlayerGuard(player1, timeout=3) player_guard2 = PlayerGuard(player2, timeout=3) # set ids ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_valid_placement(self):\n # returns different locations on the board (indexed locations)\n self.assertEqual(tictactoe.get_valid_placement(\"1\"), 0)\n self.assertEqual(tictactoe.get_valid_placement(\"5\"), 4)\n self.assertEqual(tictactoe.get_valid_placement(\"9\"), 8)\n ...
[ "0.7367059", "0.68868554", "0.6208456", "0.62047017", "0.6139792", "0.6034143", "0.60261494", "0.60252225", "0.59996617", "0.5998429", "0.59965986", "0.5952739", "0.59331244", "0.59071267", "0.5866559", "0.58646554", "0.5839247", "0.5821397", "0.57945883", "0.57904005", "0.57...
0.7540214
0
Test that well formed bad turns raise PlayerInvalidTurn
def test_bad_turn(self): board = Board() player1 = LegitPlayer() player2 = BadTurnPlayer() player1.start_of_game() player2.start_of_game() player_guard1 = PlayerGuard(player1) player_guard2 = PlayerGuard(player2) # set ids p1id = uuid.uuid4() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_move_with_invalid(self):\n board = [\n [\" \"] * 6,\n [\" \"] * 6,\n [\" \"] * 6,\n [\" \"] * 6,\n [\"\\u25cb\"] * 6,\n [\" \"] * 6,\n [\" \"] * 6\n ]\n valid = self.game.check_move(board, 4)\n s...
[ "0.6701553", "0.65213466", "0.64966804", "0.6373617", "0.6352758", "0.6229218", "0.6176841", "0.6129866", "0.6090395", "0.60559195", "0.6018962", "0.5970219", "0.5968776", "0.59393597", "0.592507", "0.58982015", "0.58887184", "0.588521", "0.58822984", "0.58731556", "0.5860134...
0.7168204
0
Test that unowned worker placement gives the correct Exception
def test_bad_worker(self): board = Board() player1 = LegitPlayer() player2 = BadWorkerPlayer() player1.start_of_game() player2.start_of_game() player_guard1 = PlayerGuard(player1, timeout=3) player_guard2 = PlayerGuard(player2, timeout=3) # set ids ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exception_in_worker_process(self):\n\n # NOTE: The process pool has a problem that if the workers are throwing exceptions, their\n # zmq sockets will be closed and there is some race condition that can cause the ventilate\n # to raise an exception. Only ventilating a single time guara...
[ "0.6822212", "0.6821461", "0.67584", "0.67518866", "0.65961397", "0.6581797", "0.6508106", "0.64441866", "0.64384246", "0.6388309", "0.6341409", "0.6335462", "0.6307846", "0.6288868", "0.62753135", "0.6244821", "0.6169066", "0.6120559", "0.61167157", "0.6106806", "0.6104009",...
0.7523249
0
Test that players who throw exceptions get filtered to our Exception
def test_exception_player(self): board = Board() player1 = ExceptionPlayer() player_guard1 = PlayerGuard(player1, timeout=3) # set ids p1id = uuid.uuid4() self.assertRaises(PlayerRaisedException, player_guard1.set_id, p1id) self.assertRaises(PlayerRaisedExcepti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_exception(players, strats, when, _):\n game = gamegen.samplegame(players, strats)\n sched = gamesched.samplegamesched(game)\n esched = utils.ExceptionScheduler(sched, 10, when)\n sgame = schedgame.schedgame(esched)\n rests = np.concatenate(\n [game.random_restrictions(3), np.on...
[ "0.6748903", "0.6578069", "0.655932", "0.646005", "0.6369915", "0.6350076", "0.6297309", "0.6278384", "0.6244852", "0.61987185", "0.6185558", "0.6155757", "0.61158526", "0.6038814", "0.6038026", "0.602396", "0.60149395", "0.5991167", "0.59786206", "0.59782815", "0.59774053", ...
0.7339391
0
Test that players who stall for time (sleep) are timed out and a timeout exception is thrown
def test_sleep_player(self): board = Board() player1 = SleepPlayer() player_guard1 = PlayerGuard(player1, timeout=1) p1id = uuid.uuid4() self.assertRaises(PlayerTimeout, player_guard1.set_id, p1id) self.assertRaises(PlayerTimeout, player_guard1.start_of_game) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_timeout(self) -> None:", "def testSleeping(self):\n time.sleep(2 * 60)\n raise AssertionError('Test case should have timed out.')", "def test_timeoutReset(self):\n for i in range(3):\n self.circuit_breaker.failure()\n self.time.advance(29.0)\n available2...
[ "0.7406435", "0.7336682", "0.7099123", "0.7022548", "0.69348085", "0.6910702", "0.68089736", "0.67845494", "0.6699001", "0.66963995", "0.6604476", "0.65811646", "0.6520014", "0.65127754", "0.64452875", "0.64074236", "0.64044005", "0.639574", "0.63744754", "0.6369861", "0.6317...
0.7417258
0