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
admin "erase" board route
def erase_board(bid): if current_user.is_admin: DB.session.delete(Board.query.get(bid)) DB.session.commit() msg = 'Board {} permanently removed from database. '\ 'All associated posts and comments have also been removed.' flash(msg.format(bid)) else: flash(con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_board(bid):\n if current_user.is_admin:\n Board.query.get(bid).deleted = True\n DB.session.commit()\n flash('Board {} is no longer viewable.'.format(bid))\n return redirect(request.referrer)", "def revive_board(bid):\n if current_user.is_admin:\n Board.query.get(bi...
[ "0.6663433", "0.6346066", "0.61803126", "0.6123992", "0.6109822", "0.6013274", "0.5860381", "0.578081", "0.5780407", "0.5756733", "0.5743018", "0.5732131", "0.5723054", "0.56639546", "0.56594646", "0.5619822", "0.5611579", "0.5577402", "0.55449736", "0.5531958", "0.5501947", ...
0.706307
0
admin revive board route
def revive_board(bid): if current_user.is_admin: Board.query.get(bid).deleted = False DB.session.commit() msg = 'Board {} is now visible again.' flash(msg.format(bid)) else: flash(constants.DEFAULT_SUBMISSION_ERR) return redirect(request.referrer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route(self):\n pass", "def route(self):\n # TODO: wenn keine url, herausfinden, welche ????\n # TODO: wenn url = hostname (fqdn), dann -> google.ch\n if not (self.META.has_key('REMOTE_ADDR') and \n self.GET.has_key('provider')):\n #self.GET.has_key('url')):\n #return HttpRe...
[ "0.639884", "0.57397103", "0.5584636", "0.54806924", "0.54461694", "0.5399685", "0.53785545", "0.5375579", "0.53507906", "0.53437626", "0.53437626", "0.5334951", "0.5329222", "0.5291434", "0.52833575", "0.52498335", "0.5245823", "0.52204305", "0.52161586", "0.5197525", "0.519...
0.63001364
1
subscribe accounts log groups to target account log group destination
def subscribe(config, accounts, region, merge, debug): config = validate.callback(config) subscription = config.get('subscription') if subscription is None: log.error("config file: logs subscription missing") sys.exit(1) def converge_destination_policy(client, config): destinat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _subscribe_users(self):\n group = self.env.ref('odoo_magento2_ept.group_connector_manager')\n if not group:\n return\n companies = self.mapped('company_id')\n domain = [('groups_id', '=', group.id)]\n if companies:\n domain.append(('company_id', 'child_o...
[ "0.6371777", "0.6259225", "0.5749728", "0.56459796", "0.55690557", "0.55181706", "0.5429786", "0.5353789", "0.51864505", "0.5160758", "0.51556367", "0.51556367", "0.51556367", "0.51459944", "0.5069009", "0.5033788", "0.50062", "0.49968696", "0.49712193", "0.49004823", "0.4897...
0.7344485
0
Filter log groups by shell patterns.
def filter_group_names(groups, patterns): group_names = [g['logGroupName'] for g in groups] matched = set() for p in patterns: matched.update(fnmatch.filter(group_names, p)) return [g for g in groups if g['logGroupName'] in matched]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_command_filter(self, testsuite_pattern, testcase_pattern):\n return None # Hobbes-test does not support listing by filter", "def list(self, pattern='*'):\n if self._group_dict is None:\n self._group_dict = collections.OrderedDict(\n (group.name, group) for group in self._client....
[ "0.6008613", "0.5841888", "0.5739808", "0.5477056", "0.5305808", "0.5287709", "0.5283606", "0.5276361", "0.5276361", "0.5247437", "0.5243044", "0.52194685", "0.521362", "0.519743", "0.5168097", "0.5156099", "0.5154336", "0.51460075", "0.51007366", "0.50932705", "0.50567377", ...
0.6737141
0
Filter log groups by their creation date. Also sets group specific value for start to the minimum of creation date or start.
def filter_creation_date(groups, start, end): results = [] for g in groups: created = datetime.fromtimestamp(g['creationTime'] / 1000.0) if created > end: continue if created > start: g['exportStart'] = created else: g['exportStart'] = start ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _groupDate(item):\n return item.time.date()", "def filter_last_write(client, groups, start):\n retry = get_retry(('ThrottlingException',))\n\n def process_group(group_set):\n matched = []\n for g in group_set:\n streams = retry(\n client.describe_log_streams,\...
[ "0.5349732", "0.53088593", "0.5135366", "0.51161885", "0.50460446", "0.50092417", "0.49472526", "0.4919195", "0.4872214", "0.47953695", "0.47320732", "0.47296935", "0.47275117", "0.4711657", "0.4679824", "0.46712154", "0.46613857", "0.46525186", "0.46412024", "0.4633902", "0....
0.7864727
0
Filter log groups where the last write was before the start date.
def filter_last_write(client, groups, start): retry = get_retry(('ThrottlingException',)) def process_group(group_set): matched = [] for g in group_set: streams = retry( client.describe_log_streams, logGroupName=g['logGroupName'], orde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_creation_date(groups, start, end):\n results = []\n for g in groups:\n created = datetime.fromtimestamp(g['creationTime'] / 1000.0)\n if created > end:\n continue\n if created > start:\n g['exportStart'] = created\n else:\n g['exportStar...
[ "0.6635909", "0.52722096", "0.52423257", "0.518209", "0.51671964", "0.51543635", "0.5145697", "0.5122798", "0.51035225", "0.5058704", "0.50209457", "0.5015845", "0.49920514", "0.4966966", "0.49647346", "0.49560562", "0.49525395", "0.48545003", "0.48374102", "0.4812402", "0.47...
0.6843721
0
Filter days where the bucket already has extant export keys.
def filter_extant_exports(client, bucket, prefix, days, start, end=None): end = end or datetime.now() # days = [start + timedelta(i) for i in range((end-start).days)] try: tag_set = client.get_object_tagging(Bucket=bucket, Key=prefix).get('TagSet', []) except ClientError as e: if e.respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_up_old_exports(self):\n threshold = datetime.datetime.utcnow() - datetime.timedelta(days=30)\n self.session.query(Export).filter(Export.started_at < threshold).delete()", "def export_old_audits(min_to_export=1000, export_count=500):\n try:\n # print min_to_export, export_count\n...
[ "0.52053744", "0.5099278", "0.50236905", "0.5003069", "0.4969293", "0.49566582", "0.49530184", "0.49155438", "0.4885868", "0.48518157", "0.48443332", "0.48185405", "0.48138407", "0.4807479", "0.47937182", "0.47893035", "0.47234836", "0.47130275", "0.47066486", "0.46859834", "...
0.7333458
0
Check iam permissions for log export access in each account
def access(config, region, accounts=()): config = validate.callback(config) accounts_report = [] def check_access(account): accounts_report.append(account) session = get_session(account['role'], region) identity = session.client('sts').get_caller_identity() account['account_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_accessible_to_all(self, pvm: PermissionView) -> bool:\n\n return pvm.permission.name in self.ACCESSIBLE_PERMS", "def has_export_permission(self, request):\n opts = self.opts\n codename = get_permission_codename('export', opts)\n return request.user.has_perm(\"%s.%s\" % (opts.a...
[ "0.5922439", "0.5674963", "0.5661662", "0.560372", "0.5548407", "0.5503811", "0.5503811", "0.5503811", "0.5503811", "0.5503811", "0.54923755", "0.54669565", "0.5439774", "0.5423338", "0.5386345", "0.53821", "0.53797674", "0.5375663", "0.5375663", "0.5371909", "0.53555375", ...
0.60143447
0
export a given log group to s3
def export(group, bucket, prefix, start, end, role, poll_period=120, session=None, name="", region=None): start = start and isinstance(start, str) and parse(start) or start end = (end and isinstance(start, str) and parse(end) or end or datetime.now()) start = start.replace(tzinfo=tzloc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def export_cw_logs_to_s3(global_vars, log_group_name, retention_days, bucket_name, obj_prefix = None):\n resp_data = {'status': False, 'task_info':{}, 'error_message': ''}\n if not retention_days: retention_days = 90\n if not obj_prefix: obj_prefix = log_group_name.split('/')[-1]\n now_time = dat...
[ "0.7299515", "0.6354688", "0.609733", "0.5968771", "0.5890701", "0.57919425", "0.5719376", "0.5693675", "0.5673941", "0.5615103", "0.55705446", "0.55546635", "0.5508692", "0.5500976", "0.5415052", "0.53872406", "0.5381192", "0.5351819", "0.5333531", "0.5318828", "0.52851784",...
0.76097655
0
Open a text file & return a list of lowercase strings.
def load(filename: str) -> list: try: with open(filename) as in_file: loaded_txt = in_file.read().strip().split("\n") loaded_txt = [x.lower() for x in loaded_txt] return loaded_txt except IOError as e: print("{}\nError opening {}. Terminating program.".format(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_text_file(filename):\n try:\n file = open(filename, 'r')\n except:\n print('Cannot read file ' + filename + '. Please check the path', file=sys.stderr)\n sys.exit(1)\n output = []\n \n for line in file:\n line = line.strip().lower(...
[ "0.7791968", "0.76199895", "0.7393152", "0.7225327", "0.7197625", "0.7197625", "0.71210194", "0.70748514", "0.69804806", "0.6914742", "0.6905123", "0.6821919", "0.67699254", "0.6751201", "0.66823953", "0.66470754", "0.6636171", "0.66317534", "0.6623684", "0.6623684", "0.66015...
0.76761186
1
The constructor takes in sender, receiver and a signature.
def __init__(self, sender: str, receiver: str, signature: str) -> None: super().__init__(sender, receiver) self.signature = signature
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, method, receiver):\n self.method = method\n if type(receiver) == Class:\n self.receiver = cast(receiver, objc_id)\n else:\n self.receiver = receiver", "def __init__(self, sender):\r\n\t\tself.sender = sender", "def __init__(self, sig, *args, **kwarg...
[ "0.6864943", "0.68118566", "0.6798293", "0.6582685", "0.6582685", "0.6582685", "0.64841205", "0.6334486", "0.6323883", "0.6277131", "0.60506815", "0.6022045", "0.6010426", "0.60057503", "0.5989921", "0.5977475", "0.5931117", "0.59037286", "0.59037286", "0.5903544", "0.5898120...
0.8604357
0
Search `docstr` for a type of `param_str`.
def _search_param_in_docstr(docstr, param_str): # look at #40 to see definitions of those params patterns = [re.compile(p % re.escape(param_str)) for p in DOCSTRING_PARAM_PATTERNS] for pattern in patterns: match = pattern.search(docstr) if match: return _strip_res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_doc(cls, type_str):\n do_doc_test(cls, type_str)", "def string_check(param, name):\n\tif not isinstance(param, strcomp):\n\t\traise TypeError(\"Keyword arg '%s' must be of type string. Got: %s\" % (\n\t\t\tname, type(param)))\n\telse:\n\t\tpass", "def findType(*args, deep: bool=True, exact: bool=Tr...
[ "0.63382846", "0.598061", "0.58747685", "0.5833059", "0.57483447", "0.56994957", "0.56646067", "0.56259286", "0.5518372", "0.54818416", "0.54810244", "0.5438783", "0.5408456", "0.5370847", "0.53659624", "0.5362474", "0.5314391", "0.528517", "0.528517", "0.5272139", "0.5266672...
0.75555766
0
Strip off the part looks like a ReST role in `type_str`.
def _strip_rest_role(type_str): match = REST_ROLE_PATTERN.match(type_str) if match: return match.group(1) else: return type_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_action_str(string: str) -> str:", "def keep_types_s(s, types):\n patt = \"(?s)\" + \"|\".join(\"(?<=\\n)\" + s + \"\\n.+?\\n(?=\\S+|$)\" for s in types)\n return \"\".join(re.findall(patt, \"\\n\" + s.strip() + \"\\n\")).rstrip()", "def remove_rt(token):\n if token == 'rt' or tok...
[ "0.63687265", "0.614773", "0.5987192", "0.5897323", "0.58686006", "0.5840779", "0.58221066", "0.57654697", "0.57208276", "0.5631733", "0.55604565", "0.55465204", "0.5546396", "0.54754424", "0.5445958", "0.5437278", "0.543659", "0.5418817", "0.54181844", "0.5377318", "0.536126...
0.80957615
0
Sets the blocks of this SmartNvmeSize.
def blocks(self, blocks: int): self._blocks = blocks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_x_block_size(self):\n self._scene_gen.block_dimensions = (self._block_size_x_spinbox.value(),\n self._scene_gen.block_dimensions[Y],\n self._scene_gen.block_dimensions[Z])\n self._refresh_view()", "def bl...
[ "0.6569442", "0.64330506", "0.6303345", "0.60803413", "0.6073872", "0.6004342", "0.5976128", "0.59371215", "0.58781767", "0.58410674", "0.5803466", "0.5743724", "0.5650272", "0.56428427", "0.5577154", "0.5539702", "0.553863", "0.55320626", "0.55199337", "0.55170935", "0.54881...
0.71460104
0
Return query, with all existing models.
def get_models_query(): query = db.session.query(Products.model).distinct() return query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def models(self, model=None):\n for query in self.__queries:\n if isinstance(query, orb.Query):\n yield query.model(model)\n else:\n for model in query.models(model):\n yield model", "def _get_all_records(self) -> List[DBModelInstance]...
[ "0.69336724", "0.67575055", "0.6741291", "0.6721403", "0.66756815", "0.66453505", "0.65904415", "0.6569294", "0.65680003", "0.6514055", "0.6467715", "0.64061546", "0.64025044", "0.6397078", "0.6390089", "0.6326347", "0.6288563", "0.6265645", "0.6263423", "0.62535185", "0.6227...
0.75393826
0
Return query, on all existing producents.
def get_producents_query(): query = db.session.query(Products.producent).distinct() return query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getAllProvas(self):\n return self.execSql(\"select_all_provas\")", "def generate_query(self):\n return", "def make_query(self):", "def query(self):\n pass", "def get_query(self):\n q = db.Query(self.KIND,keys_only=self.KEYS_ONLY)\n for prop, value in self.FILTERS...
[ "0.70404816", "0.60729134", "0.603747", "0.5846816", "0.58360267", "0.58090544", "0.58018607", "0.5783798", "0.57318574", "0.5725078", "0.56661415", "0.5665614", "0.56622094", "0.56526935", "0.5649819", "0.56355524", "0.56053555", "0.55854297", "0.55686235", "0.55618703", "0....
0.7525649
0
Set a minimum relative uncertainty for the HirexSr signals.
def set_min_uncertainty(signal, threshold=0.05): # Increase Hirex-Sr uncertainties to be a rel error of 5% minimum (JUST FOR TESTING) corrected_unc=signal.std_y/signal.y<=0.05 signal.std_y[corrected_unc]=0.05*signal.y[corrected_unc] # correction for normalized uncertainties if signal.s/signal.m<=0....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_min_confidence(self, new_min):\n self.__min_confidence = new_min", "def set_Ec_min(self, x):\n x = float(x)\n if self.Ec_min != x:\n self.Ec_min = x\n self.Ec[0] = x", "def setUncertainty(self, uncertainty):\n self.uncertainty = uncertainty", "def...
[ "0.6703387", "0.63027465", "0.6177287", "0.5665198", "0.56195945", "0.56136763", "0.55630547", "0.55627656", "0.555593", "0.555593", "0.54854083", "0.54678583", "0.54263455", "0.5422868", "0.54227537", "0.5412941", "0.5385455", "0.5342574", "0.53386", "0.53296685", "0.5296957...
0.69471943
0
Calculate the impurity confinement time, defined as the time constant obtained from an exponential fit of the spectroscopic signal after peaking. If signal is an array of signals, finds the impurity confinement time for each, then provides the mean and standard deviation within the set.
def get_tau_imp(signal, plots=True): tau_imp=np.zeros((signal.y.shape[1],1)) time=signal.t if plots==True: f1 = plt.figure() ax1 = f1.add_subplot(2,1,1) ax2 = f1.add_subplot(2,1,2) for i in range(signal.y.shape[1]): sig=signal.y[:,i] # Subtract the m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error_time(input_signalorspectrum, output_signalorspectrum):\n if isinstance(input_signalorspectrum, list) != True:\n observed_l = []\n observed_l.append(input_signalorspectrum)\n else:\n observed_l = input_signalorspectrum\n if isinstance(output_signalorspectrum, lis...
[ "0.5298134", "0.51132464", "0.5097189", "0.5064602", "0.50354946", "0.50028414", "0.49787804", "0.49409816", "0.49381432", "0.4925306", "0.49154824", "0.49072072", "0.49028787", "0.4901111", "0.4873843", "0.48637593", "0.48314908", "0.4823539", "0.4823539", "0.48046473", "0.4...
0.5672792
0
Lists available interface names.
def list(): return netifaces.interfaces()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interface_list() -> List[str]:\n cmd_ip = system_command('ip')\n command = f\"{cmd_ip} -o addr show up primary scope global\".split()\n result = SUDO.execute_unit(command)\n result.assert_return()\n line_list = result.stdout.splitlines()\n pattern = re.compile(r\"^\\d+[:]\\s+(\\S+)\\s+(.+)$\"...
[ "0.7411383", "0.7232032", "0.72114456", "0.6973412", "0.69043547", "0.68619394", "0.679673", "0.6740396", "0.6686123", "0.6686123", "0.6661291", "0.66574144", "0.6648544", "0.65959096", "0.65669006", "0.65150845", "0.64693594", "0.64693594", "0.64693594", "0.6445497", "0.6410...
0.7836606
0
build weixin JSApi.chooseWXPay params
def build_jspay_params(paysign_key, appid, prepay_id): _params = { "nonceStr": sign.random_nonce_str(32), "timeStamp": int(time.time()), "package": 'prepay_id={}'.format(prepay_id), "signType": "MD5", "appId": appid } _params['paySign'] = sign.sign_for_pay(paysign_key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_parameters(pobj):\n ViscosityWilke.build_parameters(pobj)", "def initialize(public_api_key, default_wak=None, params=None):\n\n if params is None:\n params = {}\n\n print('initializing lnpay..')\n\n global __VERSION__\n global __PUBLIC_API_KEY__\n global __ENDPOINT_URL_...
[ "0.5316788", "0.5219171", "0.49018717", "0.48517498", "0.48473987", "0.4843703", "0.47966686", "0.4786458", "0.4684021", "0.46805087", "0.46547464", "0.46540335", "0.46333072", "0.46102008", "0.46095118", "0.46002406", "0.45881376", "0.45822966", "0.4577122", "0.4576725", "0....
0.5701106
0
Return sorted content items for this block.
def get_content_for_block(self, block_name): return self.page_content_items.filter(block_name=block_name).order_by('sort')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_items(self, instance):\n sorted_items = instance.items.order_by('contentitemonpage__sort_by').all()\n return ContentItemSerializer(sorted_items, read_only=True, many=True).data", "def __get_items(self, sort_keys_function=None):\n if sort_keys_function:\n return sorted(list...
[ "0.7203827", "0.65020275", "0.6405821", "0.6380889", "0.6337046", "0.6282616", "0.62138516", "0.6061105", "0.5986232", "0.5945387", "0.59096706", "0.5909197", "0.57804215", "0.5760349", "0.57546836", "0.5749722", "0.57332176", "0.57332176", "0.57321185", "0.57300663", "0.5728...
0.7341322
0
Fetches repos from config.json
def fetch_repos(self): for repo in self.json_repos['repos']: title = str(repo["title"]) repo_url = str(repo['repo']) self.repos[title] = repo_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_repos(connection):\n\n try:\n response = connection.get_json('repository')\n except HTTPRequestError as ex:\n raise exception_from_http_error(ex) from ex\n\n result = response.get('result', [])\n return [Repository(connection, repo['rid'], data=repo) for repo in result]", "def...
[ "0.69072866", "0.68005025", "0.6771198", "0.6725589", "0.66690826", "0.6660223", "0.6563224", "0.6562054", "0.6532253", "0.6429869", "0.6419862", "0.6401692", "0.63973206", "0.62876177", "0.6262754", "0.62594336", "0.6254202", "0.6254202", "0.6208351", "0.6194637", "0.6191547...
0.78047276
0
Fetches branches for each repo from config.json
def fetch_branches(self): for jrepo in self.json_repos['repos']: title = str(jrepo["title"]) self.branches[title] = str(jrepo['current'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def branches_full(config, args):\n for b in config.repo.branches():\n yield config.repo.branch(b.name)", "def show_branches(config, args):\n for item in lib.input_json_lines():\n yield config.repo.branch(item)", "def make_branches(self, api_json=None):\n if api_json is None:\n return ...
[ "0.69463867", "0.68368787", "0.6707363", "0.6653876", "0.6577588", "0.65272236", "0.6501614", "0.64859295", "0.64772815", "0.6438882", "0.64305085", "0.6258769", "0.62371534", "0.6195701", "0.6190658", "0.61512154", "0.6114853", "0.60720813", "0.60627514", "0.60360074", "0.59...
0.7710535
0
Returns a list of steps for cloning necessary repos
def repos_clone_steps(self): platform = self.platform # required by coho tools to correctly resolve repo location if platform == "blackberry10": platform = "blackberry" return [ ShellCommand(command=["node", "medic/checkout.js", "--path=medic/repos.json", "--cat=C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone_all_repo(self):\n repo_path = self.cfg['paths']['repo']\n since = datetime.datetime.strptime(self.cfg['filters']['since'], self.cfg['filters']['date_format'])\n threads = []\n # INITIALIZE ALL REPOS\n for repo in self.cfg[\"repos\"]:\n if (not self.cfg['repla...
[ "0.6446149", "0.6382948", "0.6273487", "0.6116369", "0.59837794", "0.59746057", "0.58794206", "0.5857089", "0.5844229", "0.5772935", "0.572115", "0.5718577", "0.57020026", "0.56601727", "0.56417", "0.5637879", "0.5619802", "0.56186646", "0.5604742", "0.5546208", "0.55187005",...
0.79946405
0
Returns a list of steps for CLI setup
def cli_steps(self): return [ ShellCommand(command=["git", "clone", "-b", CONFIG.branches['CLI'], CONFIG.repos['CLI'], "cordova-cli"], workdir='build', haltOnFailure=True, description='Clone CLI'), ShellCommand(command=["git", "clone", "--depth", "1", "-b", CONFIG.branches['CORDOVA-LIB']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_commands(self):\n return self.get_data(\"setup_commands\")", "def _get_install_steps(self):\n\n content = self._get_yaml_content()\n\n return self._fix_install_steps(content['install'])", "def get_all_steps(self):\n steps = []\n steps.extend(self.init_workspace_step...
[ "0.6651091", "0.6479719", "0.6409983", "0.6366993", "0.6313349", "0.6267738", "0.6155656", "0.6142456", "0.6105375", "0.60354024", "0.5895893", "0.5795892", "0.57458186", "0.56846845", "0.567229", "0.5646961", "0.5621909", "0.56113553", "0.5608341", "0.55730104", "0.5529855",...
0.7070678
0
Returns a list of steps for mobilespec app setup
def prepare_mobilespec_steps(self): platform = self.platform # required by coho tools to correctly resolve repo location if platform == "blackberry10": platform = "blackberry" return [ NPMInstall(workdir='build/cordova-mobile-spec/createmobilespec', haltOnFailure=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_steps(self):\n return [ShellCommand(command=[\"node\", \"medic/build_\" + self.platform + \".js\"], workdir='build', timeout=CONFIG.build_timeout, description='Run tests', name='Run tests')]", "def init_workspace_steps(self):\n return [\n InstallShellJS(),\n RMComma...
[ "0.65084136", "0.642119", "0.6384407", "0.63580227", "0.6311263", "0.62183255", "0.59461796", "0.56012833", "0.555745", "0.55543995", "0.5514638", "0.54713285", "0.54269874", "0.54202676", "0.53925604", "0.5366822", "0.53609735", "0.5345367", "0.5297906", "0.5297146", "0.5282...
0.760149
0
Returns a list of steps for deploying mobilespec application to test device
def deploy_steps(self): return [ShellCommand(command=["node", "medic/build_" + self.platform + ".js"], workdir='build', timeout=CONFIG.build_timeout, description='Run tests', name='Run tests')]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_mobilespec_steps(self):\n platform = self.platform\n # required by coho tools to correctly resolve repo location\n if platform == \"blackberry10\":\n platform = \"blackberry\"\n return [\n NPMInstall(workdir='build/cordova-mobile-spec/createmobilespec',...
[ "0.75590795", "0.63454", "0.6130196", "0.6108414", "0.5982014", "0.58221376", "0.5818699", "0.56397694", "0.5596652", "0.55899227", "0.5447674", "0.54173493", "0.5405188", "0.5400062", "0.53762925", "0.53739935", "0.53050184", "0.5303761", "0.5242022", "0.5242022", "0.5223853...
0.75774807
0
Returns a list of all steps current platform
def get_all_steps(self): steps = [] steps.extend(self.init_workspace_steps()) steps.extend(self.repos_clone_steps()) steps.extend(self.cli_steps()) steps.extend(self.prepare_mobilespec_steps()) steps.extend(self.deploy_steps()) return steps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def availableSteps( self ):\n assert isinstance( self._level, int )\n assert isinstance( self._steps, list )\n assert isinstance( self._outter, Env ) or ( self._outter is None )\n\n lst = [ ]\n self._availableSteps( lst )\n return lst", "def Platforms():\n return platforms", ...
[ "0.6643733", "0.6476299", "0.6185028", "0.59915143", "0.5967349", "0.59573674", "0.5938493", "0.5935553", "0.59315646", "0.5929291", "0.5864497", "0.58506036", "0.58318293", "0.58021766", "0.5801714", "0.57479554", "0.5633305", "0.5621189", "0.56003636", "0.55945224", "0.5584...
0.7025099
0
Creates and returns a default factory for platform
def get_default_factory(self): factory = BuildFactory() factory.addSteps(self.get_all_steps()) return factory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_factory():", "def get_factory(self):\n\n return Factory(type(self), self.kwargs)", "def get_factory():\n # Get config from Django settings\n sdk_config = settings.SPLITIO\n api_key = settings.SPLITIO.get('apiKey', '')\n\n return get_splitio_factory(\n api_key,\n config=...
[ "0.7371389", "0.69652283", "0.66573524", "0.6580631", "0.65027964", "0.6408167", "0.6408167", "0.63948816", "0.63177794", "0.6279471", "0.62083936", "0.61812407", "0.6175728", "0.6141327", "0.6116158", "0.6052502", "0.60209906", "0.6020783", "0.6019271", "0.59833974", "0.5974...
0.70641434
1
Splits the batched output into minibatches and returns JSON
def _batch_to_json(self, batch, lengths): outputs = [] cursor = 0 for length in lengths: cursor_end = cursor + length mini_batch = batch[cursor:cursor_end] outputs.append(self._to_json(mini_batch)) cursor = cursor_end return outputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stream(self, batch):\n response = self.post(batch)\n try:\n for i, result_data in grouped(response):\n result = JobResult.hydrate(assembled(result_data), batch)\n log.info(\"< %s\", result)\n yield result\n finally:\n respo...
[ "0.59080344", "0.5836622", "0.5752528", "0.5719733", "0.57189065", "0.56764466", "0.5583515", "0.54925376", "0.5491519", "0.54831016", "0.5462597", "0.5448692", "0.54304487", "0.5430236", "0.5419724", "0.5404057", "0.5388233", "0.53790146", "0.5311455", "0.530825", "0.5275606...
0.6573735
0
check if the file is 3D
def is3D(data): return data.find("x3") != -1 and data.find("y3") != -1 and data.find("z3") != -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is3DImage(self):\n\t\treturn self.is3D", "def is3_d(self):\n return self.container['is3_d']", "def test_3D_extension(filename):\n\t\n\t# We need to make a test for extention :\n\timport os\n\textension = (os.path.splitext(filename)[1]).upper()\n\text_ok=['.3DMF','.3DM','.3DS','.ABC','.AC','.AMF','....
[ "0.77863926", "0.7232436", "0.70992756", "0.64200777", "0.63904953", "0.6375951", "0.61639416", "0.6107695", "0.60958946", "0.60189956", "0.5987281", "0.59524274", "0.59127194", "0.5904561", "0.58345073", "0.5822435", "0.5760195", "0.5750544", "0.5736583", "0.5732694", "0.573...
0.75637364
1
creating local preview for the converted image
def __createPreviewLocal(self, data, format, width, height, params): ifd, inputFile = tempfile.mkstemp(".tmp", "jmol") os.write(ifd, data) os.close(ifd) ofd, outputFile = tempfile.mkstemp("." + format.lower(), "jmol") os.close(ofd) if format in ["png", "svg"]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePreview(self):\n self.saveParameters()\n image=self.simulation.generatePreview()\n # convert pil image to a tkinter image\n self.photo = ImageTk.PhotoImage(image)\n\n # display image\n self.preview.create_image(0, 0, anchor='nw', image=self.photo)", "def crea...
[ "0.7341452", "0.6504548", "0.6415399", "0.6406624", "0.6404133", "0.6395913", "0.6337176", "0.63316154", "0.62957937", "0.6290337", "0.61565405", "0.6129579", "0.6102919", "0.6049723", "0.6047395", "0.59816676", "0.59734213", "0.59711885", "0.59273", "0.592083", "0.5883899", ...
0.6699744
1
creating remote preview for the converted image
def __createPreviewRemote(self, urlOrData, format, width, height, params): baseUrl = self.__remoteServiceUrl postData = [('mode', 'preview'), ('format', format), ('width', width), ('height', height), ('params', params)] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePreview(self):\n self.saveParameters()\n image=self.simulation.generatePreview()\n # convert pil image to a tkinter image\n self.photo = ImageTk.PhotoImage(image)\n\n # display image\n self.preview.create_image(0, 0, anchor='nw', image=self.photo)", "def plot...
[ "0.7341685", "0.6815818", "0.67535913", "0.6574728", "0.656734", "0.6519413", "0.6449722", "0.63953793", "0.63321733", "0.6307271", "0.62930334", "0.6277126", "0.6203864", "0.61652726", "0.6126213", "0.6126092", "0.6123441", "0.6119769", "0.6105551", "0.60652846", "0.60298723...
0.73780996
0
invoking jmol command to convert the file
def __invokeJmol(self, inputFile, outputFile, format, width, height): try: jmolCmd = self.__getJmolCmd() fd, name = tempfile.mkstemp(".jmol", "ice") os.write(fd, "load %s" % inputFile) os.close(fd) _, stderr = self.iceContext.system.execute2("java", "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Convert(self, filename, filetype, file, progress): # real signature unknown; restored from __doc__\n pass", "def convert(input_filename, output_filename):\n c_file = pkg_resources.resource_filename('ShapelyChipDesigns', 'convert.rb')\n os.system('klayout -z -rd input='+input_filename+' -rd outpu...
[ "0.61588496", "0.6094811", "0.5904379", "0.590102", "0.58707225", "0.5806931", "0.5780012", "0.5779278", "0.56995857", "0.56420714", "0.5584956", "0.5573719", "0.5538817", "0.553601", "0.5533928", "0.55256754", "0.55230045", "0.5520638", "0.54912555", "0.54887944", "0.5485348...
0.617377
0
invoking jumbo command to convert the file
def __invokeJumbo(self, inputFile, outputFile, format, params): try: converter = "" converterClass = "" jumboCmd = self.__getJumboCmd() if format == "png": converterClass = "org.xmlcml.cml.converters.graphics.png.CML2PNGConverter" elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli(ctx):\n ctx.invoke(clean)\n ctx.invoke(build_convert_upload)", "def GenConvertCmd(files):\n\n retfiles = []\n for f in files:\n fnew = f + '.done'\n retfiles.append(fnew)\n f = f.replace('(', '\\(').replace(')', '\\)')\n line = '/usr/bin/iconv -f GBK -t UTF-8 %s -o %s.done' % (f, f)\n...
[ "0.59100825", "0.58389264", "0.58339757", "0.582714", "0.57829005", "0.57043177", "0.56663746", "0.5644343", "0.56300783", "0.5611455", "0.56099594", "0.56008106", "0.5600323", "0.5527929", "0.54490596", "0.5445635", "0.5444377", "0.544099", "0.5404118", "0.5370559", "0.53703...
0.6628393
0
Converting .cdx to .cml
def __invokeCdx2Cml(self, inputFile, outputDir): tmpFs = None try: tmpFs = self.iceContext.fs.unzipToTempDirectory(inputFile) toDir = tmpFs.absPath() tmpFs.unzipToDirectory(inputFile, toDir) tmpFs.makeDirectory("raw") tmpFs.makeDirectory("cml")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def t2c(x):\n dx = to_dlpack(x)\n return cp.fromDlpack(dx)", "def import_cml(self, fname):\n self.ftype = 'cml'\n with open(fname) as f:\n lines = f.readlines()\n self.n_atom = 0\n self.n_connect = 0\n self.sym = []\n self.at_num = []\n self.xyz =...
[ "0.6194621", "0.6009154", "0.58544147", "0.55669045", "0.5511087", "0.54635435", "0.53899854", "0.5369059", "0.5346506", "0.53245556", "0.53050333", "0.5302654", "0.5291607", "0.52548665", "0.52318984", "0.52043146", "0.51741844", "0.5163281", "0.50964886", "0.50647235", "0.5...
0.7189275
0
to check if it's a url or a data
def __isUrl(self, url): if type(url)==str: return url.startswith('http://') or url.startswith('https://') return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_url(string):\n return \"http\" in string", "def handles(self, data: ByteString) -> Optional[bool]:", "def url_type(verifield, required):\n return verifield is None or urlparse(verifield) is not None", "def check_data_exist(data):\n if data is not None:\n if data.text is not None:\n ...
[ "0.6711378", "0.63993317", "0.6371455", "0.63660157", "0.62258697", "0.6222878", "0.61809355", "0.6169255", "0.61107785", "0.61042947", "0.6063057", "0.6057898", "0.60352564", "0.60352564", "0.60133845", "0.59892875", "0.5969818", "0.59652543", "0.5963128", "0.59603554", "0.5...
0.68785894
0
get jmol command through JMOL_HOME
def __getJmolCmd(self): return self.__getCmd("JMOL_HOME", "Jmol.jar", "Jmol")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getCmd(self, homeEnv, cmd, desc):\n home = self.iceContext.system.environment.get(homeEnv, \"\")\n if home == '':\n #Use jumbo and jmol jar from the trunk\n cmdPath = \"plugins/extras/cml/%s\" % (cmd)\n cmdPath = self.iceContext.fs.absPath(cmdPath)\n ...
[ "0.71832633", "0.5956472", "0.5453094", "0.53910017", "0.5219738", "0.51757115", "0.51493716", "0.51242197", "0.5102158", "0.50927836", "0.50854266", "0.50714445", "0.5040367", "0.5004637", "0.49858192", "0.49761528", "0.49560434", "0.49311507", "0.49131826", "0.4913165", "0....
0.8530013
0
get jumbo command through JUMBO_HOME
def __getJumboCmd(self): return self.__getCmd("JUMBO_HOME", "jumbo-converters.jar", "JUMBO")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getCmd(self, homeEnv, cmd, desc):\n home = self.iceContext.system.environment.get(homeEnv, \"\")\n if home == '':\n #Use jumbo and jmol jar from the trunk\n cmdPath = \"plugins/extras/cml/%s\" % (cmd)\n cmdPath = self.iceContext.fs.absPath(cmdPath)\n ...
[ "0.61986524", "0.56836194", "0.5436829", "0.52809906", "0.52328485", "0.5220105", "0.52155423", "0.5193473", "0.5136273", "0.50964797", "0.50669754", "0.50520766", "0.5001258", "0.49956968", "0.49704632", "0.49497208", "0.49363744", "0.48990354", "0.4888093", "0.48647845", "0...
0.82354075
0
get the command from local installation
def __getCmd(self, homeEnv, cmd, desc): home = self.iceContext.system.environment.get(homeEnv, "") if home == '': #Use jumbo and jmol jar from the trunk cmdPath = "plugins/extras/cml/%s" % (cmd) cmdPath = self.iceContext.fs.absPath(cmdPath) cmdPath = cmdPa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LocalCommand(TestinfraBackend):\n return testinfra.get_backend(\"local://\").get_module(\"Command\")", "def get_executable(self) -> str:\n ...", "def command():\n return _config.command", "def get_command(self, ctx, cmd_name):\n path = \"%s.%s\" % (__name__, cmd_name)\n path = ...
[ "0.7119751", "0.6811133", "0.6759823", "0.6708233", "0.6459861", "0.63145125", "0.629779", "0.6261173", "0.62609696", "0.62204325", "0.6165813", "0.61531067", "0.60995555", "0.6069599", "0.60613394", "0.6053938", "0.60402006", "0.60319364", "0.6001814", "0.59941185", "0.59880...
0.70195866
1
Concat two image in horizontal way
def get_concat_h(im1, im2): dst = Image.new('RGB', (im1.width + im2.width, im1.height)) dst.paste(im1, (0, 0)) dst.paste(im2, (im1.width, 0)) return dst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def horizontalConcat(image1, image2):\n shape1 = image1.shape\n shape2 = image2.shape\n if shape1[0] > shape2[0]:\n resizeMaintainAspectRatio(image2, height=shape1[0])\n elif shape2[0] > shape1[0]:\n resizeMaintainAspectRatio(image1, height=shape2[0])\n\n return np.hstack((image1, imag...
[ "0.8144802", "0.79957724", "0.78960985", "0.7679934", "0.76004934", "0.75067824", "0.74638087", "0.741726", "0.7388689", "0.73258907", "0.71822596", "0.71517295", "0.7056923", "0.700469", "0.6892519", "0.6865185", "0.68628246", "0.6855957", "0.67954344", "0.67847216", "0.6717...
0.8175918
0
Remove transparency for a image
def remove_transparency(image): new_image = Image.new("RGBA", image.size, "WHITE") new_image.paste(image, (0, 0), image) new_image.convert('RGB') return new_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_alpha(img): \n img = img[:,:,0:3].copy()\n return img", "def set_transparent(img):\n assert img.shape[-1] == 4\n white_pix = np.all(img == [255, 255, 255, 255], axis=-1)\n # print(white_pix)\n img[white_pix, -1] = 0\n # return img", "def remove_transparency(\n img: Image....
[ "0.7504152", "0.7433356", "0.70777506", "0.6965527", "0.69617593", "0.68964976", "0.67231977", "0.66540384", "0.6460288", "0.6455768", "0.64381826", "0.64203703", "0.6385706", "0.6385706", "0.63644874", "0.6312032", "0.6294968", "0.6271131", "0.62217015", "0.622153", "0.61745...
0.82600784
0
Gets multiple existing transactions by their IDs.
def batch_get_transactions( self, transaction_ids: List[str] ) -> Dict[str, Transaction]: params = {'ids': transaction_ids} json_response = self._rest_api_client.get( '/v1/transactions:batchGet', params ) return { id_: Transaction.from_json(jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all(self, *ids):", "def get(self, id):\n return get_transaction_list_data(id)", "def get_objects(self, ids, **args):\n args[\"ids\"] = \",\".join(ids)\n return self.request(\"\", args)", "def get_all(self, *ids):\n return self.__model__.query.filter(self.__model__.id.in_(i...
[ "0.6820558", "0.67222804", "0.6530826", "0.65196484", "0.63513917", "0.63268924", "0.6313062", "0.6303794", "0.6303274", "0.6267709", "0.62301475", "0.6216673", "0.6164155", "0.615514", "0.6154718", "0.61466515", "0.611333", "0.60773677", "0.6063531", "0.60564107", "0.5997637...
0.7479358
0
Returns a filtered list of transactions. You must provide at least one of the available filter criteria to filter transactions. Filters are additive (similar to SQL AND), for example if you provide both account_ids and payment_order_ids then transactions will be returned that match both criteria. Within each filter fie...
def list_transactions( self, account_ids: List[str] = None, payment_order_ids: List[str] = None, payee_ids: List[str] = None, direction: TransactionDirection = None, statuses: List[TransactionStatus] = None, value_timestamp_range: Dict[str, datetime] = None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transactions(\n self,\n since: Optional[date] = None,\n count: int = 1000,\n offset: int = 0,\n include_pending: bool = False,\n ) -> List[Transaction]:\n return self.session.get_transactions(\n self.account_id,\n options={\n ...
[ "0.65789837", "0.6551348", "0.6524975", "0.643697", "0.63870436", "0.63828325", "0.6184074", "0.6104861", "0.60844904", "0.6030461", "0.6005945", "0.59506714", "0.58950776", "0.5889965", "0.5830454", "0.58221173", "0.5817953", "0.5797632", "0.57867986", "0.5762698", "0.576108...
0.6810662
0
This method performs the same function as `list_transactions`, but if `list_transactions` returns no results it retries for a predetermined amount of time until a transaction exists. If after this time a transaction does not exist,
def list_transactions_when_exists( self, account_ids: List[str] = None, payment_order_ids: List[str] = None, payee_ids: List[str] = None, direction: TransactionDirection = None, statuses: List[TransactionStatus] = None, value_timestamp_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monitor_transactions(account):\n start_time = datetime.datetime.now()\n logger.info(\n format_log_message(\n 'Looking for new ripple transactions since last run'\n )\n )\n ledger_min_index = _get_min_ledger_index(account)\n marker = None\n has_results = True\n\n tr...
[ "0.61574686", "0.6132094", "0.60610616", "0.5894661", "0.58276093", "0.57181156", "0.5666674", "0.55693555", "0.55398804", "0.5537642", "0.55305403", "0.55089337", "0.5388786", "0.535668", "0.53235155", "0.5322525", "0.5259739", "0.525583", "0.5250593", "0.52324945", "0.52297...
0.7142871
0
Streams the supplied WAV file via socketio, continuously replaying.
def stream_file(filename): wf = wave.open(filename, 'rb') # read in ~100ms chunks chunk = int(wf.getframerate() / 10) data = wf.readframes(chunk) while True: try: while connected: if data != '' and len(data) != 0: sio.emit('data', data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_open(ws):\n data = {\n \"action\": \"start\",\n # this means we get to send it straight raw sampling\n \"content-type\": \"audio/l16;rate=%d\" % RATE,\n \"interim_results\": True,\n \"profanity_filter\": False\n }\n\n # Send the initial control message which sets ...
[ "0.6427144", "0.636915", "0.63591737", "0.6194203", "0.61640173", "0.61318856", "0.60220325", "0.6009962", "0.6006023", "0.5964754", "0.5836398", "0.5800446", "0.5782398", "0.5780301", "0.57240874", "0.5713771", "0.5685672", "0.5669737", "0.5662679", "0.56351227", "0.5615766"...
0.8023602
0
Simple object consisting of a recording tape (dictionary) that can be extended and saved Keys are strings and values are lists of recorded quantities (could be reward, loss, action, parameters, gradients, evaluation metric, etc.)
def __init__(self, metrics_to_record): self.tape = {} for metric_name in metrics_to_record: self.tape[metric_name] = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store(self, state, action, reward, next_state, done):\n self.replay_memory.append((state, action, reward, next_state, done))", "def capture_recording(self, data={}):\n pass", "def globals(self):\n return {\n 'tf_types': { # How to store each in tfrecords\n 'n...
[ "0.55686456", "0.552908", "0.5476886", "0.5471872", "0.54307735", "0.53701115", "0.53599215", "0.53560925", "0.5348791", "0.5346682", "0.53424", "0.5288167", "0.5264136", "0.5220265", "0.51981044", "0.51957417", "0.51944643", "0.5189375", "0.5186529", "0.5158259", "0.5141921"...
0.61478746
0
Appends to tape all values for corresponding keys defined in dict If some keys present on tape do not have a new value in 'new_values_dict', we add None instead (so that all lists have the same length.
def write_to_tape(self, new_values_dict): # new_values_dict is not allowed to contain un-initialised keys assert all([key in self.tape.keys() for key in new_values_dict.keys()]), \ f"self.tape.keys()={self.tape.keys()}\nnew_values_dict.keys()={new_values_dict.keys()}" for key in se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_dict(original_dict, new_dict):\n if new_dict == None: return original_dict\n for k in new_dict:\n if k not in original_dict:\n original_dict[k] = []\n original_dict[k].append(new_dict[k])\n else: original_dict[k].append(new_dict[k])\n return original_dict", ...
[ "0.6606166", "0.6348434", "0.62963283", "0.62963283", "0.6170631", "0.61657584", "0.60346776", "0.60147613", "0.60000193", "0.5913951", "0.58892894", "0.58358747", "0.5827264", "0.58020097", "0.58019096", "0.57884663", "0.57748395", "0.57672644", "0.57396984", "0.57005566", "...
0.74856895
0
Saves the tape (dictionary) in .pkl file
def save(self, filename): with open(filename, 'wb') as f: pickle.dump(self.tape, f, protocol=pickle.HIGHEST_PROTOCOL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_pkl(dictionnary,directory,file_name):\n with open(f'saved_exp_info/{directory}/{file_name}.pkl', 'wb') as output:\n pickle.dump(dictionnary, output)", "def save(self, filename):\n with open(filename, \"wb\") as f:\n pkl.dump(self, f)", "def save(self, filepath):\n save_c...
[ "0.70614785", "0.68560034", "0.6833931", "0.68306804", "0.67602664", "0.674844", "0.66768265", "0.6644964", "0.6559311", "0.6545818", "0.64557844", "0.6444832", "0.6424357", "0.64230824", "0.64214575", "0.6411857", "0.6408804", "0.637426", "0.63678277", "0.63668257", "0.63660...
0.6978
1
Initialises Recorder() from a .pkl file containing a tape (dictionary)
def init_from_pickle_file(cls, filename): with open(filename, 'rb') as f: loaded_tape = pickle.load(f) instance = cls(metrics_to_record=loaded_tape.keys()) instance.tape = loaded_tape return instance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, path, seq_len, vocabs, padding=None, pad_with=None, *args, **kwargs):\n super().__init__(*args, **kwargs)\n\n self.path = path\n\n with open(self.path, 'r') as infile:\n keys = json.loads(next(infile)).keys()\n\n if type(seq_len) == dict:\n self....
[ "0.5984399", "0.59770834", "0.5864978", "0.5844918", "0.5832154", "0.57460415", "0.5745419", "0.570755", "0.5680438", "0.5639552", "0.56102276", "0.55861783", "0.55648184", "0.55603045", "0.5556769", "0.55060536", "0.54856926", "0.54825", "0.54778546", "0.5476827", "0.5467384...
0.64515835
0
Returns path relative to dir.
def relpath(path, dir = '.'): apath = os.path.abspath(os.path.normpath(path)) adir = os.path.abspath(os.path.normpath(dir)) if apath == adir: return(os.curdir) commonpath = os.path.commonprefix((apath, adir)) uniqpath = adir[len(commonpath):] if len(uniqpath) == 0: return(path) if uniqpath.startswith(os....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_relative_path(dir, full_path):\n if dir[-1] == '/' or dir[-1] == ':':\n return full_path[ len(dir) : ]\n else:\n return full_path[ len(dir)+1 : ]", "def dir(self) -> str:\n return f'{os.path.dirname(self.path)}/'.lstrip('/')", "def get_relative_path(path):\r\n components =...
[ "0.73512733", "0.7256607", "0.70581496", "0.7025892", "0.7023596", "0.6984552", "0.69707996", "0.6943182", "0.69392395", "0.68329155", "0.6819966", "0.6805251", "0.6773979", "0.6750591", "0.6749946", "0.6705201", "0.6704479", "0.6677323", "0.6668318", "0.66661364", "0.6627059...
0.7438515
0
Fills the accumulator with zero values, based on the shape of the given weights.
def fill_zero(self, weights): if self.value is None: # if we have a list of weights, allocate a list of zeros for the accumulator if isinstance(weights, list): self.value = list() # for each weight in the list, allocate zeros with the same shape as the wei...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initializeWeightsToZero(self):\n\t\t## YOUR CODE BELOW\n\t\t\n\t\tutil.raiseNotDefined()\n\t\treturn", "def init_weight(w):\n shape = w.shape\n if len(shape) == 4:\n i, o, u, v = shape\n k = np.sqrt(6 / (i * u * v + o * u * v))\n w.data.uniform_(-k, k)\n elif len(shape) == 2:\n k = np.sqrt(6 /...
[ "0.6747005", "0.65881675", "0.656351", "0.6509806", "0.6401679", "0.61936784", "0.61487097", "0.61451656", "0.61346465", "0.6079333", "0.6079333", "0.60078335", "0.60078335", "0.60078335", "0.59733015", "0.59696776", "0.595237", "0.5928644", "0.5926054", "0.5923076", "0.58934...
0.8440121
0
Test the behaviour of the method search() when a 429 status code is returned (rate limit exceeded) from Twitter.
def test429Error1Second(self): """ In this case the search() method send more than one rewuest per second, so twitter get 429 error. """ """ In this case we wait for 2 second before resend the request """ wk = os.path.dirname(os.path.abspath(__file__)) f = os.path.join(wk, "search_tweets...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test429Error300request(self):\n \"\"\" In this case the search() method send more than one rewuest per second, so twitter get 429 error. \"\"\"\n \"\"\" In this case we wait for 2 second before resend the request \"\"\"\n \"\"\" WARNING: TIME EXPENSIVE TEST: 20-25min needed \"\"\"\n ...
[ "0.7398791", "0.7269502", "0.66806537", "0.659621", "0.635376", "0.6349741", "0.6342282", "0.6324057", "0.6238973", "0.6153719", "0.61377597", "0.6106966", "0.609943", "0.6087153", "0.6020295", "0.59994733", "0.59925103", "0.5975396", "0.5969328", "0.5916833", "0.5916108", ...
0.7327844
1
Test the behaviour of the method search() when a 429 status code is returned (rate limit exceeded) from Twitter.
def test429Error300request(self): """ In this case the search() method send more than one rewuest per second, so twitter get 429 error. """ """ In this case we wait for 2 second before resend the request """ """ WARNING: TIME EXPENSIVE TEST: 20-25min needed """ wk = os.path.dirname(os.pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test429Error1Second(self):\n \"\"\" In this case the search() method send more than one rewuest per second, so twitter get 429 error. \"\"\"\n \"\"\" In this case we wait for 2 second before resend the request \"\"\"\n wk = os.path.dirname(os.path.abspath(__file__))\n f = os.path.jo...
[ "0.7328549", "0.7270075", "0.6679664", "0.659703", "0.63527197", "0.6350212", "0.63424253", "0.6323767", "0.62383693", "0.6152785", "0.6137693", "0.61061054", "0.60996085", "0.6087402", "0.6020407", "0.6000137", "0.5993146", "0.5975135", "0.5969896", "0.5916732", "0.5916732",...
0.7399247
0
Test the correct behavior when there is no next_token in the twitter response
def test_no_next_token(self): response1 = {'meta': {'result_count': 500}} wk = os.path.dirname(os.path.abspath(__file__)) f = os.path.join(wk, "search_tweets.config") thing = SearchTweets(self.db, f) with patch.object(thing, '_SearchTweets__twitter_n_results', new_callable=Prope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_next_token(self) -> None:\n\n # `next_token` does not appear\n # Number of results is the number of entries\n channel = self.make_request(\n \"GET\",\n self.url + \"?limit=20\",\n access_token=self.admin_user_tok,\n )\n\n self.assertEqua...
[ "0.704404", "0.67973155", "0.66211593", "0.65471673", "0.62317795", "0.6222573", "0.6195106", "0.61674", "0.6139818", "0.61232126", "0.6115378", "0.60630554", "0.60593456", "0.6043721", "0.5976828", "0.5952003", "0.59301335", "0.5924487", "0.5918789", "0.5912228", "0.59050536...
0.76404405
0
Test the correct behavior when we are asking for more than 500tweets
def test_n_results_greater_than_500(self): wk = os.path.dirname(os.path.abspath(__file__)) f = os.path.join(wk, "search_tweets.config") thing = SearchTweets(self.db, f) with patch.object(thing, '_SearchTweets__twitter_n_results', new_callable=PropertyMock(return_value=1070)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_tweets(self):\n auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)\n auth.set_access_token(ACCESS_TOKEN, ACCESS_SECRET)\n api = tweepy.API(auth)\n search = api.search(self.term, lang='en', count=100)\n\n print(f\"Getting tweets that mention '{self.term}', \"\n ...
[ "0.69010276", "0.68833387", "0.6755314", "0.66907847", "0.6618208", "0.65483314", "0.65428895", "0.6474945", "0.644554", "0.6434697", "0.6408902", "0.63830626", "0.635693", "0.6339326", "0.6317709", "0.6299777", "0.62916416", "0.62657195", "0.62617755", "0.6247156", "0.624085...
0.758883
0
Test the correct behavior when we are asking for less than 10tweets
def test_n_results_less_than_10(self): wk = os.path.dirname(os.path.abspath(__file__)) f = os.path.join(wk, "search_tweets.config") thing = SearchTweets(self.db, f) with patch.object(thing, '_SearchTweets__twitter_n_results', new_callable=PropertyMock(return_value=9)): with p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_n_results_greater_than_500(self):\n\n wk = os.path.dirname(os.path.abspath(__file__))\n f = os.path.join(wk, \"search_tweets.config\")\n thing = SearchTweets(self.db, f)\n with patch.object(thing, '_SearchTweets__twitter_n_results', new_callable=PropertyMock(return_value=1070))...
[ "0.7026964", "0.62198794", "0.61109257", "0.6048585", "0.59946287", "0.599228", "0.59364814", "0.59218824", "0.59202087", "0.5912624", "0.5897766", "0.5881844", "0.5877866", "0.5864308", "0.58563", "0.5854406", "0.5850718", "0.58407307", "0.58005804", "0.5783727", "0.577584",...
0.7311962
0
Run the savedstate init fanout scenario. This scenario involves a savedstate init with some local changes. It
def run_scenario_saved_state_init(bins: Binaries, test: FanoutTest) -> None: repo_root = _prepare_repo_root(test) fanout_hash_map = _build_fanout_hash_map(bins, test) (hh_result_base, saved_state_dir) = _create_saved_state(bins, repo_root, test) changed_files = _make_repo_change(repo_root, test) _l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_initial_state(self):\n pass", "def init_game_setting(self):\n np.random.seed(1) \n self.s_prev = np.zeros((80, 80, 1))\n print('loading trained model from {}'.format(self.model_path))\n self.sess = tf.InteractiveSession(graph=self.model)\n self.saver.restore(sel...
[ "0.6261618", "0.62210846", "0.621587", "0.61689353", "0.6103269", "0.6080731", "0.60274255", "0.6024216", "0.60211223", "0.60135037", "0.60061145", "0.59996676", "0.59910953", "0.5976209", "0.59741294", "0.59443223", "0.59259933", "0.5898326", "0.58928865", "0.5884248", "0.58...
0.7507916
0
Run the incremental fanout scenario with old decls unavailable. This scenario involves calculating the fanout in an incremental change scenario (i.e. after savedstate initialization was successful), but where the old versions of the declarations are unavailable and thus finegrained decl diffing is impossible. 1. Build ...
def run_scenario_incremental_no_old_decls(bins: Binaries, test: FanoutTest) -> None: repo_root = _prepare_repo_root(test) fanout_hash_map = _build_fanout_hash_map(bins, test) (hh_result_base, saved_state_dir) = _create_saved_state(bins, repo_root, test) _launch_hh_from_saved_state( bins, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_scenario_incremental_with_old_decls(bins: Binaries, test: FanoutTest) -> None:\n repo_root = _prepare_repo_root(test)\n fanout_hash_map = _build_fanout_hash_map(bins, test)\n (hh_result_base, saved_state_dir) = _create_saved_state(bins, repo_root, test)\n\n _launch_hh_from_saved_state(\n ...
[ "0.6128766", "0.53606516", "0.5172758", "0.514661", "0.5115114", "0.49521196", "0.48244527", "0.47939095", "0.47716245", "0.4758018", "0.4744681", "0.47394326", "0.47092965", "0.47092965", "0.4708643", "0.4671987", "0.46669197", "0.4643479", "0.46394598", "0.4624957", "0.4616...
0.5752881
1
Run the incremental fanout scenario with old decls available. This scenario involves calculating the fanout in an incremental change scenario (i.e. after savedstate initialization was successful), and where the old versions of the declarations are available and thus finegrained decl diffing is possible. 1. Build a save...
def run_scenario_incremental_with_old_decls(bins: Binaries, test: FanoutTest) -> None: repo_root = _prepare_repo_root(test) fanout_hash_map = _build_fanout_hash_map(bins, test) (hh_result_base, saved_state_dir) = _create_saved_state(bins, repo_root, test) _launch_hh_from_saved_state( bins, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_scenario_incremental_no_old_decls(bins: Binaries, test: FanoutTest) -> None:\n repo_root = _prepare_repo_root(test)\n fanout_hash_map = _build_fanout_hash_map(bins, test)\n (hh_result_base, saved_state_dir) = _create_saved_state(bins, repo_root, test)\n\n _launch_hh_from_saved_state(\n b...
[ "0.5960542", "0.5429477", "0.5161214", "0.5142243", "0.50387084", "0.49212727", "0.49116406", "0.48962757", "0.48677114", "0.48600653", "0.48474938", "0.4842235", "0.48348385", "0.48294404", "0.48189464", "0.4800195", "0.4789388", "0.4767516", "0.47603634", "0.47586364", "0.4...
0.65711904
0
Creates a sky model for peeling with BBS using input gsm or gsm.py MS measurement set to create sky model for gsm global sky model radius radius in deg flux_cutoff_Jy cutoff flux in Jy outdir output directory master_skymodel sky model with patch definitions
def create_peeling_skymodel(MS, gsm=None, radius=10, flux_cutoff_Jy=0.1, outdir='.', master_skymodel=None, use_patches=False): ms = MS.split("/")[-1] outfile = "{0}/skymodels/{1}.peeling.skymodel".format(outdir, ms) if gsm is not None: s = lsmtool.load(gsm) else: obs = pt.table(M...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skel_model(action, install_path_mp, install_path_zfs, jname):\n # init vars\n # mp - mount point, zfs - zfs point\n skel_path_mp = '%s-SKELETON' % install_path_mp\n skel_path_zfs = '%s-SKELETON' % install_path_zfs\n rw_path_mp = '%s-RW' % install_path_mp\n rw_path_zfs = '%s-RW' % install_path_zfs\n ...
[ "0.59043306", "0.56918895", "0.5633", "0.55373156", "0.55076116", "0.54988986", "0.5438238", "0.5369653", "0.5328531", "0.5315692", "0.524287", "0.5226319", "0.52186763", "0.51967865", "0.51844686", "0.51451534", "0.51304495", "0.5101808", "0.5101808", "0.5080816", "0.5073805...
0.7611216
0
Scans the directory and returns list of Field objects The search assumes measurement sets all end with '.MS'
def scan_directory(indir, outdir='.'): ms_list = sorted(glob.glob(indir+"/*.MS")) if len(ms_list) == 0: ms_list = sorted(glob.glob(indir+"/*.ms")) # Create a Band object for each MS band_list = [] for ms in ms_list: band_list.append(Band(ms, outdir)) # Sort the Band objects int...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_to_list(folder, start, stop):\n measurements = []\n for i in range(start, stop+1):\n measurements.append(Measurement(folder + str(i) + \".tdms\"))\n return measurements", "def find_avail_mof_files(dell_version):\n assert dell_version is not None\n mof_path =...
[ "0.6019757", "0.5813022", "0.57499355", "0.56756604", "0.56659186", "0.56560653", "0.5628832", "0.5628118", "0.5564649", "0.5493637", "0.5467764", "0.5458785", "0.5456487", "0.543752", "0.5410307", "0.53952974", "0.53653675", "0.53544027", "0.5351652", "0.5345277", "0.5343521...
0.6426915
0
approx_equal(float1, float2[, tol=1e18, rel=1e7]) > True|False approx_equal(obj1, obj2[, args, kwargs]) > True|False Return True if x and y are approximately equal, otherwise False. If x and y are floats, return True if y is within either absolute error tol or relative error rel of x. You can disable either the absolut...
def approx_equal(x, y, *args, **kwargs): if not (type(x) is type(y) is float): # Skip checking for __approx_equal__ in the common case of two floats. methodname = '__approx_equal__' # Allow the objects to specify what they consider "approximately equal", # giving precedence to x. If ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def almosteq(a, b, rel_eps=1e-6, abs_eps=1e-8):\n if type(a) in float_int and type(b) in float_int:\n return math.isclose(a, b, rel_tol=rel_eps, abs_tol=abs_eps)\n else:\n return np.isclose(a, b, rtol=rel_eps, atol=abs_eps)", "def is_equal_approx(x, y, epsilon=1e-6):\r\n # Check absolute p...
[ "0.7530065", "0.7369549", "0.71033525", "0.70840406", "0.70172733", "0.701064", "0.6999978", "0.6992779", "0.6846152", "0.6783572", "0.6729564", "0.6728558", "0.6714742", "0.66494906", "0.6640349", "0.65970004", "0.6542232", "0.6481839", "0.6480189", "0.64533716", "0.64232427...
0.807153
0
Returns list of optimal set of GSM calibrators for peeling Calibrators are determined as compact sources above the given apparent flux cutoff in Jy and are selected from the master list defined by sources in master_skymodel.
def find_calibrators(master_skymodel, beamMS, flux_cut_Jy=15.0, maj_cut_arcsec=None, plot=False): log.info('Checking {0}:'.format(beamMS)) s = lsmtool.load(master_skymodel, beamMS=beamMS) if maj_cut_arcsec is not None: log.info('Filtering out sources larger than {0} arcsec:'.format(maj_cut_arcse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_calcs(list_mols, max_restart=False, depth='medium', sort=False, frc=False, wait=False):\n from gausspy import gaussian_job_manager\n from gausspy import oniom_utils\n from gausspy.gaussian_job_manager import server_files_equal_v2\n #scratch, local_home = os.environ['GAUSS_SCRATCH'], os.path.r...
[ "0.53037333", "0.5280659", "0.5139736", "0.5131832", "0.5057638", "0.50186104", "0.49889907", "0.49781016", "0.49002066", "0.4893543", "0.48686594", "0.4839152", "0.48249856", "0.48063698", "0.48017228", "0.4780652", "0.47778502", "0.47665104", "0.47656235", "0.47653547", "0....
0.7313673
0
Makes a BBS parset for peeling For best results, the sources should be peeled in order of decreasing flux. If phase_only is False, amplitudes are also solved for.
def make_peeling_parset(parset, peel_bins, scalar_phase=True, phase_only=True, sol_int_amp=500, time_block=None): sol_int_list = [] if time_block is not None: # Set all chunk sizes to time_block for peel_bin in peel_bins: peel_bin['sol_int'] = time_block + 2 for peel_bin in p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partial_load_curve_all(self, bias_high_array, bias_low_array=None, \n wait_time=0.1, bias_step=0.1, gcp_mode=True, show_plot=False, analyze=True, \n make_plot=True, save_plot=True, channels=None, overbias_voltage=None,\n overbias_wait=1.0, phase_excursion_min=1.):\n\n original_bias...
[ "0.54238033", "0.5250513", "0.5170614", "0.51189685", "0.5041268", "0.50364095", "0.49047285", "0.48587352", "0.48486724", "0.48438793", "0.48289207", "0.48196426", "0.48027223", "0.47692788", "0.47635278", "0.47601658", "0.47584817", "0.47488314", "0.4731511", "0.4731511", "...
0.7528911
0
Collects all solutions and writes them to an H5parm file
def write_sols(field_list, h5file): log = logging.getLogger("Writer") log.info('Collecting all solutions in H5parm file {0}'.format(h5file)) # Use LoSoTo's H5parm_importer.py tool to make H5parm files for each # MS/instrument_out parmdb. Then use H5parm_merge.py to merge them all. create_master = T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_all_optimal_solutions(suffix):\n directory_name = \"inputs/\"\n directory = os.fsencode(directory_name)\n outfolder = \"outputs/\" + suffix.strip(\".in\") + \"/\"\n try:\n os.makedirs(outfolder)\n except FileExistsError:\n pass\n for file in os.listdir(directory):\n ...
[ "0.6241306", "0.59154993", "0.5848162", "0.57124954", "0.57107854", "0.5707296", "0.5687209", "0.567122", "0.56208324", "0.56042516", "0.5581068", "0.55754423", "0.55620253", "0.5559841", "0.5558354", "0.5553362", "0.5546298", "0.5523173", "0.5512645", "0.5512407", "0.5494244...
0.71093005
0
Calibrates a single MS chunk using a timecorrelated solve
def calibrate_chunk(chunk_obj): # Modify weights fwhm_min, fwhm_max = modify_weights(chunk_obj.output, chunk_obj.ionfactor, ntot=chunk_obj.ntot, trim_start=chunk_obj.trim_start) # Run bbs subprocess.call("calibrate-stand-alone -f {0} {1} {2} > {3}/logs/" "{4}_peeling_calibrate_timecorr....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calibrate(msname, parset, skymodel, logname_root, use_timecorr=False,\n time_block=None, ionfactor=0.5, outdir='.', instrument='instrument',\n solint=None, flag_filler=False, ncores=1):\n log = logging.getLogger(\"Calib\")\n\n if not use_timecorr:\n subprocess.call(\"calibrate-stand-alone -f...
[ "0.5890532", "0.58383137", "0.574568", "0.5582106", "0.55118734", "0.54725975", "0.54675585", "0.54447806", "0.54043955", "0.5364265", "0.5355562", "0.5285875", "0.5281969", "0.5278564", "0.52281594", "0.52144665", "0.5197262", "0.51953125", "0.517528", "0.51523846", "0.51415...
0.5904108
0
Resets and copies a parmdb instrument_name parmdb to copy instrument_out output parmdb blockl block length in time slots flag_filler = flag parts that won't be filled with timecorrelated solutions
def clean_and_copy_parmdb(instrument_name, instrument_out, blockl, flag_filler=False, msname=None, timepersample=10.0): pdb = lofar.parmdb.parmdb(instrument_name) parms = pdb.getValuesGrid("*") keynames = parms.keys() filler = int(blockl/2.0) # Set phases to zero for key in keynames: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bwrite_restart2(part,ppart,pparti,qi,kpic,kipic,iur,ntime,ntime0,\n irc):\n global i1, i2\n# write out basic restart file for electrostatic code\n idimp = numpy.size(part,0)\n iur.seek(0,0)\n# write out current and initial time\n i2[0] = ntime; i2[1] = ntime0\n i2.tofile(iur)\n# wr...
[ "0.5168009", "0.50673", "0.4947126", "0.49104014", "0.48406178", "0.48157802", "0.47710294", "0.4766063", "0.47122216", "0.46624592", "0.4656938", "0.4632951", "0.4632568", "0.4626756", "0.46192855", "0.46145344", "0.4602952", "0.46024594", "0.45817512", "0.45814747", "0.4581...
0.812106
0
Splits an MS between start and end times in hours relative to first time
def split_ms(msin, msout, start_out, end_out): t = pt.table(msin, ack=False) starttime = t[0]['TIME'] t1 = t.query('TIME > ' + str(starttime+start_out*3600) + ' && ' 'TIME < ' + str(starttime+end_out*3600), sortlist='TIME,ANTENNA1,ANTENNA2') t1.copy(msout, True) t1.close() t.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def srt_segment_to_range(item):\n start_segment = item.start.hours * 60 * 60 + item.start.minutes * \\\n 60 + item.start.seconds + item.start.milliseconds / 1000.0\n end_segment = item.end.hours * 60 * 60 + item.end.minutes * \\\n 60 + item.end.seconds + item.end.milliseconds / 1000.0\n retu...
[ "0.63409483", "0.6017167", "0.5993557", "0.58652925", "0.5848793", "0.58297354", "0.5822132", "0.5799598", "0.5791997", "0.5770986", "0.5758852", "0.5649099", "0.564129", "0.562015", "0.5611457", "0.56004214", "0.55800474", "0.55678755", "0.5552483", "0.5535664", "0.5527064",...
0.66607237
0
Modifies the WEIGHTS column of the input MS
def modify_weights(msname, ionfactor, dryrun=False, ntot=None, trim_start=True): t = pt.table(msname, readonly=False, ack=False) freq_tab = pt.table(msname + '/SPECTRAL_WINDOW', ack=False) freq = freq_tab.getcol('REF_FREQUENCY') wav = 3e8 / freq anttab = pt.table(msname + '/ANTENNA', ack=False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateweigths():\n for i_lay in range(1, len(layers)):\n layers[i_lay][\"weigths\"] += layers[i_lay][\"Delta_w\"]", "def update_weights(self):\n\t\tpass", "def set_weights(self, wts):\n\t\tself.wts = wts", "def _lowess_wt_standardize(weights, new_entries, x_copy_i, width):\n weights[:] = new...
[ "0.63532156", "0.6196621", "0.6058362", "0.5998187", "0.59564406", "0.58622783", "0.57913005", "0.57629573", "0.5713679", "0.57074416", "0.5692728", "0.56822026", "0.56192887", "0.5601717", "0.5554214", "0.5543677", "0.54998434", "0.549505", "0.5475238", "0.54646707", "0.5457...
0.6227072
1
Transform BARTScore data into a list of SummevalExample data objects.
def transform_bartscore_data( bartscore_data): examples = [] for inst_key in bartscore_data: inst = bartscore_data[inst_key] src = inst['src'] if 'ref_summs' not in inst: refs = [inst['ref_summ']] else: refs = inst['ref_summs'] src = sent_tokenize(src) for i in range(len(ref...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(bartscore_file, summeval_file):\n with open_file(bartscore_file, 'rb') as f:\n summeval_data = json.load(f)\n\n summeval_examples = transform_bartscore_data(summeval_data)\n\n with open_file(summeval_file, 'r') as f:\n for line in f:\n inst = json.loads(line.strip())\n inst_key = in...
[ "0.67230064", "0.5792557", "0.5604448", "0.5488223", "0.5443884", "0.5442121", "0.5432233", "0.541678", "0.54064023", "0.53716147", "0.53266627", "0.5320055", "0.5306231", "0.525138", "0.5250969", "0.5222136", "0.52111644", "0.5207547", "0.52041227", "0.5194794", "0.5186959",...
0.7919838
0
Gets data from BARTScore and SummEval papers and combine their results.
def get_data(bartscore_file, summeval_file): with open_file(bartscore_file, 'rb') as f: summeval_data = json.load(f) summeval_examples = transform_bartscore_data(summeval_data) with open_file(summeval_file, 'r') as f: for line in f: inst = json.loads(line.strip()) inst_key = inst['id'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pub_scores(self, subset='auth_all'):\n from nltk.corpus import stopwords\n from nltk.tokenize import word_tokenize\n import csv\n from difflib import SequenceMatcher\n import jellyfish\n# self.sanity_check()\n\n if subset == 'auth_top':\n pubs = s...
[ "0.6078427", "0.5600871", "0.55917376", "0.5582671", "0.55516416", "0.5500969", "0.5493312", "0.5433306", "0.542875", "0.5413827", "0.5381441", "0.53763473", "0.5375061", "0.5372235", "0.53388447", "0.53326964", "0.5314992", "0.5314732", "0.53024817", "0.5299181", "0.52930075...
0.62876374
0
Calculate all kinds of SMART with several default matchers. Precalculated pairwise scores, one srcspecific and one refspecific, can also be passed to speed up calculation. This will be transformed into score matrices.
def calculate_smart_score( examples, matcher_name, matcher = None, pairwise_scores = None): print(f'calculating scores using matcher {matcher_name}') if matcher: smart_scorer = scorer.SmartScorer(matching_fn=matcher) elif pairwise_scores: src_score_id = 0 ref_score_id = 0 smart_sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def painting_matching_ml(imgs, db_imgs, method_list, text_masks, author_text, gt_text, metrics, weights, splits=30, max_rank=10):\n descriptor_extractors = [get_descriptor_extractor(method_name) for method_name in method_list]\n tmp_img_format = []\n tmp_mask_format = []\n tmp_text_format = []\n for...
[ "0.5925929", "0.5737001", "0.56244814", "0.5610677", "0.5522575", "0.54477394", "0.5415077", "0.534141", "0.5325246", "0.5321644", "0.5306748", "0.52777165", "0.5253119", "0.52520865", "0.5215385", "0.51846707", "0.5175076", "0.5162141", "0.512143", "0.5113836", "0.50882214",...
0.700952
0
Copy file from the build pack to the droplet Copies a file from the build pack to the application droplet. bpFile > file to copy, relative build pack toLocation > optional location where to copy the file relative to app droplet. If not specified uses the bpFile path.
def install_from_build_pack(self, bpFile, toLocation=None): fullPathFrom = os.path.join(self._ctx['BP_DIR'], bpFile) if os.path.exists(fullPathFrom) and os.path.isfile(fullPathFrom): fullPathTo = os.path.join( self._ctx['BUILD_DIR'], ((toLocation is None) and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_wb_copy():\r\n shutil.copy(full_target_file_name, path_name + copied_file_name) # copy the file\r", "def copy_api(self, packageFilePath: Path):\n\n packageFile = packageFilePath.name\n destPath = self.modulesdir / packageFile\n\n shutil.copy(str(packageFilePath), str(destPath...
[ "0.5916808", "0.57363", "0.57123363", "0.57075065", "0.57018846", "0.56370133", "0.55825883", "0.5524373", "0.55220926", "0.54607546", "0.5435141", "0.54289895", "0.53727597", "0.53543955", "0.53374946", "0.53294253", "0.5318939", "0.5290592", "0.5277075", "0.52587783", "0.52...
0.6957141
0
Copy file from one place to another in the application Copies a file from one place to another place within the application droplet. cfgFile > file to copy, relative build pack toLocation > location where to copy the file, relative to app droplet.
def install_from_application(self, cfgFile, toLocation): fullPathFrom = os.path.join(self._ctx['BUILD_DIR'], cfgFile) if os.path.exists(fullPathFrom) and os.path.isfile(fullPathFrom): fullPathTo = os.path.join(self._ctx['BUILD_DIR'], toLocation) self._safe_makedirs(os.path.dirnam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_asoundconf(asoundconf_file):\n this_dir, this_filename = os.path.split(__file__)\n asoundconf_path = os.path.join(this_dir, MicrophoneSetup.ASOUNDCONF_PATH, asoundconf_file)\n shutil.copy2(asoundconf_path, ASOUNDCONF_DEST_PATH)", "def create_config_file(original_file, copy_file):\n...
[ "0.6343885", "0.6336738", "0.60998446", "0.60200584", "0.60036415", "0.59466124", "0.5943103", "0.591028", "0.58178073", "0.5814941", "0.58017373", "0.57391167", "0.5736653", "0.5729335", "0.57201236", "0.57201236", "0.57201236", "0.5702419", "0.57010454", "0.5678111", "0.566...
0.7120409
0
Fetches the injectable parameter names of parameters to the given method, along with a set of parameters which have default values and should be considered optional dependencies. This method will throw InjectionError if the method provided has arguments that are not POSITIONAL_OR_KEYWORD or KEYWORD_ONLY. If the method ...
def get_injection_params(f, unbound_ctor=False): injection_param_names = [] default_param_set = set() params: List = [] if not inspect.ismethod(f) and unbound_ctor and not inspect.isfunction(f): # We do not want to try to inject a slot wrapper # version of __init__, as its params are (*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_params(cls, *args, **kwargs):\n sig = inspect.signature(cls.__init__)\n # The 'self' parameter needs to be removed or the first *args will be\n # assigned to it\n self_param = sig.parameters.get(\"self\")\n new_params = list(sig.parameters.values())\n new_params.r...
[ "0.5747912", "0.55833083", "0.5566967", "0.5376236", "0.5150334", "0.5149961", "0.5107904", "0.5066509", "0.50581443", "0.5034733", "0.49593595", "0.49587607", "0.492701", "0.49034765", "0.4865419", "0.4864978", "0.48638812", "0.48015445", "0.4793075", "0.47842905", "0.478277...
0.73655486
0
Scan the object for methods that match the given attribute filter and return them as a stream of tuples.
def scan_methods(obj, filter_f): for class_ in inspect.getmro(obj.__class__): for _, method in inspect.getmembers(class_, predicate=inspect.isfunction): attrs = MethodAttributes.for_method(method, create=False) if attrs is not None and filter_f(attrs): yield (attrs, b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_attributes(self):\r\n log.debug('Searching for attributes in method %s()' % self.name)\r\n for attribute in self.recursive_attribute_search(self._body.body):\r\n yield attribute", "def get_results(instance: Algorithm) -> Dict[str, Any]:\n all_attributes = dir(instance)\n a...
[ "0.6415986", "0.60716975", "0.6005169", "0.57756734", "0.56913346", "0.56831646", "0.5651693", "0.5633347", "0.56255144", "0.56116575", "0.5602829", "0.559043", "0.5555249", "0.5547694", "0.5497991", "0.54068846", "0.5406017", "0.54042256", "0.5354883", "0.53510535", "0.53485...
0.66959804
0
Scan the object and all of its parents for injection points and return them as a stream of tuples.
def get_injection_points(obj): return scan_methods(obj, lambda attr: attr.check(Tags.INJECTION_POINT))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan(subs: typing.Iterable[type['dsl.Any']]) -> typing.Iterable[type['dsl.Any']]:\n return (s for c in subs for s in (c, *scan(c.__subclasses__())))", "def get_providers(obj):\n\n return scan_methods(obj, lambda attr: attr.check(Tags.PROVIDER))", "def walk(top: str) -> Iterable[Tuple[str, str...
[ "0.5406336", "0.5372108", "0.53254384", "0.5320625", "0.5311466", "0.52154124", "0.5215248", "0.5187188", "0.5123593", "0.50819296", "0.50719607", "0.50677514", "0.5064819", "0.50424683", "0.5018821", "0.5018821", "0.5001969", "0.50004125", "0.4980497", "0.49700838", "0.49396...
0.6814632
0
Scan the object and all of its parents for providers and return them as a stream of tuples.
def get_providers(obj): return scan_methods(obj, lambda attr: attr.check(Tags.PROVIDER))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fetch_providers(self, looking_for, providers=None):\n if providers is None:\n providers = self._reverse_mapping.get(looking_for, [])\n default_providers = []\n atom_providers = []\n for p in providers:\n if p.name in (_TRANSIENT_PROVIDER, self.injector_name):\...
[ "0.5664694", "0.5663725", "0.565363", "0.555043", "0.555043", "0.555043", "0.555043", "0.555043", "0.555043", "0.5542752", "0.5525161", "0.5466963", "0.54455996", "0.54371494", "0.5436518", "0.5413293", "0.53756744", "0.5372495", "0.5372495", "0.5289727", "0.52379227", "0.5...
0.6732775
0
Generates a histogram of the number of interactions per item at the given timestep.
def _generate_interaction_histogram(interactions, num_users, num_items): histogram = np.zeros(num_items) np.add.at(histogram, interactions, 1) # Check that there's one interaction per user if histogram.sum() != num_users: raise ValueError("The sum of interactions must be equa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulationDelayedTreatment(numTrials):\n pop_list = {}\n resistant_pop_list = {}\n init_step_list = [300, 150, 75, 0]\n for index, init_step in enumerate(init_step_list):\n pop_list[init_step] = get_pop_list(init_step, numTrials)\n pylab.subplot(2, 2, index + 1)\n pylab.hist(po...
[ "0.58669347", "0.5695201", "0.5691308", "0.5691308", "0.5658827", "0.54336786", "0.5395067", "0.5321645", "0.5317378", "0.5317378", "0.5301124", "0.52959836", "0.52488905", "0.52431965", "0.52353716", "0.52309775", "0.5209029", "0.5176769", "0.5166195", "0.5143484", "0.513077...
0.6274684
0
Add the newly infected users to the graph with edges to the users who infected them
def _add_to_graph(self, user_profiles, new_infected_users): self.diffusion_tree.add_nodes_from(new_infected_users) parents = self._find_parents(user_profiles, new_infected_users) # connect parent(s) and child(ren) if parents is not None: edges = np.vstack((parents, new_infect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_users(self):\n record_unit = 1000\n print self.friendship_graph.number_of_nodes()\n print self.friendship_graph.number_of_edges()\n\n for num, node in enumerate(self.friendship_graph.nodes()):\n fake_flag = self.determine_spammer_by_percentage(node)\n sel...
[ "0.64074546", "0.6077787", "0.5868358", "0.58492565", "0.58449686", "0.58250636", "0.5774835", "0.570022", "0.5621838", "0.55863255", "0.5568239", "0.54609644", "0.54342806", "0.54251474", "0.5419406", "0.5408848", "0.54063964", "0.53791034", "0.53702176", "0.5356087", "0.535...
0.7433641
0
Add new infected users to graph and return number of newly infected users
def _manage_new_infections(self, user_profiles, current_infection_state): if self._old_infection_state is None: self._old_infection_state = np.zeros(current_infection_state.value.shape) new_infections = current_infection_state.infected_users()[0] # only extract user indices if len(n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_to_graph(self, user_profiles, new_infected_users):\n self.diffusion_tree.add_nodes_from(new_infected_users)\n parents = self._find_parents(user_profiles, new_infected_users)\n # connect parent(s) and child(ren)\n if parents is not None:\n edges = np.vstack((parents, ...
[ "0.6571273", "0.62856615", "0.59389716", "0.59255856", "0.5853271", "0.56588763", "0.5632928", "0.5597388", "0.55676395", "0.5527856", "0.55051005", "0.54940206", "0.5490893", "0.548263", "0.5472054", "0.54370207", "0.5396607", "0.539128", "0.5383661", "0.5360588", "0.5359630...
0.64403194
1
Returns a measure of structural virality. Returns
def get_structural_virality(self): num_nodes = self.diffusion_tree.number_of_nodes() return wiener_index(self.diffusion_tree) / (num_nodes * (num_nodes - 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fraction_of_infectious_virus(self) -> _VectorisedFloat:\n return self.virus.viable_to_RNA_ratio * (1 - self.host_immunity)", "def fraction_of_infectious_virus(self) -> _VectorisedFloat:\n return 1.", "def getViscosityLaw(self):\n return self.viscosityLaw", "def compute_volume(self) -...
[ "0.62442523", "0.61286414", "0.60827076", "0.60565484", "0.6045784", "0.60139126", "0.5982267", "0.5955694", "0.58917797", "0.5873444", "0.584239", "0.5830845", "0.5823968", "0.5816936", "0.5791665", "0.57834685", "0.5768636", "0.5765892", "0.5763708", "0.57599145", "0.573346...
0.7318086
0
Measures the average range (across users) of item attributes for items users were recommended at a time step. Used as a measure of within list recommendation diversity
def measure(self, recommender): items_shown = recommender.items_shown if items_shown.size == 0: # at beginning of simulation, there are no recommendations, # so we log a `None` value self.observe(None) return recommended_item_attr = recommender.it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_predictions(actives, train_rdd_gbitem_dict, train_rdd_gbuser_dict, num_items):\n active_user = actives[0][0]\n active_item = actives[0][1]\n\n # -----------------------------------\n # train_rdd_gbitem_dict = (item, ([(user,r),(user,r)...],avg_of_item))\n # train_rdd_gbuser_dict = (user, [(...
[ "0.63024384", "0.5934979", "0.58648264", "0.5863556", "0.58444667", "0.5841134", "0.580924", "0.57839996", "0.5736375", "0.57359916", "0.56896806", "0.56890374", "0.5681781", "0.5677384", "0.56624997", "0.5658554", "0.5627349", "0.561665", "0.56071526", "0.5561088", "0.555942...
0.7054138
0
Inits Movie with parameters movie_title, poster_image, trailer_youtube and review_imdb.
def __init__(self, movie_title, poster_image, trailer_youtube, review_imdb): self.title = movie_title self.poster_image_url = poster_image self.trailer_youtube_url = trailer_youtube self.imdb_url = review_imdb
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, movie_title, movie_storyline, movie_poster_image_url, movie_trailer):\n\t\tself.title = movie_title\n\t\tself.storyline = movie_storyline\n\t\tself.poster_image_url = movie_poster_image_url\n\t\tself.trailer_youtube_url = movie_trailer", "def __init__(self, movie_title, movie_storyline, poster...
[ "0.7487349", "0.73171014", "0.7302299", "0.728411", "0.7268446", "0.72576356", "0.723372", "0.7217655", "0.7213409", "0.7186125", "0.71557635", "0.715567", "0.7118879", "0.7104062", "0.70794713", "0.69712996", "0.6897454", "0.68907535", "0.6795655", "0.6761041", "0.6745814", ...
0.7561743
0
Assert weighted aggfunc returns the correct values.
def test_aggregation_weighted(forecasters, y, aggfunc, weights): forecaster = EnsembleForecaster( forecasters=forecasters, aggfunc=aggfunc, weights=weights ) forecaster.fit(y, fh=[1, 2, 3]) actual_pred = forecaster.predict() predictions = [] for _, forecaster in forecasters: f =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_weighted_results():\n pass", "def test_aggregation_unweighted(forecasters, y, aggfunc):\n forecaster = EnsembleForecaster(forecasters=forecasters, aggfunc=aggfunc)\n forecaster.fit(y, fh=[1, 2, 3])\n actual_pred = forecaster.predict()\n\n predictions = []\n\n _aggfunc = VALID_AGG_...
[ "0.69678855", "0.69622105", "0.68174344", "0.64943796", "0.62034446", "0.61748505", "0.61683464", "0.610991", "0.6063537", "0.60567755", "0.60419095", "0.6034405", "0.60315365", "0.6015006", "0.59978324", "0.59898674", "0.5972689", "0.5967299", "0.59628946", "0.5956217", "0.5...
0.72802424
0
Convert a Python list (xy list of a shape) into a Numpy matrix of vertices
def list2matrix_homog(xy_shape): vertex_array = [] for i in range(0, len(xy_shape), 2): vertex_x = xy_shape[ i] vertex_y = xy_shape[i + 1] extra_element = 1.0 vertex = [vertex_x, vertex_y, extra_element] vertex_array.append(vertex) vertex_matrix = num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices(tri, vertex_list):\n dim = len(vertex_list[0])\n p = numpy.zeros((3, dim))\n for j in range(3):\n p[j] = vertex_list[tri[j]]\n return p", "def _vertex_arrays_to_list(x_coords_metres, y_coords_metres):\n\n _check_polyline(\n x_coords_metres=x_coords_metres, y_coords_metre...
[ "0.69606847", "0.6807603", "0.66569346", "0.6394897", "0.62601906", "0.6189537", "0.61764187", "0.6162913", "0.61064583", "0.60833645", "0.607453", "0.60307765", "0.5982219", "0.59796184", "0.59634584", "0.5934088", "0.5903811", "0.5898226", "0.58964306", "0.588976", "0.58892...
0.76167476
0
Convert Numpy matrix of vertices into a Python list (xy list of a shape)
def matrix2list(vertex_matrix): flat_array = vertex_matrix.tolist() xy_list = [] for i in range(0, len(flat_array)): xy_list.append( flat_array[i][0] ) xy_list.append( flat_array[i][1] ) return xy_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vertex_arrays_to_list(x_coords_metres, y_coords_metres):\n\n _check_polyline(\n x_coords_metres=x_coords_metres, y_coords_metres=y_coords_metres)\n\n num_vertices = len(x_coords_metres)\n vertex_list_xy_metres = []\n for i in range(num_vertices):\n vertex_list_xy_metres.append((x_coo...
[ "0.7413975", "0.7025411", "0.68816763", "0.6750809", "0.6745582", "0.66855454", "0.65625846", "0.6517452", "0.64930856", "0.6437436", "0.64248884", "0.6411927", "0.6367023", "0.63419783", "0.6332802", "0.6315702", "0.63048035", "0.62930965", "0.6277304", "0.62731403", "0.6272...
0.8255958
0
Copy the worldview and its immediate neighbours.
def locality_copy(self): new = copy(self) new.north = copy(self.north) new.south = copy(self.south) new.east = copy(self.east) new.west = copy(self.west) return new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return _coordsys.coordsys_copy(self)", "def copy(self):\n\t\tb = Board(self.size, self.end_count)\n\t\tfor x in range(self.size):\n\t\t\tfor y in range(self.size):\n\t\t\t\tb.tiles[x][y] = self.tiles[x][y]\n\t\treturn b", "def copy(self):\n return self.__class__(*self.maps[:-1],...
[ "0.61862814", "0.57994807", "0.5732002", "0.5688422", "0.5686226", "0.5660167", "0.5655698", "0.56276125", "0.56194663", "0.56163204", "0.56155884", "0.56155884", "0.5602962", "0.56004703", "0.55852944", "0.5538871", "0.5536237", "0.5529703", "0.5507877", "0.5504208", "0.5503...
0.6385162
0
Test whether this location is the last place the current person has visited.
def is_most_recent_location(self, person):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_current_location(self):\n return self.location_set.current_location is not None", "def is_finish(self,location):\n return location[0] == self.columns - 1 and location[1] == self.rows - 1", "def is_last_position(self):\r\n return self.position >= len(self.rule.rightside)", "def is...
[ "0.7002344", "0.6673924", "0.660607", "0.65718144", "0.65527457", "0.6518544", "0.6288451", "0.62500423", "0.6199464", "0.6172359", "0.6069799", "0.60570204", "0.6023481", "0.5978436", "0.5900725", "0.58284974", "0.5796673", "0.5783083", "0.5769586", "0.5756217", "0.57546085"...
0.7422763
0
Injure this person by a certain amount (amount<=1.0) amount may be negative to heal
def injure(self, amount): self.health -= amount if self.health < 0.0: self.health = 0.0 if self.health > 1.0: self.health = 1.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def give_raise(self,amount=5000):\n self.salary += amount", "def give_raise(self, amount=5000):\n self.salary += amount", "def heal(self, amount: int) -> str:\n if self.hp + amount > MAX_HP:\n amount = MAX_HP - self.hp\n new_hp = self.hp + amount\n self.hp = new_h...
[ "0.6924608", "0.69075024", "0.69006264", "0.6801079", "0.67490596", "0.6691288", "0.66403013", "0.6638185", "0.65639347", "0.64924115", "0.64563555", "0.6416064", "0.630171", "0.6301572", "0.62866527", "0.62706417", "0.62615544", "0.6211703", "0.6164884", "0.6131726", "0.6104...
0.7328159
0
Swap suits to remove most symmetries. Modifies cards in place Fails to remove some in the case where there is a lowerranked pair or triple that shares a suit with a higherranked card.
def swap_suits(cards): cards_need_swap = cards new_suit = 5 while cards_need_swap.shape[0] > 0: suit = cards_need_swap[0,1] cards[cards[:,1] == suit, 1] = new_suit new_suit += 1 cards_need_swap = cards[cards[:,1] < 5] cards[:,1] = cards[:,1] - 4 return cards
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap_suits(cards):\n cards_need_swap = cards\n new_suit = 5\n while cards_need_swap.shape[0] > 0:\n suit = cards_need_swap[0,1]\n cards[cards[:,1] == suit, 1] = new_suit\n new_suit += 1\n cards_need_swap = cards[cards[:,1] < 5]\n cards[:,1] = cards[:,1] - 4\n return c...
[ "0.731475", "0.6521344", "0.64044553", "0.5974011", "0.58290917", "0.57423127", "0.56717587", "0.55904925", "0.55786467", "0.5472148", "0.5469577", "0.54659194", "0.5464322", "0.5456538", "0.54394937", "0.54057246", "0.5331853", "0.5318002", "0.5312691", "0.530591", "0.530110...
0.73551816
0
to learn the attention of one channel and the rest channels
def channelAttention(self,x): b, c, h, w = x.shape pre_x = x.contiguous().view(b, c, h * w) att_x, relations = self.forward_unified(pre_x, pre_x, pre_x) att_x = att_x.contiguous().view(b, c, h, w) return att_x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _attention(self, inputs):\n attn_weights = K.batch_dot(x=inputs,\n y=K.permute_dimensions(inputs,\n pattern=(0, 2, 1)))\n return K.permute_dimensions(attn_weights, (0, 2, 1))", "def attention(self, decode...
[ "0.6191988", "0.6182749", "0.61674166", "0.6110955", "0.60878927", "0.6033937", "0.60321414", "0.6014058", "0.60054046", "0.5966352", "0.5961111", "0.59551805", "0.5920994", "0.59022796", "0.5893938", "0.58766156", "0.5868471", "0.5847925", "0.58348364", "0.5827881", "0.58140...
0.62221354
0
List all naf tournaments from members.thenaf.net
def list_tournaments(renew_time=False, force=None): filename = "data/naf_tourneys.html" LOG.debug("Listing tournaments") if renew_time or force: return load_tournaments(renew_time=renew_time, force=force) tournaments = load_cached(nafparser.parse_tournaments, filename) return tournaments
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tournament_list():\n database = TinyDB('db.json')\n tournament_list = database.table('tournaments').all()\n return tournament_list", "def display_tournament_list():\r\n for tournament in tournaments_table:\r\n print(tournament['Nom'])", "def house_members(*, verbose=False):\n...
[ "0.62914014", "0.6109366", "0.5846553", "0.57829034", "0.56696373", "0.5601255", "0.5601255", "0.5601255", "0.5601255", "0.55882907", "0.55572516", "0.55448544", "0.55409384", "0.54748046", "0.54364485", "0.53815234", "0.53773314", "0.5313395", "0.5302785", "0.52871", "0.5272...
0.7149776
0
addone function takes a number as an array with an element for each digit. It adds one to the number and returns the result as a similar array. Any leading zeroes will be removed.
def addone(arg): for s in arg[:]: if s == 0: # Remove any leading zeroes arg.remove(s) if arg[len(arg) - 1] != 9: arg[len(arg) - 1] += 1 # Add one to the last element. else: # If the last number is nine then the second last # element must also be changed. if le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plusOne(self, digits: List[int]) -> List[int]:\n n = len(digits)\n for i in reversed(range(n)):\n # set all the nines at the end of array to zeros\n if digits[i] == 9:\n digits[i] = 0\n\n # here we have the rightmost not-nine \n else:\n # increase this...
[ "0.7688615", "0.7510205", "0.64064455", "0.63816565", "0.6377803", "0.6266959", "0.6123707", "0.6068747", "0.5995501", "0.59779876", "0.5936203", "0.58488744", "0.5805329", "0.56270254", "0.558196", "0.5570155", "0.5533241", "0.5513251", "0.55027306", "0.54867077", "0.5482474...
0.86135465
0
Gets score counts per player in a date scope
def counts_per_players(cls, date_scope): return cls._counts_per("player_name", date_scope)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def counts_per_teams(cls, date_scope):\n return cls._counts_per(\"player_team\", date_scope)", "def games_count(self, start_date, end_date): # noqa\n if start_date > end_date:\n raise RuntimeError(\"End date must be beyond start\")\n cur_date = start_date\n tot_gc = default...
[ "0.70805335", "0.61034626", "0.5999346", "0.59791017", "0.5965352", "0.5873043", "0.582727", "0.5764276", "0.5752803", "0.57515305", "0.56772786", "0.5654991", "0.5558223", "0.55491227", "0.5534203", "0.55316144", "0.5500438", "0.5496959", "0.5493157", "0.54864126", "0.547416...
0.7679463
0
Gets score counts per team in a date scope
def counts_per_teams(cls, date_scope): return cls._counts_per("player_team", date_scope)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def games_count(self, start_date, end_date): # noqa\n if start_date > end_date:\n raise RuntimeError(\"End date must be beyond start\")\n cur_date = start_date\n tot_gc = defaultdict(int)\n while cur_date <= end_date:\n teams_playing = self._teams_playing_one_day(c...
[ "0.6440161", "0.6400013", "0.6081967", "0.593549", "0.5931942", "0.5877388", "0.58412147", "0.5751432", "0.57329845", "0.5712143", "0.5702498", "0.5694906", "0.5685514", "0.56634647", "0.56083405", "0.55377275", "0.54963267", "0.54125893", "0.54095155", "0.54077744", "0.53844...
0.7475803
0
Compute matches when text is a simple name. Return a list of all keywords, builtin functions and names currently defined in self.namespace that match.
def global_matches(self, text): matches = [] n = len(text) for list in [keyword.kwlist, __builtin__.__dict__, self.namespace]: for word in list: if word[:n] == text: matches.append(word) return matc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_matches(self, text):\n import keyword\n matches = []\n n = len(text)\n for word in keyword.kwlist:\n if word[:n] == text:\n matches.append(word)\n for nspace in [builtins.__dict__, self.namespace]:\n for word, val in nspace.items():...
[ "0.81320006", "0.7065873", "0.7050401", "0.69584954", "0.6639191", "0.65908337", "0.64813334", "0.61590165", "0.60079956", "0.55892473", "0.5545319", "0.5419989", "0.53929675", "0.53920263", "0.53830427", "0.53503126", "0.5301055", "0.5280724", "0.52775556", "0.52568513", "0....
0.7634869
1
Compute matches when text contains a dot. Assuming the text is of the form NAME.NAME....[NAME], and is evaluatable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class instances, class members are also considered.)
def attr_matches(self, text): m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text) if not m: return [] expr, attr = m.group(1, 3) object = eval(expr, self.namespace) words = dir(object) if hasattr(object,'__class__'): words.append('__class__') w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def python_matches(self,text):\n #print 'Completer->python_matches' # dbg\n if \".\" in text:\n try:\n matches = self.attr_matches(text)\n if text.endswith('.') and self.omit__names:\n if self.omit__names == 1:\n ...
[ "0.67350745", "0.6467589", "0.5659091", "0.56373996", "0.55783284", "0.54272413", "0.53458554", "0.528147", "0.5278319", "0.52603084", "0.5194667", "0.51900584", "0.51714355", "0.5169853", "0.5109693", "0.5102715", "0.50885576", "0.50000334", "0.49939442", "0.4941889", "0.491...
0.6702154
1
Display a list of Event paginated
def list_event(request): event_list = Event.objects.all() paginator = Paginator(event_list, 5) try: page = int(request.GET.get('page', '1')) except ValueError: page = 1 # If page request (9999) is out of range, deliver last page of results. try: event_list = paginator.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_events_list():\r\n\tevents_list = Page.objects.filter(tags='events').order_by('-created')\r\n\treturn {'events_list': events_list}", "def event_list(request):\n if request.method == 'GET':\n if request.GET.get('search'):\n request_terms = request.GET.get('search')\n searc...
[ "0.83030045", "0.7657986", "0.7629149", "0.7394973", "0.7273532", "0.71547526", "0.6988922", "0.6988497", "0.6924161", "0.6869403", "0.68199164", "0.6779448", "0.67320573", "0.671834", "0.67172897", "0.6673681", "0.66686934", "0.65960234", "0.6561609", "0.65346944", "0.651391...
0.849096
0