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
Simple checking function whether an url exists or not for an API for which we expect
def url_was_found(url="localhost:5000/health"): res = requests.get(url).json() if res['status_code'] == 200: return True elif res['status_code'] == 404: return False else: raise UnexpectedResponseError("Expected 200 OK or 404, got {}.\n".format(res['status']), "Full response : {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endpoint_checker(url):\r\n if \"/arcgis/rest/services/\" and \"http\" in url:\r\n return True\r\n return False", "def check_url(url):\n return 'products.json' in url", "def url_exists(url):\n\n try:\n connection = urlopen(url)\n return connection.getcode() < 400...
[ "0.75923854", "0.7515353", "0.7493454", "0.7483758", "0.7450148", "0.742065", "0.7366325", "0.73550236", "0.73360634", "0.7320072", "0.73066574", "0.72183454", "0.71041965", "0.70459384", "0.70447576", "0.70319855", "0.7022121", "0.6952489", "0.6927507", "0.6901926", "0.68810...
0.75237095
1
Function to extract a list of genes and write to file
def get_genes(infile,outfile): gene_list = [] with open(infile) as gene: tag = False for line in gene: if line.startswith('name'): tag = True continue if tag: items = line.split() if len(items) > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_genes(filename, fmt, outname, outfmt, locuses=None):\n\n record = SeqIO.read(filename, fmt)\n proteins = []\n for feature in filter(lambda f: f.type == \"CDS\", record.features):\n qualifiers = feature.qualifiers\n if locuses is None or qualifiers[\"locus_tag\"][0] in locuses:\n ...
[ "0.6505155", "0.64799863", "0.6442034", "0.64137423", "0.6358331", "0.6319198", "0.6303898", "0.62977004", "0.62914544", "0.62514764", "0.6224801", "0.6154694", "0.6145755", "0.613941", "0.61073935", "0.6035381", "0.60235345", "0.5973374", "0.59587014", "0.59146833", "0.58895...
0.6875583
0
Open a square. The square is added to `self.opened`. If you survive, the number of mines around xy is published in `self.mines_near[xy]`. If you die, the square is also added to `self.flagged`, and `self.mines_near[xy]` is set to 'mine' instead of a number.
def open(self, xy): if xy in self.opened: return self.opened.add(xy) if xy in self._mines: self.mines_near[xy] = 'mine' self.flag(xy) # simplifies playing after death logic self.lose() else: self.mines_near[xy] = len(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_tile(self, y, x):\n # Find the letter index and convert into a y-coordinate.\n # Checks if it is a mine\n if [y, x] in self.mine_locations:\n # explode\n self.show_answer_board([y, x])\n print \"Boomz.\"\n return Minesweeper.IS_A_BOMB\n ...
[ "0.6151162", "0.5784085", "0.5716945", "0.5655926", "0.56013936", "0.5556093", "0.5474702", "0.540533", "0.5357954", "0.53536934", "0.5344168", "0.5304478", "0.5276817", "0.52626586", "0.5260349", "0.5220338", "0.52165616", "0.52024376", "0.51827097", "0.51771474", "0.5176331...
0.80960995
0
paste knob_value into new node
def paste_val(node, knob_name, knob_value): if node.knob(knob_name) is not None: node.knob(knob_name).setValue(knob_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addOrUpdateFactor(self, knobFactor: cern.lsa.domain.settings.KnobFactor) -> _AbstractKnobBuilder__T:\n ...", "def add(self):\r\n value = int(self.value_entry.get())\r\n self.value_entry.delete(0, tk.END)\r\n self.value_entry.focus_force()\r\n\r\n self.root.add_node(value)\r...
[ "0.6018957", "0.5982678", "0.585561", "0.57183415", "0.564189", "0.5593129", "0.5554506", "0.55129737", "0.5485929", "0.5439852", "0.5420697", "0.5407335", "0.52589893", "0.519508", "0.51812345", "0.5165599", "0.51233375", "0.5108813", "0.507851", "0.5036744", "0.5035296", ...
0.825682
0
read data from given node, create and fill ConvertNode object and return it
def create_convert_node(node): try: file = read_knob_val(node, "file").getValue() first = int(read_knob_val(node, "first").getValue()) last = int(read_knob_val(node, "last").getValue()) first2 = int(read_knob_val(node, "origfirst").getValue()) last2 = int(read_knob_val(node,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(self, node):\n # get the conversion lut\n node_type = self.get_node_type(node)\n conversion_specs = self.conversion_spec_sheet.get(node_type)\n if not conversion_specs:\n print('No conversion_specs for: %s' % node_type)\n return\n\n # call any ca...
[ "0.679477", "0.6682094", "0.60348463", "0.59449285", "0.59174734", "0.5899135", "0.58760214", "0.58396685", "0.5806423", "0.57982457", "0.5761724", "0.5697374", "0.56820565", "0.56805956", "0.56773216", "0.5675179", "0.5658774", "0.5595692", "0.55716044", "0.55578136", "0.555...
0.70612025
0
try to read the knob value; if it doesn't exist return empty String
def read_knob_val(node, knob_name): try: return node[knob_name] except KeyError: return "" except NameError: return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_input():\r\n inputValue = simpleText.get(\"1.0\",\"end-1c\") #Our Variable\r\n #\"1.0\" = start from first character in the text widget\r\n #\"end-1c = delete the last character that Text creates every time\"\r\n return inputValue", "def get_value(default):\n output(\" [\" + default +...
[ "0.59298456", "0.57521105", "0.56507623", "0.55940926", "0.55683196", "0.55596906", "0.554398", "0.5501618", "0.545086", "0.5449694", "0.5449388", "0.5442163", "0.5379863", "0.536139", "0.5344755", "0.5336155", "0.532224", "0.5309412", "0.53077966", "0.530188", "0.5264041", ...
0.8030681
0
proxy(object[, callback]) create a proxy object that weakly references 'object'. 'callback', if given, is called with a reference to the proxy when 'object' is about to be finalized.
def weakref_proxy(*args, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _proxify(func) -> weakref.ProxyType:\r\n _keep_alive.append(func)\r\n return weakref.proxy(func)", "def fl_set_object_callback(ptr_flobject, pyfn_CallbackPtr, numdata):\n #FL_CALLBACKPTR = cty.CFUNCTYPE(None, cty.POINTER(xfdata.FL_OBJECT),\n # cty.c_long)\n _fl_se...
[ "0.56864166", "0.5649651", "0.5597413", "0.5393539", "0.51406497", "0.5135785", "0.5061495", "0.49494594", "0.48840693", "0.48092043", "0.47971678", "0.47971678", "0.47801232", "0.4731322", "0.472666", "0.46767485", "0.46504003", "0.46494353", "0.46494353", "0.45718247", "0.4...
0.6606573
1
Need to pass a list of Card objects in. The deck should also know what game it's for. That information belongs with the deck since a deck will be made up of cards from just one game. Also, a deck for a given game should be able to tell you whether it's a legal deck for a given format in that game however, this is for s...
def __init__(self, decklist): self.decklist = decklist # Since Card implements __str__(), `print self.decklist` is a # good-enough string representation of the deck. Note that decks # should assert that count > 0 for all cards in the full deck. What # kind of validation do we wa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.deck = []\n for n in range(1, 14):\n card1 = Card(n, \"diamond\")\n self.deck.append(card1)\n\n for n in range(1, 14):\n card1 = Card(n, \"spade\")\n self.deck.append(card1)\n\n for n in range(1, 14):\n ca...
[ "0.7067736", "0.68714076", "0.681387", "0.6780888", "0.6776782", "0.67323965", "0.6661562", "0.66035146", "0.6578332", "0.654974", "0.6543735", "0.65101725", "0.64868504", "0.6482843", "0.6464824", "0.6463143", "0.6441016", "0.64017296", "0.6401417", "0.6359067", "0.6344033",...
0.729421
0
A mediumdifficulty question removes 1020 random cards from your deck, then asks which of four options the top card of your deck is most likely to be. Should be useful to most games, and it's easy to implement in a gameagnostic way, so it's here instead of in gamespecific code.
def most_likely_top_card(self, deck): question_string = "If {}have been removed from your deck, which of the following cards is most likely to be the top card of your deck?" answer_suffix = "is most likely to be the top card" reduced_deck = copy.deepcopy(deck) cards_to_remove = random.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_hand(hand, deck):\n possible = list()\n for c in combinations(hand, 4):\n possible.append([Cribbage.expected_score(list(c), deck), c])\n best = max(possible, key = lambda i : i[0])\n discard = list(set(hand) - set(best[1]))\n return best[1], discard", "def...
[ "0.66956043", "0.6490272", "0.6446676", "0.6376408", "0.6299008", "0.6255553", "0.62223595", "0.6184848", "0.6184359", "0.6096527", "0.6076049", "0.60742056", "0.60742056", "0.60742056", "0.60742056", "0.606422", "0.5953516", "0.5947961", "0.5947961", "0.5947961", "0.5944662"...
0.70982635
0
Return a scoped session (according to SQLAlchemy docs, this returns always the same object within a thread, and a different object in a different thread. Moreover, since we update the scopedsessionclass upon forking, also forks have different session objects.
def get_scoped_session(): if scopedsessionclass is None: s = None else: s = scopedsessionclass() return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session():\n session = scoped_session(sessionmaker(bind=engine))\n return session", "def get_session():\n return scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))", "def get_scoped_session():\n scoped_session = SESSION()\n try:\n yield scoped_session\n ...
[ "0.7187179", "0.71814144", "0.710347", "0.7078379", "0.7068919", "0.6859953", "0.67099005", "0.67088383", "0.6662891", "0.6648465", "0.6634474", "0.6613667", "0.6585746", "0.658351", "0.65781957", "0.65781957", "0.6575925", "0.6549415", "0.65426534", "0.65316164", "0.65285134...
0.7503224
0
>>> chequejaCaixa([[2,7,6,3,1,4,9,5,8],[8,5,4,9,6,2,7,1,3],[9,1,3,8,7,5,2,6,4],[4, 6, 8, 1, 2, 7, 3, 9, 5], [ 5, 9, 7, 4, 3, 8, 6, 2, 1], [1, 3, 2, 5, 9, 6, 4, 8, 7],[3, 2, 5, 7, 8, 9, 1, 4, 6], [6, 4, 1, 2, 5, 3, 8, 7, 9], [7, 8, 9, 6, 4, 1, 5, 3, 2]]) True >>> chequejaCaixa([[2,7,5,3,1,4,9,6,8],[8,5,4,9,6,2,7,1,3],[9...
def chequejaCaixa(m): for caixaX in range(3): for caixaY in range(3): #Per una caixa numsUtilitzats ="" for i in range (caixaX*3, caixaX*3 + 3): for j in range(caixaY*3, caixaY*3 + 3): if(m[i][j] < 1 or m[i][j] > 9): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Tablero_completo(self,matriz:list) -> bool:\n\t\tfor i in range(6):\n\t\t\tfor j in range(6):\n\t\t\t\tif matriz[i][j]==0:\n\t\t\t\t\treturn False\n\t\treturn True", "def entrada(self, linha, coluna):\n matriz = [[ 0 for x in range(coluna) ] for y in range (linha)]\n vetor_linha = [0, 1, 0, -...
[ "0.5899558", "0.5898364", "0.584221", "0.56435746", "0.54986304", "0.5476072", "0.5394028", "0.5356176", "0.5284666", "0.51707196", "0.5153619", "0.51265126", "0.51237506", "0.5084624", "0.50804573", "0.5059511", "0.5059344", "0.5040672", "0.50087786", "0.50064075", "0.497978...
0.666221
0
The function determines whether dealer has a card that would qualify for discard or not
def dealer_matching(self): if len([card for card in self.dealer_hand if card[1] == '8']) > 0: self.discard_pile = [card for card in self.dealer_hand if card[1] == '8'][0] self.dealer_hand.remove(self.discard_pile) dealer_suits = [card[0] for card in self.dealer_hand] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cardDiscardable(self, card):\n if self.cardDead(card):\n return True\n\n cardAttr = \"\"\n if Suit.toString(card.getSuit()) == \"white\":\n cardAttr = \"w\"\n elif Suit.toString(card.getSuit()) == \"blue\":\n cardAttr = \"b\"\n elif Suit.toStr...
[ "0.8037587", "0.6778592", "0.6672884", "0.6595173", "0.6592071", "0.6523255", "0.6504276", "0.6475008", "0.6374864", "0.636109", "0.6359076", "0.6343342", "0.63184786", "0.62778324", "0.6257041", "0.62546676", "0.62442625", "0.6229118", "0.6229065", "0.62240404", "0.6197725",...
0.68221676
1
Test the updating of calendarfreebusyset xattrs on inboxes
def test_freeBusyUpgrade(self): self.setUpInitialStates() directory = self.directory # # Verify these values require no updating: # # Uncompressed XML value = "<?xml version='1.0' encoding='UTF-8'?>\r\n<calendar-free-busy-set xmlns='urn:ietf:params:xml:ns:calda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_calendar_query_partial_freebusy(self):\n raise SkipTest(\"test unimplemented\")", "def test_update_custom_button(self):\n pass", "def test_calendarsUpgradeWithUIDs(self):\n\n before = {\n \"calendars\":\n {\n \"__uids__\":\n {\n ...
[ "0.54488975", "0.519129", "0.51017874", "0.50756145", "0.5068723", "0.5064646", "0.5036777", "0.50349975", "0.50123906", "0.49567854", "0.49487585", "0.49486288", "0.48828766", "0.48776853", "0.48565727", "0.48427084", "0.4841117", "0.48325676", "0.4821195", "0.4814", "0.4812...
0.62855875
0
Verify that the hierarchy described by "before", when upgraded, matches the hierarchy described by "after".
def verifyDirectoryComparison(self, before, after, reverify=False): root = self.createHierarchy(before) config.DocumentRoot = root config.DataRoot = root (yield self.doUpgrade(config)) self.assertTrue(self.verifyHierarchy(root, after)) if reverify: # Ensure...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertBalanceChange (self, before, changes):\n\n after = self.getBalances ()\n assert_equal (len (before), len (changes))\n assert_equal (after, [before[i] + changes[i] for i in range (len (before))])", "def _detect_changes(before_states, after_states):\n\n return MigrationAutodetector(\n ...
[ "0.62915796", "0.611342", "0.59514964", "0.5916525", "0.5836583", "0.57875043", "0.57854444", "0.5783139", "0.578169", "0.5724749", "0.57057667", "0.5702303", "0.5697221", "0.5692152", "0.5687135", "0.5671171", "0.563159", "0.563159", "0.5571707", "0.5537103", "0.55254525", ...
0.72657055
0
The upgrade process should remove unused notification directories in users' calendar homes, as well as the XML files found therein.
def test_removeNotificationDirectories(self): before = { "calendars": { "users": { "wsanchez": { "calendar": { db_basename: { "@contents": "", }, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cleanPackageDir(self, *_):\r\n for _, path in self._pkgDir:\r\n os.rmdir(os.path.join(self._rootfs, path))\r\n\r\n assert len(self._containers) == 0", "def cleanupInstall(self):\n\n os.chdir( os.path.dirname(self.installPath) )\n tryunlink( self.download.tarball )", ...
[ "0.6124525", "0.6064273", "0.5862961", "0.58584833", "0.5794497", "0.5785999", "0.57849133", "0.5784629", "0.57541484", "0.57509446", "0.57488537", "0.57299966", "0.5702775", "0.5690832", "0.5685405", "0.56484056", "0.56467074", "0.56436086", "0.5637158", "0.5624792", "0.5621...
0.65725094
0
Verify that calendar homes in the /calendars/// form whose records don't exist are moved into dataroot/archived/
def test_calendarsUpgradeWithOrphans(self): before = { "calendars": { "users": { "unknownuser": { }, }, "groups": { "unknowngro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_calendarsUpgradeWithDuplicateOrphans(self):\n\n before = {\n \"archived\":\n {\n \"unknownuser\":\n {\n },\n \"unknowngroup\":\n {\n },\n },\n \"calendars\":\n ...
[ "0.6892958", "0.64702445", "0.59006584", "0.5871715", "0.5591878", "0.55893683", "0.5515116", "0.5494797", "0.53261685", "0.52998716", "0.52600235", "0.5235838", "0.5230849", "0.52290356", "0.51895154", "0.5150668", "0.5131935", "0.51303554", "0.50978", "0.5095233", "0.507746...
0.7058807
0
Verify that calendar homes in the /calendars/// form whose records don't exist are moved into dataroot/archived/
def test_calendarsUpgradeWithDuplicateOrphans(self): before = { "archived": { "unknownuser": { }, "unknowngroup": { }, }, "calendars": { "u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_calendarsUpgradeWithOrphans(self):\n\n before = {\n \"calendars\":\n {\n \"users\":\n {\n \"unknownuser\":\n {\n },\n },\n \"groups\":\n {\n ...
[ "0.7058937", "0.64720345", "0.590238", "0.5872786", "0.5592633", "0.5588349", "0.5517519", "0.5494793", "0.53246284", "0.5299591", "0.5261831", "0.52328426", "0.52309614", "0.5229098", "0.51864475", "0.5152008", "0.5129799", "0.5129616", "0.509695", "0.5096544", "0.5079429", ...
0.68933755
1
Unknown files, including .DS_Store files at any point in the hierarchy, as well as nondirectory in a user's calendar home, will be ignored and not interrupt an upgrade.
def test_calendarsUpgradeWithUnknownFiles(self): ignoredUIDContents = { "64": { "23": { "6423F94A-6B76-4A3A-815B-D52CFD77935D": { "calendar": { db_basename: { "@contents": "", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CheckForUnknownFiles(self):\n unknown_files = self.GetUnknownFiles()\n if unknown_files:\n print \"The following files are not added to version control:\"\n for line in unknown_files:\n print line\n prompt = \"Are you sure to continue?(y/N) \"\n answer = raw_input(prompt).strip...
[ "0.61615694", "0.61526537", "0.590852", "0.5865593", "0.58169883", "0.5709954", "0.5677684", "0.56375474", "0.5619872", "0.5615769", "0.5602505", "0.5568837", "0.5514606", "0.55021447", "0.5469052", "0.5466647", "0.546537", "0.54529905", "0.54308003", "0.54149336", "0.5402871...
0.68915445
0
Verify that calendar homes in the /calendars/__uids__// form are upgraded to /calendars/__uids__/XX/YY// form
def test_calendarsUpgradeWithUIDs(self): before = { "calendars": { "__uids__": { "6423F94A-6B76-4A3A-815B-D52CFD77935D": { "calendar": { db...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_calendarsUpgradeWithDuplicateOrphans(self):\n\n before = {\n \"archived\":\n {\n \"unknownuser\":\n {\n },\n \"unknowngroup\":\n {\n },\n },\n \"calendars\":\n ...
[ "0.6521772", "0.65184355", "0.644795", "0.6287781", "0.6244558", "0.62066233", "0.6160223", "0.5841681", "0.5369036", "0.5337584", "0.5312082", "0.525256", "0.5214574", "0.513125", "0.5101096", "0.5082935", "0.506659", "0.50127804", "0.50119203", "0.49426952", "0.49366602", ...
0.6769738
0
Ensure that calendar user addresses (CUAs) are cached so we can reduce the number of principal lookup calls during upgrade.
def test_normalizeCUAddrs(self): class StubRecord(object): def __init__(self, fullNames, uid, cuas): self.fullNames = fullNames self.uid = uid self.calendarUserAddresses = cuas def getCUType(self): return "INDIVIDUAL" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reload_acls(self):\n\t\tself.acls = ACLs()", "def figure_out_real_accounts(people_involved, people_caches):\n # Using '+' as a filter removes a fair number of WATCHLISTS entries.\n people_involved = set(\n i for i in people_involved\n if ('+' not in i and\n not i.startswith('commit-bot') ...
[ "0.5056765", "0.50430185", "0.50411654", "0.49688035", "0.48858058", "0.48572317", "0.4816586", "0.48022962", "0.48006323", "0.47516596", "0.4751512", "0.47317553", "0.47303107", "0.4713648", "0.46938983", "0.4681661", "0.4647238", "0.46310037", "0.46113184", "0.4600518", "0....
0.65721285
0
Verify conversion of old resources.xml format to twext.who.xml format
def test_resourcesXML(self): fileName = self.mktemp() fp = FilePath(fileName) fp.setContent(oldResourcesFormat) upgradeResourcesXML(fp) self.assertEquals(fp.getContent(), newResourcesFormat)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_augmentsXML(self):\n fileName = self.mktemp()\n fp = FilePath(fileName)\n fp.setContent(oldAugmentsFormat)\n upgradeAugmentsXML(fp)\n self.assertEquals(fp.getContent(), newAugmentsFormat)", "def _check_deprecated_openerp_xml_node(self):\n xml_files = self.filter...
[ "0.57672864", "0.56299335", "0.5602613", "0.5601678", "0.5579377", "0.5514357", "0.5493907", "0.5473611", "0.5369198", "0.5347428", "0.5339022", "0.5327907", "0.53258663", "0.5279402", "0.5250793", "0.52303827", "0.51986897", "0.5194378", "0.5167916", "0.51619595", "0.5104468...
0.7313695
0
Spams transactions with the same nonce, and ensures the server rejects all but one
async def test_transaction_nonce_lock(self): no_tests = 20 txs = [] tx = await self.get_tx_skel(FAUCET_PRIVATE_KEY, TEST_ADDRESS, 10 ** 10) dtx = decode_transaction(tx) txs.append(sign_transaction(tx, FAUCET_PRIVATE_KEY)) for i in range(11, 10 + no_tests): t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_prevent_out_of_order_txs(self):\n\n tx1 = await self.get_tx_skel(FAUCET_PRIVATE_KEY, TEST_ADDRESS, 10 ** 10)\n dtx1 = decode_transaction(tx1)\n stx1 = sign_transaction(tx1, FAUCET_PRIVATE_KEY)\n tx2 = await self.get_tx_skel(FAUCET_PRIVATE_KEY, TEST_ADDRESS, 10 ** 10, dtx1...
[ "0.69079286", "0.58825755", "0.5746995", "0.5733096", "0.5711697", "0.567918", "0.56385994", "0.5612486", "0.5612486", "0.55686194", "0.5554134", "0.55391735", "0.54671746", "0.5456013", "0.54439116", "0.5411669", "0.537741", "0.5359163", "0.53529143", "0.5338359", "0.5334859...
0.7153444
0
Spams transactions with the same nonce, and ensures the server rejects all but one
async def test_prevent_out_of_order_txs(self): tx1 = await self.get_tx_skel(FAUCET_PRIVATE_KEY, TEST_ADDRESS, 10 ** 10) dtx1 = decode_transaction(tx1) stx1 = sign_transaction(tx1, FAUCET_PRIVATE_KEY) tx2 = await self.get_tx_skel(FAUCET_PRIVATE_KEY, TEST_ADDRESS, 10 ** 10, dtx1.nonce + 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_transaction_nonce_lock(self):\n\n no_tests = 20\n\n txs = []\n tx = await self.get_tx_skel(FAUCET_PRIVATE_KEY, TEST_ADDRESS, 10 ** 10)\n dtx = decode_transaction(tx)\n txs.append(sign_transaction(tx, FAUCET_PRIVATE_KEY))\n for i in range(11, 10 + no_tests):\...
[ "0.7153444", "0.58825755", "0.5746995", "0.5733096", "0.5711697", "0.567918", "0.56385994", "0.5612486", "0.5612486", "0.55686194", "0.5554134", "0.55391735", "0.54671746", "0.5456013", "0.54439116", "0.5411669", "0.537741", "0.5359163", "0.53529143", "0.5338359", "0.5334859"...
0.69079286
1
Return controller instance that is based on the equipment role.
def get_controller(equipment, accessmethod, logfile=None): path = _CONTROLLERMAP[accessmethod] constructor = module.get_object(path) return constructor(equipment, logfile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controller( self ):\n\t\ttry:\n\t\t\treturn self._controller\n\t\texcept Exception as e:\n\t\t\tself.logToConsole( \"controller: %s\" % str(e) )", "def _get_controller(self):\n return self.__controller", "def controller(self) -> Optional['outputs.CSIPowerStoreSpecDriverController']:\n return pulu...
[ "0.6269231", "0.6233761", "0.6187338", "0.6164868", "0.6092095", "0.60748947", "0.6031051", "0.5952912", "0.5898791", "0.58094746", "0.58000463", "0.57449204", "0.5729063", "0.5727584", "0.5714278", "0.5706469", "0.569184", "0.566643", "0.5543107", "0.55369985", "0.5530174", ...
0.71080726
0
Converts the given data frame into a list of lists. When the `row` paremeter is given with a value >= 0, only that row is extracted as list from the data frame.
def as_list(df: pandas.DataFrame, row=-1) -> list: if df is None: return [] if row >= 0: rec = [] for col in range(0, 13): rec.append(df.iat[row, col]) return rec recs = [] for row in range(df.shape[0]): recs.append(as_list(df, row=row))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataframe_to_list(df: pandas.DataFrame) -> list:\n return json.loads(df.to_json(orient=\"records\"))", "def column_to_list(data, index):\n return [line[index] for line in data]", "def rows_from_data (data):\n return data.tolist() # use numpy.ndarray conversion function", "def ...
[ "0.6662499", "0.6641174", "0.6313694", "0.6297723", "0.62273407", "0.6145791", "0.60353565", "0.60344374", "0.6024161", "0.60228693", "0.59896314", "0.59687847", "0.59476876", "0.5942627", "0.592644", "0.58992493", "0.5875752", "0.58308697", "0.58127946", "0.5726091", "0.5696...
0.83004636
0
Inherite the query here to add the woo instance field for group by.
def _query(self, with_clause='', fields={}, groupby='', from_clause=''): fields['woo_instance_id'] = ", s.woo_instance_id as woo_instance_id" groupby += ', s.woo_instance_id' return super(SaleReport, self)._query(with_clause, fields, groupby, from_clause)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate_query(self):\n raise NotImplementedError", "def group_by(self, *args):\n for name in args:\n assert name in self._fields or name in self._calculated_fields, \\\n 'Cannot group by `%s` since it is not included in the query' % name\n qs = copy(self)\n...
[ "0.5847245", "0.5766902", "0.57639116", "0.5744305", "0.5731105", "0.5619564", "0.5573698", "0.5570105", "0.54822487", "0.5438589", "0.5371942", "0.534263", "0.5284601", "0.5278813", "0.5276851", "0.52438235", "0.51627016", "0.51558334", "0.5118398", "0.5118195", "0.5111496",...
0.7433047
0
Run clingo with the provided argument list and return the parsed JSON result.
def solve(*args): args = ['clingo','--outf=2']+list(args) print ' '.join(args) clingo = subprocess.Popen( ' '.join(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True ) out, err = clingo.communicate() if err: print err with open('dump...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cc_json():\n return sh(\"intercept-build ./build.py compile:\\\\* -R; ./build.py -c compile:\\\\*\")", "def xcresulttool_json(*args):\n args = list(args) + ['--format', 'json']\n contents = xcresulttool(*args)\n return json.loads(contents)", "def xcresulttool_json(*args):\n args = list(args) + ['--f...
[ "0.5743908", "0.57331854", "0.57331854", "0.5550003", "0.55271095", "0.52811164", "0.5247224", "0.52448386", "0.52060694", "0.5136273", "0.5135224", "0.5096528", "0.5070134", "0.50677496", "0.50677496", "0.5049834", "0.5035326", "0.5027086", "0.50106984", "0.500295", "0.49970...
0.6133359
0
Like solve() but uses a random sign heuristic with a random seed.
def solve_randomly(*args): args = list(args[0]) + ["--sign-def=3","--seed="+str(random.randint(0,1<<30))] return solve(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def find():\n b = 0\n q = 0\n while b == q:\n seq = [randint(-10, 10) for _ in range(randint(15, 30))]\n b, b_at = brute_force(seq)\n q = solution(seq)\n print(seq, b, q, b_at)", "def initLocalBestChoice(self):\n random.seed()\n return", "def...
[ "0.5972131", "0.595319", "0.5898223", "0.58782655", "0.5782235", "0.5782235", "0.5760689", "0.5755695", "0.57238746", "0.56515795", "0.5626522", "0.5608089", "0.55490136", "0.54761404", "0.5436409", "0.5363292", "0.53548735", "0.5340229", "0.5321458", "0.52873623", "0.5283367...
0.8397691
0
Parse the provided JSON text and extract a dict representing the predicates described in the first solver result.
def parse_json_result(out): result = json.loads(out) assert len(result['Call']) > 0 assert len(result['Call'][0]['Witnesses']) > 0 witness = result['Call'][0]['Witnesses'][0]['Value'] class identitydefaultdict(collections.defaultdict): def __missing__(self, key): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reach_process_text():\n response = request.body.read().decode('utf-8')\n body = json.loads(response)\n text = body.get('text')\n rp = reach.process_text(text)\n if rp and rp.statements:\n stmts = stmts_to_json(rp.statements)\n res = {'statements': stmts}\n return res\n el...
[ "0.5605068", "0.5600367", "0.54364705", "0.52712244", "0.5269811", "0.52465916", "0.51889664", "0.5111044", "0.5047918", "0.50293493", "0.49568862", "0.4936398", "0.49341658", "0.49337515", "0.49258518", "0.4897983", "0.48910117", "0.48890945", "0.48828137", "0.48752654", "0....
0.63283634
0
Returns a tuple of (constants, functions, properties) constants a sorted list of (name, features) tuples, including all constants except for SCLEX_ constants which are presumed not used by scripts. The SCI_ constants for functions are omitted, since they can be derived, but the SCI_ constants for properties are include...
def GetScriptableInterface(f): constants = [] # returned as a sorted list functions = {} # returned as a sorted list of items properties = {} # returned as a sorted list of items for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_functions():\n\treturn [f for f in globals() if f.startswith('make_')]", "def get_constants(self):\n return self.D1, self.D2, self.A1, self.A2, \\\n self.F1, self.F2, self.S12", "def list_step_functions() -> List[str]:\n return list(STEP_SCORES_MAP.keys())", "def get_defined...
[ "0.5691015", "0.56161505", "0.5587567", "0.55644184", "0.5510985", "0.54930717", "0.5430147", "0.5411343", "0.5374079", "0.53456837", "0.52303857", "0.5223214", "0.51945597", "0.5171993", "0.51279044", "0.5125285", "0.51191556", "0.5116045", "0.5112311", "0.5022907", "0.49247...
0.6213655
0
Shows the given View controller.
def showViewController(viewController): __PyContentViewController__.shared.setRootViewController(viewController)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug_view(self):\n\n self.view.show()", "def show(self):\n self.Show()", "def show(self):\n self.wid.show()", "def show(self):\n self.scene().show()", "def Show(self):\r\n return Control.Show(self)", "def show(self):\n self._impl.show()", "def show(self):\...
[ "0.6725987", "0.6593572", "0.6456488", "0.63563937", "0.6289247", "0.62467057", "0.62319267", "0.62244475", "0.6197007", "0.6121775", "0.609827", "0.5939371", "0.59245074", "0.59083045", "0.589036", "0.5832835", "0.5802848", "0.5787498", "0.56053865", "0.5597037", "0.55964655...
0.7933866
0
Search a list of (header, value) tuples for a debug header. If found, return the index. Otherwise, return 1.
def find_debug_header(self, header_list): matchers = { "debug_uri": ("location", False), "debug_token": (self.debug_header.lower(), True) } for i, htup in enumerate(header_list): header, val = htup for attr in matchers: h, ret = ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sample_idx(sample, header):\n\n for item in header:\n if sample in item:\n return header.index(item)\n\n print(sample + \" not found in header, check input files.\")\n sys.exit()", "def index_from_headers(self, item):\n assert item in set(self.headers), f\"String of {ite...
[ "0.64398503", "0.60269237", "0.5929694", "0.5926794", "0.5895366", "0.58858496", "0.58537346", "0.5735795", "0.57175994", "0.57111824", "0.5660905", "0.56124383", "0.55739796", "0.55615", "0.5545172", "0.5544696", "0.5517766", "0.55092615", "0.5485651", "0.5432676", "0.542341...
0.80507034
0
Initialize object that handles counting of words
def __init__(self): self.word_count_dict = {} self.num_comments = 0 self.num_words = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n #\r\n # Create dictionaries for each characteristic\r\n #\r\n self.words = {} # For counting words\r\n self.wordlengths = {} # For counting word lengths\r\n self.stems = {} # For counting stems\r\n self.sentencelengths...
[ "0.75186896", "0.7517636", "0.7487317", "0.74007696", "0.72729164", "0.7101917", "0.7101241", "0.7074422", "0.6983678", "0.6976498", "0.69556195", "0.6916977", "0.6903863", "0.68937266", "0.68930876", "0.68808365", "0.6868824", "0.68647087", "0.686444", "0.68576026", "0.68557...
0.80315834
0
Instantiate the class with data. this class gets called from a PptxTable.
def __init__(self, data): self.data = data self.columns = Columns(data) self.rows = Rows(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n _snap.TTableRow_swiginit(self, _snap.new_TTableRow())", "def __init__(self, table):\n\n self.table = table\n\n ## Lots of shortcutting\n # \"Connection\"\n self.client = self.table.db.client\n\n # Table object\n self.worksheet = self.table.wo...
[ "0.7175044", "0.7061784", "0.688019", "0.687335", "0.68206704", "0.68206704", "0.68206704", "0.68206704", "0.68206704", "0.68206704", "0.68206704", "0.68206704", "0.68206704", "0.68206704", "0.68206704", "0.6778853", "0.66937035", "0.6593775", "0.6545444", "0.6529477", "0.652...
0.7786698
0
Updates the column index to account for the headers and updates the data self.data.
def set_column_headers(self, headers): if isinstance(self.columns.idx[0], int): self.data = [sorted(headers)] + self.data increment = [i + 1 for i in self.rows.idx] self.rows.idx = [0] + increment elif isinstance(self.columns.idx[0], str): datum = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateColumns(self):\r\n data = self.data\r\n columns = data.getParam('columns',data.tankColumns[:])\r\n col_name = data.getParam('colNames',{})\r\n col_width = data.getParam('colWidths',{})\r\n col_align = data.getParam('colAligns',{})\r\n for index,column in enumerat...
[ "0.66377145", "0.61051923", "0.60043097", "0.59972775", "0.5958276", "0.5950638", "0.5932546", "0.5932343", "0.5900175", "0.5803581", "0.57608676", "0.573972", "0.57000065", "0.56839633", "0.5668996", "0.56637555", "0.5663126", "0.5660447", "0.5659867", "0.56540513", "0.56156...
0.69262457
0
Returns the origin's type specs. A TFXIO 'Y' may be a result of projection of another TFXIO 'X', in which case then 'X' is the origin of 'Y'. And this method returns what X.TensorAdapter().TypeSpecs() would return. May equal to `self.TypeSpecs()`.
def OriginalTypeSpecs(self) -> Dict[str, tf.TypeSpec]: return self._original_type_specs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TypeSpecs(self) -> Dict[str, tf.TypeSpec]:\n return self._type_specs", "def get_spec_type(self):\r\n return self._spec_type", "def gettypes(self):\n return [str(self.sd.xlate(t[0])) for t in self.sd.types]", "def numpy_types(self) -> List[np.dtype]:\n if self.is_tensor_spec():\n ...
[ "0.67809033", "0.6172155", "0.6097099", "0.5830014", "0.5826194", "0.58002317", "0.5799282", "0.5738908", "0.5685234", "0.5614321", "0.558659", "0.5584207", "0.5573686", "0.5501269", "0.54489535", "0.5427112", "0.53903335", "0.5382472", "0.5372961", "0.53345495", "0.5292687",...
0.65551096
1
Returns the TypeSpec for each tensor.
def TypeSpecs(self) -> Dict[str, tf.TypeSpec]: return self._type_specs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_spec(self) -> tf.TypeSpec:\n raise NotImplementedError", "def numpy_types(self) -> List[np.dtype]:\n if self.is_tensor_spec():\n return [x.type for x in self.inputs]\n return [x.type.to_numpy() for x in self.inputs]", "def get_all_tensor_dtypes() -> KeysView[int]:\n retu...
[ "0.66568756", "0.6340732", "0.6339329", "0.62210155", "0.61656004", "0.60684854", "0.5887791", "0.58818924", "0.571628", "0.5686403", "0.56000185", "0.5598356", "0.5592052", "0.55783784", "0.55601513", "0.5499973", "0.5484487", "0.5443799", "0.5402399", "0.53958815", "0.53845...
0.74948585
0
Returns a batch of tensors translated from `record_batch`.
def ToBatchTensors( self, record_batch: pa.RecordBatch, produce_eager_tensors: Optional[bool] = None) -> Dict[str, Any]: tf_executing_eagerly = tf.executing_eagerly() if produce_eager_tensors and not tf_executing_eagerly: raise RuntimeError( "Eager Tensors were requested but e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetTensor(self, record_batch: pa.RecordBatch,\n produce_eager_tensors: bool) -> Any:", "def transform_batch(self, the_batch):\n return (\n arg.to(self.device) if isinstance(arg, torch.Tensor) else arg\n for arg in the_batch\n )", "def generate_batch(\n ...
[ "0.68435967", "0.67113644", "0.64927554", "0.6489503", "0.6200377", "0.6178752", "0.6141338", "0.60852915", "0.60623634", "0.6045422", "0.59889543", "0.5961333", "0.59462744", "0.592611", "0.5886543", "0.5885961", "0.5879243", "0.5869325", "0.5849582", "0.5841679", "0.5822695...
0.7057336
0
Initializer. It can be assumed that CanHandle(arrow_schema, tensor_representation) would return true.
def __init__(self, arrow_schema: pa.Schema, tensor_representation: schema_pb2.TensorRepresentation):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CanHandle(arrow_schema: pa.Schema,\n tensor_representation: schema_pb2.TensorRepresentation) -> bool:", "def __init__(self, schema: dict, **kwargs) -> None:\r\n self.case_check = case_check(settings.CASE)\r\n self.ignored_keys = set_ignored_keys(**kwargs)\r\n if read_type(...
[ "0.6957694", "0.58774436", "0.5753732", "0.57403076", "0.55515134", "0.55478054", "0.54788816", "0.5473977", "0.54100204", "0.5403191", "0.5394013", "0.5376588", "0.5372768", "0.53579617", "0.53541607", "0.5344507", "0.53393805", "0.5317258", "0.5312363", "0.5267516", "0.5265...
0.75617373
0
Returns the TypeSpec of the converted Tensor or CompositeTensor.
def type_spec(self) -> tf.TypeSpec: raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spec_type(self):\r\n return self._spec_type", "def TypeSpecs(self) -> Dict[str, tf.TypeSpec]:\n return self._type_specs", "def get_tf_dtype(dtype): # pylint: disable=too-many-return-statements\n if dtype in {'float', 'float32', 'tf.float32', float,\n np.float32, tf.float32}...
[ "0.6116064", "0.60049427", "0.597106", "0.56536496", "0.56475276", "0.55525804", "0.55150294", "0.549156", "0.5469775", "0.54503685", "0.5421005", "0.54045445", "0.53997046", "0.53790647", "0.53731406", "0.5366895", "0.5364541", "0.5344615", "0.53302383", "0.53137934", "0.530...
0.68329406
0
Converts the RecordBatch to Tensor or CompositeTensor. The result must be of the same (not only compatible) TypeSpec as self.type_spec.
def GetTensor(self, record_batch: pa.RecordBatch, produce_eager_tensors: bool) -> Any:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, batch: iter) -> torch.Tensor or list(torch.Tensor):\n if torch.is_tensor(batch[0]):\n return torch.cat(tuple(t.unsqueeze(0) for t in batch), 0).view(-1, self.batch_size, *batch[0].size())\n elif isinstance(batch[0], int):\n return torch.LongTensor(batch).view(...
[ "0.63535535", "0.60607845", "0.5949915", "0.5802738", "0.5792601", "0.5786943", "0.5721988", "0.5646653", "0.5506841", "0.5362173", "0.5297846", "0.5296241", "0.52926576", "0.5283197", "0.5271365", "0.5257141", "0.52229846", "0.52151346", "0.5209855", "0.5195071", "0.51758224...
0.6129063
1
Converts a ListArray to a dense tensor.
def _ListArrayToTensor( self, list_array: pa.Array, produce_eager_tensors: bool) -> Union[np.ndarray, tf.Tensor]: values = list_array.flatten() batch_size = len(list_array) expected_num_elements = batch_size * self._unbatched_flat_len if len(values) != expected_num_elements: raise Valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sparse_to_dense(self, tensor: tf.Tensor, output_shape: tf.TensorShape) -> tf.Tensor:\n return tf.scatter_nd(self.observations_index, tensor, output_shape)", "def dense_to_sparse(self, tensor: tf.Tensor) -> tf.Tensor:\n tensor_shape = tensor.shape\n expand_dims = len(tensor_shape) == 3\n\...
[ "0.6261433", "0.60625476", "0.5917142", "0.58886254", "0.5838281", "0.57698417", "0.5738672", "0.56580937", "0.5619259", "0.55969185", "0.5541283", "0.5505446", "0.54937375", "0.5480769", "0.5433032", "0.54126364", "0.53512746", "0.5347285", "0.53289104", "0.53236985", "0.532...
0.6430456
0
Builds type handlers according to TensorRepresentations.
def _BuildTypeHandlers( tensor_representations: Dict[str, schema_pb2.TensorRepresentation], arrow_schema: pa.Schema) -> List[Tuple[str, _TypeHandler]]: result = [] for tensor_name, rep in tensor_representations.items(): potential_handlers = _TYPE_HANDLER_MAP.get(rep.WhichOneof("kind")) if not potent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TensorRepresentations(self) -> tensor_adapter.TensorRepresentations:", "def build(self, input_tensors, is_training, lengths=None, hparams=None):", "def _build_tensor_info(tensor_dict):\n return {\n k: tf.compat.v1.saved_model.utils.build_tensor_info(t)\n for k, t in tensor_dict.items()\n }", ...
[ "0.5455603", "0.5400152", "0.5234202", "0.51972973", "0.5190988", "0.51100725", "0.50209606", "0.50017303", "0.4946088", "0.4935415", "0.4932959", "0.49186134", "0.4878031", "0.48477086", "0.4841599", "0.48182094", "0.48147652", "0.48146516", "0.47980627", "0.47892433", "0.47...
0.7305379
0
Enumerates nested types along a column_path. A nested type is either a listlike type or a struct type. It uses `column_path`[0] to first address a field in the schema, and enumerates its type. If that type is nested, it enumerates its child and continues recursively until the column_path reaches an end. The child of a ...
def _EnumerateTypesAlongPath(arrow_schema: pa.Schema, column_path: path.ColumnPath, stop_at_path_end: bool = False) -> pa.DataType: field_name = column_path.initial_step() column_path = column_path.suffix(1) arrow_field = arrow_schema.field(field_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetNestDepthAndValueType(\n arrow_schema: pa.Schema,\n column_path: path.ColumnPath) -> Tuple[int, pa.DataType]:\n arrow_type = arrow_schema.field(column_path.steps()[0]).type\n depth = 0\n\n for arrow_type in _EnumerateTypesAlongPath(arrow_schema, column_path):\n if _IsListLike(arrow_type):\n ...
[ "0.67806774", "0.5649272", "0.52802294", "0.5041527", "0.5004218", "0.50018305", "0.49943122", "0.4993439", "0.4964379", "0.49569297", "0.4941945", "0.4900904", "0.48964566", "0.48888087", "0.48849034", "0.48633215", "0.4858233", "0.48521087", "0.48463467", "0.48446807", "0.4...
0.7417042
0
Returns a function that converts a StringArray to BinaryArray.
def _GetConvertToBinaryFn( array_type: pa.DataType) -> Optional[Callable[[pa.Array], pa.Array]]: if pa.types.is_string(array_type): return lambda array: array.view(pa.binary()) if pa.types.is_large_string(array_type): return lambda array: array.view(pa.large_binary()) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tobinary_multiples(arr):\n return [np.array(arr_i).tobytes() for arr_i in arr]", "def get_string_binary(string):\r\n string_binary_array = []\r\n\r\n # Create array of binaries from the string\r\n for character in string:\r\n string_binary_array.append(get_binary(character))\r\n\r\n # C...
[ "0.652799", "0.6486571", "0.6189265", "0.61772597", "0.60881764", "0.6065052", "0.59320545", "0.58606786", "0.58524144", "0.58404696", "0.5823679", "0.5797087", "0.57892406", "0.5775931", "0.5766405", "0.5760254", "0.5730116", "0.57267714", "0.5702361", "0.56939006", "0.56433...
0.71034527
0
Creates and concatenates the map and reduce pools,
def create_pools(finalize, reduce_size=-1): # Create the reduce pool LOGGER.debug("Creating reduce pool") reduce_pool = RedPool(reduce_task) # Set attributes reduce_pool.on_done = finalize if reduce_size > 1: reduce_pool.group_size = reduce_size # Create the map pool LOGGER.deb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_pool(self):\n self._pool = [0] * N\n if isinstance(self._bases, dict):\n for base, num in self._bases.items():\n self._pool[to_code(base)] += num\n elif isinstance(self._bases, list):\n for base in self._bases:\n self._pool[to_code(...
[ "0.5690839", "0.5648045", "0.5546011", "0.5538413", "0.55374104", "0.54235184", "0.5396628", "0.53945255", "0.53736633", "0.5349251", "0.53477794", "0.53184974", "0.5250934", "0.5247123", "0.52167875", "0.5189451", "0.517974", "0.51670843", "0.51543236", "0.5147", "0.51386416...
0.7103352
0
Test whether can parse a pipe
def test_pipe(): parser = CmdParser([posandtwo, valprog]) out = parser.parse("posandtwo | valprog") assert isinstance(out[0], ProgramNode) assert out[0].program_desc == posandtwo assert isinstance(out[1], PipeNode) assert isinstance(out[2], ProgramNode) assert out[2].program_desc == valprog ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pipe2():\n parser = CmdParser([posandtwo, valprog])\n out = parser.parse(\"posandtwo | valprog | posandtwo\")\n assert isinstance(out[0], ProgramNode)\n assert isinstance(out[1], PipeNode)\n assert isinstance(out[2], ProgramNode)\n assert isinstance(out[3], PipeNode)\n assert isinstan...
[ "0.68179655", "0.6040547", "0.6036297", "0.5914417", "0.5893625", "0.578709", "0.557524", "0.5528742", "0.55239904", "0.5494209", "0.5474658", "0.53684044", "0.53115535", "0.5283069", "0.52190304", "0.52190304", "0.51897234", "0.5186336", "0.514774", "0.5147619", "0.51244754"...
0.7330331
0
Test whether can parse several pipes
def test_pipe2(): parser = CmdParser([posandtwo, valprog]) out = parser.parse("posandtwo | valprog | posandtwo") assert isinstance(out[0], ProgramNode) assert isinstance(out[1], PipeNode) assert isinstance(out[2], ProgramNode) assert isinstance(out[3], PipeNode) assert isinstance(out[4], Pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pipe():\n parser = CmdParser([posandtwo, valprog])\n out = parser.parse(\"posandtwo | valprog\")\n assert isinstance(out[0], ProgramNode)\n assert out[0].program_desc == posandtwo\n assert isinstance(out[1], PipeNode)\n assert isinstance(out[2], ProgramNode)\n assert out[2].program_de...
[ "0.701313", "0.59645516", "0.56327486", "0.55999887", "0.55907416", "0.53708684", "0.53358024", "0.5299428", "0.5264803", "0.5258192", "0.52323353", "0.521374", "0.51996046", "0.51893926", "0.518938", "0.5164227", "0.51499546", "0.51329315", "0.51180947", "0.5110935", "0.5097...
0.6755077
1
A test to see if can handle findlike single dash for long args
def test_findlike(): parser = CmdParser([findlike]) out = parser.parse("findlike . -name foo") assert out[0].arguments[0].present == True assert out[0].arguments[0].value == "foo" assert out[0].arguments[1].present == True assert out[0].arguments[1].value == "." assert out[0].as_shell_string...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arg_option_long_only(self):\n optional_long = [\n arg for arg in cli_args.values() if len(arg.flags) == 1 and arg.flags[0].startswith(\"-\")\n ]\n for arg in optional_long:\n assert ILLEGAL_LONG_OPTION_PATTERN.match(arg.flags[0]) is None, f\"{arg.flags[0]} is not...
[ "0.6788855", "0.6294759", "0.6258076", "0.61646134", "0.61308974", "0.6072468", "0.5958455", "0.58832896", "0.58533525", "0.5805959", "0.5746239", "0.5735969", "0.57151854", "0.5693454", "0.56681514", "0.56567216", "0.5641007", "0.56351584", "0.5633745", "0.5623828", "0.56227...
0.64588284
1
Dont expect duplicate flags unless told.
def test_duplicate_flags(): parser = CmdParser([noArgs, onearg]) with pytest.raises(CmdParseError): out = parser.parse("onearg -a -a")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_duplicate(self, state):\n pass", "def SynchronizeFlags(self):\n pass", "def test_checkFlags(self):\n self.failUnlessEqual(self.nice.opts['aflag'], 1)\n self.failUnlessEqual(self.nice.opts['flout'], 0)", "def resetFlags():\r\n for flag in flags:\r\n flags[flag] ...
[ "0.61147404", "0.60242957", "0.59610164", "0.5883106", "0.5855223", "0.5831722", "0.57295144", "0.56410885", "0.5606265", "0.5586294", "0.5546479", "0.54805815", "0.5478503", "0.5455299", "0.5423713", "0.5400602", "0.539708", "0.53953934", "0.53726554", "0.53534085", "0.53386...
0.66306114
0
stop the execution and print out the captured error message.
def stop_err(msg): sys.stderr.write('%s\n' % msg) sys.exit(-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n if self.debug:\n print(\"%s stop\" % self.name)\n self.force_exit()", "def _stop(self):\n self.display_end_message()", "def stop() -> None:", "def stop_err(msg, error_level=1):\n sys.stderr.write(\"%s\\n\" % msg)\n sys.exit(error_level)", "def stop(s...
[ "0.7179926", "0.6989759", "0.69344425", "0.68685615", "0.68195295", "0.68195295", "0.6798366", "0.6798366", "0.6798366", "0.6798366", "0.67834127", "0.6706759", "0.6693671", "0.66405547", "0.66277504", "0.6595876", "0.6595876", "0.6584673", "0.6584673", "0.6577877", "0.657122...
0.7336493
0
Returns a list of iteration steps corrsponding to multiple of the stepsize time.
def get_steps_by_regular_time_interval(times, stepsize, max_time=None): if max_time is None: max_time = times[-1] chosen_times = arange(stepsize,max_time,stepsize) return get_steps_by_times(times,chosen_times)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getsteps(num_of_steps, limit):\n steps = []\n current = 0.0\n for i in range(0, num_of_steps):\n if i == num_of_steps - 1:\n steps.append(int(round(limit)))\n else:\n steps.append(int(round(current)))\n current += float(limit) / float(num_of_steps - 1)\n ...
[ "0.6362053", "0.6323178", "0.6312536", "0.6141533", "0.60039514", "0.6000389", "0.5971617", "0.5956176", "0.5933951", "0.589602", "0.5892214", "0.5855558", "0.5854265", "0.5840716", "0.58393264", "0.5838846", "0.5836665", "0.5818361", "0.58091825", "0.577143", "0.57600915", ...
0.6738848
0
Returns a list of iteration steps (think indices) corresponding to the first time after each of the sorted eval_times.
def get_steps_by_times(times,chosen_times): time_steps = [] chosen_index = 0 for i in range(len(times)): if times[i] >= chosen_times[chosen_index]: time_steps.append(i) chosen_index += 1 if chosen_index == len(chosen_times): #We're done return time_steps if chosen_index != len(cho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_list(self):\n return (self.N_T * (np.arange(self.N_itr) + 1) /\n self.N_itr * 1000 * self.DT)", "def get_timesteps(self, timesteps=None, every=None, samples=None):\n timedict = self.generate_timedict()\n\n if samples is not None:\n stride = len(timedict) //...
[ "0.58948535", "0.58846205", "0.5860858", "0.5825945", "0.57967544", "0.57846475", "0.57793707", "0.57188964", "0.56175333", "0.5607721", "0.5590442", "0.55815035", "0.55307555", "0.5507173", "0.5487642", "0.5441355", "0.5435563", "0.5435563", "0.5435563", "0.5398938", "0.5314...
0.65579444
0
Compute operation "option" on the item of the two files
def compute_opt(filenames, item, option): if len(filenames) == 2: file1 = os.path.join(ROOT_DATA, filenames[0]) file2 = os.path.join(ROOT_DATA, filenames[1]) if not os.path.isfile(file1) or not os.path.isfile(file2): print("One of the given files '%s' or '%s' does not exists" % ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(file1, file2, uniq1=False, uniq2=False, union=False, tab=False, col1=1, col2=1):\n delimiter = \"\\t\" if tab else \",\"\n\n idx1 = col1 - 1\n idx2 = col2 - 1\n\n # Figure out what the mode of operation is.\n show = ISECT\n show = UNIQ1 if uniq1 else show\n show = UNIQ2 if uniq2 else ...
[ "0.5435761", "0.5236189", "0.5221077", "0.5185513", "0.51824975", "0.51474214", "0.5124852", "0.51119435", "0.5088273", "0.49563205", "0.49543867", "0.4934598", "0.49257588", "0.49221843", "0.49147666", "0.49147666", "0.49069288", "0.48821086", "0.48575395", "0.4838069", "0.4...
0.6201015
0
run application use gunicorn http server
def run_gunicorn_server(app): from gunicorn.app.base import Application class FlaskApplication(Application): def init(self, parser, opts, args): return { 'bind': '{0}:{1}'.format(FLASK_HOST, FLASK_PORT), 'workers': 4 } def load(self): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gunicorn():\n # fmt: off\n if os.name == \"nt\":\n print(\"Sorry, gunicorn is not available on windows\")\n exit(1)\n specter_gunicorn = SpecterGunicornApp(config=None)\n specter_gunicorn.run()", "def serve() -> None:\n uvicorn.run(\n \"bartender.web.application:get_app\",...
[ "0.748902", "0.72147924", "0.70594573", "0.7044088", "0.6984339", "0.6954709", "0.6949557", "0.693541", "0.6902215", "0.6897665", "0.6895318", "0.68715054", "0.6867967", "0.6860533", "0.6821104", "0.67707294", "0.67282206", "0.67218506", "0.669681", "0.6695175", "0.66906226",...
0.7617813
0
Execute raw cypher queries
def cypher(self, query: str, **parameters: str) -> Any: try: # results, meta = db.cypher_query(query, parameters) results, _ = db.cypher_query(query, parameters) except CypherSyntaxError as e: log.warning(query) log.error(f"Failed to execute Cypher Query\...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cypher(self, query):\n from neomodel import db\n try:\n results, meta = db.cypher_query(query)\n except Exception as e:\n raise Exception(\n \"Failed to execute Cypher Query: %s\\n%s\" % (query, str(e)))\n return False\n # log.debug(\"...
[ "0.65917706", "0.6311631", "0.6257389", "0.62430876", "0.6125018", "0.6125018", "0.61153865", "0.61023426", "0.60645294", "0.605868", "0.60440093", "0.6003765", "0.59613854", "0.58681923", "0.58470386", "0.582492", "0.58190846", "0.5815288", "0.58127505", "0.58115643", "0.579...
0.6914791
0
Strip and clean up terms from special characters. To be used in fuzzy search
def sanitize_input(term: str) -> str: return term.strip().replace("*", "").replace("'", "\\'").replace("~", "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_special_chars(text):\n \n text = re.sub(' +', ' ', re.sub('[^A-Za-z ]+', ' ', text).strip())\n return text", "def clean_word(self, word):\n return self.filter_pattern.sub(u'', word.lower())", "def clean_text ( self, text ) :\n text = BeautifulSoup ( text , \"lxml\" ).text # H...
[ "0.70704466", "0.70424956", "0.701857", "0.701857", "0.701857", "0.701857", "0.701857", "0.701857", "0.700928", "0.6997776", "0.69969887", "0.6988537", "0.698002", "0.6951187", "0.69446355", "0.69331133", "0.6931965", "0.6915906", "0.68655795", "0.68475455", "0.68451554", "...
0.7121154
0
Returs tuple with joint states and TCP coordinates.
def __getitem__(self, item): # exclude tcp orientation return self._joint_states[item], self._tcp_coords[item][:2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_joint_states(self) -> Tuple[List[float], List[float], List[str]]:\n \n rospy.wait_for_service('/' + self.model_name + '/get_all_joint_states', timeout=2.0)\n try:\n resp = self.__get_all_joint_states()\n except rospy.ServiceException as e:\n print('Serv...
[ "0.6140449", "0.59999305", "0.5931853", "0.5850808", "0.58111596", "0.58111596", "0.5742225", "0.5667046", "0.56276125", "0.5614639", "0.5608495", "0.54987055", "0.549173", "0.54879147", "0.54866815", "0.54844534", "0.5476058", "0.54419196", "0.5407677", "0.5401779", "0.53909...
0.6355352
0
Calculate the Wilcoxon signedrank test The Wilcoxon signedrank tests the null hypothesis that two related paired samples come from the same distribution. It tests whether the distribution of the difference x y is symmetric about zero.
def wilcoxon_test(data): n = len(data) print(n) absolute_values = [] for d in data: absolute_values.append((d, np.abs(d))) absolute_values.sort(key=lambda x: x[1]) ret = [] for i, d in enumerate(absolute_values): ret.append((i + 1, d[0], d[1])) t_plus = 0 t_minus = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wilcoxon(_sample_a, _sample_b):\n res = stats.ranksums(_sample_a, _sample_b)\n print('Wilcoxon rank-sum\\nstatistic: {}\\np-value: {}'.format(res[0], res[1]))\n print('-' * 10)", "def lwilcoxont(x,y):\r\n if len(x) <> len(y):\r\n raise ValueError, 'Unequal N in wilcoxont. Abo...
[ "0.7029563", "0.6060772", "0.60201573", "0.585339", "0.58216035", "0.5812656", "0.5804695", "0.5777771", "0.5729734", "0.57100165", "0.5675171", "0.5665772", "0.5662058", "0.5558153", "0.5539113", "0.55338377", "0.55330694", "0.55140287", "0.54924697", "0.547573", "0.54596657...
0.6156549
1
Calculate the MannWhitney rank test on samples X and Y. It tests whether they have the same median.
def mann_whitney_u_test(X, Y): m, n = len(X), len(Y) U = 0 for x in X: for y in Y: if x < y: U += 1 E_u = m * n / 2 var_u = m * n * (m + n + 1) / 12 z = (U - E_u) / np.sqrt(var_u) p_value = 2. * norm.sf(abs(z)) # two sided test return z, p_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mann_whitney(_sample_a, _sample_b):\n res = stats.mannwhitneyu(_sample_a, _sample_b, use_continuity=True)\n print('Mann-Whitney rank test\\nU-statistic: {}\\np-value: {}'.format(res[0], res[1]))\n print('-' * 10)", "def amannwhitneyu(x,y):\r\n n1 = len(x)\r\n n2 = len(y)\r\n ra...
[ "0.68291473", "0.6501168", "0.6212198", "0.6049667", "0.6025934", "0.60197026", "0.58614886", "0.57373714", "0.55942005", "0.55923915", "0.5583715", "0.5572583", "0.55200773", "0.5506094", "0.55004585", "0.5487513", "0.5483416", "0.54309464", "0.54106146", "0.536388", "0.5362...
0.6677407
1
Calculate the FlignerPolicello test on samples X and Y. It tests whether they have the same median, but without assumption on shape or scale of the distributions. However, it assumes that X and Y are from two different symmetric distributions.
def fligner_policello_test(X, Y): P_i = [] for x in X: count = 0 for y in Y: if y <= x: count += 1 P_i.append(count) Q_j = [] for y in Y: count = 0 for x in X: if x <= y: count += 1 Q_j.append(count)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(X, Y, perms=10000, method='pearson', tail='two-tail'):\n\n # Make sure that X and Y are formatted as Numpy arrays.\n X, Y = np.asarray(X, dtype=float), np.asarray(Y, dtype=float)\n\n # Check that X and Y are valid distance matrices.\n if spatial.distance.is_valid_dm(X) == False and spatial.distance.is...
[ "0.5877307", "0.5653117", "0.56165034", "0.56134", "0.5569941", "0.54437655", "0.5397881", "0.53854823", "0.53649646", "0.53622454", "0.53537786", "0.5341069", "0.5332188", "0.5312273", "0.52843684", "0.5277466", "0.5256211", "0.5219326", "0.5143481", "0.51307106", "0.5129633...
0.7405578
0
Given the path from the current working directory (cwd) to a root directory, and a path from that root directory to some file, derives the path from the cwd to that file.
def from_cwd(root, path): return normpath(join(root, normpath(path)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cwd_in_path():\n ...", "def file_path(file_name, path):\n return path.rstrip('\\/') + \"/{0}\".format(file_name) if path else os.getcwd() + \"/{0}\".format(file_name)", "def relative_path(root_dir, dirpath, f):\n full = os.path.join(dirpath, f)\n if not root_dir:\n return full\n if no...
[ "0.7066784", "0.6979399", "0.68085057", "0.6724433", "0.6708733", "0.66995543", "0.663998", "0.66332114", "0.6588345", "0.6575982", "0.652172", "0.643652", "0.6431836", "0.6407975", "0.6388555", "0.63809216", "0.6373353", "0.63663834", "0.6355308", "0.6333472", "0.632867", ...
0.77983445
0
Parses the .ciignore file to get the set of ignored directories.
def get_ignored_dirs(ci_ignore_path): with open(ci_ignore_path, 'r') as ignore_file: return set([ normpath(line.strip()) for line in ignore_file.readlines() if not line.startswith('#') and not is_blank(line) ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_gitignore():\n excludes = []\n gitignore = Path(\".gitignore\")\n if gitignore.exists():\n with gitignore.open() as f:\n excludes += f.read().split(\"\\n\")\n else:\n raise ValueError(\n \"No exclude configuration option and no .gitignore file present\"\n ...
[ "0.698658", "0.66188174", "0.6460673", "0.64552116", "0.6418179", "0.6402279", "0.6382113", "0.6331511", "0.628935", "0.62670165", "0.6191348", "0.6068765", "0.6014593", "0.59507906", "0.5916836", "0.5842815", "0.58326954", "0.579473", "0.57505643", "0.5738737", "0.56943214",...
0.79720974
0
Parses the timespan format used in the manifest.json format.
def parse_timespan(unparsed): pattern = '%H:%M:%S' return datetime.strptime(unparsed, pattern) - datetime.strptime('00:00:00', pattern)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_task_time(line):\n stripret = \"\".join(line.split())\n p = re.compile(r'\\d+\\.\\d{2}-\\d+\\.\\d{2}')\n findret = p.findall(stripret) \n if findret:\n formatstr = \" \".join(line.split())\n timeregx = r'\\d+\\.\\d{2}\\s*-\\s*\\d+\\.\\d{2}'\n time = re.compile(timeregx)...
[ "0.6017276", "0.595505", "0.5945074", "0.5825513", "0.57538307", "0.5595888", "0.5492997", "0.54822344", "0.546899", "0.5464472", "0.5456662", "0.5447526", "0.5441685", "0.54099345", "0.538926", "0.53401285", "0.5325533", "0.5311758", "0.52765626", "0.5264576", "0.5249275", ...
0.6562235
0
Increments the current scope. Returns `True` if successful, otherwise `False`.
def next_scope(self) -> bool: if self._scope_index + 1 >= len(self._scopes): return False self._scope_index += 1 self._current_scope = self._scopes[self._scope_index] return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prev_scope(self) -> bool:\n if self._scope_index - 1 < 0:\n return False\n self._scope_index -= 1\n self._current_scope = self._scopes[self._scope_index]\n return True", "def isScopeActive(self, name):", "def hasScope(self, name):", "def enterScope(self, name):", ...
[ "0.6443153", "0.6352644", "0.600642", "0.58440465", "0.56883276", "0.5544916", "0.54464257", "0.54252976", "0.5288855", "0.5240058", "0.5224531", "0.5200019", "0.51939374", "0.5191955", "0.5179793", "0.5179793", "0.5179793", "0.5151326", "0.5147138", "0.51400316", "0.5100714"...
0.7437988
0
Decrements the current scope. Returns `True` if successful, otherwise `False`.
def prev_scope(self) -> bool: if self._scope_index - 1 < 0: return False self._scope_index -= 1 self._current_scope = self._scopes[self._scope_index] return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leaveScope(self, name):", "def endScope():", "def deleteScope():\n global currScope\n scopeStack.pop()\n currScope = scopeStack[-1]", "def scope_pop(self) -> None:\n self.scope_stack.popleft()", "def next_scope(self) -> bool:\n if self._scope_index + 1 >= len(self._scopes):\n ...
[ "0.66638553", "0.64204556", "0.63871336", "0.6014307", "0.601418", "0.56921864", "0.5668897", "0.540422", "0.52995574", "0.5242012", "0.5185722", "0.51733506", "0.51417696", "0.51218563", "0.5106407", "0.5016107", "0.5004228", "0.49873295", "0.49578768", "0.4929177", "0.48866...
0.6474312
1
Returns the actions to be executed when the `phrase` is said or an empty list if the `phrase` isn't recognized.
def actions(self, phrase: str) -> list: return self._current_scope.get(phrase, [])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _complete_actions(self, text):\r\n return [ a + ' ' for a in self.vocab if a.startswith(text)]", "def complete(self, text, state, line=None):\r\n if line is None: # line is only set in tests\r\n import readline\r\n line = readline.get_line_buffer()\r\n\r\n # take th...
[ "0.60004616", "0.57317823", "0.56835073", "0.5680508", "0.5658361", "0.56231767", "0.55279064", "0.54998857", "0.5439864", "0.5381623", "0.53224576", "0.53194034", "0.5273951", "0.5268868", "0.5265452", "0.5254681", "0.522656", "0.522656", "0.5225555", "0.52229613", "0.521105...
0.78682524
0
Return the possible phrases that can be said in the current scope.
def phrases(self) -> set: return set(phrase for phrase in self._current_scope.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup_pronunciations_for_phrase(words: Sequence[Text]) -> Sequence[Phrase]:\n return EnglishUtils.all_possible_phrases_for(words)", "async def phrases(self, ctx):\n settings = await self.fetch_settings(ctx)\n cats, cats_remain = self.format_list(settings['cattriggers'])\n dogs, d...
[ "0.650457", "0.6290294", "0.6185158", "0.6177416", "0.61262715", "0.6069863", "0.599309", "0.59742767", "0.59522754", "0.5952065", "0.59339577", "0.58751494", "0.5860007", "0.5860007", "0.5824749", "0.5822537", "0.58140486", "0.58132386", "0.5788827", "0.5752199", "0.5703098"...
0.7400061
0
>>> rI.getRoadInformation("RandomRoad") should return 1,1 (1, 1)
def getRoadInformation(self,nameOfRoad): exist = getattr(self,'_hashMap',None) if (exist is not None) and (nameOfRoad in self._hashMap): return self._hashMap[nameOfRoad]['lanes'],self._hashMap[nameOfRoad]['length'] else: return 1,1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self) -> tuple:", "def get_trips(self) -> Tuple[Trip]:\n ...", "def simpleObjPickRoad(obj, roads):\n # in here the obj (either union or terrace) consists of one building\n fittestRid = -1\n accessPoint = Point(0, 0)\n\n findRoad = False\n\n for road in roads:\n reference = ...
[ "0.58014214", "0.57424927", "0.5625062", "0.5350593", "0.5331557", "0.5284436", "0.5245976", "0.5243223", "0.52362585", "0.5231731", "0.5218621", "0.52178955", "0.51694965", "0.5164629", "0.514382", "0.514382", "0.51375484", "0.512408", "0.510979", "0.510979", "0.5107514", ...
0.6431428
0
Check if folders fo logs and DB exists, create folders if don't.
def check_if_dir_exists(): if not os.path.exists(str(__CURRENT_DIRECTORY) + os.sep + ".." + os.sep + "logs"): try: os.mkdir(str(__CURRENT_DIRECTORY) + os.sep + ".." + os.sep + "logs") logger.debug("Dir for logs has been created") except OSError: logger.debug(f"Cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createDirectories(self):\n # -- LOG\n thepath = os.path.dirname(self.settings.logfile)\n distutils.dir_util.mkpath(thepath)\n\n # -- SESSION \n thepath = self.settings.sessionpath\n distutils.dir_util.mkpath(thepath)\n\n # -- DATABASE\n thepath = self.settings.dbpat...
[ "0.75340325", "0.74847454", "0.74525905", "0.73823094", "0.73680645", "0.72598135", "0.7199667", "0.71511656", "0.7090995", "0.70324355", "0.69800925", "0.6928911", "0.69100326", "0.69078887", "0.6882662", "0.6876244", "0.68343437", "0.6815257", "0.6797767", "0.6752044", "0.6...
0.7939407
0
Whether to allow the message given the current state of the guard
def allow(self, message): if message.author.id == Guard.AUTHOR: return True if message.author.id in Guard.BANNED_USERS: return False if self.state == State.TRUSTED_ONLY and not Guard.is_trusted(message): return False if self.state == State.SUDO_ONLY an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_message(self, msg):\n pass", "def collect_allowed(message):\n return True", "def IsAllowed(self):\r\n\r\n return self.notify.IsAllowed()", "def IsAllowed(self):\r\n\r\n return self.notify.IsAllowed()", "def IsAllowed(self):\r\n\r\n return self.notify.IsAllowed()", ...
[ "0.6435458", "0.64242923", "0.6385886", "0.6385886", "0.6385886", "0.6313028", "0.62827015", "0.62696564", "0.62615937", "0.6235407", "0.6195627", "0.6128726", "0.6123504", "0.6036772", "0.6009013", "0.6009013", "0.6008502", "0.6004612", "0.5997457", "0.59911567", "0.59179616...
0.7359263
0
Returns whether in the circumstances of the given message, a sudo action is allowed
def allow_sudo(message): if message.author.id == Guard.AUTHOR and message.channel.type == discord.ChannelType.private: return True if message.author.id in Guard.SUDO_IDS and message.channel.id in Guard.SUDO_CHANNELS: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_should_be_able_to_use_sudo(driver):\n assert \"lectured\" in sudo_results, str(sudo_results)", "def allow(self, message):\n if message.author.id == Guard.AUTHOR:\n return True\n if message.author.id in Guard.BANNED_USERS:\n return False\n if self.state == St...
[ "0.68108046", "0.6810564", "0.65219665", "0.6107883", "0.6106064", "0.59634566", "0.5876366", "0.58678156", "0.58661014", "0.5843343", "0.5835886", "0.5754817", "0.5732411", "0.57277626", "0.56578225", "0.56416506", "0.56124586", "0.56103116", "0.559504", "0.5545683", "0.5458...
0.7590361
0
Returns whether the circumstances of the message, the author is trusted
def is_trusted(message): author = message.author if author.id == Guard.AUTHOR: return True if author.id in Guard.BANNED_USERS: return False try: if set([role.name for role in author.roles]).intersection(Guard.TRUSTED_ROLES): return True...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow(self, message):\n if message.author.id == Guard.AUTHOR:\n return True\n if message.author.id in Guard.BANNED_USERS:\n return False\n if self.state == State.TRUSTED_ONLY and not Guard.is_trusted(message):\n return False\n if self.state == State....
[ "0.6596535", "0.6152043", "0.5797919", "0.57831234", "0.57756525", "0.5773149", "0.577266", "0.57364255", "0.5713972", "0.57097185", "0.56366843", "0.5631748", "0.5630205", "0.5573819", "0.55649304", "0.55580103", "0.5552814", "0.5552814", "0.5528097", "0.5524117", "0.5512337...
0.8007942
0
Returns whether we have the specified permission when replying to the message
def has_permission(message, permission): if message.channel.type == discord.ChannelType.private: return True if getattr(message.channel.guild.me.permissions_in(message.channel), permission): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_perm(self, user, perm):\r\n #superuser has all rights\r\n if user.is_superuser:\r\n return True\r\n if perm in [OI_READ, OI_ANSWER]:\r\n if self.project:\r\n return self.project.has_perm(user, perm)\r\n else:\r\n return Tru...
[ "0.73359954", "0.6755361", "0.6672767", "0.6643699", "0.66324294", "0.6602714", "0.65812474", "0.6541931", "0.647505", "0.6463046", "0.6444851", "0.64401436", "0.6407568", "0.63953", "0.6367485", "0.635122", "0.62977666", "0.6294286", "0.6294286", "0.6286682", "0.6276007", ...
0.7485159
0
Returns the intent of the message, as defined by the Intent class
def get_intent(msg): if re.search(MapController.MAP_REGEX, msg.content) and client.user.id in msg.raw_mentions: return Intent.MAP elif re.match(Controller.KEY_REGEX, msg.content): return Intent.DIRECT else: return Intent.NONE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _intent(self) -> MessageIntent:\r\n pass", "def handle(self, message: discord.Message, intent: Intent) -> Optional[str]:\n pass", "def get_intent_action(self, intent_keyword):\n pass", "def open_intent_envelope(message):\n intent_dict = message.data\n return Intent(intent_dict....
[ "0.7623119", "0.6905368", "0.6655187", "0.65414625", "0.63272935", "0.61630195", "0.61426914", "0.6030031", "0.5988024", "0.5958836", "0.5771847", "0.56992733", "0.5698487", "0.561783", "0.54841554", "0.5475818", "0.54735065", "0.5444824", "0.5429536", "0.5429536", "0.5413568...
0.72745353
1
Decorate a function as requiring sudo access
def privileged(f): @wraps(f) def wrapper(self, msg, *args, **kwargs): if not Guard.allow_sudo(msg): return return f(self, msg, *args, **kwargs) return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elevate_priv_if_needed(func):\n def inner(*args, **kwargs):\n try:\n return func(*args, **kwargs)\n except OSError as e:\n logger.debug('Elevating privileges due to receiving permission errror')\n logger.debug(e)\n return run_as_root(func)(*args, **k...
[ "0.7411366", "0.6413903", "0.63163996", "0.6282777", "0.6280451", "0.6224123", "0.6188734", "0.6127398", "0.6112499", "0.6107867", "0.6105563", "0.6062908", "0.6052526", "0.6051395", "0.6020828", "0.5980072", "0.59735245", "0.5961545", "0.595655", "0.5924637", "0.59125936", ...
0.78824574
0
Create an instance of a map controller based on the regex match object
def from_match(match): clat = float(match.group(1)) clng = float(match.group(2)) if match.group(3): mlat = float(match.group(3)) mlng = float(match.group(4)) else: mlat = mlng = None zoom = float(match.group(5)) return MapController(cla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_re_match(cls, match):\n kwargs = match.groupdict()\n location = kwargs['location'].split()\n kwargs['location'] = (int(location[0]), int(location[1]),\n int(location[2]))\n return cls(**kwargs)", "def from_re_match(cls, match):\n kwargs = m...
[ "0.642154", "0.62663186", "0.613197", "0.6051899", "0.58634245", "0.5823124", "0.5723135", "0.5703356", "0.5665067", "0.564505", "0.557083", "0.5539005", "0.54985327", "0.54926795", "0.54654515", "0.54522747", "0.5433033", "0.5412259", "0.53442377", "0.5310062", "0.53073347",...
0.7379016
0
Returns the world map image This method caches the result the first time it is called.
def get_world_image(cls): if cls.map_image is None: with open(str(Path(RES_PATH, cls.map_path)), 'rb') as infile: cls.map_image = Image.open(infile).convert('RGBA') return cls.map_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def generate_snapshot(self, include_world=True):\n if self.has_marker:\n y, x = -self.mlat, self.mlng\n else:\n y, x = -self.clat, self.clng\n zoom = self.zoom\n world = MapController.get_world_image()\n top, bottom = y - 256/(2**zoom), y + 256/(2**zoo...
[ "0.66868144", "0.6528561", "0.64764446", "0.6316041", "0.6301161", "0.6254141", "0.62515", "0.6232758", "0.6192258", "0.6036638", "0.6019334", "0.60071325", "0.5981669", "0.5949518", "0.5942885", "0.58881766", "0.5847239", "0.5834663", "0.5819538", "0.57475656", "0.57475656",...
0.84329826
0
Returns the marker image This method caches the result the first time it is called.
def get_marker_image(cls): if cls.marker_image is None: with open(str(Path(RES_PATH, cls.marker_path)), 'rb') as infile: cls.marker_image = Image.open(infile).convert('RGBA').resize((32, 32)) return cls.marker_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getImage(self, point):\n if self.map[point.y,point.x] != None:\n return self.map[point.y,point.x].getItemImage()", "def get_image(self):\n if not hasattr(self, '_BasePublication__image_cache'):\n images = self.get_images()\n self.__image_cache = images[0].pictur...
[ "0.6773873", "0.6567225", "0.6480415", "0.63177365", "0.63177365", "0.63177365", "0.63121176", "0.6306062", "0.6303342", "0.6243714", "0.61313015", "0.6050443", "0.6037759", "0.60189766", "0.6010048", "0.59817874", "0.59225345", "0.59153646", "0.591476", "0.5906588", "0.58802...
0.788136
0
Sleep until the specified datetime
async def wait_until(dt): now = datetime.now() await sleep((dt - now).total_seconds())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep_until(self, time):\n raise NotImplementedError()", "def sleep_for(timeToSleep):\r\n time.sleep(timeToSleep)", "def sleep_until(hour, minute=0):\n import datetime\n from time import sleep\n\n now = datetime.datetime.now()\n to = (now + datetime.timedelta(days=1))....
[ "0.7860681", "0.75957644", "0.7344111", "0.7316204", "0.71682894", "0.71541137", "0.71498096", "0.7025248", "0.69865376", "0.6975623", "0.69485664", "0.6945424", "0.68780625", "0.68588567", "0.6832199", "0.6821095", "0.6821095", "0.68148077", "0.68145597", "0.67563605", "0.67...
0.803321
0
Schedule sending the status of the bot to author's DM
async def schedule_status(): while True: if controller.scheduled_status_date is not None: return controller.scheduled_status_date = datetime.now()+timedelta(hours=23) await wait_until(controller.scheduled_status_date) channel = await client.fetch_channel(Guard.AUTHOR_DM) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def status(self, msg, *args):\n content = self.get_status()\n await msg.channel.send(**{\n 'content': content,\n 'reference': msg.to_reference(),\n 'mention_author': True,\n })", "async def schedule_activity():\n if controller.scheduled_activity_...
[ "0.6610289", "0.64141685", "0.6388113", "0.6227487", "0.6192259", "0.5966803", "0.59522605", "0.59513205", "0.59512687", "0.5911446", "0.5883258", "0.5881281", "0.5862279", "0.5821707", "0.57725155", "0.57487243", "0.5716497", "0.56860787", "0.566197", "0.56558305", "0.565435...
0.7905984
0
Schedule setting the status of the bot
async def schedule_activity(): if controller.scheduled_activity_date is not None: return controller.scheduled_activity_date = datetime.now()+timedelta(seconds=30) await wait_until(controller.scheduled_activity_date) await client.change_presence(activity=discord.Activity(type=discord.ActivityType...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def schedule_status():\n while True:\n if controller.scheduled_status_date is not None:\n return\n controller.scheduled_status_date = datetime.now()+timedelta(hours=23)\n await wait_until(controller.scheduled_status_date)\n channel = await client.fetch_channel(Guard....
[ "0.754021", "0.64982355", "0.6476354", "0.6317739", "0.6290572", "0.61519027", "0.61437833", "0.6137482", "0.60466665", "0.5946994", "0.59342116", "0.5927603", "0.59186566", "0.5887395", "0.5886717", "0.5883357", "0.5882372", "0.5882372", "0.5882372", "0.588211", "0.588192", ...
0.7197702
1
Returns True if the command exists and is enabled
def is_enabled(command): if command not in Controller.commands: return False return Controller.commands[command][2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkIfEnabled(self):\n\n # Reload the command file to check for new commands\n importlib.reload(BotSettings)\n matches = BotSettings.config['commands']\n\n # Check for the match and if it is there return the value that goes with the command\n for key in matches:\n ...
[ "0.8009495", "0.73429406", "0.72534823", "0.71589005", "0.71207994", "0.70904523", "0.7001283", "0.68857443", "0.6817424", "0.68012553", "0.6798277", "0.67917633", "0.6757153", "0.6734743", "0.6718272", "0.667678", "0.66564655", "0.65755635", "0.65725994", "0.655036", "0.6549...
0.80444074
0
Returns the wikitext of the specified item. This method handles redirects as well.
async def get_wikitext(item): item = item.strip() url = Controller.WIKI_API_REV_URL + item response = await Controller.http_get(url) try: pages = json.loads(response)['query']['pages'] key = list(pages.keys())[0] if key == '-1': raise V...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetItemText(self, item):\r\n\r\n return item.GetText()", "def _getText(self, item): # TODO: move this method to more suitable place when possible (scripting base class)\r\n if not isinstance(item, basestring):\r\n return item\r\n\r\n translation = self.phone.getTranslation(ite...
[ "0.71310467", "0.6846198", "0.6360924", "0.63444716", "0.6208977", "0.6193657", "0.6024532", "0.5965504", "0.592966", "0.589569", "0.5876253", "0.5847495", "0.58415383", "0.5787497", "0.57604456", "0.5738865", "0.5703757", "0.5667341", "0.5667341", "0.5667341", "0.56493497", ...
0.79088044
0
Returns the canonical title for the given title, if found
async def canonical_title(title): url = Controller.WIKI_API_SEARCH_URL + title response = await Controller.http_get(url) try: pages = json.loads(response)['query']['search'] if len(pages) == 0: return None for page in pages: if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resolve_title(self, title):\n try:\n return config_data.get(\"Website\", title)\n except Exception as e:\n print(\"Title URL not configured\")\n raise e", "def normalize_title(self, title):\n return \" \".join(w[0].capitalize() + w[1:] for w in title.spl...
[ "0.68825155", "0.66403437", "0.6610627", "0.66068155", "0.6586052", "0.65578806", "0.65400726", "0.64582205", "0.64436924", "0.6440577", "0.6421765", "0.63735795", "0.6332046", "0.6319642", "0.628051", "0.6260701", "0.62309647", "0.6217494", "0.6215482", "0.62082005", "0.6205...
0.8441544
0
Replies the user with the wikilink for the specified item
async def link(self, msg, item=None, *args): if not Guard.has_permission(msg, 'embed_links'): await msg.channel.send(**{ 'content': 'Cannot send links on this channel', 'reference': msg.to_reference(), 'mention_author': True, 'delete_af...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_link(self, obj):\n if obj.item is None:\n return '\\N{EM DASH}'\n\n return format_html(\n '<a href=\"{}\">{}</a>',\n reverse('admin:mediaplatform_mediaitem_change', args=(obj.item.pk,)),\n obj.item.title if obj.item.title != '' else '[Untitled]'\n ...
[ "0.6142394", "0.61364466", "0.6084915", "0.60085547", "0.59002894", "0.5884859", "0.5846574", "0.5835982", "0.5824301", "0.5748178", "0.5720398", "0.5717556", "0.5700181", "0.56942743", "0.56676304", "0.5665238", "0.5580297", "0.55604523", "0.5471592", "0.54502934", "0.545029...
0.6284063
0
Replies the user with the crafting recipe of the given item
async def recipe(self, msg, item=None, *args): if not Guard.has_permission(msg, 'embed_links'): await msg.channel.send(**{ 'content': 'I need embed_links permission to answer in this channel', 'reference': msg.to_reference(), 'mention_author': True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func(self):\n caller = self.caller\n\n if not self.args or not self.recipe:\n self.caller.msg(\"Usage: craft <recipe> from <ingredient>, ... [using <tool>,...]\")\n return\n\n ingredients = []\n for ingr_key in self.ingredients:\n if not ingr_key:\n ...
[ "0.6736054", "0.61099", "0.6082913", "0.6016578", "0.60134727", "0.5981742", "0.5953637", "0.59410495", "0.5934667", "0.5928849", "0.59241426", "0.5899832", "0.5897507", "0.57860583", "0.5768086", "0.5627919", "0.56226647", "0.56204826", "0.5610315", "0.5566833", "0.5565702",...
0.6734797
1
Returns True if the template name is a type of infobox
def is_infobox(self, name): name = name.strip() if name.lower().startswith('infobox'): return True if name == 'Armors_(NEW)': return True if name == 'All_inclusive_infobox_2020': return True if name.lower() == 'item': return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_template(self):\n\t\treturn bool(call_sdk_function('PrlFoundVmInfo_IsTemplate', self.handle))", "def is_template(self):\n\t\treturn bool(call_sdk_function('PrlVmCfg_IsTemplate', self.handle))", "def istemplate(self, t):\n if isinstance(t, basestring):\n return t in self.template_types\...
[ "0.719086", "0.6656455", "0.6562287", "0.5975037", "0.5917431", "0.5775788", "0.5742233", "0.5733611", "0.56911385", "0.5621843", "0.5567178", "0.55560607", "0.5515181", "0.5500605", "0.5496725", "0.541349", "0.5398289", "0.5381162", "0.5378755", "0.53602856", "0.535799", "...
0.7511678
0
Replies the user with the information from infobox of the specified item
async def info(self, msg, item=None, *args): if not Guard.has_permission(msg, 'embed_links'): await msg.channel.send(**{ 'content': 'I need embed_links permission to answer in this channel', 'reference': msg.to_reference(), 'mention_author': True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def iteminfo(self, ctx, *, item: str):\n items = await self.bot.di.get_guild_items(ctx.guild)\n item = items.get(item)\n if not item:\n await ctx.send(await _(ctx, \"Item doesnt exist!\"))\n return\n if hasattr(item, \"description\"):\n embed = dis...
[ "0.6939309", "0.66859245", "0.6623628", "0.6331634", "0.63185996", "0.6283439", "0.6266595", "0.6234912", "0.61936915", "0.6185648", "0.6137834", "0.61105543", "0.6095368", "0.6089556", "0.60420245", "0.60150623", "0.59859926", "0.5933654", "0.59217507", "0.59145945", "0.5877...
0.6815587
1
Fetch and cache the trading table from wiki
async def get_trading_table(self): if self.trading_table is None: self.trading_table = {} wikitext = await Controller.get_wikitext('Trading') for match in re.finditer(r"===='''([^']+)'''====\n({\|[^\n]*\n(?:[^\n]*\n)+?\|})", wikitext): place = match.group(1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sp500_stocks_wiki(url=None):\n\n website_url = requests.get(url)\n soup = BeautifulSoup(website_url.text, 'lxml')\n my_table = soup.find('table', {'class': 'wikitable sortable'})\n my_table\n\n table_rows = my_table.find_all('tr')\n\n data = []\n for row in table_rows:\n data.ap...
[ "0.5821737", "0.5693989", "0.5649378", "0.5550121", "0.5491645", "0.5477678", "0.5426335", "0.5404699", "0.5395954", "0.5388061", "0.5386293", "0.53255683", "0.5314863", "0.5280537", "0.5252164", "0.52466863", "0.5241401", "0.52316666", "0.5225064", "0.52195275", "0.5215217",...
0.61209226
0
Replies the user with a list of places that trade for and from the item if the argument is an item name, and a list of possible trades if the argument is a location name If the argument is empty, replies the user with the list of possible trading locations
async def trader(self, msg, arg=None, *args): trading_table = await self.get_trading_table() self_delete = False if not arg: content = '• '+'\n• '.join(place.capitalize() for place in trading_table.keys()) content = f'Places you can trade:\n{content}' else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_item(date_in, loc_in, item_in, meal_in, requisites):\n secrets = get_secrets()\n url = secrets.get('m_dining_api_main')\n location = '&location='\n date = '&date='\n meal = '&meal='\n\n #API url concatenation\n location += loc_in\n date += str(date_in)\n url = url + location ...
[ "0.55701673", "0.54838645", "0.54508644", "0.53599703", "0.5310921", "0.5309665", "0.5201589", "0.5175528", "0.50172406", "0.49962473", "0.4967968", "0.49516737", "0.49477062", "0.49312726", "0.49152538", "0.49084076", "0.49028268", "0.489911", "0.4895174", "0.4892474", "0.48...
0.61802715
0
Replies the user with a snapshot of the specified location
async def snapshot(self, msg, *args): if not Guard.has_permission(msg, 'attach_files'): await msg.channel.send(**{ 'content': 'Cannot send images on this channel', 'reference': msg.to_reference(), 'mention_author': True, 'delete_after':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveLocally(self, location):\n t = threading.Thread(target=Snapshot.__saveSnapshot, args=(self, location))\n t.start()", "def snap(self, path=None):\n if path is None:\n path = \"/tmp\"\n else:\n path = path.rstrip(\"/\")\n day_dir = datetime.datetime....
[ "0.6316481", "0.6148619", "0.59814966", "0.5792674", "0.57118636", "0.55614907", "0.5513457", "0.54459316", "0.53872216", "0.53725713", "0.52661574", "0.5254602", "0.52459157", "0.52299005", "0.5224609", "0.52218723", "0.521777", "0.5199946", "0.51784426", "0.51539075", "0.51...
0.6323737
0
Replies the user with the coordinates of the given place, as well as the snapshot and the URL
async def location(self, msg, place_name=None, *args): if not place_name: return if args: place_name = f'{place_name} {" ".join(args)}' if place_name.lower() in MapController.locations: lat, lng, size = MapController.locations[place_name.lower()] m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_place(self):\n place = self.status.user['location']\n return place", "def geolocate(place): # string\n geolocator = geopy.geocoders.Nominatim()\n location = geolocator.geocode(place)\n # i dati si danno in (latitudine, longitudine), ma vanno intesi come (y, x)\n # ovvero vanno ...
[ "0.5741757", "0.5636716", "0.5636548", "0.56217134", "0.53884745", "0.53340495", "0.5326232", "0.53156716", "0.52914727", "0.52897", "0.5223609", "0.5215813", "0.52116656", "0.52053446", "0.5197685", "0.5193562", "0.5173581", "0.51653576", "0.5164704", "0.5133908", "0.5115011...
0.59125996
0
Replies the user with the distance between the two place names mentioned
async def distance(self, msg, place1=None, place2=None, *args): if not place1 or not place2: return try: if place1.lower() not in MapController.locations: raise ValueError(place1) if place2.lower() not in MapController.locations: raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance():\n return str(us.get_distance())", "def edit_distance(str1, str2):\r\n pass", "def getDistance(pos1, pos2):\r\n return ((pos1[0] - pos2[0]) ** 2 + (pos1[1] - pos2[1]) ** 2) ** 0.5", "def get_distance_metres(aLocation1, aLocation2):\n [dNorth, dEast, dDown] = get_position_error(aLoc...
[ "0.69901127", "0.6892306", "0.64907265", "0.6486312", "0.6462533", "0.6446145", "0.6441033", "0.6402432", "0.6395236", "0.6380346", "0.63785714", "0.63785714", "0.63747483", "0.633181", "0.6319796", "0.6289507", "0.62639916", "0.62585694", "0.62468517", "0.6234138", "0.622619...
0.69919837
0
Sets the activity of the bot
async def set_activity(self, msg, activity=None, *args): await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=activity))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_activity(self, status):\n self._activity = status", "async def activity(self, ctx:utils.Context, activity_type:str, *, name:str=None):\n\n if name:\n activity = discord.Activity(name=name, type=getattr(discord.ActivityType, activity_type.lower()))\n else:\n awai...
[ "0.76861185", "0.70110416", "0.6871109", "0.6633408", "0.6617505", "0.65683097", "0.6544981", "0.64911014", "0.64569134", "0.6431248", "0.63290405", "0.6172366", "0.6133315", "0.59609354", "0.59220105", "0.5766587", "0.57659775", "0.5760408", "0.5752067", "0.5601439", "0.5585...
0.8018901
0
Send some status about the bots
async def status(self, msg, *args): content = self.get_status() await msg.channel.send(**{ 'content': content, 'reference': msg.to_reference(), 'mention_author': True, })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def status(self, context):\n await self.send_message(context, await self.status_msg_packed(context))", "def send_robot_status(self, robot_status):\n self.robot_status_sender.send(robot_status)", "async def status(self, ctx: Context):\n # Get lines of code\n lines_of_code = os....
[ "0.7099396", "0.7079799", "0.6860571", "0.6767609", "0.673753", "0.672401", "0.6702105", "0.6679856", "0.6679856", "0.6644952", "0.66088927", "0.6600472", "0.6588556", "0.65812016", "0.6564508", "0.6503747", "0.64562637", "0.6452571", "0.6448351", "0.6413562", "0.64076763", ...
0.7468175
0
Add one record into set.
def add(self, record): self._hist_records[record.uid] = record
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, item):\n item = self._prepare_item(len(self), item)\n if item not in self._data:\n self._data.append(item)\n self.__log__.append(SetAdd(value=item))", "def _add_record(self, datetime_, hash_):\n assert isinstance(datetime_, datetime)\n assert isinst...
[ "0.6866645", "0.6579463", "0.63470685", "0.62643814", "0.6259924", "0.6255585", "0.6249951", "0.6244476", "0.6234149", "0.61436373", "0.61233157", "0.61089814", "0.6103372", "0.6085331", "0.60585153", "0.6054745", "0.6037263", "0.59963894", "0.59255654", "0.5917086", "0.59116...
0.67170227
1
Back up output to local path.
def backup_output_path(self): backup_path = TaskOps().backup_base_path if backup_path is None: return FileOps.copy_folder(TaskOps().local_output_path, backup_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup_command(server, output):\n # Stop saving chunks\n server.save_off()\n # Run the external save program\n subprocess.call(CONFIG['backup_command']['script'].split())\n # Start saving chunks again\n server.save_on()\n return", "def backup(self):\n import datetime\n suff...
[ "0.6644395", "0.6394173", "0.5991687", "0.59489906", "0.59429973", "0.5856808", "0.5855813", "0.5798508", "0.57897097", "0.564352", "0.5574243", "0.5509337", "0.54634744", "0.5453597", "0.5429871", "0.537353", "0.5356973", "0.5346617", "0.5346035", "0.53141814", "0.5309788", ...
0.68394625
0
Output step all records.
def output_step_all_records(self, step_name, desc=True, weights_file=True, performance=True): records = self.all_records logging.debug("All records in report, records={}".format(self.all_records)) records = list(filter(lambda x: x.step_name == step_name, records)) logging.debug("Filter s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n print('#' + '\\t'.join(OutputRecord.get_header_fields()),\n file=self.args.output_tsv)\n for chunk in chunk_by_query(self.sam_file, expand_xa=True):\n #print('STARTING CHUNK', file=sys.stderr)\n if not chunk:\n continue # ignore empt...
[ "0.6829503", "0.63628876", "0.62389874", "0.60432297", "0.60114896", "0.5987003", "0.59672743", "0.5898101", "0.5888029", "0.5881636", "0.5874173", "0.58740133", "0.5855136", "0.58379674", "0.5837826", "0.5834566", "0.58343154", "0.57998765", "0.5793351", "0.5792536", "0.5772...
0.72609735
0
Dump report to file.
def dump(self): try: _file = FileOps.join_path(TaskOps().step_path, "reports.csv") FileOps.make_base_dir(_file) data = self.all_records data_dict = {} for step in data: step_data = step.serialize().items() for k, v in st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report(self, output_dir):", "def export_records_to_file(self, report_file):\n self.write_to_file(report_file, self.construct_report_columns())\n for record in self.database.fetch_sensor_data_grouped_by_date():\n date_report = self.construct_date_report(record)\n print(\"{}...
[ "0.68204385", "0.6599571", "0.6362758", "0.6291036", "0.6244349", "0.6243112", "0.6230732", "0.6227176", "0.61734873", "0.6153664", "0.6133584", "0.610474", "0.60003084", "0.5990166", "0.5954442", "0.5949858", "0.59321535", "0.5924271", "0.59219396", "0.59174067", "0.5915938"...
0.70031875
0