query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Make a bar plot of a categorical variable, given as a field field_name in the structured array data. Field categories and their names are given in the dict field_categories.
def barplot(data, field_name, field_categories): categories, counts = np.unique(data[field_name], return_counts=True) fig = plt.figure(figsize=(4, 3)) axes = fig.add_axes([0, 0, 1, 1]) # left, bottom, width, height (range 0 to 1) axes.bar(range(len(categories)), counts, fc="gray") # fc is the face color axes.se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bar_plot(df, field_name, graph_title, threshold_value, x_axis_label, y_axis_label):\n\n x = df[field_name].value_counts().sort_values()\n x[x > threshold_value].plot(kind='barh', figsize=(12, 8), title=graph_title, x=x_axis_label, y=y_axis_label)\n return", "def category_bar_chart(df):\n label_na...
[ "0.62241316", "0.6152364", "0.5592704", "0.5530848", "0.55261475", "0.5514559", "0.5509452", "0.5494726", "0.549077", "0.54689884", "0.5450162", "0.5434566", "0.5409188", "0.538418", "0.536517", "0.5325083", "0.5314956", "0.5302128", "0.5273056", "0.5260679", "0.5229185", "...
0.8023683
0
divide the figure in (nx, ny) subplots
def __init__(self, nx, ny, nxsize=5.4, nysize=6.2): self.nx = nx self.ny = ny self.n = 1 plt.figure(figsize=(nysize*ny, nxsize*nx)) plt.subplot(nx, ny, self.n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_four_subplots():\n pass", "def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, apportion = None, debug = 0, *args, **kwargs):\n #Note: we use squeeze = False internally, then return axes according to the keyword\n fig, axes = pylab_subplots(nrows=nrows, ncols=ncols, share...
[ "0.7502299", "0.71985096", "0.6763827", "0.6570539", "0.65698874", "0.6540221", "0.6515875", "0.6473783", "0.6385505", "0.6382876", "0.6320926", "0.6312594", "0.6271411", "0.6214693", "0.6210137", "0.6206027", "0.620597", "0.6148369", "0.61265504", "0.6113325", "0.6111227", ...
0.7220459
1
locate in subplot i in figure
def __call__(self, i): plt.subplot(self.nx, self.ny, i) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subplotInterface(self, annotate = True, idx = 0, verbose = 1,\\\n align_base = \"cell_1\", scale = False, save = False,\\\n format = \"pdf\", dpi = 100, row = None,\\\n col = None):\n\n\n if type(idx) != list:\n \"\"\"Jus...
[ "0.63224703", "0.6281179", "0.59312135", "0.58704233", "0.580318", "0.5788824", "0.5757078", "0.575006", "0.57305676", "0.56653893", "0.5630787", "0.5624858", "0.5617859", "0.5590443", "0.5575057", "0.5545475", "0.55385506", "0.55196583", "0.5518725", "0.5510385", "0.5487405"...
0.671145
0
hist function extended to plot stattistics
def _hist(xs, bins=100, range=None, stats=('entries', 'mean', 'rms'), xylabels = (), stats_xypos=(0.1, 0.7), *args, **kargs): if (range==None): range = (np.min(xs), np.max(xs)) cc = hst.hist(xs, bins=bins, range=range, *args, **kargs); if (not stats): return cc ys, xedg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hist(self, bins):\n x = self.x\n plt.hist(x, bins)\n plt.xlabel('Observed Data')\n plt.ylabel('Frequency')\n plt.show()", "def plot_hist(self):\n labels = [self.get_class_str(action, obj)\n for (action, obj, subj, rec, beg, end) in self.action_clips]...
[ "0.700293", "0.6858992", "0.6851635", "0.6733778", "0.6721069", "0.67167056", "0.6709508", "0.6697659", "0.6695027", "0.66849524", "0.66489035", "0.66478205", "0.66446716", "0.6577029", "0.657074", "0.65556145", "0.65371954", "0.65273106", "0.6521044", "0.6478086", "0.6474529...
0.71179366
0
Insert first datapoint in the database.
def _insert_datapoint(self): # Insert if db_datapoint.idx_datapoint_exists(1) is False: record = Datapoint( id_datapoint=general.encode(self.reserved), agent_label=general.encode(self.reserved), agent_source=general.encode(self.reserved) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_datapoint(sql, parts):\n t = datetime.fromtimestamp(parts[0])\n humid = parts[1]\n temp_c = parts[2]\n temp_f = parts[3]\n heat_c = parts[4]\n heat_f = parts[5]\n c = sql.cursor()\n c.execute(\"INSERT INTO points VALUES (?,?,?,?,?,?)\",\n (t, humid, temp_c, temp_f, heat_c, ...
[ "0.66409856", "0.6614501", "0.6461848", "0.6433478", "0.6331537", "0.62894434", "0.623728", "0.6231327", "0.61550397", "0.61478513", "0.6059122", "0.60588497", "0.59783554", "0.59783554", "0.59761745", "0.5968749", "0.59624904", "0.59598815", "0.59538317", "0.59033364", "0.58...
0.7998137
0
Insert first department in the database.
def _insert_department(self): # Insert if db_department.idx_department_exists(1) is False: record = Department( code=general.encode(self.reserved), name=general.encode(self.reserved)) database = db.Database() database.add(record, 1102)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seed4():\n if Department.find_by_identity(app.config['SEED_DEPARTMENT']) is not None:\n return None\n\n params = {\n 'departmentname': 'testdept',\n 'deptowneremail': 'er.ritesh.mehta@gmail.com'\n }\n\n return Department(**params).save()", "def add_department():\n form = A...
[ "0.64102626", "0.63995546", "0.61741805", "0.61718684", "0.6119254", "0.60806566", "0.5931589", "0.5917951", "0.59139866", "0.5867223", "0.5838998", "0.5770903", "0.5567153", "0.54696494", "0.5416664", "0.5407628", "0.5407628", "0.53592044", "0.53505164", "0.5342802", "0.5284...
0.79333127
0
Insert first billcode in the database.
def _insert_billcode(self): # Insert if db_billcode.idx_billcode_exists(1) is False: record = Billcode( code=general.encode(self.reserved), name=general.encode(self.reserved)) database = db.Database() database.add(record, 1104)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, sql):\n try:\n # Execute the SQL command\n self.cursor.execute(sql)\n # Commit your changes in the database\n self.db.commit()\n except:\n # Rollback in case there is any error\n self.db.rollback()", "def insert_to_d...
[ "0.6301685", "0.6257179", "0.6171408", "0.6077293", "0.5851242", "0.57877386", "0.57575035", "0.5745975", "0.574445", "0.57382643", "0.57061344", "0.57061344", "0.57061344", "0.5701996", "0.56728", "0.5659489", "0.56475896", "0.56186724", "0.56084", "0.56060004", "0.559914", ...
0.82463765
0
Insert first agent and device in the database.
def _insert_agent_device(self): # Initialize key variables idx_agent = 1 idx_device = 1 # Add agent if db_agent.idx_agent_exists(idx_agent) is False: # Generate a UID and add a record in the database record = Agent( id_agent=general.encode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_into_db(self, database):\n\n # insert person\n keys = \"\"\n values = \"\"\n for key, value in self.person.items():\n # location\n if key == \"location\":\n # ensure location is in table\n database.select(f\"\"\"DO $do$ BEGI...
[ "0.5917118", "0.57357377", "0.5714411", "0.55926985", "0.5586116", "0.5455014", "0.54244137", "0.5374424", "0.5357495", "0.53562266", "0.5317439", "0.5317439", "0.5317439", "0.5261197", "0.52423173", "0.52157986", "0.5213579", "0.52010274", "0.5193928", "0.51743084", "0.51367...
0.7941295
0
Insert first config in the database.
def _insert_config(self): # Initialize key variables key_values = [('version', '0.0.0.0')] # Cycle through all the key value pairs for item in key_values: key = item[0] value = item[1] # Check if value exists and insert if not if db_confi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self):\n self.getDbRecord().insert()\n\n return", "def config_skeleton():\n config = Config()\n config.set_to_default()\n config.save()", "def config_db():", "def insert_db():\n populate_tables()", "def _save_to_database(self, data):\n self._logger.in...
[ "0.65543216", "0.6231456", "0.6197239", "0.618433", "0.61325914", "0.61080337", "0.61080337", "0.61080337", "0.6015693", "0.5981799", "0.5916322", "0.58256114", "0.58244497", "0.5773632", "0.57164454", "0.5700255", "0.5685849", "0.5667353", "0.565591", "0.56507236", "0.562257...
0.7516463
0
Setup daemon scripts and file permissions.
def setup(self): # Set bashrc file self._bashrc() # Return if not running script as root user if self.running_as_root is False: return # Return if user prompted doesn't exist if self.infoset_user_exists is False: return # Set file permis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_permissions():\n sudo('chown %s:%s -R %s' % (env.apache_user, env.apache_user, env.whole_path_symlinked))", "def setupEnvironment(self, chroot, rundir, nodaemon, umask, pidfile):\n daemon = not nodaemon\n\n if chroot is not None:\n os.chroot(chroot)\n if rundir ==...
[ "0.68749136", "0.63898104", "0.6315376", "0.61940134", "0.61697245", "0.6156293", "0.61302006", "0.6121493", "0.6063271", "0.604604", "0.60355693", "0.59841716", "0.5958335", "0.5945734", "0.5910354", "0.58855337", "0.5800965", "0.5783833", "0.57625", "0.57576156", "0.5748411...
0.6931322
0
Set bashrc file environment variables.
def _bashrc(self): # Initialize key variables root_directory = self.root_directory # Determine username to use if self.running_as_root is True: # Edit local user's bashrc file username = self.infoset_user else: # Edit selected user's bashrc fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_bash_profile():\n run('cat %(bash_profile)s >> ~/.bash_profile' % env)", "def bash(ctx):\n if os.environ.get('RUNNING_ON_DOCKER', False):\n prefix = 'docker-'\n else:\n prefix = ''\n\n file_name = prefix + 'bashrc'\n rcfile = os.path.join(os.path.dirname(__file__), 'data'...
[ "0.67692745", "0.66647166", "0.6390473", "0.60676485", "0.5944671", "0.58868504", "0.58868504", "0.58794713", "0.5842473", "0.58120805", "0.5724302", "0.5688453", "0.5672777", "0.55925816", "0.5587807", "0.5551319", "0.55474234", "0.55311364", "0.5530302", "0.55150586", "0.54...
0.73845375
0
Count the number of occurences of target_class in the data
def count_target_class_data(data, target_class): count = 0 for row in data: if row[0] == target_class: count += 1 return count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_target(self):\n tally = {}\n for obj in self.target:\n tally[obj] = 0\n\n ind = 0\n for label in self.labelList:\n filename = self.pathLabel + label\n f = open(filename, 'r')\n content = f.read().split('\\n')\n for line in...
[ "0.7505753", "0.70607", "0.6935497", "0.6678549", "0.6678549", "0.6678549", "0.66415346", "0.6629299", "0.6511362", "0.6496359", "0.64001685", "0.6392629", "0.63592434", "0.6350829", "0.63047993", "0.6290631", "0.62288123", "0.6221511", "0.6201017", "0.6199443", "0.6178533", ...
0.8777466
0
check if sequence a is a subsequence of b
def is_subsequence(a, b): i_a, i_b = 0, 0 while i_a < len(a) and i_b < len(b): if a[i_a].issubset(b[i_b]): i_a += 1 i_b += 1 return i_a == len(a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_subsequence(subseq, seq):\n n = len(seq)\n m = len(subseq)\n\n if m > n:\n return False\n\n i = 0 # index of seq\n j = 0 # index of subseq\n\n while i < n and j < m:\n if seq[i] == subseq[j]:\n j += 1\n i += 1\n\n return j == m", "def isSubsequence(x:...
[ "0.7517667", "0.75154275", "0.7415611", "0.7130467", "0.70990896", "0.7001119", "0.6875942", "0.6578957", "0.6524083", "0.65069354", "0.6502676", "0.64893323", "0.6413586", "0.64094514", "0.6328478", "0.6269901", "0.6263851", "0.6216728", "0.6101734", "0.60896814", "0.6042722...
0.8708662
0
Return itemset indices of b that itemset of a are included in
def subsequence_indices(a, b): index_b_mem = 0 indices_b = [] for index_a, itemset_a in enumerate(a): for index_b in range(index_b_mem, len(b)): if index_b == len(b) - 1: # we mark as finished index_b_mem = len(b) itemset_b = b[index_b] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memberIDs(a, b):\n bind = {}\n for i, elt in enumerate(b):\n if elt not in bind:\n bind[elt] = i\n return [bind.get(itm, None) for itm in a] # None can be replaced by any other \"not in b\" value", "def intersect(self, other):\n result = IntSet()\n map(result.insert,...
[ "0.6480096", "0.62859654", "0.6284794", "0.62498695", "0.62055707", "0.6100419", "0.60925007", "0.60800415", "0.6049581", "0.60341656", "0.60310316", "0.5903813", "0.59021163", "0.58024406", "0.5800228", "0.5716897", "0.567191", "0.5652813", "0.56439", "0.56128395", "0.560546...
0.74765635
0
Replaces all item in data by its encoding
def encode_data(data, item_to_encoding): for line in data: for i, itemset in enumerate(line[1:]): encoded_itemset = set() for item in itemset: encoded_itemset.add(item_to_encoding[item]) line[i + 1] = encoded_itemset return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def force_utf8(data):\n if isinstance(data, unicode):\n return data.encode(\"utf-8\")\n elif isinstance(data, list):\n return [force_utf8(i) for i in data]\n elif isinstance(data, dict):\n return {force_utf8(i): force_utf8(data[i]) for i in data}\n return data", "def SetDataEncod...
[ "0.66368276", "0.6455011", "0.6275243", "0.6227313", "0.621462", "0.61941475", "0.61907387", "0.61102164", "0.6099654", "0.6066702", "0.60402256", "0.60342956", "0.5956745", "0.59050936", "0.5870682", "0.58624417", "0.5813089", "0.57530445", "0.5732765", "0.57288027", "0.5712...
0.70406705
0
Tries to replace itself with the settings of a given model. Returns true if it succeeds or false if the current model can not represent the same set of values.
def exchange_model(self, model): if self.can_be_exchanged(model): self._browser = model._browser return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def models_are_equivalent(model_a: TopLevelOscalModel, model_b: TopLevelOscalModel) -> bool:\n # this will change the second model as a side-effect\n model_b.metadata.last_modified = model_a.metadata.last_modified\n return model_a == model_b", "def _compare_settings(self, settings, original_fields):\r\n...
[ "0.54065675", "0.52343124", "0.52181566", "0.5195714", "0.5108508", "0.51036304", "0.5078762", "0.50757647", "0.5062585", "0.50535893", "0.50410616", "0.50374234", "0.50266767", "0.5018507", "0.5015829", "0.4978108", "0.49635047", "0.4953279", "0.4943368", "0.49315923", "0.49...
0.6060511
0
Ensures that there are exactly 'request_lists' number of content lists. Returns whether a change was needed or not.
def _fit_content_lists(self, requested_lists): raise requested_lists > 0 or AssertionError if requested_lists != self._num_contents: while requested_lists < self._num_contents: self._pop_content_list() while requested_lists > self._num_contents: s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_request_more():\n # Note: Files are restored in pairs (so we multiply by 2)\n active_requests = jobtracker.query(\"SELECT IFNULL(SUM(numrequested), 0) \" \\\n \"FROM requests \" \\\n \"WHERE status='waiting'\", fetchone=True)...
[ "0.6278202", "0.5973832", "0.59087783", "0.5907891", "0.5855553", "0.57828623", "0.57475185", "0.5690994", "0.5683942", "0.56583077", "0.56555396", "0.5647205", "0.5612722", "0.5565011", "0.55416954", "0.5533485", "0.55164355", "0.5491288", "0.54516184", "0.5421067", "0.54083...
0.6881133
0
After a series of push/pop/fit operations, this makes sure that we only have as many content lists referenced as necessary.
def _finalize_content_lists_change(self): while self._num_contents < len(self._contents): _, slot = self._contents.pop() self.disconnect_disconnectable(slot) raise self._num_contents == len(self._contents) or AssertionError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fit_content_lists(self, requested_lists):\n raise requested_lists > 0 or AssertionError\n if requested_lists != self._num_contents:\n while requested_lists < self._num_contents:\n self._pop_content_list()\n\n while requested_lists > self._num_contents:\n ...
[ "0.7201645", "0.55642855", "0.54273766", "0.53647256", "0.53465223", "0.5329691", "0.5302143", "0.52922094", "0.5268114", "0.5258695", "0.5258695", "0.5251591", "0.5224916", "0.5214627", "0.5214149", "0.5214149", "0.51835203", "0.5163969", "0.50850517", "0.5079492", "0.503490...
0.65103406
1
Returns the appropriate browser filter type for a given hotswap target.
def filter_type_for_hotswap_target(target): if isinstance(target, Live.Device.Device): if target.type == DeviceType.instrument: return FilterType.instrument_hotswap elif target.type == DeviceType.audio_effect: return FilterType.audio_effect_hotswap elif target.type ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_filter_type(filter_func):\r\n if hasattr(filter_func, 'contextfilter') or \\\r\n hasattr(filter_func, 'environmentfilter'):\r\n return JINJA2, False\r\n\r\n args = inspect.getargspec(filter_func)\r\n if len(args[0]) - (len(args[3]) if args[3] else 0) > 2:\r\n return JINJA...
[ "0.550746", "0.5350171", "0.5214283", "0.5172255", "0.51384073", "0.5098301", "0.5082551", "0.504926", "0.49898934", "0.49884063", "0.4926733", "0.49166557", "0.4882145", "0.48667943", "0.48643303", "0.48557383", "0.4853188", "0.47465545", "0.47167808", "0.46532175", "0.46306...
0.8288752
0
Factory that returns an appropriate browser model depending on the browser filter type and hotswap target.
def make_browser_model(browser, filter_type = None): factories = {FilterType.instrument_hotswap: make_instruments_browser_model, FilterType.drum_pad_hotswap: make_drum_pad_browser_model, FilterType.audio_effect_hotswap: make_audio_effect_browser_model, FilterType.midi_effect_hotswap: make_midi_effect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_browser(request):\n #get the META data about the browser type\n browser=request.META['HTTP_USER_AGENT']\n #make META data all lowercase\n browser=browser.lower()\n #for firefox\n if 'firefox' in browser:\n browser='firefox'\n #for chrome\n elif 'chrome' in browser:\n ...
[ "0.61912", "0.6001817", "0.5997133", "0.597749", "0.58534664", "0.5690751", "0.5627307", "0.5554387", "0.5523247", "0.5439414", "0.5395686", "0.5385105", "0.536546", "0.5281819", "0.5270705", "0.52703404", "0.52104986", "0.5208358", "0.51796514", "0.5151725", "0.51408345", ...
0.81959134
0
Creates the name of an item shortened by removing words from the parents name
def _shorten_item_name(self, shortening_limit, list_index, item_name): def is_short_enough(item_name): return len(item_name) <= 9 content_lists = self._browser_model.content_lists parent_lists = reversed(content_lists[max(0, list_index - 3):list_index]) for content_list in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _complete_name(self):\n for record in self:\n if record.parent_id:\n record.complete_name = record.parent_id.complete_name + ' / ' + record.name\n else:\n record.complete_name = record.name", "def generate_name_suggestion(self):\n if not self....
[ "0.66901696", "0.6240433", "0.61582357", "0.6134796", "0.6129895", "0.6053635", "0.6006241", "0.598846", "0.5954065", "0.5892455", "0.5827515", "0.58168906", "0.5776765", "0.57244366", "0.5722493", "0.57079446", "0.57067114", "0.57050925", "0.5695637", "0.56951994", "0.568722...
0.71447694
0
Monitor opening FIFO operation if timeout was expired (or disconnect was called in the meantime), then interrupt opening FIFO in other thread.
def _opening_monitor(self) -> None: timeout_time: float = time.time() + self._timeout while time.time() < timeout_time and not self._stop_waiting_for_opening.is_set(): if self._fifo_opened.is_set(): return time.sleep(0.1) self._stop_waiting_for_opening.set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unblock_open_fifo_operation(self) -> None:\n if os.path.exists(self._fifo_out_path):\n open(self._fifo_out_path, 'wb', buffering=0)\n if os.path.exists(self._fifo_in_path):\n open(self._fifo_in_path, 'rb', buffering=0)", "def ack_or_timeout(receiver):\n\n timeout_start...
[ "0.5875112", "0.5731592", "0.5588942", "0.54539853", "0.5290407", "0.52629447", "0.52584803", "0.5223161", "0.52226985", "0.5214648", "0.51609844", "0.5129125", "0.50584686", "0.5039045", "0.5037886", "0.5036288", "0.5028191", "0.50216097", "0.50216097", "0.49879858", "0.4974...
0.7664157
0
This is workaround for unblocking opening FIFO operation imitate opening FIFO "on the other side".
def _unblock_open_fifo_operation(self) -> None: if os.path.exists(self._fifo_out_path): open(self._fifo_out_path, 'wb', buffering=0) if os.path.exists(self._fifo_in_path): open(self._fifo_in_path, 'rb', buffering=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_fifo(self):\n if os.path.exists(self.fifo_path):\n os.remove(self.fifo_path)\n os.mkfifo(self.fifo_path)", "def _open_fifo(self, path, flags):\n collectd.info('Opening: %s' % path)\n if self._open_nonblock:\n # NOTE: Open non-blocking, to detect when th...
[ "0.6802569", "0.62895423", "0.6190773", "0.6061759", "0.5897779", "0.5859627", "0.5841202", "0.58050406", "0.5755729", "0.574868", "0.5717438", "0.5699288", "0.5688702", "0.5677355", "0.56472605", "0.56437516", "0.56407607", "0.56212544", "0.5571513", "0.5566992", "0.5514071"...
0.76129514
0
scrape and clean stuff up to save in a GameContainer which is just a shell to hold all needed data for parsing the container allows us to have a file that we can manually repair and reparse in the case of scoring errors
def scrape_to_container(gameid, cache_path=None, session=None, save_container=True): d = setup_scraper(gameid, cache_path, session) scraper, away_starting_lineup, home_starting_lineup, away_roster, home_roster = d #======================================================================= # Move into game...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def parse_replay(request, game):\n\n game = game.lower()\n replay_file = request.files.get(\"replay\")\n if replay_file:\n if game == STARCRAFT:\n basic, result = await SC2Replay.process_replay(replay_file, request.args.get(\"load_map\", False))\n if result:\n ...
[ "0.5883831", "0.5731385", "0.5504873", "0.543542", "0.54344803", "0.54229444", "0.54229164", "0.52950484", "0.52757853", "0.5214277", "0.5172111", "0.5169089", "0.5136626", "0.5134884", "0.50984156", "0.5005022", "0.49743158", "0.49637678", "0.4961036", "0.49550956", "0.49384...
0.63541466
0
simply redirect to dashboard
def index(self): log.debug('index()') return redirect_to('/admin/dashboard')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_dashboard():\n\treturn render_template(\"/dashboard.html\")", "def get(self):\n self.redirect('/admin')", "def get(self):\n self.redirect('/admin')", "def toLanding():\n return redirect(url_for('landingurl'))", "def dispatch(request):\n if request.user.is_admin:\n retur...
[ "0.7913281", "0.745907", "0.745907", "0.74100876", "0.73945457", "0.7383052", "0.7213817", "0.7201024", "0.7168231", "0.7139866", "0.70773005", "0.70773005", "0.70773005", "0.7049786", "0.6996893", "0.69752914", "0.6969216", "0.69509476", "0.6876307", "0.6867712", "0.682362",...
0.7543102
1
switch server ON or OFF (no param is toggle)
def toggle_server(self): name = request.params.get('name', g.DEFAULT_SERVER) log.debug('toggle_server(%s)' % name) servers = model.Session.query(model.Server) server = servers.filter(model.Server.name == name).one() server.server_on = not server.server_on model.Session.up...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _toggle_server(self):\r\n\t\t_logger.debug(\"Toggle server button is pressed.\")\r\n\r\n\t\tif not comm_server.is_running():\r\n\t\t\tserver_ip = self.children[\"entry_IP\"].get()\r\n\t\t\tserver_port = int(self.children[\"entry_port\"].get())\r\n\t\t\tif not comm_server.start_server(server_ip, server_port):\r...
[ "0.76402134", "0.71926904", "0.68771076", "0.663573", "0.655506", "0.64368844", "0.6404402", "0.63814354", "0.63383687", "0.6325942", "0.6312694", "0.6296537", "0.62616146", "0.62301064", "0.6228538", "0.61898726", "0.6149007", "0.61183274", "0.61173564", "0.6102371", "0.6095...
0.78646547
0
edit the settings of a station, or create a new one
def edit_station(self): mac = request.params.get('mac', g.DEFAULT_MAC) log.debug('edit_station(%s)' % mac) # collect desired request params into dictionary # XXX need to do form validation here items = request.params stations = model.Session.query(model.Station) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_settings(path, server, station):\n db.save_data(path, server, station)", "def _edit_setting(self):\n settings = fileIO.load_json(\"settings.json\")\n self._list_settings(settings=settings)\n option = False\n while not option: #While loop until valid setting given\n ...
[ "0.6273995", "0.59488606", "0.5932659", "0.59095985", "0.5875198", "0.5861084", "0.58298385", "0.55824786", "0.55695635", "0.5492336", "0.5476819", "0.54746765", "0.54738426", "0.54638255", "0.5434654", "0.5421887", "0.5418526", "0.5418469", "0.5399601", "0.5392158", "0.53798...
0.6632205
0
reset all stations to the default configuration
def reset_stations(self): # XXX currently everyone shares the default MAC mac = g.DEFAULT_MAC stations = model.Session.query(model.Station) station = stations.filter(model.Station.mac == mac).one() station.clone(model.Station()) model.Session.update(station) model...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset( self ):\n self.conf = self.defaults", "def reset_config():\r\n # TODO implement configuration reset\r\n pass", "def antenny_config_reset(self):\n return self.antenny_config.reset_default_config()", "def reset():\n Vessel.reset_instances()", "def reset(self):\n self....
[ "0.6853071", "0.68103075", "0.6650491", "0.6463266", "0.64595515", "0.64433664", "0.642196", "0.6405763", "0.6370755", "0.6367848", "0.6355455", "0.6312466", "0.62638384", "0.6220435", "0.6203902", "0.6186515", "0.618514", "0.6183243", "0.61750066", "0.614511", "0.6129231", ...
0.80534256
0
Takes a query string and returns up to n results from dfr.jstor.org.
def jstor(query_str, n):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _search(q: str, n: int):\n return search_client.retrieve([q], n)[0]", "def query(q, top_n=12):\n print('Query: ' + q + '; Top N: ' + str(top_n))\n\n driver = None\n bad_request = False\n urls = set()\n try:\n driver = Fetcher.get_selenium_driver()\n driver.get('https://api...
[ "0.6514424", "0.64358556", "0.61324334", "0.5951311", "0.589267", "0.5877768", "0.5805753", "0.57447416", "0.57253385", "0.5724489", "0.57081157", "0.5680368", "0.5673939", "0.5651415", "0.5615148", "0.56129974", "0.557348", "0.5568963", "0.5501987", "0.5501987", "0.54856455"...
0.67318326
0
Parse the boundary coordinates from a GenBankformatted flat file. The functions takes a Biopython SeqFeature object containing data that was parsed from the feature in the flat file. Parsing these coordinates can be tricky. There can be more than one set of coordinates if it is a compound location. Only features with 1...
def parse_coordinates(seqfeature): start_position = None stop_position = None start = -1 stop = -1 parts = 0 if (isinstance(seqfeature.location, FeatureLocation) or \ isinstance(seqfeature.location, CompoundLocation)): if seqfeature.strand is None: pass elif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseBoundaryField(fn):\n content = getFileContent(fn)\n if content is not None:\n return parseBoundaryContent(content)\n else:\n return None", "def get_bbox(fname):\r\n fname = fname.split('_') # fname -> list\r\n i = fname.index('bbox')\r\n return map(float, fname[i+1:i+5]) # m\r", "d...
[ "0.52373254", "0.50964826", "0.5067136", "0.5046825", "0.5045167", "0.5020805", "0.50203526", "0.4937692", "0.49202532", "0.4911355", "0.48771298", "0.4874154", "0.48680946", "0.48605794", "0.4844378", "0.4825628", "0.47997165", "0.479658", "0.47905588", "0.4760451", "0.47603...
0.5479175
0
Parse data from a Biopython CDS SeqFeature object into a Cds object.
def parse_cds_seqfeature(seqfeature): cds_ftr = cds.Cds() cds_ftr.seqfeature = seqfeature try: locus_tag = seqfeature.qualifiers["locus_tag"][0] except: locus_tag = "" finally: cds_ftr.set_locus_tag(locus_tag, delimiter=None) cds_ftr.set_orientation(seqfeature.strand, "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_cds_features(self, handle, alphabet=..., tags2id=...):\n ...", "def extract_cds(seq_record):\n return [f for f in seq_record.features if f.type == \"CDS\"]", "def process_cds(cfs, ref):\n # unpack the tuple\n feat, scaffold, phase = cfs\n # First, extract the sequence of the CDS fr...
[ "0.6618724", "0.6388655", "0.62729174", "0.571681", "0.56512153", "0.5595933", "0.55470765", "0.55052245", "0.5452013", "0.5344809", "0.53293115", "0.53277576", "0.5323969", "0.5287743", "0.51737297", "0.50894594", "0.50693136", "0.5034963", "0.5032553", "0.5020525", "0.50168...
0.7385726
0
Parse data from a Biopython tRNA SeqFeature object into a Trna object.
def parse_trna_seqfeature(seqfeature): trna_ftr = trna.Trna() trna_ftr.seqfeature = seqfeature try: locus_tag = seqfeature.qualifiers["locus_tag"][0] except (KeyError, IndexError): locus_tag = "" finally: trna_ftr.set_locus_tag(locus_tag, delimiter=None) trna_ftr.set_or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_tmrna_seqfeature(seqfeature):\n tmrna_ftr = tmrna.Tmrna()\n tmrna_ftr.seqfeature = seqfeature\n\n try:\n locus_tag = seqfeature.qualifiers[\"locus_tag\"][0]\n except (KeyError, IndexError):\n locus_tag = \"\"\n finally:\n tmrna_ftr.set_locus_tag(locus_tag, delimiter=No...
[ "0.7088515", "0.5894162", "0.54035914", "0.53238535", "0.5313058", "0.53036654", "0.528235", "0.52794975", "0.5255988", "0.52157354", "0.5066412", "0.50403583", "0.5033416", "0.501589", "0.5011236", "0.50101614", "0.50068706", "0.5001515", "0.49953058", "0.49833107", "0.49733...
0.75705236
0
Parses data from a BioPython tmRNA SeqFeature object into a Tmrna object.
def parse_tmrna_seqfeature(seqfeature): tmrna_ftr = tmrna.Tmrna() tmrna_ftr.seqfeature = seqfeature try: locus_tag = seqfeature.qualifiers["locus_tag"][0] except (KeyError, IndexError): locus_tag = "" finally: tmrna_ftr.set_locus_tag(locus_tag, delimiter=None) tmrna_ftr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_trna_seqfeature(seqfeature):\n trna_ftr = trna.Trna()\n trna_ftr.seqfeature = seqfeature\n\n try:\n locus_tag = seqfeature.qualifiers[\"locus_tag\"][0]\n except (KeyError, IndexError):\n locus_tag = \"\"\n finally:\n trna_ftr.set_locus_tag(locus_tag, delimiter=None)\n\...
[ "0.71053255", "0.57508117", "0.56290597", "0.55088407", "0.5436147", "0.53689307", "0.53286886", "0.52768457", "0.52746665", "0.5266213", "0.5193937", "0.5161827", "0.5149462", "0.51487356", "0.5133959", "0.50579363", "0.5048437", "0.5045914", "0.50262564", "0.5013615", "0.50...
0.7405606
0
Parses a Biopython Source SeqFeature.
def parse_source_seqfeature(seqfeature): src_ftr = source.Source() src_ftr.seqfeature = seqfeature start, stop, parts = parse_coordinates(seqfeature) src_ftr.start = start src_ftr.stop = stop try: src_ftr.organism = str(seqfeature.qualifiers["organism"][0]) except: src_ftr.o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_seqfeature(feature):\n if isinstance(feature, six.string_types):\n feature = feature_from_line(feature)\n\n qualifiers = {\n \"source\": [feature.source],\n \"score\": [feature.score],\n \"seqid\": [feature.seqid],\n \"frame\": [feature.frame],\n }\n qualifiers...
[ "0.6938026", "0.67124647", "0.64333224", "0.5949653", "0.580537", "0.57997847", "0.5682999", "0.56635153", "0.5602488", "0.55622095", "0.5510677", "0.5465436", "0.54645", "0.534558", "0.53260916", "0.52932435", "0.52316695", "0.52245367", "0.5222536", "0.5202381", "0.51751524...
0.7324228
0
Create a dictionary of Biopython SeqFeature objects based on their type. From a list of all Biopython SeqFeatures derived from a GenBankformatted flat file, create a dictionary of SeqFeatures based on their 'type' attribute.
def create_seqfeature_dictionary(seqfeature_list): seqfeature_type_set = set() seqfeature_dict = {} for seqfeature in seqfeature_list: seqfeature_type_set.add(seqfeature.type) for type in seqfeature_type_set: sublist = [] for index in range(len(seqfeature_list)): seq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cbf_file_to_basis_dict(path):\n import dxtbx.format.Registry\n reader = dxtbx.format.Registry.get_format_class_for_file(path)\n instance = reader(path)\n return map_detector_to_basis_dict(instance.get_detector())", "def _create_feature_dict(feature_table_file) -> dict:\n feature_dict = dict()\n wit...
[ "0.59509116", "0.5866959", "0.5769676", "0.568471", "0.56685895", "0.5634546", "0.5574579", "0.5568446", "0.55519086", "0.554404", "0.5521767", "0.55096895", "0.55072814", "0.5497107", "0.54693377", "0.54522717", "0.5439587", "0.54240304", "0.540727", "0.537465", "0.5333679",...
0.7171406
0
Parse data from a Biopython SeqRecord object into a Genome object. All Source, CDS, tRNA, and tmRNA features are parsed into their associated Source, Cds, Trna, and Tmrna objects.
def parse_genome_data(seqrecord, filepath=pathlib.Path(), translation_table=11, genome_id_field="_organism_name", gnm_type="", host_genus_field="_organism_host_genus"): # Keep track of the file from which the record is derived. gnm = genome.Genome() gnm.set_filename(filepath) gnm.type =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parser(raw_seq, date):\n taxon_id = int(raw_seq.features[0].qualifiers['db_xref'][0][6:])\n organism = raw_seq.annotations['organism']\n accession = raw_seq.annotations['accessions'][0]\n gene = []\n records = []\n frag_type = 'whole'\n begin = 1\n end = len(raw_seq)\n sequence = str...
[ "0.65917826", "0.5944873", "0.5835161", "0.5765218", "0.5681081", "0.5671689", "0.55402595", "0.54088056", "0.5357843", "0.53517663", "0.5294333", "0.5235795", "0.52263", "0.52156526", "0.5198588", "0.5175581", "0.51186824", "0.51084155", "0.50481284", "0.5037028", "0.5034998...
0.6747453
0
Creates a SeqRecord object from a pdm_utils Genome object.
def genome_to_seqrecord(phage_genome): assert phage_genome != None,\ "Genome object passed is None and not initialized" try: record = SeqRecord(phage_genome.seq) record.seq.alphabet = IUPAC.IUPACAmbiguousDNA() except AttributeError: print("Genome object failed to be converted to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_seq_record(self):\n\t\t#create the anotations in a pythonic manner\n\t\texempt = ['name', 'description', 'features', 'sequence'] #things which aren't annotations\n\t\tannotations = { }\n\t\tfor key, value in self.__dict__.iteritems():\n\t\t\tif key.lower() not in exempt:\n\t\t\t\tannotations[key] = value\n\...
[ "0.666563", "0.63349533", "0.61896443", "0.59928375", "0.59649557", "0.58573574", "0.57353216", "0.57348984", "0.56775516", "0.5654107", "0.56354314", "0.5570128", "0.5517305", "0.54365057", "0.54361284", "0.54074484", "0.53710055", "0.5333639", "0.52329975", "0.5215455", "0....
0.71668196
0
Helper function that uses Genome data to populate the annotations SeqRecord attribute
def get_seqrecord_annotations(phage_genome): annotations = {"molecule type": "DNA",\ "topology" : "linear",\ "data_file_division" : "PHG",\ "date" : "",\ "accessions" : [],\ "sequence_version" : "1",\ "keyword" : [],\ "source" : ""...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_seq_record(self):\n\t\t#create the anotations in a pythonic manner\n\t\texempt = ['name', 'description', 'features', 'sequence'] #things which aren't annotations\n\t\tannotations = { }\n\t\tfor key, value in self.__dict__.iteritems():\n\t\t\tif key.lower() not in exempt:\n\t\t\t\tannotations[key] = value\n\...
[ "0.61961854", "0.614041", "0.59840614", "0.59612197", "0.59370255", "0.5875188", "0.58745486", "0.5842022", "0.57989097", "0.57771647", "0.5719793", "0.57143587", "0.56944454", "0.56943953", "0.5606682", "0.5590644", "0.55596644", "0.55595595", "0.55420077", "0.5540718", "0.5...
0.6855981
0
Helper function that uses Genome data to populate the comment annotation attribute
def get_seqrecord_annotations_comments(phage_genome): if phage_genome.subcluster == "": cluster_comment = "Cluster: {}; Subcluster: None".format\ (phage_genome.cluster) else: cluster_comment = "Cluster: {}; Subcluster: {}".format\ (phage_genome.cluster, phage_geno...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init():\n\n # Complete our stop words set.\n add_extra_words()\n\n model = read_model(MODEL_FILE)\n model_keys = list(model.keys())\n\n # Basic random.\n new_comment = generate_comment(model=model, order=2,\n number_of_sentences=2,\n ...
[ "0.5940948", "0.5896796", "0.57457376", "0.56866765", "0.56605685", "0.5631936", "0.5573606", "0.55731833", "0.5529364", "0.54920137", "0.5472266", "0.54506373", "0.54092973", "0.5386058", "0.53741366", "0.5355898", "0.5355448", "0.5333661", "0.53121537", "0.5307911", "0.5288...
0.59162307
1
Create a fastaformatted Biopython SeqRecord object.
def create_fasta_seqrecord(header, sequence_string): seq = Seq(sequence_string, alphabet=IUPAC.unambiguous_dna) seqrecord = SeqRecord(seq, description=header) return seqrecord
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_seq_record(self):\n\t\t#create the anotations in a pythonic manner\n\t\texempt = ['name', 'description', 'features', 'sequence'] #things which aren't annotations\n\t\tannotations = { }\n\t\tfor key, value in self.__dict__.iteritems():\n\t\t\tif key.lower() not in exempt:\n\t\t\t\tannotations[key] = value\n\...
[ "0.8072106", "0.7331823", "0.6897975", "0.68514806", "0.6835495", "0.67624587", "0.67114806", "0.66011626", "0.6347892", "0.62518346", "0.60974985", "0.58882695", "0.5858205", "0.5857612", "0.5838891", "0.5797587", "0.57610375", "0.57281584", "0.5715485", "0.57087386", "0.570...
0.7524539
1
Relabel one file which is labeled
def relabel_one_file(file_path: Path, result_file: Path = None, label_items=LABEL_ITEMS): global all_files_labels logger.info(f'Processing file: {file_path}') file_name = file_path.stem # Load data df = pd.read_csv(file_path, index_col=False, comment='#') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_original_label(filename):\n original_label = filename.replace('.tab', '.lbl')\n original_label = original_label.replace('.txt', '.lbl')\n original_label = original_label.replace('.TAB', '.lbl')\n original_label = original_label.replace('.TXT', '.lbl')\n original_label = o...
[ "0.63218987", "0.6226931", "0.62268233", "0.62173223", "0.6149746", "0.6009117", "0.60019803", "0.59985584", "0.59711593", "0.5957811", "0.5940782", "0.59025943", "0.5864083", "0.5859577", "0.5859372", "0.5857351", "0.5856371", "0.5854134", "0.5827571", "0.5821693", "0.580701...
0.7301757
0
returns True if source was changed (cache revalidation is needed)
def source_changed(source, cache): return os.path.getmtime(source)>os.path.getmtime(cache)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasChanged(self):\n return ((self.mtime != getmtime(self.path)) or\n (self.size != os.path.getsize(self.path)) )", "def has_changed(self) -> bool:\n # TODO: Add in change logic here\n state = None\n if state != self._file_state:\n self._changed_flag = True\n ...
[ "0.68384165", "0.67520934", "0.67060685", "0.6670692", "0.6652378", "0.6626898", "0.6595107", "0.6590439", "0.65189856", "0.6509706", "0.64642346", "0.6343046", "0.6337292", "0.62796354", "0.62630564", "0.6256935", "0.6254536", "0.6247282", "0.62462795", "0.6181623", "0.61746...
0.8501976
0
returns CachedImage retrieved from cache or None
def get_image(self, processor, source, cache=None): cache = cache or self._get_cache_filename(processor, source) cache_path = os.path.join(self.cache_dir, cache) if os.path.exists(cache_path): return CachedImage(cache_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cached_item(self, path):\n item_path = '%s/%s' % (\n self.cache_folder,\n path.strip('/')\n )\n\n try:\n cf_object = self.container.get_object(item_path)\n except NoSuchObject:\n return False\n\n f = tempfile.NamedTe...
[ "0.7916652", "0.77383137", "0.7470543", "0.72071636", "0.70587105", "0.684402", "0.6749766", "0.6610611", "0.65577084", "0.6536232", "0.65349305", "0.6476579", "0.6444317", "0.6421493", "0.64117175", "0.64117175", "0.63977987", "0.6368785", "0.63677204", "0.63548386", "0.6354...
0.789398
1
returns processed PIL Image file path retrieved from cache or generated using processor
def get_image_file(self, processor, source, cache=None): cache = cache or self._get_cache_filename(processor, source) cache_path = os.path.join(self.cache_dir, cache) if not os.path.exists(cache_path) or source_changed(source, cache): processor.process(source).save(cache_path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_processed_path(self):\n\n return self.processed_img_path", "def get_image(self, processor, source, cache=None):\n cache = cache or self._get_cache_filename(processor, source)\n cache_path = os.path.join(self.cache_dir, cache)\n if os.path.exists(cache_path):\n retur...
[ "0.7165686", "0.7003112", "0.6352672", "0.6270706", "0.6210086", "0.6124692", "0.60887355", "0.60833514", "0.60302365", "0.60283566", "0.6013624", "0.6001999", "0.5993517", "0.59487355", "0.5870053", "0.5862867", "0.585564", "0.58496", "0.58461076", "0.5843072", "0.58290166",...
0.7657464
0
make md5 hash filename from source file properties and processor filters
def _get_cache_filename(self, processor, source): return '%s%s' % (str(hashlib.md5(str(processor.quality) + source\ + str(os.path.getsize(source)) \ + make_filters_hash(processor.filters) \ + source.encode('utf-8')).hexdigest()), os.path.splitext(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_field_md5(source_file, blocksize=65536):\n hasher = hashlib.md5()\n if source_file.closed:\n source_file.open('rb')\n buf = source_file.read(blocksize)\n while len(buf) > 0:\n hasher.update(buf)\n buf = source_file.read(blocksize)\n source_file.seek(0)\n return hashe...
[ "0.6519305", "0.63283056", "0.62906706", "0.62502766", "0.62337464", "0.62247896", "0.62084156", "0.6197898", "0.6172346", "0.60608166", "0.59985685", "0.5990981", "0.5989901", "0.5962435", "0.59557986", "0.59446186", "0.5944345", "0.59428257", "0.5932913", "0.5931676", "0.59...
0.7254631
0
Fit IV array to 2 Ic RSJ model and return arrays of fit params, error.
def fit2rsj_arr(iarr, varr, **kwargs): if 'guess' in kwargs: kwargs['guess'] = np.array(kwargs['guess']) # array type update = kwargs.get('updateguess', 0.95) n = len(iarr) npopt = 4 popt_arr, pcov_arr = np.zeros((n, npopt)), np.zeros((n, npopt, npopt)) for k in range(n): try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svmfit(itr,C):\r\n train_x, train_y, valid_x, valid_y=get_next_train_valid(itr)\r\n train_y=train_y.reshape(len(train_y),1)\r\n n = len(train_y)\r\n P = matrix(np.dot(train_x,train_x.T) * np.outer(train_y,train_y))\r\n q = matrix(-np.ones([n, 1], np.float64))\r\n G = matrix(np.vstack((-np.eye...
[ "0.56063974", "0.54226416", "0.5420667", "0.5295927", "0.52612674", "0.52542776", "0.5231817", "0.5189687", "0.51571906", "0.5116141", "0.5085025", "0.5074433", "0.5074433", "0.5074433", "0.5072969", "0.5034838", "0.50345165", "0.50255895", "0.49887204", "0.49887204", "0.4974...
0.59477234
0
Compare two ContentItem objects with each other in a weak way we only take the filename and path into consideration and ignore constraints (as the proper __eq__ method would do).
def _content_item_comparison_weak(item_a, item_b): if item_a is None or item_b is None: log.debug("Item is None") return False return item_a.get_xml() == item_b.get_xml()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return self.doc_type == other.doc_type and \\\n self.src == other.src and \\\n self.name == other.name", "def __eq__(self, other):\n contentsmatchfail = False\n equal = False\n for i in self.contents:\n if i in other.contents...
[ "0.66765034", "0.6653508", "0.6383707", "0.6308725", "0.6296383", "0.6288879", "0.6228396", "0.62265986", "0.6225754", "0.62123716", "0.6193374", "0.6163143", "0.61564714", "0.6117004", "0.60719264", "0.60421354", "0.60350317", "0.6013134", "0.6004329", "0.5997933", "0.599631...
0.71401227
0
Determines if the specified item should be kept. If this method returns False then the item will be filtered out of the CDS. In this implementation, we compare each item from the CDS against the touch input. We only keep items that do match the input.
def keep_item(self, content_item): return self._content_item_comparison_weak( content_item, self.touch_content_item )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def condition(keep_it, item):\n if keep_it:\n return item\n else:\n return not item", "def _apply_item(self, item: Item) -> bool:\n if self.locked:\n self.__locked = item.item_type != self.__key\n return not self.locked", "def retain_if(self, conditi...
[ "0.6118802", "0.5894216", "0.5867209", "0.57629687", "0.5717916", "0.5690692", "0.5572477", "0.5494828", "0.54161733", "0.5409092", "0.53812903", "0.5371803", "0.53713757", "0.5323428", "0.53209174", "0.527529", "0.5270618", "0.5258588", "0.5252858", "0.5237473", "0.5220362",...
0.6703609
0
Get marcels for each game
def get_marcels(goalies, date, df): goalies_marcels = [] for goalie in goalies: goalie_marcels = marcels_players(goalie, date, df) goalies_marcels.append({"goalie": goalie, "adj_fsv": goalie_marcels['fsv'], "gp": goalie_marcels['gp']}) return goalies_marcels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_meals():", "def get_all_games():\n games = brain.get_all_games()\n return games", "def get_teams():", "def get_mos_from_aps(self):\n rewards = dict() # saves the reward of each client from each ap\n for ap in self.aps:\n _, data = self.command_ap(ap.name, ap.port, ...
[ "0.6226665", "0.5985738", "0.56903183", "0.5650183", "0.5593422", "0.5577678", "0.5503695", "0.5473676", "0.54020166", "0.5368344", "0.53635", "0.53524166", "0.53257835", "0.5325075", "0.5287838", "0.5281853", "0.5265225", "0.5262602", "0.5246494", "0.52396417", "0.52058876",...
0.6752537
0
Loads a store file into a dictionary with keys as tuples (x,y) coords and values as the integer encoding what is there.
def load_store(filename): result = {} # Open file with open(filename, 'r') as file: # Read first character char = file.read(1) while char: # ; defines a new point if char == ";": # The next characters are of the form (x,y,e) cha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_file(self, filename):\n # clear datastore mape\n self._datastoreMap = {}\n # citanje filea\n with open(filename, 'rb') as f:\n binstr = f.read()\n inMap = pickle.loads(binstr)\n # za svaki kanal moramo dodati element u _datastoreMap\n ...
[ "0.6371407", "0.5922768", "0.57294613", "0.56840926", "0.5636541", "0.5611314", "0.558087", "0.55750114", "0.55637383", "0.55598134", "0.5546833", "0.5530001", "0.5480446", "0.5475486", "0.5475486", "0.5475411", "0.5465203", "0.54610336", "0.54399496", "0.5429055", "0.5410855...
0.79950714
0
Visualises the store, colour coded by section
def plot_results(store): plt.figure() c = 0 for i in store.keys(): plt.scatter(i[0], -1*i[1], color=get_colour(store[i])) c += 1 plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self):\n import Helpers\n for p in self.parts:\n color = (p[1][0]*255, p[1][1]*255, p[1][2]*255, 0)\n Helpers.show(p[0], color)", "def visualise(self):\n\n scores, education = self.get_data()\n self.write_data(scores, education)\n\n return True", ...
[ "0.621113", "0.58131015", "0.57735425", "0.56498563", "0.56281793", "0.5530164", "0.55135596", "0.54813457", "0.5477863", "0.5418798", "0.54141897", "0.53675026", "0.53595763", "0.53586966", "0.52963907", "0.5247792", "0.5236707", "0.52300817", "0.5226265", "0.5215034", "0.52...
0.6128887
1
map on the list of tensors unpacked from `elems` on dimension 0. The simplest version of `map_fn` repeatedly applies the callable `fn` to a sequence of elements from first to last. The elements are made of the tensors unpacked from `elems`. `dtype` is the data type of the return value of `fn`. Users must provide `dtype...
def map_fn(fn, elems, dtype=None, parallel_iterations=None, back_prop=True, swap_memory=False, infer_shape=True, name=None): if not callable(fn): raise TypeError("fn must be callable.") if isinstance(elems, sparse_tensor.SparseTensor): raise TypeError( "To perform a map on the values of ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map(self, fn, *iterables, **kwargs):\n fn = self._prepare_fn(fn)\n return self._self.map(fn, *iterables, **kwargs)", "def array_map(fn, arrs, n):\n # we shouldn't need a special case for n == 0, but NumPy complains about indexing into a zero-dimensional\n # array a using a[(Ellipsis,)].\n...
[ "0.58948135", "0.57702446", "0.56236166", "0.54255617", "0.542432", "0.54126114", "0.541121", "0.53815204", "0.5381166", "0.53656024", "0.5327522", "0.5287739", "0.5266946", "0.5264301", "0.52466375", "0.5220995", "0.5209663", "0.5201138", "0.5159362", "0.5151307", "0.5148298...
0.7334713
0
define how many pixels thick the grid hint is
def _grid_hint_size(self) -> int:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grid_width(self):\n # replace with your code\n return 0", "def get_grid_height(self):\n # replace with your code\n return 0", "def sizeHint(self):\n return self.minimumSize() * 3", "def get_grid_width(self):\r\n # replace with your code\r\n return self...
[ "0.6378773", "0.61242104", "0.6004149", "0.5950054", "0.59119844", "0.59119844", "0.5891236", "0.5891007", "0.5885277", "0.58248097", "0.58248097", "0.57842076", "0.57842076", "0.5780021", "0.5780021", "0.5767355", "0.5745657", "0.56863886", "0.5684655", "0.5684655", "0.56666...
0.8068411
0
Define a mapping from types that are implementations of BaseSpriteLoader to a dictionary that contain a chunk_size and a chunk_map
def _origin_map(self) -> Dict[Type[BaseSpriteLoader], chunk_map_type]:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _createMap(self):\n width = self.map_size[0] * self.chunk_size\n height = self.map_size[1] * self.chunk_size\n map_array = np.zeros((height, width), dtype=float)\n chunks = {}\n clist = []\n for i in range(0, self.map_size[0]*self.map_size[1]):\n chunks[i+1]...
[ "0.6178685", "0.57068276", "0.5565248", "0.54777354", "0.5474463", "0.54582816", "0.53941673", "0.5388777", "0.533501", "0.5314602", "0.52988505", "0.5262939", "0.52612567", "0.5257605", "0.52540195", "0.5243595", "0.519796", "0.51598465", "0.51360023", "0.50686884", "0.50672...
0.78368694
0
Send a request and return a response. If argument ``cache_key`` is not ``None``, session will check its cache before sending the request. For now, we don't support setting ``cache_key`` in ``request``. ``sticky_key`` is similar to ``cache_key`` except that it refers to an unbounded cache (thus the name "sticky"). If ar...
async def __call__(self, request, **kwargs): cache_key = kwargs.pop('cache_key', None) sticky_key = kwargs.pop('sticky_key', None) cache_revalidate = kwargs.pop('cache_revalidate', None) if cache_key is not None and sticky_key is not None: raise AssertionError( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, request, **kw):\r\n if request.method == 'GET':\r\n cached_response = self.controller.cached_request(request)\r\n if cached_response:\r\n return self.build_response(request, cached_response, from_cache=True)\r\n\r\n # check for etags and add hea...
[ "0.56710464", "0.5380218", "0.5277406", "0.51162297", "0.49647447", "0.49608576", "0.49380323", "0.4910418", "0.48294824", "0.4757973", "0.46899825", "0.46096906", "0.45851278", "0.45390433", "0.4521895", "0.45152617", "0.450051", "0.44955355", "0.44897163", "0.44563928", "0....
0.60925895
0
Update cookies with a dictlike object.
def update_cookies(self, cookie_dict): requests.cookies.cookiejar_from_dict( cookie_dict, self._session.cookies )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, cookie=None):\n if isinstance(cookie, str):\n self.__udpate_str(cookie)\n if isinstance(cookie, dict):\n self.__update_dict(cookie)\n if isinstance(cookie, requests.cookies.RequestsCookieJar):\n d = cookie.get_dict()\n for key, val i...
[ "0.7328599", "0.7113552", "0.7019901", "0.6602599", "0.6172265", "0.6155734", "0.6105894", "0.6006707", "0.5999476", "0.59140986", "0.5844728", "0.57702464", "0.5757035", "0.56695026", "0.56473345", "0.56406015", "0.5631936", "0.5561294", "0.55334646", "0.551439", "0.5495705"...
0.7592125
0
Send an HTTP request and return a response. If argument ``priority`` is not ``None``, the request is sent with priority (this requires ``PriorityExecutor``). For now, we do not support setting ``priority`` in ``request``.
async def send(self, request, **kwargs): priority = kwargs.pop('priority', None) if priority is None: future = self._executor.submit( self.send_blocking, request, **kwargs ) else: LOG.debug( 'send: priority=%r, %r, kwargs=%r', p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_request(self, http_request, **kwargs):\n # type: (HttpRequest, Any) -> HttpResponse\n http_request.url = self._client.format_url(http_request.url)\n stream = kwargs.pop(\"stream\", True)\n pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)\n ...
[ "0.55242413", "0.54918885", "0.545943", "0.54478884", "0.52762944", "0.51643455", "0.5151465", "0.505821", "0.5055705", "0.50430596", "0.50257236", "0.5018931", "0.5013865", "0.49931225", "0.49770147", "0.4931497", "0.49172196", "0.48725277", "0.4831139", "0.48177412", "0.479...
0.7391536
0
Send a request in a blocking manner. If ``stream`` is set to true, we will return the original response object, and will NOT copythenclose it to our response class. In this case, the caller is responsible for closing the response object. This does not implement rate limit nor retry.
def send_blocking(self, request, **kwargs): LOG.debug('send: %r, kwargs=%r', request, kwargs) # ``requests.Session.get`` and friends do a little more than # ``requests.Session.request``; so let's use the former. method = getattr(self._session, request.method.lower()) # ``kwargs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None):\n if self.rate_limit_handler:\n self.rate_limit_handler.pre_send(request)\n\n try:\n response = super().send(request, stream, timeout, verify, cert, proxies)\n except exceptions.Ret...
[ "0.7113001", "0.67975926", "0.673969", "0.6423465", "0.6422512", "0.6057528", "0.604382", "0.5993796", "0.58285165", "0.58225983", "0.57846904", "0.5776013", "0.57309645", "0.5710379", "0.566662", "0.5618056", "0.55856884", "0.5550998", "0.5527313", "0.55215275", "0.5517145",...
0.790529
0
Make a "copy" from a ``requests`` Response object. Note that this consumes the content of the ``source`` object, which forces ``source`` to read the whole response body from the server (and so we do not need to do this in the Sender class).
def __init__(self, source, content, *, _copy_history=True): self._content = content self.status_code = source.status_code self.headers = source.headers self.url = source.url if _copy_history: self.history = [ Response( r, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_response(context):\n context.response_copy = context.response.json()\n logging.debug('Successfully copied the response')", "def copy(self, dest):\n if not isinstance(dest, Request):\n raise ValueError(\"'%s' should be a sub-class of 'Request'\" % dest)\n return dest.update...
[ "0.677958", "0.59345746", "0.57835406", "0.55620325", "0.5471291", "0.5337002", "0.5294734", "0.52340436", "0.520091", "0.5153462", "0.5144874", "0.5106061", "0.5106061", "0.50697017", "0.5021026", "0.5019364", "0.5016278", "0.5000586", "0.49666125", "0.49373594", "0.49259564...
0.67062664
1
Parse response as an HTML document. Caller may pass ``encoding`` and ``errors`` to instructing us how to decode response content. This is useful because lxml's default is to silently skip the rest of the document when there is any encoding error in the middle. lxml's strictbutsilent policy is counterproductive because ...
def html(self, encoding=None, errors=None): if encoding and errors: string = self.content.decode(encoding=encoding, errors=errors) parser = _get_html_parser(None) else: ASSERT.none(errors) string = self.content parser = _get_html_parser( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def htmlParseDoc(cur, encoding):\n ret = libxml2mod.htmlParseDoc(cur, encoding)\n if ret is None:raise parserError('htmlParseDoc() failed')\n return xmlDoc(_obj=ret)", "def htmlParseDocument(self):\n ret = libxml2mod.htmlParseDocument(self._o)\n return ret", "def html_parser():\n retu...
[ "0.5807232", "0.5546697", "0.55118394", "0.5314366", "0.5302231", "0.51846737", "0.5178749", "0.5171138", "0.516803", "0.5043235", "0.49736738", "0.4957396", "0.49460128", "0.49409348", "0.49071482", "0.48973745", "0.4881638", "0.48738164", "0.48732352", "0.48569918", "0.4833...
0.71148086
0
Insert single record object in the collection
async def insert(self, record, collection: str): db_record = await self.database[collection].insert_one(record.dict(exclude={'id'})) return record
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, record):\n self.collection.insert(record)\n self.record = record\n\n return self", "def insert(self):\n self.getDbRecord().insert()\n\n return", "def insert_record(self):\r\n try:\r\n db.session.add(self)\r\n db.session.commit()\r\n...
[ "0.73335576", "0.728069", "0.72504306", "0.71881104", "0.7135278", "0.7135278", "0.7135278", "0.71175796", "0.70221514", "0.7010273", "0.6919808", "0.68871707", "0.68585205", "0.6805966", "0.6790478", "0.6775092", "0.674791", "0.6710327", "0.66818607", "0.66420037", "0.664176...
0.8090869
0
Method to get records from a collection based on key and value
async def get_by_value(self, collection: str, key: str, value): query = {key: value} db_records = self.database[collection].find(query) output_records = [] async for record in db_records: output_records.append(QuestionInDB(**record, id=record["_id"])) return output_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, key):\n return self.query(key)", "def find(self, key=None, lo=None, hi=None, reverse=None, include=False,\n txn=None, rec=None, default=None):\n it = self.values(key, lo, hi, reverse, None, include, txn, rec)\n v = next(it, default)\n if v is default ...
[ "0.6563864", "0.63076335", "0.6280453", "0.6171545", "0.613677", "0.6104942", "0.6096535", "0.6076541", "0.60433006", "0.59330887", "0.5929107", "0.5899685", "0.5890298", "0.5871584", "0.58656615", "0.5824654", "0.58050776", "0.5792954", "0.57815087", "0.57759804", "0.5770541...
0.75334543
0
r""" Helper function for performing convolution after upsampling.
def _upsample_conv(self, x, conv): return conv( F.interpolate(x, scale_factor=2, mode='bilinear', align_corners=False))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upsample_conv_2d(x, w, k=None, factor=2, gain=1, data_format='NCHW', impl='cuda', gpu=True):\r\n\r\n assert isinstance(factor, int) and factor >= 1\r\n\r\n # Check weight shape.\r\n w = tf.convert_to_tensor(w)\r\n assert w.shape.rank == 4\r\n convH = w.shape[0]\r\n con...
[ "0.67663765", "0.65779626", "0.6553816", "0.6398234", "0.6392767", "0.6387929", "0.63407", "0.6329719", "0.6299886", "0.6282646", "0.62362", "0.6212653", "0.6173056", "0.6152558", "0.61221737", "0.6120341", "0.6120341", "0.6120341", "0.60860676", "0.60844463", "0.6062132", ...
0.69547844
0
This funtion is to add the multiple link attributes to graph G
def add_multi_link_attributes(self, attr1,attr2, attr3): i = 0 for (u, v) in self.G.edges(): if self.checkKey(attr1, (u,v)) and self.checkKey(attr2, (u,v)) and self.checkKey(attr3, (u,v)): self.G.add_edge(u,v,w=attr1[(u,v)],c1=attr2[(u,v)], c2= attr3[(u,v)]) elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_link_attr(d: Dict):\n d.update({\"link\": urljoin(\"https://vdb-kasf1i23nr1kl2j4.rapid7.com/v1/content/\", d.get(\"identifier\"))})", "def _add_links_from_mergers(self):\n for i, node_name in enumerate(self.node_list):\n self.builder.addDirectedLink(node_name, self, islot=i)", "def add_...
[ "0.65256554", "0.6264825", "0.62624276", "0.60532814", "0.60358834", "0.6033251", "0.6006186", "0.59122646", "0.5909699", "0.5881892", "0.58349824", "0.5819813", "0.57816803", "0.5781342", "0.57540774", "0.57408094", "0.5718112", "0.5714831", "0.57105774", "0.5698091", "0.565...
0.7415763
0
This function is to remove edges in the rm_edge_list from G
def remove_Edge(self, rm_edge_list): self.G.remove_edges_from(rm_edge_list) self.G.edges() return self.G
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_edges(g, edgelist):\n for edge in edgelist:\n (u, v) = tuple(edge)\n g[u].remove(v)\n g[v].remove(u)", "def remove_edges(self, node: NodeKey) -> Edge:", "def remove_edge(self, edge: Edge) -> Edge:", "def delete_edges_from(self, edges: Iterable):\n for i, j in edges:\...
[ "0.7794919", "0.73144794", "0.7183438", "0.71494997", "0.70152396", "0.69617105", "0.68124664", "0.6739959", "0.67176265", "0.6659268", "0.6655754", "0.6595909", "0.6566617", "0.65123194", "0.6509404", "0.6497717", "0.64858997", "0.6465598", "0.6465135", "0.64296776", "0.6426...
0.7745967
1
This function is to find the path cost based on the additive costs
def additive_path_cost(self, path, attr): return sum([self.G[path[i]][path[i+1]][attr] for i in range(len(path)-1)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_cost(self, c, state1, action, state2):\n # This should probably just be 1 every state....\n return c + 1", "def path_cost(self, c, state1, action, state2):\n # This should probably just be 1 every state....\n return c + 1", "def path_cost(self, c, state1, move, state2):\n ...
[ "0.7617994", "0.7617994", "0.7597403", "0.7554137", "0.7527699", "0.74822974", "0.74822974", "0.74822974", "0.7429028", "0.72676957", "0.72414786", "0.711392", "0.6980379", "0.6906745", "0.6895414", "0.6795053", "0.67780983", "0.6749605", "0.67375493", "0.6723749", "0.6688599...
0.79299235
0
This function is to find the path cost based on the concave function
def calculate_path_cost_with_concave_function(self, path, attr1, attr2): c1 = max([self.G[path[i]][path[i+1]][attr1] for i in range(len(path)-1)]) c2 = max([self.G[path[i]][path[i+1]][attr2] for i in range(len(path)-1)]) return max([c1,c2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_cost(self, c, state1, action, state2):\n # This should probably just be 1 every state....\n return c + 1", "def path_cost(self, c, state1, action, state2):\n # This should probably just be 1 every state....\n return c + 1", "def path_cost(self, c, state1, action, state2):\n...
[ "0.7507695", "0.7507695", "0.74749666", "0.73756534", "0.73756534", "0.73756534", "0.72768503", "0.7256803", "0.7144491", "0.7008772", "0.6996443", "0.692127", "0.6799869", "0.6563299", "0.64602214", "0.6419999", "0.6410938", "0.63985276", "0.6318047", "0.6301476", "0.6279349...
0.79420674
0
Return True if G has a path from source to target, False otherwise.
def has_path(self, source, target): try: sp = nx.shortest_path(self.G, source, target) except nx.NetworkXNoPath: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_path_source(self) -> bool:\n\n return any(self.is_path_type(x) for x in self.parameters)", "def exists_path(self, start, end):\n return end in self.paths(start)", "def is_path(self, plays):\n edges = [self.ind_dict[p] for p in plays]\n path = [self.source]\n for i in ...
[ "0.6959824", "0.6836107", "0.68324447", "0.6604859", "0.6593845", "0.6593503", "0.64851725", "0.64775616", "0.6451273", "0.6392526", "0.6296195", "0.62843114", "0.62619346", "0.6250411", "0.6164813", "0.6146912", "0.6066695", "0.60657865", "0.60454684", "0.6038807", "0.602659...
0.85063815
0
This function is to find the optimal path from S to D with constraint L
def Optimum_prun_based_routing(self, S, D, L): if self.has_path(S, D): Shortest_path = nx.dijkstra_path(self.G, S, D, weight='w') Opt_path = Shortest_path PathConcave_cost = self.max_path_cost(Shortest_path, 'c1') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Option2_routing(self, S, D, L):\n if self.has_path(S, D): \n Shortest_path = nx.dijkstra_path(self.G, S, D, weight='w') \n Opt_path = Shortest_path\n path_cost_with_weighted_sum = self.calculate_path_cost_with_weighted_sum(Shortest_p...
[ "0.73995465", "0.73801374", "0.6814434", "0.6594097", "0.64776325", "0.619143", "0.609329", "0.60840875", "0.60799897", "0.6048444", "0.6044331", "0.60185933", "0.60175085", "0.5949434", "0.5947762", "0.59321314", "0.59200174", "0.5913112", "0.5887984", "0.5882185", "0.587206...
0.7894295
0
This function is to find the optimal path from S to D with constraint L by combining two concave matrics with concave function
def Option3_routing(self, S, D, L): if self.has_path(S, D): Shortest_path = nx.dijkstra_path(self.G, S, D, weight='w') Opt_path = Shortest_path path_cost_with_concave_function = self.calculate_path_cost_with_concave_function(Shortest_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Optimum_prun_based_routing(self, S, D, L):\n if self.has_path(S, D):\n \n Shortest_path = nx.dijkstra_path(self.G, S, D, weight='w') \n Opt_path = Shortest_path\n PathConcave_cost = self.max_path_cost(Shortest_path, 'c1') ...
[ "0.6558933", "0.62821716", "0.61626667", "0.6098481", "0.581593", "0.57655877", "0.5763163", "0.57363194", "0.5675206", "0.5596622", "0.5536808", "0.55302745", "0.55295086", "0.54934233", "0.54817027", "0.5479422", "0.54510534", "0.5447503", "0.5436156", "0.5408442", "0.54082...
0.63657045
1
Verify SSH Access with Root works.
def test_verify_ssh_access_with_root_works(driver):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def the_root_user_should_be_able_to_login_with_ssh(driver):\n assert ssh_result['result'], ssh_result['output']\n assert '..' in ssh_result['output'], ssh_result['output']", "def test_ssh(self):\n assert self.rc_conf.has_key('sshd_enable')\n assert self.rc_conf['sshd_enable'] == '\"YES\"'\n ...
[ "0.8164614", "0.76414716", "0.7162678", "0.6947462", "0.6803128", "0.6792433", "0.6751752", "0.67172444", "0.66793", "0.66309094", "0.663083", "0.6603524", "0.6576518", "0.65564007", "0.649722", "0.6473558", "0.64599997", "0.6431845", "0.63726485", "0.63556963", "0.6315167", ...
0.8793579
0
the browser is open navigate to "{nas_url}".
def the_browser_is_open_navigate_to_nas_url(driver, nas_url): if nas_url not in driver.current_url: driver.get(f"{nas_url}/ui/sessions/signin")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def the_browser_is_open_navigate_to_nas_url(driver, nas_url, request):\n depends(request, ['First_User', 'Setup_SSH'], scope='session')\n global host\n host = nas_url\n if nas_url not in driver.current_url:\n driver.get(f\"http://{nas_url}/ui/sessions/signin\")", "def the_browser_is_open_navig...
[ "0.80348057", "0.7913638", "0.7416739", "0.718283", "0.7099535", "0.7070255", "0.7025585", "0.6998565", "0.6980769", "0.6960713", "0.6910556", "0.6764071", "0.67598534", "0.67507684", "0.6718104", "0.67153645", "0.66919", "0.6680896", "0.6666685", "0.66450447", "0.6626909", ...
0.79244345
1
go to System Settings, click Services.
def go_to_system_settings_click_services(driver): rsc.Go_To_Service(driver)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_manual(self):\n try:\n webbrowser.open(\"https://openeo.org/documentation/1.0/qgis/#service-management\")\n except:\n pass", "def on_actionSettings_triggered(self):\n self.start_app(SettingsApp)", "def services(status):\n\n run(\"sudo sy...
[ "0.67575246", "0.6122552", "0.5932413", "0.5895286", "0.57974863", "0.5790793", "0.5771788", "0.5738168", "0.573721", "0.57223356", "0.57181805", "0.57047504", "0.56862456", "0.55873585", "0.5547596", "0.5486807", "0.5463146", "0.5442314", "0.5418023", "0.54111516", "0.538724...
0.8028309
0
the service page should open.
def the_service_page_should_open(driver): assert wait_on_element(driver, 5, xpaths.services.title) time.sleep(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_manual(self):\n try:\n webbrowser.open(\"https://openeo.org/documentation/1.0/qgis/#service-management\")\n except:\n pass", "def isBrowseable(self, service):\n\t\treturn False", "def test_open(self):\n page, resources = self.ghost.open(bas...
[ "0.6390198", "0.6162065", "0.6072125", "0.60534656", "0.6048276", "0.5947872", "0.58881843", "0.5836421", "0.57742107", "0.5757675", "0.5726324", "0.57130045", "0.57113594", "0.5677961", "0.5675672", "0.56657815", "0.56542724", "0.5652201", "0.5648147", "0.5630627", "0.562055...
0.75671417
0
press on configure(pencil) SSH.
def press_on_configure_ssh(driver): assert wait_on_element(driver, 5, xpaths.services.ssh_Service_Button, 'clickable') driver.find_element_by_xpath(xpaths.services.ssh_Service_Button).click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_config(self, args):\n self.config_command.cmdloop(\"Enter to config mode\")", "def open_ssh():\n print('Opening SSH...')", "def configure(username, password, domain):\n art = r'''\nWelcome! __ ___. .__\n_____ ____ ____ ____ __ __ _____/ |_____...
[ "0.65699154", "0.6418787", "0.62135017", "0.6209512", "0.6088588", "0.60334", "0.6016521", "0.6001123", "0.5966563", "0.5885682", "0.5823382", "0.5806015", "0.5788063", "0.57637227", "0.5755207", "0.5689586", "0.56737524", "0.5669383", "0.5639078", "0.5637163", "0.5633341", ...
0.7515753
0
the SSH General Options page should open.
def the_ssh_general_options_page_should_open(driver): assert wait_on_element(driver, 5, '//h1[text()="SSH"]') assert wait_on_element(driver, 5, '//legend[contains(.,"General Options")]')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_opt(self):\n print(OPTIONS)", "def generalHelp(self):\n rf = os.path.join('docs','helpButtons','prefsGeneral.html')\n self.showHelpFile( rf )", "def OnButtonOptionsHelpButton(self, event):\r\n\t\twebbrowser.open(consts.URL_HELP_OPTIONS)", "def otherOptionsFullScreen(self):\n\n ...
[ "0.68342537", "0.65731114", "0.6296498", "0.6134775", "0.6071951", "0.60229146", "0.6021095", "0.5994295", "0.59757835", "0.5967947", "0.5923113", "0.588971", "0.5887491", "0.58640087", "0.5841276", "0.5833848", "0.58013505", "0.5783216", "0.57594115", "0.5745592", "0.5727621...
0.77246684
0
click the checkbox "Log in as root with password".
def click_the_checkbox_log_in_as_root_with_password(driver): assert wait_on_element(driver, 5, '//mat-checkbox[contains(.,"Log in as Root with Password")]', 'clickable') time.sleep(0.5) value_exist = attribute_value_exist(driver, '//mat-checkbox[contains(.,"Log in as Root with Password")]', 'class', 'mat-ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loginAsManager(self):\n self.browser.open('http://nohost/plone/')\n self.browser.getLink('Log in').click()\n self.browser.getControl('Login Name').value = 'root'\n self.browser.getControl('Password').value = 'secret'\n self.browser.getControl('Log in').click()", "def login(...
[ "0.74703526", "0.74241596", "0.74170965", "0.7220949", "0.7136605", "0.7132571", "0.69986665", "0.6882587", "0.68124306", "0.6740211", "0.67398465", "0.6739545", "0.6698767", "0.6698767", "0.6577201", "0.6571196", "0.6553244", "0.65500057", "0.6543612", "0.65392774", "0.65259...
0.7759269
0
click Start Automatically SSH checkbox and enable the SSH service.
def click_start_automatically_ssh_checkbox_and_enable_the_ssh_service(driver): assert wait_on_element(driver, 5, xpaths.services.title) time.sleep(1) assert wait_on_element(driver, 5, '//tr[contains(.,"SSH")]//mat-checkbox') value_exist = attribute_value_exist(driver, '//tr[contains(.,"SSH")]//mat-check...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def press_on_configure_ssh(driver):\n assert wait_on_element(driver, 5, xpaths.services.ssh_Service_Button, 'clickable')\n driver.find_element_by_xpath(xpaths.services.ssh_Service_Button).click()", "def open_ssh():\n print('Opening SSH...')", "def scp_enable(task):\n cmd = \"ip scp server enable\"\...
[ "0.7518686", "0.6496028", "0.6454716", "0.62138116", "0.6133582", "0.6122777", "0.5973726", "0.5902316", "0.5857052", "0.57772857", "0.57702386", "0.57609695", "0.57590127", "0.57451016", "0.5743138", "0.56877005", "0.56823933", "0.56456465", "0.5626627", "0.5604173", "0.5540...
0.7955349
0
the service should be enabled with no errors.
def the_service_should_be_enabled_with_no_errors(driver): assert wait_on_element_disappear(driver, 30, xpaths.progress.spinner) assert wait_for_attribute_value(driver, 20, xpaths.services.ssh_Service_Toggle, 'class', 'mat-checked')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_enabled(self):", "def enable(self) -> None:", "def Enabled(self) -> bool:", "def enabled(name, **kwargs):\n if not available(name):\n log.error(\"Service %s not found\", name)\n return False\n\n run_file = os.path.join(SERVICE_DIR, name, \"run\")\n down_file = os.path.join(SERVI...
[ "0.6779741", "0.67622614", "0.675949", "0.67435724", "0.67135346", "0.671267", "0.66452473", "0.6642858", "0.6601505", "0.6555925", "0.65523106", "0.64544934", "0.63838243", "0.6378184", "0.6370161", "0.6368944", "0.63200057", "0.6312439", "0.6312439", "0.6309658", "0.6305008...
0.7326841
0
run ssh root@"{host}" with root password "{password}".
def run_ssh_root_host_with_root_password(driver, host, password): global ssh_result ssh_result = ssh_cmd('ls -la', 'root', password, host)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh(host_=None):\n run_command_on_selected_server(open_shell, host_=host_)", "def css_login_as_root(css_test_machine):\n ssh_config = collections.namedtuple('ssh_config',\n ('hostname port username '\n 'rsa_key_file password...
[ "0.71752024", "0.70384115", "0.6979858", "0.6902557", "0.679378", "0.6753487", "0.6716479", "0.6705598", "0.6633392", "0.660619", "0.6563642", "0.6469829", "0.64319026", "0.642217", "0.63958335", "0.6395418", "0.6362119", "0.63617915", "0.63132185", "0.62975687", "0.62537336"...
0.817772
0
the root user should be able to login with ssh.
def the_root_user_should_be_able_to_login_with_ssh(driver): assert ssh_result['result'], ssh_result['output'] assert '..' in ssh_result['output'], ssh_result['output']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verify_ssh_access_with_root_works(driver):", "def css_login_as_root(css_test_machine):\n ssh_config = collections.namedtuple('ssh_config',\n ('hostname port username '\n 'rsa_key_file password'))\n config = ssh_config(h...
[ "0.7457555", "0.725366", "0.6982431", "0.6840304", "0.6652", "0.66381174", "0.66168934", "0.65830183", "0.65589464", "0.6533763", "0.65160865", "0.64793193", "0.63521785", "0.6320156", "0.63003814", "0.62917894", "0.6257883", "0.6256203", "0.6244345", "0.6208445", "0.6206562"...
0.8243572
0
Given a rollout, compute its value targets and the advantage.
def compute_advantages(rollout, last_r, gamma=0.9, lambda_=1.0, use_gae=True): traj = {} trajsize = len(rollout["actions"]) for key in rollout: traj[key] = np.stack(rollout[key]) if use_gae: assert "vf_preds" in rollout, "Values not found!" vpred_t = np.concatenate([rollout["vf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_targets(rollout, action_space, last_r=0.0, gamma=0.9, lambda_=1.0):\n\n rollout = compute_advantages(rollout, last_r, gamma=gamma, lambda_=lambda_)\n rollout[\"adv_targets\"] = np.zeros((rollout.count, action_space.n))\n rollout[\"adv_targets\"][np.arange(rollout.count), rollout[\"actions\"]] ...
[ "0.69817305", "0.6567999", "0.6169661", "0.6129128", "0.6064148", "0.5974392", "0.5889183", "0.58680856", "0.5848842", "0.58002174", "0.5742709", "0.5742709", "0.5742173", "0.574011", "0.57117146", "0.57093364", "0.57023776", "0.5684186", "0.56739855", "0.5669796", "0.5659963...
0.67084
1
Given a rollout, compute targets. Used for categorical crossentropy loss on the policy. Also assumes there is a value function. Uses GAE to calculate advantages.
def compute_targets(rollout, action_space, last_r=0.0, gamma=0.9, lambda_=1.0): rollout = compute_advantages(rollout, last_r, gamma=gamma, lambda_=lambda_) rollout["adv_targets"] = np.zeros((rollout.count, action_space.n)) rollout["adv_targets"][np.arange(rollout.count), rollout["actions"]] = \ rol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_advantages(rollout, last_r, gamma=0.9, lambda_=1.0, use_gae=True):\n\n traj = {}\n trajsize = len(rollout[\"actions\"])\n for key in rollout:\n traj[key] = np.stack(rollout[key])\n\n if use_gae:\n assert \"vf_preds\" in rollout, \"Values not found!\"\n vpred_t = np.conc...
[ "0.666095", "0.6440683", "0.63122576", "0.62946445", "0.61775386", "0.6116227", "0.6081535", "0.59924567", "0.5973676", "0.5929982", "0.59123373", "0.58755696", "0.5871999", "0.5837028", "0.58256716", "0.5817292", "0.58115995", "0.58017886", "0.5794705", "0.57909685", "0.5785...
0.76641226
0
Use the appropriate videostreamer depending on the platform/camera to use
def set_video_source(self): if self.config['camera_device_id'] == 'pi': # Raspberry Pi camera as video source # only import if needed because it requires specific packages! from raspicamera import RasPiCamera self.video_stream = RasPiCamera() elif self.con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, camera=None):\n\n if camera is None:\n self.cam = Camera(0)\n elif type(camera) == int:\n self.cam = Camera(camera)\n else:\n self.cam = VirtualCamera(camera, \"video\")", "def __init__(self, device='/dev/video0', output_filename='/dev/null...
[ "0.6395852", "0.6357365", "0.6351877", "0.62840235", "0.62343246", "0.61802995", "0.6172302", "0.6079385", "0.6058784", "0.6023922", "0.59703314", "0.5919922", "0.5915451", "0.591257", "0.58635557", "0.5812116", "0.5780909", "0.57319295", "0.56983274", "0.5668839", "0.5663067...
0.70106345
0
Paint boxes and labels/names around detected faces
def paint_faces_data(frame, faces_data): for face in faces_data: (top, right, bottom, left) = face['location'] if face['identity'] is None: name = 'Unknown' color = (0, 0, 255) # red else: name = face['identity'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlight_faces(image, faces, output_filename, terminal_print=True):\n im = Image.open(image)\n draw = ImageDraw.Draw(im)\n\n for (face_ind, face) in enumerate(faces):\n\n # compute emotions\n list_emotion_scores = [face.sorrow_likelihood,\n face.joy_likelih...
[ "0.74479693", "0.7110669", "0.7070581", "0.70114297", "0.6918849", "0.67359346", "0.6709659", "0.66393256", "0.65917903", "0.6556406", "0.65250915", "0.65222067", "0.64628524", "0.6459832", "0.6419342", "0.64013", "0.6392646", "0.63896686", "0.6386491", "0.6378196", "0.637755...
0.7864521
0
Return the real value instead of the %.
def real_value(val): return round(val/100*sum(euros), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __float__(self):\n return self.num/self.denom", "def __float__(self):\n return self.num/self.denom", "def get_real_percent(self):\n if not (self.votes and self.score):\n return 0\n return 100 * (self.get_real_rating() / self.field.range)", "def __float__(self):\n ...
[ "0.7050284", "0.7050284", "0.6976536", "0.68554485", "0.65986884", "0.6563995", "0.6494256", "0.64709556", "0.6425573", "0.64117116", "0.6388856", "0.6343258", "0.6331123", "0.6329049", "0.6311305", "0.6307815", "0.62896955", "0.6274282", "0.6263361", "0.62617683", "0.6260623...
0.7619975
0
summary of the vibrational analysis
def vibrational_analysis_summary(self): print("Summary of the vibrational analysis:") #cols = [ "eigvals [a.u.]" , "w [a.u.]", "w [THz]", "w [cm^-1]", "T [a.u.]", "T [ps]","E [a.u.]", "n [a.u.]"] df = pd.DataFrame() eigvals = self.eigvals.copy() eigvals [ eigvals == MicroStatePri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(self):\r\n self.base.summary()\r\n self.extra_layers.summary()\r\n self.detector.summary()", "def compute_statistics(self):", "def full_analysis(self):\n print('FULL ANALYSIS\\n' +\n '----------------------------------\\n')\n #print('Basic Statistics'...
[ "0.6564602", "0.64965", "0.63673824", "0.6317777", "0.6268647", "0.6255099", "0.6235681", "0.62339216", "0.62134176", "0.6196753", "0.61504763", "0.6085174", "0.6070195", "0.6057506", "0.60011464", "0.59826547", "0.5980289", "0.5943046", "0.5934304", "0.5932248", "0.59235865"...
0.80188596
0
The `UniqueTogetherValidator` always forces an implied 'required' state on the fields it applies to.
def enforce_required_fields(self, attrs): if self.instance is not None: return # missing_items = { # field_name: self.missing_message # for field_name in self.fields # if field_name not in attrs # } # if missing_items: # raise V...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(self):\n super(RequireOneFormSet, self).clean()\n for error in self.errors:\n if error:\n return\n completed = 0\n for cleaned_data in self.cleaned_data:\n # form has data and we aren't deleting it.\n if cleaned_data and not clea...
[ "0.63508886", "0.62670535", "0.6224601", "0.5925875", "0.5883616", "0.5850091", "0.58260864", "0.58111674", "0.576753", "0.5755194", "0.56639725", "0.5650911", "0.564817", "0.5634258", "0.5611223", "0.5602472", "0.5597902", "0.5581856", "0.55527353", "0.55427045", "0.5531815"...
0.6627792
0
Retrieve the destination Group.
def get_destination_group(self): sg = self.source_group dd = self.destination_directory while True: try: matches = dd.groups.search({'name': sg.name}) return matches[0] if len(matches) > 0 else None except StormpathError as err: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destination_group_id(self):\n return self._destination_group_id", "def copy_group(self):\n dd = self.destination_directory\n sg = self.source_group\n dg = self.destination_group\n\n data = {\n 'description': sg.description,\n 'name': sg.name,\n ...
[ "0.76878965", "0.6967713", "0.6963653", "0.6943798", "0.68907416", "0.6877535", "0.67855513", "0.6750913", "0.66631055", "0.66631055", "0.66631055", "0.66631055", "0.66631055", "0.66631055", "0.6655987", "0.66556984", "0.6610054", "0.6482741", "0.6440536", "0.6440536", "0.644...
0.84470224
0
Copy the source Group over into the destination Directory.
def copy_group(self): dd = self.destination_directory sg = self.source_group dg = self.destination_group data = { 'description': sg.description, 'name': sg.name, 'status': sg.status, } # If this Group already exists, we'll just update...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate(self):\n self.destination_group = self.get_destination_group()\n self.destination_group = self.copy_group()\n self.copy_custom_data()\n\n logger.info('Successfully copied Group: {}'.format(self.destination_group.name.encode('utf-8')))\n return self.destination_group",...
[ "0.73172754", "0.67645866", "0.6629909", "0.6627596", "0.66050786", "0.66050786", "0.6604063", "0.6591996", "0.64791036", "0.6458609", "0.6448786", "0.6380771", "0.6378119", "0.63748825", "0.63348556", "0.6277222", "0.6262582", "0.6262367", "0.6216219", "0.61892563", "0.61813...
0.8197669
0
Copy CustomData to the destination Group.
def copy_custom_data(self): sg = self.source_group dg = self.destination_group dd = self.destination_directory for key, value in sanitize(sg.custom_data).items(): dg.custom_data[key] = value try: dg.custom_data.save() return dg.custom_data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate(self):\n self.destination_group = self.get_destination_group()\n self.destination_group = self.copy_group()\n self.copy_custom_data()\n\n logger.info('Successfully copied Group: {}'.format(self.destination_group.name.encode('utf-8')))\n return self.destination_group",...
[ "0.7007891", "0.57221156", "0.54404587", "0.54385394", "0.5380675", "0.52697796", "0.51893926", "0.5166701", "0.516446", "0.513698", "0.51313716", "0.5121373", "0.50766444", "0.5023055", "0.5015248", "0.49674436", "0.4964484", "0.49641585", "0.4957558", "0.49224517", "0.49059...
0.804995
0
Migrates one Group to another Tenant =) Won't stop until the migration is complete.
def migrate(self): self.destination_group = self.get_destination_group() self.destination_group = self.copy_group() self.copy_custom_data() logger.info('Successfully copied Group: {}'.format(self.destination_group.name.encode('utf-8'))) return self.destination_group
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_migration(self):\n step = \"Migrating Database\"\n try:\n self.slacker.send_thread_reply(step)\n self.kuber.run_migration(tag=self.tag, source=config.APP_MIGRATOR_SOURCE)\n self.migration_completed = True\n except Exception as e:\n self.raise...
[ "0.60504246", "0.5771623", "0.57313025", "0.5703251", "0.56833225", "0.56692", "0.55300903", "0.552122", "0.5495515", "0.54355794", "0.542806", "0.54272103", "0.54244304", "0.5424313", "0.5424132", "0.53701836", "0.5363987", "0.53493965", "0.5324889", "0.5317418", "0.52856", ...
0.6369106
0
Compile a list of all allergens For each allergeg, find all ingredient lists that reference it Get an intersection of those lists to find all candidates for that allergen Return all ingredients not in the allergen list
def solve_part1(start): all_ilists = load_inputs() allergen_map = get_allergen_map(all_ilists) all_ingredients = get_all_ingredients(all_ilists) all_potential_bad_ingredients = set() for l in allergen_map.values(): all_potential_bad_ingredients.update(l) safe_ingredients = [a for a i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_allergens(foods):\n\n # Create a dictionary mapping allergens to lists\n # of ingredients that may contain that allergen\n allergen_foods = {}\n for ingredients, allergens in foods:\n for allergen in allergens:\n allergen_foods.setdefault(allergen, []).append(set(ingredien...
[ "0.7667913", "0.5850064", "0.5719783", "0.5694653", "0.5650647", "0.5642431", "0.5635721", "0.55769885", "0.55377215", "0.55338204", "0.5510489", "0.5507309", "0.54491836", "0.54376495", "0.5432545", "0.5425725", "0.53932744", "0.53638357", "0.53454673", "0.5335317", "0.53127...
0.6366038
1
Split the list of tags in attribute cols into sub lists grouped by level
def split_tags_to_levels(attribute_cols, max_depth): level_tags = [] for i in range(0, max_depth): level = max_depth - i current_level_tags = [] for att in attribute_cols: att_level = len(att.split('.')) - 1 if att_level == level: current_level_ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unique_tags(df):\n tags = []\n\n for index, row in df.iterrows():\n tags = list(set(tags + ast.literal_eval(row.tags)))\n\n pdb.set_trace()", "def splitBy(data, attribute_id):\n \n col = getColumn(data, attribute_id)\n values = set(col)\n split_data = [] \n for i in valu...
[ "0.5686046", "0.5586532", "0.5547188", "0.5459328", "0.54577595", "0.53406495", "0.533561", "0.52994555", "0.5283539", "0.5202037", "0.51741797", "0.5152816", "0.515235", "0.5147258", "0.51467", "0.51462287", "0.51429564", "0.5140572", "0.5132887", "0.5115969", "0.5078673", ...
0.7616157
0
stage three, create map of summary = column of same name in level above + all tags containing in level
def create_level_maps(max_depth, level_tags, summary_tags): level_maps = [] for i in range(0, max_depth - 1): level_map = dict() level = max_depth - i for summary in summary_tags[i]: all_sub_tags = [att for att in level_tags[i] if summary[:-4] == ".".join(att.split('.')[:-1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_df_with_macro_cats(df, level_maps):\n for level_map in level_maps:\n for summary_att, atts in level_map.items():\n df[summary_att] = df[atts].sum(axis=1).apply(lambda e: 1 if e >= 1 else 0)\n\n return df", "def add_summary_mapping(otu_table,\r\n mapping...
[ "0.6095907", "0.5899178", "0.5657692", "0.52457756", "0.52168375", "0.5198422", "0.517395", "0.5151941", "0.51494884", "0.5133481", "0.5127067", "0.50493133", "0.500938", "0.4997392", "0.49971712", "0.49863157", "0.49833137", "0.4966695", "0.49348795", "0.49285176", "0.492688...
0.6325224
0
Prunes tensor corresponding to parameter called `name` in `module` by removing every other entry in the tensors. Modifies module in place (and also return the modified module)
def foobar_unstructured(module, name): FooBarPruningMethod.apply(module, name) return module
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_weight_norm_and_equal_lr(module: Module,\n name: str = 'weight') -> Module:\n return remove_weight_lambda(module, 'norm_equal_lr', name)", "def remove_norms(module_: \"WN\") -> \"WN\":\n module_.start = torch.nn.utils.remove_weight_norm(module_.start_conv)\...
[ "0.60598844", "0.5909009", "0.5744272", "0.5732194", "0.5677878", "0.5647646", "0.5559865", "0.5466906", "0.5406585", "0.5399408", "0.53274816", "0.5233343", "0.5209073", "0.5150959", "0.5150959", "0.5150959", "0.51101005", "0.50904685", "0.5088666", "0.50826114", "0.50823766...
0.6131159
0
Returns Dict with class name and bounding boxes. Key number is box number
def return_boxes_class_as_dict(self) -> Dict[int, Dict]: boxes_dict = {} for index, sg_box in enumerate(self.root.iter('object')): boxes_dict[index] = {"name": sg_box.find("name").text, "xmin": int(sg_box.find("bndbox").find("xmin").text), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self, round_boxes: bool = True) -> dict:\n npboxes = self.get_npboxes()\n if round_boxes and np.issubdtype(npboxes.dtype, np.floating):\n npboxes = npboxes.round(2)\n classes = self.get_class_ids()\n scores = self.get_scores().round(6)\n d = {\n ...
[ "0.6812948", "0.6808152", "0.6690509", "0.65427005", "0.6401556", "0.63900846", "0.61920977", "0.6154504", "0.614809", "0.6109047", "0.6102897", "0.6070463", "0.605929", "0.59976906", "0.5995844", "0.5992272", "0.5982084", "0.5980321", "0.596288", "0.59605664", "0.5936286", ...
0.79432786
0
Create data object storing the synapse id. Id is none if
def __init__(self, synid=None, data_uri): self.synid = synid self.data_uri = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, id, data={}):\n\t\tself.__id = id\n\t\tself.__dStore = data", "def payload_creation(self, id, data):\n\n payload = {\n 'UUID': self.uuid,\n 'ID': id,\n 'RATE': self.rate,\n 'GPIO': data[2],\n 'DDL': self.ddl,\n 'VALUE': d...
[ "0.6683341", "0.5950109", "0.5892375", "0.5882798", "0.5797706", "0.57971925", "0.57971925", "0.57971925", "0.57971925", "0.57885116", "0.57885116", "0.5745124", "0.574388", "0.574388", "0.56933784", "0.56933784", "0.56933784", "0.56933784", "0.56933784", "0.56933784", "0.569...
0.6004968
1
Retrieves data from data_uri and stores it in the local cache.
def getData(self, local_cache):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _retrieveCachedData(self):", "def read_data_cache(self):\n if os.path.exists(self.cache_filename):\n return self.read_data_cache_file()\n else:\n data = self._empty_data()\n self.write_data_cache(data)\n return data", "def get_uri(\n uri,\n ig...
[ "0.6769925", "0.6302919", "0.61490214", "0.613357", "0.61221176", "0.61186427", "0.6081297", "0.6054003", "0.60285616", "0.59756505", "0.58839726", "0.5862857", "0.5859773", "0.5847547", "0.580898", "0.5805113", "0.57414836", "0.57271916", "0.56812966", "0.56810653", "0.56489...
0.66638345
1
Changing retraction speed for a specific source file. User has to define the initial distance and the layer distance, which specifies the number of layers between steps.
def change_retraction_speed(gcode_source=None, gcode_target=None, initial_retraction_speed=None, retraction_speed_steps=None, layer_distance=None): current_retraction_speed_at = initial_retraction_sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_retraction_distance(gcode_source=None,\r\n gcode_target=None,\r\n initial_retraction_distance=None,\r\n retraction_distance_step=None,\r\n layer_distance=None):\r\n current_retracti...
[ "0.68603784", "0.59780365", "0.59389067", "0.5706731", "0.56527776", "0.5626594", "0.55819356", "0.55043226", "0.54412353", "0.5432877", "0.543281", "0.5414724", "0.5414351", "0.53777224", "0.53676", "0.53567505", "0.5352132", "0.5328321", "0.52560544", "0.5254133", "0.524784...
0.7475537
0