file stringlengths 8 116 | function stringlengths 2 72 | version_data listlengths 2 2 | diff_code stringlengths 87 17.4k | diff_docstring stringlengths 31 12k | whitespace_only_code bool 1
class | whitespace_only_docstring bool 1
class | file_path stringlengths 9 116 | filename stringlengths 5 52 | project stringclasses 100
values | owner stringclasses 96
values |
|---|---|---|---|---|---|---|---|---|---|---|
theano_gof_cmodule.py | dlimport | [
{
"version": "v7",
"docstring_lines": {
"start_line": 127,
"end_line": 137
},
"code_lines": {
"start_line": 137,
"end_line": 166
},
"commit_date_time": "2009-07-20 15:20:23",
"commit_sha": "120b1ee90424c52d7a4e4e93782380b5698217bc",
"commit_message": "added so... | def dlimport(fullpath, suffix=None):
if suffix is None:
if fullpath.endswith('.so'):
suffix = '.so'
+ elif fullpath.endswith('.pyd'):
+ suffix = '.pyd'
elif fullpath.endswith('.dll'):
suffix = '.dll'
elif fullpath.end... | - Dynamically load a .so, .dll, or .py file
+ Dynamically load a .so, .pyd, .dll, or .py file
? ++++++
:type fullpath: string
:param fullpath: a fully-qualified path do a compiled python module
:param suffix: a suffix to strip from the end of fullpath to get the import name
... | false | false | theano/gof/cmodule.py | cmodule.py | Theano | Theano |
theano_gof_cmodule.py | ModuleCache.refresh | [
{
"version": "v17",
"docstring_lines": {
"start_line": 260,
"end_line": 268
},
"code_lines": {
"start_line": 268,
"end_line": 331
},
"commit_date_time": "2009-08-26 17:41:42",
"commit_sha": "dbd50c91ff998f8f925af9ec3119ca24cb100047",
"commit_message": "Fix err... | def refresh(self):
compilelock.get_lock()
try:
# add entries that are not in the entry_from_key dictionary
for root, dirs, files in os.walk(self.dirname):
if os.path.join(root, 'key.pkl') in self.loaded_key_pkl:
... | Update self.entry_from_key by walking the cache directory structure.
Add entries that are not in the entry_from_key dictionary.
Remove entries which have been removed from the filesystem.
-
- Also, remove malformed cache directories. | false | false | theano/gof/cmodule.py | cmodule.py | Theano | Theano |
theano_gof_cmodule.py | ModuleCache.clear | [
{
"version": "v107",
"docstring_lines": {
"start_line": 948,
"end_line": 961
},
"code_lines": {
"start_line": 961,
"end_line": 971
},
"commit_date_time": "2011-06-13 17:16:30",
"commit_sha": "7fcd8fe7d2414a3b736e921b026fdfabaccfb028",
"commit_message": "Avoid ... | def clear(self, unversioned_min_age=None, clear_base_files=False,
- delete_if_unpickle_failure=False):
? -- ^^^ ^^^^^^^^
+ delete_if_problem=False):
? ^^^ ^
compilelock.get_lock()
try:... | Clear all elements in the cache.
:param unversioned_min_age: Forwarded to `clear_unversioned`. In
particular, you can set it to -1 in order to delete all unversioned
cached modules regardless of their age.
:param clear_base_files: If True, then delete base directories
... | false | false | theano/gof/cmodule.py | cmodule.py | Theano | Theano |
theano_gof_cmodule.py | ModuleCache.clear_base_files | [
{
"version": "v395",
"docstring_lines": {
"start_line": 1342,
"end_line": 1352
},
"code_lines": {
"start_line": 1352,
"end_line": 1370
},
"commit_date_time": "2017-03-27 06:31:59",
"commit_sha": "361840759dc396537d70f99c45c54cd3333af336",
"commit_message": "Op... | def clear_base_files(self):
with compilelock.lock_ctx():
- for base_dir in ('cuda_ndarray', 'cutils_ext', 'lazylinker_ext',
? ----------------
+ for base_dir in ('cutils_ext', 'lazylinker_ext', 'scan_perform'):
? ... | - Remove base directories 'cuda_ndarray', 'cutils_ext', 'lazylinker_ext'
? ----------------
+ Remove base directories 'cutils_ext', 'lazylinker_ext' and
? ++++
- and 'scan_perform' if present.
? ----
+ 'scan_perform' ... | false | false | theano/gof/cmodule.py | cmodule.py | Theano | Theano |
theano_gof_cmodule.py | ModuleCache.clear_old | [
{
"version": "v348",
"docstring_lines": {
"start_line": 1383,
"end_line": 1396
},
"code_lines": {
"start_line": 1396,
"end_line": 1481
},
"commit_date_time": "2016-01-05 19:33:43",
"commit_sha": "b47debfb6bc2afa3c376af4f692cb4584021d29b",
"commit_message": "pe... | def clear_old(self, age_thresh_del=None, delete_if_problem=False):
-
if age_thresh_del is None:
age_thresh_del = self.age_thresh_del
# Ensure that the too_old_to_use list return by refresh() will
# contain all modules older than age_thre... | Delete entries from the filesystem for cache entries that are too old.
+
+ This refreshes the content of the cache. Don't hold the lock
+ while calling this method, this is useless. It will be taken
+ if needed.
Parameters
----------
age_thresh_del
... | false | false | theano/gof/cmodule.py | cmodule.py | Theano | Theano |
theano_gof_cmodule.py | KeyData.save_pkl | [
{
"version": "v86",
"docstring_lines": {
"start_line": 754,
"end_line": 757
},
"code_lines": {
"start_line": 757,
"end_line": 763
},
"commit_date_time": "2011-05-30 13:38:47",
"commit_sha": "226b50c99e7d8273bcfeca379393b76a75758db4",
"commit_message": "Added v... | def save_pkl(self):
+
+
+ # Note that writing in binary mode is important under Windows.
+ try:
- cPickle.dump(self, open(self.key_pkl, 'wb'),
+ cPickle.dump(self, open(self.key_pkl, 'wb'),
? ++++
- protocol=cPickle.HIGHEST_PROTOCO... | Dump this object into its `key_pkl` file.
+
+ May raise a cPickle.PicklingError if such an exception is raised at
+ pickle time (in which case a warning is also displayed). | false | false | theano/gof/cmodule.py | cmodule.py | Theano | Theano |
theano_gof_cmodule.py | KeyData.add_key | [
{
"version": "v99",
"docstring_lines": {
"start_line": 275,
"end_line": 277
},
"code_lines": {
"start_line": 277,
"end_line": 280
},
"commit_date_time": "2011-06-12 03:12:28",
"commit_sha": "b189e459a200c28481863eee99722be75c501838",
"commit_message": "Try to ... | - def add_key(self, key):
+ def add_key(self, key, save_pkl=True):
? +++++++++++++++
assert key not in self.keys
self.keys.add(key)
+ if save_pkl:
- self.save_pkl()
+ self.save_pkl()
? ++++
| - Add a key to the `keys` set, and update the pickled file.
? ----
+ Add a key to the `keys` set, and update pickled file if asked to.
? ++++++++++++
| false | false | theano/gof/cmodule.py | cmodule.py | Theano | Theano |
theano_gof_cmodule.py | is_same_entry | [
{
"version": "v127",
"docstring_lines": {
"start_line": 222,
"end_line": 230
},
"code_lines": {
"start_line": 230,
"end_line": 241
},
"commit_date_time": "2011-06-28 20:57:20",
"commit_sha": "090ca5526023fe4f9fae7675aecdb1c5c4b59e05",
"commit_message": "extrac... | def is_same_entry(entry_1, entry_2):
if entry_1 == entry_2:
return True
if os.path.realpath(entry_1) == os.path.realpath(entry_2):
return True
if (os.path.basename(entry_1) == os.path.basename(entry_2) and
(os.path.basename(os.path.dirname(entry_1))... | Return True iff both paths can be considered to point to the same module.
This is the case if and only if at least one of these conditions holds:
- They are equal.
- - There real paths are equal.
? -
+ - Their real paths are equal.
? +
- They s... | false | false | theano/gof/cmodule.py | cmodule.py | Theano | Theano |
theano_gof_cmodule.py | gcc_llvm | [
{
"version": "v219",
"docstring_lines": {
"start_line": 1454,
"end_line": 1458
},
"code_lines": {
"start_line": 1458,
"end_line": 1480
},
"commit_date_time": "2013-03-16 22:56:28",
"commit_sha": "277c6755e46806a61599e95e477c343d0a190066",
"commit_message": "Ty... | def gcc_llvm():
if gcc_llvm.is_llvm is None:
- pass
p = None
try:
p = call_subprocess_Popen(['g++', '--version'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
... | Detect if the g++ version used is the llvm one or not.
- It don't support all g++ parameters even if it support many of them.
? ^
+ It does not support all g++ parameters even if it supports many of them.
? +++ ^ +
| false | false | theano/gof/cmodule.py | cmodule.py | Theano | Theano |
sanic_blueprint_group.py | BlueprintGroup.blueprints | [
{
"version": "v6",
"docstring_lines": {
"start_line": 86,
"end_line": 90
},
"code_lines": {
"start_line": 90,
"end_line": 91
},
"commit_date_time": "2021-01-27 08:25:05",
"commit_sha": "dadf76ce727441f2f42c5bfa5d5f7a046e70d7b9",
"commit_message": "Move logic i... | - def blueprints(self):
+ def blueprints(self) -> List["sanic.Blueprint"]:
return self._blueprints | Retrieve a list of all the available blueprints under this group.
+
:return: List of Blueprint instance | false | false | sanic/blueprint_group.py | blueprint_group.py | sanic | sanic-org |
python_ccxt_okcoin.py | okcoin.cancel_order | [
{
"version": "v241",
"docstring_lines": {
"start_line": 1513,
"end_line": 1523
},
"code_lines": {
"start_line": 1523,
"end_line": 1582
},
"commit_date_time": "2023-11-16 12:46:12",
"commit_sha": "8d2f99100013351c73cf0629d66e28e7a2e45c0a",
"commit_message": "Me... | def cancel_order(self, id: str, symbol: Str = None, params={}):
- self.check_required_symbol('cancelOrder', symbol)
+ if symbol is None:
+ raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
self.load_markets()
... | :see: https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-order
:see: https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-algo-order
:see: https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-advance-algo-order
cancels an open order
:param str id: order id
... | false | false | python/ccxt/okcoin.py | okcoin.py | ccxt | ccxt |
research_object_detection_builders_post_processing_builder.py | _build_score_converter | [
{
"version": "v2",
"docstring_lines": {
"start_line": 91,
"end_line": 105
},
"code_lines": {
"start_line": 105,
"end_line": 112
},
"commit_date_time": "2017-09-21 19:58:20",
"commit_sha": "f87a58cd96d45de73c9a8330a06b2ab56749a7fa",
"commit_message": "Move the ... | - def _build_score_converter(score_converter_config):
+ def _build_score_converter(score_converter_config, logit_scale):
? +++++++++++++
if score_converter_config == post_processing_pb2.PostProcessing.IDENTITY:
- return tf.identity
+ return _score_... | Builds score converter based on the config.
Builds one of [tf.identity, tf.sigmoid, tf.softmax] score converters based on
the config.
Args:
score_converter_config: post_processing_pb2.PostProcessing.score_converter.
+ logit_scale: temperature to use for SOFTMAX score_converter.
Retu... | false | false | research/object_detection/builders/post_processing_builder.py | post_processing_builder.py | models | tensorflow |
libs_langchain_langchain_evaluation_comparison_eval_chain.py | LabeledPairwiseStringEvalChain.from_llm | [
{
"version": "v10",
"docstring_lines": {
"start_line": 328,
"end_line": 342
},
"code_lines": {
"start_line": 342,
"end_line": 350
},
"commit_date_time": "2023-07-26 08:53:22",
"commit_sha": "adf019724f095b1835040f4dd8c1ff0026cbc729",
"commit_message": "unpack ... | def from_llm(
cls,
llm: BaseLanguageModel,
*,
prompt: Optional[PromptTemplate] = None,
+ criteria: Optional[Union[CRITERIA_TYPE, str]] = None,
**kwargs: Any,
) -> PairwiseStringEvalChain:
# noqa: E501
- expected_input_va... | Initialize the LabeledPairwiseStringEvalChain from an LLM.
Args:
llm (BaseLanguageModel): The LLM to use.
prompt (PromptTemplate, optional): The prompt to use.
+ criteria (Union[CRITERIA_TYPE, str], optional): The criteria to use.
**kwargs (Any): Addi... | false | false | libs/langchain/langchain/evaluation/comparison/eval_chain.py | eval_chain.py | langchain | langchain-ai |
libs_langchain_langchain_evaluation_comparison_eval_chain.py | PairwiseStringResultOutputParser.parse | [
{
"version": "v11",
"docstring_lines": {
"start_line": 95,
"end_line": 101
},
"code_lines": {
"start_line": 101,
"end_line": 102
},
"commit_date_time": "2023-07-27 01:46:54",
"commit_sha": "9eb7e6e27f04e4f84d5d62494415afe783a45245",
"commit_message": "Delete O... | - def parse(self, text: str) -> Any:
+ def parse(self, text: str) -> Dict[str, Any]:
? ++++++++++ +
parsed = text.strip().rsplit("\n", maxsplit=1)
if len(parsed) == 1:
reasoning = ""
verdict = parsed[0]
e... | Parse the output text.
Args:
text (str): The output text to parse.
Returns:
- Any: The parsed output.
? ^^^
+ Dict: The parsed output.
? ^^^^
Raises:
ValueError: If the verdict is invalid. | false | false | libs/langchain/langchain/evaluation/comparison/eval_chain.py | eval_chain.py | langchain | langchain-ai |
luigi_tools_range.py | _get_filesystems_and_globs | [
{
"version": "v23",
"docstring_lines": {
"start_line": 435,
"end_line": 448
},
"code_lines": {
"start_line": 448,
"end_line": 462
},
"commit_date_time": "2015-02-16 15:59:39",
"commit_sha": "bf53e4c56bbe47730332dd2ecbdcb108db6502c5",
"commit_message": "Embed s... | - def _get_filesystems_and_globs(task_cls):
+ def _get_filesystems_and_globs(datetime_to_task, datetime_to_re):
- # probe some scattered datehours unlikely to all occur in paths, other than by being sincere datehour parameter's representations
? ^^^^ ... | - Yields a (filesystem, glob) tuple per every output location of task_cls.
? ----
+ Yields a (filesystem, glob) tuple per every output location of task.
- task_cls can have one or several FileSystemTarget outputs.
? ----
+ The task ... | false | false | luigi/tools/range.py | range.py | luigi | spotify |
readthedocs_vcs_support_backends_bzr.py | Backend.parse_tags | [
{
"version": "v21",
"docstring_lines": {
"start_line": 53,
"end_line": 61
},
"code_lines": {
"start_line": 61,
"end_line": 68
},
"commit_date_time": "2013-09-25 10:55:53",
"commit_sha": "c145a541de76aa77820bc69a1571986ba9cff65c",
"commit_message": "Fix bzr tag... | def parse_tags(self, data):
# parse the lines into a list of tuples (commit-hash, tag ref name)
squashed_data = re.sub(r' +', ' ', data)
raw_tags = csv.reader(StringIO(squashed_data), delimiter=' ')
vcs_tags = []
- for name, commit in ra... | - Parses output of show-ref --tags, eg:
? ^^^^^ ^^^^^
+ Parses output of bzr tags, eg:
? ^^ ^
0.1.0 171
0.1.1 173
0.1.2 174
0.2.0-pre-alpha 177
+
+ Can't forget about... | false | false | readthedocs/vcs_support/backends/bzr.py | bzr.py | readthedocs.org | readthedocs |
redash_handlers_query_results.py | QueryResultListResource.post | [
{
"version": "v50",
"docstring_lines": {
"start_line": 105,
"end_line": 116
},
"code_lines": {
"start_line": 116,
"end_line": 139
},
"commit_date_time": "2018-12-05 08:11:08",
"commit_sha": "d42f0b2d40a2b7686b20d8a8c59a8eb21e87c821",
"commit_message": "Directl... | def post(self):
params = request.get_json(force=True)
- parameter_values = collect_parameters_from_request(request.args)
query = params['query']
max_age = int(params.get('max_age', -1))
query_id = params.get('query_id', 'adhoc')
+ ... | Execute a query (or retrieve recent results).
:qparam string query: The query text to execute
:qparam number query_id: The query object to update with the result (optional)
:qparam number max_age: If query results less than `max_age` seconds old are available,
... | false | false | redash/handlers/query_results.py | query_results.py | redash | getredash |
python_ray_data__internal_lazy_block_list.py | LazyBlockList._submit_task | [
{
"version": "v28",
"docstring_lines": {
"start_line": 561,
"end_line": 561
},
"code_lines": {
"start_line": 562,
"end_line": 591
},
"commit_date_time": "2022-08-12 00:47:13",
"commit_sha": "b1cad0a1121c06cae55aaed32f2b901b2b725521",
"commit_message": "[Datase... | def _submit_task(
self, task_idx: int
+ ) -> Tuple[
- ) -> Tuple[ObjectRef[MaybeBlockPartition], ObjectRef[BlockPartitionMetadata]]:
? ^^^^^^^^^^^ -
+ ObjectRef[MaybeBlockPartition], Union[None, ObjectRef[BlockPartitionMet... | Submit the task with index task_idx.
+
+ NOTE: When dynamic block splitting is enabled, returns
+ Tuple[ObjectRef[ObjectRefGenerator], None] instead of
+ Tuple[ObjectRef[Block], ObjectRef[BlockMetadata]], and the blocks metadata will
+ be fetched as the last element in ObjectRefGenera... | false | false | python/ray/data/_internal/lazy_block_list.py | lazy_block_list.py | ray | ray-project |
python_ray_data__internal_lazy_block_list.py | LazyBlockList.__init__ | [
{
"version": "v45",
"docstring_lines": {
"start_line": 45,
"end_line": 64
},
"code_lines": {
"start_line": 64,
"end_line": 106
},
"commit_date_time": "2023-12-21 20:55:39",
"commit_sha": "124cba6cfb5b883eb6dd482e1e67f2eec4ddd9ee",
"commit_message": "[data] ref... | def __init__(
self,
tasks: List[ReadTask],
- read_stage_name: Optional[str] = None,
? ^^^^^
+ read_op_name: Optional[str] = None,
? ^^
block_partition_refs: Optional[List[ObjectRef[MaybeBlockPartition]]] = None,
block_partition_meta_r... | Create a LazyBlockList on the provided read tasks.
Args:
tasks: The read tasks that will produce the blocks of this lazy block list.
- read_stage_name: An optional name for the read stage, derived from the
? ^^^^^ ^ ^^^
+ ... | false | false | python/ray/data/_internal/lazy_block_list.py | lazy_block_list.py | ray | ray-project |
python_ray_data__internal_lazy_block_list.py | LazyBlockList.stats | [
{
"version": "v38",
"docstring_lines": {
"start_line": 122,
"end_line": 124
},
"code_lines": {
"start_line": 124,
"end_line": 143
},
"commit_date_time": "2023-04-14 19:13:52",
"commit_sha": "6d69d79cfef1741dc11b0d9662ed120a90dd99a4",
"commit_message": "[data] ... | - def stats(self) -> DatastreamStats:
? ----
+ def stats(self) -> DatasetStats:
? +
- return DatastreamStats(
? ----
+ return DatasetStats(
? +
- # Make a copy of metadata, as the Datastr... | - Create DatastreamStats for this LazyBlockList.
? ----
+ Create DatasetStats for this LazyBlockList.
? +
| false | false | python/ray/data/_internal/lazy_block_list.py | lazy_block_list.py | ray | ray-project |
lib_training_cache.py | _Cache.pre_fill | [
{
"version": "v6",
"docstring_lines": {
"start_line": 274,
"end_line": 284
},
"code_lines": {
"start_line": 284,
"end_line": 299
},
"commit_date_time": "2024-04-03 13:37:48",
"commit_sha": "983901466fe8d77e4910d2392ea1f545aeef5dcf",
"commit_message": "linting:... | def pre_fill(self, filenames: list[str], side: T.Literal["a", "b"]) -> None:
with self._lock:
for filename, meta in tqdm(read_image_meta_batch(filenames),
desc=f"WTL: Caching Landmarks ({side.upper()})",
... | When warp to landmarks is enabled, the cache must be pre-filled, as each side needs
access to the other side's alignments.
Parameters
----------
filenames: list
The list of full paths to the images to load the metadata from
side: str
`"a... | false | false | lib/training/cache.py | cache.py | faceswap | deepfakes |
src_lightning_pytorch_core_datamodule.py | LightningDataModule.load_from_checkpoint | [
{
"version": "v80",
"docstring_lines": {
"start_line": 168,
"end_line": 225
},
"code_lines": {
"start_line": 225,
"end_line": 234
},
"commit_date_time": "2023-08-09 14:44:20",
"commit_sha": "efa7b2f9efd8d268a463b73e5d9154a6c5ab4831",
"commit_message": "docform... | def load_from_checkpoint(
cls,
checkpoint_path: Union[_PATH, IO],
map_location: _MAP_LOCATION_TYPE = None,
hparams_file: Optional[_PATH] = None,
**kwargs: Any,
) -> Self:
loaded = _load_from_checkpoint(
- cls,
+ ... | r"""
Primary way of loading a datamodule from a checkpoint. When Lightning saves a checkpoint
it stores the arguments passed to ``__init__`` in the checkpoint under ``"datamodule_hyper_parameters"``.
Any arguments specified through \*\*kwargs will override args stored in ``"datamodul... | false | false | src/lightning/pytorch/core/datamodule.py | datamodule.py | pytorch-lightning | Lightning-AI |
lib_logger.py | _stream_handler | [
{
"version": "v24",
"docstring_lines": {
"start_line": 212,
"end_line": 230
},
"code_lines": {
"start_line": 230,
"end_line": 244
},
"commit_date_time": "2022-05-29 12:13:45",
"commit_sha": "afec52309326304f4323029039e49bfcf928ef43",
"commit_message": "Bugfixe... | - def _stream_handler(loglevel, is_gui):
+ def _stream_handler(loglevel: int, is_gui: bool) -> Union[logging.StreamHandler, TqdmHandler]:
# Don't set stdout to lower than verbose
loglevel = max(loglevel, 15)
log_format = FaceswapFormatter("%(asctime)s %(levelname)-8s %(message)s",
... | Add a stream handler for the current Faceswap session. The stream handler will only ever
output at a maximum of VERBOSE level to avoid spamming the console.
Parameters
----------
- loglevel: str
? ^ -
+ loglevel: int
? ^^
The requested log level tha... | false | false | lib/logger.py | logger.py | faceswap | deepfakes |
lib_logger.py | _crash_handler | [
{
"version": "v21",
"docstring_lines": {
"start_line": 274,
"end_line": 287
},
"code_lines": {
"start_line": 287,
"end_line": 292
},
"commit_date_time": "2020-12-08 01:31:56",
"commit_sha": "05018f6119b4f90b91d18203e6bcd39868b0b662",
"commit_message": "Extract... | def _crash_handler(log_format):
- log_crash = logging.StreamHandler(_debug_buffer)
? ^^^^^ ^^^^^^
+ log_crash = logging.StreamHandler(_DEBUG_BUFFER)
? ^^^^^ ^^^^^^
log_crash.setFormatter(log_format)
log_... | - Add a handler that stores the last 100 debug lines to :attr:'_debug_buffer' for use in
? ^^^^^ ^^^^^^
+ Add a handler that stores the last 100 debug lines to :attr:'_DEBUG_BUFFER' for use in
? ... | false | false | lib/logger.py | logger.py | faceswap | deepfakes |
lib_logger.py | FaceswapFormatter._rewrite_warnings | [
{
"version": "v23",
"docstring_lines": {
"start_line": 105,
"end_line": 113
},
"code_lines": {
"start_line": 113,
"end_line": 128
},
"commit_date_time": "2021-03-10 14:36:49",
"commit_sha": "daac5dff3136d0be25a1c7f86dec742edff79020",
"commit_message": "Bugfix ... | def _rewrite_warnings(cls, record):
+
if record.levelno == 30 and record.funcName == "warn" and record.module == "ag_logging":
# TF 2.3 in Conda is imported with the wrong gast(0.4 when 0.3.3 should be used). This
# causes warnings in autograph. They don't... | Change certain warning messages from WARNING to DEBUG to avoid passing non-important
information to output.
Parameters
----------
record: :class:`logging.LogRecord`
The log record to check for rewriting
+
+ Returns
+ -------
+ :class:`l... | false | false | lib/logger.py | logger.py | faceswap | deepfakes |
tests_gis_tests_test_geoforms.py | GeometryFieldTest.test_to_python | [
{
"version": "v52",
"docstring_lines": {
"start_line": 71,
"end_line": 75
},
"code_lines": {
"start_line": 75,
"end_line": 85
},
"commit_date_time": "2018-05-07 13:34:00",
"commit_sha": "607970f31cc07c317f2ebb684c8f3ccc36a95b3e",
"commit_message": "Replaced dj... | def test_to_python(self):
+ good_inputs = [
+ 'POINT(5 23)',
+ 'MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))',
+ 'LINESTRING(0 0, 1 1)',
+ ]
+ bad_inputs = [
+ 'POINT(5)',
+ 'MULTI POLYGON(((0 0, 0 1, 1... | - Testing to_python returns a correct GEOSGeometry object or
? --------
+ to_python() either returns a correct GEOSGeometry object or
? +++++++++
- a ValidationError
+ a ValidationError.
? +
| false | false | tests/gis_tests/test_geoforms.py | test_geoforms.py | django | django |
rllib_env_wrappers_atari_wrappers.py | wrap_deepmind | [
{
"version": "v15",
"docstring_lines": {
"start_line": 292,
"end_line": 300
},
"code_lines": {
"start_line": 300,
"end_line": 319
},
"commit_date_time": "2021-07-22 02:24:18",
"commit_sha": "05c9dfbbda575e92273121e1a62aec8b1d122624",
"commit_message": "[RLlib]... | + def wrap_deepmind(env, dim=84, framestack=True):
- def wrap_deepmind(
- env,
- dim=84,
- # TODO: (sven) Remove once traj. view is norm.
- framestack=True,
- framestack_via_traj_view_api=False):
env = MonitorEnv(env)
env = NoopResetEnv(env, noop_max=30)... | Configure environment for DeepMind-style Atari.
Note that we assume reward clipping is done outside the wrapper.
Args:
+ env (EnvType): The env object to wrap.
dim (int): Dimension to resize observations to (dim x dim).
framestack (bool): Whether to framestack observation... | false | false | rllib/env/wrappers/atari_wrappers.py | atari_wrappers.py | ray | ray-project |
python_ray__private_state.py | GlobalState.add_worker | [
{
"version": "v196",
"docstring_lines": {
"start_line": 628,
"end_line": 639
},
"code_lines": {
"start_line": 639,
"end_line": 648
},
"commit_date_time": "2023-05-10 01:51:21",
"commit_sha": "acffd2f5329a582064e9f62e3c9eb0377fc61c0d",
"commit_message": "[Core]... | def add_worker(self, worker_id, worker_type, worker_info):
- worker_data = gcs_utils.WorkerTableData()
? ^^^^^
+ worker_data = gcs_pb2.WorkerTableData()
? ^^^
worker_data.is_alive = True
worker_data.worker_... | Add a worker to the cluster.
Args:
worker_id: ID of this worker. Type is bytes.
- worker_type: Type of this worker. Value is gcs_utils.DRIVER or
? - ^ ^^^^^
+ worker_type: Type of this worker. Value is common_pb... | false | false | python/ray/_private/state.py | state.py | ray | ray-project |
python_ray__private_state.py | GlobalState.get_draining_nodes | [
{
"version": "v204",
"docstring_lines": {
"start_line": 803,
"end_line": 805
},
"code_lines": {
"start_line": 805,
"end_line": 809
},
"commit_date_time": "2023-11-30 00:57:19",
"commit_sha": "c913358c1a85dc341e6abe5cce815d42ac11280c",
"commit_message": "[Core/... | - def get_draining_nodes(self) -> Set[str]:
? ^^
+ def get_draining_nodes(self) -> Dict[str, int]:
? ^^^ +++++
+
self._check_connected()
return self.global_state_accessor.get_draining_nodes() | - Get all the hex ids of nodes that are being drained.
? -
+ Get all the hex ids of nodes that are being drained
+ and the corresponding draining deadline timestamps in ms.
+
+ There is no deadline if the timestamp is 0. | false | false | python/ray/_private/state.py | state.py | ray | ray-project |
python_ray__private_state.py | GlobalState.actor_table | [
{
"version": "v201",
"docstring_lines": {
"start_line": 805,
"end_line": 814
},
"code_lines": {
"start_line": 814,
"end_line": 821
},
"commit_date_time": "2023-08-09 04:07:30",
"commit_sha": "36965bad8a7f381c121f580bdab12fc24b2229c0",
"commit_message": "[Core]... | - def actor_table(self, actor_id):
+ def actor_table(
+ self, actor_id: str, job_id: ray.JobID = None, actor_state_name: str = None
+ ):
self._check_connected()
if actor_id is not None:
actor_id = ray.ActorID(hex_to_binary(actor_id))
a... | Fetch and parse the actor table information for a single actor ID.
Args:
actor_id: A hex string of the actor ID to fetch information about.
If this is None, then the actor table is fetched.
-
+ If this is not None, `job_id` and `actor_state_name`
+ ... | false | false | python/ray/_private/state.py | state.py | ray | ray-project |
lib_gui_display_command.py | GraphDisplay.add_child | [
{
"version": "v22",
"docstring_lines": {
"start_line": 178,
"end_line": 180
},
"code_lines": {
"start_line": 180,
"end_line": 186
},
"commit_date_time": "2022-05-02 13:30:43",
"commit_sha": "c1512fd41d86ef47a5d1ce618d6d755ef7cbacdf",
"commit_message": "Update ... | - def add_child(self, name, data):
+ def add_child(self, name: str, data: Calculations) -> None:
-
? -
+
+
logger.debug("Adding child: %s", name)
graph = TrainingGraph(self.subnotebook, data, "Loss")
graph.build()
graph = self.subnotebook_a... | - Add the graph for the selected keys
+ Add the graph for the selected keys.
? +
+
+ Parameters
+ ----------
+ name: str
+ The name of the graph to add to the notebook
+ data: :class:`~lib.gui.analysis.stats.Calculations`
+ The... | false | false | lib/gui/display_command.py | display_command.py | faceswap | deepfakes |
python_ccxt_ascendex.py | ascendex.parse_market_leverage_tiers | [
{
"version": "v130",
"docstring_lines": {
"start_line": 2272,
"end_line": 2272
},
"code_lines": {
"start_line": 2273,
"end_line": 2314
},
"commit_date_time": "2022-04-02 22:02:54",
"commit_sha": "602255762ed3384f16fd6741d58a5914463503ff",
"commit_message": "1.... | def parse_market_leverage_tiers(self, info, market=None):
- '''
? ---
+
-
? ----
+
- '''
? ^^^
+
? ^
+ #
+ # {
+ # "symbol":"BTC-PERP",
+ # "status":"Normal",
+ # "d... | - @param info: Exchange market response for 1 market
? ^
+ :param dict info: Exchange market response for 1 market
? ^ +++++
- {
- "symbol":"BTC-PERP",
- "status":"Normal",
- "displayName":"BTCUSDT",
- "settlementAsset":"USDT",
- ... | false | false | python/ccxt/ascendex.py | ascendex.py | ccxt | ccxt |
python_ccxt_ascendex.py | ascendex.fetch_tickers | [
{
"version": "v199",
"docstring_lines": {
"start_line": 933,
"end_line": 939
},
"code_lines": {
"start_line": 939,
"end_line": 965
},
"commit_date_time": "2022-09-29 17:19:03",
"commit_sha": "73a0d584c596d7d721e72c94ce908bf279f879fa",
"commit_message": "move p... | def fetch_tickers(self, symbols=None, params={}):
self.load_markets()
request = {}
+ market = None
if symbols is not None:
+ symbol = self.safe_value(symbols, 0)
+ market = self.market(symbol)
marketIds = self... | fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
+ see https://ascendex.github.io/ascendex-pro-api/#ticker
+ see https://ascendex.github.io/ascendex-futures-pro-api-v2/#ticker
:param [str]|None symbols: un... | false | false | python/ccxt/ascendex.py | ascendex.py | ccxt | ccxt |
python_ccxt_ascendex.py | ascendex.set_leverage | [
{
"version": "v239",
"docstring_lines": {
"start_line": 2666,
"end_line": 2673
},
"code_lines": {
"start_line": 2673,
"end_line": 2691
},
"commit_date_time": "2023-10-23 11:45:36",
"commit_sha": "c9913cb44031e12f78e504c35bb194ed744facd4",
"commit_message": "4.... | def set_leverage(self, leverage, symbol: Optional[str] = None, params={}):
+ self.check_required_symbol('setLeverage', symbol)
- if symbol is None:
- raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
if (leverage < 1) ... | set the level of leverage for a market
+ :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-contract-leverage
:param float leverage: the rate of leverage
:param str symbol: unified market symbol
:param dict [params]: extra parameters specific to the ascendex api... | false | false | python/ccxt/ascendex.py | ascendex.py | ccxt | ccxt |
python_ccxt_ascendex.py | ascendex.transfer | [
{
"version": "v261",
"docstring_lines": {
"start_line": 2963,
"end_line": 2972
},
"code_lines": {
"start_line": 2972,
"end_line": 3003
},
"commit_date_time": "2024-02-01 10:26:02",
"commit_sha": "86b41eeed45e51ffa4b4e9a5f7206c99d6c262cd",
"commit_message": "4.... | - def transfer(self, code: str, amount, fromAccount, toAccount, params={}):
+ def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
? +++++++ +++++++++++++++++
s... | transfer currency internally between wallets on the same account
- :param str code: unified currency code
+ :param str code: unified currency codeåå
? ++
:param float amount: amount to transfer
:param str fromAccount: account to transf... | false | false | python/ccxt/ascendex.py | ascendex.py | ccxt | ccxt |
python_ccxt_ascendex.py | ascendex.fetch_deposit_address | [
{
"version": "v263",
"docstring_lines": {
"start_line": 2284,
"end_line": 2290
},
"code_lines": {
"start_line": 2290,
"end_line": 2349
},
"commit_date_time": "2024-02-08 08:10:44",
"commit_sha": "590e6191eef3a0c61005b596a0d68cf6153dbdb7",
"commit_message": "4.... | def fetch_deposit_address(self, code: str, params={}):
self.load_markets()
currency = self.currency(code)
- chainName = self.safe_string(params, 'chainName')
? ---- ---
+ networkCode = self.safe_string_2(params, 'network', 'chainName')
? ... | fetch the deposit address for a currency associated with self account
+ :see: https://ascendex.github.io/ascendex-pro-api/#query-deposit-addresses
:param str code: unified currency code
:param dict [params]: extra parameters specific to the exchange API endpoint
+ :param str [param... | false | false | python/ccxt/ascendex.py | ascendex.py | ccxt | ccxt |
django_test_runner.py | DiscoverRunner.run_tests | [
{
"version": "v120",
"docstring_lines": {
"start_line": 863,
"end_line": 874
},
"code_lines": {
"start_line": 874,
"end_line": 906
},
"commit_date_time": "2021-07-12 04:36:12",
"commit_sha": "5848b3a1d70f09aaf598d794569ad758183f41db",
"commit_message": "Fixed ... | def run_tests(self, test_labels, extra_tests=None, **kwargs):
+ if extra_tests is not None:
+ warnings.warn(
+ 'The extra_tests argument is deprecated.',
+ RemovedInDjango50Warning,
+ stacklevel=2,
+ )
... | Run the unit tests for all the test labels in the provided list.
Test labels should be dotted Python paths to test modules, test
classes, or test methods.
- A list of 'extra' tests may also be provided; these tests
- will be added to the test suite.
-
Return the nu... | false | false | django/test/runner.py | runner.py | django | django |
django_test_runner.py | DiscoverRunner.log | [
{
"version": "v124",
"docstring_lines": {
"start_line": 679,
"end_line": 685
},
"code_lines": {
"start_line": 685,
"end_line": 690
},
"commit_date_time": "2021-08-19 07:18:32",
"commit_sha": "36714be874fa9ba7c0229d97607906669615e409",
"commit_message": "Refs #... | def log(self, msg, level=None):
+ if level is None:
+ level = logging.INFO
+ if self.logger is None:
- if self.verbosity <= 0 or (
+ if self.verbosity <= 0 or (
? ++++
- self.verbosity == 1 and level is not None and level < ... | - Log the given message at the given logging level.
? ------
+ Log the message at the given logging level (the default is INFO).
? ++++++++++++++++++++++
- A verbosity of 1 logs INFO (the default level) or above, and verbosity
- 2 or higher logs all ... | false | false | django/test/runner.py | runner.py | django | django |
django_contrib_admin_options.py | ModelAdmin.save_formset | [
{
"version": "v19",
"docstring_lines": {
"start_line": 442,
"end_line": 445
},
"code_lines": {
"start_line": 445,
"end_line": 446
},
"commit_date_time": "2008-08-10 04:03:01",
"commit_sha": "02cc59187be963b6c1ede084a7c9912ea6a1a338",
"commit_message": "Fixed #... | def save_formset(self, request, form, formset, change):
- return formset.save(commit=False)
+ formset.save() | - Given an inline formset return unsaved instances.
+ Given an inline formset save it to the database. | false | false | django/contrib/admin/options.py | options.py | django | django |
django_contrib_admin_options.py | ModelAdmin.message_user | [
{
"version": "v166",
"docstring_lines": {
"start_line": 669,
"end_line": 672
},
"code_lines": {
"start_line": 672,
"end_line": 693
},
"commit_date_time": "2012-10-20 13:49:52",
"commit_sha": "c2e19e26bc33d34eff57079bd1a6838ff64d9e81",
"commit_message": "Fixed ... | - def message_user(self, request, message):
+ def message_user(self, request, message, level=messages.INFO, extra_tags='',
+ fail_silently=False):
- messages.info(request, message)
+
+ if not isinstance(level, int):
+ # attempt to get th... | Send a message to the user. The default implementation
posts a message using the django.contrib.messages backend.
+
+ Exposes almost the same API as messages.add_message(), but accepts the
+ positional arguments in a different order to maintain backwards
+ compatibility. For conveni... | false | false | django/contrib/admin/options.py | options.py | django | django |
django_contrib_admin_options.py | ModelAdmin.has_add_permission | [
{
"version": "v111",
"docstring_lines": {
"start_line": 342,
"end_line": 342
},
"code_lines": {
"start_line": 343,
"end_line": 346
},
"commit_date_time": "2010-12-23 03:44:38",
"commit_sha": "732198ed5c2a127249970e0cd4218d093a38e9a2",
"commit_message": "Fix a ... | def has_add_permission(self, request):
- ""
? --
+
+
+
opts = self.opts
return request.user.has_perm(opts.app_label + '.' + opts.get_add_permission()) | Returns True if the given request has permission to add an object.
+ Can be overriden by the user in subclasses. | false | false | django/contrib/admin/options.py | options.py | django | django |
django_contrib_admin_options.py | ModelAdmin.response_add | [
{
"version": "v172",
"docstring_lines": {
"start_line": 867,
"end_line": 883
},
"code_lines": {
"start_line": 883,
"end_line": 939
},
"commit_date_time": "2012-12-16 14:22:09",
"commit_sha": "d7b49f5b0dcecfcc9b5a77632ecbba88e7637490",
"commit_message": "Fixed ... | - def response_add(self, request, obj, post_url_continue='../%s/',
? ^^^^^^^^^
+ def response_add(self, request, obj, post_url_continue=None):
? ^^^^^^
- continue_editing_url=None, add_an... | Determines the HttpResponse for the add_view stage.
-
- :param request: HttpRequest instance.
- :param obj: Object just added.
- :param post_url_continue: Deprecated/undocumented.
- :param continue_editing_url: URL where user will be redirected after
- ... | false | false | django/contrib/admin/options.py | options.py | django | django |
django_contrib_admin_options.py | ModelAdmin.response_delete | [
{
"version": "v346",
"docstring_lines": {
"start_line": 483,
"end_line": 483
},
"code_lines": {
"start_line": 484,
"end_line": 518
},
"commit_date_time": "2017-02-03 13:01:45",
"commit_sha": "29f607927fe82e2c8baab171dfa8baf710cd9b83",
"commit_message": "Fixed ... | def response_delete(self, request, obj_display, obj_id):
-
opts = self.model._meta
if IS_POPUP_VAR in request.POST:
popup_response_data = json.dumps({
'action': 'delete',
'value': str(obj_id),
})
... | - Determines the HttpResponse for the delete_view stage.
? -
+ Determine the HttpResponse for the delete_view stage. | false | false | django/contrib/admin/options.py | options.py | django | django |
django_contrib_admin_options.py | ModelAdmin.get_model_perms | [
{
"version": "v379",
"docstring_lines": {
"start_line": 625,
"end_line": 630
},
"code_lines": {
"start_line": 630,
"end_line": 635
},
"commit_date_time": "2018-04-04 23:21:50",
"commit_sha": "be6ca89396c031619947921c81b8795d816e3285",
"commit_message": "Fixed ... | def get_model_perms(self, request):
return {
'add': self.has_add_permission(request),
'change': self.has_change_permission(request),
'delete': self.has_delete_permission(request),
+ 'view': self.has_view_permission(reques... | Return a dict of all perms for this model. This dict has the keys
- ``add``, ``change``, and ``delete`` mapping to the True/False for each
? ---- ---------
+ ``add``, ``change``, ``delete``, and ``view`` mapping to the True/False
? ... | false | false | django/contrib/admin/options.py | options.py | django | django |
.dev_scripts_test_init_backbone.py | _check_backbone | [
{
"version": "v3",
"docstring_lines": {
"start_line": 91,
"end_line": 111
},
"code_lines": {
"start_line": 111,
"end_line": 151
},
"commit_date_time": "2022-08-23 06:34:19",
"commit_sha": "d0695e68654ca242be54e655491aef8c959ac345",
"commit_message": "[Fix] rep... | def _check_backbone(config, print_cfg=True):
if print_cfg:
print('-' * 15 + 'loading ', config)
cfg = Config.fromfile(config)
init_cfg = None
try:
init_cfg = cfg.model.backbone.init_cfg
init_flag = True
except AttributeError:
init_fla... | Check out backbone whether successfully load pretrained model, by using
`backbone.init_cfg`.
First, using `CheckpointLoader.load_checkpoint` to load the checkpoint
without loading models.
- Then, using `build_detector` to build models, and using
? ^^^^^^ -----
+ ... | false | false | .dev_scripts/test_init_backbone.py | test_init_backbone.py | mmdetection | open-mmlab |
sklearn_cross_decomposition__pls.py | PLSSVD.fit | [
{
"version": "v137",
"docstring_lines": {
"start_line": 683,
"end_line": 821
},
"code_lines": {
"start_line": 821,
"end_line": 830
},
"commit_date_time": "2020-06-23 12:35:02",
"commit_sha": "195f2f4d50e0eee498398d35d6048a419745c62a",
"commit_message": "DOC do... | def fit(self, X, Y):
- # copy since this will contains the centered data
check_consistent_length(X, Y)
X = self._validate_data(X, dtype=np.float64, copy=self.copy,
ensure_min_samples=2)
Y = check_array(Y, dtype=np.float64, c... | Fit model to data.
Parameters
----------
X : array-like of shape (n_samples, n_features)
+ Training samples
- Training vectors, where n_samples is the number of samples and
- n_features is the number of predictors.
- Y : array-like of sha... | false | false | sklearn/cross_decomposition/_pls.py | _pls.py | scikit-learn | scikit-learn |
sklearn_cross_decomposition__pls.py | PLSRegression.fit | [
{
"version": "v182",
"docstring_lines": {
"start_line": 1033,
"end_line": 1051
},
"code_lines": {
"start_line": 1051,
"end_line": 1063
},
"commit_date_time": "2024-03-13 17:20:27",
"commit_sha": "40cc29028c4fd538f3e3e8239c6ce1ccdd735005",
"commit_message": "DO... | - def fit(self, X, Y):
+ def fit(self, X, y=None, Y=None):
? ++++++++ +++++
+ y = _deprecate_Y_when_required(y, Y)
+
- super().fit(X, Y)
? ^
+ super().fit(X, y)
? ^
# expose the fitted attributes `... | Fit model to data.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number of predictors.
+ y : array-like of shape (n_samples,) or (n_sampl... | false | false | sklearn/cross_decomposition/_pls.py | _pls.py | scikit-learn | scikit-learn |
sklearn_cross_decomposition__pls.py | _PLS.inverse_transform | [
{
"version": "v163",
"docstring_lines": {
"start_line": 402,
"end_line": 419
},
"code_lines": {
"start_line": 419,
"end_line": 428
},
"commit_date_time": "2021-10-01 09:49:23",
"commit_sha": "39f7790e3d32d473593921c68ecc9147d7ba8d1e",
"commit_message": "DOC En... | - def inverse_transform(self, X):
+ def inverse_transform(self, X, Y=None):
? ++++++++
check_is_fitted(self)
X = check_array(X, dtype=FLOAT_DTYPES)
# From pls space to original space
X_reconstructed = np.matmul(X, self.x_loading... | Transform data back to its original space.
Parameters
----------
X : array-like of shape (n_samples, n_components)
New data, where `n_samples` is the number of samples
and `n_components` is the number of pls components.
+ Y : array-like of shape ... | false | false | sklearn/cross_decomposition/_pls.py | _pls.py | scikit-learn | scikit-learn |
vpype_model.py | Document.add | [
{
"version": "v37",
"docstring_lines": {
"start_line": 646,
"end_line": 651
},
"code_lines": {
"start_line": 651,
"end_line": 655
},
"commit_date_time": "2022-02-03 17:18:58",
"commit_sha": "6c347bd67f9e39b56664f23d3aeeb76ee495921b",
"commit_message": "Added p... | - def add(self, lines: LineCollectionLike, layer_id: Union[None, int] = None) -> None:
+ def add(
+ self,
+ lines: LineCollectionLike,
+ layer_id: Union[None, int] = None,
+ with_metadata: bool = False,
+ ) -> None:
if layer_id is None:
l... | Add a the content of a :py:class:`LineCollection` to a given layer.
- If the given layer is None, a new layer with the lowest available layer ID is created
? -----------
+ If the given layer ID is :data:`None`, a new... | false | false | vpype/model.py | model.py | vpype | abey79 |
vpype_model.py | LineCollection.__init__ | [
{
"version": "v23",
"docstring_lines": {
"start_line": 261,
"end_line": 264
},
"code_lines": {
"start_line": 264,
"end_line": 265
},
"commit_date_time": "2020-08-10 21:21:08",
"commit_sha": "b51b8070740777dc4540409bb7dd6461bc6db6a1",
"commit_message": "Feature... | def __init__(self, lines: LineCollectionLike = ()):
-
self._lines: List[np.ndarray] = []
self.extend(lines) | - Create a line collection.
- :param lines: iterable of line-like things
+ Create a LineCollection instance from an iterable of lines.
+
+ Args:
+ lines (LineCollectionLike): iterable of line (accepts the same input as
+ :func:`~LineCollection.append`). | false | false | vpype/model.py | model.py | vpype | abey79 |
vpype_model.py | Document.clone | [
{
"version": "v36",
"docstring_lines": {
"start_line": 601,
"end_line": 611
},
"code_lines": {
"start_line": 611,
"end_line": 612
},
"commit_date_time": "2022-01-31 17:28:33",
"commit_sha": "ea2c87d2ab803fe75b6010942ebff32b031da44c",
"commit_message": "Moved a... | - def clone(self) -> "Document":
+ def clone(self, keep_layers: bool = False) -> "Document":
+
- return Document(metadata=self.metadata)
? ^^^^^^
+ doc = Document(metadata=self.metadata)
? ^^^^^
+ if keep_layers:
+ for layer_id in self.layers:
+ ... | - Create an empty copy of this document with the same metadata
+ Create an empty copy of this document with the same metadata.
? +
+
+ By default, the cloned document doest not contain any layer. If ``keep_layers`` is set
+ to true, empty lay... | false | false | vpype/model.py | model.py | vpype | abey79 |
vpype_model.py | Document.add_to_sources | [
{
"version": "v40",
"docstring_lines": {
"start_line": 611,
"end_line": 619
},
"code_lines": {
"start_line": 619,
"end_line": 625
},
"commit_date_time": "2022-03-25 16:39:05",
"commit_sha": "10d88dc68813c9028586299e7598b94d1b434bda",
"commit_message": "Update ... | def add_to_sources(self, path) -> None:
- try:
- path = pathlib.Path(path)
? ^^^^
+ if (path := pathlib.Path(path)).exists():
? ^^^^ + +++++++++++
- if path.exists():
+ path = path.absolute()
+ ... | Add a path to the source list.
- If ``path`` cannot be converted to a :class:`pathlib.Path` or the file doesn't exist,
- it is ignored and not added to the source list.
+ This function sets the `vp_source` property to provided path and adds it to the
+ `vp_sources` property.
... | false | false | vpype/model.py | model.py | vpype | abey79 |
libs_community_langchain_community_vectorstores_pgvector.py | PGVector.delete | [
{
"version": "v48",
"docstring_lines": {
"start_line": 286,
"end_line": 291
},
"code_lines": {
"start_line": 291,
"end_line": 302
},
"commit_date_time": "2024-01-02 00:01:22",
"commit_sha": "d006be60ecc856c53bb07eb6db13422ca4387063",
"commit_message": "Added m... | def delete(
self,
ids: Optional[List[str]] = None,
+ collection_only: bool = False,
**kwargs: Any,
) -> None:
with Session(self._bind) as session:
if ids is not None:
self.logger.debug(
"T... | Delete vectors by ids or uuids.
Args:
ids: List of ids to delete.
+ collection_only: Only delete ids in the collection. | false | false | libs/community/langchain_community/vectorstores/pgvector.py | pgvector.py | langchain | langchain-ai |
Lib_configparser.py | SectionProxy.__init__ | [
{
"version": "v106",
"docstring_lines": {
"start_line": 1105,
"end_line": 1107
},
"code_lines": {
"start_line": 1107,
"end_line": 1115
},
"commit_date_time": "2010-11-21 13:41:35",
"commit_sha": "5c86339bd09959366fcb0d4c31798a4aac128083",
"commit_message": "Is... | - def __init__(self, parser, section_name):
? --------
+ def __init__(self, parser, name):
self._parser = parser
- self._section = section_name
+ self._name = name
self.getint = functools.partial(self._parser.getint,
- ... | - Creates a view on a section named `section_name` in `parser`.
? ^^^ --------
+ Creates a view on a section of the specified `name` in `parser`.
? ^^^^^^^^^^^^^^
| false | false | Lib/configparser.py | configparser.py | cpython | python |
Lib_configparser.py | RawConfigParser.get | [
{
"version": "v107",
"docstring_lines": {
"start_line": 1089,
"end_line": 1091
},
"code_lines": {
"start_line": 1091,
"end_line": 1101
},
"commit_date_time": "2010-11-21 13:56:42",
"commit_sha": "a73dc9d5e8ba2320a5aebf8c24ab665ccdfed5f8",
"commit_message": "co... | - def get(self, section, option, *, vars=None, fallback=_UNSET):
+ def get(self, section, option, *, raw=False, vars=None, fallback=_UNSET):
? +++++++++++
try:
d = self._unify_values(section, vars)
except NoSectionError:
... | Get an option value for a given section.
If `vars' is provided, it must be a dictionary. The option is looked up
in `vars' (if provided), `section', and in `DEFAULTSECT' in that order.
If the key is not found and `fallback' is provided, it is used as
a fallback value. `None'... | false | false | Lib/configparser.py | configparser.py | cpython | python |
Lib_configparser.py | RawConfigParser.read_dict | [
{
"version": "v110",
"docstring_lines": {
"start_line": 724,
"end_line": 733
},
"code_lines": {
"start_line": 733,
"end_line": 749
},
"commit_date_time": "2010-12-04 11:48:11",
"commit_sha": "24bcc61f2d8748515356a4e1daac05faed3ae731",
"commit_message": "config... | def read_dict(self, dictionary, source='<dict>'):
elements_added = set()
for section, keys in dictionary.items():
+ section = str(section)
try:
self.add_section(section)
except (DuplicateSectionError, ValueError):
... | Read configuration from a dictionary.
Keys are section names, values are dictionaries with keys and values
that should be present in the section. If the used dictionary type
preserves order, sections and their keys will be added in order.
+ All types held in the dictionary ... | false | false | Lib/configparser.py | configparser.py | cpython | python |
Lib_configparser.py | RawConfigParser._write_section | [
{
"version": "v166",
"docstring_lines": {
"start_line": 869,
"end_line": 871
},
"code_lines": {
"start_line": 871,
"end_line": 881
},
"commit_date_time": "2024-03-19 09:59:08",
"commit_sha": "b1bc37597f0d36084c4dcb15977fe6d4b9322cd4",
"commit_message": "gh-116... | - def _write_section(self, fp, section_name, section_items, delimiter):
+ def _write_section(self, fp, section_name, section_items, delimiter, unnamed=False):
? +++++++++++++++
+ if not unnamed:
- fp.write("[{}]\n".format(sec... | - Write a single section to the specified `fp`.
? ^
+ Write a single section to the specified `fp'.
? ^
| false | false | Lib/configparser.py | configparser.py | cpython | python |
django_forms_widgets.py | MultiWidget._get_media | [
{
"version": "v224",
"docstring_lines": {
"start_line": 825,
"end_line": 825
},
"code_lines": {
"start_line": 826,
"end_line": 832
},
"commit_date_time": "2017-02-20 13:48:03",
"commit_sha": "fb7e0e01af5364987de7fc95ae4d66e22130f2bc",
"commit_message": "Fixed ... | def _get_media(self):
- ""
? --
+
+
+
media = Media()
for w in self.widgets:
media = media + w.media
return media | - Media for a multiwidget is the combination of all media of the subwidgets
? -----------
+ Media for a multiwidget is the combination of all media of the
+ subwidgets. | false | false | django/forms/widgets.py | widgets.py | django | django |
kivy_core_image_img_pil.py | ImageSequence._img_array | [
{
"version": "v15",
"docstring_lines": {
"start_line": 41,
"end_line": 53
},
"code_lines": {
"start_line": 53,
"end_line": 70
},
"commit_date_time": "2011-07-16 16:05:26",
"commit_sha": "31967e12d63b40297419e03681739773b434cb94",
"commit_message": "fix comment... | def _img_array(self):
-
+ '''
? +++
-
+ '''
? +++
pilIm = self.im
pilIm.seek(0)
# Read all images inside
image_data = []
try:
while True:
img_tmp = pilIm
img_tmp =... | Read images from an animated file.
Returns a list/array of typ ImageData
-
- NOTE:
- gif animation has a lot of Issues(transparency/color depths... etc).
- In order to keep simple what is implimented here is what is natively
- supported by pil
-
- As a general rule ... | false | false | kivy/core/image/img_pil.py | img_pil.py | kivy | kivy |
gyp_pylib_gyp_generator_make.py | MakefileWriter.WriteMakeRule | [
{
"version": "v16",
"docstring_lines": {
"start_line": 1702,
"end_line": 1715
},
"code_lines": {
"start_line": 1715,
"end_line": 1762
},
"commit_date_time": "2015-05-24 21:12:55",
"commit_sha": "9513572a881588bb1cdca5896226d79d0beeb46d",
"commit_message": "gyp... | def WriteMakeRule(self, outputs, inputs, actions=None, comment=None,
- order_only=False, force=False, phony=False):
+ order_only=False, force=False, phony=False, command=None):
? ++++++++++++++
o... | Write a Makefile rule, with some extra tricks.
outputs: a list of outputs for the rule (note: this is not directly
supported by make; see comments below)
inputs: a list of inputs for the rule
actions: a list of shell commands to run for the rule
comment: a comment to put in t... | false | false | gyp/pylib/gyp/generator/make.py | make.py | node-gyp | nodejs |
gyp_pylib_gyp_generator_make.py | EscapeShellArgument | [
{
"version": "v40",
"docstring_lines": {
"start_line": 668,
"end_line": 670
},
"code_lines": {
"start_line": 670,
"end_line": 681
},
"commit_date_time": "2020-10-15 00:12:52",
"commit_sha": "ee6a837cb71f465c0e689a81b4adc784bdf8a0c7",
"commit_message": "gyp: up... | def EscapeShellArgument(s):
-
? -
+
return "'" + s.replace("'", "'\\''") + "'" | Quotes an argument so that it will be interpreted literally by a POSIX
- shell. Taken from
? -
+ shell. Taken from
- http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python
? -
+ http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-c... | false | false | gyp/pylib/gyp/generator/make.py | make.py | node-gyp | nodejs |
python_ccxt_async_support_binance.py | binance.parse_market_leverage_tiers | [
{
"version": "v667",
"docstring_lines": {
"start_line": 4597,
"end_line": 4597
},
"code_lines": {
"start_line": 4598,
"end_line": 4866
},
"commit_date_time": "2022-04-07 11:30:22",
"commit_sha": "f9485984e33930f382dcf04c1803959c8cecba79",
"commit_message": "1.... | def parse_market_leverage_tiers(self, info, market):
- '''
? ---
+
-
? ---
+
- '''
? ^^^
+
? ^
+ #
+ # {
+ # "symbol": "SUSHIUSDT",
+ # "brackets": [
+ # {
+ ... | + * @ignore
- @param info: Exchange response for 1 market
? ^
+ :param dict info: Exchange response for 1 market
? ^^^^^^^^^ +++++
- {
- "symbol": "SUSHIUSDT",
- "brackets": [
- {
- "bracket": 1,
- ... | false | false | python/ccxt/async_support/binance.py | binance.py | ccxt | ccxt |
homeassistant_components_bayesian_binary_sensor.py | BayesianBinarySensor._process_numeric_state | [
{
"version": "v15",
"docstring_lines": {
"start_line": 231,
"end_line": 233
},
"code_lines": {
"start_line": 233,
"end_line": 240
},
"commit_date_time": "2020-02-25 05:27:59",
"commit_sha": "0e6a48c68882f338c361a50090fe995204d01880",
"commit_message": "Add obs... | def _process_numeric_state(self, entity_observation):
entity = entity_observation["entity_id"]
should_trigger = condition.async_numeric_state(
self.hass,
entity,
entity_observation.get("below"),
entity_observation.get("above"),
... | - Add entity to current_obs if numeric state conditions are met.
+ Return True if numeric condition is met. | false | false | homeassistant/components/bayesian/binary_sensor.py | binary_sensor.py | core | home-assistant |
tools_manual_frameviewer_control.py | Navigation.nav_scale_callback | [
{
"version": "v6",
"docstring_lines": {
"start_line": 41,
"end_line": 49
},
"code_lines": {
"start_line": 49,
"end_line": 69
},
"commit_date_time": "2021-06-08 18:30:28",
"commit_sha": "eb96da03463fe80514b54c1f7483af9509db9e78",
"commit_message": "Add Misalign... | def nav_scale_callback(self, *args, reset_progress=True): # pylint:disable=unused-argument
self._display_frame.pack_threshold_slider()
if reset_progress:
self.stop_playback()
frame_count = self._det_faces.filter.count
if self._current_nav_f... | Adjust transport slider scale for different filters. Hide or display optional filter
controls.
-
- Returns
- -------
- bool
- ``True`` if the navigation scale has been updated otherwise ``False`` | false | false | tools/manual/frameviewer/control.py | control.py | faceswap | deepfakes |
glances_processes.py | GlancesProcesses.__get_mandatory_stats | [
{
"version": "v121",
"docstring_lines": {
"start_line": 261,
"end_line": 266
},
"code_lines": {
"start_line": 266,
"end_line": 293
},
"commit_date_time": "2016-10-15 17:08:07",
"commit_sha": "6c502baf7aebd527a4e0ecf3489d4ebe04cd14ce",
"commit_message": "Correc... | def __get_mandatory_stats(self, proc, procstat):
procstat['mandatory_stats'] = True
- # Process CPU, MEM percent and name
+ # Name, cpu_times, status and ppid stats are in the same /proc file
+ # Optimisation fir issue #958
try:
... | - Get mandatory_stats: need for the sorting/filter step.
+ Get mandatory_stats: for all processes.
+ Needed for the sorting/filter step.
- => cpu_percent, memory_percent, io_counters, name, cmdline
+ Stats grabbed inside this method:
+ * 'name', 'cpu_times', 'status', 'ppid'
+ ... | false | false | glances/processes.py | processes.py | glances | nicolargo |
glances_processes.py | _sort_cpu_times | [
{
"version": "v182",
"docstring_lines": {
"start_line": 505,
"end_line": 509
},
"code_lines": {
"start_line": 509,
"end_line": 541
},
"commit_date_time": "2021-10-01 12:39:35",
"commit_sha": "1e75f104e9b98a577afad67c1378bbdb4529f27b",
"commit_message": "fixed ... | def _sort_cpu_times(process,
- sortedby='cpu_times',
+ sorted_by='cpu_times',
? +
- sortedby_secondary='memory_percent'):
+ sorted_by_secondary='memory_percent'):
? +
+
- ... | Specific case for cpu_times
+
Patch for "Sorting by process time works not as expected #1321"
By default PsUtil only takes user time into account
see (https://github.com/giampaolo/psutil/issues/1339)
The following implementation takes user and system time into account | false | false | glances/processes.py | processes.py | glances | nicolargo |
glances_processes.py | GlancesProcesses.sort_key | [
{
"version": "v168",
"docstring_lines": {
"start_line": 372,
"end_line": 374
},
"code_lines": {
"start_line": 374,
"end_line": 376
},
"commit_date_time": "2019-10-27 10:44:11",
"commit_sha": "6d76daaecab7baf8608710d8a9bc021775ae4aa8",
"commit_message": "KeyErr... | - def sort_key(self, key):
+ def sort_reverse(self):
- self._sort_key = key
+ if self.sort_key == 'name' or self.sort_key == 'username':
+ return False
+
+ return True | - Set the current sort key.
+ Return True to sort processes in reverse 'key' order, False instead. | false | false | glances/processes.py | processes.py | glances | nicolargo |
glances_processes.py | GlancesProcesses.getlist | [
{
"version": "v202",
"docstring_lines": {
"start_line": 427,
"end_line": 429
},
"code_lines": {
"start_line": 429,
"end_line": 431
},
"commit_date_time": "2023-01-14 08:59:56",
"commit_sha": "b79edc7df6a54337830684d9b53d61716d2a8330",
"commit_message": "Glance... | - def getlist(self, sorted_by=None):
+ def getlist(self, sorted_by=None, as_programs=False):
? +++++++++++++++++++
+ if as_programs:
+ return processes_to_programs(self.processlist)
+ else:
- return self.processlist
+ return sel... | Get the processlist.
+ By default, return the list of threads.
+ If as_programs is True, return the list of programs. | false | false | glances/processes.py | processes.py | glances | nicolargo |
glances_processes.py | GlancesProcesses.export_process_filter | [
{
"version": "v214",
"docstring_lines": {
"start_line": 244,
"end_line": 246
},
"code_lines": {
"start_line": 246,
"end_line": 249
},
"commit_date_time": "2024-04-05 17:39:12",
"commit_sha": "6fc0814a320e4deb8299da635fb862518a3053a2",
"commit_message": "Add op... | def export_process_filter(self, value):
- self._filter_export.filter = '|'.join(value.split(','))
? --------- ------------
+ self._filter_export.filter = value | - Set the export process filter.
+ Set the export process filter list.
? +++++
| false | false | glances/processes.py | processes.py | glances | nicolargo |
django_db_models_base.py | Model.save | [
{
"version": "v80",
"docstring_lines": {
"start_line": 272,
"end_line": 276
},
"code_lines": {
"start_line": 276,
"end_line": 279
},
"commit_date_time": "2008-08-08 20:59:02",
"commit_sha": "7899568e01fc9c68afe995fa71de915dd9fcdd76",
"commit_message": "File st... | - def save(self):
+ def save(self, force_insert=False, force_update=False):
- self.save_base()
+ if force_insert and force_update:
+ raise ValueError("Cannot force both insert and updating in "
+ "model saving.")
+ self.save_base(f... | Saves the current instance. Override this in a subclass if you want to
control the saving process.
+
+ The 'force_insert' and 'force_update' parameters can be used to insist
+ that the "save" must be an SQL insert or update (or equivalent for
+ non-SQL backends), respectively. Norma... | false | false | django/db/models/base.py | base.py | django | django |
django_db_models_base.py | Model.serializable_value | [
{
"version": "v91",
"docstring_lines": {
"start_line": 300,
"end_line": 306
},
"code_lines": {
"start_line": 306,
"end_line": 308
},
"commit_date_time": "2008-12-08 08:15:37",
"commit_sha": "d662ef554015a3508ff8100c73b370728156a02c",
"commit_message": "The fir... | def serializable_value(self, field_name):
+ try:
- field = self._meta.get_field_by_name(field_name)[0]
+ field = self._meta.get_field_by_name(field_name)[0]
? ++++
+ except FieldDoesNotExist:
+ return getattr(self, field_name)
... | - Returns the value of the field name for this instance. If the field
+ Returns the value of the field name for this instance. If the field is
? +++
- is a foreign key, returns the id value, instead of the object.
? ---
+ a fore... | false | false | django/db/models/base.py | base.py | django | django |
django_db_models_base.py | Model._check_ordering | [
{
"version": "v252",
"docstring_lines": {
"start_line": 1360,
"end_line": 1362
},
"code_lines": {
"start_line": 1362,
"end_line": 1420
},
"commit_date_time": "2014-05-16 20:39:12",
"commit_sha": "1efb2e73bf13100639c4f06963220549a7eb725c",
"commit_message": "Fi... | def _check_ordering(cls):
from django.db.models import FieldDoesNotExist
if not cls._meta.ordering:
return []
if not isinstance(cls._meta.ordering, (list, tuple)):
return [
checks.Error(
("'ordering... | - Check "ordering" option -- is it a list of lists and do all fields
? --
+ Check "ordering" option -- is it a list of strings and do all fields
? ++++
exist? | false | false | django/db/models/base.py | base.py | django | django |
django_db_models_base.py | Model._check_indexes | [
{
"version": "v412",
"docstring_lines": {
"start_line": 1588,
"end_line": 1590
},
"code_lines": {
"start_line": 1590,
"end_line": 1616
},
"commit_date_time": "2020-03-31 05:12:11",
"commit_sha": "c06d7c92392c799d5a17f2620f8e280e119409bf",
"commit_message": "Re... | - def _check_indexes(cls):
+ def _check_indexes(cls, databases):
? +++++++++++
errors = []
for index in cls._meta.indexes:
# Index name can't start with an underscore or a number, restricted
# for cross-database compatibility with Oracle.... | - Check the fields and names of indexes.
+ Check fields, names, and conditions of indexes. | false | false | django/db/models/base.py | base.py | django | django |
django_db_models_base.py | Model._do_insert | [
{
"version": "v398",
"docstring_lines": {
"start_line": 913,
"end_line": 917
},
"code_lines": {
"start_line": 917,
"end_line": 919
},
"commit_date_time": "2019-08-19 11:28:35",
"commit_sha": "85458e94e38c20e57939947ee515a1a53689659f",
"commit_message": "Fixed ... | - def _do_insert(self, manager, using, fields, update_pk, raw):
? ^ ^^^^^^
+ def _do_insert(self, manager, using, fields, returning_fields, raw):
? +++ ^^^^^^^^^^ ^
- return manager._ins... | - Do an INSERT. If update_pk is defined then this method should return
? ^ ^^^^^^ -------
+ Do an INSERT. If returning_fields is defined then this method should
? +++ ^^^^^^^^^^ ^
- the new pk for the model.
+ return the newly create... | false | false | django/db/models/base.py | base.py | django | django |
django_db_models_base.py | Model.full_clean | [
{
"version": "v448",
"docstring_lines": {
"start_line": 1414,
"end_line": 1418
},
"code_lines": {
"start_line": 1418,
"end_line": 1448
},
"commit_date_time": "2022-04-21 08:12:28",
"commit_sha": "cd4da34fc1f1df08f593e461b2f670bfd61d0d2f",
"commit_message": "Fi... | - def full_clean(self, exclude=None, validate_unique=True):
+ def full_clean(self, exclude=None, validate_unique=True, validate_constraints=True):
? +++++++++++++++++++++++++++
errors = {}
if exclude is None:
... | - Call clean_fields(), clean(), and validate_unique() on the model.
? ---- ^^ ------- ---
+ Call clean_fields(), clean(), validate_unique(), and
? ^^^
- Raise a ValidationError for any errors that occur.
+ val... | false | false | django/db/models/base.py | base.py | django | django |
readthedocs_projects_querysets.py | ProjectQuerySetBase.is_active | [
{
"version": "v37",
"docstring_lines": {
"start_line": 51,
"end_line": 64
},
"code_lines": {
"start_line": 64,
"end_line": 69
},
"commit_date_time": "2021-05-06 18:08:46",
"commit_sha": "2ce3a5eafede30cee1f1a050374b8fd1e3f96b1b",
"commit_message": "Querysets: ... | def is_active(self, project):
any_owner_banned = any(u.profile.banned for u in project.users.all())
- if project.skip or any_owner_banned:
+ organization = project.organizations.first()
+ if (
+ project.skip
+ or any_owner_bann... | Check if the project is active.
- The check consists on,
? ^
+ The check consists on:
? ^
+
- * the Project shouldn't be marked as skipped.
? --
+ * the Project shouldn't be marked as skipped.
- * any of the p... | false | false | readthedocs/projects/querysets.py | querysets.py | readthedocs.org | readthedocs |
readthedocs_projects_querysets.py | HTMLFileQuerySetBase.external | [
{
"version": "v20",
"docstring_lines": {
"start_line": 231,
"end_line": 236
},
"code_lines": {
"start_line": 236,
"end_line": 238
},
"commit_date_time": "2019-06-18 09:21:47",
"commit_sha": "9140a57e745045d08c5fa74e4e15568953a822dd",
"commit_message": "HTMLFil... | def external(self):
- return self.filter(version__type=PULL_REQUEST)
? ^^ ---------
+ return self.filter(version__type=EXTERNAL)
? ^^^^^^^
| HTMLFileQuerySet method that only includes external version html files.
- It will only include PULL_REQUEST type Version html files in the queries.
? ^^^^^^^^^^^^^ ^^
+ It will only include pull request/merge request Version html files in the queries.
? ... | false | false | readthedocs/projects/querysets.py | querysets.py | readthedocs.org | readthedocs |
readthedocs_projects_querysets.py | ProjectQuerySetBase.for_user_and_viewer | [
{
"version": "v43",
"docstring_lines": {
"start_line": 32,
"end_line": 34
},
"code_lines": {
"start_line": 34,
"end_line": 38
},
"commit_date_time": "2021-05-26 14:56:07",
"commit_sha": "f930dd1a6872ea6e3b66269f0a2a4088e64a6217",
"commit_message": "QuerySets: ... | def for_user_and_viewer(self, user, viewer):
- queryset = self.filter(privacy_level=constants.PUBLIC)
- queryset = self._add_user_projects(queryset, viewer)
- queryset = queryset.filter(users__in=[user])
+
+
+ viewer_projects = self._add_user_projects(self.... | Show projects that a user owns, that another user can see.
+
+ This includes:
+
+ - Projects where both are member
+ - Public projects from `user` | false | false | readthedocs/projects/querysets.py | querysets.py | readthedocs.org | readthedocs |
readthedocs_projects_querysets.py | ProjectQuerySetBase.max_concurrent_builds | [
{
"version": "v47",
"docstring_lines": {
"start_line": 92,
"end_line": 107
},
"code_lines": {
"start_line": 107,
"end_line": 117
},
"commit_date_time": "2022-05-11 23:57:18",
"commit_sha": "bb45582260df9bcac539c68f9bd202c0b1a3e460",
"commit_message": "User: de... | def max_concurrent_builds(self, project):
+ from readthedocs.subscriptions.constants import TYPE_CONCURRENT_BUILDS
+ from readthedocs.subscriptions.models import PlanFeature
+
max_concurrent_organization = None
organization = project.organizations.... | Return the max concurrent builds allowed for the project.
Max concurrency build priority:
- project
- organization
+ - plan
- default setting
:param project: project to be checked
:type project: readthedocs.projects.models.Project
... | false | false | readthedocs/projects/querysets.py | querysets.py | readthedocs.org | readthedocs |
django_core_management_base.py | BaseCommand.execute | [
{
"version": "v71",
"docstring_lines": {
"start_line": 308,
"end_line": 314
},
"code_lines": {
"start_line": 314,
"end_line": 323
},
"commit_date_time": "2013-12-30 22:59:34",
"commit_sha": "bfcc686d22df10c268752635947dd242317ba156",
"commit_message": "Removed... | def execute(self, *args, **options):
self.stdout = OutputWrapper(options.get('stdout', sys.stdout))
if options.get('no_color'):
self.style = no_style()
self.stderr = OutputWrapper(options.get('stderr', sys.stderr))
else:
... | - Try to execute this command, performing model validation if
- needed (as controlled by the attribute
+ Try to execute this command, performing system checks if needed (as
+ controlled by attributes ``self.requires_system_checks`` and
``self.requires_model_validation``, except if force-skippe... | false | false | django/core/management/base.py | base.py | django | django |
django_core_management_base.py | BaseCommand.validate | [
{
"version": "v68",
"docstring_lines": {
"start_line": 308,
"end_line": 314
},
"code_lines": {
"start_line": 314,
"end_line": 323
},
"commit_date_time": "2013-12-28 08:42:59",
"commit_sha": "bb8ec71f61066587aa3a8feb0aedab213422775a",
"commit_message": "Updated... | - def validate(self, app=None, display_num_errors=False):
+ def validate(self, app_config=None, display_num_errors=False):
? +++++++
from django.core.management.validation import get_validation_errors
s = StringIO()
- num_errors = ge... | Validates the given app, raising CommandError for any errors.
- If app is None, then this will validate all installed apps.
+ If app_config is None, then this will validate all installed apps.
? +++++++
| false | false | django/core/management/base.py | base.py | django | django |
homeassistant_components_notion_sensor.py | NotionSensor.native_value | [
{
"version": "v25",
"docstring_lines": {
"start_line": 79,
"end_line": 84
},
"code_lines": {
"start_line": 84,
"end_line": 87
},
"commit_date_time": "2023-05-14 16:11:22",
"commit_sha": "ff14277805750105fcd7456c9ab7de839ef698b4",
"commit_message": "Fix a serie... | def native_value(self) -> str | None:
-
if not self.listener.status_localized:
return None
+ if self.listener.listener_kind == ListenerKind.TEMPERATURE:
+ # The Notion API only returns a localized string for temperature (e.g.
+ # "70°"); we s... | Return the value reported by the sensor.
-
- The Notion API only returns a localized string for temperature (e.g. "70°"); we
- simply remove the degree symbol: | false | false | homeassistant/components/notion/sensor.py | sensor.py | core | home-assistant |
skimage_draw_draw_nd.py | line_nd | [
{
"version": "v8",
"docstring_lines": {
"start_line": 55,
"end_line": 97
},
"code_lines": {
"start_line": 97,
"end_line": 109
},
"commit_date_time": "2019-09-17 13:43:46",
"commit_sha": "6bc612e496c261d2c82060420308644562f373f1",
"commit_message": "Make some a... | - def line_nd(start, stop, *, endpoint=False, round=True):
? ----
+ def line_nd(start, stop, *, endpoint=False, integer=True):
? ++++++
start = np.asarray(start)
stop = np.asarray(stop)
npoints = i... | Draw a single-pixel thick line in n dimensions.
The line produced will be ndim-connected. That is, two subsequent
pixels in the line will be either direct or diagonal neighbours in
n dimensions.
Parameters
----------
start : array-like, shape (N,)
The start coordina... | false | false | skimage/draw/draw_nd.py | draw_nd.py | scikit-image | scikit-image |
homeassistant_components_homekit_controller_binary_sensor.py | HomeKitOccupancySensor.is_on | [
{
"version": "v15",
"docstring_lines": {
"start_line": 98,
"end_line": 100
},
"code_lines": {
"start_line": 100,
"end_line": 100
},
"commit_date_time": "2020-02-25 22:01:03",
"commit_sha": "4a89fba6f9a2f7b5db1247032fcae4b93d0bbf49",
"commit_message": "Add home... | def is_on(self):
- return self._state == 1
+ return self.service.value(CharacteristicsTypes.OCCUPANCY_DETECTED) == 1 | - Return true if smoke is currently detected.
? -- ^^
+ Return true if occupancy is currently detected.
? ^^^^^^^^
| false | false | homeassistant/components/homekit_controller/binary_sensor.py | binary_sensor.py | core | home-assistant |
python_ray_client_builder.py | _LocalClientBuilder.connect | [
{
"version": "v12",
"docstring_lines": {
"start_line": 145,
"end_line": 145
},
"code_lines": {
"start_line": 146,
"end_line": 182
},
"commit_date_time": "2021-07-15 04:45:46",
"commit_sha": "bd9d7bbbaa7c07cd38cb22b6af6c8d78e5d5cb15",
"commit_message": "[client... | def connect(self) -> ClientContext:
connection_dict = ray.init(
- address=self.address,
- job_config=self._job_config,
? ^
+ address=self.address, job_config=self._job_config)
? ++++++++++... | - Begin a connection to the address passed in via ray.client(...) or
? ---
+ Begin a connection to the address passed in via ray.client(...)
- ray.init("local://...") | false | false | python/ray/client_builder.py | client_builder.py | ray | ray-project |
python_ray_client_builder.py | client | [
{
"version": "v19",
"docstring_lines": {
"start_line": 237,
"end_line": 237
},
"code_lines": {
"start_line": 238,
"end_line": 264
},
"commit_date_time": "2021-10-27 01:58:02",
"commit_sha": "6bd49a8cd5a66476ec4ce059ed085f031f478a6c",
"commit_message": "[runtim... | - def client(address: Optional[str] = None) -> ClientBuilder:
? ^^^^^^^^^^^^^^^^^^^
+ def client(address: Optional[str] = None,
? ^
+ _deprecation_warn_enabled: bool = True) -> ClientBuilder:
env_addr... | Creates a ClientBuilder based on the provided address. The address can be
of the following forms:
* None: Connects to or creates a local cluster and connects to it.
* ``"local"``: Creates a new cluster locally and connects to it.
* ``"IP:Port"``: Connects to a Ray Client Server ... | false | false | python/ray/client_builder.py | client_builder.py | ray | ray-project |
Lib_dis.py | findlinestarts | [
{
"version": "v150",
"docstring_lines": {
"start_line": 755,
"end_line": 759
},
"code_lines": {
"start_line": 759,
"end_line": 765
},
"commit_date_time": "2023-08-16 22:25:18",
"commit_sha": "665a4391e10167dad1c854fb604c86f336fcd331",
"commit_message": "gh-105... | def findlinestarts(code):
- lastline = None
+
+ lastline = False # None is a valid line number
for start, end, line in code.co_lines():
- if line is not None and line != lastline:
? -----------------
+ if line is not lastline:
lastline ... | Find the offsets in a byte code which are start of lines in the source.
Generate pairs (offset, lineno)
+ lineno will be an integer or None the offset does not have a source line. | false | false | Lib/dis.py | dis.py | cpython | python |
Lib_dis.py | get_instructions | [
{
"version": "v76",
"docstring_lines": {
"start_line": 210,
"end_line": 218
},
"code_lines": {
"start_line": 218,
"end_line": 224
},
"commit_date_time": "2013-08-24 14:48:17",
"commit_sha": "095668914c38c03760aaf6f2cbe04c0bb1aead51",
"commit_message": "Close #... | - def get_instructions(x, *, line_offset=0):
? ^ ^^^ ---
+ def get_instructions(x, *, first_line=None):
? ++++++ ^^ ^
co = _get_code_object(x)
cell_names = co.co_cellvars + co.co_freevars
linestarts = dict(findlinestarts(co))... | Iterator for the opcodes in methods, functions or code
Generates a series of Instruction named tuples giving the details of
each operations in the supplied code.
- The given line offset is added to the 'starts_line' attribute of any
- instructions that start a new line.
+ If *first_line*... | false | false | Lib/dis.py | dis.py | cpython | python |
Lib_dis.py | _get_code_object | [
{
"version": "v93",
"docstring_lines": {
"start_line": 109,
"end_line": 111
},
"code_lines": {
"start_line": 111,
"end_line": 123
},
"commit_date_time": "2017-06-11 11:09:39",
"commit_sha": "1efbf92e90ed2edf3f5bb5323340b26f318ff61e",
"commit_message": "bpo-118... | def _get_code_object(x):
+ # Extract functions from methods.
- if hasattr(x, '__func__'): # Method
? ---------
+ if hasattr(x, '__func__'):
x = x.__func__
+ # Extract compiled code objects from...
- if hasattr(x, '__code__'): # Function
? ... | - Helper to handle methods, functions, generators, strings and raw code objects
+ Helper to handle methods, compiled or raw code objects, and strings. | false | false | Lib/dis.py | dis.py | cpython | python |
Lib_dis.py | Instruction._disassemble | [
{
"version": "v157",
"docstring_lines": {
"start_line": 467,
"end_line": 469
},
"code_lines": {
"start_line": 469,
"end_line": 470
},
"commit_date_time": "2023-11-24 18:13:25",
"commit_sha": "9eb3b35dd7d72ff73005abf20266a618215b9ae0",
"commit_message": "gh-112... | - def _disassemble(self, lineno_width=3, mark_as_current=False, offset_width=0):
? ^^
+ def _disassemble(self, lineno_width=3, mark_as_current=False, offset_width=0,
? ... | Format instruction details for inclusion in disassembly output.
*lineno_width* sets the width of the line number field (0 omits it)
*mark_as_current* inserts a '-->' marker arrow as part of the line
*offset_width* sets the width of the instruction offset field
+ *label_width* ... | false | false | Lib/dis.py | dis.py | cpython | python |
Lib_dis.py | _get_const_info | [
{
"version": "v110",
"docstring_lines": {
"start_line": 377,
"end_line": 385
},
"code_lines": {
"start_line": 385,
"end_line": 438
},
"commit_date_time": "2021-09-14 09:09:05",
"commit_sha": "c99fc4e53a60084df88ac5c69b3b13bc033677e1",
"commit_message": "bpo-45... | - def _get_const_info(const_index, const_list):
+ def _get_const_info(op, arg, co_consts):
- if const_list is not None:
- argval = const_list[const_index]
+ argval = _get_const_value(op, arg, co_consts)
+ argrepr = repr(argval) if argval is not UNKNOWN else ''
- return argval, ... | Helper to get optional details about const references
- Returns the dereferenced constant and its repr if the constant
? ^^^^^ ^^
+ Returns the dereferenced constant and its repr if the value
? ... | false | false | Lib/dis.py | dis.py | cpython | python |
Lib_dis.py | Formatter.__init__ | [
{
"version": "v160",
"docstring_lines": {
"start_line": 413,
"end_line": 415
},
"code_lines": {
"start_line": 415,
"end_line": 463
},
"commit_date_time": "2023-12-13 12:00:21",
"commit_sha": "428c9812cb4ff3521e5904719224fe63fba5370a",
"commit_message": "gh-112... | def __init__(self, file=None, lineno_width=0, offset_width=0, label_width=0,
- line_offset=0):
+ line_offset=0, show_caches=False):
? +++++++++++++++++++
+
self.file = file
self.lineno_width =... | Create a Formatter
*file* where to write the output
*lineno_width* sets the width of the line number field (0 omits it)
*offset_width* sets the width of the instruction offset field
*label_width* sets the width of the label field
+ *show_caches* is a boolean indicati... | false | false | Lib/dis.py | dis.py | cpython | python |
readthedocs_projects_tasks_builds.py | UpdateDocsTask.store_build_artifacts | [
{
"version": "v80",
"docstring_lines": {
"start_line": 778,
"end_line": 792
},
"code_lines": {
"start_line": 792,
"end_line": 864
},
"commit_date_time": "2022-11-14 09:25:05",
"commit_sha": "e5c1d5b56823e0595be1daf218c0f85ab49fcd11",
"commit_message": "Build: ... | - def store_build_artifacts(
+ def store_build_artifacts(self):
? ++++++
- self,
- html=False,
- localmedia=False,
- search=False,
- pdf=False,
- epub=False,
- ):
log.info('W... | Save build artifacts to "storage" using Django's storage API.
The storage could be local filesystem storage OR cloud blob storage
such as S3, Azure storage or Google Cloud Storage.
Remove build artifacts of types not included in this build (PDF, ePub, zip only).
-
- :param... | false | false | readthedocs/projects/tasks/builds.py | builds.py | readthedocs.org | readthedocs |
readthedocs_projects_tasks_builds.py | UpdateDocsTask.get_valid_artifact_types | [
{
"version": "v96",
"docstring_lines": {
"start_line": 539,
"end_line": 551
},
"code_lines": {
"start_line": 551,
"end_line": 600
},
"commit_date_time": "2023-06-22 23:24:22",
"commit_sha": "5508303484cc72e6244633ef1a1ad5e48b6a98b1",
"commit_message": "Use pro... | def get_valid_artifact_types(self):
valid_artifacts = []
for artifact_type in ARTIFACT_TYPES:
artifact_directory = self.data.project.artifact_path(
version=self.data.version.slug,
type_=artifact_type,
... | Return a list of all the valid artifact types for this build.
It performs the following checks on each output format type path:
- it exists
- it is a directory
- does not contains more than 1 files (only PDF, HTMLZip, ePUB)
+ - it contains an "index.html" file at... | false | false | readthedocs/projects/tasks/builds.py | builds.py | readthedocs.org | readthedocs |
libs_community_langchain_community_vectorstores_clarifai.py | Clarifai.from_documents | [
{
"version": "v16",
"docstring_lines": {
"start_line": 279,
"end_line": 291
},
"code_lines": {
"start_line": 291,
"end_line": 301
},
"commit_date_time": "2024-01-11 03:33:10",
"commit_sha": "9e1ed17bfbfd6d1074d907268b684486bbeef8ed",
"commit_message": "Communi... | def from_documents(
cls,
documents: List[Document],
embedding: Optional[Embeddings] = None,
user_id: Optional[str] = None,
app_id: Optional[str] = None,
number_of_docs: Optional[int] = None,
pat: Optional[str] = None,
+ token: Optional[str]... | Create a Clarifai vectorstore from a list of documents.
Args:
user_id (str): User ID.
app_id (str): App ID.
documents (List[Document]): List of documents to add.
- number_of_docs (Optional[int]): Number of documents to return
? ... | false | false | libs/community/langchain_community/vectorstores/clarifai.py | clarifai.py | langchain | langchain-ai |
tests_test_redirect.py | test_chained_redirect | [
{
"version": "v1",
"docstring_lines": {
"start_line": 90,
"end_line": 92
},
"code_lines": {
"start_line": 92,
"end_line": 97
},
"commit_date_time": "2017-02-05 04:57:04",
"commit_sha": "a15ee3ad0667193fa358cfd8293d6e758413bb5e",
"commit_message": "Fix sanic_en... | def test_chained_redirect(redirect_app):
- request, response = sanic_endpoint_test(redirect_app, uri='/1')
+ request, response = redirect_app.test_client.get('/1')
assert request.url.endswith('/1')
assert response.status == 200
assert response.text == 'OK'
assert response.url.en... | - Test sanic_endpoint_test is working for redirection
? ---------------
+ Test test_client is working for redirection
? +++++++
| false | false | tests/test_redirect.py | test_redirect.py | sanic | sanic-org |
scripts_fsmedia.py | Utils.rotate_image_by_angle | [
{
"version": "v5",
"docstring_lines": {
"start_line": 27,
"end_line": 29
},
"code_lines": {
"start_line": 29,
"end_line": 32
},
"commit_date_time": "2018-05-16 22:40:15",
"commit_sha": "f8bf47ad431706553ad853402f009763400c50b6",
"commit_message": "Refactor lib... | - def rotate_image_by_angle(image, angle, rotated_width=None, rotated_height=None):
+ def rotate_image_by_angle(image, angle,
+ rotated_width=None, rotated_height=None):
height, width = image.shape[:2]
image_center = (width/2, height/2)
rotation_m... | - Rotate an image by a given angle. From:
? ------
+ Rotate an image by a given angle.
- https://stackoverflow.com/questions/22041699
+ From: https://stackoverflow.com/questions/22041699
? ++++++
+
- This is required by both Faces and Im... | false | false | scripts/fsmedia.py | fsmedia.py | faceswap | deepfakes |
scripts_fsmedia.py | Alignments.load | [
{
"version": "v42",
"docstring_lines": {
"start_line": 349,
"end_line": 351
},
"code_lines": {
"start_line": 351,
"end_line": 365
},
"commit_date_time": "2019-12-10 02:01:20",
"commit_sha": "ef03be17064a7653fef41f62c7cd789596dfec8a",
"commit_message": "Update ... | def load(self):
-
? -
+
+
data = dict()
- if not self.is_extract:
+ if not self._is_extract:
? +
if not self.have_alignments_file:
return data
data = super().load()
return... | - Override parent loader to handle skip existing on extract
+ Override the parent :func:`~lib.alignments.Alignments.load` to handle skip existing
+ frames and faces on extract.
+
+ If skip existing has been selected, existing alignments are loaded and returned to the
+ calling script.
+
+ ... | false | false | scripts/fsmedia.py | fsmedia.py | faceswap | deepfakes |
scripts_fsmedia.py | DebugLandmarks.process | [
{
"version": "v49",
"docstring_lines": {
"start_line": 202,
"end_line": 209
},
"code_lines": {
"start_line": 209,
"end_line": 220
},
"commit_date_time": "2022-08-23 18:19:16",
"commit_sha": "9e503bdaa2bfe2baaea50ad2e4bf742f309d9d10",
"commit_message": "bugfix:... | - def process(self, extract_media):
+ def process(self, extract_media: "ExtractMedia") -> None:
frame = os.path.splitext(os.path.basename(extract_media.filename))[0]
for idx, face in enumerate(extract_media.detected_faces):
if not self._face_size:
... | Draw landmarks on a face.
Parameters
----------
extract_media: :class:`~plugins.extract.pipeline.ExtractMedia`
The :class:`~plugins.extract.pipeline.ExtractMedia` object that contains the faces to
draw the landmarks on to
-
- Returns
- ----... | false | false | scripts/fsmedia.py | fsmedia.py | faceswap | deepfakes |
scripts_fsmedia.py | Images.get_input_images | [
{
"version": "v11",
"docstring_lines": {
"start_line": 136,
"end_line": 138
},
"code_lines": {
"start_line": 138,
"end_line": 146
},
"commit_date_time": "2018-12-04 13:31:49",
"commit_sha": "7f5391145318ebe8012818eb810070e76be7e3b7",
"commit_message": "Logging... | def get_input_images(self):
+ if self.is_video:
+ input_images = self.args.input_dir
+ else:
- if not os.path.exists(self.args.input_dir):
- logger.error("Input directory %s not found.", self.args.input_dir)
- exit(1)
-
- logger.info("I... | - Return the list of images that are to be processed
? ^^^
+ Return the list of images or video file that is to be processed
? ++++++++++++++ ^^
| false | false | scripts/fsmedia.py | fsmedia.py | faceswap | deepfakes |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.