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
Test constructing an infinite _db_updates feed.
def test_constructor_db_updates(self): feed = InfiniteFeed(self.client, chunk_size=1, timeout=100, feed='continuous') self.assertEqual(feed._url, '/'.join([self.client.server_url, '_db_updates'])) self.assertIsInstance(feed._r_session, Session) self.assertFalse(feed._raw_data) se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_infinite_db_updates_feed(self):\n feed = InfiniteFeed(self.client, since='now', timeout=100)\n\n # Create a proxy for the feed._start method so that we can track how\n # many times it has been called.\n feed._start = MethodCallCount(feed._start)\n\n new_dbs = list()\n ...
[ "0.8253992", "0.72884977", "0.6604631", "0.64941096", "0.64665896", "0.6328994", "0.6175912", "0.6170512", "0.61609447", "0.6133652", "0.6111069", "0.60689044", "0.6057885", "0.60202515", "0.59075385", "0.58818424", "0.5873431", "0.58687603", "0.58345026", "0.58297986", "0.58...
0.8292704
0
Test that an infinite feed will continue to issue multiple requests until stopped. This check is performed in combination by creating documents 3 separate times and checking that the "_start" method on the InfiniteFeed object was called 3 times as well.
def test_infinite_feed(self): self.populate_db_with_documents() feed = InfiniteFeed(self.db, timeout=100) # Create a proxy for the feed._start method so that we can track how # many times it has been called. feed._start = MethodCallCount(feed._start) changes = list() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_infinite_db_updates_feed(self):\n feed = InfiniteFeed(self.client, since='now', timeout=100)\n\n # Create a proxy for the feed._start method so that we can track how\n # many times it has been called.\n feed._start = MethodCallCount(feed._start)\n\n new_dbs = list()\n ...
[ "0.72182524", "0.60102415", "0.5983157", "0.58984596", "0.58564985", "0.5765583", "0.574824", "0.56290317", "0.5562241", "0.55338424", "0.55331767", "0.55290794", "0.5521841", "0.55046946", "0.54600227", "0.5453966", "0.54417586", "0.54326344", "0.5425452", "0.54100937", "0.5...
0.8080091
0
Test that an _db_updates infinite feed will continue to issue multiple requests until stopped. Since we do not have control over updates happening within the account as we do within a database, this test is stopped after 15 database creations regardless. Within that span of time we expect that the feed would have been ...
def test_infinite_db_updates_feed(self): feed = InfiniteFeed(self.client, since='now', timeout=100) # Create a proxy for the feed._start method so that we can track how # many times it has been called. feed._start = MethodCallCount(feed._start) new_dbs = list() try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_constructor_db_updates(self):\n feed = InfiniteFeed(self.client, chunk_size=1, timeout=100, feed='continuous')\n self.assertEqual(feed._url, '/'.join([self.client.server_url, '_db_updates']))\n self.assertIsInstance(feed._r_session, Session)\n self.assertFalse(feed._raw_data)\n...
[ "0.7011999", "0.68627167", "0.6791708", "0.6187079", "0.60834736", "0.6051524", "0.597345", "0.5913373", "0.5900723", "0.5835557", "0.57842183", "0.57730925", "0.574309", "0.56848246", "0.5683321", "0.5671484", "0.56435144", "0.5643226", "0.56350946", "0.56171465", "0.5606239...
0.8167076
0
verify equal between passcode and verify passcode lines
def check_verify(self): if self.ui.to_register.isChecked(): if self.ui.pass_line.text() == self.ui.verify_line.text(): return else: self.set_pwd = False return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_match(password, verify):\n return password == verify", "def verify():", "def verify(self, code) -> bool:\n totp = self.__initialize_totp()\n return totp.verify(code)", "def verify(verification_code):\n verification.verify(verification_code)", "def is_valid_part2(line):\n p...
[ "0.65438277", "0.64028597", "0.6356857", "0.6348567", "0.6281897", "0.6279664", "0.6217392", "0.61520046", "0.6127023", "0.61227757", "0.6044916", "0.6035572", "0.60347754", "0.603319", "0.60201436", "0.59780884", "0.5974098", "0.59488344", "0.5927072", "0.5911942", "0.590858...
0.66863775
0
Gets or sets the count of assessments reported by the solution.
def assessment_count(self) -> Optional[pulumi.Input[int]]: return pulumi.get(self, "assessment_count")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_count(self) -> int:\n return pulumi.get(self, \"test_set_count\")", "def get_scenario_count(self):\n return self.count", "def assessment_points(self) -> int:\n return self._assessment_points", "def validation_set_count(self) -> int:\n return pulumi.get(self, \"validat...
[ "0.655095", "0.6256413", "0.6221543", "0.60291547", "0.59234524", "0.5899697", "0.5858163", "0.5763119", "0.5760012", "0.57559884", "0.5745691", "0.5726684", "0.5713718", "0.56976104", "0.56974524", "0.56958336", "0.56958336", "0.5683292", "0.5681071", "0.5662276", "0.5566641...
0.75875336
0
Gets or sets the extended details reported by the solution.
def extended_details(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: return pulumi.get(self, "extended_details")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extended_info(self):\n return self.client.call('GET', self.name + 'extended-info')", "def extend_info(self):\n return self._extend_info", "def get_details(self):\n return self.details", "def get_details(self):\n return self.details", "def get_details(self):\n return s...
[ "0.7648492", "0.7092702", "0.6316318", "0.6316318", "0.6316318", "0.626519", "0.6184532", "0.6146312", "0.60449284", "0.601758", "0.59144187", "0.5871447", "0.5868428", "0.57756555", "0.57584494", "0.57446784", "0.57446784", "0.5723758", "0.5712438", "0.5710641", "0.57040286"...
0.71451074
1
Gets or sets the count of groups reported by the solution.
def group_count(self) -> Optional[pulumi.Input[int]]: return pulumi.get(self, "group_count")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ngroups(self):\n return self._ngroups", "def getNumGroups(self):\n return len(np.unique(self._group_index))", "def getNumGroups(self):\n return _libsbml.ListOfGroups_getNumGroups(self)", "def getNumGroups(self):\n return _libsbml.GroupsModelPlugin_getNumGroups(self)", "def n...
[ "0.7400885", "0.7161271", "0.7075182", "0.6943827", "0.69214857", "0.68017477", "0.64547825", "0.64547825", "0.6173699", "0.61217064", "0.60980016", "0.5956926", "0.5956926", "0.5956926", "0.59355694", "0.5882286", "0.58765113", "0.5858414", "0.5815837", "0.58114374", "0.5792...
0.721151
1
Gets or sets the cleanup state of the solution.
def cleanup_state(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "cleanup_state")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(self):\n if self._status == 0:\n self.flag = 0\n else:\n self.flag = 2\n\n self.final_params = self._popt", "def cleanup_on_fail(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"cleanup_on_fail\")", "def on_cleanup(self, state) ->...
[ "0.5761538", "0.5755214", "0.5706903", "0.5703411", "0.55710393", "0.556933", "0.5542009", "0.5537145", "0.55345905", "0.5530671", "0.55218774", "0.55047137", "0.55047137", "0.5491092", "0.548035", "0.547034", "0.54567224", "0.54559046", "0.54367256", "0.5433634", "0.54175705...
0.64944875
0
Gets or sets the details of the solution.
def details(self) -> Optional[pulumi.Input['SolutionDetailsArgs']]: return pulumi.get(self, "details")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_details(self):\n return self.details", "def get_details(self):\n return self.details", "def get_details(self):\n return self.details", "def get_solution(self):\r\n return self.solution", "def get_solution(self):\n solution = self.raw_solution\n if solution ...
[ "0.65263337", "0.65263337", "0.65263337", "0.62827975", "0.62794477", "0.6158341", "0.5972385", "0.58721447", "0.58504283", "0.5804181", "0.5779834", "0.5756773", "0.56696814", "0.56623816", "0.5615718", "0.5593665", "0.557681", "0.55743575", "0.5570838", "0.55553085", "0.555...
0.7780491
0
Gets or sets the goal of the solution.
def goal(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "goal")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goal(self):\n return self._build_goal", "def get_goal(self):\n return self.get_observation(self.env._get_goal())", "def get_goal(self) -> GoalType:\n return self.goal", "def goal(self, goal):\n\n self._goal = goal", "def get_goal(self):\n self._pid_lock.acquire() ...
[ "0.7292076", "0.7102423", "0.6604421", "0.65645677", "0.6517414", "0.64766264", "0.6386368", "0.6379113", "0.63391376", "0.6286651", "0.6228413", "0.6221903", "0.6003145", "0.5985015", "0.5963023", "0.59561074", "0.59523135", "0.59348536", "0.5926568", "0.58431983", "0.583569...
0.7343218
0
Gets or sets the purpose of the solution.
def purpose(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "purpose")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purpose(self) -> str:\n return pulumi.get(self, \"purpose\")", "def purpose(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"purpose\")", "def purpose(self):\n return self._purpose", "def purpose(self, purpose):\n\n self._purpose = purpose", "def purpose(self, purpos...
[ "0.7381015", "0.73635876", "0.73545533", "0.68121064", "0.68121064", "0.6228698", "0.5389133", "0.5388711", "0.51902056", "0.51759166", "0.5102519", "0.5102519", "0.4944245", "0.49320877", "0.49257827", "0.48774207", "0.4871906", "0.4851118", "0.48033178", "0.48033178", "0.48...
0.7400996
0
Finds the package a resource lives in
def getPackageFromResource(resource): import sd url = resource.getUrl() pkg_manager = sd.getContext().getSDApplication().getPackageMgr() for p in pkg_manager.getPackages(): for r in p.getChildrenResources(False): if r.getUrl() == url: return p return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_pkg(self, pkg):\n pass", "def get_resource(package_name, resource):\n # Path of the package, relative to the loader root:\n # For package 'foo.bar', this is 'foo/bar'.\n package_path = package_name.replace(\".\", \"/\")\n\n # Path of the resource, relative to the loader root:\n # F...
[ "0.68585324", "0.6817595", "0.65799993", "0.65498376", "0.6490739", "0.62694687", "0.6261306", "0.625357", "0.6235414", "0.61686736", "0.61296916", "0.61037827", "0.6083547", "0.6046237", "0.6046237", "0.6038811", "0.60204786", "0.60182536", "0.60166734", "0.6001912", "0.5998...
0.7700212
0
is_valid checks a formula and returns True if it's always satisfied within the interval. Otherwise, it returns an example of when it's not satisfied.
def is_valid(self, formula, systemstate=None): msg = "Don't know how to check validity of objects of type {type(check)}" logger.error(msg) raise ValueError(msg) # logger.debug("is_valid {str(formula)}") # if isinstance(formula, check.Check): # directly invert to a check ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid(formula):\r\n\r\n try:\r\n return not re.search(r'\\b0[0-9]', formula) and eval((formula) is True\r\n #except ArithmeticError:\r\n #return False\r\n except:\r\n return False", "def isRangeValid(self) -> bool:\n ...", "def check_formula(self, expected, given, sampl...
[ "0.6952767", "0.6359789", "0.61984766", "0.60863614", "0.6065324", "0.6033336", "0.5894179", "0.5823172", "0.5815996", "0.5808585", "0.57865024", "0.5782736", "0.5776578", "0.5729661", "0.5703226", "0.5698514", "0.56970704", "0.56938696", "0.56928974", "0.5641353", "0.5600812...
0.7043341
0
Convert n bytes into a human readable string based on format. symbols can be either "customary", "customary_ext", "iec" or "iec_ext",
def bytes2human(n, format='%(value).1f %(symbol)s', symbols='customary'): n = int(n) sign = '' if n < 0: sign = '-' n = -n symbols = SYMBOLS[symbols] prefix = {} for i, s in enumerate(symbols[1:]): prefix[s] = 1 << (i + 1) * 10 for symbol in reversed(symbols[1:]): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytes2human(n, format=\"%(value)i%(symbol)s\"):\n symbols = ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')\n prefix = {}\n for i, s in enumerate(symbols[1:]):\n prefix[s] = 1 << (i+1)*10\n for symbol in reversed(symbols[1:]):\n if n >= prefix[symbol]:\n value = float(n) / pr...
[ "0.65021646", "0.62997663", "0.62691927", "0.59078735", "0.57972115", "0.5664556", "0.56188285", "0.5568806", "0.5559517", "0.5547597", "0.5538554", "0.55122787", "0.5508553", "0.546931", "0.5457602", "0.54516983", "0.543876", "0.53954804", "0.5391302", "0.53787154", "0.53519...
0.6520492
0
Set the view limits to the nearest multiples of base that contain the data
def view_limits(self, dmin, dmax): base = self._select_base(dmin, dmax) if mpl.rcParams['axes.autolimit_mode'] == 'round_numbers': vmin = base.le(dmin) vmax = base.ge(dmax) if vmin == vmax: vmin -= 1 vmax += 1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_limits(self, vmin, vmax):\n return vmin, vmax\n # return nonsingular(vmin, vmax)", "def set_view_max(self, view_max):\n try:\n view_max = float(view_max)\n self._view_max = view_max\n self.update_rgba()\n if self._cross_pos:\n ...
[ "0.61097175", "0.6046753", "0.5984086", "0.5902828", "0.58193773", "0.581779", "0.5771895", "0.5711445", "0.5687423", "0.5683919", "0.5634394", "0.5563799", "0.55608094", "0.5543304", "0.5472012", "0.54453385", "0.5431932", "0.5431932", "0.54241353", "0.5407296", "0.5398765",...
0.7059033
0
Convert lists to JSON encoded strings, and correctly handle any unicode URL parameters.
def unicode_urlencode(self, params): if isinstance(params, dict): params = params.items() for i, param in enumerate(params): if isinstance(param[1], list): params[i] = (param[0], json.dumps(param[1]),) return urllib.urlencode( [(k, isinstance(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unicode_urlencode(params):\n if isinstance(params, dict):\n params = list(params.items())\n for i, param in enumerate(params):\n if isinstance(param[1], list):\n params[i] = (param[0], json.dumps(param[1]),)\n\n result = urllib.parse.urlencode([(k, isi...
[ "0.6864774", "0.66397476", "0.66172516", "0.66086245", "0.6606865", "0.65962803", "0.65903056", "0.65903056", "0.6582515", "0.6557054", "0.65298176", "0.6521824", "0.65212786", "0.65129966", "0.65129966", "0.65117544", "0.65017253", "0.64936596", "0.64865845", "0.6458174", "0...
0.66988754
1
Hashes arguments by joining key=value pairs, appending a secret, and then taking the MD5 hex digest.
def hash_args(self, args, secret=None): for a in args: if isinstance(args[a], list): args[a] = json.dumps(args[a]) args_joined = '' for a in sorted(args.keys()): if isinstance(a, unicode): args_joined += a.encode('utf-8') else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_hash(*args):\n key = bytes(' '.join(args), 'utf_8')\n hashh = hashlib.md5()\n hashh.update(key)\n return hashh.hexdigest()", "def checksum(**kwargs):\n\n # remove secretkey from kwargs, lookup if missing\n secretkey = kwargs.pop('secretkey', resolve_secretkey())\n\n # sort the a...
[ "0.7316442", "0.71318525", "0.7110362", "0.63037807", "0.6302396", "0.6230085", "0.6221342", "0.6154309", "0.6154309", "0.6154309", "0.6154309", "0.6154309", "0.6154309", "0.60746914", "0.6072491", "0.5993483", "0.5954927", "0.59384996", "0.5916692", "0.58866465", "0.58668876...
0.7924275
0
given an opened email file f, parse out all text below the metadata block at the top (in Part 2, you will also add stemming capabilities) and return a string that contains all the words in the email (spaceseparated)
def parseOutText(f): f.seek(0) ### go back to beginning of file (annoying) all_text = f.read() ### split off metadata content = re.split("X-FileName:.*$", all_text, flags=re.MULTILINE, maxsplit=1) words = "" if len(content) > 1: text_string = content[1] ## remove mails t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseOutText(f):\n\n\n f.seek(0) ### go back to beginning of file (annoying)\n all_text = f.read()\n\n ### split off metadata\n content = all_text.split(\"X-FileName:\")\n words = \"\"\n if len(content) > 1:\n ### remove punctuation\n text_string = content[1].translate(str.make...
[ "0.71798396", "0.66124284", "0.6192006", "0.6141319", "0.6066048", "0.60461986", "0.60439855", "0.6027324", "0.6021339", "0.59490126", "0.58234227", "0.57764715", "0.573566", "0.5679234", "0.5660324", "0.5651464", "0.5651464", "0.5589413", "0.55189335", "0.5435613", "0.538966...
0.75676155
0
Recursively search for linked calendars, generating iteration of those found
def get_linked_cals(folders): for folder in folders: if 'link' in folder: for linked_folder in folder['link']: yield linked_folder if 'folder' in folder: subfolders = folder['folder'] for linked_folder in get_linked_cals(subfolders): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __addCalendars(self, tree, key=\"dates/calendars\"):\n \n calendars = self.__getStore(self.__data, \"calendar\")\n \n for element in tree.findall(\"./%s/*\" % key):\n if not element.get(\"draft\"):\n self.__addCalendar(calendars, element)", "def test_...
[ "0.63429284", "0.57949895", "0.5711854", "0.5607237", "0.55794144", "0.55794144", "0.5459125", "0.5458623", "0.5429311", "0.5379322", "0.531464", "0.52693355", "0.52175975", "0.5208984", "0.51823956", "0.5172256", "0.5160157", "0.51547325", "0.5136413", "0.51360726", "0.51347...
0.6902938
0
Add a dotted line representing a change
def addDottedLine(self, sourceTreeLabelPrefix, sourceLabel, targetTreeLabelPrefix, targetLabel): color = "green" if sourceLabel != targetLabel: color = "gray" self.dotRepresentation.append( '{} -> {} [style=dotted color="{}" constraint=false...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addLineStyle(dist, focus, axis, pupil):\n r = 0 #focus / 2\n g = 0 #np.log10(dist) / (25 / 3)\n b = 0 #axis / 20\n a = 0.4\n rgb = [r, g, b, a]\n line = {'style': '-', 'color': rgb}\n return line", "def _defLine(self):\n self._dline=GPath(points = [0,100,GAME_WIDTH,100], linewidth...
[ "0.64584184", "0.6071593", "0.60253584", "0.59168375", "0.5902079", "0.58755267", "0.5826162", "0.5811116", "0.5811116", "0.579447", "0.578479", "0.57716346", "0.57066214", "0.5697388", "0.5693667", "0.56484234", "0.56478703", "0.56259626", "0.56172717", "0.56061083", "0.5596...
0.6653383
0
Read Double(8 bytes) from RAM\n
def read_double(self, process_handle: int, address: int): self.__bufferSize = 8 value = self.__read_bytes(process_handle, address) return None if value is None else unpack('<d', bytearray(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_double(self):\n return self._packers[\"d\"].unpack(self.read(8))[0]", "def read_double(data):\n s_type = \"=%s\" % get_type(\"double\")\n return struct.unpack(s_type, data.read(8))[0]", "def ReadDouble(self, endian=\"<\"):\n return self.unpack(\"%sd\" % endian, 8)", "def read_dou...
[ "0.73760796", "0.7177214", "0.7096821", "0.674607", "0.648972", "0.6238688", "0.6091336", "0.6064237", "0.6064237", "0.6027614", "0.6014518", "0.5953449", "0.5883696", "0.5883034", "0.58459276", "0.5834244", "0.5813193", "0.5796779", "0.57841295", "0.5764492", "0.5742572", ...
0.73079646
1
Write Long Integer to RAM
def write_long_integer(self, process_handle: int, address: int, value): self.__bufferSize = 8 is_write = self.__write_bytes(process_handle, address, value) return True if is_write else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_long(self, l):\n if not isinstance(l, six.integer_types):\n raise TypeError(\"expected an int, got %r\" % (type(l),))\n\n if not -2147483648 <= l <= 2147483647:\n raise OverflowError(\"Not in range, %d\" % l)\n\n self.write(self._packers[\"l\"].pack(l))", "def...
[ "0.6978887", "0.6569718", "0.6544994", "0.6524525", "0.6470489", "0.64520514", "0.6406458", "0.63829195", "0.6229732", "0.6182572", "0.617011", "0.61541975", "0.61541975", "0.6016069", "0.60110754", "0.59766585", "0.5974542", "0.5972365", "0.59481144", "0.59329474", "0.591877...
0.690406
1
Write Double to RAM
def write_double(self, process_handle: int, address: int, value): self.__bufferSize = 8 is_write = self.__write_bytes(process_handle, address, value) return True if is_write else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_double(self, d):\n if not isinstance(d, float):\n raise TypeError(\"expected a float, got %r\" % (type(d),))\n\n self.write(self._packers[\"d\"].pack(d))", "def write_double(self, f: float) -> None:\n self.write(STRUCT_DOUBLE.pack(f))", "def write_memory(self, address,...
[ "0.6733481", "0.65203", "0.6181993", "0.5956225", "0.5944526", "0.5870351", "0.58195794", "0.5721083", "0.5606261", "0.559216", "0.553943", "0.553408", "0.54819244", "0.545933", "0.54461956", "0.5419049", "0.5410827", "0.53655046", "0.5362042", "0.5362042", "0.5360366", "0....
0.67981523
0
Creates a new instance of the class extending Definition. After creation any dependencies defined in the class are looked up in mod_reg and added as fields to the newly created instance.
def _new_instance(cls: Type[T], mod_dir: str, home_dir: str, state_dir: str, mod_reg: Dict[str, "Definition"]) -> T: assert cls.name mod = cls(mod_dir, home_dir, state.load_state(state_dir, cls.name), logging.get_logger(cls.name)) for dep_name in cls.requi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _new_instance(self):\n return self.__class__(self._fmodule)", "def _new_instance(self):\n return self.__class__(self._fmodule)", "def __init__(self):\n \n cls = self.__class__\n \n # check if the class doesn't override mod_info\n if cls.mod_info == Mod.mod_i...
[ "0.66630805", "0.66630805", "0.6438465", "0.63896257", "0.6250889", "0.61951476", "0.6176598", "0.61626345", "0.61407685", "0.61407685", "0.60893005", "0.6053891", "0.6015417", "0.5839071", "0.5776912", "0.575494", "0.5753405", "0.56903225", "0.56891537", "0.5682703", "0.5663...
0.71358895
0
Filter mod_info for modules that are enabled on the current host.
def enabled_on_host() -> Callable[[Loader.ModInfo], bool]: def filter_fn(mod_info: Loader.ModInfo) -> bool: if len(mod_info.mod_def.hostnames) == 0: return True if HOSTNAME not in mod_info.mod_def.hostnames: _LOG.info( f"{mod_info.mod_def.name} is not enabled...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modules_enabled(self, c):\n\n modules = []\n for name, module in self.modules.iteritems():\n modules.append( (name, module.__class__.__name__) )\n\n return modules", "def enabled_modules(self):\n return [scomp for scomp in self.modules()\n if getattr(scom...
[ "0.62593675", "0.5974044", "0.5942882", "0.5807972", "0.5670104", "0.5630162", "0.544685", "0.5350841", "0.5337559", "0.5322708", "0.5253789", "0.52141494", "0.5195664", "0.5185848", "0.5140138", "0.5120659", "0.5107055", "0.5052914", "0.5033366", "0.50035936", "0.49902838", ...
0.64883715
0
Topologically sorts mod_infos by the module definitions list of required dependencies. Topological sort is done using Kahn's algorithm
def sort_by_dependencies( mod_infos: List[Loader.ModInfo]) -> List[Loader.ModInfo]: # First compile a list of module infos with no dependencies and a mapping # from modules with at least one dependency to their respective # dependencies. no_deps: List[Loader.ModInfo] = [] with_deps: Dict[str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dag_topology_sort(self):\n mlist = []\n mod_wrapper = self.mod_wrapper.copy()\n while mod_wrapper:\n temp_list = []\n for mod, wrapper in mod_wrapper.items():\n if wrapper.is_root_mod():\n temp_list.append(mod)\n wr...
[ "0.71461624", "0.64357716", "0.6193327", "0.6173135", "0.61355674", "0.604872", "0.6001152", "0.5978634", "0.5959674", "0.5802672", "0.57968855", "0.57469845", "0.5734828", "0.5680638", "0.5603417", "0.56024396", "0.5596359", "0.5579106", "0.5559897", "0.55554754", "0.5545035...
0.8192629
0
Compute Allan variance (AVAR). Consider an underlying measurement y(t). Our sensors output integrals of y(t) over successive time intervals of length dt. These measurements x(k dt) form the input to this function. Allan variance is defined for different averaging times tau = m dt as
def allan_variance(x, dt=1, min_cluster_size=1, min_cluster_count='auto', n_clusters=100, input_type="increment"): if input_type not in ('increment', 'mean'): raise ValueError("`input_type` must be either 'increment' or 'mean'.") x = np.asarray(x, dtype=float) n = x.shape[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allanvariance(data, dt=1):\n # 2008-07-30 10:20 IJC: Created\n # 2011-04-08 11:48 IJC: Moved to analysis.py\n\n newdata = array(data, subok=True, copy=True)\n dsh = newdata.shape\n\n newdata = newdata.ravel()\n\n nsh = newdata.shape\n\n alvar = zeros(nsh[0]-1, float)\n\n for lag in rang...
[ "0.77815217", "0.6229782", "0.6185854", "0.6170043", "0.601502", "0.5954434", "0.5937822", "0.5889841", "0.57054853", "0.56572413", "0.5547725", "0.550151", "0.5489578", "0.54802334", "0.5443163", "0.5424169", "0.5422288", "0.54091", "0.53961694", "0.5382453", "0.53801197", ...
0.6378373
1
Downloads a cookbook tar.gz, unzips it, and writes the directory structure to the zip file.
def download_cookbook(fileurl, download_dir): # download and save file to download_dir logger.info('Downloading cookbook: %s' % fileurl) # get filename tarname = fileurl.split('/')[-1].split('?')[0] tarfilepath = download_dir + tarname logger.info('Writing cookbook file to %s' % tarfilepath) with ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_and_unzip(url, zip_path, csv_path, data_folder):\n\n download_from_url(url, zip_path)\n\n unzip(zip_path, csv_path, data_folder)\n\n print('Done.')", "def _download_compressed_dir(self, tar_gz_path):\n self._log.debug(\"Downloading compressed directory at {!r}\".format(tar_gz_path))\n\n ...
[ "0.6516769", "0.6404197", "0.6369594", "0.620349", "0.62003124", "0.6194112", "0.61609334", "0.6144687", "0.6142736", "0.6118757", "0.6090507", "0.6075871", "0.6071649", "0.60694623", "0.60556203", "0.60411805", "0.6037752", "0.6025028", "0.60244155", "0.6015607", "0.60121644...
0.6953494
0
Search for all cookbooks matching search_term
def cookbook_search(search_term): return db.boxcar_cookbooks.find({'name': {'$regex':'^'+search_term}})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def book_search(self, term):\n\n try:\n cur = self._db.cursor()\n search = f'%{term.upper()}%'\n cur.execute('SELECT rowid, * FROM books WHERE UPPER(title) like ? OR UPPER(author) like ?', (search, search))\n return self._cursor_to_booklist(cur...
[ "0.72791237", "0.71715647", "0.69993097", "0.68785614", "0.66799706", "0.6646577", "0.6640332", "0.66243654", "0.65412086", "0.64594185", "0.64096427", "0.6388486", "0.63285005", "0.63256395", "0.6321836", "0.6234597", "0.62287444", "0.6206532", "0.61862636", "0.61501443", "0...
0.78580964
0
Search for a single cookbook of the specified name
def find_one_cookbook(name): return db.boxcar_cookbooks.find_one({'name': name})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookbook_search(search_term):\n return db.boxcar_cookbooks.find({'name': {'$regex':'^'+search_term}})", "def get_recipe_by_name(self, name):\n for key in self.recipe_list.keys():\n if name in self.get_recipes_by_types(key):\n for recipe in self.recipe_list[key]:\n ...
[ "0.7266315", "0.66256815", "0.6528147", "0.64047", "0.63835543", "0.61755985", "0.60229975", "0.59094644", "0.57915264", "0.573889", "0.56801695", "0.5435157", "0.5398273", "0.53891546", "0.5387135", "0.5348948", "0.5345011", "0.5339703", "0.52805656", "0.5240057", "0.5239863...
0.8132757
0
Check if credit limit for partner was exceeded.
def check_limit(self): self.ensure_one() partner = self.partner_id moveline_obj = self.env['account.move.line'] movelines = moveline_obj.\ search([('partner_id', '=', partner.id), ('account_id.user_type_id.type', 'in', ['receivable', 'p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_capacity_limit(self, res, amt, balance, meta, raven_vars, dispatch, t):\n cap = self.get_capacity(meta, raven_vars, dispatch, t)[0][self._capacity_var]\n try:\n if abs(balance[self._capacity_var]) > abs(cap):\n #ttttt\n # do the inverse problem: how much can we make?\n ba...
[ "0.7017334", "0.67190903", "0.6673682", "0.6619289", "0.6474647", "0.6447294", "0.6442348", "0.6328854", "0.6313708", "0.628994", "0.628804", "0.6241019", "0.6215823", "0.6123995", "0.61043304", "0.60935956", "0.6043182", "0.6026192", "0.6019101", "0.5975524", "0.5956821", ...
0.83692616
0
Extend to check credit limit before confirming sale order.
def action_confirm(self): for order in self: order.check_limit() return super(SaleOrder, self).action_confirm()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_limit(self):\n self.ensure_one()\n partner = self.partner_id\n moveline_obj = self.env['account.move.line']\n movelines = moveline_obj.\\\n search([('partner_id', '=', partner.id),\n ('account_id.user_type_id.type', 'in',\n ['re...
[ "0.7913511", "0.6271354", "0.61509377", "0.61213034", "0.59694165", "0.59436303", "0.59382004", "0.5932659", "0.5925501", "0.5905597", "0.5774578", "0.57630503", "0.5758884", "0.5758847", "0.57344717", "0.5730981", "0.57309234", "0.5721947", "0.5711063", "0.56954175", "0.5691...
0.7099402
1
This function will save microburst data to a CSV file.
def saveData(self, fPath=None): keys = ['dateTime', 'dos1rate', 'peak_std', 'Lm_OPQ', 'MLT_OPQ', 'lat', 'lon', 'alt', 'Dist_In_Track', 'Lag_In_Track', 'Dist_Total','Loss_Cone_Type', 'flag'] # headerl1 = ['Microburst catalogue created on {}'.format( # datetime.now())] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_microtrips(self):\n for data in self.microtrip_data:\n file_name = \"../data/microtrips/\" + data.file.name + \"_m\" + \".csv\"\n data.save_csv(file_name)", "def save(self, data, outpath):\n data.to_csv(outpath)", "def save_csv(self, filename): # DONE\n self....
[ "0.70688546", "0.6881139", "0.6879607", "0.67490184", "0.6713802", "0.666279", "0.66253996", "0.6521193", "0.6448808", "0.63529104", "0.62716025", "0.6208062", "0.61897266", "0.6178907", "0.61324775", "0.6119791", "0.6088917", "0.6062749", "0.6046528", "0.60461986", "0.600355...
0.71242034
0
This method calculates the autocorrelation of the counts array in the time range specified by tRange. times array is used to identify which counts to autocorrelate. The ax argument specified the subplot on which to plot the autocorrelation on.
def _autoCorrCounts(self, times, counts, tRange, norm=True): validIdt = np.where((counts != -1E31) & (times > tRange[0]) & (times < tRange[1]))[0] x = counts[validIdt] - counts[validIdt].mean() # mode=same means that some edge effects wil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_autocorrelation(self):\n fig, ax = plt.subplots()\n U = stats.nanmean(self.uf, axis=1)\n # correlate two 1d arrays\n # np.correlate(U, U, mode='full')[len(U) - 1:]\n # but we want to autocorrelate a 2d array over a given\n # axis\n N = U.shape[1]\n p...
[ "0.661664", "0.6439528", "0.60843444", "0.60580397", "0.59329104", "0.58847815", "0.583871", "0.576628", "0.5759394", "0.5759256", "0.56740904", "0.5664268", "0.56560445", "0.56214404", "0.5612409", "0.5610661", "0.56057805", "0.5589329", "0.5573851", "0.5513599", "0.55013096...
0.6516164
1
This method calculates the crosscorrelation of the counts array in the time range specified by tRange. times array is used to identify which counts to autocorrelate. This method also calculates the cross correlation of the two signals to determine if the micorbursts observed by both AC6 units are coincident. The ax arg...
def _crossCorrCounts(self, timesA, timesB, countsA, countsB, tRange, norm=True): validIdtA = np.where((countsA != -1E31) & (timesA > tRange[0]) & (timesA < tRange[1]))[0] x = countsA[validIdtA] - countsA[validIdtA].mean() validIdtB = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _autoCorrCounts(self, times, counts, tRange, norm=True):\n validIdt = np.where((counts != -1E31) & \n (times > tRange[0]) & \n (times < tRange[1]))[0]\n x = counts[validIdt] - counts[validIdt].mean()\n # mode=same means that some edge e...
[ "0.6614545", "0.6281476", "0.6077013", "0.6034651", "0.5968193", "0.5919165", "0.5915795", "0.57973635", "0.5676885", "0.5622812", "0.56201494", "0.55895126", "0.5481448", "0.5457837", "0.5448213", "0.54476875", "0.5436288", "0.543615", "0.53927565", "0.53915906", "0.5390924"...
0.6914292
0
Load the AC6 data.
def _loadData(self): self.d = read_ac_data.read_ac_data_wrapper(self.sc_id, self.date, dType='10Hz') return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self) -> None:", "def load_data(self):", "def load_data(self):\n if self.debug:\n print(\"Loading data\")", "def test_load_from_v6(self) -> None:\n self.save_new_valid_exploration(\n 'Exp1', 'user@example.com', end_state_name='End')\n collection = coll...
[ "0.60632014", "0.59163", "0.5692363", "0.5506359", "0.54695237", "0.53923327", "0.5391937", "0.5374051", "0.53720856", "0.53419524", "0.5327158", "0.52767026", "0.52273965", "0.5223794", "0.5223542", "0.5215916", "0.52092546", "0.5207547", "0.5191525", "0.5180599", "0.5178168...
0.654677
0
This function will look for periods of consecutive indicies of detections and find the peak for each period. The peak index array for the data is self.peakInd.
def _getPeaks(self, ch, validDataIdt): startInd, endInd = locate_consecutive_numbers.locateConsecutiveNumbers( self.burstIdt) # Find consecutive numbers to get a max of first self.peakInd = np.nan*np.ones(len(startInd), dtype=int) # Loop over every microburst detection region (consec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_peak(data):\n nonlocal last, ascent_dist, ascent_start\n if data > last:\n if ascent_start is None:\n ascent_start = last\n ascent_dist += 1\n else:\n if ascent_dist:\n peak = last\n ascent_dist = 0\n ...
[ "0.6640405", "0.6564305", "0.65567225", "0.654545", "0.64378893", "0.642369", "0.63958347", "0.62712115", "0.6269682", "0.6266941", "0.6174153", "0.6173894", "0.61729497", "0.61286587", "0.61276084", "0.6126366", "0.60827506", "0.60455763", "0.60307384", "0.6011327", "0.59966...
0.6901499
0
TMIN, TAVG, and TMAX for a list of dates.
def calc_temps(start_date, end_date): print("two dates\n") return session.query(func.min(Measurement.tobs), func.avg(Measurement.tobs), func.max(Measurement.tobs)).\ filter(Measurement.date >= start_date).filter(Measurement.date <= end_date).all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_time_means(val_list, time_list, t, start_month=1, err='std'):\n if len(time_list) != len(val_list):\n raise ValueError('val_list and time_list must have same length')\n # Arrays for outputs\n dates = []\n means = []\n errs = []\n year = np.min(time_list).year\n month = start_mo...
[ "0.6345828", "0.59785753", "0.595069", "0.5902184", "0.58804536", "0.5833137", "0.5816172", "0.57829845", "0.57284266", "0.56646013", "0.5582322", "0.5576219", "0.5570467", "0.5535141", "0.5529744", "0.5529462", "0.54203075", "0.54126215", "0.5412404", "0.5373379", "0.5356169...
0.6042569
1
Mark a song with score = 1000 Delete the file from Playlist
def markfile(self, song_id): cur = self.conn.cursor() query = """UPDATE caro_song SET score = -1000 WHERE id=%s""" cur.execute(query, (song_id, )) self.memcache.delete(":1:song_%d" % song_id) query = """DELETE FROM caro_playlistentry WHERE song_id=%s""" cur.execute(quer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_song(song):\n logging.debug('{CRUD_operations} BEGIN function delete_song()')\n logging.debug('{CRUD_operations} Data received: song: %s', song)\n song.is_deleted = True\n logging.debug('{CRUD_operations} END function delete_song()')", "def delete_song(self):\r\n song_id = tuple(inp...
[ "0.65513116", "0.6344058", "0.63115144", "0.61488205", "0.60956544", "0.60894954", "0.6069589", "0.6061151", "0.6005755", "0.5924812", "0.5891067", "0.58458006", "0.5767601", "0.5687184", "0.56593955", "0.5651815", "0.5644319", "0.55622435", "0.55598545", "0.5545439", "0.5534...
0.80521697
0
randomly returns 'm' or 'f'
def gender(): return random.choice((GENDER_FEMALE, GENDER_MALE))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name():\r\n return _random.choice([male_first(), female_first()])", "def choose_guard(self):\n\n\t\tg = randint(1, 3)\n\n\t\tif g == 1:\n\t\t\treturn 'h'\n\t\tif g == 2:\n\t\t\treturn 't'\n\t\tif g == 3:\n\t\t\treturn 'l'", "def get_random_male_name ():\n return db_random_pop_default(DB_FIRST_MALE, \...
[ "0.6963704", "0.69568205", "0.6864142", "0.6769605", "0.6755098", "0.6719579", "0.6704305", "0.66721994", "0.66479915", "0.6628899", "0.6628899", "0.6626261", "0.66160446", "0.6609609", "0.6583059", "0.65823984", "0.6559137", "0.6552863", "0.6538592", "0.65204793", "0.6515001...
0.71739215
0
create a VTIMEZONE object from a caldav data block
def __init__(self, data: str): # parsing notes: # required fields: tzid # optional fields: last-mod, tzurl, x-prop # # required blocks: standard or daylight (at least once) # required fields in block standard/daylight: dtstart, tzoffsetto, tzoffsetfrom ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n\t\tself.__c_version = c_singlezone(**kwargs)", "def decode_zone(obj, name):\n try:\n zone_obj = Zone([Card(c) for c in obj], name)\n except TypeError as e:\n raise GTREncodingError('Error decoding Zone: ' + e.message)\n\n return zone_obj", "def __init__ (s...
[ "0.5184043", "0.51366085", "0.51014906", "0.507741", "0.5037655", "0.49450675", "0.4804317", "0.47907048", "0.47804165", "0.47664854", "0.47210106", "0.47165537", "0.46668682", "0.46470034", "0.46281227", "0.46242642", "0.46223897", "0.4621646", "0.45555016", "0.4546735", "0....
0.7330531
0
Two packages with same filename should be equal
def test_equality(self): p1 = make_package(filename="foo") p2 = make_package(filename="foo") self.assertEqual(hash(p1), hash(p2)) self.assertEqual(p1, p2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_equal(self):\n p1 = make_package(filename=\"foobar\")\n p2 = make_package(filename=\"foo\")\n self.assertNotEqual(hash(p1), hash(p2))\n self.assertNotEqual(p1, p2)", "def test_multiple_packages_same_version(self):\n request = DummyRequest()\n request.access ...
[ "0.71986055", "0.63136137", "0.6229243", "0.61793065", "0.6143484", "0.6143484", "0.6143484", "0.6113326", "0.61121", "0.6060622", "0.6058038", "0.60573334", "0.6034512", "0.6006042", "0.59972495", "0.5978069", "0.5958835", "0.5921375", "0.5919401", "0.58932966", "0.5881119",...
0.7288239
0
Two packages with different filenames should not be equal
def test_not_equal(self): p1 = make_package(filename="foobar") p2 = make_package(filename="foo") self.assertNotEqual(hash(p1), hash(p2)) self.assertNotEqual(p1, p2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_equality(self):\n p1 = make_package(filename=\"foo\")\n p2 = make_package(filename=\"foo\")\n self.assertEqual(hash(p1), hash(p2))\n self.assertEqual(p1, p2)", "def test_IsPackage_files():\n with tempfile.NamedTemporaryFile() as f:\n assert not dpack._IsPackage(pathlib.Pa...
[ "0.721788", "0.64885724", "0.6443223", "0.6327845", "0.6313415", "0.6254438", "0.62533826", "0.6172888", "0.6132945", "0.6088958", "0.59762913", "0.59170675", "0.59131634", "0.5901148", "0.5895722", "0.58880514", "0.58856195", "0.58856195", "0.58856195", "0.5827569", "0.58022...
0.76380116
0
Uploading a package generates SHA256 and MD5 hashes
def test_upload_hash_generation(self): cache = DummyCache() pkg = cache.upload("a-1.tar.gz", BytesIO(b"test1234"), "a") self.assertEqual( pkg.data["hash_sha256"], "937e8d5fbb48bd4949536cd65b8d35c426b80d2f830c5c308e2cdec422ae2244", ) self.assertEqual(pkg.da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upload_prepend_hash(self):\n self.storage.prepend_hash = True\n package = make_package()\n data = StringIO()\n self.storage.upload(package, data)\n key = list(self.bucket.list())[0]\n\n pattern = r'^[0-9a-f]{4}/%s/%s$' % (re.escape(package.name),\n ...
[ "0.62484837", "0.5853526", "0.5780175", "0.57252145", "0.5716217", "0.5705437", "0.5700427", "0.56927264", "0.568528", "0.56655866", "0.56243956", "0.5618303", "0.5617467", "0.560571", "0.5599217", "0.5593012", "0.5587831", "0.55812234", "0.55801195", "0.55577385", "0.5551657...
0.7278852
0
If allow_delete=[], packages cannot be deleted
def test_no_delete(self): request = DummyRequest() request.access = DummyAccess(request) cache = DummyCache(request) request.access.allow_delete = [] pkg = make_package() with self.assertRaises(ValueError): cache.delete(pkg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_delete(self):\r\n return True", "def test_delete(self):\n self.request.access.allow_delete = [\"everyone\"]\n pkg = make_package(factory=SQLPackage)\n self.sql.add(pkg)\n transaction.commit()\n self.sql.add(pkg)\n self.db.delete(pkg)\n count = self....
[ "0.6490357", "0.64601755", "0.6455567", "0.64492196", "0.6326829", "0.6319609", "0.6257597", "0.6189358", "0.61655724", "0.60241777", "0.5932366", "0.5870834", "0.5808837", "0.5798392", "0.57893324", "0.57326317", "0.5730256", "0.5702716", "0.56959826", "0.56811345", "0.56779...
0.66625583
0
Don't reload the cache if it's not necessary
def test_no_reload_if_needed(self): cache = DummyCache() cache.reload_from_storage = MagicMock() cache.distinct = MagicMock() cache.distinct.return_value = ["hi"] cache.reload_if_needed() self.assertFalse(cache.reload_from_storage.called)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cached(self):\n return False", "def maybe_refresh(self, name=None):\n now = time.time()\n if self.last_load is None or (now - self.last_load) > self.tfs.cache_validity:\n self.load(name)", "def mark_if_cached(self, args):\n pass", "def reload_cache(self):\n ...
[ "0.71614826", "0.7092918", "0.70813805", "0.69887173", "0.69872105", "0.6943646", "0.6940279", "0.693159", "0.69176036", "0.69003165", "0.6895797", "0.68905365", "0.6876613", "0.6831341", "0.6824815", "0.6815882", "0.6813079", "0.68049896", "0.6743433", "0.66721517", "0.66212...
0.7300289
0
save() can store packages with unicode in the names
def test_save_unicode(self): pkg = make_package("mypackage™", factory=SQLPackage) self.db.save(pkg) count = self.sql.query(SQLPackage).count() self.assertEqual(count, 1) saved_pkg = self.sql.query(SQLPackage).first() self.assertEqual(saved_pkg, pkg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save_pkgs(self, *pkgs):\n for pkg in pkgs:\n self.engine.save(pkg)\n summary = PackageSummary(pkg)\n self.engine.save(summary, overwrite=True)", "def save_as_data_packages(path):\n\n logger.info(f'Saving as data packages at {path}')\n def f(row):\n packag...
[ "0.5931251", "0.5794059", "0.57553834", "0.5731187", "0.57028395", "0.5587278", "0.5544812", "0.54981047", "0.5447239", "0.5393025", "0.5386598", "0.5382567", "0.531384", "0.5301667", "0.52455693", "0.52381504", "0.5207928", "0.517478", "0.5152811", "0.5141345", "0.5124013", ...
0.7716409
0
reload_from_storage() inserts packages into the database
def test_reload(self): keys = [ make_package(factory=SQLPackage), make_package( "mypkg2", "1.3.4", "my/other/path", factory=SQLPackage, hash_md5="md5", hash_sha256="sha256", ), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reload(self):\n keys = [\n make_package(factory=SQLPackage),\n make_package(\"mypkg2\", \"1.3.4\", \"my/other/path\", factory=SQLPackage),\n ]\n self.storage.list.return_value = keys\n self.db.reload_from_storage()\n for pkg in keys:\n se...
[ "0.6807296", "0.66666466", "0.6007408", "0.59651184", "0.5937385", "0.5856151", "0.55851835", "0.5584457", "0.55680364", "0.55680364", "0.55680364", "0.55486923", "0.55486923", "0.5518602", "0.5455169", "0.5449565", "0.54419625", "0.5432723", "0.54300004", "0.5427746", "0.540...
0.7006676
0
fetch() retrieves a package from the database
def test_fetch(self): pkg = make_package(factory=SQLPackage) self.sql.add(pkg) saved_pkg = self.db.fetch(pkg.filename) self.assertEqual(saved_pkg, pkg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fetch(self):\n pkg = make_package()\n self.db.save(pkg)\n saved_pkg = self.db.fetch(pkg.filename)\n self.assertEqual(saved_pkg, pkg)", "def test_fetch(self):\n pkg = make_package(factory=DynamoPackage)\n self._save_pkgs(pkg)\n saved_pkg = self.db.fetch(pk...
[ "0.77681977", "0.76642436", "0.6594907", "0.6594907", "0.6594907", "0.65284604", "0.63306046", "0.61829334", "0.61411977", "0.6081578", "0.6049043", "0.60410875", "0.60410875", "0.59358525", "0.5873866", "0.58250237", "0.58231133", "0.58095026", "0.57333004", "0.5728252", "0....
0.7715148
1
Assert that a package exists in redis
def assert_in_redis(self, pkg): self.assertTrue(self.redis.sismember(self.db.redis_set, pkg.name)) data = self.redis.hgetall(self.db.redis_key(pkg.filename)) dt = pkg.last_modified lm = calendar.timegm(dt.utctimetuple()) + dt.microsecond / 1000000.0 lm_str = ("%.6f" % lm).rstrip(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_subversion_package_installed(host):\n assert host.package(PACKAGE).is_installed", "def test_72_packages(host, pkg):\n assert host.package(pkg).is_installed", "def test_azurecli_package_installed(host):\n assert host.package(PACKAGE).is_installed", "def test_is_package_installed(self, mock_r...
[ "0.6934081", "0.6924417", "0.66299754", "0.6493026", "0.6456694", "0.6321571", "0.62864304", "0.62710935", "0.62278736", "0.61834127", "0.61584306", "0.61579615", "0.61522186", "0.6134971", "0.6124497", "0.6056061", "0.6053051", "0.6052222", "0.60043275", "0.5990259", "0.5973...
0.7310376
0
reload_from_storage() inserts packages into the database
def test_reload(self): keys = [ make_package(factory=SQLPackage), make_package("mypkg2", "1.3.4", "my/other/path", factory=SQLPackage), ] self.storage.list.return_value = keys self.db.reload_from_storage() for pkg in keys: self.assert_in_redis(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reload(self):\n keys = [\n make_package(factory=SQLPackage),\n make_package(\n \"mypkg2\",\n \"1.3.4\",\n \"my/other/path\",\n factory=SQLPackage,\n hash_md5=\"md5\",\n hash_sha256=\"sha2...
[ "0.7005225", "0.66653717", "0.600818", "0.59671783", "0.59358585", "0.5855708", "0.5586571", "0.5582626", "0.556691", "0.556691", "0.556691", "0.55463755", "0.55463755", "0.55172724", "0.5454357", "0.5451549", "0.54415125", "0.54324967", "0.5429829", "0.5429193", "0.54062206"...
0.6805712
1
fetch() retrieves a package from the database
def test_fetch(self): pkg = make_package() self.db.save(pkg) saved_pkg = self.db.fetch(pkg.filename) self.assertEqual(saved_pkg, pkg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fetch(self):\n pkg = make_package(factory=SQLPackage)\n self.sql.add(pkg)\n saved_pkg = self.db.fetch(pkg.filename)\n self.assertEqual(saved_pkg, pkg)", "def test_fetch(self):\n pkg = make_package(factory=DynamoPackage)\n self._save_pkgs(pkg)\n saved_pkg ...
[ "0.7715148", "0.76642436", "0.6594907", "0.6594907", "0.6594907", "0.65284604", "0.63306046", "0.61829334", "0.61411977", "0.6081578", "0.6049043", "0.60410875", "0.60410875", "0.59358525", "0.5873866", "0.58250237", "0.58231133", "0.58095026", "0.57333004", "0.5728252", "0.5...
0.77681977
0
fetch() returns None if no package exists
def test_fetch_missing(self): saved_pkg = self.db.fetch("missing_pkg-1.2.tar.gz") self.assertIsNone(saved_pkg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_package(self, package_name):\n\t\t\t\n\t\t\tpackage_root_url = urlparse.urljoin(self.packages_root_url,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpackage_name + \"/\")\n\t\t\t\n\t\t\tpackage_info_url = urlparse.urljoin(package_root_url, \"info\")\n\t\t\tpackage_archive_url = urlparse.urljoin(package_root_url, \"archi...
[ "0.6841072", "0.67000926", "0.66926116", "0.6597814", "0.6547767", "0.6434574", "0.64287364", "0.62104625", "0.6064177", "0.5982968", "0.59753776", "0.5958001", "0.5895387", "0.5870588", "0.5860548", "0.58389133", "0.5822474", "0.5799762", "0.57829195", "0.57777876", "0.57693...
0.73527503
1
Can upload multiple packages that have the same version
def test_multiple_packages_same_version(self): with patch.object(self.request.access, "allow_overwrite", []): name, version = "a", "1" path1 = "old_package_path-1.tar.gz" self.db.upload(path1, BytesIO(b"test1234"), name, version) path2 = "new_path-1.whl" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multiple_packages_same_version(self):\n request = DummyRequest()\n request.access = DummyAccess(request)\n cache = DummyCache(request)\n request.access.allow_overwrite = []\n name, version = \"a\", \"1\"\n path1 = \"old_package_path-1.tar.gz\"\n cache.uploa...
[ "0.71966016", "0.6126126", "0.6103652", "0.60980034", "0.60938525", "0.6091341", "0.6082932", "0.5858274", "0.5816589", "0.57428926", "0.57245314", "0.56891763", "0.5637761", "0.5536747", "0.55115604", "0.5509517", "0.549662", "0.5485993", "0.54698163", "0.5434405", "0.543175...
0.764577
1
reload_from_storage() doesn't break on packages with None summary
def test_reload_none_summary(self): pkg = make_package( "mypkg3", "1.2", "some/other/path", summary=None, factory=SQLPackage ) keys = [pkg] self.storage.list.return_value = keys self.db.reload_from_storage() # The shim will convert None summary to "" p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reload(self):\n keys = [\n make_package(factory=SQLPackage),\n make_package(\n \"mypkg2\",\n \"1.3.4\",\n \"my/other/path\",\n factory=SQLPackage,\n hash_md5=\"md5\",\n hash_sha256=\"sha2...
[ "0.6402811", "0.62282103", "0.61236465", "0.60962933", "0.5989792", "0.5803124", "0.57837903", "0.57631075", "0.57631075", "0.5665015", "0.5651823", "0.5642191", "0.5568245", "0.551319", "0.54255974", "0.5408669", "0.5347922", "0.5310908", "0.53005844", "0.529438", "0.5281935...
0.7729607
0
fetch() returns None if no package exists
def test_fetch_missing(self): saved_pkg = self.db.fetch("missing_pkg-1.2.tar.gz") self.assertIsNone(saved_pkg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_package(self, package_name):\n\t\t\t\n\t\t\tpackage_root_url = urlparse.urljoin(self.packages_root_url,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpackage_name + \"/\")\n\t\t\t\n\t\t\tpackage_info_url = urlparse.urljoin(package_root_url, \"info\")\n\t\t\tpackage_archive_url = urlparse.urljoin(package_root_url, \"archi...
[ "0.6841072", "0.67000926", "0.66926116", "0.6597814", "0.6547767", "0.6434574", "0.64287364", "0.62104625", "0.6064177", "0.5982968", "0.59753776", "0.5958001", "0.5895387", "0.5870588", "0.5860548", "0.58389133", "0.5822474", "0.5799762", "0.57829195", "0.57777876", "0.57693...
0.73527503
0
all() returns all versions of a package
def test_all_versions(self): pkgs = [ make_package(factory=DynamoPackage), make_package(version="1.3", filename="mypath3", factory=DynamoPackage), make_package("mypkg2", "1.3.4", "my/other/path", factory=DynamoPackage), ] self._save_pkgs(*pkgs) saved_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_versions(cls) -> list[str]:\n\n s = run([cls.command, \"install\", \"-l\"])\n versions = s.split()\n\n return list(filter(cls._is_python_version, versions))", "def list_package(all: bool = False) -> List[List[str]]:\n if not all:\n pkgs_info = read_installation_records(...
[ "0.717854", "0.696309", "0.6916211", "0.68950415", "0.68423796", "0.6829205", "0.6755086", "0.6545546", "0.6498525", "0.6406439", "0.63651323", "0.6318197", "0.6294569", "0.62841994", "0.62509996", "0.6247027", "0.6237215", "0.6169527", "0.6168053", "0.6163518", "0.6115892", ...
0.70585597
1
distinct() returns all unique package names
def test_distinct(self): pkgs = [ make_package(factory=DynamoPackage), make_package(version="1.3", filename="mypath3", factory=DynamoPackage), make_package("mypkg2", "1.3.4", "my/other/path", factory=DynamoPackage), ] self._save_pkgs(*pkgs) saved_pkgs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_packages():\n\n packages = find_packages()\n packages = ['{}.{}'.format('uniq', package) for package in packages]\n packages.append('uniq')\n return packages", "def test_distinct(self):\n pkgs = [\n make_package(factory=SQLPackage),\n make_package(version=\"1.3\",...
[ "0.73910946", "0.72039706", "0.7160833", "0.636343", "0.6134391", "0.60275495", "0.60188", "0.5997735", "0.59974086", "0.5962981", "0.5940934", "0.5940207", "0.5934591", "0.59199566", "0.58889276", "0.58124715", "0.58024675", "0.5769506", "0.5720157", "0.5686013", "0.56856835...
0.72898066
1
Can upload multiple packages that have the same version
def test_multiple_packages_same_version(self): with patch.object(self.request.access, "allow_overwrite", []): name, version = "a", "1" path1 = "old_package_path-1.tar.gz" self.db.upload(path1, BytesIO(b"test1234"), name, version) path2 = "new_path-1.whl" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multiple_packages_same_version(self):\n request = DummyRequest()\n request.access = DummyAccess(request)\n cache = DummyCache(request)\n request.access.allow_overwrite = []\n name, version = \"a\", \"1\"\n path1 = \"old_package_path-1.tar.gz\"\n cache.uploa...
[ "0.7196442", "0.61255217", "0.61043423", "0.6099664", "0.60938144", "0.6092737", "0.60841924", "0.5857378", "0.5818061", "0.57452154", "0.57256395", "0.5691203", "0.56372887", "0.5537358", "0.5511155", "0.55096114", "0.5498683", "0.54872787", "0.546868", "0.54370767", "0.5432...
0.7645613
0
Calling clear_all will keep same table throughput
def test_clear_all_keep_throughput(self): throughput = {} for model in (DynamoPackage, PackageSummary): tablename = model.meta_.ddb_tablename(self.engine.namespace) desc = self.dynamo.describe_table(tablename) self.dynamo.update_table(desc.name, Throughput(7, 7)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteAll():\n _table.deleteAll()\n _initialiseGlobals()\n\n return", "def flush(self):\n self.table = []", "def clear_tables(self):\n for table in self.modified_tables:\n self.api.do_table_clear(table)\n self.modified_tables = []", "def remove_all():\n \"\...
[ "0.73763025", "0.72920036", "0.7195111", "0.7004636", "0.6977167", "0.69601184", "0.6958541", "0.6949839", "0.6910979", "0.6881586", "0.6842338", "0.682759", "0.6827083", "0.67934114", "0.6769874", "0.6764047", "0.6752019", "0.6714772", "0.6650677", "0.6617581", "0.6610839", ...
0.77589965
0
upload() saves package even when there is no summary
def test_upload_no_summary(self): pkg = make_package(factory=DynamoPackage) self.db.upload( pkg.filename, BytesIO(b"test1234"), pkg.name, pkg.version, summary="" ) count = self.engine.scan(DynamoPackage).count() self.assertEqual(count, 1) saved_pkg = self.engi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_package(self, __contents):\n raise NotImplementedError", "def test_upload(self):\n pkg = make_package(factory=SQLPackage)\n content = BytesIO(b\"test1234\")\n self.db.upload(pkg.filename, content, pkg.name, pkg.version)\n count = self.sql.query(SQLPackage).count()\n ...
[ "0.75582093", "0.652778", "0.6510554", "0.6490564", "0.63053066", "0.61908734", "0.61849767", "0.6156637", "0.6149053", "0.61228496", "0.6098898", "0.6089424", "0.604158", "0.60039645", "0.5974472", "0.59176534", "0.5875046", "0.5840688", "0.58405584", "0.58125734", "0.579092...
0.75371444
1
Returns all the files in the given path which matches the extension
def get_files(path, extension): extension = listify(extension) return [p for p in path.ls() if p.suffix in extension and "(" not in p.stem]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_files(path, extension):\n matches = []\n for root, dirnames, filenames in os.walk(path):\n for filename in fnmatch.filter(filenames, extension):\n matches.append(os.path.join(root, filename))\n return matches", "def findFiles(path, ext='txt'):\n if not os.path.exists(path):...
[ "0.8473555", "0.8358024", "0.82955307", "0.8249992", "0.8165438", "0.80491453", "0.79155713", "0.78752804", "0.78646743", "0.781289", "0.78089064", "0.7808255", "0.77932817", "0.7784879", "0.77192956", "0.7589907", "0.758737", "0.7579747", "0.75113535", "0.750457", "0.7477634...
0.87833667
0
Returns a list of paths of all label files.
def get_label_files(path, ext=".txt"): return get_files(path, ext)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_file_paths_labels(data_root: str) -> list:\n\n speaker_dirs = os.listdir(data_root)\n all_files = []\n i = 0\n for d in speaker_dirs:\n files = glob.iglob(data_root + '/' + d + '/**/*.wav', recursive=True)\n files = [[f, i] for f in files]\n ...
[ "0.7681277", "0.74249905", "0.742166", "0.73119056", "0.72976214", "0.7211796", "0.7121309", "0.69645387", "0.68985945", "0.689014", "0.68764573", "0.67646277", "0.6759799", "0.671353", "0.6682471", "0.6668028", "0.665166", "0.66508526", "0.65965366", "0.65963733", "0.6588633...
0.7458727
1
Gets a label from a given image path
def get_label(img_path): img_name = img_path.stem label_name = img_name + ".txt" label_path = img_path.parent / label_name with open(label_path) as f: label = json.load(f) return label
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_label(client, label):\n image_name = get_image_name()\n image = client.images.get(image_name)\n try:\n return image.labels[label]\n except KeyError:\n raise Exception(f\"Image should have a label '{label}'\")", "def get_label(image, model):\n x = Variable(image, volatile=True...
[ "0.8130192", "0.7271338", "0.72610754", "0.72576123", "0.71734583", "0.7101198", "0.7082114", "0.707369", "0.7006125", "0.6975027", "0.6914926", "0.6888219", "0.6779321", "0.66797745", "0.66453075", "0.66104287", "0.653919", "0.6511472", "0.65014905", "0.6453433", "0.64453256...
0.85277015
0
Creates a label df with all labels concatenated.
def create_label_df(path): image_files = get_images(path) labels = [get_label(p) for p in image_files] label_df = pd.DataFrame(labels) label_df.fillna(" ", inplace=True) return label_df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_labels(self, labels):\n self.labels = pd.DataFrame(labels, index=[\"label\"]).T", "def add_label_counts(labels_df):\n # ---------------------------------------------------------------------\n # label count: count total number of occurences of a label in all label sources\n projects = ['f...
[ "0.6601174", "0.64376587", "0.62578154", "0.6249624", "0.6200135", "0.6038482", "0.599989", "0.59783006", "0.59754735", "0.5972586", "0.5940923", "0.5933921", "0.5933152", "0.5904", "0.58979785", "0.5895999", "0.58786684", "0.58408", "0.5820154", "0.5800604", "0.5785483", "...
0.6924985
0
Project managers can replace completion status of the project
def update_project_status(project_id): completion_status = request.get_json()['completion_status'] project = Project.query.filter_by(id=project_id).first() if not project: return { 'success': False, 'message': f"No project with the specified id {project_id} found.", }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repo_refresh_for_unfinished():\n project_list = Project.objects()\n crawl_list = []\n for repo in project_list:\n if repo.analyser_progress != \"100%\":\n crawl_list.append(repo.project_name)\n analyser.add_repos(current_user.username, crawl_list)\n flash('Refresh for unfinishe...
[ "0.63556254", "0.6097139", "0.6097139", "0.6010299", "0.6010299", "0.6010299", "0.59843576", "0.59797865", "0.5946904", "0.5905803", "0.58927155", "0.5876474", "0.5854564", "0.5852657", "0.583997", "0.58357406", "0.5791279", "0.5755392", "0.57458824", "0.5745145", "0.57081807...
0.64196265
0
Get list of tasks associated with a project
def get_tasks_list(project_id): project = Project.query.filter_by(id=project_id).first() if not project: return { 'success': False, 'message': f"No project with the specified id {project_id} found.", } else: permission = has_project_permission(project, g.user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tasks_of_project(self, project_id):\n res = self.conn.cursor().execute(\"SELECT * FROM tasks WHERE project_id=? ORDER BY project_order\", (project_id,))\n return res.fetchall()", "def getProjectTasks(self, pid, archived=False):\n return self.request(Endpoints.PROJECTS + '/{0}'.format...
[ "0.8217871", "0.7975788", "0.75386", "0.7525342", "0.7506066", "0.74947053", "0.7418993", "0.7322707", "0.7289081", "0.7264354", "0.72270566", "0.7187831", "0.71321934", "0.711599", "0.7102491", "0.7091863", "0.7089866", "0.70818645", "0.7079432", "0.70347834", "0.7004059", ...
0.8169617
1
User with permissions can replace completion status of task if it exists and is part of the project
def update_task_status(project_id, task_id): completion_status = request.get_json()['completion_status'] project = Project.query.filter_by(id=project_id).first() if not project: return { 'success': False, 'message': f"No project with the specified id {project_id} found.", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_status():\n pass", "def upload_priviledge(request):\n try:\n check = UserProfile.objects.filter(contributor = 1)\n uncheck = UserProfile.objects.filter(contributor = 0)\n \n i = UserProfile.objects.filter(contributor=1).count()\n k = UserProfile.objects.filter(contri...
[ "0.61753845", "0.60224724", "0.60031533", "0.5881787", "0.5879694", "0.5829092", "0.5815816", "0.5802099", "0.5792718", "0.57676065", "0.57620394", "0.5757087", "0.574239", "0.5696005", "0.56877255", "0.5670999", "0.56441444", "0.56272525", "0.5616785", "0.56102926", "0.56081...
0.62761444
0
Inherit receive_voucher method to create journal entry when the operation is treasury feeding
def receive_voucher(self, cr, uid, ids, context=None): super(account_voucher, self).receive_voucher(cr, uid, ids, context=context) if self.browse(cr, uid, ids, context=context)[0].operation_type == 'treasury': self.action_move_line_create(cr, uid, ids, context=context) return self.wr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ticket_created(self, ticket):", "def on_submit(self):\n\n\t\tfor accounting_entry in self.get('accounting_entries'):\n\t\t\tledger_entry_doc = frappe.get_doc({\n\t\t\t\t'doctype': 'Ledger Entry',\n\t\t\t\t'posting_date': self.posting_date,\n\t\t\t\t'account': accounting_entry.account,\n\t\t\t\t'debit': accou...
[ "0.6029652", "0.5823393", "0.57141507", "0.5677925", "0.56722486", "0.5605178", "0.55741674", "0.5452405", "0.5438415", "0.5426153", "0.53734416", "0.5366408", "0.5342838", "0.53389865", "0.5308819", "0.5275973", "0.5271341", "0.52083504", "0.51759064", "0.51672345", "0.51516...
0.6805315
0
Returns the edit distance of x to y, where x and y are two strings. The edit distance is the minimum number of operations, among insertion, deletion and substitution, that we need to turn x into y. If return_matrix = True, the matrix used to calculate the edit distance is returned, instead of the edit distance. This al...
def min_edit_distance(x: str, y: str, return_matrix: bool = False) -> object: m = _get_edit_distance_matrix(x, y) for i in range(1, len(x) + 1): for j in range(1, len(y) + 1): # How do we obtain the m[i][j] value? # We need to look at three positions while iterating: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_distance(x, y):\n\n global recursion_depth\n global num_function_calls\n recursion_depth += 1\n num_function_calls += 1\n indent = \" \" * recursion_depth\n print(\"%sBEGIN edit_distance(\\\"%s\\\", \\\"%s\\\")\" % (indent, x, y))\n n = len(x)\n m = len(y)\n if n == 0:\n ...
[ "0.72378236", "0.68309796", "0.6778071", "0.6751621", "0.6589623", "0.6551195", "0.6455476", "0.6449539", "0.64448684", "0.6433347", "0.6388333", "0.6365304", "0.6345468", "0.63007766", "0.61905324", "0.61462915", "0.6144506", "0.61297476", "0.60540056", "0.60415614", "0.6036...
0.80208546
0
Returns a tuple whose first item is the minimum edit distance, and the second item is a list of lists containing the instructions (in the "language of coordinates") to convert a string to another.
def extended_min_edit_distance(x: str, y: str) -> tuple: m = _get_edit_distance_matrix(x, y) o = _get_coordinates_matrix(x, y) for i in range(1, len(x) + 1): for j in range(1, len(y) + 1): coordinates = (i - 1, j - 1) if x[i - 1] == y[j - 1]: m[i][j] = m[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_distance(str1, str2):\r\n pass", "def build_min_edit_instructions(x: str, y: str, o: list) -> list:\n\n instructions = [] # List for the instructions.\n\n c = (len(x), len(y)) # Initial coordinates for o.\n\n while c != (0, 0):\n # 3 cases:\n # 1. Go diagonally (to the left) ...
[ "0.59002924", "0.5818325", "0.58050925", "0.5697112", "0.5696955", "0.56715965", "0.5608784", "0.56067246", "0.5575531", "0.54917693", "0.54911697", "0.5451414", "0.5377977", "0.5371696", "0.53555745", "0.53307635", "0.5321868", "0.53198034", "0.5303609", "0.5267929", "0.5261...
0.5924839
0
Interprets the coordinates o (returned as second item of the tuple returned by extended_min_edit_distance) and creates a comprehensible list of instructions. The indices mentioned in the instructions are with respect to the original strings x and y and not with respect to the strings after having applied an modificatio...
def build_min_edit_instructions(x: str, y: str, o: list) -> list: instructions = [] # List for the instructions. c = (len(x), len(y)) # Initial coordinates for o. while c != (0, 0): # 3 cases: # 1. Go diagonally (to the left) => replace, if characters are different # 2. Go left ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extended_min_edit_distance(x: str, y: str) -> tuple:\n m = _get_edit_distance_matrix(x, y)\n\n o = _get_coordinates_matrix(x, y)\n\n for i in range(1, len(x) + 1):\n\n for j in range(1, len(y) + 1):\n\n coordinates = (i - 1, j - 1)\n\n if x[i - 1] == y[j - 1]:\n ...
[ "0.6467284", "0.5889748", "0.5710616", "0.5507128", "0.53792125", "0.5310419", "0.5272096", "0.52095956", "0.5205697", "0.5166738", "0.5116879", "0.50985277", "0.50777525", "0.50473917", "0.5031812", "0.5012823", "0.5010603", "0.5003589", "0.49800825", "0.49780247", "0.496098...
0.805715
0
Userfriendly approach which lets the user manually select the area corresponding to the verticle line. If not correctly selected the first time, the user can redo this procedure. Close plots manually to continue in the procedure. Type Y for 'yes' or N for 'no' when deciding if the area is good.
def select_vert(img): # Local variable which breaks loop if area of interest is selected well OK = False # Main while-loop while OK == False: # Plot image fig, ax = plt.subplots(figsize=(10, 10)) ax.imshow(img, cmap="gray") # Let user specify points coord = np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_select_treatment_area(self):\n self.txt_shoulder.hide()\n self.txt_arm.hide()\n self.txt_thigh.hide()\n self.line_shoulder.hide()\n self.line_arm.hide()\n self.line_thigh.hide()", "def OnMouseOut( self, event ):\n self.whichChoice = 0\n event.conte...
[ "0.55472", "0.55037045", "0.54417837", "0.5397977", "0.53612226", "0.5340556", "0.5328645", "0.5273989", "0.5273989", "0.5203098", "0.51560444", "0.51241", "0.51219076", "0.5109118", "0.5108845", "0.5095289", "0.5091633", "0.50630957", "0.5059883", "0.50550723", "0.50508314",...
0.6410726
0
Configure celery instance using config from Flask app
def configure_celery(app: Flask) -> Celery: TaskBase = celery_holder.celery.Task class ContextTask(TaskBase): abstract = True def __call__(self, *args, **kwargs): with app.app_context(): return TaskBase.__call__(self, *args, **kwargs) celery_holder.celery.conf....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_celery(config_name):\n app = Flask(__name__)\n\n # apply configuration\n cfg = os.path.join(os.getcwd(), 'config', config_name + '.py')\n app.config.from_pyfile(cfg)\n\n # Initialize aws client\n aws_client = boto3.Session(\n aws_access_key_id=app.config['AWS_ACCESS_KEY'],\n ...
[ "0.77063173", "0.75819045", "0.7530678", "0.7459084", "0.7273119", "0.7219687", "0.71717805", "0.71142334", "0.695116", "0.6718956", "0.66823643", "0.6564181", "0.65242624", "0.62319493", "0.6199454", "0.61328864", "0.6120141", "0.6090478", "0.6005244", "0.5987801", "0.587524...
0.858661
0
Builds the computation graph of the mask head of Feature Pyramid Network.
def fpn_mask_graph(rois, feature_maps, image_meta, pool_size, num_classes, train_bn=True): # ROI Pooling # Shape: [batch, boxes, pool_height, pool_width, channels] x = modellib.PyramidROIAlign([pool_size, pool_size], name="roi_align_mask")([rois, image_meta] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_fpn_mask_graph(rois, feature_maps, image_meta,\n pool_size, num_classes, train_bn=True):\n # ROI Pooling\n # Shape: [batch, boxes, pool_height, pool_width, channels]\n x = PyramidROIAlign([pool_size, pool_size],\n name=\"roi_align_mask\")([rois, ima...
[ "0.70537764", "0.63258725", "0.63258725", "0.61573416", "0.61179805", "0.6080467", "0.6060265", "0.6056162", "0.60199755", "0.59952897", "0.5957809", "0.5887339", "0.58784956", "0.58744246", "0.5869617", "0.5815184", "0.5795823", "0.5788427", "0.5768547", "0.57574487", "0.575...
0.64246434
1
Sets model layers as trainable if their names match the given regular expression.
def set_trainable(self, layer_regex, keras_model=None, indent=0, verbose=0): # Print message on the first call (but not on recursive calls) if verbose > 0 and keras_model is None: modellib.log("Selecting layers to train") keras_model = keras_model or self.keras_model # In m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_trainable(self, layer_regex, keras_model=None, indent=0, verbose=1):\n # Print message on the first call (but not on recursive calls)\n if verbose > 0 and keras_model is None:\n log(\"Selecting layers to train\")\n\n keras_model = keras_model or self.keras_model\n\n #...
[ "0.7040944", "0.7010938", "0.6323237", "0.63104945", "0.59898615", "0.59447974", "0.5602651", "0.5426624", "0.5401681", "0.538814", "0.5264683", "0.52443", "0.5213373", "0.51864445", "0.51501006", "0.50745326", "0.5071175", "0.50471604", "0.50219536", "0.5000034", "0.4999891"...
0.71956694
0
Sets the model log directory and epoch counter.
def set_log_dir(self, model_path=None): # Set date and epoch counter as if starting a new model self.epoch = 0 # now = datetime.datetime.now() # # # If we have a model path with date and epochs use them # if model_path: # # Continue from we left of. Get epoch and dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_log_dir(self, model_path=None):\n # Set date and epoch counter as if starting a new model\n self.epoch = 0\n now = datetime.datetime.now()\n\n # If we have a model path with date and epochs use them\n if model_path:\n # Continue from we left of. Get epoch and d...
[ "0.8340662", "0.82427096", "0.8216617", "0.69299877", "0.6209155", "0.61991924", "0.61920685", "0.61835784", "0.6142625", "0.6124378", "0.6124006", "0.61115265", "0.6072062", "0.6066884", "0.60577244", "0.60125613", "0.598763", "0.59855914", "0.59802425", "0.59746325", "0.595...
0.8334618
1
Process the new or edit office forms
def office_edit_process_view(request): status = '' success = True # admin, analytics_admin, partner_organization, political_data_manager, political_data_viewer, verified_volunteer authority_required = {'verified_volunteer'} if not voter_has_authority(request, authority_required): return redi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def office_create(request, slug):\n #verifies if the company exists if not returns a 404 page\n company =get_object_or_404(Company,slug=slug)\n edit = validate_user_company_access_or_redirect(request,company)\n #if the request is GET presents empty form\n if request.method == 'GET':\n\n offic...
[ "0.65139395", "0.6487149", "0.6185686", "0.6144711", "0.60302484", "0.5803553", "0.5786804", "0.57757664", "0.57180357", "0.5691069", "0.55917436", "0.558072", "0.5578744", "0.55752146", "0.5531387", "0.55180806", "0.55093175", "0.549522", "0.5483268", "0.54766715", "0.544637...
0.6624268
0
Called on task startup to copy all static resources into the output path (and to make sure the output path exists as a directory).
def setup_output_path(self): self.logger.info('setting up output path') try: self.output_path.mkdir() except FileExistsError: pass try: (self.output_path / 'simple').mkdir() except FileExistsError: pass for filename in resou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_static(self, outdir):\n pass", "def copy_static_resources(self):\n if not hasattr(settings, 'STATIC_ROOT'):\n raise MissingStaticRoot()\n destination = os.path.join(STORAGE_PATH, 'static')\n if os.path.exists(destination):\n shutil.rmtree(destination)\n ...
[ "0.77394503", "0.7600356", "0.6926869", "0.6820733", "0.6785674", "0.6785608", "0.6746367", "0.65858966", "0.65577996", "0.6496821", "0.6481917", "0.6263674", "0.61868364", "0.61790466", "0.61160195", "0.6110984", "0.60765094", "0.6062903", "0.6055576", "0.6050808", "0.602480...
0.7670651
1
Handle incoming requests to (re)build index files. These will be in the form of "HOME", a request to write the homepage with some associated statistics, or "PKG", a request to write the index for the specified package.
def handle_index(self, queue): msg, *args = queue.recv_pyobj() if msg == 'PKG': package = args[0] if package not in self.package_cache: self.package_cache.add(package) self.write_root_index() self.write_package_index(package, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_root_index(self):\n self.logger.info('writing package index')\n temp_dir = self.output_path / 'simple'\n with tempfile.NamedTemporaryFile(mode='w', dir=str(temp_dir),\n encoding='utf-8',\n delete=False) a...
[ "0.6072376", "0.59161943", "0.5912372", "0.5844684", "0.58258736", "0.58107734", "0.5639663", "0.55557406", "0.54828745", "0.5466139", "0.5445653", "0.5366465", "0.5359489", "0.5355283", "0.5319221", "0.5296515", "0.52074337", "0.5156442", "0.5136858", "0.51300204", "0.512995...
0.7049984
0
(Re)writes the index of all packages. This is implicitly called when a request to write a package index is received for a package not present in the task's cache.
def write_root_index(self): self.logger.info('writing package index') temp_dir = self.output_path / 'simple' with tempfile.NamedTemporaryFile(mode='w', dir=str(temp_dir), encoding='utf-8', delete=False) as index: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rebuild_index(self):\n from django.core.management import call_command\n call_command('rebuild_index', interactive=False, verbosity=0)", "def updateIndex(ix, pool_path):\n \n logger.debug('updating search index')\n writer = ix.writer()\n \n exercise_list = [f.name for f in os.sc...
[ "0.6794511", "0.6569954", "0.65582806", "0.65071815", "0.6454542", "0.642781", "0.62335306", "0.6226423", "0.6206927", "0.61409336", "0.6128224", "0.6067755", "0.6067755", "0.6058486", "0.6013691", "0.60030484", "0.59971786", "0.5969887", "0.59236366", "0.5873569", "0.5845069...
0.7205941
0
(Re)writes the index of the specified package. The file metadata (including the hash) is retrieved from the database, never from the filesystem.
def write_package_index(self, package, files): self.logger.info('writing index for %s', package) pkg_dir = self.output_path / 'simple' / package mkdir_override_symlink(pkg_dir) with tempfile.NamedTemporaryFile(mode='w', dir=str(pkg_dir), encoding=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_root_index(self):\n self.logger.info('writing package index')\n temp_dir = self.output_path / 'simple'\n with tempfile.NamedTemporaryFile(mode='w', dir=str(temp_dir),\n encoding='utf-8',\n delete=False) a...
[ "0.6997369", "0.6264878", "0.6230651", "0.60717297", "0.6042983", "0.6042155", "0.60356575", "0.59532493", "0.59532493", "0.5952769", "0.5850773", "0.5839971", "0.5826849", "0.5805045", "0.5797951", "0.57742566", "0.5764337", "0.5759863", "0.5757269", "0.57194316", "0.5701246...
0.7133477
0
A simple worker loop tutorial, where a person goes to an assigned office during work time and goes back home after work.
def simple_worker_loop() -> None: print('\nSimple worker loop tutorial', flush=True) # the first thing to do at the start of any experiment is to initialize a few global parameters # these parameters are shared across the entire repo ps.init_globals( seed=0, # if None, the experiment is not se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main() -> None:\n worker = Worker()\n worker.do_work()", "def run_worker(self):\n\n # exec(open('restarter.py').read())\n # sys.exit()\n self.update_session_state()\n currentTime = QTime().currentTime()\n fromTime = QTime(int(self.settings.TECHFROMHOUR), int(self.sett...
[ "0.6303065", "0.61887157", "0.6119434", "0.609201", "0.5847591", "0.58374554", "0.58043665", "0.5719119", "0.5713537", "0.5688086", "0.56838995", "0.56798404", "0.5606069", "0.560276", "0.55847", "0.5574085", "0.55657315", "0.5554054", "0.55216855", "0.55083454", "0.5506641",...
0.70773005
0
Returns a PREMIS valid hash function name, if possible.
def convert_to_premis_hash_function(hash_type): if hash_type.lower().startswith("sha") and "-" not in hash_type: hash_type = "SHA-" + hash_type.upper()[3:] elif hash_type.lower() == "md5": return "MD5" return hash_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_function_key(fn):\n return hashlib.md5(fn.func_code.co_code).hexdigest()", "def _function_sig_key(name: str, *args: Any, **kwargs: Any) -> int:\n function_sig = name\n for arg in args:\n function_sig += str(arg)\n for _, value in kwargs.items():\n function_sig += str(value)...
[ "0.66541505", "0.66076416", "0.65569323", "0.6499355", "0.6462295", "0.64203614", "0.638321", "0.6263362", "0.6210296", "0.6168451", "0.6134635", "0.6111885", "0.6081206", "0.6046545", "0.6041833", "0.6017602", "0.6017602", "0.5976814", "0.59592223", "0.59416676", "0.59413165...
0.7343964
0
get a list of the the formatted events related to the file
def list_file_events(file_obj_events): ret = [] for event in file_obj_events: ret.append(format_file_event(event)) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_events(file_obj):\n file_events = file_obj.event_set.all()\n return file_events", "def events(self):\n return get_tsv(self.path, self.values, 'events.tsv')", "def file_events(self):\n return self._file_events", "def read(cls, event_file, regex=regex):\n with open(event...
[ "0.6945467", "0.68493074", "0.6757438", "0.65512663", "0.647044", "0.6456969", "0.6431299", "0.6402945", "0.6382251", "0.63623226", "0.6338081", "0.6285148", "0.6093697", "0.6050992", "0.60133076", "0.5990272", "0.59856236", "0.59660107", "0.59591275", "0.5939103", "0.5908682...
0.76860726
0
gets all events linked to a file_object
def get_file_events(file_obj): file_events = file_obj.event_set.all() return file_events
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_file_events(file_obj_events):\n\n ret = []\n for event in file_obj_events:\n ret.append(format_file_event(event))\n return ret", "def file_events(self):\n return self._file_events", "def get_events(self):\n\n print \"\\ngetting new Events\"\n path = os.path.join(se...
[ "0.76239884", "0.72182584", "0.6120225", "0.6075563", "0.59999406", "0.59407324", "0.5918491", "0.5851653", "0.58487296", "0.5846607", "0.584488", "0.5776906", "0.5775421", "0.57627344", "0.5746324", "0.56975585", "0.56643677", "0.56583166", "0.56568396", "0.5634918", "0.5634...
0.8561063
0
maps the normalization event info, and therefore splits the event_detail to display the tool name and the tool version separately
def map_file_normalization_info(file_normalization_event): event_info = {} if not file_normalization_event: return try: event_info.update( { "premis:outcome": file_normalization_event.event_outcome_detail, } ) if file_normalization_even...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_file_validation_info(file_validation_event):\n event_info = {}\n if not file_validation_event:\n return\n try:\n event_info.update(\n {\n \"premis:outcome\": file_validation_event.event_outcome_detail,\n \"prov:softwareAgent\": file_validation...
[ "0.65614873", "0.6268047", "0.5862656", "0.5489602", "0.5350454", "0.52793896", "0.5253923", "0.5160849", "0.50771683", "0.5073524", "0.50472724", "0.50194335", "0.4990838", "0.49535462", "0.49394515", "0.48982656", "0.4864565", "0.486448", "0.48361394", "0.48343584", "0.4830...
0.7267318
0
gets all events from the type virus_check
def get_virusscan_events(file_events): virusscan_events = file_events.filter(event_type="virus check") if virusscan_events: return virusscan_events
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all(self):\r\n return list(pecan.request.storage_conn.get_event_types())", "def get_events() -> list[Event]:\n g.ledger.changed()\n return [e for e in g.filtered.entries if isinstance(e, Event)]", "def get_events(self):\n self._events = []\n self.ircobj.process_once(timeout=0...
[ "0.63607806", "0.58471835", "0.5819439", "0.5816538", "0.58113927", "0.58003557", "0.5785132", "0.5784336", "0.578308", "0.57225883", "0.57221717", "0.5695665", "0.56645083", "0.55595946", "0.55595946", "0.55592936", "0.5546411", "0.5522073", "0.5522073", "0.54979116", "0.549...
0.72586447
0
maps the validation event info, and therefore splits the event_detail to display the tool name and the tool version separately
def map_file_validation_info(file_validation_event): event_info = {} if not file_validation_event: return try: event_info.update( { "premis:outcome": file_validation_event.event_outcome_detail, "prov:softwareAgent": file_validation_event.event_deta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_file_format_info(file_format_event, file_validation_event):\n event_info = {}\n if not file_format_event:\n return\n try:\n event_info.update(\n {\n \"dct:FileFormat\": file_format_event.event_outcome_detail,\n \"prov:softwareAgent\": file_for...
[ "0.6742715", "0.61438614", "0.5372289", "0.5349182", "0.5309553", "0.52051926", "0.5093518", "0.5081945", "0.49995312", "0.49678308", "0.4956184", "0.49480337", "0.48884967", "0.48879263", "0.48558927", "0.48491517", "0.4832293", "0.48005238", "0.47813728", "0.47797647", "0.4...
0.75312114
0
maps info regarding the file format and therefore uses the file_format_event to get the id, tool and tool_version of the used tool, and takes the outcome_detail of the validation event to get the name of the file format, if the file has those events linked.
def map_file_format_info(file_format_event, file_validation_event): event_info = {} if not file_format_event: return try: event_info.update( { "dct:FileFormat": file_format_event.event_outcome_detail, "prov:softwareAgent": file_format_event.event_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_file_validation_info(file_validation_event):\n event_info = {}\n if not file_validation_event:\n return\n try:\n event_info.update(\n {\n \"premis:outcome\": file_validation_event.event_outcome_detail,\n \"prov:softwareAgent\": file_validation...
[ "0.7225926", "0.66014904", "0.62202483", "0.6051946", "0.58100253", "0.56802005", "0.56800455", "0.5560679", "0.54779977", "0.5443689", "0.5421021", "0.53728986", "0.53687453", "0.53450334", "0.5339682", "0.5317839", "0.5283682", "0.52812934", "0.5249191", "0.52461636", "0.52...
0.824023
0
uses the name cleanup_event to get the first part of the event_outcome as original file name
def get_original_file_name(cleanup_event): original_name = None if not cleanup_event: return try: original_name = cleanup_event.event_outcome_detail.split(";")[0] except IndexError: logger.info( "name and version of the file format tool %s could not be" "d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_name_cleanup(file_events):\n cleanup_event = file_events.filter(event_type=\"name cleanup\").first()\n if cleanup_event:\n return cleanup_event", "def get_sanitized_file_name(cleanup_event):\n sanitized_name = None\n if not cleanup_event:\n return\n try:\n sanitiz...
[ "0.7763713", "0.7252744", "0.61244434", "0.60504305", "0.5674285", "0.5595301", "0.5591282", "0.55478466", "0.5542216", "0.5515983", "0.5455788", "0.5410433", "0.5405495", "0.53931946", "0.5390997", "0.5367019", "0.53666896", "0.53636366", "0.5339203", "0.53355193", "0.531356...
0.7813742
0
uses the name cleanup_event to get the second part of the event_outcome as sanitized file name
def get_sanitized_file_name(cleanup_event): sanitized_name = None if not cleanup_event: return try: sanitized_name = cleanup_event.event_outcome_detail.split(";")[1] except IndexError: logger.info( "name and version of the virus check tool %s could not be" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_name_cleanup(file_events):\n cleanup_event = file_events.filter(event_type=\"name cleanup\").first()\n if cleanup_event:\n return cleanup_event", "def get_original_file_name(cleanup_event):\n original_name = None\n if not cleanup_event:\n return\n try:\n original_...
[ "0.779782", "0.738654", "0.58494496", "0.57917094", "0.57624686", "0.5737705", "0.5598119", "0.55943274", "0.55774605", "0.5506891", "0.548149", "0.5477749", "0.54703015", "0.54598963", "0.54485", "0.54481256", "0.5405872", "0.5405509", "0.5393709", "0.53931856", "0.5384876",...
0.7791005
1
get all virus_check_events which failed and get the information of the event and the file_id from the files which failed the virus_check
def get_failed_virus_checks(file_events): virus_check_events = get_virusscan_events(file_events) if not virus_check_events: return for event in virus_check_events: if event.event_outcome != "Pass": try: failed_file = { "premis:identifier": even...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_passed_virus_checks(file_events):\n virus_check_events = get_virusscan_events(file_events)\n if not virus_check_events:\n return\n for event in virus_check_events:\n if event.event_outcome == \"Pass\":\n try:\n passed_event = {\n \"premis:...
[ "0.7037156", "0.6773092", "0.58044827", "0.56824124", "0.55182916", "0.5506397", "0.54874086", "0.5348977", "0.53265375", "0.5307501", "0.5303932", "0.5303932", "0.5273958", "0.5255364", "0.52527535", "0.5216588", "0.5209719", "0.5194858", "0.5168988", "0.51503533", "0.51414"...
0.79492867
0
get and return all virus_check_events which passed
def get_passed_virus_checks(file_events): virus_check_events = get_virusscan_events(file_events) if not virus_check_events: return for event in virus_check_events: if event.event_outcome == "Pass": try: passed_event = { "premis:outcome": event....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_virusscan_events(file_events):\n virusscan_events = file_events.filter(event_type=\"virus check\")\n if virusscan_events:\n return virusscan_events", "def get_events(self):\n ret = []\n while True:\n event = self.event.get_event(wait=1, full=True)\n if eve...
[ "0.7644736", "0.66425484", "0.6552635", "0.6500239", "0.6301848", "0.62276447", "0.6164383", "0.6035749", "0.60337937", "0.5993986", "0.596327", "0.5959023", "0.59463876", "0.59462994", "0.5944266", "0.5944266", "0.5924022", "0.5924022", "0.5885887", "0.5857111", "0.58524805"...
0.6770501
1
does the mapping of the file_object and returns the file_obj as dict
def map_file_data(file_obj, file_events): file_as_dict = { "premis:originalName": file_obj.currentlocation, "original_name": escape(file_obj.originallocation), # needs investigation "sanitized_file_name": get_sanitized_file_name( get_file_name_cleanup(file_events) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fileobject_to_dict(fo):\n if fo.allocated():\n # proc = subprocess.Popen(['./extract_strings', fo.inode()], stdout=subprocess.PIPE)\n # contents = proc.stdout.read()\n return {\n 'atime_dt': epoch_to_dt(fo.atime()),\n 'compressed_b': fo.compressed(),\n '...
[ "0.7471708", "0.6875288", "0.685313", "0.6438057", "0.625583", "0.62365437", "0.62274283", "0.6191611", "0.6160291", "0.6127357", "0.6083918", "0.60666394", "0.60020196", "0.59979707", "0.5992356", "0.59894216", "0.59645075", "0.5962417", "0.5958333", "0.58898216", "0.5880217...
0.79688126
0
Find the command using a Pip VCS backend.
def get_vcs_command(vcs_type): try: return pip_vcs.get_backend(vcs_type)().cmd except BadCommand: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_command(vcs_name):\n\n try:\n return [vcs['cmd'] for vcs in get_vcs_settings() if vcs.get('name') == vcs_name][0]\n except IndexError:\n return None", "def get_command(pid):", "def get_command(self, ctx, cmd_name):\n path = \"%s.%s\" % (__name__, cmd_name)\n path ...
[ "0.60336435", "0.5905804", "0.5887258", "0.57998616", "0.57792455", "0.56713223", "0.563673", "0.55427724", "0.551555", "0.5410901", "0.5404135", "0.54030824", "0.5381162", "0.53678364", "0.5361021", "0.5346396", "0.5342507", "0.5309934", "0.530921", "0.52939373", "0.52939373...
0.67878574
0
When an area in the main canvas is clicked, mouse() returns the click's location in terms of the data dimensions if the click was within the plot region. This location is passed to model by updateTrackClick(), which finds the nearest track/vertex to the click and updates the track data accordingly. Data from the update...
def click(self, event): try: x_loc, y_loc = self.appWindow.spec_cv.mouse(event) trackNo, updated_track = self.model.updateTrackClick(x_loc, y_loc,\ self.x_high) self.appWindow.spec_cv.updateTrack(trackNo, update...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drag(self, event):\n if event.button:\n try:\n x_loc, y_loc = self.appWindow.spec_cv.mouse(event)\n print(x_loc, y_loc)\n trackNo, updated_track =\\\n self.model.updateTrackDrag(x_loc, y_loc,\\\n ...
[ "0.6058535", "0.5994052", "0.58561856", "0.57993245", "0.5710567", "0.5700471", "0.569974", "0.5697816", "0.56608105", "0.5551457", "0.55488133", "0.554185", "0.55417347", "0.55244434", "0.55154103", "0.55042386", "0.5499609", "0.54935616", "0.54893976", "0.546768", "0.544527...
0.6938923
0
Uses self stress and family context to incur in probability of becoming violent
def trigger_violence(self): # First time offender get registered in the system and changes category into an Aggressor and a Victim if self.assaulted == 0: if self.stress > self.random.random(): self.category = 'aggressor' self.assaulted += 1 se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_td_self_energy_active(self):\n self.distribute_workload()\n self.self_energy_T = self.sum_qpt_function('get_td_self_energy_active')", "def sing(self):\n if self._energy < self._sing_cost:\n return\n\n self._energy = self._energy - self._sing_cost\n self._...
[ "0.5673091", "0.5671478", "0.5643265", "0.5633148", "0.5629966", "0.5571182", "0.5550801", "0.5532556", "0.54866314", "0.5474761", "0.5474262", "0.5450669", "0.54457366", "0.5436073", "0.54114723", "0.5410417", "0.5398809", "0.5379679", "0.5364702", "0.53609514", "0.53539217"...
0.60149026
0
Get a list of available gpu devices (formatted as strings). Returns A list of available GPU devices.
def _get_available_gpus(): global _LOCAL_DEVICES if _LOCAL_DEVICES is None: if _is_tf_1(): devices = get_session().list_devices() _LOCAL_DEVICES = [x.name for x in devices] else: _LOCAL_DEVICES = tf.config.experimental_list_devices() return [x for x in _LO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_gpu_names() -> Sequence[str]:\n result = []\n for device in device_lib.list_local_devices():\n if device.device_type != \"GPU\":\n continue\n desc = device.physical_device_desc\n\n fields = desc.split(\",\")\n for field in fields:\n name, value = fie...
[ "0.7635497", "0.7591881", "0.75787866", "0.7576536", "0.7576536", "0.75703716", "0.7540326", "0.74637085", "0.74631166", "0.73232", "0.7317866", "0.7153969", "0.715106", "0.7149406", "0.7134455", "0.7124889", "0.700968", "0.69798607", "0.69466555", "0.6936653", "0.687559", ...
0.76762456
0
Load faces into an array (N, M), where N is the number of face images and d is the dimensionality (heightwidth for greyscale).
def load_faces(path, ext=".pgm"): # # You code here # images = [] img_shape = (0, 0) for root, dirs, files in os.walk(path): for file in files: if ext in file: # check if file is of pgm-type img_path = os.path.join(root, file) img = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _open_images(training_filenames, path):\n imagePaths=[os.path.join(path,f) for f in training_filenames]\n faces=[]\n for i, imagePath in enumerate(imagePaths):\n faceImg=Image.open(imagePath).convert('L')\n faceNp=np.array(faceImg,'uint8')\n faces.append(faceNp)\n return faces"...
[ "0.65888363", "0.6099295", "0.6054895", "0.6036122", "0.5994611", "0.5958421", "0.58676267", "0.58492595", "0.5841656", "0.58148503", "0.57781494", "0.57710123", "0.57406574", "0.5714294", "0.5692881", "0.5690731", "0.5687985", "0.56691706", "0.5647786", "0.5619585", "0.56161...
0.6499972
1