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
List scripts in scripts.d/ directory, without their extension.
def list_scripts(self): glob_exp = self.script_dir + "/*.sh" return [re.sub(r'.*/(.*)\.sh', r'\1', x) for x in glob(glob_exp)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_list():\n\n print_debug('Getting scripts to list...')\n scripts = get_scripts()\n print('\\nFound {} scripts:'.format(len(scripts)))\n curdir = None\n for scriptpath in scripts:\n thisdir, thisscript = os.path.split(scriptpath)\n if thisdir != curdir:\n # Directory ch...
[ "0.7199069", "0.6682177", "0.6673067", "0.6331609", "0.6187239", "0.6186075", "0.6166454", "0.61594635", "0.56995183", "0.55123377", "0.54982466", "0.54692805", "0.5426736", "0.542594", "0.5412528", "0.53207296", "0.5311334", "0.5284247", "0.5279119", "0.5274191", "0.5264465"...
0.7104907
1
Mainloop, running while a wiimote is connected.
def run(self): # I want to reload the list of scripts on each # disconnect/reconnect: it's easier to debug. :) scripts = self.list_scripts() while True: if 0 != self.wm.state['buttons']: [self.run_handler(script) for script in scripts] if self.omg_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n if self._main_loop:\n return\n self._main_loop = GObject.MainLoop()\n self._disconnect_all()\n self._register()\n logger.info(\"--- Mainloop started ---\")\n logger.info(\"Hub is ready for onboarding\")\n try:\n self._main_loop...
[ "0.7394161", "0.70788264", "0.679856", "0.67235404", "0.67235404", "0.6629297", "0.6596111", "0.6593369", "0.65529376", "0.65375286", "0.6503248", "0.6503248", "0.6469985", "0.6456766", "0.6444463", "0.6439083", "0.64162016", "0.6381249", "0.6381249", "0.6374149", "0.636953",...
0.7384352
1
Vibrate for a while.
def vibrate(self, duration): self.wm.rumble = 1 sleep(duration) self.wm.rumble = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def brake(self):\n\n self.log_speed()\n while self.speed_mph > 0:\n time.sleep(1)\n if (self.speed_mph - self.deceleration_rate) < 0:\n self.speed_mph = 0\n self.log_speed()\n break\n else:\n self.speed_mph -...
[ "0.6667656", "0.63831866", "0.62922806", "0.6204618", "0.61976445", "0.61719435", "0.6125226", "0.6056607", "0.60405046", "0.6012841", "0.5994203", "0.5953422", "0.5942182", "0.59269655", "0.59215504", "0.59201324", "0.59156823", "0.59118986", "0.59118986", "0.59118986", "0.5...
0.76400393
0
Returns cell data for features on columns 0 and 1 based on given bounds
def getCellData(X, y, min0, max0, min1, max1): Xcell = [] ycell = [] for x,label in zip(X, y): if (x[0] >= min0) and (x[0] < max0) and (x[1] >= min1) and (x[1] < max1): Xcell.append(x) ycell.append(label) return np.array(Xcell), np.array(ycell)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_bounds(ds, bounds):\n \n xs = slice(bounds[0][0], bounds[1][0])\n ys = slice(bounds[1][1], bounds[0][1])\n # select over x and y axis\n return ds.sel(x=xs, y=ys)", "def get_cells(self, data_path, pattern, bounds, return_bounds=False):\n\n\t\t# Special case of bounds=None (all sky)\n\t\t...
[ "0.60085094", "0.5873821", "0.5870089", "0.58400893", "0.5826306", "0.5741569", "0.572897", "0.5716853", "0.57073796", "0.5684906", "0.5678184", "0.5653759", "0.56203735", "0.5575718", "0.55287445", "0.5512851", "0.55055404", "0.5488575", "0.54720306", "0.54466045", "0.542996...
0.6622131
0
Return the best n predicted classes for the given probabilities
def bestNPredictions(probabilities, classes, n): assert(len(probabilities) == len(classes)) reverse_sorted_probability_indices = sorted(range(0, len(probabilities)), key = lambda idx: probabilities[idx], reverse = Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _classify_from_probs(predicts_proba):\n def find_majority(dict_probs):\n \"\"\"Find the majority class\"\"\"\n # if there is no majority class, pick the first from the sorted\n max_val = max(dict_probs.values())\n max_keys = [key for key in dict_probs.keys()\n ...
[ "0.7229792", "0.6929863", "0.6683146", "0.6618696", "0.65558374", "0.65456903", "0.64651066", "0.6441382", "0.6441244", "0.6402458", "0.63788116", "0.6361449", "0.63582784", "0.6335772", "0.631162", "0.62979406", "0.62611717", "0.6254704", "0.62536496", "0.62524647", "0.62515...
0.88965905
0
Both data grids need to be 2D.
def enforce_2D(self,): for data in (self.data_obs,self.data_fcst): shp = data.shape if len(shp) == 2: pass elif len(shp) == 3: if shp[0] == 0: data = data[0,:,:] elif len(shp) == 4: if (shp[0] ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_input_grid(self, x1, x2):\n return x1.unsqueeze(-2), x2.unsqueeze(-3)", "def cell_edges2d_cartesian(self, axis2):", "def sameGrid(A, B):\n if np.isscalar(A):\n # A is a scalar \n if not np.isscalar(B):\n return False\n else:\n return (A == B)\n ...
[ "0.6938337", "0.64650697", "0.63200545", "0.6301145", "0.61692667", "0.61587864", "0.6158255", "0.6156493", "0.6144679", "0.60967004", "0.6060262", "0.6054667", "0.6048626", "0.5985644", "0.59330547", "0.58606344", "0.58538663", "0.58464617", "0.58250165", "0.57747597", "0.57...
0.6838991
1
Decorator to "register" a mock method. `name` is required. Unlike `remote_method`, and `Mock.method`, this doesn't immediately add functions to a `Registry` instead, it sets an attribute on the function, allowing such functions to be recognised when the test case is instantiated.
def mock_method(name): def decorator(func): """ Return `func`, with the `mock_method.attr_name` attribute set. """ setattr(func, mock_method.attr_name, name) return func # Set an attribute on `decorator`. This can be used to discover situations # where `mock_method...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decorator(func):\n\n setattr(func, mock_method.attr_name, name)\n return func", "def builtin_wrapper(method_name):\n def wrapper(self, *args, **kwargs):\n if method_name not in self.__dict__:\n raise AttributeError(\n \"object '%s' has no mock method '%s'\" %...
[ "0.7267121", "0.6734391", "0.65233094", "0.64206845", "0.6276636", "0.6275976", "0.62199324", "0.61470366", "0.6111515", "0.60806227", "0.60078967", "0.59150237", "0.57728004", "0.57687855", "0.5745724", "0.57455486", "0.5732674", "0.5726623", "0.57248616", "0.5696047", "0.56...
0.74133193
0
Return `func`, with the `mock_method.attr_name` attribute set.
def decorator(func): setattr(func, mock_method.attr_name, name) return func
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_method(name):\n\n def decorator(func):\n \"\"\"\n Return `func`, with the `mock_method.attr_name` attribute set.\n \"\"\"\n\n setattr(func, mock_method.attr_name, name)\n return func\n\n # Set an attribute on `decorator`. This can be used to discover situations\n ...
[ "0.76465225", "0.71144456", "0.71144456", "0.6644002", "0.6469306", "0.63677436", "0.62743974", "0.62743974", "0.6228774", "0.6190622", "0.61193985", "0.6039265", "0.60373425", "0.5941217", "0.59026754", "0.58819354", "0.58632904", "0.57538706", "0.5744867", "0.5696653", "0.5...
0.86594665
0
Create `zorp_mock`. Register RPC methods, and activate the mock object.
def setup(): self.zorp_mock = Mock() for name, func in six.iteritems(self._get_zorp_mock_methods()): self.zorp_mock.server.registry.put(name, func) self.zorp_mock.start()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getattribute__(self, name):\n\n def setup():\n \"\"\"\n Create `zorp_mock`. Register RPC methods, and activate the mock\n object.\n \"\"\"\n\n self.zorp_mock = Mock()\n\n for name, func in six.iteritems(self._get_zorp_mock_methods()):\n...
[ "0.66261476", "0.6176426", "0.5985614", "0.5878401", "0.5801956", "0.57371515", "0.5662555", "0.56600934", "0.5658248", "0.5635125", "0.56093246", "0.5576623", "0.5562454", "0.5557701", "0.5544976", "0.5544976", "0.55407256", "0.55402535", "0.55187553", "0.5514346", "0.551145...
0.7708297
0
Return a function that calls each of `funcs` in order.
def func_caller(*funcs): def caller(): """ Call each of `funcs`. """ for func in funcs: func() return caller
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _apply_in_order(functions, input_data):\n return reduce(lambda res, func: func(res), functions, input_data)", "def compose(x, funcs, *args, order=\"_order\", **kwargs):\n key = lambda x: getattr(x, order, 0)\n for func in sorted(listify(funcs), key=key):\n x = func(x, *args, **kwargs)\n re...
[ "0.7257837", "0.71246034", "0.6821015", "0.6568005", "0.6491997", "0.6487925", "0.64167523", "0.6389436", "0.6375847", "0.6316178", "0.63063693", "0.6182636", "0.617863", "0.6164258", "0.6073444", "0.6068886", "0.60642874", "0.6051654", "0.6049405", "0.5961831", "0.59185237",...
0.7369996
0
Call each of `funcs`.
def caller(): for func in funcs: func()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func_caller(*funcs):\n\n def caller():\n \"\"\"\n Call each of `funcs`.\n \"\"\"\n\n for func in funcs:\n func()\n\n return caller", "def run_functions(self):\n for function in self.functions:\n ...
[ "0.7243829", "0.70459545", "0.70049006", "0.64890724", "0.6422185", "0.6305511", "0.62884367", "0.6274015", "0.61782634", "0.61755943", "0.6166101", "0.6120158", "0.61038685", "0.6055395", "0.59353966", "0.5934734", "0.5878595", "0.58741367", "0.5865713", "0.5849483", "0.5798...
0.7204175
1
Return this instance's mock methods. These are recognised by the presence of the `mock_method.attr_name` attribute. This is set by the `` decorator.
def _get_zorp_mock_methods(self): mock_methods = {} for name in dir(self): if name not in ("setUp", "tearDown"): try: value = getattr(self, name) except AttributeError: pass else: if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_methods(self):\n\n methods = inspect.getmembers(self, predicate=callable)\n method_list = set()\n\n for name, _ in methods:\n if (name in ('proxy', 'start', 'stop', 'part', 'join',)\n or name[0] == '_'):\n continue\n\n method_lis...
[ "0.68739885", "0.6667683", "0.66409683", "0.66073537", "0.65035397", "0.64645165", "0.63901216", "0.63686246", "0.6301099", "0.62942314", "0.62886536", "0.6277794", "0.61663085", "0.6110262", "0.60916585", "0.60578614", "0.6049329", "0.5985367", "0.5975958", "0.5946389", "0.5...
0.8010171
0
API request to return a single image by uid
async def fetch_image_by_id( image_uid: str ): image_uid = int(image_uid) image = utils_com.get_com_image_by_uid(image_uid) return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image(image_id, user_id):\n\n with image_backend(user_id) as backend:\n return backend.get_image(image_id)", "def image(image_id):\n\n found = False\n img = None\n \n try:\n for img in api.get_all_images():\n if img.id == image_id:\n found = True\n break\n except Exce...
[ "0.738781", "0.67425454", "0.6702967", "0.6604356", "0.6574783", "0.6558754", "0.6463551", "0.64468724", "0.6359077", "0.6345214", "0.6336239", "0.6325769", "0.63244176", "0.63116163", "0.62697446", "0.6195465", "0.61829007", "0.6177198", "0.61725074", "0.6122976", "0.608752"...
0.77187634
0
Will calculate the number of degrees jerry needs to turn.
def get_turn_degrees(self): self.turn_degrees = 360/self.num_protrusions return self.turn_degrees
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sh_degree(j):\n l = 0\n while dimension(l) - 1 < j:\n l += 2\n return l", "def angle(self) -> int:", "def degree(x):\n return x*(180.0/math.pi)", "def StepsToDegree(self,Steps):\n return int(round(Steps/(self.Reduction/self.StepAngle/2)))", "def degree(self, k):\n one_i...
[ "0.63584703", "0.62752825", "0.6189304", "0.5996228", "0.5963241", "0.5947708", "0.59263587", "0.5898654", "0.58813983", "0.5874243", "0.5874243", "0.5874243", "0.58467865", "0.5830721", "0.58067614", "0.57995397", "0.57700604", "0.5769787", "0.5769034", "0.5720258", "0.57190...
0.6993534
0
Assert if the project data for a given PXD identifier is accessable through the PRIDE Archive API.
def check_pxd_id(pxd_identifier): url = "https://www.ebi.ac.uk:443/pride/ws/archive/project/{}".format(pxd_identifier) response = json.loads(requests.get(url).content.decode('utf-8')) assert "accession" in response.keys(), "Could not access data for PXD ID '{}'".format(pxd_identifier)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_public_guest_access(self):\n self.project.public_guest_access = True\n self.project.save()\n user_new = self.make_user('user_new')\n url = reverse('projectroles:api_project_list')\n response = self.request_knox(url, token=self.get_token(user_new))\n self.asser...
[ "0.60435635", "0.5945826", "0.58934295", "0.5763079", "0.57564324", "0.57422584", "0.5688732", "0.5677933", "0.56371826", "0.5612533", "0.55831444", "0.55367893", "0.5525628", "0.55055684", "0.5504764", "0.5498353", "0.5438755", "0.54209495", "0.54209495", "0.54209495", "0.54...
0.74924076
0
Get DataFrame with files to download, filtered by extension and filename regex pattern.
def get_files_df(pxd_identifier, filetypes, pattern): check_pxd_id(pxd_identifier) get_files_url = "https://www.ebi.ac.uk:443/pride/ws/archive/file/list/project" # Get dataframe with file info through PRIDE Archive REST API url = "{}/{}".format(get_files_url, pxd_identifier) response = pd.D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(path=None, pattern=None):\n if path is None:\n path = '.'\n if pattern is None:\n pattern = '**/*'\n # noinspection SpellCheckingInspection\n fnames = pl.Path(path).glob(pattern)\n files = [(str(fname),) for fname in fnames]\n return pd.DataFrame.from_records(files, co...
[ "0.6573039", "0.64280176", "0.63554955", "0.60897726", "0.596867", "0.59244347", "0.58663195", "0.5839656", "0.5830557", "0.57660383", "0.5752029", "0.5654326", "0.56461686", "0.5620358", "0.5588894", "0.55639416", "0.55277634", "0.55275786", "0.5523089", "0.54738504", "0.546...
0.72380656
0
Checks configuration for missing deletion related values and prompts for values.
def configure_deletes(conf): print() if conf.get('purge', None) is None: conf['purge'] = yes_no( 'Would you like the sync to be able to delete files between devices?', default=False) if conf['purge'] and conf.get('purge_limit') is None: conf['purge_limit'] = numeric_response( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_missing_information(conf):\n failed = False\n\n for field, _ in REQUIRED_SETTINGS.items():\n if field not in conf:\n print 'error: missing configuration for \"{0}\"'.format(field)\n failed = True\n\n if failed:\n sys.exit(1)", "def _check_valid_config(sel...
[ "0.6323292", "0.61649376", "0.6148028", "0.6023466", "0.5988487", "0.58843106", "0.5839063", "0.5813254", "0.58048785", "0.58048785", "0.57988125", "0.5768111", "0.56937367", "0.5623049", "0.5616765", "0.5610144", "0.5607009", "0.56037515", "0.5582131", "0.552171", "0.5519023...
0.6202489
1
Checks configuration for missing performance limitations related values and prompts for values.
def configure_limits(conf, unit_prompt, units): print() if conf.get('ram', None) is None: if conf['host'] == 'Server': prompt = 'How much RAM would you like the Sync to use per thread?' else: prompt = 'How much RAM would you like the Sync to use?' prompt += unit_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_resources(self):\n resources = self.options.resources\n\n for key in ['num_machines', 'num_mpiprocs_per_machine', 'tot_num_mpiprocs']:\n if key in resources and resources[key] != 1:\n raise exceptions.FeatureNotAvailable(\n f'Cannot set resou...
[ "0.5894045", "0.5759664", "0.57440335", "0.5696283", "0.56953585", "0.56741554", "0.5658842", "0.56429005", "0.5627582", "0.56162953", "0.5607499", "0.5607499", "0.5607188", "0.55973595", "0.55946517", "0.55940646", "0.55761975", "0.5564509", "0.5564458", "0.5562981", "0.5561...
0.6193891
0
Checks configuration for missing logging related values and prompts for values.
def configure_logging(conf, unit_prompt, units): print() if conf.get('logging', None) is None: prompt = 'Would you like to log information?' options = ['Nothing Logged', 'Errors Only', 'Errors and Summary Activity', 'Errors, Summary Activity, and Deletions', 'Nearly all Activ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_config(self):", "def printConfig():\n # Why not log instead? Are we asking user to confirm settings?\n pass # until implemented", "def _check_log_params(self):\n steps_per_stats = self.configs['steps_per_stats']\n if not steps_per_stats or steps_per_stats < 0:\n steps_per_stats = 1...
[ "0.65780866", "0.6554678", "0.65348667", "0.6387649", "0.63615996", "0.6330242", "0.63162655", "0.6285085", "0.6260294", "0.6246176", "0.62132025", "0.62132025", "0.61892307", "0.6179928", "0.61524385", "0.6121231", "0.6109863", "0.61058766", "0.6081248", "0.6055453", "0.6037...
0.67895603
0
Presents question that requires a numeric response.
def numeric_response(prompt, units=[], num_type=int, default=None): if default is None: response = input(prompt + ': ') else: response = input(prompt + f' [{default}]' + ': ') try: if response == '' and default is not None: return standardize_response(default, units, num_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_a_number(update: Update, context: CallbackContext):\n text = update.message.text\n update.message.reply_text(f'{text} is not an available number of questions, please use the keyboard provided!')\n\n return HOW_MANY_QUESTIONS", "def evaluate_question(self):\n self.get_question_fequency()\n...
[ "0.6238893", "0.6071908", "0.60269135", "0.5927225", "0.5900183", "0.5887562", "0.5868315", "0.58545965", "0.5834199", "0.58074737", "0.5781654", "0.57209146", "0.5714141", "0.5708979", "0.5702695", "0.5694853", "0.5680054", "0.5669896", "0.5668895", "0.5654739", "0.56503886"...
0.66275686
0
Standardize response containing units to base unit.
def standardize_response(response, units, num_type): if len(units) > 0: response = str(response) units.sort(key=len, reverse=True) for unit, callback in units: _slice = len(unit) * -1 if response[_slice:].upper() == unit.upper(): response = num_type(re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_units(self):\n for prod in (\"ier\", \"ier_inc_rain\"):\n self.data[prod].data[:] /= 1e6", "def test_human_size_units_to_base(self):\n self.assertEqual(human_size_units_to_base(1), 1)\n self.assertEqual(human_size_units_to_base('1'), 1)\n self.assertEqual(human_...
[ "0.6033621", "0.598406", "0.58787733", "0.5681799", "0.5621072", "0.56171083", "0.5587378", "0.55716", "0.55702555", "0.55057794", "0.5446213", "0.54329264", "0.5428557", "0.54246074", "0.54105663", "0.540375", "0.53766006", "0.53703415", "0.53471154", "0.5322826", "0.527145"...
0.6655422
0
Presents question which requires a response that is a valid path.
def ask_path(prompt, default=None): response = simple_response(prompt, default) if os.path.exists(response): return response else: print('That path does not exist. Try again.') return ask_path(prompt, default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_question(q_id):\n responses = session[ANSWERS_KEY]\n if len(responses) < len(survey.questions):\n current_question = survey.questions[len(responses)]\n return render_template(\"question.html\", \n question = current_question)\n else:\n return re...
[ "0.6136718", "0.6005101", "0.5916733", "0.58304137", "0.5753341", "0.5733104", "0.5650662", "0.564015", "0.56023693", "0.55799335", "0.55717534", "0.5551202", "0.55452055", "0.55073565", "0.54717475", "0.54560333", "0.54495245", "0.54265404", "0.54212683", "0.5409997", "0.540...
0.6019812
1
Prompts user with a range of values to choose from. Formats differently depending on tips.
def ask_range(prompt, min, max, tips=[], default=None): print(prompt + ':') keys = [i for i in range(min, max+1)] if default is not None and default not in keys: raise KeyError('Default value not in range.') if len(keys) == len(tips): for key, tips in zip(keys, tips): print(k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ask_user_range(question, first, last, default):\n\n while True:\n answer = input(question)\n if answer == \"\":\n answer = default\n break\n if re.findall(r\"[0-9+]\", answer):\n if int(answer) in range(first, last + 1):\n ...
[ "0.66488975", "0.60051745", "0.5929596", "0.5922045", "0.5860042", "0.5849516", "0.5715345", "0.5676588", "0.5614406", "0.5601453", "0.55842775", "0.5557284", "0.5521468", "0.5504355", "0.5499738", "0.5476641", "0.5459333", "0.5454823", "0.54457134", "0.5440379", "0.5434361",...
0.7494725
0
Asks user if configuration dictionary is correct.
def confirm_conf(conf): print() print('Your configuration:') for key, value in conf.items(): print(f'{key.title()}: {value}') if not yes_no('Is this correct?'): key = ask_options('Which would you like to change?', list(conf.keys()), hints=list(conf.values())) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_input(self):\n answer = simpledialog.askstring(\"Input\", \"Please input the path of the config file.\",\n parent=self._master) # ask for a string\n if answer is not None:\n try:\n self.read_config(answer) # read the config...
[ "0.73272705", "0.67158973", "0.6697673", "0.66423285", "0.6594866", "0.65417045", "0.65392095", "0.6537699", "0.6535462", "0.65057796", "0.6496914", "0.6496914", "0.64444584", "0.64154243", "0.6379144", "0.6374636", "0.63733447", "0.6346451", "0.6168119", "0.6157497", "0.6142...
0.70261884
1
Creates metrics to assess the model's performance. yhat the predicted labels labels the known labels [kappa, j, jkappa]
def get_metrics(yhat, labels, lb): conf_matrix = metrics.confusion_matrix(yhat, labels, labels=lb ) kappa = get_kappa(conf_matrix, len(labels)) j = get_j_index(conf_matrix) jkappa = 0.5*kappa + 0.125*j return [kappa, j, jkappa]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prediction_fn(self, yhat):\n raise NotImplementedError", "def performance_metrics(self, y, y_predicted, type='mse'):\n if type== 'mse':\n if y.ndim > 1:\n m = np.shape(y)[0] #number of samples\n n = np.shape(y)[1] #number of output elements\n ...
[ "0.6201905", "0.6103443", "0.5961512", "0.59387374", "0.59215117", "0.5904821", "0.59006184", "0.5899629", "0.585598", "0.58254904", "0.58196753", "0.5808812", "0.5794988", "0.57877", "0.5787501", "0.57854795", "0.5781029", "0.5762664", "0.57598305", "0.57567835", "0.5754029"...
0.6605423
0
Returns a dict of command handlers in the structure
def get_command_handlers(self): return self.command_handlers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_commands(self):\n\t\treturn list(self.command_handlers.keys())", "def commands(self) -> dict:\n return self._command_lookup", "def _find_commands(self):\n result = {}\n\n prefix = \"on_cmd_\"\n prefix_len = len(prefix)\n funcs = [getattr(self, a, None) for a in dir(se...
[ "0.7464191", "0.7221886", "0.7202781", "0.7157945", "0.7019805", "0.6971972", "0.69374454", "0.6855675", "0.6850317", "0.67910695", "0.6734047", "0.66710114", "0.66619945", "0.66608804", "0.6613472", "0.6603086", "0.6591417", "0.6555287", "0.6553852", "0.6550484", "0.65481436...
0.7762424
0
Returns the command handler from a command
def get_command(self,command): return self.command_handlers[command]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_command_handler(self, command):\n try:\n command_handler = getattr(self, \"command_{}\".format(command))\n except AttributeError:\n raise AttributeError(\"Unknown command: '{}'\".format(command))\n\n return command_handler", "async def _get_command_handler(self,...
[ "0.8500935", "0.8069736", "0.77888626", "0.7359413", "0.72827333", "0.6855246", "0.6847068", "0.6834811", "0.67627764", "0.67585224", "0.6733079", "0.6731637", "0.6698704", "0.66393363", "0.65882784", "0.6558804", "0.6540146", "0.6535977", "0.65052855", "0.6480291", "0.647660...
0.8497354
1
Returns a list of message handlers in the structure (message_handler,messager_filter) Returns
def get_message_handlers(self): return self.message_handlers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_message_handlers(self):\n for name in dir(self):\n attr = getattr(self, name)\n if isinstance(attr, MessageHandler):\n yield attr", "def get_handlers(self):\n\n # Get handlers \n logger.debug(\"%s: Returned %d handlers.\" % \\\n ...
[ "0.727013", "0.6617175", "0.65846986", "0.6580174", "0.65279084", "0.6405162", "0.6371594", "0.63540936", "0.6348447", "0.62768894", "0.6186464", "0.60891277", "0.60217625", "0.60179484", "0.5927636", "0.5909603", "0.58350766", "0.5831539", "0.58294576", "0.57700914", "0.5742...
0.802455
0
Add a conversation flow to the blueprint
def add_conversation(self,conversation): if isinstance(conversation,Conversation): self.conversations.append(conversation) else: raise NotAConversation("Must pass Conversation object, not {}".format(type(conversation)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_conversation(self, event):\n if self._border.get_background_color(False) == globals.GROUP_ODD_COLOR:\n background_color = globals.CONVERSATION_EVEN_COLOR\n else:\n background_color = globals.CONVERSATION_ODD_COLOR\n \n self._conv.append(Conversation(s...
[ "0.56598103", "0.565631", "0.55455583", "0.5531714", "0.543125", "0.5388896", "0.537768", "0.53754324", "0.5326764", "0.5241267", "0.5164956", "0.5164593", "0.51470864", "0.512416", "0.5116317", "0.5113777", "0.5101201", "0.50989693", "0.5043992", "0.503197", "0.50177974", ...
0.6171369
0
Returns the list of conversations on the blueprint Returns
def get_conversations(self): return self.conversations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self) -> List[Conversation]:\n return get_all_conversations(), 200", "def cmd_conversation_list(client, args):\n conversation_list = client.conversation_list()\n data = [item.__dict__ for item in conversation_list]\n generate_output({'conversation_list': data}, args.output_file)", "def ...
[ "0.7615793", "0.69025356", "0.67457104", "0.66602635", "0.65406483", "0.64509505", "0.6307778", "0.6179066", "0.6091759", "0.5925376", "0.590096", "0.5885989", "0.58401376", "0.5757033", "0.5751515", "0.5713414", "0.5710137", "0.5704534", "0.5697661", "0.56638074", "0.5660604...
0.79534054
0
Set material equivalences and geu for each material composing the GEU
def complete_material_equivalences(self): for material in self.materials: material.geu = self for material_aux in self.materials: material.equivalent_materials.add(material_aux)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_materials_dict(self):\n c = 299792458.0\n w_mat = 2 * np.pi * c / self.l_mat - self.w0\n l2_mat = (self.l_mat * 1e6) ** 2\n\n n_air = 1 + 0.05792105 * l2_mat / (238.0185 * l2_mat - 1) + 0.00167917 * l2_mat / (57.362 * l2_mat - 1)\n air_ip = interp1d(w_mat, n_air, bou...
[ "0.58715135", "0.5680804", "0.56760716", "0.55602074", "0.5446021", "0.5408011", "0.53246635", "0.5315609", "0.53036845", "0.5293901", "0.5284275", "0.52706105", "0.5258877", "0.5249075", "0.52316505", "0.5231068", "0.52302927", "0.5230056", "0.5228996", "0.52201605", "0.5207...
0.7555229
0
Set starting stock for simulation run
def set_starting_stock_from_row(self, starting_stock_df_row, is_teco_simulation=False): if not is_teco_simulation: wh = starting_stock_df_row['grep'] else: wh = starting_stock_df_row['grep'] stock = starting_stock_df_row['stock'] # self.starting_stock_by_wh[wh] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_initial(self, value):\n # TODO: Make an Initial Stock Adjust here\n pass", "def set_start( self , name ):\n self.startState = name.upper()", "def init_stock():\n return {\"five\":0, \"one\": 0, \"quarter\": 25, \"dime\": 25, \"nickel\":25}", "async def setstart(self, ctx, amou...
[ "0.7126954", "0.590015", "0.5876931", "0.58424103", "0.58116984", "0.5793366", "0.5729765", "0.5729765", "0.5729765", "0.5729765", "0.5697479", "0.5684243", "0.5677586", "0.56773186", "0.5648521", "0.560055", "0.5583651", "0.5583585", "0.5572344", "0.5568558", "0.5559916", ...
0.6734844
1
Plots NetworkX GEU graph with its appropriate color
def plot_bare_graph(self, show_plot=True, clf: bool = True): if clf: for i in plt.get_fignums(): if plt.figure(i).get_label()[0:5] == "(NXG)": plt.close(plt.figure(i).get_label()) # Close plot with the same name as the one we're creating (if applies) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize(G, color=None, figsize=(5, 5)):\n plt.figure(figsize=figsize)\n plt.xticks([])\n plt.yticks([])\n nx.draw_networkx(G,\n pos=nx.spring_layout(G, seed=42),\n with_labels=True,\n node_color=color,\n cmap=\"Set2\"...
[ "0.7220155", "0.7088357", "0.70064664", "0.6909276", "0.68292046", "0.6762947", "0.66931486", "0.6678452", "0.6643132", "0.658322", "0.657256", "0.6514893", "0.64363873", "0.64348376", "0.6414272", "0.63936913", "0.63927776", "0.6386568", "0.63821584", "0.6347544", "0.6331255...
0.7549029
0
Terminate logged in session; logout without response
def terminate_session(): token = oidc.user_loggedin and oidc.get_access_token() if token and oidc.validate_token(token): # Direct POST to Keycloak necessary to clear KC domain browser cookie logout_uri = oidc.client_secrets['userinfo_uri'].replace( 'userinfo', 'logout') data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_logout():\n del session[CURRENT_USER_KEY]", "def logout(self):\r\n self._api_entrypoint.logout(self._session_token)", "def logout(self):\n try:\n log.info(\"Logging out of the netscaler\")\n self.post(\"/logout\", {\"logout\": {}})\n except BadNetScaler as error...
[ "0.795778", "0.79377806", "0.793381", "0.7828115", "0.7826171", "0.77631235", "0.7715976", "0.770072", "0.7691472", "0.76903754", "0.7651323", "0.7625889", "0.76211286", "0.7608082", "0.75864893", "0.75855327", "0.7547281", "0.753917", "0.7505125", "0.74614817", "0.7460619", ...
0.8332156
0
API to confirm header token is still valid
def validate_token(): try: token = validate_auth() except Unauthorized: return jsonify(valid=False, expires_in=0) expires = oidc.user_getfield('exp') delta = expires - datetime.now().timestamp() return jsonify(valid=True, expires_in=delta)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_token(self, token):\n return False", "async def validate_token(self, token):", "def verify_token(vial_http: urllib3.connectionpool.ConnectionPool) -> bool:\n verify_resp = vial_http.request(\"GET\", \"/api/verifyToken\")\n return verify_resp.status == 200", "def test_verifies_bearer_t...
[ "0.70857686", "0.7015632", "0.68766755", "0.68508404", "0.6795216", "0.6791847", "0.67063695", "0.6698879", "0.6639689", "0.6626826", "0.65763557", "0.6575521", "0.6565331", "0.65637016", "0.65484494", "0.65356356", "0.6525267", "0.65172446", "0.6517146", "0.6509483", "0.6509...
0.70486665
1
Query HAPI for resource_type and return as JSON FHIR Bundle NB not decorated with `.require_login` as that does an implicit redirect. Client should watch for 401 and redirect appropriately.
def resource_bundle(resource_type, methods=["GET"]): token = validate_auth() url = current_app.config.get('MAP_API') + resource_type params = {'_count': 1000} params.update(request.args) resp = requests.get(url, auth=BearerAuth(token), params=params) try: resp.raise_for_status() exce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_by_id(resource_type, resource_id, methods=[\"GET\"]):\n token = validate_auth()\n url = f\"{current_app.config.get('MAP_API')}{resource_type}/{resource_id}\"\n resp = requests.get(url, auth=BearerAuth(token))\n try:\n resp.raise_for_status()\n except requests.exceptions.HTTPError...
[ "0.6384943", "0.59034264", "0.58505565", "0.58505565", "0.5843548", "0.57318074", "0.57253337", "0.5722467", "0.5722467", "0.5722467", "0.5722467", "0.5722467", "0.5609039", "0.5602633", "0.55896556", "0.5560408", "0.55597615", "0.54899234", "0.54797965", "0.5467379", "0.5423...
0.6920961
0
Marks an order as completed
def mark_completed(self, order_id=None): self.status = "paid" if order_id and not self.order_id: self.order_id = order_id print("Order completed") self.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_finish(self):\r\n logger.info(f'Remaining qty:{self.quantity-self.filled_quantity}')\r\n self.is_active = False\r\n self.is_finished = True\r\n self.is_trading = False\r\n schedule.clear(tag=self.id)\r\n logger.info(f'Order {self.id} is finished')", "def mark_a...
[ "0.73513097", "0.73335606", "0.7194528", "0.7194528", "0.7194528", "0.71694565", "0.71419185", "0.6988013", "0.69498014", "0.69059676", "0.6903752", "0.6864232", "0.68314147", "0.67531234", "0.6730083", "0.6558612", "0.64180624", "0.6382922", "0.6376544", "0.63629156", "0.630...
0.841114
0
Create or update the tile with value and send to the client with websocket
def update_tile_receive(self, tile_id, template_name=None): tileData = MyCache().get(tile_id=getRedisPrefix(tile_id)) if tileData is None: print(f'[DEBUG] Building fake data for {tile_id}. with template {template_name}', flush=True) tileData = buildFakeDataFromTemplate(tile_id, t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tile(self, data):\n self.send(text_data=MyCache().get(tile_id=getRedisPrefix(data['tile_id'])))", "def set_tile(self, row, col, value):\n # replace with your code\n pass", "def new_tile(self):\n # replace with your code\n pass", "def set_tile(self, row, col, valu...
[ "0.6613175", "0.6104644", "0.60077435", "0.59444594", "0.5886995", "0.5816504", "0.5814163", "0.579839", "0.579839", "0.5789465", "0.57342374", "0.57101965", "0.56983244", "0.56966656", "0.56966656", "0.56953204", "0.569042", "0.5660248", "0.5610149", "0.55800325", "0.5569906...
0.6157906
1
Raises errors if the system is improperly configured. This checks if elasticsearch will accept our vm.max_map_count kernel parameter value.
def check_system_config(): if os.uname().sysname == 'Darwin': return assert int(run("cat /proc/sys/vm/max_map_count", shell=True)) >= 262144, \ 'the "vm.max_map_count" kernel parameter is too low, check readme' check_resources()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mem_limit_too_high():\n args = argparse.Namespace(cfg=os.path.join(TEST_DATA_DIR, 'mem-limit-too-high.ini'))\n with pytest.raises(UserReportError) as err:\n cfg = ElasticBlastConfig(configure(args), task = ElbCommand.SUBMIT)\n assert err.value.returncode == INPUT_ERROR\n m = re.match(r'...
[ "0.56661624", "0.5563849", "0.54744697", "0.54521096", "0.53535205", "0.5343771", "0.5293801", "0.52362907", "0.5170722", "0.5145504", "0.512169", "0.510528", "0.50375116", "0.5018581", "0.5008497", "0.4993235", "0.49708164", "0.49649447", "0.49529934", "0.49504504", "0.49429...
0.71257263
0
Sets a secrets for every path given and start liquidcore. The function sets a secret for every path given (the secrets stored in vault_secret_keys are 256 bits whereas the secrets for cookies are 64 bits long).
def populate_secrets_pre(vault_secret_keys, core_auth_cookies, extra_fns): for path in vault_secret_keys: vault.ensure_secret_key(path) for fn in extra_fns: if fn: fn(vault, config, random_secret) for name in core_auth_cookies: vault.ensure_secret(f'liquid/{name}/cooki...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secrets(self, secrets):\n\n self._secrets = secrets", "def apply_secrets():\n for name, value in Secrets.__dict__.items():\n if name[0] != '_':\n os.environ[name] = value", "def inject_secrets(self, secrets: str) -> None:\n self.config.read(secrets)", "def secrets():\n ...
[ "0.60062516", "0.5955356", "0.5753717", "0.5644572", "0.55677885", "0.55572164", "0.5395536", "0.53619534", "0.5249026", "0.521986", "0.5217434", "0.5153807", "0.5144836", "0.5131279", "0.5092254", "0.49749333", "0.49111554", "0.4859448", "0.48492607", "0.48046198", "0.479260...
0.67710537
0
Sets up oauth2 app logins. Creates OAuth2 entries for every app. If selfhosted continuous integration is enabled, then the client id and secret are added to vault.
def populate_secrets_post(core_auth_apps): # Create the OAuth2 callbacks for apps. This is really slow, so do them all # in parallel... with multiprocessing.Pool(3) as p: for app_name in p.imap_unordered(create_oauth2_app, core_auth_apps): log.debug('auth done: ' + app_name) log.info...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_oauth_app(self):\n\n sys.stdout.write('configuring up oauth...'.ljust(LJ_SIZE))\n\n u = User.objects.get(username='admin')\n\n client_id = ClientIdGenerator().hash()\n secret = ClientSecretGenerator().hash()\n\n Application.objects.create(\n client_id=client...
[ "0.6321571", "0.59347045", "0.5910343", "0.5671346", "0.56653446", "0.56570905", "0.5614971", "0.5611854", "0.56041473", "0.5568921", "0.5487579", "0.54492056", "0.542379", "0.54135835", "0.5366082", "0.5359514", "0.53497666", "0.53481054", "0.5344864", "0.53303134", "0.53254...
0.62071544
1
Runs `docker pull` and checks if the image digest changed. The arguments are passed through this function into the results for collecting after using multiprocessing.
def _update_image(name): if not name or name == 'None': return None, None old = docker.image_digest(name) for _ in range(3): new = docker.pull(name) if new: break time.sleep(5) return name, old != new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docker_pull(args, image): # type: (EnvironmentConfig, str) -> None\n if '@' not in image and ':' not in image:\n display.info('Skipping pull of image without tag or digest: %s' % image, verbosity=2)\n return\n\n if docker_image_exists(args, image):\n display.info('Skipping pull of e...
[ "0.7324519", "0.7317975", "0.6492653", "0.6412781", "0.6400874", "0.63333714", "0.62987834", "0.62827694", "0.62822807", "0.61101013", "0.6099495", "0.6094845", "0.60873497", "0.60861725", "0.6076164", "0.5951486", "0.5923291", "0.5870769", "0.5867516", "0.58490944", "0.58453...
0.7482611
0
Update all docker images in this list, running a few in parallel.
def _update_images(): any_new = False def comment(name, new): nonlocal any_new if new: log.info(f"Downloaded new Docker image for {name} - {docker.image_size(name)}") elif name: log.debug(f"Docker image is up to date for {name} - {docker.image_size(name)}") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def images_refresh(self, kwargs=None):\n scode, hosts = Rest.get('Host')\n filter = {}\n n = 1\n e = {}\n data = []\n for host in hosts:\n os.environ[\"DOCKER_HOST\"] = host['Ip'] + \":\" + str(host['Port'])\n filter['Ip'] = os.environ[\"DOCKER_HOST\"...
[ "0.7393684", "0.6848326", "0.6510606", "0.631116", "0.6200554", "0.61582994", "0.60921884", "0.60550773", "0.60332763", "0.6025518", "0.59900427", "0.5977915", "0.5964482", "0.5950539", "0.59415704", "0.59274906", "0.59194505", "0.58877873", "0.58627313", "0.58623123", "0.585...
0.7195534
1
Print the nomad address.
def nomad_address(): print(nomad.get_address())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_label(self):\r\n return _(\"Address:\")", "def __str__(self):\n return str(self.address)", "def __str__(self):\n if self._street_name != self.DEFAULT_STREET_NAME and \\\n self._house_num != self.DEFAULT_HOUSE_NUM and \\\n self._apt_num != s...
[ "0.6540764", "0.65147114", "0.6496899", "0.64924407", "0.64645696", "0.6435686", "0.6416716", "0.63989526", "0.634319", "0.6316832", "0.62607366", "0.62607366", "0.62607366", "0.62246186", "0.621415", "0.61628157", "0.6102857", "0.6101531", "0.60662496", "0.60520095", "0.6041...
0.8952292
0
Print the ID of the current allocation of the job and group.
def alloc(job, group): allocs = nomad.job_allocations(job) running = [ a['ID'] for a in allocs if a['ClientStatus'] == 'running' and a['TaskGroup'] == group ] print(first(running, 'running allocations'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showId(self):\n #Here I'm supposing that the name of the table, and the extent polygon gives a unique mapping.\n try:\n extent = self.geometry.extent\n name = self.grid_name\n res = self.dArea\n string = \"%s:%s:%s:%s\" %(self.parent_id,name,extent,res)...
[ "0.5925216", "0.5909034", "0.5886874", "0.58796924", "0.58408654", "0.57932824", "0.5763551", "0.5754771", "0.5740027", "0.5731843", "0.5731823", "0.565056", "0.56433517", "0.56062347", "0.56062347", "0.56062347", "0.5593951", "0.5591711", "0.55818737", "0.556989", "0.5569721...
0.69429296
0
Send request to deactivate last Elasticsearch data node.
def remove_last_es_data_node(): RETRY_COUNT = 120 assert config.elasticsearch_data_node_count >= 1 es_node_name = 'data-' + str(config.elasticsearch_data_node_count - 1) data_dir = config.liquid_volumes + "/hoover/es/" + es_node_name es = JsonApi(f'http://{nomad.get_address()}:{config.port_lb}/_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deactivate(self):\n pass", "def deactivate(self):\n pass", "def reset_elasticsearch_endpoint():\n reset_elasticsearch()\n resp = Response(response=json.dumps({\"success\": True}),\n status=200,\n mimetype=\"application/json\")\n return resp", "...
[ "0.55709296", "0.55709296", "0.54940456", "0.5391226", "0.52642965", "0.5207551", "0.51984835", "0.51984835", "0.5180679", "0.5174387", "0.5147491", "0.51054287", "0.5101627", "0.50623643", "0.5033121", "0.50206447", "0.49984506", "0.49952772", "0.49665517", "0.49560276", "0....
0.61925554
0
Check if the given word is a direction. Return True in case it is together with the tuple('direction', value)
def __isDirection__(self, word): self.directions = ('north', 'south', 'east', 'west', 'down', 'up', 'left', 'right', 'back') for direction in self.directions: if direction == word: return ('direction', word), True return None, False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __check_word__(self, word):\n self.directionValue, self.isDirection = self.__isDirection__(word.lower())\n self.verbValue, self.isVerb = self.__isVerb__(word.lower())\n self.stopValue, self.isStop = self.__isStopWord__(word.lower())\n self.nounValue, self.isNoun = self.__isNoun__(wo...
[ "0.67670006", "0.6721269", "0.65632236", "0.6477716", "0.64221424", "0.62539905", "0.6233002", "0.6218141", "0.6214159", "0.61778545", "0.61691964", "0.61308235", "0.61250776", "0.6102901", "0.604007", "0.6033462", "0.60139555", "0.60136336", "0.60054654", "0.59738815", "0.59...
0.8880629
0
Check if the given word is a verb. Return True in case it is together with the tuple('verb', value)
def __isVerb__(self, word): self.verbs = ('go', 'stop', 'kill', 'eat') for verb in self.verbs: if verb == word: return ('verb', word), True return None, False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_verb_concept(self):\n return self._concept_type is not None and self._concept_type.find('verb') != -1", "def is_verb(tag_string):\n result = True if tag_string in POS.POS_tags.verb_tags else False\n return result", "def isDisambiguatedByNextVerb(self, word):\n\t\treturn 'verb' in disambig_c...
[ "0.7186781", "0.7159582", "0.69565564", "0.69348013", "0.6911", "0.6759222", "0.6539279", "0.6342951", "0.62689954", "0.6135856", "0.5994092", "0.59872335", "0.59848535", "0.59429085", "0.58736104", "0.5849016", "0.5765791", "0.5714664", "0.57061744", "0.56696916", "0.5651668...
0.87067866
0
Check if the given word is a stop word. Return True in case it is together with the tuple('stop', value)
def __isStopWord__(self, word): self.stopWords = ('the', 'in', 'of', 'from', 'at', 'it') for stopWord in self.stopWords: if stopWord == word: return ('stop', word), True return None, False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_stop_word(self, word):\n pass", "def is_stop_word(word):\n return word in final_stop_words", "def is_stopword(self, word, language):", "def is_stop(word:str, STOP_WORDS:Set):\n if word in STOP_WORDS:\n return \"☑\"\n else: \n return \"☐\"", "def stop_word(w): ...
[ "0.8358522", "0.82944286", "0.82165796", "0.78624344", "0.7577541", "0.7520491", "0.745671", "0.7051994", "0.6975059", "0.6711286", "0.65029395", "0.6395346", "0.63262475", "0.6197893", "0.6165739", "0.6152451", "0.6152451", "0.6152451", "0.60918623", "0.6054247", "0.60472906...
0.8674098
0
Check if the given word is a noun. Return True in case it is together with the tuple('noun', value)
def __isNoun__(self, word): self.nouns = ('door', 'bear', 'princess', 'cabinet') for noun in self.nouns: if noun == word: return ('noun', word), True return None, False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_noun(tag):\r\n return tag in ['NN', 'NNS', 'NNP', 'NNPS']", "def is_noun(tag_string):\n result = True if tag_string in POS.POS_tags.noun_tags else False\n return result", "def isDisambiguatedByNextNoun(self, word):\n\t\treturn 'noun' in disambig_const.DISAMBIGUATATION_TABLE.get(word, {});", "...
[ "0.7459034", "0.685088", "0.665825", "0.6454289", "0.644385", "0.62773377", "0.6263778", "0.6204247", "0.6195013", "0.6167554", "0.6164598", "0.60549605", "0.6022213", "0.60210997", "0.6018829", "0.6016986", "0.59926033", "0.59599626", "0.5902154", "0.589447", "0.58158934", ...
0.8654026
0
Check if the given word is a number. Return True in case it is together with the tuple('number', value)
def __isNumber__(self, word): try: return ('number', int(word)), True except ValueError: return None, False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isNumber(word):\n try:\n int(word)\n return True\n except ValueError:\n return False", "def is_number(text):\n return text.lower() in AVRO_NUMBERS", "def _is_num(w):\n symbols = list(w)\n for s in symbols:\n if s in string.digits:\n ...
[ "0.789358", "0.7467294", "0.7333102", "0.6969791", "0.6964006", "0.6943701", "0.6941617", "0.6911992", "0.6892562", "0.6856893", "0.6847538", "0.683996", "0.68387276", "0.68271315", "0.6822781", "0.68095434", "0.68031216", "0.67755413", "0.67716694", "0.67705446", "0.67630583...
0.80926466
0
Check if the word is a direction, verb, stop word, noun or number and return the correct tuple (Type, Value)
def __check_word__(self, word): self.directionValue, self.isDirection = self.__isDirection__(word.lower()) self.verbValue, self.isVerb = self.__isVerb__(word.lower()) self.stopValue, self.isStop = self.__isStopWord__(word.lower()) self.nounValue, self.isNoun = self.__isNoun__(word.lower(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getType(word):\n rules = {\n 'direction': ['north', 'south', 'east', 'west', 'down', 'up', 'left', 'right', 'back'],\n 'verb': ['go', 'stop', 'kill', 'eat'],\n 'stop': ['the', 'in', 'of', 'from', 'at', 'it'],\n 'noun': ['door', 'bear', 'princess', 'cabinet']\n }\n if isNumb...
[ "0.673249", "0.6548602", "0.6336032", "0.6297251", "0.6100336", "0.6074194", "0.5896475", "0.57382774", "0.5719436", "0.57010007", "0.5699448", "0.5691484", "0.562829", "0.55815595", "0.5572965", "0.5569384", "0.5556088", "0.55442935", "0.55329657", "0.5467288", "0.5390347", ...
0.75480384
0
Split the given message into words. Return an array of tuples with (TYPE, WORD)
def scan(self, message): words = message.split(" ") for word in words: self.words.append(self.__check_word__(word)) return self.words
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWords(speech):\r\n return speech.split()", "def get_words(message):\n all_words = set(wordpunct_tokenize(message.replace('=\\\\n', '').lower()))\n\n # verwijder stopwoorden alsook worden waarvan lengte <=2\n msg_words = [word for word in all_words if word not in stopwords and len(word) > 2]\n\...
[ "0.66460824", "0.6443859", "0.6398183", "0.637118", "0.6302318", "0.62749106", "0.6269124", "0.6215595", "0.6203069", "0.62026393", "0.62026393", "0.61878115", "0.6163675", "0.6147167", "0.6147167", "0.6147167", "0.6147167", "0.6147167", "0.6146015", "0.6146015", "0.6129641",...
0.66256505
1
function that checks if a word is a number or not
def isNumber(word): try: int(word) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(text):\n return text.lower() in AVRO_NUMBERS", "def _is_num(w):\n symbols = list(w)\n for s in symbols:\n if s in string.digits:\n return '<NUM>'\n return w", "def isnum(self, x):\n\n return x in '1234567890.-'", "def ...
[ "0.78436583", "0.7706737", "0.75962543", "0.7555199", "0.75409734", "0.75214046", "0.75180584", "0.7509221", "0.7465878", "0.7459621", "0.74367565", "0.7393404", "0.7370456", "0.73683584", "0.7351673", "0.7326669", "0.7314529", "0.728529", "0.7263139", "0.721123", "0.71813613...
0.8211872
0
Function that checks the type of a word based on a dictionary
def getType(word): rules = { 'direction': ['north', 'south', 'east', 'west', 'down', 'up', 'left', 'right', 'back'], 'verb': ['go', 'stop', 'kill', 'eat'], 'stop': ['the', 'in', 'of', 'from', 'at', 'it'], 'noun': ['door', 'bear', 'princess', 'cabinet'] } if isNumber(word): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isWord(word, dictionary):\n return word in dictionary", "def w_is_typed(tokens):\n return (\n 'type' in tokens or\n 'answerblock' in tokens or\n 'drawbox' in tokens or\n 'answerfigure' in tokens\n )", "def is_a_word(self, word):\n word = word.lower()\n if ...
[ "0.73175365", "0.66626674", "0.65457463", "0.6478905", "0.6371712", "0.6314994", "0.62179106", "0.61699104", "0.6151976", "0.61438", "0.6087933", "0.6069086", "0.6036974", "0.60271037", "0.5990495", "0.5979531", "0.59705436", "0.5969391", "0.59635544", "0.596286", "0.59567255...
0.7311886
1
Returns None if this is the base class. Returns the type of project if this is a valid project.
def project_type(self): project_type = self.__class__.__name__.lower() if project_type == 'baseproject': project_type = None return project_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"project\")", "def project(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"project\")", "def project(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"project\")", "def project(...
[ "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6679888", "0.6569116", "...
0.87560594
0
Print each vertex in depthfirst order beginning from starting_vertex.
def dft(self, starting_vertex): visited = [] stack = Stack() stack.add(starting_vertex) while len(stack): current = stack.pop() if current not in visited: print(current) visited.append(current) f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print(self):\n for i, v in enumerate(self._adj):\n if v:\n print(\"vertex {0}\".format(i))\n for e in v:\n print(e)\n print()", "def dft_recursive(self, starting_vertex):\n # TODO\n # creating a function inside th...
[ "0.71442217", "0.6844493", "0.6655301", "0.6629964", "0.65694076", "0.64505523", "0.63725525", "0.62792003", "0.618516", "0.6174981", "0.6125597", "0.61178565", "0.6105832", "0.6093275", "0.6074492", "0.60744387", "0.6066715", "0.6049891", "0.6042915", "0.60275644", "0.602577...
0.7097335
1
Return a list containing a path from starting_vertex to destination_vertex in depthfirst order.
def dfs(self, starting_vertex, destination_vertex): parents = {} for index, (p, c) in enumerate(self.vertices.items()): for child in c: if child not in parents: parents[child] = [] parents[child].append(p) path = [] curre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dfs(self, starting_vertex, destination_vertex):\n visited = set()\n paths = [[starting_vertex]]\n \"\"\"\n While the length of possible paths is not zero. \n Store the current path and remove it from possible \n paths. Return the last path if it's the destination. \n ...
[ "0.7577893", "0.74265605", "0.73263896", "0.7264412", "0.72132045", "0.71690327", "0.7143365", "0.7078884", "0.7001528", "0.69962204", "0.6983124", "0.69708425", "0.69157046", "0.6913365", "0.6913365", "0.6899288", "0.6899288", "0.6868995", "0.6810703", "0.6806686", "0.680453...
0.8430803
0
Set the credentials for the given session.
def SetCredentials(self, credentials): self._session[_CREDENTIAL_KEY] = credentials self._ReCreateUserInfo(credentials)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_credentials():", "def set_credentials(self, *args, **kwargs):\n pass", "def set_credentials(self, user, password):\n self.user = user\n self._set_opener(user, password)", "def setCredentials( self, login=MissingValue, password=MissingValue ):\n if login is not MissingValue...
[ "0.71832484", "0.709029", "0.6921396", "0.687898", "0.6826994", "0.66519225", "0.63632244", "0.6324048", "0.63118005", "0.62895787", "0.621978", "0.6218051", "0.6194222", "0.6034496", "0.6031702", "0.5973921", "0.59593534", "0.5913587", "0.59020656", "0.5862252", "0.58606553"...
0.75476635
0
Set the user information in the session.
def SetUserInformation(self, user_info): self._session[_USER_INFO_KEY] = user_info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_current_user(self, user):\n self.session['u'] = user.get().key.urlsafe()", "def setup_user():\n if 'auth_user' in flask.session:\n user = models.User.query.get(flask.session['auth_user'])\n if user is None:\n # old bad cookie, no good\n del flask.session['aut...
[ "0.768364", "0.7397751", "0.73670053", "0.72930264", "0.72716004", "0.7042937", "0.70326406", "0.7018134", "0.68026054", "0.6793498", "0.6786732", "0.6779422", "0.67743343", "0.6705677", "0.66985685", "0.6660348", "0.6606209", "0.659772", "0.659542", "0.65333986", "0.65333986...
0.80242234
0
Return the package name as the sole visible directory under rootDir. Raise RuntimeError if there is not exactly one visible directory under rootDir.
def getPackageName(rootDir="python"): dirIter = os.walk(rootDir) (dirPath, dirList, fileList) = next(dirIter) dirList = [dirName for dirName in dirList if not dirName.startswith(".")] if len(dirList) != 1: raise RuntimeError("Found %s instead of 1 directory" % (dirList,)) return dirList[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _package_root(name):\n return name.split('.', 1)[0]", "def package_dir(self):\r\n return \".\"", "def _package_name(root_path, path):\n if not _under(path, root_path):\n raise ValueError('\"%s\" is not a subpath of \"%s\"' % (path, root_path))\n return path[len(root_path) + 1:].replace(o...
[ "0.68817973", "0.672186", "0.6580668", "0.6543408", "0.651663", "0.6477734", "0.6467718", "0.6402619", "0.63620394", "0.63317144", "0.63117087", "0.62970096", "0.62927186", "0.627097", "0.61816436", "0.61396646", "0.6112495", "0.60953516", "0.60753113", "0.60702145", "0.60676...
0.7023158
0
Get the list of sites to use for PrivateMC workflows. For the moment we are filtering out T1_ since they are precious resources and don't want to overtake production (WMAgent) jobs there. In the future we would like to take this list from the SSB.
def getListOfSites(self): with self.config.TaskWorker.envForCMSWEB: sites = self.resourceCatalog.getAllPSNs() filteredSites = [site for site in sites if not site.startswith("T1_")] return filteredSites
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_sites(self):\n\n return self.site_db_obj.get_list_of_sites()", "def sites(self):\n return self._sites", "def sites(self):\n return self._sites", "def sites(self):\n return self.data.sites.values", "def get_list_of_sites(self) -> list:\n ah_write = self.get...
[ "0.6728959", "0.67110044", "0.67110044", "0.6652487", "0.6637475", "0.6616133", "0.6533508", "0.6434278", "0.6367477", "0.636715", "0.63461065", "0.62432724", "0.6142592", "0.6020553", "0.5980879", "0.5945056", "0.59386986", "0.5904653", "0.5891012", "0.58844113", "0.58818495...
0.792737
0
Calculates the taboo cells for the given warehouse id and prints them
def print_taboo_spaces(warehouse_id): problem_file = "./warehouses/warehouse_{:02d}.txt".format(warehouse_id) wh = Warehouse() wh.load_warehouse(problem_file) print(wh) print("TABOO CELLS: ") taboo = taboo_cells(wh) print(taboo)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print(self):\n print(\"-----\", self.name, \"-----\")\n print(\"Enable index\", self.enable_index)\n print(\"End index:\", self.stop_index)\n print(\"Measurement length (from the very beginning to the end index):\", self.time_vec[self.stop_index])\n print()\n print(\"S...
[ "0.5277908", "0.52769065", "0.5272588", "0.5245294", "0.5211563", "0.5189378", "0.51883966", "0.51851934", "0.5181804", "0.5176772", "0.51681626", "0.514574", "0.51347136", "0.5133972", "0.5110808", "0.510619", "0.5099038", "0.5096307", "0.5095281", "0.5094976", "0.50852066",...
0.75753945
0
Get the power spectrum of alm1 and alm2, we use healpy.alm2cl for doing this. for the spin0 and spin2 case it is a bit ugly as we have to deal with healpix convention.
def get_spectra(alm1, alm2=None, spectra=None): if spectra is None: if alm2 is None: cls = hp.sphtfunc.alm2cl(alm1) else: cls = hp.sphtfunc.alm2cl(alm1, alm2) l = np.arange(len(cls)) return l, cls cls = hp.sphtfunc.alm2cl(alm1, alm2) l = np.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spectra_pixell(alm1, alm2=None, spectra=None):\n \n if spectra is None:\n if alm2 is None:\n cls = curvedsky.alm2cl(alm1)\n else:\n cls = curvedsky.alm2cl(alm1, alm2)\n l = np.arange(len(cls))\n return l, cls\n \n \n cls = curvedsky.a...
[ "0.6497778", "0.6231929", "0.6082935", "0.6082744", "0.603263", "0.598273", "0.59120846", "0.5775731", "0.5642607", "0.5604873", "0.5559391", "0.5517512", "0.550861", "0.53265345", "0.52974665", "0.52772915", "0.52672523", "0.52103794", "0.51691973", "0.5154307", "0.51436174"...
0.67046833
0
Get the power spectrum of alm1 and alm2, we use pixell.alm2cl (this is faster)
def get_spectra_pixell(alm1, alm2=None, spectra=None): if spectra is None: if alm2 is None: cls = curvedsky.alm2cl(alm1) else: cls = curvedsky.alm2cl(alm1, alm2) l = np.arange(len(cls)) return l, cls cls = curvedsky.alm2cl(alm1[:,Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spectra(alm1, alm2=None, spectra=None):\n\n if spectra is None:\n if alm2 is None:\n cls = hp.sphtfunc.alm2cl(alm1)\n else:\n cls = hp.sphtfunc.alm2cl(alm1, alm2)\n l = np.arange(len(cls))\n return l, cls\n \n cls = hp.sphtfunc.alm2cl(alm1, alm...
[ "0.67771775", "0.6537302", "0.6268171", "0.62503314", "0.5895213", "0.5884554", "0.5878578", "0.5871677", "0.5596098", "0.5576113", "0.5473899", "0.54375094", "0.5418897", "0.54117674", "0.5387484", "0.5376538", "0.53694975", "0.53624314", "0.5345933", "0.5345544", "0.5304626...
0.7266525
0
deconvolve the mode coupling matrix
def deconvolve_mode_coupling_matrix(l, ps, inv_mode_coupling_matrix, spectra=None): n_element = len(l) if spectra is None: ps = np.dot(inv_mode_coupling_matrix, ps) else: ps["TT"] = inv_mode_coupling_matrix["spin0xspin0"] @ ps["TT"] for spec in ["TE", "TB"]: ps[spec] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deconvolution(obs, green, lambd):\n\n nr, nt = obs.shape\n num = np.zeros(nt)\n den = np.zeros(nt)\n\n for ir in range(len(obs)):\n\n OBS = fft(obs[ir, :])\n GRE = fft(green[ir, :])\n\n # Sum all\n num = num + np.conj(GRE) * OBS\n den = den + np.conj(GRE) * GRE\n\...
[ "0.62708265", "0.62411857", "0.5942056", "0.58985466", "0.57968473", "0.57631505", "0.5662541", "0.5540479", "0.5527455", "0.5498456", "0.5487986", "0.5485438", "0.54613376", "0.5460645", "0.54552037", "0.5451292", "0.54421663", "0.5362415", "0.53527665", "0.5335526", "0.5334...
0.6550161
0
Bin the power spectra according to a binning file and optionnaly deconvolve the (binned) mode coupling matrix
def bin_spectra(l, cl, binning_file, lmax, type, spectra=None, mbb_inv=None, binned_mcm=True): bin_lo, bin_hi, lb, bin_size = pspy_utils.read_binning_file(binning_file, lmax) n_bins = len(bin_hi) # the alm2cl return cl starting at l = 0, we use spectra from l = 2 # this is due in particular to the fac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin_by_resel(data_table , binsize = 6, weighted = True, verbose = True):\n exptimes_ = []\n wvlns_, fluxs_, fluxErrs_, fluxErr_lowers_, gross_s_, gcount_s_ = [], [], [], [], [], []\n \n print(f\"function `bin_by_resel` is Binning by {binsize}\")\n for i in range(len(data_table)):\n exptim...
[ "0.61424226", "0.6121043", "0.61174715", "0.60917556", "0.60789603", "0.59740865", "0.5945219", "0.5892906", "0.58700466", "0.58632094", "0.58416015", "0.582106", "0.5792225", "0.5784845", "0.57504296", "0.573096", "0.573096", "0.573096", "0.573096", "0.573096", "0.573096", ...
0.6559454
0
Take a vector of power spectra and return a power spectra dictionnary. vec should be of the form [spectra[0], spectra[1], ... ]. For example [cl_TT,cl_TE,cl_ET, ...., cl_BB]
def vec2spec_dict(n_bins, vec, spectra): return {spec: vec[i * n_bins:(i + 1) * n_bins] for i, spec in enumerate(spectra)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_chem_pot_dict(self, chem_pot_vec):\n chem_pot_dict = {}\n for i, name in enumerate(self._singlet_names):\n chem_pot_dict[name] = chem_pot_vec[i]\n return chem_pot_dict", "def vector_to_factor_dict(self, vector):\n factor_dict = {\n \"booking_limits\": ve...
[ "0.5798344", "0.55926347", "0.55298084", "0.5507293", "0.5497036", "0.54379904", "0.5307009", "0.528564", "0.5176992", "0.5015678", "0.49572787", "0.49300274", "0.49117064", "0.48775715", "0.4844245", "0.4801468", "0.47855532", "0.47757897", "0.47567853", "0.4746062", "0.4738...
0.7266163
0
Read the power spectra in a hdf5 file.
def read_ps_hdf5(file, spec_name, spectra=None): spec = file[spec_name] data = np.array(spec["data"]).T l = data[:,0] if spectra is None: ps = data[:, 1] else: ps = {spec: data[:, i + 1] for i, spec in enumerate(spectra)} return l, ps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def openMCSH5File(filename, verbose=False):\n rf = h5py.File(filename, 'r')\n \n stream = rf.require_group('/Data/Recording_0/AnalogStream/Stream_0')\n data = np.array(stream.get('ChannelData'),dtype=np.int)\n timestamps = np.array(stream.get('ChannelDataTimeStamps'))\n info = np.array(stream.get...
[ "0.6844775", "0.6227084", "0.61179084", "0.60264516", "0.60045594", "0.6001637", "0.5998591", "0.59757334", "0.5960156", "0.595381", "0.59099746", "0.5887677", "0.58626664", "0.58496535", "0.57918787", "0.57847416", "0.57835114", "0.5736834", "0.57282406", "0.5726041", "0.569...
0.64703524
1
Deletes all contours that are big enough and their descendants. Used to delete artificial contours.
def kill_nested_in_big (contours,hierarchy,max_size = 120000): ts = time.time() del_indexes = [] conts = [] hier = [] art_conts = [] # find all sons for i,c in enumerate(contours): if((cv2.contourArea(c) > max_size)): # and util.solidity (c) > const.MIN_ARTIFICIAL_SO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_big_areas(img):\n gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)\n # ret, gray = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)\n gray = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 101, 3) \n implt(gray, 'gray')\n \n gray2 ...
[ "0.6857098", "0.6625931", "0.61222583", "0.61085695", "0.5954586", "0.5934998", "0.5904931", "0.5894366", "0.5768541", "0.5753343", "0.57331336", "0.57133895", "0.56409633", "0.55974716", "0.5533228", "0.5526213", "0.55262095", "0.5450178", "0.5440893", "0.5438663", "0.541455...
0.7297142
0
Returns True if the conture is of bare soil
def bare_soil(sil): sil.get_color_params() if ((sil.l_mean < 160) and (sil.a_std > 3)): return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containseverything(self) -> bool:\n return self.isinfinite() and self.complement().isempty()", "def is_water(self):\n return False", "def is_water(self):\n return False", "def isGasBoiler(self):\n if self.getTER1() == 0 and self.getTER2() == 0:\n return 1 #gas boile...
[ "0.6476771", "0.6385747", "0.6385747", "0.63753754", "0.6356601", "0.6286141", "0.6178974", "0.6178035", "0.6174257", "0.61393034", "0.61266136", "0.6090212", "0.60650873", "0.60628986", "0.60216665", "0.60132676", "0.5986183", "0.5968524", "0.59555763", "0.59400445", "0.5922...
0.72889656
0
Classify all conts in an image, to artificial/baresoil/targets
def main_classifier (image,conts,hierarchy,pxl_size = -1): ts0 = time.time() art_conts = [] bare_soil_conts = [] target_conts = [] del_indexes = [] t1 = time.time() im = image #.get_image() t2 = time.time() artificial_pxl_size = const.MAX_ARTIFICIAL_TRUE_SIZE / (pxl_size**2) te0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify_images():\n\n # Load the desired image\n img_path = 'dataset/colorize_images/n02085782_919.jpg'\n img = image.load_img(img_path, target_size=(299, 299))\n x = image.img_to_array(img)\n x = np.expand_dims(x, axis=0)\n x = preprocess_input(x)\n\n model = InceptionV3(weights=\"imagen...
[ "0.652355", "0.62996066", "0.62669665", "0.6147759", "0.6140895", "0.6107709", "0.6082123", "0.6052951", "0.603589", "0.6016999", "0.60133874", "0.5992065", "0.594448", "0.5942497", "0.5907343", "0.58895636", "0.58869237", "0.58762413", "0.5859374", "0.5843471", "0.5842482", ...
0.648036
1
There may be more than one instance for an ArchivalObject we look for an instance that has a top_container defined return
def get_instance (self): instances = self.data['instances'] if not len(instances): raise Exception, "ArchivalObject: No Instances found" for instance in instances: # print json.dumps(instance, indent=3) try: instance['sub_container']['top_conta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getContainerTop(self):\n return self.containerTop", "def find_player_bp():\n for i in inven.GetContainers():\n if (i.Id == inven.GetItemInSlot(3).Id) and (i.HasParent == False):\n return i\n\n print 'Container not found'\n return None", "def getInstacefromContainer(cls, co...
[ "0.5939105", "0.593623", "0.5851786", "0.57729405", "0.54912174", "0.5461053", "0.5459171", "0.5405615", "0.53490996", "0.5323763", "0.53106874", "0.5288503", "0.52042735", "0.51936555", "0.5147344", "0.5076248", "0.50714755", "0.50197434", "0.50184083", "0.49974832", "0.4994...
0.7895253
0
Set the top_container to specified top_container_id. Assumes there should be a single top container only!
def set_top_container (self, top_container_id): instance = self.get_instance() instance['sub_container']['top_container']['ref'] = '/repositories/2/top_containers/%s' % top_container_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def container_id(self, container_id):\n\n self._container_id = container_id", "def top(self, top):\n\n self._top = top", "def top(self, top):\n\n self._top = top", "def set_top(self,top_name):\n self.top_name = top_name", "def _update_container(self):\n client = docker.fr...
[ "0.6100906", "0.5791204", "0.5791204", "0.5759552", "0.57387", "0.53711313", "0.53711313", "0.53328", "0.5329554", "0.5326246", "0.51455945", "0.5114905", "0.5105981", "0.5058464", "0.4998576", "0.4930108", "0.48920053", "0.48558876", "0.48511288", "0.4840944", "0.4810169", ...
0.8874447
0
Get the details for a Report from an RDF triplestore
def _get_details(self): # formulate the query query = ''' PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX proms: <http://promsns.org/def/proms#> PREFIX prov: <http://www.w3.org/ns/prov#> SELECT * WHERE { GRAPH ?g { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_report(self, address: Any = None, rep_id: int = None) -> requests.Response:\n return self._call('GET', '/report', params={\n 'address': address,\n 'repId': rep_id\n })", "def get_report(ctx, report_ids):\n client = ctx.obj[\"client\"]\n for report_id in report_id...
[ "0.5920797", "0.56297696", "0.5407115", "0.5373363", "0.525492", "0.52500683", "0.52405846", "0.5239231", "0.5234334", "0.52331907", "0.52233917", "0.5220807", "0.52158725", "0.5197146", "0.513769", "0.5119394", "0.5101112", "0.50999993", "0.508475", "0.50723165", "0.5062235"...
0.67822313
0
Override for update_runtime_variables for custom parsing
def update_runtime_variables(self) -> None: # Opportunistic, works if SELinux not enforced super().update_runtime_variables() self.parse_sysconfig_var()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_variable(self, variable): # pragma: no cover\n raise NotImplementedError('Implemented in child class')", "def _parse(self):\n pass", "def parse_variable_value(self, line):\n tmp = self.parse_metadata_line(line, 'get')\n md_var_names, md_names, md_line = tmp\n\n # E...
[ "0.61919564", "0.57564145", "0.57527184", "0.57315135", "0.56750315", "0.561023", "0.5594056", "0.55782694", "0.5482233", "0.5463628", "0.5403518", "0.5371495", "0.5321528", "0.53196675", "0.53119797", "0.53096265", "0.5291114", "0.5287409", "0.5271257", "0.526977", "0.526639...
0.6131023
1
Submit form to view defines quantity of product added to shopping bag
def add_to_bag(request, item_id): product = get_object_or_404(Product, pk=item_id) # Get quantity of item and add to current bag quantity = int(request.POST.get('quantity')) redirect_url = request.POST.get('redirect_url') # get products select = None if 'product_select' in request.POST: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_shoppingbag(request, item_id):\n\n quantity = int(request.POST.get('quantity'))\n redirect_url = request.POST.get('redirect_url')\n size = None\n if 'merchandise_size' in request.POST:\n size = request.POST['merchandise_size']\n shoppingbag = request.session.get('shoppingbag', {})\...
[ "0.68162733", "0.67571735", "0.6658857", "0.66071445", "0.6599626", "0.6589895", "0.6522963", "0.6518172", "0.6508417", "0.64594775", "0.6433578", "0.6432066", "0.6431109", "0.63977545", "0.6373436", "0.6352588", "0.63389534", "0.633268", "0.6326888", "0.63219446", "0.6292119...
0.67959094
1
Submit update form to view to update shopping bag
def update_bag(request, item_id): product = get_object_or_404(Product, pk=item_id) # Get quantity of item and add to current bag quantity = int(request.POST.get('quantity')) # get products select = None if 'product_select_id' in request.POST: select = request.POST['product_select_id']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_update(request):\n if request.method == 'POST':\n item_to_update = get_object_or_404(StockItem, pk=request.POST['id'])\n item_to_update.name = request.POST['name']\n item_to_update.count = int(request.POST['count'])\n item_to_update.date_of_expiration = request.POST['exp']\n...
[ "0.69255984", "0.6524598", "0.63340825", "0.6302064", "0.61911786", "0.6104844", "0.6037049", "0.6032212", "0.5962508", "0.5932371", "0.59208465", "0.5899975", "0.58690614", "0.58607394", "0.5842495", "0.5840684", "0.58130383", "0.58054495", "0.57666415", "0.57326406", "0.571...
0.7033655
0
Read next block of text from file and returns four strings and list
def next_block(the_file): category = next_line(the_file) question = next_line(the_file) answers = [] for i in range(4): answers.append(next_line(the_file)) # Conversion answer by cut '\n' which is read from txt file correct = next_line(the_file) correct = correct.strip('\n') points = next...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_block(the_file):\n category = next_line(the_file)\n question = next_line(the_file)\n answers = []\n for i in range(4):\n answers.append(next_line(the_file))\n\n correct = next_line(the_file)\n if correct:\n correct = correct[0]\n explanation = next_line(the_file)\n\n ...
[ "0.71694505", "0.7149875", "0.6398054", "0.61799496", "0.6147387", "0.6030554", "0.59459436", "0.58621806", "0.58497167", "0.5847863", "0.58322585", "0.58317626", "0.58112925", "0.5807234", "0.58042705", "0.5790026", "0.5790026", "0.5780091", "0.57448435", "0.5735574", "0.572...
0.7430885
0
Asking yes or no questions
def ask_yes_no(question): response = None while response not in ("y", "n"): response = input(question).lower() return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_Yes_no(question, **kwargs):\n return ask_yes_no(question, default=\"y\", **kwargs)", "def ask_yes_No(question, **kwargs):\n return ask_yes_no(question, default=\"n\", **kwargs)", "def eval_y_n(self, question):\n answer = raw_input(question + \" [y/n] : \")\n return answer.lower() in...
[ "0.7614199", "0.7519589", "0.7499955", "0.74935395", "0.7477794", "0.74647367", "0.74524534", "0.7423375", "0.74129075", "0.74101156", "0.7377443", "0.73751044", "0.7365018", "0.73452204", "0.7339778", "0.7307625", "0.7237996", "0.7236304", "0.7225837", "0.72239035", "0.72169...
0.7590542
1
Sprite needs to be a pygame.image object.
def __init__(self, sprite): self.sprite = sprite
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n # Call the parent class (Sprite) constructor\n super().__init__()\n\n self.image = pygame.Surface([20, 20])\n self.image.fill(RED)\n\n self.rect = self.image.get_rect()", "def __init__(self):\n # Call the pare...
[ "0.6985332", "0.6973626", "0.6831595", "0.6831595", "0.67319673", "0.67185324", "0.66925913", "0.6686012", "0.6662481", "0.6637729", "0.6637485", "0.6610897", "0.660033", "0.6596914", "0.6587467", "0.65714735", "0.64629394", "0.6451392", "0.6406171", "0.63714856", "0.6319911"...
0.7154421
0
Loads environment for inference mode, used in jupyter notebook.
def load_env(data_dir, model_dir): model_params = sketch_rnn_model.get_default_hparams() with tf.gfile.Open(os.path.join(model_dir, 'model_config.json'), 'r') as f: model_params.parse_json(f.read()) return load_dataset(data_dir, model_params, inference_mode=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_environment(self):\n # import outside of cell so we don't get a traceback\n from sage import all_cmdline\n from sage.repl.user_globals import initialize_globals\n initialize_globals(all_cmdline, self.shell.user_ns)\n self.run_init()", "def load_environment(self, env):\...
[ "0.62730896", "0.6208105", "0.6028741", "0.586392", "0.58456445", "0.5837497", "0.57491773", "0.57484585", "0.5718714", "0.5686432", "0.563619", "0.5559297", "0.5552985", "0.55186814", "0.54520696", "0.54429024", "0.5422108", "0.5422108", "0.5422108", "0.5422108", "0.5422108"...
0.65105677
0
Download pretrained models to a temporary directory.
def download_pretrained_models( models_root_dir='/tmp/sketch_rnn/models', pretrained_models_url=PRETRAINED_MODELS_URL): tf.gfile.MakeDirs(models_root_dir) zip_path = os.path.join( models_root_dir, os.path.basename(pretrained_models_url)) if os.path.isfile(zip_path): tf.logging.info('%s already e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_pre_trained_model (model_name):\n model_url = cfg.LIST_MODEL_TO_DOWNLOAD[model_name]\n\n file_name = (model_url.split(\"/\")[-1]).split(\".\")[0] # get file name from url\n\n # create directory if not exit\n if not os.path.exists(os.path.join(cfg.PATH_PRE_TRAINED_MODELS,file_name)):\n ...
[ "0.70658165", "0.6752764", "0.6737815", "0.6700069", "0.65289086", "0.6440069", "0.6427293", "0.6417896", "0.63841856", "0.6345454", "0.63129276", "0.63106924", "0.6299627", "0.6294661", "0.6234909", "0.6200997", "0.6187767", "0.6082064", "0.60380375", "0.60232204", "0.601958...
0.7816876
0
Train a sketchrnn model.
def trainer(model_params): np.set_printoptions(precision=8, edgeitems=6, linewidth=200, suppress=True) tf.logging.info('sketch-rnn') tf.logging.info('Hyperparams:') tf.logging.info('Loading data files.') datasets = load_dataset(FLAGS.data_dir, model_params) train_set = datasets[0] valid_set = datasets[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train():\n args = arguments()\n\n # Create output directories\n create_output_dir(args.outputDir)\n\n # Start Log File\n log_path = os.path.join(args.outputDir, LOG_DIR, time.strftime('%Y-%m-%d_%H-%M-%S.log'))\n log_file = Logger(log_path)\n\n # Log arguments\n arg_str = ''\n for arg...
[ "0.6787768", "0.669849", "0.668386", "0.668386", "0.66198343", "0.6546574", "0.65256673", "0.65193766", "0.64996576", "0.6493797", "0.64494854", "0.64484054", "0.64231074", "0.64231074", "0.6388172", "0.6358295", "0.6339183", "0.632785", "0.6320554", "0.6303163", "0.62836313"...
0.7274986
0
Clicks the "show more" button when scrolling down the review page of a play store app Tested yet with review pages only.
def click_button_xpath(driver, platform): xpath = settings.platforms[platform]['search_listings']['show_more_xpath'] time.sleep(1) show_more_button = driver.find_elements_by_xpath(xpath)[0] driver.execute_script("arguments[0].click();", show_more_button)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_more(self):\r\n delay = WebDriverWait(driver, 5)\r\n try:\r\n ReadMore = delay.until(EC.element_to_be_clickable((By.XPATH, \".//div[@id='see_more_pager']//a[.= 'Lihat Hasil Selanjutnya'] \")))\r\n ReadMore.click()\r\n except:\r\n try:\r\n ...
[ "0.7033098", "0.6344363", "0.60130936", "0.5971481", "0.5927033", "0.59119856", "0.5804481", "0.57168674", "0.5628345", "0.5611567", "0.5599046", "0.54855263", "0.54716974", "0.54516166", "0.543418", "0.5370538", "0.5298097", "0.52818733", "0.52784103", "0.5269796", "0.526903...
0.6422785
1
Scrolls down a webpage x_times times. Clicking button button when scrolled down if specified.
def scroll_down_till_limit(driver, platform): # Scroll page to load whole content last_height = 0 while True: new_height = scroll_down_page(driver) # if no more scrolling possible if new_height == last_height: break # if specified point in past reached if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scroll():\n \n SCROLL_PAUSE_TIME = 0.5\n \n last_height = driver.execute_script(\"return window.scrollY\") \n \n tries = 0\n while True:\n down_height = last_height + 1000\n driver.execute_script(\"window.scrollTo(0,\" + str(down_height) + \")\")\n \n time.s...
[ "0.6831954", "0.6493584", "0.6476292", "0.6447726", "0.6378296", "0.63718534", "0.6231462", "0.61754245", "0.6112342", "0.60975766", "0.60956115", "0.60364723", "0.5924752", "0.59026605", "0.5895913", "0.58146757", "0.5752206", "0.5742012", "0.5699637", "0.56971246", "0.56847...
0.65855026
1
Get correct embed url for Youtube or Vimeo.
def get_embed_url(self): embed_url = None youtube_embed_url = 'https://www.youtube.com/embed/{}' vimeo_embed_url = 'https://player.vimeo.com/video/{}' # Get video ID from url. if re.match(YOUTUBE_URL_RE, self.url): embed_url = youtube_embed_url.format(re.match(YOUTUB...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_embed_url(self):\n if not self.get_video_id():\n return ''\n \n return 'https://player.vimeo.com/video/%s' % self.get_video_id()", "def get_embed_url(self):\n if not self.get_video_id():\n return ''\n \n if not self.embed_url:\n self.embed_url ...
[ "0.7828118", "0.7814367", "0.7414861", "0.737184", "0.72612184", "0.72476715", "0.7107336", "0.70412034", "0.69847536", "0.69211274", "0.6907252", "0.68743837", "0.66982573", "0.6473078", "0.6468694", "0.6453508", "0.64285535", "0.6417479", "0.6410676", "0.6389189", "0.633747...
0.84772736
0
Set html field with correct iframe.
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): if self.url: iframe_html = '<iframe src="{}" frameborder="0" title="{}" allowfullscreen></iframe>' self.html = iframe_html.format( self.get_embed_url(), self.title ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setHtmlValue(self, html): #$NON-NLS-1$\r", "def as_iframe(self, html_data):\n\n srcdoc = html_data.replace('\"', \"'\")\n return ('<iframe id=\"{div_id}\", srcdoc=\"{srcdoc}\" style=\"width: {width}; '\n 'height: {height};\"></iframe>'.format(\n div_id=self.div...
[ "0.6441944", "0.64249814", "0.5759606", "0.57419306", "0.56163406", "0.5604228", "0.55218154", "0.53373575", "0.5335781", "0.5322123", "0.5291798", "0.5280631", "0.5279701", "0.52749676", "0.5256767", "0.5237193", "0.5233074", "0.52274734", "0.52215004", "0.52162135", "0.5121...
0.65802157
0
Loads a remotely stored image into memory as an OpenCV/Numpy array
def load_remote_image(image_url): response = requests.get(image_url, stream=True) img = Image.open(BytesIO(response.content)) image = cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR) return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadImage(img_path):\n\n img = Image.open(img_path)\n np_img = np.array(img)\n return (np_img)", "def load_image(img_file: str) -> numpy.ndarray:\n img = cv2.imread(img_file, 0) # Load in Gray Scale\n return img", "def load_image(self, img_name):\n img_data = cv2.imread(img_name, 0)\...
[ "0.6853666", "0.68157405", "0.6747305", "0.65142685", "0.64450747", "0.6443917", "0.64067864", "0.63988316", "0.6388035", "0.63744015", "0.63716054", "0.6365284", "0.6361425", "0.63565683", "0.63180566", "0.6264895", "0.6252883", "0.6237735", "0.62246114", "0.62240994", "0.61...
0.7072676
0
Downloads JSON metadata files for a set of images with a given S3 prefix This function downloads the JSON files and puts them in a folder called "json" in the current working directory.
def download_json_metadata_from_s3(bucket_name, prefix="", num_threads=20): # simple method for threads to pull from a queue and download JSON files def download_object(queue): while True: obj = queue.get() if obj is None: break obj.Object().download_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_s3_files(bucket, prefix):\n \n s3 = boto3.client('s3')\n\n if type(prefix) != list:\n prefix = [prefix]\n \n # Loop over prefixes:\n file_list = []\n for p in prefix:\n \n # Load one prefix:\n response = s3.list_objects_v2(Bucket=bucket, Prefix=p)\n ...
[ "0.64972776", "0.64391273", "0.6400086", "0.6288178", "0.6250664", "0.6176843", "0.6142461", "0.6076157", "0.6075296", "0.6051385", "0.6047283", "0.6035559", "0.6011339", "0.5987856", "0.59870446", "0.5977654", "0.5966956", "0.59460807", "0.59234214", "0.5918367", "0.5907186"...
0.7765149
0
Downloads semantic masks, label maps, and original images from S3 This function downloads the semantic mask PNG files and puts them in a folder called "masks" in the current working directory, and it does the same for label map CSVs but puts them in a folder called "labels".
def download_image_data_from_s3(image_ids, prefix="", num_threads=20): # simple method for threads to pull from a queue and download files def download_object(queue): while True: obj = queue.get() if obj is None: break obj.Object().download_file(obj.k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_images(path, dataset):\n \n print(f\"Processing images {os.path.join(path, dataset)}\", flush=True)\n label_file = os.path.join(path, dataset + '-labels-idx1-ubyte')\n with open(label_file, 'rb') as file:\n _, num = struct.unpack(\">II\", file.read(8))\n labels = numpy.fromfil...
[ "0.60393983", "0.5830984", "0.57466894", "0.57055396", "0.56822556", "0.56214005", "0.56166536", "0.5579245", "0.55012137", "0.5485271", "0.5476514", "0.54472387", "0.54363936", "0.5426099", "0.54092324", "0.5402907", "0.53980774", "0.5371031", "0.534213", "0.530074", "0.5294...
0.6166055
0
Constructs the S3 filepath for a given image ID
def get_s3_filepath(image_id, prefix="", filetype="png"): bucket_name = os.environ["LABELED_BUCKET_NAME"] key_name = "{prefix}/{id}.{suffix}".format( prefix=prefix, id=image_id, suffix=filetype) url = "https://s3.amazonaws.com/{bucket}/{key}".format( bucket=bucket_name, key=key_name) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_convert_id_to_path(self):\n backend = BackendS3(**self.config)\n filename = 'demo-test.tar.gz'\n id = utils.generate_id(filename)\n parts = backend.id_to_path(id)\n self.assertEquals(6, len(parts))\n self.assertEquals(filename, parts[5])", "def get_s3_url(iid):\...
[ "0.71750176", "0.6932295", "0.69124687", "0.6774749", "0.65561664", "0.6491738", "0.6454519", "0.64104897", "0.64037967", "0.6299588", "0.62905556", "0.6274981", "0.6165325", "0.6162891", "0.6142884", "0.61318266", "0.61236405", "0.6119733", "0.6104078", "0.60496026", "0.6031...
0.7880191
0
Test methods for Right [Scalene, Isosceles] triangle
def test_right_triangle(self): self.assertEqual(classify_triangle(3, 4, 5), 'Right Scalene') self.assertEqual(classify_triangle(10, 6, 8), 'Right Scalene') self.assertEqual(classify_triangle(24, 25, 7), 'Right Scalene') self.assertEqual(classify_triangle(5, 5, 7.07106781187), 'Right Iso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_case_01_right_scalene(self):\n self.__assert_equals_test_case(self.yield_right_scalene_triangles(), 'Right Scalene Triangle')", "def test_right():\n assert 'right' == classify_triangle(3,4,5)", "def test_case_00_right_isosceles(self):\n self.__assert_equals_test_case(self.yield_right_...
[ "0.8074625", "0.7999827", "0.7985104", "0.7966955", "0.7638159", "0.7486346", "0.7422653", "0.736529", "0.73076516", "0.727841", "0.7260674", "0.72565806", "0.7247314", "0.72284454", "0.7226325", "0.72174716", "0.7216331", "0.72013134", "0.7152106", "0.71269596", "0.7125056",...
0.8084049
0
Test methods for Equilateral triangle
def test_equilateral_triangle(self): self.assertEqual(classify_triangle(1, 1, 1), 'Equilateral', '1,1,1 is equilateral') self.assertEqual(classify_triangle(5, 5, 5), 'Equilateral', '5,5,5 is equilateral') self.assertEqual(classify_triangle(10, 10, 10), 'Equilateral', '10,10,10 is equilateral')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_case_02_equilateral(self):\n self.__assert_equals_test_case(self.yield_equilateral_triangles(), 'Equilateral Triangle')", "def test_equilateral():\n assert 'equilateral' == classify_triangle(1.2,1.2,1.2)", "def test_equilateral(self):\r\n self.assertEqual(triangle_classification(1, 1,...
[ "0.82914066", "0.78427655", "0.75147796", "0.7389425", "0.73836875", "0.7361928", "0.7258092", "0.7256758", "0.7208632", "0.718011", "0.71753234", "0.713035", "0.7109921", "0.70710874", "0.7066831", "0.7038394", "0.70199966", "0.6991587", "0.698308", "0.69716996", "0.6953325"...
0.812215
1
Test methods for Isosceles triangle
def test_isosceles_triangle(self): self.assertEqual(classify_triangle(2, 2, 3), 'Isosceles', '2,2,4 is Isosceles') self.assertEqual(classify_triangle(3, 5, 3), 'Isosceles', '3,5,3 is Isosceles') self.assertEqual(classify_triangle(4, 6, 6), 'Isosceles', '4,6,6 is Isosceles')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_case_03_isosceles(self):\n self.__assert_equals_test_case(self.yield_isosceles_triangles(), 'Isosceles Triangle')", "def test_isosceles():\n assert 'isosceles' == classify_triangle(2,2,3)", "def test_invalid_isosceles():\n assert 'invalid' == classify_triangle(1,1,3)", "def test_scalene...
[ "0.84446776", "0.8072981", "0.7788175", "0.771113", "0.76592475", "0.7633901", "0.7476804", "0.74675", "0.7434156", "0.7347774", "0.7280196", "0.72178996", "0.721078", "0.71846586", "0.715455", "0.7146466", "0.7144785", "0.71339273", "0.71170884", "0.7059335", "0.7057126", ...
0.8346685
1
Test methods for Scalene triangle
def test_scalene_triangle(self): self.assertEqual(classify_triangle(4, 5, 6), 'Scalene', '4,5,6 is Scalene') self.assertEqual(classify_triangle(6, 5, 4), 'Scalene', '6,5,4 is Scalene') self.assertEqual(classify_triangle(5, 4, 6), 'Scalene', '5,4,6 is Scalene') self.assertEqual(classify_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_scalene():\n assert 'scalene' == classify_triangle(2,3,4)", "def test_right():\n assert 'right' == classify_triangle(3,4,5)", "def test_invalid_scalene():\n assert 'invalid' == classify_triangle(1,2,3)", "def test_scalene(self):\r\n self.assertEqual(triangle_classification(3, 4, 6), ...
[ "0.7947035", "0.75788146", "0.7463741", "0.74324894", "0.7381935", "0.7376503", "0.7351776", "0.72876686", "0.7245467", "0.7242359", "0.723632", "0.7214425", "0.7024384", "0.7021558", "0.70174783", "0.6989766", "0.69245934", "0.69018877", "0.68750864", "0.6868855", "0.6859425...
0.79820395
0
does a regex search on 'regex_string' and returns the results >>> regex_search(r'...a', 'FJSIfdsa') 'fdsa'
def regex_search(regex, regex_string): match = re.search(regex, regex_string) if match is not None: return match.group()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(pattern, string):\n result = []\n if re.search(pattern, string):\n result.append(string)\n return result", "def RunRegex(regex, string):\n m = regex.search(string)\n if m:\n return m.groups()[0]\n else:\n return None", "def search(self, regex):\n if isin...
[ "0.72984266", "0.68292576", "0.67671424", "0.6665669", "0.6643086", "0.6536143", "0.63860357", "0.6385368", "0.63182336", "0.6282762", "0.6265356", "0.6257985", "0.6234129", "0.6188668", "0.61427456", "0.61027694", "0.60976815", "0.60624313", "0.603701", "0.6005658", "0.59878...
0.7975572
0
checks if a regex match is in string >>> is_regex_in_string(r'333', 'jaskljds3aksdlja33313d') True >>> is_regex_in_string(r'434', 'sdlkfnhds43asdasd') False
def is_regex_in_string(regex, regex_string): try: match = re.search(regex, regex_string) does_nothing(match.group()) return True; except Exception, e: return False;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def REGEXMATCH(text, regular_expression):\n return bool(re.search(regular_expression, text))", "def _is_regex_match(s, pat):\n\n pat = pat.rstrip()\n m = re.search(Settings._REPAT, pat)\n if m:\n flags_combined = 0\n if m.group('flag'):\n char_to_flag = {\n ...
[ "0.6875535", "0.6838606", "0.68038124", "0.6678743", "0.65503407", "0.645842", "0.634704", "0.6302857", "0.6209838", "0.6178053", "0.61448866", "0.6132919", "0.60919535", "0.607232", "0.6060946", "0.60419315", "0.60268056", "0.60173213", "0.59807694", "0.5972975", "0.595107",...
0.8194809
0
returns the text in between before and after, in the first line containg regex >>> find_page_part(('abc','ahd'),r'abc','a','c') 'b'
def find_page_part(page_list, regex, before, after): for x in page_list: if is_regex_in_string(regex, x): return between(before, after, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_line(line, pos):\n found = u''\n depth = 0\n offset = 0\n for c in line:\n if c == '<':\n depth += 1\n elif c == '>':\n depth -= 1\n if depth == 0:\n pos -= process_match(found[1:], pos + offset)\n found = u''\n\n ...
[ "0.56253177", "0.5600132", "0.5586512", "0.5543749", "0.54765445", "0.54274607", "0.5375869", "0.53683364", "0.53153014", "0.52571017", "0.52355975", "0.5205802", "0.5205802", "0.5175798", "0.5175072", "0.5165106", "0.51389533", "0.5131084", "0.5076957", "0.50633055", "0.5040...
0.694789
0
adds a list to the specified csv file
def add_to_csv(file_name, single_list): final_list = read_csv(file_name) writer = csv.writer(open(file_name, 'wb'), delimiter=',',quoting=csv.QUOTE_MINIMAL) final_list.append(single_list) for x in final_list: writer.writerow(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_list_as_row(file_path, l):\n script_dir = os.path.dirname(__file__)\n abs_file_path = os.path.join(script_dir, file_path)\n \n with open(abs_file_path, 'a+', newline='', encoding='utf-8') as write_obj:\n csv_writer = writer(write_obj)\n csv_writer.writerow(l)", "def add_csv(f...
[ "0.71772105", "0.6890821", "0.68163484", "0.6806851", "0.67946565", "0.6760294", "0.67128855", "0.6702241", "0.6562833", "0.6468973", "0.6390065", "0.63829917", "0.6331627", "0.63311887", "0.6324109", "0.62996733", "0.6291121", "0.6274453", "0.619928", "0.61915267", "0.618373...
0.7825831
0