query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return the value in the voting results for a given precinct based on various conditions
def query_voting_results(vr_data, precinct, queries): query_result = 0 # Get the voting results for the precinct vr_data = vr_data[ vr_data['precinct'] == precinct ] # for each of the queries return the remaining that match the conditions for col, row in queries: if len( vr_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_precinct_votes():\n c.execute(\n \"SELECT Contest_Name, County, Precinct, Sum(Total_Votes) as Votes from v group by County, Precinct, Contest_Name order by Votes ASC\")\n return c.fetchall()", "def t(p, vote_count):\n return vote_count[p]", "def result_poll(votes):\n return sum(votes...
[ "0.6866511", "0.6193262", "0.6021859", "0.5718616", "0.5718616", "0.5654299", "0.56460893", "0.5624494", "0.5357243", "0.5343016", "0.5297956", "0.52842486", "0.52389294", "0.5222362", "0.5215099", "0.52003187", "0.51853424", "0.5164715", "0.5159816", "0.5123581", "0.51138216...
0.7000912
0
Build voting results data per precinct and district from Open Elections file
def make_voting_results_data(categories, district_data = {}, state=48, district=7, leg_body='US-REP', election_year='2018', census_year='2016', district_config_file = 'static/data/district.json', voting_precincts_file=None, voting_results_file=None): print( "\nGetting election results per precin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_votes():\n c.execute(\"\"\"CREATE TABLE IF NOT EXISTS v\n (County TEXT, Election_Date TEXT, Precinct TEXT,\n Contest_Group_ID INTEGER, Contest_Type TEXT,\n Contest_Name TEXT, Choice TEXT, Choice_Party TEXT,\n Vote_For INTEGER,\tElection_Day INTEGER, One_Stop INTEGER...
[ "0.6453298", "0.62704986", "0.591759", "0.5638283", "0.5609781", "0.55366975", "0.5454583", "0.5409491", "0.5403494", "0.5342446", "0.53199655", "0.52896106", "0.52841806", "0.52664864", "0.5242544", "0.52125007", "0.51701033", "0.5168771", "0.514175", "0.5128764", "0.5099989...
0.7711749
0
Builds stats for a legislative district, e.g., a US Congressional District
def main(): args = get_command_line_args() settings = read_settings(args) census_api_key = settings['census_api_key'] state = settings['state'] district = settings['district'] leg_body = settings['leg_body'] census_year = settings['census_year'] election_year = settings['el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_district_census_data(api, fields, census_data = {}, state=48, district=7, leg_body='US-REP', year='2015'):\r\n district_key = 'district'\r\n if year not in census_data.keys():\r\n census_data[year] = { district_key: {} }\r\n else:\r\n if district_key not in census_data[year].keys():\...
[ "0.6563642", "0.58617634", "0.5728523", "0.5649055", "0.5632157", "0.55478066", "0.5473275", "0.5421888", "0.53868103", "0.53298515", "0.5312874", "0.53122324", "0.5302672", "0.5255284", "0.5232427", "0.5196343", "0.5184982", "0.5163237", "0.5130934", "0.5123592", "0.5111837"...
0.0
-1
calcule un ACM du graphe G en utilisant l'algorithme de Kruskal
def ACM_Kruskal(G): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Kruskal(G): # la fonction prend la liste de edges et de union find\n edges = G.edges\n unionfind_list = G.nodes\n G_k = Graph() # le graph contient le graph de kruskal\n dim = len(unionfind_list) # dimension du nombre de sommet du graph\n kruskal_cost = 0 # initilisation du cout du graphe\n\...
[ "0.7165909", "0.67326295", "0.64641", "0.64422137", "0.6430121", "0.6193321", "0.60410535", "0.5938368", "0.5934219", "0.5923638", "0.5894519", "0.5869061", "0.58546543", "0.57801723", "0.5769721", "0.5765839", "0.5758802", "0.57420546", "0.57336897", "0.5726783", "0.571303",...
0.86322194
0
Sets an access_token in a secure cookie
def auth(): code = request.query.code auth = 'https://foursquare.com/oauth2/access_token' params = dict( client_id=CLIENT_ID, client_secret=CLIENT_SECRET, grant_type='authorization_code', redirect_uri=REDIRECT_URI, code=code ) auth_says = fetch('%s?%s'%(auth, urlencode(params))) auth_response = json.loa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_secure_cookie( name, value, **kwargs ):", "def set_cookie( name, value, **kwargs ) :", "def set_access_token(self, access_token):\n self.access_token = access_token", "def set_token(self, token: AccessToken):\n self.access_token = token.access_token or \"\"\n if isinstance(token,...
[ "0.70390296", "0.6613886", "0.6550457", "0.6528021", "0.6515496", "0.6478465", "0.6478465", "0.644429", "0.6443181", "0.64147496", "0.63794595", "0.63322574", "0.6260747", "0.6246768", "0.622871", "0.62160164", "0.62073505", "0.617344", "0.61505836", "0.6145044", "0.6121549",...
0.5604453
66
create data loader for specific data set
def __init__(self, dataset, batch_size, n_threads=4, ten_crop=False, data_path='/home/dataset/', logger=None): self.dataset = dataset self.batch_size = batch_size self.n_threads = n_threads self.ten_crop = ten_crop self.data_path = data_path self.logger = logger self.dataset_root = data_path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataloader(self):\n\n # load / split data\n train_data = self.data.get_train_data()\n if self.args.use_dev:\n train_data, dev_data = self.data.split_data(train_data)\n test_data = self.data.get_test_data()\n\n #print(train_data[0])\n #print(dev_data[0])\n ...
[ "0.73314863", "0.7277198", "0.71719694", "0.7169948", "0.7164453", "0.71400106", "0.71015227", "0.7098408", "0.70484775", "0.70151687", "0.7014975", "0.6991446", "0.6934047", "0.69307005", "0.6914219", "0.6913435", "0.6871265", "0.68299145", "0.678279", "0.67725205", "0.67673...
0.6432308
65
get train_loader and test_loader
def getloader(self): return self.train_loader, self.test_loader
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loader(mode):\n\tglobal train_loader, valid_loader\n\tconfig = Config\n\ttransform_list_train = []\n\ttransform_list_test = []\n\tis_train = mode == \"train\"\n\tif config.train.use_augmentation:\n\t\ttransform_list_train.extend([transforms.Resize((config.data.image_size, config.data.image_size)), ImageNet...
[ "0.77100426", "0.76738524", "0.76040876", "0.7384658", "0.7363785", "0.72057515", "0.71765244", "0.71735513", "0.7090515", "0.6992934", "0.6848907", "0.6813013", "0.67717856", "0.6755532", "0.6742161", "0.6734493", "0.67340785", "0.67340785", "0.67340785", "0.67340785", "0.67...
0.90590286
0
Checks if the location provided is valid
def isValidLocation(location): if (".." in location): return 1 elif ("/" in location): return 1 elif (len(set(location))==1 and location[0]==' '): return 0 elif (len(set(location))==0): return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_location(location):\r\n if location.latitude > 35 and location.latitude < 39 and location.longitude > -123 and location.longitude < -120:\r\n return True\r\n else:\r\n return False", "def validate_location_string(location_string):\n if not is_valid_location_string(location_string...
[ "0.72018135", "0.71911407", "0.70503855", "0.70482206", "0.6986304", "0.69819015", "0.6888222", "0.6885054", "0.6870642", "0.6842541", "0.6826519", "0.6815417", "0.6808533", "0.65721273", "0.6568966", "0.6565965", "0.6560578", "0.6542337", "0.65000886", "0.6468777", "0.646676...
0.6946971
6
Returns a dictionary with fasta sequences
def readFastaFile(filename): if os.path.exists(filename)==False:return {} sequences={} fhr=open(filename,"r") for line in fhr: if line[0]==">": sequences[line.strip()[1:].split()[0]]=fhr.readline().strip() fhr.close() return sequences
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequenceDict(self):\n\t\twith open(self.ff) as fastaFile:\n\t\t\tsequences = {}\n\t\t\tfor name, seq in self.readFasta(fastaFile):\n\t\t\t\tsequences[name] = seq\n\t\treturn sequences", "def return_fasta_dic(file):\n seq_dict = {rec.id: rec.seq for rec in SeqIO.parse(file, \"fasta\")}\n return seq_dict...
[ "0.80807185", "0.7724803", "0.7573926", "0.7517369", "0.73367995", "0.7267906", "0.72154003", "0.71667635", "0.71563816", "0.70788085", "0.7021273", "0.6995693", "0.6901336", "0.68707097", "0.6860085", "0.6858154", "0.6797722", "0.67955476", "0.6772851", "0.6702563", "0.66836...
0.75669366
3
Writes each sequence in the dictionary sequence into the file
def writeFastaFile(filename,sequences): fhw=open(filename,"w") for id in sequences: fhw.write(">"+id+"\n"+sequences[id]+"\n") fhw.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_dictionary():\n for dictionary in dictionaries:\n for values in dictionary.values():\n with open(sys.argv[1] + \"-1\", \"ab\") as dest_file:\n dest_file.write(values)", "def write_all(self):\n\n for _, seq in self.seq_dict.items():\n write_mode(seq)...
[ "0.72846466", "0.7275438", "0.71122277", "0.7018072", "0.6823325", "0.6785966", "0.66114575", "0.64336467", "0.6419349", "0.6363609", "0.63390887", "0.6335222", "0.6323237", "0.63117623", "0.6288234", "0.62842673", "0.62507164", "0.6242228", "0.6240362", "0.62274235", "0.6208...
0.67444724
6
Given a set of images with all the same shape, makes a mosaic with nrows and ncols
def make_mosaic(imgs, nrows, ncols, border=1): nimgs = imgs.shape[0] imshape = imgs.shape[1:] mosaic = ma.masked_all((nrows * imshape[0] + (nrows - 1) * border, ncols * imshape[1] + (ncols - 1) * border), dtype=np.float32) paddedh = imsha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_mosaic(imgs, nrows, ncols, border=1):\n nimgs = imgs.shape[0]\n imshape = imgs.shape[1:]\n\n mosaic = ma.masked_all((nrows * imshape[0] + (nrows - 1) * border,\n ncols * imshape[1] + (ncols - 1) * border),\n dtype=np.float32)\n\n paddedh = ...
[ "0.8022985", "0.7750741", "0.7483416", "0.7252812", "0.7172096", "0.68353236", "0.6759894", "0.664381", "0.6552254", "0.6430067", "0.6313499", "0.6269626", "0.62662363", "0.6173159", "0.61729586", "0.61434", "0.6112478", "0.61113024", "0.60981095", "0.60899454", "0.6086112", ...
0.8077606
0
Users will be asked to input a number to produce shifted ALPHABET as the cipher table. After that, any strings typed in will be encrypted.
def main(): secret_number = int(input('Secret number: ')) ciphered_string = input("What's the ciphered string?") ciphered_string = ciphered_string.upper() s = decipher(ciphered_string, secret_number, ALPHABET) print('The deciphered string is: '+s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cryptate(self):\r\n\r\n intab1 = \"abcdefghijklomnopqrstuvwxyz\"\r\n outtab1 = \"?2p=o)7i(u9/y&t3%r¤5e#w1q!>)\"\r\n# Fetching the writing in textbox\r\n s = self.textbox.toPlainText()\r\n a = s.lower()\r\n# The crypting process, replaces letters in intab1 with outtab1\r\n cry...
[ "0.68428767", "0.67755866", "0.6713744", "0.6542811", "0.6457704", "0.6448941", "0.6403837", "0.6338209", "0.6330272", "0.62990385", "0.6244252", "0.62310904", "0.6195139", "0.6165526", "0.6152364", "0.61205655", "0.6074213", "0.60739654", "0.6046632", "0.60419285", "0.603745...
0.63130975
9
Creates a checkers marker
def __init__(self, symbol, row, col, player, king): self.symbol = symbol self.row = row self.col = col self.alive = True self.player = player self.king = king
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DefineMarkers(self):\n # Get the colours for the various markers\n style = self.GetItemByName('foldmargin_style')\n back = style.GetFore()\n rgb = eclib.HexToRGB(back[1:])\n back = wx.Colour(red=rgb[0], green=rgb[1], blue=rgb[2])\n\n fore = style.GetBack()\n rgb...
[ "0.61258304", "0.5981696", "0.5978777", "0.5670918", "0.5628701", "0.56238633", "0.55355644", "0.54654825", "0.54654825", "0.54654825", "0.54654825", "0.54128397", "0.5385469", "0.5328432", "0.5304465", "0.52660483", "0.52591896", "0.523701", "0.5223657", "0.52122986", "0.517...
0.0
-1
Retrieves the position a piece will end up in when it jumps/captures another piece
def get_piece_jumping_position(self, captured_piece): row_diff = captured_piece.row - self.row # Compares the row/column numbers of the two pieces col_diff = captured_piece.col - self.col opp_row = row_diff + captured_piece.row opp_col = col_diff + captured_piece.col return {'op...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_position(self):", "def get_position(self, position):", "def getKickingPosition():\n pass", "def GetPosition(self):\n ...", "def _find_position(self, e):\n walk = self._data.first()\n while walk is not None and walk.element()._value != e:\n walk = self._data.a...
[ "0.6879707", "0.6765341", "0.6561232", "0.64922756", "0.64267874", "0.6377644", "0.63749224", "0.6371028", "0.63477916", "0.6345881", "0.6296877", "0.6216796", "0.62100327", "0.62100327", "0.62100327", "0.62100327", "0.62100327", "0.62100327", "0.62100327", "0.62100327", "0.6...
0.7369341
0
Moves jumping piece and removes captured piece on the board
def capture_piece(self, captured_piece): self.row = self.get_piece_jumping_position(captured_piece)['opp_row'] self.col = self.get_piece_jumping_position(captured_piece)['opp_col'] captured_piece.alive = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unmove(self):\n (start, end) = self.history.pop()\n self._board[start] = self._board[end]\n self._board[end] = 0\n self.winner = None\n self.player_turn = CheckersGame.opposite[self.player_turn]", "def remove_piece(self) -> None:\r\n if self.has_piece():\r\n ...
[ "0.70486736", "0.6989994", "0.6985869", "0.69829", "0.67745566", "0.67109895", "0.6653524", "0.6583775", "0.6516506", "0.6491379", "0.6382669", "0.6363406", "0.63576984", "0.6307027", "0.6293441", "0.6271673", "0.62415826", "0.6231706", "0.6230169", "0.62088776", "0.6160887",...
0.6425888
10
Checks for the positions of immediatelylocated squares on the diagonals nearby the current piece
def get_valid_moves(self): if self.king: valid_moves = [[self.row + 1, self.col + 1], [self.row + 1, self.col - 1], [self.row - 1, self.col - 1], [self.row - 1, self.col + 1]] else: if self.player ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _any_piece_in_way(self, from_row, from_col, dr, dc, dm, toRow=None, toCol=None):\n if toRow != None and toCol != None and (toRow == from_row):\n colDiff = abs(toCol - from_col)\n for i in range(1, colDiff):\n if self.board.squares[from_row][from_col + i * dc] != None...
[ "0.70770323", "0.7031906", "0.66915286", "0.66789377", "0.66785914", "0.6651661", "0.6633612", "0.6569592", "0.6533331", "0.65264416", "0.6517482", "0.6507979", "0.6469776", "0.64560163", "0.6453531", "0.6445893", "0.6443594", "0.6432724", "0.64040756", "0.6399492", "0.636126...
0.0
-1
Turns a normal piece into a King piece
def make_piece_king(self): made_king = False if self.player == 1 and self.row == 7 and not self.king: self.king = True self.symbol = '@' made_king = True if self.player == 2 and self.row == 0 and not self.king: self.king = True self.sym...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crowned(self): # called when this piece has become a 'King'\r\n \r\n self.isKing = True", "def __init__(self, player):\n self._piece_type = 'king'\n self._value = 200 if player == \"white\" else -200\n self._summary = 'W-Kg' if player == \"white\" else 'B-Kg'\n\n sel...
[ "0.6926413", "0.6292884", "0.6171554", "0.6160158", "0.60965276", "0.5949254", "0.5843888", "0.5793144", "0.57742566", "0.5739838", "0.57030153", "0.56553817", "0.5634157", "0.5566023", "0.5545282", "0.5544854", "0.5489704", "0.5484199", "0.54804754", "0.5445173", "0.54320693...
0.63675565
1
Turns a King piece back into a normal piece
def undo_king_piece(self): self.king = False if self.symbol == '%': self.symbol = 'X' else: self.symbol = 'O'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crowned(self): # called when this piece has become a 'King'\r\n \r\n self.isKing = True", "def king_adjust(self, turn):\n\n opposite_turn = next_turn(turn)\n\n original_location_index = (piece_class.KING_LOCATION[turn][0] + piece_class.KING_LOCATION[turn][1] * 8)\n \n# ...
[ "0.67174953", "0.61718196", "0.58132625", "0.5801378", "0.5796565", "0.578926", "0.5748493", "0.57447267", "0.56837153", "0.56673205", "0.56466615", "0.5537448", "0.5526973", "0.5514001", "0.546705", "0.54153657", "0.53785384", "0.5371563", "0.53497434", "0.53432065", "0.5323...
0.61067027
2
Serialize content of the response
def __init__(self, content = None, *args, **kwargs): super(Response, self).__init__(content, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_response(self, response):\n raise NotImplementedError()", "def content(self):\n return(self.__response.content)", "def serialize(self) -> bytes:\n return json_dumps([\n resp._to_dict() for resp in self if resp is not None\n ]).encode()", "def to_response(s...
[ "0.7928743", "0.7011565", "0.70030195", "0.6780554", "0.6768665", "0.672819", "0.6711302", "0.6693346", "0.6677484", "0.6660508", "0.66330224", "0.6612777", "0.6574437", "0.6560126", "0.6557569", "0.6477153", "0.64720225", "0.6470388", "0.6457519", "0.64427125", "0.64219767",...
0.0
-1
Adds an element to the window, and returns the element that drops out of the window.
def append(self, event): # Adding as the first element if len(self) == 0: self.starttime = event.time self.endtime = event.time self.insert(0, event) if self.streamEventTypes.has_key(event.type): self.streamEventTypes[event.type] += 1 else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_element(self, element) -> Node:\r\n current_element = self._top\r\n while True:\r\n if current_element.value() <= element:\r\n if current_element.right_son() == None:\r\n new_son = Node(current_element, element)\r\n current_elem...
[ "0.553016", "0.53889203", "0.52515614", "0.519655", "0.519523", "0.5108464", "0.5104741", "0.5095854", "0.5061609", "0.5050048", "0.4982234", "0.49784708", "0.49784708", "0.49746892", "0.4958872", "0.49581817", "0.4933229", "0.49160886", "0.49093467", "0.49034932", "0.4903013...
0.45702696
60
Returns whether the window is full (i.e. contains length elements).
def filled(self): return len(self) == self.length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isFull(self) -> bool:\n return self._elems == self._k", "def is_full(self):\n return self.top == self.size - 1", "def isFull(self) -> bool:\n return self.size == self.maxlen", "def is_full(self):\n return len(self.__occupied_slots__) >= self.__size__", "def is_full(self):\n ...
[ "0.79250014", "0.78371614", "0.7822246", "0.7745839", "0.77388257", "0.7659492", "0.7657841", "0.76251173", "0.7612211", "0.75978243", "0.7503964", "0.74769604", "0.74674183", "0.74674183", "0.7453933", "0.7441793", "0.7432225", "0.7414699", "0.73752224", "0.73672813", "0.736...
0.7037145
48
Returns the count of the given event in this window.
def getCount(self, event): # Attempt 2: Still too slow count = 0 for mEvent in self: if event.__st__(mEvent): count += 1 return count # Attempt 1: Too slow #return reduce((lambda x, y: x+y), # map((...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_count(self):\n\n with self.lock:\n return self.num_events", "def count(self):\n self._read_keypad()\n return len(self._current_events)", "def getNumberOfEvents(self):\n whereClause = \"ecc_id = 1 and r_power = 0 and n = 2\"\n Nevent = self.db.selectFromTa...
[ "0.73000044", "0.71963114", "0.71276337", "0.6958334", "0.68215454", "0.6774381", "0.6593176", "0.64775324", "0.64505064", "0.64042574", "0.63854074", "0.6373321", "0.63723993", "0.6370872", "0.6362475", "0.63529676", "0.63209456", "0.63068074", "0.63068074", "0.6304193", "0....
0.7007153
3
Generate the rotation matrix from the axisangle notation. Conversion equations ====================
def rotation_matrix( axis, angle ): # Trig factors. ca = cos(angle) sa = sin(angle) C = 1 - ca # Depack the axis. x, y, z = tuple( axis ) # Multiplications (to remove duplicate calculations). xs = x*sa ys = y*sa zs = z*sa xC = x*C yC = y*C zC = z*C xyC = x*yC ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def axis2rotmat(axis):\n return quat2rotmat(axis2quat(axis))", "def angle_axis_to_rotation_matrix(angle_axis):\n def _compute_rotation_matrix(angle_axis, theta2, eps=1e-6):\n # We want to be careful to only evaluate the square root if the\n # norm of the angle_axis vector is greater than zero...
[ "0.77043355", "0.76359385", "0.7588388", "0.75811124", "0.754111", "0.74904245", "0.74278057", "0.7345989", "0.7274639", "0.7268306", "0.7201735", "0.71938246", "0.7182542", "0.71510977", "0.71450824", "0.7110727", "0.708203", "0.7053", "0.7053", "0.7021987", "0.70177096", ...
0.7492095
5
Add given successor to given node. Successor must be a list
def addSuccTo(self, thisNode, addedSuccessor): # add addedSuccessor to node addedSuccessors if self.nodes.get(thisNode) != None: self.nodes[thisNode] += addedSuccessor else: self.nodes[thisNode] = addedSuccessor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_last(cls, node, value):\n # Check if element is the last element\n if node.next_ is None:\n node.next_ = Node(value)\n return\n\n # Recursively go to next node\n cls._add_last(node.next_, value)", "def append(self, node):\n if not isinstance(node,...
[ "0.59201324", "0.5847294", "0.58244926", "0.56499416", "0.56388146", "0.5604914", "0.55893385", "0.5552044", "0.5538396", "0.5529828", "0.55075616", "0.5507199", "0.55013466", "0.5490016", "0.5460252", "0.5459665", "0.5453652", "0.54473245", "0.5441345", "0.543303", "0.542749...
0.6483051
0
Delete successor of given node. retiredSuccessor must be a list
def retSuccOf(self, thisNode, retiredSuccessor): if self.nodes.get(thisNode) != None: # reconstruct the list without content # of retiredSuccessor self.nodes[thisNode] = [x for x in self.nodes[thisNode] if x not in retiredSuccessor] else: pass # nothing t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_node(self, node):\n predecessor = node._prev\n successor = node._next\n predecessor._next = successor\n successor._prev = predecessor\n self._size -= 1\n element = node._element # record deleted element\n node._prev = node._next = node._element = None ...
[ "0.6731497", "0.66242737", "0.6571568", "0.63829976", "0.6107068", "0.5910325", "0.57547265", "0.5712412", "0.5700635", "0.56927544", "0.5683774", "0.5659619", "0.56565934", "0.5649435", "0.56414557", "0.5528133", "0.5516164", "0.54907864", "0.54866654", "0.5474099", "0.54736...
0.73988205
0
Dijkstra. Return path to end
def Dijkstra(self, start, end): # Pour n parcourant noeuds # for each node of graph walked = {} previous = {} for key in self.nodes.iterkeys(): walked[key] = -1 # infinity previous[key] = None #Fin pour #début.parcouru = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortestPath(G,start,end):\n\n D,P = Dijkstra(G,start)\n Path = []\n while 1:\n Path.append(end)\n if end == start: break`\u001b`\n end = P[end]\n Path.reverse()\n return Path", "def shortestPath(G, start, end):\n\n D, P = Dijkstra(G, start)\n print(D)\n print(P)\...
[ "0.7668829", "0.747206", "0.7428651", "0.7387995", "0.7198562", "0.7070464", "0.7038927", "0.69999737", "0.69256294", "0.68962705", "0.6884718", "0.684857", "0.68350804", "0.6822122", "0.6805646", "0.67936665", "0.6757965", "0.67419994", "0.6724328", "0.6698233", "0.66802895"...
0.6809197
14
Wait for nonempty list of tuple (x,y), keys of distances dictionnary. Return the key with the minimum positive value
def nodeAtMinimumDistance(self, notFoundYet, distances): # found minimal minimal = None for node in notFoundYet: if (distances[node] >= 0): if minimal == None or (distances[minimal] > distances[node]): minimal = node # return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minInDict(dist):\r\n m = float('inf')\r\n for p in dist:\r\n for q in dist[p]:\r\n if dist[p][q] < m:\r\n m = dist[p][q]\r\n a,b = p,q\r\n return a,b", "def get_min_distance(distances, unvisited_nodes):\n min_value = None\n node = None\n ...
[ "0.7580942", "0.6650865", "0.6553729", "0.6480363", "0.64265734", "0.63816047", "0.624649", "0.62450093", "0.619113", "0.61821353", "0.61122376", "0.61039424", "0.6092546", "0.6077502", "0.6054605", "0.6032718", "0.6010928", "0.60083693", "0.5967033", "0.59658986", "0.5961938...
0.60253537
16
Create a DNNLinearCombinedClassifier based on the HYPER_PARAMS in the parameters module
def create_classifier(config): feature_columns = list(featurizer.create_feature_columns().values()) deep_columns, wide_columns = featurizer.get_deep_and_wide_columns( feature_columns ) linear_optimizer = tf.train.FtrlOptimizer(learning_rate=parameters.HYPER_PARAMS.learning_rate) dnn_optim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_hparams(hparam_string=None):\n hparams = tf.contrib.training.HParams(\n # The name of the architecture to use.\n arch='resnet',\n lrelu_leakiness=0.2,\n batch_norm_decay=0.9,\n weight_decay=1e-5,\n normal_init_std=0.02,\n generator_kernel_size=3,\n discriminator_...
[ "0.61655724", "0.6055172", "0.5826157", "0.57699984", "0.5739669", "0.57394177", "0.57380944", "0.5731565", "0.57296675", "0.5708917", "0.56826067", "0.5669957", "0.5664464", "0.56582004", "0.561601", "0.5595524", "0.5571619", "0.55614996", "0.55269104", "0.5517112", "0.55164...
0.6402716
0
Create a DNNLinearCombinedRegressor based on the HYPER_PARAMS in the parameters module
def create_regressor(config): feature_columns = list(featurizer.create_feature_columns().values()) deep_columns, wide_columns = featurizer.get_deep_and_wide_columns( feature_columns ) linear_optimizer = tf.train.FtrlOptimizer(learning_rate=parameters.HYPER_PARAMS.learning_rate) dnn_optimi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dnn_regressor(input_columns, dnn_hidden_units, learning_rate):\n # Following values are hard coded for simplicity in this example,\n # However prefarably they should be passsed in as hparams.\n\n input_layers = {\n colname: tf.keras.layers.Input(name=transformed_name(colname), shape=(), dtype=tf....
[ "0.6357165", "0.6267551", "0.5845995", "0.57434636", "0.56861526", "0.5682881", "0.5592301", "0.5583284", "0.55018824", "0.54800844", "0.54477584", "0.54402536", "0.54336065", "0.5403131", "0.533953", "0.5338399", "0.53342026", "0.53158724", "0.52965474", "0.52957726", "0.529...
0.69446474
0
Create the number of hidden units in each layer if the HYPER_PARAMS.layer_sizes_scale_factor > 0 then it will use a "decay" mechanism to define the number of units in each layer. Otherwise, parameters.HYPER_PARAMS.hidden_units will be used asis.
def construct_hidden_units(): hidden_units = list(map(int, parameters.HYPER_PARAMS.hidden_units.split(','))) if parameters.HYPER_PARAMS.layer_sizes_scale_factor > 0: first_layer_size = hidden_units[0] scale_factor = parameters.HYPER_PARAMS.layer_sizes_scale_factor num_layers = parameter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layers_sizes(self):\n return iter([self.delta_h*l for l in range(int(self.h/self.delta_h)-1)])", "def get_hidden_layer_size(self):\r\n return self.hidden_layer_size", "def init(InputUnits, OutputUnits, numHiddenLayer, HiddenUnits=None):\n global HiddenUnit\n all_weights = []\n ...
[ "0.6702567", "0.64026886", "0.6389147", "0.6316787", "0.6186162", "0.61597973", "0.6137765", "0.6114793", "0.61083937", "0.6039899", "0.6028688", "0.6006836", "0.59841716", "0.5980518", "0.5980518", "0.5961161", "0.5955761", "0.5954433", "0.5954433", "0.5954433", "0.5954433",...
0.7744325
0
Stream mode detection for live monitoring.
def stream_detect(self, data, is_lanczos=False): # Set variables data = self.convert_to_nparray(data) T = len(data) # Check the size of input data if not len(data) > self.L + self.w + self.k - 2: return 0 # Calculation range t = T - self.L + 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_active(self):\n\t\tself.stream.is_active()", "def is_monitor_changes(self):\n return self.subscription_list.mode == gnmi_pb2.SubscriptionList.STREAM", "def capture_is_active(self):\n return self.um in self._streams", "def __live_video_stream(self, setting: bool):\n command = '...
[ "0.6232466", "0.61419344", "0.61410385", "0.60588294", "0.6038101", "0.59463435", "0.5937946", "0.59305567", "0.59303325", "0.58259875", "0.5813975", "0.5796872", "0.577639", "0.57553786", "0.56605387", "0.56320494", "0.55989474", "0.55502355", "0.55490345", "0.5529361", "0.5...
0.507843
72
Method to serialize instance into database record
def serialize(self): data = {} for k, v in self.__dict__.items(): if not k.startswith('__'): data[k] = v return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_to_db(self):", "def serialize(self):\n return self.record", "def serialize(self):", "def persistence_serialize(self):\n raise NotImplementedError", "def instance_to_model(self):\n pass", "def serialize(self, obj):\n pass", "def serialize(self):\n pass", "d...
[ "0.7205748", "0.7138313", "0.7055717", "0.6969619", "0.6826118", "0.6812763", "0.67744905", "0.67398894", "0.66115546", "0.65866464", "0.65163994", "0.64966214", "0.6420716", "0.6392247", "0.637449", "0.6372859", "0.6363159", "0.6322575", "0.63046175", "0.6274368", "0.6248277...
0.0
-1
Method to deserialize database record into instance
def deserialize(cls, row: Dict): return cls(row)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_to_class(cls, record):\n raise NotImplementedError()", "def deserialize(cls, record):\n return cls(\n source=record.get(\"source\", \"\"),\n category=record.get(\"category\", \"\"),\n name=record.get(\"name\", \"\"),\n message=record.get(\"message\...
[ "0.7406476", "0.7108388", "0.6613538", "0.6518557", "0.6459915", "0.64042187", "0.6397658", "0.638551", "0.638145", "0.6333562", "0.62562114", "0.61834943", "0.6118097", "0.61079067", "0.6076536", "0.60713637", "0.60583806", "0.60353255", "0.59890425", "0.5983995", "0.5981883...
0.65390396
3
Saves an object to the database
def save(self): data = self.serialize() self.validate(data) saved_data = DATABASE_CONNECTION.insert(self.__class__.__name__, data) self.__dict__.update(saved_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_object(self, object, **kwargs):\n object.save()", "def save(self, obj):", "def save(self):\n self.db.commit()", "def save(self):\n self.__db.commit()", "def save_to_db(self):\n db.session.add(self)\n db.session.commit()", "def save_to_db(self):\n db.sess...
[ "0.7955058", "0.7923415", "0.7690593", "0.7657648", "0.76123697", "0.76123697", "0.76123697", "0.76123697", "0.7612078", "0.7559152", "0.75419587", "0.7541607", "0.7541607", "0.7541607", "0.7541607", "0.7541607", "0.7541607", "0.7541607", "0.7541607", "0.7541607", "0.7541607"...
0.7133994
43
Updates an existing object in the database
def update(self): data = self.serialize() self.validate(data) saved_data = DATABASE_CONNECTION.update(self.__class__.__name__, data['id'], data) self.__dict__.update(saved_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n db.session.commit()", "def update(self):\n db.session.commit()", "def model_update(self, db):\n db.session.commit()", "def _update(self, model_obj):\n conn = self._get_session()\n db_item = None\n\n # Fetch the record from database\n try:\n...
[ "0.75371003", "0.75371003", "0.7466571", "0.74126726", "0.72996414", "0.72359157", "0.7225728", "0.71664655", "0.71437275", "0.7073557", "0.70131123", "0.6992443", "0.6980974", "0.68851495", "0.6846718", "0.6777979", "0.67719555", "0.67719376", "0.6763548", "0.6753278", "0.67...
0.72196794
7
Deletes an object from the database
def delete(self): DATABASE_CONNECTION.delete(self.__class__.__name__, self.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_obj(obj):\n Session.delete(obj)\n Session.flush()\n Session.commit()", "def delete(self, obj):\n self.session.delete(obj)", "def delete(self, obj=None):\n if obj is not None:\n self.__session.delete(obj)\n self.save()", "def delete(self, obj=None):\n ...
[ "0.8452331", "0.82672685", "0.8126796", "0.80908465", "0.80908465", "0.80908465", "0.80908465", "0.80451196", "0.8007541", "0.79879785", "0.79879785", "0.79879785", "0.7984152", "0.798322", "0.7979902", "0.7969098", "0.7925014", "0.7908807", "0.7908807", "0.7908807", "0.79088...
0.77275157
34
Function to return all users based on a filter
def get(cls, filters: Dict = None): if filters is None: filters = {} data = DATABASE_CONNECTION.get(cls.__name__) for k, v in filters.items(): data = [row for row in data if row[k] in v] res = [cls.deserialize(row) for row in data] return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_users():", "def get_users(filter, api_site_parameter, page = 1, pagesize = 30, sort = 'reputation'):\n path = \"users\"\n results = __fetch_results(path, api_site_parameter, inname= filter, page = page, pagesize = pagesize, sort = sort)\n return results", "def get_users():\n request_fil...
[ "0.80941874", "0.77792567", "0.75039816", "0.74839103", "0.7448195", "0.7316701", "0.73149776", "0.7279059", "0.71218026", "0.7106459", "0.7092408", "0.70290434", "0.70177096", "0.69870985", "0.69189495", "0.6900591", "0.6892448", "0.6838329", "0.6803028", "0.67621124", "0.67...
0.0
-1
Function to validate the data before saving into the database
def validate(self, data: Dict): for key in self.__dict__.keys(): if not key.startswith('__') and key != 'id': if data[key] == '' or data[key] is None: raise ValidationError( message=f'{key} should not be "{data[key]}"' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_save(self):\r\n self.validate()", "def validate():", "def __validate():\n # TODO: implement", "def _validate_create_data(self, data):\n return", "def _validate(self):\n pass", "def _validate_update_data(self, data):\n return", "def validate(cls, data, errors):", ...
[ "0.73586977", "0.73210484", "0.70206267", "0.6999707", "0.6918218", "0.68896943", "0.68790495", "0.68769294", "0.68769294", "0.6824844", "0.6824844", "0.6824844", "0.6824844", "0.6824844", "0.6824844", "0.6824844", "0.6824844", "0.6781121", "0.6692529", "0.6667702", "0.666222...
0.6086586
73
Recebe valor e retorna aumentando a porcentagem indicada.
def aumentar(valor=0, taxa=0, formatar=False): taxa = taxa / 100 res = valor + (valor * taxa) return res if formatar is False else moeda(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self):\r\n return 0", "def Get(self):\n value=0\n return value", "def __int__(self) -> int:\n\n return self.centi", "def desconto(self, porcentagem):\n return(self.__valor * (100 - porcentagem)/100)", "def get(self) -> float:\n ...", "def getamount(...
[ "0.6326216", "0.6237523", "0.61094576", "0.60889095", "0.6083021", "0.59671485", "0.5952484", "0.5937926", "0.5879708", "0.5850464", "0.5830787", "0.5798187", "0.5792034", "0.57859194", "0.578497", "0.5778552", "0.5772671", "0.57025516", "0.5697521", "0.56903106", "0.56903106...
0.0
-1
[Retorna o dobro do valor recebido.]
def dobro(valor=0, formatar=False): res = valor * 2 return res if not formatar else moeda(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self):", "def getvalue(self):\n ...", "def getvalue(self):\n ...", "def getval(self):\r\n return self.value", "def getvalue(self):\n return str(self.data)", "def get_value(self):\n pass", "def get_val(self):\n return", "def get_value(self):\n ...
[ "0.73297185", "0.72909284", "0.72909284", "0.72222644", "0.7220246", "0.715381", "0.7126349", "0.7019796", "0.69751", "0.69751", "0.6941204", "0.6940868", "0.6888588", "0.68696535", "0.6866569", "0.68407863", "0.68407863", "0.68407214", "0.6838351", "0.68271303", "0.68047523"...
0.0
-1
[Retorna a metade do valor recebido.]
def metade(valor=0, formatar=False): res = valor / 2 return res if not formatar else moeda(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self):", "def getvalue(self):\n ...", "def getvalue(self):\n ...", "def getvalue(self):\n return str(self.data)", "def get_value(self):\n pass", "def value(self):\n return self.raw.get_attribute(\"value\")", "def get_value(self):\n return None", "de...
[ "0.71889293", "0.7119958", "0.7119958", "0.7082544", "0.70788443", "0.6963671", "0.68912464", "0.68792003", "0.686312", "0.686312", "0.6816046", "0.6810356", "0.6804807", "0.68017834", "0.6786927", "0.6786927", "0.6783616", "0.6783616", "0.67645025", "0.6752893", "0.6752169",...
0.0
-1
We expect the 2019 population for Boulder, CO to be 326196.
def test_census_county_population(): dataframe = get_county_population_dataframe() boulder_county_row = dataframe.loc[dataframe['county_fips'] == 8013] boulder_county_population = boulder_county_row.get('county_population') assert float(boulder_county_population) == 326196
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_population_for_health_board(health_board_to_council: pd.DataFrame,\r\n council_areas: pd.DataFrame) -> pd.Series:\r\n population_health_boards = {}\r\n for health_board, councils in health_board_to_council.iterrows():\r\n population_total = 0\r\n for c...
[ "0.5970188", "0.5863773", "0.5613959", "0.55375576", "0.55260384", "0.5476783", "0.54646116", "0.5452425", "0.5383164", "0.5369351", "0.53572977", "0.53572977", "0.5309722", "0.5297909", "0.5263271", "0.525975", "0.5241239", "0.520593", "0.5202293", "0.5201915", "0.51903474",...
0.668509
0
This function is print result for the selected function
def main(ch): try: # Here is the search and launch of the selected function if ch == '1': result = fact(int(input("Factorial for "))) if ch == '2': result = exp2(float(input("Square exponention for "))) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_out():\n pass", "def result_display(self, arg):\n if self.rc.pprint:\n out = stringify_func(arg)\n\n if '\\n' in out:\n print\n\n print out\n else:\n print repr(arg)",...
[ "0.7258426", "0.6994682", "0.6988934", "0.69853956", "0.6805064", "0.6761002", "0.6725707", "0.658907", "0.6573678", "0.6561214", "0.6560366", "0.6544426", "0.64836955", "0.64681154", "0.6456814", "0.6456814", "0.6419521", "0.6403205", "0.640306", "0.6391788", "0.6389173", ...
0.0
-1
GIVEN A FLASK app running WHEN the '/' page is requested (GET) THEN check the response is valid
def test_service_api_get(service_app): response = service_app.get('/') assert response.headers['Content-Type'] == 'application/json' assert response.status_code == 200 assert json.loads(response.data) == {'description': 'service is up', 'status': 200}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_should_get_an_ok_response():\n assert web_app.validate_reponse()", "def test_index():\n\n with flask_app.test_client() as client:\n response = client.get(\"/\")\n assert response.status_code == 200\n assert b\"milhouse\" in response.data\n\n response = client.get(\"/?ur...
[ "0.69667166", "0.65075797", "0.6493349", "0.6464485", "0.6455989", "0.6425723", "0.6377717", "0.6328973", "0.631041", "0.6307348", "0.6304983", "0.6293757", "0.6253998", "0.6250294", "0.6235956", "0.62253267", "0.6175314", "0.6168223", "0.6158203", "0.61540496", "0.6146673", ...
0.0
-1
GIVEN A FLASK app running WHEN the '/' page is requested (POST) THEN 400 Bad Request is returned
def test_service_api_post_without_data(service_app): response = service_app.post('/predict') assert response.headers['Content-Type'] == 'application/json' assert response.status_code == 400 assert json.loads(response.data) == {'error': 'Failed to decode JSON object'}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_bad_request(e):\n app.logger.info('Bad request', e)\n return flask.make_response('bad request', 400)", "def test_400_bad_request(self):\n # create route to abort the request with the 400\n @self.app.route('/400')\n def bad_request_error():\n abort(400)\n re...
[ "0.70822495", "0.6771565", "0.65812755", "0.63042635", "0.6297667", "0.6243962", "0.6184475", "0.61802363", "0.6133762", "0.61061805", "0.6099018", "0.60918915", "0.59911215", "0.59702384", "0.5940665", "0.59371", "0.5922674", "0.59174955", "0.58841676", "0.58604157", "0.5847...
0.5677333
42
GIVEN A FLASK app running WHEN the '/predict' page is requested (POST) with missing data THEN error message is returned
def test_service_api_predict_missing_keys(service_app): tmp_data = copy.deepcopy(data[:1]) tmp_data[0].pop('x1') response = service_app.post('/predict', data=json.dumps(tmp_data), content_type='application/json') assert response.headers['C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_service_api_post_without_data(service_app):\n response = service_app.post('/predict')\n assert response.headers['Content-Type'] == 'application/json'\n assert response.status_code == 400\n assert json.loads(response.data) == {'error': 'Failed to decode JSON object'}", "def test_prediction_en...
[ "0.6962393", "0.69179934", "0.66848165", "0.665652", "0.6646762", "0.6506658", "0.6432259", "0.6270553", "0.62445444", "0.6205674", "0.6173624", "0.61522317", "0.6070071", "0.6068994", "0.6047629", "0.6034418", "0.6016047", "0.60125744", "0.6012292", "0.5998298", "0.59882045"...
0.6289248
7
GIVEN A FLASK app running WHEN the '/predict' page is requested (POST) with wrong data type THEN error message is returned
def test_service_api_predict_wrong_data_type(service_app): response = service_app.post('/predict', data="test", content_type='application/json') assert response.headers['Content-Type'] == 'application/json' assert response.status_code == 400 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_service_api_post_without_data(service_app):\n response = service_app.post('/predict')\n assert response.headers['Content-Type'] == 'application/json'\n assert response.status_code == 400\n assert json.loads(response.data) == {'error': 'Failed to decode JSON object'}", "def test_service_api_p...
[ "0.66735005", "0.6633048", "0.6560816", "0.6507953", "0.63487774", "0.6273836", "0.626291", "0.6202898", "0.61672586", "0.6142531", "0.60959303", "0.6080977", "0.6053256", "0.60155135", "0.6006262", "0.59955657", "0.5945496", "0.59417224", "0.5937137", "0.5935213", "0.5906254...
0.7668008
0
GIVEN A FLASK app running WHEN the '/predict' page is requested (POST) with one not classified data sample THEN Records does not meet classification requirements is returned
def test_service_api_predict_single_raw_no_classification(service_app): response = service_app.post('/predict', data=json.dumps(data[:1]), content_type='application/json') assert response.headers['Content-Type'] == 'application/json' assert res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_service_api_predict_single_raw_classified(service_app):\n response = service_app.post('/predict',\n data=json.dumps(data[1:2]),\n content_type='application/json')\n\n response_data = json.loads(response.data)\n assert response.headers[...
[ "0.7039637", "0.6956225", "0.6946195", "0.6836482", "0.66805923", "0.6593482", "0.6588958", "0.6545336", "0.64770377", "0.6471251", "0.6464594", "0.6451226", "0.6428195", "0.6403254", "0.64030516", "0.638386", "0.63687927", "0.63607633", "0.6325054", "0.6274598", "0.62648636"...
0.76360226
0
GIVEN A FLASK app running WHEN the '/predict' page is requested (POST) with one not classified data sample THEN Class classification is returned
def test_service_api_predict_single_raw_classified(service_app): response = service_app.post('/predict', data=json.dumps(data[1:2]), content_type='application/json') response_data = json.loads(response.data) assert response.headers['Content-Ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify():\n excerpt = request.form.get('data')\n if excerpt is None or not excerpt:\n return jsonify(message='Bad request'), 400\n return jsonify(clf.predict(excerpt))", "def test_service_api_predict_single_raw_no_classification(service_app):\n response = service_app.post('/predict',\n ...
[ "0.76406753", "0.74213797", "0.7416105", "0.72912914", "0.7222102", "0.72028095", "0.7123915", "0.7011428", "0.69632816", "0.6948046", "0.68989575", "0.6890397", "0.6888021", "0.6880098", "0.68342173", "0.68097967", "0.66959274", "0.6684077", "0.6667818", "0.66490483", "0.663...
0.7220582
5
GIVEN A FLASK app running WHEN the '/predict' page is requested (POST) with one not classified data sample THEN multiple classifications are returned
def test_service_api_predict_multiple_raw_classified(service_app): response = service_app.post('/predict', data=json.dumps(data), content_type='application/json') response_data = json.loads(response.data) assert response.headers['Content-Type']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_predict(self):\n answer = []\n response = []\n\n for it_predictions in json.loads(request.data.decode('UTF-8')):\n prediction = it_predictions['score']\n for ite_clf in g_list_of_classifier:\n answer.append(ite_clf.predict(prediction))\n ...
[ "0.76061213", "0.74443936", "0.7346938", "0.72539616", "0.7151024", "0.70943403", "0.7005228", "0.7001114", "0.69478196", "0.6899592", "0.68731046", "0.68594086", "0.68349653", "0.67683935", "0.6751782", "0.6748465", "0.6708636", "0.66829735", "0.66460854", "0.6640956", "0.66...
0.7640239
0
Initializes ROSnode, instantiates the controller and initializes dynamic quantities (eta, ni, ...).
def __init__(self, name, rate): super(ControlNode, self).__init__(name, rate) self.mutex = RLock() self.controller = InverseDynamicController() self.ready = False # Physical quantities from sensors self.eta2 = np.zeros((3, 1)) self.ni = np.zeros((6, 1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_ros_node(self): #pylint: disable=no-self-use\n print(\"rospy init node\")\n rospy.init_node('ispy_ROS_receiver', anonymous = True)", "def __init__(self):\n rospy.init_node('TruckSimNode')\n\n self.steer_angle_topic = rospy.get_param('~steer_angle_topic', \"steer_angle\")\n ...
[ "0.6636221", "0.65183675", "0.6513829", "0.6351623", "0.63456255", "0.63114524", "0.62774974", "0.62013453", "0.6159472", "0.61007905", "0.60075647", "0.59990346", "0.5983112", "0.59483445", "0.5938138", "0.5929864", "0.5914592", "0.5877536", "0.5867562", "0.58567476", "0.584...
0.68503463
0
Subscribe node to topics.
def StartSubscriptions(self): rospy.Subscriber('/drivers/dvl', Dvl, self.dvl_callback) rospy.Subscriber('/drivers/imu', Imu, self.imu_callback) rospy.Subscriber('/reference/depth', Position, self.refDepth_callback) rospy.Subscriber('/reference/speed', Speed, self.refSpeed_callback) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def subscribe(self, topic: str, callback: aiowamp.SubscriptionHandler, *,\n match_policy: aiowamp.MatchPolicy = None,\n node_key: str = None,\n options: aiowamp.WAMPDict = None) -> int:\n ...", "def subscribe(self, topic):\n\t\tsel...
[ "0.74287224", "0.7375778", "0.7348242", "0.7206322", "0.70486134", "0.701521", "0.6995846", "0.6991145", "0.69009537", "0.6899129", "0.6774496", "0.6748149", "0.67456394", "0.6667064", "0.66310495", "0.6610548", "0.65937304", "0.6587241", "0.6570885", "0.6495778", "0.6490737"...
0.0
-1
Entering this callback means that a new mission has started. The PI need to be resetted. NewMissionReceived(msg)
def trackersControl_callback(self, msg): self.mutex.acquire() if ('rpy_tracker' in msg.trackers) and ('speed_tracker' in msg.trackers) and ('depth_tracker' in msg.trackers): self.controller.PI.reset() self.ready = False if ('rpy_tracker' in msg.trackers) and ('ll_tracker...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_msg(msg):\n if comm._msg_callback:\n comm._msg_callback(msg)", "def pose_cb(self, msg):\n rospy.loginfo(rospy.get_name() + ': pose received')\n self.current_pose = msg.pose", "def laser_cb(self, msg):\n #rospy.loginfo(\"Received new scan\")\n sel...
[ "0.6127478", "0.60987276", "0.6052381", "0.5896514", "0.5707285", "0.56814367", "0.5620228", "0.55741024", "0.5543224", "0.55415154", "0.5500179", "0.5499847", "0.54965955", "0.5492973", "0.5492973", "0.54139495", "0.53911155", "0.53909546", "0.5374573", "0.53664804", "0.5349...
0.0
-1
Callback function to extract values from topic '/drivers/imu'.
def imu_callback(self, msg): self.mutex.acquire() self.ni[3] = msg.angular_rate.x self.ni[4] = msg.angular_rate.y self.ni[5] = msg.angular_rate.z self.eta2[0] = msg.orientation.roll self.eta2[1] = msg.orientation.pitch self.eta2[2] = msg.orientation.yaw ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sensor_data(self):\n # Initialize ROS msgs\n imu_raw_msg = Imu()\n imu_msg = Imu()\n mag_msg = MagneticField()\n temp_msg = Temperature()\n\n # read from sensor\n buf = self.con.receive(registers.BNO055_ACCEL_DATA_X_LSB_ADDR, 45)\n # Publish raw data\...
[ "0.6155501", "0.5870027", "0.5677831", "0.5530361", "0.5407481", "0.5399191", "0.53831446", "0.5286985", "0.5270629", "0.5181471", "0.5162484", "0.51556665", "0.51381165", "0.50479764", "0.50355625", "0.5021234", "0.500381", "0.49855492", "0.49629354", "0.49543217", "0.492997...
0.6154561
1
Callback function to extract values from topic '/drivers/dvl'.
def dvl_callback(self, msg): self.mutex.acquire() self.ni[0] = msg.velocity_instrument.x self.ni[1] = msg.velocity_instrument.y self.ni[2] = msg.velocity_instrument.z self.mutex.release() rospy.loginfo("%s receive dvl", self.node_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull(self):\n \n data = self.s.recv(1024)\n if data:\n info = ET.fromstring(data)\n info = { info[0].tag : info[0].text, info[1].tag : info[1].text}\n #print(info)\n \n return info.get(\"topic\"), info.get(\"value\")\n pass", ...
[ "0.5263453", "0.5185213", "0.5034765", "0.5004337", "0.48835906", "0.48829684", "0.48176336", "0.4803725", "0.48003805", "0.4771483", "0.47152287", "0.47055992", "0.4702171", "0.46666574", "0.46612", "0.4641564", "0.46413577", "0.4634017", "0.46190333", "0.46136248", "0.46108...
0.5269785
0
Callback function to extract values from topic '/reference/depth'. This method compute derivative of eta1_ref in body_fixed frame.
def refDepth_callback(self, msg): self.mutex.acquire() depth_ref = np.array([0, 0, msg.depth]).reshape((3, 1)) if not (self.reference_flags['depth']): # first assignment self.eta1_ref_body.last_value = self.controller.vehicle.ned2body_linear(deepcopy(depth_ref), self.eta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delta_ad_ref(self, T: float):\n return self.kappa_ref * (np.exp(self.eps_ref / T) - 1.0)", "def extract_depth(obj, varname=None):\n if varname is not None:\n try:\n depth = obj[varname]\n except KeyError:\n raise LookupError\n if np.size(depth) > 1:\n ...
[ "0.52576995", "0.5111601", "0.5059385", "0.49424797", "0.48675165", "0.48636612", "0.48578805", "0.48349983", "0.4817226", "0.48155236", "0.47970894", "0.4778559", "0.47529778", "0.47526708", "0.47429052", "0.4730778", "0.47178364", "0.47172207", "0.46995127", "0.46942344", "...
0.7089794
0
Callback function to extract values from topic '/reference/speed'.
def refSpeed_callback(self, msg): self.mutex.acquire() self.speed_ref[0] = msg.vx self.speed_ref[1] = msg.vy self.speed_ref[2] = msg.vz self.mutex.release() rospy.loginfo("%s receive speed reference", self.node_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_scan_speed(self, mess):\n scan_speed = mess[self.scan_speed_idx]\n return scan_speed", "def get_speed(self):\n return self.get_par(\"slew_speed\")", "def get_of_features_speed(self):\n speed = self._get_v0x01_v0x04_speed()\n # Don't use switch.is_connected() because w...
[ "0.57048595", "0.5602207", "0.5388428", "0.53410476", "0.533619", "0.52595574", "0.5231034", "0.52257985", "0.5213829", "0.5150222", "0.51455814", "0.509102", "0.5084496", "0.5084496", "0.50796765", "0.5075798", "0.49859887", "0.4978502", "0.49759266", "0.49322572", "0.492607...
0.61902446
0
Callback function to extract values from topic '/reference/rpy'. This method compute derivative of eta2_ref.
def refRpy_callback(self, msg): self.mutex.acquire() rpy_ref = np.array([msg.roll, msg.pitch, msg.yaw]).reshape((3, 1)) if not (self.reference_flags['rpy']): # first assignment self.eta2_ref.last_value = deepcopy(rpy_ref) self.eta2_ref.last_sampling = rospy.T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refDepth_callback(self, msg):\n self.mutex.acquire()\n depth_ref = np.array([0, 0, msg.depth]).reshape((3, 1))\n\n if not (self.reference_flags['depth']):\n # first assignment\n self.eta1_ref_body.last_value = self.controller.vehicle.ned2body_linear(deepcopy(depth_ref...
[ "0.56509167", "0.53251004", "0.52550304", "0.525233", "0.51270187", "0.50797045", "0.50053024", "0.49920037", "0.49759054", "0.49710527", "0.49663278", "0.49258175", "0.49160272", "0.49135745", "0.490166", "0.48991102", "0.4883105", "0.4860947", "0.48555177", "0.48424578", "0...
0.66459703
0
Callback function to extract values from topic '/reference/ll'.
def refLL_callback(self, msg): self.mutex.acquire() ll_ref = np.array([msg.latitude, msg.longitude, 0]).reshape((3, 1)) self.reference_flags['ll'] = True self.mutex.release() rospy.loginfo("%s receive ll reference", self.node_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_topic(bot, trigger, from_topic, topic_reset):", "def ll_ext_values(tt):\n\n res = []\n for t in tt:\n xref = xref_fnc(t)\n nu = tv_feedback_gain.nu\n uuref = [refinput(t, i) for i in range(nu)]\n\n args = list(xref) + list(uuref)\n\n ll_num_ext = tv_feedback_gai...
[ "0.56976753", "0.5451466", "0.53502387", "0.52519614", "0.5142377", "0.5081978", "0.5074142", "0.49585354", "0.49151048", "0.48834464", "0.48804724", "0.47684902", "0.47528148", "0.47485197", "0.47457796", "0.4745345", "0.4723722", "0.4719889", "0.47153133", "0.47101045", "0....
0.64063287
0
Publish control law in '/control/tau' topic.
def publish(self, tau): # tau message sender = String('') tau1 = Forces(tau[0], tau[1], tau[2]) tau2 = Euler(tau[3], tau[4], tau[5]) tau = Tau(sender, tau1, tau2) self.pub_tau.publish(tau) rospy.loginfo(tau)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendControls(self):\n\n if self.controller.status:\n mode = '\"cool3\"'\n temp = self.controller.setpoint\n else:\n mode = '\"off\"'\n temp = self.controller.setpoint\n\n payload = '{\"mode\": ' + mode + ', \"temp\": ' + str(temp) + '}'\n ...
[ "0.5807704", "0.5758317", "0.55228525", "0.5270476", "0.52608407", "0.5252377", "0.5207384", "0.517864", "0.5148226", "0.5117156", "0.5114873", "0.5094817", "0.5083416", "0.5068257", "0.50589406", "0.49929762", "0.4973006", "0.4966835", "0.49520248", "0.49468485", "0.4941492"...
0.7162413
0
Define message for topic '/measurement'.
def tester(self, tau): # tau message sender = String('') tau1 = Forces(tau[0], tau[1], tau[2]) tau2 = Euler(tau[3], tau[4], tau[5]) tau = Tau(sender, tau1, tau2) # PQ message ni_ref = PQ(self.ni_ref.value[0], self.ni_ref.value[1], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_message(self, topic, message):\n if is_measurement_topic(topic):\n new_topic = \"measurement\".format(topic)\n self.produce(new_topic.encode(), message)", "def generate_message(self):\n meter = Meter.objects.get_or_create(name=\"4530303237303030303130313334353136\")[0]\...
[ "0.7480047", "0.62764657", "0.627231", "0.5986691", "0.59566027", "0.59308267", "0.58146507", "0.5769368", "0.5722564", "0.56864566", "0.5642508", "0.56298864", "0.5620943", "0.55951756", "0.5524752", "0.55228", "0.55036813", "0.5496203", "0.5494798", "0.5487093", "0.5483098"...
0.0
-1
Connects node to topics for publish tau and extract dynamic parameters.
def run(self): old_sampling = rospy.Time(0) while not rospy.is_shutdown(): self.mutex.acquire() reference_received = all(self.reference_flags.values()) if reference_received: if not self.ready: # first value of ni_ref ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish(self, node, topic, data={}, on_publish=None, on_response=None):\n pass", "def publish_and_wait(self, node, topic, data={}):\n pass", "def publish(self, node, topic, **kwargs):\n topic = self.generate_node_topic(node, topic)\n\n return self.publish_mqtt(topic, **kwargs)",...
[ "0.63137764", "0.6111883", "0.6041055", "0.6023848", "0.59356666", "0.5801089", "0.5713184", "0.56949735", "0.5686285", "0.5680989", "0.56607276", "0.5635899", "0.5633615", "0.561198", "0.560544", "0.55918163", "0.5556044", "0.5550037", "0.5547674", "0.5534404", "0.5524704", ...
0.0
-1
Read a graph from a file using given representation
def read_data(self, representation, filename) -> bool: self.adjacency_matrix = self.reader.read_data(representation, filename) if self.adjacency_matrix is None: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_graph(filename):\n with open(filename) as f:\n g = eval(f.read())\n return g", "def read_graph(filename):\n return nx.read_edgelist(filename, create_using=nx.DiGraph(), nodetype=str)", "def read_graph(filename, directed=True):\n if not directed:\n G = nx.Graph()\n else:\n ...
[ "0.780496", "0.7537537", "0.715704", "0.71570206", "0.7057402", "0.70331335", "0.6960638", "0.6960638", "0.6936821", "0.6931618", "0.69242877", "0.69237286", "0.6910258", "0.69042784", "0.6897083", "0.6885469", "0.68708676", "0.68661803", "0.6850584", "0.67781925", "0.676843"...
0.0
-1
Return a graph in the given output representation
def get_graph(self, output_representation) -> Union[np.ndarray, list, None]: return GraphConverter.convert_graph(self.adjacency_matrix, GraphRepresentation.ADJACENCY_MATRIX, output_representation)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_graph(self):", "def generate_graphml_output(self, path):\n self.restructure_edge_info()\n self.restructure_node_info()\n return nx.write_graphml(self.G, path)", "def as_graph(self, graph=None):\n # at this level it works but what if we have nested structures?\n # What...
[ "0.7232203", "0.68125737", "0.6613876", "0.6530046", "0.6505417", "0.64882594", "0.6466644", "0.641801", "0.64134705", "0.63770616", "0.63673943", "0.6350465", "0.6323403", "0.63040066", "0.628878", "0.6235419", "0.6233481", "0.62234056", "0.62120163", "0.62118566", "0.621159...
0.68026316
2
Save a graph with given representation to the file with given name
def save_to_file(self, representation, filename) -> bool: filename = "data/" + filename output_matrix = self.get_graph(representation) if isinstance(output_matrix, list): with open(filename, "w+") as f: for row in output_matrix: f.write(" ".join(st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_graph(g, filename):\n with open(filename, 'w') as f:\n f.write(repr(g))", "def saveGraph(self, filename):\n nx.write_yaml(self.G,filename)", "def save_graph(self, filename, fileType):\n if fileType == \"GML Format\":\n nx.write_gml(self.graph, filename+\".gml\")\n ...
[ "0.7857519", "0.78358036", "0.7785526", "0.7606082", "0.75994337", "0.7500862", "0.7485712", "0.736877", "0.7234757", "0.7164441", "0.71276635", "0.70757556", "0.7071019", "0.69945675", "0.69060326", "0.68731517", "0.686162", "0.68552595", "0.68462294", "0.678659", "0.6783398...
0.6799672
19
Visualize graph on a circle. Return visualization or save to file.
def visualise_graph_on_circle(self, save_to_file, file_name) -> None: nodes_number = len(self.adjacency_matrix) phi = 2 * math.pi / nodes_number # estimate graph radius graph_radius = nodes_number * 1.5 nodes = [] for node in range(nodes_number): nodes.inser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_graph(self, filename='', save=False):\n nx.draw_circular(self.graph, node_color='pink', node_size=1000, with_labels=True)\n if save:\n plt.savefig(filename)\n print(f'Saved graph as {filename!r}')\n else:\n plt.show()", "def show(self, circular=Fals...
[ "0.6911878", "0.67860097", "0.6635305", "0.643991", "0.6420579", "0.6402754", "0.63290936", "0.6279044", "0.6165545", "0.61419237", "0.61375046", "0.606099", "0.60442394", "0.6030049", "0.59707093", "0.59639984", "0.5942462", "0.59208083", "0.59208083", "0.59208083", "0.59185...
0.7294445
0
Sets the adjacency matrix
def set_graph(self, data) -> None: graph, representation = data self.adjacency_matrix = GraphConverter.convert_graph(graph, representation, GraphRepresentation.ADJACENCY_MATRIX)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formAdjacencyMatrix(self):\n self.adjacencyMatrix = dict()\n for i in self.node:\n self.adjacencyMatrix[i] = dict()\n for j in self.node:\n self.adjacencyMatrix[i][j] = 0\n \n for ij in self.link:\n self.adjacencyMatrix[self.link[ij].tail][self.link[ij]...
[ "0.771893", "0.7141307", "0.69702315", "0.67333454", "0.66985816", "0.65901214", "0.6559249", "0.655024", "0.6443236", "0.6431789", "0.64166796", "0.6354043", "0.63439506", "0.6334796", "0.63185364", "0.62884116", "0.6276677", "0.6259613", "0.62275964", "0.6205296", "0.619810...
0.67588174
3
Returns the adjacency matrix
def __str__(self) -> str: return '\n'.join([' '.join([str(u) for u in row]) for row in self.adjacency_matrix])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_adjacency_matrix(self):\n m = zeros(self.size)\n perm = self.array_form\n for i in xrange(self.size - 1):\n m[perm[i], perm[i + 1]] = 1\n return m", "def adj_matrix(self):\n return nx.adj_matrix(self.network)", "def adjacency_matrix(g):\n nodes = sorted(...
[ "0.8292026", "0.8141487", "0.8095393", "0.8068744", "0.79990095", "0.7977734", "0.7914583", "0.7772028", "0.76660657", "0.7634396", "0.75280213", "0.75195515", "0.7518438", "0.7472344", "0.7465537", "0.7455788", "0.7455788", "0.7418913", "0.7416407", "0.7398081", "0.73773223"...
0.0
-1
Main function entrypoint for lambda
def lambda_handler(event, context): if autoscaling_schedule == 'true': autoscaling_handler(schedule_action, tag_key, tag_value) if ec2_schedule == 'true': ec2_handler(schedule_action, tag_key, tag_value) if rds_schedule == 'true': rds_handler(schedule_action, tag_key, tag_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lambda_handler(event, context):\n return", "def lambda_handler(event, context):\n return", "def testGetLambda(self):\n self.ports.get_lambda(file_name = 'get_lambda.xml', port_ids = portsDict['port_ids'], lambdas = portsDict['lambda'])", "def cli_entry():\n\n parser = argparse.ArgumentPar...
[ "0.66229665", "0.66229665", "0.65373605", "0.64536905", "0.6283732", "0.6283197", "0.6283197", "0.6283197", "0.6283197", "0.6246419", "0.62320256", "0.6180176", "0.616309", "0.6133377", "0.6010098", "0.6010098", "0.6010098", "0.5995422", "0.598368", "0.5969271", "0.59525037",...
0.0
-1
a simple error checking routine
def _CHK(self,_err): if _err < 0: buf_size = 100 buf = ctypes.create_string_buffer('\000' * buf_size) nidaq.DAQmxGetErrorString(_err,ctypes.byref(buf),buf_size) raise RuntimeError("nidaq call failed with error %d: %s"%(_err,repr(buf.value))) if _err > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_errors(self) -> None:", "def error_check(command):\r\n\r\n # TODO\r", "def check_errors():\n\n for error in errors:\n ERROR('%s' % str(error))\n\n if len(errors) != 0:\n sys.exit(1)", "def check():", "def _check(error: int) -> None:\n if error < 0:\n raise Runtime...
[ "0.80194867", "0.73047864", "0.70998687", "0.703224", "0.70014125", "0.69030416", "0.68796855", "0.6875768", "0.6788306", "0.6754821", "0.673501", "0.6713116", "0.6688653", "0.66741985", "0.6635941", "0.6629495", "0.65767413", "0.6530645", "0.6521978", "0.6518656", "0.6509858...
0.6331047
33
configure an analog input channel to measure voltage
def Config_Finite_Voltage_Measurement(self,device,AIchan,min_volts,max_volts,sample_rate,num_samples): self.min_volts = min_volts self.max_volts = max_volts self.sample_rate = sample_rate self.num_samples = num_samples self.channel = device + "/" + AIchan self._CHK(nidaq....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Add_Analog_Voltage_Channel(self,channel,min=-10.0,max=10.0):\n self.num_channels += 1\n self.channel = self.device + \"/\" + channel\n self._CHK(nidaq.DAQmxCreateAIVoltageChan(self.task_handle,self.channel,\"\",\n DAQmx_Val_NRSE,\n ...
[ "0.69626075", "0.66515446", "0.6598998", "0.65891325", "0.65135473", "0.6456312", "0.6431402", "0.64178854", "0.6392787", "0.63915384", "0.6377078", "0.63437396", "0.63163424", "0.63067985", "0.62622344", "0.62316406", "0.62316406", "0.62115556", "0.6201199", "0.6197366", "0....
0.63863814
10
take a voltage measurement from a defined voltage channel
def Take_Voltage_Measurement(self,timeout=10.0): self.timeout = timeout self._CHK(nidaq.DAQmxStartTask(self.task_handle)) samples_read = int32() data = numpy.zeros((self.num_samples,),dtype=numpy.float64) self._CHK(nidaq.DAQmxReadAnalogF64(self.task_handle,uInt32(self.num_samples...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_voltage(self, channel):\n self.check_validity()\n\n channel = int(channel)\n\n return self.ipcon.send_request(self, BrickletIndustrialDualAnalogInV2.FUNCTION_GET_VOLTAGE, (channel,), 'B', 12, 'i')", "def hp34401a_read_voltage(hp_meter):\n hp_meter.write(\"MEAS:VOLT:DC? DEF,DEF\")\...
[ "0.77019006", "0.73781055", "0.7371819", "0.71958065", "0.71943635", "0.71666414", "0.71666414", "0.7125515", "0.70797503", "0.70667315", "0.70028174", "0.6991565", "0.69510007", "0.69423896", "0.6921404", "0.6892145", "0.6867775", "0.6852998", "0.6835893", "0.68157196", "0.6...
0.6841951
18
configure an analog input channel to measure voltage
def Config_Finite_Voltage_Measurement(self,AIchans,min_volts,max_volts,sample_rate,num_samples): self.num_channels = len(AIchans.split(',')) self.num_samples = num_samples self._CHK(nidaq.DAQmxCreateAIVoltageChan(self.task_handle,AIchans,"", DAQmx_Val_N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Add_Analog_Voltage_Channel(self,channel,min=-10.0,max=10.0):\n self.num_channels += 1\n self.channel = self.device + \"/\" + channel\n self._CHK(nidaq.DAQmxCreateAIVoltageChan(self.task_handle,self.channel,\"\",\n DAQmx_Val_NRSE,\n ...
[ "0.6961794", "0.66521806", "0.659945", "0.65892506", "0.6513956", "0.6456523", "0.64306885", "0.64173836", "0.6393412", "0.6390889", "0.6385708", "0.6385708", "0.6376611", "0.6343636", "0.6316515", "0.6306265", "0.62618184", "0.62311405", "0.62311405", "0.62115693", "0.620154...
0.61350906
25
take a voltage measurement from a defined voltage channel
def Take_Voltage_Measurement(self,timeout=10.0): self.timeout = timeout self._CHK(nidaq.DAQmxStartTask(self.task_handle)) samples_per_chan_read = int32() data = numpy.zeros((self.num_samples*self.num_channels),dtype=numpy.float64) self._CHK(nidaq.DAQmxReadAnalogF64(self.task_han...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_voltage(self, channel):\n self.check_validity()\n\n channel = int(channel)\n\n return self.ipcon.send_request(self, BrickletIndustrialDualAnalogInV2.FUNCTION_GET_VOLTAGE, (channel,), 'B', 12, 'i')", "def hp34401a_read_voltage(hp_meter):\n hp_meter.write(\"MEAS:VOLT:DC? DEF,DEF\")\...
[ "0.7702024", "0.73788154", "0.73701376", "0.71966827", "0.71935546", "0.7168216", "0.7168216", "0.7124691", "0.7078227", "0.7067103", "0.70016664", "0.699197", "0.6951471", "0.6940939", "0.6918662", "0.689085", "0.6869372", "0.6852331", "0.68430954", "0.68351525", "0.6814393"...
0.67070264
26
configure an analog input channel to measure voltage
def Add_Channels(self,AIchans,min_volts=-10.0,max_volts=10.0): self.num_channels += len(AIchans.split(',')) self._CHK(nidaq.DAQmxCreateAIVoltageChan(self.task_handle,AIchans,"", DAQmx_Val_NRSE, float64(min_volts),float...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Add_Analog_Voltage_Channel(self,channel,min=-10.0,max=10.0):\n self.num_channels += 1\n self.channel = self.device + \"/\" + channel\n self._CHK(nidaq.DAQmxCreateAIVoltageChan(self.task_handle,self.channel,\"\",\n DAQmx_Val_NRSE,\n ...
[ "0.69626075", "0.66515446", "0.6598998", "0.65891325", "0.65135473", "0.6456312", "0.6431402", "0.64178854", "0.6392787", "0.63915384", "0.63863814", "0.63863814", "0.6377078", "0.63437396", "0.63163424", "0.63067985", "0.62622344", "0.62316406", "0.62316406", "0.62115556", "...
0.0
-1
configure the DAQ card sample clock
def Config_Sample_Clock(self,samples_per_sec=1000.0,num_samps_per_ch=1000): self.samples_per_sec = samples_per_sec self.num_samples_per_ch = num_samps_per_ch
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_clock_config(self, *args, **kwargs):\n return _uhd_swig.usrp_sink_sptr_set_clock_config(self, *args, **kwargs)", "def set_clock_config(self, *args, **kwargs):\n return _uhd_swig.usrp_source_sptr_set_clock_config(self, *args, **kwargs)", "def set_clock_config(self, *args, **kwargs):\n ...
[ "0.6446509", "0.64428025", "0.6261773", "0.62558603", "0.6078298", "0.60676754", "0.6008888", "0.5913299", "0.5799603", "0.57889813", "0.57223356", "0.5658652", "0.5648047", "0.56223387", "0.56196237", "0.561595", "0.56083894", "0.56038594", "0.5572591", "0.5551271", "0.55359...
0.69151354
0
take a voltage measurement from a defined voltage channel
def Take_Voltage_Measurement(self,timeout=10.0): self.timeout = timeout self._CHK(nidaq.DAQmxCfgSampClkTiming(self.task_handle,Internal_Clock,float64(self.samples_per_sec), DAQmx_Val_Rising,DAQmx_Val_FiniteSamps, uInt64(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_voltage(self, channel):\n self.check_validity()\n\n channel = int(channel)\n\n return self.ipcon.send_request(self, BrickletIndustrialDualAnalogInV2.FUNCTION_GET_VOLTAGE, (channel,), 'B', 12, 'i')", "def hp34401a_read_voltage(hp_meter):\n hp_meter.write(\"MEAS:VOLT:DC? DEF,DEF\")\...
[ "0.77011776", "0.7378799", "0.7369953", "0.7195673", "0.7193201", "0.7166391", "0.7166391", "0.712433", "0.7078901", "0.7065857", "0.7001311", "0.6992086", "0.69505054", "0.694105", "0.69195026", "0.689066", "0.6851241", "0.68417925", "0.6834151", "0.68135357", "0.6801148", ...
0.68682396
16
this function will start the voltage measurement and, when completed put the result onto a result queue for retrieval by the calling function
def run(self): result = self.Take_Voltage_Measurement() self.result_queue.put(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Take_Voltage_Measurement(self):\n self._CHK(nidaq.DAQmxStartTask(self.task_handle))\n samples_read = int32()\n data = numpy.zeros((self.num_samples,),dtype=numpy.float64)\n self._CHK(nidaq.DAQmxReadAnalogF64(self.task_handle,uInt32(self.num_samples),float64(self.timeout),\n ...
[ "0.69389534", "0.69389534", "0.6495457", "0.6467312", "0.6262244", "0.6239943", "0.6169618", "0.6110444", "0.6105568", "0.6086529", "0.6075996", "0.6055169", "0.6050425", "0.60212076", "0.5989642", "0.59422153", "0.5929142", "0.5898589", "0.58818233", "0.58625567", "0.5854719...
0.85619634
0
configure an analog input channel to measure voltage
def Config_Finite_Voltage_Measurement(self,device,AIchan,min_volts,max_volts,sample_rate,num_samples): self.min_volts = min_volts self.max_volts = max_volts self.sample_rate = sample_rate self.num_samples = num_samples self.channel = device + "/" + AIchan self._CHK(nidaq....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Add_Analog_Voltage_Channel(self,channel,min=-10.0,max=10.0):\n self.num_channels += 1\n self.channel = self.device + \"/\" + channel\n self._CHK(nidaq.DAQmxCreateAIVoltageChan(self.task_handle,self.channel,\"\",\n DAQmx_Val_NRSE,\n ...
[ "0.69626075", "0.66515446", "0.6598998", "0.65891325", "0.65135473", "0.6456312", "0.6431402", "0.64178854", "0.6392787", "0.63915384", "0.6377078", "0.63437396", "0.63163424", "0.63067985", "0.62622344", "0.62316406", "0.62316406", "0.62115556", "0.6201199", "0.6197366", "0....
0.63863814
11
take a voltage measurement from a defined voltage channel
def Take_Voltage_Measurement(self): self._CHK(nidaq.DAQmxStartTask(self.task_handle)) samples_read = int32() data = numpy.zeros((self.num_samples,),dtype=numpy.float64) self._CHK(nidaq.DAQmxReadAnalogF64(self.task_handle,uInt32(self.num_samples),float64(self.timeout), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_voltage(self, channel):\n self.check_validity()\n\n channel = int(channel)\n\n return self.ipcon.send_request(self, BrickletIndustrialDualAnalogInV2.FUNCTION_GET_VOLTAGE, (channel,), 'B', 12, 'i')", "def hp34401a_read_voltage(hp_meter):\n hp_meter.write(\"MEAS:VOLT:DC? DEF,DEF\")\...
[ "0.77019006", "0.73781055", "0.7371819", "0.71958065", "0.71943635", "0.7125515", "0.70797503", "0.70667315", "0.70028174", "0.6991565", "0.69510007", "0.69423896", "0.6921404", "0.6892145", "0.6867775", "0.6852998", "0.6841951", "0.6835893", "0.68157196", "0.6800731", "0.676...
0.71666414
5
configure analog input channel and add to the task
def Add_Analog_Voltage_Channel(self,channel,min=-10.0,max=10.0): self.num_channels += 1 self.channel = self.device + "/" + channel self._CHK(nidaq.DAQmxCreateAIVoltageChan(self.task_handle,self.channel,"", DAQmx_Val_NRSE, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setInput(self):\n gpio.setup(self.bcm_id, gpio.IN, pull_up_down=self.pull)\n self.mode = gpio.IN", "def __init__(\n self,\n analog_input_mode: int = 0x00,\n send_on_sensor_alarm: bool = False,\n send_on_input_port_change: bool = False,\n enable_1_wire_port: bo...
[ "0.6519989", "0.64124924", "0.63445646", "0.6212342", "0.60651934", "0.60190463", "0.59216535", "0.58013326", "0.5796897", "0.5777286", "0.575863", "0.57367545", "0.5722561", "0.5688327", "0.5686097", "0.5633454", "0.5587305", "0.5573289", "0.55676293", "0.5566016", "0.553944...
0.52522516
62
take the list of samples (gathered by scan) and put into numpy arrays to place on the queue for return. If there was only one channel measured put the numpy array on the queue If there were more than one channel measured put a list of the numpy arrays on the queue
def _group_samples_by_channel(self): samples_acquired_per_channel = len(self.all_samples_list) / self.num_channels #make a list with each element being a numpy array for the results from each channel channel_data = [] for i in range(self.num_channels): channel_data.append(nu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_buffer(self):\n num_of_smp = 0\n while num_of_smp < self.buf_size:\n c, t = self.inlet.pull_chunk(timeout=0.0)\n new_c = []\n new_t = []\n while c:\n new_c += c\n new_t += t\n c, t = self.inlet.pull_chun...
[ "0.5985075", "0.5966764", "0.58003885", "0.5708871", "0.5656563", "0.5628519", "0.56126255", "0.55900705", "0.5584042", "0.5574181", "0.5572602", "0.55428034", "0.5534926", "0.5500349", "0.5494749", "0.5487945", "0.548696", "0.5468989", "0.5410651", "0.5404914", "0.53854257",...
0.72428924
0
this function will start the voltage measurement and, when completed put the result onto a result queue for retrieval by the calling function
def run(self): result = self.Take_Voltage_Measurement() self.result_queue.put(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Take_Voltage_Measurement(self):\n self._CHK(nidaq.DAQmxStartTask(self.task_handle))\n samples_read = int32()\n data = numpy.zeros((self.num_samples,),dtype=numpy.float64)\n self._CHK(nidaq.DAQmxReadAnalogF64(self.task_handle,uInt32(self.num_samples),float64(self.timeout),\n ...
[ "0.69374573", "0.69374573", "0.6493556", "0.6465622", "0.62603533", "0.6238026", "0.6168592", "0.61111826", "0.6104776", "0.6087953", "0.60747576", "0.60541385", "0.6051305", "0.6022862", "0.5989234", "0.59406954", "0.59291", "0.58989024", "0.5880741", "0.5860903", "0.5854285...
0.8560719
1
configure an analog input channel to measure voltage
def Config_Finite_Voltage_Measurement(self,device,AIchan,min_volts,max_volts,sample_rate,num_samples): self._CHK(nidaq.DAQmxCreateAIVoltageChan(self.task_handle,self.device_and_channel,"", DAQmx_Val_NRSE, float64(self.min_volt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Add_Analog_Voltage_Channel(self,channel,min=-10.0,max=10.0):\n self.num_channels += 1\n self.channel = self.device + \"/\" + channel\n self._CHK(nidaq.DAQmxCreateAIVoltageChan(self.task_handle,self.channel,\"\",\n DAQmx_Val_NRSE,\n ...
[ "0.69626075", "0.66515446", "0.6598998", "0.65891325", "0.65135473", "0.6456312", "0.6431402", "0.64178854", "0.6392787", "0.63915384", "0.63863814", "0.63863814", "0.6377078", "0.63437396", "0.63163424", "0.63067985", "0.62622344", "0.62316406", "0.62316406", "0.62115556", "...
0.5908061
49
take a voltage measurement from a defined voltage channel
def Take_Voltage_Measurement(self): self._CHK(nidaq.DAQmxStartTask(self.task_handle)) samples_read = int32() data = numpy.zeros((self.num_samples,),dtype=numpy.float64) self._CHK(nidaq.DAQmxReadAnalogF64(self.task_handle,uInt32(self.num_samples),float64(self.timeout), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_voltage(self, channel):\n self.check_validity()\n\n channel = int(channel)\n\n return self.ipcon.send_request(self, BrickletIndustrialDualAnalogInV2.FUNCTION_GET_VOLTAGE, (channel,), 'B', 12, 'i')", "def hp34401a_read_voltage(hp_meter):\n hp_meter.write(\"MEAS:VOLT:DC? DEF,DEF\")\...
[ "0.77011776", "0.7378799", "0.7369953", "0.7195673", "0.7193201", "0.712433", "0.7078901", "0.7065857", "0.7001311", "0.6992086", "0.69505054", "0.694105", "0.69195026", "0.689066", "0.68682396", "0.6851241", "0.68417925", "0.6834151", "0.68135357", "0.6801148", "0.6765973", ...
0.7166391
6
this function will start the pulse width measurement thread and, when completed put the result onto a result queue for retrieval by the calling function
def run(self): result = self.measure_pulse_width() self.result_queue.put(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n result = self.Take_Voltage_Measurement()\n self.result_queue.put(result)", "def run(self):\n result = self.Take_Voltage_Measurement()\n self.result_queue.put(result)", "async def run(self):\n\n\t\tawait asyncio.sleep(self.delay)\n\t\tR_load = self.lock.mag/(self.sen...
[ "0.590271", "0.590271", "0.585027", "0.5721861", "0.5684144", "0.5626837", "0.5606898", "0.5588782", "0.5566415", "0.55425", "0.55309975", "0.5524727", "0.5490144", "0.54408985", "0.5437546", "0.54260224", "0.5421195", "0.5393401", "0.53891146", "0.5383975", "0.536363", "0....
0.84387416
0
Affiche la table de multiplication de `nombre` >>> affiche_table(3) 3x1=3 3x2=6 3x3=9 3x4=12 3x5=15 3x6=18 3x7=21 3x8=24 3x9=27
def affiche_table(nombre: int) -> None: for k in range(1, 10): ## Version classique #print(nombre, "x", k, "=", k * nombre, sep="") ## Version f-string ; recommandée print(f"{nombre}x{k}={k * nombre}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obtenerTabla(numero, limite):\n\tcontador = 1\n\tcadena = \"\"\n\t# tambien se puede utilizar un for \n\twhile contador <= limite:\n\t\tmultiplicacion = numero + contador\n\t\tcadena = \"%s%d * %d = %d\\n\" % (cadena, numero, contador, multiplicacion) \n\t\tcontador = contador + 1 \n\t\t\n\treturn cadena", "...
[ "0.6910347", "0.6519845", "0.62801874", "0.6244707", "0.61948454", "0.6127561", "0.60558057", "0.58783156", "0.58383137", "0.54473317", "0.5439304", "0.5434162", "0.5394117", "0.5381114", "0.5374683", "0.5309784", "0.52044314", "0.5187076", "0.5173614", "0.5159223", "0.510004...
0.7620428
0
returns n lowercase letters
def dealHand(): import random import string vowels = 'aeiou' constant = 'bcdfghjklmnpqrstvwxyz' maxint = max(list(map(len, wordlist))) n = random.randint(5, maxint) # 1/3 vowls n_vowl = n // 3 n_constant = n - n//3 get_vowl = random.choices(vowels, k = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _nth_letter(n):\r\n\treturn string.ascii_lowercase[n % len(string.ascii_lowercase)]", "def lowercase_count(n):\n saveText = _get_clipboard_text()\n cutText = _select_and_cut_text(n)\n if cutText:\n newText = cutText.lower()\n newText = newText.replace(\"%\", \"%%\") # Escape any forma...
[ "0.7834847", "0.7215836", "0.70852304", "0.7074009", "0.6902572", "0.68129355", "0.6608036", "0.6522187", "0.6514753", "0.6507044", "0.65062153", "0.64718586", "0.64408904", "0.6429268", "0.6425639", "0.6415927", "0.63723403", "0.63558346", "0.63484573", "0.62804955", "0.6197...
0.0
-1
Returns the shape of the tensor but sets middle dims to None.
def _get_shape_invariants(tensor): if isinstance(tensor, tf.TensorArray): shape = None else: shape = tensor.shape.as_list() for i in range(1, len(shape) - 1): shape[i] = None return tf.TensorShape(shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape(tensor):\n raise NotImplementedError", "def _tensor_shape(self):\n return 2 * tuple(reversed(self._op_shape.dims_l())) + 2 * tuple(\n reversed(self._op_shape.dims_r())\n )", "def get_shape(tensor):\n return tensor.get_shape().as_list()", "def get_shape(tensor):\n\...
[ "0.7017186", "0.67802906", "0.67323947", "0.6707228", "0.6629448", "0.65736884", "0.6543091", "0.6511464", "0.64290965", "0.6416101", "0.6324683", "0.6318147", "0.6288006", "0.62567383", "0.6235461", "0.6234109", "0.62268716", "0.6199721", "0.61811334", "0.6173611", "0.613119...
0.67619145
2
Only values for the input action will be nonzero
def getStateActionFeatures(self,state,action): return [state, self.actions[action]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_action(self):\n self.action = self.automata > self.states\n self.inv_action = self.inv_automata > self.states", "def getqvalue(self, state, action):\n \"*** YOUR CODE HERE ***\"\n if (state, action) not in self.qvals:\n self.qvals[(state, action)] = 0.0\n ...
[ "0.6301348", "0.6251442", "0.6209533", "0.62008107", "0.6181537", "0.6164043", "0.61488837", "0.613366", "0.6113596", "0.6077933", "0.6075833", "0.6075833", "0.6075833", "0.6075833", "0.6061919", "0.6045429", "0.60364676", "0.6023061", "0.6008689", "0.5970762", "0.5944791", ...
0.0
-1
Contains commands to register/deregister channels as specialized
async def managechannels(self, ctx:commands.Context):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_switch_channels(self):\n\t\t# not available yet, experimental\n\t\tpass", "async def deregister(self, ctx:commands.Context):\r\n\r\n if await self.IsSpecialized(ctx.guild, ctx.channel.id):\r\n channels = await self.config.guild(ctx.guild).channels()\r\n t = channels.pop(str(...
[ "0.61868197", "0.59882474", "0.59592223", "0.57463384", "0.56101733", "0.5564106", "0.5533975", "0.5527059", "0.5507555", "0.5495455", "0.5495455", "0.5489563", "0.5468004", "0.53812283", "0.537934", "0.5369928", "0.5332631", "0.5319344", "0.53091747", "0.52858245", "0.526146...
0.62506276
0
Designates a channel to be either a pool or a shop, and allow users to fish or sell within them
async def register(self, ctx:commands.Context, channel_type): if not channel_type in [POOL_CHANNEL, SHOP_CHANNEL]: await ctx.send(f'{channel_type} is not a valid channel type\n_Channel types:_\npool\nshop') channel_type = await self.GetChannelType(ctx.guild, ctx.channel.id) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def buybait(self, ctx:commands.Context, quantity:int, *bait_type:str):\r\n\r\n if not await self.IsSpecialized(ctx.guild, ctx.channel.id, SHOP_CHANNEL):\r\n await ctx.send('Cannot buy bait here\\nUse `add shop` to turn this channel into a shop')\r\n return\r\n\r\n bait_typ...
[ "0.5647163", "0.5521696", "0.55059946", "0.5493717", "0.5469494", "0.54440546", "0.54370826", "0.53783447", "0.5305762", "0.5266002", "0.52345294", "0.5204717", "0.51995337", "0.51888597", "0.5185262", "0.51404196", "0.5135386", "0.50460726", "0.5040098", "0.5039286", "0.5029...
0.57456744
0
Removes a specialization from a channel
async def deregister(self, ctx:commands.Context): if await self.IsSpecialized(ctx.guild, ctx.channel.id): channels = await self.config.guild(ctx.guild).channels() t = channels.pop(str(ctx.channel.id)) await self.config.guild(ctx.guild).channels.set(channels) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_channel(self, channel):\n self._channels.pop(channel.fileno, None)\n\n try:\n self._poller.remove(channel.fileno, channel._events)\n except (IOError, OSError):\n log.exception(\"Error while removing %r.\" % channel)", "async def remove(self, ctx, channel: dis...
[ "0.6403853", "0.6333425", "0.62266964", "0.61756617", "0.6173588", "0.6055281", "0.6000497", "0.5994604", "0.5960761", "0.5886335", "0.5879209", "0.5879169", "0.58512884", "0.5774928", "0.57064", "0.5690842", "0.5644079", "0.5636995", "0.5624369", "0.5623662", "0.5566769", ...
0.66375667
0
Displays if a channel has been registered as a type or is a normal channel
async def checktype(self, ctx:commands.Context): t = await self.GetChannelType(ctx.guild, ctx.channel.id) if t == 'none': await ctx.send( f'<#{ctx.channel.id}> is a normal channel (use `register <channel type>` to make this a specialized channel)') else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_channel(self):\n return True", "def single_channel():\n return True", "async def register(self, ctx:commands.Context, channel_type):\r\n\r\n if not channel_type in [POOL_CHANNEL, SHOP_CHANNEL]:\r\n await ctx.send(f'{channel_type} is not a valid channel type\\n_Channel typ...
[ "0.7110801", "0.6721393", "0.65132374", "0.62517273", "0.59904927", "0.59034956", "0.5791688", "0.5790419", "0.5699715", "0.5697061", "0.56941587", "0.56895554", "0.5688134", "0.56565374", "0.56562656", "0.5655637", "0.5649726", "0.5635336", "0.56016374", "0.55869657", "0.557...
0.779624
0
Show the fish a specific member has caught
async def bucket(self, ctx:commands.Context, member: Member = None): await self.bucketsort(ctx, '', '', member)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def eat(self, ctx, *, member : str = None):\r\n\r\n authorName = DisplayName.name(ctx.message.author)\r\n\r\n # Check if we're eating nothing\r\n if member == None:\r\n nothingList = [ 'you sit quietly and eat *nothing*...',\r\n 'you\\'re *sure* ther...
[ "0.6035695", "0.5935951", "0.58403945", "0.5830821", "0.5782943", "0.5750741", "0.57168055", "0.5704903", "0.5644047", "0.5548363", "0.5535331", "0.5534272", "0.55260277", "0.55110335", "0.55109197", "0.5477275", "0.54511285", "0.54159284", "0.53990173", "0.5398927", "0.53958...
0.0
-1
Shows the fish of a specific category (name, school, or rarity) a specific member has caught
async def bucketsort(self, ctx:commands.Context, sort_type:str, sort_parameter:str, member:Member = None): if not sort_type in ['name', 'school', 'rarity', '']: await ctx.send(f'{sort_type} must be one of the following:\n```name\nschool\nrarity```') return if member is No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def bestiary(self, ctx: commands.Context, *, fish_name: str = None):\r\n\r\n # See if we want to list all of the fish\r\n if not fish_name:\r\n fields = []\r\n embed = discord.Embed(title=\"All Fish\")\r\n for rarity, fish_types in self.bot.fish.items():\r\n ...
[ "0.6081178", "0.59799826", "0.58170044", "0.56611615", "0.5600877", "0.55930954", "0.5547083", "0.5521694", "0.546011", "0.54144067", "0.5367911", "0.53148675", "0.5300393", "0.5294331", "0.52884895", "0.52493984", "0.52470785", "0.51839775", "0.51824075", "0.51792943", "0.51...
0.0
-1
Rolls for a fish similar to cast, but you do not get to choose the fish to reel in, instead instantly rolling and choosing to keep/release a fish Must be used in a channel registered as a pool
async def quickcast(self, ctx:commands.Context, bait_type:str): if not await self.IsSpecialized(ctx.guild, ctx.channel.id, POOL_CHANNEL): return profile = self.config.member(ctx.message.author) await profile.currently_fishing.set(True) modified_fish_weights = await s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll():\n pass", "def roll(self):\n rate = rospy.Rate(50)\n while not rospy.is_shutdown():\n self.rc_lock.acquire()\n rc = self.rc_message\n self.rc_lock.release()\n\n px2_message = PX2()\n px2_message.Mode = 2\n px2_message.h...
[ "0.5607962", "0.5357949", "0.5239348", "0.51591283", "0.5052591", "0.50420976", "0.5020488", "0.49975258", "0.49867794", "0.49359548", "0.49291566", "0.49198553", "0.49083692", "0.48966914", "0.4865098", "0.4862936", "0.48629323", "0.48022562", "0.47644353", "0.47530198", "0....
0.4838621
17
Rolls for a fish Fish will periodically bite the pole, at which point the message can be reacted to to catch the fish After reeling in the rod, you will have the option to keep or release the fish Must be used in a channel registered as a pool
async def cast(self, ctx:commands.Context, bait_type:str): if not await self.IsSpecialized(ctx.guild, ctx.channel.id, POOL_CHANNEL): return profile = self.config.member(ctx.message.author) await profile.currently_fishing.set(True) modified_fish_weights = await self.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def fish(ctx):\n global fish_now\n r = random.random()\n if len(str(fish_now)) > 1500:\n fish_now = round(pow(fish_now, 0.5))\n if fish_now == 69: fish_now = 70\n return await ctx.send(\"Woah! Bear's fish is a little too high, so it unfortunately has to be square rooted.\")\n ...
[ "0.6017885", "0.54692054", "0.54487175", "0.5428656", "0.539477", "0.5375985", "0.5372756", "0.53601915", "0.5356429", "0.5304964", "0.52907836", "0.51619464", "0.5157794", "0.5147157", "0.5146077", "0.5073609", "0.5048156", "0.50397307", "0.50372", "0.50343823", "0.5020478",...
0.5366422
7
Displays all of the bait in your inventory
async def bait(self, ctx:commands.Context): bait = '' member_bait = await self.config.member(ctx.message.author).bait() for i in member_bait.keys(): if not member_bait[i] == 0: bait += f'{i}{" " * (25 - len(i))}{member_bait[i]}\n' await ctx.send(f'You ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_inventory(table):\r\n print('======= The Current Inventory: =======')\r\n print('ID\\tCD Title by: Artist\\n')\r\n for cd in table:\r\n print(cd)\r\n\r\n print('======================================')", "def print_inventory(self):\n print(\"Backpack:\")\n ...
[ "0.73381823", "0.73256356", "0.72955793", "0.7257294", "0.71874076", "0.7127229", "0.70661706", "0.70646745", "0.70477", "0.6995277", "0.68549484", "0.67404497", "0.6642026", "0.66281885", "0.6509801", "0.65021634", "0.6250519", "0.62437147", "0.61546624", "0.6120125", "0.610...
0.0
-1
Allows an admin to skip the merchant cooldown and refresh the current merchants Must be used in a channel registered as a shop
async def forceshopreset(self, ctx:commands.Context): if not await self.IsSpecialized(ctx.guild, ctx.channel.id, SHOP_CHANNEL): await ctx.send('Cannot refresh the shops here\nUse `add shop` to turn this channel into a shop') return await self.RefreshMerchants(ctx.guild, c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_fedcm_cooldown(self):\n pass", "def somenonturbotadmin():\n cond = lambda member: member != ADMIN and ADMIN_ROLE not in member.roles\n return random.choice(list(filter(cond, CHANNEL_MEMBERS)))", "async def plaguebearer(self, ctx):\n currency = await bank.get_currency_name(ctx.guil...
[ "0.56874806", "0.54557216", "0.5449109", "0.5441443", "0.5407161", "0.5375872", "0.536857", "0.53412104", "0.532588", "0.53013366", "0.5246306", "0.5204909", "0.52011704", "0.51955307", "0.51895314", "0.5162264", "0.5128543", "0.5118908", "0.5112617", "0.50994235", "0.5087400...
0.5940937
0