query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns search results of the query obtained in request args. It Returns four seperate variables containing results for artists, music, albums and records.
def search(): if not request.vars.search_term: redirect(URL('index')) term = request.vars.search_term origterm = term term = term.replace(' ','|') artists = db.executesql("select distinct(m1.id), m1.art_name, m1.artist_type, m1.country, m1.b_year,m1.b_month,m1.b_date,m1.e_year,m1.e_month,m1.e_day,ts_rank(to_tsve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_artists():\n return query_multiple(request.args, artist_search, \\\n artist_filter, Artist, artists_schema)", "def get(self):\n mb = MusicbrainzClient()\n query = self.get_argument('q')\n artists, tracks = yield [mb.search_artists(query),\n ...
[ "0.6995513", "0.6946495", "0.69276816", "0.6712662", "0.66553944", "0.6650486", "0.66414595", "0.66204256", "0.66038275", "0.65670973", "0.65214497", "0.65137446", "0.64969873", "0.6442194", "0.6438711", "0.6370827", "0.6355204", "0.6339323", "0.6334207", "0.63236696", "0.631...
0.73612744
0
This action is responsible for obtaining and returning all the information related to a particular release group item.
def album(): if not request.vars.id: redirect(URL('index')) id = request.vars.id releasegroupname = db.executesql("select m1.name, m2.id from release_name as m1, release_group as m2 where m1.id = m2.name and m2.id = "+id+";") releasegroup = db.executesql("select distinct(m2.id),m3.name,m5.name,m7.track_count,m2.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_item(group):\n print(\"\\tName: {}\".format(group.name))\n print(\"\\tId: {}\".format(group.id))\n print(\"\\tLocation: {}\".format(group.location))\n print(\"\\tTags: {}\".format(group.tags))\n if hasattr(group, 'properties'):\n print_properties(group.properties)", "def print_ite...
[ "0.58416325", "0.5816238", "0.58002716", "0.54882723", "0.54080135", "0.52620345", "0.51343477", "0.5105051", "0.503373", "0.5021229", "0.50112814", "0.4995143", "0.49764192", "0.4962052", "0.49419135", "0.492932", "0.49121702", "0.49007878", "0.48873103", "0.48685712", "0.48...
0.4758959
33
This action is reponsible for displaying the displaying the tracklist of a particular release
def release(): if not request.vars.id: redirect(URL('index')) id = request.vars.id releasename = db.executesql("select m1.name from release_name as m1, release as m2 where m1.id = m2.name and m2.id = "+id+";") tracklist = db.executesql("select m4.id, m5.name, m4.position, m4.length from release m1,medium m2,track...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_release_details(release):\n def get(key, dictionary=release):\n try:\n return dictionary[key]\n except KeyError as e:\n return None\n\n date = get('date')\n date = date[:4] if date else \"\"\n print(\"{} / {} ({})\".format(get('artist-credit-phrase'), get('t...
[ "0.6434879", "0.5879494", "0.57307416", "0.563012", "0.5614375", "0.55647445", "0.55647445", "0.5560884", "0.5560467", "0.5530062", "0.54957026", "0.5479897", "0.5445508", "0.5431248", "0.5370204", "0.5301003", "0.52960336", "0.52862537", "0.5273142", "0.526875", "0.52551377"...
0.586884
2
This action is reponsible for displaying all the information related to an artist
def artist(): if not request.vars.id: redirect(URL('index')) id = request.vars.id artistname = db.executesql("select m1.name from artist_name as m1, artist as m2 where m1.id = m2.name and m2.id = "+id+";") urls = db.executesql("select distinct(m2.url) from l_artist_url m1, url m2 where m2.id = m1.entity1 and m1.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def artists():\n # TODO: replace with real data returned from querying the database (DONE)\n artists = Artist.query.group_by(Artist.id, Artist.name).all()\n\n data = []\n\n for a in artists :\n data.append({\n 'id' : a.id,\n 'name' : a.name\n })\n\n return render_...
[ "0.7046416", "0.6953733", "0.6649395", "0.66083264", "0.657852", "0.65465295", "0.6491085", "0.64804745", "0.64677274", "0.64607227", "0.64456445", "0.6401886", "0.63846064", "0.6378521", "0.6368321", "0.6331579", "0.6211678", "0.62032557", "0.6153709", "0.61417043", "0.61027...
0.78098094
0
allows downloading of uploaded files
def download(): return response.download(request, db)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_files(self):", "def post_download(self, remote_files):\n pass", "def download_file(self, parsed_event, input_dir_path):", "def download(self,fn):\n\t\treturn False #TODO: implement meme download", "def download(self):\n pass", "def download(self):\n pass", "def pre_dow...
[ "0.7924571", "0.7199257", "0.6978304", "0.6841495", "0.6764734", "0.6764734", "0.66671187", "0.6631285", "0.6588692", "0.6555494", "0.65398693", "0.65012735", "0.6458808", "0.6451737", "0.64442515", "0.6402176", "0.63864595", "0.63758063", "0.63659835", "0.6345104", "0.633138...
0.0
-1
Assemble a uri based on a base, any number of path segments, and query string parameters.
def urljoin(base, *path, **query): if base and base.endswith('/'): base = base[:-1] retval = [base] # build the path path = '/'.join([''] + [quote(s, '') for s in path]) if path: retval.append(path) # build the query string params = [] for name, value in query.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_uri(self, uri_base, params):\n if not params:\n return uri_base\n else:\n uri_extension = \"?\"\n for param in params:\n uri_extension = uri_extension + param + \"&\"\n uri_extension = uri_extension[:-1] # clip off the final & \n ...
[ "0.8172769", "0.7679958", "0.7513473", "0.6879448", "0.68683076", "0.6697143", "0.6584741", "0.64706886", "0.64205086", "0.63630056", "0.63141865", "0.6287929", "0.62767005", "0.6271733", "0.62544346", "0.62226605", "0.62067354", "0.6118589", "0.609388", "0.6077103", "0.60672...
0.6343084
10
Add a listener to be invoked whenever ``for_listeners(name)`` is called.
def add_listener(self, name, callback: Callable[..., Any], filter_fn=None, optional=False) -> 'CallbackDisconnector': if not callable(callback): raise ValueError('callback must be callable') name = self._normalize_name(name) record = self._records.get(name) if record is None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_listener(self, listener):\r\n self.listeners.append(listener)", "def add_listener(self, listener):\n self.listeners.append(listener)", "def AddListener(self, listener):\n pass", "def add_listener(self, listener):\n self._listeners.append(listener)", "def add_message_listen...
[ "0.75564337", "0.74877083", "0.7243794", "0.72170144", "0.718768", "0.707675", "0.6893153", "0.68294317", "0.67576826", "0.6747247", "0.6540557", "0.6404089", "0.6355143", "0.62774986", "0.6263101", "0.6199482", "0.61959505", "0.61842805", "0.6172105", "0.61708695", "0.614587...
0.67746115
8
Returns a proxy callback that takes parameters that are passed to each callback as is. Any return values are gathered and returned as a list of Future in the same order as the original callbacks.
def for_listeners(self, name) -> Callable[..., List['CallbackRecord']]: try: hash(name) except TypeError: LOG.error('Tried to use %s as a key for looking up event handlers.', name) raise name = self._normalize_name(name) cb = self._records.get(name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self):\n results = []\n \n for callback in self.callback:\n results.append(callback(*self.args))\n \n return results", "def execute(self):\n results = []\n\n for callNumber in xrange(len(self.callback)):\n results.append( (self.ca...
[ "0.75090116", "0.7237878", "0.69892627", "0.6575861", "0.65059805", "0.6466124", "0.6276305", "0.6188024", "0.60304135", "0.60152036", "0.59994966", "0.5934425", "0.5891724", "0.58878666", "0.5830869", "0.5813392", "0.57927155", "0.57908887", "0.57848376", "0.5717209", "0.571...
0.0
-1
Actually invoke the underlying function (but only if it hasn't been invoked already).
def start(self) -> None: cb = self._callback if cb is not None: self._callback = None propagate(from_=ensure_future(cb()), to=self._future)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(self):\n self.call() # Call a function", "def __call__(self, *arg, **kwargs):\n return self._fun(*arg, **kwargs)", "def __call__(self, *args, **kwargs):\n if Numba.numba_flag:\n return self.numba_fn(*args, **kwargs)\n else:\n return self.function(*arg...
[ "0.645682", "0.6429473", "0.64159334", "0.639884", "0.6388811", "0.63531023", "0.63465124", "0.63283324", "0.6302384", "0.62790745", "0.6166103", "0.6166103", "0.61579746", "0.6139069", "0.6121427", "0.61082965", "0.61067134", "0.61054397", "0.60570645", "0.605564", "0.604391...
0.0
-1
Convert the allowable callback signatures to a function that
def _normalize_callback_implementation(callback: Callable[..., Any]) -> Callable[..., Future]: if not callable(callback): raise ValueError('callback must be callable') @wraps(callback) def invoke_sync(*args, **kwargs) -> Future: loop = asyncio.get_event_loop() try: resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_function_callbacks(self):\n res = \"\"\n for node in self.description.definitions():\n if isinstance(node.type.get_type(), pdl.TypeFunction):\n frags={\n \"name\": node.name,\n \"nameupper\": self.python_madz_deftypes + \"___\" ...
[ "0.64135003", "0.63697374", "0.5881934", "0.58109105", "0.57914805", "0.57761544", "0.5667346", "0.5652006", "0.559458", "0.55765367", "0.557005", "0.5563907", "0.55628437", "0.54764694", "0.54760617", "0.5406841", "0.5405066", "0.5390303", "0.53657085", "0.5351603", "0.53044...
0.53438926
20
Remove an existing callback from the list of callbacks that will be invoked whenever this record is called.
def remove(self, callback) -> bool: for i, tracker in enumerate(self.trackers): if tracker.original_callback == callback: del self.trackers[i] return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_callback(self, callback):\n if callback in self._callbacks:\n self._callbacks.remove(callback)", "def remove_callback(self, callback):\n if callback in self._async_callbacks:\n self._async_callbacks.remove(callback)", "def unregister(self, callback):\n\t\tcallback...
[ "0.81763077", "0.8000942", "0.7855995", "0.76857203", "0.7678713", "0.7539317", "0.747451", "0.74458057", "0.74337065", "0.73114634", "0.7176973", "0.7165153", "0.7162398", "0.7117453", "0.7117453", "0.71164805", "0.7048038", "0.7043623", "0.7039069", "0.6980838", "0.6967926"...
0.7058943
16
Extract consecutive ners from the result of CoreNLPNERTagger
def merge_ners(tokens): ners = list() merged_tokens = list() candid_entity = list() keep = False prev_tag = 'O' for i, (token, tag) in enumerate(tokens): if keep: if tag not in IGNORE_NER_TAG: candid_entity.append(token) keep = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_ngrams(self, sequence):\n sequence = self.prefix + sequence + self.suffix\n for i, event in enumerate(sequence[self.n:], self.n):\n yield event, sequence[i-self.n: i]", "def extract_nps(text, annotation):\n np_starts = [i for i in range(len(annotation)) if annotation[i] ==...
[ "0.5992052", "0.58803827", "0.57412916", "0.57153046", "0.56501865", "0.56453776", "0.55940616", "0.5551463", "0.54952145", "0.5488924", "0.54851663", "0.54851663", "0.54396814", "0.53640854", "0.5351113", "0.5312324", "0.5291228", "0.52684474", "0.52250415", "0.5201601", "0....
0.59793997
1
Load freebase entity dictionary from saved dict
def load_freebase_entity(path="../data/freebase/dict.txt"): logger.info('Loading freebase entity dictionary...') name2id = dict() id2name = dict() with open(path, 'r', buffering=1024 * 1024 * 100) as f: for line in f: tokens = line.split('\t') _name = tokens[0].strip() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dikt) -> 'GnbrEntity':\n return util.deserialize_model(dikt, cls)", "def load_dict(self, dct):\n pass", "def load(self):\n\n args = self.id, self.name\n self.loader.session.logger.debug(\"loading CDR%d (%r)\", *args)\n cursor = self.loader.dicti...
[ "0.64202756", "0.6255847", "0.62532294", "0.61488426", "0.59458196", "0.59139955", "0.58941555", "0.5862503", "0.58609146", "0.5860008", "0.5859102", "0.5848029", "0.5788074", "0.57809716", "0.5733735", "0.5718896", "0.5706553", "0.5698764", "0.5692765", "0.56742126", "0.5661...
0.7637444
0
Return position of ner in list of tokens
def get_nerpos(tokens, ner): loc = list() for i, token in enumerate(tokens): if token == ner: loc.append(i) return loc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nerspos(tokens, ners):\n pos_list = list()\n for ner in ners:\n pos = get_nerpos(tokens, ner)\n pos_list.append(pos)\n\n return pos_list", "def get_head_pos( head, ngram ):\n try:\n tokens = ngram.split( ' ' )\n return str([ i for i, t in enumerate( tokens ) if t.s...
[ "0.68481386", "0.64260495", "0.6337191", "0.6327533", "0.6311592", "0.63036317", "0.62495536", "0.62290925", "0.6140072", "0.6086388", "0.5966749", "0.59169406", "0.59167016", "0.590555", "0.5892167", "0.58879244", "0.58879244", "0.58879244", "0.58823013", "0.58707553", "0.58...
0.81861734
0
Return positions of ners in list of tokens
def get_nerspos(tokens, ners): pos_list = list() for ner in ners: pos = get_nerpos(tokens, ner) pos_list.append(pos) return pos_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nerpos(tokens, ner):\n\n loc = list()\n for i, token in enumerate(tokens):\n if token == ner:\n loc.append(i)\n return loc", "def get_positions(token, docs):\n\n all_matches = [token]\n for doc in docs:\n matches = []\n if token in doc:\n indexes ...
[ "0.8392064", "0.69574887", "0.6598042", "0.6516395", "0.6503853", "0.63557386", "0.6345", "0.6334957", "0.63280684", "0.62971956", "0.6194977", "0.61768335", "0.61675954", "0.61302745", "0.6104622", "0.60178024", "0.60013366", "0.5981349", "0.5938564", "0.59180295", "0.591576...
0.78989506
1
Create the specified path on the filesystem like the `mkdir p` command Creates one or more filesystem directory levels as needed, and does not return an error if the directory already exists.
def mkdir_p(path): # http://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python try: os.makedirs(path) except OSError as exc: # Python >2.5 if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mkdir(path):\n\tif not Path(path).exists():\n\t\tPath(path).mkdir(parents=True, exist_ok=True)", "def mkdir_p(path):\n\n if os.path.exists(path):\n return\n\n par = os.path.split(path)[0]\n if os.path.exists(par):\n os.mkdir(path)\n getLogger(__name__).debug('created directory: ...
[ "0.8252548", "0.8147374", "0.813743", "0.8125734", "0.8122502", "0.8044979", "0.8040932", "0.80242634", "0.79902554", "0.79894096", "0.79894096", "0.79894096", "0.79894096", "0.7985319", "0.79825383", "0.7970779", "0.79506147", "0.79506147", "0.79506147", "0.79506147", "0.794...
0.78200287
40
Returns true if arg is a list or another Python Sequence, and false otherwise.
def is_sequence(arg): return (not hasattr(arg, "strip") and hasattr(arg, "__getitem__") or hasattr(arg, "__iter__"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_list(arg):\n return isinstance(arg, collections.Sequence) and not _is_string(arg)", "def is_sequence(arg):\n\n # np.float{16,32,64} and np.int types have __getitem__ defined\n # this is a long-standing bug in NumPy and unlikely to be fixed\n # todo: backport to qmmlpack, write tests\n if i...
[ "0.842769", "0.7965603", "0.7516044", "0.7451877", "0.7329391", "0.73040754", "0.72747916", "0.7107596", "0.70028114", "0.69910914", "0.69853663", "0.6981128", "0.69492453", "0.6949044", "0.6924374", "0.68378544", "0.681947", "0.67969847", "0.67924744", "0.6788219", "0.675699...
0.79118264
2
Internal function to configure which subset of the datasets is being used. Helps to choose a reasonable default action based on previous user parameters.
def _update_dataset_param(self, dataset): if dataset is None and self.dataset is None: return [] if dataset is 'all': dataset = '' if dataset is None and self.dataset is not None: dataset = self.dataset return dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset(options):\n pass", "def set_default_parameters(self):\n super().set_default_parameters()\n if not \"n_sub_images\" in vars(self):\n self.n_sub_images = -1 # do all-sub-images", "def set_data_subset(self, subset):\n self.data_subset = subset", "def selected_datas...
[ "0.6140803", "0.5858651", "0.58069193", "0.57882154", "0.57795227", "0.5742967", "0.5709668", "0.56961155", "0.56382173", "0.56296766", "0.56248546", "0.56127524", "0.55776656", "0.5573759", "0.55507874", "0.5547382", "0.5512426", "0.5499787", "0.54964566", "0.54803866", "0.5...
0.57147396
6
Get a appropriate OTP for the current Vault version under test.
def get_generate_root_otp(): if vault_version_ge("1.10.0"): test_otp = "BMjzW3wAsEzINXCM05Wbas3u9zSl" elif vault_version_ge("1.0.0"): test_otp = "ygs0vL8GIxu0AjRVEmJ5jLCVq8" else: test_otp = "RSMGkAqBH5WnVLrDTbZ+UQ==" return test_otp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def otp_generate(request):\n phone = request.GET.get('phone', None)\n otp = UserAuth(phone).generate_otp()\n return Response(\n {\n 'success': True,\n 'phone': phone,\n 'otp': otp\n }\n )", "def generate_otp(email):\n\tprint \"generate_otp\"\n\totp_key =...
[ "0.58393794", "0.5716151", "0.56288546", "0.56154954", "0.55863196", "0.55287445", "0.5509557", "0.542242", "0.53520805", "0.5223635", "0.52086926", "0.5172018", "0.5132177", "0.50504476", "0.5044505", "0.50082654", "0.50049675", "0.4994672", "0.49763277", "0.49655774", "0.49...
0.79360807
0
Small helper method used to discover an open port to use by mock API HTTP servers.
def get_free_port(): s = socket.socket(socket.AF_INET, type=socket.SOCK_STREAM) s.bind(("localhost", 0)) address, port = s.getsockname() s.close() return port
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_unused_port() -> None:\n available_port = get_unused_port()\n with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:\n sock.bind((\"\", available_port))\n assert int(sock.getsockname()[1]) == available_port", "def get_open_port():\n sock = socket.socket(socket.AF_INET...
[ "0.71796995", "0.706297", "0.70570284", "0.7037272", "0.69158477", "0.69090056", "0.6884879", "0.6799318", "0.6780961", "0.6749321", "0.67204267", "0.6717844", "0.67094326", "0.6703785", "0.6686551", "0.665296", "0.664464", "0.6629048", "0.6572091", "0.65138483", "0.6497322",...
0.62442183
43
Load test config file data for use by various test cases.
def load_config_file(filename): test_data_path = get_config_file_path(filename) with open(test_data_path) as f: test_data = f.read() return test_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_test_data(self):\n self._save_test_data()", "def test_load_from_file(self):\n cf = ConfigFile()\n cf.load_from_file(TestConfigFile.TEST_CONFIG)\n\n self.assertEqual(4, len(cf))\n self.assertEqual(cf[\"key1\"], \"val1\")\n self.assertEqual(cf[\"key2\"], \"val2\"...
[ "0.7346483", "0.7241617", "0.7041901", "0.7021762", "0.69928503", "0.69685555", "0.6907617", "0.68597746", "0.68017393", "0.6799866", "0.67664844", "0.6723095", "0.6710996", "0.6676708", "0.66698784", "0.66493666", "0.6597196", "0.6592818", "0.6589089", "0.65828204", "0.65756...
0.7834851
0
Get the path to a config file under the "tests/config_files" directory. I.e., the directory containing selfsigned certificates, configuration files, etc. that are used for various tests.
def get_config_file_path(filename): # Use __file__ to derive a path relative to this module's location which points to the tests data directory. relative_path = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "config_files" ) return os.path.join(os.path.abspath(relative_path), f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_path():\n\n root = os.path.dirname(os.path.abspath(__file__))[:-5]\n config_path = os.path.join(root, 'config.ini')\n\n return config_path", "def get_config_path(config):\n section = config.sections()[0]\n return Path(config.get(section, \"path\")).expanduser().absolute()", "def g...
[ "0.80562377", "0.8025532", "0.7936335", "0.7636513", "0.759419", "0.75863504", "0.7586312", "0.74758565", "0.7409882", "0.7362901", "0.7351157", "0.73110783", "0.725994", "0.725583", "0.71291775", "0.70951337", "0.7093658", "0.7087657", "0.708164", "0.7075927", "0.70503074", ...
0.8256649
0
Decode a newly generated root token via Vault CLI.
def decode_generated_root_token(encoded_token, otp): command = ["vault"] if vault_version_ge("0.9.6"): # before Vault ~0.9.6, the generate-root command was the first positional argument # afterwards, it was moved under the "operator" category command.append("operator") command.exten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meraki_vault_r_secret(mount, path):\n read_secret_result = client.secrets.kv.v1.read_secret(path=meraki_vault_path, mount_point=vault_mount_point)\n api_token = read_secret_result['data']['token']\n return api_token", "def vault_auth():\n # Check if vault is sealed\n if client.sys.is_sealed() ...
[ "0.59399545", "0.5710058", "0.56865376", "0.5683078", "0.5500785", "0.5490273", "0.5472639", "0.5260887", "0.5217738", "0.521536", "0.5193939", "0.5115839", "0.51024985", "0.5093198", "0.50621367", "0.5052655", "0.5043405", "0.5037708", "0.503704", "0.49572414", "0.49545163",...
0.75455594
0
Helper method to add `encoding='utf8'` to subprocess.Popen.
def get_popen_kwargs(**popen_kwargs): popen_kwargs["encoding"] = "utf-8" return popen_kwargs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_terminal_encoding(encoding='utf_8'):\n sys.stdin = codecs.getreader(encoding)(sys.stdin)\n sys.stdout = codecs.getwriter(encoding)(sys.stdout)\n sys.stderr = codecs.getwriter(encoding)(sys.stderr)", "def defaultProcessOutputEncodingDecider(context, executable, **forfutureuse):\n\treturn __DEFAUL...
[ "0.64557153", "0.6064261", "0.5924003", "0.58920264", "0.5797352", "0.57451856", "0.5647091", "0.5566803", "0.5552143", "0.54971397", "0.5480613", "0.5451589", "0.5397502", "0.53734374", "0.5352288", "0.5268057", "0.5194355", "0.51533914", "0.5115416", "0.5112865", "0.5074088...
0.6455326
1
Helper method to perform base64 encoding
def base64ify(bytes_or_str): if isinstance(bytes_or_str, str): input_bytes = bytes_or_str.encode("utf8") else: input_bytes = bytes_or_str output_bytes = base64.urlsafe_b64encode(input_bytes) return output_bytes.decode("ascii")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base64_encode(data):\n return base64.encodestring(data);", "def my_base64encode(s):\n return base64.b64encode(s).decode(\"utf-8\")", "def base64_string(self) -> global___Expression:", "def _encode_base64(data: str) -> str:\n ebytes = base64.b64encode(data.encode(\"utf-8\"))\n estring = str(eb...
[ "0.8336032", "0.8287229", "0.8229982", "0.82246256", "0.79071426", "0.7830374", "0.77805984", "0.7689982", "0.7669789", "0.7659945", "0.7618254", "0.76087964", "0.75895584", "0.7491684", "0.7423716", "0.73868006", "0.7357054", "0.73041403", "0.7277756", "0.7277756", "0.724756...
0.7250471
20
Helper function to configure a pki backend for integration tests that need to work with lease IDs.
def configure_pki( client, common_name="hvac.com", role_name="my-role", mount_point="pki" ): if f"{mount_point}/" in client.sys.list_mounted_secrets_engines(): client.sys.disable_secrets_engine(mount_point) client.sys.enable_secrets_engine(backend_type="pki", path=mount_point) client.write( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_global_backends(pytest_config):\n backend_settings = {}\n\n backends = [\"http\", \"mqtt\"]\n for b in backends:\n # similar logic to above - use ini, then cmdline if present\n ini_opt = pytest_config.getini(\"tavern-{}-backend\".format(b))\n cli_opt = pytest_config.getoptio...
[ "0.5777911", "0.5647634", "0.5610944", "0.5572502", "0.55506784", "0.5415104", "0.5322861", "0.53125286", "0.5294264", "0.52423364", "0.52252173", "0.5218377", "0.5196795", "0.51509863", "0.5147188", "0.51185846", "0.5118058", "0.5037185", "0.50200725", "0.5019633", "0.500976...
0.50279945
18
Disable a previously configured pki backend.
def disable_pki(client, mount_point="pki"): client.sys.disable_secrets_engine(mount_point)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_auth_backend():\n\n headers = {\"X-Vault-Token\": args.x_vault_token}\n url = \"{0}/sys/auth/{1}\".format(args.vault_url, args.k8s_cluster_name)\n print 'Disabling auth backend for cluster {0}'.format(args.k8s_cluster_name)\n send_delete(url=url, headers=headers)", "def disable():\n req...
[ "0.66995364", "0.61998165", "0.6093094", "0.5812049", "0.57911944", "0.5744036", "0.5727666", "0.5665002", "0.5649514", "0.5604349", "0.5598673", "0.55670303", "0.55586666", "0.5540842", "0.5500927", "0.5498942", "0.5472412", "0.5471941", "0.5409242", "0.54068637", "0.5401836...
0.61382073
2
remove the sqlalchemy sesh
def tear(exc): storage.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove():\n\n db_remove()", "def tearDown(self):\n #db.session.remove()\n db.drop_all()", "def teardown_db():\n engine = config['tg.app_globals'].sa_engine\n connection = engine.connect()\n\n # INFO - D.A. - 2014-12-04\n # Recipe taken from bitbucket:\n # https://bitbucket.o...
[ "0.6853588", "0.6843821", "0.6779843", "0.67321277", "0.67321277", "0.6699622", "0.66935766", "0.66935766", "0.66935766", "0.66935766", "0.66935766", "0.66935766", "0.66935766", "0.668059", "0.6641767", "0.6641767", "0.6641767", "0.6641767", "0.6641767", "0.66150945", "0.6602...
0.0
-1
Input file_path, save model weights into a file of given format.
def save_weights(self, file_path, format=None): _save_weights(self, file_path, format)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, weights_file):\r\n \r\n self.model.save_weights(weights_file)", "def save_weights_file(self, file_path, file_name):\n\n # Join the path with the file name and append the extension (h5)\n path = join(file_path, \"{}.h5\".format(file_name))\n\n # Store the weights\...
[ "0.7974793", "0.79393816", "0.7818803", "0.76390755", "0.748463", "0.7457383", "0.7365727", "0.7359829", "0.7352166", "0.7283044", "0.7283044", "0.7068052", "0.7067362", "0.70322907", "0.7007359", "0.7005004", "0.7005004", "0.7005004", "0.69427085", "0.6855376", "0.68439704",...
0.8305987
0
Load model weights from a given file, which should be previously saved by self.save_weights().
def load_weights(self, file_path, format=None, in_order=True, skip=False): _load_weights(self, file_path, format, in_order, skip)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_weights(self, weight_file):\r\n self.model.load_weights(weight_file)", "def load_weights(self, file):\n self.model.load_weights(file)\n return", "def load_model_weights(self, filename):\n self.model.load_weights(filename)", "def load_weights(self, filepath):\n self...
[ "0.89469826", "0.8901181", "0.8853004", "0.8774798", "0.8556394", "0.8332117", "0.8260749", "0.8030833", "0.799898", "0.7895191", "0.78296417", "0.7825905", "0.77957875", "0.7748564", "0.7748564", "0.7705152", "0.7701626", "0.764279", "0.7554501", "0.7549377", "0.7390658", ...
0.75612944
18
Add a LayerNode for this layer given input_tensors, output_tensors.
def _add_node(self, input_tensors, output_tensors): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_layer(inputs, in_size, out_size, n_layer, activation_function=None, ):\r\n layer_name = \"layer%s\" % n_layer\r\n with tf.name_scope(layer_name):\r\n with tf.name_scope(\"Weights\"):\r\n Weights = tf.Variable(tf.random_normal([in_size, out_size]), name=\"W\")\r\n tf.summa...
[ "0.6593948", "0.6312318", "0.6243013", "0.62338334", "0.6224892", "0.5977068", "0.592607", "0.5898218", "0.58804685", "0.5858943", "0.58344376", "0.57562846", "0.5721505", "0.5678528", "0.56682277", "0.56655985", "0.5646037", "0.56409556", "0.56349766", "0.55707383", "0.55651...
0.7810959
0
Sets the cell to training mode. The cell itself and all children cells will be set to training mode.
def set_train(self): self._phase = 'train' self.add_flags_recursive(training=True) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_mode_train(self):\n self._set_mode('train')\n return self", "def training(self):\n self.training = True", "def train(self):\n self.training = True", "def train(self, mode: bool = True):\n if self.nn_module.training != mode:\n self.nn_module.train(mode)", ...
[ "0.6975608", "0.6717992", "0.67168665", "0.6564689", "0.6497327", "0.6497327", "0.6356984", "0.6347624", "0.62881464", "0.62857175", "0.6089425", "0.6061524", "0.6053733", "0.6053733", "0.60506725", "0.59250903", "0.591193", "0.5873809", "0.58694804", "0.5862343", "0.58432263...
0.61627144
10
Set this network in evaluation mode. After calling this method, all layers in network are in evaluation mode, in particular, BatchNorm, Dropout, etc. Examples >>> import tensorlayer as tl >>> net = tl.models.vgg16() >>> net.eval() do evaluation
def set_eval(self): self._phase = 'predict' self.add_flags_recursive(training=False) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_eval(self):\n\n if self.model.__dict__['training']:\n self.model.eval()", "def eval(self):\n self.train(mode=False)", "def set_eval(self, eval: bool):\n self.brain.set_eval(eval)", "def eval(self):\n self.mode = \"eval\"\n self.online_net.eval()", "def...
[ "0.78309643", "0.75001425", "0.74250203", "0.7406579", "0.7406579", "0.73397756", "0.7029367", "0.6851151", "0.67749524", "0.6703862", "0.6631509", "0.6591249", "0.6569461", "0.6422038", "0.637382", "0.6329969", "0.6329969", "0.63081795", "0.6305343", "0.6291049", "0.6288456"...
0.6941809
7
Set this network in evaluation mode.
def test(self): self.eval()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setEvaluationMode(self, newMode):\n \n pass", "def set_eval(self, eval: bool):\n self.brain.set_eval(eval)", "def _set_eval(self):\n\n if self.model.__dict__['training']:\n self.model.eval()", "def set_mode(self, mode):\n if mode == 'train':\n self.net...
[ "0.7694437", "0.7670649", "0.7342549", "0.7151897", "0.7103393", "0.7103393", "0.70450133", "0.70249236", "0.7009851", "0.7001831", "0.691162", "0.68425643", "0.66861284", "0.6543857", "0.6487741", "0.63806707", "0.6322034", "0.62210166", "0.60879964", "0.60867757", "0.607585...
0.0
-1
Set this network in evaluation mode.
def infer(self): self.eval()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setEvaluationMode(self, newMode):\n \n pass", "def set_eval(self, eval: bool):\n self.brain.set_eval(eval)", "def _set_eval(self):\n\n if self.model.__dict__['training']:\n self.model.eval()", "def set_mode(self, mode):\n if mode == 'train':\n self.net...
[ "0.7694437", "0.7670649", "0.7342549", "0.7151897", "0.7103393", "0.7103393", "0.70450133", "0.70249236", "0.7009851", "0.7001831", "0.691162", "0.68425643", "0.66861284", "0.6543857", "0.6487741", "0.63806707", "0.6322034", "0.62210166", "0.60879964", "0.60867757", "0.607585...
0.0
-1
Returns all trainable weights. Returns a list of all trainable parmeters.
def trainable_weights(self): self._trainable_weights = list(filter(lambda x: x.requires_grad, self.get_parameters(expand=True))) return self._trainable_weights
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weights_lst(self):\n assert self.sess is not None, \"Model has not been fitted yet!\"\n return self.sess.run(self.W_lst)", "def get_weights(self):\n return [self.W]", "def get_weights(self):\n return [self.W]", "def get_weights(self):\n return []", "def get_weights(se...
[ "0.7333756", "0.70962805", "0.70962805", "0.70862687", "0.7070256", "0.6915223", "0.68708634", "0.6868791", "0.6868791", "0.679045", "0.679045", "0.6756826", "0.6756826", "0.675156", "0.673351", "0.673351", "0.673351", "0.6731417", "0.6691864", "0.66902167", "0.668324", "0....
0.76837504
0
Returns all untrainable weights. Returns a list of all untrainable weights.
def nontrainable_weights(self): return list(filter(lambda x: not x.requires_grad, self.get_parameters(expand=True)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weights(self):\n return []", "def trainable_weights(self):\n self._trainable_weights = list(filter(lambda x: x.requires_grad, self.get_parameters(expand=True)))\n return self._trainable_weights", "def get_weights(self):\n return [self.W]", "def get_weights(self):\n ...
[ "0.7384943", "0.7170098", "0.70482403", "0.70482403", "0.6928857", "0.69194895", "0.69194895", "0.69194895", "0.6848169", "0.6782915", "0.6730147", "0.6730147", "0.6730147", "0.6663011", "0.6663011", "0.6640928", "0.6623843", "0.6623843", "0.6608877", "0.65747327", "0.6571032...
0.7795881
0
Indicate whether account registration is currently permitted, based on the value of the setting ``REGISTRATION_OPEN``. This
def registration_allowed(self, request): return getattr(settings, 'REGISTRATION_OPEN', True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registration_allowed(self):\n return getattr(settings, 'REGISTRATION_OPEN', True)", "def registration_allowed(self):\n return getattr(settings, 'REGISTRATION_OPEN', True)", "def is_registered(self):\n if self.user == getpass.getuser():\n return True\n else:\n ...
[ "0.8357122", "0.8357122", "0.65590364", "0.6422705", "0.63702977", "0.6330357", "0.61983466", "0.60988814", "0.60063547", "0.6001445", "0.6001445", "0.6001445", "0.5912449", "0.59091336", "0.59021175", "0.59021175", "0.59021175", "0.58721966", "0.5866057", "0.5802698", "0.579...
0.8022301
2
Return the default form class used for user registration.
def get_form_class(self, request): return RegistrationForm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_form_class(self, request):\n return RegistrationForm", "def get_form_class(self):\n return self.form_class", "def get_form_class(self):\n if self.form_class:\n return self.form_class\n else:\n raise ImproperlyConfigured(\n \"在定义类视图%s的时候,你...
[ "0.7956627", "0.770102", "0.74282926", "0.72233987", "0.71631217", "0.7097246", "0.7082445", "0.696311", "0.692484", "0.6767896", "0.67418265", "0.66456175", "0.66020036", "0.64767134", "0.64665145", "0.64210325", "0.63494134", "0.6314577", "0.62687373", "0.6240669", "0.62336...
0.8111784
0
Return the name of the URL to redirect to after successful user registration.
def post_registration_redirect(self, request, user): return ('registration_complete', (), {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_redirect_url(self):\n return reverse('accounts:home')", "def create_redirect_url(self):\n return url_for(self.create_redirect_to_view)", "def get_success_url(self):\n return reverse('account:details',\n kwargs={'username': self.request.user.username})", "def...
[ "0.73379296", "0.7324677", "0.69434536", "0.69189394", "0.6870109", "0.68566924", "0.67954004", "0.67184335", "0.67070496", "0.66305435", "0.66210127", "0.6547608", "0.65307903", "0.6493313", "0.64655125", "0.64655125", "0.64608943", "0.64608943", "0.64532584", "0.64532584", ...
0.66944695
9
Return the name of the URL to redirect to after successful account activation.
def post_activation_redirect(self, request, user): newMember = StaffMember.objects.filter(user_id__exact=user.pk).get() labGroup = LabGroup.objects.filter(pk=1).get() newMember.lab_group = labGroup newMember.save() return ('registration_activation_complete', (), {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_redirect_url(self):\n return reverse('accounts:home')", "def get_success_url(self):\n return reverse('account:details',\n kwargs={'username': self.request.user.username})", "def get_redirect_url(self):\n return reverse(\"accounts:profile\",kwargs={\"username\"...
[ "0.7594355", "0.74765575", "0.6963185", "0.695647", "0.694857", "0.69257337", "0.689037", "0.6835599", "0.6769089", "0.66786706", "0.66693467", "0.6649202", "0.6619501", "0.6595316", "0.6586077", "0.6558655", "0.65566254", "0.65478855", "0.65478855", "0.6544256", "0.6531706",...
0.0
-1
Add a new user location to the system
def add_location(location): # noqa: E501 if connexion.request.is_json: location = Location.from_dict(connexion.request.get_json()) # noqa: E501 db = PostgresDB() error = db.insert_new_location(location.location) if error: return jsonify(msg=error) return jsonify(msg='Human detected...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_location():\n\n if not g.user:\n flash(\"Please login to access\", \"danger\")\n return redirect(\"/\")\n \n if g.user.is_admin == False:\n flash (\"Unauthorized\", \"danger\")\n return redirect(\"/login\")\n \n form = Location_Form()\n\n if form.validate_on_su...
[ "0.67645496", "0.6588918", "0.6556488", "0.6494251", "0.6454458", "0.64176095", "0.6245872", "0.61988354", "0.61489385", "0.61150897", "0.60815144", "0.59883666", "0.59883666", "0.59883666", "0.59883666", "0.59883666", "0.59883666", "0.59883666", "0.59876204", "0.59050107", "...
0.62180394
7
Get a historic of locations
def get_historic_location(): # noqa: E501 db = PostgresDB() historial = db.get_locations() if "Error" in historial: return jsonify(msg=historial) if len(historial) > 0: data = {"historial" : []} for row in historial: data['historial'].append( { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def historic(self) -> dict:\n return await self._request(\n \"get\", \"https://www.asthmaforecast.com/api/forecast/historic/asthma\"\n )", "def get_historic_data(self):\n\n historic_market_events = []\n\n return historic_market_events", "def History(self):\n retu...
[ "0.64075005", "0.6306349", "0.61227405", "0.60741436", "0.5974619", "0.5956443", "0.59440225", "0.5868649", "0.58360744", "0.5833078", "0.5829477", "0.5814553", "0.5808685", "0.5795159", "0.5782138", "0.57627606", "0.5699749", "0.568246", "0.5676575", "0.5676575", "0.56725854...
0.77446115
0
Convert from keras to tf
def keras_to_tensorflow( keras_model, output_dir: Path, model_name, out_prefix="output_", log_tensorboard=True, ): if not output_dir.exists(): output_dir.mkdir(parents=True, exist_ok=True) output_dir: str = str(output_dir) out_nodes = [] for i in range(len(keras_model.outpu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(self, example):\n tf_example = _convert_to_tf_example(example, self.tokenizer, self.rules,\n self.config, self.max_sizes)\n return tf_example", "def convert_to_tf_record(_):\n\n mnist = input_data.read_data_sets(\n \"/tmp/tensorflow/mnist/input_d...
[ "0.6639992", "0.6630255", "0.6283206", "0.6280251", "0.6261455", "0.61814857", "0.61665124", "0.6141866", "0.6130877", "0.6106019", "0.60859215", "0.60848236", "0.6076101", "0.60558754", "0.60113984", "0.6006671", "0.59937596", "0.59848094", "0.5983833", "0.5973008", "0.59620...
0.67439127
0
Returns a new keras SqueezeNet model
def SqueezeNet(input_shape=(224, 224, 3)): image_input = Input(shape=input_shape) network = Conv2D(64, (3, 3), strides=(2, 2), padding="valid")(image_input) network = Activation("relu")(network) network = MaxPool2D(pool_size=(3, 3), strides=(2, 2))(network) network = squeezenet_fire_module( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_original_model():\n model = Sequential()\n model.add(Embedding(max_features,\n embedding_dims,\n input_length=maxlen))\n model.add(Dropout(0.2))\n model.add(Conv1D(filters,\n kernel_size,\n padding='valid',...
[ "0.6779109", "0.6638269", "0.66308945", "0.6543631", "0.65331703", "0.6512372", "0.65106356", "0.6495543", "0.64914733", "0.6490912", "0.6468552", "0.6449092", "0.64283264", "0.64260525", "0.64073676", "0.6404156", "0.64011025", "0.63759005", "0.6370142", "0.6355601", "0.6339...
0.66259646
3
Convert a model from keras to tensorflow lite.
def main(opt): weights_path: Path = Path("../weights") model_path = weights_path / opt.model_path if not model_path.exists(): raise ValueError(f"Invalid model path: {model_path}") print(f"Loading keras model: '{model_path}'") keras_model = SqueezeNet() keras_model.load_weights(model_pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gensim_to_keras(model):\n layer = model.wv.get_keras_embedding()\n return (layer)", "def convert_from_keras_model(\n model,\n output_dir='my-hls-test',\n project_name='myproject',\n input_data_tb=None,\n output_data_tb=None,\n backend='Vivado',\n hls_config=None,\n **kwargs,\n):...
[ "0.6945519", "0.69119895", "0.67486066", "0.6652685", "0.6608672", "0.66009986", "0.6539233", "0.65300494", "0.6507346", "0.6503937", "0.63850594", "0.6307801", "0.62692785", "0.6261237", "0.6259688", "0.62363434", "0.62114567", "0.62083393", "0.61811054", "0.6177432", "0.615...
0.0
-1
returns a,b where a <= b
def calcualte_ellipse_radii(guess, eccentricity = 0, perimeter = 2 * np.pi*1): return fsolve(ellipse_radii_test, guess, args = (eccentricity, perimeter))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_inclusive(a, b):\n c = int(b > a)*2-1\n return range(a, b+c, c)", "def in_range(x, a, b):\n return (x >= a and x <= b) or (x <= a and x >= b)", "def inrange ( a , x , b ) :\n _a = float(a)\n _b = float(b)\n _x = float(x)\n return ( _a <= _x or isequal ( _a , _x ) ) and ( _x <= ...
[ "0.7141207", "0.6981709", "0.6854545", "0.67296296", "0.658509", "0.64805", "0.641424", "0.6400484", "0.63955367", "0.6359278", "0.63141984", "0.6286686", "0.6239231", "0.62344867", "0.61758864", "0.61594373", "0.61306363", "0.6129907", "0.6094695", "0.6094206", "0.607342", ...
0.0
-1
The returned tuple should be zero
def ellipse_radii_test(radii, eccentricity = 0, perimeter = 2*np.pi*1): a,b = radii return (np.sqrt(np.absolute(1 - (b**2)/(a**2))) - eccentricity, # perimeter approximation from https://www.mathsisfun.com/geometry/ellipse-perimeter.html np.pi * (3 * (a + b) - np.sqrt(np.absolute((3 * a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self) -> tuple:", "def filtered_xyz(self) -> tuple[int, int, int]:", "def retrieve_data_tuple(self):\n return ((42,))", "def empty_tuple():\n empty = ()\n print(type(empty)) # <type 'tuple'>", "def calibration(self) -> tuple[int, int, int, int, int]:", "def answer(self):\n\n r...
[ "0.6652293", "0.6397256", "0.6196077", "0.6129998", "0.6127603", "0.6054833", "0.58035886", "0.5797779", "0.5754019", "0.574967", "0.57462484", "0.5733556", "0.57165074", "0.5707046", "0.5702668", "0.5702668", "0.56937104", "0.56858724", "0.56741434", "0.56697756", "0.5638495...
0.0
-1
Currently only works for ellipse centered on origin the points are drawn from the +ve x axis in the order of the quardrants
def get_points_on_ellipse(a, b, numPoints, startAngle = 0, verbose = False, increment = 0.01): def distance(x1,y1,x2,y2): return np.sqrt((x2-x1)**2 + (y2-y1)**2) x0 = a y0 = 0 angle = 0 d = 0 while(angle <= 360): x = a * np.cos(np.radians(angle)) y = b * np.sin(np.radians...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ellipse(self):\n f = self.img\n x = self.x\n y = self.y\n x2 = self.x2\n y2 = self.y2\n xy = self.xy\n self.a2 = (x2+y2) + sqrt(((x2-y2)/2.)**2 + xy**2)\n self.b2 = (x2+y2) - sqrt(((x2-y2)/2.)**2 + xy**2)\n self.a = sqrt(self.a2)\n self.b = sqrt(self....
[ "0.64417464", "0.6421503", "0.6344339", "0.6330868", "0.62400186", "0.6224325", "0.62029326", "0.616415", "0.610634", "0.60904914", "0.6083488", "0.6008982", "0.5992977", "0.59813225", "0.59795386", "0.59648114", "0.596078", "0.59202594", "0.5856401", "0.5848941", "0.5840281"...
0.61181104
8
this method is used in the scraper to return the last updated station. this lets us pull only updated data.
def last_updated(self): try: return max(self.station_usage, key=lambda x: x.last_update).dt_last_update except ValueError: return datetime.fromtimestamp(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n _LOGGER.debug(\"------- Updating AEMET sensor\")\n\n endpoint_url = \"{}{}\".format(\n self.API_URL_BASE,\n self.API_STATION_ENDPOINT.format(self._station_id)\n )\n params = {'api_key': self._api_k...
[ "0.6880449", "0.66213137", "0.65706927", "0.64415693", "0.6376864", "0.6356469", "0.63331", "0.6162094", "0.6155076", "0.6130627", "0.61070186", "0.6050127", "0.6050127", "0.60353684", "0.60135305", "0.598416", "0.5949982", "0.59141076", "0.587603", "0.5870146", "0.5856976", ...
0.6447243
3
as the method name suggests this returns the up to date station information.
def get_current_station_info(cls, dbsession): sub = dbsession.query(UsageData.station_id, func.max(UsageData.id).label('max_update')).group_by( UsageData.station_id).subquery() return dbsession.query( UsageData.last_update, UsageData.available_bike_stands, UsageData....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_station_boroughs(self):\\", "def show_info(self):\n\n print(\"Querying the station...\")\n val = getvalues(self.station, '', fixed_format)\n\n print('Fine Offset station settings:')\n print('%s: %s' % ('local time'.rjust(30),\n time.strftime('%Y.%m.%d ...
[ "0.66889495", "0.6452908", "0.62583035", "0.62394136", "0.619208", "0.6112521", "0.60889035", "0.6042705", "0.6017993", "0.5981389", "0.59698784", "0.5953793", "0.59492654", "0.591016", "0.59028894", "0.589664", "0.58665407", "0.5864966", "0.58616376", "0.5854664", "0.5849501...
0.71660936
0
return when was the last update. Once again this is used in the scraper to determine newly updated data.
def dt_last_update(self): return self.last_update
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_update(self):\n return self._last_update", "def last_update(self):\n return self._last_update", "def last_updated(self):\n return self._last_updated", "def updated_on(self):\n return self.get_time(\"updated_on\")", "def last_update_time(self):\n return self._last...
[ "0.8410479", "0.8410479", "0.8173209", "0.8136815", "0.8069375", "0.79213256", "0.7860239", "0.78425276", "0.77858883", "0.7742599", "0.7720309", "0.7720309", "0.76988846", "0.7695073", "0.76872325", "0.7657064", "0.7653909", "0.7651964", "0.7573087", "0.7570922", "0.7544852"...
0.8191779
2
creates a datetime object which is added to the database with an update from the dublinbikes api. once again used by the scraper. essentially the adds the time at which the update was entered.
def dt_last_update(self, val): self.last_update = datetime.fromtimestamp(int(val)/1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_update(self):\n date, time = self.data.get(\"update_date\"), self.data.get(\"update_time\")\n if date is not None and time is not None:\n return datetime.strptime(date + time, \"%d-%m-%Y%H:%M\").replace(\n tzinfo=VIENNA_TIME_ZONE\n )", "def test_save_2_...
[ "0.6314246", "0.6284306", "0.622363", "0.6131683", "0.6062952", "0.6007324", "0.59122413", "0.5867222", "0.58476716", "0.5812767", "0.5742817", "0.5728761", "0.5703045", "0.56967443", "0.56705844", "0.56597465", "0.5653817", "0.56500095", "0.56480604", "0.56480604", "0.564188...
0.5992166
6
returns a list of bikes for a provided weekday and station. averaged per hour so 24 results.
def get_bikes_for_weekday(cls, dbsession, weekday, station_id): station = [("Time", "Available Bikes", "Available Stands")] station_data = dbsession.query(func.hour(cls.last_update), func.avg(cls.available_bikes), func.avg(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bikes_for_week(cls, dbsession, station_id):\n station = [(\"Day\", \"Available Bikes\")]\n station_data = dbsession.query(func.weekday(cls.last_update),\n func.avg(cls.available_bikes)) \\\n .filter(cls.station_id == station_id) \\\n ...
[ "0.77892643", "0.71780616", "0.69516826", "0.67270637", "0.6636598", "0.6216508", "0.59292334", "0.56938154", "0.5609472", "0.554261", "0.55170375", "0.5512873", "0.546571", "0.53780615", "0.53184694", "0.5302574", "0.52739406", "0.52701545", "0.52644885", "0.5257001", "0.525...
0.84364945
0
as method name describes. similar to methods above but averaged over week.
def get_bikes_for_week(cls, dbsession, station_id): station = [("Day", "Available Bikes")] station_data = dbsession.query(func.weekday(cls.last_update), func.avg(cls.available_bikes)) \ .filter(cls.station_id == station_id) \ .group_by(func....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weekly():", "def averageTime(self):\n \n pass", "def forecast_weekly():\n forecast = get_forecast()\n daily = forecast.daily()\n return daily.summary", "def mean_by_airline_dow(flights):\n\n return ...", "def return_weekly_figure():\n today = datetime.datetime.now()\n\n whil...
[ "0.7532469", "0.6411122", "0.61803746", "0.6157488", "0.6108338", "0.60862935", "0.6068665", "0.5999342", "0.59047836", "0.5893497", "0.58837366", "0.58724874", "0.5833644", "0.5821823", "0.5818497", "0.5785093", "0.5764682", "0.5736772", "0.57038623", "0.5698677", "0.5676207...
0.0
-1
finds days where there was wet weather.
def findWetWeatherDays(self, dbsession, today): wetDays = dbsession.query(self.dt).filter(or_(self.weather_description == "light rain", self.weather_description == "moderate rain")).all() # if one of those days is today return it. # else just return a wet day. for i in range(len(wetDays)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_typical_days(weather_data, cfg):\n settings = cfg['settings']\n # Flag to determine if any holidays have been found:\n interpolation_freq = pd.Timedelta(settings['intervall'])\n flag_holidays_found = False\n\n # --- Season --------------------------------------------------------------\n #...
[ "0.6345522", "0.62267625", "0.620805", "0.6172952", "0.6154723", "0.6078286", "0.59555215", "0.5860357", "0.5847305", "0.5832294", "0.5819031", "0.5799269", "0.5799269", "0.57958776", "0.5793687", "0.57477695", "0.57152104", "0.570199", "0.57016325", "0.5699181", "0.5681354",...
0.7885582
0
Calling openChannel() with various wrong arguments
def test_open_channel_call(token_network: Contract, get_accounts: Callable) -> None: (A, B) = get_accounts(2) # Validation failure with the number zero instead of an address with pytest.raises(ValidationError): token_network.functions.openChannel(0x0, B) # Validation failure with the empty str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_open_via_channel(testchannel, callit):\n\n channel = testchannel.channel() if callit else testchannel.channel\n\n with channel as t:\n assert t.state == ChannelState.open\n\n assert testchannel.state == ChannelState.closed", "def channel_open(self):\n self._chan = self._session.in...
[ "0.66451424", "0.6250406", "0.6153946", "0.61513305", "0.61273223", "0.57756436", "0.5759044", "0.5668032", "0.5634415", "0.5631686", "0.5622906", "0.5616735", "0.5573923", "0.55352193", "0.5531159", "0.55040747", "0.5495176", "0.5488037", "0.54677826", "0.54428947", "0.54259...
0.5625717
10
For two participants, at most one channel can be opened
def test_max_1_channel( token_network: Contract, get_accounts: Callable, create_channel: Callable ) -> None: (A, B) = get_accounts(2) create_channel(A, B) with pytest.raises(TransactionFailed, match="TN/open: channel exists for participants"): token_network.functions.openChannel(A, B).call() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_channel():\n return True", "def have_channel_open(channels, user):\n for x in channels:\n chan = channels[x]\n if 'is_member' in chan:\n continue\n if \"user\" in chan and chan['user'] == user:\n return True\n return False", "def have_chann...
[ "0.68654567", "0.6490941", "0.6464989", "0.63985145", "0.6327629", "0.6311468", "0.6309975", "0.6291697", "0.6276977", "0.62615794", "0.6125024", "0.6120147", "0.60907483", "0.6057845", "0.6023134", "0.59909755", "0.5980023", "0.5967421", "0.5960192", "0.5923796", "0.59115165...
0.6518068
1
getParticipantsHash() behaves as get_participants_hash
def test_participants_hash(token_network: Contract, get_accounts: Callable) -> None: (A, B) = get_accounts(2) AB_hash = get_participants_hash(A, B) assert token_network.functions.getParticipantsHash(A, B).call() == AB_hash assert token_network.functions.getParticipantsHash(B, A).call() == AB_hash
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hash(self, composition):\n return", "def __hash__(self):\n return hash((self.member_role, self.member_type, self.member_email))", "def get_hash(self):\r\n return", "def get_hash(self):\n return freeze_dict(self.get_hash_params())", "def get_hash(self):\n return self._...
[ "0.63765395", "0.63318187", "0.6321352", "0.6252258", "0.6228718", "0.6136036", "0.613001", "0.61032784", "0.6090188", "0.60368407", "0.59734964", "0.5966896", "0.5864445", "0.58352035", "0.58331984", "0.5813834", "0.57882416", "0.57848483", "0.57782173", "0.5753588", "0.5749...
0.7115849
0
getParticipantsHash() behaves as get_participants_hash on equal addresses
def test_participants_hash_equal(token_network: Contract, get_accounts: Callable) -> None: (A,) = get_accounts(1) with pytest.raises(ValueError): get_participants_hash(A, A) with pytest.raises(TransactionFailed, match="TN: identical addresses"): token_network.functions.getParticipantsHash(A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_participants_hash(token_network: Contract, get_accounts: Callable) -> None:\n (A, B) = get_accounts(2)\n\n AB_hash = get_participants_hash(A, B)\n assert token_network.functions.getParticipantsHash(A, B).call() == AB_hash\n assert token_network.functions.getParticipantsHash(B, A).call() == AB_...
[ "0.70927805", "0.6258063", "0.6066081", "0.6022483", "0.59809077", "0.5974033", "0.5940762", "0.5915285", "0.5876238", "0.58748066", "0.5854341", "0.5794211", "0.57636255", "0.57451165", "0.57385176", "0.5730055", "0.5713905", "0.5703602", "0.5702778", "0.56973827", "0.569604...
0.6733924
1
Open three channels and observe states
def test_counter( token_network: Contract, get_accounts: Callable, create_channel: Callable ) -> None: (A, B, C, D) = get_accounts(4) AB_hash = token_network.functions.getParticipantsHash(A, B).call() BC_hash = token_network.functions.getParticipantsHash(B, C).call() CD_hash = token_network.functio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_switch_channels(self):\n\t\t# not available yet, experimental\n\t\tpass", "def setup_channels():\n\n # Setup channel encoders\n for c in channels:\n channels[c].setup()\n print()", "def setup(self, channels):\n self.channels = channels[:]", "def test_open_state(testchannel):\n...
[ "0.5793696", "0.5630462", "0.5624394", "0.5620674", "0.55608547", "0.5529064", "0.5342438", "0.5337173", "0.52379125", "0.51599574", "0.51407015", "0.5138206", "0.513631", "0.51333195", "0.51088315", "0.50961053", "0.508256", "0.50556326", "0.504091", "0.5036432", "0.5026253"...
0.0
-1
getChannelState() returns the empty channel state for onttoobig channelID
def test_state_channel_identifier_invalid( token_network: Contract, get_accounts: Callable, create_channel: Callable ) -> None: (A, B, C) = get_accounts(3) channel_id = 0 pairs = permutations([A, B, C], 2) for pair in pairs: state = token_network.functions.getChannelState(channel_id, *pair)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_none2(self, channel):\n pass", "def is_open(self, channel=None):\n return self.get_state(channel)", "def test_open_state(testchannel):\n\n with testchannel.open() as t:\n assert t.state == ChannelState.open\n\n assert testchannel.state == ChannelState.closed", "def __getsta...
[ "0.61654663", "0.5896519", "0.586283", "0.57887614", "0.55998313", "0.5566425", "0.55561423", "0.55363715", "0.550702", "0.5485005", "0.54813683", "0.5425511", "0.5421768", "0.5409737", "0.54013985", "0.5372156", "0.536304", "0.5345527", "0.53410935", "0.5324677", "0.53205526...
0.53508157
17
Observe the state of the channel after a openChannel() call
def test_open_channel_state(token_network: Contract, get_accounts: Callable) -> None: (A, B) = get_accounts(2) channel_counter = token_network.functions.channel_counter().call() participants_hash = token_network.functions.getParticipantsHash(A, B).call() assert ( token_network.functions.partic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel_connected(self):\n self.update_status()", "def channel(self):\n\n self._channel = self._connection.channel()\n print(\"Channel opened...\")", "def on_channel_open(self, channel):\n self.logger.info('Channel opened')\n self._channel = channel\n self.add_on_c...
[ "0.7205853", "0.71653926", "0.6919226", "0.69056886", "0.6886432", "0.6766391", "0.6646003", "0.6632794", "0.6582453", "0.6503419", "0.639545", "0.6375993", "0.63722664", "0.6370337", "0.6332137", "0.6310028", "0.6302871", "0.628356", "0.6197925", "0.61534774", "0.6099827", ...
0.0
-1
Open a second channel after settling one
def test_reopen_channel( token_network: Contract, get_accounts: Callable, create_close_signature_for_no_balance_proof: Callable, time_travel: Callable, get_block_timestamp: Callable, ) -> None: (A, B) = get_accounts(2) call_and_transact(token_network.functions.openChannel(A, B)) channel_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_channel(self):\n # LOGGER.info('Creating a new channel')\n self._connection.channel(on_open_callback=self.on_channel_task_open)\n self._connection.channel(on_open_callback=self.on_channel_ctrl_open)", "def channel_open(self):\n self._chan = self._session.invoke_shell()", "d...
[ "0.71482056", "0.71042883", "0.6652178", "0.6647473", "0.6591444", "0.6469845", "0.64180195", "0.6370166", "0.6346812", "0.63326895", "0.6309731", "0.6277799", "0.6268313", "0.61745846", "0.6156467", "0.61109924", "0.6065597", "0.6009683", "0.59848595", "0.597528", "0.5909403...
0.0
-1
A successful openChannel() causes an OPENED event
def test_open_channel_event( get_accounts: Callable, token_network: Contract, event_handler: Callable ) -> None: ev_handler = event_handler(token_network) (A, B) = get_accounts(2) txn_hash = call_and_transact(token_network.functions.openChannel(A, B)) channel_identifier = token_network.functions.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_channel_open(self, channel_id: str) -> None:\n self._send_alive(channel_id)", "def open_channel(self):\n # LOGGER.info('Creating a new channel')\n self._connection.channel(on_open_callback=self.on_channel_task_open)\n self._connection.channel(on_open_callback=self.on_channel_c...
[ "0.73577046", "0.7354011", "0.729137", "0.72610146", "0.7230036", "0.71792716", "0.717188", "0.71689665", "0.7120604", "0.7002149", "0.69875485", "0.6979207", "0.6953193", "0.6920781", "0.6873996", "0.68318856", "0.6830546", "0.68283147", "0.6792365", "0.67258024", "0.6709773...
0.6202603
33
Initializes the upper and lower pmos
def add_ptx(self): self.pmos = ptx(width=self.ptx_width, tx_type="pmos") self.add_mod(self.pmos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.upper = 230.0\n self.lower = 195.0", "def __init__(self, upper_left, lower_right):\n self.upper_left = upper_left\n self.lower_right = lower_right", "def __init__(self):\n\t\tself.upper, self.lower = 0,0\n\t\tself.timestamp = 0", "def __init__(self):\n ...
[ "0.6813188", "0.6626031", "0.63374364", "0.60283935", "0.60178435", "0.594762", "0.5900908", "0.57963645", "0.57945627", "0.5754933", "0.57467234", "0.5743787", "0.5730844", "0.5700219", "0.56684303", "0.5618184", "0.56096613", "0.56016254", "0.55860263", "0.55860263", "0.558...
0.0
-1
Adds a vdd rail at the top of the cell
def route_vdd_rail(self): # adds the rail across the width of the cell vdd_position = vector(0, self.height - self.m1_width) self.add_rect(layer="metal1", offset=vdd_position, width=self.width, height=self.m1_width) pmos_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_border(self):\n top = TopWallCell(self)\n left = SideWallCell(self, False)\n right = SideWallCell(self, True)\n for col in range(self._columns):\n self.cell_at(col, self._rows - 1, top)\n for row in range(self._rows):\n self.cell_at(0, row, left)\n ...
[ "0.5719361", "0.54055804", "0.5304635", "0.53003937", "0.52842367", "0.5275856", "0.5258827", "0.5232115", "0.51538235", "0.51155037", "0.50955796", "0.5081745", "0.506918", "0.5068402", "0.50647056", "0.50580543", "0.5054077", "0.50488394", "0.50478745", "0.49961856", "0.494...
0.6683286
0
Create both the upper_pmos and lower_pmos to the module
def create_ptx(self): self.lower_pmos_inst=self.add_inst(name="lower_pmos", mod=self.pmos) self.connect_inst(["bl", "en", "br", "vdd"]) self.upper_pmos1_inst=self.add_inst(name="upper_pmos1", mod=self.pmos) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_modules(self):\n self.nmos = ptx(width=self.nmos_size,\n mults=self.nmos_mults,\n tx_type=\"nmos\")\n self.add_mod(self.nmos)\n\n self.pmos = ptx(width=self.pmos_size,\n mults=self.pmos_mults,\n ...
[ "0.62417173", "0.5595662", "0.5592487", "0.5253398", "0.5209395", "0.5176703", "0.5076419", "0.5046861", "0.50380796", "0.49966943", "0.4981465", "0.49621493", "0.49106213", "0.49073905", "0.49046108", "0.48944435", "0.48900783", "0.48836777", "0.4832847", "0.48023075", "0.47...
0.626209
0
Place both the upper_pmos and lower_pmos to the module
def place_ptx(self): # Compute the other pmos2 location, but determining offset to overlap the # source and drain pins self.overlap_offset = self.pmos.get_pin("D").ll() - self.pmos.get_pin("S").ll() # adds the lower pmos to layout #base = vector(self.width - 2*self.pmos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modules():", "def create_modules(self):\n self.nmos = ptx(width=self.nmos_size,\n mults=self.nmos_mults,\n tx_type=\"nmos\")\n self.add_mod(self.nmos)\n\n self.pmos = ptx(width=self.pmos_size,\n mults=self.pmos_mults,\n...
[ "0.5711919", "0.56773573", "0.5484845", "0.5373545", "0.5269169", "0.5117529", "0.503132", "0.5020452", "0.49931383", "0.49220088", "0.49029332", "0.4861574", "0.47709423", "0.4747098", "0.47383958", "0.47374594", "0.47188666", "0.47152808", "0.4713286", "0.4705685", "0.47054...
0.58079857
0
Connects the upper and lower pmos together
def connect_poly(self): offset = self.lower_pmos_inst.get_pin("G").ll() # connects the top and bottom pmos' gates together ylength = self.upper_pmos1_inst.get_pin("G").ll().y - offset.y self.add_rect(layer="poly", offset=offset, width=self.pol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_poly(self):\n # connect pmos1 poly\n nmos_gate = (self.nmos_position1 \n + self.nmos.poly_positions[0]\n + vector(0.5 * drc[\"minwidth_poly\"], 0))\n for i in range(len(self.pmos.poly_positions)):\n pmos_gate = (self.pmos_position1...
[ "0.5922714", "0.5896698", "0.5664321", "0.5499741", "0.54175603", "0.53472805", "0.5343195", "0.5323919", "0.5288541", "0.5283576", "0.5264222", "0.5234746", "0.5233384", "0.5213443", "0.5183542", "0.5177952", "0.51564336", "0.515582", "0.51377267", "0.5134331", "0.50970364",...
0.6478284
0
Adds the en input rail, en contact/vias, and connects to the pmos
def route_en(self): # adds the en contact to connect the gates to the en rail on metal1 offset = self.lower_pmos_inst.get_pin("G").ul() + vector(0,0.5*self.poly_space) self.add_contact_center(layers=("poly", "contact", "metal1"), offset=offset, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_connections(self):\n\t\t# Lorsque l'on choisi une devise dans la cbb\n\t\tself.cbb_devisesFrom.activated.connect(self.compute)\n\t\tself.cbb_devisesTo.activated.connect(self.compute)\n\t\t# Lorsque l'on change le montant dans la spn\n\t\tself.spn_montant.valueChanged.connect(self.compute)\n\t\tself.spn_m...
[ "0.56937957", "0.5588377", "0.5364039", "0.53394985", "0.53394985", "0.5271092", "0.5241046", "0.5142711", "0.5137675", "0.512801", "0.5114251", "0.5101308", "0.5082479", "0.50810903", "0.50637263", "0.5054848", "0.50368226", "0.50169", "0.50132143", "0.5012345", "0.49996084"...
0.5722017
0
Adds a nwell tap to connect to the vdd rail
def place_nwell_and_contact(self): # adds the contact from active to metal1 well_contact_pos = self.upper_pmos1_inst.get_pin("D").center().scale(1,0) \ + vector(0, self.upper_pmos1_inst.uy() + contact.well.height/2 + drc["well_extend_active"]) self.add_contact_center(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_bilink(self, nodeport_a, nodeport_b, bilink):", "def port_nic_add(switch, port, node, nic):\n client.port.connect_nic(switch, port, node, nic)", "def add_road(ccTremb):\n pass", "def connect(self, kern):\n self.driver = Board(kern)\n self.print_log(1, \"CONNECTION SUCCESSFUL\")", ...
[ "0.5762853", "0.546645", "0.5400702", "0.5365223", "0.53347313", "0.5312553", "0.5271529", "0.52679247", "0.5259497", "0.5243317", "0.5153511", "0.51240474", "0.5117145", "0.5093661", "0.50626403", "0.5029237", "0.5029237", "0.50022084", "0.50006396", "0.4997442", "0.4988631"...
0.0
-1
Adds both bitline and bitlinebar to the module
def route_bitlines(self): # adds the BL on metal 2 offset = vector(self.bitcell.get_pin(self.bitcell_bl).cx(),0) - vector(0.5 * self.m2_width,0) self.add_layout_pin(text="bl", layer="metal2", offset=offset, width...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addToolBarButtons(self):", "def addBarrelBlue(self, event):\n # let user draw second ROI\n ROI = RoiPoly(color='b') #let user draw ROI\n plt.show(block=False)\n mask = ROI.get_mask(self.greyimg)\n self.ROI += mask", "def add_modules(self):\n # This is the threshold...
[ "0.5931237", "0.56883824", "0.5411799", "0.5363328", "0.523951", "0.5219392", "0.52153605", "0.52136797", "0.5135922", "0.50847983", "0.5036947", "0.50350106", "0.5027019", "0.5021388", "0.5010233", "0.4987663", "0.49871254", "0.49766114", "0.49440458", "0.49363413", "0.48943...
0.61381006
0
Adds contacts/via from metal1 to metal2 for bitlines
def add_bitline_contacts(self): stack=("metal1", "via1", "metal2") pos = self.lower_pmos_inst.get_pin("S").center() self.add_contact_center(layers=stack, offset=pos) pos = self.lower_pmos_inst.get_pin("D").center() self.add_contact_center(layers=s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route_bitlines(self):\n # adds the BL on metal 2\n offset = vector(self.bitcell.get_pin(self.bitcell_bl).cx(),0) - vector(0.5 * self.m2_width,0)\n self.add_layout_pin(text=\"bl\",\n layer=\"metal2\",\n offset=offset,\n ...
[ "0.693796", "0.67024845", "0.61300176", "0.5741309", "0.5715331", "0.5709275", "0.56884384", "0.55448365", "0.5517545", "0.54770654", "0.54025584", "0.5344132", "0.5279721", "0.52553105", "0.5248629", "0.5226081", "0.5191582", "0.51813334", "0.5166011", "0.5162329", "0.516208...
0.73841476
0
Connect pmos pin to bitline pin
def connect_pmos(self, pmos_pin, bit_pin): ll_pos = vector(min(pmos_pin.lx(),bit_pin.lx()), pmos_pin.by()) ur_pos = vector(max(pmos_pin.rx(),bit_pin.rx()), pmos_pin.uy()) width = ur_pos.x-ll_pos.x height = ur_pos.y-ll_pos.y self.add_rect(layer="metal2", of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_pins(self):\n\n for bit in range(self.addr_size):\n self.add_pin(\"addr_{0}\".format(bit),\"INPUT\")\n \n self.add_pin(\"wl_en\", \"INPUT\")\n\n for bit in range(self.num_rows):\n self.add_pin(\"wl_{0}\".format(bit),\"OUTPUT\")\n \n self.add_p...
[ "0.6256124", "0.6165595", "0.6141988", "0.61245584", "0.612056", "0.61114496", "0.60696626", "0.6058473", "0.60407984", "0.60359067", "0.5940562", "0.5879642", "0.5822711", "0.58177835", "0.5814207", "0.57660544", "0.5757099", "0.5755097", "0.5746251", "0.5702823", "0.5679750...
0.74909616
0
Sort a list using the insertion sort
def insertion_sort(my_list): # Start at the second element (pos 1). # Use this element to insert into the # list. for key_pos in range(1, len(my_list)): # n # Get the value of the element to insert key_value = my_list[key_pos] # Scan from right to the left (start of list) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertionSort(list):", "def insertion_sort(a_list):\n\n i = 0\n while i < len(a_list):\n current = a_list[i]\n j = i\n while j > 0 and a_list[j - 1] > current:\n a_list[j] = a_list[j - 1]\n j -= 1\n a_list[j] = current\n i += 1\n return a_list...
[ "0.9294735", "0.84433293", "0.8433886", "0.8369417", "0.83684015", "0.8341289", "0.8337272", "0.82814753", "0.8255657", "0.82203144", "0.817608", "0.8162831", "0.80360997", "0.7981972", "0.797846", "0.7969085", "0.79533505", "0.78883386", "0.7884372", "0.7877078", "0.78731656...
0.7946972
17
Custom shared utility setup for tests.
def setUp(self): self.portal = self.layer['portal'] self.request = self.layer['request'] self.installer = api.portal.get_tool('portal_quickinstaller') self.view = api.content.get_view( name="search", context=self.portal, request=self.request )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n # After stage1:\n # TODO: use this form after implementing a fixer to consolidate\n # __future__ imports into a single line:\n # self.headers1 = \"\"\"\n # from __future__ import absolute_import, division, print_function\n # \"\"\"\n self.he...
[ "0.70489055", "0.69983375", "0.69934666", "0.6938551", "0.6886009", "0.6853525", "0.6848782", "0.6848782", "0.6814673", "0.6778472", "0.67625844", "0.6757128", "0.6745611", "0.6745611", "0.6745611", "0.6745611", "0.6745611", "0.67200303", "0.66971433", "0.66803986", "0.665251...
0.0
-1
Compute loss for model. If both `labels` and `mask` are None,
def supcon_loss(features_lst, labels_lst, contrast_mode='all', temperature=0.07, base_temperature=0.07): res = [] device = features_lst.device for i in range(11): features = features_lst[:, :, i].unsqueeze(1) labels = labels_lst[:, i] if len(features.shape) < 3: raise Va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_unreduced_loss_impl(self, labels, logits, mask=None):\n raise NotImplementedError('Calling an abstract method.')", "def _compute_unreduced_loss_impl(self, labels, logits, mask=None):\n if mask is None:\n mask = utils.is_label_valid(labels)\n labels = tf.compat.v1.where(mask, labels, tf...
[ "0.7447054", "0.7227031", "0.71983606", "0.7175569", "0.7107803", "0.7051049", "0.7042948", "0.70405126", "0.6972529", "0.69522893", "0.6914948", "0.6902001", "0.6863949", "0.67680174", "0.67488766", "0.6742742", "0.6711211", "0.6705183", "0.66921157", "0.66846156", "0.666742...
0.0
-1
Change first convolution layer input channels.
def patch_first_conv(model, in_channels): # get first conv for module in model.modules(): if isinstance(module, nn.Conv2d): break # change input channels for first conv module.in_channels = in_channels weight = module.weight.detach() reset = False if in_channels == 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_first_conv(model, in_channels: int = 4) -> None:\n\n # get first conv\n for module in model.modules():\n if isinstance(module, torch.nn.Conv2d):\n break\n\n # change input channels for first conv\n module.in_channels = in_channels\n weight = module.weight.detach()\n # ...
[ "0.75123245", "0.6696509", "0.66346097", "0.64516467", "0.64232844", "0.63495713", "0.6230231", "0.62070876", "0.6168099", "0.61499965", "0.60493684", "0.6044107", "0.60128045", "0.59726113", "0.59684473", "0.5937715", "0.5925386", "0.5920553", "0.59197867", "0.5918833", "0.5...
0.7558337
0
Initialize your data structure here.
def __init__(self): self.root = WordNode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__...
[ "0.7765608", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7595176", "0.75853467", "0.7558298", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.74971247", "0.74971247", "0.7478105", "0.7477832", "0.7477832", "0.7477832", ...
0.0
-1
Adds a word into the data structure.
def addWord(self, word: str) -> None: cur = self.root for c in word: cur = cur.children[c] cur.end = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, word: str) -> None:\n self.d.add(word)", "def addWord(self, word):\n if word:\n self.word_dict[len(word)].append(word)", "def add_word(self, word, data=None):\n self.__word = word\n self.__data = data", "def addWord(self, word: str) -> None:\n self....
[ "0.8927149", "0.8707726", "0.8691716", "0.8683696", "0.866071", "0.8609965", "0.8577551", "0.850608", "0.8444817", "0.8438259", "0.8397973", "0.83428085", "0.832509", "0.82493746", "0.824884", "0.8230209", "0.8217579", "0.82155204", "0.8213111", "0.8212719", "0.8134825", "0...
0.78671056
29
Returns if the word is in the data structure. A word could contain the dot character '.' to represent any one letter.
def search(self, word: str, cur=None) -> bool: if cur is None: cur = self.root is_exist, flag = True, False for i, c in enumerate(word): if c=='.': flag = False for child in cur.children: if self.search(word[i+1:], child...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, word):\n if not word:\n return False\n if '.' not in word:\n return word in self.word_dict[len(word)]\n for v in self.word_dict[len(word)]:\n for i, ch in enumerate(word):\n if ch != v[i] and ch != '.':\n break...
[ "0.7730379", "0.76118255", "0.7585627", "0.7579322", "0.7545671", "0.74328244", "0.7381778", "0.73046196", "0.7272159", "0.7260463", "0.7249184", "0.7232086", "0.72108984", "0.71929723", "0.7162314", "0.71533686", "0.71374553", "0.7133968", "0.7133708", "0.7104273", "0.709549...
0.65321076
71
Creates answer instance and tries to add it into database.
def create(text, is_correct, question_id): answer = Answer(question_id=question_id, text=text, is_correct=is_correct) try: answer.save() return answer except IntegrityError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store(self) -> None:\n con, c = db.connect()\n if not db.exists('SELECT * FROM answers WHERE id = ?', self.id, con=con):\n c.execute('INSERT INTO answers VALUES (?, ?, ?, ?, ?, ?, ?)', (self.id, self.answer, \n self.likes, self.created, self.tell, self.user.id, sel...
[ "0.74090177", "0.7360692", "0.7325249", "0.6723447", "0.6708266", "0.6560831", "0.65191895", "0.6512874", "0.6498012", "0.6452953", "0.63771117", "0.63582677", "0.6309882", "0.6295815", "0.6247545", "0.62320566", "0.62159014", "0.6209142", "0.6187571", "0.6144167", "0.6135668...
0.7057084
3
Returns True if user's answer matches with answer from database.
def is_correct_answer(answer): db_answer = Answer.objects.get(id=int(list(answer.keys())[0])) return db_answer.is_correct == bool(list(answer.values())[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self, answer):\n return self.answer == answer", "def check_if_correct(self, q, ans):\n answer = OnlyAnswer.objects.get(question=q)\n cleaned_guess = (ans.strip()).lower()\n if answer.content == cleaned_guess:\n return True\n else:\n return Fa...
[ "0.7286002", "0.72846013", "0.7091092", "0.6901954", "0.67433286", "0.6692698", "0.6672469", "0.655168", "0.6540481", "0.65291345", "0.6469405", "0.64011556", "0.6371484", "0.6338362", "0.6301711", "0.62966347", "0.6283468", "0.62660295", "0.6132463", "0.6112869", "0.60622096...
0.7438986
0
Return a spectrum for the given parameters. If necessary the SSPs are updated, and if necessary the component spectra are updated, before being combined here.
def get_spectrum(self, outwave=None, filters=None, nebular=True, **params): spec, neb, phot, ex = self.get_components(outwave, filters, **params) total_spec = (spec * self.params['mass'][:, None]).sum(axis=0) if nebular: total_spec += neb total_phot = (phot * self.params['mas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spectrum(self, outwave=None, filters=None, peraa=False, **params):\n self.params.update(**params)\n # Pass the model parameters through to the sps object\n ncomp = len(self.params['mass'])\n for ic in range(ncomp):\n s, p, x = self.one_sed(component_index=ic, filterli...
[ "0.713812", "0.6641795", "0.6600415", "0.6430547", "0.6319527", "0.6317205", "0.6156336", "0.6150407", "0.61060166", "0.6043588", "0.6030428", "0.5996301", "0.5982051", "0.5974503", "0.58879244", "0.58713675", "0.58588684", "0.58316994", "0.5792978", "0.57904905", "0.5765851"...
0.63489866
4
Return the component spectra for the given parameters, making sure to update the components if necessary.
def get_components(self, outwave, filters, **params): if outwave is not None: params['outwave'] = outwave # This will rebuild the basis if relevant parameters changed self.update(params) # distance dimming and conversion from Lsun/AA to cgs dist10 = self.params.get('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spectrum(self, outwave=None, filters=None, peraa=False, **params):\n self.params.update(**params)\n # Pass the model parameters through to the sps object\n ncomp = len(self.params['mass'])\n for ic in range(ncomp):\n s, p, x = self.one_sed(component_index=ic, filterli...
[ "0.650899", "0.63521004", "0.62602806", "0.6212332", "0.6152562", "0.61498123", "0.60125136", "0.600692", "0.59775174", "0.59307957", "0.58136463", "0.5777221", "0.568845", "0.5676116", "0.5654231", "0.5653515", "0.56379193", "0.5629634", "0.56277597", "0.56085885", "0.560046...
0.6034915
6
Basically do all the COMPSP stuff for one component.
def process_component(self, i, outwave, filters): cspec = self.basis_spec[i, :].copy() cphot = 0 inwave = self.ssp.wavelengths if self.safe: cspec = np.interp(self.params['outwave'], vac2air(inwave), cspec/a) cphot = 10**(-0.4 * getSED(inwave, cspec/a, filters)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_component(self):\n raise NotImplementedError", "def execute(self):\n if self.runVolGrid == 1:\n if self.cshUserBatch1 == 0:\n self.write_mesh_csh()\n if self.runVolGrid == 1:\n self.write_mesh_java()\n if self.runCFD == 1:\n if s...
[ "0.580832", "0.57996196", "0.5601529", "0.5541401", "0.5448608", "0.54424137", "0.53614277", "0.53517246", "0.5333314", "0.5324852", "0.5324852", "0.52889913", "0.526856", "0.5247708", "0.5241391", "0.5210807", "0.5175131", "0.5170005", "0.5151401", "0.5144587", "0.51259434",...
0.0
-1
If the emission_rest_wavelengths parameter is present, return a nebular emission line spectrum. Currently uses several approximations for the velocity broadening. Currently does not affect photometry. Only provides samples of the nebular spectrum at outwave, so will not be correct for total power unless outwave densley...
def nebular(self, params, outwave): if 'emission_rest_wavelengths' not in params: return 0. mu = vac2air(params['emission_rest_wavelengths']) # try to get a nebular redshift, otherwise use stellar redshift, # otherwise use no redshift a1 = params.get('zred_emission',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spectrum(self, outwave=None, filters=None, nebular=True, **params):\n spec, neb, phot, ex = self.get_components(outwave, filters, **params)\n total_spec = (spec * self.params['mass'][:, None]).sum(axis=0)\n if nebular:\n total_spec += neb\n total_phot = (phot * self.p...
[ "0.57497835", "0.5429985", "0.53425705", "0.52842164", "0.52446645", "0.5162241", "0.50572604", "0.5036854", "0.5012343", "0.49678618", "0.4942516", "0.49243805", "0.49133074", "0.49097195", "0.4870502", "0.48516658", "0.48274308", "0.48018676", "0.47904533", "0.47681382", "0...
0.6854461
0
Update the parameters, recording whether it was new for the ssp or basis parameters. If either of those changed, regenerate the relevant spectral grid(s).
def update(self, newparams): for k, v in list(newparams.items()): if k in self.basis_params: # Make sure parameter is in dict, and check if it changed if k not in self.params: self.basis_dirty = True self.params[k] = v ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_parameters(self):\n # We update gamma, gamma0, lambda and nu in turn (Bottolo et al, 2011)\n self.update_gamma()\n self.update_gamma0()\n self.update_lambda()\n self.update_nu()\n if self.sample_xi:\n self.update_xi()", "def update_parameters(self):...
[ "0.73953754", "0.71710765", "0.7023726", "0.69720674", "0.68460697", "0.66629374", "0.6656813", "0.6526564", "0.647887", "0.6461412", "0.6455409", "0.638619", "0.6373815", "0.6373815", "0.6373815", "0.6373815", "0.6373815", "0.6373815", "0.6373815", "0.6373815", "0.63724744",...
0.74350566
0
Rebuild the component spectra from the SSPs. The component spectra include dust attenuation, redshifting, and spectral regridding. This is basically a proxy for COMPSP from FSPS, with a few small differences. In particular, there is interpolation in metallicity and the redshift and the output wavelength grid are taken ...
def build_basis(self): if self.debug: print('sps_basis: rebuilding basis') # Setup the internal component basis arrays inwave = self.ssp.wavelengths nbasis = len(np.atleast_1d(self.params['mass'])) self.nbasis = nbasis # nbasis = ( len(np.atleast_1d(self.param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_component(self, i, outwave, filters):\n cspec = self.basis_spec[i, :].copy()\n cphot = 0\n inwave = self.ssp.wavelengths\n\n if self.safe:\n cspec = np.interp(self.params['outwave'], vac2air(inwave), cspec/a)\n cphot = 10**(-0.4 * getSED(inwave, cspec/a...
[ "0.5937564", "0.5780565", "0.5741519", "0.56655246", "0.563537", "0.5506949", "0.5402162", "0.5372675", "0.5352444", "0.5346785", "0.532719", "0.531849", "0.5266165", "0.5228784", "0.5225048", "0.51991665", "0.51623684", "0.5162299", "0.51584435", "0.5140857", "0.5140395", ...
0.60962576
0
Given a theta vector, generate spectroscopy, photometry and any extras (e.g. stellar mass).
def get_spectrum(self, outwave=None, filters=None, peraa=False, **params): self.params.update(**params) # Pass the model parameters through to the sps object ncomp = len(self.params['mass']) for ic in range(ncomp): s, p, x = self.one_sed(component_index=ic, filterlist=filters...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scattering_direction(v, theta):\r\n # Sample cos_phi and sin_phi, phi is the azimuthal angle of the scattering event\r\n continue_loop = True\r\n while continue_loop:\r\n eta1 = 1-2*random.random()\r\n eta2 = 1-2*random.random()\r\n alpha = eta1**2 + eta2**2\r\n if alpha <=...
[ "0.5524242", "0.5429524", "0.539759", "0.5299873", "0.5297758", "0.52611303", "0.5256927", "0.52566576", "0.52441525", "0.5228684", "0.5216859", "0.51940954", "0.5164453", "0.5148786", "0.51425505", "0.51343614", "0.513167", "0.51285547", "0.5123628", "0.5120493", "0.51005423...
0.0
-1
Get the SED of one component for a multicomponent composite SFH. Should set this up to work as an iterator.
def one_sed(self, component_index=0, filterlist=[]): # Pass the model parameters through to the sps object, and keep track # of the mass of this component mass = 1.0 for k, vs in list(self.params.items()): try: v = vs[component_index] except(IndexE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getComponent(self):\n return _libsbml.SpeciesFeature_getComponent(self)", "def getComponent(self):\n return _libsbml.SubListOfSpeciesFeatures_getComponent(self)", "def __iter__(self):\n return self.cli.essids.essids().__iter__()", "def getComponent(self):\n return _libsbml.Spe...
[ "0.60309696", "0.5875762", "0.5732701", "0.5669978", "0.54934925", "0.54934925", "0.5313908", "0.5306956", "0.5271111", "0.5270919", "0.52329254", "0.52045023", "0.5201842", "0.5201842", "0.51868373", "0.51427984", "0.51417166", "0.5088495", "0.5074315", "0.5063659", "0.50567...
0.5463816
6
Lay down mutiple gaussians on the xaxis.
def gauss(x, mu, A, sigma): mu, A, sigma = np.atleast_2d(mu), np.atleast_2d(A), np.atleast_2d(sigma) val = (A / (sigma * np.sqrt(np.pi * 2)) * np.exp(-(x[:, None] - mu)**2 / (2 * sigma**2))) return val.sum(axis=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __draw_xaxis(self):\n self.ax.set_xlim(self.xlims)\n # put x ticks on top\n xticks = [1]\n xticks.extend(range(5, self.xmax+5, 5))\n fs = self.settings.rcParams[\"axes.labelsize\"] if self.settings.otherParams[\n \"xlabel.fontsize\"] is None else self.settings.othe...
[ "0.60257566", "0.59820426", "0.5593813", "0.55852216", "0.55148125", "0.55004704", "0.5493635", "0.545422", "0.54387575", "0.54352844", "0.5398524", "0.53769404", "0.5369894", "0.5365591", "0.5359699", "0.5343257", "0.53026277", "0.52932596", "0.5254157", "0.52503586", "0.525...
0.0
-1
Validates the data and creates the config objects
def validate(data): if 'project' not in data: raise PolyaxonfileError("The Polyaxonfile must contain a project section.") if 'model' not in data: raise PolyaxonfileError("The Polyaxonfile must contain a model section.") validated_data = { 'version': data['version'], 'projec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_config(self):\r\n c = self.config\r\n \r\n # Make sure that we have a database_path, and an image_path...\r\n assert 'database_path' in c\r\n assert 'image_path' in c\r\n # We should probably check if these paths exist and make them as well...\r\n \r\n ...
[ "0.66749805", "0.65164816", "0.64016116", "0.64016116", "0.6307988", "0.62377954", "0.6136363", "0.61220586", "0.6081083", "0.6076208", "0.6051987", "0.6048227", "0.60396284", "0.6021695", "0.59975976", "0.59783435", "0.5976575", "0.5976575", "0.5946913", "0.59431374", "0.593...
0.64124906
2
r"""align(imgDim, rgbImg, bb=None, landmarks=None, landmarkIndices=INNER_EYES_AND_BOTTOM_LIP) Transform and align a face in an image.
def align(imgDim, rgbImg, landmarks, landmarkIndices=INNER_EYES_AND_BOTTOM_LIP, skipMulti=True): assert imgDim is not None assert rgbImg is not None assert landmarks is not None #if bb is None: # bb = self.getLargestFaceBoundingBox(rgbImg, skipMult...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def align(self, image, landmark_indices, anchor_points, size=96):\n # Detect face in image and find landmarks\n box = self.detect(image)\n landmarks = self.find_landmarks(image, box)\n\n # Select three points in the landmarks(Eyes and nose)\n points_in_image = landmarks[landmark_...
[ "0.6571622", "0.65087074", "0.6424263", "0.63643926", "0.62261367", "0.62224346", "0.6209903", "0.60258204", "0.6018538", "0.58878434", "0.5757735", "0.56468785", "0.552677", "0.5469069", "0.53907555", "0.5254516", "0.5184894", "0.5080917", "0.50786936", "0.50399625", "0.5037...
0.7130995
0
Gets console output text from a specific job build
def get_console_text(self): console_text_api = '/consoleText' return self._api_request(self.url + console_text_api)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_build_line(latest_build):\n proc = Popen([\"osg-koji\", \"buildinfo\", latest_build],\n stdout=PIPE)\n build_line = proc.stdout.readline().decode(\"latin-1\").strip()\n ret = proc.wait()\n if ret != 0 or not build_line:\n return\n return build_line", "def general_job...
[ "0.6886761", "0.6039708", "0.60122496", "0.60070854", "0.60053575", "0.5946325", "0.5929492", "0.5887831", "0.5874886", "0.58744806", "0.58705306", "0.5813472", "0.5802365", "0.5799912", "0.5730037", "0.5696503", "0.56834877", "0.56523955", "0.56515515", "0.56502163", "0.5633...
0.0
-1
Gets the prepopulated environment variables for the job build
def get_env_vars(self): env_vars_api = '/injectedEnvVars/api/json' env_vars_json = self._api_request(self.url + env_vars_api) try: env_vars_json = json.loads(env_vars_json) return env_vars_json['envMap'] except JSONDecodeError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_env_vars(self):\n return _untag_env_vars(self._tagged_env_vars, build=True)", "def environment_variables(\n self,\n ) -> typing.Optional[\n typing.Mapping[str, aws_cdk.aws_codebuild.BuildEnvironmentVariable]\n ]:\n return self._values.get(\"environment_variables\")", ...
[ "0.71218103", "0.6978689", "0.6978689", "0.6978689", "0.6978689", "0.6962417", "0.6928234", "0.6838894", "0.6718607", "0.6701541", "0.67005", "0.6680116", "0.6649582", "0.66316056", "0.6587881", "0.65733594", "0.6556599", "0.64912426", "0.63936", "0.63538235", "0.6329612", ...
0.5978486
53
Return a bs4 object containing all the tags in doc of the URL
def _grab_tags(self, url): a = self._api_request(url) return bs4.BeautifulSoup(a,features="html.parser")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_soup(url):\n return BeautifulSoup(requests.get(url).content, 'lxml')", "def getSoup(url):\n return BeautifulSoup(getHtml(url), 'lxml')", "def find_tag_urls(r):\n parser = MyHTMLParser()\n parser.feed(r)\n return parser.url_list", "def request(self, url):\r\n\r\n req = self.get(u...
[ "0.7076313", "0.70216066", "0.69696605", "0.6889851", "0.6826193", "0.68196535", "0.6767906", "0.67462474", "0.67079365", "0.67003834", "0.66789085", "0.66782737", "0.6670707", "0.66667145", "0.66216266", "0.6597798", "0.65232784", "0.64535815", "0.64357543", "0.6435498", "0....
0.7892951
0
Gets the workspace zip for the specific build URL by parsing HTML The API has no way of retrieving the workspace zip AFAIK
def get_workspace_zip(self): workspace_api = '/ws/' # print("Checking Workspaces For: {}".format(self.url)) workspace_elements = self._grab_tags(self.url + workspace_api) workspace_links = [] root_domain = urllib.parse.urlparse(self.url).scheme + '://' + urllib.parse.urlparse(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_project(path: str):\n zip_path = os.path.join(path, 'Simulation.Machine.V1.zip')\n\n # Download zip file with project\n requested_file = requests.get(URL)\n with open(zip_path, 'wb') as f:\n f.write(requested_file.content)\n\n # Extract contents\n with ZipFile(zip_path, 'r') as...
[ "0.556513", "0.5522339", "0.5424023", "0.5417535", "0.53908026", "0.5365669", "0.5358795", "0.5332443", "0.52523816", "0.5220812", "0.5178104", "0.5170915", "0.5148962", "0.51238537", "0.51191694", "0.5066204", "0.5062707", "0.5060167", "0.5052632", "0.50380456", "0.5033808",...
0.7396624
0
Recursively search through all jobs and projects to pull out build URLs
def get_all_build_links(url, auth=None, netloc_force=False): all_build_links = [] if 'api/json' not in url: # if the api endpoint isnt appended, then append it: url += '/api/json/' def recurse_to_build(url): orig_url = urllib.parse.urlparse(url) try: json_reply = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_builds(self):\n for p in self.product_config:\n p_str = p[0]\n\n for l in self.link_list:\n if l.startswith(p[1]):\n if not self.builds_list.has_key(p_str):\n self.builds_list[p_str] = []\n b_str = ...
[ "0.6178584", "0.612089", "0.60826075", "0.59894234", "0.5935299", "0.5781459", "0.5699846", "0.56969726", "0.5667781", "0.560925", "0.5579634", "0.5579634", "0.55440015", "0.5480648", "0.5456297", "0.5444982", "0.5421424", "0.54137886", "0.5393616", "0.5388915", "0.5386272", ...
0.6822186
0