query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Create an asynchronous event object.
def create_event() -> abc.Event: return get_asynclib().Event()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def createEvent(self, event: Event) -> None:", "async def async_event(self, event: str, *args, **kwargs):\n for cb in self.event_handlers[event]:\n asyncio.ensure_future(cb(*args, **kwargs), loop=self.loop)", "def create_new_event(self):\n pass", "async def start_events_async(s...
[ "0.77821743", "0.63274366", "0.6155302", "0.59984094", "0.599693", "0.59448147", "0.5877639", "0.585124", "0.5843828", "0.58366704", "0.58196694", "0.5744085", "0.57186764", "0.56930447", "0.5687933", "0.5659814", "0.5600452", "0.55845153", "0.55748785", "0.55728734", "0.5570...
0.8588365
0
Create an asynchronous semaphore.
def create_semaphore(value: int, *, max_value: Optional[int] = None) -> Semaphore: return Semaphore(value, max_value=max_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.clock = 0\n self.sem = asyncio.Semaphore(1)", "def get_semaphore(name, pid, time_out=None, pause=0.1):\n\n semaphore_key = get_semaphore_key(name, pid)\n while True:\n try:\n return Semaphore(semaphore_key)\n\n except ExistentialError:\n ...
[ "0.672445", "0.5945115", "0.57099426", "0.5578381", "0.55409366", "0.54068184", "0.53410405", "0.52689165", "0.52660245", "0.5145877", "0.51016116", "0.5043989", "0.4977009", "0.4974455", "0.4938569", "0.4906048", "0.48825568", "0.48692894", "0.48491052", "0.48244274", "0.480...
0.7126209
0
Create a capacity limiter.
def create_capacity_limiter(total_tokens: float) -> abc.CapacityLimiter: return get_asynclib().CapacityLimiter(total_tokens)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_capacity(self, m, comp, prod_name):\n name = comp.name\n cap_res = comp.get_capacity_var() # name of resource that defines capacity\n r = m.resource_index_map[comp][cap_res] # production index of the governing resource\n # production is always lower than capacity\n ## NOTE get_capa...
[ "0.69381076", "0.67714393", "0.6637287", "0.66100174", "0.6550799", "0.65026176", "0.6429049", "0.6293804", "0.62928146", "0.6212927", "0.6205634", "0.61527216", "0.6143372", "0.6116694", "0.6098608", "0.6046397", "0.60152835", "0.6004185", "0.59930545", "0.59619427", "0.5949...
0.7675186
0
Caulculate the wall panels area from CC
def walls_cc(lenght, width, wall_height=3, roof_height=4): a = min(0.1*lenght, 0.1*width, 0.4*(wall_height+0.5*roof_height)) trian = 0.5*width*roof_height trian_5 = 0.5*a*a*(wall_height/roof_height) # trian_4 = trian - 2*trian_5 area = (lenght + width)*2*wall_height + 2*trian area_5 = 8*a*wall_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.center_x += self.change_x\n self.center_y += self.change_y\n\n # boundary for the sides of the screen\n if self.left < 0:\n self.left = 0\n if self.right > settings.WIDTH:\n self.right = settings.WIDTH\n\n # boundary for the t...
[ "0.6238483", "0.62136805", "0.6182634", "0.6129454", "0.6088007", "0.5912483", "0.5898643", "0.5848686", "0.5848686", "0.58375394", "0.58281547", "0.58228177", "0.5809672", "0.5803751", "0.58012855", "0.57715404", "0.5770111", "0.57564414", "0.574188", "0.5714904", "0.5705827...
0.66047704
0
Caulculate the roof area from CC sections roof components and clading
def roof_cc(lenght, width, overhang=1, wall_height=3, roof_height=4): a = min(0.1 * lenght, 0.1 * width, 0.4 * (wall_height + 0.5 * roof_height)) area = (lenght + overhang)*(width + overhang) area_3 = 8*a**2 area_1 = (lenght - 2)*(width - 4*a) area_2 = area - area_3 - area_1 return area, area_1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Intarea( xc, yc, r, x0, x1, y0, y1):\n\n#\n# Shift the objects so that the circle is at the origin.\n#\n x0 = x0 - xc\n y0 = y0 - yc\n x1 = x1 - xc\n y1 = y1 - yc\n\n return Oneside( x1, y0, y1, r ) + Oneside( y1, -x1, -x0, r ) +\\\n Oneside( -x0, -y1, -y0, r ) + Oneside( -y0, x0, x1, r )...
[ "0.63638693", "0.62987286", "0.5934985", "0.57753664", "0.57585657", "0.57120097", "0.56629455", "0.56081516", "0.5587647", "0.5574878", "0.55626607", "0.5532842", "0.5528696", "0.54673076", "0.5436828", "0.5425758", "0.5423959", "0.5423923", "0.5408869", "0.54074836", "0.539...
0.7076949
0
Caulculate the area of the roof sections from mwfrs
def roof_mwfrs(lenght, width, overhang=1, wall_height=3, roof_height=4): h = wall_height + 0.5*roof_height area = (lenght + overhang) * (width + overhang) area_1 = 0.5*h*width area_2 = 0.5*h*width area_3 = h*width area_4 = area - area_1 -area_2 - area_3 return area, area_1, area_2, area_3, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_area(self):\r\n\r\n \"\"\"Косое произведение векторов\r\n A = (x2-x1; y2-y1; z2-z1)\r\n B = (x3-x1; y3-y1; z3-z1)\r\n S = 0.5*sqrt((Ay*Bz - Az*By)^2 + (Az*Bx - Ax*Bz)^2 + (Ax*By - Ay*Bx)^2 )\r\n \"\"\"\r\n a_x = self.x2 - self.x1\r\n a_y = self.y2 - self...
[ "0.6690208", "0.63474447", "0.631824", "0.622642", "0.62213504", "0.6113038", "0.6052953", "0.6041878", "0.6038184", "0.6016974", "0.6003224", "0.60003316", "0.59857655", "0.59566283", "0.5944727", "0.59417486", "0.5940033", "0.5937483", "0.5933765", "0.59291804", "0.5923295"...
0.6744593
0
Returns True if the path references a storage managed by this client.
def is_managed_path(self, path): if self._config is None: return False fields = path.split(':', 1) return len(fields) == 2 and fields[0] in self._config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ismount(path):\n return True if not get_instance(path).relpath(path) else False", "def is_remote(path: Text) -> bool:\n\n # TODO(Alex): add check for another remote storages (s3, ...) when they will be supported\n if path.startswith('gs://'):\n return True\n\n return False", "def allowed...
[ "0.6592271", "0.6509119", "0.64684016", "0.611049", "0.6104739", "0.6081552", "0.6011759", "0.598951", "0.5900278", "0.589274", "0.58603543", "0.58445936", "0.58394146", "0.5830439", "0.57979333", "0.5789618", "0.57753074", "0.57674164", "0.5746314", "0.57142276", "0.570292",...
0.71175957
0
Returns the storage ID and the full path from a managed path.
def parse_managed_path(path): fields = path.split(':', 1) return fields[0], fields[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(self, path):\n if not self.is_managed_path(path):\n return os.path.split(path)\n client, _ = self._get_storage(path)\n prefix, rel_path = self.parse_managed_path(path)\n return (\"%s:\" % prefix,) + client.split(rel_path)", "def path(self):\n return self.st...
[ "0.66156155", "0.6590386", "0.6478085", "0.6305727", "0.62419665", "0.6214927", "0.61787874", "0.61033297", "0.6006285", "0.5967128", "0.5922896", "0.5895419", "0.5891455", "0.58695024", "0.5827752", "0.58000994", "0.57938576", "0.5782561", "0.5782561", "0.57012945", "0.56800...
0.66794413
0
Returns the storage implementation based on storage_id or infer it from the path. Defaults to the local filesystem.
def _get_storage(self, path, storage_id=None): if storage_id is None: fields = path.split(':', 1) if len(fields) == 2 and len(fields[0]) > 1: storage_id = fields[0] path = fields[1] if storage_id is not None: if storage_id not in self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_storage(self, schema, storage, path, params=None):\n return self.storages[storage](schema, path, params)", "def get_storage_backend(self):\n return self.client.info()['Driver']", "def get_storage(local_path=None, redis_index=None):\n from config import STORAGE\n if STORAGE[\"Method\...
[ "0.7357804", "0.6921912", "0.68589514", "0.6835108", "0.68159646", "0.6788167", "0.66761404", "0.66322684", "0.65226316", "0.6512314", "0.6474266", "0.64128834", "0.63737255", "0.6356499", "0.63296413", "0.6297468", "0.6296833", "0.6200552", "0.6189922", "0.6164156", "0.61605...
0.7910017
0
Joins the paths according to the storage implementation.
def join(self, path, *paths): if not self.is_managed_path(path): return os.path.join(path, *paths) client, _ = self._get_storage(path) prefix, rel_path = self.parse_managed_path(path) return '%s:%s' % (prefix, client.join(rel_path, *paths)) # Only join the actual path.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join(self, path, *paths):", "def __combine_path(self, other):\n self.path = other.path + self.path", "def join_paths(path_1, path_2):\r\n a = lib_path.join(path_1, path_2)\r\n return a", "def join(\n self, store: \"FlattenedStorage\", lsuffix: str = \"\", rsuffix: str = \"\"\n ) ->...
[ "0.6690264", "0.6219887", "0.6160995", "0.6084246", "0.59763473", "0.5885998", "0.5878738", "0.58280677", "0.580559", "0.57253736", "0.56920284", "0.56796026", "0.5673265", "0.56396765", "0.5624865", "0.55687606", "0.5559663", "0.55429184", "0.5537703", "0.55269426", "0.55257...
0.6259977
1
Splits the path according to the storage implementation.
def split(self, path): if not self.is_managed_path(path): return os.path.split(path) client, _ = self._get_storage(path) prefix, rel_path = self.parse_managed_path(path) return ("%s:" % prefix,) + client.split(rel_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitPath(self, path):\n return os.path.split(path)", "def split(path):\r\n if path.lower().startswith(\"smb://\"):\r\n if '/' not in path[6:]:\r\n path = path.replace(\"smb://\", \"smb:///\", 1)\r\n return path.rsplit('/', 1)\r\n else:\r\n return os.path.split(pa...
[ "0.7338659", "0.704846", "0.6959433", "0.6954841", "0.68820107", "0.6753386", "0.6746454", "0.6732698", "0.66898245", "0.66167927", "0.6399389", "0.6367646", "0.6342386", "0.6329785", "0.6303435", "0.6253679", "0.6211378", "0.61924195", "0.61387295", "0.6095969", "0.6065212",...
0.76428443
0
Retrieves a file from remote_path to local_path.
def get_file(self, remote_path, local_path, storage_id=None): return self.get(remote_path, local_path, directory=False, storage_id=storage_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(host, username, remotepath, localpath=None, port=22):\n log = logging.getLogger('device.remotecall')\n log.info('geting file from remote:%s -> %s', remotepath, localpath)\n if not localpath:\n localpath = os.path.split(remotepath)[1]\n cmd = 'scp -P %s %s@%s:%s %s' % ...
[ "0.8135602", "0.8111427", "0.7951518", "0.750407", "0.7486695", "0.7328098", "0.7257956", "0.7212995", "0.6986036", "0.69763374", "0.69627047", "0.6884778", "0.6879238", "0.6876323", "0.68586385", "0.6786958", "0.671621", "0.67073643", "0.6648413", "0.6631423", "0.66255814", ...
0.83529526
0
Retrieves a full directory from remote_path to local_path.
def get_directory(self, remote_path, local_path, storage_id=None): return self.get(remote_path, local_path, directory=True, storage_id=storage_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDirectory( self, path, localPath = False ):\n res = self.__checkArgumentFormat( path )\n if not res['OK']:\n return res\n urls = res['Value']\n\n failed = {}\n successful = {}\n gLogger.debug( \"DIPStorage.getDirectory: Attempting to get local copies of %s directories.\" % len( urls )...
[ "0.71187484", "0.7090581", "0.6674842", "0.66484684", "0.65908664", "0.6586931", "0.65826195", "0.6580506", "0.65319806", "0.6471554", "0.6446152", "0.6442478", "0.6335604", "0.6271005", "0.6265481", "0.61953896", "0.6186426", "0.6037663", "0.6009096", "0.59784174", "0.596171...
0.80905944
0
Returns stat on remote_path file
def stat(self, remote_path, storage_id=None): client, remote_path = self._get_storage(remote_path, storage_id=storage_id) return client.stat(remote_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_stat(self, file_path):", "def stat (self, path):\r\n pass", "def stat(self, path):\n return os.stat(path)", "def stat(path: str) -> StatResult:\n return _fs().stat(path)", "def stat(self, path: bytes) -> Any:\n return os.stat(self.storage.path(path.decode()))", "def get_s...
[ "0.759059", "0.74223083", "0.7068877", "0.6889453", "0.67729634", "0.67529154", "0.67309195", "0.6718362", "0.6688009", "0.6540114", "0.6426513", "0.63638204", "0.6309964", "0.62603474", "0.6134606", "0.61128014", "0.6097762", "0.6071095", "0.60283256", "0.6028293", "0.600829...
0.7572192
1
Pushes a local_path file or directory to storage.
def push(self, local_path, remote_path, storage_id=None, lp=None): if not os.path.exists(local_path): raise RuntimeError('%s not found' % local_path) if local_path == remote_path: return None LOGGER.info('Uploading %s to %s', local_path, remote_path) client, remot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_push_file(job_log_dir, file_path, local_config):\n dest_dir = os.path.join(local_config['path'], job_log_dir)\n dest_filename = os.path.basename(file_path)\n if not os.path.isdir(dest_dir):\n os.makedirs(dest_dir)\n\n dest_file = os.path.join(dest_dir, dest_filename)\n\n shutil.copy...
[ "0.65923005", "0.65466136", "0.653534", "0.64600855", "0.64583194", "0.6253895", "0.6151398", "0.61167777", "0.6061019", "0.6037784", "0.6037443", "0.5991548", "0.59851855", "0.59710395", "0.59525883", "0.5892432", "0.58776206", "0.5817515", "0.57922804", "0.5791136", "0.5755...
0.7437701
0
Delete segments from a corpus in a storage.
def seg_delete(self, remote_path, corpus_id, seg_ids, storage_id=None): client, remote_path = self._get_storage(remote_path, storage_id=storage_id) return client.seg_delete(corpus_id, seg_ids)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_network_segments(self, tenant_id, network_segments):", "def del_segment_translations(*args):\n return _ida_segment.del_segment_translations(*args)", "def test_deleting_a_segment(self):\n pass", "def del_segm(*args):\n return _ida_segment.del_segm(*args)", "def delete(fits: Optional[str]...
[ "0.6602147", "0.63999766", "0.62061095", "0.59552914", "0.592743", "0.5694561", "0.5608127", "0.55144745", "0.55131215", "0.5494817", "0.5445123", "0.54226285", "0.5414766", "0.5398532", "0.5384618", "0.53805983", "0.53650475", "0.5341641", "0.53285897", "0.53285897", "0.5327...
0.68825424
0
Modify segment from a corpus in a storage.
def seg_modify(self, remote_path, corpus_id, seg_id, tgt_id, tgt_seg, src_seg, storage_id=None): client, remote_path = self._get_storage(remote_path, storage_id=storage_id) return client.seg_modify(corpus_id, seg_id, tgt_id, tgt_seg, src_seg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_updating_a_segment(self):\n pass", "def change_segment(self):\n logging.debug(\"change_segment\")\n word_string_list = list(self.word_string) # Making a mutable list from immutable string\n index_of_change = randint(0, len(self.word_string)-1)\n old_segment = word_str...
[ "0.57963276", "0.5316993", "0.52617526", "0.51432174", "0.5116421", "0.5114566", "0.5093644", "0.5076101", "0.4989136", "0.49597093", "0.49469495", "0.49101588", "0.49080533", "0.4904618", "0.48917064", "0.48703775", "0.48694524", "0.48629633", "0.48147547", "0.48052073", "0....
0.61081445
0
Add segments from a corpus in a storage.
def seg_add(self, remote_path, corpus_id, segments, storage_id=None): client, remote_path = self._get_storage(remote_path, storage_id=storage_id) return client.seg_add(corpus_id, segments)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_segments(self, *segments):\n for s in segments:\n self._add_one(s)", "def add_documents(self, docs):\n if 'sentences' in docs:\n for sent in docs.sentences:\n sent = map(self.process_token, [t for t in sent.tokens if not t.is_stopword])\n ...
[ "0.60334104", "0.56780165", "0.54971635", "0.54327893", "0.53650546", "0.53482825", "0.5279206", "0.52374446", "0.5221571", "0.52145606", "0.52145606", "0.50907433", "0.5046816", "0.50380266", "0.50286496", "0.49813986", "0.4940868", "0.48904213", "0.48843732", "0.48765466", ...
0.700075
0
Renames a file or directory on storage from old_remote_path to new_remote_path.
def rename(self, old_remote_path, new_remote_path, storage_id=None): client_old, old_remote_path = self._get_storage(old_remote_path, storage_id=storage_id) client_new, new_remote_path = self._get_storage(new_remote_path, storage_id=storage_id) if client_old._storage_id != client_new._storage_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename(path, new_path):\n fs.rename(path, new_path)", "def rename(self, name, new_name):\n\n if not new_name:\n raise ValueError(\"Current remote name must be a non-empty string\")\n\n if not new_name:\n raise ValueError(\"New remote name must be a non-empty string\")\n...
[ "0.66009545", "0.65774685", "0.6334382", "0.6323269", "0.6254582", "0.62079513", "0.61884886", "0.61884886", "0.6153674", "0.6129355", "0.6117416", "0.61145955", "0.6065734", "0.6009174", "0.60073656", "0.60063607", "0.5983843", "0.5968736", "0.592499", "0.5916464", "0.591577...
0.7846696
0
Add a tag associated with a corpus.
def tag_add(self, remote_path, corpus_id, tag, storage_id=None): client, remote_path = self._get_storage(remote_path, storage_id=storage_id) return client.tag_add(corpus_id, tag)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tag(self, tag):\n self.tags.append(tag)", "def add(self, tag):\n self.tags[tag.name] = tag", "def add_tag(self, tag: str) -> None:\n tags = self.get_tag_index()\n tags.append(tag)\n self.write_tag_index(list(set(tags)))", "def add_tag(self, tag, attributes, extent):...
[ "0.67452145", "0.67087305", "0.6602822", "0.654039", "0.6409781", "0.6332519", "0.61717", "0.61188984", "0.60842836", "0.60632265", "0.60379875", "0.60356516", "0.58503866", "0.58032125", "0.57711476", "0.5755432", "0.5735581", "0.57319754", "0.56949925", "0.56422025", "0.563...
0.7265227
0
Remove a tag associated with a corpus.
def tag_remove(self, remote_path, corpus_id, tag, storage_id=None): client, remote_path = self._get_storage(remote_path, storage_id=storage_id) return client.tag_remove(corpus_id, tag)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_tag(self, tag: str) -> None:\n tags = self.get_tag_index()\n tags.remove(tag)\n self.write_tag_index(list(set(tags)))", "def remove_tag(self, dataset: \"Dataset\", tag: \"DatasetTag\"):\n raise NotImplementedError", "def remove_tag(args):", "def delete_tag(tag):\n ta...
[ "0.72124904", "0.7099556", "0.70785826", "0.69428086", "0.68757766", "0.68354094", "0.6760699", "0.67518336", "0.66936296", "0.66848594", "0.6625902", "0.6531172", "0.6494891", "0.6458214", "0.64311934", "0.64180356", "0.62905985", "0.6257875", "0.62415624", "0.62254566", "0....
0.75549275
0
Construct half of a queued batch, all of the same label
def _generate_half_batch(record_data, min_queue_examples, batch_size, num_steps, test_mode): # From TF documentation: "The batching will be nondeterministic if num_threads > 1" # Ok to have many threads for training, but in testing want a deterministic result. if test_mode: num_preprocess_threads = 1 else: num_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_batch():\n\n # Initialize variables\n example = np.zeros(self.batch_size)\n labels = np.zeros((self.batch_size, 1))\n alphas = np.zeros(self.batch_size)\n n_items = 0\n index = 0\n\n while index < len(data):\n ...
[ "0.6270515", "0.5756146", "0.57460064", "0.5700081", "0.5598213", "0.5595119", "0.54683524", "0.5448528", "0.5440111", "0.5430576", "0.54280764", "0.5404559", "0.53941274", "0.5314276", "0.5312027", "0.5303626", "0.5300449", "0.529997", "0.5289015", "0.52655345", "0.5265391",...
0.62710935
0
Reads data from a binary file of cell image data. Create an object with information about sequence and batch that will be filled with data obtained from the queue by the FixedLengthRecordReader
def _read_from_file(queue, config, class_label): class SequenceRecord(object): pass result = SequenceRecord() # Dimensions of the images and the bytes they each take # up in the binary file result.height = config.image_size result.width = config.image_size result.depth = config.image_depth result.sequence...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_data(self, fh, byteorder='>'):\r\n fh.seek(len(self.header))\r\n data = fh.read()\r\n dtype = 'u1' if self.maxval < 256 else byteorder + 'u2'\r\n depth = 1 if self.magicnum == b\"P7 332\" else self.depth\r\n shape = [-1, self.height, self.width, depth]\r\n size =...
[ "0.64353794", "0.634234", "0.6255051", "0.60868925", "0.6069626", "0.6022551", "0.60060596", "0.5988088", "0.5954001", "0.59471613", "0.5936006", "0.59276175", "0.5907464", "0.58940315", "0.5716337", "0.571063", "0.56878084", "0.5677389", "0.5655111", "0.56530195", "0.5634797...
0.694582
0
Returns the product 'abc' for a pythagorean triple (a^2 + b^2 = c^2) whose sum a+b+c is equal to the given number. Utilizes Euclid's formula.
def find_pythagorean_triple_product(num): m = 2 n = 1 while True: a = m ** 2 - n ** 2 b = 2 * m * n c = m ** 2 + n ** 2 if a ** 2 + b ** 2 == c ** 2 and a + b + c == num: return a * b * c else: m += 1 if m >= num: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_pythagorean_triplet(N):\n\tfor a in range(0,N):\n\t\tfor b in range(a+1,N):\n\t\t\tfor c in range(b+1,N):\n\t\t\t\tif a+b+c == 1000 and is_pythagorean_triplet(a,b,c):\n\t\t\t\t\treturn a*b*c\n\treturn \"N too small\"", "def product1(a, b, c) :\n return a * b * c", "def nine():\r\n \r\n a =...
[ "0.6650262", "0.6598621", "0.6506206", "0.642716", "0.633817", "0.633817", "0.62214804", "0.62109685", "0.60733694", "0.6063541", "0.60557306", "0.60468155", "0.6007859", "0.6002839", "0.5995274", "0.5953455", "0.5953455", "0.5928577", "0.5911845", "0.58982366", "0.58903277",...
0.7518107
0
Creates a string list with the devices type to test the source code. CUDA devices will be test only in case the current hardware supports it.
def get_test_devices(): devices = ["cpu"] if torch.cuda.is_available(): devices.append("cuda") return devices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_test_devices():\n\n # Assumption: CPU is always available\n devices = ['cpu']\n\n if torch.cuda.is_available():\n devices.append('cuda')\n\n return devices", "def _get_device_list(self):\n if self.app.config.cloud_type == 'ec2':\n # c5/m5 on AWS mounts EBS volumes as ...
[ "0.7328727", "0.6380837", "0.63609934", "0.610601", "0.6104033", "0.6104033", "0.60989046", "0.6091093", "0.6062906", "0.6032046", "0.60173154", "0.6013383", "0.5992261", "0.5990151", "0.5924036", "0.5923588", "0.58618355", "0.58598804", "0.58459705", "0.5845135", "0.5832014"...
0.72319925
1
Search for existing Service Catalog Provisioned Products. If it's not found then will search for any inprogress deployments since Control Tower has a serial method of deploying accounts.
def search_provisioned_products(search_pp_name, client: boto3.client) -> dict: logger.info(f"Searching for {search_pp_name}") response = client.search_provisioned_products( AccessLevelFilter={ 'Key': 'Account', 'Value': 'self' }, Filters={ 'SearchQuery...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan_provisioned_products(search_pp_name, client: boto3.client) -> dict:\n logger.info('Making sure Control Tower is not already executing')\n paginator = client.get_paginator(\"scan_provisioned_products\")\n for page in paginator.paginate(\n AccessLevelFilter={\n 'Key': 'Acc...
[ "0.7160304", "0.5986171", "0.5977867", "0.5391701", "0.53883964", "0.53183687", "0.5263458", "0.52195495", "0.5137301", "0.5083074", "0.504988", "0.503884", "0.5022518", "0.50006783", "0.48638386", "0.48609245", "0.48583177", "0.48581347", "0.4857908", "0.48564598", "0.484577...
0.7295413
0
Retrieve the Default Service Catalog Provisioning Artifact Id from the Service Catalog Product specified in the definition call.
def get_provisioning_artifact_id(product_name: str, client: boto3.client) -> str: product_info = client.describe_product( Name=product_name ) logger.info(product_info) for _product_info in product_info['ProvisioningArtifacts']: if _product_info['Guidance'] == 'DEFAULT': logg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_resource_discovery_association_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"default_resource_discovery_association_id\")", "def get_product_id(self, field_name='PRODUCT_ID'):\n return self.get_default(field_name)", "def default_resource_discovery_id(self) -> pulumi.Outp...
[ "0.62677944", "0.6110953", "0.5900704", "0.56286764", "0.55779773", "0.55494344", "0.5543497", "0.5379514", "0.53641295", "0.5290732", "0.5174435", "0.51636326", "0.51466084", "0.5116483", "0.5071252", "0.5062847", "0.50372", "0.50372", "0.50372", "0.50372", "0.50332355", "...
0.7186167
0
Build an op used as a target for return values at given quantiles.
def _build_target_quantile_values_op(self): batch_size = tf.shape(self._replay.rewards)[0] ###### Munchausen-specific replay_action_one_hot = tf.one_hot( self._replay.actions, self.num_actions, 1., 0., name='action_one_hot') # tau * ln pi_k+1 (s') replay_next_log_policy = utils.stable_scaled...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_train_op(self):\n batch_size = tf.shape(self._replay.rewards)[0]\n\n target_quantile_values = tf.stop_gradient(\n self._build_target_quantile_values_op())\n # Reshape to self.num_tau_prime_samples x batch_size x 1 since this is\n # the manner in which the target_quantile_values are ti...
[ "0.5792982", "0.5327944", "0.51979405", "0.51626", "0.5160351", "0.5001683", "0.4997703", "0.49878305", "0.49823052", "0.49398604", "0.48812854", "0.48698434", "0.4853174", "0.4833269", "0.48265964", "0.47628295", "0.47479182", "0.47349328", "0.47272837", "0.4723074", "0.4720...
0.6132188
0
Returns a new fox instance. Expects a gender (true=male) and a location
def create_fox(a_male,a_location): fox = None if a_male: fox = Fox() else: fox = Vixen() fox.location = a_location return fox
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def person_object_factory():\n person = {\n 'lastName': rl_fake().last_name(),\n 'gender': random.choice(('M', 'F'))\n }\n\n # Make the person's name match their gender.\n person['firstName'] = rl_fake().first_name_male() if person['gender'] == 'M' else rl_fake().first_name_female()\n\n ...
[ "0.5613212", "0.5395922", "0.5308169", "0.5271084", "0.5211801", "0.5208754", "0.5162016", "0.51154745", "0.5076069", "0.5022176", "0.50201225", "0.50070053", "0.5006258", "0.5003537", "0.49931666", "0.49746263", "0.49349275", "0.4879405", "0.4857509", "0.48508057", "0.482383...
0.77177227
0
Splits a daterange in even buckets
def _split_date_range(start, end, intv): previous = start diff = (end - start) / intv for i in range(1, intv): current = start + diff * i yield (previous, current) previous = current yield (previous, end)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_split_ranges(self):\n start = datetime.utcnow() - pd.Timedelta(\"5H\")\n end = datetime.utcnow() + pd.Timedelta(\"5min\")\n delta = pd.Timedelta(\"1H\")\n\n ranges = QueryProvider._calc_split_ranges(start, end, delta)\n self.assertEqual(len(ranges), 5)\n self.asse...
[ "0.70844066", "0.6660324", "0.65962434", "0.63845986", "0.63150877", "0.624241", "0.6117686", "0.61104435", "0.6062371", "0.603898", "0.59842044", "0.5892017", "0.58731925", "0.58605164", "0.5858732", "0.5845585", "0.5840416", "0.58369154", "0.5805926", "0.5704877", "0.568080...
0.7247785
0
RPC request to subscribe to specific type of transactions
def subscribe(self, topic_type, tx_filter=None): request = protos.RequestSubscribe(type=topic_type, filter=tx_filter) res = self.stub.subscribe(request) for r in res: yield r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe(self, namespace, sub_strings=None):\n req = JSONRPCRequest('subscribe', [namespace, sub_strings])\n result = yield self._send(req)\n self._cache_jsonrpc_request(req)\n raise tornado.gen.Return(result)", "def subscribe(self, req: SubscribeRequest) -> None:\n if sel...
[ "0.64912724", "0.63196254", "0.63196254", "0.6257161", "0.6257161", "0.6257161", "0.6179839", "0.61468124", "0.5952488", "0.5937249", "0.57590926", "0.57590926", "0.57562625", "0.57485455", "0.5745518", "0.5726276", "0.572594", "0.5714911", "0.57020134", "0.563073", "0.562365...
0.6478053
1
close the file handler
def close(self) -> None: if self.file_handler: self.file_handler.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _close(self):\n self.fh.close()", "def close_file_handle(self):\n if self.file_handle and self.output_file:\n self.file_handle.close()", "def close_file(self):\r\n self.file.close()", "def close(self):\r\n self._fp.close()", "def close(self):\n self.fileobj.close...
[ "0.80638564", "0.7899277", "0.76776", "0.7598503", "0.759643", "0.759643", "0.7555477", "0.7555477", "0.75353223", "0.75353223", "0.7534309", "0.74882436", "0.746249", "0.74507326", "0.74417937", "0.7408353", "0.74020976", "0.7385599", "0.7385599", "0.7360604", "0.73488915", ...
0.8375519
0
return the client name given a subversion string
def subverParseClient(s): return s[1:].split(":")[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_client_ctx_t_client_name_get(svn_client_ctx_t_self): # real signature unknown; restored from __doc__\n return \"\"", "def get_client_name(self, obj):\n\t\treturn obj.client.name", "def get_client_name(self, client):\n info = self.clientmap[client]\n host, name = info[0][0], info[1]\n ...
[ "0.7523611", "0.666468", "0.61638457", "0.598154", "0.5943123", "0.58753544", "0.5852146", "0.57407033", "0.57030475", "0.56988454", "0.56832063", "0.5635375", "0.5635375", "0.5609268", "0.552585", "0.5525318", "0.54745305", "0.54636943", "0.5447733", "0.54427", "0.54276645",...
0.7026395
1
Verify that every passed node is interconnected with all the other clients
def verifyInterconnect(nodes, clientTypes=clientSubvers): for n in nodes: connectedTo = set() myclient = subverParseClient(n.getnetworkinfo()["subversion"]) pi = n.getpeerinfo() for p in pi: connectedTo.add(subverParseClient(p["subver"])) notConnectedTo = clientT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection_is_established(self):\n assert self.connection_node_1.is_connected is True\n assert self.connection_node_2.is_connected is True\n assert self.connection_client_1.is_connected is True\n assert self.connection_client_2.is_connected is True", "def checkonly(self):\n ...
[ "0.68466765", "0.6563393", "0.6492229", "0.64650893", "0.6449981", "0.6430157", "0.6389443", "0.6318689", "0.63007426", "0.6234157", "0.6223971", "0.61432195", "0.6124322", "0.61007655", "0.6083266", "0.60621226", "0.6053421", "0.6053421", "0.6020111", "0.59973615", "0.597762...
0.77593154
0
Check if a cookie is expired.
def is_cookie_expired(cookie_name): if cookie_name: expires = int timestamp = int(time.time()) for cookie in __request_session.cookies: if cookie.name == cookie_name: expires = cookie.expires else: return None if timestamp > exp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cookie_expired(cookie):\n now = int(round(time() * 1000))\n expire = cookie[u't']\n return now > expire", "def expired(self):\n return int(time.time()) > self.expires_at", "def has_expired(self):\n self.ensure_one()\n return datetime.now() > fields.Datetime.from_string(self...
[ "0.8836514", "0.77920187", "0.77391326", "0.7730929", "0.7603923", "0.7591796", "0.75569636", "0.75034326", "0.7462581", "0.7440906", "0.7415246", "0.736596", "0.7357847", "0.73257196", "0.7270349", "0.72035724", "0.7195444", "0.7123442", "0.70624334", "0.6997034", "0.6988297...
0.8001271
1
Check a cookie by name to see if it exist.
def has_cookie(cookie_name): if cookie_name in __request_session.cookies: log.debug('cookie found: %s' % __request_session.cookies[cookie_name]) return __request_session.cookies[cookie_name] log.debug('no cookie named: %s found.' % cookie_name) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_cookie(self, name, domain):\n for cookie in self._cookiejar:\n if cookie.name == name and cookie.domain == domain:\n if cookie.is_expired():\n break\n return cookie", "def driver_has_cookie(self, cookie_name, timeout=3):\n try:\n ...
[ "0.7101593", "0.7086198", "0.6647389", "0.6630075", "0.6630075", "0.6610906", "0.6543777", "0.6334645", "0.62841827", "0.61255693", "0.5999913", "0.5945455", "0.5881533", "0.5805246", "0.5785581", "0.576895", "0.575548", "0.575548", "0.57039577", "0.56893706", "0.5664889", ...
0.74513674
0
Load a genbank file as a Biopython object.
def load_genbank(path): with open(path, 'r') as fd: try: genbank = SeqIO.read(fd, 'genbank') except Exception as err: raise Exception(path + '\t' + str(err)) return genbank
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_genbank(cls, filename):\n\t\tseq_record = SeqIO.read(filename, 'genbank')\n\t\trec = cls(seq_record=seq_record)\n\t\treturn rec", "def readGBK(filename):\r\n gnome_record = SeqIO.read(filename, \"genbank\")\r\n return gnome_record", "def read_genbank(genome_accession_no, genbank_file=None):\n ...
[ "0.74134886", "0.67536664", "0.673955", "0.645511", "0.6367303", "0.61472815", "0.6139651", "0.60025644", "0.5941233", "0.5793891", "0.5757002", "0.57405365", "0.5613736", "0.5606458", "0.55976534", "0.55834764", "0.55792767", "0.5574212", "0.5572035", "0.5569845", "0.5569083...
0.7991978
0
Generate all import files for a given genbank file path to an output_dir. Will produce CSV files for each collection (filename = collection name)
def generate_genome_import_files(genbank_path, output_dir): genbank = load_genbank(genbank_path) genome_path = os.path.join(output_dir, _genome_vert_name + '.json') write_import_file(generate_genome(genbank), genome_path) gene_path = os.path.join(output_dir, genbank.id, _gene_vert_name + '.json') wr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_file(some_genbank, collection):\n with open(some_genbank, 'r') as open_file:\n collection = kv.get_collection(collection)\n\n # Each \"record\" in genbank file is read, corresponds to individual contigs\n for record in SeqIO.parse(open_file, 'gb'):\n current_contig = r...
[ "0.5798412", "0.57970154", "0.57526034", "0.5752054", "0.5739597", "0.5733188", "0.5693836", "0.5582578", "0.55606", "0.55546856", "0.5545329", "0.5531751", "0.55185336", "0.55129224", "0.5498727", "0.5498189", "0.54929864", "0.5453699", "0.54207224", "0.54065645", "0.5396418...
0.76203096
0
Generate gene rows for every feature in a genbank object.
def generate_genes(genbank): for (idx, feature) in enumerate(genbank.features): if feature.type == 'source' or feature.type == 'gene': continue row = { 'location_start': feature.location.start, 'location_end': feature.location.end, 'strand': feature.st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_genome(genbank):\n row = {\n '_key': genbank.id,\n 'name': genbank.name,\n 'description': genbank.description,\n 'molecule_type': genbank.annotations.get('molecule_type', ''),\n 'topology': genbank.annotations.get('topology', ''),\n 'data_file_division': ge...
[ "0.65353125", "0.6407948", "0.6181564", "0.6134817", "0.6083009", "0.6072681", "0.5995177", "0.5953996", "0.58472127", "0.5838847", "0.5811208", "0.5793491", "0.575938", "0.575097", "0.568226", "0.5674407", "0.5673749", "0.56730604", "0.56158006", "0.56121176", "0.5607535", ...
0.8024798
0
Generate genetogenome edges for every feature in a genbank object.
def generate_gene_edges(genbank): genome_key = genbank.id genome_id = _genome_vert_name + '/' + genome_key for (idx, feature) in enumerate(genbank.features): # Skip the 'source' feature, which describes the entire genome if feature.type == 'source' or 'locus_tag' not in feature.qualifiers: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_genes(genbank):\n for (idx, feature) in enumerate(genbank.features):\n if feature.type == 'source' or feature.type == 'gene':\n continue\n row = {\n 'location_start': feature.location.start,\n 'location_end': feature.location.end,\n 'strand'...
[ "0.69899094", "0.61919343", "0.61718875", "0.58896923", "0.5833681", "0.5817742", "0.57499737", "0.57238543", "0.5720613", "0.57019067", "0.5695498", "0.56385654", "0.5601511", "0.558328", "0.55295444", "0.550557", "0.5473217", "0.54718006", "0.5461635", "0.5460057", "0.54591...
0.77022773
0
Given a permutation of {0,1,...,n1} return the 2^n by 2^n permuation matrix representing the permutation of qubits (bigendian convention).
def lift_perm(p: Dict[int, int]) -> np.ndarray: n = len(p) pm = np.zeros((1 << n, 1 << n), dtype=complex) for i in range(1 << n): j = 0 mask = 1 << n for q in range(n): mask >>= 1 if (i & mask) != 0: j |= 1 << (n - 1 - p[q]) pm[j][i] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makePermutationMatrix(permList):\n permList = scipy.array(permList)\n n = len(permList)\n if 0 not in permList:\n permList = permList - 1\n permMat = scipy.zeros((n,n),'d')\n for ii, jj in enumerate(permList):\n permMat[ii,jj] = 1.\n return scipy.transpose(permMat)", "def bitr...
[ "0.6811559", "0.65865314", "0.6399813", "0.63301665", "0.631787", "0.6282494", "0.6277264", "0.61535066", "0.61456126", "0.6065182", "0.60574985", "0.60513324", "0.5965659", "0.59486353", "0.59402007", "0.59321636", "0.59311527", "0.5897101", "0.5897032", "0.58776504", "0.587...
0.66230685
1
Translate tk1 to a RzRxRz so AerUnitaryBackend can simulate
def _tk1_to_rotations(a: float, b: float, c: float) -> Circuit: circ = Circuit(1) circ.Rz(c, 0).Rx(b, 0).Rz(a, 0) return circ
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_controls(self):\n\n\n controls_keypress_QWERTY = {\n 'w': lambda: self.set_speed(\"pitch\", self.def_speed[\"pitch\"]),\n 's': lambda: self.set_speed(\"pitch\", -self.def_speed[\"pitch\"]),\n 'a': lambda: self.set_speed(\"roll\", -self.def_speed[\"roll\"]),\n ...
[ "0.5091354", "0.48640856", "0.4863087", "0.4839665", "0.4798844", "0.4759309", "0.47126836", "0.47027948", "0.4693687", "0.4687498", "0.46860364", "0.4680407", "0.4671953", "0.46660995", "0.46642715", "0.4631289", "0.46038824", "0.46022075", "0.45926744", "0.4587362", "0.4554...
0.52568376
0
Report the result of an authentication request This endpoint returns the result of the request made in the '/auth/zenkeyasyncsignin' endpoint, identified by auth_req_id. If the request was successful, then the server makes and returns a token which can be used as to authorize API calls. It must be included in an Author...
def async_token_result(auth_req_id): # create a new user based on auth request so that each auth request returns a different token new_user_params = { 'zenkey_sub': auth_req_id, 'name': 'Mock User', 'phone_number': '+15555555555', 'postal_code': '55555', 'email': 'mockus...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticated_request(**kwargs):\n return authenticated_request_async(**kwargs).get_result()", "def auth_complete(self, *args, **kwargs):\n request_data = self.strategy.request_data()\n\n sso_params = request_data.get(\"sso\")\n sso_signature = request_data.get(\"sig\")\n\n param...
[ "0.62605786", "0.6203439", "0.60911304", "0.6047729", "0.59584135", "0.5940721", "0.5940721", "0.5912063", "0.59063685", "0.5894196", "0.5864419", "0.58414835", "0.58228904", "0.5785015", "0.5781725", "0.57685417", "0.5760979", "0.5752778", "0.57499754", "0.5749469", "0.57336...
0.6753446
0
Retry an authentication request This endpoint retries the request made in the '/auth/zenkeyasyncsignin' endpoint, identified by auth_req_id, and has the same return value.
def async_token_retry(auth_req_id): return jsonify({'auth_req_id': auth_req_id})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retry_request(\n self,\n tapi_exception,\n error_message,\n repeat_number,\n response,\n request_kwargs,\n api_params,\n **kwargs\n ):\n return False", "async def _retry_get(url: str, retries: int, **kwargs):\r\n retries -= 1\r\n ...
[ "0.6041712", "0.5856318", "0.5761647", "0.5758948", "0.5676299", "0.5676299", "0.5544573", "0.5448385", "0.5387163", "0.5387163", "0.5383666", "0.53787154", "0.53494453", "0.53354377", "0.52876604", "0.528456", "0.52109355", "0.5199061", "0.5176951", "0.5176951", "0.51569957"...
0.7038709
0
Cancel an authentication request This endpoint cancels the request made in the '/auth/zenkeyasyncsignin' endpoint, identified by auth_req_id, and just returns a status, 200 if successful.
def async_token_cancel(auth_req_id): #pylint: disable=unused-argument return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nexmo_cancel(request):\n state = request.validated[\"querystring\"][\"state\"]\n\n # Require on-going session\n state_info = request.registry.cache.get(state)\n\n if not state_info:\n error_msg = \"The Nexmo session was not found, please re-authenticate.\"\n return http_error(\n ...
[ "0.62335056", "0.580511", "0.5616215", "0.5513265", "0.548557", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0.5480032", "0...
0.6933732
0
Grant token request This endpoint grants the token request made in the '/auth/zenkeyasyncsignin' endpoint, identified by auth_req_id, and has the same return value. The ZenKey carrier hits this endpoint
def async_token_grant(): required_params = ['auth_req_id', 'state', 'scope'] optional_params = ['access_token', 'expires_in', 'refresh_token', 'id_token', 'error', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def async_token_request():\n required_params = ['login_hint',\n 'client_id',\n 'scope',\n 'mccmnc',\n 'redirect_uri']\n optional_params = ['correlation_id']\n validated_params = validate_params(request, required_params...
[ "0.6658314", "0.63655144", "0.609516", "0.60386145", "0.6004609", "0.5970912", "0.5961136", "0.5922673", "0.59126514", "0.5911629", "0.5882935", "0.5847808", "0.5799271", "0.57977325", "0.56687057", "0.5584188", "0.55664384", "0.55645496", "0.5562488", "0.55596745", "0.554770...
0.68695843
0
The construction method of the page passes the page's implemented entityBlocks attribute to the Template base class construction , or the optional entityBlocks Parameter.
def __init__(self, entityBlocks): Template.__init__(self, entityBlocks)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, entityBlocks=None):\n\t\tif entityBlocks:\n\t\t\tself.entityBlocks = entityBlocks\n\t\tTemplate.__init__(self, self.entityBlocks)", "def __init__(self,**kwargs):\n Element.__init__(self,**kwargs)\n self.setVars(['entity'],**kwargs)", "def __init__(self, template_content, sectio...
[ "0.8255997", "0.6097554", "0.574299", "0.56744987", "0.5653919", "0.5599532", "0.55128586", "0.5449456", "0.5448524", "0.54456073", "0.53858835", "0.53586984", "0.52999777", "0.5286158", "0.527467", "0.52528787", "0.5189372", "0.5186057", "0.5185921", "0.5180944", "0.51229626...
0.8411368
0
Terminate the server process
def terminate(self): if self.proc: logging.info("Terminating Proxy Server...") self.proc.terminate() self.proc = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terminate(self):\n print('Terminating Revshell thread.')\n self.server.close()", "def stop():\n global server_handle\n server_handle.kill()\n server_handle = None", "def exit(self):\n self.tcp_server_exit_event.set()\n for _, process in self.name_to_process.items():\n ...
[ "0.7887827", "0.7732045", "0.75751805", "0.74291086", "0.74241346", "0.7410972", "0.73573947", "0.7319716", "0.72791415", "0.7265624", "0.725529", "0.7247277", "0.7217128", "0.72014165", "0.71880674", "0.7184858", "0.71616644", "0.71488863", "0.7148135", "0.7137019", "0.70648...
0.77705073
1
Create a RPC server that uses an websocket that connects to a proxy.
def websocket_proxy_server(url, key=""): def create_on_message(conn): def _fsend(data): data = bytes(data) conn.write_message(data, binary=True) return len(data) on_message = rpc._CreateEventDrivenServer(_fsend, "WebSocketProxyServer") return on_message ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_server(request):\n def build(handler, host=\"localhost\", port=None, *, loop=None):\n loop = loop or asyncio.get_event_loop()\n port = port or get_next_port(host)\n\n server = serve(handler, host, port, klass=WebSocket, loop=loop)\n server = loop.run_until_complete(server)...
[ "0.6948238", "0.6761193", "0.6707289", "0.66721493", "0.65216213", "0.64277166", "0.6424164", "0.63957137", "0.6342866", "0.63294774", "0.6319867", "0.62677985", "0.6209199", "0.61780703", "0.61010545", "0.609926", "0.6053257", "0.6047363", "0.6036524", "0.6031591", "0.601818...
0.74283665
0
Initializes the embeddings, depending on the embedding type.
def _initialize_embeddings(self): with tf.variable_scope(self.scope): init_temporal_s = np.sqrt( 6. / (self._config.nact_dict["num_s"] + self._config.ndim_emb + 1)) self.w_dt = tf.get_variable( name="w_dt", shape=[1, self._config.ndim_emb], initializer=tf.initial...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self, preload_embeddings):\n\t\tself.__find_metadata()\n\t\tself.__parse_embedding_metadata()\n\t\tself.__parse_model_metadata()\n\t\t# should we load all of the word embeddings into memory now?\n\t\tif preload_embeddings:\n\t\t\tlog.info(\"Preloading word embeddings ...\")\n\t\t\tfor embed_id in self.emb...
[ "0.7415511", "0.7169483", "0.69956625", "0.67939156", "0.6730466", "0.67063075", "0.6464072", "0.641942", "0.63999146", "0.62024164", "0.61996436", "0.6125713", "0.6099087", "0.6088853", "0.607822", "0.60730416", "0.605379", "0.6051636", "0.6051552", "0.6016388", "0.5989231",...
0.7428394
0
Gets the total expected size of the embedding.
def get_total_embedding_size(self) -> Union[int, List[int]]: features = self._config.context_features + self._config.sequential_features feature_dims = [self._embed_dim_dict[feat] for feat in features] if self._config.embedding_combination_method == ( types.EmbeddingCombinationMethod.SUM_ALL): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_size(self) -> int:\n total_size = 0\n for entry in self.__entries:\n total_size += entry.get_size()\n return total_size", "def get_final_emb_size(self):\n size = self.n_layers * 1 * 2 * self.hidden_size\n return size", "def _input_size(self):\n retur...
[ "0.72786283", "0.726968", "0.7224457", "0.71614337", "0.7145755", "0.7144727", "0.71412814", "0.71291584", "0.7115016", "0.71070266", "0.7092374", "0.7082026", "0.7068235", "0.7061945", "0.7058983", "0.7046681", "0.7035419", "0.7003102", "0.7002194", "0.698089", "0.69800216",...
0.72793114
0
Embeds data dictionary and creates inputs to temporal model.
def embed_data( self, data: Dict[str, tf.SparseTensor] ) -> Tuple[tf.Tensor, tf.Tensor]: batch_shape = tf.shape(data["t"])[:-1] flat_data = nest.map_structure(batches.flatten_batch, data) flat_data = nest.map_structure(batches.sparse_fill_empty_rows, flat_data) context_embeddings = (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_embed_itmes(data):\n for k, v in data.items() :\n embed.add_embed_field(name=k, value=v)", "def emb_experiment():\n print(\"EMBEDDINGS EXPERIMENT\")\n\n # set the name of the experiment\n now = datetime.datetime.now()\n experiment_id = str(now.day) + \"_\" + str(now.month) + \"_\" +...
[ "0.56800663", "0.55806065", "0.5433915", "0.5323284", "0.5315226", "0.5314329", "0.52291834", "0.5220039", "0.5213521", "0.5192599", "0.518687", "0.51661015", "0.51657164", "0.5155179", "0.5129116", "0.50947684", "0.50538045", "0.5042975", "0.50393456", "0.5035438", "0.499796...
0.5893568
0
Gets the regularization loss for embedding weights.
def get_embedding_regularization_loss(self) -> tf.Tensor: sparse_lookup_regularization = self._config.sparse_lookup_regularization sparse_lookup_regularization_weight = ( self._config.sparse_lookup_regularization_weight) encoder_regularization = self._config.encoder_regularization encoder_regula...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regularization_loss(embedding, lambda_coef, regularization_type='msq'):\n loss = tf.constant(0.0, dtype=tf.float32)\n if regularization_type == 'msq':\n loss = tf.reduce_mean(tf.square(tf.norm(embedding, axis=1))) * 0.5\n elif regularization_type == 'unit_length':\n loss = tf.reduce_mean(tf.abs(tf.squ...
[ "0.6920596", "0.65842164", "0.6542781", "0.6534144", "0.6424401", "0.63727957", "0.6351934", "0.63452446", "0.63420784", "0.6311684", "0.63035953", "0.6266828", "0.6257979", "0.62567496", "0.624748", "0.6185578", "0.6178956", "0.6168068", "0.6154505", "0.614846", "0.61013037"...
0.7138567
0
Combines embeddings into one input for the model. The embeddings can be combined in different ways and this function encapsulates that logic and returns an input vector based on the combination method that is specified.
def _combine_embeddings_for_input( self, embedding_dict: Dict[str, int]) -> tf.Tensor: if self._config.embedding_combination_method == ( types.EmbeddingCombinationMethod.SUM_ALL): return sum(embedding_dict.values()) elif self._config.embedding_combination_method == ( types.EmbeddingC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(self, x, *args, **kwargs):\n with tf.name_scope(\"embedding\"):\n # fills out of bound values with padding symbol\n out_bound_mask = tf.cast(x > (self.vocab_size - 1), dtype=tf.int32)\n x *= 1 - out_bound_mask\n x += out_bound_mask * tf.cast(self.pad_sym,...
[ "0.5955232", "0.58174616", "0.58171684", "0.57225627", "0.56999433", "0.5671518", "0.5625221", "0.55981785", "0.55981785", "0.5576363", "0.5552107", "0.55190223", "0.545595", "0.5426745", "0.53774136", "0.5334926", "0.5326682", "0.5315223", "0.5301722", "0.5273913", "0.527373...
0.7343154
0
Gets the suffix of a feature from its name.
def get_feature_suffix(feature_name: str) -> str: if "_" not in feature_name: return "" return feature_name.split("_")[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suffix(self):\n return self[\"suffix\"]", "def suffix(self):\n return self[\"suffix\"]", "def suffix(self) -> typing.Optional[str]:\n return self._values.get('suffix')", "def suffix ( self ) :\n return self.__suffix", "def suffix ( self ) :\n return self.__suffix", ...
[ "0.71289575", "0.71289575", "0.69416517", "0.6781878", "0.6781878", "0.67778254", "0.67778254", "0.67778254", "0.65710884", "0.6557411", "0.64998925", "0.6475674", "0.63860905", "0.63544905", "0.63543004", "0.62719065", "0.6252688", "0.6237147", "0.62303", "0.6210002", "0.620...
0.87202376
0
In the CoAP client read method, different exceptions can arise from the DTLS stack. Depending on the type of exception, a continuation might not be possible, or a logging might be desirable. With this callback both needs can be satisfied.
def _cb_ignore_read_exception(self, exception, client): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cb_ignore_read_exception(self, exception, client):\n return False", "def test_wantReadError(self):\n ctx = Context(SSLv23_METHOD)\n conn = Connection(ctx, None)\n with pytest.raises(WantReadError):\n conn.bio_read(1024)", "def _cb_ignore_listen_exception(self, exception, s...
[ "0.66514987", "0.5624444", "0.55150366", "0.54504734", "0.53648037", "0.5351862", "0.5241772", "0.5215485", "0.5212549", "0.51477045", "0.514248", "0.51263565", "0.5021402", "0.49990284", "0.49652463", "0.49529836", "0.49523494", "0.4938335", "0.49164072", "0.49018252", "0.48...
0.66081977
1
In the CoAP client write method, different exceptions can arise from the DTLS stack. Depending on the type of exception, a continuation might not be possible, or a logging might be desirable. With this callback both needs can be satisfied.
def _cb_ignore_write_exception(self, exception, client): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cb_ignore_write_exception(self, exception, client):\n return False", "def failure(self, cb: CircuitBreaker, exc: BaseException) -> None:", "def _callback_error_handler(exception, exc_value, tb):\n # From cffi docs: \"First check if traceback is not None (it is None e.g.\n # if the whole function ra...
[ "0.6399046", "0.56971824", "0.5395722", "0.5373552", "0.52277315", "0.5194488", "0.51759434", "0.5153259", "0.51442254", "0.5128307", "0.51009566", "0.50440973", "0.50042504", "0.4984776", "0.49645448", "0.49513006", "0.49485222", "0.49382952", "0.48677444", "0.48533612", "0....
0.63898355
1
Set current sensors values+10% as the comparison baseline for trigger
def set_sensor_baseline(self, sensor_data=None): cont = self.continuous(sensor_data) for idx,val in enumerate(cont): self.thresholds[idx][0] = val*1.1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getBaselineThresh(self):\n print('Calculating 10% baseline')\n self.baseline = obrienBaseline.obrienBaseline(\n self.d['dos1rate'], timeWidth=5.0, \n cadence=0.1)\n self.peak_std = ( (self.d['dos1rate'][self.peakInd]/10 - \n ...
[ "0.6339183", "0.62632155", "0.6128972", "0.5886148", "0.5862159", "0.58352584", "0.57543653", "0.5740762", "0.56626266", "0.5647609", "0.56101316", "0.55523014", "0.5543149", "0.5527939", "0.55186856", "0.5512248", "0.55031335", "0.5467484", "0.5460671", "0.5455734", "0.54495...
0.73394936
0
Test that you are able to retrieve a list of all users ranked by win percentage
def test_get_user_rankings(self): user = User(name=u'no win', email=u'generic@thingy.com') user.put() userone = User(name=u'one win', email=u'generic@thingy.com', total_played=1, wins=1) userone.put() usertwo = User(name=u'two wins', email=u'generic@thingy.com',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_rankings(self, request):\n users = User.query(User.total_games > 0).fetch()\n users = sorted(users, key=lambda x: x.win_percentage, reverse=True)\n return UserForms(items=[user.to_form() for user in users])", "def testHighscore(self):\n \n game = Game.objects.get(t...
[ "0.6441626", "0.6410253", "0.63942116", "0.6246523", "0.6229379", "0.61177903", "0.609688", "0.60868376", "0.6083801", "0.6032084", "0.5962515", "0.59496826", "0.5942009", "0.58788043", "0.5840735", "0.58205724", "0.57919294", "0.57524", "0.5742837", "0.5739226", "0.5737768",...
0.71827596
0
General Gaussian elimination. Solve Av = b, for `v`. `A` is a square matrix with dimensions (n,n) and `b` has dim (n,)
def gaussian_elimination(A, b): n = len(b) # Join A and b ab = np.c_[A,b] # Gaussian Elimination for i in range(n-1): if ab[i,i] == 0: raise ZeroDivisionError('Zero value in matrix..') for j in range(i+1, n): ratio = ab[j,i] / ab[i,i] for k in ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_elimination(A, b):\n \n m, n = A.shape\n U = A.copy() \n b = b.copy()\n\n # forward sweep, reduce A to a upper triangular matrix\n for k in range(min(m, n)):\n swap = np.argmax(np.abs(U[k:, k])) + k\n if U[swap, k] == 0:\n raise ValueError('Singular matrix')\...
[ "0.72205275", "0.69978184", "0.6909211", "0.664306", "0.6558458", "0.647643", "0.64515245", "0.63309264", "0.62061775", "0.61396176", "0.6073213", "0.60224277", "0.6003381", "0.5858073", "0.58359253", "0.5735665", "0.5601619", "0.55769444", "0.5568682", "0.55639195", "0.55589...
0.7118353
1
Parses YAML document using filepath, returns dict.
def load(filePath): stream = open(filePath, 'r') yamlDict = yaml.safe_load(stream) return yamlDict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_yaml_file(filepath: str) -> Dict:\n return yaml.safe_load(read_file(filepath))", "def read_yaml(path: PathLike) -> Dict:\n with open(path, \"r\") as read_file:\n return yaml.load(read_file, Loader=yaml.UnsafeLoader)", "def load_yaml(path: str) -> Dict[str, Any]:\n with open(path, \"r\"...
[ "0.7903323", "0.7508515", "0.74972093", "0.74559927", "0.7386771", "0.736159", "0.735117", "0.72731614", "0.71901506", "0.71841854", "0.715368", "0.71515054", "0.70432895", "0.70343006", "0.6987099", "0.69750446", "0.6970174", "0.68350554", "0.68124586", "0.6810847", "0.67970...
0.7580855
1
Processes pyYAML output; resolves references and evaluates arithmetic expressions.
def process(yamlDict, subDict=None, path=[], first=True): if subDict is None: subDict = yamlDict.copy() for key, value in subDict.items(): if first: first = False path = path + [key] else: path[-1] = key if isinstance(value, dict): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n res = []\n\n all_lines = [l.strip() for l in sys.stdin]\n\n # Possibly the stats are empty? This can happen if nothing passes.\n if all_lines:\n\n assert all_lines[0] == \"General summary:\"\n\n res.append( [ all_lines[0].split(':')[0], [] ] )\n summary_bits = res[-1]...
[ "0.5250444", "0.50050116", "0.49924704", "0.49598306", "0.49067336", "0.48261368", "0.47995853", "0.4730459", "0.47279227", "0.47276902", "0.47207996", "0.4692445", "0.46897322", "0.46429425", "0.46355367", "0.4619667", "0.46165827", "0.4616196", "0.46019894", "0.45978037", "...
0.58088744
0
Methode getTestObjects gibt fuer das uebergebene GMLFile ein temporaeres TestObject zurueck.
def requestTestObjects(self, gmlFile: str) -> dict: jsonData = {} url = '%s%s' % (self.__urlWebApp, '/v2/TestObjects?action=upload') headers = {'Accept': 'application/json'} with open(gmlFile, 'rb') as f: files = {'file': f} r = requests.post(url, files=files...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_objects(self):\n\n obj = FBO(\n path=TEST_FILES_ROOT,\n metadata=FileObject.MetadataInFileHead,\n ).objects.all().filter(\n name__glob='*.rst',\n ).get(\n name='test2.rst',\n )\n\n self.assertEqual(\n 'Second in the ...
[ "0.63484746", "0.5927141", "0.58990014", "0.5834164", "0.57331353", "0.5705799", "0.5692242", "0.5691409", "0.56715447", "0.5653191", "0.56211764", "0.56167984", "0.56016", "0.5597074", "0.5571964", "0.55381674", "0.5530272", "0.5512248", "0.54992706", "0.5481464", "0.5473183...
0.6209419
1
Methode requestTestRunsProgress gibt true zurueck wenn der TestRun abgeschlossen ist.
def requestTestRunsProgress(self, testRunRef: str) -> bool: url = testRunRef.replace('.json', '/progress?pos=0') ist = 0; soll = 100 while ist < soll: time.sleep(8) r = requests.get(url, proxies=self.__proxies) if r.status_code == 200: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__progress_callback(self):\n backend = self.test_init_valid()\n\n fake_total_size = 500\n num_tests = 10\n progress = 0\n\n for i in range(num_tests):\n result = backend._progress_callback(i * fake_total_size/num_tests, fake_total_size)\n self.assert...
[ "0.65843594", "0.642197", "0.642197", "0.642197", "0.642197", "0.6393079", "0.6393079", "0.62220234", "0.6220406", "0.61894155", "0.6134013", "0.6066548", "0.5948006", "0.5948006", "0.59287864", "0.590314", "0.58682877", "0.58659166", "0.5864398", "0.5814855", "0.5802529", ...
0.7500514
0
Methode requestTestRunResults gibt das Ergebnis des TestRuns zurueck.
def requestTestRunResults(self, testRunRef: str) -> dict: jsonData = {} url = testRunRef r = requests.get(url, proxies=self.__proxies) if r.status_code == 200: jsonData = json.loads(r.text) else: message = '%s: %s' % (r.status_code, 'Test Run Resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTestResults():", "def test_get_results(self):\n pass", "def upload_test_run_results():\n if debug:\n print('[DEBUG] Func: upload_test_run_results...')\n\n if new_test_run_id == 0:\n print('[ERROR] new_test_run: id could not be found... ' + str(new_test_run_id))\n sys.ex...
[ "0.722702", "0.68538225", "0.6756852", "0.6595341", "0.6523461", "0.645256", "0.6393136", "0.6381202", "0.6372013", "0.6318589", "0.6318589", "0.630098", "0.6296187", "0.6266045", "0.62650174", "0.6251577", "0.6247649", "0.6194278", "0.6172445", "0.6065245", "0.60328704", "...
0.71555626
1
evaluates other metrics for the dataset
def __evaluate_other_metrics(dataset, m, y_act, y_pred): return evaluate_metric(y_act, y_pred, m, dataset.y_n_classes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_dataset_metrics(self):\n pass", "def evaluate(self, dataset):\n\t\tpass", "def compute_metrics(self):\n pass", "def __evaluate_metric(dataset, y_act, y_pred):\n if dataset.metric == 'specific':\n if dataset.best_is_min:\n return return_specific_metrics(y_act, ...
[ "0.7678181", "0.7512594", "0.7453756", "0.71230525", "0.68468404", "0.67882264", "0.677536", "0.67679405", "0.67434514", "0.67238873", "0.6684663", "0.66521555", "0.6645087", "0.66166586", "0.6613626", "0.66093993", "0.66065264", "0.65886134", "0.657816", "0.65687567", "0.656...
0.76998883
0
Strips the string value if and only if all the characters in the string are not " ".
def strip_if_not_blank(value): if any([i != " " for i in value]): return value.strip() return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_strip_string(self, i_str):\n return ''.join(e for e in i_str if e.isalnum())", "def filter(string):\n # remove all unwanted characters\n return regex2.sub(' ', string)", "def strip_string(input):\n return input.lower().replace(\" \", \"\")", "def _clean(self, string):\n return ...
[ "0.7316561", "0.7145191", "0.7046523", "0.7038135", "0.70192903", "0.69609845", "0.6947088", "0.6947088", "0.69281536", "0.69197446", "0.6914073", "0.690112", "0.6887776", "0.6860018", "0.683223", "0.6832113", "0.6808764", "0.6795601", "0.67919624", "0.677004", "0.6751491", ...
0.7467689
0
Safely joins an array of iterables together while preventing empty/null values from corrupting the final string spacing and allowing prefix/suffix values to be included for each element if the element is not null.
def space_join(*items): valid_items = [] for item in items: if item is None: continue if isinstance(item, tuple): if item[0] is None: continue stripped = strip_if_not_blank(item[0]) if not is_null(stripped): if len(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join(self, iterable) -> String:\n pass", "def join(self, iterable):\n result = ANSIString(\"\")\n last_item = None\n for item in iterable:\n if last_item is not None:\n result += self._raw_string\n if not isinstance(item, ANSIString):\n ...
[ "0.6982282", "0.69374067", "0.6928608", "0.68068033", "0.6782663", "0.64416945", "0.6399586", "0.6399031", "0.6292311", "0.6265237", "0.62498164", "0.62322575", "0.6216144", "0.6168476", "0.61541164", "0.6151066", "0.6119639", "0.61163634", "0.6109299", "0.607979", "0.6075018...
0.7044498
0
Given a child and a parent, tries to infer whether or not the child is an extension of the parent.
def extends_or_instance_of(child, parent): if isinstance(child, six.string_types): raise ValueError("The child cannot be of string type.") if isinstance(parent, six.string_types): if isinstance(child, type): bases = classlookup(child) return ( parent in [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_child(self, parent, child): # type: (str, str) -> bool\n return child != parent and child.startswith(parent + \".\")", "def isAncestorOf(ancestor, child):\n\twhile child is not None:\n\t\tif child is ancestor:\n\t\t\treturn True\n\t\tchild = child.parent()\n\treturn False", "def inherits_from(c...
[ "0.7233818", "0.633225", "0.6328605", "0.6110934", "0.6085241", "0.60491276", "0.6047496", "0.59858125", "0.59134716", "0.58713543", "0.5867895", "0.5824956", "0.5813192", "0.5767744", "0.5751257", "0.5695839", "0.5680158", "0.5635793", "0.5599923", "0.55797595", "0.55704015"...
0.75583863
0
Does a POST request to /accounts/viewaccount.{ResponseType}. Display Account Description
def create_view_account(self, options=dict()): # Validate required parameters self.validate_parameters(date = options.get("date")) # Prepare query URL _query_builder = Configuration.get_base_uri() _query_builder += '/accounts/viewaccount.{Res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_account_view_good(flask_server, create_account):\n import json\n import requests\n\n data = create_account\n\n req = requests.post('{}/account/view'.format(API_URL), data=data)\n assert req.status_code == 200\n assert json.loads(req.content.decode('utf-8')) == [data['name'], data['code']...
[ "0.5829913", "0.57385606", "0.57148266", "0.5661263", "0.56181955", "0.5576239", "0.55430156", "0.5522742", "0.54032105", "0.5379178", "0.53114665", "0.52346975", "0.52147704", "0.5186668", "0.5185481", "0.5180433", "0.51534367", "0.51526195", "0.5146171", "0.51339394", "0.51...
0.5999456
0
Build omega and weight for one quadrant.
def Build_quadrant(self) : self.omega = np.zeros((self.n_dir,3)) self.weight = np.zeros((self.n_dir)) if self.sn==2 : direction = 0.577350269189625764509149 weight = 1. self.omega[0,0] = direction self.omega[0,1] = direction self.omega[0,2] = direction self.weight...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_quad(self,mw,A0,A1,A2): \n return (A0 + A1 * mw + A2 * mw**2)", "def generate_quadrant_coordinates(self):\n qw = 1. # quadrant width\n Qc = np.array([[0, 0]])\n Qo = np.array([[-qw, -qw], [qw, qw], [qw, -qw], [-qw, qw]])\n Qstd = np.array([qw])\n if self.center...
[ "0.6052389", "0.5725959", "0.5695479", "0.5676664", "0.5578913", "0.5474302", "0.5401909", "0.5374855", "0.53578025", "0.5349752", "0.53495365", "0.5322237", "0.53042483", "0.5294827", "0.5287967", "0.52565825", "0.52493024", "0.5245003", "0.52133757", "0.5203506", "0.5176213...
0.74617565
0
Initializes a list of Log Levels
def init(cls, levels: List[str]) -> List[Level]: return [cls(lvl, val) for val, lvl in enumerate(levels)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_log_levels(self):\n for logger_name, level in self.named_levels.items():\n logger = logging.getLogger(logger_name)\n logger.setLevel(level)\n LOG.info(\"Set %s to use logging level %s\", logger_name, level)", "def test_level_values(self) -> None:\n self.a...
[ "0.6628986", "0.657911", "0.65455437", "0.64682525", "0.63555413", "0.62843335", "0.62470645", "0.61197793", "0.59739", "0.59739", "0.59739", "0.59697783", "0.59558034", "0.59521854", "0.59476656", "0.59133816", "0.58976674", "0.5889272", "0.58495504", "0.5845259", "0.5804432...
0.778308
0
Given a nonempty array of integers arr and an integer k, return the sum of the first k element that has at most two digits.
def add_elements(arr, k): return sum(elem for elem in arr[k] if len(str(elem)) <= 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twoSumLessThanK(nums, k):\n nums.sort()\n start = 0\n end = len(nums) - 1\n max_sum = -1\n while start < end:\n curr_sum = nums[start] + nums[end]\n if curr_sum < k:\n max_sum = max(curr_sum, max_sum)\n if curr_sum >= k:\n end -= 1\n else:\n ...
[ "0.7111014", "0.7106602", "0.6709087", "0.6570492", "0.65060997", "0.6502326", "0.64653206", "0.64385146", "0.6366034", "0.63578564", "0.63147587", "0.62667817", "0.6192361", "0.6190565", "0.6170776", "0.6143347", "0.61372757", "0.6136915", "0.61089677", "0.6067554", "0.60127...
0.7140078
0
_dqmHarvesting_ DQM Harvesting for RelVal MC production
def dqmHarvesting(self, datasetName, runNumber, globalTag, **args): options = defaultOptions options.scenario = "pp" options.step = "HARVESTING:validationHarvesting+dqmHarvesting" options.isMC = True options.isData = False options.beamspot = None options.eventcont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ADM_SM_QCD(nf):\n\n adm_qqp_qqp = np.array([[0, 0, 0, 0, 0, 12, 0, 0],\n [0, 0, 0, 0, 12, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 12],\n [0, 0, 0, 0, 0, 0, 12, 0],\n [0, 8/3, 0, 0, - 19/3, 5, 0, 0],\n ...
[ "0.5650388", "0.5577619", "0.55206364", "0.53261775", "0.53095275", "0.5304296", "0.5297168", "0.52906555", "0.52465874", "0.52195776", "0.51906115", "0.51801974", "0.51726836", "0.51407194", "0.5120269", "0.5100831", "0.5087694", "0.50870574", "0.5077208", "0.5037777", "0.50...
0.57871085
0
create polygon for corresponding mesh code
def create_polygon(meshcode): lat1,lon1 = ju.to_meshpoint(meshcode,0,0) lat2,lon2 = ju.to_meshpoint(meshcode,1,1) poly_text = 'POLYGON (('+str(lon1)+' '+str(lat1)+','+str(lon1)+' '+str(lat2)+','+str(lon2)+' '+str(lat2)+','+str(lon2)+' '+str(lat1)+','+str(lon1)+' '+str(lat1)+'))' return poly_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePolygons():", "def _createpoly(self):\n return self.cv.create_polygon((0, 0, 0, 0, 0, 0), fill=\"\", outline=\"\")", "def make_polygon(*coords):\n global GEOMETRY_SURF, POLYGONS,col\n if len(coords) < 3:\n print(\"Warning: Invalid polygon passed, ignoring...\")\n return\n...
[ "0.75163543", "0.69011664", "0.6727274", "0.66169375", "0.65865767", "0.65797776", "0.65755314", "0.6541206", "0.6536048", "0.65110767", "0.64228475", "0.6391254", "0.6383122", "0.637157", "0.63180137", "0.6238032", "0.6238032", "0.6224582", "0.61890024", "0.61714065", "0.609...
0.80410415
0
Downloads a new file and replaces the current
def downloadAndReplaceFile(file_path, download_url): file = urllib.request.urlopen(download_url) with open(file_path, 'wb') as output: output.write(file.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_url(self, new_url):\n self._download_url = new_url\n\n if not self.download_filename:\n lang_code = \"\"\n if self.language_code:\n lang_code = self.language_code\n self.download_filename = lang_code + \"_\" + new_url.split(\"/\")[-1]", "...
[ "0.675267", "0.6551912", "0.6546044", "0.65164804", "0.6515489", "0.6470142", "0.6406113", "0.6395002", "0.63866776", "0.6361258", "0.63526785", "0.63443387", "0.63276863", "0.63052297", "0.6251958", "0.6250347", "0.6234136", "0.6224093", "0.6222619", "0.6215353", "0.6196918"...
0.7659723
0
Check for updates by connecting to an endpoint which returns the latest versions
def checkForUpdates(self): url = self.config.get_conf("Client", "versions-url") try: self._logger.info("Checking for updates...") response = requests.get(url) if 200 <= response.status_code <= 300: data = response.json()[self.mission_name] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_updates(self):\n try:\n if not common.latest_version(version):\n self.update_notify()\n except:\n self.neterror()", "def check_for_updates():\n last_version = str(request.urlopen(__source__).read().decode(\"utf8\"))\n if str(open(__file__).read()...
[ "0.7504742", "0.69656986", "0.67726046", "0.6757253", "0.647151", "0.642298", "0.6343375", "0.63147825", "0.62722856", "0.6236601", "0.62349147", "0.62333035", "0.61005026", "0.60946906", "0.6091233", "0.60737616", "0.60723543", "0.60146767", "0.59970456", "0.5980403", "0.596...
0.7609964
0
Stores to new versions after updating
def updateVersions(self): f = open('../versions.pckl', 'wb') pickle.dump(self.versions, f) f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade(self):", "def upgrade(self):", "def save(self):\n self.updated_at = datetime.today()\n models.storage.save()", "def save(self):\n self.updated_at = datetime.today()\n models.storage.save()", "def save(self):\r\n self.updated_at = datetime.now()\r\n mode...
[ "0.7079501", "0.7079501", "0.6628957", "0.6628957", "0.6503125", "0.6460739", "0.645108", "0.645108", "0.645108", "0.6427714", "0.6370648", "0.63382095", "0.6315561", "0.6303461", "0.6257175", "0.6256316", "0.6255571", "0.6195385", "0.6195385", "0.6155903", "0.6142688", "0....
0.72113633
0
Updates the grafana.db fail to display updates dashboards
def updateGrafana(self, data): try: if "version" not in self.versions["grafana"] or self.mission_name + "_" + data["grafana"]["version"] != self.versions["grafana"]["version"]: downloadAndReplaceFile(self.config.get_conf("Client", "grafana-database"), data["grafana"]["link"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dashboards_v2_update(self):\n pass", "def test_update_dashboard(self):\n os.unlink(self.dboard._path)\n self.dboard.update_dashboard()\n self.assertTrue(os.path.isfile(self.dboard._path))", "def fix_db_stats(invalid_books, invalid_translations, invalid_subreddit):\n\t\n\tup...
[ "0.64582586", "0.5638242", "0.56262255", "0.5506757", "0.5482997", "0.5392161", "0.53738594", "0.531366", "0.52734226", "0.52485365", "0.52429175", "0.52428406", "0.5215931", "0.5211604", "0.52089715", "0.519161", "0.5191182", "0.5191182", "0.51782215", "0.51731366", "0.51674...
0.6387006
1
Updates the subsystems files to respond to changes in packet configuration
def updateSubSystems(self, data): current_subsystems_files = {} for subsystems_filename in self.versions["subsystems"]: current_subsystems_files[subsystems_filename] = self.versions["subsystems"][subsystems_filename] for subsystems_filename in data["subsystems"]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateconfig(self):\n\n # Initialize the yaml data\n ydata = {\"metadata\": self._metadata, \"nodes\": self._nodes}\n\n # Write the system config file\n filename = self._rootdir + self._metadata[\"system_config_file\"]\n with open(filename, \"w\") as yamlfile:\n ya...
[ "0.6238645", "0.5925609", "0.58945334", "0.58627445", "0.58171177", "0.56774724", "0.5671018", "0.54769933", "0.546279", "0.5458001", "0.5442244", "0.5416476", "0.53997326", "0.5390456", "0.53853697", "0.5376636", "0.5373165", "0.53604275", "0.5336013", "0.5318945", "0.530782...
0.7344193
0
Create a function that dispatches to dask for dask array inputs.
def _dask_or_eager_func(name, eager_module=np, list_of_args=False, n_array_args=1): if has_dask: def f(*args, **kwargs): dispatch_args = args[0] if list_of_args else args if any(isinstance(a, dsa.Array) for a in dispatch_args[:n_array_args]): module = dsa ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_input(f):\n @wraps(f)\n def wrapped(self, t):\n t = np.atleast_1d(t)\n r = f(self, t)\n return r\n return wrapped", "def gnumpy_func_wrap(f):\n def inner(*args):\n args = garray_to_cudandarray_nested(args)\n res = f(*args)\n if isinstance(res, list)...
[ "0.6345012", "0.5943624", "0.59142417", "0.5799531", "0.5785533", "0.5699175", "0.561758", "0.5583389", "0.55789495", "0.552335", "0.5488789", "0.5378587", "0.5335627", "0.53254235", "0.5319744", "0.52875775", "0.52390635", "0.5225205", "0.52230674", "0.5208402", "0.5199496",...
0.632499
1
Supply boundary conditions for an xarray.DataArray da according along the specified dimension. Returns a raw dask or numpy array, depending on the underlying data.
def _apply_boundary_condition(da, dim, left, boundary=None, fill_value=0.0): if boundary not in ["fill", "extend", "extrapolate"]: raise ValueError( "`boundary` must be 'fill', 'extend' or " "'extrapolate', not %r." % boundary ) axis_num = da.get_axis_num(dim) # th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_category_inside_boundary(self: Union[pd.DataFrame, pd.Series],\n boundary: dict, *,\n inclusive: bool = True) -> ndarray:\n pass\n boolean_array = np.full(self.__getattribute__('shape')[0], fill_value=True)\n fo...
[ "0.55187356", "0.5427349", "0.51378554", "0.5105014", "0.510499", "0.50856996", "0.5008775", "0.49854606", "0.49854606", "0.49708956", "0.49670136", "0.4929073", "0.49227515", "0.4882665", "0.48811394", "0.48774448", "0.4864481", "0.4864481", "0.48592335", "0.48482525", "0.48...
0.62297755
0
Pad an xarray.DataArray da according to the boundary conditions along dim. Return a raw dask or numpy array, depending on the underlying data.
def _pad_array(da, dim, left=False, boundary=None, fill_value=0.0): if boundary not in ["fill", "extend"]: raise ValueError("`boundary` must be `'fill'` or `'extend'`") axis_num = da.get_axis_num(dim) shape = list(da.shape) shape[axis_num] = 1 base_array = da.data index = slice(0, 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def padding(a, dim):\n\n return np.pad(a, (0, dim-len(a)), 'constant', constant_values=(0))", "def pad(data, maxPadLength=False):\n data_padded = data.copy()\n bad_indexes = np.isnan(data)\n good_indexes = np.logical_not(bad_indexes)\n good_data = data[good_indexes]\n interpolated = np.interp(\...
[ "0.5916931", "0.555809", "0.55494297", "0.5496643", "0.54872304", "0.5461839", "0.5435356", "0.5432517", "0.53927624", "0.53607583", "0.5343201", "0.5320598", "0.5312922", "0.52983654", "0.52979755", "0.5248074", "0.52351177", "0.5210277", "0.5204645", "0.5204212", "0.5164592...
0.7270703
0
Function monitors IP traffic in real time using Scapy's sniff function. If an exception occurres it will run again in 5 seconds.
def run_ip_traffic_monitor(db_connection, net_interfaces, device_id, agent_ip): while 1: try: arp_traffic_out = sniff(prn = ip_monitoring_callback(db_connection, net_interfaces, device_id, agent_ip), filter = "ip", store = 0); except: utc_time_now = str(datetime.utcnow()) print('[' + utc_ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_forever(self):\n scapy.sniff(prn=self.arp_cb, filter=\"arp\", store=0, count=0)", "def sniffing():\n sniff(store=False, prn=lambda p: threading.Thread(target=next, args=(p,)).start(), iface=IFACE)", "def sniff_online(args):\n print('viewer: listening on ' + args.interface)\n\n try:\n ...
[ "0.7126685", "0.68830526", "0.6274077", "0.605297", "0.5967374", "0.5935252", "0.5896744", "0.5872024", "0.58675337", "0.5812287", "0.57800436", "0.57372296", "0.56378335", "0.5585778", "0.5581399", "0.5579333", "0.55172724", "0.54108804", "0.5356755", "0.5340449", "0.5304415...
0.7301768
0
Function monitors IP traffic in real time using Scapy's sniff function and result stores in the sqlite3 database.
def ip_monitoring_callback(db_connection, net_interfaces, device_id, host_ip): # For example, if 10.2.x.x talks to 10.1.x.x that is fine. subnet_ip_list = [] for data in net_interfaces: local_ip = data['ip'] local_ip = local_ip.split('.') subnet_ip_list.append(str(local_ip[0])) host_parts = host_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_ip_traffic_monitor(db_connection, net_interfaces, device_id, agent_ip):\n\n while 1:\n try:\n arp_traffic_out = sniff(prn = ip_monitoring_callback(db_connection, net_interfaces, device_id, agent_ip), filter = \"ip\", store = 0);\n except:\n utc_time_now = str(datetime.utcnow())\n prin...
[ "0.68234485", "0.66879004", "0.6390416", "0.63076127", "0.61595774", "0.60337055", "0.5978882", "0.59621894", "0.59603024", "0.5897678", "0.587754", "0.58491415", "0.5800434", "0.5795848", "0.5759272", "0.57397294", "0.55257237", "0.54305667", "0.5375751", "0.529121", "0.5286...
0.6899458
0
prettyprinter for dumping this variable to _file
def prettyprint(self, _file): xstr = "var " + self.name + " " + self.type.desc() _file.write(xstr + "\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prettyprint(self, _file):\n xstr = \"reg \" + self.name + \" \" + self.type.desc()\n _file.write(xstr + \"\\n\")", "def prettyprint(self, _file):\n _file.write(\"Function %s returns %s\\n\" % (self.name, self.returnType))\n _file.write(\" local vars\\n\")\n for val in self....
[ "0.7163909", "0.66443485", "0.6586192", "0.65374786", "0.6152915", "0.6114037", "0.60867304", "0.59884775", "0.5986953", "0.5972376", "0.5882353", "0.57969296", "0.5763943", "0.5755351", "0.5739949", "0.5702993", "0.5678127", "0.56770426", "0.5674878", "0.56744444", "0.566506...
0.81848353
0
prettyprinter for dumping this register to _file
def prettyprint(self, _file): xstr = "reg " + self.name + " " + self.type.desc() _file.write(xstr + "\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prettyprint(self, _file):\n xstr = \"var \" + self.name + \" \" + self.type.desc()\n _file.write(xstr + \"\\n\")", "def prettyprint(self, _file):\n _file.write(\"Function %s returns %s\\n\" % (self.name, self.returnType))\n _file.write(\" local vars\\n\")\n for val in self....
[ "0.747862", "0.69527394", "0.6617654", "0.6217994", "0.6206654", "0.61563045", "0.61102194", "0.5948794", "0.59108806", "0.5895563", "0.5882521", "0.58252144", "0.58229977", "0.5805466", "0.5795636", "0.5766275", "0.57474035", "0.5730405", "0.57264787", "0.572616", "0.5725961...
0.8537647
0
generate new, unused label
def genLabel(self): self._nextlabelid += 1 return CLABEL(self._nextlabelid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unused_label(self, label):\n original = label\n existing = self.column_labels\n i = 2\n while label in existing:\n label = '{}_{}'.format(original, i)\n i += 1\n return label", "def uniqueLabel(self):\n label = f\"Label-{self.next_label}\"\n ...
[ "0.72095937", "0.70172065", "0.6992559", "0.6919921", "0.6875562", "0.6685837", "0.6595837", "0.656445", "0.6552505", "0.6459706", "0.64372915", "0.63094926", "0.6299775", "0.62694937", "0.62503123", "0.62356275", "0.6233588", "0.6232511", "0.62244177", "0.6221866", "0.621807...
0.7646934
0
creates new, globally unique virtual register and returns it
def getFreeVirtReg(self, function, _type: common.Type): while True: name = "$R"+str(self._nextvregid) self._nextvregid += 1 if not name in self._used_names: break reg = VirtualRegister(name, _type) self._used_names.add(name) function.ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self,registerable):\n result = self.registry.register(registerable)\n if result.reg_info.index is None:\n raise RuntimeError(\"failed to register {}\".format(str(registerable)))\n return result", "def __new__(cls, *args, **kwargs):\n obj = super(RegistersBank, ...
[ "0.62169015", "0.61992264", "0.6111969", "0.6111969", "0.6012539", "0.59799826", "0.5868822", "0.5843639", "0.57748914", "0.57584983", "0.57393277", "0.5698932", "0.5672466", "0.5543582", "0.5534334", "0.55243844", "0.5516907", "0.5514164", "0.5504319", "0.54888034", "0.54738...
0.6297248
0
inserts otherinstr before this instruction in this instruction's owner
def insertBefore(self, otherinstr): # pylint: disable=protected-access assert isinstance(otherinstr, ICode) if self.__prev is None: self.__prev = otherinstr otherinstr.__next = self otherinstr.owner = self.owner self.owner._firstInstr = otherinstr ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertAfter(self, otherinstr):\n # pylint: disable=protected-access\n assert isinstance(otherinstr, ICode)\n if self.__next is None:\n self.__next = otherinstr\n otherinstr.__prev = self\n otherinstr.owner = self.owner\n self.owner._lastInstr = o...
[ "0.74177617", "0.73127705", "0.68408257", "0.6571505", "0.650014", "0.6094729", "0.58833224", "0.58634835", "0.5708529", "0.57056504", "0.5630455", "0.5542791", "0.5493814", "0.54496557", "0.5449439", "0.5430143", "0.54208475", "0.54148895", "0.53924996", "0.53715074", "0.537...
0.8292218
0
inserts otherinstr after this instruction in this instruction's owner
def insertAfter(self, otherinstr): # pylint: disable=protected-access assert isinstance(otherinstr, ICode) if self.__next is None: self.__next = otherinstr otherinstr.__prev = self otherinstr.owner = self.owner self.owner._lastInstr = otherinstr ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addInstr(self, instr: ICode):\n if self._firstInstr is None:\n self._firstInstr = self._lastInstr = instr\n instr.owner = self\n else:\n self._lastInstr.insertAfter(instr)", "def insertBefore(self, otherinstr):\n # pylint: disable=protected-access\n ...
[ "0.719003", "0.7132219", "0.6927207", "0.65833426", "0.5970327", "0.5787707", "0.5783591", "0.56777227", "0.5648216", "0.5632277", "0.56003106", "0.5597215", "0.55759704", "0.5575936", "0.5554544", "0.544754", "0.54253715", "0.54174846", "0.5384279", "0.5366979", "0.53345114"...
0.8242531
0
removes this instruction from this instruction's owner
def remove(self): # pylint: disable=protected-access if self.__next is None and self.__prev is None: self.owner._firstInstr = self.owner._lastInstr = None elif self.__next is None: self.owner._lastInstr = self.__prev self.__prev.__next = None elif self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpossessed(self):\r\n self.owner = None", "def removeInstruction(self, instruction: ghidra.program.model.listing.Instruction) -> None:\n ...", "def remove_from_hand(self):\n pass", "def remove_self(self):\n self.parent.remove(self.element)", "def remove():", "def remove(s...
[ "0.69388956", "0.69099617", "0.6750926", "0.6566112", "0.65368277", "0.65222853", "0.6515427", "0.6501087", "0.6485686", "0.6485686", "0.6485686", "0.6457478", "0.63775134", "0.63522595", "0.62998563", "0.6274236", "0.6253145", "0.6226511", "0.6226511", "0.61956424", "0.61892...
0.6978263
0
returns a list of operands read in this instruction
def getOperandsRead(self): # pylint: disable=no-self-use return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_ops(self):\n return self._read_ops", "def operartors(self) -> List[Operator]:\n return list(self.__ops.keys())", "def operators(self):\n return self._operators", "def repair_operators(self) -> List[Tuple[str, _OperatorType]]:\n return list(self._r_ops.items())", "def ge...
[ "0.7080609", "0.70025116", "0.68571204", "0.68286264", "0.68182766", "0.6815364", "0.66542053", "0.6588963", "0.646638", "0.6445326", "0.63981086", "0.63981086", "0.63981086", "0.63981086", "0.63549936", "0.6339191", "0.6320942", "0.63162535", "0.618147", "0.6178464", "0.6151...
0.8149229
0
returns a list of operands written in this instruction
def getOperandsWritten(self): # pylint: disable=no-self-use return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOperandsRead(self):\n # pylint: disable=no-self-use\n return []", "def operartors(self) -> List[Operator]:\n return list(self.__ops.keys())", "def operators(self):\n return self._operators", "def repair_operators(self) -> List[Tuple[str, _OperatorType]]:\n return lis...
[ "0.74284786", "0.6942272", "0.68793195", "0.67819464", "0.67440844", "0.67391163", "0.6701617", "0.64588183", "0.64523685", "0.64015955", "0.63703436", "0.63552004", "0.6314888", "0.6314888", "0.6314888", "0.6314888", "0.63003516", "0.62023795", "0.61812854", "0.60893553", "0...
0.7680413
0
prettyprinter for dumping this function to _file
def prettyprint(self, _file): _file.write("Function %s returns %s\n" % (self.name, self.returnType)) _file.write(" local vars\n") for val in self.vars.values(): _file.write(" ") val.prettyprint(_file) _file.write(" params\n") for val in self.params.values...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_print(self):\n pt = PrettyTable()\n for i in self.files_summary:\n pt.field_names = [\"File Name\", \"Classes\", \"Functions\", \"Lines\", \"Characters\"]\n pt.add_row(list([i, self.files_summary[i][\"class\"], self.files_summary[i][\"function\"], self.files_summary[i...
[ "0.71779335", "0.7116922", "0.7084293", "0.70625824", "0.66019326", "0.6540435", "0.6426516", "0.64012384", "0.6324325", "0.6153158", "0.611711", "0.6105079", "0.6035712", "0.5985358", "0.59463036", "0.5938295", "0.59304595", "0.5902174", "0.58622736", "0.58602864", "0.582285...
0.79620916
0
Draws lines on the board, the first and last lines are not drawn because these lines are the ends of the screen
def draw_lines(self): for x_cord in range(0, Dimension.SCREEN_WIDTH.value, Dimension.SQUARE_WIDTH.value): pg.draw.line(self.window, Colors.BLACK.value, (x_cord, 0), (x_cord, Dimension.SCREEN_HEIGHT.value)) for y_cord in range(0, Dimension.SCREEN_HEIGHT.value, Dimension.SQUARE_HEIGHT.value):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_lines(self):\n # draw x lines\n y = self.step_y\n while y <= self.height:\n x = 0\n while x <= self.width:\n self.canvas.create_line(x, y, x+3.5, y)\n self.canvas.update()\n x += 3.5\n y += self.step_y\n \n # draw y lines\n x = self.step_x\n while x...
[ "0.81675446", "0.76167536", "0.7486768", "0.7479164", "0.73604876", "0.7308902", "0.7301014", "0.7262629", "0.7260224", "0.7067093", "0.7031589", "0.7013453", "0.7009544", "0.6995654", "0.69763374", "0.6916263", "0.6910306", "0.6907244", "0.6904076", "0.68767136", "0.68581563...
0.78859526
1
Obstacles created by self.create_obstacles are drawn on self.windows as a black rectangles.
def draw_obstacles(self): for obstacle in self.obstacles: obstacle.draw(self.window, Colors.BLACK.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_obstacles():\n for obstacle in obstacles:\n plt.gca().add_patch(obstacle)", "def place_obstacles():\n #Randomly generate different sized rectangles\n #Soem may overlap, which gives more variety in shape of obstacles\n xvals = np.random.randint(0,self.map_dimens...
[ "0.70438933", "0.69378084", "0.68815863", "0.685203", "0.6783483", "0.666752", "0.6614215", "0.6580512", "0.65752584", "0.6495871", "0.64657646", "0.6459727", "0.6416091", "0.63066995", "0.6299761", "0.6271255", "0.61703116", "0.61362374", "0.60891026", "0.6071949", "0.607047...
0.85527563
0
Function creates from 1 to 10 obstacles with random coordinates. The self.matrix is modified to reflect the changes to on the board
def create_obstacles(self) -> List[Square]: obstacles_number = random.randint(1, self.maximum_obstacles_on_board) obstacles = list() while len(obstacles) < obstacles_number: obstacle_x_pos = random.randint(0, Dimension.board_width() - 1) obstacle_y_pos = random.randint(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recreate_obstacles(self):\n self.board_matrix = np.full(Dimension.board_size(), 1)\n self.obstacles = self.create_obstacles()", "def place_obstacles():\n #Randomly generate different sized rectangles\n #Soem may overlap, which gives more variety in shape of obstacles\n ...
[ "0.78306466", "0.7273958", "0.70843565", "0.70556134", "0.69390327", "0.6925378", "0.6871779", "0.67835164", "0.66807145", "0.6673614", "0.6662289", "0.6659398", "0.6652911", "0.66385484", "0.6629301", "0.65946746", "0.6584933", "0.6569968", "0.6563175", "0.65319467", "0.6528...
0.76295495
1
Checks if clicked square is not obstacle and it's possible to start/end path here.
def is_square_empty(self, clicked_square: Square) -> bool: return clicked_square not in self.obstacles
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_obstacle_in_path(self):\n for obstacle in self.obstacles.tolist():\n print(\"obstacle.get_point():\", obstacle.get_point())\n dist_to_obstacle = VectorMath.get_vector_magnitude(np.subtract(obstacle.get_point(), self.drone.get_point()))\n if dist_to_obstacle < obstacle...
[ "0.67216086", "0.6399878", "0.63358396", "0.6280128", "0.626441", "0.6188265", "0.61713976", "0.61628646", "0.60517824", "0.6038364", "0.6031158", "0.6017531", "0.6014424", "0.60048735", "0.60025954", "0.6000857", "0.59907734", "0.59674644", "0.5930595", "0.5913718", "0.59069...
0.6928356
0
Creates new state of board with different number of obstacles and their positions.
def recreate_obstacles(self): self.board_matrix = np.full(Dimension.board_size(), 1) self.obstacles = self.create_obstacles()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_board(self):\n board = []\n for i in range(self.rows):\n row = []\n for j in range(self.columns):\n row.append(\n {\n \"c\": j + 1, # c column number base 1\n \"r\": i + 1, # r row numb...
[ "0.7055454", "0.67278403", "0.67269707", "0.6680739", "0.6606683", "0.6588023", "0.6581234", "0.65147763", "0.65075326", "0.6501786", "0.64927673", "0.64923614", "0.64883053", "0.64836043", "0.645332", "0.64511937", "0.64277464", "0.6404062", "0.63852406", "0.63647217", "0.63...
0.73487616
0