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
Compare in pairs If n is odd then initialize min and max as first element. If n is even then initialize min and max as minimum and maximum of the first two elements respectively. For rest of the elements, pick them in pairs and compare their maximum and minimum with max and min respectively.
def getminmax_pair_compare(arr): if len(arr) == 0: return None, None if len(arr) == 1: return arr[0], arr[0] min_num = None max_num = None index = 0 if len(arr) % 2 == 0: if arr[0] > arr[1]: max_num = arr[0] min_num = arr[1] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pairs_upto(n):\n return ((a, b)\n for a in range(1, n)\n for b in range(1, n)\n if a <= b)", "def getminmax_tournament(arr, low, high):\n if low == high:\n return arr[low], arr[low]\n\n if abs(low - high) == 1:\n min_num = None\n max_num = None\n...
[ "0.6786804", "0.62690365", "0.5994578", "0.589454", "0.58620936", "0.57882094", "0.5732618", "0.56569004", "0.56277883", "0.560861", "0.56031567", "0.55943364", "0.55386573", "0.5536303", "0.5491848", "0.5489913", "0.54479414", "0.5440645", "0.541281", "0.540084", "0.53986096...
0.69033545
0
Checks whether an executable is in the user's search path. This expects a name without any systemspecific executable extension. It will append the proper extension as necessary. For example, use "myapp" and not "myapp.exe". This will return True if the app is in the path, or False otherwise. Taken from djblets.util.fil...
def is_exe_in_path(name): if sys.platform == 'win32' and not name.endswith('.exe'): name += '.exe' for dir in os.environ['PATH'].split(os.pathsep): if os.path.exists(os.path.join(dir, name)): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_path(self):\n exe = self.command.split()[0]\n for try_path in os.environ[\"PATH\"].split(os.pathsep):\n try_path = try_path.strip('\"')\n exe_try = os.path.join(try_path, exe).strip()\n if os.path.isfile(exe_try) and os.access(exe_try, os.X_OK):\n ...
[ "0.7964499", "0.75925285", "0.74517477", "0.7201914", "0.7171159", "0.7160815", "0.7160815", "0.7151977", "0.71429574", "0.7139493", "0.7132476", "0.7113784", "0.70644397", "0.7055049", "0.70248353", "0.6968808", "0.69569904", "0.69459975", "0.6837878", "0.68116426", "0.67874...
0.80723464
0
Render the comments on a match.
def view_for_match(match_id): match = _get_match_or_404(match_id) party_id = request.args.get('party_id') comments = match_comment_service.get_comments( match.id, party_id=party_id, include_hidden=False ) return { 'comments': comments, }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_for_match_as_json(match_id):\n match = _get_match_or_404(match_id)\n\n party_id = request.args.get('party_id')\n\n comments = match_comment_service.get_comments(\n match.id, party_id=party_id, include_hidden=True\n )\n\n comment_dtos = list(map(_comment_to_json, comments))\n\n ret...
[ "0.69025636", "0.6517017", "0.64587337", "0.6375415", "0.5832153", "0.57927454", "0.56803596", "0.5635831", "0.5615115", "0.5613555", "0.55577534", "0.5545727", "0.536719", "0.5287216", "0.51774096", "0.5171562", "0.5137133", "0.5116178", "0.5093417", "0.5071616", "0.5009722"...
0.77387655
0
Render the comments on a match as JSON.
def view_for_match_as_json(match_id): match = _get_match_or_404(match_id) party_id = request.args.get('party_id') comments = match_comment_service.get_comments( match.id, party_id=party_id, include_hidden=True ) comment_dtos = list(map(_comment_to_json, comments)) return jsonify({ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_for_match(match_id):\n match = _get_match_or_404(match_id)\n\n party_id = request.args.get('party_id')\n\n comments = match_comment_service.get_comments(\n match.id, party_id=party_id, include_hidden=False\n )\n\n return {\n 'comments': comments,\n }", "def render(self, d...
[ "0.74470305", "0.64242184", "0.6096649", "0.60887337", "0.59857726", "0.58441186", "0.5687088", "0.5570564", "0.5343562", "0.5233029", "0.52269316", "0.52158976", "0.5182298", "0.51769084", "0.51769084", "0.51769084", "0.5169123", "0.51422024", "0.5129795", "0.5127157", "0.51...
0.8169989
0
Create a comment on a match.
def create(): schema = CreateMatchCommentRequest() try: req = schema.load(request.get_json()) except ValidationError as e: abort(400, str(e.normalized_messages())) match = match_service.find_match(req['match_id']) if not match: abort(400, 'Unknown match ID') creator = u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_comment(\n match_id: MatchID, creator_id: UserID, body: str\n) -> DbMatchComment:\n comment = DbMatchComment(match_id, creator_id, body)\n\n db.session.add(comment)\n db.session.commit()\n\n return comment", "def make_comment(self, offset, comment):\n #self.ret = idc.MakeComm(off...
[ "0.76624846", "0.6174262", "0.5974365", "0.5959866", "0.59292716", "0.58998793", "0.58507085", "0.5784041", "0.5759629", "0.5698574", "0.56976587", "0.5687063", "0.5665218", "0.5641729", "0.5636225", "0.56260973", "0.5558051", "0.55462354", "0.5516858", "0.5492579", "0.546112...
0.7506518
1
Hide the match comment.
def hide(comment_id): schema = ModerateMatchCommentRequest() try: req = schema.load(request.get_json()) except ValidationError as e: abort(400, str(e.normalized_messages())) initiator = user_service.find_active_user(req['initiator_id']) if not initiator: abort(400, 'Initiato...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_comment(comment_id: MatchCommentID, initiator_id: UserID) -> None:\n comment = DbMatchComment.query.get(comment_id)\n if comment is None:\n raise ValueError('Unknown match comment ID')\n\n comment.hidden = True\n comment.hidden_at = datetime.utcnow()\n comment.hidden_by_id = initiato...
[ "0.6956386", "0.67960644", "0.6645516", "0.64213216", "0.6122187", "0.6085422", "0.6044063", "0.589062", "0.58788264", "0.587854", "0.57618713", "0.5756605", "0.5739403", "0.5698349", "0.5673908", "0.5667086", "0.56274337", "0.5554921", "0.5545091", "0.553894", "0.5529545", ...
0.7107491
0
Unhide the match comment.
def unhide(comment_id): schema = ModerateMatchCommentRequest() try: req = schema.load(request.get_json()) except ValidationError as e: abort(400, str(e.normalized_messages())) initiator = user_service.find_active_user(req['initiator_id']) if not initiator: abort(400, 'Initia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unhide_comment(comment_id: MatchCommentID, initiator_id: UserID) -> None:\n comment = DbMatchComment.query.get(comment_id)\n if comment is None:\n raise ValueError('Unknown match comment ID')\n\n comment.hidden = False\n comment.hidden_at = None\n comment.hidden_by_id = None\n\n db.ses...
[ "0.70979667", "0.65529567", "0.6209326", "0.61320955", "0.60730875", "0.6047574", "0.6014774", "0.5923895", "0.5921565", "0.5790912", "0.57796824", "0.57351196", "0.56272805", "0.5621866", "0.5553992", "0.5522723", "0.54890823", "0.54295117", "0.5421029", "0.5381388", "0.5304...
0.7044827
1
Generates a random token of length 50 100, consisting of letters and numbers.
def generateToken(): token_length = random.randint(MIN_TOKEN_LEN, MAX_TOKEN_LEN) token = ''.join(random.choice(POSS_TOKEN_CHARS) for _ in range(token_length)) return token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):\n rand = random.SystemRandom()\n return ''.join(rand.choice(chars) for x in range(length))", "def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):\n rand = random.SystemRandom()\n return ''.join(rand.choice(chars) for x in...
[ "0.7993329", "0.7993329", "0.7920154", "0.78736335", "0.7871774", "0.77672803", "0.7656302", "0.73956025", "0.7290423", "0.7186431", "0.6872293", "0.68314445", "0.6819142", "0.6745215", "0.6715566", "0.6651408", "0.6571149", "0.65467554", "0.65405196", "0.6539193", "0.6511962...
0.8124889
0
Checks if the given password matches the stored password in the database for the given user name.
def correct_password(name, password): if not User.created(name): return False user = User.get_user(name) return user.info['password'] == password
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password(self, username, password):\n\n try:\n self.c.execute('SELECT password FROM profiles WHERE name=(?)', (username,))\n\n db_pw = self.c.fetchone()[0]\n print(password)\n\n return db_pw == password\n\n except TypeError:\n return F...
[ "0.81212944", "0.8041874", "0.7520548", "0.74664444", "0.74535733", "0.74509126", "0.7448705", "0.7347964", "0.731099", "0.72927326", "0.72677416", "0.7239683", "0.7214253", "0.71979207", "0.71949124", "0.71595156", "0.7130568", "0.71266335", "0.7122605", "0.71045524", "0.702...
0.82322747
0
Checks if the given token matches the stored token in the database for the given user name.
def correct_token(name, token): if not User.created(name): return False user = User.get_user(name) return user.info['token'] == token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isValid(self, username, token):\n env = {\n \"__username__\": username,\n \"__token__\": token\n }\n sql = \"\"\"\n SELECT md5([token]||strftime('%Y-%m-%d','now'))='{__token__}' \n FROM [users] \n WHERE hex([mail])=hex('{__username__}') \n ...
[ "0.71866256", "0.70793885", "0.6864088", "0.68539584", "0.66948694", "0.66763306", "0.66446084", "0.66169566", "0.6515855", "0.65100497", "0.648291", "0.64040583", "0.6359269", "0.63475573", "0.6327279", "0.63075227", "0.6297307", "0.6269785", "0.6257916", "0.62532854", "0.62...
0.8024435
0
Load a string in TOML format.
def load_toml(content): from toml import loads return loads(content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_toml(self, toml_str): # type: (str) -> None\n self._toml = tomlkit.loads(toml_str)\n self._load_dict(self._toml.value)", "def from_content(cls, content: str) -> Any:\n cls._check_toml()\n return toml.loads(content)", "def readString(self, st):\n if not isinstance(st...
[ "0.7420956", "0.64042324", "0.6400318", "0.62130696", "0.6175536", "0.6037555", "0.5923447", "0.57195985", "0.5696763", "0.56276166", "0.5561361", "0.55125827", "0.5508243", "0.54697067", "0.5423769", "0.5421016", "0.5386182", "0.53803873", "0.5350524", "0.5347358", "0.531767...
0.72137314
1
Recursively load a list of paths and merge their content left to right. That is, last to load will override last.
def load_files(paths): bundle = {} # Load files # The returned dict of a parsed file cannot be guaranteed consistently # ordered, so sadly here we loose sequentially of declaration in files. for file in paths: log.info( 'Loading file {} ...'.format(file) ) con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_full(self):\n\t\tfor filename in self.FILENAMES:\n\t\t\tself.load(filename)\n\t\tself.reverse_dicts()", "def _load(name, paths):\n for base_path in paths:\n parts = name.split('.')\n number_of_parts = len(parts)\n\n for folder_parts in range(number_of_parts):\n folder ...
[ "0.57152873", "0.56620735", "0.55487216", "0.55046284", "0.5459949", "0.5413269", "0.5405028", "0.53849477", "0.5367127", "0.53445715", "0.52973175", "0.5290876", "0.5290413", "0.5282406", "0.52707595", "0.52488333", "0.52382416", "0.5212468", "0.5205933", "0.52001184", "0.51...
0.5794004
0
Tests that backend frameworks and noncritical libraries are not imported.
def test_failure(): with pytest.raises(ModuleNotFoundError): import torch # noqa: F401 with pytest.raises(ModuleNotFoundError): import tensorflow # noqa: F401 with pytest.raises(ModuleNotFoundError): import horovod # noqa: F401 with pytest.raises(ModuleNotFoundError): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def importlib_only(fxn):\n return unittest.skipIf(using___import__, \"importlib-specific test\")(fxn)", "def test_imports():\n assert False", "def test_absent_imports():\n module, HABEMUS_MODULE = optional_import(\"not_real_module\")\n\n assert not HABEMUS_MODULE\n assert module.__name__ == \"no...
[ "0.68966895", "0.6590146", "0.6410541", "0.640875", "0.63725764", "0.63153327", "0.6310005", "0.62650174", "0.61983067", "0.6145739", "0.6111093", "0.6097245", "0.6043151", "0.6024104", "0.60225976", "0.60222936", "0.5995633", "0.5948781", "0.59451693", "0.59420294", "0.59381...
0.6604788
1
chose an appropriate pygments lexer based on filename an contents
def pick_lexer(filename, contents): if filename in ["LICENSE", "COPYING", "README"]: return lexers.TextLexer() try: return lexers.guess_lexer_for_filename(filename, contents) except pygments.util.ClassNotFound: try: return lexers.guess_lexer(contents) except pygme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FindLexer(self, set_ext=u''):\n if set_ext != u'':\n ext = set_ext.lower()\n else:\n ext = self.file.GetExtension().lower()\n\n if ext == u'':\n fname = self.GetFileName()\n ext = ebmlib.GetFileName(fname).lower()\n\n self.ClearDocumentSty...
[ "0.63497233", "0.62798244", "0.6272315", "0.62466085", "0.5932153", "0.5927871", "0.5925492", "0.58749396", "0.5871015", "0.5857189", "0.5839256", "0.58244497", "0.5809686", "0.57122916", "0.5699207", "0.565513", "0.56470096", "0.56289476", "0.5628755", "0.5622783", "0.561491...
0.7685585
0
get the filetype of a file mode
def get_filetype(filemode): mode_funcs = [ (stat.S_ISREG, "-"), (stat.S_ISBLK, "b"), (stat.S_ISCHR, "c"), (stat.S_ISDIR, "d"), (stat.S_ISFIFO, "p"), (stat.S_ISLNK, "l"), (stat.S_ISSOCK, "s"), ] for pred, val in mode_funcs: if pred(filemode): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_type(self):\n return FileType(self.unpack_dword(0x1C))", "def separate_mode_type(mode):\n m = stat.S_IMODE(mode)\n t = stat.S_IFMT(mode)\n return m, mode_to_unix(t)", "def file_type(self):\n return self.__file_type", "def get_file_type(filename):\n return filename[filename....
[ "0.7450004", "0.7423909", "0.72859955", "0.7259538", "0.72056085", "0.7116693", "0.7092354", "0.70837855", "0.6979861", "0.6899653", "0.68610466", "0.6858636", "0.6858636", "0.6849705", "0.6824208", "0.68010753", "0.6798186", "0.67940944", "0.67481923", "0.6725726", "0.671833...
0.86426646
0
add info related to the set UID bit, the set GID bit and the sticky bit
def add_bits_info(perms, filemode): bit_vals = [ (stat.S_ISUID, 2, "s", "s"), (stat.S_ISGID, 5, "s", "s"), (stat.S_ISVTX, 8, "t", "T"), ] for bit, i, xval, yval in bit_vals: if filemode & bit: if perms[i] == "x": perms[i] = xval else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initMetadata(self):\n\n if not 'flags' in self.metadata:\n\n self.metadata['flags'] = {}\n\n if not 'uidvalidity' in self.metadata:\n\n\n self.metadata['uidvalidity'] = random.randint(1000000, 9999999)\n\n if not 'uids' in self.metadata:\n\n self.metadata['...
[ "0.5581358", "0.53236526", "0.52267784", "0.51815194", "0.5159865", "0.51437914", "0.51163894", "0.51121086", "0.51067626", "0.5056954", "0.5051719", "0.4944715", "0.49100944", "0.4897046", "0.4880741", "0.4864748", "0.48488283", "0.4804211", "0.47231904", "0.47075477", "0.47...
0.569763
0
format a filemode int into a a nice string
def format_filemode(filemode): filetype = get_filetype(filemode) permissions = add_bits_info(get_perms(filemode), filemode) return filetype + permissions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_mode(filename: str) -> str:\n return '{0:04o}'.format(stat.S_IMODE(os.stat(filename).st_mode))", "def filemode(mode):\n perm = []\n for table in _filemode_table:\n for bit, char in table:\n if mode & bit == bit:\n perm.append(char)\n break\n ...
[ "0.7865812", "0.6887833", "0.6831519", "0.66854316", "0.6539661", "0.62018806", "0.6169183", "0.60933334", "0.5975011", "0.5926117", "0.5923357", "0.5851956", "0.57330686", "0.57321155", "0.56938946", "0.5651825", "0.5632885", "0.55774564", "0.55690205", "0.5546659", "0.55377...
0.7804943
1
write html displaying a blob
def write_blob(blob, header_data, path, levels): if path is None: path = "" mkdir(os.path.join("file", path)) mkdir(os.path.join("raw", path)) if blob.is_binary: content = None highlighted = None rendered = None nlines = 0 else: content = blob.data.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputHtml(s):\n htmlFile.write(s + \"\\n\")", "def write_html(self, content):\n self.write(content)", "def output_to_html(string_data):\n raise NotImplementedError(\"This function is not yet Implemented!\")", "def static_html(self, obj, fmt=None, template=None):\n html_bytes = String...
[ "0.6580048", "0.6531536", "0.6415666", "0.6363096", "0.6268991", "0.6207812", "0.6203876", "0.6122517", "0.606148", "0.60258734", "0.5992513", "0.5992321", "0.59695345", "0.59223884", "0.5919993", "0.5919779", "0.5883791", "0.5882668", "0.58557886", "0.584473", "0.5841449", ...
0.6675383
0
Utility function to get pixel value for coordinate vectors x and y from a 4D tensor image. Input
def get_pixel_value(img, x, y): shape = tf.shape(x) batch_size = shape[0] height = shape[1] width = shape[2] batch_idx = tf.range(0, batch_size) batch_idx = tf.reshape(batch_idx, (batch_size, 1, 1)) b = tf.tile(batch_idx, (1, height, width)) indices = tf.stack([b, y, x], 3) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vecteur_image(T,x,y):\n a,b,c,d = T[0][0],T[0][1],T[1][0],T[1][1]\n xx = a*x + b*y\n yy = c*x + d*y\n return xx,yy", "def getPixel (self, x, y):\r\n return self.image [y][x]", "def get_pixel(image, x, y):\n x = in_bound(image[\"height\"], x)\n y = in_bound(image[\"width\"], y)\n ...
[ "0.72120667", "0.7111711", "0.6763613", "0.67106384", "0.66041225", "0.6509605", "0.64627975", "0.6440617", "0.6410553", "0.6342924", "0.63029987", "0.6291874", "0.6291588", "0.62779397", "0.626543", "0.6245165", "0.62448704", "0.6238417", "0.6173571", "0.6162264", "0.6160496...
0.80248594
1
yields variants listed in vcf file as 'Variant'
def simple_vcf_reader(fh): for line in fh: if line.startswith('#'): continue ls = line.rstrip().split('\t') # 8 fixed fields per record assert len(ls)>=8, ( "Number of retrieved fields in vcf file too small") # ignoring the rest (chrom, pos, i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_variants_from_vcf( vcf_file ):\n\t\n\tsnps_per_chr = {}\n\tindels_per_chr = {}\n\t\n\ttri_counter = 0\n\t\n\twith open( vcf_file, \"r\" ) as f:\n\t\tline = f.readline()\n\t\twhile line:\n\t\t\tif line[0] != '#':\n\t\t\t\tparts = line.strip().split('\\t')\n\t\t\t\tif not \",\" in parts[4]:\t#only biallelic...
[ "0.7201303", "0.6650941", "0.65448", "0.64423966", "0.63880545", "0.6301285", "0.62869686", "0.6278264", "0.626897", "0.6137558", "0.61200696", "0.61076975", "0.61054826", "0.59219545", "0.5920386", "0.59201425", "0.5894", "0.5866502", "0.5800668", "0.57959044", "0.5764796", ...
0.6716026
1
Shorthand for `compare_values(t, v1, v2) == EQ`.
def values_equal(t : Type, v1, v2) -> bool: return compare_values(t, v1, v2) == EQ
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values_eq(self, a, b):\r\n return a == b", "def are_equal(value1, value2):\n if value1 == None or value2 == None:\n return True\n if value1 == None or value2 == None:\n return False\n return value1 == value2", "def compare(self, values):\n raise NotI...
[ "0.7225015", "0.66483396", "0.63902336", "0.62941045", "0.59793293", "0.5886414", "0.58498853", "0.5848486", "0.5826007", "0.5760525", "0.57133996", "0.5677296", "0.5624517", "0.5551929", "0.55439883", "0.55428416", "0.55212235", "0.5506666", "0.5491236", "0.54909456", "0.548...
0.8292787
0
Returns a queryset of events with attendance_event that a user has access to
def get_group_restricted_events(user, all_events=False): types_allowed = get_types_allowed(user) if all_events: return Event.objects.filter(event_type__in=types_allowed) else: return Event.objects.filter(attendance_event__isnull=False, event_type__in=types_allowed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n return Event.objects.all().filter(user_id=self.request.user)", "def myevents(self, request, pk=None):\n user = request.auth.user\n myevents = user.events\n serializer = EventSerializer(\n myevents, many=True, context={'request': request})\n ...
[ "0.6964939", "0.6351143", "0.62036747", "0.6021155", "0.59197706", "0.58528394", "0.58394927", "0.58226365", "0.5759699", "0.57324386", "0.5666887", "0.55813336", "0.5572948", "0.55628294", "0.5537274", "0.5526723", "0.5497164", "0.54951507", "0.54903823", "0.5483845", "0.547...
0.6573138
1
from a obc name find a IOB mapping array The list of IOB should be defined in config.mapLoockUp
def findMap(obc, nWin): try: return config.mapLoockUp[(obc,nWin)] except KeyError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_obcfile(casename=None): \n\n data={}\n\n if casename==None:\n print('_load_obcfile requires a filename to load.')\n return\n try:\n fp=open(casename+'_obc.dat','r')\n except IOError:\n print('_load_obcfile: invalid case name.')\n return data\n\n obc_st...
[ "0.53534824", "0.5345637", "0.531654", "0.53130233", "0.5284127", "0.52317035", "0.5207828", "0.51392853", "0.50721306", "0.50523263", "0.5050292", "0.5049232", "0.5045717", "0.50451595", "0.5042849", "0.5037867", "0.5027547", "0.50163406", "0.5013733", "0.50073826", "0.50031...
0.58121645
0
Return the Delay Line position of a given beam Warning beam number start from 0
def getDlPos(beamNumber): return simConfig["POS.DL"][beamNumber]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offsetline(linen, pattern_result):\n\n if \"nlines\" in pattern_result:\n nlines = pattern_result[\"nlines\"]\n else:\n nlines = 0\n new_linen = linen - nlines - 1\n if new_linen < 0:\n return 0\n else:\n return new_linen", "def get_log_pos(timer, lane_speed):\n ...
[ "0.5512712", "0.537704", "0.5293158", "0.52356976", "0.52356976", "0.52214617", "0.5214272", "0.521096", "0.5195175", "0.5143228", "0.5130889", "0.51158094", "0.5109107", "0.51056105", "0.5097807", "0.50839174", "0.5081821", "0.50558937", "0.5030805", "0.50258696", "0.4987796...
0.6232385
0
Return all the 4 Delay Line numbers for the current config
def getDlsConfig(): return [getDlConfig(beam) for beam in range(4)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ActiveHlt2Lines(self) :\n \n lines = ['Hlt2PassThrough','Hlt2Lumi','Hlt2DebugEvent',\n 'Hlt2Forward','Hlt2ErrorEvent','Hlt2Transparent']\n \n return lines", "def getDelays(self, format='list', gather=True):\n global controller\n timer = None\n ...
[ "0.5559269", "0.5519003", "0.5477813", "0.5445103", "0.54032725", "0.53132904", "0.525101", "0.52285844", "0.52029085", "0.51925206", "0.5190326", "0.51830465", "0.517551", "0.51675606", "0.514633", "0.510918", "0.5090941", "0.507592", "0.50677884", "0.5053894", "0.50504214",...
0.5713411
0
turn onthe flag for saving data offset (background) Outputs None
def sendSaveDataOffsetFlag(): global saveDataOffset saveDataOffset = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkpoint():", "def _save(self, data: np.ndarray) -> None:\n ...", "def checkpoint(self):\n save()", "def save(self, output, data):", "def save(self, output, data):\n return", "def d_flag(self):\n if self.datalog:\n self.datalogflag = True", "def d_flag(self)...
[ "0.57026297", "0.5683805", "0.56627965", "0.5627759", "0.546395", "0.5463393", "0.5463393", "0.5446886", "0.54384375", "0.5419372", "0.5361131", "0.5328824", "0.531574", "0.53148425", "0.5312103", "0.5289828", "0.5289278", "0.5247191", "0.5235028", "0.52209085", "0.52066034",...
0.7732312
0
Read the database to get the SNR min defined by operator Outputs
def getSnrMin(): return simuConfig["SNR.MIN"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_min(self):\r\n df = pd.read_csv(\"MonthlyRate.csv\")\r\n df = df[df.CurrencyCode == self.choice]\r\n minimum = df.min(axis=1).values[0]\r\n # Round the value to 4 d.p.\r\n minimum = round(float(minimum), 4)\r\n return minimum", "def min(self):\n return sel...
[ "0.57113594", "0.56933683", "0.5600002", "0.55113375", "0.54340667", "0.5282107", "0.52606547", "0.52606547", "0.5216487", "0.51996547", "0.51909685", "0.5180202", "0.5180202", "0.5137507", "0.5131965", "0.51163536", "0.51074255", "0.5062509", "0.505264", "0.50401497", "0.503...
0.64284706
0
set the snrMin in dBase for pannel feedback
def setSnrMin(_snrMin): simuConfig["SNR.MIN"] = _snrMin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSnrMin():\n return simuConfig[\"SNR.MIN\"]", "def _config_min(self):\n self.cntrl[\"imin\"] = 1\n self.cntrl[\"ntx\"] = 1\n self.cntrl[\"irest\"] = 0\n self.cntrl[\"maxcyc\"] = 5000\n self.cntrl[\"ncyc\"] = 1000\n self.cntrl[\"dt\"] = 0.0\n self.cntrl[\"...
[ "0.71924514", "0.6476827", "0.63125944", "0.63125944", "0.6213003", "0.6163583", "0.6116942", "0.60737133", "0.60737133", "0.6044693", "0.6024053", "0.6024053", "0.5887038", "0.5877152", "0.5697911", "0.5678184", "0.5614045", "0.5614045", "0.5593825", "0.5543213", "0.5543213"...
0.75251085
0
Read the database to get the SNR of a given telescope
def getSnr(tel): return simuConfig["SNRS"][tel]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSNR(self):\n \n return self.SNR", "def get_patient_ssn(patient_bundle):\n id = patient_bundle['identifier']\n for map in id:\n if 'type' in map.keys():\n if map['system'] == 'http://hl7.org/fhir/sid/us-ssn':\n return map['value']", "def read_database(...
[ "0.58202755", "0.52314675", "0.52235097", "0.51584494", "0.514501", "0.5088073", "0.5018781", "0.5008929", "0.50089216", "0.49568102", "0.4939084", "0.4914521", "0.49106422", "0.4900181", "0.4881851", "0.4881635", "0.48762473", "0.4866988", "0.48658404", "0.48402956", "0.4835...
0.68398803
0
set the snr in dBase for a given telescope
def setSnr(tel, snr): simuConfig["SNRS"] = snr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSnr(tel):\n \n return simuConfig[\"SNRS\"][tel]", "def set_domain_sid(self, sid):\n dsdb._samdb_set_domain_sid(self, sid)", "def setSNR(self, SNR):\n \n self.SNR = SNR", "def _setsenders_correspondent_53D(self, val):\n self.swift_obj.SendersCorrespondent_D = val\n ...
[ "0.54689693", "0.54573345", "0.54074717", "0.52965707", "0.52727807", "0.5175448", "0.51365745", "0.512694", "0.51230574", "0.50328803", "0.50098556", "0.49850285", "0.49821377", "0.49814898", "0.4968855", "0.48970973", "0.48902145", "0.48855165", "0.48603553", "0.48568228", ...
0.6957905
0
return the tracking Flag Outputs
def getTrackingFlag(): return simuConfig["FLAG.TRACKING"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_Flagging(flagging_file, n_Rec, nChan, exp_count):\n\n line = subprocess.check_output(['grep','Flagged', flagging_file]) # grab the summary line\n str_line = line.decode('utf-8')\n TOKS = str_line.split()\n total_flagged_pct = float(TOKS[-2]) #data+autocorrelation\n total_uv = float(TOKS[7])\...
[ "0.61067444", "0.6044914", "0.579919", "0.56962866", "0.5660274", "0.56373096", "0.5611493", "0.5563837", "0.5535483", "0.5523262", "0.54696953", "0.54341286", "0.5426424", "0.5366812", "0.53487825", "0.53384817", "0.53342944", "0.53253853", "0.53215444", "0.53177875", "0.531...
0.6908209
0
return the scope Flag Outputs
def getScopeFlag(): return simuConfig["FLAG.SCOPE"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scopes(self) -> pulumi.Output[Sequence[str]]:\n return pulumi.get(self, \"scopes\")", "def scope(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"scope\")", "def scope(self): # noqa: ANN201", "def get_scopes(self):\n return [i[0] for i in self.scopes.items() if i[1] is True]...
[ "0.59579974", "0.5919191", "0.5918992", "0.58710974", "0.57423997", "0.57096314", "0.56678677", "0.563304", "0.55888224", "0.5520501", "0.5444528", "0.54407614", "0.53719556", "0.5329911", "0.5329418", "0.5302947", "0.52608573", "0.5255765", "0.5249626", "0.5238304", "0.52208...
0.6631793
0
Send a quit flag for any loop running that will check getQuitFlag()
def sendQuitFlag(): simuConfig["FLAG.QUIT"] = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearQuitFlag():\n simuConfig[\"FLAG.QUIT\"] = False", "def Quit(self):\n loop.quit()", "def quit():\r\n autoquit()", "def do_quit(self, arg):\n return True", "def do_quit(self, arg):\n return True", "def do_quit(self, arg):\n return True", "def do_quit(self, arg):...
[ "0.70866394", "0.70497096", "0.69908375", "0.69688296", "0.69688296", "0.69688296", "0.69688296", "0.6824366", "0.6793398", "0.6793398", "0.6766277", "0.67517275", "0.674785", "0.6730997", "0.6650368", "0.66456085", "0.6635151", "0.6629098", "0.6609762", "0.6606819", "0.65943...
0.7753488
0
Change the plot focus plot focus can be red by the rtd plot running
def setPlotFocus(pt): if pt not in [None]+plotFocusList: return None simuConfig["PLOT.FOCUS"] = pt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPlotFocus():\n return simuConfig[\"PLOT.FOCUS\"]", "def setFocus(*args):", "def setFocus(*args):", "def setFocus(*args):", "def setFocus(*args):", "def __window_focus(self):\n pass", "def focus(self, focus_library=True):\n if focus_library:\n self.treeview.grab_focus(...
[ "0.73497474", "0.60920614", "0.60920614", "0.60920614", "0.60920614", "0.6059263", "0.5926662", "0.58893436", "0.5886191", "0.5886161", "0.58709913", "0.58667284", "0.58132076", "0.57713467", "0.5754558", "0.57388055", "0.5728797", "0.5682191", "0.562164", "0.5614595", "0.559...
0.78742456
0
return the curent plot focus Outputs
def getPlotFocus(): return simuConfig["PLOT.FOCUS"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_active_plot(self):\n for plot in list(self.plots.values()):\n canvas = plot.canvas()\n if canvas.hasFocus():\n return plot\n return self.default_plot", "def axes_active(self) -> np.ndarray: # array[Axes]\n return self.axes.flat[:self.n_plots]", "de...
[ "0.6525195", "0.6401383", "0.6326858", "0.5858073", "0.5850102", "0.58179593", "0.58121914", "0.5791585", "0.5791364", "0.5681423", "0.5670078", "0.5668752", "0.5613337", "0.56026685", "0.55971617", "0.55587906", "0.55350786", "0.55204564", "0.55133486", "0.5487056", "0.54588...
0.75008744
0
We need a Python program that generates all the possible flags with 3
def main(): print("Q1") for flag in make_flags("q1"): print(flag, end=" ") print("\n\nQ2") for flag in make_flags("q2"): print(flag, end=" ") print("")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_flags():\n return flag_args", "def print_all():\n for i in flags:\n print(i)", "def get_all_flags(options):\n flags = []\n if options.inputFlag:\n flags.append(try_to_int(options.inputFlag))\n if options.outputFlags:\n for flag in options.outputFlags:\n fla...
[ "0.6402689", "0.6371302", "0.6164857", "0.5915956", "0.58479756", "0.57833755", "0.57662773", "0.57662773", "0.57662773", "0.57662773", "0.5756997", "0.56976503", "0.56976247", "0.56976247", "0.56976247", "0.56976247", "0.5687503", "0.5665192", "0.563023", "0.56099737", "0.55...
0.70252657
0
Returns a callable required for proto files generation. e.g. return generate_proto(saved_game_bytes, is_validation_set)
def proto_generation_callable(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_proto_serializer():\n def _serialize_proto(proto):\n return proto.SerializeToString()\n return _serialize_proto", "def get_protobuf_schema() -> GeneratedProtocolMessageType:\n\n return RunFunctionOrConstructorAction_PB", "def build(\n cls,\n file_descriptor: de...
[ "0.5963592", "0.58178014", "0.5767514", "0.5743596", "0.5712156", "0.5561316", "0.5528851", "0.5511984", "0.5439808", "0.53994524", "0.53555566", "0.5355289", "0.53187203", "0.53042555", "0.53023523", "0.5295403", "0.5258989", "0.5220882", "0.5217801", "0.51910365", "0.518645...
0.73003674
1
Tets correctness of final CFs and their predictions for sample query instance.
def test_final_cfs_and_preds(self, sample_adultincome_query): counterfactual_explanations = self.exp.generate_counterfactuals( sample_adultincome_query, total_CFs=4, desired_class="opposite") assert isinstance(counterfactual_explanations, CounterfactualExplanations) # test_cfs = [[72...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(self, samples):\n prediction_errors = np.zeros(len(samples), int)\n predictions = np.zeros(len(samples), int)\n class_predictions = np.zeros(self.class_count)\n \n for i in range(len(samples)): # Loop over each sample\n for j in range(self.class_count): #...
[ "0.6186899", "0.6181334", "0.6173338", "0.6169429", "0.61346185", "0.608773", "0.60555875", "0.60455006", "0.6040177", "0.6013586", "0.6008393", "0.599961", "0.59564793", "0.59537786", "0.59256095", "0.5915373", "0.5911987", "0.59108406", "0.58981806", "0.5867814", "0.5860259...
0.6870501
0
Verify execute_review() creates new directory as expected.
def test_execute_review_1(self): review.execute_review(self.alchemist, self.test_dir, self.review_test_dir.name) self.assertTrue(self.review_test_dir.is_dir())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_execute_review_5(self):\n review.execute_review(self.alchemist, self.test_dir,\n self.review_test_dir.name,\n review=False)\n\n self.assertTrue(self.review_test_dir.is_dir())", "def test_execute_review_4(self):\n review.execu...
[ "0.7242757", "0.72419107", "0.7037094", "0.689238", "0.6671771", "0.66480756", "0.65441185", "0.65027815", "0.6452117", "0.62934065", "0.61304945", "0.61244786", "0.59787667", "0.5978526", "0.59366506", "0.5932075", "0.58986014", "0.58634335", "0.5838747", "0.58047247", "0.57...
0.77492034
0
Verify execute_review() g_reports parameter functions as expected.
def test_execute_review_6(self): review.execute_review(self.alchemist, self.test_dir, self.review_test_dir.name, g_reports=True) self.assertTrue(self.review_test_dir.is_dir()) gene_report_dir = self.review_test_dir.joinpath("GeneRepor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_review_is_done(self):\n self.assertFalse(processes.review_is_done(None))\n self.assertFalse(processes.review_is_done(0))\n self.assertFalse(processes.review_is_done(models.REVIEW_PENDING))\n self.assertFalse(processes.review_is_done(models.REVIEW_ISSUES_OPEN))\n self.assertTrue(processes.re...
[ "0.62868595", "0.6212757", "0.6113263", "0.584701", "0.57769084", "0.5751094", "0.5700198", "0.5627688", "0.5568834", "0.5565489", "0.55631316", "0.55567676", "0.548278", "0.5437698", "0.5434019", "0.5399112", "0.53961974", "0.53805166", "0.53678334", "0.5360183", "0.53236", ...
0.68138856
0
Verify execute_review() s_report parameter functions as expected.
def test_execute_review_7(self): review.execute_review(self.alchemist, self.test_dir, self.review_test_dir.name, s_report=True) self.assertTrue(self.review_test_dir.is_dir()) summary_report_file = self.review_test_dir.joinpath("Summar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_review_is_done(self):\n self.assertFalse(processes.review_is_done(None))\n self.assertFalse(processes.review_is_done(0))\n self.assertFalse(processes.review_is_done(models.REVIEW_PENDING))\n self.assertFalse(processes.review_is_done(models.REVIEW_ISSUES_OPEN))\n self.assertTrue(processes.re...
[ "0.625906", "0.6215037", "0.6079821", "0.605461", "0.5940084", "0.5858847", "0.58261263", "0.5787651", "0.5567173", "0.5542198", "0.5537528", "0.5508412", "0.5503725", "0.54966176", "0.5496157", "0.54441243", "0.5423454", "0.53979665", "0.53977054", "0.5381116", "0.5344718", ...
0.64828974
0
Verify review_phams() correctly identifies disrepencies.
def test_review_phams_1(self): self.db_filter.values = self.db_filter.build_values( where=self.db_filter.build_where_clauses()) review.review_phams(self.db_filter) self.assertFalse(39854 in self.db_filter.values) self.assertTrue(40481 in self.db_filter.values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unsuccessful_verification(self):\n for i in (-4, -3, 3, 4):\n description = \"TOTP verified for `i={0}`\".format(i)\n calculated = self.algorithm.calculate(self.device.secret, drift=i)\n confirmed = self.relate.verify(calculated, save=False)\n\n self.asse...
[ "0.57791716", "0.5642184", "0.54765165", "0.54339254", "0.54250133", "0.54250133", "0.54250133", "0.54203993", "0.5368484", "0.53536505", "0.5352088", "0.5343342", "0.5304699", "0.52976656", "0.525753", "0.52460766", "0.5218623", "0.5122834", "0.5115473", "0.5113044", "0.5103...
0.65374625
0
Verify get_pf_data() retrieves and returns data as expected.
def test_get_pf_data_1(self): self.db_filter.values = [40481] pf_data = review.get_pf_data(self.alchemist, self.db_filter) self.assertTrue(isinstance(pf_data, list)) for header in review.PF_HEADER: with self.subTest(header=header): self.assertTrue(header in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_data(self):\r\n success, _data = self.peer_grading.query_data_for_location(self.problem_location)\r\n self.assertTrue(success)", "def test_getknowndata(self):\n result = recordparser.getfields(self.rawdata, self.fieldmap,\n self.sourcekeys)\n self.assertEqu...
[ "0.6491381", "0.6261381", "0.6225589", "0.6133288", "0.60651624", "0.59994286", "0.5965018", "0.59296054", "0.5926258", "0.5926258", "0.5926258", "0.5915046", "0.58646065", "0.58031034", "0.5797196", "0.5794694", "0.57883406", "0.57495934", "0.57458067", "0.5729523", "0.56688...
0.72779644
0
Verify get_g_data() retreives and retrusn data as expected.
def test_get_g_data_1(self): self.db_filter.values = [40481] g_data = review.get_g_data(self.alchemist, self.db_filter, 40481) self.assertTrue(isinstance(g_data, list)) for header in review.PG_HEADER: with self.subTest(header=header): self.assertTrue(header...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_data(self):\r\n success, _data = self.peer_grading.query_data_for_location(self.problem_location)\r\n self.assertTrue(success)", "def test_gc_datastore(self):\n yg_gc = parsegc.generate_yg_gc_entry(\n \"100.25\",\n \"100.25\",\n \"ParNew\",\n ...
[ "0.6880222", "0.66431636", "0.6471408", "0.62280977", "0.6214435", "0.62143874", "0.61981314", "0.61831266", "0.6173409", "0.61414707", "0.6108344", "0.6095074", "0.6095074", "0.6095074", "0.6050329", "0.6019996", "0.5988685", "0.5986319", "0.5964577", "0.5957988", "0.5893297...
0.7342229
0
Generate a CSV file of the Dataset information
def generate_dataset_csv(request): response = csv_export(request,Dataset) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_csv(self):\n\n # add the label to the header\n if self.input_data.get_value(InputType.TIME_PERIOD) == 'all':\n self.header.append('Date')\n else:\n self.header.append('sample id')\n\n key_list = []\n\n for i, cube in enumerate(self.cube_list):\n ...
[ "0.7301781", "0.7188036", "0.70366293", "0.70341796", "0.6933217", "0.68942285", "0.6882128", "0.6836537", "0.6826749", "0.6826596", "0.68030626", "0.68030626", "0.6784672", "0.6763934", "0.6762665", "0.6719179", "0.65670377", "0.65446883", "0.65274465", "0.65093666", "0.6493...
0.7548971
0
Generate the jtable data for rendering in the list template.
def generate_dataset_jtable(request, option): obj_type = Dataset type_ = "dataset" mapper = obj_type._meta['jtable_opts'] if option == "jtlist": # Sets display url details_url = mapper['details_url'] details_url_key = mapper['details_url_key'] fields = mapper['fields'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gen_datatable__(self):\n # | - __generate_data_table\n rows_list = []\n for Job_i in self.Job_list:\n # | - FOR LOOP BODY\n entry_param_dict = {}\n for prop, value in Job_i.job_params.items():\n entry_param_dict[prop] = value\n\n ...
[ "0.6957045", "0.65309566", "0.6484074", "0.6239349", "0.61573464", "0.6097337", "0.5979821", "0.5976074", "0.59642226", "0.5879871", "0.5868879", "0.5808444", "0.5792779", "0.57764864", "0.57394606", "0.57326126", "0.5722943", "0.5710817", "0.56943315", "0.5688803", "0.567253...
0.6782189
1
Generate the data to render the Dataset details template.
def get_dataset_details(name, analyst): template = None allowed_sources = user_sources(analyst) dataset_object = Dataset.objects(name = name, source__name__in=allowed_sources).first() if not dataset_object: error = ("Either no data exists for this dataset" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data():\n return render_template(\n 'data.html',\n title='World Happiness Report',\n year=datetime.now().year,\n message='Main Data Model'\n )", "def data():\n return render_template(\n 'data.html',\n title='Data',\n year=datetime.now().year,\n ...
[ "0.6786504", "0.677638", "0.6696329", "0.6644693", "0.6549089", "0.6539549", "0.6480339", "0.6422021", "0.6389156", "0.6363354", "0.6326907", "0.63251007", "0.6324231", "0.6286099", "0.6258859", "0.62314236", "0.6211274", "0.62073964", "0.6190721", "0.61876315", "0.6074533", ...
0.68706584
0
Generates parameters of a super ball
def gen_super_ball(): super_ball_radius = 80 super_ball_x = randint(super_ball_radius, screen_width - super_ball_radius) super_ball_y = randint(super_ball_radius, screen_height - super_ball_radius) super_ball_color = (RED, YELLOW, GREEN) return [super_ball_color, super_ball_x, super_ball_y, super_ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_super_ball():\n super_balls.append(gen_super_ball())\n generate_velocity(super_balls)", "def __init__(self, posn_x, posn_y, velocity_x, velocity_y, kula): \n self.posn_x = posn_x # x position of box containing the ball (bottom). \n self.posn_y = posn_y # x...
[ "0.69011176", "0.6279852", "0.6235428", "0.6158913", "0.613197", "0.6061376", "0.6033093", "0.60131353", "0.5985253", "0.5949455", "0.5946373", "0.59461635", "0.5881633", "0.5881352", "0.5837037", "0.5832942", "0.5820211", "0.5816382", "0.58020455", "0.5778845", "0.57671064",...
0.6386006
1
Moves every ball according their position and velocity
def move_balls(times_moved): for time in range(times_moved): for ball in balls: touched_border_1 = ball[1] <= ball[3] + 1 or ball[1] >= screen_width - (ball[3] + 1) touched_border_2 = ball[2] <= ball[3] + 1 or ball[2] >= screen_height - (ball[3] + 1) # checking the positi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tick():\n move_balls(targets_speed)\n move_super_balls(targets_speed * 2)", "def move(self):\n new_velocities = self._create_velocities()\n for boid, vel in zip(self.boids, new_velocities):\n boid.change_speed(*vel)\n for obstacle in self.obstacles:\n ...
[ "0.7707619", "0.76045424", "0.75311244", "0.74456006", "0.74178046", "0.7367661", "0.73274946", "0.7279402", "0.7104018", "0.70265543", "0.69604886", "0.69478655", "0.69259155", "0.6891615", "0.6872966", "0.6867801", "0.6753945", "0.6708518", "0.66990066", "0.6697089", "0.666...
0.7733392
0
Moves a super ball according its position and velocity
def move_super_balls(times_moved): for super_ball in super_balls: if super_ball[3] != 0: super_ball[3] -= 0.25 else: super_balls.remove(super_ball) create_ball() for time in range(times_moved): for ball in super_balls: # checking the positi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self) -> None:\n self.delta_time += 1 / 30 # FPS is 30 frames per second\n\n if self.is_active:\n self.y -= self.velocity * self.delta_time + 0.5 * self.gravity * (self.delta_time ** 2) # s = ut + 0.5at^2\n self.velocity = self.velocity + self.gravity * self.delta_tim...
[ "0.7592387", "0.73820126", "0.7332446", "0.72793245", "0.72696424", "0.70698607", "0.70569444", "0.70373905", "0.70267665", "0.7024209", "0.6992322", "0.6945556", "0.6943953", "0.6937738", "0.692931", "0.6924519", "0.6884891", "0.68680847", "0.6855089", "0.6794775", "0.679248...
0.73970246
1
Creates a new ball
def create_ball(): balls.append(gen_ball()) generate_velocity(balls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_ball():\n ball = Ball()\n # Starting position of the ball.\n # Take into account the ball size so we don't spawn on the edge.\n ball.x = random.randrange(BALL_SIZE, SCREEN_WIDTH - BALL_SIZE)\n ball.y = random.randrange(BALL_SIZE, SCREEN_HEIGHT - BALL_SIZE)\n\n # Speed and direction of re...
[ "0.78910744", "0.7773026", "0.75718427", "0.729235", "0.71304464", "0.7016827", "0.68962", "0.68675226", "0.68090975", "0.67911744", "0.6787879", "0.67824346", "0.6752662", "0.6746393", "0.6635242", "0.6631885", "0.65989226", "0.64579904", "0.64246917", "0.6302894", "0.630126...
0.7948333
0
Creates a new super ball
def create_super_ball(): super_balls.append(gen_super_ball()) generate_velocity(super_balls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, x = 140, y = 140):\r\n super(Ball, self).__init__(image = Ball.image,\r\n x = 600, y = 240,\r\n dx = -3, dy = 1)", "def create_ball():\n balls.append(gen_ball())\n generate_velocity(balls)", "def __init__(self, ...
[ "0.730643", "0.72916216", "0.715264", "0.6966334", "0.6859085", "0.6695298", "0.6680856", "0.6522806", "0.6485458", "0.64399636", "0.6430099", "0.633791", "0.63072115", "0.626187", "0.62459886", "0.6230659", "0.6223655", "0.6124047", "0.61092705", "0.60890025", "0.60649514", ...
0.8251493
0
Tags this object with a tag specified by a tag name, primary key or Tag model instance
def tag(self, tag): if isinstance(tag, six.integer_types): try: tag = Tag.objects.get(pk=tag, owner=self.owner) except Tag.DoesNotExist: #Handle this better? return if isinstance(tag, six.string_types): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tag(self, obj, tag_name):\r\n tag_names = parse_tag_input(tag_name)\r\n if not len(tag_names):\r\n raise AttributeError(_('No tags were given: \"%s\".') % tag_name)\r\n if len(tag_names) > 1:\r\n raise AttributeError(_('Multiple tags were given: \"%s\".') % tag_na...
[ "0.69300115", "0.6737296", "0.6443798", "0.64252824", "0.64252824", "0.64252824", "0.64252824", "0.6414007", "0.63670653", "0.63209105", "0.63030666", "0.6279283", "0.6275524", "0.621508", "0.6196465", "0.6148248", "0.6104529", "0.60913354", "0.6081214", "0.60594183", "0.6058...
0.7870358
0
Untags this object from a tag specified by a tag name, primary key or Tag model instance
def untag(self, tag): if isinstance(tag, six.integer_types): try: tag = Tag.objects.get(pk=tag, owner=self.owner) except Tag.DoesNotExist: return if isinstance(tag, six.string_types): try: tag = Tag.objects.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def untag(self, uuid, tags=None):\n if isinstance(tags, basestring):\n tags = [tags]\n\n self._backend.untag(uuid, tags)", "def remove_tag(self, tag):\n cp = self.copy()\n cp.tags.remove(tag)\n return cp", "def delete_tag(self,tag):\r\n\r\n # with shelf\r\n ...
[ "0.6581936", "0.6569352", "0.65154964", "0.6419307", "0.6366215", "0.613729", "0.6099109", "0.60640305", "0.60616106", "0.6047276", "0.6009565", "0.5999241", "0.59780717", "0.5956036", "0.59260625", "0.588727", "0.5883824", "0.58749294", "0.5853107", "0.5759094", "0.5744433",...
0.7446062
0
Produces the JSON representation of this tag It's the JSON for the output of to_dir()
def to_json(self): return json.dumps(self.to_dir())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json(self):\n return {'name': self.name, \n 'path': self.path, \n 'enabled': self.enabled}", "def to_dir(self):\n out = {}\n out[\"name\"] = self.name\n out[\"colour\"] = self.colour\n out[\"slug\"] = self.slug\n out[\"id\"] = self.p...
[ "0.7254296", "0.7204862", "0.6899478", "0.6766462", "0.6741779", "0.67358327", "0.671214", "0.671214", "0.671214", "0.671214", "0.671214", "0.671214", "0.671214", "0.671214", "0.671214", "0.6691138", "0.66525084", "0.6629055", "0.6582917", "0.6580073", "0.6575524", "0.65662...
0.81298095
0
Given the undoable JSON representation of the tag, creates one for it Note that this SAVES the object to the database.
def from_undoable(jsonData, user): obj = json.loads(jsonData) tag = Tag(owner=user, name=obj["tag"]["name"], colour=obj["tag"]["colour"], slug=obj["tag"]["slug"], ) tag.save() for t in obj["tag"]["tags"]: tag.tag(t) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, name, tag):\n\n\t\turl_json = urllib.urlencode({\"name\": name, \"tag\": tag})\n\t\treturn self._create(\"/tag?json_hash=%s\" % url_json, \"tag\")", "def tag(self, tag):\n \n if isinstance(tag, six.integer_types):\n try:\n tag = Tag.objects.get(pk=tag, own...
[ "0.68379575", "0.6223951", "0.6206263", "0.6084949", "0.6079323", "0.6001024", "0.5909171", "0.5885422", "0.58552563", "0.5853059", "0.5835232", "0.582034", "0.580405", "0.5733759", "0.57311594", "0.57013", "0.56803435", "0.5633003", "0.5623184", "0.5532445", "0.5512779", "...
0.76959306
0
Checks if a tag exists for a given user, and returns it if it does If it doesn't, the owner of the instance is set to the provided one, it is saved and then returned.
def get_or_create_with_slug(owner, instance): try: return Tag.objects.get(owner=owner, slug=makeslug(instance.name)) except Tag.DoesNotExist: instance.owner = owner instance.save() return instance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_owner(self):\n username = self.cleaned_data['owner']\n owner = User.objects.filter(username=username).first()\n if owner is None:\n raise forms.ValidationError(\n _('User %(username)s does not exist'),\n params={'username': username},\n ...
[ "0.57880306", "0.56677806", "0.56435883", "0.5559733", "0.55188113", "0.5518041", "0.5497315", "0.54858625", "0.5484042", "0.5459997", "0.5448539", "0.5447152", "0.53896964", "0.53632486", "0.53549755", "0.53303343", "0.53284883", "0.53248155", "0.5321938", "0.5318804", "0.53...
0.62832665
0
Takes an iterable of tags, and returns a list of those tags and all that they imply That is, make a list out of the argument, and for each tag T, add all T's tags to this list if they aren't in it already. The list is sorted alphabetically. For example, if A is tagged B (A implies B), then expand_implies([A]) == [A, B]...
def expand_implies(tags): out = list(tags) i = 0 while i < len(out): for implied in out[i].tags.all(): if implied not in out: out.append(implied) i += 1 out.sort(key=lambda a: a.slug) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_implied_by_check(tags):\n out = list(map(lambda x : (x, True), list(tags)))\n tlist = list(tags)\n \n i = 0\n while i < len(tlist):\n for implies in tlist[i].tags_to.all():\n if implies not in out:\n out.append((implies, Fal...
[ "0.8277511", "0.82477945", "0.8071657", "0.52188385", "0.5081271", "0.5079979", "0.49866027", "0.49452943", "0.47744787", "0.47594008", "0.47567642", "0.47527817", "0.47327515", "0.4704478", "0.46731877", "0.46594027", "0.4648895", "0.46449554", "0.46080807", "0.4599413", "0....
0.82710314
1
Does the same as expand_implies, but each element is a (tag, direct) pair Direct is true only for the tags in the input iterable, not for the implied ones.
def expand_implies_check(tags): out = list(map(lambda x : (x, True), list(tags))) tlist = list(tags) i = 0 while i < len(tlist): for implied in tlist[i].tags.all(): if implied not in tlist: out.append((implied, False)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_implied_by_check(tags):\n out = list(map(lambda x : (x, True), list(tags)))\n tlist = list(tags)\n \n i = 0\n while i < len(tlist):\n for implies in tlist[i].tags_to.all():\n if implies not in out:\n out.append((implies, Fal...
[ "0.7650832", "0.7026415", "0.69893414", "0.5127024", "0.50551105", "0.48585972", "0.4781383", "0.4683263", "0.4681429", "0.46648985", "0.45524988", "0.4549901", "0.45247072", "0.44956627", "0.44738948", "0.44586575", "0.44510412", "0.44402215", "0.44390503", "0.4438355", "0.4...
0.7637341
1
Takes an iterable of tags, and returns a list of those tags and all that imply them That is, make a list out of the argument, and for each tag T, add all tags that have T as a tag if it isn't already in the list. The list is sorted alphabetically. For example if A is tagged B (A implies B), expand_implied_by([A]) == [A...
def expand_implied_by(tags): out = list(tags) i = 0 while i < len(out): for implies in out[i].tags_to.all(): if implies not in out: out.append(implies) i += 1 out.sort(key=lambda a: a.slug) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_implied_by_check(tags):\n out = list(map(lambda x : (x, True), list(tags)))\n tlist = list(tags)\n \n i = 0\n while i < len(tlist):\n for implies in tlist[i].tags_to.all():\n if implies not in out:\n out.append((implies, Fal...
[ "0.79339683", "0.7664067", "0.7466441", "0.5794743", "0.5567189", "0.54926735", "0.54457945", "0.5440171", "0.5335196", "0.53335434", "0.5256834", "0.5229648", "0.5100543", "0.5064569", "0.50596", "0.5045757", "0.50413346", "0.50368875", "0.5029048", "0.5010543", "0.5006942",...
0.8137174
0
Does the same as expand_implied_by, but each element is a (tag, direct) pair Direct is true only for the tags in the input iterable, not for the implied ones.
def expand_implied_by_check(tags): out = list(map(lambda x : (x, True), list(tags))) tlist = list(tags) i = 0 while i < len(tlist): for implies in tlist[i].tags_to.all(): if implies not in out: out.append((implies, False)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_implied_by(tags):\n out = list(tags)\n \n i = 0\n while i < len(out):\n for implies in out[i].tags_to.all():\n if implies not in out:\n out.append(implies)\n \n i += 1\n \n out.sort(key=lambda a:...
[ "0.73786473", "0.6921995", "0.6901337", "0.5127778", "0.4939665", "0.4857299", "0.4841612", "0.48378667", "0.47903764", "0.4744233", "0.47146145", "0.46981707", "0.4651671", "0.46219185", "0.46054628", "0.46042565", "0.4585371", "0.45849028", "0.45668754", "0.45388457", "0.45...
0.7290612
1
Returns all the tags owned by this user
def by_user(user): return Tag.objects.all().filter(owner=user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_asset_tags(user_id):\n result = db.session.query(Tag).filter(\n NotificationAssetTag.user_id == user_id,\n NotificationAssetTag.tag_id == Tag.id\n ).all()\n return result if result else []", "def tags(request):\n return Tag.objects.filter(user=request.user)", "def get_inte...
[ "0.692619", "0.6867615", "0.68465114", "0.6743126", "0.65778196", "0.65561783", "0.6544148", "0.6514843", "0.6499508", "0.6447732", "0.6423474", "0.638473", "0.638473", "0.638473", "0.638473", "0.638473", "0.638473", "0.638473", "0.638473", "0.6380079", "0.6321024", "0.6310...
0.7943311
0
with a data_containers (list of processed SampleDataContainer objects), this will transform results into a single dataframe with all of the function values, with probe names in rows, and sample beta values for probes in columns.
def consolidate_values_for_sheet(data_containers, postprocess_func_colname='beta_value'): for idx,sample in enumerate(data_containers): sample_id = "{0}_{1}".format(sample.sample.sentrix_id,sample.sample.sentrix_position) this_sample_values = sample._SampleDataContainer__data_frame[postprocess_func_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_frame(data, index, resultsq, functions):\n results_list = []\n failed = False\n for function_id in functions:\n function = function_mapper[function_id]\n result = function(data.slice, functions[function_id])\n results_list.append(result)\n if not result.res:\n ...
[ "0.61030674", "0.5999272", "0.59028965", "0.5843566", "0.5804714", "0.5803746", "0.5624689", "0.5613195", "0.5611028", "0.55851024", "0.54885006", "0.54116213", "0.5403579", "0.5392863", "0.5391308", "0.5386644", "0.53635895", "0.5361517", "0.5337244", "0.5320356", "0.5312189...
0.60265476
1
Resolves a path for a config type
def get_config_path(config_type, config_path=""): data = { "own": config_path, "user": get_user_config_path(), "global": get_global_config_path() } try: return data[config_type] except KeyError: raise InvalidConfigTypeException()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resolve_conf_name(conf_type):\n fnm = config_names[conf_type]\n if os.path.isfile(fnm):\n return fnm\n elif os.path.isfile(config_path + fnm):\n return config_path + fnm\n else:\n raise RuntimeError(\"Missing configuration file for %s\" % conf_type)", "def get_config_type(co...
[ "0.6675451", "0.6384866", "0.5918775", "0.5913211", "0.5868751", "0.58641165", "0.57384616", "0.56661963", "0.5644473", "0.5627098", "0.5624543", "0.5576847", "0.5562291", "0.55478436", "0.5451666", "0.5439571", "0.54111356", "0.54036963", "0.5273365", "0.527113", "0.52587265...
0.7259593
0
Returns the path of the global configuration file
def get_global_config_path(): return "/etc/dapsenv/dapsenv.conf"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_file_location():\n\n return './' + CONFIG_FILE_NAME", "def get_config_path():\n\n root = os.path.dirname(os.path.abspath(__file__))[:-5]\n config_path = os.path.join(root, 'config.ini')\n\n return config_path", "def configPath(self):\n return os.path.dirname(__file__)", "def...
[ "0.8170498", "0.8149112", "0.8113216", "0.7989826", "0.7970176", "0.79333484", "0.7824644", "0.7777473", "0.77438056", "0.7719309", "0.7697185", "0.76197577", "0.7570368", "0.7545556", "0.75374484", "0.7467858", "0.74403304", "0.74283", "0.7358495", "0.73165745", "0.7294852",...
0.8346807
0
Returns the path of the user configuration file
def get_user_config_path(): return "{}/.dapsenv/dapsenv.conf".format(expanduser("~"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_config_path():\n return os.path.join(os.path.expanduser('~'))", "def get_user_config_dir(options):\n return '/root/.spinnaker'", "def config_file(self):\n return join_path(self.prefix.etc.bohrium, \"config.ini\")", "def config_file_and_path():\n return str(rmfriend_dir() / 'config.cf...
[ "0.78400224", "0.7665953", "0.7620153", "0.75382227", "0.7534668", "0.7432483", "0.7346872", "0.72849715", "0.726103", "0.7230243", "0.7229635", "0.7221889", "0.7221053", "0.71134675", "0.7088942", "0.7082575", "0.70495373", "0.6991914", "0.69861937", "0.6981911", "0.69739807...
0.79443234
0
Draw card item with its image on the screen
def draw_card(self, x, y, card_pos): card_id = self.cards[card_pos] item = CommonCardHandle(card_pos, self) pixmap = QPixmap() if not pixmap.loadFromData(self.parent.database.get_data(card_id, 'low_res')): # TODO: throw error or something pass item.setPixm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_card_icon(self):\n card_icon = pygame.Surface((card_dimensions[0]/2, card_dimensions[1]/2))\n card_icon.fill(self.color)\n pygame.draw.rect(card_icon, CARD_OUTLINE, (0,0,card_icon.get_width(), card_icon.get_height()), 1)\n #the picture\n pic = pygame.transform.scale(self...
[ "0.77568555", "0.7183763", "0.70858896", "0.70401824", "0.70079154", "0.6899117", "0.6876519", "0.68346894", "0.6754337", "0.6723893", "0.67201185", "0.6700681", "0.6670856", "0.6617026", "0.6616946", "0.65604407", "0.6513981", "0.64907306", "0.64469767", "0.6432041", "0.6398...
0.7373437
1
Calculate the offset from the page number and number per page
def calculate_offset(page_number, per_page): if page_number < 1: return 0 else: offset = (page_number - 1) * per_page return offset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_offset(page_num, per_page):\r\n if page_num and per_page:\r\n return (page_num-1) * per_page\r\n else:\r\n return None", "def get_page_offset(self) -> int:\n page_offset: int = self.page_number\n if page_offset <= 1:\n return 0\n return (page_offset - 1)...
[ "0.77995265", "0.76814127", "0.7105734", "0.6967159", "0.6652218", "0.6636704", "0.64200956", "0.63789934", "0.63724935", "0.63724935", "0.63724935", "0.633144", "0.610982", "0.60907185", "0.6062406", "0.60604966", "0.6048903", "0.6029713", "0.6027081", "0.5996911", "0.598415...
0.8489778
0
Determines the initial rows and columns of the fleas.
def initialize_flea_locs(self, flea_rows, flea_cols): # Replace None with center flea_rows = [flea_row if flea_row is not None else self.num_rows // 2 for flea_row in flea_rows] flea_cols = [flea_col if flea_col is not None else self.num_cols // 2 for flea_col in flea_cols] # Replace n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_block():\n final_locs = [[1 for x in range(LOC_SIZE)] for y in range(LOC_SIZE)]\n for a in range(int(LOC_SIZE / 2)):\n for b in range(a, int(LOC_SIZE / 2)):\n # creating and ringing each of the fleas individually\n print(a, b)\n locs = [[1 if x == a and y == b...
[ "0.5747349", "0.55304915", "0.54669744", "0.544392", "0.536384", "0.5329804", "0.5238225", "0.5191042", "0.51660126", "0.51305646", "0.5103158", "0.5083339", "0.5059225", "0.5046582", "0.50390905", "0.5030519", "0.5030001", "0.5018883", "0.5002887", "0.5000909", "0.49926257",...
0.61964476
0
Determines the initial directions of the fleas.
def initialize_flea_directions(self, init_directions): init_directions += ['up'] * (self.num_fleas - len(init_directions)) return init_directions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_direction(self, feats):\n if feats.name == \"ARNC\":\n if feats[\"z-score\"] < -1.5:\n return Directions.long_dir\n elif feats[\"z-score\"] > 1.5:\n return Directions.short_dir\n elif feats.name == \"UNG\":\n if feats[\"z-scor...
[ "0.577651", "0.5761766", "0.54945475", "0.5401978", "0.5295211", "0.52914995", "0.52668256", "0.5246092", "0.51954025", "0.51931316", "0.5184261", "0.517382", "0.5150054", "0.51456606", "0.5136114", "0.512479", "0.5088317", "0.50830895", "0.5068119", "0.50432193", "0.5039508"...
0.72522104
0
Determine the initial square colors.
def initialize_square_colors(self, square_colors): if square_colors is None: square_colors = [[0] * self.num_cols] * self.num_rows return square_colors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_colors(self) -> None:\n curses.init_pair(ColorPair.black_on_white.value, curses.COLOR_BLACK, curses.COLOR_WHITE)\n curses.init_pair(ColorPair.red_on_black.value, curses.COLOR_RED, curses.COLOR_BLACK)\n curses.init_pair(ColorPair.blue_on_black.value, curses.COLOR_BLUE, curses.COL...
[ "0.65205836", "0.64879256", "0.64560956", "0.64264864", "0.6399936", "0.6295429", "0.61141825", "0.60455334", "0.6031279", "0.60079896", "0.6003107", "0.59678465", "0.5959027", "0.59578264", "0.59552187", "0.59532493", "0.5947528", "0.59200263", "0.59002054", "0.5895776", "0....
0.73408926
0
Gets the Square in a given row and column.
def get_square(self, row, col): return self.board[row][col]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def square(self, row, col):\n return self.board[row][col]", "def square(self, row, col):\n return self._board[row][col]", "def square(self, row, col):\n if 0 == row:\n if 0 == col:\n return self.tl\n elif 1 == col:\n return self.tc\n ...
[ "0.8541956", "0.8489466", "0.8139662", "0.76062024", "0.7603011", "0.73756915", "0.72731274", "0.722714", "0.722714", "0.7216884", "0.7193437", "0.71650165", "0.71462554", "0.70792747", "0.7056047", "0.69592404", "0.69378346", "0.68022996", "0.6793762", "0.6790237", "0.678944...
0.8849575
0
Changes the color of the Squares under the Fleas.
def change_square_colors(self): for flea in self.fleas.sprites(): flea.square.change_color()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changeColor( self ):\n\t\t\n\t\tx, y = self.position.xy\n\t\tself.color = ( int((x / WINDOW_X) * 128), int((x / WINDOW_X) * 128) + int((y / WINDOW_Y) * 128 ), int((y / WINDOW_Y) * 128))", "def update_color(self):\n self.plot(update_traces=False, update_waveforms=True)", "def update_colourin(self):\n...
[ "0.69831204", "0.63404846", "0.6302929", "0.6261795", "0.6195861", "0.619493", "0.61861604", "0.6058782", "0.60587114", "0.6052671", "0.60500383", "0.6008667", "0.59344876", "0.59155804", "0.5906455", "0.58579266", "0.57919824", "0.5791351", "0.57853216", "0.57681215", "0.573...
0.7049206
0
Build a MetaDataSetFeaturizerViaLambda based on supplied keyword arguments.
def __call__( self, method: str, callable_: Callable[[pd.DataFrame], Union[pd.DataFrame, pd.Series]], normalizable: bool, **_ignore ): return MetaDataSetFeaturizerViaLambda( method=method, callable_=callable_, normalizable=normalizable )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(self, func):\r\n return func(**self.kwargs)", "def lambda_fn(ds, fn):\n logger.info(\"Applying function '%s' on dataset.\", str(fn))\n return fn(ds)", "def factory(*args):\n\n def wrapper(dataset):\n return Factory(dataset, *args)\n\n return wrapper", "def function_maker(s...
[ "0.521316", "0.5161827", "0.5130045", "0.5062305", "0.50407004", "0.49847677", "0.4981667", "0.4978922", "0.48902628", "0.48765245", "0.4872106", "0.48687008", "0.48558855", "0.48554668", "0.48479384", "0.4819062", "0.48036474", "0.48031783", "0.4770191", "0.4765676", "0.4764...
0.7124045
0
Identify the interface residues for all pairs of chains involved in the interface.
def identify_interface_residues_12(reference_pdb, reference_withH_pdb, trajectory, cutoffs, frames): # Load reference PDB forcefield = ForceField('amber14-all.xml', 'amber14/tip3pfb.xml') pdb = PDBFile(reference_pdb) modeller = Modeller(pdb.topology, pdb.positions) modeller.addHydrogens(forcefield,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residues(self, chain_id, model_num = 0, include_alt = False):\n resi = []\n for res in self.chain(chain_id, model_num):\n res.chain_id = chain_id\n if res.id[0] ==' ':\n resi.append(res)\n elif include_alt:\n resi.append(res)\n ...
[ "0.63490707", "0.57995063", "0.549096", "0.5399745", "0.53579885", "0.5353315", "0.5337845", "0.5297717", "0.52630556", "0.52081615", "0.5159576", "0.51541764", "0.5130359", "0.5124876", "0.5121439", "0.5100151", "0.50913095", "0.50734675", "0.50631887", "0.5062796", "0.50600...
0.59105253
1
Add the mask to the provided face, and return the face with mask.
def apply_mask(face: np.array, mask: np.array) -> np.array: mask_h, mask_w, _ = mask.shape face_h, face_w, _ = face.shape # Resize the mask to fit on face factor = min(face_h / mask_h, face_w / mask_w) new_mask_w = int(factor * mask_w) new_mask_h = int(factor * mask_h) new_mask_shape = (new...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_face(self, face):\n try:\n face_idx = self.faces.index(face)\n return self.faces[face_idx]\n except Exception:\n self.faces.append(face)\n return face", "def add_mask(self, bg, mask):\n # if mask is to tall for the background image, decreas...
[ "0.68112254", "0.61941063", "0.61160135", "0.5863433", "0.5680295", "0.56591696", "0.5506171", "0.5495523", "0.5465617", "0.54287475", "0.540982", "0.5407283", "0.5399397", "0.53711027", "0.53566027", "0.52766466", "0.5251095", "0.52477425", "0.5221825", "0.521897", "0.516831...
0.7651554
0
Append header/footer to `cmd`.
def append_footer(cmd, marker): header = "" footer = """ EXIT_CODE=$? echo {marker}code: ${{EXIT_CODE}}{marker} echo {marker}pwd: $(pwd){marker} echo {marker}env: $(cat -v <(env -0)){marker} """.format( marker=marker ) full_command = "\n".join([header, cmd, footer]) return full_command
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tprint_raw(self, cmd, end='\\n'):\n self.fileHandle.write(cmd + end)", "def _build_command(self, cmd, unit):\n return '#' + unit + cmd + NEWLINE", "def add_header(force=False):\n print_debug_info()\n if not force:\n if not should_do_write():\n return\n\n on_ente...
[ "0.5938615", "0.5770663", "0.56236213", "0.5596925", "0.5524238", "0.55135214", "0.54929286", "0.5477096", "0.5441686", "0.53585064", "0.53575087", "0.53523684", "0.5345566", "0.53223354", "0.5313103", "0.5260496", "0.52242094", "0.5208714", "0.52053946", "0.52005076", "0.518...
0.7447718
0
Parse and postprocess ssh_config and rename some keys for plumbum.ParamikoMachine.__init__()
def load_ssh_config_for_plumbum(filename, host): conf = paramiko.config.SSHConfig() expanded_path = os.path.expanduser(filename) username_from_host = None m = re.search("([^@]+)@(.*)", host) if m: username_from_host = m.group(1) host = m.group(2) if os.path.exists(expanded_pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse(self, content):\n result = TincConfParser.conf_file.parseString(to_unicode(content))\n for entry in result.get(\"entries\", []):\n self[entry[0]] = entry[1]\n keys = result.get(\"keys\", [])\n if keys:\n if len(keys) > 1:\n raise ParserErr...
[ "0.6004054", "0.5839919", "0.5825213", "0.5778339", "0.5707421", "0.56640553", "0.5603101", "0.55248064", "0.54654783", "0.5437723", "0.5413477", "0.53898275", "0.5389727", "0.5387925", "0.53728455", "0.53633326", "0.5356791", "0.5346864", "0.53243184", "0.5306002", "0.53013"...
0.58567256
1
always run this method first to evaluate the meta json file. Pass the directory of the corpus (where metafile.json is situated)
def load_json(corpus): global corpus_dir, u_path, candidates, unknowns, encoding, language corpus_dir += corpus m_file = open(os.path.join(corpus_dir, META_FILENAME), "r") meta_json = json.load(m_file) m_file.close() u_path += os.path.join(corpus_dir, meta_json["folder"]) encoding += meta_j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_corpus_meta_from_dir(filename, corpus_meta, exclude_overall_meta):\n with open(os.path.join(filename, \"corpus.json\"), \"r\") as f:\n for k, v in json.load(f).items():\n if k in exclude_overall_meta: continue\n corpus_meta[k] = v", "def main():\n \n root = Folder(n...
[ "0.7082381", "0.586382", "0.5772098", "0.57677233", "0.5752917", "0.57001966", "0.5661683", "0.5659507", "0.56590486", "0.5642474", "0.5588098", "0.55415887", "0.551891", "0.5513077", "0.54982644", "0.5493433", "0.549307", "0.54841393", "0.5416018", "0.54146445", "0.5410795",...
0.6883183
1
get training text 'filename' from candidate 'can' (obtain values from 'trainings', see example above)
def get_training_text(can, filename): d_file = codecs.open(os.path.join(corpus_dir, can, filename), "r", "utf-8") s = d_file.read() d_file.close() return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_filename():\n dirname = os.path.dirname(__file__)\n return os.path.join(dirname, 'occulttraining.txt')", "def load_training():\n for can in candidates:\n trainings[can] = []\n for subdir, dirs, files in os.walk(os.path.join(corpus_dir, can)):\n for doc in files:\n ...
[ "0.60562044", "0.6041802", "0.6016182", "0.58461756", "0.5826132", "0.5790548", "0.5689206", "0.5469799", "0.54335415", "0.539198", "0.5366164", "0.5323693", "0.52881306", "0.52773625", "0.52503705", "0.5247028", "0.52131414", "0.5187469", "0.51757795", "0.51622295", "0.51342...
0.7263047
0
get training file as bytearray
def get_training_bytes(can, filename): d_file = open(os.path.join(corpus_dir, can, filename), "rb") b = bytearray(d_file.read()) d_file.close() return b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_sample_binary() -> bytearray:\n full_path = path.abspath(__file__).replace(\n DemoBinaryPuller._MODULE_FILE_NAME,\n DemoBinaryPuller._BIN_FILE_NAME)\n with open(full_path, \"rb\") as bin_file:\n binary_content = bin_file.read()\n return binary_content"...
[ "0.6530316", "0.62942386", "0.6263488", "0.6066596", "0.6008916", "0.5943695", "0.59409225", "0.58880603", "0.58114594", "0.57615244", "0.5689741", "0.5688625", "0.56801695", "0.5667511", "0.56595796", "0.5641395", "0.56238467", "0.56224763", "0.56184244", "0.5617344", "0.560...
0.7570874
0
get unknown text 'filename' (obtain values from 'unknowns', see example above)
def get_unknown_text(filename): d_file = codecs.open(os.path.join(u_path, filename), "r", "utf-8") s = d_file.read() d_file.close() return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_filename(f):\n problem = f[2:5]\n extension = f.split('.')[-1]\n if extension not in langs.keys():\n # if the extension isn't in our list we don't care about the file\n return (None, None)\n return (problem, extension)", "def parseOutText(f):\n\n\n f.seek(0) ### go back to...
[ "0.60619533", "0.59448653", "0.5880763", "0.5844294", "0.57835126", "0.57252425", "0.57172376", "0.5701078", "0.5650412", "0.5641387", "0.5602536", "0.55996644", "0.5551253", "0.5534546", "0.55136657", "0.55071455", "0.54930013", "0.5470423", "0.54324615", "0.5426587", "0.542...
0.75179213
0
get unknown file as bytearray
def get_unknown_bytes(filename): d_file = open(os.path.join(u_path, filename), "rb") b = bytearray(d_file.read()) d_file.close() return b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_as_bytes(filename):\n try:\n with open(filename, \"rb\") as file:\n bytes = array.array(\"B\")\n bytes.frombytes(file.read())\n return bytes\n except FileNotFoundError:\n print(f\"File not found: {filename}\")\n ex...
[ "0.7152647", "0.69215786", "0.6701248", "0.6561615", "0.65179765", "0.650987", "0.64195776", "0.6374897", "0.63348585", "0.6324657", "0.6263759", "0.6194869", "0.61396164", "0.6138177", "0.61314404", "0.6122473", "0.6080764", "0.60445416", "0.60434145", "0.60298926", "0.60172...
0.79798865
0
if you want to evaluate your answers using the groundtruth.json, load the true authors in 'trueAuthors' using this function
def load_ground_truth(): t_file = open(os.path.join(corpus_dir, GT_FILENAME), "r") t_json = json.load(t_file) t_file.close() global trueAuthors for i in range(len(t_json["ground-truth"])): trueAuthors.append(t_json["ground-truth"][i]["true-author"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_authors_from_data(self):\n responses.add(\n responses.GET,\n \"https://openlibrary.org/authors/OL382982A\",\n json={\n \"name\": \"George Elliott\",\n \"personal_name\": \"George Elliott\",\n \"last_modified\": {\n ...
[ "0.5868444", "0.57829976", "0.5589759", "0.55294764", "0.5447328", "0.54368585", "0.5414421", "0.5405367", "0.5401354", "0.53672665", "0.53661776", "0.5360875", "0.53598326", "0.5315401", "0.5311761", "0.530894", "0.5297903", "0.5284491", "0.5276247", "0.5260965", "0.5245783"...
0.74645066
0
Mock the redis pubsub.listen generator Yields the elements of `side_effects`, one at a time. If an element is an exception, it is raised instead of yielded. If the element is a callable, it is called and the return value is yielded.
def redis_listen(*side_effects): for effect in side_effects: if ( isinstance(effect, Exception) or isinstance(effect, type) and issubclass(effect, Exception) ): raise effect elif callable(effect): yield effect() else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_side_effect(self, original_object, attribute_name, side_effect):\n original_function = getattr(original_object, attribute_name)\n def original_with_side_effect(*args, **kwargs):\n side_effect()\n return original_function(*args, **kwargs)\n self.mock(original_object, attribute_name, orig...
[ "0.5850686", "0.55700994", "0.5440504", "0.5365091", "0.5313459", "0.5286434", "0.5244393", "0.5134776", "0.5041271", "0.5028358", "0.4956616", "0.49153754", "0.491494", "0.4888333", "0.48866546", "0.48858225", "0.48772252", "0.48605973", "0.48562133", "0.485331", "0.484318",...
0.7716917
0
Anonymous user can't access the user profile view.
def test_anonymous_cannot_get_userprofileview(dclient): resp = dclient.get("/api/record/profile/", follow=True) assert resp.status_code == 403
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_get_profile_not_authorized(self):\n self.client.logout()\n response = self.client.get(CONSTS.USER_PROFILE_URL)\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)", "def test_not_logged_user_cannot_access(self):\n\n utils.test_not_logged_cannot_access(sel...
[ "0.72416484", "0.6976399", "0.6976399", "0.6976399", "0.6976399", "0.6944178", "0.68615055", "0.68094474", "0.67919546", "0.6710337", "0.66798", "0.66781527", "0.664407", "0.66254276", "0.66114944", "0.6598399", "0.6598399", "0.6598399", "0.6598399", "0.6598399", "0.6598399",...
0.7859145
0
User can post source records and an empty crecord to the server and receive a crecord with the cases from the source record incorporated.
def test_integrate_sources_with_crecord(dclient, admin_user, example_crecord): dclient.force_authenticate(user=admin_user) docket = os.listdir("tests/data/dockets/")[0] with open(f"tests/data/dockets/{docket}", "rb") as d: doc_1 = SourceRecord.objects.create( caption="Hello v. World", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_flow_request_with_no_sources(self):\n res = self._add_flow_request(flow_request=self.flow_request_without_sources)\n self.assertEqual(res.status_code, 201)\n flow_request = res.json()\n destination = Destination.objects.get(name='Destination 1')\n self.assertEqual(fl...
[ "0.5335964", "0.5273506", "0.5268467", "0.50346047", "0.50232166", "0.50214654", "0.50048697", "0.49723393", "0.4958517", "0.49340504", "0.48781565", "0.48394287", "0.48392814", "0.48148042", "0.48148042", "0.48148042", "0.48148042", "0.48148042", "0.48148042", "0.48148042", ...
0.584946
0
Create a jobfile for a command and submit it. This function takes an arbitrary shell command and submits it to SGE.
def submit( command: str, namespace: argparse.Namespace, sge_dir: Path = Path(os.path.curdir), job_name="", ) -> int: id_file = Path("sge.id") job_script = Path("sge_job") stop_script = Path("sge_stop") epilogue_script = Path("sge_epilogue") # check if job is already running if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_command_to_queue(command, queue=None, max_jobs_in_queue=None, queue_file=None, queue_parameters={'max_mem':5000, 'queue':'short', 'logs_dir':'/tmp', 'modules':['Python/3.6.2']}, dummy_dir=\"/tmp\", script_name=None):\n #if max_jobs_in_queue is not None:\n # while number_of_jobs_in_queue() >= ma...
[ "0.66603345", "0.6486015", "0.6295028", "0.6273452", "0.6230695", "0.62159914", "0.6041481", "0.6036891", "0.59854907", "0.5983392", "0.5968986", "0.5875951", "0.5868986", "0.5732721", "0.56980747", "0.5687351", "0.5685329", "0.5644428", "0.56439567", "0.56382155", "0.5620296...
0.66162074
1
Add a volume object to the database
def database_volume_add(volume_obj): db = database_get() session = db.session() query = session.query(model.Volume) query = query.filter(model.Volume.uuid == volume_obj.uuid) volume = query.first() if not volume: volume = model.Volume() volume.uuid = volume_obj.uuid volum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_volume_snapshot_add(volume_snapshot_obj):\n db = database_get()\n session = db.session()\n query = session.query(model.VolumeSnapshot)\n query = query.filter(model.VolumeSnapshot.uuid == volume_snapshot_obj.uuid)\n volume_snapshot = query.first()\n if not volume_snapshot:\n vo...
[ "0.75710624", "0.7532311", "0.6907653", "0.6772771", "0.66654813", "0.65324235", "0.64125866", "0.6377688", "0.6288482", "0.6157662", "0.61301947", "0.610188", "0.6083926", "0.60792243", "0.6057686", "0.6031038", "0.6029394", "0.6018405", "0.60026425", "0.60026425", "0.600264...
0.86276716
0
Delete a volume object from the database
def database_volume_delete(volume_uuid): db = database_get() session = db.session() query = session.query(model.Volume) query.filter(model.Volume.uuid == volume_uuid).delete() session.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\r\n return self.connection.delete_volume(self.id)", "def database_volume_snapshot_delete(volume_snapshot_uuid):\n db = database_get()\n session = db.session()\n query = session.query(model.VolumeSnapshot)\n query.filter(model.VolumeSnapshot.uuid == volume_snapshot_uuid).delet...
[ "0.79892504", "0.7345457", "0.7280439", "0.7173193", "0.71207607", "0.70749444", "0.6984302", "0.69721687", "0.69567794", "0.695297", "0.69519734", "0.6908548", "0.6908018", "0.6890436", "0.68565786", "0.6845565", "0.6828146", "0.6813317", "0.68118554", "0.67957896", "0.67940...
0.811518
0
Fetch all the volume objects from the database
def database_volume_get_list(): db = database_get() session = db.session() query = session.query(model.Volume) volume_objs = list() for volume in query.all(): nfvi_volume_data = json.loads(volume.nfvi_volume_data) nfvi_volume = nfvi.objects.v1.Volume(nfvi_volume_data['uuid'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_volume_snapshot_get_list():\n db = database_get()\n\n session = db.session()\n query = session.query(model.VolumeSnapshot)\n\n volume_snapshot_objs = list()\n for volume_snapshot in query.all():\n nfvi_volume_snapshot_data = \\\n json.loads(volume_snapshot.nfvi_volume_...
[ "0.73705924", "0.7112665", "0.6906975", "0.67215234", "0.65297365", "0.65240467", "0.6436968", "0.6402819", "0.6332509", "0.6292779", "0.6251874", "0.6200711", "0.61889696", "0.6147304", "0.61373913", "0.61325896", "0.60601556", "0.60338706", "0.6029828", "0.6019226", "0.6002...
0.83202946
0
Add a volume snapshot object to the database
def database_volume_snapshot_add(volume_snapshot_obj): db = database_get() session = db.session() query = session.query(model.VolumeSnapshot) query = query.filter(model.VolumeSnapshot.uuid == volume_snapshot_obj.uuid) volume_snapshot = query.first() if not volume_snapshot: volume_snapsho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_volume_add(volume_obj):\n db = database_get()\n session = db.session()\n query = session.query(model.Volume)\n query = query.filter(model.Volume.uuid == volume_obj.uuid)\n volume = query.first()\n if not volume:\n volume = model.Volume()\n volume.uuid = volume_obj.uuid\...
[ "0.7482185", "0.7002271", "0.69539315", "0.6797534", "0.67487913", "0.66576785", "0.6618506", "0.6606803", "0.65955716", "0.65905356", "0.6559316", "0.65032834", "0.64993346", "0.6497157", "0.6489921", "0.6484812", "0.64749944", "0.6470906", "0.64646864", "0.6435568", "0.6407...
0.8692387
0
Delete a volume snapshot object from the database
def database_volume_snapshot_delete(volume_snapshot_uuid): db = database_get() session = db.session() query = session.query(model.VolumeSnapshot) query.filter(model.VolumeSnapshot.uuid == volume_snapshot_uuid).delete() session.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_snapshot(self, snapshot):\n aname = \"cinder_v%s.delete_snapshot\" % self.version\n with atomic.ActionTimer(self, aname):\n self._get_client().volume_snapshots.delete(snapshot)\n bench_utils.wait_for_status(\n snapshot,\n ready_statuses=[...
[ "0.7709622", "0.77053", "0.7690059", "0.76509684", "0.7645589", "0.76316714", "0.75801545", "0.75216985", "0.71301407", "0.70789945", "0.7070644", "0.7053744", "0.69826925", "0.68643117", "0.6813923", "0.681291", "0.6803012", "0.6705354", "0.6684261", "0.66091204", "0.6593013...
0.85667115
0
Fetch all the volume snapshot objects from the database
def database_volume_snapshot_get_list(): db = database_get() session = db.session() query = session.query(model.VolumeSnapshot) volume_snapshot_objs = list() for volume_snapshot in query.all(): nfvi_volume_snapshot_data = \ json.loads(volume_snapshot.nfvi_volume_snapshot_data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_volume_get_list():\n db = database_get()\n\n session = db.session()\n query = session.query(model.Volume)\n\n volume_objs = list()\n for volume in query.all():\n nfvi_volume_data = json.loads(volume.nfvi_volume_data)\n nfvi_volume = nfvi.objects.v1.Volume(nfvi_volume_data[...
[ "0.7633621", "0.6984137", "0.6806291", "0.676285", "0.66530216", "0.6551907", "0.6531195", "0.6491406", "0.6482924", "0.63923556", "0.63025755", "0.62802666", "0.62676686", "0.6210009", "0.6184586", "0.61717004", "0.6132653", "0.6115144", "0.6067539", "0.60583323", "0.6047448...
0.8395358
0
Copy this config, replacing the regions with those in the `regions` parameter.
def copy_with_regions(self, regions): new = copy.deepcopy(self) new.regions = [] for region in regions: new.regions.append(self._parse_region(region)) return new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regions(self, regions):\n self._regions = regions", "def copy(self, **kwargs):\n # type: (...) -> SalusConfig\n return deepcopy(self).update(**kwargs)", "def update_region_config(cls, body: CloudAccountRegionConfigurationViewModel) -> Dict:\n\t\tpass", "def __copy__(self):\n r...
[ "0.61411893", "0.6017079", "0.60054064", "0.5572163", "0.5489599", "0.54806817", "0.54680604", "0.54073626", "0.5361858", "0.5301637", "0.5257151", "0.4999279", "0.49944136", "0.49855417", "0.4982498", "0.49822417", "0.49773163", "0.49644902", "0.49597627", "0.49420026", "0.4...
0.728114
0
Build a datastore client.
def _get_client(): return datastore.Client()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, project_id, namespace=None):\n self._client = datastore.Client(project=project_id, namespace=namespace)", "def _generate_client(self):\n mongoConf = self._config.get('Connectivity', 'MongoDB') # type: dict\n if mongoConf.get('username') and mongoConf.get('password'):\n ...
[ "0.65066254", "0.6466267", "0.64521277", "0.6253457", "0.62465185", "0.6241816", "0.6188744", "0.6176696", "0.61699075", "0.6131375", "0.60795176", "0.6067072", "0.6050736", "0.603745", "0.6025112", "0.59992546", "0.5985941", "0.59515315", "0.5943441", "0.58857954", "0.587854...
0.7500386
1
Load a datastore key using a particular client.
def _load_key(client, entity_type, entity_id=None, parent_key=None): key = None if entity_id: key = client.key(entity_type, entity_id, parent=parent_key) else: # this will generate an ID key = client.key(entity_type) return key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_key(self, type, keyid):\n pass", "def load_key():", "def load_key(self, key):\n self.key = key", "def _load_entity(client, entity_type, entity_id, parent_key=None):\n\n key = _load_key(client, entity_type, entity_id, parent_key)\n entity = client.get(key)\n log('retrieved enti...
[ "0.68274784", "0.6435767", "0.63572484", "0.62927514", "0.6038199", "0.57368225", "0.56166524", "0.55872095", "0.5579193", "0.55307025", "0.5491296", "0.547498", "0.547498", "0.54582745", "0.54403764", "0.5429789", "0.5429789", "0.54016703", "0.53822833", "0.52943665", "0.527...
0.69858867
0
Load a datstore entity using a particular client, and the ID.
def _load_entity(client, entity_type, entity_id, parent_key=None): key = _load_key(client, entity_type, entity_id, parent_key) entity = client.get(key) log('retrieved entity: ' + entity_type + ' for ID: ' + str(entity_id)) return entity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(cls, id):\n key = cls.get_key_prefix()+\"#\"+str(id)\n src = dal_get(key)\n logger.debug( \"LOAD %s %s %s\", str(key), str(id), str(src))\n if src == None:\n raise cls.NotExist(\"No instance could be found with ID: \"+str(id))\n result = dal_retrieve(src)\n ...
[ "0.66032004", "0.571891", "0.5601208", "0.54721177", "0.5397103", "0.53937095", "0.5379413", "0.5363272", "0.5350971", "0.5345492", "0.5338532", "0.5322248", "0.52968", "0.5267842", "0.5262351", "0.5257719", "0.52296597", "0.521735", "0.5184554", "0.51640236", "0.51234055", ...
0.7085959
0
Build a new entity of the given type.
def _new_entity(client, entity_type): return datastore.Entity(_load_key(client, entity_type))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_entity_in_domain(entity_type, domain_id):\n if entity_type == 'users':\n new_entity = unit.new_user_ref(domain_id=domain_id)\n new_entity = self.identity_api.create_user(new_entity)\n elif entity_type == 'groups':\n new_entity = unit.ne...
[ "0.6640664", "0.6596463", "0.6416151", "0.6234594", "0.61637956", "0.61633486", "0.6055688", "0.59273124", "0.58544844", "0.58489096", "0.5681009", "0.5670029", "0.5641178", "0.562199", "0.5620456", "0.5573635", "0.5527734", "0.55230725", "0.55120534", "0.55038404", "0.546361...
0.7312703
0
Vectorized wrapper function for _lerchphi()
def _vlerchphi(self, z: np.ndarray, a: int) -> np.ndarray: return np.array([self._lerchphi(z_, a) for z_ in z])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vzlerchphi(self, z: np.ndarray, a: int) -> np.ndarray:\n return np.array([self._zlerchphi(z_, a) for z_ in z])", "def eulerphi(n):\r\n\treturn euler_phi(n)", "def eulerphi(n):\n\treturn euler_phi(n)", "def phi_t(self):\n\t\tdim = self.dim\n\t\ttim_all = self.tim_all \n\t\tphi_all = np.zeros((tim_...
[ "0.6796746", "0.6349775", "0.63100874", "0.6223985", "0.61475223", "0.6019182", "0.6001288", "0.59823066", "0.5928675", "0.5911068", "0.58917844", "0.5880426", "0.58690506", "0.58565605", "0.5855527", "0.5853087", "0.58330727", "0.5802594", "0.5786916", "0.57567644", "0.57268...
0.7559975
0