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
Lists of tags on the repository. Returns list[str] The `String` scalar type represents textual data, represented as UTF8 character sequences. The String type is most often used by GraphQL to represent freeform humanreadable text. Raises ExecuteTimeoutError If the time to execute the query exceeds the configured timeout...
def tags(self) -> list[str]: _args: list[Arg] = [] _ctx = self._select("tags", _args) return _ctx.execute_sync(list[str])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self):\n return self._post(\n request='list',\n uri=ApiUri.TAGS.value,\n ).get('tags')", "def do_list_tags(cs, args):\n resp, tags = cs.repositories.list_tags(args.repository)\n tags = [{\"Tag\": t} for t in tags]\n utils.print_list(tags, [\"Tag\"], sortby=\"...
[ "0.7537095", "0.7308341", "0.7147275", "0.706256", "0.69950134", "0.69553554", "0.6925393", "0.6891249", "0.6863067", "0.68479353", "0.6775054", "0.6760145", "0.66394955", "0.6558417", "0.65561694", "0.655354", "0.65425885", "0.6537936", "0.64859897", "0.643276", "0.63932294"...
0.80385756
0
Accesses a Unix socket on the host.
def unix_socket(self, path: str) -> "Socket": _args = [ Arg("path", path), ] _ctx = self._select("unixSocket", _args) return Socket(_ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_unixsocket(self, url):\n assert self._socket is None, 'The connection has already been established'\n\n logger.debug('Opening a unix socket msgpackrpc connection')\n self._socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n hostname = url.hostname or ''\n path =...
[ "0.6957623", "0.6846401", "0.6427868", "0.63732684", "0.6355117", "0.62402636", "0.6220675", "0.6212612", "0.60896385", "0.6047045", "0.59988767", "0.5969336", "0.5905171", "0.58979136", "0.58952713", "0.5872788", "0.5797466", "0.57263947", "0.57122874", "0.569558", "0.567655...
0.7402831
0
The port description. Returns Optional[str] The `String` scalar type represents textual data, represented as UTF8 character sequences. The String type is most often used by GraphQL to represent freeform humanreadable text. Raises ExecuteTimeoutError If the time to execute the query exceeds the configured timeout. Query...
def description(self) -> Optional[str]: if hasattr(self, "_description"): return self._description _args: list[Arg] = [] _ctx = self._select("description", _args) return _ctx.execute_sync(Optional[str])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description(self):\n return QueryCommand.desc_text", "def description(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"description\")", "def description(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"description\")", "def description(self) -> pul...
[ "0.6323781", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "0.5866519", "...
0.60819715
1
The port number. Returns int The `Int` scalar type represents nonfractional signed whole numeric values. Int can represent values between (2^31) and 2^31 1. Raises ExecuteTimeoutError If the time to execute the query exceeds the configured timeout. QueryError If the API returns an error.
def port(self) -> int: if hasattr(self, "_port"): return self._port _args: list[Arg] = [] _ctx = self._select("port", _args) return _ctx.execute_sync(int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port_number(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"port_number\")", "def port(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"port\")", "def port(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"port\")", "def port(self) -> pulumi.Output[int]:\n ...
[ "0.68129724", "0.6757083", "0.6757083", "0.66213965", "0.66213965", "0.66213965", "0.65635526", "0.65635526", "0.65635526", "0.65635526", "0.65635526", "0.65635526", "0.65635526", "0.6551465", "0.63833815", "0.63824254", "0.63824254", "0.63824254", "0.63824254", "0.63824254", ...
0.7297934
0
The transport layer network protocol. Returns NetworkProtocol Transport layer network protocol associated to a port. Raises ExecuteTimeoutError If the time to execute the query exceeds the configured timeout. QueryError If the API returns an error.
def protocol(self) -> NetworkProtocol: if hasattr(self, "_protocol"): return self._protocol _args: list[Arg] = [] _ctx = self._select("protocol", _args) return _ctx.execute_sync(NetworkProtocol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transportprotocol(self) :\n\t\ttry :\n\t\t\treturn self._transportprotocol\n\t\texcept Exception as e:\n\t\t\traise e", "def protocol(self):\n self._recv_protocol()\n return self._protocol", "def protocol(self) -> Optional[pulumi.Input['TargetServerProtocol']]:\n return pulumi.get(self...
[ "0.6348662", "0.58793586", "0.56476617", "0.5633025", "0.55776554", "0.54789937", "0.54208523", "0.54129565", "0.53827244", "0.5378679", "0.5374093", "0.5372477", "0.53539217", "0.5351676", "0.5327181", "0.53266543", "0.53031504", "0.53027827", "0.5294397", "0.5294397", "0.52...
0.6736263
0
A unique identifier for this command. Note This is lazyly evaluated, no operation is actually run. Returns ProjectCommandID A unique project command identifier. Raises ExecuteTimeoutError If the time to execute the query exceeds the configured timeout. QueryError If the API returns an error.
def id(self) -> ProjectCommandID: _args: list[Arg] = [] _ctx = self._select("id", _args) return _ctx.execute_sync(ProjectCommandID)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_command(\n self,\n id: Optional[ProjectCommandID] = None,\n ) -> ProjectCommand:\n _args = [\n Arg(\"id\", id, None),\n ]\n _ctx = self._select(\"projectCommand\", _args)\n return ProjectCommand(_ctx)", "def project_id(self) -> pulumi.Output[str...
[ "0.669502", "0.66544163", "0.65079445", "0.65079445", "0.6331355", "0.6331355", "0.6331355", "0.6331355", "0.6250307", "0.6250307", "0.6250307", "0.6250307", "0.6250307", "0.6195116", "0.6094232", "0.6092446", "0.5911283", "0.5885012", "0.5810856", "0.57995456", "0.56992793",...
0.68039656
0
Constructs a cache volume for a given cache key.
def cache_volume(self, key: str) -> CacheVolume: _args = [ Arg("key", key), ] _ctx = self._select("cacheVolume", _args) return CacheVolume(_ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_cache_volume(self, context, img_meta,\n img_service, cachevol_props):\n lcfg = self.configuration\n cache_dir = '%s/' % lcfg.zfssa_cache_directory\n cache_vol = Volume()\n cache_vol.provider_location = self.mount_path\n cache_vol._name_id =...
[ "0.6562647", "0.5990654", "0.5797106", "0.5678285", "0.5670817", "0.56409603", "0.55442846", "0.55040085", "0.54413503", "0.54371464", "0.5426353", "0.54188824", "0.5406338", "0.53249043", "0.53245944", "0.5314955", "0.53101665", "0.53088665", "0.53088087", "0.52988535", "0.5...
0.84980476
0
Loads a container from ID. Null ID returns an empty container (scratch). Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
def container( self, id: Optional[ContainerID] = None, platform: Optional[Platform] = None, ) -> Container: _args = [ Arg("id", id, None), Arg("platform", platform, None), ] _ctx = self._select("container", _args) return Container(_ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def container_by_id(self, id):\n if not id:\n return None\n return next((container for container in self.containers(all=True)\n if container['Id'] == id), None)", "def getMainContainer(self, port):\n map = self.hz.get_map(self.container_map)\n try:\n ...
[ "0.5772204", "0.56404155", "0.56089073", "0.5487577", "0.5405059", "0.5388333", "0.5378071", "0.53699005", "0.5327329", "0.5300713", "0.51314753", "0.507024", "0.5068354", "0.50363344", "0.5023615", "0.4954214", "0.49167392", "0.48895022", "0.48705822", "0.48590308", "0.48418...
0.756366
0
The default platform of the builder. Returns Platform The platform config OS and architecture in a Container. The format is [os]/[platform]/[version] (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64"). Raises ExecuteTimeoutError If the time to execute the query exceeds the configured timeout. QueryError If the A...
def default_platform(self) -> Platform: _args: list[Arg] = [] _ctx = self._select("defaultPlatform", _args) return _ctx.execute_sync(Platform)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform(self) -> Platform:\n _args: list[Arg] = []\n _ctx = self._select(\"platform\", _args)\n return _ctx.execute_sync(Platform)", "def platform(self):\n return self.random.choice([\n 'Laptop', \n 'Desktop', \n 'Workstation', \n 'Serv...
[ "0.7500557", "0.6820205", "0.68178904", "0.6788074", "0.67660815", "0.66832024", "0.66458005", "0.6618222", "0.6601224", "0.65934664", "0.6508021", "0.6468797", "0.64190835", "0.63798565", "0.6327381", "0.6266462", "0.6222256", "0.62124807", "0.6210097", "0.6066512", "0.60634...
0.7635805
0
Load a directory by ID. No argument produces an empty directory.
def directory(self, id: Optional[DirectoryID] = None) -> Directory: _args = [ Arg("id", id, None), ] _ctx = self._select("directory", _args) return Directory(_ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load(self, directory):\n pass", "def _load_dir(self, dirdoc, parent):\n path = dirdoc.get_path().rstrip('/')\n if not os.path.isabs(path):\n path = os.path.join(self._source_root, path)\n relpath = self._get_rel_path(path)\n dirobj = self._dirs.get(relpath)\n ...
[ "0.5902571", "0.5733291", "0.5528355", "0.54908407", "0.54747856", "0.545685", "0.53948534", "0.53407854", "0.5308188", "0.5308188", "0.5308188", "0.525469", "0.5244527", "0.52046084", "0.5183137", "0.5181206", "0.5149205", "0.5099683", "0.5093009", "0.50800556", "0.507793", ...
0.70760345
0
Load a project command from ID.
def project_command( self, id: Optional[ProjectCommandID] = None, ) -> ProjectCommand: _args = [ Arg("id", id, None), ] _ctx = self._select("projectCommand", _args) return ProjectCommand(_ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_command(self, run_id: str, command_id: str) -> Command:\n select_run_commands = sqlalchemy.select(run_table.c.commands).where(\n run_table.c.id == run_id\n )\n with self._sql_engine.begin() as transaction:\n try:\n row = transaction.execute(select_r...
[ "0.59816575", "0.59130156", "0.58891493", "0.5796397", "0.5609695", "0.5608153", "0.5605671", "0.55157363", "0.54920506", "0.5466161", "0.5433719", "0.54298997", "0.5401508", "0.5385387", "0.5382517", "0.53507376", "0.53500974", "0.53486633", "0.53406537", "0.5337943", "0.530...
0.7154898
0
Loads a secret from its ID.
def secret(self, id: SecretID) -> "Secret": _args = [ Arg("id", id), ] _ctx = self._select("secret", _args) return Secret(_ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_secret_from_secrets_manager(secret_id):\n try:\n secret_response = SECRETS_CLIENT.get_secret_value(SecretId=secret_id)\n except botocore.exceptions.ClientError as e:\n if e.response['Error']['Code'] == 'ResourceNotFoundException':\n print(\"The requested secret \" + secret_id...
[ "0.64768386", "0.6296929", "0.6286372", "0.61941475", "0.6010353", "0.59894884", "0.58976305", "0.5849497", "0.5833675", "0.5743838", "0.57183564", "0.57039124", "0.5616656", "0.56143856", "0.55480623", "0.55475557", "0.5545142", "0.5542181", "0.55393237", "0.5530744", "0.551...
0.7125567
0
Sets a secret given a user defined name to its plaintext and returns the secret. The plaintext value is limited to a size of 128000 bytes.
def set_secret(self, name: str, plaintext: str) -> "Secret": _args = [ Arg("name", name), Arg("plaintext", plaintext), ] _ctx = self._select("setSecret", _args) return Secret(_ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secret_name(self, secret_name: str):\n\n self._secret_name = secret_name", "async def write_secret(self, name: str, value: str, content_type: str, tags: dict):\n pass", "def create_secret(secret_name, secret_value, environment):\n environment.add_cleanup(\n environment.cfy.secrets.d...
[ "0.63324", "0.63073885", "0.61804336", "0.6083482", "0.60661083", "0.5851548", "0.5827603", "0.5774198", "0.5712104", "0.56992877", "0.5686555", "0.5673367", "0.5671408", "0.5632462", "0.5612299", "0.5564957", "0.55553335", "0.5549962", "0.5549962", "0.551757", "0.5511768", ...
0.80450666
0
Loads a socket by its ID.
def socket(self, id: Optional[SocketID] = None) -> "Socket": _args = [ Arg("id", id, None), ] _ctx = self._select("socket", _args) return Socket(_ctx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_socket_tcp(self, worker_id):\n\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n sock.connect((self.host, self.port))\n if len(self.sockets) - 1 < worker_id:\n self.sockets.append(MessageSocket(sock))\n else:\n # socket was already initialized,...
[ "0.5896631", "0.57419246", "0.56726164", "0.5506799", "0.5405886", "0.5388545", "0.53619236", "0.5353527", "0.5307306", "0.52529365", "0.52365834", "0.51966864", "0.5145992", "0.5133644", "0.50869465", "0.50775117", "0.5027824", "0.50255984", "0.5020532", "0.501663", "0.50157...
0.7101312
0
The identifier for this secret. Note This is lazyly evaluated, no operation is actually run. Returns SecretID A unique identifier for a secret. Raises ExecuteTimeoutError If the time to execute the query exceeds the configured timeout. QueryError If the API returns an error.
def id(self) -> SecretID: _args: list[Arg] = [] _ctx = self._select("id", _args) return _ctx.execute_sync(SecretID)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secret_id(self):\n if self._secret_id:\n return self._secret_id\n return self.device_id", "def credential_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"credential_id\")", "def secret(self, id: SecretID) -> \"Secret\":\n _args = [\n Arg(\"id\",...
[ "0.62632376", "0.56606525", "0.5575883", "0.5551399", "0.5475425", "0.54505223", "0.54505223", "0.542791", "0.54203725", "0.53091943", "0.5308966", "0.5299386", "0.5299386", "0.52866477", "0.5282878", "0.52595127", "0.52530897", "0.52530897", "0.52047634", "0.51913774", "0.51...
0.6752598
0
The contentaddressed identifier of the socket. Note This is lazyly evaluated, no operation is actually run. Returns SocketID A contentaddressed socket identifier. Raises ExecuteTimeoutError If the time to execute the query exceeds the configured timeout. QueryError If the API returns an error.
def id(self) -> SocketID: _args: list[Arg] = [] _ctx = self._select("id", _args) return _ctx.execute_sync(SocketID)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self):\n try:\n return self.inst.query('*IDN?')[:36]\n except errors.VisaIOError as e:\n logger.warning(e)\n return 'Device not connected.'", "def get_conn_id(self):\n return self._conn_id", "def get_identity(self):\n return self.query_ser...
[ "0.55940413", "0.53135484", "0.53007567", "0.5274564", "0.51804435", "0.5169236", "0.5164426", "0.5151229", "0.51055396", "0.50643754", "0.5036687", "0.4925575", "0.49145514", "0.48973447", "0.4887037", "0.48602158", "0.48547375", "0.4841917", "0.4794122", "0.47725692", "0.47...
0.62213135
0
Recursive generator to traverse through the next attribute and \ crawl through the links to be followed
def traverse_next(page, next, results): for link in page.extract_links(next['follow_link']): print(Back.YELLOW + Fore.BLUE + "Loading page ", link.url + Back.RESET + Fore.RESET) r = results.copy() for attribute in next['scraping'].get('data'): if attribute['field'] != "": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_links(self):", "def parse(self, response):\n for href in response.xpath(\"//h2/a/@href\"):\n url = response.urljoin(href.extract())\n yield scrapy.Request(url, self.parse_post_content)\n\n # Check for a next page\n next_page_links = response.xpath(\"//a[@class=...
[ "0.65599394", "0.6369224", "0.6208132", "0.6178044", "0.6139378", "0.60776615", "0.5943352", "0.5923521", "0.58888763", "0.5847299", "0.5832258", "0.5825916", "0.580362", "0.5800987", "0.575707", "0.5744859", "0.57438844", "0.5741563", "0.5735658", "0.5732073", "0.5718406", ...
0.7585939
0
Get the case with the given id.
def get_case( case_id: str, db: Session = Depends(get_db), ) -> Any: case_and_site = crud.case.get_case_with_site(db, id=case_id) if not case_and_site: return None (case, site) = case_and_site return schemas.CaseWithTaskInfo.get_case_with_task_info(case, site)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_case(self, key: str):\n case = self.cases.get(key)\n if not hasattr(case, 'case_id'):\n message = \"get_case(): Case key {} does not have a case_id\"\n logmessage(message.format(key))\n else:\n logmessage(\"get_case(): \" + \"Retrieved case {}\".format(...
[ "0.7652816", "0.75069267", "0.742796", "0.74086934", "0.68050575", "0.67527646", "0.6727599", "0.66455543", "0.66006774", "0.66006774", "0.65687746", "0.6526103", "0.6523807", "0.6397721", "0.63572866", "0.63300836", "0.63286036", "0.6318402", "0.6287967", "0.6262556", "0.624...
0.78470695
0
Create a new case with the given parameters.
def create_case( case_attrs: schemas.CaseBase = Body(...), data_file: UploadFile | None = None, db: Session = Depends(get_db), ) -> Any: case = crud.case.create(db, obj_in=case_attrs, data_file=data_file) case_with_site = crud.case.get_case_with_site(db, id=case.id) if not case_with_site: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, data):\n\t\tassert isinstance(data, dict), 'The data type must be a dictionary'\n\t\tassert data, 'Case data must not be an empty dictionary'\n\n\t\turl = f'{self.root.url}/api/v1.2/cases'\n\t\tdata = json.dumps(data)\n\t\treturn self.root.r('POST', url, data, headers=None, verify=self.root.verify...
[ "0.6602358", "0.6243168", "0.6151143", "0.59093493", "0.5901428", "0.5863238", "0.57288516", "0.569517", "0.56175363", "0.5600924", "0.5571604", "0.54987", "0.54490995", "0.54490995", "0.5442545", "0.5419051", "0.53634536", "0.53506285", "0.53416675", "0.53376764", "0.5328685...
0.6516636
1
Delete the case with the given id.
def delete_case( case_id: str, db: Session = Depends(get_db), ) -> Any: return crud.case.remove(db, id=case_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, id):\n\t\tassert isinstance(id, str), 'The ID must be a string'\n\t\tassert id, 'The ID must not be an empty string'\n\n\t\turl = f'{self.root.url}/api/v1.2/cases/{str(id)}'\n\t\treturn self.root.r('DELETE', url, body=None, headers=None, verify=self.root.verify)", "def delete(self, id):\n ...
[ "0.84369844", "0.73596317", "0.72730875", "0.7185908", "0.71783876", "0.71575975", "0.71393", "0.7098429", "0.7039126", "0.70330113", "0.70286715", "0.6953266", "0.6928895", "0.69166875", "0.6901097", "0.68983555", "0.6893836", "0.688908", "0.68862903", "0.68758273", "0.68642...
0.84714806
0
Download a compressed tarball of the case with the given id.
def download_case(case_id: str, db: Session = Depends(get_db)) -> Any: case_and_site = crud.case.get_case_with_site(db, id=case_id) if not case_and_site: return None (case, site) = case_and_site case_folder_name = case.env["CASE_FOLDER_NAME"] archive_name = settings.ARCHIVES_ROOT / f"{ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_result_archive(run_id):\n from robflask.service import service\n with service() as api:\n ioBuffer = api.runs().get_result_archive(run_id=run_id)\n return send_file(\n ioBuffer.open(),\n as_attachment=True,\n attachment_filename='run.tar.gz',\n ...
[ "0.662663", "0.60236204", "0.59797704", "0.5942099", "0.58977664", "0.5883229", "0.5854524", "0.5841927", "0.5803023", "0.5784929", "0.57631713", "0.57533705", "0.5741124", "0.57009476", "0.5692873", "0.5692211", "0.5639134", "0.5635846", "0.56315255", "0.56135046", "0.561247...
0.68127346
0
Provides a list of all installed screens with various options.
def list_screens(self): # Check if the form ws submitted form = request.forms.get("submit", False) # If so... if form: # ...find out what the user wanted to do and to which screen action, screen = form.split("+") # Call the relevant action ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getScreenList(self, verbose = False):\n return execCmd(\"%s -list\" % self._screenPath, verbose)", "def set_screens(screen_list):\n global screens, screen_manager\n screens = screen_list\n for s in screen_list:\n screen_manager.add_widget(s)", "def ls():\n cfgmgr = ConfigManager()...
[ "0.7698006", "0.62944466", "0.61939716", "0.60135794", "0.60123616", "0.59499973", "0.59408593", "0.5889573", "0.5849794", "0.58275825", "0.5799081", "0.574292", "0.5704067", "0.5643079", "0.56395257", "0.55941457", "0.55328465", "0.55140173", "0.5513191", "0.55050707", "0.54...
0.6725818
1
Checks if giving no arguments to func raises TypeError
def check_if_giving_no_args_to_func_raises_type_error(self): self.assertRaises(TypeError, add_expressions()()) self.assertRaises(TypeError, add_expressions(1, 2, 3)()) self.assertRaises(TypeError, add_expressions()(1, 2, 3))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_no_raise(func, msg=None):\n # type: (Callable[[], Any], Optional[Str]) -> Any\n try:\n return func()\n except Exception as exc: # pylint: disable=W0703\n msg = \": {}\".format(msg) if msg else \".\"\n raise AssertionError(\"Exception [{!r}] was raised when none is expected{...
[ "0.7016071", "0.69044995", "0.6742821", "0.67261815", "0.6671249", "0.6628022", "0.651699", "0.64856565", "0.64479023", "0.63919127", "0.63702077", "0.635005", "0.63424367", "0.6324157", "0.6324005", "0.6310796", "0.6292908", "0.6280658", "0.6266263", "0.6266004", "0.6259964"...
0.73872966
0
Checks if keys and values from result dict are int type
def test_if_keys_or_values_in_result_dict_are_int(self): for key, value in add_expressions(1, 2, 8)(2, 3).items(): self.assertIsInstance(key, int) self.assertIsInstance(value, int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dict_keys_int_range_valid_i64(self):\n assert (\n orjson.dumps(\n {9223372036854775807: True},\n option=orjson.OPT_NON_STR_KEYS | orjson.OPT_STRICT_INTEGER,\n )\n == b'{\"9223372036854775807\":true}'\n )\n assert (\n ...
[ "0.6375111", "0.63052046", "0.62880164", "0.623207", "0.6183187", "0.61647284", "0.61647284", "0.6141801", "0.61231464", "0.6104782", "0.61022276", "0.6088094", "0.60652304", "0.6004216", "0.5965555", "0.592258", "0.5909435", "0.5892179", "0.5848679", "0.5833292", "0.58214957...
0.7895935
0
Compute indexes for communities on a lattice e.g. A A A B B B A A A B B B A A A B B B C C C D D D C C C D D D C C C D D D community_side = 3 community_size = 33 = 9 communities_per_side = 2 num_communities = 4 tot nodes = 49
def make_communities(community_side, communities_per_side): community_size = community_side * community_side communities = [] seed_node = 0 for i in range(communities_per_side): for j in range(communities_per_side): community = [] for k in range(community_side): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_node_dissociation_index(community_vect, sparse_mat):\n dense_mat = sparse_mat.todense()\n undir_dense_mat = dense_mat + np.transpose(dense_mat)\n bin_dense_mat = np.array(undir_dense_mat != 0, dtype=int)\n\n degree_vect = np.array(np.sum(bin_dense_mat != 0, axis=1), dtype='float')\n comm...
[ "0.6061604", "0.5917704", "0.5842453", "0.5724781", "0.5721958", "0.57200986", "0.5714558", "0.5704961", "0.56901795", "0.56571835", "0.56564486", "0.5653799", "0.56306344", "0.5619969", "0.55986416", "0.55287296", "0.5504435", "0.5499393", "0.546776", "0.5464022", "0.5456440...
0.6615992
0
Generates and returns the frame for time t.
def make_frame(t): mlab.view(360*t/duration, 90) # camera angle return mlab.screenshot(antialiased=True) # return a RGB image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_frame(t):\r\n while world['t'] < hours_per_second*t:\r\n update(world)\r\n return world_to_npimage(world)", "def make_frame(t):\n mlab.view(azimuth= 100*t/duration, distance=100) # roll camera angle\n f = mlab.gcf()\n f.scene._lift()\n return mlab.scr...
[ "0.77718586", "0.7345014", "0.72444147", "0.6519072", "0.62089837", "0.61012053", "0.6074839", "0.56971854", "0.5631116", "0.5566875", "0.55628157", "0.5555367", "0.553775", "0.55165285", "0.549194", "0.5480783", "0.54515386", "0.544963", "0.5444734", "0.5421372", "0.5412726"...
0.74052477
1
two parameter mlp test nn n.b. by default tf and np add 1d arrays and row vectors to matrices rowwise, but column vectors columnwise
def mlp_test(a0, weights): a1 = tf.tanh(tf.matmul(a0, weights[0])) prediction = tf.reduce_sum(a1, axis = 1, keepdims = True) return prediction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mlp():\r\n datasets = gen_data()\r\n\r\n train_set_x, train_set_y = datasets[0]\r\n valid_set_x, valid_set_y = datasets[1]\r\n test_set_x , test_set_y = datasets[2]\r\n\r\n\r\n\r\n batch_size = 100 # size of the minibatch\r\n\r\n # compute number of minibatches for training, validati...
[ "0.6334259", "0.59655154", "0.58167905", "0.5816116", "0.5769974", "0.56921166", "0.56765157", "0.5643931", "0.562812", "0.5616511", "0.561143", "0.5605464", "0.5585012", "0.5583221", "0.5560998", "0.55559224", "0.55487335", "0.5548239", "0.55384654", "0.5538323", "0.55288494...
0.6279069
1
It creates N list of files based on filesize to average the size between lists.
def dispatch_files_bysize(nb_list, files): logging.info('Having {} files to dispatch in {} lists'.format(len(files), nb_list)) # # 1 - Init N lists of size 0. # sublists = {} for list_id in range(0,nb_list): sublists[list_id] = { 'files' : [], 'size' :...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inputFiles(self, filesizelist):\n self.inputs = filesizelist\n self.inputSize = reduce(lambda x,y: x + y[1], filesizelist, 0)", "def create_filelist(list_filename=LIST_FILE, path=\".\"):\n try:\n list_file = open(list_filename, 'w')\n except IOError:\n print \"Unable to open...
[ "0.66736156", "0.66320497", "0.6626601", "0.6580247", "0.6577763", "0.6424614", "0.63820195", "0.6323214", "0.63135624", "0.62448233", "0.6233614", "0.62148637", "0.6192251", "0.61703515", "0.6165395", "0.6061914", "0.59730166", "0.59606755", "0.59246695", "0.5924243", "0.587...
0.75299454
0
get the smallest sublist
def _get_smallest_sublist(sublists): smallest_list_id = 0 for list_id, sublist in sublists.items(): if sublist['size'] < sublists[smallest_list_id]['size']: smallest_list_id = list_id return smallest_list_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(l):\n if l:\n s_list = sorted(l)\n return s_list[0]\n else:\n raise ValueError(\"list empty\")", "def min():\n\n # check if collection passed to process() so far is empty\n assert len(inlist) > 0, \"process() has empty collection\"\n\n # assign tmp the first val inside...
[ "0.7056408", "0.70193195", "0.697621", "0.68915933", "0.68367916", "0.6689233", "0.6641165", "0.6516632", "0.645246", "0.64513105", "0.6434636", "0.63819605", "0.6360475", "0.634743", "0.63354117", "0.63319147", "0.628876", "0.62865216", "0.6278832", "0.6271458", "0.6247247",...
0.812234
0
Assert the correctness of the v1 prime number calculation algorithm using the list of prime booleans
def test_v1_correct(self): for index, expected_result in enumerate(self.prime_booleans): n = index + 1 self.assertEqual(prime_numbers_v1(n), expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_v2_correct(self):\r\n\r\n for index, expected_result in enumerate(self.prime_booleans):\r\n\r\n n = index + 1\r\n self.assertEqual(prime_numbers_v2(n), expected_result)", "def test_v3_correct(self):\r\n\r\n for index, expected_result in enumerate(self.prime_booleans):...
[ "0.8380083", "0.8201695", "0.7277579", "0.7055186", "0.703127", "0.70275456", "0.69862235", "0.6982209", "0.6913775", "0.68713045", "0.6843959", "0.68323517", "0.6798891", "0.6782229", "0.6774055", "0.6762753", "0.6753647", "0.6724724", "0.67228", "0.671049", "0.6631349", "...
0.8585346
0
Assert the correctness of the v2 prime number calculation algorithm using the list of prime booleans
def test_v2_correct(self): for index, expected_result in enumerate(self.prime_booleans): n = index + 1 self.assertEqual(prime_numbers_v2(n), expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_v1_correct(self):\r\n\r\n for index, expected_result in enumerate(self.prime_booleans):\r\n\r\n n = index + 1\r\n self.assertEqual(prime_numbers_v1(n), expected_result)", "def test_v3_correct(self):\r\n\r\n for index, expected_result in enumerate(self.prime_booleans):...
[ "0.8220716", "0.8152404", "0.71836805", "0.71185863", "0.70760846", "0.70564747", "0.7014341", "0.69715416", "0.69692093", "0.69673604", "0.6917475", "0.69155043", "0.6874409", "0.6864565", "0.68215203", "0.68168235", "0.67525196", "0.6694099", "0.66535103", "0.66168654", "0....
0.8535274
0
Assert the correctness of the v3 prime number calculation algorithm using the list of prime booleans
def test_v3_correct(self): for index, expected_result in enumerate(self.prime_booleans): n = index + 1 self.assertEqual(prime_numbers_v3(n), expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_v2_correct(self):\r\n\r\n for index, expected_result in enumerate(self.prime_booleans):\r\n\r\n n = index + 1\r\n self.assertEqual(prime_numbers_v2(n), expected_result)", "def test_v1_correct(self):\r\n\r\n for index, expected_result in enumerate(self.prime_booleans):...
[ "0.82087076", "0.8177396", "0.732867", "0.71836776", "0.7098153", "0.70722985", "0.7065491", "0.7064264", "0.7015378", "0.6951214", "0.69468385", "0.69185156", "0.69153416", "0.68972445", "0.68887734", "0.68886656", "0.68154436", "0.67425555", "0.6729536", "0.6725839", "0.670...
0.85893613
0
Tests how much time it takes for v1 to calculate if the numbers 1 through 30000 are primes. The results are not saved, as this is only a test of the performance of the algorithm. Print the time required for the calculations in seconds.
def test_v1_runtime(self): start_time = time.time() for n in range(1, 30000): prime_numbers_v1(n) elapsed_time = round(time.time() - start_time, 3) print(f"v1, time required: {elapsed_time}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_v2_runtime(self):\r\n\r\n start_time = time.time()\r\n\r\n for n in range(1, 30000):\r\n prime_numbers_v2(n)\r\n\r\n elapsed_time = round(time.time() - start_time, 3)\r\n\r\n print(f\"v2, time required: {elapsed_time}\")", "def test_v3_runtime(self):\r\n\r\n ...
[ "0.7879326", "0.74808073", "0.6699539", "0.6290277", "0.61656386", "0.6003062", "0.5979317", "0.59676176", "0.59506255", "0.5949393", "0.59420824", "0.593169", "0.589858", "0.58843815", "0.5854023", "0.58220744", "0.58083224", "0.5790027", "0.57823044", "0.5781996", "0.577921...
0.8346246
0
Tests how much time it takes for v1 to calculate if the numbers 1 through 30000 are primes. The results are not saved, as this is only a test of the performance of the algorithm. Print the time required for the calculations in seconds.
def test_v2_runtime(self): start_time = time.time() for n in range(1, 30000): prime_numbers_v2(n) elapsed_time = round(time.time() - start_time, 3) print(f"v2, time required: {elapsed_time}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_v1_runtime(self):\r\n\r\n start_time = time.time()\r\n\r\n for n in range(1, 30000):\r\n prime_numbers_v1(n)\r\n\r\n elapsed_time = round(time.time() - start_time, 3)\r\n\r\n print(f\"v1, time required: {elapsed_time}\")", "def test_v3_runtime(self):\r\n\r\n ...
[ "0.8345897", "0.74798024", "0.6698268", "0.6289179", "0.61657226", "0.6002892", "0.59794164", "0.5968033", "0.5950494", "0.59485817", "0.5941551", "0.59311694", "0.5898548", "0.5884206", "0.58534", "0.5822481", "0.58088005", "0.57895803", "0.5782659", "0.5781886", "0.5778441"...
0.78786385
1
Enhanced version of fnmatch.filter() that accepts multiple inclusion and exclusion patterns. If only inclusion_patterns is specified, only the names which match one or more patterns are returned. If only exclusion_patterns is specified, only the names which do not match any pattern are returned. If both are specified, ...
def superfilter(names, inclusion_patterns=(), exclusion_patterns=()): is_mapping = isinstance(names, collections.Mapping) keys = names.iterkeys() if is_mapping else names included = multifilter(keys, inclusion_patterns) if inclusion_patterns else keys excluded = multifilter(keys, exclusion_patterns) if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multifilter(names, patterns):\n for name in names:\n if isinstance(name, collections.Mapping):\n for key in name.iterkeys():\n for pattern in patterns:\n if fnmatch.fnmatch(key, pattern):\n yield key\n break\n ...
[ "0.62235886", "0.6200664", "0.5729722", "0.5671728", "0.561601", "0.55249554", "0.5483943", "0.54652137", "0.5277342", "0.52337253", "0.51885813", "0.518316", "0.51692367", "0.50327486", "0.49542668", "0.4940638", "0.48726985", "0.48610923", "0.48338836", "0.48335955", "0.480...
0.76531035
0
Determines whether key is in collection. If collection is a mapping type, recursively checks for key inclusion
def key_is_in_collection(key, collection): if isinstance(key, collections.Mapping): for subkey in key.iterkeys(): if key_is_in_collection(subkey, collection): return True return False else: return key in collection
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, key):\n return key in self._mappings.keys()", "def __contains__(self, key):\n\n return key in self.keys_set", "def _map___contains__(self, key):\n if not isinstance(key, self.keytype):\n raise KeyError('type of `key` should be ' + repr(self.keytype) + ' bu...
[ "0.6594242", "0.651695", "0.64697117", "0.6428458", "0.62929577", "0.6250031", "0.61806536", "0.6151651", "0.6148859", "0.6130819", "0.6128609", "0.6123638", "0.608128", "0.60794806", "0.6050483", "0.60424745", "0.6035019", "0.6011405", "0.60047156", "0.6003059", "0.59875184"...
0.85162044
0
Generator function which yields the names that match one or more of the patterns.
def multifilter(names, patterns): for name in names: if isinstance(name, collections.Mapping): for key in name.iterkeys(): for pattern in patterns: if fnmatch.fnmatch(key, pattern): yield key break else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pattern_filter(patterns, name):\n return [pat for pat in patterns if fnmatch.fnmatchcase(name, pat)]", "def _internal_match(self, pattern):\n compiled_re = re.compile(pattern)\n for word in self.words:\n if compiled_re.fullmatch(word) is not None:\n yield word",...
[ "0.67918676", "0.61530924", "0.6149047", "0.6009554", "0.5943029", "0.59356576", "0.5925343", "0.5908555", "0.5897268", "0.5894053", "0.5883061", "0.5879703", "0.5879703", "0.58755773", "0.58145523", "0.5793739", "0.5783", "0.57817805", "0.5773427", "0.5741047", "0.57304984",...
0.74782073
0
Do a batched gather on a 3D tensor.
def batch_gather_3d(values, indices): return tf.gather(tf.reshape(values, [-1, tf.shape(values)[2]]), tf.range(0, tf.shape(values)[0]) * tf.shape(values)[1] + indices)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather(input: torch.Tensor) -> Tuple[torch.Tensor]:\n return GatherLayer.apply(input)", "def gather(tensor):\n if PartialState().distributed_type == DistributedType.TPU:\n return _tpu_gather(tensor)\n elif PartialState().distributed_type in TORCH_DISTRIBUTED_OPERATION_TYPES:\n return _...
[ "0.6302166", "0.6237263", "0.6120555", "0.60212666", "0.6008304", "0.5993317", "0.59825003", "0.59671915", "0.59625334", "0.58826137", "0.5852146", "0.58414745", "0.57512283", "0.56198025", "0.5593949", "0.55925506", "0.5582084", "0.5577364", "0.5508032", "0.5507494", "0.5465...
0.6951424
0
Do a batched gather on a 2D tensor.
def batch_gather_2d(values, indices): return tf.gather(tf.reshape(values, [-1]), tf.range(0, tf.shape(values)[0]) * tf.shape(values)[1] + indices)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_gather(tensors, indices):\n is_singleton = not isinstance(tensors, (list, tuple))\n\n if is_singleton:\n tensors = [tensors]\n\n sequence_dim = len(indices.get_shape()) - 1\n if sequence_dim > 1:\n batch_shape = shape(tensors[0])[:sequence_dim]\n batch_size = 1\n for s in batch_shape:\n ...
[ "0.628341", "0.6264856", "0.62005585", "0.616745", "0.61495984", "0.6109914", "0.60996586", "0.60989064", "0.608136", "0.6065413", "0.60612226", "0.59515154", "0.59039307", "0.5901351", "0.58886105", "0.58401215", "0.5803595", "0.5794062", "0.57369864", "0.5714343", "0.570400...
0.6702868
0
Apply study description filter
def test_filter_study_desc(self): self.client.login(username='temporary', password='temporary') response = self.client.get(reverse_lazy('dx_summary_list_filter') + '?study_description=CR', follow=True) self.assertEqual(response.status_code, 200) one_responses_text = u'There are 2 studies...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _description_filter(self, df):\n df = df[df['Description'].str.contains(\"and\")]\n df['Description'] = df['Description'].map(lambda x: x[:MAX_DESC_LENGTH])\n return df", "def filter(self, filters):", "def sanitize_sample_descriptions(sample_description_list, sanitize_fn=sanitize_text)...
[ "0.6134804", "0.56931835", "0.5660236", "0.55813044", "0.5564626", "0.5460468", "0.53609484", "0.523943", "0.522782", "0.5190649", "0.51765674", "0.5142829", "0.5125176", "0.51222235", "0.51137686", "0.5104604", "0.5045232", "0.5022879", "0.50205487", "0.5015759", "0.5005608"...
0.6737063
0
Get the parent directory of this file. This makes it so the app will work, (and the db will be found) no matter the current working directory.
def getParentDirectory(): path = os.path.dirname(os.path.realpath(__file__)) path = '/'.join( path.split('/')[:-1] ) return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_parent_path(self):\n return os.path.join(os.getcwd(), \"src\", \"data\", \"genes\")", "def get_base_dir(self):\n dir_of_this_file = os.path.dirname(os.path.abspath(__file__))\n return os.path.dirname(dir_of_this_file)", "def get_parent_dir(path):\n return os.path.dirname(path)"...
[ "0.78082865", "0.7638114", "0.7614312", "0.7529412", "0.75218713", "0.7497493", "0.74604976", "0.7340551", "0.728736", "0.7257311", "0.71410936", "0.71262145", "0.7101389", "0.70540065", "0.7024741", "0.7024741", "0.7021977", "0.7003165", "0.6980236", "0.6978866", "0.69738686...
0.82124346
0
Set the two sequences to be compared. >>> s = SequenceMatcher() >>> s.set_seqs("abcd", "bcde") >>> s.ratio() 0.75
def set_seqs(self, a, b): self.set_seq1(a) self.set_seq2(b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _match(a, b):\n return SequenceMatcher(None, a, b).ratio()", "def similar(a, b):\n return SequenceMatcher(None, a, b).ratio()", "def similar(a, b):\n return SequenceMatcher(None, a, b).ratio()", "def string_match_ratio(str1, str2):\n sm = edit_distance.SequenceMatcher(a=str1, b=str2)\n ...
[ "0.5984555", "0.5930257", "0.5930257", "0.575731", "0.5574542", "0.55189204", "0.538439", "0.53444505", "0.5282242", "0.519625", "0.519416", "0.5169865", "0.5141124", "0.5134836", "0.5129731", "0.5116236", "0.5072094", "0.5070735", "0.505594", "0.5035924", "0.50188625", "0....
0.60350657
0
Get the View from the path to help build the list of safe views.
def _get_view(self, view_path): right_most_dot = view_path.rfind('.') module_path, view_name = ( view_path[:right_most_dot], view_path[right_most_dot + 1:]) module = __import__(module_path, globals(), locals(), [view_name]) return getattr(module, view_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_view_and_args(path, request):\n # Let's use urlconf from request object, if available:\n urlconf = getattr(request, \"urlconf\", settings.ROOT_URLCONF)\n resolver = RegexURLResolver(r\"^/\", urlconf)\n return resolver.resolve(path)", "def getViews(read):\n ...", "def static_view_finder(...
[ "0.6225276", "0.6064448", "0.59390426", "0.584949", "0.58025235", "0.57702816", "0.57678056", "0.57524335", "0.5722791", "0.5600051", "0.5592325", "0.5578807", "0.55743736", "0.551812", "0.5507082", "0.55015093", "0.54933405", "0.5463006", "0.5449332", "0.5446513", "0.5440941...
0.6682703
0
Returns a mask with specified bit ranges set. An integer mask is generated based on the bits and bit ranges specified by the arguments. Any number of arguments can be provided. Each argument may be either a 2tuple of integers, a list of integers, or an individual integer. The result is the combination of masks produced...
def bitmask(*args: Union[int, Sequence[int], Tuple[int, int]]) -> int: mask = 0 for a in args: if isinstance(a, tuple): hi, lo = a mask |= ((1 << (hi - lo + 1)) - 1) << lo elif isinstance(a, (list, set)): mask |= reduce(operator.or_, ((1 << b) for b in a)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask(n, start, end):\n columns = []\n value = 1\n for i in range(n):\n if start <= end:\n columns.append(value if (start <= i < end) else 0)\n else:\n columns.append(value if (start <= i or i < end) else 0)\n value <<= 1\n ...
[ "0.5995168", "0.59024674", "0.5739385", "0.5613326", "0.5611902", "0.55834854", "0.5490211", "0.54637986", "0.54594946", "0.5416668", "0.5414292", "0.5406115", "0.5387957", "0.5382915", "0.53585654", "0.5351825", "0.5345867", "0.53413814", "0.5329045", "0.52851546", "0.527291...
0.7710858
0
Return the bitwise inverted value of the argument given a specified width. value Integer value to be inverted. width Bit width of both the input and output. If not supplied, this defaults to 32. Integer of the bitwise inversion of value.
def bit_invert(value: int, width: int = 32) -> int: return ((1 << width) - 1) & (~value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invert(val):\n return -1 * coerce_to_int(val)", "def twos_complement(value: int, width: int) -> int:\n signmask = 1 << (width - 1)\n if (value & signmask) == 0:\n # Mask off sign bit.\n return value & (signmask - 1)\n else:\n # Two's complement.\n return -bit_invert(va...
[ "0.6442035", "0.6396958", "0.6054422", "0.5648667", "0.54536587", "0.543744", "0.5432142", "0.54318696", "0.5411972", "0.5411253", "0.5406764", "0.53561056", "0.53310287", "0.51702154", "0.51562136", "0.51495856", "0.51446515", "0.514284", "0.51397866", "0.51321155", "0.51226...
0.8374871
0
Modified the bitfield in a register value. self The Bitfield object. register_value Integer register value. field_value New value for the bitfield. Must not be shifted into place already. Integer register value with the bitfield updated to `field_value`.
def set(self, register_value: int, field_value: int) -> int: return bfi(register_value, self._msb, self._lsb, field_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_register_field(self, field, value, verify=False):\n logger.debug(\"Writing value {} to field {}-{} in register {}\".format(\n value,field.startbit,field.get_endbit(),field.register))\n\n # check input fits in specified field\n if (1 << (field.length)) <= value:\n ...
[ "0.6882494", "0.67327577", "0.64652544", "0.58483684", "0.58094406", "0.5782345", "0.571288", "0.56897306", "0.56717145", "0.56447816", "0.5632034", "0.561708", "0.5536422", "0.55185086", "0.5469732", "0.54658073", "0.54023707", "0.5393991", "0.5372027", "0.5327026", "0.52552...
0.72762865
0
Test whether two sequences contain the same values. Unlike a simple equality comparison, this function works as expected when the two sequences are of different types, such as a list and bytearray. The sequences must return compatible types from indexing.
def same(d1: Sequence[Any], d2: Sequence[Any]) -> bool: if len(d1) != len(d2): return False for i in range(len(d1)): if d1[i] != d2[i]: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence_equals(sequence1, sequence2):\n assert len(sequence1) == len(sequence2), (len(sequence1), len(sequence2))\n for item_from_s1, item_from_s2 in zip(sequence1, sequence2):\n assert item_from_s1 == item_from_s2, (item_from_s1, item_from_s2)\n\n return True", "def __eq__(self, seq):\n ...
[ "0.7813231", "0.7145499", "0.70590293", "0.7007046", "0.6919414", "0.6892941", "0.68648785", "0.6858367", "0.6839692", "0.67992145", "0.6797385", "0.6788613", "0.6783527", "0.67567945", "0.6742153", "0.67207736", "0.6698523", "0.6692463", "0.6635252", "0.6586327", "0.65729964...
0.7649041
1
Return value aligned down to multiple.
def align_down(value: int, multiple: int) -> int: return value // multiple * multiple
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def align_up(value: int, multiple: int) -> int:\n return (value + multiple - 1) // multiple * multiple", "def align(val):\n ovr = val % ALIGNMENT\n if (ovr):\n val = val + ALIGNMENT - ovr\n return val", "def next_larger_multiple(value, multiple):\n return multiple * math.ceil(value / mult...
[ "0.7706064", "0.7037037", "0.63738245", "0.6165709", "0.60679907", "0.56774473", "0.5659092", "0.55996305", "0.55584687", "0.53745484", "0.5360651", "0.5357041", "0.5354797", "0.5353794", "0.5328098", "0.53273886", "0.53250384", "0.53149056", "0.53149056", "0.52961886", "0.52...
0.79042345
0
Return value aligned up to multiple.
def align_up(value: int, multiple: int) -> int: return (value + multiple - 1) // multiple * multiple
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def align_down(value: int, multiple: int) -> int:\n return value // multiple * multiple", "def align(val):\n ovr = val % ALIGNMENT\n if (ovr):\n val = val + ALIGNMENT - ovr\n return val", "def next_larger_multiple(value, multiple):\n return multiple * math.ceil(value / multiple)", "def ...
[ "0.76178324", "0.7052247", "0.6255033", "0.6204089", "0.58212984", "0.57040334", "0.55434275", "0.5518695", "0.54680246", "0.5414448", "0.53553", "0.527706", "0.52528614", "0.5209934", "0.5208516", "0.5195294", "0.51839477", "0.5137807", "0.5129195", "0.5119322", "0.5105192",...
0.77190053
0
Return value divided by the divisor, rounding up to the nearest multiple of the divisor.
def round_up_div(value: int, divisor: int) -> int: return (value + divisor - 1) // divisor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_to_multiple_of(val, divisor, round_up_bias=0.9):\n assert 0.0 < round_up_bias < 1.0\n new_val = max(divisor, int(val + divisor / 2) // divisor * divisor)\n return new_val if new_val >= round_up_bias * val else new_val + divisor", "def _ceil_div(value, factor):\n if value % factor == 0:\n ...
[ "0.7550002", "0.74696445", "0.743567", "0.73714924", "0.73528147", "0.7314674", "0.7314674", "0.7314674", "0.7314674", "0.7314674", "0.7314674", "0.7314674", "0.73081744", "0.7294456", "0.72579414", "0.72429836", "0.7158656", "0.7132212", "0.7024962", "0.70230913", "0.6963808...
0.8534208
0
Compute parity over a 32bit value. This function is intended to be used for computing parity over a 32bit value transferred in an Arm ADI AP/DP register transfer. The result is returned in bit 32, ready to be OR'd into the register value to form the 33bit data + parity for the AP/DP register transfer. n 32bit integer. ...
def parity32_high(n: int) -> int: n ^= n >> 16 n ^= n >> 8 n ^= n >> 4 n &= 0xf return (0xD32C0000 << n) & (1 << 32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parity_odd(x):\r\n\t\t\tx = x ^ (x >> 4)\r\n\t\t\tx = x ^ (x >> 2)\r\n\t\t\tx = x ^ (x >> 1)\r\n\t\t\treturn x & 1", "def parity(n):\n # bin(n) returns 0b.... \n # bin(n)[2:] trims \"ob\"\n return sum(int(x) for x in bin(n)[2:]) % 2", "def parity(x):\n\n res = 0\n while x:\n # XOR flips last bit\n ...
[ "0.7133543", "0.6885397", "0.67277306", "0.67071563", "0.6632368", "0.6623402", "0.6473091", "0.62973255", "0.61287665", "0.5915613", "0.5849972", "0.55896115", "0.55135816", "0.5464266", "0.5420463", "0.5396798", "0.53685755", "0.52674574", "0.52268904", "0.52255875", "0.520...
0.7475924
0
Test fib_digits returns correct integer pairs.
def test_fib_digits(n, result): from even_digit_primes import f assert f(n) == result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_digits_fibonacci(digits):\n fib = [1, 1]\n\n while len(str(fib[-1])) < digits:\n fib.append(fib[-1]+fib[-2])\n\n return fib", "def test_fibonacci():\n\n def isPerfectSquare(x):\n s = int(math.sqrt(x))\n return s * s == x\n\n def isFibonacci(n):\n # n is Fibonacci ...
[ "0.68498516", "0.6797962", "0.6625413", "0.6603754", "0.6591817", "0.65323377", "0.6487722", "0.64611775", "0.6442528", "0.6406966", "0.6389307", "0.63814795", "0.6327189", "0.63040644", "0.62928617", "0.628131", "0.62811166", "0.6279116", "0.62585217", "0.62416375", "0.62220...
0.7925204
0
Download and install "miniconda".
def conda_install(): require('MINICONDA_NAME') require('MINICONDA_FILE') with cd(utils.home()): if not files.exists(env.MINICONDA_NAME): # Download the miniconda installer. run('wget {0}'.format(env.MINICONDA_FILE)) # Give permission to execute installer. ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_anaconda(prefix):\n prefix = os.path.join(os.path.realpath(prefix), \"miniconda\")\n if \"Windows\" in platform.system():\n command = \" \".join([\n ANACONDA_INSTALL_SCRIPT,\n \"/S\",\n \"/AddToPath=0\",\n \"/RegisterPython=0\",\n \"/D...
[ "0.69456744", "0.62597215", "0.6118621", "0.6035285", "0.5657302", "0.56538", "0.5515435", "0.52801204", "0.52286595", "0.50935763", "0.5031322", "0.5025495", "0.49713638", "0.49667668", "0.4921598", "0.4901545", "0.4900025", "0.48586303", "0.48580027", "0.48501986", "0.48259...
0.83013046
0
List all conda virtual environments.
def conda_list_environments(): conda = '{0}/bin/conda'.format(utils.home('apps', 'miniconda')) run('{conda} info --envs'.format(conda=conda))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_environments():\n return ENVIRONMENTS", "def list_venvs(obj) -> None:\n if not isinstance(obj, VenvConfig): # pragma: no cover\n raise TypeError(\"ctx.obj must be a VEnvConfig\")\n obj.list()", "def envs():\n\n # update and grab the envs from the metadata keys\n metadata = _i...
[ "0.7038529", "0.68373734", "0.67901546", "0.6143945", "0.6143042", "0.6107839", "0.60895985", "0.60845685", "0.60367084", "0.5997797", "0.5934772", "0.5918228", "0.58790326", "0.5861501", "0.58602077", "0.58495873", "0.58452374", "0.578232", "0.5768105", "0.5725452", "0.57238...
0.83509284
0
Places a vehicle modeled as a box as 8 points in the world coordinate system about a position and orientation in degrees
def place_vehicle_box(position, heading_from_x_axis, length=5.0, width=2.0, height=2.0): quat = helper.quat_from_rpy(0.0, 0.0, heading_from_x_axis) # define 8 points as points of the rectangular prism l, w, h = length/2.0, width/2.0, height base_points = np.array([[-l, -w, 0], [-l, w, 0], [l, w, 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_box(self) -> None:\n from math import pi, sin, cos\n import pymol\n from pymol import cmd\n\n # Convert angle\n angle1 = (self.angle1.value() / 180.0) * pi\n angle2 = (self.angle2.value() / 180.0) * pi\n\n # Get positions of box vertices\n # P1\n ...
[ "0.63864404", "0.636662", "0.6141546", "0.60586977", "0.6005823", "0.5877428", "0.58661616", "0.58498317", "0.57609266", "0.5759974", "0.5730846", "0.5712925", "0.5651433", "0.56298864", "0.56274277", "0.56050247", "0.559568", "0.55869895", "0.55751854", "0.55711466", "0.5570...
0.6957321
0
Takes an instantiated camera, its definition, and vehicle grid placement parameters and generates world center and orientation of a vehicle
def camera_grid_generator(camera, vehicle_params): start_x, start_y = 0.0, 0.0 end_x, end_y = camera.R_x, camera.R_y step_x, step_y = end_x/vehicle_params["x_pixel_steps_per_line"], end_y/vehicle_params["y_pixel_steps_per_line"] start_heading = 0.0 orientation_step = vehicle_params["orientation_step...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_camera(self) -> None:\n self.world.camera.update(\n cam_base_pos=(0, -3, 0),\n cam_dist=1.2*self.world.env_dim,\n cam_yaw=0,\n cam_pitch=-60\n )", "def setup_camera(self) -> None:\n self.world.camera.update(\n cam_base_pos=(3.,...
[ "0.601115", "0.5837416", "0.57366174", "0.5664917", "0.5661297", "0.55872494", "0.55048525", "0.54508686", "0.54214007", "0.54165375", "0.54120576", "0.5401298", "0.53846836", "0.53765386", "0.5323575", "0.5311154", "0.5298725", "0.52956396", "0.5283243", "0.5279094", "0.5278...
0.58899003
1
Check module clock against computer clock Print metadata summary
def meta_summary(self, compclock, tolerance, prefix=0): dtdelta = (compclock - self.dumpdt).total_seconds() dtdays = int(abs(dtdelta) / 86400) dthours = int((abs(dtdelta) - (dtdays * 86400)) / 3600) dtmins = int((abs(dtdelta) - (dtdays * 86400) - (dthours * 3600)) / 60) dtsecs = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checktime(host=\"all\", status=False, verbose=False):\n if host == \"all\" :\n exe = helpers.getCarmaBinaryPath() + \"/imrconfig file=\"\n exe += helpers.getCarmaConfPath() + \"/imr/carma.xml hosts=true\"\n host = os.popen(exe).read().split()\n else : host = helpers.makeList(host)\n ...
[ "0.60649735", "0.59678733", "0.5870225", "0.5839971", "0.57395506", "0.5614064", "0.55683297", "0.5483695", "0.54727685", "0.5459222", "0.5442036", "0.5428182", "0.54248905", "0.5403544", "0.5397849", "0.53939074", "0.53908426", "0.5373274", "0.5354035", "0.5348449", "0.53109...
0.644344
0
Make an initial comparison of local system time with NTP server
def check_ntp_server(ntpserv): ntpcheck = "\n--- Network Time Server Check ---\n" ntpoffset = 0.0 try: client = ntplib.NTPClient() response = client.request(ntpserv) ntpoffset = response.offset if ntpoffset < 0: ntpcheck += "*** localhost system clock is {:.2f} s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateRTCFromNTP(strip, start = False):\r\n wifi = connectToWifi(strip, start)\r\n try:\r\n ntptime.settime()\r\n except OSError:\r\n for i in range(0, 3):\r\n ledFlash(strip, LED_COLOR_RED, 0.5)\r\n print(\"Can not connect to NTP server\")\r\n machine.reset()\r\...
[ "0.69371396", "0.6923327", "0.6432035", "0.63634694", "0.6332838", "0.629215", "0.62218714", "0.61958945", "0.6105327", "0.6100027", "0.60587597", "0.60420185", "0.6031987", "0.6021275", "0.5986148", "0.5957376", "0.5911003", "0.5909277", "0.5904858", "0.589998", "0.5893756",...
0.71121156
0
Show a list of ports and ask the user for a choice. To make selection easier on systems with long device names, also allow the input of an index.
def ask_for_port(): sys.stderr.write("\n--- Available ports:\n\n") ports = [] # for n, (port, desc, hwid) in enumerate(sorted(comports()), 1): for n, (port, desc, hwid) in enumerate( sorted(serial.tools.list_ports.grep(r"usb")), 1 ): # sys.stderr.write(' {:2}: {:20}\n\n'.format(n, po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_for_port():\n sys.stderr.write('\\nAvailable ports: <index:> <name> <desc> <hwid>\\n')\n ports = []\n for n, (port, desc, hwid) in enumerate(sorted(comports()), 1):\n sys.stderr.write('{:2}: {:40} {!r} {!r}\\n'.format(n, port, desc, hwid))\n ports.append(port)\n while True:\n ...
[ "0.77245253", "0.7101905", "0.66528", "0.6499736", "0.6409378", "0.6406128", "0.64053947", "0.62409425", "0.61712927", "0.61057574", "0.61040676", "0.6091833", "0.6061859", "0.59017634", "0.5889308", "0.587678", "0.5869022", "0.58643425", "0.585866", "0.582449", "0.57980746",...
0.74328846
1
Send CtrlC CtrlC to TC module to wake it up, capture header content Get computer's UTC time for comparison to time reported in module header If debug flag, write module response to stderr
def wake_tc_get_header(ser, ntpoffset, debug=0): ser.reset_input_buffer() ser.reset_output_buffer() wakeup = b"\x03\x03" for b in serial.iterbytes(wakeup): n = ser.write(b) if debug: LOGGER.debug("{} byte ({}) written to port".format(n, b)) time.sleep(0.1) timec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ctrl_c(self, m_sys, m_docker_client):\n # attach(..., stream=True) returns a generator.\n def container_output_gen():\n yield (\"Some output\\n\")\n yield (\"from the container.\")\n raise KeyboardInterrupt()\n yield (\"This output is not printed.\...
[ "0.5537267", "0.5361951", "0.52658105", "0.5100411", "0.5076525", "0.5048181", "0.5031328", "0.497372", "0.4949209", "0.49303126", "0.48847353", "0.48809353", "0.48770487", "0.48665327", "0.48554787", "0.48369825", "0.48110306", "0.47755748", "0.47581947", "0.4738944", "0.473...
0.5395374
1
Wait 10 seconds for response to waking SSC module, capture header content Get computer's UTC time for comparison to time reported in module header If debug flag, write module response to stderr
def wake_ssc_get_header(ser, ntpoffset, debug=0): ser.reset_output_buffer() xloop = 0 while not ser.in_waiting: xloop += 1 if xloop > 1000: return None, None time.sleep(0.01) timecheck = datetime.utcnow() + timedelta(seconds=ntpoffset) capture = "" rx = 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_wait(duration, headers):\n debug = os.environ.get(\"DREPIN_DEBUG\")\n message = \"DREPIN_DEBUG is not defined. Delay duration: 0 sec.\"\n if debug:\n message = \"Delay duration: {} sec.\".format(duration)\n time.sleep(duration)\n return message", "def print_header(now):\n glo...
[ "0.6006486", "0.5748688", "0.56277704", "0.5531151", "0.54853964", "0.54494965", "0.54210263", "0.54210263", "0.54210263", "0.53777826", "0.5377109", "0.53375447", "0.5314768", "0.5298772", "0.5266956", "0.5186797", "0.5165283", "0.51626873", "0.51578635", "0.51363677", "0.51...
0.6024316
0
Send 'TEXT.DUMP' command to module, wait for response Write response (hopefully module header and data) to stderr and output file. Check each record for sync flag 'CAFE', change output file name as necessary.
def dump_data(ser, meta, args): ser.reset_input_buffer() ser.reset_output_buffer() command = b"TEXT.DUMP\r" rx = "" ntry = 0 while not rx or (rx.split()[-1] != "data?"): rx = send_cmd(ser, command, args.debug) # sys.stderr.write(rx) ntry += 1 if ntry > 3: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def core_dump(self):\r\r\n loggerModem = logging.getLogger(__name__ + 'core_dump')\r\r\n cmd_l=[r'at%debug=0', r'at%debug=2']\r\r\n cmd_str='\\r\\n'.join(cmd_l)\r\r\n\r\r\n text_str = \"AT command\"\r\r\n if self.dumpfile:\r\r\n loggerModem.debug(\"Core file : %s\" % s...
[ "0.6052406", "0.5467339", "0.5407923", "0.5234022", "0.5169445", "0.50867075", "0.50670743", "0.5018628", "0.49960986", "0.4993158", "0.4982567", "0.4964626", "0.4946717", "0.4942943", "0.4938567", "0.49164003", "0.48742476", "0.48606214", "0.48547417", "0.48527837", "0.48507...
0.65606326
0
Update all sections in a semester. If given abbreviation + course_number, update only that course's sections.
def update(self, semester, year, abbreviation=None, course_number=None): print({ 'message': 'Updating sections.', 'semester': semester, 'year': year, 'abbreviation': abbreviation, 'course_number': course_number, }) # Get list of course...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_section(self, new_section, updating=False):\n SECTION_QUERY = \"\"\"UPDATE Section SET num_students = %s, comment1 = %s, comment2 = %s WHERE course_name = %s, semester = %s, section_id = %s, year = %s\"\"\" if updating \\\n else \"\"\"INSERT INTO Section (course_name, semester, section_id...
[ "0.59073246", "0.56396455", "0.562492", "0.55179805", "0.5505804", "0.5351788", "0.5218658", "0.5199531", "0.51550674", "0.5150656", "0.5132869", "0.49909762", "0.49885237", "0.48526812", "0.48107865", "0.4799445", "0.47773656", "0.47734866", "0.47230178", "0.47230116", "0.47...
0.80155516
0
Update all sections for a course in a semester. Though not rigorously defined, a 'class' here is the collection of sections for a course offered in a single semester.
def _update_class(self, course, semester, year): if cache_result := cache.get(f'no classes {course.id}'): print(f'no classes found for course {course.id} at {cache_result}') return # Get response from SIS class resource response = sis_class_resource.get( sem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, semester, year, abbreviation=None, course_number=None):\n print({\n 'message': 'Updating sections.',\n 'semester': semester,\n 'year': year,\n 'abbreviation': abbreviation,\n 'course_number': course_number,\n })\n\n # Get ...
[ "0.7309514", "0.6702245", "0.632187", "0.6302274", "0.6232388", "0.62125766", "0.6172755", "0.5890496", "0.58623636", "0.58243483", "0.58036506", "0.57898164", "0.5713571", "0.5671586", "0.5622817", "0.5616263", "0.55887914", "0.5585681", "0.5510564", "0.54654753", "0.5460308...
0.70675933
1
Returns true, if all elements of sequence are equal
def all_equal(sequence): return all(x == sequence[0] for x in sequence)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, seq):\n # If seq is different length or not a list, then it is not equal\n if self._length != len(seq) or not isinstance(seq, list):\n return False\n # seq is equal if every element at the same index has equivalent value\n return all(self._arr[i] == seq[i] fo...
[ "0.7771811", "0.7630559", "0.76040655", "0.74519235", "0.74492294", "0.74333686", "0.74333686", "0.73482615", "0.7314613", "0.7251249", "0.7221133", "0.71162134", "0.7042793", "0.69785583", "0.6889345", "0.6882769", "0.68535495", "0.68117934", "0.6715549", "0.66522205", "0.66...
0.8933809
0
Save stereo or mono sonifications
def save_stereo(self, fname, master_volume=1.): if len(self.out_channels) > 2: print("Warning: sonification has > 2 channels, only first 2 will be used. See 'save_combined' method.") # first pass - find max amplitude value to normalise output # and concatenate channels to l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stereo(filename,time,wout=True):\n n, data, data_dB,sr,ch=inputwav(filename)\n s_shift=int(sr*time*1E-3)\n R=np.zeros(n)\n L=np.zeros(n)\n if ch==2:\n L[:]=data[:,0]\n R[:]=data[:,1]\n if ch==1:\n L[:]=data[:,0]\n R[:]=data[:,0]\n print('Applying stereo width.....
[ "0.6303113", "0.6231249", "0.6198246", "0.5950591", "0.5906383", "0.58590186", "0.5698299", "0.56980276", "0.56471825", "0.56357217", "0.56219125", "0.5585795", "0.55833113", "0.5571781", "0.553028", "0.5518988", "0.5494285", "0.5490669", "0.5483737", "0.54784036", "0.5476098...
0.7189394
0
Save render as a combined multichannel wav file Can use this function to save sonification of any audio_setup, using ffmpeg processing, and unscrampling to the correct channel order.
def save_combined(self, fname, ffmpeg_output=False, master_volume=1.): # setup list to house wav stream data inputs = [None]*len(self.out_channels) # first pass - find max amplitude value to normalise output vmax = 0. for c in range(len(self.out_channels)): vmax = m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_stereo(self, fname, master_volume=1.):\n\n if len(self.out_channels) > 2:\n print(\"Warning: sonification has > 2 channels, only first 2 will be used. See 'save_combined' method.\")\n \n # first pass - find max amplitude value to normalise output\n # and concatenate ...
[ "0.67646736", "0.6626647", "0.6266401", "0.62461674", "0.61140275", "0.6086729", "0.6073783", "0.604304", "0.5992487", "0.5956512", "0.5926306", "0.5846258", "0.58324414", "0.5821109", "0.58165187", "0.580056", "0.5795595", "0.5793863", "0.5790893", "0.579088", "0.5759375", ...
0.72466904
0
plot the waveforms and embed player in the notebook Show waveforms and embed an audio player in the python notebook for direct playback. the notebook player only supports up to stereo, so if more than two channels, only the first two are used as left and right.
def notebook_display(self): time = self.out_channels['0'].samples / self.out_channels['0'].samprate vmax = 0. for c in range(len(self.out_channels)): vmax = max( abs(self.out_channels[str(c)].values.max()), abs(self.out_channels[str(c)].values.min()),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # st.info(__doc__)\n st.markdown(STYLE, unsafe_allow_html=True)\n\n col1, col2 = st.beta_columns(2)\n\n # Audio upload\n audio_file = col1.file_uploader(\"Upload file\", type=FILE_TYPES)\n show_file = col1.empty()\n if not audio_file:\n show_file.info(\"Please upload a fil...
[ "0.6688491", "0.6415009", "0.62456554", "0.61815965", "0.59825194", "0.58767325", "0.58695394", "0.58606106", "0.585154", "0.57592803", "0.57416207", "0.57049185", "0.56237274", "0.5622428", "0.56160945", "0.55887264", "0.5554027", "0.55509603", "0.55428576", "0.5542391", "0....
0.70891184
0
Default string representation of an episode
def __repr__(self: object) -> str: measstring: str = "Tatort - {:04d} - {} - {} - {} - {}".format(self.episode_id, self.episode_name, self.episode_inspectors, self.episode_sequence, self.episode_broadcast) return measstring
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_repr_episode(self):\n self.assertEquals(\n repr(self.t['CNNNN'][1][1]),\n \"<Episode 01x01 - September 19, 2002 (20:30 - 21:00)>\"\n )", "def episode_title_for_tvdb(self):\n \n # strip out the year from the episode title:\n return \"Episode %d\"%s...
[ "0.6892609", "0.6823024", "0.66752917", "0.66561633", "0.6531795", "0.6483069", "0.59807134", "0.59258676", "0.5917912", "0.5902664", "0.57870936", "0.57848823", "0.5757625", "0.5751035", "0.57418555", "0.5741557", "0.5729932", "0.5685127", "0.5668884", "0.56685406", "0.56558...
0.70681846
0
Check if episode matches the filename
def matches(self: object, filename: str) -> bool: # Filename is equal to episode string representation if str(self) == filename: return True # Check leading episode number => download marked as special episode manually filename_match: Match[str] = re.search(r"(^[0-9]{4} )", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_download_specific_episode(self):\n episode = self._get_episode()\n torrent_filename = self.fetcher.download_specific_episode(episode)\n self.assertEqual(torrent_filename, FILENAME_2)", "def has_filename(self):\n if self.filename == \"untitled\":\n return False\n else:\n ...
[ "0.692733", "0.63529074", "0.61275893", "0.6059626", "0.60187244", "0.6013806", "0.60092103", "0.6005156", "0.5968689", "0.5959677", "0.59322983", "0.5896534", "0.58897823", "0.58860147", "0.586119", "0.58537513", "0.58447766", "0.5843757", "0.5820994", "0.57811594", "0.57020...
0.78865135
0
Generates an MSBuild payload. The file's name will be staged/stageless_64/32.xml depending on the staging and architecture of the generated payload.
def generateMSBuild( self, agscriptPath: str, listener: str, outputPath: str = './', staged: bool = False, x64: bool = True ): shellcode = self.generateShellcode(listener, staged=staged, x64=x64) if shellcode: encoded = base64.b64encode(shellcode) if x64: arch = "64" else: arch = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePayload(\n\t\tself, \n\t\tlistener: str, \n\t\tartifact_type: 'ArtifactType', \n\t\tstaged: bool = False, \n\t\tx64: bool = True\n\t) -> bytes:\n\t\tif x64:\n\t\t\tarch = \"x64\"\n\t\telse:\n\t\t\tarch = \"x86\"\n\n\t\tif staged:\n\t\t\tfunction = \"artifact_stager\"\n\t\telse:\n\t\t\tfunction = \"arti...
[ "0.60222113", "0.57082", "0.5464583", "0.53195286", "0.52366763", "0.522021", "0.5214184", "0.5179783", "0.5174202", "0.5165629", "0.51046497", "0.50927144", "0.5089831", "0.5016062", "0.50151026", "0.49320623", "0.4913447", "0.49012786", "0.48914814", "0.48749232", "0.487293...
0.73205304
0
Connect to CS team server
def connectTeamserver(self): # In my testing, I found that there were issues sending too many # messages to event log over one connection ( => ~7), so I recommend # creating a new object every so often or disconnecting and reconnecting. # This issue needs to be troubleshot (troubleshooted?) in the future i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __enter__(self) -> 'CSConnector':\t\t\n\t\tself.connectTeamserver()\n\t\treturn self", "def connect_to_server(self):\n\n server=os.popen('hostname').read()\n if 'epfl.ch' not in server:\n conn = mds.Connection('tcvdata.epfl.ch')\n conn.openTree('tcv_shot', self.shot)\n ...
[ "0.6808818", "0.67253095", "0.6314064", "0.6253115", "0.61478263", "0.61306477", "0.61055356", "0.6078703", "0.60469615", "0.6033928", "0.60079867", "0.5991796", "0.5918314", "0.58971834", "0.5884616", "0.58705187", "0.5805506", "0.5789507", "0.57733417", "0.57255983", "0.571...
0.7268684
0
Disconnect from CS team server
def disconnectTeamserver(self): # close the agscript process if self.cs_process: self.cs_process.close() else: print("CS was already disconnected! Hopefully you already knew this.") # clear config vars #self.socks_port = '' #self.beacon_pid = '' #self.bid = '' #self.socks_port_connected = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect(self):\n r = requests.post(f'{self.SERVER_ADDR}/api/disconnect', headers={'Authorization': 'Token ' + self.token})\n r.raise_for_status()", "def disconnect():\n\n\tglob.tokens.deleteToken(glob.tokens.getTokenFromUserID(999))", "def disconnect():\n logging.info('Client disconnect...
[ "0.77458733", "0.7388412", "0.708683", "0.70863456", "0.70855576", "0.69495", "0.6946623", "0.6928156", "0.6895667", "0.68756366", "0.68551135", "0.68306154", "0.6818361", "0.6812805", "0.67746043", "0.6712635", "0.6712635", "0.6712635", "0.6712635", "0.6712635", "0.67083234"...
0.8071877
0
Loads a TF DistilBERT model from disk. Requires a TF model JSON and matching weights HDF5.
def get_bert_clf(): model = tf.keras.models.model_from_json(get_object('distilbert_model.json', 'r')) model.load_weights(model_dir/'distilbert_weights.hdf5') return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_bert(bert_path: str) -> DistilBertModel:\n \n return transformers.DistilBertModel.from_pretrained(bert_path.split(\"/\")[-1],)", "def load_model():\n global model_tok, model_mlm, model, model_cls\n if model is None:\n model_name_or_path = os.getenv('TRANSFORMER_MODEL', default='distil...
[ "0.6959563", "0.6595203", "0.64651626", "0.64029515", "0.64007574", "0.6391504", "0.6389886", "0.6382109", "0.6325404", "0.6314643", "0.6312481", "0.63053036", "0.628094", "0.62788576", "0.6257383", "0.62431", "0.6227926", "0.6222491", "0.62206703", "0.62203914", "0.62166363"...
0.7081523
0
Makes a prediction on `query` using `clf_type`, optionally returning probabilities.
def predict(query, clf_type, probas=False): clf_types = ['bert'] if clf_type not in clf_types: raise ValueError(f'`clf_type` must be one of {clf_types}') if clf_type == 'bert': x = bert_tkzr(query, padding='max_length', max_length=100, truncation=True, return_tensors='tf') pred = ber...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(\n self,\n query: str = None,\n n_predictions: int = None,\n retriever_score_weight: float = 0.35,\n return_all_preds: bool = False,\n ):\n\n if not isinstance(query, str):\n raise TypeError(\n \"The input is not a string. Please pr...
[ "0.61752635", "0.5986784", "0.59645206", "0.57622683", "0.5646404", "0.56376857", "0.5617043", "0.5584285", "0.55033684", "0.5468079", "0.5438504", "0.54021007", "0.5369579", "0.5367017", "0.5347045", "0.534229", "0.5317413", "0.5294753", "0.5259834", "0.52245325", "0.5208639...
0.758634
0
Applies each NER model passed in `ners` on `query`, taking the union set of their predictions. Ignores various types of entities not useful for the business case.
def apply_ners(query, ners): ignore = ['CARDINAL', 'DATE', 'MONEY', 'ORDINAL', 'PERCENT', 'QUANTITY', 'TIME'] if not isinstance(ners, Iterable): ners = [ners] preds = set() for ner in ners: pred = ner(query) preds.update({e.text for e in pred.ents if e.label_ not in ignore}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_all_trainers(q, county, skill, diciplines):\n model = Trainer\n sqs = SearchQuerySet().models(model)\n\n if q is not None and q not in ('', '0'):\n sqs = sqs.filter_or(name=AutoQuery(q))\n sqs = sqs.filter_or(email=AutoQuery(q))\n\n if county is not None and county not in ('', ...
[ "0.5627644", "0.53449416", "0.4984958", "0.4956766", "0.4891891", "0.48880184", "0.48676622", "0.48525736", "0.48514426", "0.4790326", "0.47404784", "0.47294402", "0.47181335", "0.46985117", "0.46837392", "0.46826315", "0.46826315", "0.46692058", "0.46422508", "0.46241277", "...
0.7351375
0
Filters `df` by `tags` and streamlines DataFrame appearance in the UI, depending on whether `df` contains query or expert data.
def show_df_by_tags(df, tags): return st.dataframe(filter_df(df, tags)) if not 'Expert' in df.columns else st.dataframe(filter_df(df, tags), height=150, width=450)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crossfilter_by_tag(self,df, tag):\n col,spec= list(tag.items())[0]\n return df[df[col]==spec]", "def hacky_tagging(df):\n\n df['tag'] = 'none' # add tag column (set to 'none' by default)\n\n df_rtemp = df.query('name == \"ROOMTEMP\"') # tag 'room_temp'\n df.loc[df_rtemp.index, 'tag']...
[ "0.6755258", "0.6149031", "0.5976484", "0.59734195", "0.5755026", "0.55929774", "0.5552872", "0.55354345", "0.55064297", "0.5398084", "0.5397062", "0.5374368", "0.5302532", "0.530131", "0.52849764", "0.52504003", "0.52212536", "0.5209753", "0.52061975", "0.5192886", "0.512780...
0.80028766
0
get a canonical for a specific contentid
def get_canonical(self, id): canonical = None if id in self.canonicals: canonical = self.canonicals[id] return canonical
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_content_by_id(self, content_id):\n url = \"http://api.applezhuan.com/api/m/get_content?content_id=%s\" % content_id\n headers = {\n \"Host\": \"api.applezhuan.com\",\n \"Connection\": \"keep-alive\",\n \"Accept\": \"application/json\",\n \"Origin\":...
[ "0.58656305", "0.5723252", "0.5694835", "0.5690846", "0.5667842", "0.5654734", "0.56339806", "0.5605462", "0.5558522", "0.5475486", "0.5419294", "0.5374985", "0.52763873", "0.52607274", "0.5257965", "0.5237707", "0.52269727", "0.5155256", "0.51282", "0.5124557", "0.50875765",...
0.7764283
0
add a canonical there is a usecase where the id can already exist on the OOBTree
def add_canonical(self, id, canonical): if not self.canonicals.insert(id, canonical): # We are going to remove the language on a old canonical # so we need to check if the canonical has other translation active # before removing it canonical_old = self.get_canonic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_canonical(self, id):\n canonical = None\n if id in self.canonicals:\n canonical = self.canonicals[id]\n return canonical", "def make_content_id_unique(self):\n is_node_original = self.original_source_node_id is None or self.original_source_node_id == self.node_id\n ...
[ "0.63310057", "0.6012784", "0.5948852", "0.5705226", "0.5647089", "0.55811375", "0.55705875", "0.54094654", "0.53656423", "0.53409755", "0.532209", "0.5315606", "0.531252", "0.51765686", "0.51623964", "0.50879544", "0.5068205", "0.5059612", "0.50456685", "0.5028423", "0.50237...
0.7160384
0
Run a Caffe network on an input image after preprocessing it to prepare it for Caffe.
def caffe_preprocess_and_compute(pimg, caffe_transformer=None, caffe_net=None, output_layers=None): import caffe # noqa if caffe_net is not None: # Grab the default output names if none were requested specifically. if output_layers is None: output_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_caffe(deploy_file, input_weight_file, training_mean_pickle, inference_width,\n inference_height):\n caffe.set_mode_gpu()\n net = caffe.Net(deploy_file, input_weight_file, caffe.TEST)\n\n # input preprocessing: 'data' is the name of the input blob == net.inputs[0]\n transforme...
[ "0.67077094", "0.6513013", "0.6327204", "0.6255537", "0.6219109", "0.6197426", "0.61933935", "0.61933935", "0.6076099", "0.6071206", "0.60582525", "0.60239714", "0.60040885", "0.59629303", "0.59228253", "0.58913016", "0.58718365", "0.5859405", "0.5852062", "0.5850686", "0.583...
0.70073366
0
Sets the frequency_type of this MonthlyScheduleParameters.
def frequency_type(self, frequency_type): allowed_values = ["day-of-month", "last-day-of-month", "custom"] # noqa: E501 if frequency_type not in allowed_values: raise ValueError( "Invalid value for `frequency_type` ({0}), must be one of {1}" # noqa: E501 .fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule_type(self, schedule_type):\n\n self._schedule_type = schedule_type", "def schedule_type(self, schedule_type):\n\n self._schedule_type = schedule_type", "def type(self, type):\n if type is None:\n raise ValueError(\"Invalid value for `type`, must not be `None`\") # ...
[ "0.6519196", "0.6519196", "0.61696416", "0.61696416", "0.5929421", "0.57562137", "0.56042707", "0.5603833", "0.55820787", "0.55743843", "0.55741084", "0.55741084", "0.5548087", "0.55453634", "0.55442363", "0.5506891", "0.5469647", "0.54503554", "0.5450069", "0.54219294", "0.5...
0.79463154
0
Sets the day_of_month of this MonthlyScheduleParameters.
def day_of_month(self, day_of_month): self._day_of_month = day_of_month
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monthly_day(self, monthly_day):\n\n self._monthly_day = monthly_day", "def __init__(__self__, *,\n day_of_month: Optional[pulumi.Input[str]] = None,\n day_of_week: Optional[pulumi.Input['RefreshScheduleMapScheduleFrequencyPropertiesRefreshOnDayPropertiesDayOfWeek']] = N...
[ "0.7128963", "0.6362633", "0.63394713", "0.6198328", "0.6083698", "0.59888995", "0.5959477", "0.58093905", "0.58093905", "0.5685598", "0.5654272", "0.5651076", "0.56197333", "0.56197333", "0.5604694", "0.5585938", "0.5585938", "0.5577093", "0.55378944", "0.5509653", "0.544917...
0.82245034
0
Sets the week_of_month of this MonthlyScheduleParameters.
def week_of_month(self, week_of_month): allowed_values = ["first", "second", "third", "fourth", "last"] # noqa: E501 if week_of_month not in allowed_values: raise ValueError( "Invalid value for `week_of_month` ({0}), must be one of {1}" # noqa: E501 .format(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monthly_week(self, monthly_week):\n\n self._monthly_week = monthly_week", "def monthly_week_day(self, monthly_week_day):\n\n self._monthly_week_day = monthly_week_day", "def week(self, week):\n\n self._week = week", "def weeks_of_the_month(self) -> Optional[pulumi.Input[Sequence[pulu...
[ "0.6862327", "0.6331729", "0.60383093", "0.56966734", "0.5561449", "0.55597836", "0.53997093", "0.5246082", "0.5210806", "0.5117393", "0.5093318", "0.5032607", "0.5026494", "0.50089705", "0.4997164", "0.49523243", "0.4879109", "0.48593387", "0.48158655", "0.474049", "0.471999...
0.7588538
0
Sets the day_of_week of this MonthlyScheduleParameters.
def day_of_week(self, day_of_week): allowed_values = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] # noqa: E501 if day_of_week not in allowed_values: raise ValueError( "Invalid value for `day_of_week` ({0}), must be one of {1}" # noqa: E501 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_schedule(self, day, week, schedule):\n self.schedule['schedule'][day][week] = schedule", "def monthly_week_day(self, monthly_week_day):\n\n self._monthly_week_day = monthly_week_day", "def __init__(__self__, *,\n day_of_month: Optional[pulumi.Input[str]] = None,\n ...
[ "0.65451014", "0.6450897", "0.6318746", "0.6181094", "0.61504734", "0.60341996", "0.5997357", "0.5934946", "0.58040494", "0.58040494", "0.5783237", "0.57307565", "0.5712482", "0.5665473", "0.5665473", "0.56241703", "0.54240334", "0.53522944", "0.5311846", "0.5273088", "0.5273...
0.714455
0
Sets the months of this MonthlyScheduleParameters.
def months(self, months): allowed_values = ["january", "feburary", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"] # noqa: E501 if not set(months).issubset(set(allowed_values)): raise ValueError( "Invalid values for `months`...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setMonth(self, *args):\n return _libsbml.Date_setMonth(self, *args)", "def set_Month(self, value):\n super(GetTimestampFromDateParametersInputSet, self)._set_input('Month', value)", "def set_monthly(self, interval, *, day_of_month=None, days_of_week=None,\n index=None, **kw...
[ "0.706509", "0.6490704", "0.63334316", "0.62851346", "0.6143732", "0.6106879", "0.60167474", "0.58650213", "0.5827655", "0.5698256", "0.5679997", "0.5614835", "0.56113094", "0.555234", "0.5551026", "0.5551026", "0.552642", "0.5522827", "0.551986", "0.5368505", "0.5368221", ...
0.72907597
0
Function built to load up private_link url string
def private_link_loader(): with open(Default_Location + Default_File, 'r') as f: private_link = f.readline() link_string = private_link.split('=')[1].replace("'", "").strip() f.close() return link_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_link(id_: str, is_public: bool):\n return id_[:8] if is_public else id_[8:]", "def _get_url(self, absolute):", "def format_internal_url(url):\n\n url = url.split('\"')[-2]\n\n if not url.startswith('https:'):\n url = (\n 'https://medium.com{}'.format(url) if not url.star...
[ "0.6267695", "0.6121384", "0.6119787", "0.590862", "0.590665", "0.5841511", "0.58127576", "0.57675666", "0.57369995", "0.5711653", "0.57089186", "0.566503", "0.56441027", "0.5599313", "0.5558284", "0.5556067", "0.5556067", "0.5551697", "0.5539781", "0.55221766", "0.5519972", ...
0.78621435
0
Mighty Ape private Wishlist web scraper function Scraper for parsing Might Ape private wishlist. Set up to build skeleton html code for each item to be output on webpage
def grab_mApe_wishList(id_string) : returned_data = "" mape_wishList_url = 'https://www.mightyape.co.nz/wishlist/'+id_string print("Grabbing results from:",mape_wishList_url) page = requests.get(mape_wishList_url) print("Status:",page.status_code) #print(page.content) tree = html.fromstring(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scrape(self):", "def get_wish_lists():\n flash(\"The Wish list feature is under construction! Please check back soon!\")\n return render_template('index.html')", "def get_listings(drug, page):\n file_number = (page-1) * 25\n html = open('%s_data/%s.html' % (drug, file_number)).read()\n soup...
[ "0.61460096", "0.59381086", "0.59163743", "0.58321685", "0.58090967", "0.57985216", "0.5718267", "0.5693055", "0.56182814", "0.56004435", "0.55690217", "0.5502302", "0.548948", "0.54557216", "0.5454278", "0.5452581", "0.54516864", "0.54082024", "0.5407941", "0.5401023", "0.53...
0.6698157
0
Find the repeating part of a fraction's decimal equivalent.
def repeating_decimal(numerator, divisor, min_length=5): getcontext().prec = 10000 number_string = str(Decimal(numerator) / Decimal(divisor))[:-2] size, stop_looking_size, found = min_length - 1, len(number_string) / 2, None def trailing_chunks(length): """Return last two substrings of the give...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fraction(n: int, m: int):\n fr = str(n / m)\n integer, decimal = fr.split('.')\n # Check for repeating digits\n repeating = ''\n seen = set()\n # Iterate over decimal part\n for num in decimal:\n # Add new numbers to set and pattern string\n if num not in seen:\n r...
[ "0.6894149", "0.6848224", "0.668977", "0.62088144", "0.61858827", "0.61621845", "0.6157845", "0.61535996", "0.61443657", "0.6119444", "0.6111806", "0.6110142", "0.6054709", "0.60318565", "0.6030348", "0.60211957", "0.6014209", "0.5944677", "0.5913727", "0.59124255", "0.591228...
0.6960417
0
function that counts linenumbers, and estimates the of comments in the supplied C++ sourceFile. The function returns a tuple with the format (numLines, numComments).
def analyzeCppCode(self, sourceFile): numLines = 0 # Number of lines of code numComments = 0 # Number of comments in the code f=self.openFile(sourceFile) for line in f: numLines += 1; loc = 0 while (loc != -1): #count the # of times t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _count_comment_rows(vcf_path):\n vcf_lines_generator = lines_from_vcf(vcf_path)\n\n comment_lines_count = 0\n for line in vcf_lines_generator:\n if line.startswith('#'):\n comment_lines_count += 1\n else:\n vcf_lines_generator.close() # Don't leave the file handle ...
[ "0.68301624", "0.65444595", "0.6520541", "0.6145409", "0.6128049", "0.6037432", "0.60169935", "0.6003067", "0.59753484", "0.5958787", "0.59527725", "0.5899834", "0.58490187", "0.57830787", "0.5730602", "0.5728607", "0.5720618", "0.5719583", "0.56406754", "0.56091505", "0.5605...
0.79186606
0
function that counts linenumbers, and estimates the of comments and of tokens in the supplied Python sourceFile. The function returns a tuple with the format (numLines, numDocStr, numComments, numDefs, numClasses).
def analyzePythonCode(self, sourceFile): numLines = 0 # Number of lines of code numDocStr = 0 # Number of doc strings in code numComments = 0 # Number of comments in the code numDefs = 0 # Number of functions numClasses = 0 # Number of classes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analyzeCppCode(self, sourceFile):\n numLines = 0 # Number of lines of code\n numComments = 0 # Number of comments in the code\n\n f=self.openFile(sourceFile)\n for line in f:\n numLines += 1;\n loc = 0\n while (loc != -1): #count the...
[ "0.76874185", "0.5968829", "0.5954283", "0.5884245", "0.58680767", "0.5829623", "0.58096313", "0.5757835", "0.575283", "0.5733373", "0.56727415", "0.5671281", "0.56097543", "0.5603962", "0.5599431", "0.555258", "0.553188", "0.55112416", "0.54930526", "0.5491626", "0.54684174"...
0.7417786
1
create the html header in the supplied outputFile
def _MakeHtmlHeader(self, outputFile, language, title="AutoGrader", header_text=""): if language == 'C++': brush = shBrushCpp_js if language == 'Python': brush = shBrushPython_js html_header = ''' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "htt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputHtmlFileHeader(pageTitle):\n outputHtml(\n \"\"\"\n <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n \"http://www.w3.org/TR/html4/loose.dtd\">\n <html lang=\"en\">\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">...
[ "0.7152052", "0.67620224", "0.6754817", "0.66791964", "0.6628568", "0.6532872", "0.6511477", "0.6427936", "0.6390561", "0.6352134", "0.6268169", "0.62501234", "0.6247941", "0.6149167", "0.6139665", "0.61389315", "0.6135243", "0.6133009", "0.6114474", "0.60384345", "0.6032151"...
0.74869466
0
function that appends the first maxNumLines lines or first maxNumBytes bytes (whichever is smaller) from sourceFile to destFile.
def _fileHead(self, sourceFile, destFile, maxNumLines, maxNumBytes): #os.system('head -n ' + str(numLines) +' "' + sourceFile +'" >> "' + destFile + '"') os.system('head -c ' + str(maxNumBytes) + ' "' + sourceFile + '" | head -n ' + str(maxNumLines) + ' >> "' + destFile + '"')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def truncate_text_file_by_num_tokens(orig_file, dest_file, max_tokens, tok_separator=\" \"):\n with open(orig_file, \"r\") as f_r:\n with open(dest_file, \"w\") as f_w:\n for l in f_r:\n f_w.write(truncate_text_by_num_tokens(l, max_tokens=max_tokens, tok_separator=tok_separator)...
[ "0.55102915", "0.5431867", "0.5430276", "0.5414478", "0.5331924", "0.5188506", "0.51473904", "0.5125271", "0.5117446", "0.5095434", "0.50921696", "0.49860424", "0.49726388", "0.49295855", "0.49209782", "0.49109003", "0.48747078", "0.4865452", "0.48324844", "0.47747716", "0.47...
0.64364463
0
function that gets and reports source code analytics to the destination file in the specified format (AutoGrader.Const.TEXT or AutoGrader.Const.HTML)
def _reportFileAnalytics(self, sourceFiles, outputFile, language): #is this a single file or a set of files? bSingleFile = len(sourceFiles) == 1 #open the output file for appending f=self.openFile(outputFile, "a") #open for appending f.write ('<font face="ver...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_generator(self):\n analyze_tool = \"/home/haihuam/Projects/RepPoints/mmdetection/tools/analyze_logs.py\"\n ex_options = self.global_setting.get('analyze_options', str())\n py = self.global_setting.get('python', sys.executable)\n if os.access(py, os.X_OK):\n content...
[ "0.58657575", "0.58456576", "0.5790609", "0.57877344", "0.5612369", "0.55638", "0.55175114", "0.54054457", "0.5385039", "0.53571945", "0.52849984", "0.5231061", "0.5196173", "0.5132563", "0.5124129", "0.51123667", "0.5094899", "0.50903296", "0.50889057", "0.50876725", "0.5062...
0.7011536
0
function that reports execution time to the output file in the specified format (AutoGrader.Const.TEXT or AutoGrader.Const.HTML)
def _reportExecTime(self, exec_time, outputFile): f=self.openFile(outputFile, "a") #open for appending f.write ('<font face="verdana" color="' + AutoGrader.Const.ANALYTICS_COLOR2 + '">[Execution Time: ' + format("%0.4f" % exec_time) + ' sec.]</font><br>\n') f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_timing_report(self):\r\n report = ('Timing report\\n'\r\n '=============\\n')\r\n for phase, timings in self.timings.items():\r\n phase_time = None\r\n for goal, times in timings.items():\r\n if len(times) > 1:\r\n report += '[%(phase)s:%(goal)s(%(numsteps)d)...
[ "0.6570657", "0.6539266", "0.6494923", "0.64170593", "0.63911384", "0.6288337", "0.62621516", "0.6257514", "0.6236003", "0.6200053", "0.6197794", "0.6164083", "0.61312646", "0.6041612", "0.5965578", "0.5963509", "0.59394854", "0.59224683", "0.5919965", "0.5918068", "0.5917949...
0.7520648
0
function that reports the name of the input data file to the outputFile in the specified format. dataFileName = the name of the data file to be reported in the output file outputfile = the name of the output file (this is the same file that receives stdout and stderr from the executed script outputFileType = format of ...
def _reportDataFile(self, dataFileName, outputFile): #subsequent access to the file should be open for "append"-ing f=self.openFile(outputFile, "a") #open for appending f.write ('<font face="verdana" color=" ' +AutoGrader.Const.HEADER_COLOR2 + '"><br>\n------------- ' + os.path.split(dataFile...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_format(self):\n # Run without arguments\n if len(sys.argv) == 1:\n sys.exit(usage(None))\n # Test input file argument\n if self.input and not os.path.isfile(self.input):\n print(self.input)\n print(os.path.isfile(self.input))", "def handle...
[ "0.61869925", "0.5979931", "0.5750244", "0.5719579", "0.5716297", "0.57133543", "0.56917155", "0.56686217", "0.5658168", "0.5641395", "0.5632022", "0.5631809", "0.56305486", "0.56274647", "0.5594017", "0.55693054", "0.55514264", "0.55501556", "0.55459416", "0.5536606", "0.552...
0.67733246
0
function that prints a separator in the output file
def _printSeparator(self, filePointer, color=Const.HEADER_COLOR1): filePointer.write ('<font face="verdana" color=" ' + color + '"><br>\n=======================================================</font><br>\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_sep_mark():\n print(sep_mark)", "def _print_separator():\n print(\n \"───── ──────────────── ──────────────────────────────────────────────────────────────────────────────── ──────── ───────── ───── ──────── ──── ──── ──── ──── ──── ──── ──── ──── ──── ────...
[ "0.7295171", "0.7275947", "0.694501", "0.6823766", "0.65936506", "0.65815055", "0.6524574", "0.64949036", "0.6481826", "0.6460346", "0.6395679", "0.6378389", "0.6301889", "0.6063296", "0.60507584", "0.6019728", "0.59806734", "0.59258085", "0.58759683", "0.584891", "0.58404654...
0.73290414
0
function that prints a separator in the output file after opening the file
def _openFileAndPrintSeparator(self, outputFile, color=Const.HEADER_COLOR1): f=self.openFile(outputFile, "a") #open for appending _printSeparator(f, color) f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _printSeparator(self, filePointer, color=Const.HEADER_COLOR1):\n filePointer.write ('<font face=\"verdana\" color=\" ' + color + '\"><br>\\n=======================================================</font><br>\\n')", "def output(*args):\n print(*args, end='', file=file)", "def output_sep...
[ "0.70281214", "0.6549026", "0.6539985", "0.6291301", "0.62573457", "0.6241287", "0.60500336", "0.6028565", "0.6019591", "0.6016583", "0.59558743", "0.5932695", "0.5917033", "0.58757865", "0.58684933", "0.58684933", "0.58684933", "0.58159", "0.58033115", "0.5801959", "0.577927...
0.7484514
0
function that searches the specified 'directory' for files with the supplied extention. The function returns a list of these files or appends to the supplied foundFiles list.
def _findFilesInDir(self, directory, extension=".py", foundFiles=None): #mutable default arguments in Python are evaluated once when the function is defined, not each time the function is called. if foundFiles == None: foundFiles = [] filenames = os.listdir(directory) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def searchfiles(directory, filenames, ext=None):\n if ext:\n filenames = [f'{file}{ext}' for file in filenames]\n return [\n file for file in Path(directory).glob('*')\n if file.name in filenames\n ]", "def _findFiles(self, topLevelDirectory, extension=\".py\", foundFiles=None):\n ...
[ "0.785525", "0.7775073", "0.76548415", "0.75776005", "0.75531554", "0.7412598", "0.7365653", "0.73567414", "0.7344923", "0.7334975", "0.73295915", "0.7327037", "0.7277756", "0.7250813", "0.7247269", "0.71909344", "0.7126716", "0.7106908", "0.7102458", "0.70977485", "0.708593"...
0.86345595
0
function that searches the supplied topLevelDirectory and all subdirectories for files with the supplied extention. The function returns a list of these files or appends to the supplied foundFiles list.
def _findFiles(self, topLevelDirectory, extension=".py", foundFiles=None): #mutable default arguments in Python are evaluated once when the function is defined, not each time the function is called. if foundFiles == None: foundFiles = [] for dirpath, dirnames, filen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _findFilesInDir(self, directory, extension=\".py\", foundFiles=None):\n\n #mutable default arguments in Python are evaluated once when the function is defined, not each time the function is called.\n if foundFiles == None:\n foundFiles = []\n \n filenames = os.listdir...
[ "0.7933329", "0.79280114", "0.7593847", "0.7487619", "0.7385149", "0.7346304", "0.71540517", "0.71438915", "0.71207476", "0.7037298", "0.703342", "0.7017179", "0.70161426", "0.70031244", "0.6923451", "0.6863741", "0.68348724", "0.6833357", "0.68185884", "0.6813634", "0.680922...
0.8803894
0
function that searches the supplied topLevelDirectory and all subdirectories for files with the supplied extention. The function returns a list of these files in the toplevel directory (self.TopLevelFilesFound) along with a list of subdirectories containing these files (self.SubDirsFound).
def _recursivelyFindFiles(self, topLevelDirectory, extension=".py"): print ('finding ' + extension + '...\n') tempFilesFound = [] tempSubDirs = {} #initialize temporary dictionary of sbudirectories for dirpath, dirnames, filenames in os.walk(topLevelDirectory): #p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _findFiles(self, topLevelDirectory, extension=\".py\", foundFiles=None):\n \n #mutable default arguments in Python are evaluated once when the function is defined, not each time the function is called.\n if foundFiles == None:\n foundFiles = []\n \n for dirpath, di...
[ "0.86346513", "0.7606747", "0.747115", "0.73366565", "0.73094016", "0.7299386", "0.72694016", "0.7169544", "0.715743", "0.7058809", "0.6976055", "0.69282913", "0.6928055", "0.69058466", "0.6893258", "0.6892679", "0.688161", "0.68683034", "0.6862816", "0.6859078", "0.6814937",...
0.8364048
1