text
stringlengths
15
7.82k
ids
listlengths
1
7
def METHOD_NAME(self, s=None, b=None, connection=None, returnCursor=False): """ _executemanybinds_ b is a list of dictionaries for the binds, e.g.: b = [ {'bind1':'value1a', 'bind2': 'value2a'}, {'bind1':'value1b', 'bind2': 'value2b'} ] see: http://www.gingerandjohn.com/arch...
[ -1 ]
async def METHOD_NAME(next_link=None): request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if respon...
[ 19, 243 ]
def METHOD_NAME(self): pass
[ 164, 41, 8869 ]
def METHOD_NAME(tag: Dict[str, Any]) -> bool: return re.match(r"^[0-9]+-[0-9]+-[a-z0-9]+$", tag["name"]) is not None
[ 250, 82 ]
def METHOD_NAME(l): for x in range(l.numberOfMothers()): mom = l.mother(x) if mom.status() > 2: return True id = abs(mom.pdgId()) if id > 1000000: return True if id > 100: return False if id < 6: return False if id == 21: return False if id in [11,12...
[ 137, 130, 280, -1, 13886 ]
def METHOD_NAME(self): """ rx_sync_start_available: Returns a list of possible keys used for rx_sync_start """ try: return self._get_iio_dev_attr_str( "sync_start_enable_available", _ctrl=self._rxadc ) except: # noqa: E722 return "arm"
[ 2068, 164, 447, 1272 ]
def METHOD_NAME(self) -> Sequence[Sequence[str]]: """ The rule baseline result """ return pulumi.get(self, "results")
[ 51 ]
def METHOD_NAME(): # Connecting ClearML with the current process, # from here on everything is logged automatically task = Task.init(project_name='examples', task_name='Remote_execution PyTorch MNIST train') # Training settings parser = argparse.ArgumentParser(description='PyTorch MNIST Example') ...
[ 57 ]
def METHOD_NAME(next_link=None): if not next_link: request = build_list_metrics_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, ...
[ 123, 377 ]
def METHOD_NAME(): # # Technically we don't need to call alias_flavor() here (since it's # already been invoked for this REPO_CFG variable), but we do it # anyway to support `fail-on-flavor-aliasing` testing. Basically, # alias_flavor() will fail() if flavor aliasing is disabled and we # try to ...
[ 19, 3032, 235 ]
def METHOD_NAME(self, a): net = a.network() agent1 = a.replicator(network=net) agent2 = a.replicator(network=net) agent3 = a.replicator(network=net) agent1.connect(direction="to", whom=agent2) agent1.connect(direction="to", whom=agent3) info = a.info(origin=agent1) agent1.transmit(what=m...
[ 9, 1849, 5022, 8211, 24, 13273 ]
def METHOD_NAME(self) -> bytes: """Reads 4 bytes and increases cursor""" if self.cursor + 4 > self.length_input: raise ValueError( "BMA Layer NRL Compressor: Reached EOF while reading data." ) oc = self.cursor self.cursor += 4 return read_bytes(self.uncompressed_data, oc,...
[ 203 ]
def METHOD_NAME(s: str): if s.endswith("."): return FAIL return OK
[ 4812, 688 ]
def METHOD_NAME( db_session: Session, function_calls: List[ContractFunctionCall], blockchain_type: AvailableBlockchainType, label_name=CRAWLER_LABEL, ) -> None: label_model = get_label_model(blockchain_type) transactions_hashes_to_save = [ function_call.transaction_hash for function_call...
[ 238, 559, 1929, 24, 240 ]
def METHOD_NAME(self, data, padding=None, hashAlg=None, saltLen=None): """ :type data: bytearray :param data: The value which will be signed (generally a binary encoding of hash output. :type padding: str :param padding: Ignored, present for API compatibility with RSA :type hashAlg: str ...
[ 2452 ]
def METHOD_NAME(self): self._events.append('startTestRun') super(_BaseLoggingResult, self).METHOD_NAME()
[ 447, 9, 22 ]
def METHOD_NAME(self, input): print("SIGNER state #3") u = self.group.random() s = self.group.random() d = self.group.random() g = input.get('g') y = input.get('y') str = "info" msg = integer(SHA2(str)) z = (msg ** ((p - 1)/q)) % p a = g ** u b = (g **...
[ 3529, 3530 ]
def METHOD_NAME(cls, spec, value): return cls.class_map[spec['type']](spec, value)
[ 280, 1457 ]
def METHOD_NAME(authorization_provider_id: Optional[pulumi.Input[str]] = None, resource_group_name: Optional[pulumi.Input[str]] = None, service_name: Optional[pulumi.Input[str]] = None, opts: Optional[pulum...
[ 19, 1355, 2275, 146 ]
def METHOD_NAME(): """ test to_dict function for ShipDrift object create a new ship_drift object and make sure it has same properties """ new_wind = ShipDriftMover(wind_file, topology_file, grid_type=2) serial = new_wind.serialize() nw2 = ShipDriftMover.deserialize(serial) assert new_win...
[ 9, 183, 2696 ]
def METHOD_NAME(): from litex.build.parser import LiteXArgumentParser parser = LiteXArgumentParser(platform=xilinx_zcu104.Platform, description="LiteX SoC on ZCU104.") parser.add_target_argument("--sys-clk-freq", default=125e6, type=float, help="System clock frequency.") args = parser.parse_args() s...
[ 57 ]
def METHOD_NAME(s: str): level_mapping = StorageLevel.__members__ level_strings = [ss.strip() for ss in s.upper().split("|")] levels = [] for ls in level_strings: if ls not in level_mapping: # pragma: no cover raise ValueError(f"Unknown level {ls}") levels.append(level_mappi...
[ 280, 3 ]
def METHOD_NAME(expr, vx, vy, data, fref): n = len(data) A = te.placeholder((n,), name="A", dtype=expr.dtype) B = te.placeholder((n,), name="B", dtype=expr.dtype) def make_binds(i): x = expr x = tvm.tir.Let(vx, A[i], x) x = tvm.tir.Let(vy, B[i], x) return x C = te.com...
[ 250, 99 ]
def METHOD_NAME(i, cai): for sec in s: sec.cai = cai h.finitialize(-65) while h.t < 15.0: h.fadvance() plt(i)
[ -1 ]
def METHOD_NAME(builder, authid): return HelloNewAddAuthid(builder, authid)
[ 238, 13814 ]
def METHOD_NAME(cls, url, **kwargs): """ Create an :class:`Media` from a URL. :code:`Media.from_url(url)` is equivalent to: .. code-block: python med = Media(value=url, format='url') But both unicode and bytes arguments are allowed for ``url``. Parameters ---------- url: [str, by...
[ 280, 274 ]
def METHOD_NAME(jars_1: List, jars_2: List) -> bool: """ Checks if two lists of jar files contain the same jars. The order of the jars in the list does not matter. Args: jars_1 (List): A list of jar files. jars_2 (List): A list of jar files. Returns: bool: True if the lists c...
[ 1992, 1101, 2692 ]
def METHOD_NAME(self) -> Optional["QObject"]: return self._createViewFromQML()
[ 19, 52, 1024 ]
def METHOD_NAME(string): """Escape all regular expressions special characters from STRING.""" return re.escape(string)
[ 211, 4748 ]
def METHOD_NAME(start, duration): start_time = datetime.datetime.now().replace(hour=start, minute=0) return start_time + datetime.timedelta(hours=duration // 60, minutes=duration % 60)
[ -1, 1798, 104 ]
def METHOD_NAME(fname, dtypes=None): """Read a tsv file into an OrderedDict. Parameters ---------- fname : str Path to the file being loaded. dtypes : list, optional List of types to cast the values loaded as. This is specified column by column. Defaults to None. In t...
[ 280, 2255 ]
def METHOD_NAME(scope, transaction_style, request): # type: (Scope, str, Any) -> None name = "" if transaction_style == "endpoint": endpoint = request.scope.get("endpoint") if endpoint: name = transaction_from_function(endpoint) or "" elif transaction_style == "url": ...
[ 0, 1853, 156, 61, 1458 ]
def METHOD_NAME(self): response = self.client.get(reverse("home")) self.assertRedirects(response, self.project.get_absolute_url())
[ 9, 97, 155, 1231 ]
def METHOD_NAME(self): for record in self: country_code = record.country_id.code or "" if record.cpf and country_code.upper() == "BR": cpf = misc.punctuation_rm(record.cpf) if not cnpj_cpf.validar(cpf): raise ValidationError(_("Invalid CPF!")) return T...
[ 250, 1370 ]
def METHOD_NAME(self): return base64.b64encode(self.serialize()).decode("utf8")
[ 24, 2426 ]
def METHOD_NAME(self): for record in self: self._event("on_record_unlink").notify(record) result = super(Base, self).METHOD_NAME() return result
[ 4384 ]
f METHOD_NAME(self):
[ 9, 756 ]
def METHOD_NAME(StrParI1, StrParI2): IntLoc = 1 while IntLoc <= 1: if Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1: CharLoc = 'A' IntLoc = IntLoc + 1 if CharLoc >= 'W' and CharLoc <= 'Z': IntLoc = 7 if CharLoc == 'X': return TRUE else: ...
[ 7640 ]
def METHOD_NAME(chan0, chan1, phase_correction): assert len(chan0) == len(chan1) (p, s) = measure_phase_and_delay(chan0, chan1) # print("Across Chips Sample delay: ",s) # print("Phase delay: ",p,"(Degrees)") # print(phase_correction) return (sub_phases(phase_correction, [int(p * 1000)] * 4), s)
[ 599, 61, 270, 3200, 1540 ]
def METHOD_NAME(settings, max_blocks_per_call=10000): rpc = BitcoinRPC(settings['host'], settings['port'], settings['rpcuser'], settings['rpcpassword']) height = settings['min_height'] while height < settings['max_height']+1: num_blocks = min(settings['max_height']+1-height, max_blocks_...
[ 19, 573, 2012 ]
def METHOD_NAME() -> dict: parser = ArgumentParser() add_required_arguments(parser) add_optional_arguments(parser) return vars(parser.METHOD_NAME())
[ 214, 335 ]
def METHOD_NAME() -> bool: """ Whether the logging outputs returned by `forward` can be summed across workers prior to calling `reduce_metrics`. Setting this to True will improves distributed training speed. """ return False
[ 663, 141, 1046, 673, 8599 ]
def METHOD_NAME(self, manifest): return manifest.get('config').get("digest").split(":")[1]
[ 19, 660, 200, 171 ]
def METHOD_NAME(self): logger.hr(f'{self.FUNCTION_NAME_BASE}{self.battle_count}', level=2) prev = self.battle_count result = False for _ in range(10): try: result = self.battle_function() break except MapEnemyMoved: if self.battle_count > prev: ...
[ 750, 385, 1505 ]
def METHOD_NAME(self): self._testInsertGlyph(setGlyphName=False)
[ 9, 0, 6634, 41, 156, 98 ]
def METHOD_NAME(gherkin_languages_path, output_file=None, encoding=None, verbose=False): """Workhorse. Performs the conversion from "gherkin-languages.json" to "i18n.py". Writes output to file or console (stdout). :param gherkin_languages_path: File path for JSON f...
[ 16673, 2539, 24, 440, 298 ]
def METHOD_NAME(self) -> None: """Close connection""" self.conn.close()
[ 72, 783 ]
def METHOD_NAME(private_cloud_name: Optional[pulumi.Input[str]] = None, resource_group_name: Optional[pulumi.Input[str]] = None, segment_id: Optional[pulumi.Input[str]] = None, opts: Optional[pulumi.I...
[ 19, 2454, 1228, 4373, 146 ]
def METHOD_NAME(data): input_quantizer = model._bn.input_quantizers[0] if isinstance(input_quantizer, StaticGridTensorQuantizer): return input_quantizer.quantize_dequantize(data, input_quantizer.round_mode) assert isinstance(input_quantizer, LearnedGridTensorQuantizer) encoding = input_quantizer...
[ 1429, 362 ]
def METHOD_NAME(A: dace.float64[10, 5, 3]): return np.mean(A, axis=-2)
[ 9, 314, 2927 ]
def METHOD_NAME(self, func, use_previous_behavior=True, preserves_partitioning=False, **kwargs): if use_previous_behavior is True: LOGGER.warning(f"please use `applyPartitions` instead of `mapPartitions` " f"if the previous behavior was expected. " f"The previou...
[ 422, 1031 ]
def METHOD_NAME(self): info = self.find_indextype(self.SPEC_HEADER) _, _, offset, length = self.sections()[info] with open(self.filename, 'rb') as f: f.seek(offset) dataType, numPoints, xUnits, yUnits, firstX, lastX, noise = \ struct.unpack('<iiiifff', f.read(28)) return ...
[ 203, 1457, 572 ]
def METHOD_NAME(self: SharedUtils) -> list: return range_expand(default(get(self.switch_data_combined, "mlag_interfaces"), get(self.default_interfaces, "mlag_interfaces"), []))
[ 13016, 703 ]
def METHOD_NAME(self): file = open("example.glsl") shader_sourcecode = file.read() size = self.width, self.height self.shadertoy = Shadertoy(size, shader_sourcecode) self.channel0 = self.shadertoy.ctx.framebuffer( color_attachments=[self.shadertoy.ctx.texture(size, components=4)] ) s...
[ 557, 1871 ]
def METHOD_NAME(cls, token): """Get the AccessRequestToken referenced by the specified token.""" return cls.query.filter_by(token=token).one_or_none()
[ 19, 604, 466 ]
def METHOD_NAME(*args, **kwargs): func_to_call = get_func_to_call() logger.info("running %s()...", func.__name__) try: test_map[func.__name__] = dict() test_map[func.__name__]["result"] = SUCCESSED test_map[func.__name__]["error_message"] = "" test_map[func.__name__]["error_s...
[ 291 ]
def METHOD_NAME(parameters_string): parameters = [] for parameter_string in split_parameters_string(parameters_string): match = re.search(r'\s*(?:\[(?P<attributes>.*?)\]\s+)?(?P<type_and_name>.*)', parameter_string) attributes_string, type_and_name_string = match.group('attributes', 'type_and_na...
[ 214, 386, 144 ]
def METHOD_NAME( self, connection, engine, Base, User ): create_view( name='trivial_view', selectable=sa.select(*_select_args(User.id)), metadata=Base.metadata, ) Base.metadata.create_all(engine) view = CreateView( name='trivial_view', selectab...
[ 9, 1717, 3351, 369, 1153 ]
def METHOD_NAME(self) -> int: return self.y
[ 1635 ]
def METHOD_NAME(self): return self.get("/installation/repositories")
[ 19, 2223 ]
def METHOD_NAME(self, node): """ Swap out Python's AnnAssign with an Assign node where the annotation function is called. Example: Original: y: Tensor_Type(1,2,3, Dyn) = f2(x) Output: y = annotate(f2(x),Tensor_Type((1,2,3,Dyn))) """ return ast.Assign(targets=[node....
[ 716, 5165, 1283 ]
def METHOD_NAME(self) -> Optional[str]: """ The user that created the API key. """ return pulumi.get(self, "created_by")
[ 152, 604 ]
def METHOD_NAME(self): """ Get the description (shown below the title). Defaults to ``None``, which means that no description is rendered. """ return None
[ 19, 1067 ]
def METHOD_NAME(self): metric = WordMetric(mode='ignore_case_symbol') metric.process(None, self.pred) eval_res = metric.evaluate(size=3) self.assertEqual(eval_res['recog/word_acc_ignore_case_symbol'], 1.0)
[ 9, 2236, 7774, 684, 331, 1608, 1341 ]
def METHOD_NAME(): summary_modified_field = '_current_version__autoapprovalsummary__modified' # We don't take deleted reports into account valid_abuse_report_states = ( AbuseReport.STATES.UNTRIAGED, AbuseReport.STATES.VALID, AbuseReport.STATES.SUSPICIOUS, ) recent_abuse_repor...
[ 19, 9425, 2002, 469 ]
def METHOD_NAME(self, mock_echo): result = self.run_command( ["remote-build", "--launchpad-accept-public-upload", "--recover"] ) self.assertThat(result.exit_code, Equals(0)) self.mock_lc_init.assert_called_once_with( project=mock.ANY, architectures=mock.ANY, deadline=mock...
[ 9, 2437, 56, 2986, 1916, 4551, 1161 ]
def METHOD_NAME(): git_version = subprocess.Popen( ["git", "--version"], shell=False, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ).communicate()[0] if not git_version: log.error("Git not installed") return False log.debug("Dete...
[ 1493, 281 ]
def METHOD_NAME(self, new_values, profile_name): # The access_key/secret_key are now *always* written to the shared # credentials file (~/.aws/credentials), see aws/aws-cli#847. # post-conditions: ~/.aws/credentials will have the updated credential # file values and new_values will have the cred vars re...
[ 77, 1737, 6471, 171, 199 ]
def METHOD_NAME(domain: str, message: str) -> str: ...
[ -1 ]
def METHOD_NAME(self, id_): # See the comment for RadioSelect.id_for_label() if id_: id_ += "_0" return id_
[ 147, 43, 636 ]
def METHOD_NAME(ws_app: WebSocketApp, msg: str): # We strongly trust that the contract on API will hold atm :D event_dict = json.loads(msg) labels = _LogEventLabels(**event_dict.get("labels", {})) if "message" in event_dict: message = event_dict["message"] timestamp = dateutil.parser.iso...
[ 1076 ]
def METHOD_NAME(self, schema): query = "SELECT database, table, name FROM system.columns WHERE database NOT IN ('system')" results, error = self.run_query(query, None) if error is not None: self._handle_run_query_error(error) results = json_loads(results) for row in results["rows"]: ...
[ 19, 2253 ]
def METHOD_NAME(self): self.run_test(ntime=1024, nchan=32, max_delay=1, batch_shape=(7,9,5))
[ 9, 9835, -1, -1, 14803, 1136, 822 ]
def METHOD_NAME(self, temperature): """ Sets the low threshold temperature of thermal Args : temperature: A float number up to nearest thousandth of one degree Celsius, e.g. 30.125 Returns: A boolean, True if threshold is set successfully, False if not """ raise NotImplem...
[ 0, 3420, 853 ]
def METHOD_NAME(self) -> str: """ The name of the resource """ return pulumi.get(self, "name")
[ 156 ]
def METHOD_NAME(): """Returns a platform-specific root directory for user config settings.""" # On Windows, prefer %LOCALAPPDATA%, then %APPDATA%, since we can expect the # AppData directories to be ACLed to be visible only to the user and admin # users (https://stackoverflow.com/a/7617601/1179226). If ...
[ 19, 21, 200, 2851 ]
def METHOD_NAME(): models = [] models.extend( [ VertaModelNoImpl, VertaModelOnlyInit, VertaModelOnlyPredict, ] ) return models
[ 6600, 10884, 379 ]
def METHOD_NAME(self): return QueryVersion(display=self.display, opcode=self.display.get_extension_major(extname), major_version=1, minor_version=1)
[ 539, 281 ]
def METHOD_NAME(): '''Test that an instance of MetaRefElementArgMetadata can be created successfully. Also check the input value with mixed case. ''' ref_element_arg = MetaRefElementArgMetadata("Normals_To_Faces") assert isinstance(ref_element_arg, MetaRefElementArgMetadata) assert ref_element_a...
[ 9, 129 ]
def METHOD_NAME(self): self.assertEqual(utils.format_datetime(self.naive_dt), self.datestring + ' -0000')
[ 9, 4806, 884 ]
def METHOD_NAME(self): return self.client.format_url( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity", **self.url_parameters )
[ 274 ]
def METHOD_NAME(source_dir: Path) -> Path: setup_py = source_dir / "setup.py" setup_py.write_text( "from setuptools import setup; " 'setup(name="demo", ' 'version="0.1.0", ' 'install_requires=["package"])' ) return source_dir
[ 2660, 102 ]
def METHOD_NAME(self) -> None: asset_name = "wiki.en.vec" asset_path = get_asset_path(asset_name) with tempfile.TemporaryDirectory() as dir_name: data_path = os.path.join(dir_name, asset_name) shutil.copy(asset_path, data_path) vector_transform = VectorTransform(FastText(root=dir_nam...
[ 9, 798, 1053 ]
def METHOD_NAME() -> None: ...
[ 7100 ]
f METHOD_NAME(self):
[ 19, 53, 1173, 578 ]
f METHOD_NAME(self):
[ 9, 4360, 1922, 651 ]
def METHOD_NAME(agent_plugin_service, flask_client, error): agent_plugin_service.install_plugin_archive = MagicMock(side_effect=error) resp = flask_client.put( get_url_for_resource(InstallAgentPlugin), data=AGENT_PLUGIN, follow_redirects=True, ) assert resp.status_code == HTTPSta...
[ 9, 428, 2793, 808, 2026, 163, 168 ]
def METHOD_NAME(db, info): FakeModel = get_fake_model(model_base=models.UUIDModel) class Serializer(serializers.ModelSerializer): class Meta: model = FakeModel fields = "__all__" class CustomMutation1(Mutation): class Meta: serializer_class = Serializer ...
[ 9, 343, 437, 5580, 4263 ]
def METHOD_NAME(self): """Sequence: ensure ability to assign a Dataset to a Sequence item""" ds = Dataset() ds.add_new((1, 1), "IS", 1) # Create a single element Sequence first seq = Sequence( [ Dataset(), ] ) seq[0] = ds assert ds == seq[0]
[ 9, 1205, 776 ]
def METHOD_NAME( df: Union[str, pd.Series, dd.Series, pd.DataFrame, dd.DataFrame], column: str = "", ) -> Union[bool, pd.Series, pd.DataFrame]: """ Validate if a data cell is CPJ in a DataFrame column. For each cell, return True or False. Parameters ---------- df A pandas or Dask...
[ 187, 3630, -1 ]
def METHOD_NAME(x, is_training): # Reduce hw by avg and max # Return cat([avg_pool_0, avg_pool_1, ..., max_pool_0, max_pool_1, ...]) if not isinstance(x, (list, tuple)): return avg_max_reduce_hw_helper(x, is_training) elif len(x) == 1: return avg_max_reduce_hw_helper(x[0], is_training) ...
[ 1654, 232, 332, 3354 ]
def METHOD_NAME(sents, args): g2p = G2p() out_sents = [] res_wrds = load_reserve_word(args.reserve_word) for sent in sents: col1 = "" if args.reserve_first_column: col1, sent = sent.split(None, 1) sent = process_sent(sent, g2p, res_wrds, args) if args.reserve_...
[ 356, 8138 ]
def METHOD_NAME(self): if isinstance(self._monitor_address, tuple): moncdev = "socket,id=mon,host=%s,port=%s" % ( self._monitor_address[0], self._monitor_address[1]) else: moncdev = 'socket,id=mon,path=%s' % self._monitor_address return ['-chardev', moncdev, ...
[ 414, 335 ]
def METHOD_NAME(self, agent: AgentID) -> ObsType | None: if not self._has_reset: EnvLogger.error_observe_before_reset() return super().METHOD_NAME(agent)
[ 6427 ]
def METHOD_NAME(self) -> Optional[List[ParameterBuilder]]: return self._validation_parameter_builders
[ 437, 511, 8881 ]
def METHOD_NAME( monitor: zmq.asyncio.Socket, loop: asyncio.BaseEventLoop ) -> None: """A thread that prints events This is a convenience method. It could serve as an example for your code of a monitor, For example if you don't need the prints, then copy paste this part of code to your code and modify i...
[ 417, 1863, 600, 958 ]
def METHOD_NAME(fn, rate: float, deterministic: bool = False): def attn_fn(scope: Scope, weights: Array): attn_weights = fn(scope, weights) return nn.dropout( scope, attn_weights, deterministic=deterministic, rate=rate ) return attn_fn
[ 41, 3663 ]
def METHOD_NAME(self): self.assertMarkdownRenders( """![Text](http://link.com/".png'title') more text""", """<p><img alt="Text" src="http://link.com/&quot;.png" title="title" /> more text</p>""" )
[ 9, 1474, 2893, -1 ]
def METHOD_NAME(self): pass
[ 447 ]
def METHOD_NAME(self) -> None: """Close and reopen our log file, if supported. This should be overridden where needed.""" return # pragma: no cover
[ 18233 ]