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
Take off extension, and check for another if extension is gz >>> split_ext('tmp.txt') ('tmp', '.txt') >>> split_ext('tmp.txt.gz') ('tmp', '.txt.gz')
def split_ext(filepath): (fn, ext) = os.path.splitext(filepath) if ext=='.gz': (fn, ext) = os.path.splitext(fn) ext += '.gz' return (fn, ext)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _splitzipext(self, filename):\n\n if self._iszip(filename):\n return os.path.splitext(filename)\n else:\n return filename, None", "def splitext_zip(fname):\n base_fname, ext = splitext(fname)\n if ext == '.gz' or ext == '.zip':\n base_fname, ext2 = splitext(ba...
[ "0.7340182", "0.7257484", "0.71303344", "0.71084404", "0.7084778", "0.6784504", "0.66711336", "0.62481695", "0.6245035", "0.6069734", "0.59981674", "0.5978438", "0.59362453", "0.58886087", "0.5830605", "0.58134735", "0.5779528", "0.57668006", "0.575168", "0.5707265", "0.56953...
0.78384006
0
Creates a shorter version of the keys in params
def shorten_keys(params): param_names = {} for n in params: parts = n.split('_') firsts = [p[0] for p in parts] param_names[n] = ''.join(firsts) return param_names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freeze_dict(params):\n return hashlib.sha1(\"&\".join(\n \"{key}={value}\".format(\n key = key,\n value = value,\n )\n for key, value in sorted(six.iteritems(params))\n ).encode('utf-8')).hexdigest()", "def join_params(**params):\n\tparam_list = get_sorted_key...
[ "0.6766152", "0.63372403", "0.62510985", "0.6122546", "0.59665054", "0.592801", "0.5922785", "0.5906238", "0.59036815", "0.58864623", "0.585397", "0.5847884", "0.5844398", "0.58411515", "0.58168304", "0.5811425", "0.57726884", "0.57306355", "0.57174504", "0.5715628", "0.57139...
0.7581339
0
Creates a string from the keyvalue pairs with _ separating them, sorted by key >>> join_params(alpha=.5, gamma=.9) 'alpha0.5_gamma0.9' >>> join_params(features=['a','b','c'],depth=15) 'depth15_featuresabc' >>> join_params(alpha=.1, trace_rate=None, l=['a','b']) 'alpha0.1_lab_trace_rateNone'
def join_params(**params): param_list = get_sorted_keys(params) values = [] for k in param_list: values.append(k+'-'+join_items(params[k])) return "_".join(values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_parameter_list(parameters):\n items = sorted(dict(parameters).items())\n return \" \".join([\"=\".join([key, repr(str(value))]) for (key,value) in items])", "def _join(lst, key, sep=\";\"):\n return sep.join([d[key] for d in lst if d[key]])", "def joined_parameter(*values: str) -> str:\n ...
[ "0.6141748", "0.59891856", "0.5859167", "0.58393925", "0.57129323", "0.57054585", "0.55881333", "0.55730945", "0.54583883", "0.5409094", "0.5379683", "0.53321546", "0.527924", "0.52433175", "0.52432543", "0.52367586", "0.52364355", "0.5234342", "0.5218139", "0.5169389", "0.51...
0.8081009
0
Turns a dictionary of parameters into a commandline list of arguments
def params_to_args(**params): args = [] keys = get_sorted_keys(params) for k in keys: if params[k] == False: continue args.append('--'+k) if params[k] == True: continue if isinstance(params[k], str): args.append(params[k]) continue try: args.extend([str(v) for v in params[k]]) except: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configToCliArguments(config):\n if not isinstance(config, dict):\n raise TypeError(\"Expected dict for config\")\n\n args = []\n for key, value in config.items():\n if value == None:\n args.append(f\"--{key}\")\n continue\n\n if isinstance(value, list):\n ...
[ "0.7267064", "0.6773042", "0.67161405", "0.66971356", "0.6630844", "0.6525081", "0.6472653", "0.6465406", "0.63680834", "0.6322142", "0.6303616", "0.62891084", "0.6241041", "0.6233576", "0.62206215", "0.62063277", "0.62021786", "0.61741203", "0.61519337", "0.6143028", "0.6110...
0.75936013
0
Return an list of the directories in dirpath, starting with the directory in base_dir If base_dir is provided but dirpath does not contain it, return None >>> get_all_dirs('/tmp/asdf/fred') ['tmp', 'asdf', 'fred'] >>> get_all_dirs('/tmp/asdf/fred/') doesn't care about final slash ['tmp', 'asdf', 'fred'] >>> get_all_dir...
def get_all_dirs(dirpath, base_dir=None): if not base_dir: post = os.path.normpath(dirpath) elif base_dir in dirpath: (pre, post) = dirpath.split(os.path.normpath(base_dir)) post = os.path.normpath(post) else: return dirs = [] (head, tail) = os.path.split(post) while tail: dirs.append(tail) (head, tai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_directories(path):\n\n # Uses abspath as the directory\n absolute = os.path.dirname(abspath(path))\n all_files = os.listdir(absolute)\n\n # Get the absolute path of each file\n absolute_files = [\"/\".join([absolute, d]) for d in all_files]\n\n # Here we filter all non-directires out and ...
[ "0.68340456", "0.6785555", "0.6668709", "0.63527954", "0.63505065", "0.6325283", "0.6313887", "0.62805694", "0.62461233", "0.6196611", "0.6186414", "0.61573446", "0.6148574", "0.60876536", "0.60819036", "0.6080527", "0.6074074", "0.60723394", "0.60716766", "0.6064101", "0.606...
0.8212185
0
Split off the tail directory and add the parameters in that string to param dictionary passed. Return the head directory >>> params = {} >>> get_dir_params('/tmp/alpha1.0_alpha_decay1', params) '/tmp' >>> len(params) 2 >>> params['alpha_decay'] 1 >>> params['alpha'] 1.0
def get_dir_params(dirpath, params): (head, tail) = os.path.split(dirpath) params.update(split_params(tail)) return head
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directory_parameters(directories):\n def _join_dirs(index, subdir):\n # collect sub-directories\n dirs = []\n for i in range(index+1):\n dirs += directories[steps[i]]\n if not dirs:\n return subdir\n else:\n dir = dirs[0]\n for d in dirs[1:]:\n dir = os.path.join(dir,...
[ "0.5661217", "0.5205796", "0.5171829", "0.5156654", "0.51377976", "0.5104749", "0.50199026", "0.49683952", "0.4960869", "0.49373043", "0.49353787", "0.49041578", "0.4877014", "0.48736858", "0.4725308", "0.4718489", "0.47135746", "0.47031134", "0.4695834", "0.46458367", "0.464...
0.800422
0
Join a number to the end of a string in the standard way If width is provided will backfill >>> join_number('fred', 10) 'fred10' >>> join_number('fred', 10, 3) 'fred010'
def join_number(string, num, width=None): num = str(num) if width: num = num.rjust(width, '0') return string + '-' + str(num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(number, width=0):\n return str(number).zfill(width)", "def pad_number(number, length):\n\n string_number = str(number)\n number_of_zeros = length - len(string_number)\n if number_of_zeros >= 0:\n return \"0\" * number_of_zeros + string_number\n else:\n return string_number", ...
[ "0.7575873", "0.6719598", "0.6585075", "0.6569616", "0.6502219", "0.6435242", "0.6325695", "0.63152623", "0.63049746", "0.6270025", "0.6255137", "0.62551343", "0.6232007", "0.6167308", "0.61607224", "0.61002517", "0.60625637", "0.59663886", "0.5961309", "0.59325504", "0.59198...
0.8679115
0
Splits off a number from the end of the string and returns the tuple >>> split_number('rawdata.txt500') ('rawdata.txt', 500) >>> split_number('squareboxsquare2.5') ('squareboxsquare', 2.5) >>> split_number('fred') ('fred', None) >>> split_number('fredjones') ('fredjones', None) >>> split_number(0) ('', 0) >>> split_num...
def split_number(string): try: parts = string.split('-') except AttributeError: try: string * string return ('', string) except TypeError: return None end = parts[-1] if '.' in end: try: num = float(end) except: num = None else: try: num = int(end) except: num = None if num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_num(s):\n i = 0\n while i < len(s):\n if s[i] < '0' or s[i] > '9':\n break\n i += 1\n if s[i:]:\n return (int(s[:i]), s[i:], )\n return (int(s[:i]), )", "def split(n):\n rest_of_num, last_num = n // 10, n % 10\n return rest_o...
[ "0.6397843", "0.6025169", "0.60193896", "0.58248246", "0.5821307", "0.5711017", "0.54345703", "0.53441983", "0.53429466", "0.5247775", "0.5150985", "0.5026478", "0.50150573", "0.50136864", "0.4990291", "0.49878863", "0.49797055", "0.49792823", "0.49334368", "0.49008104", "0.4...
0.70436335
0
Splits a parameter string into its keyvalue pairs >>> d = split_params('alpha0.5_gamma0.9') >>> d['alpha'] 0.5 >>> d['gamma'] 0.9 >>> d = split_params('depth15_featuresabc') >>> d['depth'] 15 >>> d['features'] ['a', 'b', 'c'] >>> d = split_params('alpha0.1_lab_trace_rateNone') >>> d['alpha'] 0.1 >>> d['l'] ['a', 'b'] >...
def split_params(param_string): #TODO: check for negatives i.e. alpha--1 parts = param_string.split('_') params = {} for i in range(len(parts)): param = split_items(parts[i]) if len(param) < 2: try: parts[i+1] = parts[i] + "_" + parts[i+1] except: pass continue elif len(param) == 2: param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_url_string(param_str):\n parameters = parse_qs(param_str, keep_blank_values=False)\n for key, val in parameters.iteritems():\n parameters[key] = urllib.unquote(val[0])\n return parameters", "def test_splitParamArgs(self):\n res = irc.ServerSupportedFeatures._spli...
[ "0.66845363", "0.6530655", "0.6480405", "0.6348581", "0.62863165", "0.61444205", "0.60926306", "0.6052062", "0.6042144", "0.6038052", "0.59232545", "0.58511275", "0.5802076", "0.5720275", "0.5705016", "0.5694049", "0.5687249", "0.56427014", "0.56421286", "0.5573257", "0.54799...
0.7688976
0
Removes modifiers from the given string and returns the original name plus a list of the modifiers present (checked against mod_set if provided) >>> split_modifiers('joint_active_scaled_return', ['trace', 'scaled', 'return']) ('joint_active', ['scaled', 'return']) >>> split_modifiers('joint_active_scaled') ('joint', ['...
def split_modifiers(mod_string, mod_set=None): parts = mod_string.split('_') if mod_set is None: return (parts[0], parts[1:]) name = [parts[0]] mods = [] for p in parts[1:]: if p in mod_set: mods.append(p) else: name.append(p) return ('_'.join(name), mods)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modifiers(m) -> Set[str]:\n return set(m[\"modifier_list\"])", "def split(string, separator, keep_separator):\n\t\t\tparts = string.split(separator)\n\t\t\tif keep_separator:\n\t\t\t\t*parts, last_part = parts\n\t\t\t\tparts = [part + separator for part in parts]\n\t\t\t\tif last_part:\n\t\t\t\t\treturn p...
[ "0.59638035", "0.5797061", "0.54651815", "0.54193926", "0.5409097", "0.53156203", "0.5306072", "0.5209662", "0.50047225", "0.49938494", "0.49826226", "0.4935543", "0.49057367", "0.48880288", "0.48861265", "0.48632205", "0.4861422", "0.4847447", "0.4827977", "0.48262042", "0.4...
0.80421674
0
Removes _scaled, etc, from the feature list to create a unique set of the features as in the environment directory >>> features = ['obs2_scaled_decayed','obs1_scaled','obs2_scaled','obs1_return'] >>> remove_modifiers(features, sort=False) ['obs2', 'obs1'] >>> remove_modifiers(features, sort=True) ['obs1', 'obs2'] >>> r...
def remove_modifiers(*values, sort=False, mod_set=None): features = [] for f in values: (name, mods) = split_modifiers(f, mod_set=mod_set) if name not in features: features.append(name) if sort: features.sort() return features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modifiers(m) -> Set[str]:\n return set(m[\"modifier_list\"])", "def test_remove_feature_with_extras():\n mock = MagicMock()\n with patch.dict(dism.__salt__, {\"cmd.run_all\": mock}):\n dism.remove_feature(\"sponge\", True)\n mock.assert_called_once_with(\n [\n ...
[ "0.60711634", "0.5854533", "0.576454", "0.552694", "0.5376382", "0.53698", "0.53240466", "0.5302668", "0.53006244", "0.52412456", "0.5228294", "0.52273476", "0.5213669", "0.51895434", "0.517557", "0.517557", "0.51688987", "0.51524097", "0.5135517", "0.5121186", "0.50604916", ...
0.80447644
0
Return true if filepath ends in 'gz' extension
def is_zip(filepath): return os.path.splitext(filepath)[1] == '.gz'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_archive_ext(filepath):\n file_extension = os.path.splitext(filepath)[1].lower()\n if file_extension in get_archive_extensions():\n return True\n else:\n return False", "def chk_for_gz(filenm):\n import os\n from os.path import expanduser\n filenm = expanduser(filenm)\n\n ...
[ "0.73746085", "0.73102397", "0.728944", "0.7181048", "0.69474477", "0.67704386", "0.6675972", "0.6661081", "0.6557845", "0.6541729", "0.6535836", "0.6522381", "0.64815605", "0.646029", "0.6333025", "0.6316177", "0.62578523", "0.6246907", "0.6244113", "0.6234546", "0.6212786",...
0.80162406
0
Recursively creates every directory in dirpath if it does not exists. Returns True/False on success/failure >>> newdir = '/tmp/asdf/fdsa/fred' >>> os.path.exists(newdir) False >>> os.path.exists('/tmp/asdf/fdsa') False >>> make_dirs(newdir) '/tmp/asdf/fdsa/fred' >>> os.path.exists(newdir) True >>> os.path.exists('/tmp/...
def make_dirs(dirpath, debug=False): if not os.path.exists(dirpath): try: os.mkdir(dirpath) except OSError as e: if debug: print(e) (head, tail) = os.path.split(dirpath) if '/' not in head or os.path.exists(head): return False else: if(make_dirs(head)): return make_dirs(dirpath) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dirs(path):\n\tif not os.path.exists(path):\n\t\treturn os.makedirs(path)", "def make_dirs(path):\n if not os.path.exists(path):\n os.makedirs(path)", "def make_dirs_or_not(dirpath: Union[PathOrStrType]):\n if not os.path.exists(dirpath):\n os.makedirs(dirpath)", "def makeDir(path):\r\...
[ "0.7709915", "0.7483823", "0.7414723", "0.73108613", "0.72236437", "0.7209876", "0.71590054", "0.71147317", "0.7107763", "0.710238", "0.7098765", "0.70964026", "0.7016854", "0.7009933", "0.70048064", "0.6991996", "0.69547653", "0.69364005", "0.6925537", "0.692539", "0.6917738...
0.84734285
0
Standardize array naming! >>> get_array_headers('tile_index', 3) ['tile_index0', 'tile_index1', 'tile_index2'] >>> get_array_headers('a', 1) ['a0'] >>> get_array_headers('a', 10)[0] 'a00' >>> get_array_headers('a', 1000)[1] 'a0001'
def get_array_headers(array_name, length): width = len(str(length)) return [join_items([array_name, str(i).zfill(width)]) for i in range(length)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_headers(worksheet):\n headers = {}\n cell_idx = 0\n while cell_idx < worksheet.ncols:\n cell_type = worksheet.cell_type(0, cell_idx)\n if cell_type == 1:\n header = slughifi(worksheet.cell_value(0, cell_idx))\n if not header.startswith(\"_\"):\n ...
[ "0.6100702", "0.5570762", "0.5531662", "0.54993814", "0.548593", "0.5444392", "0.5387722", "0.53857964", "0.5276731", "0.52353406", "0.5227597", "0.5223803", "0.5222528", "0.5206451", "0.51679057", "0.5157311", "0.50992876", "0.50846374", "0.5073744", "0.5066414", "0.5048884"...
0.7206283
0
Set attributes of the obj according to arguments in params include_all will add all the arguments in params to the object if not will only add those that are in valid_params if validate_params, will check that the params in valid_params are not None
def set_attributes(obj, include_all=True, validate_params=False, valid_params=None, **params): # make sure all required values are here if valid_params: for k in valid_params: if k not in params: if not hasattr(obj, k): raise ParameterException("Required parameter {0} missing".format(k)) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_params(self,**kwargs):\n for key in kwargs:\n setattr(self, key, kwargs[key])", "def _validate_params(self):\n assert set(self.required_params) - set(self._params) == set()\n for par, val in self.optional_params.items():\n if par not in self._params:\n ...
[ "0.63769895", "0.62967455", "0.60953456", "0.5948282", "0.59235907", "0.5901765", "0.5898007", "0.5861664", "0.58595383", "0.5832369", "0.58027583", "0.5785382", "0.57812935", "0.57797676", "0.5772693", "0.57565576", "0.57520235", "0.575147", "0.57505697", "0.574735", "0.5744...
0.8129952
0
Make sure the iterable params contains all elements of required_params If validate_values is True, make sure params[k] are set. If required_params is a dictionary, make sure params[k] are set to the values given >>> validate_params(['a','b','c'], ['a','b']) True >>> validate_params(['a','b','c'], ['a','b','d']) False
def validate_params(params, required_params, validate_values=False): # every key (or element) in required_params must be present in the given params for k in required_params: if k not in params: return False elif validate_values: try: # see if we got a dictionary of parameters p_val = params.get(k)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_params(self):\n assert set(self.required_params) - set(self._params) == set()\n for par, val in self.optional_params.items():\n if par not in self._params:\n self._params[par] = val", "def _check_parameters(self, ep, params):\n\n any_group_satisfied = ...
[ "0.75490326", "0.7438984", "0.7273896", "0.7218024", "0.71317744", "0.7084169", "0.7016126", "0.6884917", "0.67766726", "0.6771224", "0.6769371", "0.66928345", "0.6688257", "0.6678528", "0.6674225", "0.6648262", "0.663149", "0.65512455", "0.65321004", "0.65198606", "0.6519411...
0.8133651
0
Get the next noncommented line of strings from a file, separated by whitespace >>> f = open('results/testing/pos/Large/rawdata.txt', 'r') >>> read_strings(f) ['a', 'b', 'c', 'd', 'e', 'f', 'step']
def read_strings(filepointer): line = '#' try: while line and line[0]=='#': line = filepointer.readline() except (IOError, ValueError): return None if line: return line.split() else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_strings(src_file):\n res = []\n try:\n res = open(src_file,'r').readlines()\n res = [x.strip() for x in res]\n except:\n res = []\n return res", "def get_next_hundered_lines(file):\n count = 0\n result = []\n while count < 100:\n count += 1\n next_l...
[ "0.6840863", "0.6173089", "0.612168", "0.6075292", "0.6003574", "0.59796333", "0.59180355", "0.5904176", "0.5896242", "0.5887557", "0.5884237", "0.5814879", "0.5809892", "0.5803777", "0.57963556", "0.57625866", "0.5758329", "0.5758329", "0.57532275", "0.57433313", "0.57394236...
0.74165165
0
Get the next line of floats from a file, separated by whitespace >>> f = open('results/testing/pos/Large/rawdata.txt', 'r') >>> read_floats(f) [0.0, 0.2, 500.0, 0.0, 0.001, 0.0, 1.0]
def read_floats(filepointer): data = read_strings(filepointer) if not data: return None try: data = [float(x) for x in data] return data except: # try the next line return read_floats(filepointer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_float(filename):\n\tf = open(filename, \"r\")\n\tarr = np.fromfile(f, dtype='>f4')\n\treturn arr", "def txt2float(file: str) -> float:\n return float(get_first_line(file))", "def read_floats(self, count=1, location=None):\n return_vals = []\n byteorder = {'little':'<f', 'big':'>f'}[se...
[ "0.66995656", "0.6633805", "0.65709525", "0.65611815", "0.65453225", "0.6478923", "0.6464272", "0.64488614", "0.6371395", "0.63362014", "0.6324018", "0.6272083", "0.62164915", "0.61707884", "0.61507845", "0.61435115", "0.61096746", "0.60898066", "0.6086851", "0.6082991", "0.6...
0.80918074
0
Returns a dictionary of the column indices keyed by the header in the file
def get_header_indices(filepath): headers = get_header_list(filepath, sort=False) return {h: i for i, h in enumerate(headers)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getColumnIndices(*args, filepath=\"CO2.tab\"):\n # idxDict = {\"PT\": 0, \"TM\": 0, \"HG\": 0, \"SEG\": 0}\n idxDict = {\"PT\": 0, \"TM\": 0, \"HG\": 0, \"VISG\": 0, \"VISHL\": 0, \"ROG\": 0, \"ROHL\": 0}\n if filepath:\n cols = tabLineToList(readFullLine(filepath, 52))\n for key in idxDict:...
[ "0.76352763", "0.6538343", "0.6447495", "0.6401379", "0.63600105", "0.6346782", "0.63438034", "0.6278738", "0.6268012", "0.6213276", "0.6110932", "0.610526", "0.6068173", "0.6054864", "0.6004899", "0.5946061", "0.5935479", "0.59272295", "0.5905116", "0.5894535", "0.588547", ...
0.80510694
0
Moves file pointer to the next noncomment line and returns the comments as a list of strings.
def skip_comments(filepointer): comments = [] data = '#' try: pos = filepointer.tell() except: print("Could not read file.") return None while data[0] == '#': data = filepointer.readline() if not data: raise Exception("Unexpected end of file while reading comments.") if data[0] == '#': commen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_comments(path):\n\n # opens comments file\n try:\n return [\n re.sub(\" +\", \" \", comment.strip().rstrip())\n for comment in list(open(path, \"r\"))\n ]\n except Exception as e:\n print(\"Error loading comments fi...
[ "0.7470412", "0.71484244", "0.7036303", "0.6953977", "0.69023705", "0.6800556", "0.6739347", "0.6587444", "0.65565395", "0.6545687", "0.6507777", "0.6506175", "0.63937104", "0.63558143", "0.63366956", "0.62867033", "0.6239873", "0.622723", "0.62262815", "0.6225103", "0.622230...
0.75017625
0
Return true if all of the keys specified in required are present and match or do not match settings if specified.
def check_param_matches(candidate, settings=None, required=None, restricted=None): print("Deprecated?") if not settings: settings = {} if not required: required = [] if not restricted: restricted = [] # required keys must be present in candidate and match the value in settings, # if provided for p in req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_required_keys(plist, filename, required_keys):\n passed = True\n for req_key in required_keys:\n if not plist.get(req_key):\n print(\"{}: missing required key {}\".format(filename, req_key))\n passed = False\n return passed", "def validate_required_keys(input_di...
[ "0.68788046", "0.68218213", "0.6819219", "0.68076414", "0.67759246", "0.6773437", "0.67254263", "0.66216743", "0.65819454", "0.65736276", "0.6532516", "0.64255255", "0.63672996", "0.6340896", "0.63351995", "0.63173246", "0.63134223", "0.63104975", "0.6309449", "0.6299355", "0...
0.685779
1
For the given list of parameter dictionaries, return a list of the dictionary keys that appear in every parameter dictionary
def get_shared_keys(param_list): if not param_list: return keys = set(param_list[0].keys()) for i in range(1, len(param_list)): keys = keys.intersection(param_list[i].keys()) keys = list(keys) keys.sort() return keys
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unique_keys(param_list):\n\tif not param_list:\n\t\treturn\n\tcounts = {}\n\tmax_count = len(param_list)\n\tfor p in param_list:\n\t\tfor k in p:\n\t\t\tcounts[k] = 1 + counts.get(k, 0)\n\tunique = []\n\t# now find out which keys are not shared\n\tfor k in counts:\n\t\tif counts[k] < max_count:\n\t\t\tuniq...
[ "0.6639945", "0.6413684", "0.63082236", "0.6279882", "0.61982036", "0.6186242", "0.6142993", "0.6075495", "0.6054601", "0.6009603", "0.5964664", "0.59626204", "0.59246665", "0.59243405", "0.5853851", "0.58462185", "0.5836325", "0.5816195", "0.58044916", "0.5801902", "0.577432...
0.686177
0
Return a dictionary of the unique sets of param values for the given keys, indexed by a name made up of those values
def group_by_keys(param_list, keys): keys = list(keys) names = {} for p in param_list: if len(keys) > 0: key = join_params(**{k: p.get(k, None) for k in keys}) #vals = {k: p.get(k, None) for k in keys} #name = join_params(**vals) #names[name]=vals else: key = '' if key in names: names[key]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_parameters(self, *keys):\n return {k: v for k, v in self.param.items() if k in keys}", "def get_unique_keys(param_list):\n\tif not param_list:\n\t\treturn\n\tcounts = {}\n\tmax_count = len(param_list)\n\tfor p in param_list:\n\t\tfor k in p:\n\t\t\tcounts[k] = 1 + counts.get(k, 0)\n\tunique = []\...
[ "0.675617", "0.6436779", "0.6321909", "0.62885296", "0.61847234", "0.60890037", "0.59862626", "0.5977559", "0.5854747", "0.58353114", "0.5812666", "0.5799092", "0.57755125", "0.57612205", "0.5678434", "0.5674742", "0.56722915", "0.56689703", "0.5647891", "0.56409335", "0.5590...
0.67722785
0
For each entry in arg_dict add the argument to the parser if it is not already in the namespace provided. If sources is a dictionary of strings, will use the strings as the help message for the key If source is a dictionary of dictionaries, will pass the dictionary elements as parameters to add_argument
def add_arguments(arg_dict, parser, namespace=None): for k in arg_dict: if namespace and hasattr(namespace, k): continue try: h = arg_dict[k] if isinstance(h, dict): parser.add_argument('--'+k, **h) else: parser.add_argument('--'+k, help=h) except: parser.add_argument('--'+k, help='manager...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _map_arguments(self, args):\n data = args.get('data')\n comp = args.get('comp')\n library = args.get('library')\n dry_run = args.get('dry_run', False)\n\n self._set_link('srcmaps-catalog', SrcmapsCatalog_SG,\n comp=comp, data=data,\n ...
[ "0.58115476", "0.5370188", "0.52439994", "0.52399445", "0.5215256", "0.51828295", "0.5136675", "0.5135823", "0.5095992", "0.5078414", "0.50783795", "0.503532", "0.5018439", "0.5017416", "0.50130874", "0.49956897", "0.4963854", "0.496178", "0.49517304", "0.4924612", "0.4919691...
0.6476159
0
Parse the given launch arguments from the command line, into list of tuples for launch.
def parse_launch_arguments(launch_arguments: List[Text]) -> List[Tuple[Text, Text]]: parsed_launch_arguments = OrderedDict() # type: ignore for argument in launch_arguments: count = argument.count(':=') if count == 0 or argument.startswith(':=') or (count == 1 and argument.endswith(':=')): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def _parse_command_line_arguments():\n parser = ArgumentParser(\n description=(\n 'Command-line tool to generate a list of unique from a TS file from FermiFAST'\n ),\n )\n parser.add_argument(\n 'ts-file',\n type=str,\n help=(\n...
[ "0.7123171", "0.68779016", "0.68531114", "0.68477416", "0.6797236", "0.6794053", "0.67317593", "0.6700564", "0.6684113", "0.66812426", "0.66508806", "0.66495556", "0.6644529", "0.6633411", "0.66262376", "0.6623169", "0.66193837", "0.66157824", "0.65600795", "0.65463066", "0.6...
0.7299944
0
Return a single experience instance
def get_single_experience(self, time_step): assert self.n_experience - 1 > time_step, "Sample time step must be less than number of experience minus one." return self.buffer_experience[time_step]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_experience(cls, state, action, reward, done, next_state) -> 'Experience':\n return cls(\n state=state,\n action=action,\n reward=reward,\n done=done,\n next_state=next_state,\n )", "def get_experience(uid, rid):\n experience = Exp...
[ "0.6488589", "0.6468385", "0.6168099", "0.58028114", "0.5753395", "0.5579298", "0.5455302", "0.5434499", "0.5421998", "0.54172146", "0.53958464", "0.53948414", "0.5381991", "0.5371138", "0.5356552", "0.5337088", "0.5315421", "0.5306023", "0.5300618", "0.5293251", "0.5285871",...
0.7033003
0
Return batch list of experience instance
def get_batch_experience(self, batch_size): batch = [] for i in range(batch_size): index = random.choice(range(self.n_experience - 1)) batch.append(self.get_single_experience(index)) return batch
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_experience(self):\n return self.experience_set.all()", "def batch(self):\n return self._client.batch()", "def experiences(self):\n return self.client.call('GET',\n self.name + 'experiences')", "def __iter__(self):\n batch = []\n for i_batc...
[ "0.6554049", "0.6396855", "0.6297287", "0.6107383", "0.6098944", "0.60974336", "0.6025186", "0.60197103", "0.58755547", "0.58387226", "0.58213526", "0.5778656", "0.56729084", "0.565521", "0.5647804", "0.5634885", "0.56303805", "0.5615144", "0.5606871", "0.5605314", "0.5564643...
0.7348829
0
test that audiobook can be inserted into db
def test_audiobook_can_insert(self): data = { "audiotype": "Audiobook", "metadata": { "duration": 37477, "title": "another", "author": "Solomon", "narrator": "Ndiferke" } } response = requests.po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_can_create_a_music(self):\n self.assertEqual(self.response.status_code, status.HTTP_201_CREATED)", "def test_upload_voice_dataset(self):\n pass", "async def test_valid_insert(database, valid_data):\n await database.setup_database(reset=True)\n for id ,user_id,embeddings,batch_i...
[ "0.67848116", "0.6577634", "0.6528779", "0.63863647", "0.6381396", "0.63655", "0.63352036", "0.63241166", "0.6306235", "0.6287628", "0.6280709", "0.62133586", "0.620948", "0.62088597", "0.6194809", "0.61815", "0.6163415", "0.61458015", "0.6109276", "0.6099825", "0.6083798", ...
0.83560413
0
test that audiobook can be read from DB
def test_audiobook_can_read(self): response = requests.get( "http://localhost:9001/api/get-audio/Audiobook") self.assertEqual(response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_audiobook_can_insert(self):\n\n data = {\n \"audiotype\": \"Audiobook\",\n \"metadata\": {\n \"duration\": 37477,\n \"title\": \"another\",\n \"author\": \"Solomon\",\n \"narrator\": \"Ndiferke\"\n }\n ...
[ "0.7046402", "0.6732572", "0.6514186", "0.6272971", "0.6199112", "0.617027", "0.61287713", "0.6095272", "0.6043759", "0.5952801", "0.59451705", "0.5902091", "0.58871716", "0.58851415", "0.5864519", "0.5856869", "0.58567923", "0.5825781", "0.58153707", "0.5800193", "0.57910967...
0.7720838
0
test that audiobook can be deleted from DB
def test_audiobook_can_delete(self): num = str(5) response = requests.delete( "http://localhost:9001/api/delete-audio/Audiobook/"+num) self.assertEqual(response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_voice_dataset(self):\n pass", "def test_api_can_delete_music(self):\n music = Music.objects.get()\n response = self.client.delete(\n reverse('details', kwargs={'pk': music.id}),\n format = \"json\",\n follow = True\n )\n self.ass...
[ "0.7435866", "0.7428341", "0.72781295", "0.7209934", "0.71410346", "0.6997073", "0.6972826", "0.69329727", "0.6901897", "0.6901834", "0.687459", "0.6856501", "0.6855984", "0.6841089", "0.6790555", "0.67834634", "0.67833436", "0.67829585", "0.678234", "0.67810273", "0.67750245...
0.8164794
0
test that audiobook can be updated in DB
def test_audiobook_can_update(self): data = { "audiotype": "Audiobook", "metadata": { "title": "audiobook1", "duration": 45678, "author": "Solomon", "narrator": "Aniefiok" } } num = str(3) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_audiobook_can_insert(self):\n\n data = {\n \"audiotype\": \"Audiobook\",\n \"metadata\": {\n \"duration\": 37477,\n \"title\": \"another\",\n \"author\": \"Solomon\",\n \"narrator\": \"Ndiferke\"\n }\n ...
[ "0.7134568", "0.7090748", "0.70769113", "0.69468963", "0.65462226", "0.6545777", "0.6538061", "0.6538061", "0.6538061", "0.64445615", "0.6443035", "0.64324975", "0.6414275", "0.6392401", "0.6383004", "0.63642", "0.63418466", "0.6337228", "0.63190335", "0.63148654", "0.6284827...
0.78056514
0
Validates aliasing works properly when the query contains both tags_key and tags_value.
def test_aliasing() -> None: processed = parse_and_process( { "aggregations": [], "groupby": [], "selected_columns": ["tags_value"], "conditions": [["tags_key", "IN", ["t1", "t2"]]], } ) sql = format_query(processed).get_sql() transactions_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_generic_tag_match(key: str, value: str) -> Dict[str, Any]:\n query = {\n \"tags\": {\n \"$elemMatch\": {\n \"key\": key,\n \"$or\": [\n {\"vStr\": value},\n {\"vInt64\": value},\n ...
[ "0.57817465", "0.570398", "0.5615116", "0.5476921", "0.5441292", "0.5437843", "0.54195595", "0.5388927", "0.53832835", "0.53694046", "0.5329078", "0.5325659", "0.5304145", "0.52602834", "0.52379453", "0.516322", "0.5129891", "0.50972956", "0.5071068", "0.50556076", "0.5045664...
0.6864035
0
Get the project_ids associated with this Community.
def get_project_ids(self, *criterion): from wkcdd.models.helpers import get_project_ids return get_project_ids([self.id], *criterion)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_list(self):\n try:\n ids = self.request[api.DATA][api.DATA][\"ids\"]\n return self._get_keystone_projects(ids)\n except Exception as e:\n LOG.exception(\"Error occurred: %s\" % e)", "def get_projects(self):\n return self.jira.projects()", "def g...
[ "0.7047133", "0.6907629", "0.6902153", "0.6842879", "0.6808918", "0.679463", "0.67528903", "0.65890634", "0.6489477", "0.6425217", "0.64227444", "0.639533", "0.6394208", "0.63902646", "0.63456815", "0.630165", "0.62439257", "0.62269944", "0.62134", "0.61947155", "0.61920667",...
0.69406384
1
checks if there are ids already initialized
def check_initial_ids(self): if '_Base__nb_objects' in dir(Square): type(self).initial_ids = Square.__dict__['_Base__nb_objects'] - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.ids_seen = set()", "def __init__(self):\n initialize_db()\n self.ids_seen = set()", "def _is_initialized(self) -> bool:\n return len(self) > 0", "def test_ids(self):\n state1 = State()\n state2 = State()\n state3 = State()\n self.asse...
[ "0.6757793", "0.6522094", "0.6364243", "0.6272424", "0.6165194", "0.60231423", "0.60110307", "0.6009121", "0.59739226", "0.5962889", "0.590866", "0.5889949", "0.58549154", "0.5829648", "0.5811595", "0.5807346", "0.5774812", "0.57503724", "0.5718341", "0.5718137", "0.57145154"...
0.7212387
0
We use a different broker_url when running the workers than when running within the flask app. Generate an appropriate URL with that in mind
def broker_url(host): return '{broker_scheme}://{username}:{password}@{host}:{port}//'.format(host=host, **CONFIG_JOB_QUEUE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def broker_url(settings):\n broker = 'amqp://'\n broker += settings.get('BROKER_USER') or 'guest'\n broker += ':' + (settings.get('BROKER_PASSWORD') or 'guest')\n broker += '@' + (settings.get('BROKER_HOST') or 'localhost')\n broker += ':' + (settings.get('BROKER_PORT') or '5672')\n\n return brok...
[ "0.68481046", "0.63808596", "0.6348577", "0.5819164", "0.574416", "0.57123405", "0.55717474", "0.55477244", "0.55355334", "0.5522162", "0.5520994", "0.5511979", "0.55012876", "0.5496532", "0.5467085", "0.5446945", "0.54385513", "0.5428514", "0.54229367", "0.5410307", "0.53947...
0.73196733
0
approxdp outputs eps as a function of delta based on rdp calculations
def approxdp(delta): if delta < 0 or delta > 1: print("Error! delta is a probability and must be between 0 and 1") if delta == 0: return rdp(np.inf) else: def fun(x): # the input the RDP's \alpha if x <= 1: return np.inf ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eps(newEps=None):\n\n global _eps\n if newEps is not None:\n _eps = newEps\n return _eps", "def draw_p_to_eps(p):\n return ppf((p + 1.0) / 2)", "def epsilon_delta(self):", "def InterpolationDerivs(self, , p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_f...
[ "0.6053316", "0.6033463", "0.59292716", "0.5863483", "0.57953846", "0.5786605", "0.56892174", "0.56870705", "0.5685585", "0.56785506", "0.5676544", "0.5573095", "0.5561564", "0.5548653", "0.5540436", "0.5539918", "0.54265237", "0.5423283", "0.54080003", "0.53545034", "0.53545...
0.7399501
0
from an approxdp function to fdp
def approxdp_func_to_fdp(func, delta_func=False): # # By default, logdelta_func is False, and func is eps as a function of delta # fpr = maximize_{delta} approxdp_to_fdp(eps(delta),delta)(fpr) # if delta_func is True, it means that 'func' is a delta as a function of eps, then # fpr = maximize_{delta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def InterpolateDerivs(self, , p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=..., p_float=...,...
[ "0.6328194", "0.6294494", "0.60166425", "0.60097474", "0.599097", "0.5985712", "0.59741604", "0.5957853", "0.5893827", "0.5860794", "0.5855705", "0.5840527", "0.5767828", "0.5689522", "0.5686636", "0.5654464", "0.56200004", "0.56181914", "0.5612902", "0.5598372", "0.55951947"...
0.68981594
0
split by block extract 1st level data (timestamp, and raw data of block) to dict
def _split_by_block(self, path=None,category='meminfo'): with open(path, "r") as f: text = f.read() lst = re.split('zzz', text, flags=re.DOTALL) # to list based on time lst = [x for x in lst if x] # remove empty strings """ Python 2.x ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_data_from_block(self,block,skip_lines=7):\n \n lines = block.split('\\n') #process block line by line\n chrom = {}\n chrom['title'] = lines[1] #block full title in 2nd line\n dump,chrom['short_title'] = lines[1].rsplit(' ',maxsplit=1) #taking last part of the line which i...
[ "0.71398336", "0.6421845", "0.6310692", "0.6232713", "0.6159134", "0.6008795", "0.58964336", "0.5853936", "0.5750201", "0.57200634", "0.5679504", "0.56746316", "0.56639814", "0.5650643", "0.56322706", "0.56211495", "0.5621063", "0.55872095", "0.55845296", "0.5560303", "0.5558...
0.73097277
0
split by keypair element within a line
def _split_by_keypair(self, osw_dict={}): lst = osw_dict keypair_dict = [] for d in lst: if d['key'] == 'raw_line': keypair_lst = re.split(r',',d['value']) for k,v in keypair_lst: _d = [{'timestamp':d['timestamp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitkv(s):\n a=re.split('(\\w*)\\s*=\\s*\"([^=\"]*)\"\\s*', s)\n a=[ t for t in a if t!='']\n return a", "def tokenize_key_value_pair(kv_pair):\n key, value = kv_pair.strip().split('\\t')\n key = tuple(key.strip().split())\n value = tuple(value.strip().split())\n return (key...
[ "0.6456821", "0.63751614", "0.6154483", "0.6092737", "0.60747635", "0.59243345", "0.5920596", "0.59065396", "0.5904815", "0.58083063", "0.5758918", "0.5717138", "0.5714947", "0.5691351", "0.5686674", "0.56773335", "0.55829465", "0.5543476", "0.54818356", "0.54575175", "0.5450...
0.72110385
0
analyze oswmem free memory check if free mmemory <= min memory
def oswmem_free_memory(self,min=0): result = self.df[self.df['free mmemory'] > min].all return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _checkAvailableMemory():\n #execute free -m to get output in MB\n logging.debug(\"checking total memory\")\n cmd = [\n basedefs.EXEC_FREE, \"-m\"\n ]\n output, rc = utils.execCmd(cmdList=cmd, failOnError=True, msg=output_messages.ERR_EXP_FREE_MEM)\n\n #itterate over output and look for...
[ "0.67095083", "0.6632159", "0.6463974", "0.64158916", "0.6393297", "0.63684064", "0.6331907", "0.6315069", "0.6303074", "0.62661755", "0.62638867", "0.6201548", "0.6164832", "0.6159131", "0.61274666", "0.60981977", "0.6093252", "0.6063132", "0.6053817", "0.60520935", "0.60448...
0.7907078
0
Add a label on edge
def add_edge_label(self, edge, label, color): # Sort vertices index min - max p0, p1 = edge p0, p1 = min(p0, p1), max(p0, p1) self.edges_label[(p0, p1)].append((label, color))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createLabels(edge):\n k = removeLabel(edge)\n return k + \"_L\", k + \"_R\"", "def _edgeLabel(self, node, parent):\r\n return self.word[node.idx + parent.depth: node.idx + node.depth]", "def add_edge(source, target, label, side_label):\n if (elements is not self and\n ...
[ "0.72381914", "0.7027375", "0.6901796", "0.6890718", "0.6868756", "0.6738556", "0.66855615", "0.66676563", "0.66360575", "0.66360575", "0.6628755", "0.65694034", "0.64525896", "0.63817084", "0.63212174", "0.628949", "0.62592226", "0.6235304", "0.62335396", "0.6216172", "0.621...
0.8186049
0
Add a label on point
def add_point_label(self, point, label, color): self.vertices_label[point].append((label, color))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _draw_label(label, label_x, label_y):\n pass", "def draw_shape_label(self, label, xform, colour):\n #TODO deal with alignment, rotation\n pos = xform.chain(Point(label.x, label.y))\n self.canvas.text((pos.x, pos.y), label.text, fill=colour)", "def draw_label(self, image, point, ...
[ "0.7767723", "0.7519163", "0.7506295", "0.7415118", "0.7404069", "0.7259624", "0.70306754", "0.70253646", "0.68806297", "0.6823486", "0.68070644", "0.67730355", "0.67621034", "0.6754007", "0.67432547", "0.6664425", "0.66360676", "0.65894914", "0.65858585", "0.6573907", "0.655...
0.8212442
0
Transform a 3D point from the mesh to a 3D point of the world by multiplying with the matrix world
def _world_point(self, point_3d): return self.obj.matrix_world @ point_3d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def world_to_object(self, point: Point) -> Point:\n if self.parent:\n point = self.parent.world_to_object(point)\n result = self.transform.inverse() * point\n return result", "def matrix_translate_3d(tx: float, ty: float, tz: float) -> np.matrix:\n return np.matrix([[1, 0, 0, t...
[ "0.6619691", "0.643642", "0.6416658", "0.6408308", "0.63418496", "0.6291406", "0.6243179", "0.6203395", "0.6108228", "0.6091871", "0.6077667", "0.6073341", "0.6024039", "0.5998349", "0.59783256", "0.5972309", "0.59351104", "0.59069496", "0.587442", "0.5872318", "0.586021", ...
0.769006
0
Return the normal vector (pointing outside) to an object and a pair of vertices
def _normal_vector(o, p0_3d, p1_3d): # The vector between middle point of v1-v2 and object center location # is the normal vector I'm looking for vn = p0_3d.lerp(p1_3d, 0.5) - o.matrix_world.translation # normalize so I can to length computation on it vn.normalize() return vn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal(self) -> Vec:\n # The three points are in clockwise order, so compute differences\n # in the clockwise direction, then cross to get the normal.\n point_1 = self.planes[1] - self.planes[0]\n point_2 = self.planes[2] - self.planes[1]\n\n return Vec.cross(point_1, point_2...
[ "0.6874289", "0.68552566", "0.66967344", "0.6693776", "0.6652025", "0.6616837", "0.65679944", "0.6470694", "0.6464965", "0.6430536", "0.6415808", "0.6406652", "0.6401626", "0.63933384", "0.6393271", "0.6362454", "0.63607025", "0.63591343", "0.6353536", "0.6314179", "0.629924"...
0.7952905
0
Load 10 products from dump.json.
def loadProducts(): dump = os.path.dirname(os.path.abspath(__file__)) + "/dump.json" data = open(dump, 'r') for deserialized_object in serializers.deserialize("json", data): deserialized_object.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_products():\n\n print \"Loading Products\"\n\n for i, row in enumerate(open(\"data/mock_product_data.csv\")):\n row = row.rstrip()\n title, price, inventory = row.split(\",\")\n\n product = Product(title=title,\n price=price,\n a...
[ "0.65700144", "0.6372123", "0.63135356", "0.6217432", "0.6184496", "0.6161715", "0.6153932", "0.61406696", "0.60312456", "0.60286355", "0.6022135", "0.6015756", "0.60124123", "0.60045147", "0.59682816", "0.5967611", "0.596441", "0.59624016", "0.5950973", "0.5938882", "0.59184...
0.8113893
0
Test that core.learncurve.learning_curve raises NotADirectoryError
def test_learncurve_raises_not_a_directory(dir_option_to_change, specific_config, tmp_path, device): options_to_change = [ {"section": "LEARNCURVE", "option": "device", "value": device}, dir_option_to_change ] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_nagl_model_path_failed():\n with pytest.raises(FileNotFoundError):\n validate_nagl_model_path(\"does-not-exist.pt\")", "def testNotADirectory(self):\n\n self.assertRaises(OSError,\n parse_package,\n \"not_a_directory\")", "def...
[ "0.6309109", "0.6294871", "0.61584276", "0.59203106", "0.59100646", "0.5750234", "0.5733092", "0.5653635", "0.56445676", "0.5610109", "0.55922353", "0.55654114", "0.5561165", "0.5520227", "0.5439886", "0.5432369", "0.5410431", "0.54093164", "0.5398113", "0.53962386", "0.53922...
0.7250528
0
Downloads and extracts a zip file from S3.
def download_zip_file(s3_client, bucket, key): temp_file = tempfile.NamedTemporaryFile() with tempfile.NamedTemporaryFile() as temp_file: s3_client.download_file(bucket, key, temp_file.name) with zipfile.ZipFile(temp_file.name, "r") as zip_file: yield zip_file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3_download(path):\n with s3_read(path):\n # Reading the file will cache the file locally.\n pass", "def s3_get(url, temp_file):\n s3_resource = boto3.resource(\"s3\")\n bucket_name, s3_path = split_s3_path(url)\n s3_resource.Bucket(bucket_name).download_fileobj(s3_path, temp_file)"...
[ "0.722156", "0.7164689", "0.7164689", "0.6928136", "0.687183", "0.68641627", "0.67871815", "0.67756826", "0.6773488", "0.6746224", "0.67218864", "0.6695276", "0.66722906", "0.66696244", "0.6659661", "0.66388583", "0.66098696", "0.6505979", "0.6503254", "0.64721113", "0.647175...
0.72148407
1
Fix END (missing END, End > END, END position should be the same as FOR etc).
def fix_end(self, node): if node.header.tokens[0].type == Token.SEPARATOR: indent = node.header.tokens[0] else: indent = Token(Token.SEPARATOR, self.formatting_config.separator) node.end = End([indent, Token(Token.END, "END"), Token(Token.EOL)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end():\n return EndBlock()", "def RespEnd(builder):\n return End(builder)", "def GroundExcelEnd(builder):\n return End(builder)", "def end(self):\n self.set_initial_offset(1e6)", "def GachaCraftNodeExcelEnd(builder):\n return End(builder)", "def endComment():\r\n\tglobal sEType, sE...
[ "0.6314465", "0.62066823", "0.6137427", "0.60304046", "0.59303176", "0.58672017", "0.5803466", "0.57732284", "0.57505035", "0.5628803", "0.5566523", "0.5530937", "0.55015606", "0.54930145", "0.54926085", "0.54899275", "0.5474391", "0.5457475", "0.545294", "0.54398143", "0.543...
0.721261
0
Split statements from node for those that belong to it and outside nodes.
def collect_inside_statements(self, node): new_body = [[], []] is_outside = False starting_col = self.get_column(node) for child in node.body: if not isinstance(child, EmptyLine) and self.get_column(child) <= starting_col: is_outside = True new_bod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_sub_statement(stream, node_types):\n \n if isinstance(stream, Node):\n stream = stream.get_inner_body()\n \n current_node = None\n \n try:\n while True:\n \n token = next(stream)\n #print('current token ', token)\n \n ...
[ "0.6498111", "0.5984435", "0.59213006", "0.57918197", "0.57530564", "0.56118774", "0.56068283", "0.5518854", "0.54685843", "0.54046243", "0.5394992", "0.5346872", "0.53465676", "0.5308791", "0.52554667", "0.5254312", "0.5253405", "0.5246265", "0.51586336", "0.51581365", "0.51...
0.73233235
0
Render action This action returns a wiki page with optional message, or redirects to new page.
def render(self): _ = self.request.getText form = self.request.form if form.has_key('cancel'): # User canceled return self.page.send_page(self.request) try: if not self.allowed(): raise ActionError(_('You are not allowed to ed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_result():\n\n action = request.form['action']\n session['visibility'] = request.form['vis'] == 'pub'\n if(action == 'list'):\n resp = utils.get_posts(g.graph,session['visibility'],session['page']['id'])\n return render_template('display_posts.html', data = resp, next = resp['next'...
[ "0.6232014", "0.62105066", "0.62075084", "0.6181259", "0.6165267", "0.6127661", "0.6127661", "0.6127661", "0.6127661", "0.6127661", "0.61201984", "0.6097872", "0.60584813", "0.5958934", "0.5923101", "0.5914462", "0.59116375", "0.5910482", "0.5901794", "0.58796734", "0.586973"...
0.6526012
0
Create a discrete control set that is shaped like a cosine function.
def gen_controls_cos(complex_controls, control_count, control_eval_count, evolution_time, max_control_norms, periods=10.): period = np.divide(control_eval_count, periods) b = np.divide(2 * np.pi, period) controls = np.zeros((control_eval_count, control_count)) # Create a wave f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def C(i, x):\n if i == 1:\n return np.array([[1., 0., 0.],\n [0., cos(x), sin(x)],\n [0., -sin(x), cos(x)]])\n elif i == 2:\n return np.array([[cos(x), 0., -sin(x)],\n [0., 1., 0.],\n ...
[ "0.62159336", "0.5716321", "0.5659428", "0.543885", "0.54238886", "0.5407454", "0.5336914", "0.5282942", "0.5246328", "0.5203804", "0.5200005", "0.5176265", "0.5172793", "0.5138024", "0.50859714", "0.50710136", "0.50569665", "0.5047774", "0.5034469", "0.50343806", "0.5020108"...
0.5927754
1
Create a discrete control set that is shaped like a flat line with small amplitude.
def gen_controls_flat(complex_controls, control_count, control_eval_count, evolution_time, max_control_norms, periods=10.): controls = np.zeros((control_eval_count, control_count)) # Make each control a flat line for all time. for i in range(control_count): max_norm = max_cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basis_categorical():\n cat_data = ['sand'] * 20 + [np.nan] * 5 + ['cement'] * 10 + [np.nan] * 5\n curve_cat = Curve(cat_data, index=range(0, 40))\n curve_new = curve_cat.to_basis(start=5, stop=30, step=1)\n assert len(curve_new) == 26", "def make_curve_data(control_points):\n spline =...
[ "0.5583016", "0.5450101", "0.5243448", "0.52267694", "0.51810956", "0.5128539", "0.5126478", "0.5073892", "0.50508", "0.5050274", "0.4984794", "0.49822906", "0.497473", "0.49142426", "0.49085063", "0.48147082", "0.4802282", "0.47470176", "0.47278032", "0.47173092", "0.4714509...
0.5548447
1
Sanitize `initial_controls` with `max_control_norms`. Generate both if either was not specified.
def initialize_controls(complex_controls, control_count, control_eval_count, evolution_time, initial_controls, max_control_norms): if max_control_norms is None: max_control_norms = np.ones(control_count) if initial_controls...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_controls_white(complex_controls, control_count, control_eval_count,\n evolution_time, max_control_norms, periods=10.):\n controls = np.zeros((control_eval_count, control_count))\n\n # Make each control a random distribution of white noise.\n for i in range(control_count):\n ...
[ "0.5009028", "0.49913824", "0.48872063", "0.48187238", "0.47032735", "0.46083987", "0.45783016", "0.45767888", "0.45071185", "0.44361663", "0.4389645", "0.43579558", "0.43299943", "0.43290603", "0.43231726", "0.4312022", "0.42951974", "0.42844656", "0.42695424", "0.42504078", ...
0.6003062
0
Set the real state of the system when the program (re)start Transition init > any is done callback leave_init() is call manually. No email/sms alert will be sent
def init_state(self): self.read_inputs() if (self.in_power.value == 1) and (self.in_alert.value == 1): self.state = 'alert' elif (self.in_power.value == 1): self.state = 'on' else: self.state = 'off' self.leave_init()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leave_init(self):\n msg = 'init (state: {})'.format(self.state)\n logger.info(msg)\n event = 'init'\n self.push_socket_event(event) \n color = NoxAlarm.colors[NoxAlarm.events.index(event)]\n self.make_DBLog('system', msg, color)", "def set_state( self ):", "...
[ "0.6935918", "0.64275587", "0.6396648", "0.6330707", "0.6299827", "0.62608606", "0.6241156", "0.62019324", "0.61741126", "0.6166896", "0.61495113", "0.61159533", "0.609935", "0.6081462", "0.6050688", "0.60496455", "0.6041429", "0.6035328", "0.60256886", "0.60246044", "0.60233...
0.6807303
1
wrapper method to call mail & sms alerts
def make_alert(*args): try: SmsAlarmAlert(*args) except: logger.exception('Fail calling SmsAlarmAlert()') try: EmailAlarmAlert(*args) except: logger.exception('Fail calling EmailAlarmAlert()')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exec(self): \r\n emails = self.args[0].split(',')\r\n for email in emails:\r\n send_mail(self.args[1], self.args[2], email)\r\n return_text = \"Sent Mail To :: \" + self.args[0] +\"\\n\" + self.args[1] + \":\\n\" + self.args[2]\r\n return return_text", "def handle_inbou...
[ "0.60806", "0.5978295", "0.5954807", "0.59376353", "0.59341943", "0.5933434", "0.59218425", "0.59176993", "0.5902045", "0.588773", "0.58752245", "0.5865574", "0.5864", "0.5854789", "0.58476853", "0.58456624", "0.5824656", "0.57738054", "0.5769169", "0.57681054", "0.5756664", ...
0.6651949
0
wrapper method to call DBLog.new() on alarm event
def make_DBLog(subject, event, badge, detail=''): app = create_app() with app.app_context(): DBLog.new(subject=subject, scope="nox", badge=badge, message=event, ip='-', user='-', detail=detail)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_archive_record(self, event):\n \n # Reset the alarm counter\n self.alarm_count = 0", "def set_new_alarm():\r\n time = request.args.get('alarm')\r\n name = request.args.get('two')\r\n news = request.args.get('news')\r\n weather = request.args.get('weather')\r\n date = t...
[ "0.6016517", "0.59253764", "0.58328515", "0.5806967", "0.5676623", "0.5542574", "0.55408454", "0.5536402", "0.5530844", "0.552155", "0.5516598", "0.5515396", "0.54688793", "0.5462742", "0.54492784", "0.5418729", "0.53916174", "0.5350781", "0.5349644", "0.5328095", "0.5293502"...
0.64143056
0
Computes phase from given timestamps. Phase is normalized time from 0 to 1.
def normalize_time(full_timestamps, half_timestamp): phases = (half_timestamp - full_timestamps[0]) / (full_timestamps[-1] - full_timestamps[0]) return phases
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_phase(p, t):\n\n return (t % p)/p", "def calc_phase(self, time):\n dur = self.get_duration()\n phase = time / dur\n\n if self.enable_loop():\n phase -= np.floor(phase)\n else:\n phase = np.clip(phase, 0.0, 1.0)\n\n return phase", "def phase(freqs, p0, p1, p2):\n x = util...
[ "0.69019604", "0.6539628", "0.6517303", "0.62012905", "0.60972494", "0.60425115", "0.6018554", "0.59292054", "0.5912953", "0.5860659", "0.58079934", "0.58079934", "0.58040315", "0.5802654", "0.5798167", "0.5787505", "0.57755685", "0.56984144", "0.569676", "0.56709915", "0.566...
0.7095126
0
Compute a TxN matrix of features of the given phase vector using Gaussian basis functions. Where T is the number of elements in the phase vector and N is the number of basis functions.
def compute_feature_matrix(phases, N, h): T = len(phases) # Uniformly distribute the centers of N basis functions in domain[-2h,2h+1]. centers = np.linspace(-2 * h, 1 + 2 * h, num=N) # compute a TxN matrix with centers C = np.repeat(centers.reshape(1, N), T, axis=0) # compute a TxN matrix with p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TMM(x,N,n,trun_basis):\n Mat = np.zeros([len(trun_basis),len(trun_basis)])\n print('making TMM')\n perms = [int((x**n * iii)%N) for iii in trun_basis] # Modular multiplication\n for iii in range(len(trun_basis)):\n if trun_basis.__contains__(perms[iii]):\n Mat[iii,trun_basis.index...
[ "0.6072341", "0.5897467", "0.5807051", "0.5731498", "0.5680174", "0.56800663", "0.5603116", "0.5543852", "0.548797", "0.5432222", "0.5381884", "0.53484786", "0.5343271", "0.5334068", "0.53140724", "0.5287831", "0.5281735", "0.527351", "0.5270905", "0.5261998", "0.5241274", ...
0.71907866
0
This function prints out header keywords as part of BPIXTAB verification procedure. Parameter(s)
def bpix_kw(bpixtab): print('Verifying the header keywords of UVIS bad pixel table {}...'.format(bpixtab)) print('USEAFTER:') print(fits.getheader(bpixtab)['USEAFTER']) print(' ') print('PEDIGREE:') print(fits.getheader(bpixtab)['PEDIGREE']) print(' ') print('DESCRIP:') print(fits.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_header():\n print()\n print(\"*\" * 45)\n print(\"Please, select algorithm:\")\n print(\"*\" * 45)", "def print_header_information():\n\t\tprint \"Elijah Molloy\"\n\t\tprint \"70-510 - Spring 1 - 2018\"\n\t\tprint \"PROGRAMMING ASSIGNMENT #4\\n\"", "def Show_Headers( self ):\r\n se...
[ "0.6929973", "0.6687926", "0.6540516", "0.6525296", "0.6507055", "0.6387599", "0.6346713", "0.6323378", "0.6303749", "0.62909293", "0.6277778", "0.6241794", "0.6148025", "0.6145261", "0.61236537", "0.61071616", "0.60899454", "0.60371745", "0.5962819", "0.5959928", "0.5950905"...
0.75132596
0
The main function for the UVIS bad pixel table verification procedure.
def bpixtab_test(bpixtab, path='/grp/hst/wfc3j/jmedina/bpixtab_test/'): # Verifying the header keywords bpix_kw(bpixtab) # Generating an image of the bad pixels using the bad pixel table # which can be inspected using DS9 bpix_image(bpixtab, path) # uses default path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n run_test_draw_upside_down_wall()", "def main():\n test_image = load_image()\n\n pixelate_image(\n normalize_image(test_image)\n )\n pass", "def main():\n\n # Parse the arguments\n parser = argparse.ArgumentParser()\n parser.add_argument('-t', '--ttylogin', action='s...
[ "0.5844188", "0.56894135", "0.55604094", "0.5530293", "0.5493756", "0.5451574", "0.5436015", "0.5427296", "0.5422339", "0.54195154", "0.540822", "0.535743", "0.5331199", "0.5317544", "0.52700955", "0.5264249", "0.52328736", "0.5200136", "0.51995796", "0.51963454", "0.517293",...
0.5725302
1
This function will put your array in a FITS file that you can open in DS9 for visual inspection, or any other purpose. Parameter(s)
def make_fits(array, filename, path=''): hdu0 = fits.PrimaryHDU([]) hdu1 = fits.ImageHDU([array]) hdulist = fits.HDUList([hdu0, hdu1]) if path=='': path = os.getcwd() hdulist.writeto(path+filename+'.fits', overwrite=False) else: hdulist.writeto(path+filename+'.fits', overw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_fits(self, filename):", "def tofits(self, filename=None):\n robot_array = self.robot_array()\n target_array = self.target_array()\n fitsio.write(filename, robot_array, clobber=True)\n fitsio.write(filename, target_array, clobber=False)\n return", "def save_fits(da...
[ "0.7112844", "0.6903038", "0.663769", "0.65599006", "0.64984375", "0.64938784", "0.6489837", "0.64578575", "0.6420876", "0.6293552", "0.6273265", "0.62717324", "0.6267291", "0.6227415", "0.6185756", "0.6176583", "0.61275244", "0.61153895", "0.60628563", "0.6028338", "0.602212...
0.6915744
1
Organizes the files in your working directory based on visit number. Generates a dictionary that sorts the files based on visit number.
def group_visits(wdir): all_files = glob(os.path.join(wdir, '*flc.fits')) group = dict() for file in all_files: visit = fits.getheader(file)['LINENUM'].split('.')[0] if visit not in group: group[str(visit)] = [str(file)] elif visit in group: group[str(visit)]....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_file_dict():\n import os\n file_dict = {}\n for root, dirs, files in os.walk('.'):\n dirs[:] = [ # add any extra dirs to ignore #\n d for d in dirs\n if '.' not in d\n and 'ENV' not in d\n and '__' not in d\n and 'build' not in d\n ...
[ "0.5993223", "0.59494966", "0.5894371", "0.5878789", "0.5795447", "0.5788768", "0.5762669", "0.5728834", "0.5713203", "0.5642163", "0.56342036", "0.5625541", "0.5614913", "0.5597969", "0.55728817", "0.5566646", "0.55191517", "0.5480035", "0.54776114", "0.546864", "0.5452324",...
0.61746734
0
Prints HTML response; useful for debugging tests.
def debug_html(label, response): print("\n\n\n", "*********", label, "\n") print(response.data.decode('utf8')) print("\n\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_response(response):\n print(f\"Response for {url}\")\n if response.status_code == 200:\n # Green text\n print(f\"\\033[1;32;40m {response.status_code} {response.reason}\\033[1;37;40m\")\n else:\n # Red text\n print(f\"\\033[1;31;40m {response.status_code} {response....
[ "0.70429105", "0.6699819", "0.65425724", "0.65398264", "0.63861525", "0.6296697", "0.62906927", "0.6214942", "0.6199883", "0.61866623", "0.6134931", "0.61156917", "0.6112736", "0.6080736", "0.6061218", "0.6059715", "0.60414886", "0.601479", "0.59842736", "0.59836936", "0.5976...
0.7718159
0
After each test, delete the cities.
def tearDown(self): Cafe.query.delete() City.query.delete() db.session.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n del self.my_city", "def test_delete_city(self):\n u = UserFactory(role=User.MODERATOR)\n u.set_password('123')\n u.save()\n log_n = LogEntry.objects.count()\n\n c = CityFactory()\n c.save()\n\n auth_url = prepare_url('login')\n ...
[ "0.80575997", "0.6969745", "0.694893", "0.68621755", "0.680407", "0.6800682", "0.6720583", "0.6715607", "0.66467243", "0.6631308", "0.649708", "0.649708", "0.6492599", "0.6469972", "0.6467292", "0.64334804", "0.64098126", "0.6382244", "0.6382244", "0.63776475", "0.6363666", ...
0.72604793
1
Tell the Robot to stop cleaning
def stopclean(self): raise Exception("Not implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopDetection(self):\n self.statusWrite(\"stop\")\n self.p.sleep()\n self.birdHere = 0", "def stop(self):\r\n self.terminating = True", "def stop(self):\n print_message_received(\"stop\")\n self.robot.drive_system.stop()", "def stop(self):\r\n self.running...
[ "0.73576075", "0.72907317", "0.7263385", "0.72399735", "0.72399735", "0.7227755", "0.7223492", "0.7223492", "0.7223492", "0.7223492", "0.71658593", "0.71473134", "0.71473134", "0.71473134", "0.71473134", "0.71473134", "0.7133828", "0.7133828", "0.7132527", "0.7125268", "0.710...
0.77689457
0
Get indexing status Check if indexing is enabled. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def is_indexing_enabled(self, collection_id, **kwargs): kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.is_indexing_enabled_with_http_info(collection_id, **kwargs) else: (data) = self.is_indexing_enabled_with_http_info(collection_id, **kwarg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_index(self):\n\n if self._check_idx and self._index:\n return self._check_idx", "def is_indexing_enabled_with_http_info(self, collection_id, **kwargs):\n\n all_params = ['collection_id']\n all_params.append('callback')\n all_params.append('_return_http_data_only')\n...
[ "0.64202756", "0.6375936", "0.57622427", "0.57565325", "0.5620718", "0.5593013", "0.5583242", "0.5406694", "0.5362593", "0.5350638", "0.52855283", "0.522831", "0.5217023", "0.51975834", "0.51975834", "0.517215", "0.511512", "0.51103634", "0.5067149", "0.5033741", "0.50284636"...
0.64591163
0
Request rebuild index Request an index rebuild on an existing collection. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def rebuild(self, collection_id, **kwargs): kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.rebuild_with_http_info(collection_id, **kwargs) else: (data) = self.rebuild_with_http_info(collection_id, **kwargs) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rebuild_index(self):\n from django.core.management import call_command\n call_command('rebuild_index', interactive=False, verbosity=0)", "def rebuild_with_http_info(self, collection_id, **kwargs):\n\n all_params = ['collection_id']\n all_params.append('callback')\n all_par...
[ "0.62315875", "0.602992", "0.59027463", "0.5742475", "0.5566116", "0.5566116", "0.5414252", "0.5414006", "0.51835304", "0.51398534", "0.51164776", "0.5080432", "0.49207366", "0.49111786", "0.48998672", "0.48903412", "0.47889283", "0.47243795", "0.4723609", "0.46759757", "0.46...
0.6661653
0
Change indexing status Enable or disable indexing on an existing collection. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def set_indexing_enabled(self, collection_id, body, **kwargs): kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.set_indexing_enabled_with_http_info(collection_id, body, **kwargs) else: (data) = self.set_indexing_enabled_with_http_info(collect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_indexing_enabled_with_http_info(self, collection_id, body, **kwargs):\n\n all_params = ['collection_id', 'body']\n all_params.append('callback')\n all_params.append('_return_http_data_only')\n all_params.append('_preload_content')\n all_params.append('_request_timeout')\n...
[ "0.66845334", "0.571336", "0.5518714", "0.5299254", "0.5092742", "0.49066973", "0.48308542", "0.47795677", "0.46901208", "0.4644369", "0.46376935", "0.46256793", "0.46205524", "0.46175686", "0.45979646", "0.45585275", "0.45510438", "0.45369563", "0.45341522", "0.45341247", "0...
0.71299356
0
Change indexing status Enable or disable indexing on an existing collection. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def set_indexing_enabled_with_http_info(self, collection_id, body, **kwargs): all_params = ['collection_id', 'body'] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_indexing_enabled(self, collection_id, body, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.set_indexing_enabled_with_http_info(collection_id, body, **kwargs)\n else:\n (data) = self.set_indexing_enabled_with_http_in...
[ "0.7132368", "0.57167596", "0.5522436", "0.52990115", "0.50922185", "0.49085262", "0.48318607", "0.47808215", "0.46896845", "0.46444702", "0.4639374", "0.46250963", "0.46188778", "0.46187243", "0.46014965", "0.45583203", "0.45503423", "0.45368776", "0.45359975", "0.45320195", ...
0.6687099
1
List collection status Display status information about an existing collection. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def status(self, collection_id, **kwargs): kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.status_with_http_info(collection_id, **kwargs) else: (data) = self.status_with_http_info(collection_id, **kwargs) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_collection_status(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"data_collection_status\"), kwargs)", "def status_all_with_http_info(self, **kwargs):\n\n all_params = []\n all_params.append('callback')\n all_params.append('_return_http_data_only')\n ...
[ "0.7318824", "0.7295206", "0.7102955", "0.65757906", "0.648761", "0.63682735", "0.6271686", "0.61010176", "0.5650195", "0.5554575", "0.55134416", "0.5458567", "0.5368529", "0.52405345", "0.5231259", "0.51703393", "0.51604354", "0.515305", "0.5146796", "0.514557", "0.5134877",...
0.7648862
0
List status for all collections Display status information about all existing collections. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def status_all_with_http_info(self, **kwargs): all_params = [] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_collection_status(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"data_collection_status\"), kwargs)", "def status(self, collection_id, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.status_with_htt...
[ "0.6863459", "0.66944957", "0.6633338", "0.6509232", "0.6375338", "0.6056797", "0.60126746", "0.5943748", "0.5908979", "0.5755109", "0.5734625", "0.5677355", "0.5655235", "0.56186336", "0.55815095", "0.5505445", "0.5504833", "0.5412489", "0.5389496", "0.53617734", "0.5295269"...
0.7622068
0
Update a collection Updates an existing collection. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def update(self, collection_id, body, **kwargs): kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.update_with_http_info(collection_id, body, **kwargs) else: (data) = self.update_with_http_info(collection_id, body, **kwargs) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_collection(self, bucket_id, collection_id, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.update_collection_with_http_info(bucket_id, collection_id, **kwargs)\n else:\n (data) = self.update_collection_with_http_i...
[ "0.76857024", "0.71235275", "0.7037156", "0.69677466", "0.6750384", "0.6648804", "0.65590507", "0.6208271", "0.60423267", "0.6038878", "0.5893929", "0.5853785", "0.5823851", "0.5781511", "0.5763387", "0.5668278", "0.54936445", "0.5441208", "0.5405871", "0.5403321", "0.5403277...
0.7737028
0
Calculate the normalized distance between the embeddings of two words.
def diff(self, word1, word2): v = self._vecs[self._index[word1]] - self._vecs[self._index[word2]] return v / np.linalg.norm(v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pairwise_distance(self, src_embeds, vocab_embeds, squared=False):\n # compute square norm to avoid compute all the directions\n vocab_sq_norm = vocab_embeds.norm(p=2, dim=-1) ** 2\n src_sq_norm = src_embeds.norm(p=2, dim=-1) ** 2\n\n # dot product\n dot_product = self._pairw...
[ "0.7286021", "0.72623956", "0.721585", "0.721307", "0.7204037", "0.71977025", "0.7186543", "0.70891815", "0.6977888", "0.6919238", "0.68870157", "0.6784941", "0.6743485", "0.6693251", "0.6688765", "0.66666394", "0.6653541", "0.6604185", "0.65965676", "0.65595305", "0.6548764"...
0.742528
0
Save the words and embeddings to a file, sorted by words frequency in descending order.
def save_embeddings(self, filename, binary=True): with open(filename, "wb", encoding="utf8") as fout: fout.write("%s %s\n" % self._vecs.shape) # store in sorted order: most frequent words at the top for i, word in enumerate(self._words): row = self._vecs[i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, filename):\n with open(filename, \"w\", encoding=\"utf8\") as f:\n f.write(\n \"\\n\".join(\n [\n w + \" \" + \" \".join([str(x) for x in v])\n for w, v in zip(self._words, self._vecs)\n ...
[ "0.71027607", "0.6819131", "0.68078804", "0.677343", "0.6735313", "0.6511843", "0.65113306", "0.6460898", "0.6394754", "0.6384446", "0.6375948", "0.6351385", "0.631681", "0.62701535", "0.6256178", "0.6229504", "0.6220278", "0.6203524", "0.6178648", "0.6155609", "0.6126635", ...
0.74827415
0
Print the most stereotypical professions on both ends of the bias direction.
def profession_stereotypes(self, profession_words, bias_space, print_firstn=20): assert isinstance(print_firstn, int) and print_firstn >= 0 # Calculate the projection values onto the bias subspace sp = sorted( [ (self.v(w).dot(bias_space), w) for w in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_people_strategies():\n\t\tfor person in sorted(Simulation.community):\n\t\t\tSimulation.community[person].print_info()\n\t\tPerson.person_progression.write(\"--------------- END OF WEEK ---------------\" + \"\\n\")", "def print_skill_title(self):\n #index_largest = self.clusters.index(max(self.c...
[ "0.6361542", "0.60957587", "0.59916824", "0.597503", "0.5859005", "0.5754796", "0.5745316", "0.5673546", "0.5574457", "0.55710953", "0.55202615", "0.5507526", "0.5440333", "0.54283935", "0.54233825", "0.5417117", "0.5393393", "0.53846264", "0.5380719", "0.5379185", "0.5353523...
0.7290917
0
Print the analogies in a nicer format.
def viz(analogies): print("Index".ljust(12) + "Analogy".center(45) + "Gender score".rjust(12)) print("-" * 69) print( "\n".join( str(i).rjust(4) + a[0].rjust(29) + " | " + a[1].ljust(29) + (str(a[2]))[:4] for i, a in enumerate(analogies) ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print(cls, vas):\n print(vas)", "def pprint(self):\r\n for i in self.items():\r\n print '%s => %r'%i", "def print(self):\n str_items = [(str(v),str(p)) for v,p in sorted(self.items())]\n max_lens = [\n max(i[0] for i in str_items),\n max(i[1] for...
[ "0.63618153", "0.633266", "0.62989044", "0.62901837", "0.62889653", "0.6280727", "0.6275443", "0.6168047", "0.61478996", "0.6145579", "0.61368775", "0.6111617", "0.6092454", "0.6092312", "0.6087881", "0.60767114", "0.60763526", "0.6049187", "0.60266894", "0.60248387", "0.6019...
0.67746913
0
Perform PCA on the centered embeddings of the words in the pairs.
def doPCA(pairs, embedding, num_components=10): matrix = [] for a, b in pairs: center = (embedding.v(a) + embedding.v(b)) / 2 matrix.append(embedding.v(a) - center) matrix.append(embedding.v(b) - center) matrix = np.array(matrix) pca = PCA(n_components=num_components) pca.fit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pca(embedding, num_components=3, principal_components=None):\n# shape = embedding.get_shape().as_list()\n shape = tf.shape(embedding)\n embedding = tf.reshape(embedding, [-1, shape[3]])\n\n if principal_components is None:\n principal_components = calculate_principal_components(embedding,\n ...
[ "0.6045342", "0.5942827", "0.58956623", "0.58551455", "0.5813153", "0.57986903", "0.5774442", "0.5707375", "0.5700203", "0.5676374", "0.5656551", "0.56111175", "0.56064177", "0.55749196", "0.55516756", "0.5547325", "0.55451876", "0.55138457", "0.5510211", "0.55065274", "0.549...
0.75337654
0
Argument Parser for the nussinov program
def setParser(): parser = argparse.ArgumentParser( prog="Nussinov Algorithm Solver", description="A program that runs Nussinov's Algorithm on a given RNA strand and returns the most viable pairings." ) group = parser.add_mutually_exclusive_group(required=True) group.add_argument("-f", "-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Args(parser):", "def parse_arguments(args):", "def parse_args():\n parser = argparse.ArgumentParser(\n formatter_class=argparse.RawDescriptionHelpFormatter,\n description=\"\"\"\nNenG - Nash Equilibrium Noncooperative games.\nTool for computing Nash equilibria in noncooperative games.\nSpe...
[ "0.6941162", "0.67057675", "0.669804", "0.6569517", "0.65421695", "0.648353", "0.6388414", "0.6338641", "0.6330334", "0.6304197", "0.63023865", "0.63015646", "0.6294502", "0.627146", "0.6257962", "0.62389624", "0.6235523", "0.62227726", "0.62178814", "0.62130237", "0.6191569"...
0.7096899
0
Takes passed arguments from script and loads the sequence from file or from input string
def getSequence(args): sequence = args.sequence if sequence in [None, "", ''] and args.filepath not in [None, "", '']: if path.exists(args.filepath): try: with open(args.filepath, "r+") as file: sequence = file.readline() except Exception as e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_real(self):\n\n if len(self.args) == 1:\n slice_file = \"-\"\n seq_file = self.args[0]\n elif len(self.args) == 2:\n slice_file = self.args[0]\n seq_file = self.args[1]\n else:\n self.parser.print_help()\n return 1\n\n ...
[ "0.60671085", "0.591243", "0.5838243", "0.5584758", "0.5563122", "0.5546405", "0.5540286", "0.55338585", "0.55183625", "0.55168164", "0.54732597", "0.54644245", "0.53941137", "0.53898495", "0.5385075", "0.5385075", "0.53753227", "0.53566664", "0.535505", "0.5349396", "0.53475...
0.657227
0
Determines the cost associated with a pair, 1 if in valid pairs, else 0 This function gives 1 cost to UG pairs as well
def costFunction(a, b): pairs = [('G', 'C'), ('C', 'G'), ('A', 'U'), ('U', 'A')] if UNCOMMON: pairs.append([('G', 'U'), ('U', 'G')]) if (a, b) in pairs: return 1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cost(graph, gates_qubits_pairs):\n for allowed, gate in enumerate(gates_qubits_pairs):\n if gate not in graph.edges():\n break\n return len(gates_qubits_pairs) - allowed", "def pairing_cost_map(players, cost_functions):\n\n if len(players) == 0:\n return dict...
[ "0.6760898", "0.59937674", "0.5882713", "0.5844929", "0.5836548", "0.58140975", "0.57850605", "0.5784143", "0.57834023", "0.5724555", "0.56991553", "0.56976324", "0.5600499", "0.559372", "0.55909175", "0.55856216", "0.55798566", "0.5541015", "0.55360955", "0.5508084", "0.5508...
0.6949529
0
Compare a set of input keys to expected keys.
def assert_keys_match(keys, expected, allow_missing=True): if not allow_missing: missing = expected - keys assert not missing, 'missing keys: %s' % missing extra = keys - expected assert not extra, 'extraneous keys: %s' % extra
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compare_keys(self):\n dict1 = {\"a\":1 , \"b\":2 , \"c\":3}\n dict2 = {\"b\":1 ,\"a\":2 , \"c\":3}\n dict3 = {\"b\":1 ,\"d\":2 , \"c\":3}\n self.assertEqual(True, comparator.compare_keys(dict1, dict2))\n self.assertEqual(False, comparator.compare_keys(dict2, dict3))", ...
[ "0.72339267", "0.70807713", "0.7028946", "0.6939085", "0.69050825", "0.68213785", "0.68083143", "0.6603015", "0.6579404", "0.6534215", "0.6483633", "0.63990706", "0.6259154", "0.62108934", "0.6114493", "0.6069182", "0.60690826", "0.60552496", "0.60516036", "0.60516036", "0.60...
0.7215275
1
Reads a key from dict, ensuring valid bool if present.
def read_key_bool(op, key): if key in op: assert isinstance(op[key], bool), 'must be bool: %s' % key return op[key] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_key_dict(obj, key):\n assert key in obj, 'key `%s` not found' % key\n assert obj[key], 'key `%s` was blank' % key\n assert isinstance(obj[key], dict), 'key `%s` not a dict' % key\n return obj[key]", "def readKey(self, keyPath):\n\t\ttry:", "def isValidKey(key):\n return True", "def _che...
[ "0.6125381", "0.61197007", "0.59757054", "0.5955354", "0.5898141", "0.5896521", "0.58521867", "0.58086807", "0.57042295", "0.567589", "0.56483555", "0.5639008", "0.56366557", "0.562926", "0.5597538", "0.5592852", "0.5591112", "0.558603", "0.5575906", "0.55707663", "0.55380774...
0.69093263
0
Given a dict, read `key`, ensuring result is a dict.
def read_key_dict(obj, key): assert key in obj, 'key `%s` not found' % key assert obj[key], 'key `%s` was blank' % key assert isinstance(obj[key], dict), 'key `%s` not a dict' % key return obj[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapToDict(dictionary, key):\n return dictionary[key]", "def get_dict(key):\r\n name = f\"{key}_dict\"\r\n return eval(name)", "def retrieve_airflow_variable_as_dict(\n key: str) -> Dict[str, Union[str, Dict[str, str]]]:\n value = models.Variable.get(key)\n try:\n value_dict = json.loads(va...
[ "0.64505696", "0.62807685", "0.61291075", "0.6112858", "0.60777533", "0.6070061", "0.6029543", "0.60195816", "0.5918118", "0.5897547", "0.58628786", "0.5807329", "0.57855767", "0.577967", "0.5760674", "0.5735775", "0.5665205", "0.5650904", "0.56203103", "0.56022245", "0.55796...
0.7652841
0
Verify `name` as a candidate and check for record id.
def validated_id(cls, name): if name: if name in cls._ids: return cls._ids[name] if cls.validated_name(name): if Accounts.exists(name): return cls.get_id(name) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_id(self, id):", "def _validate_duplicate_names(res_data, name, _id=None):\n if _id:\n for data in res_data:\n if data.get(\"name\") == name and data.get(\"id\") != _id:\n return False\n return True\n else:\n for data in res_data:\n if data...
[ "0.6676182", "0.66549516", "0.65631896", "0.6561926", "0.6419692", "0.64138436", "0.63998145", "0.6386987", "0.62342644", "0.62223", "0.62131345", "0.6199242", "0.6191196", "0.6190522", "0.6190452", "0.61288655", "0.6125294", "0.60896033", "0.6065993", "0.60242844", "0.599035...
0.7007093
0
Given a community name, get its internal id.
def get_id(cls, name): assert name, 'name is empty' if name in cls._ids: return cls._ids[name] sql = "SELECT id FROM hive_communities WHERE name = :name" cid = DB.query_one(sql, name=name) if cid: cls._ids[name] = cid cls._names[cid] = name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _community(G, u, community):\n node_u = G.node[u]\n try:\n return node_u[community]\n except KeyError:\n raise nx.NetworkXAlgorithmError('No community information')", "def network_id(tenant_id, auth_token, network_name):\r\n content = common_utils.do_request(\r\n ...
[ "0.6250433", "0.6121883", "0.5975133", "0.59303844", "0.59173137", "0.5826043", "0.5796814", "0.57310736", "0.5728848", "0.57082736", "0.570665", "0.57005477", "0.569628", "0.5695367", "0.56726134", "0.5668089", "0.56609166", "0.565801", "0.5649222", "0.56416994", "0.56351113...
0.74913245
0
Return a list of all muted accounts.
def get_all_muted(cls, community_id): return DB.query_col("""SELECT name FROM hive_accounts WHERE id IN (SELECT account_id FROM hive_roles WHERE community_id = :community_id AND role_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_users(self):\n distinct_users = list(self.client.smartsleep.attendees.distinct(\"userId\"))\n return distinct_users", "def unlocked_accounts(self):\n return [account for account in self if not account.locked]", "def get_all_volunteers(self):\n volunteers = []\n for us...
[ "0.6307945", "0.6274277", "0.623905", "0.6095837", "0.6094344", "0.60708183", "0.6038648", "0.59835505", "0.59828734", "0.57955194", "0.5775009", "0.5770793", "0.5766413", "0.57480866", "0.57162577", "0.57076395", "0.5706624", "0.5699043", "0.56884253", "0.56756544", "0.56554...
0.7069909
0
Get user role within a specific community.
def get_user_role(cls, community_id, account_id): return DB.query_one("""SELECT role_id FROM hive_roles WHERE community_id = :community_id AND account_id = :account_id LIMIT 1""", commu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRole(self, node):\n info = self.getNode(node, includeDevices=False)\n if info is None:\n self.log.error(\"could not get role because '%s' does not exist\", node)\n return None\n return info.role", "def get_user_role():\n\n if session['user_role'] == 'student':...
[ "0.6476978", "0.63823515", "0.6363005", "0.6283268", "0.6265126", "0.62571126", "0.62291235", "0.62223184", "0.61968863", "0.60822725", "0.60033077", "0.5954628", "0.593859", "0.59317774", "0.59272474", "0.591147", "0.5909513", "0.58935285", "0.58813465", "0.5865219", "0.5852...
0.71126795
0
Given a new post/comment, check if valid as per community rules
def is_post_valid(cls, community_id, comment_op: dict): assert community_id, 'no community_id' community = cls._get_name(community_id) account_id = Accounts.get_id(comment_op['author']) role = cls.get_user_role(community_id, account_id) type_id = int(community[5]) # TOD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_blog_post(self, req, postname, version, fields):\n for category in _parse_categories(fields['categories']):\n if category in self.draft:\n if req.authname == 'anonymous':\n return [(None, 'You need to be logged in to save as draft.')]\n ...
[ "0.62227374", "0.61295384", "0.60019886", "0.59893394", "0.5949739", "0.59365237", "0.5877104", "0.5830495", "0.57753825", "0.57273066", "0.5714507", "0.57066494", "0.56890285", "0.56612223", "0.5660342", "0.5644787", "0.56245315", "0.559673", "0.5590323", "0.5586681", "0.558...
0.7543054
0
Update all pending payout and rank fields.
def recalc_pending_payouts(cls): sql = """SELECT id, COALESCE(posts, 0), COALESCE(payouts, 0), COALESCE(authors, 0) FROM hive_communities c LEFT JOIN ( SELECT community_id, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_budgets(self):\n\n # Init the variables\n self.next_Omega = self.Omega\n self.next_Phi = self.Phi\n self.next_Lambda = self.Lambda\n # Update the one to be updated\n if self.player == 0:\n self.next_Omega = self.Omega - 1\n elif self.player == ...
[ "0.5612123", "0.5498229", "0.545742", "0.5438718", "0.5407351", "0.54060024", "0.5373511", "0.5276792", "0.52203137", "0.52070946", "0.5103955", "0.5061251", "0.5003157", "0.49942267", "0.49661735", "0.4962416", "0.4912601", "0.48971972", "0.48836514", "0.48782393", "0.485905...
0.6945879
0
Check an account's subscription status.
def _subscribed(self, account_id): sql = """SELECT 1 FROM hive_subscriptions WHERE community_id = :community_id AND account_id = :account_id""" return bool(DB.query_one( sql, community_id=self.community_id, account_id=account_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verifysubscriptionstatusinaccounttab():\n pass", "async def status(ctx):\n redis = await RedisDB.create()\n user = ctx.message.author\n try:\n subscription_id = await get_subscription_id(user, redis)\n\n if subscription_id is None:\n subscription_json = await create_subsc...
[ "0.79412097", "0.71638125", "0.69243705", "0.6228792", "0.62228334", "0.60814595", "0.6052438", "0.5985828", "0.59778154", "0.5947996", "0.59201866", "0.5842008", "0.58302164", "0.5800907", "0.57920486", "0.5789828", "0.575155", "0.5726498", "0.57236356", "0.56621563", "0.564...
0.7298385
1
Check post's muted status.
def _muted(self): sql = "SELECT is_muted FROM hive_posts WHERE id = :id" return bool(DB.query_one(sql, id=self.post_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def muted(self) -> bool:\n return self._muted", "def is_muted(self):\n return self.muting_handler.is_muted()", "def isMuted(self):\n return self._isMuted", "def is_muted(self):\n # type: () -> bool\n return self._is_muted", "def is_volume_muted(self):\n return self...
[ "0.7033664", "0.68607223", "0.6625169", "0.6539288", "0.6469418", "0.63501257", "0.63372064", "0.6249322", "0.62470967", "0.62470967", "0.62470967", "0.6234355", "0.6154165", "0.61492485", "0.612375", "0.60978466", "0.60734046", "0.5952615", "0.58471787", "0.58437407", "0.576...
0.7875454
0
Check parent post's muted status.
def _parent_muted(self): parent_id = "SELECT parent_id FROM hive_posts WHERE id = :id" sql = "SELECT is_muted FROM hive_posts WHERE id = (%s)" % parent_id return bool(DB.query_one(sql, id=self.post_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _muted(self):\n sql = \"SELECT is_muted FROM hive_posts WHERE id = :id\"\n return bool(DB.query_one(sql, id=self.post_id))", "def muted(self) -> bool:\n return self._muted", "def is_muted(self):\n return self.muting_handler.is_muted()", "def is_volume_muted(self):\n ret...
[ "0.7123572", "0.6673975", "0.6323126", "0.61445504", "0.613507", "0.6108852", "0.6080271", "0.6080271", "0.6080271", "0.6044953", "0.60223186", "0.60145766", "0.5991438", "0.58561844", "0.5629622", "0.5451478", "0.5331708", "0.53028053", "0.5275612", "0.5273927", "0.52620155"...
0.7886913
0
Check post's pinned status.
def _pinned(self): sql = "SELECT is_pinned FROM hive_posts WHERE id = :id" return bool(DB.query_one(sql, id=self.post_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_pinned_content(self):\n if \"query\" in self.query:\n q = self.query[\"query\"]\n else:\n q = self.query\n if \"pinned_ids\" in q:\n return bool(len(q.get(\"pinned_ids\", [])))\n return False", "def _pinned():\n result = \"pinned\" if this_t...
[ "0.6700017", "0.61331105", "0.596125", "0.57118297", "0.56939167", "0.55961037", "0.5477324", "0.54076844", "0.5321976", "0.5283378", "0.52454925", "0.5242679", "0.5218903", "0.5209596", "0.51835704", "0.51642054", "0.5133033", "0.5130174", "0.512657", "0.5092066", "0.5090023...
0.8083206
0
Sets up a classifier for use
def setup_classifier(name): global _classifier, _trained if name == "euclid": _classifier = name _trained = True elif name == "bayes": _classifier = name _trained = True elif name == "rocchio": _classifier = name _trained = True else: print("Cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_classifier(self, classifier):\n self.classifier = classifier\n self.tester = Tester.Test(classifier)\n self.trained_ham_hist = Hist()\n self.trained_spam_hist = Hist()", "def __init__(self, classifier, X, y, val_method, val_size, k, stratify):\n\t\tModel.counter += 1\n\n\t\tse...
[ "0.7436511", "0.733247", "0.7201676", "0.70582503", "0.6993458", "0.69929725", "0.69442517", "0.69266564", "0.6838657", "0.68037814", "0.67974", "0.67292416", "0.671718", "0.6693354", "0.6679035", "0.66750187", "0.66644925", "0.6577201", "0.6555603", "0.6542693", "0.6528392",...
0.77098763
0
Evaluate a text with given train set using the set up classifier
def evaluate(text, articles, no_preprocess=False): if not _trained: print("No classifier initialized. Make sure to do so first") raise Exception if not no_preprocess: text = body_reader.get_words_in(text) if _classifier == "euclid": return euclidean.evaluate(articles, text)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, featureset):\r\n #sequence, tag = featureset\r\n gs, labels = [], []\r\n for s, t in featureset:\r\n gs.append(t)\r\n label = self.tagger.choose_tag(s)\r\n labels.append(label)\r\n print (t, label)\r\n\r\n assert(len(gs) == ...
[ "0.70962906", "0.6943633", "0.6822659", "0.66456556", "0.6644769", "0.66341835", "0.65980095", "0.65802", "0.65575683", "0.6527537", "0.6527537", "0.6511052", "0.6504692", "0.64602184", "0.64459735", "0.64284915", "0.6425316", "0.64167213", "0.640727", "0.6388599", "0.6343756...
0.71262985
0
instead of querying the site twice (first leagues and then matches)
def get_all_matches_by_league(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_matches() -> Union[WebElement, None]:\n #navigating to soccer matches page\n print(\"Starting to look for matches\")\n WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, \".hm-MainHeaderLogoWide_Bet365LogoImage\"))).click()\n sports = driver.find_elements_by_class_n...
[ "0.6230952", "0.58164877", "0.57194513", "0.5475062", "0.5414087", "0.540916", "0.5403245", "0.5382146", "0.53518337", "0.5312016", "0.5311977", "0.52966696", "0.5252232", "0.5247202", "0.5239561", "0.5224129", "0.52188694", "0.5210715", "0.5197156", "0.51748246", "0.51668096...
0.6190075
1
Get game name for user and set its proper id
def set_game_id(self, game_name): dic = {(''.join(filter(str.isalpha, key))): v for key, v in self.games_map.items()} dic = dic[self.league] dic = {(''.join(filter(str.isalpha,key))):v for key,v in dic.items()} self.game_id = dic[game_name][0] self.game_time = dic[game_name][1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_game_id(self) -> str:\n return self.game_name_entry.get()", "def set_game_id(self, value: str) -> None:\n self.game_name_entry.delete(0, len(self.game_name_entry.get()))\n self.game_name_entry.insert(0, value)", "def new_game(blank_game, user_id=None):\n if user_id:\n g.d...
[ "0.73327935", "0.65675193", "0.63035643", "0.62938285", "0.6293378", "0.6210712", "0.6188612", "0.6188612", "0.6188612", "0.6105323", "0.6088365", "0.6041224", "0.60354435", "0.60188615", "0.60188615", "0.60095835", "0.59916943", "0.59532917", "0.595209", "0.5932363", "0.5928...
0.7534376
0
Check if a path is inside of a source Rez package's list of variants. This function's purpose is hard to describe.
def _get_variant_less_path(root, path, variants): for variant_less_path in _iter_variant_extracted_paths(root, path, variants): if not imports.has_importable_module(variant_less_path, ignore={"__init__.py"}): # This condition happens only when a Rez package defines # A Python package...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, obj):\n if isinstance(obj, str):\n path = Path(obj)\n try:\n repo_path = Path(getattr(self, \"location\")).resolve()\n except AttributeError:\n return False\n\n # existing relative path\n if not path....
[ "0.6436872", "0.61978734", "0.611825", "0.59328175", "0.5863272", "0.57668215", "0.56686926", "0.5650742", "0.5596057", "0.5559053", "0.5547557", "0.5546915", "0.5546251", "0.5532427", "0.55249786", "0.54744756", "0.5423943", "0.5386734", "0.5384271", "0.5383693", "0.53809667...
0.7300656
0
Check if the given Rez package is a source directory or a built Rez package.
def is_built_package(package): try: parent_folder = finder.get_package_root(package) except (AttributeError, TypeError): raise ValueError( 'Input "{package}" is not a valid Rez package.'.format(package=package) ) version = str(package.version) if not version: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsPackage(path):\n init_base_path = os.path.join(path, '__init__.py')\n return (os.path.isfile(init_base_path) or\n os.path.isfile(init_base_path + 'c') or\n os.path.isfile(init_base_path + 'o'))", "def _is_package(path):\n if not os.path.isdir(path):\n return False\n ...
[ "0.6811845", "0.6775147", "0.67093", "0.67093", "0.6703259", "0.66499954", "0.6600665", "0.6493551", "0.63353056", "0.6322277", "0.6100381", "0.6078929", "0.60449576", "0.5986843", "0.59790695", "0.5961668", "0.5952385", "0.59494877", "0.5930723", "0.5904908", "0.5888437", ...
0.7505242
0
Get the Python files that a Rez package adds to the user's PYTHONPATH. If the Rez package is an installed Rez package and it contains variants, each variant will have its paths returned.
def get_package_python_paths(package, paths): # Note: Here we're trying to get `package`'s specific changes to PYTHONPATH (if any) # # Unfortunately, the Rez API doesn't really support this yet. # There's 2 GitHub links that may one-day implement it though: # - https://github.com/nerdvegas/rez/i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rpaths(pkg):\n rpaths = [pkg.prefix.lib, pkg.prefix.lib64]\n deps = get_rpath_deps(pkg)\n rpaths.extend(d.prefix.lib for d in deps if os.path.isdir(d.prefix.lib))\n rpaths.extend(d.prefix.lib64 for d in deps if os.path.isdir(d.prefix.lib64))\n # Second module is our compiler mod name. We use...
[ "0.68803835", "0.6792354", "0.6747557", "0.67192644", "0.66945404", "0.6643895", "0.6533894", "0.65237635", "0.6505269", "0.6490075", "0.6470572", "0.64601886", "0.64022046", "0.6363765", "0.63257396", "0.62893164", "0.62637025", "0.6257684", "0.62080556", "0.61816895", "0.61...
0.72466767
0