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
Finds and returns budget stored in the dictionary.
def get_budget(self, category: BudgetCategory) -> Budget: return self.budgets.get(category, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def budget(self):\n return self._budget", "def get_budget_by_name(self, budget_name):\n return next((budget for budget in self.budgets\n if budget.name.lower() == budget_name.lower()), None)", "def getBudget(movieInfo):\n if \"budget\" in movieInfo:\n return int(movi...
[ "0.644745", "0.6405999", "0.62401956", "0.60685647", "0.6040692", "0.5716305", "0.5598385", "0.5519935", "0.5446943", "0.54325116", "0.54259604", "0.5413207", "0.535384", "0.53050965", "0.5295184", "0.5284351", "0.5279604", "0.5254645", "0.5236342", "0.52344924", "0.5230984",...
0.64537567
0
Returns budgets stored in the dictionary as a list.
def get_budgets(self) -> list: return list(self.budgets.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_budgets(self) -> list:\n return self.budget_manager.get_budgets()", "def view_budgets(self) -> None:\n Menu.prompt_view_budgets()\n for budget in self.user.budget_manager:\n print(f\"{budget}\\n\")", "def get_expenses(budget):\n return sum(expense['bgt'] for expense i...
[ "0.74353254", "0.6164198", "0.6107933", "0.6100253", "0.58037996", "0.5798786", "0.57337105", "0.5695821", "0.56689733", "0.566745", "0.56575996", "0.5653672", "0.5653672", "0.5638305", "0.56300706", "0.5625624", "0.5610835", "0.5596588", "0.5596588", "0.5596588", "0.5596588"...
0.8426276
0
Counts and returns the number of locked budgets.
def no_locked_budgets(self) -> int: count = 0 for budget in self.budgets.values(): if budget.locked: count += 1 return count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outstanding(self):\n return sum(\n transfer.lock.amount\n for transfer in self.locked.values()\n )", "def budget_used(self):\n return int(self.total_spent() / self.budget() * 100.0)", "def count_total(self):\n\t\twith self._c_lock: # I can't believe I implemented ...
[ "0.64319116", "0.59869766", "0.5931925", "0.5908128", "0.5878541", "0.58729374", "0.58525044", "0.5819347", "0.58104414", "0.57775193", "0.5762641", "0.5753774", "0.57415694", "0.57415694", "0.57394975", "0.57261735", "0.57024676", "0.5688358", "0.5645157", "0.563684", "0.562...
0.85815716
0
Creates and returns a budget from user input for the given budget category.
def create_budget(budget_category: BudgetCategory) -> Budget: amount = -1 while amount <= 0: amount = float(input(f'Enter {budget_category.value} budget: ')) if amount <= 0: print('Budget amount must be greater than 0! Please enter ' 'again!'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_budget(self, category: BudgetCategory) -> Budget:\n return self.budgets.get(category, None)", "def execute_budgets_menu() -> BudgetCategory:\n categories = list(BudgetCategory)\n no_budgets = len(categories)\n choice = -1\n print('Select a budget category:')\n wh...
[ "0.6900647", "0.683713", "0.6413041", "0.62244904", "0.6032063", "0.5851567", "0.58220255", "0.57313067", "0.5693593", "0.55933374", "0.54202634", "0.54114354", "0.5408077", "0.5401938", "0.53535455", "0.5352132", "0.53383446", "0.5330315", "0.5309922", "0.5308046", "0.528334...
0.85561347
0
Presents the budget menu for the user to select and returns the budget category that user chooses.
def execute_budgets_menu() -> BudgetCategory: categories = list(BudgetCategory) no_budgets = len(categories) choice = -1 print('Select a budget category:') while choice < 1 or choice > no_budgets: for idx, category in enumerate(categories): print(f' {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category_choice(self):\n self.leave_category_choice = 1\n while self.leave_category_choice:\n print(fr.FR[15])\n for element in config.CATEGORIES:\n print(str(config.CATEGORIES.index(element)+1)\n + \" : \" + element)\n self.cat...
[ "0.65938395", "0.6233436", "0.6190896", "0.61505425", "0.6138054", "0.604541", "0.5960599", "0.5843633", "0.5817664", "0.5801775", "0.5791902", "0.5737235", "0.57300234", "0.56732094", "0.56335896", "0.56010336", "0.55867344", "0.55579084", "0.55082554", "0.5506753", "0.54915...
0.8198939
0
Sets up and returns a BudgetManager with each budget of amount $100.
def load_test_budget_manager(cls) -> BudgetManager: manager = BudgetManager() for category in list(BudgetCategory): budget = Budget(category, 100) manager.add_budget(budget) return manager
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_budget_manager(cls) -> BudgetManager:\n manager = BudgetManager()\n for category in list(BudgetCategory):\n budget = cls.create_budget(category)\n manager.add_budget(budget)\n return manager", "def __init__(self, bank_account_no: str, bank_name: str,\n ...
[ "0.7738722", "0.6067128", "0.5915157", "0.5754487", "0.57359993", "0.5603405", "0.5476045", "0.5440444", "0.5365476", "0.52967113", "0.52317", "0.5221079", "0.52009493", "0.5193181", "0.5189404", "0.51420105", "0.5124656", "0.5121084", "0.5118158", "0.508111", "0.50754696", ...
0.77666306
0
Looks for the best match between the tuple of the sandbox and all Europe tuples.
def correlate_sandbox(self, tuple_sb, tuple_eur, plot=False) -> tuple: # Initialize parameters with extreme values cost_best = 10000 position_best = -1 # Initialize solution vector if plot: cost_all = [] # Extract parameters from tuple R_sb, theta_sb = tuple_sb R_eur, theta_eur =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_best_offer(\n self, all_offers: List[Tuple[str, Dict]]\n ) -> Tuple[List, float]:\n bests, best_gain = [], 0\n\n for partner, offers in all_offers:\n partial_asgt = self._neighbors_values.copy()\n current_partner = self._neighbor_var(partner)\n\n #...
[ "0.5896853", "0.5688851", "0.5675493", "0.5655122", "0.5638799", "0.5624046", "0.55762094", "0.5547533", "0.54540485", "0.54252297", "0.5417066", "0.53604704", "0.5357901", "0.5335932", "0.5335924", "0.5314372", "0.5297954", "0.5288686", "0.52860814", "0.5281672", "0.52807474...
0.60800743
0
Raise an exception if all apps haven't been imported yet.
def check_apps_ready(self): if not self.apps_ready: raise RuntimeError("Apps aren't loaded yet.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import_app(self):\n dirs.attempt_app_import(\"mediabrute\")\n with self.assertRaises(ImproperlyConfigured):\n dirs.attempt_app_import(\"NONONONONO\")", "def _load_installed_applications(self):\n for application in self.settings.get('apps', None) or []:\n path =...
[ "0.63963807", "0.63125914", "0.6118928", "0.6049964", "0.59116197", "0.5881896", "0.5864091", "0.58242136", "0.5800848", "0.57961357", "0.5771751", "0.574039", "0.5713385", "0.57008845", "0.56540954", "0.56355935", "0.55529803", "0.55522925", "0.5543512", "0.55320776", "0.552...
0.7175082
0
Raise an exception if all models haven't been imported yet.
def check_models_ready(self): if not self.models_ready: raise RuntimeError("Models aren't loaded yet.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_all():\n\n # count the number of files loaded\n count = 0\n\n # get model name\n model_name_list = [model for data_models in settings.OBJECT_DATA_MODELS\n for model in data_models]\n\n model_name_list += [model for model in settings.OTHER_DATA_MODELS]\n\n # import...
[ "0.6702693", "0.6597641", "0.63824916", "0.6288562", "0.61351323", "0.605479", "0.60163903", "0.5974453", "0.5934281", "0.5840787", "0.57924795", "0.57813746", "0.57655495", "0.5670896", "0.5662005", "0.565143", "0.56474614", "0.5552075", "0.553675", "0.55349326", "0.55294484...
0.70884115
0
Import applications and returns an app config for the given label. Raise LookupError if no application exists with this label.
def get_app_config(self, app_label): self.check_apps_ready() try: return self.app_configs[app_label] except KeyError: message = "No installed app with label '%s'." % app_label for app_config in self.get_app_configs(): if app_config.name == app_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_app(self, app_label, emptyOK=False):\n self._populate()\n imp.acquire_lock()\n try:\n app_name = extract_app_name(app_label)\n if app_name is None:\n raise ImproperlyConfigured('App with label %s could not be '\n 'found' % app_lab...
[ "0.6948026", "0.60602397", "0.5971664", "0.5592162", "0.5575013", "0.5373725", "0.5323228", "0.53103024", "0.52559143", "0.52429235", "0.5188659", "0.51339275", "0.51230484", "0.51016665", "0.5075056", "0.5073376", "0.50494814", "0.5046278", "0.5040093", "0.49333227", "0.4921...
0.7493551
0
Test packet generation and fake send.
def test_generate_and_send(mock_sr): # mock send packets mock_sr.return_value = fake_sr_return() # init generator netprobify = NetProbify() netprobify.instantiate_generator() # generate packets TARGET.generate_packets(GROUP, netprobify.id_gen) assert len(TARGET.packets) == 10 asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_send(self):\n msg_flag = self.instance.send(self.msg_short)\n assert(msg_flag)\n msg_flag, msg_recv = self.driver.recv(self.timeout)\n assert(msg_flag)\n nt.assert_equal(msg_recv, self.msg_short)", "def test_send_network(self) :\n symbol = 'A' \n oProtoc...
[ "0.6892069", "0.66339993", "0.649775", "0.6465824", "0.6439808", "0.6425743", "0.63774353", "0.63420707", "0.63226706", "0.6289918", "0.62796855", "0.62690765", "0.62690526", "0.625604", "0.624448", "0.62306184", "0.61947006", "0.61494166", "0.6146559", "0.6113945", "0.604760...
0.7693772
0
Returns an HTTP response object that redirects to the supplied URL with the supplied query parameters applied.
def HttpResponseRedirectWithQuery(redirect_uri, query_params): nq = "?" for pname in query_params.keys(): if query_params[pname]: redirect_uri += nq + pname + "=" + quote(query_params[pname]) nq = "&" return HttpResponseRedirect(redirect_uri)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_to():\n\n args_dict = request.args.items()\n args = CaseInsensitiveDict(args_dict)\n\n # We need to build the response manually and convert to UTF-8 to prevent\n # werkzeug from \"fixing\" the URL. This endpoint should set the Location\n # header to the exact string supplied.\n respo...
[ "0.6659504", "0.64636075", "0.63889945", "0.63879377", "0.610228", "0.60225797", "0.60220236", "0.6000811", "0.59948146", "0.5985534", "0.58978784", "0.5849514", "0.58246356", "0.5768415", "0.5704956", "0.5704761", "0.57001656", "0.56676114", "0.5625186", "0.5616323", "0.5571...
0.66205907
1
Return True if this URL is an exact superset of the URL provided by `other`.
def is_exact_superset_of(self, other): # If this is a string of some kind, convert it to a URL. if isinstance(other, (six.text_type, six.binary_type)): other = self.__class__(other) # Type check! if not hasattr(other, 'qs') or not hasattr(other, 'uri'): raise Typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_strict_superset(self, other):\n return self.is_superset(other) and self != other", "def is_superset(self, other):\n \n for element in other:\n if element not in self:\n return False\n\n return True", "def is_superset(self, other):\n if isinsta...
[ "0.71028805", "0.69356734", "0.68522155", "0.68476844", "0.65793014", "0.6502486", "0.63076425", "0.6304706", "0.6214503", "0.6210435", "0.62005806", "0.61623186", "0.61595505", "0.6034027", "0.60209525", "0.59925973", "0.59876674", "0.59673166", "0.59448874", "0.5917174", "0...
0.82324034
0
Redirects to mean_time_weekday page.
def mean_time(): return render_template('mean_time_weekday.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n today = datetime.date.today()\n return HttpResponseRedirect(\"%s/newsletter/%d/%d/%d/\" % (SUBSITE, today.year, today.month, today.day))", "def mainpage():\n return render_template('presence_weekday.html')", "def mainpage(name=None):\n if not name:\n return redirect(url_...
[ "0.62515265", "0.6238297", "0.5995797", "0.5972302", "0.5677064", "0.5641092", "0.55807924", "0.5452718", "0.5416457", "0.53435457", "0.5311708", "0.5308008", "0.5263703", "0.52506274", "0.52275354", "0.52275354", "0.52275354", "0.52263916", "0.5193816", "0.5187562", "0.51827...
0.6704054
0
Redirects to presence_start_end page.
def start_end(): return render_template('presence_start_end.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_page():\n if not _home:\n abort(404)\n return redirect(_home)", "def start_page():\n if not _home:\n abort(404)\n return redirect(_home)", "def toLanding():\n return redirect(url_for('landingurl'))", "def get(self, request):\n return redirect('start:home')", "d...
[ "0.5971557", "0.5971557", "0.5943474", "0.57099074", "0.57099074", "0.57099074", "0.55752295", "0.5566747", "0.5566221", "0.55043846", "0.54831034", "0.5478961", "0.5430729", "0.5429293", "0.5403134", "0.5393614", "0.53604597", "0.52630067", "0.52586526", "0.5183116", "0.5173...
0.666048
0
Returns mean presence time of given user grouped by weekday.
def mean_time_weekday_view(user_id): #import pdb; pdb.set_trace() data = get_data() if user_id not in data: log.debug('User %s not found!', user_id) return [] weekdays = group_by_weekday(data[user_id]) result = [(calendar.day_abbr[weekday], mean(intervals)) for weekday...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_time_weekday_view(user_id=None):\n data = get_data()\n if not user_id:\n raise abort(400)\n\n if user_id not in data:\n log.debug('User %s not found!', user_id)\n return []\n\n weekdays = group_by_weekday(data[user_id])\n result = [(calendar.day_abbr[weekday], mean(inte...
[ "0.7820907", "0.6851208", "0.6848811", "0.6119349", "0.6025002", "0.5929798", "0.5753107", "0.5695754", "0.5610047", "0.5583093", "0.5531452", "0.5494475", "0.547884", "0.53997254", "0.53785306", "0.5343953", "0.5343953", "0.53423256", "0.53400195", "0.52665937", "0.5253249",...
0.7910484
0
Returns total presence time of given user grouped by weekday.
def presence_weekday_view(user_id): data = get_data() if user_id not in data: log.debug('User %s not found!', user_id) return [] weekdays = group_by_weekday(data[user_id]) result = [(calendar.day_abbr[weekday], sum(intervals)) for weekday, intervals in weekdays.items()] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def presence_weekday_view(user_id=None):\n data = get_data()\n if not user_id:\n raise abort(400)\n\n if user_id not in data:\n log.debug('User %s not found!', user_id)\n return []\n\n weekdays = group_by_weekday(data[user_id])\n result = [(calendar.day_abbr[weekday], sum(interv...
[ "0.7513305", "0.666141", "0.6574399", "0.64891076", "0.5944046", "0.59074956", "0.58471644", "0.5814486", "0.57856905", "0.5762274", "0.5762274", "0.5672877", "0.5672623", "0.5629637", "0.54893243", "0.5468925", "0.54269946", "0.540859", "0.54045403", "0.5379421", "0.5338772"...
0.75307816
0
Returns history of the Image.
def history(self) -> List[Dict[str, Any]]: response = self.client.get(f"/images/{self.id}/history") body = response.json() if response.status_code == 200: return body if response.status_code == 404: raise ImageNotFound(body["cause"], response=response, explanat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dohistory(self, *args, **kwargs):\n return _image.image_dohistory(self, *args, **kwargs)", "def history():", "def history(self):\n return self.info['history']", "def get_history(self):\n return self.history", "def history(self):\n return self.board.history", "def history(s...
[ "0.82483864", "0.7789621", "0.7495005", "0.7354837", "0.7303717", "0.7291426", "0.7291426", "0.72496754", "0.72476786", "0.7220276", "0.7191091", "0.71893007", "0.71339124", "0.7076902", "0.6949881", "0.68829805", "0.68773735", "0.68484914", "0.68127704", "0.68097353", "0.678...
0.83448565
0
Getter function returns user id against the specified email.
def get_id(self, email): query = self._db.User.select(self._db.User.c.email == email) query = query.with_only_columns([self._db.User.c.id_, ]) record = query.execute().fetchone() return record[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_id(email):\n try:\n user = session.query(User).filter_by(email=email).one()\n return user.id\n except:\n return None", "def getUserID(email):\r\n try:\r\n session = DBSession()\r\n return session.query(User).filter_by(email=email).one().id\r\n except:\r...
[ "0.81937325", "0.8104995", "0.80850965", "0.8067864", "0.8065274", "0.80627054", "0.80515283", "0.7991437", "0.7979025", "0.7979025", "0.794362", "0.7879122", "0.7856898", "0.7781442", "0.7704244", "0.7685305", "0.7562969", "0.7524555", "0.7518592", "0.7483379", "0.74065524",...
0.84576696
0
Update account information against the specified user id.
def update_account_with(self, id_, **kwargs): self.update_user_with(id_, **kwargs) self.update_profile_with(id_, **kwargs) # TODO: # self.update_prefecture_with(id_, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_user(id):\n pass", "def update_user(self):\n self.client.force_authenticate(user=self.user)\n self.response = self.client.patch(\n reverse(\n 'edit_account',kwargs={ 'pk': self.user.id}),\n self.updated_data, format='json'\n )\n s...
[ "0.7563365", "0.75483066", "0.7502834", "0.7481452", "0.7370565", "0.72471577", "0.7134882", "0.71121", "0.7078587", "0.70584905", "0.7002422", "0.6990923", "0.6987949", "0.69791096", "0.6962229", "0.6920091", "0.68333936", "0.68257654", "0.6802805", "0.6716634", "0.6700307",...
0.77432007
0
Generator function which returns ability records with the specified users and below query. SELECT Profile.lastName, Profile.firstName, ... FROM User INNER JOIN Profile ON Profile.userId = User.id_ INNER JOIN UsersAbility ON User.id_ = UsersAbility.userId INNER JOIN Ability ON UsersAbility.abilityId = Ability.id_;
def yield_record(self, user_ids=[], columns=None): filter_ = None if user_ids: filter_ = self._db.User.c.id_ == user_ids[0] for user_id in user_ids[1:]: filter_ |= self._db.User.c.id_ == user_id if columns: columns = [col for col in columns if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_models_organization_get_abilities_member_user(self):\n access = factories.UserOrganizationAccessFactory(role=\"member\")\n\n with self.assertNumQueries(1):\n abilities = access.organization.get_abilities(access.user)\n\n self.assertEqual(\n abilities,\n ...
[ "0.5391291", "0.5223448", "0.5184904", "0.5113543", "0.49423173", "0.49127218", "0.48708478", "0.4827274", "0.48093134", "0.48089716", "0.48043194", "0.47699356", "0.47529572", "0.47479445", "0.47470778", "0.47262278", "0.47191784", "0.47191784", "0.47117633", "0.4708607", "0...
0.72041345
0
Get the number of requests. SELECT COUNT() FROM Request INNER JOIN UsersRequest ON UsersRequest.requestId = Request.id_;
def _get_request_count(self): joined_query = self._db.Request.join( self._db.UsersRequest, self._db.UsersRequest.c.requestId == self._db.Request.c.id_) joined_query = joined_query.select().with_only_columns([func.count()]) res = joined_query.execute() return [_ for _ in res]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def friend_request_count(self) -> int:\n e = await self.request.request(url=f'https://friends.roblox.com/v1/user/friend-requests/count', method='get',\n )\n return e['count']", "def count(self):\n return len(self._request_sessions)", "def client_...
[ "0.69484293", "0.6632788", "0.65044624", "0.6379204", "0.6297678", "0.6280874", "0.62785643", "0.62650543", "0.62540686", "0.6237054", "0.6202207", "0.61585265", "0.61410373", "0.6129518", "0.6103263", "0.61020875", "0.609978", "0.6065355", "0.60639393", "0.60524714", "0.6030...
0.8224526
0
Generator function which returns request records with below query. SELECT Profile.lastName, Profile.firstName, Profile.lastKanaName, Profile.firstKanaName, Request.detail FROM User INNER JOIN Profile ON User.id = Profile.userId INNER JOIN UsersRequest ON User.id_ = UsersRequest.userId INNER JOIN Request ON UsersRequest...
def yield_record(self, user_ids=[], columns=None): filter_ = None if user_ids: filter_ = self._db.User.c.id_ == user_ids[0] for user_id in user_ids[1:]: filter_ |= self._db.User.c.id_ == user_id if columns: columns = [col for col in columns if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yield_record(self, user_ids=[], columns=None):\n filter_ = None\n if user_ids:\n filter_ = self._db.User.c.id_ == user_ids[0]\n for user_id in user_ids[1:]:\n filter_ |= self._db.User.c.id_ == user_id\n\n if columns:\n columns = [col for col ...
[ "0.607708", "0.5801224", "0.563434", "0.5436275", "0.5435522", "0.54041797", "0.5401012", "0.52706105", "0.5223789", "0.52082694", "0.5188554", "0.5173161", "0.5173011", "0.5165055", "0.5140934", "0.51273125", "0.5110731", "0.5102614", "0.5070352", "0.5065051", "0.5059272", ...
0.70053494
0
Generator function which returns prefectures with below query. SELECT Prefecture.id_, Prefecture.name_ FROM Prefecture;
def yield_record(self, columns=None): query = self._db.Prefecture.select().with_only_columns(self.get_all_column()) for record in query.execute(): yield record
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_one():\n puppies = session.query(Puppy.name).order_by(Puppy.name.asc()).all()\n\n for puppy in puppies:\n print puppy.name", "def _getAllProvas(self):\n return self.execSql(\"select_all_provas\")", "def get_people(self):\n cursor = self.cur()\n cursor.execute('SELECT...
[ "0.5559843", "0.5441475", "0.5225257", "0.5199897", "0.51973164", "0.518491", "0.5142329", "0.5121006", "0.5119528", "0.5104191", "0.5100354", "0.5074651", "0.5074651", "0.50393736", "0.5030389", "0.50123405", "0.49912012", "0.4979582", "0.4968754", "0.49064863", "0.4904445",...
0.6172738
0
Test the TabularOutputFormatter class.
def test_tabular_output_formatter(): headers = ["text", "numeric"] data = [ ["abc", Decimal(1)], ["defg", Decimal("11.1")], ["hi", Decimal("1.1")], ["Pablo\rß\n", 0], ] expected = dedent( """\ +-------+---------+ | text | numeric | +------...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_headless_tabulate_format():\n formatter = TabularOutputFormatter(format_name=\"minimal\")\n headers = [\"text\", \"numeric\"]\n data = [[\"a\"], [\"b\"], [\"c\"]]\n expected = \"a\\nb\\nc\"\n assert expected == \"\\n\".join(\n TabularOutputFormatter().format_output(\n iter...
[ "0.7598825", "0.6803152", "0.6683861", "0.6668478", "0.6604555", "0.64349806", "0.6323238", "0.6221877", "0.62087774", "0.6080011", "0.59904414", "0.59258485", "0.5906039", "0.57514274", "0.57006407", "0.5679148", "0.56766784", "0.5619825", "0.5604824", "0.55946857", "0.55943...
0.7742016
0
Test the ascii_escaped output format.
def test_tabular_output_escaped(): headers = ["text", "numeric"] data = [ ["abc", Decimal(1)], ["defg", Decimal("11.1")], ["hi", Decimal("1.1")], ["Pablo\rß\n", 0], ] expected = dedent( """\ +------------+---------+ | text | numeric | ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_plain_ansi(self):\n irc_ansi = irc.parse_ansi_to_irc(string.printable)\n ansi_irc = irc.parse_irc_to_ansi(string.printable)\n self.assertEqual(irc_ansi, string.printable)\n self.assertEqual(ansi_irc, string.printable)", "def is_printable(c):\n return ord(c)>=32 or c in ['\...
[ "0.6732766", "0.6406619", "0.6277316", "0.6251546", "0.61997485", "0.6184127", "0.6170037", "0.6024704", "0.6006847", "0.5948027", "0.5901922", "0.58854496", "0.58677125", "0.5860605", "0.5801056", "0.5801056", "0.5796908", "0.5796908", "0.5795084", "0.57895523", "0.5780044",...
0.6542039
1
Test that additional preprocessors are run.
def test_additional_preprocessors(): def hello_world(data, headers, **_): def hello_world_data(data): for row in data: for i, value in enumerate(row): if value == "hello": row[i] = "{}, world".format(value) yield row ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_processor(self):", "def test_preprocessed_data(self):\n self.assertEqual(self.tester.preprocessed_data, [1, 2])", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_process(self):\n pass", "def pre_proce...
[ "0.6938419", "0.5952152", "0.5880601", "0.5880601", "0.5880601", "0.5880601", "0.5880601", "0.57874", "0.5712376", "0.56677914", "0.5662688", "0.55605817", "0.55309963", "0.54661083", "0.5465676", "0.5465676", "0.5465676", "0.5465676", "0.54530454", "0.5423807", "0.53889424",...
0.6088411
1
Test the the format_name attribute be set and retrieved.
def test_format_name_attribute(): formatter = TabularOutputFormatter(format_name="plain") assert formatter.format_name == "plain" formatter.format_name = "simple" assert formatter.format_name == "simple" with pytest.raises(ValueError): formatter.format_name = "foobar"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_format_metadata(self):\n\n format_metadata = self.group_tr.getFormatMetadata()\n self.assertIsInstance(format_metadata, OCIO.FormatMetadata)\n self.assertEqual(format_metadata.getName(), 'ROOT')", "def format_(self):\n return self.set_format or self.default_format or self.FAL...
[ "0.6153331", "0.6076459", "0.6012055", "0.59826183", "0.592901", "0.58396417", "0.5767246", "0.5702269", "0.5685611", "0.56719285", "0.56719285", "0.5670935", "0.5660645", "0.56290805", "0.5619688", "0.5610569", "0.5610569", "0.5579394", "0.5572902", "0.55696183", "0.5552509"...
0.6804895
0
Test that a headless formatter doesn't display headers
def test_headless_tabulate_format(): formatter = TabularOutputFormatter(format_name="minimal") headers = ["text", "numeric"] data = [["a"], ["b"], ["c"]] expected = "a\nb\nc" assert expected == "\n".join( TabularOutputFormatter().format_output( iter(data), headers, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_headers(self):\n msg = self.shortDescription()\n self.assertTrue(False, msg=msg)\n pass", "def test_raw_empty(self):\n self.assertRaisesHeaderError([''])", "def test_header_constructor_without_separator(self):\n\n expected = False\n actual = self.file_instance...
[ "0.63604164", "0.63151926", "0.6163514", "0.6104256", "0.6095177", "0.60750955", "0.6004281", "0.60040116", "0.586322", "0.5856205", "0.5847177", "0.5778657", "0.57778144", "0.5774725", "0.57422394", "0.5724278", "0.572363", "0.5721617", "0.5695007", "0.56886226", "0.5687411"...
0.68265456
0
Test that TabularOutputFormatter rejects unknown formats.
def test_unsupported_format(): formatter = TabularOutputFormatter() with pytest.raises(ValueError): formatter.format_name = "foobar" with pytest.raises(ValueError): formatter.format_output((), (), format_name="foobar")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_all_text_type(extra_kwargs):\n data = [[1, \"\", None, Decimal(2)]]\n headers = [\"col1\", \"col2\", \"col3\", \"col4\"]\n output_formatter = TabularOutputFormatter()\n for format_name in output_formatter.supported_formats:\n for row in output_formatter.format_output(\n iter(...
[ "0.70976675", "0.6928261", "0.6896788", "0.68242085", "0.6706267", "0.6496966", "0.6446614", "0.64220536", "0.63867015", "0.63490313", "0.63261265", "0.6246182", "0.62458897", "0.6236886", "0.6201243", "0.6187324", "0.61603105", "0.6087869", "0.6058924", "0.6046744", "0.60211...
0.8258656
0
Test that ANSI escape codes work with tabulate.
def test_tabulate_ansi_escape_in_default_value(): data = [["1", None], ["2", "Sam"], ["3", "Joe"]] headers = ["id", "name"] styled = format_output( iter(data), headers, format_name="psql", missing_value="\x1b[38;5;10mNULL\x1b[39m", ) unstyled = format_output( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_asciitable_m_pretty_ansi(self):\n input = '''\n┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓ \n┃\\x1b[1m \\x1b[0m\\x1b[1mReleased \\x1b[0m\\x1b[1m \\x1b[0m┃\\x1b[1m \\x1b[0m\\x1b[1mTitle \\x1b[0m\\x1b[1m \\x1b[0...
[ "0.70575464", "0.653272", "0.6358273", "0.6196326", "0.60648966", "0.58987457", "0.58536655", "0.58270675", "0.5749906", "0.5715439", "0.5708848", "0.5671626", "0.56693846", "0.56251574", "0.55986124", "0.5450305", "0.544031", "0.540491", "0.5401781", "0.53985673", "0.5381614...
0.71552247
0
Test that provided column types are passed to preprocessors.
def test_provide_column_types(): expected_column_types = (bool, float) data = ((1, 1.0), (0, 2)) headers = ("a", "b") def preprocessor(data, headers, column_types=(), **_): assert expected_column_types == column_types return data, headers format_output( data, header...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_type_in_col(arch, **kwargs):\n return all(\n attrib.isdigit()\n for attrib in arch.xpath('//@col')\n )", "def _column_type(strings, has_invisible=True, numparse=True):\n types = [_type(s, has_invisible, numparse) for s in strings]\n return reduce(_more_generic, types, bool)", ...
[ "0.69267917", "0.68872726", "0.65001106", "0.61542696", "0.60413736", "0.5988151", "0.59039944", "0.5828359", "0.5757172", "0.5706538", "0.5698194", "0.56468266", "0.564525", "0.564525", "0.5624118", "0.56221634", "0.5595887", "0.5567571", "0.5535115", "0.55180484", "0.551586...
0.7498186
0
Test that all output formatters accept iterable
def test_enforce_iterable(): formatter = TabularOutputFormatter() loremipsum = ( "lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod".split( " " ) ) for format_name in formatter.supported_formats: formatter.format_name = format_name try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_output_formatting_func(self, sample: Any):\n try:\n if not type(sample) == iter:\n self._formatting_func_return_types(format=sample)\n return True\n except Exception:\n raise ValueError(\n f\"formatting_func must return {self._f...
[ "0.70609593", "0.6536862", "0.626699", "0.6217377", "0.61381465", "0.61156595", "0.6076685", "0.60205024", "0.60205024", "0.59102875", "0.5902321", "0.58030295", "0.5667096", "0.5649909", "0.56128067", "0.5604238", "0.5603586", "0.5540967", "0.5523543", "0.55017066", "0.54822...
0.83657736
0
coroutine Open a cluster, connecting to all available hosts as specified in configuration.
async def open(cls, loop, *, aliases=None, configfile=None, **config): cluster = cls(loop, aliases=aliases, **config) if configfile: cluster.config_from_file(configfile) await cluster.establish_hosts() return cluster
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(ctx, config):\n log.info('Opening connections...')\n remotes = []\n machs = []\n for name in ctx.config['targets'].iterkeys():\n machs.append(name)\n for t, key in ctx.config['targets'].iteritems():\n t = misc.canonicalize_hostname(t)\n log.debug('connecting to %s', ...
[ "0.67443687", "0.6651427", "0.64465094", "0.63779134", "0.62812424", "0.6279923", "0.6241238", "0.6115502", "0.59951556", "0.5991341", "0.5940241", "0.5907062", "0.58718926", "0.58476406", "0.58214194", "0.5781779", "0.5775787", "0.5634603", "0.5625746", "0.5581556", "0.55773...
0.7019515
0
coroutine Connect to all hosts as specified in configuration.
async def establish_hosts(self): scheme = self._config['scheme'] hosts = self._config['hosts'] port = self._config['port'] for hostname in hosts: url = '{}://{}:{}/gremlin'.format(scheme, hostname, port) host = await driver.GremlinServer.open( url,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_connect(self, args):\r\n for host in self.host:\r\n client = paramiko.SSHClient()\r\n client.set_missing_host_key_policy(paramiko.AutoAddPolicy())\r\n client.connect(host[0], username=host[1], password=host[2])\r\n self.connections.append(client)", "def c...
[ "0.76126385", "0.69372785", "0.68551636", "0.67098475", "0.6545347", "0.65244", "0.6407366", "0.63640463", "0.6282757", "0.61959034", "0.6195543", "0.61844474", "0.6115662", "0.61116165", "0.60936683", "0.60836387", "0.60481113", "0.60062855", "0.59707445", "0.5946551", "0.59...
0.7258675
1
Load configuration from from JSON file.
def config_from_json(self, filename): with open(filename, 'r') as f: config = json.load(f) config = self._process_config_imports(config) self.config.update(config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self):\r\n with open('config.json', 'r') as f:\r\n self.config = json.load(f)", "def loadConf(self):\n\n with open(self.configFile) as f:\n self.config = json.load(f)", "def load_config():\n global config\n\n with open(\"config.json\") as f:\n js...
[ "0.8539941", "0.82377046", "0.8098964", "0.80969477", "0.8014216", "0.80130273", "0.79837704", "0.79833937", "0.79324776", "0.7875829", "0.78704065", "0.78406453", "0.78028023", "0.77925986", "0.7734833", "0.7696995", "0.7658866", "0.76542926", "0.76527035", "0.763015", "0.76...
0.84245086
1
Create a Vitis.GlobalAveragePooling2D Layer.
def __init__(self, **kwargs): super(VitisGlobalAveragePooling2D, self).__init__(**kwargs) self.rescale_factor = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n super(VitisAveragePooling2D, self).__init__(**kwargs)", "def _create_globalaveragepool(cls, onnx_node, inputs, opset_version):\n data_format = onnx_node.getattr(\"data_format\", 'channels_first')\n _, forward = cls._common_onnx_node_to_singa_op(onnx_node, inputs,\...
[ "0.61525106", "0.609915", "0.5919478", "0.5911318", "0.58175915", "0.5786517", "0.5785733", "0.5725473", "0.57131076", "0.57019055", "0.56622005", "0.5642687", "0.5559154", "0.54910403", "0.5473044", "0.5453422", "0.54310554", "0.54178834", "0.53916913", "0.5368832", "0.53341...
0.6580204
0
Create a Vitis.AveragePooling2D Layer.
def __init__(self, **kwargs): super(VitisAveragePooling2D, self).__init__(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n super(VitisGlobalAveragePooling2D, self).__init__(**kwargs)\n self.rescale_factor = None", "def avg_pool2d(input, kernel_size, stride=1, padding=0, ceil_mode=False):\n return _pool('AVG', utils._pair, **locals())", "def __init__(self, incoming, ksize=(1, 3, 3, 1), strid...
[ "0.6457442", "0.6351592", "0.63016933", "0.6263064", "0.6204219", "0.6127676", "0.6081943", "0.6059515", "0.605608", "0.5863216", "0.5845179", "0.5788462", "0.5774942", "0.57626235", "0.5740961", "0.57336354", "0.56914294", "0.5654503", "0.56451905", "0.56366557", "0.5619244"...
0.6591949
0
Check if this average_pooling can be converted to global_average_pooling.
def _is_global_pooling(self, input_shape): output_shape = self.compute_output_shape(input_shape).as_list() return output_shape[1] == 1 and output_shape[2] == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_broadcast(self, op, op_reg_manager):\n op_slices = op_reg_manager.get_op_slices(op)\n op_groups = [op_reg_manager.get_op_group(op_slice)\n for op_slice in op_slices]\n return op_handler_util.get_op_size(op) == 1 and all(op_groups)", "def _create_globalaveragepool(cls, onnx_node, ...
[ "0.5702395", "0.5538844", "0.5531251", "0.55049336", "0.5397743", "0.5374523", "0.5364051", "0.53428036", "0.52849174", "0.5265467", "0.5254244", "0.52519786", "0.5186632", "0.5176284", "0.51702154", "0.5170172", "0.5161271", "0.51423174", "0.5126535", "0.50942713", "0.509141...
0.73045886
0
Return any restricted teams for particualr users that our plugin may define.
def restricted_teams(self, user): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_teams():", "def get_available_teams(self):\n teams = self.request.user.team_set.filter(competition__is_open=True)\n if not teams.exists():\n msg = \"Can't send invites at this time. You're not\"\n msg += \" registered for any open competitions\"\n messages.e...
[ "0.6975286", "0.68651044", "0.6603281", "0.6549819", "0.6532676", "0.6517242", "0.6496614", "0.648852", "0.6457178", "0.6403878", "0.6360511", "0.6280246", "0.62778485", "0.62211406", "0.6210954", "0.6171425", "0.6165721", "0.6151758", "0.60374504", "0.60309184", "0.5981556",...
0.83617604
0
Test with augmentations. If rescale is False, then returned bboxes will fit the scale of imgs[0].
def aug_test(self, imgs, img_metas, templates, proposals=None, rescale=False): # recompute feats to save memory #y = self.extract_feats(imgs, templates) proposal_list = self.aug_test_rpn(self.extract_feats(imgs, templates), img_metas, self.test_cfg.rpn) rcnn_test_cfg = self.test_cfg.rcnn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aug_test(self, imgs, img_metas, rescale=False):\n # recompute feats to save memory\n proposal_list = self.aug_test_rpn(\n self.extract_feats(imgs), img_metas, self.test_cfg.rpn)\n det_bboxes, det_labels = self.aug_test_bboxes(\n self.extract_feats(imgs), img_metas, pr...
[ "0.68419516", "0.6574216", "0.6549093", "0.6481572", "0.6396106", "0.63814837", "0.63660586", "0.63358074", "0.63159716", "0.6262087", "0.6254781", "0.62417847", "0.61867654", "0.6185712", "0.6176265", "0.61736345", "0.61701804", "0.61697906", "0.6157004", "0.61568195", "0.61...
0.6817737
1
Copy content of this stream to different stream Stream can be either asynchronous stream or python binary stream.
def copy_to(self, stream, bufsize=None): bufsize = bufsize or PRETZEL_BUFSIZE if isinstance(stream.write(b''), int): # destination stream is synchronous python stream try: while True: stream.write((yield self.read(bufsize))) except ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_stream(self):\n return DataStream(\n data_type=self.data_type,\n name=self.name,\n labels=self.labels.copy(),\n callbacks=self.callbacks.copy(),\n uid=self.uid)", "def copyStreamToStream(streamFrom, streamTo, input_length=sys.maxint, offset=...
[ "0.6567908", "0.6458702", "0.63707775", "0.63395", "0.6333425", "0.6158691", "0.6021784", "0.5996409", "0.59475935", "0.58277017", "0.57225204", "0.5707159", "0.5683792", "0.56806785", "0.56806785", "0.56780136", "0.56698525", "0.56685907", "0.56647164", "0.56537086", "0.5566...
0.71742684
0
Get a program id from program.program_id. This is not an actual attribute of cirq.Circuit, but thanks to the magic of python, it can be! If your circuit does not have a program_id, this function will return a uuid4(). Program ids can only contain alphanumeric and _ so we replace
def _get_program_id(program: Any): if not hasattr(program, 'program_id'): return str(uuid.uuid4()) program_id: str = program.program_id program_id = program_id.replace(':', '') parts = program_id.split('/') parts.append(str(uuid.uuid4())) chars_per_part = math.floor(64 / len(parts)) - 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def program_uuid(self):\n return self.kwargs['program_uuid']", "def unique_id(self):\n return f\"bhyve:program:{self._program_id}\"", "def prog_id(self):\n return self.properties.get(\"ProgID\", None)", "def generate_fwan_process_id() -> str:\n return str(uuid.uuid4())", "def get_re...
[ "0.79068476", "0.7264113", "0.65031767", "0.6405029", "0.6306429", "0.6228734", "0.6212107", "0.62085164", "0.6196261", "0.6175726", "0.6149326", "0.61228895", "0.6092414", "0.604155", "0.60018843", "0.59885347", "0.5971074", "0.5971074", "0.5971074", "0.5952242", "0.5940573"...
0.8863723
0
Find needle in known_hosts
def match_hosts(needle): matched_hosts = [] with open(known_hosts_path, "r") as known_hosts_file: for line in known_hosts_file: host, _, _ = line.split(" ") if needle in host: matched_hosts.append(host) return matched_hosts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_host_key(self, value):\n for key in self:\n if value in key.hosts:\n return key\n return None", "def findwhois_server(self, buf, hostname, query):\n nhost = None\n match = re.compile('Domain Name: {}\\s*.*?Whois Server: (.*?)\\s'.format(query), flags...
[ "0.67115235", "0.5897425", "0.58485895", "0.5797194", "0.5788939", "0.57481563", "0.56678516", "0.56509316", "0.5648003", "0.5577273", "0.55597615", "0.5547292", "0.55391026", "0.5459835", "0.5459835", "0.538749", "0.53682864", "0.53653854", "0.5352104", "0.53495044", "0.5329...
0.78194994
0
Takes a state and graph embeddings, Returns a part [h_N, D] of context vector [h_c, h_N, D], that is related to RL Agent last step.
def get_step_context(self, state, embeddings): # index of previous node prev_node = state.prev_a.to(self.dev) # (batch_size, 1) # from embeddings=(batch_size, n_nodes, input_dim) select embeddings of previous nodes cur_embedded_node = embeddings.gather(1, prev_node.view(prev_node.shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_nn(cell, rnn_size, input_data, vocab_size, embed_dim):\n embed = get_embed(input_data, vocab_size, embed_dim) \n output, final_state = build_rnn(cell, embed)\n \n logits = tf.contrib.layers.fully_connected(output, vocab_size, activation_fn=None)\n #final_state = tf.identity(final_stat...
[ "0.5710615", "0.5697232", "0.56184053", "0.5616776", "0.5595174", "0.5548798", "0.5524491", "0.5477435", "0.54760706", "0.54628956", "0.54440236", "0.54390854", "0.53898245", "0.5347198", "0.5345448", "0.5341874", "0.5341261", "0.53183186", "0.53023475", "0.53003037", "0.5272...
0.7374239
0
converts index from NED coordinate in array X to index of array J
def indXtoJ(indX): return np.unravel_index(indX % xx.size, xx.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xy_to_index(x, y):\n index = y * columns + x\n return index", "def one_dim_index(self, i, j):\n return int(i + j * self.nx)", "def index(i, j):\n return i * N + j", "def coor2idx(x, y):\r\n a = round(x/4000,0)*4000\r\n b = (round_down(y/4000,0)+0.5)*4000\r\n i = int((a - 24000)/...
[ "0.6976895", "0.68221605", "0.6785867", "0.66706675", "0.66188246", "0.6592676", "0.6390636", "0.6366008", "0.6351581", "0.632472", "0.6315053", "0.62955177", "0.6266986", "0.6242964", "0.621769", "0.62147", "0.6204049", "0.61921877", "0.6169835", "0.6155819", "0.6117954", ...
0.79179806
0
assign a resource lock to someone else other than the caller
def assignlock(self, nick, channel, assignee, resourcestr): return (channel, self._lock(nick, assignee, resourcestr))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lock_resource(self, resource, user_name):\n for sub_resource in resource.get_sub_resources():\n self._lock_resource(sub_resource, user_name)\n\n resource.owner = user_name\n resource.owner_time = datetime.now()\n resource.save()", "def __call__(self, o):\n if no...
[ "0.7998552", "0.6857944", "0.65522623", "0.65328693", "0.63625455", "0.6329278", "0.6238407", "0.6220345", "0.6207784", "0.619553", "0.61907506", "0.61907345", "0.6148036", "0.6120895", "0.6093301", "0.608594", "0.6082099", "0.60701936", "0.6067369", "0.6031181", "0.60109025"...
0.69686687
1
list locked resources and their owners
def status(self, nick, channel): lockeditems = sorted([item[0] for item in self.locks.items() if item[1].owner]) if len(lockeditems) == 0: return (channel, "There are no locked resources") else: messages = [] messages += [(channel, "Status of locked resources...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locks(self):\r\n params = {'f' : 'json'}\r\n url = \"%s/lockInfos\" % self._url\r\n return self._con.post(url, params)['lockInfos']", "def lock_resources(self, request):\n locked_resources = []\n\n client = request.worker.name\n user_name, _ = client.split(\":\") # ...
[ "0.66722405", "0.6582977", "0.6438537", "0.634539", "0.6334195", "0.60580474", "0.60307276", "0.5862831", "0.58229685", "0.58210385", "0.58006316", "0.57709336", "0.57266915", "0.5692866", "0.5691849", "0.5633208", "0.56149334", "0.55855703", "0.55745804", "0.5522181", "0.550...
0.68914664
0
Build a template measurment object.
def build_template_meas(name='example'): meas = templates.TemplateMeasurement(name) meas.set_lumi(1, 0.02) # Base shape for the signal, triangular distribution sig = np.array([10000, 12500, 15000, 12500, 10000], dtype=float) # Add a source for the signal src_sig = meas.new_source('sig', sig) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_template(self, state: gamelib.AdvancedGameState):\n for unit in self.BASE_TEMPLATE:\n if state.get_resource(state.CORES) > self.UNIT_COSTS[unit[1]]:\n if state.can_spawn(unit[1], unit[0]):\n state.attempt_spawn(unit[1], unit[0])\n\n low_health_un...
[ "0.605412", "0.605101", "0.60259765", "0.5781559", "0.5705319", "0.5661125", "0.5560697", "0.54971033", "0.5424929", "0.53872424", "0.5383353", "0.53767645", "0.5330913", "0.5301977", "0.5290818", "0.5241824", "0.5231358", "0.5226303", "0.5188401", "0.5178917", "0.51679087", ...
0.7202414
0
Generate a plausible data spectrum for a pseudoexperiment in which the true underlying parameters are not known.
def make_pseudo(meas, systs=True, signal=True, stats=True): # Get the scales for the paramters controlling the spectrum scales = meas.spec.scales # Randomize the true underlying values for constrained parameters truth = np.array(meas.spec.central) if systs: # Vary the constrained parameter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_spectrum(self):\n matlab_method = self.matlab_mapper[self.matlab_script]\n n, dm, peak_locations, omega_res, n_shell, gamma_amp = matlab_method(float(self.n_max), float(self.n_max_s),\n float(self.num_channels), float(self.scale),\n ...
[ "0.63703376", "0.61298424", "0.6076039", "0.6042859", "0.60020065", "0.5754672", "0.5692847", "0.56431437", "0.56001097", "0.5560816", "0.55325127", "0.5526705", "0.54973495", "0.5476813", "0.54699695", "0.54654425", "0.5463588", "0.54630315", "0.5450797", "0.5449483", "0.541...
0.6240589
1
Draw a spectrum with a parameter fluctuated to +/ 1 sigma, for each parameter. Unconstrained parameters are set to +/ 1.
def draw_spectra(meas, normalize=True): # Draw the plain spectrum x = list(meas.spec.central) lfull = draw_spectrum(meas, x, scale=True, label='full') x[meas.spec.ipar('xsec_sig')] = 1 x[meas.spec.ipar('xsec_bg1')] = 0 x[meas.spec.ipar('xsec_bg2')] = 0 lsig = draw_spectrum(meas, x, scale=F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_spectrum():\n filename = \"parameters.txt\"\n #If the file exists already, we should read the parameters from memory. \n #If the file does not exist, default variables are in Variables.py\n if path.exists(filename): \n para= open(filename,\"r\")\n para_lines = para.readlines(...
[ "0.5893153", "0.58147323", "0.58019096", "0.5797836", "0.57860005", "0.5742457", "0.5662904", "0.56534266", "0.5623216", "0.5619086", "0.557973", "0.5557214", "0.5554759", "0.54910123", "0.54774016", "0.5462636", "0.54308754", "0.5417131", "0.54069245", "0.54056835", "0.53973...
0.63044024
0
Return the appropriate (lambda) function for the given field
def bind_function(field): t = field['type'] try: if t == 'int': return lambda x: random.randint(field['min'], field['max']) elif t == 'float': return lambda x: field['min'] + ((field['max'] - field['min']) * random.random()) elif t == 'string': return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def picker(field_name):\n return lambda row: row[field_name]", "def picker(field_name):\n return lambda row: row[field_name]", "def use_cached_field(anki: AnkiDeck, mid: int, field: int) -> FieldFunction[str]:\n return lambda sort_field: lookup_field(anki, mid, field, sort_field)", "def _generateLam...
[ "0.6644591", "0.6644591", "0.63634723", "0.60030925", "0.59671044", "0.5951441", "0.5808804", "0.57361925", "0.57241744", "0.5697697", "0.568813", "0.5683597", "0.56689215", "0.56686634", "0.56650335", "0.5607115", "0.5566443", "0.5554812", "0.5526383", "0.55215496", "0.55166...
0.6951546
0
Check the duplicate path. If there is a same filepath, for example 'file/tests.txt', Then this path will be 'file/tests(1).txt' If 'file/tests(1).txt' also exists, then this path will be 'file/tests(2).txt'
def check_duplicate_path(filepath): if not os.path.exists(os.path.join(os.getcwd(), filepath)): return filepath i = 1 splits = filepath.split(".") head, tail = '.'.join(splits[:-1]), splits[-1] while os.path.exists(os.path.join(os.getcwd(), "%s(%d).%s" % (head, i, tail))): i += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicate_timestamp_path(existing_path):\n logfile = parse.parse_filename(existing_path)\n index = 0\n while index < 25:\n if index == 0:\n suffix = ''\n else:\n suffix = '-%02d' % index\n\n new_path = parse.unparse_filename(\n (\n l...
[ "0.66834664", "0.66339064", "0.65070987", "0.6452547", "0.6442084", "0.6263671", "0.6235103", "0.61986953", "0.618657", "0.6059476", "0.60134727", "0.59828204", "0.58634245", "0.58248854", "0.5793048", "0.57827705", "0.5739223", "0.57352346", "0.5700874", "0.5699016", "0.5665...
0.7494454
0
Exit nonzero now, unless __main__.__doc__ equals "parser.format_help()"
def exit_unless_main_doc_eq(parser): file_filename = os.path.split(__file__)[-1] main_doc = __main__.__doc__.strip() parser_doc = parser.format_help() got = main_doc got_filename = "./{} --help".format(file_filename) want = parser_doc want_filename = "argparse.ArgumentParser(..." dif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _usage(args, contents): # pragma: no cover\n sys.exit(0)", "def invoke(self) -> int:\n if self.parser is not None:\n self.parser.print_help()\n return 0", "def help(self, dummy):\r\n help = self.doc + \"\\n\"\r\n if help.find(\"%s\") > 0:\r\n help = help...
[ "0.6791217", "0.6745974", "0.67159116", "0.6627217", "0.6616108", "0.6601277", "0.64934665", "0.64894", "0.6480547", "0.64597464", "0.6455681", "0.64500916", "0.63771254", "0.635731", "0.63474774", "0.63474774", "0.63447297", "0.63438344", "0.632575", "0.6322747", "0.6318159"...
0.7570494
0
Extracts the resource id from the provided resource. This method validates the input resource dict and checks that the properties which names are passed in `props` argument match corresponding lists in `allowed` argument. In case of mismatch exception of type exc is raised.
def _extract_resource(resource: Optional[dict], allowed_vals: tuple[tuple[str, ...]], exc: Type[exception.CinderException], resource_name: str, props: tuple[str] = ('status',)) -> Optional[str]: resource_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_id(resource_instance, resource):\n if resource and \"id\" in resource:\n return resource[\"id\"] and encoding.force_str(resource[\"id\"]) or None\n if resource_instance:\n return (\n hasattr(resource_instance, \"pk\")\n and encoding.force_str(resource_inst...
[ "0.6286703", "0.61337155", "0.60168695", "0.5848513", "0.58351415", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5730958", "0.5730958", "0.5730958", "0.5730958", "0.5730958", "0.5730958", "0.5730958", ...
0.78969824
0
Extracts and validates the volume size. This function will validate or when not provided fill in the provided size variable from the source_volume or snapshot and then does validation on the size that is found and returns said validated size.
def _extract_size(size: int, source_volume: Optional[objects.Volume], snapshot: Optional[objects.Snapshot], backup: Optional[objects.Backup]) -> int: def validate_snap_size(size: int) -> None: if snapshot and size < snapshot.volume_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manage_existing_get_size(self, volume, existing_ref):\n\n target_vol_name = existing_ref['source-name']\n\n self.client_login()\n try:\n size = self.client.get_volume_size(target_vol_name)\n return size\n except stx_exception.RequestError as ex:\n LO...
[ "0.6791952", "0.6446001", "0.63496536", "0.63496536", "0.63496536", "0.6164712", "0.6164712", "0.6162713", "0.60178965", "0.5974615", "0.59507203", "0.5860648", "0.58097893", "0.58046275", "0.57876194", "0.5696484", "0.56486726", "0.56468433", "0.56148785", "0.560581", "0.554...
0.8289146
0
Extracts and returns a validated availability zone list. This function will extract the availability zone (if not provided) from the snapshot or source_volume and then performs a set of validation checks on the provided or extracted availability zone and then returns the validated availability zone.
def _extract_availability_zones( self, availability_zone: Optional[str], snapshot, source_volume, group: Optional[dict], volume_type: Optional[dict[str, Any]] = None) -> tuple[list[str], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_availability_zones(self, context, resource_type,\n availability_zones):", "def validate_availability_zones(self, context, resource_type,\n availability_zones):\n if not availability_zones:\n return\n if le...
[ "0.63943464", "0.57642007", "0.56424534", "0.54593474", "0.54593474", "0.54593474", "0.54593474", "0.54593474", "0.54593474", "0.5400208", "0.526738", "0.5254807", "0.5165108", "0.5131632", "0.50807095", "0.5023778", "0.5017825", "0.48526326", "0.48313126", "0.48292732", "0.4...
0.7768819
0
Creates a database entry for the given inputs and returns details. Accesses the database and creates a new entry for the to be created volume using the given volume properties which are extracted from the input kwargs (and associated requirements this task needs). These requirements should be previously satisfied and v...
def execute(self, context: context.RequestContext, optional_args: dict, **kwargs) -> dict[str, Any]: src_volid = kwargs.get('source_volid') src_vol = None if src_volid is not None: src_vol = objects.Volume.get_by_id(context, src_volid)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_volume(self, context, volume_id, request_spec=None,\n filter_properties=None, allow_reschedule=True,\n snapshot_id=None, image_id=None, source_volid=None,\n source_replicaid=None, consistencygroup_id=None):\n\n ctx_dict = context.__di...
[ "0.5725086", "0.5718247", "0.565376", "0.55094403", "0.54922634", "0.54513985", "0.5444849", "0.5347211", "0.5332229", "0.53095233", "0.52728635", "0.52706724", "0.5251625", "0.5236023", "0.5232849", "0.52302337", "0.52094674", "0.52048177", "0.5203383", "0.51883715", "0.5169...
0.6186938
0
Takes Keyhole Markup Language Zipped (KMZ) or KML file as input. The output is a pandas dataframe, geopandas geodataframe, csv, geojson, or shapefile.
def keyholemarkup2x(file,output='df'): r = re.compile(r'(?<=\.)km+[lz]?',re.I) try: extension = r.search(file).group(0) #(re.findall(r'(?<=\.)[\w]+',file))[-1] except IOError as e: logging.error("I/O error {0}".format(e)) if (extension.lower()=='kml') is True: buffe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readKML(filename):\n\n kml_file = path.join(filename)\n\n #### se leen los elementos del KML\n with open(kml_file) as f:\n folder = parser.parse(f).getroot().Document.Folder\n\n #### se separan los elementos, nombres de los puntos y las coordenadas\n plnm=[]\n cordi=[]\n for pm in f...
[ "0.62045234", "0.59694266", "0.5614283", "0.5588096", "0.55593634", "0.55198014", "0.54530036", "0.5381782", "0.53294533", "0.532009", "0.52355796", "0.52240384", "0.52035177", "0.51956874", "0.51648325", "0.5145558", "0.51388747", "0.51381135", "0.50973314", "0.5092485", "0....
0.7567482
0
Verifies signature (ensures matched shared secrets). Returns Bool.
def check_signature(signature, data): if SIGNATURE_DISABLED: return True # check signature try: digest = hmac.new( SEGMENT_SHARED_SECRET.encode(), msg=data, digestmod=hashlib.sha1 ).hexdigest() if digest == signature: return True else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self, request, consumer, token, signature):\r\n built = self.sign(request, consumer, token)\r\n return built == signature", "def check_signature(signature, *args, **kwargs):\n return hmac.compare_digest(signature, create_signature(*args, **kwargs))", "def verify(signature: Signature,...
[ "0.77133894", "0.7456966", "0.7451283", "0.7370368", "0.7342798", "0.723132", "0.723132", "0.7131091", "0.7098203", "0.70439786", "0.7042887", "0.70322865", "0.6982362", "0.6980211", "0.69460005", "0.6936151", "0.6911655", "0.68586284", "0.6817355", "0.67785805", "0.67738426"...
0.76915914
1
lowercase sentence `sent` given as parameter
def lowercase(self, sent): SPECIAL_TAG_PREFIX = ur"__" _sent = [] for w in sent: # make sure w is in network vocabulary if not w.startswith(SPECIAL_TAG_PREFIX) and \ w.lower() in self.word_vectors.getVocab(): _sent.append(w.lower()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lower_caser(self, sentence):\n return sentence.strip().lower()", "def lowerCase(self,phrase):\n if(\"normalizeText\" in self._classes):\n return self._normalize.lowerCase(phrase)", "def handle_sentence_simple(self, sentence, ctxinfo):\n global text_version\n global mo...
[ "0.7798232", "0.70910996", "0.6897251", "0.67695826", "0.67441666", "0.6727888", "0.66985834", "0.6653774", "0.6544608", "0.6498189", "0.64789736", "0.6471879", "0.6421757", "0.64176786", "0.64147437", "0.6348549", "0.6320604", "0.6318996", "0.6287475", "0.6287458", "0.626490...
0.7131649
1
Get code block based on position in codes, sized based on opcode.
def get_code_block(self, pos, opcode): if opcode == 99: print('99 IS THE END') block_size = 0 return [self.codes[pos]] elif opcode in (1, 2, 7, 8): block_size = 4 elif opcode in (5, 6): block_size = 3 elif opcode in (3,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_code(self, data_start, data_size, offset):\n first_block = 0x1000 - data_start % 0x1000\n full_blocks = ((data_size + (data_start % 0x1000)) / 0x1000) - 1\n left_over = (data_size + data_start) % 0x1000\n\n code = \"\"\n\n # Deal with reads that are smaller than a block\n...
[ "0.6831133", "0.5879704", "0.58197665", "0.57767147", "0.5509524", "0.53633565", "0.53602576", "0.53167605", "0.52453434", "0.5240448", "0.52288264", "0.52158344", "0.520227", "0.51487017", "0.51393586", "0.5114082", "0.5100469", "0.50978047", "0.50817233", "0.5070789", "0.50...
0.8200708
0
Get the opcode string from a codeblock.
def get_opcode(self, code): opcode = int(str(code)[-2:]) return opcode
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_op_code_str(self, op):\n try:\n from tflite.BuiltinOperator import BuiltinOperator\n except ImportError:\n raise ImportError(\"The tflite package must be installed\")\n\n op_code_list_idx = op.OpcodeIndex()\n op_code_id = self.model.OperatorCodes(op_code_li...
[ "0.6249712", "0.5808073", "0.5758956", "0.57538587", "0.570763", "0.570763", "0.5671009", "0.56138945", "0.55983204", "0.55761415", "0.557361", "0.55591536", "0.5555312", "0.5523228", "0.5506385", "0.5496092", "0.5473834", "0.5467974", "0.5443687", "0.54090476", "0.53862494",...
0.6715364
0
Get the two modes for a code block's parameters.
def get_modes(self, code_block): # FUCK YOU INDEX ERRORS, LIST COMPS, AND EVEN YOU LAMBDAS I DON'T NEED PRETTY # 0 = pos mode # 1 = imm mode modes, mode_codes = [0, 0], list(reversed(str(code_block[0])))[2:] x = 0 for mode in mode_codes: modes[x] = int(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_modes(self):\n return self.__modes", "def partial_modes(self, level, node=None):\n if node:\n return self.operator.modes[self._index_list(level, node)]\n\n indeces = [self._index_list(level, i) for i in range(2**level)]\n return np.hstack(tuple([self.operator.modes[idx...
[ "0.6424788", "0.6175102", "0.6116689", "0.60188097", "0.5950464", "0.5902551", "0.58972424", "0.5825283", "0.5721097", "0.565327", "0.5622471", "0.558995", "0.5571778", "0.5556218", "0.5544023", "0.5539861", "0.5522755", "0.54928595", "0.54884505", "0.54445195", "0.54361504",...
0.712229
0
Get the value for each code based on if it's position mode (pos_mode) or immediate mode (imm_mode) and its position in the code block.
def get_values(self, code_block): pos_mode, imm_mode = 0, 1 x, values = 1, [] modes = self.get_modes(code_block) for mode in modes: if mode == pos_mode: values.append(int(self.codes[code_block[x]])) elif mode == imm_mode: va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_modes(self, code_block):\r\n # FUCK YOU INDEX ERRORS, LIST COMPS, AND EVEN YOU LAMBDAS I DON'T NEED PRETTY\r\n # 0 = pos mode\r\n # 1 = imm mode\r\n modes, mode_codes = [0, 0], list(reversed(str(code_block[0])))[2:]\r\n x = 0\r\n for mode in mode_codes:\r\n ...
[ "0.73331314", "0.5679162", "0.5547544", "0.5291059", "0.52655387", "0.52335066", "0.52260995", "0.5219121", "0.520287", "0.51944584", "0.5185736", "0.51602906", "0.51379883", "0.50631815", "0.5047685", "0.50382125", "0.50302804", "0.48911408", "0.48609778", "0.4847673", "0.48...
0.79959965
0
Remove the base line using a SavitzkyGolay method
def remove_baseline(self): print(" \t Apply Savitzky-Golay filter \t %d" %self.nwin) base_savgol = signal.savgol_filter(self.input, self.nwin, 1) self.input_nobase = self.input - base_savgol
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cut_line(self):\r\n self.parachute.pop(0)", "def remove_line(self, origin):\n current_tile = self.board[origin[0]][origin[1]]\n\n if current_tile.is_dot:\n temp = current_tile.next\n current_tile.next = None\n current_tile = temp\n\n # Remove color...
[ "0.7042391", "0.64433926", "0.6224675", "0.61690134", "0.61472166", "0.60406417", "0.59359074", "0.593024", "0.59090394", "0.5900306", "0.5895631", "0.5871592", "0.58644634", "0.58512706", "0.58499116", "0.5848815", "0.58475477", "0.58448726", "0.57755435", "0.5750193", "0.57...
0.66475266
1
denoise the data using the 2stage kurtosis denoising
def denoise(self): #make sure the data has a len dividible by 2^2 self.len_swt = self.len while not (self.len_swt/4).is_integer(): self.len_swt -= 1 inp = self.input_nobase[:self.len_swt] self.wave = pywt.Wavelet(self.wave_type) nLevel = pywt.swt_max_level(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ICA_Denoise(Y, ica_model, noise_std):\n\n # TODO: YOUR CODE HERE", "def filter_denoise(self, x):\n b, a = self.c_notch\n return filtfilt(b, a, x)", "def MVN_Denoise(Y, mvn_model, noise_std):\n return calc_weiner_filter(Y, mvn_model.mean, mvn_model.cov, noise_std)", "def run_denoising(...
[ "0.6254114", "0.6207546", "0.61320424", "0.5874847", "0.5839554", "0.57731473", "0.5748484", "0.5744758", "0.5728441", "0.572605", "0.56469405", "0.56469405", "0.56469405", "0.56418467", "0.56233346", "0.56080765", "0.55805033", "0.5566257", "0.55619085", "0.55411446", "0.552...
0.68143743
0
Compute the rolling kurtosis.
def _rolling_kts(y,N): # number of points nPTS,N2 = len(y), int(N/2) # define the out kts = np.zeros(nPTS) # for all points comopute snr for i in range(nPTS): s,e = i-N2, i+N2 if s<0: s = 0 if s > nPTS-1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kurtosis(self) -> float:\n return float(ss.kurtosis(self.tsdf.pct_change(), fisher=True, bias=True, nan_policy='omit'))", "def calc_kurtosis(sig):\n return kurtosis(sig)", "def kurtosis(r):\n demeaned_r = r - r.mean()\n # use the population standard deviation, so set dof=0\n sigma_r = r...
[ "0.7280021", "0.72142196", "0.70349604", "0.6872883", "0.68170637", "0.679628", "0.62929606", "0.6168766", "0.6020426", "0.5842821", "0.5828331", "0.5625072", "0.56153303", "0.56038046", "0.5593879", "0.55546606", "0.55122936", "0.538985", "0.53348935", "0.5323968", "0.530855...
0.73427486
0
Function that performs a convolution on images with channels
def convolve_channels(images, kernel, padding='same', stride=(1, 1)): m = images.shape[0] image_h = images.shape[1] image_w = images.shape[2] filter_h = kernel.shape[0] filter_w = kernel.shape[1] s1 = stride[0] s2 = stride[1] if padding == 'valid': pad_h = 0 pad_w = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clConvolution(self, size, mask):", "def convolve_channels(images, kernel, padding='same', stride=(1, 1)):\n m, h, w, c = images.shape\n KernelHeight, kernelWidth, c = kernel.shape\n StrideHeight, StrideWidth = stride\n\n if padding == 'valid':\n PaddingHeight = 0\n PaddingWidth = 0\...
[ "0.78048617", "0.76200247", "0.75978273", "0.7558364", "0.74831325", "0.7368806", "0.73137546", "0.72811294", "0.722849", "0.7214952", "0.71894956", "0.71754706", "0.71480143", "0.71439964", "0.7123431", "0.7122098", "0.7074655", "0.70513123", "0.70480937", "0.7038724", "0.70...
0.77049017
1
An instrumented Template render method, providing a signal that can be intercepted by the test system Client
def instrumented_test_render(self, context): signals.template_rendered.send(sender=self, template=self, context=context) return self.nodelist.render(context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_to_template_mock(*_args):", "def _render(self) -> str:\n html = self._template.render(self._transient_context)\n self._transient_context = None\n return html", "def patch_render_template(self):\n mock_render = Mock(spec=render_template)\n mock_render.return_value =...
[ "0.685287", "0.6700654", "0.66776145", "0.6645942", "0.66436213", "0.6585426", "0.6585426", "0.6585426", "0.6585426", "0.6585426", "0.6585426", "0.6547666", "0.65277296", "0.65042114", "0.6500498", "0.64901316", "0.6445812", "0.64102834", "0.64102834", "0.64102834", "0.638103...
0.75868696
0
Register dataset related changes. For local datasets, look them up, record the dataset event, queue dagruns, and broadcast the dataset event
def register_dataset_change( self, *, task_instance: TaskInstance, dataset: Dataset, extra=None, session: Session, **kwargs ) -> None: dataset_model = session.scalar(select(DatasetModel).where(DatasetModel.uri == dataset.uri)) if not dataset_model: self.log.warning("DatasetModel ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datasets(self, datasets):\n\n self._datasets = datasets", "def add_to_dataset(self, dataset: Dataset):\n pass", "def datasets(self, datasets):\n self.__datasetsAll = datasets\n self.__datasets = list(datasets)\n self.__axisDomains = None\n for ds in self.__datasets...
[ "0.56935036", "0.56498915", "0.5641686", "0.54096603", "0.5342046", "0.5339496", "0.5286913", "0.52014285", "0.5195956", "0.5182093", "0.5152727", "0.5134192", "0.50968635", "0.5025282", "0.5021174", "0.5016711", "0.49956772", "0.4995023", "0.49723122", "0.49516952", "0.49417...
0.7455701
0
Create the cifar10 dataset.
def create_cifar10_dataset(cifar_dir): ds = de.Cifar10Dataset(cifar_dir) training = True resize_height = 224 resize_width = 224 rescale = 1.0 / 255.0 shift = 0.0 repeat_num = 10 batch_size = 32 # define map operations random_crop_op = vision.RandomCrop((32, 32), (4, 4, 4, 4)) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cifar10(transform=transforms.ToTensor()):\n\n\t# Directories\n\tscript_dir = os.path.dirname(os.path.realpath(__file__))\n\tdata_dir = os.path.join(script_dir, 'data', 'cifar10')\n\n\t# Load training set, downloading if necessary\n\tdataset = datasets.CIFAR10(data_dir, train=True, transform=transform, download...
[ "0.7966689", "0.75073844", "0.7161493", "0.71176726", "0.7109075", "0.7096102", "0.69510275", "0.6845723", "0.6814827", "0.68126905", "0.68040884", "0.670599", "0.66763234", "0.6664927", "0.65709835", "0.656717", "0.64492744", "0.6426107", "0.6410631", "0.6406311", "0.6405234...
0.7870253
1
Renders photorealistic images of a droplet interface in data from Michael or Pablo's simulations, given a case config file and render config file.
def photorealistic(case_config_filepath, render_config_filepath): # Load config file with all common directory names dirname_config = configparser.ConfigParser() dirname_config.read("dirname.cfg") # Get information from config files cconfd = load_config.get_config_params(case_config_filepath) # C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surf_tempmap(case_config_filepath, render_config_filepath):\n\n # Load config file with all common directory names\n dirname_config = configparser.ConfigParser()\n dirname_config.read(\"dirname.cfg\")\n\n # Get information from config files\n cconfd = load_config.get_config_params(case_config_fi...
[ "0.6152582", "0.5941791", "0.58843994", "0.5855938", "0.57763773", "0.5693176", "0.5657049", "0.55853724", "0.55809975", "0.5573157", "0.55586225", "0.552534", "0.54541004", "0.5444121", "0.540116", "0.5400519", "0.53548855", "0.5344291", "0.5332354", "0.53094125", "0.5267152...
0.7577917
0
Renders surface temperature images of a droplet interface in data from Michael or Pablo's simulations, given a case config file and render config file.
def surf_tempmap(case_config_filepath, render_config_filepath): # Load config file with all common directory names dirname_config = configparser.ConfigParser() dirname_config.read("dirname.cfg") # Get information from config files cconfd = load_config.get_config_params(case_config_filepath) rc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photorealistic(case_config_filepath, render_config_filepath):\n\n # Load config file with all common directory names\n dirname_config = configparser.ConfigParser()\n dirname_config.read(\"dirname.cfg\")\n\n # Get information from config files\n cconfd = load_config.get_config_params(case_config_...
[ "0.6288007", "0.58538276", "0.5514038", "0.5480608", "0.5456143", "0.5447625", "0.54016596", "0.53474796", "0.5288365", "0.5260717", "0.525005", "0.5233247", "0.5214957", "0.52136034", "0.52131844", "0.5211817", "0.52017117", "0.5193529", "0.51920855", "0.5187744", "0.5187449...
0.7388833
0
Renders lambda2 contours of droplet data from Michael or Pablo's simulations, given a case config file and render config file.
def lambda2(case_config_filepath, render_config_filepath): # Load config file with all common directory names dirname_config = configparser.ConfigParser() dirname_config.read("dirname.cfg") # Get information from config files cconfd = load_config.get_config_params(case_config_filepath) rconfd ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(config):\n file_paths_info = [('GLOFRIS','WATCH','ARG_inunriver_historical_000000000WATCH_1980_rp01000.tif'),\n \t\t\t\t('GLOFRIS','RCP45','ARG_inunriver_rcp4p5_0000GFDL-ESM2M_2030_rp01000.tif'),\n \t\t\t\t('GLOFRIS','RCP85','ARG_inunriver_rcp8p5_0000GFDL-ESM2M_2030_rp01000.tif'),\n \t\t\t\t('...
[ "0.6074889", "0.574469", "0.5545353", "0.52796954", "0.52744776", "0.518162", "0.51216215", "0.5116855", "0.51122236", "0.50734866", "0.50516486", "0.5032492", "0.50160444", "0.49768373", "0.49333197", "0.4913025", "0.4899455", "0.4876432", "0.48720288", "0.48589456", "0.4857...
0.7535855
0
Translate any C instruction
def convert_C_instruction(self, instruction): comp, dest, jump = self.parse(instruction) return f"111{convert_comp(comp)}{convert_dest(dest)}" \ f"{convert_jump(jump)}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compileInstruction(self, ins):\n pass", "def process(opcode):\n opcode.process()", "def gen_c_code(self, comp, dest, jump):\r\n return '111' + self.comp(comp) + self.dest(dest) + self.jump(jump)", "def c_instruction_parser(c_instruction):\n binary_res = '111'\n dest, comp, jmp = ''...
[ "0.6561874", "0.61943746", "0.60784996", "0.58676004", "0.58119315", "0.56691813", "0.5659387", "0.5633192", "0.5589402", "0.5568986", "0.55381376", "0.5535437", "0.5509358", "0.55061597", "0.549903", "0.5427867", "0.5420783", "0.54128903", "0.5401546", "0.5383139", "0.538116...
0.67511356
0
Finds labels inside commands and fills the symbol table with labels
def add_labels(self): counter = 0 labels_list = [] for i in range(len(self.commands)): command = self.commands[i] if command.startswith('('): raw_value = command.replace('(', '').replace(')', '') self.symbol_table[raw_value] = str(counter) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_symbols(self):\n self.add_labels()\n variable_counter = 16\n for i in range(len(self.commands)):\n command = self.commands[i]\n if command.startswith('@'): # symbols always reside in A instructions\n value = command.split('@')[1]\n ...
[ "0.6857181", "0.59875345", "0.5967218", "0.59576654", "0.59051675", "0.5721235", "0.5716886", "0.5536359", "0.5536359", "0.5535116", "0.5508334", "0.5488973", "0.54202247", "0.5391605", "0.53611904", "0.53439146", "0.5304387", "0.5279485", "0.5262439", "0.5260879", "0.5241737...
0.7957542
0
Cleans and replace symbol commands with corresponding numerical values
def clean_symbols(self): self.add_labels() variable_counter = 16 for i in range(len(self.commands)): command = self.commands[i] if command.startswith('@'): # symbols always reside in A instructions value = command.split('@')[1] if not valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_num(quote):\n for char in ROMAN:\n quote = quote.replace(*char)\n return quote", "def _hill_normalize_symbol(symb):\n symb = ptab.to_symbol(symb)\n if symb == 'C':\n symb = ''\n if symb == 'H':\n symb = '1'\n return symb", "def clean_inpu...
[ "0.6367131", "0.5781873", "0.57104903", "0.569682", "0.5692085", "0.5543413", "0.55233794", "0.5514841", "0.55030894", "0.55004317", "0.54772264", "0.53819984", "0.5351693", "0.5292913", "0.52664244", "0.52580327", "0.5227113", "0.5208533", "0.5203274", "0.5201695", "0.519784...
0.6928754
0
Build process trees from the process events.
def extract_process_tree( procs: pd.DataFrame, schema: "ProcSchema", # type: ignore # noqa: F821 debug: bool = False, ) -> pd.DataFrame: # Clean data procs_cln, schema = _clean_proc_data(procs, schema) # Merge parent-child merged_procs = _merge_parent_by_time(procs_cln, schema) if deb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pslist(self) -> Generator[dict, None, None]:\n\n # Function to switch fields to represent a parent\n def _convert_to_parent_fields(process: dict) -> dict:\n output = {}\n for left, right in [\n (FieldNames.PROCESS_IMAGE, FieldNames.PARENT_PROCESS_IMAGE),\n ...
[ "0.5943494", "0.55186284", "0.5474236", "0.5396079", "0.5336486", "0.52977246", "0.5260086", "0.5252163", "0.5249161", "0.5246989", "0.5233202", "0.5203509", "0.5188407", "0.513476", "0.5126268", "0.51151633", "0.51142776", "0.5088811", "0.50620705", "0.49990997", "0.49866286...
0.56409377
1
Change any numeric columns in our core schema to strings. Some columns like PID arrive as float or int types. We need to convert the floats to ints (since we want to get rid of the ".0") and then convert the int columns to str. We need to do this since we build parent/child keys by concatenating some of these value int...
def _num_cols_to_str( procs_cln: pd.DataFrame, schema: "ProcSchema", # type: ignore # noqa: F821 ) -> pd.DataFrame: # Change float/int cols in our core schema to force int schema_cols = [ col for col in attr.asdict(schema).values() if col and col in procs_cln.columns ] force_int_cols =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_int_to_str(df):", "def test__convert_to_str_dtype(self):\n new_column_types = process_mutation._convert_to_str_dtype(\n self.column_types, [\"foo\"]\n )\n assert new_column_types == {\"foo\": \"object\", \"bar\": \"object\"}", "def create_dtypes_str(df, max_size_stri...
[ "0.6355142", "0.62572265", "0.5918403", "0.58653873", "0.5677377", "0.55409217", "0.5471425", "0.54174095", "0.5401915", "0.538344", "0.5363697", "0.53505415", "0.5312164", "0.531032", "0.5267433", "0.52460843", "0.524159", "0.5227334", "0.521012", "0.5177431", "0.5173282", ...
0.6362964
0
Merge procs with parents using merge_asof.
def _merge_parent_by_time( procs: pd.DataFrame, schema: "ProcSchema", # type: ignore # noqa: F821 ) -> pd.DataFrame: parent_procs = ( procs[ [ schema.process_id, Col.EffectiveLogonId, Col.new_process_lc, Col.source_index, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def example_staypoints_merge():\n p1 = Point(8.5067847, 47.4)\n\n t1 = pd.Timestamp(\"1971-01-01 00:00:00\", tz=\"utc\")\n t2 = pd.Timestamp(\"1971-01-02 05:00:00\", tz=\"utc\")\n t3 = pd.Timestamp(\"1971-01-02 06:45:00\", tz=\"utc\")\n t4 = pd.Timestamp(\"1971-01-02 08:55:00\", tz=\"utc\")\n t45...
[ "0.53150934", "0.51900065", "0.5058164", "0.5057662", "0.4970098", "0.48208147", "0.4743613", "0.4735923", "0.47224164", "0.4721508", "0.47203505", "0.47181934", "0.471794", "0.47002944", "0.4695418", "0.46933174", "0.46843734", "0.4682874", "0.46639788", "0.46583503", "0.465...
0.6610868
0
Returns the top 5 most similar winners from our pokemon league data, given a single winning team. myTeam list of 6 pokemon names. league league to be considering pokedex dictionary with pokemon names as keys to pokemon instances as values
def get_sim_winners(teamNames,league,pokedex): bData, wHtml = loadBattleData(league) similarities = loadSims() results = [] myTeam = [getSimPokemon(pkm,similarities) for pkm in teamNames] for d in bData: winner, loser = determineWinner(d) score = 0 for pkm in myTeam: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scoreTeams(curTeams, oppTeam, pokedex, league, minDistWanted):\n battleData, htmlData = loadBattleData(league)\n similarities = loadSims() \n \n #If not given an opponent team then simply randomly choose losers from the dataset to compare to.\n if len(oppTeam) == 0:\n picks = set([])\n ...
[ "0.68629056", "0.6324324", "0.6290573", "0.59425783", "0.57627666", "0.5678293", "0.5615375", "0.5570595", "0.55454636", "0.55168325", "0.55126613", "0.54787564", "0.54584044", "0.54436314", "0.54137397", "0.53918636", "0.53845763", "0.5351121", "0.5300444", "0.52985793", "0....
0.64874274
1
Returns loaded data associated with the league levels, or none if associated with no league data and also returns the associated winhtml file. league one of the 11 supported leagues
def loadBattleData(league): path = os.path.dirname(os.path.realpath(__file__)) fString = None try: idx = LEAGUERANKS.index(league) fString = path+RANKSTOWINLOSEFILES[idx] except: #No file associated with the league. return None, None try: with open(fString, "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_leagues(self):\n here = os.path.dirname(os.getcwd())\n with open(os.path.join(here, self.LEAGUES_FILENAME)) as json_file:\n data = json.load(json_file)\n return data['leagues']", "def league(request,league_id=1):\n\n\t#define variables\n\targs = {}\n\tnews = []\n\n\t#gett...
[ "0.62932193", "0.61747855", "0.59221417", "0.58471715", "0.573756", "0.5722305", "0.5631495", "0.5613551", "0.55308914", "0.54132277", "0.5383598", "0.53657496", "0.5340374", "0.5316855", "0.5304499", "0.5278375", "0.52435386", "0.5204638", "0.5202595", "0.5198321", "0.512471...
0.74904084
0
Returns NUMTEAMSRETURN number of teams from curTeams as 'top' teams based on social data, along with a list of their scores. curTeams list of pokemon teams to consider oppTeam team of pokemon representing opponent team pokedex dictionary with pokemon names as keys to pokemon instances as values league one of the 11 sup...
def scoreTeams(curTeams, oppTeam, pokedex, league, minDistWanted): battleData, htmlData = loadBattleData(league) similarities = loadSims() #If not given an opponent team then simply randomly choose losers from the dataset to compare to. if len(oppTeam) == 0: picks = set([]) while (le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_current_teams_score(self):\n for game in self._get_live_games():\n teams_playing = [x['abbreviation'] for index, x in game['teams'].items()]\n if self.team in teams_playing:\n # Our team is playing in this game, get the score \n ret...
[ "0.64131546", "0.6392766", "0.6295676", "0.6139448", "0.6011329", "0.5956912", "0.5847488", "0.5829533", "0.5760881", "0.57603544", "0.5741986", "0.57035077", "0.56517524", "0.56435174", "0.55979204", "0.55692106", "0.5568594", "0.55622953", "0.5561629", "0.555497", "0.555348...
0.74281716
0
Return the current visualization. Default is no visualization
def get_visualization(): if Visualization.__current_visualization is None: Visualization.set_visualization(NoVisualization()) return Visualization.__current_visualization
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_graph(self):\n if self._linear_viewer.isVisible():\n return self._linear_viewer\n else:\n return self._flow_graph", "def get_default_plot(self):\n return self.default_plot", "def vis(self):\n \treturn self._vis", "def visual_reference(self) -> pulumi....
[ "0.7015167", "0.66728127", "0.6522938", "0.6354091", "0.6350514", "0.62987596", "0.6281821", "0.6218688", "0.62015843", "0.6179625", "0.61453456", "0.61453456", "0.61198264", "0.60377395", "0.60220164", "0.5964381", "0.5920324", "0.5883091", "0.5869931", "0.58525586", "0.5811...
0.85380006
0
Sets a new visualization.
def set_visualization(visualization): Visualization.__current_visualization = visualization
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_visualization(self, vis):\n # Destroy the old visualization to avoid leaking memory\n try:\n self.sizer.Remove(self.vis)\n self.vis.Destroy()\n except AttributeError:\n # Don't crash if there was no old visualization\n pass\n # Set the...
[ "0.75664", "0.67613727", "0.67532706", "0.67054766", "0.6348466", "0.6195793", "0.5890382", "0.58264846", "0.581631", "0.5799407", "0.5764887", "0.5696465", "0.5681003", "0.56570977", "0.565017", "0.56282824", "0.56247157", "0.56245434", "0.55731523", "0.5568358", "0.55621314...
0.775578
0
Sets a new node size
def set_node_size(self, new_node_size: float): self.node_size = new_node_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setsize(self, size):\n self.__size = size", "def onSize(self, event): \n\t\tw, h = self.GetClientSizeTuple()\n\t\tself.tree.SetDimensions(0, 0, w, h)", "def set_size(self, new_size: int):\n self.__tab_size = new_size\n self.__check_interpreter()\n self.__vals = [0...
[ "0.75852895", "0.7240643", "0.72272944", "0.7107579", "0.7069425", "0.6965684", "0.69520694", "0.69520694", "0.69520694", "0.69520694", "0.6937632", "0.69327074", "0.69160384", "0.6872866", "0.68569905", "0.684477", "0.6836281", "0.68328637", "0.6781417", "0.6777022", "0.6776...
0.89625835
0
Sets a new output directory
def set_output_directory(self, new_output_directory: str): self.output_directory = new_output_directory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setOutputDir(self, outputdir):\n self.outputdir = outputdir\n if not os.path.isdir(outputdir):\n os.makedirs(outputdir)", "def setOutputDir(self,outdir):\n\n logger = self.logger\n runstring = self.runstring\n force = self.force\n\n logger.info(runstring + \"Output...
[ "0.82821107", "0.79771626", "0.79613644", "0.79485244", "0.7578691", "0.7565269", "0.75264466", "0.749439", "0.7429396", "0.732117", "0.731421", "0.72510153", "0.72462237", "0.72454363", "0.7220839", "0.7162419", "0.7140022", "0.6970236", "0.6948216", "0.6944635", "0.68645376...
0.8459192
0
Set the position of the node in the visualization.
def set_node_position(self, node, x, y, z=0): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_node_positions(self):", "def setPosition(self):\n self.data['pos-x'] = \"%s\" % self.x()\n self.data['pos-y'] = \"%s\" % self.y()", "def setPos(self, pos):\n self.cameraNode.setPos(pos)", "def set_node(self, index, node):\r\n self.loc.coord[index] = node", "def set_node_...
[ "0.80316544", "0.76723444", "0.7639938", "0.7504539", "0.7441997", "0.7374458", "0.7365325", "0.73483866", "0.73460287", "0.7272101", "0.72263426", "0.7222932", "0.7220022", "0.7213865", "0.721017", "0.71766853", "0.7170008", "0.71616125", "0.7080263", "0.7057288", "0.7053259...
0.85538656
0
Finds SNPs with respect to the reference genome and writes the SNPs to the answer file.
def find_and_write_snps(answer_file, ref_genome, reads, lookup_table, thresh=0.6): # Use the consensus algorithm to determine SNPs relative to the reference genome # Write the SNPs to the answer file # TODO use the thresh param print "Finding SNPs..." read_map = __map_reads__(ref_genome, reads, loo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_ssearch36_df(name, ssearch_df, fasta_inputs, out_dir):\n\n fasta_in = [x for x in fasta_inputs if name.split(\".fasta.ss\")[0] == re.sub(\".fasta$\",\"\",os.path.basename(x))][0]\n fasta_file = pyfasta.Fasta(fasta_in)\n print(name) \n try:\n os.mkdir(out_dir)\n except:\n pa...
[ "0.5883539", "0.5657296", "0.5609451", "0.558543", "0.55291706", "0.5528156", "0.55074143", "0.5490762", "0.544737", "0.54255885", "0.53950757", "0.5362691", "0.534965", "0.5343809", "0.53275824", "0.5321692", "0.53178936", "0.5309606", "0.5297632", "0.5287152", "0.52773654",...
0.80086577
0
Maps the given read to the best position in the reference genome, if possible. Returns the best matching position in the reference genome, or None if no match is found
def get_best_read_position(ref_genome, read, positions, thresh): least = 100 best_pos = None for p in positions: num_mismatches = get_num_mismatches(read, ref_genome, p) if num_mismatches < thresh and num_mismatches < least: least = num_mismatches best_pos = p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_read(self, ref, read, ref_offset=0):\n\n if read.alignment.mapping_quality < self.config.min_mapq:\n return\n\n ref_pos = read.alignment.position.position - ref_offset\n read_pos = 0\n # Use set(), as some cigar operations might generate duplicated positions,\n # E.g. for insertions...
[ "0.5876357", "0.5854108", "0.57206434", "0.5676287", "0.5448705", "0.53857327", "0.5371495", "0.534903", "0.5319156", "0.52762634", "0.5226709", "0.5220328", "0.51804584", "0.5161435", "0.5159765", "0.51551884", "0.5149118", "0.51190424", "0.50989544", "0.50494", "0.502948", ...
0.72140175
0
Returns the number of mismatches between the reference genome starting at the specified position and the given sequence
def get_num_mismatches(sequence, ref_genome, position): characters = list(sequence) num_mismatches = 0 for i in range(0, len(characters)): if position + i >= len(ref_genome): break if characters[i] != ref_genome[position + i]: num_mismatches += 1 return num_misma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_sequence_mismatches(seq):\n trans_table = str.maketrans('ACGT', 'TGCA')\n half_len = len(seq) // 2\n second_half = seq[-half_len:].translate(trans_table)\n mismatches = 0\n for i in range(half_len):\n if seq[i] != second_half[-i - 1]:\n mismatches += 1\n return mismatc...
[ "0.7436655", "0.6384281", "0.63605845", "0.6251416", "0.6141242", "0.61273175", "0.60552704", "0.59271526", "0.58729815", "0.5872581", "0.5860833", "0.5816268", "0.5784733", "0.5768097", "0.5741856", "0.5740558", "0.5737593", "0.5729271", "0.5711081", "0.5703184", "0.56574935...
0.86014587
0
Create a DER encoded CMS data type given a conveyedinfo file and base64encode the response.
def opensslCmsDataCreate( conveyedInfoFile ): opensslCmdArgs = [ "openssl", "cms", "-data_create", "-in", conveyedInfoFile, "-outform", "der" ] conveyedInfoCmsDerBase64 = runOpensslCmd( opensslCmdArgs, [ "base64" ] ) return conveyedInfoCmsDerBase64
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_internal_value(self, data):\n try: # ToDo penetrate in order test if it has any security flaws\n decoded = base64.b64decode(data)\n mime_type = magic.from_buffer(decoded, mime=True)\n file_ext = mimetypes.guess_extension(mime_type)\n except TypeError:\n ...
[ "0.6028859", "0.5847619", "0.5839393", "0.5480351", "0.53368914", "0.5330984", "0.5247696", "0.5235479", "0.5232634", "0.5227278", "0.5222667", "0.52152556", "0.521113", "0.5203105", "0.5159984", "0.5137093", "0.51293385", "0.5050312", "0.5014207", "0.50107014", "0.49795356",...
0.6957099
0
Create a signed CMS encoded object given a conveyedinfo file and base64 encode the response.
def opensslCmsSignedDataCreate( conveyedInfoFile, cert, privateKey ): opensslCmdArgs = [ "openssl", "cms", "-sign", "-in", conveyedInfoFile, "-signer", cert, "-inkey", privateKey, "-outform", "der", "-nodetach" ] conveyedInfoCmsSignedDerBase64 = ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opensslCmsDataCreate( conveyedInfoFile ):\n opensslCmdArgs = [ \"openssl\", \"cms\", \"-data_create\", \"-in\", conveyedInfoFile,\n \"-outform\", \"der\" ]\n conveyedInfoCmsDerBase64 = runOpensslCmd( opensslCmdArgs, [ \"base64\" ] )\n return conveyedInfoCmsDerBase64", "def open_and...
[ "0.68802476", "0.57600963", "0.56639785", "0.56213754", "0.55112994", "0.54730743", "0.5465122", "0.5425926", "0.5361701", "0.5321274", "0.5312067", "0.5278479", "0.52773", "0.52584666", "0.52542394", "0.5243983", "0.52368605", "0.5193875", "0.51854706", "0.5185009", "0.51680...
0.6407271
1
Extract base64 value from pinneddomaincert file; i.e. given a PEM encoded cert, strip header and footer.
def getBase64PinnedDomainCert( pinnedDomainCertFile ): tailCmdArgs = [ "tail", "-n", "+2", pinnedDomainCertFile ] headCmdArgs = [ "head", "-n", "-1" ] pinnedDomainCertBase64 = runOpensslCmd( tailCmdArgs, headCmdArgs ) return pinnedDomainCertBase64
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_ca_crt_bytes_from_pem(pem_content):\n begin_search = pem_content.find(constants.BEGIN_CERTIFICATE_MARKER)\n if begin_search < 0:\n raise exception.InvalidKubernetesCA\n\n end_search = pem_content.find(constants.END_CERTIFICATE_MARKER)\n if end_search < 0:\n raise exception.Inv...
[ "0.606301", "0.5976179", "0.58105767", "0.5476757", "0.54603827", "0.5449754", "0.5434406", "0.5392469", "0.53901625", "0.53467846", "0.52828676", "0.52781343", "0.52742517", "0.5256527", "0.522737", "0.5226231", "0.52005994", "0.5152916", "0.5138789", "0.513565", "0.5134552"...
0.714601
0
Create a file within httpd directory containing response for uri
def createHttpdResponseFile( responseXml, restconfDir="/restconf/operations" ): if not os.path.exists( restconfDir ): os.makedirs( restconfDir ) responseXmlFile = "{}/ietf-sztp-bootstrap-server:get-bootstrapping-data".\ format( restconfDir ) with open( responseXmlFile, "w" ) as respF...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_file(self, response):\r\n # Extract filename from response url\r\n filename = re.search('[^/]+(?=/$|$)', response.url).group(0)\r\n\r\n # Prepend download folder name to the filename\r\n filename = self.config[\"folder\"] + filename\r\n os.makedirs(os.path.dirname(filena...
[ "0.6425665", "0.6304316", "0.62894547", "0.627631", "0.61327916", "0.6088824", "0.6078078", "0.5965769", "0.5963274", "0.5880248", "0.587777", "0.58741266", "0.5837021", "0.576541", "0.5713638", "0.57001615", "0.5658703", "0.56253684", "0.5589897", "0.55822724", "0.5550171", ...
0.69076777
0
Verify dict value types correspond to template
def verifyDictTypes( template, dictToCheck ): for key in dictToCheck: if not ( ( isinstance( dictToCheck[ key ], list ) and isinstance( template[ key ], list ) ) or ( isinstance( dictToCheck[ key ], dict ) and isinstance( template[ key ], dict ) ) or ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dictionary_coerce():\n\n @type_checked\n def _run_test(something:{int: str}):\n for key, value in something.items():\n assert isinstance(key, int)\n assert isinstance(value, str)\n\n _run_test(something={123: \"abc\", 2314: 12312, \"123\": \"abc\"})", "def check_for...
[ "0.66782385", "0.66468674", "0.6595941", "0.6493282", "0.6471941", "0.6394708", "0.62859756", "0.62481934", "0.61028117", "0.6082978", "0.60659516", "0.60586894", "0.60274726", "0.6018177", "0.60154957", "0.6013911", "0.59892005", "0.5982993", "0.59721565", "0.596949", "0.596...
0.7521832
0
Generate file containing bootstrap redirect information (json). sztpRedirectServers is a list of dictionaries, of the template below.
def genConvRedirectInfoJsonFile( sztpRedirectServers, redirectFileJson ): template = { "address": str, "port": int, "trust-anchor": str } mandatory = [ "address" ] # verify redirect-server list is correctly constructed assert isinstance( sztpRedirectServers, list ), "Expec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genSztpBootstrapResponseFile( conveyedInfoFileJson, reportingLevel ):\n\n # CMS wrap this data (unsigned)\n conveyedInfoCms = opensslCmsDataCreate( conveyedInfoFileJson )\n\n # XML encode the artifacts (conveyedInfo only)\n return genBootstrappingDataResponseFile( conveyedInfo=conveyedInfoCms,\n ...
[ "0.5130368", "0.50381947", "0.49691543", "0.48931608", "0.48542204", "0.48228222", "0.4813354", "0.48039177", "0.47937784", "0.47869673", "0.4624361", "0.45916578", "0.45715594", "0.45654586", "0.45513126", "0.45467854", "0.45035234", "0.4503066", "0.45007342", "0.44736442", ...
0.7551597
0
Generate file containing bootstrap onboarding information (json).
def genConvOnboardingInfoJsonFile( sztpOnboardingInfo, onboardingFileJson ): template = { "boot-image": { "os-name": str, "os-version": str, "download-uri": list, # of uri strings "image-verification": [ { "hash-algorithm": str, "hash-value": str } ],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api():\n return send_file('templates/bootstrapper.swagger.json')", "def write_bootstrap(self):\n\n for line in Bootstrap.BOOTSTRAP:\n self.write_line(line)\n\n self.write_call(\"Sys.init\", 0)", "def create_newfile():\n date = datetime.today().strftime('%d_%m_%Y').replace(\" ...
[ "0.59714407", "0.5859425", "0.5583089", "0.5551649", "0.5481499", "0.54219496", "0.5345955", "0.53165185", "0.5276273", "0.5172367", "0.50922686", "0.5084571", "0.50319684", "0.50302076", "0.50239533", "0.5008993", "0.50066954", "0.50027114", "0.49786752", "0.4978495", "0.497...
0.60188127
0
Verify boot image is correct
def verifyBootImage( template, sztpBootImage ): def verifyImageVerification( imageVerification ): """Verify instance of image-verification is correct""" if "hash-algorithm" in imageVerification: assert imageVerification[ "hash-algorithm" ] == \ "ietf-sztp-conveyed-info...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_exist(self):\n helper.RbdImageOperator._check_rbd_image(self.real_path)", "def testCheckAvailable(self):\n img = self.img\n img.inspect()\n with converter.RootMounted(img.converter._h,\n '/dev/VolGroup00/LogVol00'):\n c = img.conv...
[ "0.6479312", "0.64290893", "0.6369703", "0.635404", "0.6286041", "0.6180226", "0.61096185", "0.608363", "0.60541505", "0.60480213", "0.6047562", "0.5977092", "0.5966454", "0.5957976", "0.58941513", "0.58904773", "0.58685666", "0.58676755", "0.5859996", "0.5856276", "0.5854957...
0.7287546
0