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
Returns links by specified kind
def by_kind(self, kind): return self.__get_links_of_kind(kind)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_links_of_type(self, link_type):\n return (link for link in self.links if link.get('type', '') == link_type)", "def getLinks(tvshow, season, episode):\n numPage = 1\n possible_links = []\n doNext = True\n while(doNext):\n urltv = getTvShowUrl(tvshow, season, episode, numPage)\n ...
[ "0.62541753", "0.57913995", "0.57441735", "0.56872255", "0.5607647", "0.5559419", "0.5544218", "0.55263", "0.5517813", "0.5399748", "0.53875893", "0.536911", "0.5316677", "0.52928644", "0.52719575", "0.52154845", "0.5207393", "0.51708317", "0.51593643", "0.5120259", "0.511757...
0.8459637
0
Create notification about new PR encoded into JSON string.
def create_pr_notification(package, repository, id): # type: (str, str, int) -> str notification_dict = { "repository": repository, "package": package, "event": "pull-request", "id": id } return json.dumps(notification_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_issue_notification(package, repository, id):\n # type: (str, str, int) -> str\n notification_dict = {\n \"repository\": repository,\n \"package\": package,\n \"event\": \"issue\",\n \"id\": id\n }\n return json.dumps(notification_dict)", "def create_push_notific...
[ "0.7368776", "0.69647086", "0.6264538", "0.616052", "0.61432356", "0.61308223", "0.59937745", "0.59797275", "0.59643346", "0.5933744", "0.5888156", "0.58175576", "0.5811491", "0.5710258", "0.5695017", "0.5679291", "0.5665627", "0.565691", "0.56323576", "0.56159896", "0.554947...
0.82689
0
Create notification about new issue encoded into JSON string.
def create_issue_notification(package, repository, id): # type: (str, str, int) -> str notification_dict = { "repository": repository, "package": package, "event": "issue", "id": id } return json.dumps(notification_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_pr_notification(package, repository, id):\n # type: (str, str, int) -> str\n notification_dict = {\n \"repository\": repository,\n \"package\": package,\n \"event\": \"pull-request\",\n \"id\": id\n }\n return json.dumps(notification_dict)", "def create_issue(se...
[ "0.6931952", "0.65992254", "0.65992254", "0.6356018", "0.63211024", "0.61089927", "0.60944647", "0.60305566", "0.6025819", "0.60249966", "0.59330356", "0.5837374", "0.5767288", "0.57419676", "0.57410383", "0.57332975", "0.5709365", "0.5692221", "0.5649124", "0.55952764", "0.5...
0.7999522
0
Create notification about new push event encoded into JSON string.
def create_push_notification(package, repository): # type: (str, str) -> str notification_dict = { "repository": repository, "package": package, "event": "push", } return json.dumps(notification_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_pr_notification(package, repository, id):\n # type: (str, str, int) -> str\n notification_dict = {\n \"repository\": repository,\n \"package\": package,\n \"event\": \"pull-request\",\n \"id\": id\n }\n return json.dumps(notification_dict)", "def notify(self, ev...
[ "0.6686963", "0.6648966", "0.6612202", "0.64577", "0.64032626", "0.6372709", "0.63159364", "0.62687707", "0.6183537", "0.6105419", "0.6072862", "0.60584015", "0.6045075", "0.5950071", "0.5861448", "0.5816323", "0.5815697", "0.5803341", "0.57704157", "0.5765644", "0.57621056",...
0.73975295
0
Builds a trimesh.points.PointCloud with colors according to classes. pc has shape (N,3), whereas classes has shape (N,)
def build_colored_pointcloud(pc, classes, random=True): #Create array with random colors if random: random_colors = (np.random.rand(classes.max()+1, 4)*255).astype(int) random_colors[:, 3] = 255 else: random_colors = all_random_colors[0:classes.max()+1, :] #One hot encoding for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_point_cloud(self):\n pixels = []\n colors = []\n my_pixels = []\n for j in range(self.height):\n for i in range(self.width):\n depth = self.depth[j, i]\n pixels.append(\n [i * depth, j * depth, depth]\n ...
[ "0.6091042", "0.6063083", "0.5991325", "0.5973707", "0.58097756", "0.5759291", "0.57533497", "0.56859297", "0.567813", "0.56250924", "0.56091136", "0.56009686", "0.55823815", "0.5561951", "0.55301285", "0.55225855", "0.551518", "0.5411833", "0.5401321", "0.53958213", "0.53775...
0.8464607
0
cleanlocal(srcpath,uid) Cleans wintools msiinstaller, removes .iso for that UID, etc.
def cleanlocal(self,srcpath,uid): #Create log directory/file log = FakeLog() try: if not os.path.exists('c:\\build\\logs\\'+ uid): os.chdir('c:\\build\\logs') os.makedirs(uid) os.chdir('c:\\build\\logs\\'+ uid) log = ope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_local():\n local('rm -fr build')\n local('mkdir -p build')", "def scrub():\n\n\tlocal(\"rm -fr dist build\")\n\tlocal(\"find . -name \\\"*.pyc\\\" -exec rm '{}' ';'\")", "def clean():\n local('rm -fr %s' % os.path.abspath(env.config['destination']))", "def clean_local_folder():\n\n if o...
[ "0.6729632", "0.65212476", "0.64756864", "0.6284826", "0.62125957", "0.60931367", "0.600704", "0.5995872", "0.5960467", "0.5959618", "0.5954077", "0.5860415", "0.58491457", "0.5824717", "0.58175397", "0.58043015", "0.57324386", "0.5728262", "0.572665", "0.56762356", "0.567229...
0.7921656
0
Performs replacement of all tuples in the supplied list on the string
def replace_strings(text: str, replacement_pair_list): new_text = text for pair in replacement_pair_list: old, new = pair new_text = new_text.replace(old, new) return new_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_replace(text, list):\r\n\tfor pair in list:\r\n\t\tif pair[0] in text:\r\n\t\t\ttext = text.replace(pair[0], pair[1])\r\n\treturn text", "def list_string_sub(orig, repl, lst):\n return [x if orig not in x else x.replace(orig, repl) for x in lst]", "def test_sub_with_list(self):\n m = str...
[ "0.6480373", "0.6275576", "0.62637174", "0.62604994", "0.62524426", "0.61052054", "0.60848325", "0.608381", "0.6063112", "0.6056145", "0.6000511", "0.5862947", "0.58595014", "0.5833815", "0.5744858", "0.57150686", "0.5703171", "0.5682328", "0.5674144", "0.56488746", "0.564643...
0.7501913
0
Converts a scipy matrix to a numpy matrix
def scipy2numpy(scipy_obj): scipy_mat = scipy_obj.mat() size = scipy_mat.getSize() np_mat = np.zeros(size) for i in range(size[0]): for j in range(size[1]): np_mat[i,j] = scipy_mat.getValue(i,j) return np_mat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _native_matrix_2_numpy(mat):\n\n if 'RQRMI matrix' not in str(mat):\n raise ValueError('Input is not valid rqrmi matrix object')\n return np.array(rqrmilib.matrix_to_list(mat))", "def to_array_or_spmatrix(x):\n if is_SparseDataFrame(x):\n x = x.to_coo()\n elif is_sparse_dataframe(x)...
[ "0.6629825", "0.6480195", "0.64701384", "0.6443171", "0.6376115", "0.6357059", "0.63569844", "0.6322484", "0.62543416", "0.6196194", "0.61744684", "0.60874933", "0.60065746", "0.6002766", "0.59998983", "0.59851396", "0.5968057", "0.5960932", "0.594483", "0.5928596", "0.588402...
0.74352497
0
Measures avg, min and max execution time of 'func' over 'n_runs' executions
def timing(n_runs: int, func, warm_up: bool = True, verbose: bool = True): lower = float('inf') upper = -float('inf') avg = 0 if verbose: print(f"Timing (runs:{n_runs}): '{str(func)}' - ", end="", flush=True) # Call once without measurement "to get warm" if warm_up: if verbose...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_function(function, runs=1, average=min):\n results = [None] * runs\n for i in range(runs):\n t0 = time.perf_counter()\n function()\n t1 = time.perf_counter()\n results[i] = t1 - t0\n\n return average(results)", "def timedcalls(n, fn, *args):\n if isinstance(n, int...
[ "0.7177054", "0.6635889", "0.63575", "0.6284668", "0.6277308", "0.6259369", "0.6257934", "0.62328976", "0.6204911", "0.61312044", "0.61155164", "0.6090087", "0.6085559", "0.5986585", "0.5971731", "0.5951426", "0.59497905", "0.5866647", "0.58468604", "0.5842534", "0.5779698", ...
0.79506195
0
Take a string and return a valid filename constructed from the string
def format_filename(s: str): # from: https://gist.github.com/seanh/93666 valid_chars = "-_.() %s%s" % (string.ascii_letters, string.digits) filename = ''.join(c for c in s if c in valid_chars) filename = filename.replace(' ', '_') # I don't like spaces in filenames. return filename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_valid_filename(s):\n assert(s is not \"\" or s is not None)\n s = str(s).strip().replace(' ', '_')\n return re.sub(r'(?u)[^-\\w.]', '', s)", "def get_valid_filename(s):\n s = str(s).strip().replace(' ', '_')\n return re.sub(r'(?u)[^-\\w.]', '', s)", "def format_filename(s):\n valid_ch...
[ "0.80965817", "0.8055868", "0.8053721", "0.8053721", "0.8053721", "0.8001325", "0.7995787", "0.7928941", "0.7913765", "0.7826625", "0.7727187", "0.7595966", "0.75823694", "0.74955904", "0.7467527", "0.7412702", "0.73259616", "0.72336996", "0.70264083", "0.694541", "0.69451904...
0.8198603
0
Adds new simulants every time step based on the Crude Birth Rate and an assumption that birth is a Poisson process
def on_time_step(self, event): live_birth_rate = self.live_birth_rate.at[self.clock().year] still_birth_rate = self.still_birth_rate.at[self.clock().year] step_size = event.step_size / pd.Timedelta(seconds=SECONDS_PER_YEAR) mean_births = (live_birth_rate + still_birth_rate) * step_size...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_time_step(self, event):\n # Assume births are uniformly distributed throughout the year.\n step_size = event.step_size/pd.Timedelta(seconds=SECONDS_PER_YEAR)\n live_births = self.live_births_per_year*step_size + self.fractional_live_births\n stillbirths = self.stillbirths_per_yea...
[ "0.748289", "0.65296865", "0.61401683", "0.5945614", "0.5943405", "0.5849407", "0.5821653", "0.5749035", "0.5703046", "0.56443375", "0.55838895", "0.5504715", "0.5499127", "0.5495346", "0.5494614", "0.54763776", "0.5463865", "0.5440533", "0.5391943", "0.53780216", "0.5376241"...
0.80006975
0
Scans trough all github paginates results and returns the concatenated list of results.
def github_paginate(session, url): result = [] while url: r = session.get(url) result.extend(r.json()) next = r.links.get('next') if next: url = next.get('url') else: url = None return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetNextBatchOfResults(self) -> typing.List[Repository.Repository]:\n while True:\n try:\n logging.debug('Requesting page %d', self.next_page_num)\n page = list(self.query.get_page(self.next_page_num))\n logging.debug('Page %d contains %d results', self.next_page_num,\n ...
[ "0.6749739", "0.6316599", "0.6111882", "0.6063077", "0.60364", "0.60363734", "0.60069585", "0.59314877", "0.59307075", "0.5889814", "0.5881154", "0.5861267", "0.5823988", "0.58221513", "0.5805193", "0.5785465", "0.57764673", "0.57650334", "0.57580864", "0.5736606", "0.569902"...
0.69964933
0
Do the actual github import
def import_github(user, sync): session = get_oauth_session(user, provider='github') if sync and session: # Get user repos owner_resp = github_paginate(session, 'https://api.github.com/user/repos?per_page=100') try: for repo in owner_resp: GithubProject.object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ImportRepo(\n session: orm.session.Session,\n language: scrape_repos_pb2.LanguageToClone,\n metafile: pathlib.Path,\n) -> None:\n meta = pbutil.FromFile(metafile, scrape_repos_pb2.GitHubRepoMetadata())\n clone_dir = metafile.parent / f\"{meta.owner}_{meta.name}\"\n repo = contentfiles.GitHubRepository.Ge...
[ "0.64085984", "0.5903306", "0.58478564", "0.58276093", "0.582114", "0.57742536", "0.5730097", "0.5703335", "0.56866825", "0.5671395", "0.56704175", "0.5657361", "0.56095904", "0.55948627", "0.55479115", "0.5526346", "0.55108654", "0.5499223", "0.5483774", "0.548057", "0.54130...
0.5944541
1
Inject planet into random location within a frame
def inject_planet(self,data, psf_library, c_ratio=[0.01, 0.1], x_bound=[4, 61], y_bound=[4, 61], no_blend=False): image = data.copy() pl_num = np.random.randint(1, high=4) pos_label = np.zeros([64, 64]) used_xy = np.array([]) c_prior = np.linspace(c_ratio[0], c_ratio[1], 100) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spawn_orb(self):\n x_pos = random.randint(0, self.config.arena_size[0] - 1)\n y_pos = random.randint(0, self.config.arena_size[1] - 1)\n self.arena[x_pos][y_pos] = Tile.ORB", "def spawn(self, y, x, h, w):\n self.pos = (np.random.randint(y, y + h), np.random.randint(x, x + w))", ...
[ "0.619647", "0.6193241", "0.6168296", "0.6154896", "0.60892475", "0.6072915", "0.597706", "0.59406674", "0.58864975", "0.5874852", "0.58712566", "0.5793752", "0.5774825", "0.5764689", "0.5762446", "0.5756169", "0.57226956", "0.57103014", "0.5696398", "0.5671963", "0.56609255"...
0.62309784
0
Given a target namespace and other source namespaces, copy each source into the target. If a Module is passed as a source namespace, its __dict__ is used. If a namespace supplies an '__all__' key, only entries listed in '__all__' are used. Otherwise, only entries not starting with an underscore are used. This mirrors t...
def flood_namespace(target, *sources): for ns in sources: if isinstance(ns, ModuleType): ns = ns.__dict__ if '__all__' in ns: # Make sure to preserve the order of __all__. keys = ns['__all__'] ns = [(k, ns[k]) for k in ns['__all__']] e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge_sources(dest: Dict[str, Any], source: ConfigSource) -> Dict[str, Any]:\n for key, val in source.items():\n if isinstance(val, dict):\n if key in dest:\n dest[key] = _merge_sources(dest[key], val)\n else:\n dest[key] = val.copy()\n else...
[ "0.57022464", "0.54825646", "0.5393583", "0.5363507", "0.5330241", "0.5269147", "0.525944", "0.52456343", "0.5192128", "0.5158092", "0.51383495", "0.50292516", "0.50197506", "0.5004869", "0.49876675", "0.49504057", "0.4941953", "0.49281678", "0.49242175", "0.49118298", "0.489...
0.7438153
0
As above but make a new target namespace, using SimpleNamespace.
def new_namespace(*sources): ns = {} flood_namespace(ns, *sources) return SimpleNamespace(**ns)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_target_namespace(self, namespace):\n # do shit\n self.target_namespace = namespace.strip(\":\")", "def test_replace_net_namespace(self):\n pass", "def createNamespace(self):\r\n raise NotImplementedError('Endpoint can not be used directly.')", "def _create_namespace(self):...
[ "0.68276757", "0.65367144", "0.642111", "0.628723", "0.6269427", "0.6241679", "0.6128534", "0.60498405", "0.59945196", "0.5935441", "0.59166944", "0.5867554", "0.586403", "0.5848732", "0.5842931", "0.5809557", "0.5801372", "0.57773775", "0.57637984", "0.5757003", "0.5672211",...
0.6668445
1
Return a frozen version of the given value, which may be composed of lists, sets, dictionaries, tuples, and primitive immutable noncollection types. The frozen version replaces lists with tuples, sets with frozensets, and dicts with frozendicts.
def freeze(value): if isinstance(value, list): value = tuple(freeze(e) for e in value) elif isinstance(value, set): value = frozenset(freeze(e) for e in value) elif isinstance(value, dict): value = frozendict({k: freeze(v) for k, v in value.items()}) elif isinstance(value, tuple)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_frozen_set( val ):\n if isinstance(val, str):\n return frozenset([ val ])\n else:\n return frozenset(val)", "def compress(value):\n\t# type: (Any, ) -> Any\n\n\t# sets are not processed because they cannot contain lists or bytearrays anyway.\n\n\tif isinstance(value, (tuple, list)): # ...
[ "0.658217", "0.628285", "0.6254482", "0.61001176", "0.6093511", "0.5764389", "0.5704209", "0.56399447", "0.54786265", "0.54629564", "0.54567105", "0.54381984", "0.54065895", "0.5343774", "0.5340002", "0.53313535", "0.53064585", "0.5291094", "0.52744466", "0.5272368", "0.52329...
0.8504925
0
this gets a specific page from the imdb search query. imdb_page is so named because it is the page in imdb's search (divided into 50), while mine is divided into five. Thus, search will have to be rerun every 10 pages
def run_search(term, imdb_page, debug = False): # confirm function call if debug: print("run_search()") # scrub search term for imdb formatted_term = "+".join(term.split()) # add page information to search term if imdb_page > 0: page_specifier = f"&start={ (imdb_page * 50) + 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_page_number(query):\n\n\t# Local variables\n\tlanguages_list=[\"fr\"]\n\n\t# Query the API using the query in parameter\n\tfor cur_language in languages_list:\n\t\tresult=tmvdb_connect(os.path.join(app.config['API_URL'],(\"search/movie?api_key=\" + app.config['API_KEY'] + \"&language=\" + cur_language +...
[ "0.6569547", "0.62016755", "0.6195702", "0.6022802", "0.59683764", "0.59585005", "0.5923509", "0.59125024", "0.5909498", "0.57980466", "0.57091004", "0.5663413", "0.5652759", "0.5640332", "0.5630956", "0.5580548", "0.55698895", "0.548275", "0.5481085", "0.54797053", "0.547837...
0.7319664
0
gives the information for five shows, formatted for IMDB display results need to be the output of run_search() page is the page of our search results, not of the page on imdb
def make_page(results, page, debug = False): if debug: print("initiating make_page()") start = 5 * (page % 10) shows = [] if debug: print(f"start: {start}") for i in range(start, start + 5): if debug: print(i) try: args = results[i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_search(term, imdb_page, debug = False):\n\n # confirm function call\n if debug:\n print(\"run_search()\")\n\n # scrub search term for imdb\n formatted_term = \"+\".join(term.split())\n\n # add page information to search term\n if imdb_page > 0:\n page_specifier = f\"&start={...
[ "0.70160574", "0.6622251", "0.64590627", "0.6343956", "0.62634456", "0.6259138", "0.62381995", "0.61861444", "0.61835736", "0.6114548", "0.60942525", "0.6089762", "0.6086242", "0.60827166", "0.60442585", "0.6035096", "0.6031381", "0.6030996", "0.602582", "0.598011", "0.597218...
0.66484004
1
this returns a dictionary containing a list of dicts containing the episodes link, season, episode number and rating and a list of weights for their selection
def get_episodes(link, seasons, factor, debug=False): if debug: print("begin get_episodes()") print(seasons, factor) episodes = {"episodes": [], "weights": []} #this is the url that will be modified to access individual seasons base_url = f"https://www.imdb.com/{link}episodes?season="...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def episodes(self):\n for episode in self._root.iter('Episode'):\n entry = {}\n entry['season'] = int(episode.find('SeasonNumber').text)\n entry['episode'] = int(episode.find('EpisodeNumber').text)\n entry['title'] = unicode(episode.find('EpisodeName').text)\n ...
[ "0.6238751", "0.5922112", "0.5775955", "0.56929547", "0.5679052", "0.5615318", "0.55966496", "0.557304", "0.55072933", "0.5484548", "0.5450293", "0.5442787", "0.5397024", "0.53818834", "0.5340119", "0.53220266", "0.53196967", "0.52342325", "0.5217806", "0.5208575", "0.5183528...
0.75330806
0
Initialize with a ResultInfo message
def __init__(self, result_info, server=None): if server is None: server = dpf.core._global_server() self._server = server self._stub = self._connect() if isinstance(result_info, ResultInfo): self._message = result_info._message else: self._me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, msg, result):\n if result:\n msg += \" \" + repr(result)\n super(CountError, self).__init__(msg)", "def __init__(self, result, data='', msg='', safe=True, status=200):\n\n content = {'code': result, 'data': data, 'msg': msg}\n super(ResultResponse, self)....
[ "0.63554996", "0.6350709", "0.60515314", "0.59515864", "0.5937562", "0.5833333", "0.581884", "0.57942593", "0.57265574", "0.5708434", "0.5706333", "0.57042915", "0.56895477", "0.56608665", "0.5660642", "0.5660642", "0.56553495", "0.5617859", "0.56177014", "0.558525", "0.54508...
0.72683376
0
Retrieves the analysis type. Returns
def analysis_type(self): intOut = self._stub.List(self._message).analysis_type return result_info_pb2.AnalysisType.Name(intOut).lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type(self):\n return self._getValue('type')", "def get_type(self):\n return self.type", "def get_type(self):\n return self.type", "def get_type(self):\n return self._type_obj", "def get_type(self):\n return self._type", "def get_type(self):\n return self._typ...
[ "0.6945739", "0.6911548", "0.6911548", "0.6893719", "0.68596846", "0.68596846", "0.6829026", "0.6792039", "0.6767861", "0.6760933", "0.6760933", "0.6760933", "0.6760933", "0.6760933", "0.6760933", "0.6760933", "0.6760933", "0.6760933", "0.6760933", "0.6760933", "0.6760933", ...
0.81182647
0
Type of the physics. Examples Mechanical result >>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> transient = examples.download_transient_result() >>> model = dpf.Model(transient) >>> result_info = model.metadata.result_info >>> result_info.physics_type 'mecanic'
def physics_type(self): return self._get_physics_type()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type(self):\r\n return self.mm_type + self.meta_model.get_type()", "def determine_type(self):\n \n t = \" \" # Holder string\n self.cs = 0. \n ## On the lowest rigidities\n if self.xi_L < 0.3:\n if self.pe > 700.:\n ...
[ "0.64932656", "0.60521406", "0.58221495", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0.569277", "0...
0.6759795
0
Cyclic symmetry type of the result. Return
def cyclic_symmetry_type(self): return self._stub.List(self._message).cyc_info.cyclic_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_symmetry(self):\n\n # used to build the symmetry string\n symmetry = self.get_atoms()[0].get_symmetry_class()\n\n # used to count how many atoms there are of the current symmetry\n symmetric_atom_count = 1\n\n for atom in self.get_atoms()[1:]:\n\n # if this ato...
[ "0.61427885", "0.5678008", "0.56445557", "0.55818856", "0.55651236", "0.54231596", "0.5402874", "0.53900015", "0.52996665", "0.52706313", "0.52668315", "0.52633905", "0.5241587", "0.52388287", "0.5235822", "0.5200448", "0.5181456", "0.51543325", "0.51279444", "0.50888973", "0...
0.75547135
0
Name of the unit system.
def unit_system_name(self): return self._stub.List(self._message).unit_system_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_system_name(self):\n\n\t\treturn self.__system_name", "def getName(self):\n return _libsbml.UnitDefinition_getName(self)", "def name(cls):\n\n system = platform.system()\n\n # Apply system map\n if system in NAME_MAP:\n system = NAME_MAP[system]\n\n return ...
[ "0.7590635", "0.74826264", "0.73378354", "0.72057444", "0.71610206", "0.70184463", "0.69178474", "0.6863607", "0.68461764", "0.6814971", "0.67807335", "0.6778316", "0.6764865", "0.6764305", "0.67336017", "0.6729062", "0.6729062", "0.6729062", "0.6721508", "0.6664267", "0.6651...
0.8644083
0
Version of the solver.
def solver_version(self): major = self._stub.List(self._message).solver_major_version minor = self._stub.List(self._message).solver_minor_version version = str(major) + "." + str(minor) return version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_solver_version(self):\n return self.agent.version_info.get(\"SolverVersion\")", "def version(self):", "def version(self):\n pass", "def version(self):\n pass", "def version(self):\n pass", "def Version(self) -> _n_0_t_12:", "def Version(self) -> _n_0_t_12:", "def g...
[ "0.78920776", "0.75016785", "0.7411395", "0.7411395", "0.7411395", "0.7395428", "0.7395428", "0.7263973", "0.7226544", "0.71915954", "0.7051566", "0.7051566", "0.7051566", "0.7051566", "0.6999186", "0.69870436", "0.6975768", "0.69733924", "0.69228154", "0.69077677", "0.688902...
0.8034343
0
Date of the solver.
def solver_date(self): return self._stub.List(self._message).solver_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date(self):", "def get_date(self):\n raise Unimplemented()", "def date(self):\n return self._date", "def date(self):\n return self._date", "def date(self):\n return self._date", "def date(self):\n return self._date", "def getDate(self): # real signature unknow...
[ "0.7258651", "0.70778716", "0.6906804", "0.68344384", "0.68344384", "0.68344384", "0.6817727", "0.67917144", "0.6770604", "0.6735324", "0.6735324", "0.6735324", "0.6735324", "0.6735081", "0.67313784", "0.66988426", "0.6685754", "0.6682062", "0.6674413", "0.6636132", "0.661786...
0.8103799
0
Time of the solver.
def solver_time(self): return self._stub.List(self._message).solver_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time(self):\r\n raise NotImplementedError", "def time(self) -> int:\n pass", "def time(self):\n raise NotImplementedError()", "def time(self) -> float:\n return self.sim_scene.data.time", "def getSimulationTime(self):\r\n raise NotImplementedError()", "def _time(sel...
[ "0.75723124", "0.7516341", "0.75104505", "0.7490686", "0.74668705", "0.7270738", "0.724401", "0.7230352", "0.7226187", "0.722553", "0.7210946", "0.7186823", "0.7186039", "0.7113258", "0.7103441", "0.7094269", "0.7077801", "0.70721245", "0.7068871", "0.70500594", "0.7042541", ...
0.77344394
0
Find the increase in a series of increasing values over a preceding period of a certain duration.
def increment_last_period( recency: int, values: pd.Series, ) -> pd.Series: assert values.is_monotonic_increasing assert values.index.is_monotonic_increasing return values - pd.Series( np.interp(values.index - recency, values.index, values), index=values.index )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acc2vel(timeseries, dt):\n return np.cumsum(timeseries) * dt", "def step_change(data, span=10, lag=1):\n moving_average = data.ewm(span=span).mean()\n lagged = pd.Series(np.append(np.repeat(np.nan, lag), moving_average[:len(moving_average)-lag]))\n diffs = data[lag:] - lagged\n pct_diff = diff...
[ "0.5773484", "0.56507766", "0.56166655", "0.55785674", "0.55195063", "0.54890853", "0.5487738", "0.5465754", "0.53917897", "0.53910124", "0.5382138", "0.5361072", "0.5302956", "0.5268228", "0.5248495", "0.5240354", "0.5206289", "0.51781565", "0.5175583", "0.5172992", "0.51542...
0.6181045
0
Creates the SQL for this query. Returns the SQL string and list of parameters. If 'with_limits' is False, any limit/offset information is not included in the query.
def as_sql(self, with_limits=True, with_col_aliases=False): #import pdb; pdb.set_trace() if with_limits and self.query.low_mark == self.query.high_mark: return '', () self.pre_sql_setup() # After executing the query, we must get rid of any joins the query # se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_sql(self, with_limits=True, with_col_aliases=False):\n if with_limits and self.query.low_mark == self.query.high_mark:\n return '', ()\n\n self.pre_sql_setup()\n out_cols = self.get_columns(with_col_aliases)\n ordering, ordering_group_by = self.get_ordering()\n\n ...
[ "0.7211673", "0.66785", "0.6235755", "0.6094703", "0.6044571", "0.5991643", "0.583619", "0.58257467", "0.5725525", "0.56868553", "0.5616761", "0.56020063", "0.55063355", "0.5504793", "0.54430324", "0.5438193", "0.5419245", "0.5343601", "0.5312701", "0.52950084", "0.5268263", ...
0.71008664
1
Run the query against the database and returns the result(s). The return value is a single data item if result_type is SINGLE, or an iterator over the results if the result_type is MULTI. result_type is either MULTI (use fetchmany() to retrieve all rows), SINGLE (only retrieve a single row), or None. In this last case,...
def execute_sql(self, result_type=MULTI): try: sql, params = self.as_sql() #import pdb; pdb.set_trace() if not sql: raise EmptyResultSet except EmptyResultSet: if result_type == MULTI: return iter([]) el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(self, query, cs_type=None, *parameters, **kwparameters):\n cursor = self._cursor(cs_type)\n try:\n self._execute(cursor, query, parameters, kwparameters)\n if cs_type in [\"SSCursor\", \"SSDictCursor\"]:\n while 1:\n try:\n ...
[ "0.7102365", "0.6607257", "0.6566395", "0.6153875", "0.6145387", "0.60345584", "0.6025953", "0.60174847", "0.59891194", "0.5940763", "0.5934384", "0.59166", "0.5915514", "0.59021056", "0.59005976", "0.5891872", "0.5883613", "0.5880756", "0.5867162", "0.5835609", "0.5829628", ...
0.7793496
0
Yields blocks of rows from a cursor. We use this iterator in the special case when extra output columns have been added to support ordering requirements. We must trim those extra columns before anything else can use the results, since they're only needed to make the SQL valid.
def order_modified_iter(cursor, trim, sentinel): for rows in iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), sentinel): yield [r[:-trim] for r in rows]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rowgen(searchcursor_rows):\n rows = searchcursor_rows\n row = rows.next() \n while row:\n yield row\n row = rows.next()", "def __iter__(self):\n for r in self.cursor:\n yield r", ...
[ "0.6864684", "0.67795837", "0.6762757", "0.6760832", "0.6737776", "0.6573423", "0.65327466", "0.65327466", "0.64728004", "0.6402408", "0.63241476", "0.6242705", "0.6220044", "0.61291146", "0.6083363", "0.6015292", "0.5999454", "0.59743726", "0.596199", "0.593652", "0.5921442"...
0.7029898
0
Parses txt file and returns [location, dist]
def parse_tsp_txt(n): if not n == 5 and not n == 7 and not n == 30 and not n == 100: raise ValueError("Invalid n, allowed values are: 5, 7, 30, 100") with open("../data/tsp{}.txt".format(n)) as file: file_content = [l.strip() for l in file.readlines()] length = len(file_content) loc_ind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_locations():\n r = open(\"resources/files/locations.txt\", \"r\", newline=\"\\n\")\n locations = r.read().split(\"\\n\")\n return locations", "def parse_data_file(self, file_name: str) -> List[Tuple[str, int]]:\n with open(file_name, \"r\") as f:\n data_list = []\n...
[ "0.61113083", "0.5965698", "0.5928224", "0.59077394", "0.58766675", "0.5850951", "0.5831562", "0.5788629", "0.5726204", "0.56975794", "0.56836486", "0.56747615", "0.5667696", "0.5659096", "0.5650312", "0.5643559", "0.5577995", "0.5576831", "0.55664784", "0.5563601", "0.555636...
0.6564562
0
Returns tours[], where each tour is a (sub)tour using the selected visits If there are no subtours, tours is a list containing a single (complete) tour
def get_tours(visits): n = len(visits) is_timespace = len(visits[0]) == 3 # Timespace tour if is_timespace: tour = [] visits_dict = dict(zip([v[0] for v in visits], [v[1] for v in visits])) key = 0 for i in range(n + 1): tour.append(key) key = vi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alltours(cities):\n start = first(cities)\n return [[start] + Tour(rest)\n for rest in itertools.permutations(cities - {start})]", "def _parse_tour(self):\n\n tour = []\n\n while True:\n try:\n s = int(self._lines.current)\n if s == -1:\n...
[ "0.66409457", "0.5938735", "0.5928978", "0.58397067", "0.58112305", "0.5668709", "0.55179137", "0.550581", "0.53873533", "0.53786445", "0.51652724", "0.5123706", "0.50762653", "0.50448513", "0.50357574", "0.5029767", "0.49904323", "0.49869084", "0.4949537", "0.49389112", "0.4...
0.74199355
0
Returns xvars as tuples (i,j) where Xij = 1
def get_visits(xvars): is_timespace = len(list(xvars)[0]) == 3 if is_timespace: visits = [var[0] for var in xvars.iteritems() if var[1].X == 1] return sorted(visits, key=lambda visit: visit[2]) n = max(xvars.keys())[0] + 1 visits = [] for i in range(n): for j in range(n): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vars(self):\n return [Var(i,self.dims[i]) for i in range(self.nvar)] # TODO: use stored state info (=1 sometimes)", "def aind(x):\n\treturn tuple(x.T)", "def states(self):\n num_states = 2**self.num_vars\n return (int2tuple(s, self.num_vars) for s in range(num_states))", "def var(self,i...
[ "0.6673481", "0.64654684", "0.6278707", "0.6167018", "0.613378", "0.61069137", "0.61069137", "0.6101224", "0.60877955", "0.60327023", "0.59997827", "0.59293705", "0.5897879", "0.58759767", "0.5851818", "0.58161676", "0.5747827", "0.57403964", "0.57403964", "0.57246953", "0.56...
0.6478328
1
Determine that div contains category members AND that it's not recursive.
def div_contains_category_members(div, div_class='mw-content-ltr'): div_list_children = div.find('ul').find_all('li') test_child = list(div_list_children[0].children)[0] div_is_recursive = len(div.find_all('div', class_=div_class)) > 0 # tmp debugging # print(list(div_list_children[0].children)) # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_category_members(div):\n category_members = div.find_all('a')\n # remove any members with class\n category_members = list(filter(lambda x: x.get('class') is None, category_members))\n category_member_urls = list(map(lambda x: x['href'], category_members))\n for category_member in categor...
[ "0.5996574", "0.5944101", "0.57979137", "0.56122875", "0.5609548", "0.55475867", "0.54341555", "0.54182756", "0.54004925", "0.52427113", "0.523005", "0.5228566", "0.5214556", "0.52103925", "0.5196381", "0.5189288", "0.51823044", "0.51431423", "0.5122771", "0.5100869", "0.5072...
0.813301
0
Method that is executed when a SeleniumLibrary keyword fails. By default executes the registered runonfailure keyword. Libraries extending SeleniumLibrary can overwrite this hook method if they want to provide custom functionality instead.
def failure_occurred(self): if self._running_on_failure_keyword or not self.run_on_failure_keyword: return try: self._running_on_failure_keyword = True BuiltIn().run_keyword(self.run_on_failure_keyword) except Exception as err: logger.warn("Keyword...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_failure(self):\n pass", "def plugin_failure_callback(self, **_: Any) -> None:\n self.plugin_failed = True", "def v2_runner_on_failed(self, result, ignore_errors=False):\n super(Callback, self).v2_runner_on_failed(result, ignore_errors)\n self._store(result, STATUS_FAILED)", ...
[ "0.6530398", "0.6406899", "0.6398123", "0.62502456", "0.60872674", "0.60174185", "0.58952564", "0.5807115", "0.5802619", "0.57780284", "0.57699096", "0.5755381", "0.5725889", "0.5684716", "0.5536673", "0.5511737", "0.5501743", "0.5471415", "0.5459592", "0.54474235", "0.543479...
0.7164701
0
Find element matching `locator`.
def find_element(self, locator, parent=None): return self._element_finder.find(locator, parent=parent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_element(self, locator):\n try:\n elem = self.driver.find_element(*locator)\n except NoSuchElementException:\n raise NoSuchElementException('Element with locator [{}] is not found'.format(locator))\n return elem", "def _find_element(self, driver):\n WebDri...
[ "0.747968", "0.73482245", "0.731309", "0.6974652", "0.68741465", "0.6739375", "0.67346895", "0.67346895", "0.670744", "0.66600996", "0.6638456", "0.6572199", "0.6540644", "0.65099967", "0.6501087", "0.6468079", "0.64327455", "0.63999563", "0.6335513", "0.63234043", "0.6285664...
0.7715009
0
Find all elements matching `locator`.
def find_elements(self, locator, parent=None): return self._element_finder.find(locator, first_only=False, required=False, parent=parent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locate_elements(self, selector):\n if ',' not in selector:\n return self.base_driver.find_elements_by_id(selector)\n\n selector_by = selector.split(',')[0].strip()\n selector_value = selector.split(',')[1].strip()\n\n if selector_by == \"i\" or selector_by == 'id':\n ...
[ "0.7106821", "0.70479095", "0.6909338", "0.68980443", "0.682834", "0.67530894", "0.6733176", "0.66586196", "0.6616143", "0.6507854", "0.6483233", "0.647735", "0.647214", "0.6440378", "0.6423163", "0.6413793", "0.6385318", "0.63241255", "0.62613004", "0.6206836", "0.61442655",...
0.77160966
0
Reads a file and and adds routers accordingly
def read_from_file(self, filename): with open(filename, 'r') as f: for line in f.read().splitlines(): name, neighbours, r_table = line.split('!') self.add_new(name) if neighbours: for neighbour in neighbours.split(';'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_routers(filename):\n with open(filename, 'r') as json_file:\n add_list = json.loads(json_file.read())\n print(\"Addresses :\" + str(add_list))\n routers = [telnet_router.TN_ROUTER(router['device'], router['username'], \\\n router['password'], router['en_password']) for router in add...
[ "0.621587", "0.5801122", "0.57844853", "0.5641793", "0.55926573", "0.54082507", "0.53814894", "0.53564644", "0.5342552", "0.5329508", "0.5312146", "0.5301202", "0.5300435", "0.5292954", "0.5253017", "0.5133995", "0.5112328", "0.5089958", "0.50567675", "0.5053893", "0.5022192"...
0.6134862
1
Adds a new router
def add_new(self, name): if name not in self.routers: self.routers[name] = Router(name) return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_router(self):\n router = OrderedDict({self.router_name: {\n 'type': 'OS::Neutron::Router',\n 'properties': {\n 'name': self.router_name,\n 'external_gateway_info': {\n 'network': { 'get_param': 'public_net' }\n }\n...
[ "0.7745628", "0.7335507", "0.7250942", "0.7136993", "0.67677104", "0.67125756", "0.67084605", "0.6678754", "0.6618626", "0.6580354", "0.64877987", "0.64808756", "0.6478701", "0.64710027", "0.645152", "0.6347778", "0.63290423", "0.6299416", "0.6284313", "0.6275356", "0.6250851...
0.75690097
1
Adds two routers as neighbours of each other
def add_neighbours(self, router1, router2): router1 = self.routers[router1] router2 = self.routers[router2] router1.add_neighbour(router2) router2.add_neighbour(router1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect_neighbours(self):\n for prev in self.unvisited:\n for next in self.unvisited:\n if (next[0] == prev[0] and next[1] == prev[1] + 1) or (next[0] == prev[0] + 1 and next[1] == prev[1]):\n self.graph.addEdge((prev, next))\n self.visite...
[ "0.6827736", "0.66287476", "0.6611554", "0.65931433", "0.63179195", "0.62261623", "0.6216004", "0.6162332", "0.61219513", "0.6078242", "0.6041439", "0.6019774", "0.5997789", "0.59673154", "0.59464484", "0.5941529", "0.5939377", "0.5926242", "0.5914043", "0.59015495", "0.58964...
0.8533659
0
Adds a network to a router
def add_network(self, router, network, distance): self.routers[router].add_network(network, distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_network(self, network, distance):\n self.networks[network] = distance", "def test_create_router_no_external_network_and_add_network_port(self):\n # Create Router\n suffix = datetime.utcnow().strftime('%Y%m%d%H%M%S')\n router_name = TEST_ROUTER_PREFIX + \"_ports_\" + suffix\n ...
[ "0.7227589", "0.71574765", "0.6915779", "0.68536115", "0.67734444", "0.66890377", "0.66717154", "0.65800214", "0.6474031", "0.64479244", "0.6407449", "0.6370312", "0.6367269", "0.63141453", "0.63130546", "0.62178004", "0.62009114", "0.61941004", "0.6159907", "0.6157635", "0.6...
0.83719367
0
Send routing table to neighbours of the router named 'name'
def send(self, name): router = self.routers[name] for neighbour in router.neighbours: neighbour = self.routers[neighbour] neighbour.receive_routing_table(router)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_routing_table(self):\n for subnet, entry in self.tbl.items():\n if entry.neighbor_port:\n self.deploy_flow_entry(subnet=subnet, outport=entry.receive_port, dstport=entry.neighbor_port)", "def receive_routing_table(self, router):\n for network, distance in router...
[ "0.6570235", "0.610965", "0.6063992", "0.58601487", "0.5821405", "0.5767379", "0.57593596", "0.57214564", "0.56717265", "0.56673974", "0.56334335", "0.5612094", "0.5559741", "0.5521023", "0.5511581", "0.54867744", "0.5479415", "0.5464776", "0.5454418", "0.5453174", "0.5442762...
0.8777638
0
Asks for a router name and prints it's info
def print_router(router_simulator): name = input('Enter router name: ') try: router_simulator.print_info(name) except KeyError: # the router was not found. Hence KeyError was raised print('Router was not found.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_router(self, router, **_params):\r\n return self.get(self.router_path % (router), params=_params)", "def main():\r\n if len(sys.argv) != 2:\r\n sys.exit(\"Usage: python router-python.py [Router Port]\")\r\n router_port = int(sys.argv[1])\r\n router(router_port)", "def get_t1_rou...
[ "0.6651962", "0.586639", "0.5772948", "0.5671278", "0.56588936", "0.5658637", "0.5651048", "0.55746573", "0.55094606", "0.5495519", "0.5493114", "0.54390633", "0.54057986", "0.53860605", "0.538163", "0.5318896", "0.53128374", "0.5307692", "0.5302797", "0.5302105", "0.529328",...
0.8140848
0
Asks for two router name and connects them
def connect(router_simulator): router1 = input('Enter 1st router: ') router2 = input('Enter 2nd router: ') try: router_simulator.add_neighbours(router1, router2) except KeyError: print('Router was not found.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_to(self, inf1, router2, inf2):\n self.interfaces[inf1]['connect'] = [router2.hostname, inf2]\n router2.interfaces[inf2]['connect'] = [self.hostname, inf1]", "def router(paramstring):\r\n channels()", "def look_for_router(self):\n found = False\n s = None\n for ...
[ "0.6736008", "0.6112837", "0.59737176", "0.5791491", "0.577502", "0.5732288", "0.5675407", "0.56747097", "0.5630005", "0.562008", "0.56007206", "0.55675274", "0.549687", "0.5437338", "0.54185283", "0.5395231", "0.5389679", "0.5381259", "0.53764254", "0.5373118", "0.53536135",...
0.7206333
0
Asks for a new network info and adds it to the specified router adds a new new network from
def new_network(router_simulator): router = input('Enter router name: ') network = input('Enter network: ') try: distance = int(input('Enter distance: ')) except ValueError: print('Distance not valid.') return try: router_simulator.add_network(router, network, distan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_network(self, router, network, distance):\n self.routers[router].add_network(network, distance)", "def test_create_router_no_external_network_and_add_network_port(self):\n # Create Router\n suffix = datetime.utcnow().strftime('%Y%m%d%H%M%S')\n router_name = TEST_ROUTER_PREFIX ...
[ "0.7382743", "0.6471974", "0.646318", "0.64131385", "0.63992697", "0.62837666", "0.62250733", "0.6219243", "0.61409867", "0.6087181", "0.5997025", "0.59544665", "0.5885982", "0.5881553", "0.5862161", "0.58509666", "0.5818333", "0.58161104", "0.58047307", "0.57965845", "0.5792...
0.7597174
0
Smoke tests for marginal threshold convenience constructors
def test_threshold_constructors(ndraw=1000, burnin=200): cls = threshold for const_info, rand in product(zip([gaussian_instance, logistic_instance, poisson_instance], [cls.gaussian, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, method):\n self.threshold_sigma = 5\n self.method = method", "def __init__(self, threshold: float = 0.3, initial_val: float = 0.0) -> None:\n self.threshold = threshold\n self.initial_val = initial_val", "def test_unknown_thresholding(self):\n self.cube.coo...
[ "0.6341539", "0.6320659", "0.6312626", "0.62831867", "0.62030226", "0.61506224", "0.61092854", "0.6096852", "0.6053231", "0.6037748", "0.60373604", "0.59977335", "0.5984144", "0.59571886", "0.5943746", "0.5932518", "0.5883543", "0.5882622", "0.5881832", "0.58757114", "0.58717...
0.6476312
0
Uses admin API key to get account data for modify_account_family API call
def get_accounts(admin_api_key, env, project_id, default_account_family): half_url = f"{env}/api/billing.json/get_account_family_v2" api_parameters = {"use_cc_account_id": project_id} resp = requests.get(half_url, params=api_parameters, headers = {"access_key": admin_api_key}) account_families...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_account_family(admin_api_key, env, project_id, default_account_family, accounts):\n\n half_url = f\"{env}/api/billing.json/modify_account_family\"\n api_parameters = {\"use_cc_account_id\": project_id, \"name\": default_account_family, \"accounts\": accounts}\n resp = requests.post(half_url, da...
[ "0.7155302", "0.60291064", "0.59268534", "0.583606", "0.5804985", "0.580244", "0.56068254", "0.55579215", "0.5475276", "0.5439788", "0.5410799", "0.53892803", "0.5383013", "0.53538316", "0.5332116", "0.5321591", "0.5321187", "0.53109044", "0.5303763", "0.52980417", "0.5297817...
0.63871694
1
Uses admin API key to add all unmapped accounts to default account family
def modify_account_family(admin_api_key, env, project_id, default_account_family, accounts): half_url = f"{env}/api/billing.json/modify_account_family" api_parameters = {"use_cc_account_id": project_id, "name": default_account_family, "accounts": accounts} resp = requests.post(half_url, data=json.dumps(api...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accounts():", "def get_accounts(admin_api_key, env, project_id, default_account_family):\n \n half_url = f\"{env}/api/billing.json/get_account_family_v2\"\n api_parameters = {\"use_cc_account_id\": project_id}\n resp = requests.get(half_url, params=api_parameters, headers = {\"access_key\": admin...
[ "0.6062024", "0.6043067", "0.56612104", "0.56509554", "0.5596853", "0.5551189", "0.5540385", "0.54519147", "0.54022497", "0.5380714", "0.53584695", "0.5346138", "0.52714616", "0.5231801", "0.5224136", "0.51920146", "0.5191844", "0.51858574", "0.5174848", "0.51730657", "0.5158...
0.6267588
0
Validates enviroment. By default, it checks for api, eu, au, gov and qa. If you are using a standalone environment, then you must add it to the environments list
def validate_env(env): enviroments = ["https://api.cloudcheckr.com", "https://eu.cloudcheckr.com", "https://au.cloudcheckr.com", "https://gov.cloudcheckr.com", "https://qa.cloudcheckr.com"] if env not in enviroments: log_information(f"The environment {env} is not valid. If this is a standalone environ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_env(env: EnvType, env_context: EnvContext) -> None:\n pass", "def verify_environment():\n reqs = ['NAME', 'RECIPIENT', 'SUBJECT', 'MESSAGE',\n 'MAILGUN_API_KEY', 'MAILGUN_DOMAIN']\n for req in reqs:\n if not os.getenv(req):\n logging.error('Environment varia...
[ "0.75857437", "0.69768393", "0.6961345", "0.68653363", "0.6806467", "0.67389154", "0.6559027", "0.63693285", "0.63349515", "0.6279337", "0.6277938", "0.6216729", "0.6213999", "0.61731195", "0.6162738", "0.6141198", "0.6120459", "0.6084685", "0.60703725", "0.6057299", "0.60294...
0.8000082
0
get the data type dict of the corresponding backend.
def data_type_dict(backend=None) -> dict: module = get_module(backend) return module.data_type_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_type():\n return DataTypeUtil.getDTypeForName(DataTypeUtil.getDtypeFromContext())", "def backend(self) -> Dict[str, Any]:\n # Terraform can only have one backend configured; this formats the\n # data to make it easier to work with\n return [\n {\"type\": k, \"config\":...
[ "0.6731447", "0.6503522", "0.6297009", "0.62334603", "0.62334603", "0.62082255", "0.6198031", "0.61812806", "0.61686426", "0.6147504", "0.6145878", "0.61410064", "0.6107459", "0.60880953", "0.60547113", "0.60543144", "0.60382444", "0.60382444", "0.60382444", "0.5995823", "0.5...
0.88010275
0
Check whether 'x' is a strided (dense) Tensor.
def is_dense(x: Any, backend=None) -> bool: module = get_module(backend) return module.is_dense(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_tcns(x):\n return type(x) is T.TensorConstant", "def is_keras_tensor(x):\n if not is_tensor(x):\n raise ValueError('Unexpectedly found an instance of type `' +\n str(type(x)) + '`. '\n 'Expected a symbolic tensor instance.')\n return hasattr(...
[ "0.6362374", "0.62143683", "0.61998135", "0.6169852", "0.6113837", "0.6050881", "0.58987665", "0.58963126", "0.5887012", "0.57821244", "0.5754241", "0.5749059", "0.57374436", "0.5733738", "0.565673", "0.56030405", "0.5576624", "0.5526071", "0.5495965", "0.5449765", "0.5379795...
0.6459444
0
Convert a TensorFLow tensor to PyTorch Tensor, or vice versa.
def tensor2tensor(tensor, *, device=None): assert gg.TF_ENABLED, 'Currently tensorflow backend is not enabled.' if pytorch.is_tensor(tensor): m = tensoras(tensor) device = gf.device(device, backend="tensorflow") return astensor(m, device=device, backend="tensorflow") elif tenso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_tensor(cls, tensor):\n if isinstance(tensor, Tensor):\n return tensor\n return Tensor(data=tensor)", "def as_tensor(self) -> torch.Tensor:\n return self.as_subclass(torch.Tensor)", "def unwrap(t):\n if isinstance(t, torch.Tensor):\n return t.item()\n\n retur...
[ "0.7826558", "0.6762702", "0.6725563", "0.65969926", "0.6584483", "0.6583539", "0.6488551", "0.64823174", "0.6471931", "0.6430466", "0.6411087", "0.63594705", "0.6351569", "0.6303903", "0.62878263", "0.6277558", "0.6263137", "0.62521243", "0.62212837", "0.6214998", "0.6199165...
0.76599425
1
Convert a TensorFLow tensor or PyTorch Tensor to Numpy array or Scipy sparse matrix.
def tensoras(tensor): if pytorch.is_dense(tensor): m = tensor.detach().cpu().numpy() if m.ndim == 0: m = m.item() elif pytorch.is_sparse(tensor): m = pytorch.sparse_tensor_to_sparse_adj(tensor) elif gg.TF_ENABLED and tensorflow.is_dense(tensor): m = tens...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu...
[ "0.7284173", "0.688847", "0.68419737", "0.6765689", "0.67396414", "0.67396414", "0.67396414", "0.67396414", "0.67396414", "0.67396414", "0.67396414", "0.67396414", "0.67396414", "0.67396414", "0.67396414", "0.67396414", "0.67396414", "0.6739183", "0.6738073", "0.6738073", "0....
0.724067
1
Finds probabilities of edges in data relative to gold
def numerator(self,data,gold): gold_size = 0.0 for lead in gold.keys(): gold_size += len(gold[lead]) print gold_size epsilon = 0.0000000001 match = 0.0 not_match = 0.0 exp_size = 0.0 for lead in data.keys(): for hit in data[lead]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcProbXY(data,allEdges):\n\tfor edge in allEdges:\n\t\tcount = 0\n\t\tcount1 = 0\n\t\tfor tumor in data:\n\t\t\tif ((edge[0] in tumor) or (edge[1] in tumor)):\n\t\t\t\tcount1 += 1\n\t\t\tif ((edge[0] in tumor) and (edge[1] in tumor)):\n\t\t\t\tcount += 1\n\t\tedge.append(count/len(data))\n\t\tedge.append(cou...
[ "0.65501654", "0.626193", "0.61411", "0.60616773", "0.6025262", "0.6018133", "0.60132617", "0.6006102", "0.5948369", "0.58914864", "0.58255523", "0.5798609", "0.5776101", "0.5773953", "0.57680804", "0.5765425", "0.5756678", "0.5724742", "0.5704905", "0.5703837", "0.56906503",...
0.7002848
0
Load the effects for the controller
def load_effects(self): # effect 1, light rumble rumble = ff.Rumble(strong_magnitude=0xc000, weak_magnitude=0x500) duration_ms = 300 effect = ff.Effect(ecodes.FF_RUMBLE, -1, 0, ff.Trigger(0, 0), ff.Replay(duration_ms, 0), ff.EffectType(ff_rumble_effect=rumble)) effect = ff.Effect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_load(self):\r\n for _, effect in self._effects.items():\r\n effect.post_load()", "def get_effects(self):\n return self._hndl.get_effects()", "def create_effect_classes(self):\r\n effects.polulate(self.effect_packages)", "def load(self):\r\n self.create_effect_c...
[ "0.71827906", "0.63305956", "0.6327776", "0.62312603", "0.5758802", "0.56661475", "0.56661475", "0.54434437", "0.5411339", "0.53799766", "0.53766114", "0.5370574", "0.53334063", "0.5332979", "0.5325523", "0.52932864", "0.5283452", "0.5277984", "0.5266846", "0.52376026", "0.52...
0.7342398
0
Loads config and can use instance for only selecting 'instance' from config
def load_config(instance=None): if not path.exists("config.json"): raise ConfigError("config.json was not found in local directory") try: with open("config.json") as f: if instance is None: return load(f) else: return load(f)[instance] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, config_instance):\r\n pass", "def _set_instance_config(self):\n\t\t\n\t\tif \"PARAMETERS_NAME\" in self.config.keys():\n\t\t\tlogger.info(\"You specified your own PARAMETERS_NAME, I will use it.\")\n\t\telse:\n\t\t\tself.config[\"PARAMETERS_NAME\"] = self._get_params_filepath()\n\t\t\n\t\ti...
[ "0.8285529", "0.66527873", "0.6631447", "0.65686876", "0.64745265", "0.6409755", "0.63045645", "0.62906355", "0.6287491", "0.6218614", "0.6195478", "0.616303", "0.6162716", "0.61552656", "0.6141008", "0.6136666", "0.6036171", "0.6010883", "0.60021675", "0.5959411", "0.5920656...
0.7102246
1
Loads config from config.json with aiofile.AIOFile
async def aioload_config(instance=None): if not path.exists("config.json"): raise ConfigError("config.json was not found in local directory") try: async with AIOFile("config.json", "r") as afp: if instance is None: return loads(await afp.read()) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_config(config_path: str) -> dict:\n path = Path(config_path).expanduser()\n if not path.exists():\n # Produce a nice error message like:\n # Config file NAPARI_ASYNC=missing-file.json not found\n raise FileNotFoundError(\n errno.ENOENT, f\"Config file NAPARI_ASYN...
[ "0.7424413", "0.72897565", "0.7254485", "0.72409046", "0.7132173", "0.70923287", "0.70499533", "0.703439", "0.703439", "0.6944238", "0.6893426", "0.68815726", "0.6828774", "0.6813613", "0.6808992", "0.67682916", "0.67571557", "0.67081034", "0.6696688", "0.6672894", "0.6663037...
0.74381465
0
writes config and can use instance for only selecting 'instance' to write to config
def write_config(config, instance=None): if not path.exists("config.json"): raise ConfigError("config.json was not found in local directory") try: with open("config.json", "w") as f: if instance is None: return dump(f, config) else: conf = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store(self, config_instance):\r\n pass", "def _set_instance_config(self):\n\t\t\n\t\tif \"PARAMETERS_NAME\" in self.config.keys():\n\t\t\tlogger.info(\"You specified your own PARAMETERS_NAME, I will use it.\")\n\t\telse:\n\t\t\tself.config[\"PARAMETERS_NAME\"] = self._get_params_filepath()\n\t\t\n\t\t...
[ "0.7696306", "0.6935514", "0.63249296", "0.62685394", "0.62394196", "0.61583215", "0.6144106", "0.6115689", "0.6108465", "0.61017704", "0.6067649", "0.6006192", "0.59693766", "0.58783454", "0.5871066", "0.5842936", "0.58211994", "0.5811877", "0.5798685", "0.57736516", "0.5758...
0.6984597
1
Returns a batch of recommendations via TS in the synchronous setting.
def syn_ts(num_workers, gp, acq_optimiser, anc_data, **kwargs): recommendations = [] for _ in range(num_workers): rec_j = asy_ts(gp, acq_optimiser, anc_data, **kwargs) recommendations.append(rec_j) return recommendations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(self, batch: Dataset) -> List[TaggingResponse]: # type: ignore\n syntax_options: SyntaxOptions = assert_not_none(self.config.syntax)\n spacy_model = spacy.load(syntax_options.spacy_model)\n\n utterances = batch[self.config.columns.text_input]\n records: List[TaggingResponse...
[ "0.5626458", "0.56006867", "0.5556876", "0.5293165", "0.52709365", "0.5266768", "0.5192134", "0.5148291", "0.5102328", "0.50822645", "0.5016397", "0.5010936", "0.49705252", "0.4946658", "0.4936157", "0.49309418", "0.49287045", "0.49190405", "0.49188206", "0.49160415", "0.4903...
0.6457169
0
Returns a recommendation via Batch UCB in the synchronous setting.
def syn_bucb(num_workers, gp, acq_optimiser, anc_data): recommendations = [asy_ucb(gp, acq_optimiser, anc_data)] for _ in range(1, num_workers): recommendations.append(_halluc_ucb(gp, acq_optimiser, recommendations, anc_data)) return recommendations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_recommend(self, user):\n return self.user_cf.calculate(target_user_id=user, user_n=self.user_n,\n item_n=self.item_n, type=2)", "def syn_hucb(num_workers, gp, acq_optimiser, anc_data):\n recommendations = [asy_ucb(gp, acq_optimiser, anc_data)]\n for _ in ran...
[ "0.5559992", "0.5402083", "0.51015484", "0.508953", "0.5045593", "0.5040732", "0.502515", "0.4971162", "0.4957267", "0.49430785", "0.49430785", "0.49164808", "0.4892932", "0.48857567", "0.4881223", "0.4819212", "0.48170462", "0.48079178", "0.47673503", "0.47599366", "0.475148...
0.591596
0
An LCB for GPUCBPE.
def _ucbpe_lcb(x): mu, sigma = gp.eval(x, uncert_form='std') return mu - beta_th * sigma
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBL(self):\r\n return self.bL;", "def g_lb(self):\n pass", "def test_parcel_profile_lcl():\n p = np.array([1004., 1000., 943., 928., 925., 850., 839., 749., 700., 699.]) * units.hPa\n t = np.array([24.2, 24., 20.2, 21.6, 21.4, 20.4, 20.2, 14.4, 13.2, 13.]) * units.degC\n td = np.ar...
[ "0.5477161", "0.5425317", "0.5388485", "0.5338387", "0.52230024", "0.5162295", "0.5155183", "0.5142336", "0.51376677", "0.51186275", "0.51061386", "0.5049539", "0.50168234", "0.5009422", "0.50089353", "0.5005155", "0.49994755", "0.4978468", "0.49626935", "0.49400845", "0.4928...
0.566873
0
Helper function to merge embeddings values into given dataframe
def merge_embeddings(xdf, cat, emb, w, verbose): if verbose: print("embeddings category: '%s' embeddings shape %s" % (cat, np.shape(w))) if cat not in list(xdf.columns): print("categorical variable '%s' not found in data-frame" % cat) print(type(xdf), np.shape(xdf), list(xdf.columns)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_embedding_with_GO_labels(emb_df, GO_df):\n # get df with gene_symbols and entrez_ids from fetal data (more updated than adult probes data)\n all_genes = pd.read_csv(\n './data/raw/allen_human_fetal_brain/lmd_matrix_12566/rows_metadata.csv')\n all_genes = all_genes[~((all_genes.gene_symbol...
[ "0.6400779", "0.6345317", "0.62504804", "0.597661", "0.597618", "0.5893672", "0.572294", "0.5589565", "0.5566792", "0.55638057", "0.5531943", "0.55166507", "0.5506987", "0.54938644", "0.5469158", "0.5465086", "0.5449006", "0.54186934", "0.5407519", "0.53993475", "0.53437436",...
0.72372425
0
testing of function make_online with correct argument
def test_make_online(self): result = make_online() result[TIMESTAMP] = ONLINE_MESSAGE[TIMESTAMP] = time() self.assertEqual( result, ONLINE_MESSAGE )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_online_user(self):\n user = ONLINE_USER_MESSAGE[USER][ACCOUNT_NAME] = 'test_user'\n result = make_online(user)\n result[TIMESTAMP] = ONLINE_USER_MESSAGE[TIMESTAMP] = time()\n self.assertEqual(\n result,\n ONLINE_USER_MESSAGE\n )", "def main(c...
[ "0.6249515", "0.6093671", "0.6006748", "0.5951042", "0.5749661", "0.57442766", "0.56675875", "0.5587153", "0.5534772", "0.5519367", "0.5478681", "0.5477068", "0.5473699", "0.5455411", "0.54403347", "0.5435848", "0.5395726", "0.5386697", "0.53622717", "0.53490657", "0.5346795"...
0.66927665
0
testing of function make_online with correct argument
def test_make_online_user(self): user = ONLINE_USER_MESSAGE[USER][ACCOUNT_NAME] = 'test_user' result = make_online(user) result[TIMESTAMP] = ONLINE_USER_MESSAGE[TIMESTAMP] = time() self.assertEqual( result, ONLINE_USER_MESSAGE )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_online(self):\n result = make_online()\n result[TIMESTAMP] = ONLINE_MESSAGE[TIMESTAMP] = time()\n self.assertEqual(\n result,\n ONLINE_MESSAGE\n )", "def main(cls, args):\n #cls.trainOfflineAndTest(100, 0.1, 0.1, 0.9);\n #cls.trainOffl...
[ "0.66927665", "0.6093671", "0.6006748", "0.5951042", "0.5749661", "0.57442766", "0.56675875", "0.5587153", "0.5534772", "0.5519367", "0.5478681", "0.5477068", "0.5473699", "0.5455411", "0.54403347", "0.5435848", "0.5395726", "0.5386697", "0.53622717", "0.53490657", "0.5346795...
0.6249515
1
testing of function parse_server_answer with correct server response
def test_parse_correct_response(self): self.assertEqual( parse_server_answer(CORRECT_SERVER_RESPONSE), f'Correct message with response {CORRECT_SERVER_RESPONSE[RESPONSE]}.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_error_response(self):\n self.assertEqual(\n parse_server_answer(ERROR_SERVER_RESPONSE),\n f'Bad response. {ERROR_SERVER_RESPONSE[RESPONSE]}: {ERROR_SERVER_RESPONSE[ERROR]}'\n )", "def parse_answers(dns_resp: str, session_cache):\n\n ID = dns_resp[:4]\n ...
[ "0.71027803", "0.68225515", "0.67396283", "0.65409917", "0.64080316", "0.6298752", "0.6276201", "0.61536896", "0.6146969", "0.6084816", "0.6081799", "0.60398775", "0.60260403", "0.6015025", "0.5992051", "0.5968211", "0.5950601", "0.5905069", "0.59044486", "0.5880312", "0.5877...
0.81946546
0
testing of function parse_server_answer with bad server response
def test_parse_error_response(self): self.assertEqual( parse_server_answer(ERROR_SERVER_RESPONSE), f'Bad response. {ERROR_SERVER_RESPONSE[RESPONSE]}: {ERROR_SERVER_RESPONSE[ERROR]}' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_correct_response(self):\n self.assertEqual(\n parse_server_answer(CORRECT_SERVER_RESPONSE),\n f'Correct message with response {CORRECT_SERVER_RESPONSE[RESPONSE]}.'\n )", "def test_no_response(self):\n self.assertRaises(ValueError, parse_server_answer, {ER...
[ "0.7744831", "0.7513745", "0.6934748", "0.686131", "0.66853863", "0.66710067", "0.6507183", "0.6505322", "0.6453928", "0.636741", "0.6334803", "0.62309074", "0.62296325", "0.6221713", "0.61059445", "0.60909003", "0.6077677", "0.60462874", "0.60227174", "0.6010703", "0.6005763...
0.77763504
0
Performs a batch normalization using a standard set of parameters.
def batch_norm(inputs, training, data_format): # We set fused=True for a significant performance boost. See # https://www.tensorflow.org/performance/performance_guide#common_fused_ops return tf.compat.v1.layers.batch_normalization( inputs=inputs, axis=1 if data_format == 'channels_first' else 3, momen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BatchNorm(inputs, axis=None, training=None, momentum=0.9, epsilon=1e-5,\n center=True, scale=True,\n beta_initializer=tf.zeros_initializer(),\n gamma_initializer=tf.ones_initializer(),\n virtual_batch_size=None,\n internal_update=False):\n # p...
[ "0.7167361", "0.716663", "0.7145933", "0.7134978", "0.7020653", "0.69280756", "0.6903305", "0.685302", "0.67983943", "0.6775208", "0.66941243", "0.6657582", "0.6633872", "0.66320014", "0.66212356", "0.66197515", "0.65735346", "0.65624297", "0.65225774", "0.65209365", "0.65090...
0.72095215
0
Creates variables in fp32, then casts to fp16 if necessary. This function is a custom getter. A custom getter is a function with the same signature as tf.get_variable, except it has an additional getter parameter. Custom getters can be passed as the `custom_getter` parameter of tf.variable_scope. Then, tf.get_variable ...
def _custom_dtype_getter(self, getter, name, shape=None, dtype=DEFAULT_DTYPE, *args, **kwargs): if dtype in CASTABLE_TYPES: var = getter(name, shape, tf.float32, *args, **kwargs) return tf.cast(var, dtype=dtype, name=name + '_cast') else: return getter(name, shape, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def float32_variable_storage_getter(getter, name, shape=None, dtype=None,\n initializer=None, regularizer=None,\n trainable=True,\n *args, **kwargs):\n storage_dtype = tf.float32 if trainable else dtype\n ...
[ "0.77795357", "0.67645115", "0.6704484", "0.61997455", "0.60959065", "0.5969402", "0.5952168", "0.59272265", "0.5917217", "0.5720231", "0.5573573", "0.5573573", "0.5479989", "0.5459602", "0.54420453", "0.5352729", "0.5308366", "0.5292199", "0.52698094", "0.5214639", "0.519207...
0.67778546
1
to avoid SEGMENTATION FAULT all channels have to be read one by one we set the OnOff option (this option turns reading of a channel on or off) of all channels 0 if we want to read the channel we set its OnOff option to 1 this means reading is on and we read the data after we read the channel's data we must set it again...
def read_channel(self, channel): #print "Debug: self.__channels=", self.__channels, " channel=", channel self.__HDR.CHANNEL[self.__channels.index(channel)].OnOff = 1 channeldata = np.array(biosig.sread(0, self.__HDR.NRec, self.__HDR), dtype=np.float32)[0] self.__HDR.CHANNEL[self.__channe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_channel(self, channel: int, /) -> int:", "def read_channel(self, ch):\n ...", "def whenReadReady(self, channel, call):", "def read(self):\n try:\n if self.Data.Sync.IsWritten == 1:\n\n if self._IsPauseOn:\n self.Data.Sync.IsPauseOn = 1\n else:\n self.Da...
[ "0.58827406", "0.5841438", "0.5752362", "0.5576231", "0.53425467", "0.531012", "0.5267475", "0.523191", "0.52085525", "0.5190345", "0.51874185", "0.51675636", "0.5142323", "0.5142323", "0.5123407", "0.51188236", "0.51149994", "0.5082218", "0.5076131", "0.5060171", "0.5055593"...
0.6303099
0
EEG channels are referred to the appropriate reference channels It is assumed that A1 and A2 are part of the array It modifies the EEG 'in loco'
def refere(eeg, channels, mode='contralateral'): bipolar_map = {'Fp1':'Fp2', 'Fp2':'Fp2', 'F3':'F4', 'F4':'F4', 'C3':'C4', 'C4':'C4', 'T3':'T4', 'T4':'T4', 'P3':'P4', 'P4':'P4', 'O1':'O2', 'O2':'O2'} if mode not in ['monopolar', 'contralateral', 'bipolar', 'linked', 'average']: print 'WARNING - refere(): parameter ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_E(self):\n self.grid.E[:, 0, :, :] = self.grid.E[:, -1, :, :]", "def perform_reference(self):\n # Phase 1: Estimate the true signal mean with robust referencing\n self.robust_reference()\n if self.noisy_channels[\"bad_all\"]:\n self.raw.info[\"bads\"] = self.nois...
[ "0.56077194", "0.55833554", "0.55775464", "0.5515363", "0.54784274", "0.5470411", "0.5413172", "0.5399085", "0.5356846", "0.53333366", "0.5304155", "0.52972686", "0.52964044", "0.5245992", "0.52317023", "0.5231654", "0.5214368", "0.51860654", "0.5149571", "0.5135669", "0.5127...
0.6903563
0
Updates last seen and first seen. For each facility updates the date the facility was seen for the first and last time in the power data from FacilityScada.
def update_facility_seen_range( include_first_seen: bool = False, facility_codes: Optional[List[str]] = None, ) -> bool: engine = get_database_engine() __query = get_update_seen_query( include_first_seen=include_first_seen, facility_codes=facility_codes ) with engine.connect() as c: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_festival_details(self):\n self.compute_festivals()\n self.assign_relative_festivals()", "def update_compdatabase():\n for comp_group in comp_entry:\n#\n#--- read the last set of the input data and find the last entry \n#\n past = house_keeping + comp_group + '_past'\n past = mcf...
[ "0.5477236", "0.5152016", "0.5073851", "0.5032395", "0.5026013", "0.4864736", "0.48624355", "0.47804135", "0.47704548", "0.47518787", "0.4724072", "0.47172934", "0.46917036", "0.46788046", "0.46659482", "0.46556455", "0.46533918", "0.46443164", "0.46332926", "0.4620579", "0.4...
0.5604477
0
Gets the date range that a facility or list of facilities was seen in SCADA data.
def get_facility_seen_range(facility_codes: List[str]) -> FacilitySeenRange: __query = """ select min(data_first_seen) as first_seen, max(data_last_seen) as last_seen from facility where code in ({facilities}); """ engine = get_database_engine() result =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_daterange(df: pd.DataFrame):\n\n start_date = df[\"Date\"].iloc[0]\n end_date = df[\"Date\"].iloc[-1]\n return pd.date_range(start_date, end_date)", "def get_dates(self, candidates=None, start=None, end=None):\n if candidates is not None:\n return [date for date in candidat...
[ "0.62155634", "0.60260904", "0.58345526", "0.58315015", "0.5821613", "0.57750225", "0.5764604", "0.57625425", "0.5730578", "0.57040226", "0.5683034", "0.56598204", "0.5653136", "0.56222206", "0.5516752", "0.5472473", "0.54721445", "0.54418457", "0.5435447", "0.54257625", "0.5...
0.6488634
0
Creates a validation MovingMNIST dataset instance.
def __init__(self, data_dir, input_shape=[10, 64, 64, 1], target_shape=[10, 64, 64, 1], as_binary=False, num_digits=2, step_length=0.1): dataset_size = 10000 super(MovingMNISTValidDataset, self).__init__('validation', data_dir, dataset_size, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_train_validation(self) -> Tuple:\n Xt, Xv, Yt, Yv = self.dataset.train_test_split_representations()\n\n Xt = self.dataset.prepare_input_samples(Xt)\n Yt = self.dataset.prepare_output_samples(Yt)\n traindataset = tf.data.Dataset.from_tensor_slices((Xt, Yt))\n traindata...
[ "0.6790396", "0.67129046", "0.65671706", "0.6393787", "0.63566005", "0.6320849", "0.6304905", "0.62316006", "0.6220769", "0.61278504", "0.6099028", "0.6086233", "0.60855454", "0.60790193", "0.6060219", "0.6055652", "0.6052161", "0.60517865", "0.60407495", "0.6000092", "0.5981...
0.7284154
0
Creates a test MovingMNIST dataset instance.
def __init__(self, data_dir, input_seq_length=10, target_seq_length=10, as_binary=False): assert input_seq_length + target_seq_length <= 20, "The maximum total test sequence length is 20." try: filepath = light.utils.data.download(MNIST_TEST_URL, data_dir) print("Loading...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_train_test(self):\n x, y = self.read_data()\n x_train, y_train, x_test, y_test = self.sample_data(x, y)\n self.train = (x_train, y_train)\n self.test = (x_test, y_test)", "def get_dataset(self):\n\n trainset = datasets.MNIST('datasets/MNIST/train/', train=True, tra...
[ "0.67388034", "0.67050445", "0.66743994", "0.6599547", "0.64778316", "0.6456361", "0.64452213", "0.64404994", "0.63616824", "0.6343167", "0.6331357", "0.6299366", "0.62834305", "0.62828934", "0.6252377", "0.6223736", "0.6223349", "0.61917585", "0.61911905", "0.6191154", "0.61...
0.6780217
0
When updating, requiring that our serializers provide a whitelist of fields that can be updated. This is a safety check that avoids implementation errors where users can update fields that should only be set on create.
def update(self, instance, validated_data): assert hasattr(self.Meta, 'allowed_update_fields'), "Serializers that are used for update must set Meta.allowed_update_fields" if set(validated_data.keys()) - set(self.Meta.allowed_update_fields): raise serializers.ValidationError('Only updates on ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_allowed_fields(self) -> list:\n raise NotImplementedError('Each model has to have its list of update allowed fields')", "def _changeable_fields(self, request, obj):\n return not obj or not self.is_readonly(request, obj)", "def set_fields_to_required(serializer, ignore_fields=None):\n ...
[ "0.7125442", "0.654473", "0.6320682", "0.6251664", "0.62492245", "0.6166347", "0.6012889", "0.59869313", "0.5956164", "0.5950814", "0.59427387", "0.5930638", "0.5926418", "0.591129", "0.58880526", "0.58807003", "0.5850049", "0.5836533", "0.5835901", "0.5828417", "0.580011", ...
0.7777543
0
Handle result of API request (check for errors)
def handle_rest_api_result(result): if (result.status_code < 200) or (result.status_code > 299): try: json_result = result.json() except ValueError: raise VMRayRESTAPIError("API returned error {}: {}".format(result.status_code, result.text), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def handle_request(self, api_endpoint, api_version):\n code = 400\n data = self.get_post_data()\n request_method = self.request.method.lower()\n if data:\n try:\n # will call process_get or process_post methods for the given API\n res = awa...
[ "0.6975162", "0.6934104", "0.68876845", "0.688625", "0.6752605", "0.64950764", "0.6492422", "0.64658105", "0.6404618", "0.639939", "0.6385337", "0.6340955", "0.63087237", "0.6304817", "0.6266785", "0.6254952", "0.6250543", "0.6239361", "0.62239707", "0.62077194", "0.6206313",...
0.73409283
0
Keep unique spans for a given set of labels, sort by offset.
def keep_spans(cls, labels: Set[str], spans: Iterator[Span]) -> List[Span]: spans = filter(lambda sp: sp.label in labels, spans) spans = cls.dedupe_sort_spans(spans) return spans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deduplicate_spans(spans, options):\n make_key = lambda s: (s.start, s.end, s.type)\n span_map = defaultdict(list)\n deduped = []\n for span in spans:\n key = make_key(span)\n if key not in span_map:\n deduped.append(span)\n else:\n span_map[key][0].serials...
[ "0.6250191", "0.6012954", "0.5968908", "0.5865955", "0.58189", "0.56110775", "0.5548297", "0.5415131", "0.5404233", "0.5378522", "0.5359723", "0.5317473", "0.52795595", "0.5249259", "0.5195729", "0.5185027", "0.51814306", "0.5177846", "0.513521", "0.5127265", "0.51246077", ...
0.69826853
0
Get the offset of given node in the persistent node list.
def offset(self, gid: uuid.UUID) -> int: if gid not in self._nodes: raise error.Unexpected(f'Unknown node ({gid})') return self._nodes.index(gid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_loc(node):\n lineno = node.lineno\n end_lineno = get_last_deep_child(node).lineno\n return end_lineno - lineno", "def offset(self):\n self._fetch_if_needed()\n return self._offset", "def get_offset(self, index):\n if self.is_leaf():\n raise TerminalNodeExce...
[ "0.68004084", "0.65329796", "0.6408912", "0.6342138", "0.6327608", "0.63189834", "0.62651724", "0.6132692", "0.60975766", "0.60833603", "0.5992376", "0.5968507", "0.5968507", "0.59601027", "0.5952394", "0.5952394", "0.5952394", "0.5952394", "0.5952394", "0.5952394", "0.595239...
0.65611494
1
Dump an anonymous state to the repository returning its associated state ID. Caller is expected to send that state ID under given offset to the commit.
def dump(self, state: bytes) -> uuid.UUID: LOGGER.debug('Dumping state (%d bytes)', len(state)) return self._generation.lineage.dump(state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity(state: State) -> State:\n return state", "def print_state(id=None):\n data = storage.all(\"State\")\n return render_template('9-states.html', states=data, id=id)", "def state_id(self):\n return self._state_id", "def encode(self, state):\n raise NotImplementedError", "def...
[ "0.5553407", "0.48137328", "0.47365114", "0.47342572", "0.46649075", "0.46237245", "0.46026978", "0.4585692", "0.45796996", "0.45669395", "0.45469636", "0.4546829", "0.4535795", "0.4500465", "0.44665658", "0.4465815", "0.44588962", "0.44375637", "0.44328704", "0.4422744", "0....
0.59591514
0
Create new generation by committing its previously dumped states.
def commit(self, states: typing.Sequence[uuid.UUID]) -> None: LOGGER.debug('Committing %d states %s', len(states), states) assert len(states) == len(self._nodes), 'Committed number of states not matching the number of nodes' tag = self._tag or self._generation.tag self._generation = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self):\n assert self.notify.debugStateCall(self)\n self.__generates += 1", "def _save_or_verify_genesis(self) -> None:\n self._saving_genesis = True\n for tx in self._get_genesis_from_settings():\n try:\n assert tx.hash is not None\n ...
[ "0.59538585", "0.59332055", "0.5877261", "0.5862113", "0.57761747", "0.57378453", "0.57035667", "0.55409336", "0.5515694", "0.5501347", "0.54420894", "0.53969944", "0.5377506", "0.53653455", "0.5281298", "0.5253785", "0.52414644", "0.52156043", "0.52156043", "0.5210557", "0.5...
0.6050363
0
Get the project descriptor.
def project(self) -> 'product.Descriptor': return self._generation.lineage.artifact.descriptor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_project_info(self):\n return self.project_info", "def get_project(self):\n raise NotImplementedError(\"get_project is not implemented\")", "def getProject(self):\r\n return self.project", "def getProject(self):\n return self.project", "def getProject(self):\n\t\treturn s...
[ "0.72200954", "0.70092", "0.7004616", "0.68830794", "0.68686247", "0.68252265", "0.68252265", "0.68252265", "0.68252265", "0.68252265", "0.6618406", "0.65090597", "0.6499051", "0.6433703", "0.6421512", "0.6365812", "0.6364148", "0.6344005", "0.632407", "0.6312874", "0.6309599...
0.81857723
0
Get the generation tag.
def tag(self) -> 'genmod.Tag': return self._generation.tag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(self) -> 'Tag':\n # project/lineage must exist so let's fetch it outside of try-except\n project = self.project.key\n lineage = self.lineage.key\n try:\n generation = self.key\n except self.Listing.Empty: # generation doesn't exist\n LOGGER.debug('N...
[ "0.74924135", "0.74547446", "0.73257107", "0.7243974", "0.72214085", "0.71282554", "0.7028689", "0.69710064", "0.693406", "0.6907184", "0.6898204", "0.6834385", "0.67030144", "0.6640901", "0.6636779", "0.66010255", "0.6569893", "0.6555144", "0.64549255", "0.6412309", "0.63904...
0.81843007
0
Shuffles elements of multidimension tensor
def flat_shuffle(tensor): shape_ = tensor.size() flat_tensor = tensor.view(-1) shuffled_flat_tensor = shuffle(flat_tensor) return shuffled_flat_tensor.view(shape_)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shuffle_T(self):\n np.random.shuffle(self.T)", "def shuffle_row_elements(self, input):\r\n perm = self.permutation(size=input.shape[:-1], n=input.shape[-1],\r\n ndim=input.ndim - 1)\r\n shuffled = tensor.permute_row_elements(input, perm)\r\n shuffled...
[ "0.7309106", "0.6806892", "0.6788213", "0.67745066", "0.6771726", "0.66746175", "0.6542027", "0.6542027", "0.6540676", "0.65253913", "0.65142095", "0.65056294", "0.64869946", "0.6485036", "0.6480416", "0.6458194", "0.64237475", "0.64115065", "0.6407255", "0.63564575", "0.6328...
0.6935824
1
Shuffles pixels of image in the input tensor
def randomize_pixels(image): shape_ = image.size() image_flat = image.view(-1, image.size(-1)) shuffled_image = shuffle(image_flat) return shuffled_image.view(shape_)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _shuffle(inputs):\n\texpand_inputs = tf.stack(inputs, axis = -1)\n\tshuffled_inputs = tf.random_shuffle(expand_inputs)\n\treturn tf.unstack(shuffled_inputs)", "def forward(self, x):\n y = pixel_shuffle_1d(x, 2)\n return y", "def shuffle(self, inp: Tensor):\n _seed = self._seed() if cal...
[ "0.6777409", "0.66029817", "0.6602644", "0.6443697", "0.637937", "0.63601214", "0.62744284", "0.62664455", "0.6246581", "0.622342", "0.622342", "0.6207586", "0.6201639", "0.6180555", "0.6167928", "0.61082953", "0.6089713", "0.608279", "0.6080444", "0.60663784", "0.60601026", ...
0.6936197
0
Returns randomly generated labels for the given size from a uniform distribution
def random_labels(size, num_classes): return torch.randint(high=num_classes, size=(size,)).int().tolist()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_labels(n_samples):\n return np.ones([n_samples, 1]), np.zeros([n_samples, 1])", "def random_distribution():\n b = np.random.uniform(0.0, 1.0, size=[1, vocabulary_size])\n return b/np.sum(b, 1)[:,None]", "def random_distribution():\n b = np.random.uniform(0.0, 1.0, size=[1, vocabulary_s...
[ "0.6580449", "0.65053487", "0.65053487", "0.6503882", "0.6443101", "0.6244101", "0.6177878", "0.61726415", "0.6172131", "0.6170364", "0.6138876", "0.6106311", "0.61043096", "0.60395336", "0.6037983", "0.6029687", "0.6013082", "0.5988835", "0.5983106", "0.59804505", "0.5974894...
0.8075038
0
Shuffle weights of each prunable layer of the given network
def layerwise_weights_shuffling(net, make_copy=False): if make_copy: net = copy.deepcopy(net) for layer in get_fc_and_conv_layers(net): layer.weight.data = flat_shuffle(layer.weight.data) return net
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shuffle_weights(model, layers_to_shuffle, weights=None):\n\n if weights is None:\n weights = model.get_weights()\n random_weights = [np.random.permutation(w.flat).reshape(w.shape) for w in weights]\n\n if layers_to_shuffle >= 0:\n starting_layer = max(0, len(weights) - layers_to_shuffle ...
[ "0.68023413", "0.6646624", "0.6499157", "0.6447338", "0.6447338", "0.63196486", "0.63196486", "0.6194885", "0.61296767", "0.5955703", "0.5940395", "0.5900345", "0.584684", "0.58378494", "0.58256423", "0.5804631", "0.5798327", "0.57854253", "0.5773006", "0.5772566", "0.5767550...
0.72175926
0
This function will check if an order can be filled or not In this beta state, the function will assume an order will be filled if ,in case of sell order, its price is lower than the lowest offer on the market or if, in case of buy order, its price is higher than the highest offer on the market
def isFilled(self,orderID=None,order=None): if order is None: order=self[orderID] bestOffer=order.Account.Market.OrderBook[self.invertSide(order.Side)][0][0] result=((order.Side is 'sell') is (bestOffer > order.Price)) and (bestOffer is not order.Price) # if order.Side is 'sell': # if order.Price < bestOff...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_order(self, order, account, quotation, strategy_name):\n if quotation.volume < order.volume:\n print('Limit volume bardata volume:%d, untraded volume:%d, date:%s' % \n (quotation.volume, order.volume, quotation.date))\n return False\n\n # Calculate...
[ "0.7357059", "0.6728988", "0.6728981", "0.6701201", "0.6677344", "0.65897167", "0.65158206", "0.65084743", "0.64370495", "0.6363127", "0.6358141", "0.6355383", "0.6253955", "0.6240501", "0.62034833", "0.61836", "0.6182705", "0.6104264", "0.61003804", "0.60491794", "0.60464466...
0.7727941
0
Given an inputted CSV of tweets, performs some form of analysis on each tweet and saves the results in a new CSV
def perform_analysis_tagging(input_file, output_file, analysis_func, fields): stem_df = pd.read_csv(input_file, encoding='utf8') # Initialize Dataframe fields for field in fields: stem_df[field] = 0.0 # Iterate over all tweets in dataset for index, row in stem_df.iterrows(): # Clea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_twitter_sentiment():\r\n # Open/create a file to append data to\r\n csvFile = open(NAME+'_posts.csv', 'a')\r\n # Use csv writer\r\n csvWriter = csv.writer(csvFile)\r\n # Calling the user function with current parameters\r\n results = twitter.user_timeline(id=NAME, count=TWEET_COUNT)\r...
[ "0.7069002", "0.6418679", "0.6361843", "0.63130236", "0.630494", "0.6295054", "0.61697996", "0.6163136", "0.61518574", "0.6130951", "0.61137855", "0.61045843", "0.60007435", "0.59792066", "0.5949912", "0.5928418", "0.58983314", "0.5883879", "0.5868763", "0.5839455", "0.581486...
0.695028
1
Test that model processors are called after model parsing.
def test_model_processor(): global model_processor_called model_str = 'first 34 45 7 A 45 65 B true C "dfdf"' metamodel = metamodel_from_str(grammar) metamodel.register_model_processor(model_processor) metamodel.model_from_str(model_str) assert model_processor_called
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_processor(model, metamodel):\n global model_processor_called\n model_processor_called = True\n\n assert model.__class__.__name__ == \"First\"\n assert model.seconds[0].sec == 34", "def test_object_processors():\n\n call_order = []\n\n def first_obj_processor(first):\n first._fi...
[ "0.69331294", "0.6457609", "0.64200866", "0.6315689", "0.6147524", "0.6095154", "0.59263504", "0.5918173", "0.5904633", "0.5885374", "0.5885374", "0.5885374", "0.5885374", "0.5885374", "0.5860867", "0.58242303", "0.58239895", "0.58221054", "0.58188677", "0.5815784", "0.580170...
0.7804699
0
Model processor is called when the model is successfully parsed.
def model_processor(model, metamodel): global model_processor_called model_processor_called = True assert model.__class__.__name__ == "First" assert model.seconds[0].sec == 34
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_model(self, resources, resource, model, context):\n pass", "def _process(self):\n # choose the correct transform model before processing TI data\n self._select_transform()\n\n # process type first, fail early\n self._process_type()\n\n # process type specific...
[ "0.65688", "0.63776433", "0.637714", "0.635354", "0.6220839", "0.60930437", "0.5959912", "0.59485006", "0.58742857", "0.58576053", "0.5837201", "0.5827857", "0.58191234", "0.5793125", "0.5787602", "0.5784828", "0.5756922", "0.57457495", "0.57457495", "0.57457495", "0.5725118"...
0.6614259
0
Test that object processors are called. They should be called after each model object construction.
def test_object_processors(): call_order = [] def first_obj_processor(first): first._first_called = True call_order.append(1) def second_obj_processor(second): second._second_called = True call_order.append(2) # test that parent is fully initialised. # b s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_model_processor():\n global model_processor_called\n\n model_str = 'first 34 45 7 A 45 65 B true C \"dfdf\"'\n\n metamodel = metamodel_from_str(grammar)\n metamodel.register_model_processor(model_processor)\n\n metamodel.model_from_str(model_str)\n\n assert model_processor_called", "de...
[ "0.6713581", "0.64733946", "0.646127", "0.62811416", "0.62811416", "0.62811416", "0.62811416", "0.62811416", "0.62811416", "0.62755656", "0.6200319", "0.6167333", "0.6138092", "0.60986006", "0.59432703", "0.5935734", "0.5918071", "0.5904279", "0.5888507", "0.58763725", "0.587...
0.76121753
0
Return preprocessor with the given `uuid`.
def get(self, uuid: str) -> Preprocessor: return self.preprocessors[uuid]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_single_preprocessor(instance_id=None, **kw):\n pass", "def _uuid(self, flake8_out_line, mark_configuration):\n try:\n name = mark_configuration[self._pull_mark_config_name_from_output(flake8_out_line)]['name']\n if mark_configuration[self._pull_mark_config_name_from_output...
[ "0.60202396", "0.5412559", "0.5392581", "0.5249477", "0.52443844", "0.52032804", "0.51735055", "0.50917506", "0.506679", "0.5032582", "0.5028385", "0.5000068", "0.49829835", "0.4972561", "0.49583882", "0.4928904", "0.49260965", "0.49057886", "0.48960727", "0.48863015", "0.485...
0.7631133
0
write assembly code that is equivalent to the given arithmetic command
def write_arithmetic(self, command): if command == "add": self.add_command() elif command == "sub": self.sub_command() elif command == "neg": self.neg_command() elif command == "eq": self.eq_command() self.__label_num += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_arithmetic(self, command):\n\n # translate step ... dictionary?\n asm_code = ArithmeticCode.CONVERSION[command]\n # import pdb;pdb.set_trace()\n for line in asm_code:\n if \"{}\" in line:\n line = line.format(self.if_count)\n self.write_lin...
[ "0.73756063", "0.7190951", "0.707181", "0.70599", "0.68903583", "0.6833717", "0.6673311", "0.65424466", "0.64443076", "0.642345", "0.6278017", "0.62553453", "0.62083554", "0.6177724", "0.6109861", "0.6091645", "0.5982182", "0.59812915", "0.5967861", "0.5905259", "0.58647126",...
0.7265438
1
write assembly code that is equivalent to a neg command
def neg_command(self): self.write("D=0\n@SP\nA=M-1\nM=D-M\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neg(self, a):\n return -a", "def neg(a):\n return -a;", "def _negation_op(spec, expression):", "def __neg_not(self, VMInstruction):\r\n self.__writer.write(\"@SP\\n\")\r\n self.__writer.write(\"A=M-1\\n\")\r\n self.__writer.write(\"M=\" + str(self.__compVal(VMInstruction)) ...
[ "0.7162952", "0.70352393", "0.7016951", "0.6997215", "0.69652283", "0.6777753", "0.67633545", "0.6739379", "0.6692993", "0.66767746", "0.6561116", "0.6556568", "0.64680374", "0.6423781", "0.6403467", "0.63743263", "0.6370405", "0.63646376", "0.63605976", "0.63500667", "0.6310...
0.7038525
1
write assembly code that is the translation of the eq comparision command
def eq_command(self): self.write("@SP\nAM=M-1\nD=M\n@SP\nA=M-1\nD=M-D\n@CONDITION" + str( self.__label_num) + "\n" + "D;" + "JEQ" + "\n@SP\nA=M-1\nM=0\n@CONTINUE" + str( self.__label_num) + "\n0;JMP\n(CONDITION" + str( self.__l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_eq(self) -> str:\n return dedent(\n f\"\"\"\n // SP--\n @SP\n M=M-1\n // D = *SP\n A=M\n D=M\n // SP--\n @SP\n M=M-1\n // D = *SP - D <--> x - y\n A=M\n ...
[ "0.6860005", "0.6289654", "0.6119149", "0.59565526", "0.5796169", "0.57572776", "0.57494247", "0.5719687", "0.5700323", "0.5665349", "0.5647673", "0.55576175", "0.5529847", "0.5516811", "0.55067307", "0.5419522", "0.5409479", "0.5406383", "0.53606516", "0.53494084", "0.530503...
0.7351112
0
write assembly code that is equivalent to a not command
def not_command(self): self.write("@SP\nA=M-1\nM=!M\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_logical_not(g, op, block):\n\n ipt0 = g.get_node(op.input(\"X\")[0])\n op_func = get_relay_op(op.type)\n out = op_func(ipt0)\n g.add_node(op.output(\"Out\")[0], out)", "def cnot(control: QubitInput, target: QubitInput) -> Instruction:\n return Instruction(CNot(), target=[control, t...
[ "0.66493523", "0.6593717", "0.6486524", "0.64619446", "0.64617926", "0.6432362", "0.6401464", "0.6384364", "0.63174164", "0.62793076", "0.6246202", "0.6245462", "0.6079184", "0.6044361", "0.6041668", "0.5969389", "0.5930885", "0.5930885", "0.5930885", "0.5930885", "0.5930885"...
0.65989786
1
write assembly code that is equivalent to a given command, where command is either C_PUSH or C_POP
def write_push_pop(self, command, segment, index): if command == "C_PUSH": self.push_command(segment, int(index)) elif command == "C_POP": self.pop_command(segment, int(index))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_pushpop(self, command):\n commands = command.split(',')\n command_type = commands[0]\n vir_mem = commands[1]\n offset = commands[2]\n file_name = commands[3]\n vm_assembly_map = {Parser.LOCAL: \"LCL\", Parser.ARGUMENT: \"ARG\", Parser.THIS: \"THIS\", Parser.THAT:...
[ "0.74983513", "0.68097603", "0.6742777", "0.67312294", "0.65509003", "0.65460354", "0.63997203", "0.6321414", "0.604531", "0.6033847", "0.59744114", "0.57800025", "0.5714855", "0.56857353", "0.55900335", "0.5519227", "0.5485792", "0.5465166", "0.5462236", "0.5415918", "0.5391...
0.7025888
1
write the assembly code that is the translation of "push constant index" command
def push_constant_segment(self, index): self.write("@" + str(index) + "\nD=A\n@SP\nA=M\nM=D\n@SP\nM=M+1\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_push_pop(self, command, segment, index):\n\n seg_code, asm_code = PushPopCodes.CONVERSION[command][segment] # [compute_index]\n if any([segment == global_ for global_ in ('static', 'constant', 'temp', 'pointer')]):\n seg_code = GlobalSegment.converter(segment, index)\n ...
[ "0.6833397", "0.681452", "0.6536564", "0.63715947", "0.61211187", "0.60832393", "0.604436", "0.602004", "0.5951853", "0.59020954", "0.58357835", "0.57214075", "0.57206744", "0.57083803", "0.5695066", "0.56140524", "0.5599235", "0.55587035", "0.5517527", "0.54877394", "0.54534...
0.6892253
0