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
Message notifier helper to send message
def message_notifier(self, **kwargs): if all(key in kwargs for key in ["msg_type", "author", "category"]): template_name = os.path.join(kwargs.get("msg_type", ""), kwargs.get("author", ""), kwargs.get("category", ""), kwargs.get("template", "")) k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify(guid, message):", "def notify(cls, self, message):\n pass", "def send(self, msg):\n self.message('Me', msg)", "def send_message(self, message):\n pass", "def send(self, msg):\n pass", "def send(self, msg):\n pass", "def send(self, msg):\n pass", "def n...
[ "0.7474298", "0.7359119", "0.71167135", "0.70818764", "0.70510983", "0.70510983", "0.70510983", "0.6973927", "0.6973927", "0.69313467", "0.6843851", "0.6826354", "0.6787421", "0.67820174", "0.6709434", "0.6690207", "0.66766", "0.66523856", "0.6651198", "0.66505796", "0.662189...
0.0
-1
Returns a list of all Server Emojis
async def emojis(self, ctx): server = ctx.message.server await self.bot.say('This may take some time, generating list...') data = discord.Embed(description="Emojilist") for ej in server.emojis: data.add_field( name=ej.name, value=str(ej) + " " + ej.id, inline=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_slack_emoji():\n all_slack_emoji = []\n\n # load stock emoji from file\n with app.open_resource('../static/emoji-names.json') as f:\n stock_emojis = json.load(f)\n all_slack_emoji += stock_emojis\n\n # concat custom emoji by slack API call\n all_slack_emoji += sc.api_call('emoj...
[ "0.6829809", "0.67620057", "0.6723042", "0.66201127", "0.66025", "0.65196496", "0.6501168", "0.6340955", "0.62791866", "0.6245136", "0.60249436", "0.5856114", "0.57686776", "0.57601565", "0.56315124", "0.56029534", "0.55517876", "0.55233794", "0.55045164", "0.5494092", "0.549...
0.73602945
0
Displays general help information for my guild
async def just(self, ctx): user = ctx.message.author color = self.getColor(user) data = discord.Embed( description='Erklärung zu den Befehlen', color=color) data.set_author(name='Justified Loyalty') data.add_field( name='Schlüssel hinzufügen', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def help(ctx):\n\tembed = discord.Embed(description='Below Are All The Commands For SecretBot')\n\tembed.set_author(name='SecretBot Help Center')\n\tembed.add_field(name='***`!ping`***', value='Returns the bot latency', inline=False)\n\tembed.add_field(name='***`!clear`***', value='Deletes the given amount o...
[ "0.77254003", "0.76329136", "0.76176476", "0.7611161", "0.75561047", "0.75534046", "0.7512939", "0.7468252", "0.7456119", "0.7436395", "0.74283975", "0.7324036", "0.73093426", "0.730897", "0.7305636", "0.72907877", "0.7281279", "0.7268633", "0.7259403", "0.72506446", "0.72290...
0.0
-1
Check if Server is online
async def ping(self, ctx, ip): # Check for valid IP else do DNS lookup valid_ip = re.compile("[0-9]{,3}\.[0-9]{,3}\.[0-9]{,3}") valid_hostname = re.compile(".*\.[a-zA-Z]{2,}") valid = False if valid_ip.match(ip): valid = True elif valid_hostname.match(ip): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_status(self):\n try:\n self.server.ping()\n return True\n except Exception as e:\n return False", "def is_online(self) -> bool:\n return self.data[Attribute.ONLINE]", "def checkServerThread(self):\r\n\r\n # check if the server is alive\r\n ...
[ "0.77489424", "0.7634192", "0.75805205", "0.75527275", "0.7549516", "0.7535959", "0.74494815", "0.74301475", "0.7362648", "0.7362512", "0.73440593", "0.718413", "0.7166052", "0.7160639", "0.71309507", "0.71227175", "0.7115964", "0.70983225", "0.7060262", "0.7053327", "0.70431...
0.0
-1
Outputs a random image from pr0gramm.com (sfw)
async def pr0(self, ctx): # Generate random number, check if header responds with 200 (OK) # If not generate new number # Hardcoded img src from webpage in line 63 # Extract path to image from webpage # Clean up user = ctx.message.author color = self.getColor(use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rand_img():\n import urllib\n import os\n import glob\n\n pics = glob.glob('/home/cody_techngs/PycharmProjects/ProjTest/ActiveAMT/ActiveAMT_FLASK/static/images/HITs/rand*')\n nums = []\n\n for pic in pics:\n nums.append(int(pic.split('rand_img')[1].split('.')[0]))\n\n unique_num...
[ "0.647646", "0.6339494", "0.61261845", "0.6112071", "0.61045945", "0.60505414", "0.60447264", "0.6006293", "0.59611243", "0.5850205", "0.58383125", "0.5806911", "0.5787211", "0.5764011", "0.57588387", "0.57280755", "0.5725055", "0.570823", "0.56704146", "0.5665492", "0.566296...
0.55273026
31
Coinflip, defaults to Kopf/Zahl if no players are given
async def coinflip(self, ctx, player1=None, *, player2=None): rng = randint(1, 10) if player1 is None and player2 is None: if rng < 5: return await self.bot.say("Kopf gewinnt!") else: return await self.bot.say("Zahl gewinnt!") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def flipcoin(self, ctx):\n flip = random.choice([True, False])\n if flip == True:\n msg = 'It\\'s heads!'\n await ctx.send(msg)\n elif flip == False:\n msg = 'It\\'s tails!'\n await ctx.send(msg)", "def flip_player(cls):\n cls.current_...
[ "0.67842084", "0.66972786", "0.6554809", "0.65462387", "0.6510231", "0.6505744", "0.6217337", "0.61918855", "0.6128844", "0.6107027", "0.60780925", "0.6042313", "0.6022117", "0.60063225", "0.5861973", "0.57754767", "0.57477665", "0.5738534", "0.5674234", "0.5642496", "0.56303...
0.71466845
0
Moves all clients randomly in other channels for duration seconds. After the whirpool event, all clients will be in the same channel as before. Between the whirlpool cycles, the programm will sleep for relax_time seconds.
def whirlpool(ts3conn, duration=10, relax_time=0.5): # Countdown till whirlpool for i in range(5, 0, -1): ts3conn.sendtextmessage( targetmode=ts3.definitions.TextMessageTargetMode.SERVER, target=0, msg="Whirpool in {}s".format(i)) time.sleep(1) # Fetch the clientlist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_send(state):\n while state.running:\n disconnected_users = []\n time.sleep(0.05)\n for nick in users:\n nick, queue = nick, users[nick].queue\n while len(queue) > 0:\n sender, msg = queue.pop(0)\n message = '{}> {}'.format(sende...
[ "0.5521252", "0.5468559", "0.5398658", "0.532204", "0.5318605", "0.5243049", "0.521927", "0.52137786", "0.5190527", "0.51749384", "0.5163204", "0.51520616", "0.5127868", "0.50814927", "0.5065982", "0.5059794", "0.5046238", "0.5038621", "0.501738", "0.5005819", "0.4993451", ...
0.7218653
0
Defines the default ResNet arg scope.
def resnet_arg_scope(weight_decay=0.0001, batch_norm_decay=0.997, batch_norm_epsilon=1e-5, batch_norm_scale=True): batch_norm_params = { 'decay': batch_norm_decay, 'epsilon': batch_norm_epsilon, 'scale': batch_norm_scale, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_resnet_arg_scope(self):\n vs_initializer = tf.keras.initializers.VarianceScaling(2.0)\n l2_regularizer = tf.keras.regularizers.l2(self.config.GENERATOR_WEIGHT_DECAY)\n for layer in self.resnet50V2.layers:\n if isinstance(layer, layers.Conv2D):\n # original im...
[ "0.684542", "0.6298972", "0.5859722", "0.5701552", "0.56541204", "0.563224", "0.5528697", "0.55201155", "0.55156153", "0.5500726", "0.54917955", "0.54548305", "0.54043365", "0.5403969", "0.5390156", "0.5381934", "0.5364883", "0.53589743", "0.5351644", "0.53468245", "0.5309198...
0.55389446
6
Defines a lightweight resnet based model for dense estimation tasks.
def network(inputs, scale, output_channels=3, internal_channels=3, return_endpoints=False, state=None): out_shape = tf.shape(inputs)[1:3] if scale > 1: inputs = tf.pad(inputs, ((0, 0), (1, 1), (1, 1), (0, 0))) inputs = slim.layers.avg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet():\n return models.resnet152(pretrained=True)", "def resnet46(pretrained=False):\n model = ResNet(BasicBlock, [3, 6, 10, 3])\n if pretrained:\n pass\n #model.load_state_dict(model_zoo.load_url(model_urls['resnet18']))\n return model", "def resnet34(bitW, bitA, pretrained=Fa...
[ "0.678431", "0.6743733", "0.6683988", "0.6681649", "0.6650233", "0.6596993", "0.65124136", "0.6503727", "0.6500117", "0.6500117", "0.6500117", "0.6500117", "0.6482222", "0.64762425", "0.6470119", "0.6467772", "0.64354265", "0.6434284", "0.6432372", "0.6432372", "0.6432372", ...
0.0
-1
unit test for import_data
def test_import_data(): file_path = os.path.join(CONST_ADVANTICSYS_DIR, CONST_ADVANTICSYS_TEST_1) # Bring df success, log, test_ingress_df = advanticsys_import(file_path) assert success, log assert isinstance(test_ingress_df, pd.DataFrame) # Test import function success, log = import_data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import(self):\n\n database.delete_database()\n\n #Fully successful import\n actual_tuples1 = database.import_data('csvs', 'product_data.csv', 'customer_data.csv',\n 'rentals_data.csv')\n expected_tuples1 = ((1, 1, 1), (0, 0, 0))\n ...
[ "0.79549503", "0.7904061", "0.77873087", "0.764547", "0.744109", "0.7326395", "0.71442324", "0.70856327", "0.7078031", "0.69899714", "0.6982824", "0.69564384", "0.694217", "0.6923845", "0.6889546", "0.684248", "0.67932606", "0.6782817", "0.67503047", "0.67497194", "0.6735551"...
0.7698802
3
Finds a seat ID based on string provided on the boarding pass.
def find_seat(seat_string): row = int(''.join([{'F':'0', 'B':'1'}[r] for r in seat_string[:7]]),2) col = int(''.join([{'L':'0', 'R':'1'}[c] for c in seat_string[7:]]),2) return row * 8 + col
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_seat_id(boarding_pass):\n return int(re.sub(\"[FL]\", \"0\", re.sub(\"[BR]\", \"1\", boarding_pass)), 2)", "def get_seat_id(boarding_pass: str) -> int:\n row, column = parse_boarding_pass(boarding_pass)\n return row * 8 + column", "def part2(data: str):\n seat_ids = sorted(\n [bp.sea...
[ "0.77942544", "0.7530775", "0.7115229", "0.66326725", "0.6397568", "0.60840887", "0.59991723", "0.5945933", "0.58683074", "0.58614475", "0.5856253", "0.58306193", "0.5659762", "0.5606489", "0.556601", "0.55478156", "0.5538071", "0.54757804", "0.5440015", "0.5378216", "0.53555...
0.69945955
3
Converts all seat strings into seat IDs and returns the highest seat ID found.
def highest_seat_id(raw_seat_string): seat_list = raw_seat_string.split('\n') return max(list(map(find_seat, seat_list)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_highest_seat_id(seat_ids):\n\n return max(seat_ids)", "def get_max_seat_id(boarding_passes: list) -> int:\n return max(get_seat_id(boarding_pass) for boarding_pass in boarding_passes)", "def part2(data: str):\n seat_ids = sorted(\n [bp.seat_id for bp in map(lambda row: BoardingPass(row)...
[ "0.74634355", "0.668236", "0.6261357", "0.62445736", "0.6111793", "0.6099611", "0.60279304", "0.587468", "0.5664313", "0.5655479", "0.55966735", "0.5484212", "0.53893024", "0.5317917", "0.5312065", "0.52949077", "0.5271475", "0.52611125", "0.5253164", "0.52044994", "0.5197342...
0.8179302
0
All seats start out empty
def __init__(self): self.empty_seats = [row * 8 + col for row in self.rows for col in self.cols]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_seats(seats, seat_numbers):\n\n for seat in seat_numbers:\n seats[seat] = None\n\n return seats", "def fill_empty_seats(seats_names_dict, seats):\n for seat in seats:\n if seat not in seats_names_dict:\n seats_names_dict[seat] = 'empty'\n\n return seats_names_dict",...
[ "0.6661953", "0.603927", "0.603626", "0.5855473", "0.5745834", "0.55990493", "0.55397326", "0.55388844", "0.55323654", "0.5485067", "0.5471141", "0.5468245", "0.5461583", "0.54550487", "0.54510456", "0.5441734", "0.5439312", "0.5425242", "0.5423252", "0.54135686", "0.53805137...
0.64161956
1
Each time a passenger is seated, the seat_id is removed from the empty seats list
def seat_passenger(self, seat_id): self.empty_seats.remove(seat_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_player(self, seat_id):\n player_id = seat_id\n try:\n idx = self._seats.index(self._player_dict[player_id])\n self._seats[idx] = Player(0, stack=0, emptyplayer=True)\n del self._player_dict[player_id]\n self.emptyseats += 1\n except ValueError:\n pass", "def empty_sea...
[ "0.6723246", "0.67226124", "0.62767714", "0.587385", "0.58325046", "0.57876456", "0.5778089", "0.5708203", "0.5675765", "0.5618063", "0.5579411", "0.5568858", "0.5519024", "0.5517418", "0.54689866", "0.54673475", "0.5445841", "0.54018897", "0.5352401", "0.5350176", "0.5329276...
0.830451
0
Should produce identical sequences, only if seed is None and random order is required, they should be unique.
def test_dataset_accessor_return_type(device, sampling_method): params = DatasetSENavigationParams(SeDatasetSize.SIZE_24) # parametrized: params.sampling_method = sampling_method node = DatasetSeNavigationNode(params) node.allocate_memory_blocks(AllocatingCreator(device=device)) node._step() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_repeatable():\n random.seed(1234)\n np.random.seed(1234)", "def Randomize(seed=None):\n random.seed()", "def test_shuffle(self):\n random.shuffle(self.seq)\n self.seq.sort()\n self.assertEqual(self.seq, range(10))", "def test_case_3(self):\n\n print(\"-----------...
[ "0.68063575", "0.6516124", "0.6415844", "0.63486207", "0.6323278", "0.622613", "0.6209167", "0.6162394", "0.6157565", "0.61564547", "0.61397254", "0.61340016", "0.6130892", "0.6111281", "0.6107018", "0.6072725", "0.6069071", "0.60623324", "0.60471845", "0.6025049", "0.6025049...
0.0
-1
Dump observations to specified file
def writeHealthObs(usersList, health, numTimeSteps): # Write observations for EM here fout = open('../epiDBN/data/dbn_train_%d.txt' % numTimeSteps, 'w+') # Write true labels here #foutLabels = open('../epiDBN/data/dbn_train_%d_true_labels.txt' % numTimeSteps, 'w') # Header - gmtk does not want comments in the d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_data(self,filename,dump_id):\n import pickle\n from Auxiliary import tdc_Filenames\n data = [ d.get_pure_data_copy() for d in self.plotter.data ]\n dump_dict={}\n dump_dict['fft_data'] = data\n dump_dict['fitting_type'] = self.fft_fit.type \n dump_dict['n...
[ "0.6793172", "0.66224176", "0.65509844", "0.64685756", "0.63766843", "0.6334536", "0.6326792", "0.6316774", "0.6305548", "0.62975866", "0.6241558", "0.6238045", "0.61615443", "0.61470276", "0.6133353", "0.61016566", "0.60787475", "0.60740733", "0.60731506", "0.6072791", "0.60...
0.0
-1
Return fitness given a genome class
def evaluate(genome): # base fitness fit = 1.0 # promote 1001 starting motif matches = 0 if genome.sequence_A[0] == 1: matches += 1 if genome.sequence_A[1] == 0: matches += 1 if genome.sequence_A[2] == 0: matches += 1 if genome.sequence_A[3] == 1: matches ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitness(self):\n pass", "def fitness(self):\n # TO BE DECIDED\n return 1", "def fitness(self,*val):\n if len(val): self._fitness = val[0]\n return self._fitness", "def fitness(self) -> float:\n return self._fitness", "def calculate_fitness(self, **kwargs):\n ...
[ "0.7435925", "0.70573634", "0.6834959", "0.667213", "0.65809023", "0.65646446", "0.6498988", "0.64824885", "0.64313686", "0.63564503", "0.6339265", "0.63168496", "0.6300622", "0.6260624", "0.6199508", "0.61992794", "0.61722684", "0.6163491", "0.6102426", "0.60920846", "0.6091...
0.6741454
3
This function is used to search a given Book Title
def search(title, base_root): # Database Connection cnx = db.connect(user='root', password='', host='127.0.0.1', database='Library') cur = cnx.cursor() query = "SELECT * FROM Books WHERE title LIKE '%" + title + "%'" # We look for all books whose title contains the given substring try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, title=\"\", author=\"\", year=\"\", isbn=\"\"):\n self.cursor.execute(\"SELECT * FROM Book WHERE Title = ? OR Author = ? \\\n OR Year = ? OR ISBN = ?\", (title, author, year, isbn))\n rows = self.cursor.fetchall()\n return rows", "def book_search(self, term):\n\n ...
[ "0.71749747", "0.7143297", "0.6945613", "0.6931124", "0.6893685", "0.68236625", "0.68118626", "0.6783939", "0.67645556", "0.67461675", "0.671418", "0.6666875", "0.6659487", "0.65709585", "0.6557472", "0.6552977", "0.65291214", "0.65027714", "0.6492732", "0.6477249", "0.646716...
0.64785403
19
Detect sequential cut in DFG graph
def detect_sequential_cut(self, conn_components, this_nx_graph, strongly_connected_components): if len(strongly_connected_components) > 1: conn_matrix = detection_utils.get_connection_matrix(strongly_connected_components, self.dfg) comps = [] closed = set() for i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_cut(self, second_iteration=False):\n if pkgutil.find_loader(\"networkx\"):\n import networkx as nx\n else:\n msg = \"networkx is not available. inductive miner cannot be used!\"\n logging.error(msg)\n raise Exception(msg)\n\n if self.dfg:\...
[ "0.62352633", "0.62338763", "0.57436424", "0.5730967", "0.5658197", "0.5650399", "0.55493516", "0.54457647", "0.53847903", "0.53800404", "0.5375748", "0.5339116", "0.52789414", "0.5212714", "0.5196232", "0.5167567", "0.5158499", "0.5120214", "0.5101768", "0.5097351", "0.50969...
0.5710943
4
Checks if each branch of the parallel cut has a start and an end node of the subgraph
def check_sa_ea_for_each_branch(self, conn_components): parallel_cut_sa = list(set(self.initial_start_activities).union( infer_start_activities_from_prev_connections_and_current_dfg(self.initial_dfg, self.dfg, self.activities, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_connected(self, start: Union[str, int], end: Union[str, int]) -> bool:\n\t\tif start not in self.vertices or end not in self.vertices:\n\t\t\traise GraphError(\"Start or end not found in graph\")\n\n\t\tvisited = dict(zip(self.vertices, [False] * len(self.vertices)))\n\t\tqueue = []\n\t\tqueue.append(start)...
[ "0.6446912", "0.60400736", "0.6032703", "0.60213304", "0.60129786", "0.6002233", "0.59806913", "0.59728694", "0.5967003", "0.59241945", "0.5915911", "0.5913777", "0.5874635", "0.58325255", "0.5819889", "0.581288", "0.57998574", "0.57834435", "0.57786924", "0.5778236", "0.5769...
0.53612095
76
Puts the skips in sequential cut
def put_skips_in_seq_cut(self): # first, put skips when in some cut there is an ending activity in_end_act = set(self.initial_end_activities) i = 0 while i < len(self.children) - 1: activities_set = set(self.children[i].activities) intersection = activities_set.in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skipp(self):\n for x in range(4):\n self.fwd(right=100, left=100)\n time.sleep(.5)\n self.servo(1000)\n time.sleep(.1)\n self.servo(2000)\n time.sleep(.1)\n self.fwd(right=-100, left=-100)\n time.sleep(.1)\n ...
[ "0.6081469", "0.59631395", "0.590605", "0.59015036", "0.59015036", "0.563135", "0.5596978", "0.5508532", "0.550615", "0.5485905", "0.54270315", "0.54068", "0.5339759", "0.53249735", "0.52994674", "0.5296712", "0.5285578", "0.5242751", "0.52426267", "0.5176084", "0.5173648", ...
0.7369221
0
Detect generally a cut in the graph (applying all the algorithms)
def detect_cut(self, second_iteration=False): if pkgutil.find_loader("networkx"): import networkx as nx else: msg = "networkx is not available. inductive miner cannot be used!" logging.error(msg) raise Exception(msg) if self.dfg: this...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cut(S, T, graph):\n ###TODO\n pass", "def detect_cut(self, second_iteration=False):\r\n if self.dfg:\r\n # print(\"\\n\\n\")\r\n par_cut = self.detect_parallel_cut()\r\n conc_cut = self.detect_concurrent_cut()\r\n seq_cut = self.detect_sequential_cut()...
[ "0.67545813", "0.63988644", "0.6193305", "0.61927104", "0.6070173", "0.6034064", "0.60137284", "0.6012636", "0.60082155", "0.59801936", "0.59748966", "0.59515464", "0.5919017", "0.59180576", "0.5864671", "0.5861133", "0.5767556", "0.5763453", "0.5761619", "0.5738483", "0.5731...
0.63831633
2
Start the monitoring loop for the downloads.
def start(self): self._logger.info("Starting download monitor (interval: %d seconds)" % self.interval) self.monitor_lc = ensure_future(looping_call(0, self.interval, self.monitor_downloads))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.monitor.start()", "def start_download(self) -> NoReturn:\n if self.threaded:\n self.threaded_download()\n else:\n self.regular_download()", "def monitor_downloads(self):\n return self.request_manager.get_downloads().addCallback(self.on_dow...
[ "0.7030247", "0.6881864", "0.681746", "0.6760977", "0.6704339", "0.66790855", "0.6652548", "0.66350824", "0.6631739", "0.66223013", "0.65687346", "0.65481055", "0.65054774", "0.6494747", "0.64725673", "0.64176327", "0.6264444", "0.6254806", "0.62482595", "0.62001854", "0.6194...
0.8476433
0
Stop the monitoring loop for the downloads.
def stop(self): if self.monitor_lc: self.monitor_lc.cancel() self.monitor_lc = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self._running = False\n self._logger.info(\"Locator finished main loop\")", "def stop(self):\n \n for watched_file in self._watched_files:\n watched_file.close()", "def stop_monitoring(self):\n pass", "def stop(self):\n\n self.keep_ru...
[ "0.7338356", "0.7250945", "0.7194579", "0.7162138", "0.7155697", "0.7150892", "0.70830715", "0.70646536", "0.7063699", "0.7061427", "0.7033731", "0.7021838", "0.70164853", "0.70094645", "0.69946784", "0.69946784", "0.69946784", "0.69946784", "0.69946784", "0.69946784", "0.698...
0.7091725
6
Monitor the downloads in Tribler.
async def monitor_downloads(self): downloads = await self.request_manager.get_downloads() for download in downloads["downloads"]: time_diff = time.time() - self.start_time with open(self.download_stats_file_path, "a") as output_file: output_file.write("%s,%s,%s,%s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monitor_downloads(self):\n return self.request_manager.get_downloads().addCallback(self.on_downloads)", "def start(self):\n self._logger.info(\"Starting download monitor (interval: %d seconds)\" % self.interval)\n self.monitor_lc = ensure_future(looping_call(0, self.interval, self.monito...
[ "0.77754945", "0.68570465", "0.63873947", "0.6189983", "0.6162762", "0.61472476", "0.5974604", "0.5974385", "0.59406537", "0.59122854", "0.5896646", "0.58398616", "0.5819066", "0.58097005", "0.5774304", "0.57651347", "0.5756573", "0.5737742", "0.573505", "0.56281215", "0.5620...
0.65173733
2
Returns true if the cooldown is ready.
def ready(self): return self.time >= self.cooldown
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_cooldown(self) -> bool:\n return self.cooldown_counter > 0", "def is_ready(self) -> bool:\n return self._ready.is_set()", "def cooldown_checker(self):\n self.cooldown_tick += 1\n if self.cooldown_tick == self.pattern_cooldown:\n self.wait = False\n self....
[ "0.80361766", "0.73155785", "0.7213164", "0.7167499", "0.7148745", "0.7121509", "0.71099555", "0.7094376", "0.70895165", "0.7063325", "0.70395815", "0.7003874", "0.69981563", "0.69766104", "0.69766104", "0.6975192", "0.69604623", "0.69585705", "0.69414705", "0.6909078", "0.68...
0.87662184
0
Same as ready, but also resets the cooldown if it's ready.
def reset_if_ready(self): ready = self.ready if ready: self.reset() return ready
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ready(self):\n return self.time >= self.cooldown", "def cooldown_checker(self):\n self.cooldown_tick += 1\n if self.cooldown_tick == self.pattern_cooldown:\n self.wait = False\n self.cooldown_tick = 0", "def in_cooldown(self) -> bool:\n return self.cooldown...
[ "0.7826513", "0.6927548", "0.66389006", "0.6576115", "0.6455185", "0.64339614", "0.6347819", "0.6346078", "0.63389456", "0.6314018", "0.62754583", "0.62540513", "0.62156993", "0.6199212", "0.6199212", "0.6199212", "0.6199212", "0.6199212", "0.6199212", "0.6199212", "0.6191149...
0.61651146
22
Get api_key in metadata, raise error if does not exist
def get_api_key(context) -> str: provided_api_key = "" for key, value in context.invocation_metadata(): if key == "api_key": provided_api_key = str(value) return provided_api_key return provided_api_key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api_key(api_key):\n api.get(api_key)", "def resolve_apikey(self):\n # check the instance variable\n apikey = self.apikey\n if apikey is not None:\n return apikey\n\n # check the class variable and environment\n apikey = resolve_apikey()\n if apikey ...
[ "0.7678791", "0.6980334", "0.6893777", "0.67977744", "0.6746311", "0.67275006", "0.6724428", "0.6724428", "0.67214483", "0.6710168", "0.6701964", "0.66950274", "0.6663174", "0.6648977", "0.66346925", "0.6588155", "0.6586956", "0.65624505", "0.65600836", "0.6558815", "0.655764...
0.7251901
1
Update prefix with operator with best price.
def _update_prefix(self, prefix: str, operator: Operator): cached_operator: Optional[Operator] = self.lookup(prefix) if cached_operator: cached_price = cached_operator.price_for_prefix(prefix) if cached_price: if operator.has_better_price_for_prefix(prefix, cached...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_with_operator(self, operator: Operator):\n if not isinstance(operator, Operator):\n raise TypeError(\n f\"operator expected to be of type `Operator` but got type \"\n f\"{type(operator)}\"\n )\n\n for prefix in operator.rates.keys():\n ...
[ "0.6310741", "0.57850754", "0.57514006", "0.54723537", "0.54526275", "0.5421909", "0.53711325", "0.5362892", "0.5342558", "0.52658045", "0.5223748", "0.5185856", "0.51810634", "0.51768", "0.5171346", "0.5168897", "0.5147008", "0.50996333", "0.50994164", "0.50994164", "0.50835...
0.7551244
0
Find if a given number a prefix in cache.
def find(self, number: str) -> Optional[str]: if number in self.data: # noqa return number else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startsWith(self, prefix):\n ret = True\n curr = self.trie\n for i, ch in enumerate(prefix):\n curr = curr.get(ch, {})\n if curr:\n continue\n else:\n break\n \n if i==len(prefix)-1:\n ret = True\n ...
[ "0.6720833", "0.6547649", "0.6462857", "0.64407134", "0.6428188", "0.6415573", "0.62809837", "0.6258059", "0.61898506", "0.6167757", "0.6164689", "0.6134488", "0.61225975", "0.6088009", "0.60353285", "0.6033145", "0.6019844", "0.59988034", "0.5941386", "0.59368086", "0.591884...
0.53415996
84
Updates `PrefixCache` with data from given operator.
def update_with_operator(self, operator: Operator): if not isinstance(operator, Operator): raise TypeError( f"operator expected to be of type `Operator` but got type " f"{type(operator)}" ) for prefix in operator.rates.keys(): self._up...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_prefix(self, prefix: str, operator: Operator):\n cached_operator: Optional[Operator] = self.lookup(prefix)\n if cached_operator:\n cached_price = cached_operator.price_for_prefix(prefix)\n if cached_price:\n if operator.has_better_price_for_prefix(pref...
[ "0.7683273", "0.6553203", "0.64049375", "0.52432764", "0.51866513", "0.51246953", "0.5072463", "0.5072463", "0.5058224", "0.50360274", "0.5033406", "0.49451602", "0.49146992", "0.48742005", "0.4850131", "0.4843754", "0.47898152", "0.47546908", "0.47544464", "0.47422978", "0.4...
0.68408626
1
Given a prefix, returns operator with best price in `PrefixCache`
def lookup(self, prefix: str) -> Optional[Operator]: return self.data.get(prefix, None) # noqa
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_prefix(self, prefix: str, operator: Operator):\n cached_operator: Optional[Operator] = self.lookup(prefix)\n if cached_operator:\n cached_price = cached_operator.price_for_prefix(prefix)\n if cached_price:\n if operator.has_better_price_for_prefix(pref...
[ "0.7023152", "0.57442355", "0.56952125", "0.5672677", "0.5581838", "0.5468779", "0.5468779", "0.5460756", "0.5382311", "0.5373651", "0.5297867", "0.52763575", "0.5276098", "0.52464044", "0.5244506", "0.52335495", "0.51884717", "0.51734436", "0.51672626", "0.5148878", "0.51332...
0.6808338
1
map given prefix to operator, overwriting exsisting cache for prefix entry.
def add_prefix(self, prefix: str, operator: Operator): if not isinstance(operator, Operator): raise TypeError( f"`operator` expected to be of type `str` but got type " f"`{type(operator)}`" ) if not isinstance(prefix, str): raise TypeE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_prefix(self, prefix: str, operator: Operator):\n cached_operator: Optional[Operator] = self.lookup(prefix)\n if cached_operator:\n cached_price = cached_operator.price_for_prefix(prefix)\n if cached_price:\n if operator.has_better_price_for_prefix(pref...
[ "0.74195033", "0.6135819", "0.59976494", "0.56019163", "0.55027753", "0.54626215", "0.5361422", "0.53344727", "0.5287824", "0.5260219", "0.525283", "0.5196512", "0.5168845", "0.5155864", "0.5117644", "0.511022", "0.508657", "0.5071373", "0.5030445", "0.49908844", "0.49615845"...
0.63900906
1
Return prefix for `phone_number`. Use `lookup` to fetch operator.
def find_prefix(self, phone_number: str) -> Optional[str]: if not isinstance(phone_number, str): raise TypeError( f"`phone_number` expected to be of type `str` " f"but got type `{type(phone_number)}`" ) if not phone_number.isdigit(): r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_phone_prefix(self, phone_num):\n # FIXME more accurate check\n if phone_num.startswith('+86'):\n return phone_num.replace('+86', '')\n if len(phone_num) != 11:\n return None\n return phone_num", "def phone_number_organizer(self, key):\n\t\ttry:\n\t\t\tp...
[ "0.6136778", "0.596885", "0.586732", "0.5830663", "0.58184695", "0.58184695", "0.5758761", "0.5758761", "0.5729075", "0.56406903", "0.56264126", "0.56246763", "0.5618058", "0.5616657", "0.5613042", "0.56065995", "0.5562532", "0.5562178", "0.5562178", "0.5562178", "0.55411625"...
0.6957184
0
Build a `PrefixCache` from a tuple of `Operators`.
def build_cache(klass: "PrefixCache", operators: Tuple[Operator, ...]) -> "PrefixCache": prefix_cache = klass() for operator in operators: prefix_cache.update_with_operator(operator) return prefix_cache
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildOperatorCache(ham: Dict[str, Any]) -> None:\n sysLevel = ham[\"circuit\"][\"sys_level\"]\n qubitNum = ham[\"circuit\"][\"qubits\"]\n\n # Generator the operator for all of the drift terms\n for key in ham[\"drift\"]:\n drifts = ham[\"drift\"][key]\n operator = generateOperator(dri...
[ "0.55122936", "0.5408634", "0.50833046", "0.50592685", "0.49883533", "0.493835", "0.4874338", "0.48739326", "0.48162144", "0.47007602", "0.46888414", "0.4669612", "0.46306923", "0.46295217", "0.46244913", "0.46051258", "0.46014902", "0.4598839", "0.45586753", "0.45210305", "0...
0.8065964
0
The Function sets frequency.
def frequency(self, freq): self.load.write(f'TRAN:FREQ {freq}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_frequency(self, f=1e9):\r\n self.f = f", "def set_Freq(self,freq):\n super(self.__class__, self).setFreq(self, freq)", "def set_frequency(self, f=1e9):\r\n return self._api.set_frequency(f)", "def frequency(self, frequency: int):\n self._freq = freq", "def set_frequency(self...
[ "0.7891979", "0.7827949", "0.77956927", "0.7742743", "0.77067626", "0.76778984", "0.7675751", "0.7509002", "0.7471969", "0.7448706", "0.7430341", "0.7418492", "0.74022794", "0.73718685", "0.73407614", "0.73039263", "0.7269451", "0.715289", "0.71406645", "0.71391183", "0.71380...
0.6118048
66
The Function sets duty cycle.
def duty_cycle(self,duty_cycle): self.load.write(f'TRAN:DCYC {duty_cycle}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_duty_cycle(self, value):\n self._mixer.duty_cycle = value", "def set_dutyCycle(self, newval):\n rest_val = str(int(round(newval * 65536.0, 1)))\n return self._setAttr(\"dutyCycle\", rest_val)", "def set_duty_cycle(self, pin, dutycycle):\n raise NotImplementedError", "def l...
[ "0.7792069", "0.76351213", "0.74205214", "0.70004797", "0.6803659", "0.6796197", "0.6733606", "0.63782656", "0.631615", "0.6013694", "0.6013694", "0.59704655", "0.5965173", "0.5912627", "0.5794114", "0.57919294", "0.57554364", "0.5750491", "0.57222706", "0.5715776", "0.571364...
0.6837669
4
Plots the latest COVID19 status of the country if name is not given then it plots the top10
def plot(self, context=None): response = requests.get(self.url).content table = pd.read_html(response, attrs={"id": "main_table_countries_today"}) df = table[0].fillna(0) # df.drop(df.index[0], inplace=True) # World df.drop(["ActiveCases", 'Serious,Critical', 'Serious,Critical'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_country(name, case):\n click.echo(click.style(\n \"Generating Plot....\", fg='cyan', bold='true'))\n plot_time_series.TimeSeriesPloTs.plot_country(case, name)\n click.echo(click.style(\n \"Done....\", fg='green', bold='true'))", "def plot_country_representation():\n\n # Get all...
[ "0.5984105", "0.5937387", "0.5841578", "0.56083816", "0.5559453", "0.54571724", "0.54451543", "0.5368691", "0.5362344", "0.5346326", "0.53422797", "0.52614784", "0.52426875", "0.52363175", "0.5218532", "0.5201958", "0.5179261", "0.51773536", "0.51521355", "0.5141482", "0.5134...
0.6362874
0
Create the luis api query url from a csv. Requires the csv to contain the endpoint url, app id and primary key
def get_luis_url(folder: WindowsPath = None) -> str: if folder is None: folder = Path.cwd().joinpath('CONFIG') path = folder.joinpath('luis_keys.csv') df = pd.read_csv(path, index_col='key') endpoint = df.loc['endpoint', 'value'] app_id = df.loc['app_id', 'value'] prim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_urls(csvfile):\n result = []\n with open(csvfile, 'rU') as infile: \n reader = csv.DictReader(infile, dialect=csv.excel,\n fieldnames=['ID','URL','Latitude','Longitude'])\n for row in reader:\n idnum = row['ID']\n url = row['URL']\n ...
[ "0.62318754", "0.5654017", "0.5514315", "0.5352997", "0.5324021", "0.5324021", "0.51919746", "0.51832896", "0.5166666", "0.5166666", "0.5151871", "0.5135357", "0.5133279", "0.512845", "0.50671405", "0.50671405", "0.5013714", "0.5009945", "0.49635574", "0.4927147", "0.49232295...
0.6092655
1
Remove the duplicate comments based on the comment's semantics, e.g. "I was waiting for 1 hour." and "I waited for 1 hour." are orthographically different, but the semantically the same, so one will be removed
def drop_semantic_duplicates( student_comments: pd.Series ) -> pd.Series: # Remove the stopwords and remove punctuation student_comment_lemmatised_nostopwords_nopunct = ( student_comments .apply(lambda x: ' '.join( [token.lemma_ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _RemoveStaleComments(content: str) -> str:\n for match in STALE_GROUP_COMMENT_REGEX.findall(content):\n content = content.replace(match, '')\n\n return content", "def cleanup_comments(comments):\n clean_comments = []\n\n if comments:\n for comment in comments:\n cleaned_up = sub(...
[ "0.6905965", "0.64789987", "0.63036376", "0.62970257", "0.62018055", "0.6140078", "0.60909677", "0.60670996", "0.60540634", "0.60474616", "0.60381204", "0.602201", "0.59883267", "0.5974576", "0.5954461", "0.59360486", "0.5890895", "0.5868616", "0.58588153", "0.58458287", "0.5...
0.6321834
2
Sends student comments to the LUIS.ai API in batches and saves the intemediate results into the OUTPUT folder
def request_api( student_comments: pd.Series, url: str, chunk_size: int = 50 ) -> pd.Series: for i, chunk in enumerate(chunks(student_comments, chunk_size)): print(f'Processing batch {i} of size {len(chunk)}') response = chunk.apply(lambda x: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n \r\n data_dir = Path.cwd().joinpath('OUTPUT')\r\n config_dir = Path.cwd().joinpath('CONFIG')\r\n \r\n # Load deduplicated comments\r\n data = utils.load(data_dir, 'student_comment_deduplicated')\r\n \r\n # Get the luis API url\r\n with open(config_dir.joinpath('luis_url.t...
[ "0.62581986", "0.56374973", "0.55773365", "0.5480655", "0.54645246", "0.5297529", "0.52373004", "0.52115196", "0.5190923", "0.5185241", "0.51840454", "0.5158123", "0.51344043", "0.5082114", "0.50543535", "0.50502497", "0.50455976", "0.5043005", "0.5015503", "0.49875677", "0.4...
0.6514273
0
Yield successive nsized chunks from l.
def chunks(array, size: int): for i in range(0, len(array), size): yield array[i:i + size]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.0
-1
Load the batch response from calling the LUIS.ai API. The files are in pickle format. keyword arguments directory the directory that contains the pickle files
def load_pickles(directory: str) -> pd.Series: concat_series = pd.Series() for path in Path(directory).glob('luis_result_[0-9][0-9][0-9][0-9]*'): luis_series = pickle.load(open(path, 'rb')) concat_series = pd.concat([concat_series, luis_series]) return concat_series.apply(lambda x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(dirpath):\n\n batch = Pickler.load(join(dirpath, 'batch.pkl'))\n\n # load annotator\n if exists(join(dirpath, 'annotation.json')):\n annotator = Annotation.load(dirpath)\n batch.annotator = annotator\n\n return batch", "def LoadBatch(filename):", "def ...
[ "0.6535854", "0.6307839", "0.6166223", "0.59658235", "0.5965553", "0.58758074", "0.58634603", "0.5746226", "0.5686718", "0.56804204", "0.56649435", "0.56557375", "0.56435114", "0.5642064", "0.5625798", "0.5621212", "0.5580411", "0.557783", "0.5567398", "0.5554359", "0.5541838...
0.54686445
23
Merging the results from the luis response with the lemmatised comments.
def merge_comments(df1: pd.DataFrame, df2: pd.DataFrame, out_dir: str) -> pd.DataFrame: nlp = spacy.load('en_core_web_lg') df1 = pd.DataFrame(load_pickles(out_dir)) df1.columns = ['response'] df1['student_comment_apostrophe'] = df1.response.apply(lambda x: x['query'] if x is not None else No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _proc(dat):\n def lemma(text):\n lemmatizer = WordNetLemmatizer()\n w_tokenizer = WhitespaceTokenizer()\n return [lemmatizer.lemmatize(w) for w in w_tokenizer.tokenize(text)]\n\n dat['text_lemmatized'] = dat['clean_comments'].apply(lemma)\n dat['text_lemmat...
[ "0.5736245", "0.57142824", "0.5411729", "0.540935", "0.54072136", "0.5370507", "0.5283631", "0.5237631", "0.5222202", "0.52172023", "0.52092206", "0.5151312", "0.5109762", "0.5085416", "0.5063539", "0.5046727", "0.49920905", "0.49881884", "0.4975726", "0.49670464", "0.4951924...
0.6131447
0
Extract the element, e.g. topScoringIntent, from the LUIS.api json response s the pd.Series of the unravelled json response element the elements, such as "sentiment" or "intent"
def get_luis_element(s: pd.Series, element: str) -> pd.Series: result = 0 if element == 'intent': result = s.apply(lambda x: x['topScoringIntent']['intent']) elif element == 'entities': result = s.apply(lambda x: x['entities']) elif element == 'sentiment': valence = s.appl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_response(self, response):\n\t\tself.context = response['context']\n\t\ttext = response['output']['text']\n\t\tintents = response['intents'] #is a list, should filter\n\t\tif len(intents) > 0:\n\t\t\tintent = intents[0]['intent'] #get the intent of the message\n\t\telse:\n\t\t\tintent = \"\"\n\t\t\t\n\t\t...
[ "0.5717776", "0.55163515", "0.5311165", "0.52464586", "0.5228804", "0.52271056", "0.52187705", "0.52037966", "0.5090575", "0.50477314", "0.5046301", "0.5021355", "0.500153", "0.49620596", "0.49437866", "0.4942395", "0.4940954", "0.49293894", "0.4871135", "0.4847061", "0.48190...
0.6376146
0
Load the deduplicated comments Get the luis url Call the API in batches Aggregate the batched pickled files with 'luis_result' in the filename, Extract the top scoring intent, entities and the sentiment of each row Save each of the three series as separate pickle files
def main(): data_dir = Path.cwd().joinpath('OUTPUT') config_dir = Path.cwd().joinpath('CONFIG') # Load deduplicated comments data = utils.load(data_dir, 'student_comment_deduplicated') # Get the luis API url with open(config_dir.joinpath('luis_url.txt'), 'r') as f: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_api(\r\n student_comments: pd.Series, \r\n url: str, \r\n chunk_size: int = 50\r\n ) -> pd.Series:\r\n \r\n for i, chunk in enumerate(chunks(student_comments, chunk_size)):\r\n print(f'Processing batch {i} of size {len(chunk)}')\r\n \r\n response =...
[ "0.6615366", "0.5831273", "0.57000536", "0.56970143", "0.5684071", "0.5569833", "0.5552695", "0.5543285", "0.55414546", "0.55375046", "0.5494917", "0.5487292", "0.5479934", "0.54722214", "0.54708064", "0.54343843", "0.54299", "0.54090136", "0.5354556", "0.53511345", "0.534945...
0.59263885
1
Create table from csv file to input into database.
def create_table(engine, csv_filename, tablename): # Read csv file and changes all column names to be lowercase csv_df = pd.read_csv(f'./data/{csv_filename}.csv') csv_df.columns = [c.lower() for c in csv_df.columns] # Change date types to datetime todateformat = [] for c in csv_df.columns: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_table_from_csv (sqlite_db_file):\n files = [f for f in os.listdir(os.curdir) if f.endswith(\".csv\")]\n name_df = [re.findall('(.*)\\.csv',f)[0] for f in files ]\n engine = create_engine('sqlite:///' + sqlite_db_file)\n for n, f_n in zip(name_df, files):\n try:\n df = pd.re...
[ "0.78636694", "0.766007", "0.74412394", "0.7296567", "0.72548956", "0.71277964", "0.6920125", "0.6874775", "0.6822775", "0.68040115", "0.678773", "0.674541", "0.67439973", "0.6684536", "0.66534555", "0.66475165", "0.6639408", "0.6621663", "0.66060764", "0.65959024", "0.659466...
0.77351403
1
Calculates the linear function of multiple values at once.
def calculate_batch(characteristic_values: pd.DataFrame, functional_model: Dict[str, List[float]], means: Dict[str, float]) -> pd.DataFrame: coef_names = list(functional_model.keys()) n_points = len(functional_model[coef_names[0]]) result = pd.DataFrame(np.empty((len(characteristic_value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_function(x, y):\n\n return x + y / 2.", "def linear(self, X):\n return X", "def linear(force_zero=None, **kwargs):\n if force_zero is None and len(kwargs) == 0:\n # noinspection PyUnusedLocal\n def lf(x, params, const_list, const_dict):\n a, b = params[0:2]\n ...
[ "0.6685386", "0.6545232", "0.6425038", "0.63650846", "0.63128704", "0.62751406", "0.6245273", "0.6241539", "0.5982045", "0.59696317", "0.593403", "0.59226805", "0.5918838", "0.58957773", "0.58821845", "0.5876786", "0.58201665", "0.5805799", "0.5792677", "0.578401", "0.5777201...
0.0
-1
Calculates the linear function for a single item.
def calculate(characteristic_values: Component, functional_model: Dict[str, List[float]], means: Dict[str, float]) -> List[float]: coef_names = list(functional_model.keys()) n_points = len(functional_model[coef_names[0]]) # make means the same order as characteristic values. means = np.ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear(self, X):\n return X", "def linear_function(x, y):\n\n return x + y / 2.", "def linear(force_zero=None, **kwargs):\n if force_zero is None and len(kwargs) == 0:\n # noinspection PyUnusedLocal\n def lf(x, params, const_list, const_dict):\n a, b = params[0:2]\n ...
[ "0.6771267", "0.63907444", "0.6290557", "0.6165682", "0.6144242", "0.611005", "0.6104654", "0.60972625", "0.60318756", "0.5961327", "0.5924883", "0.58761096", "0.5875746", "0.58339524", "0.5821024", "0.5786686", "0.5786686", "0.5750675", "0.5737204", "0.573677", "0.57302845",...
0.0
-1
Return a list of cleaned word tokens from the raw review
def review_to_words( review ): #Remove any HTML tags and convert to lower case review_text = BeautifulSoup(review).get_text().lower() #Replace smiliey and frown faces, ! and ? with coded word SM{int} in case these are valuable review_text=re.sub("(:\))",r' SM1',review_text) review_text=re.sub("(:\(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(review):\n\n token = strip_multiple_whitespaces(strip_punctuation(review))\n return [token.split() for token in simple_preprocess(token) if token not in STOPWORDS]", "def review_to_wordlist(review):\n\n words = review.lower().split()\n words = [w for w in words]\n return(words)", "d...
[ "0.7750979", "0.7179433", "0.717803", "0.7157436", "0.7142787", "0.6961613", "0.69389796", "0.67973894", "0.67853844", "0.6727003", "0.66734666", "0.6642047", "0.66097176", "0.6597971", "0.6580113", "0.65595573", "0.6555122", "0.6553047", "0.65236735", "0.65034825", "0.650111...
0.6859479
7
Returns args including etcd endpoint and certificates if necessary. As dcosetcdctl and etcdctl share the same arguments, such as endpoints, ever considering the certificates involved, we group these arguments to generate the basic items to execute either etcdctl or dcosetcdctl
def get_etcdctl_with_base_args( cert_type: str = "root", endpoint_ip: str = LOCAL_ETCD_ENDPOINT_IP, ) -> List[str]: return [ETCDCTL_PATH, "--endpoints=http://{}:2379".format(endpoint_ip)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_args():\n\n parser = argparse.ArgumentParser(description=\"Get DC, Clusters, Hosts and VM in JSON.\")\n parser.add_argument('-H', '--host', nargs=1, required=True, help='The vCenter to connect to',\n dest='host', type=str)\n parser.add_argument('-p', '--password', nargs=1, r...
[ "0.5863232", "0.57427984", "0.57362777", "0.5711436", "0.5671684", "0.5665155", "0.56511855", "0.5629644", "0.5586884", "0.55581784", "0.5516893", "0.5515851", "0.5509923", "0.5477983", "0.5474129", "0.546462", "0.5454525", "0.54045254", "0.5360767", "0.53578204", "0.53573877...
0.7312782
0
assigns the value to the key. etcd is not exposed outside of the DC/OS cluster,so we have to execute etcdctl inside the DC/OS cluster, on a master in our case.
def put(self, key: str, value: str) -> None: master = list(self.masters)[0] etcdctl_with_args = get_etcdctl_with_base_args(endpoint_ip=MASTER_DNS) etcdctl_with_args += ["put", key, value] master.run(args=etcdctl_with_args, output=Output.LOG_AND_CAPTURE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, key, value, cb=None):\n _log.analyze(self.node.id, \"+ CLIENT\", {'key': key, 'value': value})\n self.send(cmd='SET',msg={'key':key, 'value': value}, cb=cb)", "async def set(self, key, value):\n trace_log(\"PersistantStorage: setting key \", key, \" to value \", value)\n ...
[ "0.6925788", "0.6801668", "0.6539463", "0.6499346", "0.64941585", "0.64688677", "0.6442703", "0.6442703", "0.64351684", "0.6388835", "0.6360207", "0.6353308", "0.6348998", "0.6324563", "0.6311069", "0.6296948", "0.6296282", "0.62657654", "0.6252633", "0.6233048", "0.62180454"...
0.7933066
0
gets the value of the key on given master node
def get_key_from_node( self, key: str, master_node: Node, ) -> str: etcdctl_with_args = get_etcdctl_with_base_args( endpoint_ip=str(master_node.private_ip_address)) etcdctl_with_args += ["get", key, "--print-value-only"] result = master_node.ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key):\n dkey = digest(key)\n _log.debug(\"Server:get %s\" % base64.b64encode(dkey))\n # if this node has it, return it\n exists, value = self.storage.get(dkey)\n if exists:\n return defer.succeed(value)\n node = Node(dkey)\n nearest = self.p...
[ "0.7126619", "0.70644236", "0.700838", "0.7002999", "0.69473535", "0.68663204", "0.68588144", "0.68588144", "0.68452597", "0.677081", "0.672349", "0.6679185", "0.6676274", "0.6670105", "0.663204", "0.66137815", "0.66084397", "0.6582573", "0.6569191", "0.65402824", "0.65248156...
0.79159415
0
Create self signed certificate which will be used by the server to establish an ssl connection with the clients
def create_self_signed_cert(): # create a key pair k = crypto.PKey() k.generate_key(crypto.TYPE_RSA, 1024) # create a self-signed cert cert = crypto.X509() cert.get_subject().C = "GP" cert.get_subject().ST = "GRAD_PROJECT" cert.get_subject().L = "GRAD_PROJECT" cert.get_subject().OU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ssl_certificate() :", "def create_server_certs_enc():\n global server_keystore, config\n\n same_enc_sign_cert = config[\"config\"][\"same_enc_sign_cert\"]\n if same_enc_sign_cert:\n dn = \"/CN=server certificate RSA\"\n else:\n dn = \"/CN=server certificate encryption RSA\"\n ...
[ "0.74075276", "0.73961586", "0.7382436", "0.71985453", "0.7109136", "0.70601207", "0.68436134", "0.66454", "0.6495967", "0.6444003", "0.6436761", "0.64030415", "0.6257964", "0.62239987", "0.62173396", "0.6213609", "0.6211047", "0.6204749", "0.6195145", "0.60811156", "0.603894...
0.70311016
6
Get the latest version of an artifact from Pulse.
def GetLatest(server_url, project_name, username, password, command, name, filename, stage): server = xmlrpclib.ServerProxy(server_url + 'xmlrpc') token = server.RemoteApi.login(username, password) # Get the latest 100 builds of the tools. builds = server.RemoteApi.getLatestBuildsForProjec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_release_get():\n try:\n return json_response.success({'version': version.latest_version()})\n except version.Error as e:\n return json_response.error(str(e)), 200", "async def get_latest_version(self, pkg: str) -> Optional[str]:\n return None", "def latest_version(self):\n...
[ "0.6555443", "0.6440459", "0.6415911", "0.63127923", "0.62560815", "0.6184736", "0.61423135", "0.6134404", "0.6098685", "0.6094916", "0.60846007", "0.60613364", "0.6056806", "0.6047666", "0.6035648", "0.60355157", "0.603404", "0.5991332", "0.58877105", "0.5863567", "0.5862828...
0.58272386
22
Reset Features for states.
def state_reset(): feat_self = get_self_feat(model, data['img'][0]) feat_diff = torch.zeros_like(feat_self) feat_FAR = torch.tensor([0.]).cuda() feat_history = torch.zeros([10]).cuda() return [feat_diff, feat_self, feat_FAR, feat_history]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_states(self):\n self.model.reset_states()", "def reset(self):\n self.train_loss.reset_states()\n self.train_accuracy.reset_states()\n self.val_loss.reset_states()\n self.val_accuracy.reset_states()\n self.train_mIoU.reset_states()\n self.val_mIoU.reset_s...
[ "0.7507805", "0.74202436", "0.734571", "0.7177102", "0.71432304", "0.71178913", "0.69675106", "0.69483036", "0.69046485", "0.6899169", "0.68768305", "0.6849579", "0.68468076", "0.68468076", "0.68468076", "0.68468076", "0.68468076", "0.68468076", "0.68468076", "0.68468076", "0...
0.67439723
27
Separate train or validation annotations to single video annotation.
def separate_annotations(): data_root = '/home/ubuntu/datasets/YT-VIS/' ann_file = data_root + 'annotations/instances_train_sub.json' import json with open(ann_file, 'r') as f: ann = json.load(f) # ann['videos'] = ann['videos'][15] # video_id = [0] from tqdm import tqdm ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AnnotateVideo(self, request, context):\n context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)", "def load_annotations(self):\n assert self.ann_file.endswith('.pkl')\n ann_info = hload_pkl(self.ann_file)\n\n video_infos = []\n for i, video_info in enumerate(ann_info):\n ...
[ "0.65230966", "0.6502994", "0.6373923", "0.6358761", "0.63245064", "0.62168384", "0.60723543", "0.5980911", "0.5978949", "0.59094423", "0.5880484", "0.5861228", "0.5837445", "0.5835894", "0.5835894", "0.58234775", "0.58234775", "0.58179194", "0.581608", "0.5808023", "0.577818...
0.7296973
0
Attempts to identify a face in the input image.
def crop_face(image): gray_image = cv.cvtColor(image, cv.COLOR_BGR2GRAY) face_roi_list = face_detector.detectMultiScale(gray_image, scale_factor, min_neighbors) if len(face_roi_list) > 0: (x,y,w,h) = face_roi_list[0] return gray_image[y:y+h,x:x+w] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __detect_face(self, img):\n gray = cv2.cvtColor(img.copy(), cv2.COLOR_BGR2GRAY)\n return self.detector(gray, 1)", "def detect_face(self, img):\n #convert the test image to gray image as opencv face detector expects gray images\n gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n\n ...
[ "0.75916886", "0.75504404", "0.7519903", "0.7293821", "0.72894216", "0.7179222", "0.7140634", "0.7088855", "0.70069605", "0.6986833", "0.6952809", "0.693437", "0.6923735", "0.6910418", "0.690115", "0.6891117", "0.68858343", "0.6875561", "0.6819587", "0.68134964", "0.6775174",...
0.62767583
65
Preprocess requests by attempting to extract face image, and transforming to fit the model's input Returns list of NDArray Processed images in the model's expected input shape
def preprocess(self, request): img_list = [] input_shape = self.signature['inputs'][0]['data_shape'] [height, width] = input_shape[2:] param_name = self.signature['inputs'][0]['data_name'] # Iterate over all input images provided with the request, transform and append for infere...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, request):\n img_list = []\n param_name = self.signature['inputs'][0]['data_name']\n input_shape = self.signature['inputs'][0]['data_shape']\n\n for idx, data in enumerate(request):\n img = data.get(param_name)\n if img is None:\n ...
[ "0.73400545", "0.6653662", "0.65381366", "0.65293646", "0.6363785", "0.6331957", "0.6321112", "0.6304423", "0.62506974", "0.6235382", "0.6233115", "0.6188294", "0.61358917", "0.61200666", "0.6102832", "0.60749215", "0.6074793", "0.6067623", "0.6028816", "0.6026498", "0.602559...
0.81999916
0
Postprocess inference result to normalize probabilities and render with labels
def postprocess(self, data): if self.error is not None: return [self.error] # Iterating over inference results to render the normalized probabilities response = [] for inference_result in data: softmax_result = inference_result.softmax().asnumpy() for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inference_preprocess(self):\n return", "def post(self):\n result = {'status': 'error'}\n\n args = input_parser.parse_args()\n input_data = args['image'].read()\n image = self.model_wrapper._read_image(input_data)\n preds = self.model_wrapper._predict(image)\n\n ...
[ "0.6822541", "0.6789945", "0.6525151", "0.6503865", "0.635317", "0.63490814", "0.63463706", "0.6325388", "0.6312468", "0.6298555", "0.627382", "0.62542534", "0.6231594", "0.62100625", "0.6208489", "0.61715907", "0.6155044", "0.61538804", "0.6099723", "0.6094014", "0.60685134"...
0.7199529
0
Entry point for the service, called by MMS for every incoming inference request
def handle(data, context): # Lazy initialization, so that we preserve resources until model is actually needed if not _service.initialized: _service.initialize(context) if data is None: return None return _service.handle(data, context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # Grab command line args\n args = build_argparser().parse_args()\n #print(\"finished argparser\")\n\n # Connect to the MQTT server\n client = connect_mqtt()\n #print(\"finished mqtt connect\")\n\n # Perform inference on the input stream\n infer_on_stream(args, client)", "def...
[ "0.67828876", "0.6664456", "0.6537838", "0.64908534", "0.64908534", "0.64681673", "0.6398608", "0.63723826", "0.62997884", "0.6262458", "0.62035257", "0.6189284", "0.61812276", "0.6169812", "0.61480117", "0.61341393", "0.6101827", "0.60902387", "0.6068811", "0.60454684", "0.6...
0.0
-1
give the parameters for 3 bandits an epsilon function to use for epsilongreedy strategy and N, the number of times we play the game
def run_experiment(m1,m2,m3,N): bandits = [Bandit(m1),Bandit(m2),Bandit(m3)] #for PLOTTING ONLY #this is not needed for functioning data = np.empty(N) #play game N times for i in range(N): j = np.argmax([b.mean for b in bandits]) #pull the one we chose x = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epsilon_greedy_probs(self, nA, Q_s, i_count, eps=None):\r\n epsilon = 1.0 / i_count\r\n if eps is not None:\r\n epsilon = eps\r\n \r\n policy_s = np.ones(nA) * epsilon / nA\r\n policy_s[np.argmax(Q_s)] = 1 - epsilon + (epsilon / nA)\r\n return policy_s", "...
[ "0.65078354", "0.6485118", "0.6248076", "0.623976", "0.62300354", "0.6183765", "0.6165985", "0.61592686", "0.61008763", "0.6063428", "0.6015543", "0.60097307", "0.59649414", "0.59626967", "0.58986133", "0.58937275", "0.5883711", "0.587728", "0.5865441", "0.5847683", "0.584767...
0.60085034
12
Get Mapbox access token from arg or environment
def _get_token(token=None): if token is not None: return token else: return os.environ.get("MAPBOX_ACCESS_TOKEN") or os.environ.get( "MapboxAccessToken" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_token(*args, **kwargs):\n return None", "def _get_api():\n return os.environ.get(\"MAPBOX_API\", \"https://api.mapbox.com\")", "def get_access_token() -> str:\n\n gcloud_access_token = (\n subprocess.check_output(\n \"gcloud auth print-access-token\".split(\" \")).decode().rstri...
[ "0.6571186", "0.641618", "0.6319432", "0.6312531", "0.62517345", "0.62223494", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61220384", "0.61139506", "0.60954535", "...
0.7944125
0
Get Mapbox tileset API base URL from environment
def _get_api(): return os.environ.get("MAPBOX_API", "https://api.mapbox.com")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BASE_URL():\n BASE_URL = \"http://api.zippopotam.us/\"\n return BASE_URL", "def get_api_url():\n return \"https://api.basespace.illumina.com/v1pre3\"", "def get_base_url(self):\n try:\n return self.get_metadata()['api_endpoint']\n except requests.exceptions.RequestExceptio...
[ "0.6906486", "0.66537344", "0.63970846", "0.6344204", "0.63017035", "0.62595123", "0.6243633", "0.6242185", "0.6158359", "0.607803", "0.6049366", "0.6043342", "0.6035657", "0.603387", "0.60302913", "0.6018488", "0.6010978", "0.59873545", "0.59861904", "0.5982116", "0.5865234"...
0.6620628
2
This is the command line interface for the Mapbox Tilesets API. Thanks for joining us. This CLI requires a Mapbox access token. You can either set it in your environment as "MAPBOX_ACCESS_TOKEN" or "MapboxAccessToken" or pass it to each command with the token flag.
def cli():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n args = argument_parser()\n args.mbtiles_file.close()\n mbtiles_file = args.mbtiles_file.name\n zoom = args.zoom\n tile_x = args.tilex\n tile_y = args.tiley\n mvt_content = run(tile_x, tile_y, zoom, mbtiles_file)\n print(mvt_content, end='')", "def list(username, verbose, tok...
[ "0.66064084", "0.6603558", "0.5632666", "0.5553295", "0.54832375", "0.5439695", "0.5402188", "0.54002506", "0.53913784", "0.52904177", "0.52454877", "0.522602", "0.5215025", "0.51400757", "0.5139254", "0.509903", "0.50982046", "0.5059821", "0.5051243", "0.4985214", "0.4961472...
0.5017632
44
Create a new tileset with a recipe. $ tilesets create is in the form of username.handle for example "mapbox.neattileset". The handle may only include "" or "_" special characters.
def create( tileset, recipe, name=None, description=None, privacy=None, token=None, indent=None ): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}?access_token={2}".format( mapbox_api, tileset, mapbox_token ) body = {} body["name"] = name or "" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tile(self, name):\n return self.subgrids[name[0:2]].tilesys.create_tile(name)", "def create_mapset(self, mapset, dbase=None, location=None):\n module = 'g.c.mapset'\n gs.run_command(module, mapset=mapset, dbase=dbase, location=location)", "def create_mapset(self, mapset, dbase=N...
[ "0.5746558", "0.56829774", "0.56782365", "0.5534749", "0.54125917", "0.53344876", "0.52849835", "0.52363425", "0.52307814", "0.52018946", "0.5193289", "0.5177163", "0.51419634", "0.5093439", "0.5085827", "0.50712436", "0.5016903", "0.4999963", "0.49877235", "0.49808466", "0.4...
0.7657994
0
Publish your tileset. tilesets publish
def publish(tileset, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/publish?access_token={2}".format( mapbox_api, tileset, mapbox_token ) r = requests.post(url) if r.status_code == 200: click.echo(json.dumps(r.json(),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish():\n pass", "def publish(self):\n return", "def publish(self, settings, item):\n\n publisher = self.parent\n engine = publisher.engine\n document = item.properties[\"document\"]\n\n path = _document_path(document)\n item.properties[\"upload_path\"] = pat...
[ "0.6580128", "0.5952823", "0.5932906", "0.58998835", "0.5859718", "0.56866664", "0.5659581", "0.5582952", "0.55645955", "0.5559791", "0.5526525", "0.5434319", "0.5407289", "0.54018307", "0.53910875", "0.5360681", "0.5359375", "0.5341747", "0.53361744", "0.5277855", "0.5274251...
0.7308318
0
View the current queue/processing/complete status of your tileset. tilesets status
def status(tileset, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/status?access_token={2}".format( mapbox_api, tileset, mapbox_token ) r = requests.get(url) click.echo(json.dumps(r.json(), indent=indent))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self):", "def thread_status():\n global dataSession\n return jsonify(dict(status=('finished' if len(dataSession) > 1 else 'running')))", "def report_queue_status(self):\n raise NotImplementedError", "def update_status(cls):\n for job in cls.query.filter(cls.finished == False):\...
[ "0.6251672", "0.6249044", "0.6178998", "0.61220944", "0.6083708", "0.60823643", "0.601419", "0.5995323", "0.5989828", "0.5984694", "0.5970482", "0.5943197", "0.5943197", "0.5942803", "0.5938031", "0.5891603", "0.5884071", "0.58760405", "0.5856712", "0.58364433", "0.58343846",...
0.6567368
0
View all jobs for a particular tileset. tilesets jobs
def jobs(tileset, stage, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/jobs?access_token={2}".format( mapbox_api, tileset, mapbox_token ) if stage: url = "{0}/tilesets/v1/{1}/jobs?stage={2}&access_token={3}".format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_jobs():\n\n jobs = Job.get_all()\n\n oneoffs = OneOff.get_all()\n\n job = JobView(None, jobs, oneoffs, False, Job.count() > 0)\n\n add_trello_task_links_to_g()\n\n return render_template(\"jobs.template.html\", page_title=\"Jobs\", job_info=job)", "def job(tileset, job_id, token=None, inde...
[ "0.7152179", "0.71383125", "0.6330445", "0.6263424", "0.6214478", "0.6188785", "0.61780936", "0.61448723", "0.60901165", "0.6074674", "0.6017765", "0.6007803", "0.59747595", "0.59221345", "0.589214", "0.5855021", "0.5803626", "0.57746786", "0.57746786", "0.5773371", "0.575212...
0.75485474
0
View a single job for a particular tileset. tilesets job
def job(tileset, job_id, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/jobs/{2}?access_token={3}".format( mapbox_api, tileset, job_id, mapbox_token ) r = requests.get(url) click.echo(json.dumps(r.json(), indent=indent))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_job(options, job_name, client):\n if options.show_events:\n return display_events(client.job_events(job_name))\n\n job_content = client.job(job_name)\n return display.DisplayJobs(options).format_job(job_content)", "async def job_detail(request, job_id=None):\n current_jobs = dagobah._...
[ "0.69182616", "0.6617653", "0.63476014", "0.62747604", "0.62315136", "0.60969406", "0.6079476", "0.5952673", "0.58088917", "0.5790628", "0.5686428", "0.5582579", "0.5581716", "0.55650765", "0.5540786", "0.55388176", "0.5536627", "0.55236", "0.55182064", "0.5472965", "0.544627...
0.7312882
0
List all tilesets for an account. By default the response is a simple list of tileset IDs. If you would like an array of all tileset's information, use the versbose flag. tilests list
def list(username, verbose, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}?access_token={2}".format( mapbox_api, username, mapbox_token ) r = requests.get(url) if r.status_code == 200: if verbose: for tile...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_tile_list():\n return {\n \"version\": 1,\n \"revision\": 1,\n \"timestamp\": \"2018-06-19T23:04:32.442Z\",\n \"timestamp_ms\": 1529449472442,\n \"result_code\": 0,\n \"result\": [\n {\n \"tileType\": \"TILE\",\n \"us...
[ "0.6313657", "0.5784542", "0.5680937", "0.56709623", "0.5668289", "0.56286174", "0.56016797", "0.55826", "0.5550821", "0.5427271", "0.535748", "0.5275198", "0.52157974", "0.5204004", "0.5186647", "0.51531774", "0.5109934", "0.51063216", "0.5066046", "0.5051925", "0.50334436",...
0.7860446
0
Validate a Recipe JSON document tilesets validaterecipe
def validate_recipe(recipe, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/validateRecipe?access_token={1}".format( mapbox_api, mapbox_token ) with open(recipe) as json_recipe: recipe_json = json.load(json_recipe) r ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_recipe(environ, recipe):\n try:\n validate_recipe(recipe, environ)\n except InvalidBagError as exc:\n raise HTTP409('Recipe content is invalid: %s' % exc)", "def check_recipe(recipe, data_directory=None):\n # check recipe is a dictionary\n if not isinstance(recipe, dict):\...
[ "0.63595736", "0.60863644", "0.5877467", "0.5658971", "0.544159", "0.5438701", "0.54253197", "0.5409057", "0.53850645", "0.5367168", "0.53094155", "0.5285954", "0.5279377", "0.5246911", "0.5224074", "0.5209505", "0.52058226", "0.50977165", "0.5095339", "0.50936866", "0.509328...
0.72382593
0
View a tileset's recipe JSON tilesets viewrecipe
def view_recipe(tileset, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/recipe?access_token={2}".format( mapbox_api, tileset, mapbox_token ) r = requests.get(url) if r.status_code == 200: click.echo(json.dumps(r.json(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_recipe(request, recipe, **_kwargs):\n return render(request, \"deployments/disp_recipe.html\", {\"recipe\": recipe})", "def recipe(id):\n\n selected_recipe = mongo.db.recipes.find_one({'_id': ObjectId(id)})\n\n # Using create list function to display these sections easier\n display_method = ...
[ "0.6430486", "0.6278637", "0.60368425", "0.60243356", "0.60141695", "0.5860817", "0.585936", "0.58377564", "0.58284754", "0.57778907", "0.5770112", "0.5763494", "0.5761875", "0.5735329", "0.57243955", "0.5721431", "0.5719946", "0.5699056", "0.5689098", "0.5674704", "0.5661595...
0.8028861
0
Update a Recipe JSON document for a particular tileset tilesets updaterecipe
def update_recipe(tileset, recipe, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/recipe?access_token={2}".format( mapbox_api, tileset, mapbox_token ) with open(recipe) as json_recipe: recipe_json = json.load(json_recipe)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_full_update_recipe(self):\n recipe = sample_recipe()\n recipe.ingredients.create(name='Eggs')\n original_description = recipe.description\n\n payload = {\n 'name': 'Vegan gnocchi',\n 'ingredients': [{'name': 'Vegegg'}]\n }\n url = recipe_deta...
[ "0.6287885", "0.62047666", "0.61583877", "0.6145476", "0.61356527", "0.612758", "0.6121439", "0.6084628", "0.5905411", "0.5889674", "0.5887126", "0.58802575", "0.5874741", "0.58549875", "0.5836796", "0.5829042", "0.5811349", "0.58038753", "0.57788795", "0.56087655", "0.559031...
0.7319158
0
Validate your source file. $ tilesets validatesource
def validate_source(features): click.echo(f"Validating features", err=True) for feature in features: utils.validate_geojson(feature) click.echo("✔ valid")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateSource(source):\n if not os.path.isfile(source):\n raise ShapeException('Source image not found')\n try:\n if imghdr.what(source) not in VALID_IMAGES:\n raise ShapeException('Source is not a valid image.')\n except TypeError:\n raise ...
[ "0.6696419", "0.6645326", "0.6275428", "0.62696326", "0.60603267", "0.6029202", "0.60171866", "0.597689", "0.5961857", "0.5901952", "0.5901552", "0.5900048", "0.5850723", "0.5847746", "0.58432066", "0.5825613", "0.5822421", "0.5814104", "0.5812179", "0.5792467", "0.5773302", ...
0.62247324
4
Create/add a tileset source tilesets addsource
def add_source(ctx, username, id, features, no_validation, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = ( f"{mapbox_api}/tilesets/v1/sources/{username}/{id}?access_token={mapbox_token}" ) with tempfile.TemporaryFile() as file: for feature ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _addSourceToTile(self, tile, sourceEntry, corners, scale):\n source = self._sources[sourceEntry['sourcenum']]\n ts = self._openSource(source, sourceEntry['kwargs'])\n # If tile is outside of bounding box, skip it\n bbox = source['bbox']\n if (corners[2][0] <= bbox['left'] or ...
[ "0.63106346", "0.6242407", "0.6181852", "0.5995432", "0.5959899", "0.59026515", "0.5895848", "0.5837343", "0.5822718", "0.5802456", "0.5723033", "0.5697263", "0.56536853", "0.5642326", "0.5624862", "0.5598968", "0.5473412", "0.54200363", "0.54169947", "0.5408778", "0.5397525"...
0.70931864
0
View a Tileset Source's information tilesets viewsource
def view_source(username, id, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/sources/{1}/{2}?access_token={3}".format( mapbox_api, username, id, mapbox_token ) r = requests.get(url) if r.status_code == 200: click.echo(jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_sources(username, token=None):\n mapbox_api = _get_api()\n mapbox_token = _get_token(token)\n url = \"{0}/tilesets/v1/sources/{1}?access_token={2}\".format(\n mapbox_api, username, mapbox_token\n )\n r = requests.get(url)\n if r.status_code == 200:\n for source in r.json():...
[ "0.57861507", "0.5623747", "0.54790926", "0.5461085", "0.544482", "0.53834367", "0.5382121", "0.5329366", "0.53023386", "0.5296684", "0.5284189", "0.5280753", "0.5255383", "0.52418125", "0.52131957", "0.5167571", "0.51532954", "0.51469177", "0.51326746", "0.5106873", "0.51036...
0.7161197
0
Delete a Tileset Source + all of its files. tilesets deletesource
def delete_source(username, id, force, token=None): if not force: click.confirm( "Are you sure you want to delete {0} {1}?".format(username, id), abort=True ) mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/sources/{1}/{2}?access_token={3}".for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, source):\n _source = self._source_prefix+source\n assert _source in self.cache.keys()\n del self.cache[_source]", "def __del__(self):\r\n train_data_sources = list(self._train_data.values())\r\n test_data_sources = list(self._test_data.values())\r\n all_...
[ "0.636035", "0.6173071", "0.60790503", "0.5987599", "0.5917638", "0.5863623", "0.58427405", "0.58380115", "0.5836744", "0.58044493", "0.5800107", "0.5758255", "0.5698515", "0.56531304", "0.56498647", "0.56251085", "0.55927056", "0.5576707", "0.55732995", "0.55669975", "0.5549...
0.6908297
0
List all Tileset Sources for an account. Response is an unordered array of sources. tilesets listsources
def list_sources(username, token=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/sources/{1}?access_token={2}".format( mapbox_api, username, mapbox_token ) r = requests.get(url) if r.status_code == 200: for source in r.json(): cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sources():\n url = base_url + \"sources\"\n params = {\"language\": \"en\"}\n resp = requests.get(url, params=params)\n data = resp.json()\n sources = [src['id'].strip() for src in data['sources']]\n print(\"all the sources:\")\n print(sources)\n return sources", "def get_sources(...
[ "0.7102343", "0.70275754", "0.6670911", "0.66414875", "0.6598273", "0.6418739", "0.63086843", "0.624363", "0.61829776", "0.61549807", "0.6057943", "0.60390824", "0.60325825", "0.6032255", "0.6019853", "0.600825", "0.59725916", "0.5939919", "0.5932034", "0.5928629", "0.5920800...
0.7821861
0
Returns a list of tweets matching a certain phrase (hashtag, word, etc.)
def search_tweets(q, count=100, result_type="recent"): return t.search.tweets(q=q, result_type=result_type, count=count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_by_hashtag(tweets: list, hashtag: str) -> list:\n tweets_with_hashtag = {} # findall(): Kui tekstis on rohkem kui üks regulaaravaldisele vastav alamsõne saab kõikide vastete järjendi moodustada funktsiooniga findall()\n pattern = r\"#\\w+\" # \\w : tähed, numbrid, alakriips, + : 1 või rohkem\n ...
[ "0.7142697", "0.7100457", "0.6930307", "0.67667294", "0.66168964", "0.6615334", "0.6612648", "0.6553347", "0.653473", "0.6523465", "0.6432451", "0.6315115", "0.6313982", "0.6313573", "0.6260093", "0.62319624", "0.6202652", "0.61971724", "0.61828244", "0.6172298", "0.61443394"...
0.64697844
10
Favorites tweets that match a certain phrase (hashtag, word, etc.)
def auto_fav(q, count=5, result_type="recent"): result = search_tweets(q, count, result_type) for tweet in result["statuses"]: try: # don't favorite your own tweets if tweet["user"]["screen_name"] == TWITTER_HANDLE: continue result = t.favorites.cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keep(tweet):\n text = tweet[\"Text\"].lower()\n hashtags = \" \".join(tweet[\"Hashtags\"]).lower()\n for word in keep_words:\n if word in text:\n # print(\"{} in text {}\".format(word, text))\n return True\n if word in hashtags:\n # print(\"{} in hashtags...
[ "0.69498086", "0.6639259", "0.6606243", "0.64730567", "0.6468642", "0.6389704", "0.62857056", "0.62474024", "0.6237758", "0.6198794", "0.61410093", "0.6137775", "0.6131543", "0.6126318", "0.60748243", "0.60424924", "0.6040713", "0.5978543", "0.59703326", "0.5945469", "0.59222...
0.6507708
3
Retweets tweets that match a certain phrase (hashtag, word, etc.)
def auto_rt(q, count=1, result_type="recent"): result = search_tweets(q, count, result_type) for tweet in result["statuses"]: try: # don't retweet your own tweets if tweet["user"]["screen_name"] == TWITTER_HANDLE: continue result = t.statuses.retwee...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_word_finder(word1,word2,text):\r\n word1 = word1.lower()\r\n word2 = word2.lower()\r\n text = str(text).lower()\r\n if word1 and word2 in text:\r\n return True #return text to see specific tweets\r\n return False", "def searchTweets():\n if 'api' not in globals():\n ...
[ "0.7105514", "0.69805616", "0.6976142", "0.6756619", "0.66342497", "0.6593964", "0.6430638", "0.63529456", "0.6340623", "0.62740755", "0.62429124", "0.6205182", "0.6183677", "0.6167547", "0.6147273", "0.61250204", "0.61221504", "0.6089658", "0.60785997", "0.60453033", "0.6032...
0.0
-1
Returns list of users the bot has already followed.
def get_do_not_follow_list(): # make sure the "already followed" file exists if not os.path.isfile(ALREADY_FOLLOWED_FILE): with open(ALREADY_FOLLOWED_FILE, "w") as out_file: out_file.write("") # read in the list of user IDs that the bot has already followed in the # past ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_follows(self):\n return [c.id for c in self.conf.follows]", "def getFollowers():\n followers = []\n next_max_id = True\n while next_max_id:\n # first iteration hack\n if next_max_id is True:\n next_max_id = ''\n\n _ = GetInstagra...
[ "0.69194794", "0.6886889", "0.68394905", "0.6792048", "0.67707", "0.6648926", "0.66218495", "0.65348476", "0.65341395", "0.6531563", "0.64827514", "0.6482435", "0.6460146", "0.64417636", "0.64102614", "0.640211", "0.63860524", "0.63545257", "0.635387", "0.6332258", "0.6328119...
0.6834242
3
Follows anyone who tweets about a specific phrase (hashtag, word, etc.)
def auto_follow(q, count=1, result_type="recent"): result = search_tweets(q, count, result_type) following = set(t.friends.ids(screen_name=TWITTER_HANDLE)["ids"]) do_not_follow = get_do_not_follow_list() for tweet in result["statuses"]: try: if (tweet["user"]["screen_name"] != TWIT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reply_to_tweets():\n last_seen_id = retrieve_last_seen_id(FILE_NAME)\n mentions = api.mentions_timeline(\n last_seen_id,\n tweet_mode='extended')\n\n for mention in reversed(mentions):\n print(str(mention.id) + ' - ' + mention.full_text, flush=True)\n last_seen_id = mention...
[ "0.7187562", "0.6514674", "0.63038933", "0.62657815", "0.6236046", "0.62126845", "0.61821735", "0.6114621", "0.6068988", "0.6059423", "0.6033002", "0.5977076", "0.59490186", "0.5944211", "0.5915049", "0.5908332", "0.59074265", "0.59028906", "0.58801764", "0.58654356", "0.5860...
0.62884736
3
Follows the followers of a user
def auto_follow_followers_for_user(user_screen_name, count=5): following = set(t.friends.ids(screen_name=TWITTER_HANDLE)["ids"]) followers_for_user = set(t.followers.ids(screen_name=user_screen_name)["ids"][:count]); do_not_follow = get_do_not_follow_list() for user_id in followers_for_user: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follow_user(cls, user, following):\r\n pass", "def follow_user(cls, user, following):\n pass", "def follow(self, follower, followee):\n pass", "def follow_followers(self):\n self.logger.log(\"starting follow_followers...\")\n follow = perform_with_ran_delay(self.instagr...
[ "0.84074855", "0.8322308", "0.80839336", "0.79454315", "0.7784225", "0.7753276", "0.7748424", "0.7748424", "0.7657068", "0.758209", "0.75808793", "0.75617784", "0.75339836", "0.7445854", "0.7444906", "0.7435006", "0.7433624", "0.7433624", "0.7433624", "0.7433624", "0.7409177"...
0.70788556
47
Follows back everyone who's followed you
def auto_follow_followers(): following = set(t.friends.ids(screen_name=TWITTER_HANDLE)["ids"]) followers = set(t.followers.ids(screen_name=TWITTER_HANDLE)["ids"]) not_following_back = followers - following for user_id in not_following_back: try: t.friendships.create(user_id=user_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follow(self, follower, followee):\n pass", "def follow_user(cls, user, following):\r\n pass", "def author_following(self):\n\t\tpass", "def user_follow():\n data = request.get_json(force=True)\n follower = User.query.get(data['follower'])\n following = User.query.get(data['followin...
[ "0.7804903", "0.7517027", "0.7427908", "0.7388741", "0.732171", "0.7260585", "0.72381175", "0.7165132", "0.7156749", "0.712556", "0.7086118", "0.7050882", "0.69780487", "0.6961415", "0.6956244", "0.6956244", "0.6944516", "0.69404787", "0.6928964", "0.69156355", "0.68406665", ...
0.7198094
7
Unfollows everyone who hasn't followed you back
def auto_unfollow_nonfollowers(): following = set(t.friends.ids(screen_name=TWITTER_HANDLE)["ids"]) followers = set(t.followers.ids(screen_name=TWITTER_HANDLE)["ids"]) # put user IDs here that you want to keep following even if they don't # follow you back users_keep_following = set([]) not_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_unfollow():\n data = request.get_json(force=True)\n follower = User.query.get(data['follower'])\n following = User.query.get(data['following'])\n follower.followcheck.remove(following)\n db.session.commit()\n return {'unfollowed': True}", "def unfollow(self, other):\n\t\tif self.follow...
[ "0.82762796", "0.8009202", "0.79544", "0.79389596", "0.78107613", "0.7790903", "0.7778263", "0.7770787", "0.7754866", "0.7753583", "0.77530307", "0.77448803", "0.7620163", "0.76050144", "0.7601129", "0.7597027", "0.75560814", "0.7501844", "0.7492976", "0.7484456", "0.74831533...
0.7816306
4
Mutes everyone that you are following
def auto_mute_following(): following = set(t.friends.ids(screen_name=TWITTER_HANDLE)["ids"]) muted = set(t.mutes.users.ids(screen_name=TWITTER_HANDLE)["ids"]) not_muted = following - muted # put user IDs of people you do not want to mute here users_keep_unmuted = set([]) # mute al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follow_reciprocated(self, target):\n if random.randint(1, 1000) == 1: # 1 in 20 are public @replies\n self.tweet_user(target)\n else:\n try:\n self.dm_user(target)\n except:\n pass", "def author_following(self):\n\t\tpass", "def f...
[ "0.6377603", "0.6330849", "0.6264719", "0.6097981", "0.60914946", "0.60311484", "0.57444423", "0.5744262", "0.57255733", "0.5723841", "0.56434613", "0.5592666", "0.554689", "0.55407053", "0.552391", "0.55216295", "0.55041254", "0.54987043", "0.5481601", "0.54815555", "0.54575...
0.68102974
0
Unmutes everyone that you have muted
def auto_unmute(): muted = set(t.mutes.users.ids(screen_name=TWITTER_HANDLE)["ids"]) # put user IDs of people you want to remain muted here users_keep_muted = set([]) # mute all for user_id in muted: if user_id not in users_keep_muted: t.mutes.users.destroy(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def unmute(self, ctx, user: Redeemed):\n if member == None or member == ctx.message.author:\n await ctx.send(\"You cannot unmute yourself!\")\n return \n await user.remove_roles(discord.utils.get(ctx.guild.roles, name=\"Muted\"))\n await ctx.send(f\"{user.mention}...
[ "0.7793159", "0.7562203", "0.7182035", "0.71422404", "0.71150947", "0.70955354", "0.7093954", "0.709301", "0.7084421", "0.7016341", "0.7013622", "0.68202204", "0.68122566", "0.67613274", "0.6734327", "0.6710592", "0.665197", "0.6545975", "0.6484686", "0.6455824", "0.64350253"...
0.8222266
0
Generate one random control character.
def make_control_character(): # Add one character made up of one codepoint each from # (High Surrogates + High Private Use Surrogates) and Low Surrogates. # We expect each such pair to behave as a single high-codepoint # character. controls = ('0000', '001F') return [unicode_char(char) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_charachter() -> chr:\r\n return chr(int(random.randrange(32, 126, 1)))", "def random_char():\n return chr(random.randrange(32, 126, 1))", "def get_random_char():\n return chr(randint(97, 122))", "def random_char(alph):\n char = alph[rand_generator.randrange(len(alph))]\n return char...
[ "0.78689873", "0.77449274", "0.72392774", "0.713114", "0.69535005", "0.68568593", "0.68473285", "0.6614242", "0.6555148", "0.65427595", "0.65427595", "0.6520578", "0.6508524", "0.643668", "0.636383", "0.63543737", "0.63341427", "0.62676865", "0.6259865", "0.6254233", "0.62498...
0.69967866
4
Extend `unichr` for all possible Unicode values (n).
def unicode_char(n): try: return unichr(n) except ValueError: # Generate bytes object packed as int. bytes_object = struct.pack('i', n) # Return decoded w/ utf-32 codec. return bytes_object.decode('utf-32')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int_to_unichr(codepoint):\n if PY2:\n return unichr(codepoint)\n return chr(codepoint)", "def make_unicode():\r\n for num in range(300, 320):\r\n yield unichr(num)", "def safe_unichr(intval):\n try:\n return unichr(intval)\n except ValueError:\n # ValueError: unic...
[ "0.68852764", "0.6683728", "0.6391506", "0.59930366", "0.586188", "0.58399165", "0.58334017", "0.5817205", "0.56382495", "0.5589591", "0.55534005", "0.54915816", "0.5490308", "0.5472899", "0.5450932", "0.5440723", "0.54287136", "0.5352844", "0.53169405", "0.5304779", "0.52560...
0.7051785
0
Test ``create_engine`` with invalid adapter.
def test_create_engine_no_adapters(): engine = create_engine("shillelagh://") with pytest.raises(ProgrammingError) as excinfo: Table("dummy://", MetaData(bind=engine), autoload=True) assert str(excinfo.value) == "Unsupported table: dummy://"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_engine_exists():\n # Check if engine is present\n if not is_engine_binded():\n print(\"Binding new engine\")\n bind_engine(create_engine(\"sqlite:///:memory:\", echo=True))", "def test_engine(self):\n config = {\n \"url\": 'sqlite://',\n \"connect_args\...
[ "0.68235004", "0.66725576", "0.6549929", "0.6455361", "0.62477577", "0.6210242", "0.61840785", "0.61660314", "0.6095915", "0.60754657", "0.60633755", "0.6048799", "0.59452164", "0.5927696", "0.58780146", "0.5844836", "0.5800548", "0.57547444", "0.5749329", "0.57365346", "0.57...
0.83949554
0
init the class object and simply pass either twitter object or tweets plain text to this method. The analysis will return a list indicating the polarity and subjectivity of the tweets.
def analyse(self, tweet): if (type(tweet) == dict): text = self.clean_tweet(self.to_text(tweet)) else: text = self.clean_tweet(tweet) analysis = TextBlob(text) polarity = analysis.polarity subjectivity = analysis.subjectivity res = [] #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, tweet_json):\r\n self.tweet = tweet_json\r\n self.date = datetime.datetime.strptime(self.tweet[\"date\"], \"%Y-%m-%dT%H:%M:%S.000Z\")\r\n self.processed = False\r\n self.max_importance = 0\r\n try:\r\n text = re.sub(self.tweet[\"keywords\"][0], '', s...
[ "0.6772969", "0.66310155", "0.6570511", "0.6479291", "0.64774686", "0.6471122", "0.63829994", "0.63479525", "0.6342602", "0.6246067", "0.6185657", "0.6146315", "0.61160105", "0.6048045", "0.6047929", "0.6042262", "0.6041226", "0.6035858", "0.60260266", "0.60242325", "0.600587...
0.74163216
0
Load a saved model/walker
def load_walker(self, filename=None, state=0): if filename is not None: print('Loading Walker: ' + filename + '...') err, _ = vrep.simxLoadModel(self.client_id, filename, state, OP_MODE) if err not in VALID_ERROR_CODES: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(path_to_model):\n pass", "def load_model(self, path):\n pass", "def load_model(self):\n pass", "def load(\n self,\n modelLoadPath\n ):\n pass", "def load_model(self) -> Any:", "def __load_model(self):\n loaded = load(self.__file_name)\n...
[ "0.794677", "0.77330357", "0.769884", "0.76180816", "0.75892407", "0.74990684", "0.7497519", "0.7403218", "0.7356266", "0.7322656", "0.7167664", "0.7057581", "0.7057581", "0.69810086", "0.6977028", "0.6965842", "0.6963033", "0.6956336", "0.69005823", "0.68665224", "0.68664163...
0.69034487
18
Saves to the server side
def save_walker(self, name): print("Saving Walker {}".format(name)) err, _, _, _, _ = \ vrep.simxCallScriptFunction(self.client_id, "Walker", vrep.sim_scripttype_childscript, "saveModel_function", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save():", "def save():\n pass", "def save (self):\n pass", "def save(self):\n\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n ...
[ "0.79372615", "0.7796793", "0.75564486", "0.75108397", "0.7485289", "0.7485289", "0.7485289", "0.7485289", "0.7485289", "0.7459909", "0.743181", "0.7222632", "0.7222632", "0.7222632", "0.720784", "0.71515334", "0.7129591", "0.7129591", "0.7129591", "0.7122093", "0.70347965", ...
0.0
-1
Discrete Variable to Feature Convertor. var value of variable varname name of variable. lims = range of numbers lims = range of discretization. collapse = list with two binary vals. collapse all below lim[0] to lim[0] & collapse all above lim[1] to lim[1] e.g., fdict = discVar2Feature(8, 'positive adjective', lims = [1...
def discVar2Feature( var, varname, lims = [1,3], collapse = [False, False], ctxt = 'Has'): vals = xrange(lims[0], lims[1]+1) keystr = ctxt + ' %s ' + varname fdict = {keystr % val:False for val in vals} if collapse[0] == True: if lims[0] > var: var = lims[0] #va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discVar2FeatureOld( var, varname, lims = [1,5], collapse = [False, False], ctxt = 'contains'):\n nums = ['zero','one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']\n \n vals = range(lims[0], lims[1]+1) \n \n #init fdict\n fdict = dict() \n for k, val in en...
[ "0.7855145", "0.5295992", "0.5193816", "0.51229674", "0.5071455", "0.50275296", "0.4994465", "0.49909624", "0.48956412", "0.4888899", "0.48470324", "0.47712082", "0.4754599", "0.4749255", "0.47370207", "0.47250566", "0.46894085", "0.46833327", "0.46548498", "0.4644874", "0.46...
0.8257702
0
Discrete Variable to Feature Convertor. var value of variable varname name of variable. lims = range of numbers lims = range of discretization. collapse = list with two binary vals. collapse all below lim[0] to lim[0] & collapse all above lim[1] to lim[1] e.g., fdict = discVar2Feature(8, 'positive adjective', lims = [1...
def discVar2FeatureOld( var, varname, lims = [1,5], collapse = [False, False], ctxt = 'contains'): nums = ['zero','one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'] vals = range(lims[0], lims[1]+1) #init fdict fdict = dict() for k, val in enumerate(vals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discVar2Feature( var, varname, lims = [1,3], collapse = [False, False], ctxt = 'Has'):\n \n vals = xrange(lims[0], lims[1]+1) \n \n keystr = ctxt + ' %s ' + varname\n fdict = {keystr % val:False for val in vals} \n\n if collapse[0] == True:\n if lims[0] > var:\n var = lims[...
[ "0.8234406", "0.52805275", "0.5167155", "0.5081879", "0.50444704", "0.50157154", "0.49738747", "0.49235922", "0.4897217", "0.48730886", "0.48664978", "0.47522265", "0.47458404", "0.47244322", "0.47193447", "0.47139582", "0.47023058", "0.4691292", "0.46388435", "0.46278065", "...
0.784609
1
Check if featureVals contains FKEY This is a check to see if a core feature function has been previously computed.
def haskey(featureVals, fkey): try: featureVals[fkey] except KeyError: return False #warn(HASKEYMSG % (fkey)) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_feature_by_keys(service_data=None, service_keys=None, ns_data=None, ns_keys=None):\n\n if service_data and not isinstance(service_data, Exception) and service_keys:\n if _is_keyval_greater_than_value(service_data, service_keys):\n return True\n\n if ns_data and ns_keys:\n ...
[ "0.6286112", "0.60849124", "0.5997217", "0.58951616", "0.5878267", "0.5877975", "0.58187664", "0.57946813", "0.5696939", "0.5696939", "0.564731", "0.56072927", "0.55438966", "0.5499882", "0.5431996", "0.5373477", "0.53706175", "0.53663695", "0.536493", "0.53626704", "0.531663...
0.7618906
0
End detection. described in Eq. (50) of S. Watanabe et al "Hybrid CTC/Attention Architecture for EndtoEnd Speech Recognition"
def end_detect(ended_hyps, i, M=3, d_end=np.log(1 * np.exp(-10))): if len(ended_hyps) == 0: return False count = 0 best_hyp = sorted(ended_hyps, key=lambda x: x["score"], reverse=True)[0] for m in six.moves.range(M): # get ended_hyps with their length is i - m hyp_length = i - m ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_detect(ended_hyps, i, M=3, D_end=np.log(1 * np.exp(-10))):\n if len(ended_hyps) == 0:\n return False\n count = 0\n best_hyp = sorted(ended_hyps, key=lambda x: x[\"score\"], reverse=True)[0]\n for m in range(M):\n # get ended_hyps with their length is i - m\n hyp_length = i ...
[ "0.59446865", "0.5918407", "0.5820141", "0.5536501", "0.54732686", "0.5456574", "0.5447737", "0.541912", "0.53824407", "0.53753823", "0.53732294", "0.53102255", "0.5226697", "0.52063173", "0.51992583", "0.5165421", "0.51476526", "0.5133361", "0.5113841", "0.50879014", "0.5086...
0.5958459
0
Called for every row to allow subclasses to modify rows.
def build_modify_row(self, row_gen, p, source, row): from xlrd import xldate_as_tuple from datetime import date row['year'] = int(source.time) row['facility_status_date'] = date(*xldate_as_tuple(row['facility_status_date'],row_gen.workbook.datemode)[:3]) row.update(source.row_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setRow(self, row): \n self.row = row", "def format_row(self, row):\n raise NotImplementedError()", "def add_row(self, row):\n ...", "def iter_rows_raw(self, *args):\n\n for row in super().iter_rows_raw(*args):\n row[0] = row[1] # sequential catalog index not rig...
[ "0.70247316", "0.6973256", "0.6739629", "0.66780365", "0.663705", "0.65876734", "0.65684086", "0.6497517", "0.64002925", "0.6395719", "0.6366707", "0.63460535", "0.63453114", "0.63381773", "0.6335888", "0.6279478", "0.61753815", "0.6160647", "0.6157512", "0.61517364", "0.6142...
0.0
-1