complexity
int64
1
56
n_identifiers
int64
1
114
code
stringlengths
19
12.7k
path
stringlengths
8
134
n_ast_nodes
int64
12
2.35k
ast_errors
stringlengths
0
4.01k
repo
stringlengths
3
28
documentation
dict
n_words
int64
2
866
language
stringclasses
1 value
vocab_size
int64
2
323
commit_id
stringlengths
40
40
file_name
stringlengths
5
79
id
int64
243
338k
nloc
int64
1
228
token_counts
int64
5
1.4k
fun_name
stringlengths
1
77
url
stringlengths
31
60
commit_message
stringlengths
3
15.3k
n_whitespaces
int64
1
3.23k
n_ast_errors
int64
0
20
d_id
int64
74
121k
ast_levels
int64
4
29
1
15
def from_db(cls, db, field_names, values): instance = super().from_db(db, field_names, values) instance._orig_termination_a_type_id = instance.termination_a_type_id instance._orig_termination_a_ids = instance.termination_a_ids instance._orig_termination_b_type_id = instance.ter...
netbox/dcim/models/cables.py
87
netbox
{ "docstring": "\n Cache the original A and B terminations of existing Cable instances for later reference inside clean().\n ", "language": "en", "n_whitespaces": 31, "n_words": 16, "vocab_size": 16 }
24
Python
18
4bb9b6ee2639db683b70d6ddbee055497e0a3647
cables.py
264,750
7
56
from_db
https://github.com/netbox-community/netbox.git
Extend Cable model to support multiple A/B terminations
73
0
77,794
10
1
3
def expand_dims(v, dims): return v[(...,) + (None,) * (dims - 1)]
ldm/models/diffusion/dpm_solver/dpm_solver.py
42
stablediffusion
{ "docstring": "\n Expand the tensor `v` to the dim `dims`.\n Args:\n `v`: a PyTorch tensor with shape [N].\n `dim`: a `int`.\n Returns:\n a PyTorch tensor with shape [N, 1, 1, ..., 1] and the total dimension is `dims`.\n ", "language": "en", "n_whitespaces": 70, "n_words": 36, ...
11
Python
11
ca86da3a30c4e080d4db8c25fca73de843663cb4
dpm_solver.py
157,367
2
27
expand_dims
https://github.com/Stability-AI/stablediffusion.git
release more models
17
0
36,907
10
8
26
def test_combined_data_loader_with_max_size_cycle_and_ddp(replace_sampler_ddp, tmpdir): trainer = Trainer(strategy="ddp", accelerator="auto", devices=2, replace_sampler_ddp=replace_sampler_ddp) dataloader = CombinedLoader( {"a": DataLoader(RandomDataset(32, 8), batch_size=1), "b": DataLoader(Rando...
tests/trainer/test_supporters.py
459
lightning
{ "docstring": "This test makes sure distributed sampler has been properly injected in dataloaders when using CombinedLoader\n with ddp and `max_size_cycle` mode.", "language": "en", "n_whitespaces": 22, "n_words": 20, "vocab_size": 20 }
112
Python
57
5b59c951e28ddc8bb884f044b1f46fb54c23a8b8
test_supporters.py
241,651
41
399
test_combined_data_loader_with_max_size_cycle_and_ddp
https://github.com/Lightning-AI/lightning.git
Deprecate `TrainerDataLoadingMixin` and move logic to `DataConnector` (#11282) Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com> Co-authored-by: Aki Nitta <nitta@akihironitta.com> Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
341
0
69,641
18
2
21
def set_pea_parser(parser=None): if not parser: from .base import set_base_parser parser = set_base_parser() from .peapods.base import mixin_base_ppr_parser from .peapods.runtimes.worker import mixin_worker_runtime_parser from .peapods.runtimes.container import mixin_container_run...
jina/parsers/__init__.py
193
jina
{ "docstring": "Set the parser for the Pea\n\n :param parser: an optional existing parser to build upon\n :return: the parser\n ", "language": "en", "n_whitespaces": 27, "n_words": 18, "vocab_size": 14 }
50
Python
35
933415bfa1f9eb89f935037014dfed816eb9815d
__init__.py
9,830
20
113
set_pea_parser
https://github.com/jina-ai/jina.git
feat: star routing (#3900) * feat(proto): adjust proto for star routing (#3844) * feat(proto): adjust proto for star routing * feat(proto): generate proto files * feat(grpc): refactor grpclet interface (#3846) * feat: refactor connection pool for star routing (#3872) * feat(k8s): add more labels to k8s ...
118
0
1,716
10
2
26
def _fd(f): return f.fileno() if hasattr(f, "fileno") else f if os.name == "nt": import msvcrt from ctypes import ( POINTER, Structure, Union, byref, c_int64, c_ulong, c_void_p, sizeof, windll, ) from ctypes.wintypes impo...
django/core/files/locks.py
161
django
{ "docstring": "Get a filedescriptor from something which could be a file or an fd.", "language": "en", "n_whitespaces": 12, "n_words": 13, "vocab_size": 12 }
86
Python
64
9c19aff7c7561e3a82978a272ecdaad40dda5c00
locks.py
204,481
2
21
_fd
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
210
0
50,743
9
1
13
def set_scale_factor(self, scale_factor, unit_system="SI"): sympy_deprecation_warning( f, deprecated_since_version="1.5", active_deprecations_target="deprecated-quantity-methods", ) from sympy.physics.units import UnitSystem unit_system = UnitSystem.ge...
sympy/physics/units/quantities.py
82
sympy
{ "docstring": "\n Quantity.set_scale_factor() is deprecated. Use either\n unit_system.set_quantity_scale_factors() or\n {self}.set_global_relative_scale_factor() instead.\n ", "language": "en", "n_whitespaces": 54, "n_words": 9, "vocab_size": 9 }
18
Python
18
905eb426131ca9542a6b258462d9ae984e5b2563
quantities.py
197,104
13
49
set_scale_factor
https://github.com/sympy/sympy.git
Update the deprecation warnings in sympy.physics.units
85
0
48,341
9
1
9
def trace(self, offset=0, axis1=0, axis2=1, dtype=None): from dask.array.reductions import trace return trace(self, offset=offset, axis1=axis1, axis2=axis2, dtype=dtype)
dask/array/core.py
72
dask
{ "docstring": "Return the sum along diagonals of the array.\n\n Refer to :func:`dask.array.trace` for full documentation.\n\n See Also\n --------\n dask.array.trace : equivalent function\n ", "language": "en", "n_whitespaces": 56, "n_words": 21, "vocab_size": 20 }
16
Python
15
2820bae493a49cb1d0a6e376985c5473b8f04fa8
core.py
156,750
3
51
trace
https://github.com/dask/dask.git
Don't include docs in ``Array`` methods, just refer to module docs (#9244) Co-authored-by: James Bourbeau <jrbourbeau@users.noreply.github.com>
37
0
36,760
8
1
11
async def test_ensure_config_exists_creates_config(hass): assert not os.path.isfile(YAML_PATH) with patch("builtins.print") as mock_print: await config_util.async_ensure_config_exists(hass) assert os.path.isfile(YAML_PATH) assert mock_print.called
tests/test_config.py
80
core
{ "docstring": "Test that calling ensure_config_exists.\n\n If not creates a new config file.\n ", "language": "en", "n_whitespaces": 17, "n_words": 11, "vocab_size": 11 }
16
Python
13
8b38fa58aa45d1809f6900729b4046d6c02c2230
test_config.py
312,785
6
44
test_ensure_config_exists_creates_config
https://github.com/home-assistant/core.git
Bump pytest to 7.0.0 (#65981)
38
0
111,422
11
1
3
def is_even(self): return not self.is_odd
sympy/combinatorics/permutations.py
21
sympy
{ "docstring": "\n Checks if a permutation is even.\n\n Examples\n ========\n\n >>> from sympy.combinatorics import Permutation\n >>> p = Permutation([0, 1, 2, 3])\n >>> p.is_even\n True\n >>> p = Permutation([3, 2, 1, 0])\n >>> p.is_even\n True\n\...
5
Python
5
498015021131af4dbb07eb110e5badaba8250c7b
permutations.py
196,182
2
11
is_even
https://github.com/sympy/sympy.git
Updated import locations
19
0
47,682
7
15
44
def warns(warningcls, *, match='', test_stacklevel=True): # Absorbs all warnings in warnrec with warnings.catch_warnings(record=True) as warnrec: # Hide all warnings but make sure that our warning is emitted warnings.simplefilter("ignore") warnings.filterwarnings("always", match, wa...
sympy/testing/pytest.py
485
sympy
{ "docstring": "\n Like raises but tests that warnings are emitted.\n\n >>> from sympy.testing.pytest import warns\n >>> import warnings\n\n >>> with warns(UserWarning):\n ... warnings.warn('deprecated', UserWarning, stacklevel=2)\n\n >>> with warns(UserWarning):\n ... pass\n Traceback...
229
Python
139
c5aa4e76c9642ebb2cf0fe105e46222b541966b2
pytest.py
196,844
44
263
warns
https://github.com/sympy/sympy.git
Fix the formatting of an error message
718
0
48,214
17
1
3
def precmd(self, line): return line
python3.10.4/Lib/cmd.py
18
XX-Net
{ "docstring": "Hook method executed just before the command line is\n interpreted, but after the input prompt is generated and issued.\n\n ", "language": "en", "n_whitespaces": 33, "n_words": 19, "vocab_size": 17 }
5
Python
5
8198943edd73a363c266633e1aa5b2a9e9c9f526
cmd.py
221,333
2
10
precmd
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
19
0
56,352
6
2
20
async def async_test_home_assistant(loop, load_registries=True): hass = ha.HomeAssistant() store = auth_store.AuthStore(hass) hass.auth = auth.AuthManager(hass, store, {}, {}) ensure_auth_manager_loaded(hass.auth) INSTANCES.append(hass) orig_async_add_job = hass.async_add_job orig_asyn...
tests/common.py
114
core
{ "docstring": "Return a Home Assistant object pointing at test config dir.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
27
Python
22
e1338adf1a27edbc0e3513fa67cd6690c7a8fbc0
common.py
291,337
54
320
async_test_home_assistant
https://github.com/home-assistant/core.git
Allow configuring country and language in core config (#81734) * Allow configuring country and language in core config * Add script for updating list of countries * Use black for formatting * Fix quoting * Move country codes to a separate file * Address review comments * Add generated/countries.py ...
54
0
90,446
9
1
2
def shift(self): return self["shift"]
packages/python/plotly/plotly/graph_objs/layout/_yaxis.py
22
plotly.py
{ "docstring": "\n Moves the axis a given number of pixels from where it would\n have been otherwise. Accepts both positive and negative values,\n which will shift the axis either right or left, respectively.\n If `autoshift` is set to true, then this defaults to a padding\n of -3 i...
4
Python
4
ab7ddd3e8beeb1e70ce46447d26a0715fc92a5b7
_yaxis.py
231,482
2
11
shift
https://github.com/plotly/plotly.py.git
bump plotly.js to 2.17
18
0
62,935
7
2
9
def frame(self, fn_fid_or_fname, ignorekeys=[]): # get the frame info by name or id number if isinstance(fn_fid_or_fname, str): f = self.frame_by_name(fn_fid_or_fname, ignorekeys) else: f = self.frame_by_id(fn_fid_or_fname, ignorekeys) return f
nltk/corpus/reader/framenet.py
72
nltk
{ "docstring": "\n Get the details for the specified Frame using the frame's name\n or id number.\n\n Usage examples:\n\n >>> from nltk.corpus import framenet as fn\n >>> f = fn.frame(256)\n >>> f.name\n 'Medical_specialties'\n >>> f = fn.frame('Medical_specialt...
28
Python
24
8a4cf5d94eb94b6427c5d1d7907ba07b119932c5
framenet.py
42,535
6
45
frame
https://github.com/nltk/nltk.git
Docstring tests (#3050) * fixed pytests * fixed more pytests * fixed more pytest and changed multiline pytest issues fixes for snowball.py and causal.py * fixed pytests (mainly multiline or rounding issues) * fixed treebank pytests, removed test for return_string=True (deprecated) * fixed destructive.py...
85
0
7,597
11
1
5
def _get_cookies_set(self, req, resp): raise NotImplementedError("This method must be implemented by a subclass.")
tests/csrf_tests/tests.py
27
django
{ "docstring": "\n Return a list of the cookie values passed to set_cookie() over the\n course of the request-response.\n ", "language": "en", "n_whitespaces": 38, "n_words": 16, "vocab_size": 13 }
13
Python
13
9c19aff7c7561e3a82978a272ecdaad40dda5c00
tests.py
202,418
2
15
_get_cookies_set
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
27
0
50,120
8
4
11
async def async_update(self) -> None: await self.fido_data.async_update() if (sensor_type := self.entity_description.key) == "balance": if self.fido_data.data.get(sensor_type) is not None: self._attr_native_value = round(self.fido_data.data[sensor_type], 2) e...
homeassistant/components/fido/sensor.py
175
core
{ "docstring": "Get the latest data from Fido and update the state.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
35
Python
27
58b9785485af4b49097707edb7fbcc00c72a3df0
sensor.py
304,562
11
110
async_update
https://github.com/home-assistant/core.git
Improve entity type hints [f] (#77143)
149
0
103,369
17
21
38
def _missing_(cls, value): if not isinstance(value, int): raise ValueError( "%r is not a valid %s" % (value, cls.__qualname__) ) # check boundaries # - value must be in range (e.g. -16 <-> +15, i.e. ~15 <-> 15) # - value must n...
Lib/enum.py
611
cpython
{ "docstring": "\n Create a composite member containing all canonical members present in `value`.\n\n If non-member values are present, result depends on `_boundary_` setting.\n ", "language": "en", "n_whitespaces": 43, "n_words": 21, "vocab_size": 21 }
312
Python
166
acf7403f9baea3ae1119fc6b4a3298522188bf96
enum.py
175,319
62
378
_missing_
https://github.com/python/cpython.git
bpo-40066: [Enum] update str() and format() output (GH-30582) Undo rejected PEP-663 changes: - restore `repr()` to its 3.10 status - restore `str()` to its 3.10 status New changes: - `IntEnum` and `IntFlag` now leave `__str__` as the original `int.__str__` so that str() and format() return the same result ...
1,215
0
41,600
21
1
2
def configuration(self): return []
homeassistant/components/alexa/capabilities.py
18
core
{ "docstring": "Return the configuration object.\n\n Applicable to the ThermostatController, SecurityControlPanel, ModeController, RangeController,\n and EventDetectionSensor.\n ", "language": "en", "n_whitespaces": 34, "n_words": 13, "vocab_size": 12 }
4
Python
4
53245c65238e3009dd1f3412f7f9bef10385f64e
capabilities.py
294,423
2
9
configuration
https://github.com/home-assistant/core.git
Update pylint to 2.13.0 (#68656)
18
0
93,460
6
3
11
def test_get_documents_by_id(self, ds, documents): ds.write_documents(documents) ids = [doc.id for doc in documents] result = {doc.id for doc in ds.get_documents_by_id(ids)} assert set(ids) == result
test/document_stores/test_memory.py
78
haystack
{ "docstring": "\n The base test uses the batch_size param that's not supported\n here, so we override the test case\n ", "language": "en", "n_whitespaces": 39, "n_words": 17, "vocab_size": 15 }
23
Python
18
a15af7f8c3ca504ceaa7c34e8487be2915cd6dc7
test_memory.py
258,280
5
50
test_get_documents_by_id
https://github.com/deepset-ai/haystack.git
refactor: Move `InMemoryDocumentStore` tests to their own class (#3614) * move tests to their own class * move more tests * add specific job * fix test * Update test/document_stores/test_memory.py Co-authored-by: Sara Zan <sara.zanzottera@deepset.ai> Co-authored-by: Sara Zan <sara.zanzottera@deepset....
58
0
75,213
10
2
6
def add_checkpoint_hook(self, args): if args.cpu: original_n_cpus = args.distributed_world_size
doc/source/ray-core/_examples/lm/ray_train.py
31
ray
{ "docstring": "Add a hook to the original save_checkpoint function.\n\n This checks if there are new computational resources available.\n If so, raise exception to restart the training process and\n make use of the new resources.\n ", "language": "en", "n_whitespaces": 61, "n_words"...
8
Python
8
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray_train.py
130,071
8
36
add_checkpoint_hook
https://github.com/ray-project/ray.git
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
33
0
29,088
9
5
21
def addResourceToFile(target_filename, data, resource_kind, lang_id, res_name, logger): max_attempts = 5 for attempt in range(1, max_attempts + 1): update_handle = _openFileWindowsResources(target_filename) _updateWindowsResource(update_handle, resource_kind, res_name, lang_id, data) ...
nuitka/utils/WindowsResources.py
208
Nuitka
{ "docstring": "\nFailed to add resources to file %r in attempt %d.\nDisable Anti-Virus, e.g. Windows Defender for build folders. Retrying after a second of delay.\nFailed to add resources to file %r in attempt %d with error code %d.\nDisable Anti-Virus, e.g. Windows Defender for build folders. Retrying after a secon...
76
Python
55
ed2208484bde4bf78da0712d54ab18c192df7e2e
WindowsResources.py
178,816
32
131
addResourceToFile
https://github.com/Nuitka/Nuitka.git
Onefile: Attempt opening the binary for adding payload up to five seconds * This duplicates code from resource handling, where we needed to do this already, but due to hotfix intention, we don't want to make it as a reusable functionality yet.
390
0
42,833
18
2
10
def test_connection(self) -> Tuple[bool, str]: try: conn = self.get_conn() conn.normalize('.') return True, "Connection successfully tested" except Exception as e: return False, str(e)
airflow/providers/sftp/hooks/sftp.py
78
airflow
{ "docstring": "Test the SFTP connection by calling path with directory", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
22
Python
21
f3aacebe502c4ea5dc2b7d29373539296fa037eb
sftp.py
43,251
8
44
test_connection
https://github.com/apache/airflow.git
Convert sftp hook to use paramiko instead of pysftp (#24512)
87
0
7,889
11
3
2
def test_redirect_exception(self) -> None:
tests/test_server.py
16
synapse
{ "docstring": "\n If the callback raises a RedirectException, it is turned into a 30x\n with the right location.\n ", "language": "en", "n_whitespaces": 38, "n_words": 16, "vocab_size": 14 }
4
Python
4
f1145563f662653e451525032b043d1a58998b6d
test_server.py
248,661
15
95
test_redirect_exception
https://github.com/matrix-org/synapse.git
Extra type annotations in `test_server` (#13124)
11
0
72,408
6
10
21
def __format__(self, fmt): # Support string formatting if not fmt or fmt[-1] == 's': return format(str(self), fmt) # From here on down, support for 'bnXx' global _address_fmt_re if _address_fmt_re is None: import re _address_fmt_re =...
python3.10.4/Lib/ipaddress.py
277
@functools.total_ordering
XX-Net
{ "docstring": "Returns an IP address as a formatted string.\n\n Supported presentation types are:\n 's': returns the IP address as a string (default)\n 'b': converts to binary and returns a zero-padded string\n 'X' or 'x': converts to upper- or lower-case hex and returns a zero-padded str...
115
Python
70
8198943edd73a363c266633e1aa5b2a9e9c9f526
ipaddress.py
218,526
25
141
__format__
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
369
1
55,367
12
1
23
def test_interactive_true_with_dependent_objects(self): post = Post.objects.create(title="post", content_type=self.content_type) # A related object is needed to show that a custom collector with # can_fast_delete=False is needed. ModelWithNullFKToSite.objects.create(post=post) ...
tests/contenttypes_tests/test_management.py
233
django
{ "docstring": "\n interactive mode (the default) deletes stale content types and warns of\n dependent objects.\n ", "language": "en", "n_whitespaces": 35, "n_words": 13, "vocab_size": 13 }
61
Python
50
9c19aff7c7561e3a82978a272ecdaad40dda5c00
test_management.py
202,322
13
134
test_interactive_true_with_dependent_objects
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
178
0
50,068
12
3
17
def test_activity_stream_related(): serializer_related = set( ActivityStream._meta.get_field(field_name).related_model for field_name, stuff in ActivityStreamSerializer()._local_summarizable_fk_fields(None) if hasattr(ActivityStream, field_name) ) models = set(activity_stream_r...
awx/main/tests/unit/api/serializers/test_activity_stream_serializer.py
102
awx
{ "docstring": "\n If this test failed with content in `missing_models`, that means that a\n model has been connected to the activity stream, but the model has not\n been added to the activity stream serializer.\n\n How to fix this:\n Ideally, all models should be in awx.api.serializers.SUMMARIZABLE_FK...
27
Python
22
2d310dc4e50c6f7cd298f9fb8af69da258cd9ea6
test_activity_stream_serializer.py
81,351
10
62
test_activity_stream_related
https://github.com/ansible/awx.git
Optimize object creation by getting fewer empty relationships (#12508) This optimizes the ActivityStreamSerializer by only getting many-to-many relationships that are speculatively non-empty based on information we have in other fields We run this every time we create an object as an on_commit action so it...
69
0
17,190
13
1
1
def test_invalid_scheduler_missing_state_dict():
tests/trainer/optimization/test_optimizers.py
12
lightning
{ "docstring": "Test that custom lr scheduler raises an error if it's missing the state dict.", "language": "en", "n_whitespaces": 13, "n_words": 14, "vocab_size": 14 }
2
Python
2
82c8875f33addb0becd7761c95e9674ccc98c7ee
test_optimizers.py
241,755
10
48
test_invalid_scheduler_missing_state_dict
https://github.com/Lightning-AI/lightning.git
Add `LightningModule.lr_scheduler_step` (#10249) Co-authored-by: Carlos Mocholi <carlossmocholi@gmail.com>
5
0
69,685
6
6
15
def register_for_checkpointing(self, *objects): invalid_objects = [] for obj in objects: if not hasattr(obj, "state_dict") or not hasattr(obj, "load_state_dict"): invalid_objects.append(obj) if len(invalid_objects) > 0: err = "All `objects` must i...
src/accelerate/accelerator.py
149
accelerate
{ "docstring": "\n Makes note of `objects` and will save or load them in during `save_state` or `load_state`.\n\n These should be utilized when the state is being loaded or saved in the same script. It is not designed to be\n used in different scripts\n\n Note: Every `object` must have a `...
58
Python
50
6ffab178accebda485295bddf8eb6bf436ff698f
accelerator.py
337,272
11
79
register_for_checkpointing
https://github.com/huggingface/accelerate.git
Implementation of saving and loading custom states (#270)
167
0
120,989
14
28
33
def get_subsample(train_args, mode, arch): if arch == 'transformer': return np.array([1]) elif mode == 'mt' and arch == 'rnn': # +1 means input (+1) and layers outputs (train_args.elayer) subsample = np.ones(train_args.elayers + 1, dtype=np.int) logging.warning('Subsampling...
ppg2mel/utils/nets_utils.py
897
MockingBird
{ "docstring": "Parse the subsampling factors from the training args for the specified `mode` and `arch`.\n\n Args:\n train_args: argument Namespace containing options.\n mode: one of ('asr', 'mt', 'st')\n arch: one of ('rnn', 'rnn-t', 'rnn_mix', 'rnn_mulenc', 'transformer')\n\n Returns:\n ...
275
Python
96
b617a87ee40ab384767a27335313c2c65ee094ec
nets_utils.py
161,058
49
534
get_subsample
https://github.com/babysor/MockingBird.git
Init ppg extractor and ppg2mel (#375) * Init ppg extractor and ppg2mel * add preprocess and training * FIx known issues * Update __init__.py Allow to gen audio * Fix length issue * Fix bug of preparing fid * Fix sample issues * Add UI usage of PPG-vc
735
0
38,874
19
7
17
def getTreeBuilder(treeType, implementation=None, **kwargs): treeType = treeType.lower() if treeType not in treeBuilderCache: if treeType == "dom": from . import dom # Come up with a sane default (pref. from the stdlib) if implementation is None: ...
.venv/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/__init__.py
211
transferlearning
{ "docstring": "Get a TreeBuilder class for various types of trees with built-in support\n\n :arg treeType: the name of the tree type required (case-insensitive). Supported\n values are:\n\n * \"dom\" - A generic builder for DOM implementations, defaulting to a\n xml.dom.minidom based implem...
103
Python
56
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
__init__.py
62,572
20
123
getTreeBuilder
https://github.com/jindongwang/transferlearning.git
upd; format
320
0
12,996
14
3
7
def getAllExportsAsDict(self, plugin_list=None): if plugin_list is None: # All enabled plugins should be exported plugin_list = self.getPluginsList() return {p: self._plugins[p].get_export() for p in plugin_list}
glances/stats.py
67
glances
{ "docstring": "Return all the stats to be exported (list).\n\n Default behavior is to export all the stat\n if plugin_list is provided, only export stats of given plugin (list)\n ", "language": "en", "n_whitespaces": 48, "n_words": 27, "vocab_size": 21 }
24
Python
23
5ce964bac3a618229f593ad587cb704f783a470f
stats.py
70,057
4
41
getAllExportsAsDict
https://github.com/nicolargo/glances.git
Remove the static exportable_plugins list from glances_export.py #1556" Limiting data exported for economic storage #1443
67
0
15,289
11
1
13
def mixin_client_protocol_parser(parser): from jina.enums import GatewayProtocolType parser.add_argument( '--protocol', type=GatewayProtocolType.from_string, choices=list(GatewayProtocolType), default=GatewayProtocolType.GRPC, help='Communication protocol between s...
jina/parsers/client.py
68
jina
{ "docstring": "Add the arguments for the protocol to the client parser\n\n :param parser: the parser configure\n ", "language": "en", "n_whitespaces": 21, "n_words": 15, "vocab_size": 11 }
18
Python
18
de5942f19db46321d09d31ff62d60ac33e7e43d7
client.py
13,477
9
42
mixin_client_protocol_parser
https://github.com/jina-ai/jina.git
feat: allow multiple port and protocols for gateway (#5378)
65
0
2,665
10
1
10
def test_span_maker_forward_with_empty(): nlp = English() doc1 = nlp("a b c") ent = doc1[0:1] ent.label_ = "X" doc1.ents = [ent] # no entities doc2 = nlp("x y z") # just to get a model span_maker = build_span_maker() span_maker([doc1, doc2], False)
spacy/tests/pipeline/test_entity_linker.py
103
spaCy
{ "docstring": "The forward pass of the span maker may have a doc with no entities.", "language": "en", "n_whitespaces": 13, "n_words": 14, "vocab_size": 14 }
39
Python
32
d61e742960ef230b423dfa157449b291a03bd119
test_entity_linker.py
111,575
9
57
test_span_maker_forward_with_empty
https://github.com/explosion/spaCy.git
Handle Docs with no entities in EntityLinker (#11640) * Handle docs with no entities If a whole batch contains no entities it won't make it to the model, but it's possible for individual Docs to have no entities. Before this commit, those Docs would cause an error when attempting to concatenate arrays because th...
72
0
24,444
9
3
17
def evaluate_accuracy_gpu(net, data_iter, device=None): if not device: # Query the first device where the first parameter is on device = list(net.collect_params().values())[0].list_ctx()[0] # No. of correct predictions, no. of predictions metric = d2l.Accumulator(2) for X, y in data_iter: ...
d2l/mxnet.py
167
d2l-zh
{ "docstring": "Compute the accuracy for a model on a dataset using a GPU.\n\n Defined in :numref:`sec_lenet`", "language": "en", "n_whitespaces": 17, "n_words": 15, "vocab_size": 13 }
49
Python
40
b64b41d8c1ac23c43f7a4e3f9f6339d6f0012ab2
mxnet.py
158,175
8
105
evaluate_accuracy_gpu
https://github.com/d2l-ai/d2l-zh.git
[PaddlePaddle] Merge master into Paddle branch (#1186) * change 15.2 title in chinese version (#1109) change title ’15.2. 情感分析:使用递归神经网络‘ to ’15.2. 情感分析:使用循环神经网络‘ * 修改部分语义表述 (#1105) * Update r0.17.5 (#1120) * Bump versions in installation * 94行typo: (“bert.mall”)->(“bert.small”) (#1129) * line 313: "b...
89
0
37,352
18
5
30
def test_k8s_cpu(): # Some experimentally-obtained K8S CPU usage files for use in test_k8s_cpu. PROCSTAT1 = # noqa PROCSTAT2 = # noqa CPUACCTUSAGE1 = "2268980984108" CPUACCTUSAGE2 = "2270120061999" CPUSHARES = "2048" shares_file, cpu_file, proc_stat_file = [ tempfile.N...
python/ray/tests/test_advanced_3.py
375
ray
{ "docstring": "Test all the functions in dashboard/k8s_utils.py.\n Also test ray._private.utils.get_num_cpus when running in a K8s pod.\n Files were obtained from within a K8s pod with 2 CPU request, CPU limit\n unset, with 1 CPU of stress applied.\n cpu 2945022 98 3329420 148744854 39522 0 118587 0 0 ...
142
Python
93
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
test_advanced_3.py
131,220
66
220
test_k8s_cpu
https://github.com/ray-project/ray.git
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
363
0
29,486
12
1
6
def __getstate__(self) -> Dict[str, Any]: return {} @ExperimentalAPI
rllib/agents/alpha_star/league_builder.py
31
@ExperimentalAPI
ray
{ "docstring": "Returns a state dict, mapping str keys to state variables.\n\n Returns:\n The current state dict of this LeagueBuilder.\n ", "language": "en", "n_whitespaces": 43, "n_words": 18, "vocab_size": 16 }
8
Python
8
0bb82f29b65dca348acf5aa516d21ef3f176a3e1
league_builder.py
147,590
7
16
__getstate__
https://github.com/ray-project/ray.git
[RLlib] AlphaStar polishing (fix logger.info bug). (#22281)
21
1
34,015
6
3
18
def from_euler(cls, angles, seq): if len(angles) != 3: raise ValueError("3 angles must be given.") extrinsic = _check_sequence(seq) i, j, k = seq.lower() q1 = cls.from_axis_angle(_elementary_axis(i), angles[0]) q2 = cls.from_axis_angle(_elementary_axis(j),...
sympy/algebras/quaternion.py
176
sympy
{ "docstring": "Returns quaternion equivalent to Euler angles represented same in\n the sequence defined by `seq`.\n\n Parameters\n ==========\n\n angles : list, tuple or Matrix of 3 numbers\n The Euler angles (in radians).\n seq : string of length 3\n Represen...
49
Python
38
1d8576449e7ab757f13f49a1d33faed602aa88fb
quaternion.py
200,597
12
111
from_euler
https://github.com/sympy/sympy.git
implemented to_euler and from_euler
145
0
49,726
12
1
3
def lookup_pattern(name): return _registered_patterns[name]
python/ray/_private/thirdparty/pathspec/util.py
20
ray
{ "docstring": "\n Lookups a registered pattern factory by name.\n\n *name* (:class:`str`) is the name of the pattern factory.\n\n Returns the registered pattern factory (:class:`~collections.abc.Callable`).\n If no pattern factory is registered, raises :exc:`KeyError`.\n ", "language": "en", "n_wh...
4
Python
4
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
util.py
130,285
2
11
lookup_pattern
https://github.com/ray-project/ray.git
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
10
0
29,210
6
1
7
def save_instance(self): instance = self.form.save() log(instance=instance, action="wagtail.create") return instance
wagtail/admin/views/generic/models.py
48
wagtail
{ "docstring": "\n Called after the form is successfully validated - saves the object to the db\n and returns the new object. Override this to implement custom save logic.\n ", "language": "en", "n_whitespaces": 48, "n_words": 26, "vocab_size": 22 }
9
Python
8
96a0eb0fa0cc0e28bcf5616987d193f6b2fcea82
models.py
77,827
4
27
save_instance
https://github.com/wagtail/wagtail.git
Move logging in generic CreateView and EditView to save_instance() method
37
0
16,712
9
1
10
async def poll_and_get_state(self) -> State: await time_changed(self.hass, 60) await time_changed(self.hass, DEBOUNCE_COOLDOWN) state = self.hass.states.get(self.entity_id) assert state is not None return state
tests/components/homekit_controller/common.py
77
core
{ "docstring": "Trigger a time based poll and return the current entity state.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
21
Python
17
1ded3ac51ebc1915a5026af1998eb119972f6117
common.py
290,620
7
47
poll_and_get_state
https://github.com/home-assistant/core.git
Poll HomeKit Controller locks for state after lock operation (#82058)
63
0
89,734
10
1
5
async def help_test_setup_manual_entity_from_yaml(hass, config): calls = MagicMock()
tests/components/mqtt/test_common.py
25
core
{ "docstring": "Help to test setup from yaml through configuration entry.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
7
Python
7
4894e2e5a43e80a2f64d8f9486c7eb215fcdaa6b
test_common.py
287,415
14
106
help_test_setup_manual_entity_from_yaml
https://github.com/home-assistant/core.git
Refactor common MQTT tests to use modern schema (#77583) * Common tests availability * Common tests attributes * Common tests unique id * Common tests discovery * Common tests encoding * Common tests device info * Common tests entity_id updated * Common tests entity debug info * Common test ent...
13
0
86,608
8
4
8
def random_kernel_graph(n, kernel_integral, kernel_root=None, seed=None): r if kernel_root is None: import scipy as sp import scipy.optimize # call as sp.optimize
networkx/generators/random_graphs.py
47
networkx
{ "docstring": "Returns an random graph based on the specified kernel.\n\n The algorithm chooses each of the $[n(n-1)]/2$ possible edges with\n probability specified by a kernel $\\kappa(x,y)$ [1]_. The kernel\n $\\kappa(x,y)$ must be a symmetric (in $x,y$), non-negative,\n bounded function.\n\n Param...
20
Python
18
2a05ccdb07cff88e56661dee8a9271859354027f
random_graphs.py
176,736
74
143
random_kernel_graph
https://github.com/networkx/networkx.git
Remove redundant py2 numeric conversions (#5661) * Remove redundant float conversion * Remove redundant int conversion * Use integer division Co-authored-by: Miroslav Šedivý <6774676+eumiro@users.noreply.github.com>
40
0
42,069
9
6
8
def prompt_for_move(final_file, **move_params): skip_static_hosts = move_params["skipstatichosts"] if move_params["replace"] and not skip_static_hosts: move_file = True elif move_params["auto"] or skip_static_hosts: move_file = False else: prompt = "Do you want to replace ...
updateHostsFile.py
108
hosts
{ "docstring": "\n Prompt the user to move the newly created hosts file to its designated\n location in the OS.\n\n Parameters\n ----------\n final_file : file\n The file object that contains the newly created hosts data.\n move_params : kwargs\n Dictionary providing additional paramet...
53
Python
41
258b10edc90d53c31225962dde6dcc80b0fc9ba9
updateHostsFile.py
123,270
12
60
prompt_for_move
https://github.com/StevenBlack/hosts.git
refactor: more containerization
108
0
27,313
11
1
15
def test_api_fields(self) -> None: expected_fields = set(Stream.API_FIELDS) | {"stream_id"} expected_fields -= {"id"} stream_dict_fields = set(APIStreamDict.__annotations__.keys()) computed_fields = set(["is_announcement_only", "is_default"]) self.assertEqual(stream_di...
zerver/tests/test_subs.py
183
zulip
{ "docstring": "Verify that all the fields from `Stream.API_FIELDS` and `Subscription.API_FIELDS` present\n in `APIStreamDict` and `APISubscriptionDict`, respectively.\n ", "language": "en", "n_whitespaces": 29, "n_words": 15, "vocab_size": 14 }
73
Python
55
44ecd66eaec6533778bdff3fbb31ceb0acc0419a
test_subs.py
83,879
18
104
test_api_fields
https://github.com/zulip/zulip.git
types: Better types for API fields. Signed-off-by: Zixuan James Li <359101898@qq.com>
211
0
17,743
11
1
5
def log(self) -> Logger: return self.app._logger
src/textual/message_pump.py
25
textual
{ "docstring": "Get a logger for this object.\n\n Returns:\n Logger: A logger.\n ", "language": "en", "n_whitespaces": 35, "n_words": 10, "vocab_size": 10 }
6
Python
6
ca9492ac569510ce0a7e5387f81e763a99c7359e
message_pump.py
184,828
7
14
log
https://github.com/Textualize/textual.git
layout docs
20
0
44,823
7
3
15
def fhash(value): fpart = math.modf(value) if fpart[0] == 0.0: return hash(int(fpart[1])) v, e = math.frexp(value) # 2**31 v *= 2147483648.0 # Top 32 bits hipart = int(v) # Next 32 bits v = (v - float(hipart)) * 2147483648...
samtranslator/third_party/py27hash/hash.py
162
serverless-application-model
{ "docstring": "\n Returns a Python 2.7 hash for a float.\n\n Logic ported from the 2.7 Python branch: cpython/Objects/object.c\n Method: long _Py_HashDouble(double v)\n\n Args:\n value: input float\n\n Returns:\n Python 2.7 hash\n ", "language": "en",...
62
Python
42
a5db070f446b7cfebdaa6ad2e3dcf78f6105a272
hash.py
213,059
12
105
fhash
https://github.com/aws/serverless-application-model.git
fix: Py27hash fix (#2182) * Add third party py27hash code * Add Py27UniStr and unit tests * Add py27hash_fix utils and tests * Add to_py27_compatible_template and tests * Apply py27hash fix to wherever it is needed * Apply py27hash fix, all tests pass except api_with_any_method_in_swagger * apply py2...
182
0
53,613
12
6
43
def forward(self, x, l2_norm=False): with torch.no_grad(): with torch.cuda.amp.autocast(enabled=False): x.squeeze_(1) # if you torch spec compute it otherwise use the mel spec computed by the AP if self.use_torch_spec: x = ...
TTS/speaker_encoder/models/resnet.py
505
TTS
{ "docstring": "Forward pass of the model.\n\n Args:\n x (Tensor): Raw waveform signal or spectrogram frames. If input is a waveform, `torch_spec` must be `True`\n to compute the spectrogram on-the-fly.\n l2_norm (bool): Whether to L2-normalize the outputs.\n\n Shape...
118
Python
68
127118c6378168e3d36a1e5d19ede777fd20684f
resnet.py
261,852
29
320
forward
https://github.com/coqui-ai/TTS.git
Update TTS.tts formatters (#1228) * Return Dict from tts formatters * Make style
416
0
77,033
20
3
14
def _faces_from_frames(self) -> None: logger.debug("Extracting faces from frames: Number images: %s", len(self.source)) if self.update_source: self._crop_source_faces() self._crop_destination_faces() logger.debug("Extracted faces from frames: %s", ...
tools/preview/preview.py
110
faceswap
{ "docstring": " Extract the preview faces from the source frames and apply the requisite padding. ", "language": "en", "n_whitespaces": 14, "n_words": 13, "vocab_size": 11 }
28
Python
24
1022651eb8a7741014f5d2ec7cbfe882120dfa5f
preview.py
101,408
8
65
_faces_from_frames
https://github.com/deepfakes/faceswap.git
Bugfix: convert - Gif Writer - Fix non-launch error on Gif Writer - convert plugins - linting - convert/fs_media/preview/queue_manager - typing - Change convert items from dict to Dataclass
94
0
20,822
13
1
27
def test_deleted_message(self) -> None: user_profile = self.example_user("hamlet") message = self.get_message(Recipient.PERSONAL, type_id=1) UserMessage.objects.create( user_profile=user_profile, flags=UserMessage.flags.read, message=message, ...
zerver/tests/test_push_notifications.py
229
zulip
{ "docstring": "Simulates the race where message is deleted before handling push notifications", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
78
Python
65
b0ce4f1bce8031881addecb1e86073483517f392
test_push_notifications.py
83,262
23
132
test_deleted_message
https://github.com/zulip/zulip.git
docs: Fix many spelling mistakes. Signed-off-by: Anders Kaseorg <anders@zulip.com>
308
0
17,643
11
5
25
def get_abstract_dependencies(reqs, sources=None, parent=None): deps = [] from .requirements import Requirement for req in reqs: if isinstance(req, shims.InstallRequirement): requirement = Requirement.from_line("{0}{1}".format(req.name, req.specifier)) if req.link: ...
pipenv/vendor/requirementslib/models/dependencies.py
238
pipenv
{ "docstring": "Get all abstract dependencies for a given list of requirements.\n\n Given a set of requirements, convert each requirement to an Abstract Dependency.\n\n :param reqs: A list of Requirements\n :type reqs: list[:class:`~requirementslib.models.requirements.Requirement`]\n :param sources: Pipfi...
56
Python
40
cd5a9683be69c86c8f3adcd13385a9bc5db198ec
dependencies.py
22,218
19
149
get_abstract_dependencies
https://github.com/pypa/pipenv.git
Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir.
225
0
4,264
15
1
12
def special_library_payload(parent_payload, special_type): title = f"{special_type} ({parent_payload.title})" special_library_id = f"{parent_payload.media_content_id}/{special_type}" return BrowseMedia( title=title, media_class=parent_payload.media_class, media_content_id=specia...
homeassistant/components/plex/media_browser.py
102
core
{ "docstring": "Create response payload for special library folders.", "language": "en", "n_whitespaces": 6, "n_words": 7, "vocab_size": 7 }
20
Python
19
653305b998dd033365576db303b32dd5df3a6c54
media_browser.py
294,023
12
54
special_library_payload
https://github.com/home-assistant/core.git
Support multiple Plex servers in media browser (#68321)
84
0
93,067
9
8
15
def acl_update(consul_url=None, token=None, **kwargs): ret = {} data = {} if not consul_url: consul_url = _get_config() if not consul_url: log.error("No Consul URL found.") ret["message"] = "No Consul URL found." ret["res"] = False return ...
salt/modules/consul.py
390
salt
{ "docstring": "\n Update an ACL token.\n\n :param consul_url: The Consul server URL.\n :param name: Meaningful indicator of the ACL's purpose.\n :param id: Unique identifier for the ACL to update.\n :param type: Type is either client or management. A management\n token is comparable to...
116
Python
63
fb825aa760fa0585a2c8fdafc6e62be8aec8cecf
consul.py
215,759
35
212
acl_update
https://github.com/saltstack/salt.git
[merge jam] Master port 49261 - consul modules (#58101) * add consul states and acl function present/absent * add consul to states doc index * refact/fix consul states * fix doc, fix states * fix name parameter for acl_changes * fixing pylint errors * small changes after review by @rallytime * fix...
313
0
54,153
13
1
13
def _reset(self) -> None: self._reset_slots() self._paused = False self.latest_action = {} self.latest_message = UserUttered.empty() self.latest_bot_utterance = BotUttered.empty() self.followup_action = ACTION_LISTEN_NAME self.active_loop = None
rasa/shared/core/trackers.py
89
rasa
{ "docstring": "Reset tracker to initial state - doesn't delete events though!.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
23
Python
18
e798bf049f036a5865c14d4343ed8a833864aabe
trackers.py
159,567
9
52
_reset
https://github.com/RasaHQ/rasa.git
convert TrackerActiveLoop to a dataclass
79
0
38,339
8
42
63
def resolve_type_hint(hint) -> Any: origin, args = _get_type_hint_origin(hint) excluded_fields = get_override(hint, "exclude_fields", []) if origin is None and is_basic_type(hint, allow_none=False): return build_basic_type(hint) elif origin is None and inspect.isclass(hint) and issubclass(...
src/sentry/apidocs/spectacular_ports.py
895
sentry
{ "docstring": "drf-spectacular library method modified as described above", "language": "en", "n_whitespaces": 6, "n_words": 7, "vocab_size": 7 }
284
Python
148
286bf2ae7ecfdd6698d8fb1cd4753f107159d4d2
spectacular_ports.py
86,529
67
569
resolve_type_hint
https://github.com/getsentry/sentry.git
ref: use dict instead of OrderedDict since sentry is >python3.6 (#39695) partially automated (especially the fixtures) also via `\(([^]+), (.*)\),$` -> `\1: \2,`
788
0
18,119
17
1
21
def test_mark_checked_unexpected_exception(self, mock_patch_already_checked, mock_delete_pod): k = KubernetesPodOperator( namespace="default", image="ubuntu:16.04", name="test", task_id="task", is_delete_operator_pod=False, ) s...
tests/providers/cncf/kubernetes/operators/test_kubernetes_pod.py
133
airflow
{ "docstring": "If we aren't deleting pods and have an exception, mark it so we don't reattach to it", "language": "en", "n_whitespaces": 16, "n_words": 17, "vocab_size": 15 }
24
Python
22
c3d883a971a8e4e65ccc774891928daaaa0f4442
test_kubernetes_pod.py
47,750
14
77
test_mark_checked_unexpected_exception
https://github.com/apache/airflow.git
KubernetesPodOperator should patch "already checked" always (#22734) When not configured to delete pods, at end of task execution the current behavior is to patch the pod as "already checked", but only if pod not successful. We should also patch when successful so it isn't "reattached" to after a task clear.
146
0
9,243
10
5
29
def batch_test(num_threads, delay): with mock.patch( "ray.autoscaler._private.aws.node_provider.make_ec2_client" ), mock.patch.object(AWSNodeProvider, "_create_tags", mock_create_tags): provider = AWSNodeProvider( provider_config={"region": "nowhere"}, cluster_name="default" ...
python/ray/tests/aws/test_aws_batch_tag_update.py
256
ray
{ "docstring": "Run AWSNodeProvider.set_node_tags in several threads, with a\n specified delay between thread launches.\n\n Return the number of batches of tag updates and the number of tags\n updated.\n ", "language": "en", "n_whitespaces": 38, "n_words": 26, "vocab_size": 22 }
61
Python
43
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
test_aws_batch_tag_update.py
131,087
22
154
batch_test
https://github.com/ray-project/ray.git
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
239
0
29,474
17
9
7
def validate_config(self, config): # Call (base) PPO's config validation function first. # Note that this will not touch or check on the train_batch_size=-1 # setting. super().validate_config(config) # Error if run on Win. if sys.platform in ["win32", "cygwin"]:...
rllib/agents/ppo/ddppo.py
306
ray
{ "docstring": "Validates the Trainer's config dict.\n\n Args:\n config (TrainerConfigDict): The Trainer's config to check.\n\n Raises:\n ValueError: In case something is wrong with the config.\n ", "language": "en", "n_whitespaces": 66, "n_words": 23, "vocab_size": ...
264
Python
168
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ddppo.py
133,790
34
152
validate_config
https://github.com/ray-project/ray.git
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
743
0
30,109
12
1
14
def binary_accuracy(y_true, y_pred, threshold=0.5): y_pred = tf.convert_to_tensor(y_pred) threshold = tf.cast(threshold, y_pred.dtype) y_pred = tf.cast(y_pred > threshold, y_pred.dtype) return tf.cast(tf.equal(y_true, y_pred), tf.int8) @keras_export('keras.metrics.categorical_accuracy') @tf.__internal__.di...
keras/metrics/metrics.py
121
@keras_export('keras.metrics.categorical_accuracy') @tf.__internal__.dispatch.add_dispatch_support
keras
{ "docstring": "Calculates how often predictions match binary labels.\n\n Standalone usage:\n >>> y_true = [[1], [1], [0], [0]]\n >>> y_pred = [[1], [1], [0], [0]]\n >>> m = tf.keras.metrics.binary_accuracy(y_true, y_pred)\n >>> assert m.shape == (4,)\n >>> m.numpy()\n array([1., 1., 1., 1.], dtype=float32)\n\...
23
Python
19
b96f9fdc2d5d0d375809ad9c16608830b01fc59a
metrics.py
268,902
5
66
binary_accuracy
https://github.com/keras-team/keras.git
fix sample_weight for BinAcc
26
1
79,763
9
3
9
def update(self) -> None: self.data.update() if (value := self.data.value) is None: value = STATE_UNKNOWN if self._value_template is not None: value = self._value_template.render_with_possible_json_value( str(value), STATE_UNKNOWN ) ...
homeassistant/components/influxdb/sensor.py
96
core
{ "docstring": "Get the latest data from Influxdb and updates the states.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
28
Python
19
23090cb8a268b3f268aefa8477f30af88bf46051
sensor.py
305,137
10
59
update
https://github.com/home-assistant/core.git
Improve entity type hints [i] (#77529)
111
0
103,929
12
7
16
def get_stack(self, f, t): stack = [] if t and t.tb_frame is f: t = t.tb_next while f is not None: stack.append((f, f.f_lineno)) if f is self.botframe: break f = f.f_back stack.reverse() i = max(0, len(stack...
python3.10.4/Lib/bdb.py
195
XX-Net
{ "docstring": "Return a list of (frame, lineno) in a stack trace and a size.\n\n List starts with original calling frame, if there is one.\n Size may be number of frames above or below f.\n ", "language": "en", "n_whitespaces": 54, "n_words": 33, "vocab_size": 30 }
61
Python
33
8198943edd73a363c266633e1aa5b2a9e9c9f526
bdb.py
221,146
17
124
get_stack
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
216
0
56,241
13
8
22
def _generate_graph6_bytes(G, nodes, header): n = len(G) if n >= 2**36: raise ValueError( "graph6 is only defined if number of nodes is less " "than 2 ** 36" ) if header: yield b">>graph6<<" for d in n_to_data(n): yield str.encode(chr(d + 63)) # This ...
networkx/readwrite/graph6.py
237
networkx
{ "docstring": "Yield bytes in the graph6 encoding of a graph.\n\n `G` is an undirected simple graph. `nodes` is the list of nodes for\n which the node-induced subgraph will be encoded; if `nodes` is the\n list of all nodes in the graph, the entire graph will be\n encoded. `header` is a Boolean that speci...
107
Python
75
f6755ffa00211b523c6c0bec5398bc6c3c43c8b1
graph6.py
176,498
17
147
_generate_graph6_bytes
https://github.com/networkx/networkx.git
Update black (#5438) * CI: sync up black dev requirements version with precommit * Run black Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
200
0
41,937
13
4
13
def set_constrained_layout(self, constrained): if constrained is None: constrained = mpl.rcParams['figure.constrained_layout.use'] _constrained = bool(constrained) _parameters = constrained if isinstance(constrained, dict) else {} if _constrained: self.se...
lib/matplotlib/figure.py
96
matplotlib
{ "docstring": "\n Set whether ``constrained_layout`` is used upon drawing. If None,\n :rc:`figure.constrained_layout.use` value will be used.\n\n When providing a dict containing the keys ``w_pad``, ``h_pad``\n the default ``constrained_layout`` paddings will be\n overridden. Thes...
27
Python
20
ec4dfbc3c83866f487ff0bc9c87b0d43a1c02b22
figure.py
107,135
8
58
set_constrained_layout
https://github.com/matplotlib/matplotlib.git
ENH: implement and use base layout_engine for more flexible layout.
91
0
22,600
12
4
13
def decrypt_file(self, file, key): # precondition assert isinstance(file, str) and isinstance(key, int) try: with open(file, "r") as fin: with open("decrypt.out", "w+") as fout: # actual encrypt-process for line in fi...
XORcipher/XOR_cipher.py
141
Python
{ "docstring": "\n input: filename (str) and a key (int)\n output: returns true if decrypt process was\n successful otherwise false\n if key not passed the method uses the key by the constructor.\n otherwise key = 1\n ", "language": "en", "n_whitespaces": 76, "n_words":...
106
Python
60
f0af0c43340763724f139fa68aa1e5a9ffe458b4
XOR_cipher.py
22,541
10
70
decrypt_file
https://github.com/geekcomputers/Python.git
refactor: clean code Signed-off-by: slowy07 <slowy.arfy@gmail.com>
227
0
4,357
17
5
16
def cast_if_floating_dtype_and_mismatch(targets, outputs): if tf.is_tensor(targets): # There is one target, so output[0] should be the only output. return cast_single_tensor(targets, dtype=outputs[0].dtype) new_targets = [] for target, out in zip(targets, outputs): if isinstance...
keras/engine/training_utils_v1.py
155
keras
{ "docstring": "Returns target data tensors using correct datatype.\n\n Checks that each target and output pair are the same datatype. If not, casts\n the target to the output's datatype.\n\n Args:\n targets: tensor or list of targets.\n outputs: tensor or list of outputs.\n\n Returns:\n Ta...
45
Python
38
84afc5193d38057e2e2badf9c889ea87d80d8fbf
training_utils_v1.py
271,870
12
98
cast_if_floating_dtype_and_mismatch
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
128
0
80,881
15
1
11
def _get_font(self, prop): filenames = _fontManager._find_fonts_by_props(prop) font = get_font(filenames) font.set_size(self.FONT_SCALE, self.DPI) return font
lib/matplotlib/textpath.py
59
matplotlib
{ "docstring": "\n Find the `FT2Font` matching font properties *prop*, with its size set.\n ", "language": "en", "n_whitespaces": 26, "n_words": 11, "vocab_size": 11 }
13
Python
11
140257e3ac710450c97587f95532a84a28cc526c
textpath.py
109,212
5
36
_get_font
https://github.com/matplotlib/matplotlib.git
ENH: add font fallback support to svg
48
0
23,478
8
4
26
def call_hm(self, other_args): parser = argparse.ArgumentParser( prog="hm", add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, description=, ) parser.add_argument( "-l", "--limit", ...
openbb_terminal/cryptocurrency/overview/overview_controller.py
225
OpenBBTerminal
{ "docstring": "Process hm commandDisplay cryptocurrencies heatmap with daily percentage change [Source: https://coingecko.com]\n Accepts --category or -c to display only coins of a certain category\n (default no category to display all coins ranked by market cap).\n You can look on o...
57
Python
50
5bc7bc070ed7c9051b1277d0db21299fd310d42b
overview_controller.py
285,746
37
139
call_hm
https://github.com/OpenBB-finance/OpenBBTerminal.git
Tests over API Best Practices (#2344) * Started new tests * Added special function * Improved dict * Finished new test * Got bad functions to 75 * Got bad func to 73 * Bad func down to 60 * Bad func down to 50 * Bad func down to 35 * Got bad func to 30 * No more bad functions * Added t...
388
0
85,414
11
5
17
def create_system_audit_entry(transaction_id=None, logger=None, **kwargs): entry = AuditLogEntry(actor_label="Sentry", **kwargs) if entry.event is not None: entry.save_or_write_to_kafka() extra = { "organization_id": entry.organization_id, "object_id": entry.target_object, ...
src/sentry/utils/audit.py
202
sentry
{ "docstring": "\n Creates an audit log entry for events that are triggered by Sentry's\n systems and do not have an associated Sentry user as the \"actor\".\n ", "language": "en", "n_whitespaces": 34, "n_words": 24, "vocab_size": 23 }
66
Python
46
941184cd24186324fd9f7f304b7f713041834726
audit.py
86,879
18
123
create_system_audit_entry
https://github.com/getsentry/sentry.git
chore(hybrid-cloud): AuditLogEntry is a control silo model now (#39890) In the control silo, creating an audit log entry writes to the db directly, whilst in region silo mode creating an audit log entry will instead push to a new kafka producer that consumes into the control silo asynchronously.
182
0
18,182
15
4
15
def convert_to_svg(dvi_file, extension, page=1): result = dvi_file.with_suffix(".svg") if not result.exists(): commands = [ "dvisvgm", "--pdf" if extension == ".pdf" else "", "-p " + str(page), f'"{dvi_file}"', "-n", "-v 0", ...
manim/utils/tex_file_writing.py
192
manim
{ "docstring": "Converts a .dvi, .xdv, or .pdf file into an svg using dvisvgm.\n\n Parameters\n ----------\n dvi_file : :class:`Path`\n File name of the input file to be converted.\n extension : :class:`str`\n String containing the file extension and thus indicating the file type, e.g. ``.dv...
94
Python
74
9d1f066d637cb15baea10e6907ab85efff8fb36f
tex_file_writing.py
190,076
23
101
convert_to_svg
https://github.com/ManimCommunity/manim.git
Migrate more `os.path` to `pathlib` (#2980) * Migrate more `os.path` to `pathlib` * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix type errors with recent pathlib code * pathlib fixes * more pathlib fixes * remove unused imports introduced b...
290
0
46,312
13
1
2
def group(self): return self["group"]
packages/python/plotly/plotly/graph_objs/_frame.py
22
plotly.py
{ "docstring": "\n An identifier that specifies the group to which the frame\n belongs, used by animate to select a subset of frames.\n\n The 'group' property is a string and must be specified as:\n - A string\n - A number that will be converted to a string\n\n Returns\n ...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_frame.py
226,746
2
11
group
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
58,419
7
4
12
def _match_long_opt(self, opt): try: return super()._match_long_opt(opt) except optparse.AmbiguousOptionError as e: if len(set(self._long_opt[p] for p in e.possibilities)) == 1: return e.possibilities[0] raise
yt_dlp/options.py
91
yt-dlp
{ "docstring": "Improve ambigious argument resolution by comparing option objects instead of argument strings", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 11 }
21
Python
20
db2e129ca0c11de84d57b2298dffd5d87e852518
options.py
162,533
7
56
_match_long_opt
https://github.com/yt-dlp/yt-dlp.git
[options] Better ambiguous option resolution Eg: `--write-auto` no longer results in > ambiguous option: --write-auto (--write-auto-subs, --write-automatic-subs?)
90
0
39,211
15
3
7
def global_policy(): if _global_policy is None: if base_layer_utils.v2_dtype_behavior_enabled(): return Policy(backend.floatx()) else: return Policy("_infer") return _global_policy
keras/mixed_precision/policy.py
64
keras
{ "docstring": "Returns the global dtype policy.\n\n The global policy is the default `tf.keras.mixed_precision.Policy` used for\n layers, if no policy is passed to the layer constructor. If no policy has been\n set with `keras.mixed_precision.set_global_policy`, this will return a policy\n constructed fr...
15
Python
11
84afc5193d38057e2e2badf9c889ea87d80d8fbf
policy.py
275,142
7
35
global_policy
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
60
0
81,317
13
4
10
def __eq__(self, other): ans = True SIZE = self.size() if SIZE == other.size(): for i in range(SIZE): if self.__components[i] != other.component(i): ans = False break else: ans = False return...
linear-algebra-python/src/lib.py
101
Python
{ "docstring": "\n returns true if the vectors are equal otherwise false.\n ", "language": "en", "n_whitespaces": 24, "n_words": 9, "vocab_size": 9 }
31
Python
22
f0af0c43340763724f139fa68aa1e5a9ffe458b4
lib.py
22,659
11
61
__eq__
https://github.com/geekcomputers/Python.git
refactor: clean code Signed-off-by: slowy07 <slowy.arfy@gmail.com>
148
0
4,388
12
4
31
def fit(self, X, y=None): # large sparse data is not supported for 32bit platforms because # _document_frequency uses np.bincount which works on arrays of # dtype NPY_INTP which is int32 for 32bit platforms. See #20923 X = self._validate_data( X, accept_sparse=("csr"...
sklearn/feature_extraction/text.py
249
scikit-learn
{ "docstring": "Learn the idf vector (global term weights).\n\n Parameters\n ----------\n X : sparse matrix of shape n_samples, n_features)\n A matrix of term/token counts.\n\n y : None\n This parameter is not needed to compute tf-idf.\n\n Returns\n ----...
119
Python
87
f1d3417b086550be670cbfbb5b3c1760ac99203f
text.py
259,040
22
156
fit
https://github.com/scikit-learn/scikit-learn.git
MNT Drops Python 3.7 in CI, wheel building, and docs (#22617) * MNT Drops Python 3.7 * MNT Bump NumPy and SciPy * FIX Fix build * FIX Bump versions improved * DOC Fixes numpy version [pypy] * BLD [pypy] [icc-build] * Update docs * MAINT use scipy.optimize.LinearConstraint in test * MAINT scipy ...
407
0
75,536
12
2
7
def get_penalty_details(against_loan): penalty_details = frappe.db.sql( , (against_loan, against_loan), ) if penalty_details: return penalty_details[0][0], flt(penalty_details[0][1]) else: return None, 0
erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
77
erpnext
{ "docstring": "\n\t\tSELECT posting_date, (penalty_amount - total_penalty_paid) as pending_penalty_amount\n\t\tFROM `tabLoan Repayment` where posting_date >= (SELECT MAX(posting_date) from `tabLoan Repayment`\n\t\twhere against_loan = %s) and docstatus = 1 and against_loan = %s\n\t", "language": "en", "n_whitesp...
18
Python
17
494bd9ef78313436f0424b918f200dab8fc7c20b
loan_repayment.py
66,329
13
50
get_penalty_details
https://github.com/frappe/erpnext.git
style: format code with black
9
0
14,167
12
9
25
def polarity_scores(self, text): # convert emojis to their textual descriptions text_no_emoji = "" prev_space = True for chr in text: if chr in self.emojis: # get the textual description description = self.emojis[chr] i...
build/pyinstaller/vaderSentiment/vaderSentiment.py
309
OpenBBTerminal
{ "docstring": "\n Return a float for sentiment strength based on the input text.\n Positive values are positive valence, negative value are negative\n valence.\n ", "language": "en", "n_whitespaces": 50, "n_words": 21, "vocab_size": 19 }
131
Python
82
ab4de1dd70fba866930150e440a03e461a6ca6a8
vaderSentiment.py
283,210
33
186
polarity_scores
https://github.com/OpenBB-finance/OpenBBTerminal.git
Create a packaged app bundle with Pyinstaller (#1525) * Add dashboard widget assets * Add ipywidgets and ipyflex to project * Add currencies dashboard notebook * Update docs and docstrings * Add pyinstaller to project deps * Add pyinstaller artifacts to gitignore * Fix linter errors in terminal.py ...
539
0
84,470
14
2
10
def list_of_ips(self): # Defer draining call queue until we get the ip address result = [None] * len(self.list_of_block_partitions) for idx, partition in enumerate(self.list_of_block_partitions): partition.drain_call_queue() result[idx] = partition._ip_cache ...
modin/core/execution/dask/implementations/pandas_on_dask/partitioning/virtual_partition.py
75
modin
{ "docstring": "\n Get the IPs holding the physical objects composing this partition.\n\n Returns\n -------\n List\n A list of IPs as ``distributed.Future`` or str.\n ", "language": "en", "n_whitespaces": 68, "n_words": 21, "vocab_size": 19 }
29
Python
27
9bf8d57ca44e22fd69b0abc55793cf60c199ab4d
virtual_partition.py
154,155
6
45
list_of_ips
https://github.com/modin-project/modin.git
FIX-#4676: drain sub-virtual-partition call queues. (#4695) Signed-off-by: mvashishtha <mahesh@ponder.io> Co-authored-by: Alexey Prutskov <lehaprutskov@gmail.com>
86
0
35,815
10
2
8
def set_status(self, status): self.status = status if status in JobResultStatusChoices.TERMINAL_STATE_CHOICES: self.completed = timezone.now()
netbox/extras/models/models.py
49
netbox
{ "docstring": "\n Helper method to change the status of the job result. If the target status is terminal, the completion\n time is also set.\n ", "language": "en", "n_whitespaces": 44, "n_words": 22, "vocab_size": 17 }
13
Python
11
0bcc59a1e99065c1c0a143983fed4d0828d744f4
models.py
266,140
4
29
set_status
https://github.com/netbox-community/netbox.git
#8366: Add started field to JobResult
45
0
78,305
10
3
10
def to_text(value, errors='strict'): # type: (t.AnyStr, str) -> str if isinstance(value, bytes): return value.decode(ENCODING, errors) if isinstance(value, str): return value raise Exception('value is not bytes or text: %s' % type(value))
test/lib/ansible_test/_internal/encoding.py
79
ansible
{ "docstring": "Return the given value as text decoded using UTF-8 if not already text.", "language": "en", "n_whitespaces": 12, "n_words": 13, "vocab_size": 13 }
30
Python
27
86779cc90376ea70bafa7044b12ce5132409fd63
encoding.py
267,380
6
47
to_text
https://github.com/ansible/ansible.git
ansible-test - Code cleanup. This helps prepare for a future pylint upgrade.
57
0
78,870
10
2
5
def _is_lr_warming_up(self): return ( self.warmup_scheduler is not None and self._number_training_updates < self.warmup_updates )
parlai/nn/lr_scheduler.py
38
ParlAI
{ "docstring": "\n Check if we're warming up the learning rate.\n ", "language": "en", "n_whitespaces": 23, "n_words": 8, "vocab_size": 8 }
13
Python
13
9d77adb86f707967b88d93964d8056a8bd5c84ec
lr_scheduler.py
194,798
5
23
_is_lr_warming_up
https://github.com/facebookresearch/ParlAI.git
Warmup updates bug for LR < 1 (#4384) * revert bug * relax restrictions * even more relaxed :/
56
0
47,089
9
1
6
def is_same_loop(self) -> bool: return get_or_create_event_loop() == self.router._event_loop
python/ray/serve/handle.py
32
ray
{ "docstring": "Whether the caller's asyncio loop is the same loop for handle.\n\n This is only useful for async handles.\n ", "language": "en", "n_whitespaces": 32, "n_words": 18, "vocab_size": 14 }
8
Python
8
784e66b1f2265aeb9cb9a4e2404a8ac274abce3b
handle.py
136,465
6
18
is_same_loop
https://github.com/ray-project/ray.git
[all_tests][python] Remove calling of get_event_loop from python version >= 3.10 (#29285) get_event_loop is deprecated in 3.10. This PR removes its invocation with python >= 3.10 by introducing a proxy function get_or_create_event_loop in utils.py. More details please see the function comments. In the long run - ...
22
0
30,926
8
1
20
def test_computed_list_display_localization(self): self.client.force_login(self.superuser) event = Event.objects.create(date=datetime.date.today()) response = self.client.get(reverse("admin:admin_changelist_event_changelist")) self.assertContains(response, formats.localize(event...
tests/admin_changelist/tests.py
124
django
{ "docstring": "\n Regression test for #13196: output of functions should be localized\n in the changelist.\n ", "language": "en", "n_whitespaces": 36, "n_words": 13, "vocab_size": 13 }
13
Python
12
9c19aff7c7561e3a82978a272ecdaad40dda5c00
tests.py
207,001
6
75
test_computed_list_display_localization
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
55
0
51,830
12
5
14
def apply_transparency(self): if self.mode != "P" or "transparency" not in self.info: return from . import ImagePalette palette = self.getpalette("RGBA") transparency = self.info["transparency"] if isinstance(transparency, bytes): for i, alpha i...
src/PIL/Image.py
186
Pillow
{ "docstring": "\n If a P mode image has a \"transparency\" key in the info dictionary,\n remove the key and apply the transparency to the palette instead.\n ", "language": "en", "n_whitespaces": 46, "n_words": 24, "vocab_size": 19 }
54
Python
41
11be1631433f252b816802aef1a3cd109bd308c7
Image.py
243,004
14
110
apply_transparency
https://github.com/python-pillow/Pillow.git
Added apply_transparency()
172
0
69,952
13
6
26
def mark_expected_failures_and_skips(self): # Only load unittest if we're actually testing. from unittest import expectedFailure, skip for test_name in self.connection.features.django_test_expected_failures: test_case_name, _, test_method_name = test_name.rpartition('.') ...
django/db/backends/base/creation.py
256
django
{ "docstring": "\n Mark tests in Django's test suite which are expected failures on this\n database and test which should be skipped on this database.\n ", "language": "en", "n_whitespaces": 44, "n_words": 22, "vocab_size": 18 }
92
Python
48
890bfa368c33d6ae19fe45cf1eed7e2e8d63160e
creation.py
203,151
17
158
mark_expected_failures_and_skips
https://github.com/django/django.git
Refs #20349 -- Avoided loading testing libraries when not needed.
344
0
50,238
16
1
4
def images_found(self) -> int: return self._images_found
scripts/fsmedia.py
22
faceswap
{ "docstring": "int: The number of frames that exist in the video file, or the folder of images. ", "language": "en", "n_whitespaces": 16, "n_words": 16, "vocab_size": 14 }
6
Python
6
1022651eb8a7741014f5d2ec7cbfe882120dfa5f
fsmedia.py
101,394
3
12
images_found
https://github.com/deepfakes/faceswap.git
Bugfix: convert - Gif Writer - Fix non-launch error on Gif Writer - convert plugins - linting - convert/fs_media/preview/queue_manager - typing - Change convert items from dict to Dataclass
20
0
20,809
6
4
7
def constrain_encoding(self) -> None: accept_encoding = self.headers.get("accept-encoding") if accept_encoding: self.headers["accept-encoding"] = ", ".join( e for e in {"gzip", "identity", "deflate", "br", "zstd"} if e in accept_encodi...
mitmproxy/http.py
95
mitmproxy
{ "docstring": "\n Limits the permissible Accept-Encoding values, based on what we can decode appropriately.\n ", "language": "en", "n_whitespaces": 27, "n_words": 12, "vocab_size": 12 }
27
Python
21
b3587b52b25077f68116b9852b041d33e7fc6601
http.py
251,372
11
52
constrain_encoding
https://github.com/mitmproxy/mitmproxy.git
make it black!
115
0
73,701
13
2
15
def __reduce__(self): if not hasattr(self, "model"): # Fields are sometimes used without attaching them to models (for # example in aggregation). In this case give back a plain field # instance. The code below will create a new empty instance of # class s...
django/db/models/fields/__init__.py
115
django
{ "docstring": "\n Pickling should return the model._meta.fields instance of the field,\n not a new copy of that field. So, use the app registry to load the\n model and then the field back.\n ", "language": "en", "n_whitespaces": 59, "n_words": 30, "vocab_size": 25 }
89
Python
76
9c19aff7c7561e3a82978a272ecdaad40dda5c00
__init__.py
205,534
10
68
__reduce__
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
260
0
51,144
11
1
2
def meta(self): return self["meta"]
packages/python/plotly/plotly/graph_objs/_bar.py
22
plotly.py
{ "docstring": "\n Assigns extra meta information associated with this trace that\n can be used in various text attributes. Attributes such as\n trace `name`, graph, axis and colorbar `title.text`, annotation\n `text` `rangeselector`, `updatemenues` and `sliders` `label`\n text all ...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_bar.py
226,150
2
11
meta
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
57,823
7
7
26
def process(self, in_queue, out_queue): logger.debug("Starting convert process. (in_queue: %s, out_queue: %s)", in_queue, out_queue) log_once = False while True: items = in_queue.get() if items == "EOF": logger.debug("EOF Rece...
lib/convert.py
350
faceswap
{ "docstring": " Main convert process.\n\n Takes items from the in queue, runs the relevant adjustments, patches faces to final frame\n and outputs patched frame to the out queue.\n\n Parameters\n ----------\n in_queue: :class:`queue.Queue`\n The output from :class:`scrip...
133
Python
102
3d8e674adc88b8f4cc206ebad6fb5b600e38fe14
convert.py
100,763
30
201
process
https://github.com/deepfakes/faceswap.git
convert - Fix affine borders
635
0
20,216
16
2
18
def traceParseAction(f):
.venv/lib/python3.8/site-packages/pip/_vendor/pyparsing.py
49
"""Decorator for debugging parse actions. When the parse action is called, this decorator will print ``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``. When the parse action completes, the decorator will print ``"<<"`` followed by the returned value, or ...
transferlearning
{ "docstring": "Decorator for debugging parse actions.\n\n When the parse action is called, this decorator will print\n ``\">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)\"``.\n When the parse action completes, the decorator will print\n ``\"<<\"`` followed by the ...
2
Python
2
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
pyparsing.py
63,443
8
29
traceParseAction
https://github.com/jindongwang/transferlearning.git
upd; format
5
3
13,305
8
3
9
def _pixels_and_segments_fit_in_music_mode(self) -> bool: pixels_per_segment = self._device.pixels_per_segment segments = self._device.segments assert pixels_per_segment is not None assert segments is not None return bool( pixels_per_segment <= MUSIC_PIXELS_P...
homeassistant/components/flux_led/number.py
78
core
{ "docstring": "Check if the base pixel and segment settings will fit for music mode.\n\n If they fit, they do not need to be configured.\n ", "language": "en", "n_whitespaces": 37, "n_words": 23, "vocab_size": 22 }
36
Python
22
e222e1b6f05b630bef5aed73e307ca5072b6f286
number.py
308,880
14
49
_pixels_and_segments_fit_in_music_mode
https://github.com/home-assistant/core.git
Add device configuration entities to flux_led (#62786) Co-authored-by: Chris Talkington <chris@talkingtontech.com>
118
0
107,608
10
2
10
def _generate_sharding_spec(world_size): placements = [f"rank:{idx}/cuda:{idx}" for idx in range(world_size)] # Shard the first nn module's weight by dim 0. # (nn.Linear transposes the weight internally so dim 0 actually means column) colwise_spec = ChunkShardingSpec( dim=0, placeme...
distributed/sharded_tensor/tensor_parallel.py
110
examples
{ "docstring": "\n We first need to create a sharding spec for our sharding work.\n\n For now, we only support sharding on one dimension. So we use\n ``ChunkShardingSpec`` to chunk the size of the given sharding\n dim to equally split length. The behavior is similar to\n `torch.chunk`.\n\n We also n...
76
Python
47
9ba53df5a19131e6926027b2e73aaa77cec17272
tensor_parallel.py
82,839
15
64
_generate_sharding_spec
https://github.com/pytorch/examples.git
Gh/fduwjj/2/base (#1007) * test ghstack [ghstack-poisoned] * Update base for Update on "[PT-D] Add an example for Megatron-LM style example" [ghstack-poisoned] * Update base for Update on "[PT-D] Add an example for Megatron-LM style example" [ghstack-poisoned] * Update base for Update on ...
157
0
17,549
10
4
23
def execute(): frappe.reload_doc("buying", "doctype", "purchase_order") frappe.reload_doc("buying", "doctype", "supplier_quotation") frappe.reload_doc("selling", "doctype", "sales_order") frappe.reload_doc("selling", "doctype", "quotation") frappe.reload_doc("stock", "doctype", "delivery_note") frappe.reload_doc(...
erpnext/patches/v11_0/update_total_qty_field.py
388
erpnext
{ "docstring": "\n\t\t\tSELECT\n\t\t\t\tparent, SUM(qty) as qty\n\t\t\tFROM\n\t\t\t\t`tab{0} Item`\n\t\t\twhere parenttype = '{0}'\n\t\t\tGROUP BY parent\n\t\t\n\t\t\t\tINSERT INTO `tab{}` (name, total_qty) VALUES {}\n\t\t\t\tON DUPLICATE KEY UPDATE name = VALUES(name), total_qty = VALUES(total_qty)\n\t\t\t", "lang...
188
Python
126
494bd9ef78313436f0424b918f200dab8fc7c20b
update_total_qty_field.py
66,581
48
213
execute
https://github.com/frappe/erpnext.git
style: format code with black
142
0
14,229
18
26
44
def prim_mst_edges(G, minimum, weight="weight", keys=True, data=True, ignore_nan=False): is_multigraph = G.is_multigraph() push = heappush pop = heappop nodes = set(G) c = count() sign = 1 if minimum else -1 while nodes: u = nodes.pop() frontier = [] visited =...
networkx/algorithms/tree/mst.py
762
@not_implemented_for("directed")
networkx
{ "docstring": "Iterate over edges of Prim's algorithm min/max spanning tree.\n\n Parameters\n ----------\n G : NetworkX Graph\n The graph holding the tree of interest.\n\n minimum : bool (default: True)\n Find the minimum (True) or maximum (False) spanning tree.\n\n weight : string (defa...
264
Python
110
83cc6cd2811dbc6d20cfb3de809f21153b30e14e
mst.py
176,520
62
453
prim_mst_edges
https://github.com/networkx/networkx.git
Optimize prim for mst (#5455) Co-authored-by: Dylan <dylan@200-18-80-eduroam-al.wlan.net.uc.cl>
1,173
1
41,941
20
1
9
def __add__(self, other): rank = (self.rank() + other) % self.cardinality rv = self.unrank_lex(self.size, rank) rv._rank = rank return rv
sympy/combinatorics/permutations.py
68
sympy
{ "docstring": "Return permutation that is other higher in rank than self.\n\n The rank is the lexicographical rank, with the identity permutation\n having rank of 0.\n\n Examples\n ========\n\n >>> from sympy.combinatorics import Permutation\n >>> I = Permutation([0, 1, 2, 3...
19
Python
15
498015021131af4dbb07eb110e5badaba8250c7b
permutations.py
196,160
5
42
__add__
https://github.com/sympy/sympy.git
Updated import locations
54
0
47,660
11
1
6
def to_integral_exact(self, a): a = _convert_other(a, raiseit=True) return a.to_integral_exact(context=self)
python3.10.4/Lib/_pydecimal.py
44
XX-Net
{ "docstring": "Rounds to an integer.\n\n When the operand has a negative exponent, the result is the same\n as using the quantize() operation using the given operand as the\n left-hand-operand, 1E+0 as the right-hand-operand, and the precision\n of the operand as the precision setting; In...
9
Python
9
8198943edd73a363c266633e1aa5b2a9e9c9f526
_pydecimal.py
219,712
3
27
to_integral_exact
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
30
0
55,735
9
1
9
def test_invalid_parameters_in_stacking(): stacker = StackingClassifier(estimators=[]) html_output = estimator_html_repr(stacker) assert html.escape(str(stacker)) in html_output
sklearn/utils/tests/test_estimator_html_repr.py
56
scikit-learn
{ "docstring": "Invalidate stacking configuration uses default repr.\n\n Non-regression test for #24009.\n ", "language": "en", "n_whitespaces": 16, "n_words": 10, "vocab_size": 10 }
12
Python
10
84c6421a9067de7d1b54b7a6d8e21ce38e1f0eca
test_estimator_html_repr.py
260,606
4
32
test_invalid_parameters_in_stacking
https://github.com/scikit-learn/scikit-learn.git
FIX Show a HTML repr for meta-estimatosr with invalid parameters (#24015) Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
24
0
76,372
10
1
8
def generate_new_id() -> str: return base58.b58encode(uuid.uuid4().bytes).decode()
lib/streamlit/session_data.py
43
streamlit
{ "docstring": "Randomly generate an ID representing this session's execution.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
6
Python
6
704eab3478cf69847825b23dabf15813a8ac9fa2
session_data.py
118,576
3
24
generate_new_id
https://github.com/streamlit/streamlit.git
Rename and refactor `Report` machinery (#4141) This refactor renames (almost) everything related to the outdated "report" concept with more precise concepts that we use throughout our code, primarily "script run", "session", and "app".
12
0
26,302
12
1
5
def test_event_match_body(self) -> None: # if the key is `content.body`, the pattern matches substrings. # non-wildcards should match condition = { "kind": "event_match", "key": "content.body", "pattern": "foobaz", } self._assert_mat...
tests/push/test_push_rule_evaluator.py
450
synapse
{ "docstring": "Check that event_match conditions on content.body work as expected", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
209
Python
74
9d21ecf7ceab55bc19c4457b8b07401b0b1623a7
test_push_rule_evaluator.py
247,781
71
239
test_event_match_body
https://github.com/matrix-org/synapse.git
Add type hints to tests files. (#12256)
883
0
71,916
10
1
4
def layout(self) -> Layout: return self.styles.layout
src/textual/view.py
25
textual
{ "docstring": "Convenience property for accessing ``view.styles.layout``.\n\n Returns: The Layout associated with this view\n ", "language": "en", "n_whitespaces": 26, "n_words": 12, "vocab_size": 12 }
6
Python
6
9c2a125c2412c5d011307a80f4552cf9824cc022
view.py
182,034
6
14
layout
https://github.com/Textualize/textual.git
Ensuring we get and set Layout as set in view.styles everywhere
20
0
43,737
7
1
4
def _zeropad(s, padsize): return s + b"\x00" * (-len(s) % padsize)
scapy/libs/rfc3961.py
40
scapy
{ "docstring": "\n Return s padded with 0 bytes to a multiple of padsize.\n ", "language": "en", "n_whitespaces": 18, "n_words": 11, "vocab_size": 11 }
11
Python
11
b26f2283379d3bba48d575c1fffd1c3cdeaf64c2
rfc3961.py
209,457
2
23
_zeropad
https://github.com/secdev/scapy.git
Kerberos update (#3688) * Kerberos over TCP * Kerberos: add FAST & PKCA * Many user-friendly improvements * RFC3961 crypto * Summary, Sessions, Examples, Bugs * More tests, _n_fold edge case * Ignore potatoe (kerberos tests) from codespell
17
0
52,681
12