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
This method converts news in HTML format and save file to directory
def convert_to_html(self, news_list): self.logger.info("Converting news to HTML...") self.prepare_storage() self.process_news_list_with_images(news_list) content = self.generate_html_template(news_list) self.write_to_file(content.encode("UTF-8"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_news_in_html_file(news, path_to_html, logger):\n check_path_to_directory(path_to_html, logger)\n html_file = tags.html(title='RSS news')\n html_file.add(tags.head(tags.meta(charset='utf-8')))\n\n logger.info('Converting news to html format...')\n for article in news:\n html_factory(a...
[ "0.8007381", "0.7137725", "0.6794041", "0.6674347", "0.6611536", "0.6536587", "0.65261453", "0.6417016", "0.6327483", "0.6250126", "0.6243065", "0.62169", "0.6139247", "0.6103942", "0.6098014", "0.6097145", "0.5996561", "0.5994191", "0.5986385", "0.5986346", "0.5962781", "0...
0.7303295
1
This method converts news in PDF format and save it to directory
def convert_to_pdf(self, news_list): self.logger.info("Converting news to PDF...") self.prepare_storage() self.process_news_list_with_images(news_list) content = self.generate_html_template(news_list) pdf = io.BytesIO() pisa.pisaDocument(content, pdf) self.write_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_news_in_pdf_file(news, path_to_pdf, logger, html_args=None):\n html_file = save_news_in_html_file(news, path_to_pdf, logger)\n path = os.path.join(path_to_pdf, 'rss_news.pdf')\n try:\n with open(path, 'wb') as pdf_file, open(html_file.name, 'r', encoding='utf-8') as html_file:\n ...
[ "0.7636915", "0.72893333", "0.712994", "0.6522716", "0.64740103", "0.62795556", "0.62544024", "0.61977094", "0.61708295", "0.6131437", "0.61265165", "0.61195207", "0.60779727", "0.60517234", "0.60488605", "0.5989949", "0.5969579", "0.5943232", "0.5935712", "0.59090847", "0.59...
0.7762699
0
This method write news to file
def write_to_file(self, content): try: with open(self.full_path_to_file, "wb") as fp: fp.write(content) except PermissionError: logging.error( "Conversion cannot be performed. Permission denied for this directory" ) sys.exit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __save_article_to_file(self, content):\n with open(\"article.txt\", 'w') as out:\n out.write(content)", "def saveToFile(html):\n #print(\"Saving to file.\")\n html += \"\\n\"\n #open necessary files to save\n logFile = open(\"postLog_{0}_{1}.txt\".format(os.path.splitext(path)[0...
[ "0.7412608", "0.67863214", "0.6772768", "0.67558056", "0.66990256", "0.66782635", "0.66782635", "0.6620711", "0.65455043", "0.65141547", "0.6473367", "0.64357406", "0.6418508", "0.6392606", "0.63826936", "0.6376942", "0.63761675", "0.6346682", "0.6309539", "0.6295967", "0.627...
0.7464143
0
This method process list of news, replacing image links by local paths to images if they exist in local storage
def process_news_list_with_images(self, news_list): for item in news_list: try: filename = hashlib.md5(item.get("Image").encode()).hexdigest() except AttributeError: continue for existing_img in os.listdir(self.img_storage): if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_urls(self):\n if self._urls is None:\n return\n try:\n for url in self._urls:\n # a \"URL\" is either a URL and filename or just a URL.\n try:\n filename, real_url = url\n article = Article(real_url...
[ "0.60489506", "0.5966488", "0.59466803", "0.5738515", "0.5703045", "0.56591934", "0.56306213", "0.5622069", "0.5600035", "0.55999964", "0.55947775", "0.5583736", "0.5583505", "0.55414426", "0.554117", "0.5492211", "0.5490737", "0.5453338", "0.5448537", "0.54467994", "0.544262...
0.8289069
0
Gets the USB children instance ID from the plug and play ID.
def get_children_instance_id(pnpid: str) -> Optional[str]: # Although the registry should not be accessed directly # (See https://docs.microsoft.com/en-us/windows-hardware/drivers/install/hklm-system-currentcontrolset-enum-registry-tree), # noqa E501 # and SetupDi functions/APIs should be used instead in a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getChildPIDs(self):\n\t\treturn self.pids", "def get_child_pids(pid):\n\n wmi = win32com.client.GetObject('winmgmts:')\n # noinspection SqlNoDataSourceInspection,SqlDialectInspection\n children = wmi.ExecQuery('SELECT * FROM Win32_Process WHERE ParentProcessID = %s' % pid)\n return [child.Propert...
[ "0.6001212", "0.55254084", "0.5425673", "0.53900445", "0.53731304", "0.5349252", "0.5345259", "0.5271043", "0.52337563", "0.5185409", "0.5180548", "0.516208", "0.5160209", "0.51445204", "0.51214975", "0.51214975", "0.51214916", "0.5087779", "0.5087779", "0.5087779", "0.506546...
0.68758297
0
Solve the domain with a new or loaded solver and return it autocast to the level of the domain. By default, Solver.check_domain() provides some boilerplate code and internally calls Solver._check_domain_additional() (which returns True by default but can be overridden to define specific checks in addition to the "domai...
def solve_with(cls, solver: Solver, domain_factory: Optional[Callable[[], Domain]] = None, load_path: Optional[str] = None) -> Solver: if domain_factory is None: domain_factory = cls if load_path is not None: # TODO: avoid repeating this code somehow (id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self, solver):\n solver.solve()", "def __solve(self) -> None:\n pyo.TransformationFactory(\"contrib.detect_fixed_vars\").apply_to(self.model) # type: ignore\n pyo.TransformationFactory(\"contrib.deactivate_trivial_constraints\").apply_to(self.model) # type: ignore\n\n # in...
[ "0.62395287", "0.6033113", "0.55635285", "0.55559313", "0.55402476", "0.5536151", "0.54851514", "0.54851514", "0.54851514", "0.53851396", "0.53379995", "0.52861816", "0.52818835", "0.5250305", "0.5230349", "0.5199907", "0.5199907", "0.5199907", "0.51945496", "0.5187234", "0.5...
0.6632548
0
Creation du fichier xml source model pour des Lois de puissances avec coupure exponentielle et lois de puissances
def XML_EC_PL(Name, InputsFile, OutputFile, emin,emax): #On commence par afficher ce qu'on fait print " Build xml file " print InputsFile #ouverture du fichier dans lequel on place le source model try: fresult = open(OutputFile, 'w') except: print "Coucou" #ecriture des premieres lignes invariantes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateXMLmodel(quickLogger,\n base,\n galactic_file=\"gal_2yearp7v6_v0.fits\",\n isotropic_file=\"iso_p7v6source.txt\",\n catalog_file=\"gll_psc_v07.fit\"):\n\n\n try:\n checkForFiles(quickLogger,[base+\"_model.xml\"])\...
[ "0.62085485", "0.6191802", "0.5883042", "0.5670526", "0.5605886", "0.5449843", "0.5446432", "0.543612", "0.53938085", "0.53147334", "0.52822423", "0.5257", "0.5239572", "0.5229683", "0.5215787", "0.51973796", "0.5192966", "0.5176548", "0.5172878", "0.516963", "0.51676106", ...
0.72373146
0
Returns a boto3 cloud formation client in specified region
def _get_cfn_client(region: str, profile: str = None) -> boto3.client: logger.debug(f"Creating Cloudformation client in region {region}") if profile: session = boto3.Session(profile_name=profile) else: session = boto3.Session() try: cfn_client: client = session.client("cloudforma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regional_client(config):\n try:\n # get the loaded yaml file and extract \"Region\" parameter to define cloudformation client\n region = config['Region']\n cfn = boto3.client('cloudformation', region_name=region)\n return cfn\n except botocore.exceptions.ClientError as e:\n return ...
[ "0.8151616", "0.7501493", "0.70944536", "0.68531656", "0.67799383", "0.6637234", "0.66118485", "0.6566197", "0.6457408", "0.64029866", "0.63521886", "0.62923825", "0.6246909", "0.6228961", "0.62103194", "0.61988586", "0.6177855", "0.6177855", "0.6123442", "0.60953087", "0.597...
0.7587435
1
Returns the status of a stack. None if not deployed
def _get_stack_status(stack_name: str, region: str, profile: str = None) -> Optional[str]: logger.debug(f"Getting stack status for {stack_name} in {region}") cfn_client = _get_cfn_client(region=region, profile=profile) try: result = cfn_client.describe_stacks(StackName=stack_name) except ClientE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stack_status(self, stack):\n stack_description = self.cfn.describe_stacks(StackName=stack)\n return stack_description['Stacks'][0]['StackStatus']", "def exists(self):\n try:\n response = self._cfn.describe_stacks(StackName=self.name)\n LOG.debug('Stack %s exists', s...
[ "0.8329368", "0.68438286", "0.6370778", "0.628286", "0.6259481", "0.6233836", "0.6230097", "0.62212986", "0.6210666", "0.6210666", "0.6210666", "0.6210666", "0.6210666", "0.6210666", "0.6210666", "0.6210666", "0.6210666", "0.61802495", "0.61751854", "0.61712754", "0.61658424"...
0.81538683
1
Returns true if stack is in completed state, else returns false
def _stack_is_complete(stack_name: str, region: str, profile: str = None) -> bool: logger.debug(f"Checking if stack {stack_name} in region {region} is in completed state") stack_status = _get_stack_status(stack_name, region=region, profile=profile) if not stack_status: logger.debug(f"STACK: {stack_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_complete(self):\n\n return self._state == \"COMPLETED\"", "def isDone(self):\n return self.state in self.DoneStates", "def IsCompleted(self) -> bool:", "def IsCompleted(self) -> bool:", "def IsCompleted(self) -> bool:", "def isDone(self):\n return self._state in self._DoneStat...
[ "0.7169821", "0.71376646", "0.7103794", "0.7103794", "0.7103794", "0.70634764", "0.70605016", "0.70427597", "0.7010587", "0.7002723", "0.6946667", "0.69077164", "0.69028753", "0.6895132", "0.6879864", "0.68719757", "0.6862289", "0.68539464", "0.68474066", "0.68212736", "0.681...
0.78509855
0
Returns list stack resources
def _get_stack_resources(stack_name: str, region: str, profile: str = None) -> list: logger.debug(f"Getting stack {stack_name} resources in region {region}") cfn_client = _get_cfn_client(region=region, profile=profile) try: result = cfn_client.describe_stack_resources(StackName=stack_name) excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resources(self):\n return []", "def resources(self):\r\n return self.page.object_list", "def list(self):\n resources = self._os_resource_manager.list()\n resource_list = []\n for resource in resources:\n resource_list.append(self._resource_class(id=resource...
[ "0.70398617", "0.6827205", "0.67096186", "0.67069566", "0.6664052", "0.6568745", "0.6568745", "0.6568745", "0.656735", "0.656735", "0.65326846", "0.6446593", "0.6442138", "0.64395607", "0.64377594", "0.6405322", "0.6391265", "0.6374351", "0.6374351", "0.6374351", "0.6374351",...
0.7955702
0
Validates whether template body is valid
def _template_isvalid(template_body: str, region: str, profile: str = None) -> bool: logger.debug(f"checking if template is valid in region {region}") cfn_client = _get_cfn_client(region=region, profile=profile) try: cfn_client.validate_template(TemplateBody=template_body) except Exception as e:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_template(self, contents):\n try:\n self.conn.validate_template(template_body=contents)\n return True\n except BotoServerError as e:\n print contents\n print e.message\n raise", "def _validate_template(self, template):\r\n in...
[ "0.7383605", "0.696741", "0.68463093", "0.6422072", "0.64061284", "0.6307951", "0.62839895", "0.6257938", "0.6145648", "0.6145648", "0.6072301", "0.6072301", "0.59838396", "0.59771854", "0.5973898", "0.59621143", "0.5946686", "0.5929137", "0.59252125", "0.59061676", "0.589325...
0.7101935
1
Returns a list of stack events that have status that includes FAILED
def _get_failed_stack_events(stack_name: str, region: str, profile: str = None) -> list: logger.debug(f"getting stack {stack_name} failure events in region {region}") cfn_client = _get_cfn_client(region=region, profile=profile) try: events = cfn_client.describe_stack_events(StackName=stack_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fails(self):\n return [result for result in self.values() if result.outcome == Result.FAIL]", "def get_failed_results_for_stage(self, stage):\n return self._get_filtered_results(stage_failed=stage)", "def get_test_failures(self, test_dir):\n\n cwd = os.getcwd()\n\n outdir = ...
[ "0.6111538", "0.5878257", "0.57970047", "0.5745162", "0.56228536", "0.55426675", "0.55084246", "0.5441741", "0.54271114", "0.53960174", "0.5360145", "0.53471166", "0.5340884", "0.53384525", "0.5337405", "0.53171754", "0.5301688", "0.5293094", "0.5279067", "0.5251132", "0.5248...
0.72749704
0
Import a troppsphere module
def _import_tropo_module(stack_name: str, module_name: str = None) -> Union[object, TropoformStackBase]: if module_name: logger.debug(f"importing troposphere module: {module_name}") sys.path.append(os.path.dirname(module_name)) module_name = os.path.basename(module_name).replace(".py", "") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_module(self, location, name):", "def test_parrot_imported():\n assert \"parrot\" in sys.modules", "def load_module(name):\n return __import__(\"metaswitch.%s\" % name,\n fromlist=[\"ROUTES\"])", "def test_molssi_project_imported():\n assert \"molssi_project\" in sys.m...
[ "0.65057886", "0.58277804", "0.55630046", "0.55166364", "0.54535466", "0.5434116", "0.5397166", "0.5371939", "0.53376406", "0.5320472", "0.5286328", "0.5272745", "0.5259132", "0.5234161", "0.5217448", "0.52135533", "0.52049214", "0.5202912", "0.5191632", "0.5184984", "0.51845...
0.6709114
0
gets a string of template body from either template_file or module_name or stack_name
def _load_template(template_file: str = None, module_name: str = None, stack_name: str = None) -> str: if template_file: # read the template file with open(template_file, 'r') as fh: template_body = fh.read() else: # Import the troposphere module stack = _import_tropo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_template(self, name):\n with open(name, 'r+') as open_f:\n template_content = open_f.read()\n return template_content", "def template_body(self) -> str:\n return pulumi.get(self, \"template_body\")", "def read_template(file_name):\n infile = open(file_name, 'r')\n ...
[ "0.66909385", "0.6677749", "0.6586599", "0.65118957", "0.64113003", "0.64095205", "0.6361118", "0.63273656", "0.6317198", "0.62007225", "0.6189182", "0.6120283", "0.61004734", "0.60616666", "0.60578287", "0.6054188", "0.6036643", "0.60360914", "0.59971166", "0.5979156", "0.59...
0.7441541
0
Creates a Change Plan for a cloud formation stack and logs the results
def plan(stack_name: str, region: str, module_name: str = None, template_file: str = None, parameter_files: str = None, capabilities: str = default_capabilities, output_type: str = 'text', delete_change_set: bool = True, profile: str = None, **kwargs ) -> bool: logger.debug(f"planning sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_plan(plan_name):\n pass", "def apply(stack_name: str, region: str, module_name: str = None, template_file: str = None,\n parameter_files: str = None, capabilities: str = default_capabilities, auto_approve: bool = False,\n role_arn: str = None, profile: str = None, **kwargs\n ...
[ "0.57424146", "0.5383999", "0.537971", "0.52568805", "0.5236535", "0.5193605", "0.51911", "0.50195754", "0.5015971", "0.4984828", "0.49564987", "0.491938", "0.48930696", "0.48820728", "0.48794502", "0.4871701", "0.4857909", "0.48572794", "0.48560604", "0.48403943", "0.4834396...
0.5581734
1
Initialize the IAQ algorithm
def iaq_init(self) -> List[int]: # name, command, signals, delay self._run_profile(("iaq_init", [0x20, 0x03], 0, 0.01))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_algorithm(self):\n pass", "def initialize_ai(self):\n\n self.gid, self.genome = constants.genomes_to_run[self.identifier]\n self.genome.fitness = -1\n self.net = neat.nn.FeedForwardNetwork.create(self.genome, constants.conf)\n # self.net = neat.nn.RecurrentNetwork\n ...
[ "0.7633929", "0.66924495", "0.65745157", "0.6568119", "0.65095526", "0.64869267", "0.64081424", "0.64058375", "0.6256504", "0.62454665", "0.6187681", "0.61763865", "0.6165468", "0.61414874", "0.6136906", "0.61194456", "0.61185485", "0.60881144", "0.60609126", "0.602251", "0.5...
0.67932886
1
Retreive the IAQ algorithm baseline for eCO2 and TVOC
def get_iaq_baseline(self) -> List[int]: # name, command, signals, delay return self._run_profile(("iaq_get_baseline", [0x20, 0x15], 2, 0.01))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def baseline_TVOC(self) -> int:\n return self.get_iaq_baseline()[1]", "def indoor_air_quality_baseline(self):\n # name, command, signals, delay\n return self._i2c_read_words_from_cmd(command=[0x20, 0x15], reply_size=2, delay=0.01)", "def baseline_eCO2(self) -> int:\n return self.get...
[ "0.65072536", "0.6279382", "0.59637445", "0.5881215", "0.57392997", "0.57358277", "0.5505206", "0.5480685", "0.5470256", "0.53694403", "0.53557163", "0.530661", "0.5291764", "0.5290679", "0.52889067", "0.52806133", "0.5266829", "0.5257075", "0.5249062", "0.51923835", "0.51807...
0.6883925
0
Set the previously recorded IAQ algorithm baseline for eCO2 and TVOC
def set_iaq_baseline( # pylint: disable=invalid-name self, eCO2: int, TVOC: int ) -> None: if eCO2 == 0 and TVOC == 0: raise RuntimeError("Invalid baseline") buffer = [] for value in [TVOC, eCO2]: arr = [value >> 8, value & 0xFF] arr.append(self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setBaseline(self, baseline):\n self.baseline = AmpObject(baseline, 'limb')", "def get_iaq_baseline(self) -> List[int]:\n # name, command, signals, delay\n return self._run_profile((\"iaq_get_baseline\", [0x20, 0x15], 2, 0.01))", "def baseline_TVOC(self) -> int:\n return self.get...
[ "0.682519", "0.61473423", "0.5905783", "0.5835249", "0.54679024", "0.543181", "0.5358913", "0.52875245", "0.52784926", "0.5227538", "0.5207907", "0.5199822", "0.518496", "0.5163725", "0.51399994", "0.51376015", "0.51142097", "0.5047642", "0.49950784", "0.499209", "0.49868724"...
0.72859424
0
Returns the name of the current carrier (or None) for the request lifecycle.
def get_carrier(): return getattr(_local, 'carrier', None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def carrier_name(self) -> str:\n return pulumi.get(self, \"carrier_name\")", "def get_created_carrier_name(self):\n return self.carrier_page.get_created_carrier_name()", "def get_carrier_id():\n carrier = get_carrier()\n if carrier is None:\n return carrier\n\n for carr in CARRIER...
[ "0.7962054", "0.74606353", "0.64987874", "0.5850783", "0.58208394", "0.57827497", "0.5683348", "0.566416", "0.566416", "0.566416", "0.5657287", "0.56425", "0.56022626", "0.558971", "0.5556769", "0.55432737", "0.5527936", "0.5487664", "0.54741913", "0.54596204", "0.5454606", ...
0.7471228
1
Returns the carrier ID for the request lifecycle.
def get_carrier_id(): carrier = get_carrier() if carrier is None: return carrier for carr in CARRIERS: if carr.slug == carrier: return carr.id return mkt.constants.carriers.UNKNOWN_CARRIER.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def carrier_name(self) -> str:\n return pulumi.get(self, \"carrier_name\")", "def carrier_voyage_number(self) -> Object:\n return self._carrier_voyage_number", "def get_created_carrier_name(self):\n return self.carrier_page.get_created_carrier_name()", "def carrier_service_code(self) -> ...
[ "0.6848834", "0.67090344", "0.66593313", "0.65585667", "0.6020575", "0.5749306", "0.57348835", "0.5661451", "0.5524614", "0.5491387", "0.5434929", "0.5373868", "0.53657174", "0.5346038", "0.5344121", "0.53315926", "0.53095263", "0.5274051", "0.52615047", "0.5254304", "0.52543...
0.74848056
0
Sets the name of the carrier for the current request lifecycle.
def set_carrier(name): _local.carrier = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def carrier_name(self) -> str:\n return pulumi.get(self, \"carrier_name\")", "def register(self, carrier):\n self.carriers[carrier.name] = carrier()", "def get_created_carrier_name(self):\n return self.carrier_page.get_created_carrier_name()", "def current_carrier_network(self, current_c...
[ "0.74088484", "0.63650316", "0.6355849", "0.5974812", "0.5895125", "0.57192826", "0.5702686", "0.56130254", "0.55906194", "0.55515623", "0.5463671", "0.5409844", "0.5283206", "0.5283206", "0.52701265", "0.52701265", "0.52701265", "0.52701265", "0.52669305", "0.524288", "0.523...
0.7681195
0
This function looks for overlap between two sets of ranges, usually times, formatted in seconds. It will output a boolean array equal in length to table1.
def overlap(table1, table2): out = np.zeros(np.size(table1, axis=0), dtype='bool') for i in range(np.size(table1, axis=0)): s1_s2 = table1[i, 0] < table2[:, 0] s1_e2 = table1[i, 0] <= table2[:, 1] e1_s2 = table1[i, 1] < table2[:, 0] e1_e2 = table1[i, 1] < table2[:, 1] # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overlap(t1start, t1end, t2start, t2end):\n\n return (t1start <= t2start <= t1end) or (t2start <= t1start <= t2end)", "def time_overlap(d1, d2):\n gt1, gt2, vt1, vt2 = parse_date(d1[\"t1\"]), parse_date(d1[\"t2\"]), parse_date(d2[\"t1\"]), parse_date(d2[\"t2\"])\n return (gt1 != vt2) and (vt1 != gt2)...
[ "0.7351029", "0.7317694", "0.71101266", "0.7056572", "0.6927481", "0.6842562", "0.6833646", "0.6828137", "0.67833555", "0.6766484", "0.6704582", "0.66819715", "0.65988237", "0.65952796", "0.6575358", "0.6506487", "0.64892673", "0.64672613", "0.644421", "0.64418584", "0.642429...
0.7545006
0
This function will take a table of time ranges formatted as strings (compatible with bad_times) and convert it to an nx2 array in DateTime seconds
def str_to_secs(table): out = np.zeros([len(table), 2]) for i in range(len(table)): t1, t2 = table[i].split() out[i, 0] = Time.DateTime(t1).secs out[i, 1] = Time.DateTime(t2).secs return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_convert(intime):\n Nt = intime.shape[0]\n outtime = []\n for t in range(Nt):\n timestr = ''.join([intime[t,:][~intime[t,:].mask].data[i].decode('utf-8') for i in range(len(intime[t,:][~intime[t,:].mask].data))])\n outtime.append(datetime.strptime(timestr, '%Y-%m-%d_%H:%M:%S'))\n ...
[ "0.6622439", "0.6603137", "0.64462537", "0.64186484", "0.636818", "0.62539124", "0.6182567", "0.61570144", "0.6044281", "0.5946655", "0.59294784", "0.5927839", "0.5912818", "0.5837613", "0.58100504", "0.5780167", "0.57793987", "0.57766086", "0.57525724", "0.5747646", "0.57434...
0.67100316
0
This function reads a commadelimited text file of 31x136 solar torque values and outputs the values as an array
def read_torque_table(table): f = open(table) lines = f.readlines() f.close() out = np.zeros((61, 136)) line_num = 0 for line in lines: fields = line.split() out[line_num, :] = [float(field) for field in fields] line_num = line_num + 1 return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_forces(filename):\n f=open(filename,\"r\")\n castep_forces = f.readlines()\n f.close() \n nruter = []\n for index, line in enumerate(castep_forces):\n if 'Total number of ions in cell' in line:\n n_atoms = int(line.split()[7])\n if 'Cartesian components (eV/A)'...
[ "0.66538256", "0.6490468", "0.6374328", "0.634465", "0.63280386", "0.6272088", "0.6249056", "0.621572", "0.6197635", "0.61664724", "0.6131029", "0.61304945", "0.61170995", "0.6096215", "0.6094813", "0.60880053", "0.6075212", "0.6054031", "0.60536504", "0.6042874", "0.60347384...
0.65305465
1
This function returns an array of length a with the indices of array b that are closest to the values of array a.
def find_closest(a, b): a = np.atleast_1d(np.array(a)) b = np.atleast_1d(np.array(b)) out = [np.argmin(abs(b - a1)) for a1 in a] return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closest_vals(arr1, arr2):\n arr1 = np.array(arr1).T\n arr1 = arr1[:, np.newaxis]\n arr2 = np.array(arr2).T\n\n return np.argmin(abs(arr2 - arr1), axis=1)", "def find_nearest(a, a0):\n idx = numpy.abs(a - a0).argmin()\n return a.flat[idx]", "def find_nearest(a, a0):\n idx = np.abs(a - a...
[ "0.7431907", "0.7145059", "0.7140231", "0.7072252", "0.6898944", "0.68932545", "0.6853787", "0.67495334", "0.6745704", "0.6686743", "0.66259295", "0.6621587", "0.657452", "0.6573349", "0.6497837", "0.6479958", "0.64772797", "0.64554095", "0.645303", "0.6403311", "0.63855433",...
0.83729213
0
Returns an error metric using the groundtruth and returned patterns Error = gt_patterns missed / total gt_patterns
def get_gt_patterns_found(groundtruth, patterns): hits = [0 for g in groundtruth] # 1 if hit, 0 if miss (on gt) # For each ground_truth pattern, check if we found it with our algorithm for i, gt in enumerate(groundtruth): c1 = gt.vs["label"] c1_edge = gt.es["label"] for p in patte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_errors(gt, pred, selector):\n gt = gt[selector]\n pred = pred[selector]\n\n thresh = np.maximum((gt / pred), (pred / gt))\n a1 = (thresh < 1.25 ).mean()\n a2 = (thresh < 1.25 ** 2).mean()\n a3 = (thresh < 1.25 ** 3).mean()\n\n rmse = (gt - pred) ** 2\n rmse = np.sqrt(rmse.me...
[ "0.6167152", "0.60816383", "0.5949731", "0.5928812", "0.5916659", "0.59156394", "0.5842731", "0.5700739", "0.5608707", "0.55882037", "0.55637777", "0.5563481", "0.5560884", "0.5514837", "0.5490831", "0.54693276", "0.5428169", "0.54148453", "0.54093254", "0.540057", "0.5366371...
0.6300078
0
Returns an error metric using the groundtruth and returned patterns Error = patterns not in gt / total patterns
def get_patterns_also_in_gt(groundtruth, patterns): hits = [0 for p in patterns] # 1 if hit, 0 if miss # For each ground_truth pattern, check if we found it with our algorithm for i, p in enumerate(patterns): if len(p.es) == 0: continue c1 = p.vs["label"] c1_edge = p.es...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gt_patterns_found(groundtruth, patterns):\n hits = [0 for g in groundtruth] # 1 if hit, 0 if miss (on gt)\n\n # For each ground_truth pattern, check if we found it with our algorithm\n for i, gt in enumerate(groundtruth):\n c1 = gt.vs[\"label\"]\n c1_edge = gt.es[\"label\"]\n\n ...
[ "0.6448139", "0.6139599", "0.60003453", "0.595435", "0.5853415", "0.58396924", "0.575777", "0.56467134", "0.5631713", "0.55903906", "0.5533458", "0.549733", "0.5484457", "0.54672635", "0.54334176", "0.54327667", "0.5431729", "0.5431729", "0.5418595", "0.54051536", "0.5380375"...
0.63549423
1
Print (repr) the iGraph representation and count of the topN patterns
def print_top_n_graphs(C, n): ps = sorted(C.P, key=itemgetter(2), reverse=True) for i in range(n): if i >= len(ps): break p, c, s = ps[i] print(p) print("Appeared %d times" % c)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(self):\n\t\t# Sort graph nodes by id\n\t\tnodes = list(self.nodes.values())\n\t\tnodes.sort(key=lambda n:n.id)\n\n\t\tfor n in nodes:\n\t\t\t# Get all edges\n\t\t\tedges = []\n\t\t\tfor edge in n.neighbours:\n\t\t\t\tfor neighbour in n.get_neighbours(edge):\n\t\t\t\t\tedges.append((neighbour.id, edge))\...
[ "0.61583155", "0.60153836", "0.5934082", "0.5784209", "0.57661146", "0.57632226", "0.5711929", "0.566566", "0.5659104", "0.564344", "0.5624039", "0.56130284", "0.5612793", "0.560958", "0.56004786", "0.55928165", "0.5554867", "0.5554111", "0.55373365", "0.55350655", "0.5532472...
0.72778064
0
Run compress on the Subgen file, then checks against GT
def _test_graphzip_subgen(self, fin_graphzip, fin_insts, n=None): print('Running compression on %s...' % fin_graphzip) start = time.perf_counter() # run compression to get pattern dictionary self.c.compress_file(fin_graphzip) elapsed = time.perf_counter()-start print('Com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_gzip():\n this_dir = os.getcwd()\n os.chdir(\"/data/COHERENT2/data/CrystalChar/raw\")\n all_files = glob.glob(\"./**\", recursive=True)\n for f in all_files:\n if \".gz\" in f and \"tar\" not in f:\n print(f)\n sh(\"gunzip \" + f)\n os.chdir(this_dir)", "def ...
[ "0.6143728", "0.597276", "0.5948013", "0.5781525", "0.55512893", "0.55464655", "0.5537344", "0.5535526", "0.5529033", "0.5491844", "0.54807705", "0.54738986", "0.5397783", "0.53571504", "0.533637", "0.5326397", "0.5311195", "0.52849764", "0.52785736", "0.52563846", "0.5220711...
0.6119582
1
Create a Bundler component. config A dictionary of required configuration values. logger The object the bundler should use for logging.
def __init__(self, config: Dict[str, str], logger: Logger) -> None: super(Bundler, self).__init__("bundler", config, logger) self.file_catalog_client_id = config["FILE_CATALOG_CLIENT_ID"] self.file_catalog_client_secret = config["FILE_CATALOG_CLIENT_SECRET"] self.file_catalog_rest_url = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(\n cls, component_config: Dict[Text, Any], config: DazuConfig\n ) -> \"Component\":\n\n # Check language supporting\n language = config.language\n if not cls.can_handle_language(language):\n # check failed\n raise UnsupportedLanguageError(cls.name, la...
[ "0.5984611", "0.5614811", "0.5574244", "0.545933", "0.5436974", "0.5436974", "0.54076266", "0.5377704", "0.5371634", "0.53512883", "0.53327215", "0.5314189", "0.52838236", "0.5283431", "0.5281312", "0.5281312", "0.5281312", "0.5273958", "0.5263533", "0.5259028", "0.52584743",...
0.72489446
0
Quarantine the supplied bundle using the supplied reason.
async def _quarantine_bundle(self, lta_rc: RestClient, bundle: BundleType, reason: str) -> None: self.logger.error(f'Sending Bundle {bundle["uuid"]} to quarantine: {reason}.') right_now = now() pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_deleter_quarantine_bundle_with_reason(config, mocker):\n logger_mock = mocker.MagicMock()\n lta_rc_mock = mocker.patch(\"rest_tools.client.RestClient\", new_callable=AsyncMock)\n p = Deleter(config, logger_mock)\n await p._quarantine_bundle(lta_rc_mock, {\"uuid\": \"c4b345e4-2395-4f9e-b0...
[ "0.618683", "0.57495564", "0.5700352", "0.56786245", "0.5588792", "0.55714357", "0.5551414", "0.55073553", "0.5387978", "0.5371958", "0.53666514", "0.5344349", "0.5338192", "0.5324552", "0.53136617", "0.52858984", "0.52552575", "0.5249711", "0.52332675", "0.5193098", "0.51830...
0.80517364
0
Takes txt and returns a sanitized utf8 string.
def clean_txt(txt): r = txt.encode("utf-8", errors="backslashreplace").decode('utf-8').replace("\\u0144", "") return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_unicode(text):\n clean_text = text.encode(\"ascii\", errors=\"replace\").strip().decode(\"ascii\")\n clean_text = clean_text.replace(\"?\", ' ')\n return clean_text", "def normalize_txt(txt):\n return unicodedata.normalize('NFD', txt).encode('ascii', 'ignore').decode('utf-8', 'ignoree')...
[ "0.7723046", "0.7432493", "0.7044956", "0.7010811", "0.7010811", "0.69838905", "0.6814996", "0.6813858", "0.6760313", "0.6738436", "0.6728626", "0.6728626", "0.6728626", "0.6728626", "0.6728626", "0.6728626", "0.6703209", "0.66772974", "0.6675881", "0.66670734", "0.6650846", ...
0.8136862
0
Takes a DOI string and returns a JSON string of metadata.
def doi2json(doi): if "arxiv" in doi: print("This script does not yet support arXiv.") sys.exit(2) else: url = "https://dx.doi.org/" + doi headers = {"accept": "application/json"} r = requests.get(url, headers = headers) if repr(r)=="<Response [200]>": #success! #handle potential enc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_doi_metadata(identifier_doi) -> Dict:\n\n record_metadata = None\n record = search_record_by_doi(identifier_doi)\n\n if record:\n record_metadata = _metadata_builder(record[0], scheme=\"doi\")\n record_metadata[\"url\"] = f\"/records/{record[0]['id']}\"\n\n return record_metadata...
[ "0.658324", "0.6186826", "0.60670644", "0.5869886", "0.5681247", "0.55712116", "0.53361624", "0.52934235", "0.5220034", "0.51885957", "0.5179392", "0.51644266", "0.51488006", "0.5144595", "0.5139534", "0.510246", "0.5086857", "0.5024589", "0.50141627", "0.49613795", "0.494524...
0.7098311
0
Takes the DOI result and returns a string of the year.
def make_year(res): return str(res['issued']['date-parts'][0][0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_year(date):\n return date.strftime('%Y')", "def date_year(date):\n return date.year", "def get_year(self, grab):\n return int(\n grab.doc.select(\n '//time[@itemprop=\"releaseDate\"]'\n ).attr('datetime')\n )", "def get_year(x):\n return x[\...
[ "0.73795146", "0.7228297", "0.7165338", "0.71384025", "0.7129264", "0.6988705", "0.6932365", "0.6906564", "0.6808751", "0.6798235", "0.67756087", "0.6766526", "0.67278534", "0.6683164", "0.6678295", "0.6672517", "0.6591305", "0.6571039", "0.65610033", "0.6558856", "0.65513927...
0.80286705
0
Creates a markdown citation from metadata.
def make_citation(meta): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description():\n #rule = request.url_rule\n #print(rule)\n file = open('./contest/content/description.md', 'r')\n rawText = file.read()\n file.close()\n content = Markup(markdown(rawText, \n extensions=['markdown.extensions.fenced_code', 'markdown.extensions.tables']))\n return rend...
[ "0.610169", "0.60999304", "0.6075511", "0.59388006", "0.5928492", "0.58350015", "0.583484", "0.5830997", "0.5785562", "0.57813805", "0.57697576", "0.57567203", "0.5751474", "0.5712467", "0.57048875", "0.56936425", "0.56919795", "0.56474745", "0.56297183", "0.5600928", "0.5589...
0.75264513
0
Takes a DOI json string and returns a string of authors in Chicago style.
def make_citation_authors(res): if "author" in res.keys(): first_author = res['author'][0]['family'] + ", " + res['author'][0]['given'] last_author = res['author'][-1]['given'] + " " + res['author'][-1]['family'] middle_authors = ", ".join(" ".join([x['given'], x['family']]) for x in res['author'][1:-1]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __convert_authors(self, author_dict: dict) -> str:\n if \"author\" not in author_dict.keys():\n return str(author_dict)\n res = \"\"\n for i, _ in enumerate(author_dict['author']):\n if \"given-name\" in author_dict[\"author\"][i].keys() and \"surname\" in author_dict...
[ "0.6728681", "0.6692912", "0.65401095", "0.6410286", "0.6366991", "0.63544077", "0.6307347", "0.6097952", "0.60561144", "0.5966987", "0.59162784", "0.59035283", "0.58819854", "0.5861095", "0.585607", "0.5821361", "0.5820649", "0.57907295", "0.5786199", "0.5775579", "0.5771546...
0.68210953
0
Takes a DOI query and returns a string citation key.
def make_citation_key(res): year = str(make_year(res)) try: last_names = [x['family'] for x in res['author']] except KeyError as e: last_names = ["Unknown"] if len(last_names) >= 3: key = last_names[0].capitalize() + "ETAL" + year else: key = "".join(last_names) + year return clean_txt(key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDOIFromCitation(citation):\n try:\n if \".org/\" in citation:\n DOI = citation.split(\".org/\")[1]\n elif citationContainsDOI(citation):\n DOI = citation.split(\"doi:\")[1]\n DOI = DOI.replace(\"]\", \"\")\n elif citation == \"unknown\":\n ...
[ "0.6022313", "0.5677307", "0.5497388", "0.5451675", "0.5379123", "0.5315531", "0.5298218", "0.52595454", "0.5206413", "0.52004886", "0.5185838", "0.51701903", "0.5129876", "0.5094006", "0.5090158", "0.504325", "0.5029831", "0.5014715", "0.4986593", "0.4962676", "0.49595913", ...
0.5822018
1
UK Residential Building Classification using NISMOD API
def building_classification(user_settings, LAD_Code_to_be_processed, year): # API call - get buildings buildingPolys, buildingAttributes, i = get_buildings(user_settings, year, LAD_Code_to_be_processed) print(i, " buildings loaded successfully") print("Pre-processing OAs...") print("") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_client_nationality_create(self):\n pass", "def __init__(self):\n self.incidents_models = {}\n self.risks = []\n self.incidents_models = None", "def __init__(self, name, nlp):\n if not Doc.has_extension(\"flesch_kincaid_grade_level\"):\n Doc.set_extension(\...
[ "0.5060715", "0.50379556", "0.50094616", "0.4955696", "0.49391574", "0.48894048", "0.4828508", "0.48225057", "0.4818726", "0.48027202", "0.4782183", "0.47749674", "0.4766547", "0.47340876", "0.47322473", "0.4728601", "0.4719848", "0.47131366", "0.47128528", "0.46985045", "0.4...
0.5458008
0
"Calculate communities using the louvain algorithm and assign them as property to the graphs node. if two graphs are given, also assign one graph's communities to the other's.
def assign_louvain_communities( reddit_graph: nx.Graph, wiki_graph: nx.Graph = None, reddit_edge_weight: str = "count", others_threshold: int = 2, louvain_resolution_reddit: float = 1, ) -> Union[nx.Graph, Tuple[nx.Graph, nx.Graph]]: reddit_dendrogram = community.generate_dendrogram( red...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_communities(graph):\n communities = nx.algorithms.community\\\n .greedy_modularity_communities(nx.Graph(graph))\n for node in graph.nodes:\n graph.nodes[node]['community'] = [i for i,c in enumerate(communities)\n ...
[ "0.67626125", "0.583621", "0.58006155", "0.5679958", "0.5663112", "0.56382596", "0.55777717", "0.55304617", "0.5529389", "0.5454675", "0.53729236", "0.53552675", "0.5346172", "0.5343925", "0.5282058", "0.52801174", "0.52362", "0.52290237", "0.5207473", "0.5196071", "0.5188148...
0.68032855
0
Given a graph and wikipedia data, assign a new attribute to the nodes that represent the root category of that node on wikipedia.
def assign_root_categories( graph: nx.Graph, wiki_data: Dict[str, List], mapping: Dict[str, List[str]], name: str, ): inverse_mapping = {} for category, subcategories in mapping.items(): for subcategory in subcategories: inverse_mapping[subcategory.lower()] = category.lower()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_wiki_graph(self):\n\n print 'Creating wiki corpus graph representation'\n\n for path, subdirs, files in os.walk(self.wk_path):\n\n here = os.path.split(path)[1]\n parent = os.path.split(os.path.split(path)[0])[1]\n\n self.categories.add_edge(parent, here)\n...
[ "0.5713659", "0.55243695", "0.5458509", "0.5394645", "0.53911346", "0.5331459", "0.52841", "0.5165274", "0.5155383", "0.51139027", "0.5102045", "0.5034375", "0.5022714", "0.49948585", "0.49899447", "0.49746022", "0.49727643", "0.49725136", "0.49618325", "0.49581978", "0.49541...
0.73166484
0
Fetch content from url from internet.
def fetch(url): content = requests.get(url).text if "Error" in content: raise ValueError(f"Cannot read from: {url}") return content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FetchUrlContent(url):\n content = memcache.get(url)\n if content:\n return content\n\n request = urlfetch.fetch(url)\n\n if request.status_code == 200:\n content = request.content\n memcache.add(url, content, 60 * 60)\n return content\n\n raise LookupError('Unable to fetch URL. Response code: ...
[ "0.7854713", "0.7601417", "0.7481938", "0.7471776", "0.7464785", "0.737556", "0.7333622", "0.7234272", "0.7168919", "0.71437925", "0.7130872", "0.70851994", "0.7037209", "0.6997041", "0.69916236", "0.6990844", "0.69858104", "0.694551", "0.6888064", "0.684841", "0.6812926", ...
0.7994116
0
Return text selected by current text cursor
def get_selected_text(self): return self.selectedText()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def 取现行选中项文本(self): # real signature unknown; restored from __doc__\n return self.GetStringSelection()", "def GetSelection(self):\n # STC HELL\n # Translate the UTF8 byte offsets to unicode\n start, end = super(EditraBaseStc, self).GetSelection()\n utf8_txt = self.GetTextUTF8(...
[ "0.7284781", "0.7160584", "0.70578974", "0.7029724", "0.70025164", "0.6966177", "0.68031716", "0.67322236", "0.6687264", "0.6637608", "0.6611437", "0.660396", "0.6540948", "0.65185386", "0.65033114", "0.6497085", "0.64909786", "0.6490966", "0.6487668", "0.64566475", "0.641807...
0.77053285
0
Return address label text
def get_label(self): return _("Address:")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label(self):\n return self.address.label", "def addr(label_name):\n\n if not utils.is_string_type(label_name):\n return None\n\n return labelmanager.addr(label_name)", "def Label(self) -> str:", "def label(self):\r\n return self._text", "def getLabel(self):\n return se...
[ "0.806035", "0.70272446", "0.6852581", "0.6721922", "0.66679335", "0.665301", "0.6590346", "0.6526023", "0.6508484", "0.64936596", "0.6479075", "0.64485395", "0.64107037", "0.64107037", "0.64107037", "0.6388713", "0.6388713", "0.6388713", "0.63782066", "0.6363671", "0.6352065...
0.8508571
0
Go to home page
def go_home(self): if self.home_url is not None: self.set_url(self.home_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(self):\n self.goto(0, 0)", "def go_home(request):\n\n url = request.route_url('home', _app_url=get_app_url(request))\n return HTTPFound(location=url)", "def start_page():\n if not _home:\n abort(404)\n return redirect(_home)", "def start_page():\n if not _home:\n ...
[ "0.8030926", "0.8010641", "0.78565353", "0.78565353", "0.7842787", "0.7819811", "0.7761241", "0.77168256", "0.7710422", "0.7658114", "0.75707996", "0.75160396", "0.7515307", "0.7425273", "0.74167955", "0.74005103", "0.7379817", "0.7340132", "0.7321713", "0.7319783", "0.729707...
0.82052684
0
Convert text address into QUrl object
def text_to_url(self, text): return QUrl(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_real_link(self, text):\n if text.startswith('https://www.google.com/url?'):\n return parse_qs(urlparse(text).query)['url'][0]\n\n return text", "def url( self ):\n return str(self._urlEdit.text())", "def from_text(cls, text, lazy=False):\n _url = URL.from_text...
[ "0.60896194", "0.58221596", "0.57163924", "0.56358016", "0.5625108", "0.5617658", "0.5563111", "0.5548542", "0.5467414", "0.5427628", "0.5405655", "0.5368186", "0.53607416", "0.5298272", "0.52477235", "0.52291113", "0.5227061", "0.5218417", "0.52177066", "0.52148855", "0.5210...
0.83145833
0
Load URL from combo box first item
def url_combo_activated(self, valid): text = to_text_string(self.url_combo.currentText()) self.go_to(self.text_to_url(text))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_changed(self, url):\r\n self.url_combo.add_text(self.url_to_text(url))", "def url(self, index):\r\n return self.arraydata[index.row()][3]", "def getUrl(self): #$NON-NLS-1$\r", "def getUrl(self): #$NON-NLS-1$\r", "def _set_url(self): \n self.url = self.geturl()", "def o...
[ "0.62794936", "0.56698847", "0.5567722", "0.5567722", "0.5516658", "0.5504994", "0.54238933", "0.5409259", "0.5360647", "0.5356733", "0.5342514", "0.53292465", "0.52945983", "0.5292092", "0.527177", "0.52594316", "0.52594316", "0.5163751", "0.51590276", "0.51314217", "0.51078...
0.67692727
0
Displayed URL has changed > updating URL combo box
def url_changed(self, url): self.url_combo.add_text(self.url_to_text(url))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_combo_activated(self, valid):\r\n text = to_text_string(self.url_combo.currentText())\r\n self.go_to(self.text_to_url(text))", "def setUrl( self, url ):\n self._urlEdit.setText(str(url))", "def _set_url(self): \n self.url = self.geturl()", "def update(self):\n ...
[ "0.73831874", "0.64797366", "0.6392797", "0.6291374", "0.6145232", "0.6035736", "0.6000622", "0.588983", "0.5874441", "0.5723513", "0.571668", "0.5658121", "0.5657293", "0.5549916", "0.5541507", "0.5541507", "0.5540664", "0.5539055", "0.5507194", "0.5475449", "0.54538095", ...
0.8552276
0
Test AudioWithTargetDataset when the input manifest has a list of audio files in the target key.
def test_audio_to_target_dataset_with_target_list(self): # Data setup random_seed = 42 sample_rate = 16000 num_examples = 25 data_num_channels = { 'input_signal': 4, 'target_signal': 2, } data_min_duration = 2.0 data_max_duration = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_audio_to_target_dataset(self):\n # Data setup\n random_seed = 42\n sample_rate = 16000\n num_examples = 25\n data_num_channels = {\n 'input_signal': 4,\n 'target_signal': 2,\n }\n data_min_duration = 2.0\n data_max_duration = 8....
[ "0.7250293", "0.71431744", "0.6796289", "0.605845", "0.5996755", "0.5932426", "0.56953", "0.5652721", "0.5523613", "0.55113816", "0.54439896", "0.5376069", "0.5361794", "0.53253376", "0.53091663", "0.5283096", "0.5243713", "0.5220054", "0.52077305", "0.5205458", "0.5194152", ...
0.7698354
0
Test AudioWithTargetDataset when target_key is not set, i.e., it is `None`. This is the case, e.g., when running inference, and a target is not available.
def test_audio_to_target_dataset_for_inference(self): # Data setup random_seed = 42 sample_rate = 16000 num_examples = 25 data_num_channels = { 'input_signal': 4, } data_min_duration = 2.0 data_max_duration = 8.0 data_key = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_audio_to_target_dataset_with_target_list(self):\n # Data setup\n random_seed = 42\n sample_rate = 16000\n num_examples = 25\n data_num_channels = {\n 'input_signal': 4,\n 'target_signal': 2,\n }\n data_min_duration = 2.0\n data_...
[ "0.64373434", "0.6138161", "0.60954756", "0.5792956", "0.5187526", "0.51111406", "0.5066631", "0.5061071", "0.5055374", "0.50493824", "0.5031285", "0.50212836", "0.50162834", "0.50123787", "0.5001917", "0.49845558", "0.49843332", "0.49786356", "0.49732897", "0.49652073", "0.4...
0.6358206
1
Test AudioWithTargetWithReferenceDataset in different configurations. 1) reference synchronized with input and target 2) reference not synchronized
def test_audio_to_target_with_reference_dataset(self): # Data setup random_seed = 42 sample_rate = 16000 num_examples = 25 data_num_channels = { 'input_signal': 4, 'target_signal': 2, 'reference_signal': 1, } data_min_duration =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_audio_to_target_dataset_with_target_list(self):\n # Data setup\n random_seed = 42\n sample_rate = 16000\n num_examples = 25\n data_num_channels = {\n 'input_signal': 4,\n 'target_signal': 2,\n }\n data_min_duration = 2.0\n data_...
[ "0.7115833", "0.69337875", "0.6856453", "0.587368", "0.58267164", "0.5782507", "0.56655353", "0.5663457", "0.5510921", "0.54887766", "0.54879075", "0.5476506", "0.546535", "0.5411646", "0.54094833", "0.540816", "0.5401135", "0.53859675", "0.53731173", "0.5363868", "0.5353652"...
0.7930149
0
Test caching of manifest and audio files.
def test_cache_datastore_manifests(self, cache_audio: bool): # Data setup random_seed = 42 sample_rate = 16000 num_examples = 10 num_manifests = 2 data_duration = 1.0 # Generate random signals _rng = np.random.default_rng(seed=random_seed) # Inpu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_cached_files(self, cache_key):\r\n pass", "def check_av_cache(self):\n self.set_file_md5()\n request = copy.deepcopy(self.request_template)\n request['request'][0]['md5'] = self.md5\n print(\"file {} md5: {}\".format(self.file_name, self.md5))\n data = json.dumps(req...
[ "0.6617508", "0.6597452", "0.6480026", "0.6296434", "0.62768906", "0.61264974", "0.60606784", "0.6046493", "0.60453534", "0.5941499", "0.59267324", "0.5897573", "0.5878391", "0.58396906", "0.5835139", "0.5825056", "0.5820482", "0.5812071", "0.5802669", "0.57987285", "0.578439...
0.75279844
0
Combine Zebra, ospfd and bpgd configs into an integrated FRR config file
def integrate_frr_config( device, output_dir: str, zebra_config: str, ospfd_config: str, bgpd_config: str ) -> None: filename = os.path.join(output_dir, f"{device.hostname}_frr.conf") config = "\n".join([zebra_config, ospfd_config, bgpd_config]) write_config_to_file(filename=filename, config=config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug_bfdconfig_using_frrlog(dut,config=\"\",log_file_name=\"\"):\n if config == \"yes\" or config==\"\":\n st.config(dut,\"debug bfd\", type='vtysh')\n st.config(dut,\"log syslog warnings\", type='vtysh')\n st.config(dut,\"log file /var/log/frr/%s\"%log_file_name, type='vtysh')\n el...
[ "0.6048967", "0.6027095", "0.5866024", "0.5748502", "0.56746876", "0.56197035", "0.55814254", "0.55647826", "0.55417913", "0.55403876", "0.55377334", "0.5528458", "0.5511416", "0.5500469", "0.5500469", "0.54969746", "0.5482898", "0.5461037", "0.54193646", "0.54100525", "0.540...
0.67836076
0
Check for required and recommended dependencies.
def check_dependencies(): required_found = True recommended_found = True print 'Checking dependencies ...\n' print 'Required dependencies:' try: import Image assert Image.VERSION >= '1.1.5' print ' Python Imaging Library ....... OK' except ImportError: print ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkRequiredDependencies(self):\n \n # skip dependency check for downloading only\n if( self.downloadOnly ):\n return\n\n # hard dependencies\n for req in self.reqmodules:\n if( self.parent.module(req) == None ):\n # check if there is an auto...
[ "0.8139321", "0.77652836", "0.7728164", "0.75330514", "0.75279796", "0.749545", "0.74915475", "0.7477606", "0.7475087", "0.7374663", "0.7341775", "0.73221123", "0.7314262", "0.7221009", "0.71929526", "0.71829623", "0.71196723", "0.71069777", "0.7092555", "0.7033307", "0.69972...
0.7815703
1
Checks for the installed gnome version.
def check_gnome_version(): (stdin, stdout) = os.popen2("gnome-session --version") version = stdout.read().split()[1] if version[0] == '3': return "gnome3" elif version[0] == '2': return "gnome2" else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_glibver(reqver_text):\n\treturn check_pkgcfg_ver(reqver_text, 'glib-2.0')", "def check_os_version():\n if not version.is_supported_version():\n supported_releases = []\n for rel in version.SUPPORTED_VERSIONS:\n for ver in version.SUPPORTED_VERSIONS[rel]:\n sup...
[ "0.6810678", "0.6351426", "0.63197887", "0.6202522", "0.6092114", "0.6075582", "0.60554004", "0.5933157", "0.58399296", "0.5789901", "0.578221", "0.5764587", "0.5729247", "0.57174087", "0.57173824", "0.56931776", "0.5690295", "0.5656736", "0.56408054", "0.56354445", "0.563483...
0.8036126
0
Constructor layout type of the window layout (string) editVisibilities list of flags giving the visibilities of the various parts for the 'edit' view profile (list of boolean) debugVisibilities list of flags giving the visibilities of the various parts for the 'debug' view profile (list of boolean) parent parent widget...
def __init__(self, layout, editVisibilities, debugVisibilities, parent=None): super(ViewProfileDialog, self).__init__(parent) self.__layout = layout if self.__layout == "Toolboxes": self.ui = Ui_ViewProfileToolboxesDialog() elif self.__layout == "Sid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_layout( self ):\n\n # highlight all of our widgets so we can debug layouts.\n # XXX: debugging support.\n self.setStyleSheet( \"border: 1px solid black\" )\n\n editing_layout = QGridLayout()\n editing_layout.addWidget( QLabel( \"Art Record ID:\" ),\n ...
[ "0.62874687", "0.6213777", "0.6198838", "0.61943346", "0.6192612", "0.6078968", "0.59537333", "0.5948558", "0.5915506", "0.5911127", "0.5889578", "0.5851476", "0.58412284", "0.5832966", "0.58189267", "0.58054477", "0.58054477", "0.57478803", "0.5724762", "0.5702208", "0.56946...
0.7483497
0
Public method to retrieve the visibilities configuration. tuple of two lists giving the visibilities of the various parts (two lists of boolean)
def getVisibilities(self): if self.__layout in ["Toolboxes", "Sidebars"]: return ( # edit profile [ self.ui.epltCheckBox.isChecked(), self.ui.ephtCheckBox.isChecked(), self.ui.eprtCheckBox.isChecked(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vis(self):\n \treturn self._vis", "def vis(self):\n if self._vis is None:\n raise ValueError('Visibilities are not available since dataset '\n 'was opened with metadata only')\n return self._vis", "def get_list_of_bool2(self):\n pass", "def s...
[ "0.582845", "0.55503994", "0.5478877", "0.5326926", "0.5286892", "0.523772", "0.52293015", "0.5211375", "0.5121061", "0.5117069", "0.50671124", "0.502521", "0.5006339", "0.50050074", "0.50011945", "0.49709192", "0.49708065", "0.49574512", "0.49484375", "0.49445185", "0.493935...
0.6949434
0
Launch training of the model with a set of hyperparameters in parent_dir/job_name
def launch_training_job(parent_dir, data_dir, job_name, params): # Create a new folder in parent_dir with unique_name "job_name" model_dir = os.path.join(parent_dir, job_name) if not os.path.exists(model_dir): os.makedirs(model_dir) # Write parameters in json file json_path = os.path.join(m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def launch_training_job(model_dir,job_name, params, implementation_dir):\n # Create a new folder in implementation corresponding to the model\n implementation_dir = os.path.join(implementation_dir, os.path.basename(os.path.normpath(model_dir)))\n if not os.path.exists(implementation_dir):\n os.make...
[ "0.75801235", "0.72000736", "0.71844184", "0.643731", "0.6379157", "0.6295458", "0.6280779", "0.6278884", "0.6200592", "0.61892694", "0.6156562", "0.61367965", "0.6101775", "0.6097964", "0.6089255", "0.6086131", "0.60787797", "0.60640514", "0.6054885", "0.6025348", "0.6022250...
0.80085224
0
Select specified Credential using Credential Name
def selectCredential(self, credentialName): try: utility.execLog("Reading Credentials Table...") tableName = self.CredentialsObjects('credentialsTable') getRows = "//table[@id='%s']//tbody//tr" % tableName # Get No. of Rows i.e. No. of Credentials defined ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by_user_name(cls,name):\n\n for user_name in cls.credential_list:\n if Credential.user_name == name:\n return credential", "def lookup_credential(self, credential_name) -> Union[str, None]:\n cred_info = None\n \n if credential_name in self._credenti...
[ "0.70019114", "0.6583242", "0.6461027", "0.6435053", "0.64008826", "0.6347024", "0.6330697", "0.6280079", "0.62434363", "0.61968416", "0.613325", "0.6094919", "0.59781945", "0.5945215", "0.58550346", "0.5811452", "0.58057797", "0.5801792", "0.57695407", "0.575122", "0.5744616...
0.7311637
0
Generates a mock for the Popen class that allows easy testing of device methods that use Popen.
def generateStandardMock(monkeypatch, return_value_output, return_value_error, return_code, type="gpt"): mock_popen = mock.MagicMock() mock_popen.communicate.return_value = (return_value_output, return_value_error) mock_popen.returncode = return_code def popen_constructor(*args, **kargs): return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_gitlab_subprocess(monkeypatch):\n mock_subprocess = mock.Mock()\n monkeypatch.setattr(\"libgitlab.subprocess\", mock_subprocess)\n return mock_subprocess", "def test_Command_execute(Popen, out):\n from paradrop.confd.command import Command\n\n proc = MagicMock()\n proc.stdout = [\"outp...
[ "0.65290594", "0.6446328", "0.6381332", "0.6283551", "0.6261475", "0.6226451", "0.6157169", "0.60995954", "0.6064817", "0.6023398", "0.60163933", "0.6002008", "0.59588116", "0.5842827", "0.5831892", "0.5775619", "0.5703135", "0.5686906", "0.5643579", "0.56423247", "0.56415945...
0.71386445
0
Crop video frames generated by faceit. These contain a topbottom display of both the original and the fake. We only want the fake, which is on the bottom. frame A frame of an image, represented as a numpy 2D array
def crop_frame(frame): (h,w,c) = frame.shape return frame[int(h/2):h, 0:w]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_frame(frame):\n return frame[9:195,:]", "def crop_yeast(frame):\n frame = frame.astype(np.float)[:, 20:]\n frame = frame - frame.min()\n frame = frame / frame.max()\n\n E = convolve(frame, np.ones((21, 21)) / (21 ** 2), mode='mirror')\n var = convolve((frame - E) ** 2, np.ones((21, 21)) / (21 **...
[ "0.6909063", "0.6857775", "0.6838563", "0.66702497", "0.6612095", "0.63971514", "0.63785726", "0.6314421", "0.62583184", "0.6170587", "0.6120885", "0.6119799", "0.60966414", "0.6090558", "0.60840464", "0.60569525", "0.59626687", "0.5955637", "0.5849901", "0.5822246", "0.58025...
0.7268344
0
frame_path Path of frames extracted from video out_path Destination directory face_path Path to a single image of a face. The face acts as a filter in the extraction process
def extract_faces(frame_path, out_path, face_path, processes=1): if os.path.exists(out_path): msg = '[extract_faces] Skipping extraction since faces already exist at {}' print(msg.format(out_path)) return from faceoff.faceswap_api import FaceSwapInterface os.makedirs(out_path) print('[extract_face...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_face_samples(model, output_path, invid):\n \n if not os.path.isdir(output_path) :\n os.mkdir(output_path)\n \n video = mmcv.VideoReader(invid)\n for frame_ix, frame in enumerate(video):\n frame_name = f\"{output_path}webcam_{frame_ix}_0.jpg\"\n if os.path.isfile(frame_...
[ "0.66893524", "0.64116395", "0.63762826", "0.627982", "0.6190095", "0.612784", "0.612621", "0.6102462", "0.60096014", "0.59442425", "0.59189767", "0.58937013", "0.5885089", "0.5868953", "0.5868953", "0.58336353", "0.58160245", "0.5798521", "0.5779832", "0.57628787", "0.576126...
0.73002666
0
Send emails to given addresses with author and title.
def send_emails(emails, author, title): subject = 'New post by %s' % author.capitalize() message = '%s wrote a new post with the title: %s' % (author.capitalize(), title) print('Sending emails to ', emails) send_mails_count = send_mail( subject=subject, message=message, from_emai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_publishers_authors_email(subject, template_name, context=None):\n\n if context is None:\n context = {}\n\n qry = Q(groups__name='Publishers') | Q(groups__name='Editors')\n\n emails = auth_models.User.objects.filter(qry, is_active=True).distinct().values('email')\n to = [e['email'] for e...
[ "0.73475295", "0.72880167", "0.6946897", "0.69199556", "0.68991786", "0.6872724", "0.66892296", "0.66837376", "0.6541967", "0.65169704", "0.64917403", "0.64559406", "0.64559406", "0.6429217", "0.6406536", "0.638101", "0.63640517", "0.63454235", "0.6334658", "0.6325938", "0.63...
0.78099644
0
Create a new FileSystemStorageManager.
def __init__( self, storage_path: str, block_size: Tuple[int, int, int], **kwargs ) -> None: self.name = "FilesystemStorageManager" if "next_layer" in kwargs: self._next = kwargs["next_layer"] self.is_terminal = False else: self.is_terminal = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def storage_factory():\n return storage(transaction.manager, **kwargs)", "def get_storage_factory(settings, prefix='filestore'):\n # Pull prefix.key out of the config object\n kwargs = {}\n plen = len(prefix)\n for key, val in settings.iteritems():\n if key[0:plen] == prefix and len(key...
[ "0.65684736", "0.65024024", "0.64939773", "0.64498276", "0.6393434", "0.63712853", "0.60197824", "0.6006007", "0.58452845", "0.5807645", "0.5675507", "0.55518323", "0.55076015", "0.54478616", "0.54227984", "0.5405537", "0.54037446", "0.54015326", "0.5375559", "0.5353352", "0....
0.65634197
1
Loads file.kv for given file.py.
def load_kv_from_py(f): filename = os.path.basename(os.path.splitext(f)[0]) Builder.load_file( os.path.join( os.path.dirname(os.path.abspath(f)), filename + '.kv' ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadFromFile(self,filename):\n path = os.path.dirname(__file__)+\"/\"+filename\n if os.path.exists(path) and os.path.isfile(path):\n self.load(yaml.load(open(path, 'r')))", "def load_device_key(self, filename):\n pass", "def load_file(*args, **kwargs): # real signature unknown\n pass",...
[ "0.6284266", "0.6267552", "0.61632735", "0.6158651", "0.6119409", "0.61150223", "0.59817547", "0.5913432", "0.5907245", "0.5906445", "0.5906445", "0.58475703", "0.58206075", "0.5793731", "0.5777142", "0.5775962", "0.5768624", "0.5739578", "0.5732456", "0.57303315", "0.571487"...
0.8177233
0
Android runtime storage permission check.
def check_write_permission(): if platform != "android": return True from android.permissions import Permission, check_permission permission = Permission.WRITE_EXTERNAL_STORAGE return check_permission(permission)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_request_write_permission():\n had_permission = check_write_permission()\n if not had_permission:\n from android.permissions import Permission, request_permission\n permission = Permission.WRITE_EXTERNAL_STORAGE\n request_permission(permission)\n return had_permission", "de...
[ "0.7202251", "0.6943277", "0.62124854", "0.618468", "0.6160119", "0.6134277", "0.608456", "0.6053089", "0.59828085", "0.5975798", "0.59566784", "0.5937469", "0.5937469", "0.5901972", "0.5752768", "0.5746903", "0.564597", "0.56035596", "0.5591295", "0.5583529", "0.557322", "...
0.7512763
1
Overloads the StringIO.__init__() makes it possible to hook a callback for write operations.
def __init__(self, initial_value='', newline='\n', callback_write=None): self.callback_write = callback_write super(StringIOCBWrite, self).__init__(initial_value, newline)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, s):\n super(StringIOCBWrite, self).write(s)\n if self.callback_write is not None:\n self.callback_write(s)", "def __init__(self, initial_value='', newline='\\n', callback_write=None):\n self.callback_write = callback_write\n super().__init__(initial_value, n...
[ "0.68931127", "0.621374", "0.6154422", "0.6133093", "0.61255896", "0.60084426", "0.5796933", "0.5673074", "0.55242", "0.54353964", "0.5410119", "0.5403404", "0.53811437", "0.5339648", "0.53122294", "0.52972394", "0.5255194", "0.5237322", "0.5174512", "0.51619995", "0.51542866...
0.77534133
0
Calls the StringIO.write() method then the callback_write with given string parameter.
def write(self, s): super(StringIOCBWrite, self).write(s) if self.callback_write is not None: self.callback_write(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, s):\n super().write(s)\n if self.callback_write is not None:\n self.callback_write(s)", "def write( chunk, callback=None ):", "def __init__(self, initial_value='', newline='\\n', callback_write=None):\n self.callback_write = callback_write\n super(StringIO...
[ "0.7670594", "0.6919442", "0.66212714", "0.65033835", "0.6376131", "0.63577515", "0.62098473", "0.6205309", "0.6157066", "0.6100064", "0.60791105", "0.6063465", "0.60399914", "0.6025619", "0.5989306", "0.5950414", "0.59417355", "0.5930179", "0.5919346", "0.5845781", "0.584324...
0.8081951
0
Dispatches dismiss event for all dialogs.
def dismiss_all_dialogs(cls): # keeps a local copy since we're altering them as we iterate dialogs = cls.dialogs[:] for dialog in dialogs: dialog.dispatch('on_dismiss')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_dialog_dismiss(cls, dialog):\n with cls.__lock:\n try:\n cls.dialogs.remove(dialog)\n except ValueError:\n # fails silently if the dialog was dismissed twice, refs:\n # https://github.com/AndreMiras/PyWallet/issues/89\n ...
[ "0.6910326", "0.6509887", "0.58790725", "0.54707026", "0.5470258", "0.53742695", "0.53677505", "0.5340017", "0.5338553", "0.5322852", "0.5322852", "0.52909666", "0.5289009", "0.5244598", "0.52265036", "0.5213839", "0.5212716", "0.51920927", "0.51900136", "0.51444286", "0.5127...
0.7558764
0
Creates a dialog from given title and content. Adds it to the dialogs track list.
def create_dialog_content_helper(cls, title, content): # TODO dialog = MDDialog( title=title, content=content, size_hint=(.8, None), height=dp(250), auto_dismiss=False) dialog....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dialog(cls, title, body):\n dialog = cls.create_dialog_helper(title, body)\n dialog.add_action_button(\n \"Dismiss\",\n action=lambda *x: dialog.dismiss())\n return dialog", "def create_dialog_helper(cls, title, body):\n content = MDLabel(\n ...
[ "0.636904", "0.6244571", "0.6109213", "0.55375224", "0.550563", "0.53771466", "0.5317826", "0.5278603", "0.52564305", "0.52373844", "0.5221709", "0.5191893", "0.51859796", "0.5181427", "0.51597154", "0.5142532", "0.5141786", "0.5080388", "0.50445527", "0.50080466", "0.4998171...
0.77332443
0
Creates a dialog from given title and body. Adds it to the dialogs track list.
def create_dialog_helper(cls, title, body): content = MDLabel( font_style='Body1', theme_text_color='Secondary', text=body, size_hint_y=None, valign='top') content.bind(texture_size=content.setter('size')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dialog(cls, title, body):\n dialog = cls.create_dialog_helper(title, body)\n dialog.add_action_button(\n \"Dismiss\",\n action=lambda *x: dialog.dismiss())\n return dialog", "def create_dialog_content_helper(cls, title, content):\n # TODO\n ...
[ "0.73897016", "0.6644856", "0.61082184", "0.54324734", "0.53189737", "0.52327806", "0.52259374", "0.5224977", "0.5224894", "0.5150155", "0.5140405", "0.51207227", "0.51197153", "0.5062713", "0.505777", "0.5046215", "0.501949", "0.5006114", "0.49976355", "0.49285117", "0.49270...
0.71498233
1
Creates a dialog from given title and body. Adds it to the dialogs track list. Appends dismiss action.
def create_dialog(cls, title, body): dialog = cls.create_dialog_helper(title, body) dialog.add_action_button( "Dismiss", action=lambda *x: dialog.dismiss()) return dialog
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dialog_content_helper(cls, title, content):\n # TODO\n dialog = MDDialog(\n title=title,\n content=content,\n size_hint=(.8, None),\n height=dp(250),\n auto_dismiss=False)\n ...
[ "0.6497721", "0.6401719", "0.56973445", "0.52991194", "0.5042535", "0.49958557", "0.49780062", "0.49696958", "0.4956636", "0.49514943", "0.48655143", "0.48239017", "0.48158833", "0.47824684", "0.4731406", "0.47176898", "0.4717487", "0.46942216", "0.46896547", "0.4683249", "0....
0.8119363
0
Graphing multiple choice questions
def graph_multiple_choice(question_type, question, data_frame, path): if (question_type in ["radio", "dropdown"]): # Get this question's data column_data = data_frame[question["column-name"]].astype('str') new_labels = [] new_counts = [] for option in question["choices"]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_questions(self, number_of_questions):", "def generate_question(self, num_question = 10):\n\t\t\n\t\tquestions = []\n\t\tfor q in range(num_question):\n\t\t\tfor r in range(2):\n\t\t\t\tquestion = np.zeros(self.question_dim, dtype = np.float32)\n\t\t\t\tcolor = np.random.randint(len(COLOR))\n\t\t\t\tquest...
[ "0.6292627", "0.57807386", "0.56845987", "0.564677", "0.56185234", "0.5618352", "0.55521095", "0.5453991", "0.5436512", "0.54182845", "0.5417578", "0.5412484", "0.5371258", "0.5362857", "0.5359479", "0.5287491", "0.5285787", "0.5272607", "0.52690536", "0.5268676", "0.5266893"...
0.6674671
0
Prettyprint an XML string
def xml_pretty(xml_string): return xml_string # xml.dom.minidom.parseString(xml_string).toprettyxml()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_print(xml_text: str) -> str:\n dom = mini.parseString(xml_text)\n return dom.toprettyxml()", "def pretty_xml(xml):\n try:\n #parser = etree.XMLParser(remove_blank_text=True)\n tree = etree.fromstring(xml.encode('utf-8'))\n return etree.tostring(tree, pretty_print=True).de...
[ "0.8407132", "0.81077707", "0.8100876", "0.78659326", "0.78553253", "0.78058815", "0.76646036", "0.76367384", "0.76358", "0.7612611", "0.7609612", "0.76070946", "0.7595411", "0.7593535", "0.75745606", "0.75548416", "0.7547124", "0.75440127", "0.74764097", "0.74764097", "0.746...
0.83695865
1
POST /api/users/{encoded_user_id}/api_key Creates a new API key for specified user.
def api_key( self, trans, user_id, **kwd ): user = self.get_user( trans, user_id ) key = self.create_api_key( trans, user ) return key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_api_key(self, user_id, create_api_key_details, **kwargs):\n resource_path = \"/users/{userId}/apiKeys\"\n method = \"POST\"\n\n # Don't accept unknown kwargs\n expected_kwargs = [\n \"retry_strategy\",\n \"opc_retry_token\"\n ]\n extra_kwar...
[ "0.714919", "0.69237983", "0.6818191", "0.6630553", "0.66270053", "0.6392603", "0.63214433", "0.6191616", "0.61654377", "0.61536413", "0.6124252", "0.6063807", "0.6055479", "0.5967622", "0.59583575", "0.5785574", "0.573746", "0.5732332", "0.5725283", "0.5684918", "0.5683032",...
0.6990322
1
update( self, trans, id, payload, kwd ) PUT /api/users/{id} updates the values for the item with the given ``id``
def update( self, trans, id, payload, **kwd ): current_user = trans.user user_to_update = self.user_manager.by_id( self.decode_id( id ) ) # only allow updating other users if they're admin editing_someone_else = current_user != user_to_update is_admin = trans.api_inherit_admin o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, id):\n return userDao.update(id, api.payload)", "def update_user(id):\n pass", "def update_item(self, id: str, user: User, **kwargs) -> None:", "def put(self, id):\n data = flask.request.json\n user_dao.update_user(id, data)\n return None, 204", "def updateUser(...
[ "0.71554065", "0.67934835", "0.67506397", "0.67354965", "0.6622606", "0.65459347", "0.6496836", "0.64731866", "0.6351595", "0.630971", "0.6239683", "0.6149672", "0.61330205", "0.6130985", "0.61186457", "0.60910237", "0.6088965", "0.6082389", "0.6077", "0.6034635", "0.60218805...
0.79601187
0
Returns data for an anonymous user, truncated to only usage and quota_percent
def anon_user_api_value( self, trans ): usage = trans.app.quota_agent.get_usage( trans ) percent = trans.app.quota_agent.get_percent( trans=trans, usage=usage ) return {'total_disk_usage': int( usage ), 'nice_total_disk_usage': util.nice_size( usage ), 'quota_perc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_restricted_data(self, full_data, user):\n if (self.can_retrieve(user) and\n (not full_data['is_hidden'] or\n user.has_perm('agenda.can_see_hidden_items'))):\n data = full_data\n else:\n data = None\n return data", "def getAnonymizedUserDat...
[ "0.6198555", "0.6185825", "0.6042656", "0.5881235", "0.58330727", "0.5704703", "0.5637217", "0.5632154", "0.5571384", "0.55612034", "0.55344725", "0.5530451", "0.54922104", "0.5471283", "0.5337891", "0.5326672", "0.52288496", "0.5199204", "0.51971817", "0.51498044", "0.514980...
0.71251017
0
Get the ServiceManager from the running OpenOffice.org. Then retain it in the global variable goServiceManager for future use. This is similar to the GetProcessServiceManager() in OOo Basic.
def getServiceManager( cHost="localhost", cPort="8100" ): global goServiceManager if not goServiceManager: # Get the uno component context from the PyUNO runtime oLocalContext = uno.getComponentContext() # Create the UnoUrlResolver on the Python side. oLocalResolver = oLocalConte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getServiceManager( cHost=\"localhost\", cPort=\"2002\" ):\n global goServiceManager\n global pythonloader\n if not goServiceManager:\n # Get the uno component context from the PyUNO runtime\n oLocalContext = uno.getComponentContext()\n # Create the UnoUrlResolver on the Python sid...
[ "0.7510225", "0.6158415", "0.6007284", "0.5876527", "0.577307", "0.5744391", "0.57265943", "0.56256115", "0.560694", "0.560694", "0.56068903", "0.55568916", "0.55240405", "0.5514523", "0.5507699", "0.54865426", "0.5481933", "0.5462307", "0.5462307", "0.54545087", "0.540894", ...
0.7905925
0
An easy way to obtain the Desktop object from a running OOo.
def getDesktop(): global StarDesktop if StarDesktop == None: StarDesktop = createUnoService( "com.sun.star.frame.Desktop" ) return StarDesktop
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_shell_obj(self):\n return self._shell_obj()", "def get_desktop():\n l=get_pids(('kwin','ksmserver',))\n if l: kde=l[0]\n else: kde=None\n l=get_pids(('gnome-session',))\n if l: gnome=l[0]\n else: gnome=None\n if kde:\n if not gnome or kde<gnome: return 1\n else:...
[ "0.6204603", "0.6203321", "0.61584044", "0.61228", "0.6094934", "0.6070398", "0.60609776", "0.6008457", "0.59963185", "0.59664845", "0.594239", "0.59246624", "0.5920641", "0.589721", "0.58395696", "0.58212775", "0.5812335", "0.58082837", "0.5764528", "0.57537764", "0.5746203"...
0.75336903
1
Create a UNO struct and return it. Similar to the function of the same name in OOo Basic.
def createUnoStruct( cTypeName ): oCoreReflection = getCoreReflection() # Get the IDL class for the type name oXIdlClass = oCoreReflection.forName( cTypeName ) # Create the struct. oReturnValue, oStruct = oXIdlClass.createObject( None ) return oStruct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_out_struct(self):\n args ={\n \"name\": self.python_madz_types + (\"OUTSTRUCT\" if self.namespace == \"\" else self._namespace_mangle(self.namespace)),\n \"fields\":\"\"\n }\n\n res = \\\n\"\"\"class {name}(Structure):\n _fields_ = [{fields}]\n\"\"\"\n ...
[ "0.63244736", "0.6301216", "0.61636955", "0.60895026", "0.5975966", "0.5969751", "0.59557974", "0.59557974", "0.59368527", "0.5931486", "0.5877731", "0.5787432", "0.57536936", "0.57536936", "0.57326335", "0.5729011", "0.5681302", "0.5629835", "0.5629369", "0.5552236", "0.5542...
0.7499315
1
Create a com.sun.star.beans.PropertyValue struct and return it.
def makePropertyValue( cName=None, uValue=None, nHandle=None, nState=None ): oPropertyValue = createUnoStruct( "com.sun.star.beans.PropertyValue" ) if cName != None: oPropertyValue.Name = cName if uValue != None: oPropertyValue.Value = uValue if nHandle != None: oPropertyValue.H...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _makeProperty( key, value ):\r\n property = PropertyValue()\r\n property.Name = key\r\n property.Value = value\r\n return property", "def build_property(value_token: ValueToken) -> property:\n def caller(_: Any) -> Any:\n return value_token.get_value()\n return proper...
[ "0.67887276", "0.6174897", "0.59736574", "0.57488036", "0.5725434", "0.55776346", "0.55673015", "0.5489214", "0.54637295", "0.53633696", "0.5349648", "0.53457737", "0.53144455", "0.53021073", "0.5301851", "0.5261466", "0.52546734", "0.5236803", "0.52332073", "0.5223267", "0.5...
0.81450075
1
Create a com.sun.star.awt.Point struct.
def makePoint( nX, nY ): oPoint = createUnoStruct( "com.sun.star.awt.Point" ) oPoint.X = nX oPoint.Y = nY return oPoint
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_point(x_crd, y_crd):\n\n Point = namedtuple(\"Point\", \"x_crd y_crd\")\n return Point(x_crd, y_crd)", "def point(self):\n return collections.namedtuple(self.name, [self.x, self.y, self.units])", "def getPoint(self):\n return Point(*self.position)", "def pos_as_point(self) -> P...
[ "0.7243411", "0.67983496", "0.65620244", "0.65571135", "0.65474313", "0.64679706", "0.6424313", "0.6340852", "0.62910265", "0.6268829", "0.62510884", "0.62171054", "0.6176435", "0.61754274", "0.5987973", "0.59807426", "0.59644204", "0.5933073", "0.5927502", "0.59074783", "0.5...
0.8447396
1
Create a com.sun.star.awt.Size struct.
def makeSize( nWidth, nHeight ): oSize = createUnoStruct( "com.sun.star.awt.Size" ) oSize.Width = nWidth oSize.Height = nHeight return oSize
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s_size(self) -> Size:\n pass", "def __init__(self, size: Size) -> None:\n self.size = size", "def get_size():\n opt = ['regular', 'small', 'large']\n inp = option_menu(opt, 'Widget size:')\n OPTIONS['size'] = opt[inp]\n add_to_collected('size', opt[inp])\n return", "def calc_...
[ "0.6514247", "0.63878924", "0.63867074", "0.63335556", "0.626978", "0.62154466", "0.6198053", "0.61620265", "0.6077605", "0.60734874", "0.6064625", "0.60150325", "0.60150325", "0.6009026", "0.598787", "0.5950839", "0.5940061", "0.5925219", "0.5900696", "0.5860935", "0.5852912...
0.8150994
1
Create a com.sun.star.awt.Rectangle struct.
def makeRectangle( nX, nY, nWidth, nHeight ): oRect = createUnoStruct( "com.sun.star.awt.Rectangle" ) oRect.X = nX oRect.Y = nY oRect.Width = nWidth oRect.Height = nHeight return oRect
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectangle(xcenter, ycenter, width, height):\n x1, x2 = xcenter - width, xcenter + width\n y1, y2 = ycenter - height, ycenter + height\n return Shape([Point(x1, y1), Point(x1, y2), Point(x2, y2), Point(x2, y1)])", "def create_rectangle(width, height, color):\n data = [-width / 2, -height / 2,\n ...
[ "0.6828258", "0.67447984", "0.661885", "0.6615916", "0.6569584", "0.6505301", "0.64754283", "0.645183", "0.645183", "0.64407796", "0.64276874", "0.6411871", "0.64014655", "0.6366434", "0.6291482", "0.6219487", "0.62064403", "0.62053233", "0.6200718", "0.6198248", "0.6196827",...
0.8646927
1
Lookup and return a style from the document.
def getStyle( oDrawDoc, cStyleFamily, cStyleName ): return oDrawDoc.getStyleFamilies().getByName( cStyleFamily ).getByName( cStyleName )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getstyle(self, cls, pcls, attr):\n\n if not self._loaded: \n # Load the default theme\n self._preload(\"default\")\n\n o = (cls, pcls, attr)\n \n v = self._get(cls, pcls, attr)\n if v: \n return v\n \n v = self._get(cls, \"\", at...
[ "0.7037308", "0.69399697", "0.6794137", "0.67522573", "0.6750428", "0.666402", "0.6654967", "0.66029024", "0.66029024", "0.6443583", "0.63991266", "0.6341702", "0.6240184", "0.6198077", "0.6179856", "0.60319597", "0.60168135", "0.5954674", "0.5839954", "0.580532", "0.5798659"...
0.7324632
1
Encodes a byte array.
def encode_byte_array(value: bytes) -> bytes: return bytes([]) if isinstance(value, type(None)) else value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base64_encode_array(inArray):\n return base64.b64encode(inArray)", "def _encodeArray(self, array):\n\n # Actually, we want dtype,naxis,axNlen,base64(array)\n return base64.b64encode(array.tostring())", "def encode_u8_array(value: typing.List[int]) -> bytes:\n return encode_u32(len(value...
[ "0.67685556", "0.6719785", "0.6707066", "0.66175944", "0.65519387", "0.6421554", "0.6359129", "0.6309159", "0.6290342", "0.61977494", "0.61690444", "0.59885335", "0.592693", "0.5902185", "0.58662087", "0.5840232", "0.5832926", "0.5829933", "0.58282703", "0.58261013", "0.58213...
0.70316756
0
Encodes a CL value.
def encode_cl_value(entity: CLValue) -> bytes: return encode_u8_array(encode(entity)) + \ encode_cl_type(entity.cl_type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(value: CLValue) -> bytes:\n encoder = ENCODERS[value.cl_type.typeof]\n if value.cl_type.typeof in {CLTypeKey.LIST, CLTypeKey.OPTION}:\n return encoder(\n value.parsed,\n ENCODERS[value.cl_type.inner_type.typeof]\n )\n else:\n return encoder(value.p...
[ "0.6924309", "0.6892988", "0.6754196", "0.6689653", "0.60146505", "0.5920411", "0.5842962", "0.58135366", "0.57850814", "0.5775125", "0.57655084", "0.5759036", "0.5734123", "0.569874", "0.5667831", "0.56533915", "0.56436425", "0.56319827", "0.56223106", "0.5606604", "0.559164...
0.7557248
0
Encodes a CL type definition.
def encode_cl_type(entity: CLType) -> bytes: def encode_byte_array(): return bytes([entity.typeof.value]) + encode_u32(entity.size) def encode_list(): raise NotImplementedError() def encode_map(): raise NotImplementedError() def encode_option(): return bytes([entity.ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_cl_type(entity: CLType) -> bytes:\n def encode_byte_array():\n return bytes([entity.typeof.value]) + encode_u32(entity.size)\n\n def encode_list():\n raise NotImplementedError()\n\n def encode_map():\n raise NotImplementedError()\n\n def encode_option():\n return ...
[ "0.70304537", "0.62190145", "0.59790117", "0.5946457", "0.5909911", "0.58783704", "0.57447356", "0.56664926", "0.5655347", "0.55191547", "0.5512027", "0.5464929", "0.5377146", "0.5348617", "0.5335326", "0.5331243", "0.53133863", "0.52949786", "0.5275582", "0.5263942", "0.5257...
0.71100825
0
Encodes a signed 32 bit integer.
def encode_i32(value: int) -> bytes: return int_to_le_bytes(value, NUMERIC_CONSTRAINTS[CLTypeKey.I32].LENGTH, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode32(x):\n while x < 0:\n x = x + 2**32 # Convert 2's complement negative numbers to unsigned\n assert((x >> 32) == 0) # Must be a 32bit quantity\n x = pack(x, 32, 'little', False) # Convert to little endian\n\n s = \"\"\n for b in x:\n s += '{:02x}'.format(b) # Convert l...
[ "0.732017", "0.7107245", "0.6937749", "0.6710767", "0.66709656", "0.6641764", "0.66244256", "0.65855706", "0.65325177", "0.65193176", "0.65188384", "0.6450076", "0.6440046", "0.63887787", "0.63869387", "0.6374578", "0.61871505", "0.6183587", "0.61385906", "0.61082375", "0.610...
0.7206746
1
Encodes a signed 64 bit integer.
def encode_i64(value: int) -> bytes: return int_to_le_bytes(value, NUMERIC_CONSTRAINTS[CLTypeKey.I64].LENGTH, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_u64(value: int) -> bytes:\n return int_to_le_bytes(value, NUMERIC_CONSTRAINTS[CLTypeKey.U64].LENGTH, False)", "def EncryptInt64(self, plaintext, r_value=None):\n if not isinstance(plaintext, int) and not isinstance(plaintext, long):\n raise ValueError('Expected int or long plaintext but got...
[ "0.71692836", "0.686562", "0.67323595", "0.6639236", "0.6529915", "0.6529915", "0.6500912", "0.6465857", "0.63426864", "0.62962234", "0.62952036", "0.62636083", "0.619505", "0.6107646", "0.6053847", "0.60516316", "0.6014983", "0.6005445", "0.5932173", "0.5821946", "0.580687",...
0.73616225
0
Encodes a list of values.
def encode_list(value: list, inner_encoder: typing.Callable) -> bytes: return encode_vector_of_t(list(map(inner_encoder, value)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode_list(source: list) -> bytes:\n result_data = b\"l\"\n\n for item in source:\n result_data += encode(item)\n\n return result_data + b\"e\"", "def encode_map(value: list) -> bytes:\n raise NotImplementedError()", "def encode_vector_of_t(value: list):\n return encode_u32(len(valu...
[ "0.7578226", "0.698777", "0.69816077", "0.6968496", "0.6479452", "0.6355267", "0.6316062", "0.6313891", "0.6290903", "0.6287611", "0.6217024", "0.6117214", "0.604431", "0.6038318", "0.6037949", "0.60118496", "0.59867775", "0.59576213", "0.5953789", "0.59052145", "0.59052145",...
0.7794736
0
Encodes a map of keys to associated values.
def encode_map(value: list) -> bytes: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode_dict(source: dict) -> bytes:\n result_data = b\"d\"\n\n for key, value in source.items():\n result_data += encode(key) + encode(value)\n\n return result_data + b\"e\"", "def recode_value_dict(dictionary):\n somedict = {k:v.encode('cp1251') for k, v in dictionary.items()}\n retur...
[ "0.6431957", "0.6041517", "0.5955288", "0.5951006", "0.5771898", "0.56404114", "0.55374527", "0.55217767", "0.548933", "0.5481381", "0.54517615", "0.5449542", "0.5435205", "0.5430026", "0.53833485", "0.53736645", "0.5357055", "0.53538597", "0.53396654", "0.53396654", "0.53363...
0.66410756
0
Encodes an optional CL value.
def encode_option(value: object, inner_encoder: typing.Callable) -> bytes: return bytes([0] if value is None else [1]) + inner_encoder(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(value: CLValue) -> bytes:\n encoder = ENCODERS[value.cl_type.typeof]\n if value.cl_type.typeof in {CLTypeKey.LIST, CLTypeKey.OPTION}:\n return encoder(\n value.parsed,\n ENCODERS[value.cl_type.inner_type.typeof]\n )\n else:\n return encoder(value.p...
[ "0.6168167", "0.5786296", "0.54665095", "0.5271886", "0.5246005", "0.524191", "0.51339096", "0.5040696", "0.5036797", "0.5033062", "0.50308233", "0.50152975", "0.5006923", "0.49811834", "0.4944364", "0.49320465", "0.48870832", "0.48698303", "0.48523694", "0.48369625", "0.4828...
0.60272175
1
Encodes a public key.
def encode_public_key(value: PublicKey) -> bytes: return bytes([value.algo.value]) + value.pbk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EncodeKey(pub_key: Union[bytes, IPublicKey],\n **kwargs: Any) -> str:\n\n # Get and check address type\n addr_type = kwargs.get(\"addr_type\", XlmAddrTypes.PUB_KEY)\n if not isinstance(addr_type, XlmAddrTypes):\n raise TypeError(\"Address type is not an enumerat...
[ "0.72145057", "0.7166753", "0.70937383", "0.69357204", "0.6894139", "0.6861506", "0.684275", "0.67692053", "0.67617214", "0.6725409", "0.67170835", "0.66794217", "0.6666325", "0.66571397", "0.664715", "0.66453946", "0.66192746", "0.66040796", "0.6546102", "0.6533901", "0.6490...
0.7555448
0
Encodes a smart contract execution result.
def encode_result(value: object) -> bytes: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(self) -> bytes:\n\n encoded_message = struct.pack(Protocol.Formats.RESULT_CODE_FORMAT, self.result_code)\n return encoded_message", "def encode(self) -> bytes:\n\n encoded_message = struct.pack(Protocol.Formats.RESULT_CODE_FORMAT, self.result_code)\n\n if bool(self.submarin...
[ "0.6886777", "0.6598702", "0.6391491", "0.5992211", "0.599114", "0.59867495", "0.59224695", "0.5877584", "0.58653307", "0.58633983", "0.58366793", "0.5707126", "0.5704745", "0.5695898", "0.569588", "0.5669103", "0.5669103", "0.56055176", "0.5596438", "0.5573551", "0.5547962",...
0.7032537
0
Encodes a 1ary tuple of CL values.
def encode_tuple1(value: tuple) -> bytes: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_tuple3(value: tuple) -> bytes:\n raise NotImplementedError()", "def pack_tuple(self, values):\n assert isinstance(values, (tuple, list))\n cardinality = [struct_L.pack(len(values))]\n packed_items = [self.pack_field(v) for v in values]\n return b''.join(itertools.chain(c...
[ "0.7097345", "0.7023418", "0.70021284", "0.6295913", "0.6201391", "0.6159917", "0.60030144", "0.5658093", "0.56551737", "0.56041104", "0.5479833", "0.5403992", "0.5390473", "0.5376036", "0.5360927", "0.53379273", "0.5337733", "0.5335139", "0.530873", "0.52931356", "0.52898747...
0.7145515
0
Encodes a 2ary tuple of CL values.
def encode_tuple2(value: tuple) -> bytes: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_tuple3(value: tuple) -> bytes:\n raise NotImplementedError()", "def encode_tuple1(value: tuple) -> bytes:\n raise NotImplementedError()", "def pack_tuple(self, values):\n assert isinstance(values, (tuple, list))\n cardinality = [struct_L.pack(len(values))]\n packed_items =...
[ "0.707147", "0.68824387", "0.6857989", "0.61617327", "0.6050841", "0.59548855", "0.5824187", "0.5559815", "0.5549884", "0.55418134", "0.53892887", "0.53700185", "0.5322893", "0.5307307", "0.52956504", "0.52765197", "0.52695954", "0.5263347", "0.5243576", "0.52128124", "0.5191...
0.7099712
0
Encodes a 3ary tuple of CL values.
def encode_tuple3(value: tuple) -> bytes: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_tuple2(value: tuple) -> bytes:\n raise NotImplementedError()", "def encode_tuple1(value: tuple) -> bytes:\n raise NotImplementedError()", "def pack_tuple(self, values):\n assert isinstance(values, (tuple, list))\n cardinality = [struct_L.pack(len(values))]\n packed_items =...
[ "0.68168396", "0.6740289", "0.6736029", "0.6158546", "0.59493554", "0.59369487", "0.5933106", "0.5838828", "0.57888925", "0.5727521", "0.5542324", "0.5427391", "0.5330715", "0.530436", "0.52912086", "0.5267602", "0.52468836", "0.5233456", "0.52281296", "0.5215347", "0.5214496...
0.7591188
0
Encodes an unsigned 8 bit integer.
def encode_u8(value: int) -> bytes: return int_to_le_bytes(value, NUMERIC_CONSTRAINTS[CLTypeKey.U8].LENGTH, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Write_uInt8(self,Address,Register,uInt8):\n self.Transaction(chr(Address)+chr(Register)+struct.pack('B',uInt8))", "def write_uint8(self,value):\n packed = struct.pack('!B',value)\n self.data.extend(packed)", "def u8(value: bytes, endian: str = \"little\", sign: bool = False) -> int:\n ...
[ "0.7187489", "0.70266473", "0.6738288", "0.65686345", "0.6503062", "0.6400726", "0.6365142", "0.6359848", "0.6356634", "0.6325308", "0.6324641", "0.6312194", "0.62764937", "0.6194898", "0.60572857", "0.60183847", "0.59737056", "0.59461296", "0.59255874", "0.59180444", "0.5902...
0.75584686
0
Encodes an array of unsigned 8 bit integers.
def encode_u8_array(value: typing.List[int]) -> bytes: return encode_u32(len(value)) + bytes(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tobinary_multiples(arr):\n return [np.array(arr_i).tobytes() for arr_i in arr]", "def encode(input_: list):\n global n_bytes\n block = bytearray()\n\n for tup in input_:\n arr = np.array(tup[0], dtype=tup[1]).tobytes()\n n_bytes += len(arr)\n block += arr\n\n return block"...
[ "0.65309846", "0.65033084", "0.6360074", "0.63495606", "0.6294266", "0.6075444", "0.6024918", "0.6021513", "0.6003583", "0.59500724", "0.5936038", "0.59121746", "0.590354", "0.58818984", "0.5857487", "0.5845867", "0.58439934", "0.5834095", "0.58137614", "0.58137614", "0.57468...
0.75971264
0