complexity int64 1 139 | fun_name stringlengths 1 80 | code stringlengths 101 62.2k | commit_id stringlengths 40 40 | ast_errors stringlengths 0 3.11k | ast_levels int64 6 36 | file_name stringlengths 5 79 | n_ast_nodes int64 17 19.2k | commit_message stringlengths 3 15.3k | d_id int64 12 121k | n_ast_errors int64 0 9 | n_whitespaces int64 4 10.8k | token_counts int64 5 3.06k | vocab_size int64 4 1.11k | id int64 20 338k | n_words int64 4 4.82k | repo stringlengths 3 22 | n_identifiers int64 2 176 | path stringlengths 7 134 | language stringclasses 1
value | nloc int64 1 413 | documentation dict | url stringlengths 31 59 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
12 | _expire_url_cache_data | async def _expire_url_cache_data(self) -> None:
assert self._worker_run_media_background_jobs
now = self.clock.time_msec()
logger.debug("Running url preview cache expiry")
if not (await self.store.db_pool.updates.has_completed_background_updates()):
logger.debug(... | 57f6c496d0e26b1b455de936bd950e1899a5ae25 | 13 | preview_url_resource.py | 92 | URL preview cache expiry logs: INFO -> DEBUG, text clarifications (#12720) | 72,189 | 0 | 86 | 329 | 25 | 248,275 | 29 | synapse | 12 | synapse/rest/media/v1/preview_url_resource.py | Python | 68 | {
"docstring": "Clean up expired url cache content, media and thumbnails.",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 9
} | https://github.com/matrix-org/synapse.git | |
2 | reset_format | def reset_format(self):
self._check_values_type()
for dataset in self.values():
dataset.set_format()
| e35be138148333078284b942ccc9ed7b1d826f97 | 9 | dataset_dict.py | 45 | Update docs to new frontend/UI (#3690)
* WIP: update docs to new UI
* make style
* Rm unused
* inject_arrow_table_documentation __annotations__
* hasattr(arrow_table_method, "__annotations__")
* Update task_template.rst
* Codeblock PT-TF-SPLIT
* Convert loading scripts
* Convert docs to mdx
... | 21,824 | 0 | 40 | 25 | 8 | 104,387 | 8 | datasets | 6 | src/datasets/dataset_dict.py | Python | 4 | {
"docstring": "Reset ``__getitem__`` return format to python objects and all columns.\n The transformation is applied to all the datasets of the dataset dictionary.\n\n Same as ``self.set_format()``\n ",
"language": "en",
"n_whitespaces": 46,
"n_words": 25,
"vocab_size": 22
} | https://github.com/huggingface/datasets.git | |
1 | _assert_text_deltas | def _assert_text_deltas(self, scriptrunner, text_deltas):
self.assertEqual(text_deltas, scriptrunner.text_deltas())
| 704eab3478cf69847825b23dabf15813a8ac9fa2 | 9 | script_runner_test.py | 36 | 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". | 26,337 | 0 | 20 | 22 | 6 | 118,633 | 6 | streamlit | 5 | lib/tests/streamlit/scriptrunner/script_runner_test.py | Python | 2 | {
"docstring": "Asserts that the scriptrunner's ForwardMsgQueue contains text deltas\n with the given contents.\n\n Parameters\n ----------\n scriptrunner : TestScriptRunner\n text_deltas : List[str]\n\n ",
"language": "en",
"n_whitespaces": 62,
"n_words": 20,
"vocab_... | https://github.com/streamlit/streamlit.git | |
6 | typename | def typename(typ, short=False) -> str:
if not isinstance(typ, type):
return typename(type(typ))
try:
if not typ.__module__ or typ.__module__ == "builtins":
return typ.__name__
else:
if short:
module, *_ = typ.__module__.split(".")
... | 261bf174931580230717abca93fe172e166cc1e8 | 16 | utils.py | 150 | Add mild typing to common utils functions (#8848) | 36,605 | 0 | 156 | 88 | 29 | 156,222 | 42 | dask | 12 | dask/utils.py | Python | 28 | {
"docstring": "\n Return the name of a type\n\n Examples\n --------\n >>> typename(int)\n 'int'\n\n >>> from dask.core import literal\n >>> typename(literal)\n 'dask.core.literal'\n >>> typename(literal, short=True)\n 'dask.literal'\n ",
"language": "en",
"n_whitespaces": 57,
"... | https://github.com/dask/dask.git | |
1 | test_batch_mapper_pandas_data_format | def test_batch_mapper_pandas_data_format(ds_with_expected_pandas_numpy_df):
ds, expected_df, expected_numpy_df = ds_with_expected_pandas_numpy_df
| 9c39a28ba2f6221ffd8327fa21cb8294f0390fee | 7 | test_batch_mapper.py | 23 | [AIR][Numpy] Add numpy narrow waist to `Preprocessor` and `BatchMapper` (#28418)
Co-authored-by: Eric Liang <ekhliang@gmail.com>
Co-authored-by: Clark Zinzow <clarkzinzow@gmail.com>
Co-authored-by: Amog Kamsetty <amogkamsetty@yahoo.com> | 28,613 | 0 | 13 | 145 | 7 | 128,150 | 7 | ray | 5 | python/ray/data/tests/test_batch_mapper.py | Python | 20 | {
"docstring": "Tests batch mapper functionality for pandas data format.\n\n Note:\n For single column pandas dataframes, we automatically convert it to\n single column tensor with column name as `__value__`.\n ",
"language": "en",
"n_whitespaces": 47,
"n_words": 27,
"vocab_size": 23
} | https://github.com/ray-project/ray.git | |
3 | lexer | def lexer(self) -> Optional[Lexer]:
if isinstance(self._lexer, Lexer):
return self._lexer
try:
return get_lexer_by_name(
self._lexer,
stripnl=False,
ensurenl=True,
tabsize=self.tab_size,
)
... | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | 11 | syntax.py | 83 | check point progress on only bringing in pip==22.0.4 (#4966)
* vendor in pip==22.0.4
* updating vendor packaging version
* update pipdeptree to fix pipenv graph with new version of pip.
* Vendoring of pip-shims 0.7.0
* Vendoring of requirementslib 1.6.3
* Update pip index safety restrictions patch for p... | 3,587 | 0 | 153 | 54 | 19 | 20,845 | 21 | pipenv | 12 | pipenv/patched/notpip/_vendor/rich/syntax.py | Python | 16 | {
"docstring": "The lexer for this syntax, or None if no lexer was found.\n\n Tries to find the lexer by name if a string was passed to the constructor.\n ",
"language": "en",
"n_whitespaces": 41,
"n_words": 27,
"vocab_size": 21
} | https://github.com/pypa/pipenv.git | |
2 | get_placement_group_id | def get_placement_group_id(self) -> Optional[str]:
pg_id = self.worker.placement_group_id
return pg_id.hex() if not pg_id.is_nil() else None
| 90cea203befa8f2e86e9c1c18bb3972296358e7b | 9 | runtime_context.py | 55 | Ray 2.0 API deprecation (#26116)
Ray 2.0 API deprecation for:
ray.remote(): placement_group
ray.remote(): placement_group_bundle_index
ray.remote(): placement_group_capture_child_tasks
ray.get_dashboard_url()
ray.get_resource_ids()
ray.disconnect()
ray.connect()
ray.util.ActorGroup
ray.util.ActorPo... | 27,934 | 0 | 35 | 33 | 14 | 125,637 | 14 | ray | 9 | python/ray/runtime_context.py | Python | 8 | {
"docstring": "Get the current Placement group ID of this worker.\n\n Returns:\n The current placement group id in hex format of this worker.\n ",
"language": "en",
"n_whitespaces": 46,
"n_words": 21,
"vocab_size": 16
} | https://github.com/ray-project/ray.git | |
1 | test_array_vs_scalar_is_equal | def test_array_vs_scalar_is_equal(self):
a = np.array([1., 1., 1.])
b = 1.
self._test_equal(a, b)
| cafec60a5e28af98fb8798049edd7942720d2d74 | 9 | test_utils.py | 50 | ENH: Add strict parameter to assert_array_equal. (#21595)
Fixes #9542
Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> | 38,756 | 0 | 40 | 35 | 11 | 160,837 | 12 | numpy | 7 | numpy/testing/tests/test_utils.py | Python | 4 | {
"docstring": "Test comparing an array with a scalar when all values are equal.",
"language": "en",
"n_whitespaces": 11,
"n_words": 12,
"vocab_size": 12
} | https://github.com/numpy/numpy.git | |
5 | generate_tex_file | def generate_tex_file(expression, environment=None, tex_template=None):
if tex_template is None:
tex_template = config["tex_template"]
if environment is not None:
output = tex_template.get_texcode_for_expression_in_env(expression, environment)
else:
output = tex_template.get_tex... | 5b11a0e48b5564cdf02c11dd177f7f5c9f0b9f7a | 14 | tex_file_writing.py | 245 | Improved Error in :mod:`.utils.tex_file_writing` (#2574)
* Better Error and insight
* Do not use keywords as identifiers
* add_tests
* Nasty comma
* Windows does its own thing
* Use os.path.join for windows
* Do not log path
* Include Insights
* Full stop.
Co-authored-by: Darylgolden <darylg... | 46,189 | 0 | 135 | 140 | 41 | 189,736 | 55 | manim | 23 | manim/utils/tex_file_writing.py | Python | 16 | {
"docstring": "Takes a tex expression (and an optional tex environment),\n and returns a fully formed tex file ready for compilation.\n\n Parameters\n ----------\n expression : :class:`str`\n String containing the TeX expression to be rendered, e.g. ``\\\\sqrt{2}`` or ``foo``\n environment : Op... | https://github.com/ManimCommunity/manim.git | |
5 | has_leading_dir | def has_leading_dir(paths):
# type: (Iterable[str]) -> bool
common_prefix = None
for path in paths:
prefix, rest = split_leading_dir(path)
if not prefix:
return False
elif common_prefix is None:
common_prefix = prefix
elif prefix != common_prefix:... | f638f5d0e6c8ebed0e69a6584bc7f003ec646580 | 11 | unpacking.py | 76 | upd; format | 12,506 | 0 | 114 | 45 | 29 | 61,320 | 38 | transferlearning | 7 | .venv/lib/python3.8/site-packages/pip/_internal/utils/unpacking.py | Python | 11 | {
"docstring": "Returns true if all the paths have the same leading path name\n (i.e., everything is in one subdirectory in an archive)",
"language": "en",
"n_whitespaces": 23,
"n_words": 21,
"vocab_size": 19
} | https://github.com/jindongwang/transferlearning.git | |
4 | test_stream_with_splitting_properties_with_new_record | def test_stream_with_splitting_properties_with_new_record(self, requests_mock, common_params, api, fake_properties_list):
parsed_properties = list(split_properties(fake_properties_list))
self.set_mock_properties(requests_mock, "/properties/v2/deal/properties", fake_properties_list)
te... | 2282a4ae0221b1fb88e16eca8bc14a166998d2d2 | @pytest.fixture(name="configured_catalog") | 21 | test_source.py | 673 | 🎉 Source Hubspot: Migrate to CDK (#10177)
* migrate SourceHubspot to cdk
* refactor discover method
* change method name
* deleted Client class
* remove comment
* added get_updated_state
* fix setting initial state
* fix stream_state dict key
* fix cursor_field
* change check test case stat... | 582 | 1 | 1,988 | 357 | 92 | 3,876 | 177 | airbyte | 34 | airbyte-integrations/connectors/source-hubspot/unit_tests/test_source.py | Python | 88 | {
"docstring": "\n Check working stream `workflows` with large list of properties using new functionality with splitting properties\n ",
"language": "en",
"n_whitespaces": 30,
"n_words": 15,
"vocab_size": 13
} | https://github.com/airbytehq/airbyte.git |
1 | test_cartesian_mix_types | def test_cartesian_mix_types(arrays, output_dtype):
output = cartesian(arrays)
assert output.dtype == output_dtype
| 86080bbd5fe9513cd42cf34148ea5907a1a9fc6c | 8 | test_extmath.py | 34 | ENH cartesian accepts mixed dtypes arrays (#25067)
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com> | 76,936 | 0 | 19 | 20 | 10 | 261,691 | 10 | scikit-learn | 6 | sklearn/utils/tests/test_extmath.py | Python | 3 | {
"docstring": "Check that the cartesian product works with mixed types.",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 9
} | https://github.com/scikit-learn/scikit-learn.git | |
1 | get_optimizer | def get_optimizer(self) -> List:
optimizer1 = get_optimizer(
self.config.optimizer, self.config.optimizer_params, self.config.lr_gen, self.model_g
)
optimizer2 = get_optimizer(
self.config.optimizer, self.config.optimizer_params, self.config.lr_disc, self.model_d... | a0a9279e4b8c306875b6437f853bdcc31ee5f1cf | 10 | gan.py | 98 | Fix GAN optimizer order
commit 212d330929c22d0cd970be2023770dc1e39449ab
Author: Edresson Casanova <edresson1@gmail.com>
Date: Fri Apr 29 16:29:44 2022 -0300
Fix unit test
commit 44456b0483bf42b1337a8e408ac17af38b26b1fa
Author: Edresson Casanova <edresson1@gmail.com>
Date: Fri Apr 29 07:28:39 2022 -0300
... | 77,223 | 0 | 87 | 66 | 18 | 262,448 | 23 | TTS | 12 | TTS/vocoder/models/gan.py | Python | 15 | {
"docstring": "Initiate and return the GAN optimizers based on the config parameters.\n\n It returnes 2 optimizers in a list. First one is for the generator and the second one is for the discriminator.\n\n Returns:\n List: optimizers.\n ",
"language": "en",
"n_whitespaces": 67,
... | https://github.com/coqui-ai/TTS.git | |
3 | _update_slice | def _update_slice(operand, update, start_indices, update_dims):
operand_shape = operand.shape
operand = lax.pad(operand,
jnp.array(0, operand.dtype),
[(0, d, 0) for d in update.shape])
start_indices = tuple(jnp.int32(i) for i in start_indices)
t = lax.dynamic_slice(ope... | b64e36b60fca9661ca2c8ae51a56fae07bf5efe6 | 11 | eigh.py | 173 | Make QDWH-eig implementation jit-table.
Move QDWH-eig from jax._src.scipy.eigh to jax._src.lax.eigh, in preparation for using it to back `lax.eigh` in a future change.
PiperOrigin-RevId: 449362382 | 26,903 | 0 | 94 | 120 | 37 | 120,628 | 48 | jax | 22 | jax/_src/lax/eigh.py | Python | 10 | {
"docstring": "\n Similar to lax.dynamic_update_slice, but handles padded updates where padding\n values should not overwrite existing values in the array.\n\n Args:\n operand: the array to update\n update: the padded array to write\n start_indices: the offset at which to write `update`.\n update_dims: the tr... | https://github.com/google/jax.git | |
4 | async_step_link | async def async_step_link(self, user_input=None):
errors = {}
if user_input is not None:
# Do not authenticate if the host is already configured
self._async_abort_entries_match({CONF_HOST: self._host})
try:
info = await authenticate(
... | 23264c8fd4a3f8bcff5961ed11cab6388d3c67a4 | 14 | config_flow.py | 182 | Improve roon integraton (#66000)
* Update to new library, revise discovery to work with new library, specify port to work with new library.
* Move user gui to fallback.
* Revise tests.
* Handle old config.
* Improve debugging, refresh faster on load.
* Remove duplicate.
* Bump library version.
* F... | 95,433 | 0 | 260 | 107 | 46 | 296,453 | 56 | core | 22 | homeassistant/components/roon/config_flow.py | Python | 16 | {
"docstring": "Handle linking and authenticting with the roon server.",
"language": "en",
"n_whitespaces": 7,
"n_words": 8,
"vocab_size": 8
} | https://github.com/home-assistant/core.git | |
2 | _test_migrate_stream_data | def _test_migrate_stream_data(self):
self.apply_migration()
instances = self.model.objects.all().annotate(
raw_content=Cast(F("content"), JSONField())
)
for instance in instances:
prev_content = self.original_raw_data[instance.id]
self.asse... | ad65741b94f36fbe793cf15f0ab002482070cdb6 | 14 | test_migrations.py | 113 | Add tests for streamfield migration helpers
Currently failing due to wagtail-factories being broken on Wagtail 4.1: https://github.com/wagtail/wagtail-factories/issues/65 | 17,011 | 0 | 126 | 68 | 26 | 80,125 | 29 | wagtail | 19 | wagtail/tests/streamfield_migrations/test_migrations.py | Python | 10 | {
"docstring": "Test whether the stream data of the model instances have been updated properly\n\n Apply the migration and then query the raw data of the updated instances. Compare with\n original raw data and check whether all relevant `char1` blocks have been renamed and\n whether ids and other... | https://github.com/wagtail/wagtail.git | |
2 | synchronized_output_end_sequence | def synchronized_output_end_sequence(self) -> str:
if self.synchronised_output:
return TERMINAL_MODES_ANSI_SEQUENCES[Mode.SynchronizedOutput]["end_sync"]
return ""
| 7f27e70440c177b2a047b7f74a78ed5cd5b4b596 | 10 | _terminal_features.py | 45 | [terminal buffering] Address PR feedback | 44,257 | 0 | 42 | 25 | 9 | 183,574 | 10 | textual | 7 | src/textual/_terminal_features.py | Python | 13 | {
"docstring": "\n Returns the ANSI sequence that we should send to the terminal to tell it that\n it should stop buffering the content we're about to send.\n If the terminal doesn't seem to support synchronised updates the string will be empty.\n\n Returns:\n str: the \"synchro... | https://github.com/Textualize/textual.git | |
2 | num_rows | def num_rows(self) -> int:
if self._indices is not None:
return self._indices.num_rows
return self._data.num_rows
| 445107bae3fcd6ac9eeae503232960fa4ba8ccfd | 9 | arrow_dataset.py | 46 | Add code examples to API docs (#4168)
* add code examples for functions related to the base dataset class
* ✨ make style
* 🖍 make each code example fully reproducible where applicable
* 🖍 show parameter usage for some functions
* 🖍 add examples for DatasetInfo functions | 21,960 | 0 | 45 | 28 | 12 | 104,765 | 13 | datasets | 5 | src/datasets/arrow_dataset.py | Python | 15 | {
"docstring": "Number of rows in the dataset (same as :meth:`Dataset.__len__`).\n\n Example:\n\n ```py\n >>> from datasets import load_dataset\n >>> ds = load_dataset(\"rotten_tomatoes\", split=\"validation\")\n >>> ds.num_rows\n 1066\n ```\n ",
"language": "... | https://github.com/huggingface/datasets.git | |
2 | current_cover_position | def current_cover_position(self) -> int | None:
position = None
if self.roller.type != 7:
position = 100 - self.roller.closed_percent
return position
| 10dc38e0ec27f7bef990ee431459342f9c3c52b4 | 11 | cover.py | 55 | Adjust CoverEntity property type hints in components (#73943)
* Adjust CoverEntity property type hints in components
* Revert changes to rflink
* Revert changes to wilight | 113,004 | 0 | 59 | 33 | 17 | 314,397 | 20 | core | 7 | homeassistant/components/acmeda/cover.py | Python | 9 | {
"docstring": "Return the current position of the roller blind.\n\n None is unknown, 0 is closed, 100 is fully open.\n ",
"language": "en",
"n_whitespaces": 32,
"n_words": 18,
"vocab_size": 15
} | https://github.com/home-assistant/core.git | |
1 | TextParser | def TextParser(*args, **kwds) -> TextFileReader:
kwds["engine"] = "python"
return TextFileReader(*args, **kwds)
| e48c9c3973286e257f6da1966c91806d86b917e0 | 8 | readers.py | 49 | TYP: more return annotations for io/* (#47524)
* TYP: more return annotations for io/*
* import future | 40,021 | 0 | 20 | 27 | 10 | 167,449 | 11 | pandas | 4 | pandas/io/parsers/readers.py | Python | 58 | {
"docstring": "\n Converts lists of lists/tuples into DataFrames with proper type inference\n and optional (e.g. string to datetime) conversion. Also enables iterating\n lazily over chunks of large files\n\n Parameters\n ----------\n data : file-like object or list\n delimiter : separator charac... | https://github.com/pandas-dev/pandas.git | |
2 | _nodb_cursor | def _nodb_cursor(self):
conn = self.__class__({**self.settings_dict, "NAME": None}, alias=NO_DB_ALIAS)
try:
with conn.cursor() as cursor:
yield cursor
finally:
conn.close()
| 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | 12 | base.py | 85 | Refs #33476 -- Reformatted code with Black. | 50,892 | 0 | 82 | 47 | 17 | 204,805 | 17 | django | 9 | django/db/backends/base/base.py | Python | 7 | {
"docstring": "\n Return a cursor from an alternative connection to be used when there is\n no need to access the main database, specifically for test db\n creation/deletion. This also prevents the production database from\n being exposed to potential child threads while (or after) the te... | https://github.com/django/django.git | |
6 | test_command_runner_interface_abstraction_violation | def test_command_runner_interface_abstraction_violation():
cmd_runner_interface_public_functions = dir(CommandRunnerInterface)
allowed_public_interface_functions = {
func
for func in cmd_runner_interface_public_functions
if not func.startswith("_")
}
for subcls in [SSHComma... | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | 14 | test_command_runner.py | 108 | [CI] Format Python code with Black (#21975)
See #21316 and #21311 for the motivation behind these changes. | 29,533 | 0 | 117 | 66 | 23 | 131,451 | 42 | ray | 13 | python/ray/tests/test_command_runner.py | Python | 13 | {
"docstring": "Enforces the CommandRunnerInterface functions on the subclasses.\n\n This is important to make sure the subclasses do not violate the\n function abstractions. If you need to add a new function to one of\n the CommandRunnerInterface subclasses, you have to add it to\n CommandRunnerInterface... | https://github.com/ray-project/ray.git | |
5 | resolve_granularity | def resolve_granularity(self) -> Granularity:
start = cast(datetime, self.params["start"])
end = cast(datetime, self.params["end"])
duration = (end - start).seconds
# TODO: could probably allow some leeway on the start & end (a few minutes) and use a bigger granularity
... | cf30c11a194aa5e61d8d7c7fc506764f846fcf82 | 11 | builder.py | 160 | feat(MEP): Add initial framework for metric queries (#31649)
- This adds a MetricsQueryBuilder, which works very similarily to our
QueryBuilder, but with specific handlers for how metrics construct
queries
- This MetricsQueryBuilder does not yet construct snql queries, and will
not because table queries will... | 19,289 | 0 | 317 | 95 | 91 | 96,190 | 148 | sentry | 13 | src/sentry/search/events/builder.py | Python | 20 | {
"docstring": "Granularity impacts metric queries even when they aren't timeseries because the data needs to be\n pre-aggregated\n\n Granularity is determined by checking the alignment of our start & end timestamps with the timestamps in\n snuba. eg. we can only use the daily granularity if the ... | https://github.com/getsentry/sentry.git | |
2 | test_vr_connector_respects_training_or_inference_vr_flags | def test_vr_connector_respects_training_or_inference_vr_flags(self):
view_rq_dict = {
"both": ViewRequirement(
"obs", used_for_training=True, used_for_compute_actions=True
),
"only_inference": ViewRequirement(
"obs", used_for_training=... | 5030a4c1d384e4bb1a25169384d7465e718e99a5 | 12 | test_agent.py | 414 | [RLlib] Simplify agent collector (#26803) | 27,968 | 0 | 647 | 250 | 88 | 125,751 | 144 | ray | 30 | rllib/connectors/tests/test_agent.py | Python | 43 | {
"docstring": "Tests that the connector respects the flags within view_requirements (i.e.\n used_for_training, used_for_compute_actions) under different is_training modes.\n For inference,\n the returned data should be state -> obs\n For training,\n the returned data should... | https://github.com/ray-project/ray.git | |
8 | fixture_dirs | def fixture_dirs(self):
dirs = []
fixture_dirs = settings.FIXTURE_DIRS
if len(fixture_dirs) != len(set(fixture_dirs)):
raise ImproperlyConfigured("settings.FIXTURE_DIRS contains duplicates.")
for app_config in apps.get_app_configs():
app_label = app_confi... | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | 14 | loaddata.py | 225 | Refs #33476 -- Reformatted code with Black. | 50,825 | 0 | 311 | 134 | 57 | 204,647 | 72 | django | 22 | django/core/management/commands/loaddata.py | Python | 21 | {
"docstring": "\n Return a list of fixture directories.\n\n The list contains the 'fixtures' subdirectory of each installed\n application, if it exists, the directories in FIXTURE_DIRS, and the\n current directory.\n ",
"language": "en",
"n_whitespaces": 63,
"n_words": 27,
... | https://github.com/django/django.git | |
1 | get_config_file_for_auto_config | def get_config_file_for_auto_config(self) -> Optional[Text]:
return self.config_file
| 6339856514897056716bb531acb8489c9cf05d26 | 6 | importer.py | 26 | Add support for different recipes (#10641)
* Add support for different recipes
Fixes https://github.com/RasaHQ/rasa/issues/10473
* Update docs/docs/graph-recipe.mdx
Co-authored-by: Joe Juzl <joejuzl@gmail.com> | 38,195 | 0 | 20 | 15 | 6 | 159,323 | 6 | rasa | 5 | rasa/shared/importers/importer.py | Python | 3 | {
"docstring": "Returns config file path for auto-config only if there is a single one.",
"language": "en",
"n_whitespaces": 12,
"n_words": 13,
"vocab_size": 13
} | https://github.com/RasaHQ/rasa.git | |
1 | receive_file | def receive_file(filename="example.txt"):
with open(filename, "wb") as out_file:
ftp.retrbinary("RETR " + filename, out_file.write, 1024)
ftp.quit()
| f0af0c43340763724f139fa68aa1e5a9ffe458b4 | 11 | ftp_send_receive.py | 69 | refactor: clean code
Signed-off-by: slowy07 <slowy.arfy@gmail.com> | 4,380 | 0 | 30 | 36 | 14 | 22,626 | 14 | Python | 8 | ftp_send_receive.py | Python | 4 | {
"docstring": "\n\tThe file which will be sent via the FTP server\n\tThe file send will be send to the current working directory\n",
"language": "en",
"n_whitespaces": 19,
"n_words": 21,
"vocab_size": 15
} | https://github.com/geekcomputers/Python.git | |
2 | get_queryset | def get_queryset(self):
qs = self.model_admin.get_queryset(self.request)
qs = qs.complex_filter(self.source_field.get_limit_choices_to())
qs, search_use_distinct = self.model_admin.get_search_results(
self.request, qs, self.term
)
if search_use_distinct:
... | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | 11 | autocomplete.py | 104 | Refs #33476 -- Reformatted code with Black. | 50,441 | 0 | 94 | 64 | 16 | 203,545 | 23 | django | 12 | django/contrib/admin/views/autocomplete.py | Python | 9 | {
"docstring": "Return queryset based on ModelAdmin.get_search_results().",
"language": "en",
"n_whitespaces": 4,
"n_words": 5,
"vocab_size": 5
} | https://github.com/django/django.git | |
1 | test_hub_not_support_wireless | async def test_hub_not_support_wireless(hass, mock_device_registry_devices):
await setup_mikrotik_entry(hass, support_wireless=False)
device_1 = hass.states.get("device_tracker.device_1")
assert device_1
assert device_1.state == "home"
# device_2 is added from DHCP
device_2 = hass.states.g... | b09aaba421d6d6178d582bef9ea363017e55639d | 9 | test_device_tracker.py | 95 | Add type hints and code cleanup for mikrotik (#74296)
* Add type hints and code cleanup for mikrotik
* update test and increase coverage
* move setup_mikrotik_entry to __init__.py | 114,071 | 0 | 58 | 53 | 22 | 315,483 | 31 | core | 10 | tests/components/mikrotik/test_device_tracker.py | Python | 8 | {
"docstring": "Test device_trackers created when hub doesn't support wireless.",
"language": "en",
"n_whitespaces": 7,
"n_words": 8,
"vocab_size": 8
} | https://github.com/home-assistant/core.git | |
1 | __dask_postcompute__ | def __dask_postcompute__(self) -> tuple[PostComputeCallable, tuple]:
raise NotImplementedError("Inheriting class must implement this method.")
| 1e783d9a714160e968936cb22d54d085959ab09e | 8 | typing.py | 32 | Collection Protocol (#8674)
[PEP 544](https://www.python.org/dev/peps/pep-0544/) introduces the `Protocol` class to the `typing` module in Python 3.8 (the soon be the minimum supported version, https://github.com/dask/community/issues/213). Writing new Dask collections for [dask-awkward](https://github.com/ContinuumIO... | 36,663 | 0 | 26 | 18 | 12 | 156,510 | 12 | dask | 5 | dask/typing.py | Python | 23 | {
"docstring": "Finalizer function and optional arguments to construct final result.\n\n Upon computation each key in the collection will have an in\n memory result, the postcompute function combines each key's\n result into a final in memory representation. For example,\n dask.array.Array... | https://github.com/dask/dask.git | |
1 | require_intel_extension_for_pytorch | def require_intel_extension_for_pytorch(test_case):
return unittest.skipUnless(is_ipex_available(), "test requires Intel Extension for PyTorch")(test_case)
| 34097b3304d79ace845316d4929220623279c8bc | 10 | testing_utils.py | 37 | Extend Transformers Trainer Class to Enable CPU AMP and Integrate Intel Extension for PyTorch (#17138)
* init PR
* fix import ipex
* minor fix on bf16
* refine optimizer
* refine args notes
* refine code
* refine ipex optimize args
* refine half_precision_backend
* black format
* isort forma... | 5,681 | 0 | 16 | 20 | 10 | 31,114 | 10 | transformers | 5 | src/transformers/testing_utils.py | Python | 2 | {
"docstring": "\n Decorator marking a test that requires Intel Extension for PyTorch.\n\n These tests are skipped when Intel Extension for PyTorch isn't installed.\n\n ",
"language": "en",
"n_whitespaces": 31,
"n_words": 21,
"vocab_size": 18
} | https://github.com/huggingface/transformers.git | |
2 | options_spec | def options_spec() -> str:
if not hasattr(options_spec, 'ans'):
OPTIONS =
setattr(options_spec, 'ans', OPTIONS.format(
appname=appname, conf_name=appname,
config_help=CONFIG_HELP.format(appname=appname, conf_name=appname),
))
ans: str = getattr(options_spec, 'ans... | 45bbe17559a541289699643ef0b541a2138a09d6 | 15 | cli.py | 105 | Docs: Minor improvements to the kitty cli help documentation
Add some text roles.
Use `kitty --hold`.
Use `appname` and `conf_name`.
`appname` is also applied to the system-wide configuration path. | 21,638 | 0 | 77 | 65 | 24 | 103,383 | 25 | kitty | 12 | kitty/cli.py | Python | 166 | {
"docstring": "\n--class\ndest=cls\ndefault={appname}\ncondition=not is_macos\nSet the class part of the :italic:`WM_CLASS` window property. On Wayland, it\nsets the app id.\n\n\n--name\ncondition=not is_macos\nSet the name part of the :italic:`WM_CLASS` property. Defaults to using the\nvalue from :option:`{appname}... | https://github.com/kovidgoyal/kitty.git | |
16 | execute | def execute():
warehouse_perm = frappe.get_all(
"User Permission",
fields=["count(*) as p_count", "is_default", "user"],
filters={"allow": "Warehouse"},
group_by="user",
)
if not warehouse_perm:
return
execute_patch = False
for perm_data in warehouse_perm:
if perm_data.p_count == 1 or (
perm_data.... | 494bd9ef78313436f0424b918f200dab8fc7c20b | 18 | repost_stock_ledger_entries_for_target_warehouse.py | 599 | style: format code with black | 14,274 | 0 | 105 | 351 | 103 | 66,656 | 171 | erpnext | 39 | erpnext/patches/v12_0/repost_stock_ledger_entries_for_target_warehouse.py | Python | 79 | {
"docstring": " SELECT parent_doc.name as name, child_doc.name as child_name\n\t\t\tFROM\n\t\t\t\t`tab{doctype}` parent_doc, `tab{doctype} Item` child_doc\n\t\t\tWHERE\n\t\t\t\tparent_doc.name = child_doc.parent AND parent_doc.docstatus < 2\n\t\t\t\tAND child_doc.target_warehouse is not null AND child_doc.target_war... | https://github.com/frappe/erpnext.git | |
6 | build_wheel | def build_wheel(self):
# type: () -> S
need_delete = False
if not self.pyproject.exists():
if not self.build_requires:
build_requires = '"setuptools", "wheel"'
else:
build_requires = ", ".join(
['"{0}"'.format(r) for r i... | 2669b4ce0696de02610cbea1b7547d53cead85bb | 17 | setup_info.py | 279 | patch newly occuring test failure where the base_dir does not contain the subdirectory. | 2,994 | 0 | 440 | 156 | 53 | 19,478 | 74 | pipenv | 30 | pipenv/vendor/requirementslib/models/setup_info.py | Python | 36 | {
"docstring": "\n[build-system]\nrequires = [{0}]\nbuild-backend = \"{1}\"\n ",
"language": "en",
"n_whitespaces": 20,
"n_words": 7,
"vocab_size": 6
} | https://github.com/pypa/pipenv.git | |
1 | make_rev_options | def make_rev_options(cls, rev=None, extra_args=None):
# type: (Optional[str], Optional[CommandArgs]) -> RevOptions
return RevOptions(cls, rev, extra_args=extra_args)
| f638f5d0e6c8ebed0e69a6584bc7f003ec646580 | 8 | versioncontrol.py | 39 | upd; format | 12,556 | 0 | 35 | 25 | 14 | 61,411 | 14 | transferlearning | 5 | .venv/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.py | Python | 2 | {
"docstring": "\n Return a RevOptions object.\n\n Args:\n rev: the name of a revision to install.\n extra_args: a list of extra options.\n ",
"language": "en",
"n_whitespaces": 59,
"n_words": 19,
"vocab_size": 16
} | https://github.com/jindongwang/transferlearning.git | |
14 | generate_module_groups | def generate_module_groups(self) -> Dict[int, List[str]]:
assert self.bound_model is not None, 'No model bounded in this compressor, please use Compressor.reset(model, config_list) to set it.'
assert self.config_list is not None, 'No config_list set in this compressor, please use Compressor.res... | cbac2c5c0f7606aca8ccf08fbd418ffe3adfe427 | 18 | compressor.py | 377 | [Compression] fix typehints (#4800) | 24,731 | 0 | 606 | 227 | 78 | 112,723 | 150 | nni | 28 | nni/algorithms/compression/v2/pytorch/base/compressor.py | Python | 38 | {
"docstring": "\n Get all module names in each config in config_list.\n\n Returns\n -------\n Dict[int, List[str]]\n A dict. The key is the config idx in config_list, the value is the module name list. i.e., {1: ['layer.0', 'layer.2']}.\n ",
"language": "en",
"n_whit... | https://github.com/microsoft/nni.git | |
1 | send_welcome | def send_welcome(message):
text =
markdown = telebot.types.InlineKeyboardMarkup()
markdown.add(
telebot.types.InlineKeyboardButton(
"Star us on GitHub",
url="https://github.com/GamestonkTerminal/GamestonkTerminal",
)
)
markdown.add(
telebot.types.Inli... | 635851cbf633a6ea9423ba31fe8f68ab34423a8c | @bot.message_handler(commands=["cmds", "commands"]) | 11 | run_telegram.py | 154 | Telegram Bot (#1458)
* added initial code for telegram
* improving suggestions and messages
* improving messages
* typo
Co-authored-by: teh_coderer <me@tehcoderer.com> | 84,305 | 1 | 138 | 76 | 29 | 282,800 | 41 | OpenBBTerminal | 19 | bots/telegram/run_telegram.py | Python | 21 | {
"docstring": "\nWelcome to *Gamestonk Terminal Bot* 🦋\nInvestment Research for Everyone\nCheck the available commands with /cmds\n ",
"language": "en",
"n_whitespaces": 17,
"n_words": 16,
"vocab_size": 16
} | https://github.com/OpenBB-finance/OpenBBTerminal.git |
6 | filter | def filter(names, pat):
result = []
pat = os.path.normcase(pat)
match = _compile_pattern(pat)
if os.path is posixpath:
# normcase on posix is NOP. Optimize it away from the loop.
for name in names:
if match(name):
result.append(name)
else:
for... | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | 15 | fnmatch.py | 132 | add python 3.10.4 for windows | 54,738 | 0 | 139 | 80 | 34 | 217,382 | 45 | XX-Net | 12 | python3.10.4/Lib/fnmatch.py | Python | 13 | {
"docstring": "Construct a list from those elements of the iterable NAMES that match PAT.",
"language": "en",
"n_whitespaces": 12,
"n_words": 13,
"vocab_size": 13
} | https://github.com/XX-net/XX-Net.git | |
1 | test_stream_unsupported_by_bulk | def test_stream_unsupported_by_bulk(stream_config, stream_api, caplog):
stream_name = "AcceptedEventRelation"
stream = _generate_stream(stream_name, stream_config, stream_api)
assert not isinstance(stream, BulkSalesforceStream)
| 0a3713a5a52995dc0dc205d8edfd097bf625899f | 8 | unit_test.py | 50 | Source Salesforce: Deprecate API Type parameter (#9302)
* use BULK for the first sync, REST for incremental sync
* if stream contains compound data or/and base64 use always REST
* fix get stream state from connector state
* fix integration test
* refactor catalog name
* format code
* refactor unit te... | 469 | 0 | 28 | 31 | 15 | 3,401 | 16 | airbyte | 9 | airbyte-integrations/connectors/source-salesforce/unit_tests/unit_test.py | Python | 4 | {
"docstring": "\n Stream `AcceptedEventRelation` is not supported by BULK API, so that REST API stream will be used for it.\n ",
"language": "en",
"n_whitespaces": 25,
"n_words": 18,
"vocab_size": 18
} | https://github.com/airbytehq/airbyte.git | |
8 | call_exception_handler | def call_exception_handler(self, context):
if self._exception_handler is None:
try:
self.default_exception_handler(context)
except (SystemExit, KeyboardInterrupt):
raise
except BaseException:
# Second protection layer f... | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | 18 | base_events.py | 202 | add python 3.10.4 for windows | 55,979 | 0 | 708 | 113 | 69 | 220,367 | 115 | XX-Net | 12 | python3.10.4/Lib/asyncio/base_events.py | Python | 28 | {
"docstring": "Call the current event loop's exception handler.\n\n The context argument is a dict containing the following keys:\n\n - 'message': Error message;\n - 'exception' (optional): Exception object;\n - 'future' (optional): Future instance;\n - 'task' (optional): Task inst... | https://github.com/XX-net/XX-Net.git | |
1 | test_sept_child | def test_sept_child() -> None:
rows = 10_000
cols = 7
# these times and sizes are based on the above constants and Madhavas MacBook Pro 2019
expected_sept_mem_size = 0.8035125732421875
expected_sept_ser_size = 1.4993972778320312
macbook_pro_2019_ser_time = 0.03371272199999975
macbook_pr... | 10ae1d589044a6ae4722ead7aedc63fcdc4923b5 | 10 | tensor_serde_test.py | 449 | Started DPTensor resource optimization
- Added initial REPT and SEPT benchmarking tests
- Deleted unused old Tensor classes
- Added pympler for memory size tests
Co-authored-by: @IshanMi
Co-authored-by: @rasswanth-s | 45 | 0 | 345 | 251 | 123 | 71 | 216 | PySyft | 30 | packages/syft/tests/syft/core/tensor/tensor_serde_test.py | Python | 38 | {
"docstring": "We need to benchmark both the size and time to serialize and deserialize SEPTs",
"language": "en",
"n_whitespaces": 13,
"n_words": 14,
"vocab_size": 12
} | https://github.com/OpenMined/PySyft.git | |
1 | test_xcom_pull_after_deferral | def test_xcom_pull_after_deferral(self, create_task_instance, session):
key = 'xcom_key'
value = 'xcom_value'
ti = create_task_instance(
dag_id='test_xcom',
schedule_interval='@monthly',
task_id='test_xcom',
pool='test_xcom',
)
... | 8b687ec82a7047fc35410f5c5bb0726de434e749 | 10 | test_taskinstance.py | 165 | Do not clear XCom when resuming from deferral (#22932) | 9,082 | 0 | 160 | 96 | 28 | 47,362 | 32 | airflow | 20 | tests/models/test_taskinstance.py | Python | 16 | {
"docstring": "\n tests xcom will not clear before a task runs its next method after deferral.\n ",
"language": "en",
"n_whitespaces": 29,
"n_words": 14,
"vocab_size": 14
} | https://github.com/apache/airflow.git | |
2 | test_pisa_ssd_head_loss | def test_pisa_ssd_head_loss(self):
s = 300
img_metas = [{
'img_shape': (s, s, 3),
'scale_factor': 1,
}]
cfg = Config(
dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.5,
... | 9d7511d8c35df1f9c13b17eb770136859bf370be | 15 | test_pisa_ssd_head.py | 1,025 | Update SSD and PISA-SSD model config | 70,500 | 0 | 1,565 | 698 | 162 | 244,730 | 382 | mmdetection | 63 | tests/test_models/test_dense_heads/test_pisa_ssd_head.py | Python | 88 | {
"docstring": "Tests pisa ssd head loss when truth is empty and non-empty.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 11
} | https://github.com/open-mmlab/mmdetection.git | |
2 | get_installation_order | def get_installation_order(self, req_set):
# type: (RequirementSet) -> List[InstallRequirement]
# The current implementation, which we may change at any point
# installs the user specified things in the order given, except when
# dependencies must come earlier to achieve topolog... | f638f5d0e6c8ebed0e69a6584bc7f003ec646580 | 8 | resolver.py | 36 | upd; format | 12,403 | 0 | 99 | 36 | 41 | 61,060 | 49 | transferlearning | 6 | .venv/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py | Python | 7 | {
"docstring": "Create the installation order.\n\n The installation order is topological - requirements are installed\n before the requiring thing. We break cycles at an arbitrary point,\n and make no other guarantees.\n ",
"language": "en",
"n_whitespaces": 57,
"n_words": 29,
"voc... | https://github.com/jindongwang/transferlearning.git | |
3 | bump_client_version | def bump_client_version(self):
path = os.path.join(".", "client", "package.json")
input_file = io.open(path, "r")
try:
package = json.loads(input_file.read().decode("utf-8"))
except (ValueError) as e:
print("Unable to read " + path + " " + e) # noqa
... | d10f15e55806c6944827d801cd9c2d53f5da4186 | 16 | setup.py | 247 | Reformat with black | 16,486 | 0 | 204 | 138 | 45 | 76,287 | 65 | wagtail | 26 | wagtail/utils/setup.py | Python | 15 | {
"docstring": "\n Writes the current Wagtail version number into package.json\n ",
"language": "en",
"n_whitespaces": 23,
"n_words": 8,
"vocab_size": 8
} | https://github.com/wagtail/wagtail.git | |
2 | native_min_value | def native_min_value(self) -> float:
return (self.max_value * -1) if self._is_bidirectional else 6
| 5b32eea3d04d223b01efddb5c13a88e540df8741 | 9 | number.py | 38 | Add support for bidirectional chargers to Wallbox integration (#74313)
* Add support for the Quasar bidirectional charger to the Wallbox integration, including ability to control charger while discharging, set a negative charge rate and monitor discharged amount
* Make code more generic in order to support other bi... | 115,406 | 0 | 26 | 23 | 12 | 316,830 | 12 | core | 5 | homeassistant/components/wallbox/number.py | Python | 3 | {
"docstring": "Return the minimum available current based on charger type - some chargers can discharge.",
"language": "en",
"n_whitespaces": 13,
"n_words": 14,
"vocab_size": 14
} | https://github.com/home-assistant/core.git | |
1 | test_cache_limit_ttl_greater_than_default_cache_ttl | def test_cache_limit_ttl_greater_than_default_cache_ttl(self):
page1 = create_page('test page 1', 'nav_playground.html', 'en',
published=True)
page1_url = page1.get_absolute_url()
limit_page_cache_ttl_function = ".".join([PlaceholderCacheTestCase.__module__,... | c412e97acba65a2a68e70ca15ea950bd31f90d3e | 12 | test_cache.py | 190 | feat: add cache ttl extension point (#7299)
Adds the setting `CMS_CACHE_LIMIT_TTL_CLASS` that should have a
`limit_page_cache_ttl` method that would be called to limit the cache
ttl of a page using business logic.
Closes #7296 | 17,357 | 0 | 153 | 109 | 30 | 82,360 | 35 | django-cms | 26 | cms/tests/test_cache.py | Python | 11 | {
"docstring": "\n Test the `CMS_LIMIT_TTL_CACHE_FUNCTION` setting with a class that returns a value much\n greater thant the default value of 40 seconds.\n ",
"language": "en",
"n_whitespaces": 42,
"n_words": 20,
"vocab_size": 17
} | https://github.com/django-cms/django-cms.git | |
3 | subordinate_to_user | def subordinate_to_user(self, user, site):
# get user level
from cms.utils.page_permissions import get_change_permissions_id_list
from cms.utils.permissions import get_user_permission_level
try:
user_level = get_user_permission_level(user, site)
except NoPer... | a3110e1ff24085373898c7d2a85f628abeb8518d | 11 | managers.py | 168 | Enabled isort workflow (#7200)
* Ran isort
* Enabled isort workflow
Co-authored-by: Vinit Kumar <mail@vinitkumar.me> | 17,339 | 0 | 229 | 102 | 53 | 82,288 | 69 | django-cms | 23 | cms/models/managers.py | Python | 16 | {
"docstring": "Get all page permission objects on which user/group is lover in\n hierarchy then given user and given user can change permissions on them.\n\n !IMPORTANT, but exclude objects with given user, or any group containing\n this user - he can't be able to change his own permissions, bec... | https://github.com/django-cms/django-cms.git | |
2 | test_finditer | def test_finditer():
matches = list(finditer(re.compile(rb"\d+"), b"0123 4567 890 12 3 4"))
aligned = [i.group() for i in matches]
assert aligned == [b"0123", b"567", b"890", b"12"]
| dc12cb59559f99110917bcbd21c9960ab57d994f | 13 | test_bytecode.py | 84 | tests: fix test_finditer
Have the test use bytestrings instead of strings.
Also assert that the bytecode string passed to bytecode.finditer()
is in fact a bytestring. | 77,525 | 0 | 37 | 52 | 23 | 263,956 | 25 | pyinstaller | 9 | tests/unit/test_bytecode.py | Python | 4 | {
"docstring": "\n Test that bytecode.finditer() yields matches only that start on an even byte (``match.start() % 2 == 0``).\n\n There are 3 permutations here when considering a match:\n - A match starts on an even byte:\n That's good! Include that sequence.\n - A single character match starts on ... | https://github.com/pyinstaller/pyinstaller.git | |
9 | cartesian_product | def cartesian_product(X) -> list[np.ndarray]:
msg = "Input must be a list-like of list-likes"
if not is_list_like(X):
raise TypeError(msg)
for x in X:
if not is_list_like(x):
raise TypeError(msg)
if len(X) == 0:
return []
lenX = np.fromiter((len(x) for x in... | f65417656ba8c59438d832b6e2a431f78d40c21c | 11 | util.py | 290 | TYP: more return annotations in core/ (#47618)
* TYP: more return annotations in core/
* from __future__ import annotations
* more __future__ | 40,127 | 0 | 195 | 182 | 68 | 167,802 | 96 | pandas | 27 | pandas/core/reshape/util.py | Python | 42 | {
"docstring": "\n Numpy version of itertools.product.\n Sometimes faster (for large inputs)...\n\n Parameters\n ----------\n X : list-like of list-likes\n\n Returns\n -------\n product : list of ndarrays\n\n Examples\n --------\n >>> cartesian_product([list('ABC'), [1, 2]])\n [arr... | https://github.com/pandas-dev/pandas.git | |
1 | is_monotonic_decreasing | def is_monotonic_decreasing(self) -> bool:
return self._engine.is_monotonic_decreasing
| 62a69beddbedde349891378992c902c0b9341a9f | 7 | base.py | 25 | DOC: Add numpydoc SS06 validation (#47885) | 40,199 | 0 | 20 | 14 | 6 | 168,092 | 6 | pandas | 4 | pandas/core/indexes/base.py | Python | 14 | {
"docstring": "\n Return a boolean if the values are equal or decreasing.\n\n Examples\n --------\n >>> Index([3, 2, 1]).is_monotonic_decreasing\n True\n >>> Index([3, 2, 2]).is_monotonic_decreasing\n True\n >>> Index([3, 1, 2]).is_monotonic_decreasing\n ... | https://github.com/pandas-dev/pandas.git | |
13 | get_traceback_frame_variables | def get_traceback_frame_variables(self, request, tb_frame):
# Loop through the frame's callers to see if the sensitive_variables
# decorator was used.
current_frame = tb_frame.f_back
sensitive_variables = None
while current_frame is not None:
if (
... | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | 18 | debug.py | 355 | Refs #33476 -- Reformatted code with Black. | 51,719 | 0 | 757 | 209 | 105 | 206,808 | 195 | django | 19 | django/views/debug.py | Python | 34 | {
"docstring": "\n Replace the values of variables marked as sensitive with\n stars (*********).\n ",
"language": "en",
"n_whitespaces": 33,
"n_words": 11,
"vocab_size": 11
} | https://github.com/django/django.git | |
1 | image2hmap | def image2hmap(self, image_tensor):
return self.model.forward(image_tensor, training=False)
| 803b90729d25fda253011c505d0189e8e63cc039 | 8 | DBNet.py | 34 | add dbnet | 27,289 | 0 | 28 | 21 | 6 | 123,112 | 6 | EasyOCR | 6 | easyocr/DBNet/DBNet.py | Python | 2 | {
"docstring": "\n Run the model to obtain a heatmap tensor from a image tensor. The heatmap\n tensor indicates the probability of each pixel being a part of text area.\n\n Parameters\n ----------\n image_tensor : torch.tensor\n Image tensor.\n\n Returns\n -... | https://github.com/JaidedAI/EasyOCR.git | |
7 | get_extended_attribute | def get_extended_attribute(value):
# XXX: should we have an ExtendedAttribute TokenList?
attribute = Attribute()
if value and value[0] in CFWS_LEADER:
token, value = get_cfws(value)
attribute.append(token)
if value and value[0] in EXTENDED_ATTRIBUTE_ENDS:
raise errors.Header... | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | 12 | _header_value_parser.py | 164 | add python 3.10.4 for windows | 56,956 | 0 | 129 | 99 | 33 | 223,533 | 56 | XX-Net | 13 | python3.10.4/Lib/email/_header_value_parser.py | Python | 14 | {
"docstring": " [CFWS] 1*extended_attrtext [CFWS]\n\n This is like the non-extended version except we allow % characters, so that\n we can pick up an encoded value as a single string.\n\n ",
"language": "en",
"n_whitespaces": 37,
"n_words": 27,
"vocab_size": 25
} | https://github.com/XX-net/XX-Net.git | |
1 | test_table_options_language | def test_table_options_language(self):
# default must always contain a language value
block = TableBlock()
self.assertIn("language", block.table_options)
# French
translation.activate("fr-fr")
block_fr = TableBlock()
self.assertEqual("fr-fr", block_fr.tab... | d10f15e55806c6944827d801cd9c2d53f5da4186 | 12 | tests.py | 212 | Reformat with black | 16,063 | 0 | 167 | 113 | 38 | 73,597 | 48 | wagtail | 13 | wagtail/contrib/table_block/tests.py | Python | 13 | {
"docstring": "\n Test that the environment's language is used if no language provided.\n ",
"language": "en",
"n_whitespaces": 26,
"n_words": 11,
"vocab_size": 10
} | https://github.com/wagtail/wagtail.git | |
2 | get_static_batch_size | def get_static_batch_size(layer):
batch_input_shape, _ = get_input_shape_and_dtype(layer)
if batch_input_shape is not None:
return tf.compat.v1.Dimension(batch_input_shape[0]).value
return None
| 84afc5193d38057e2e2badf9c889ea87d80d8fbf | 12 | training_utils.py | 62 | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | 80,855 | 0 | 34 | 38 | 14 | 271,831 | 15 | keras | 10 | keras/engine/training_utils.py | Python | 5 | {
"docstring": "Gets the static batch size of a Layer.\n\n Args:\n layer: a `Layer` instance.\n\n Returns:\n The static batch size of a Layer.\n ",
"language": "en",
"n_whitespaces": 40,
"n_words": 21,
"vocab_size": 14
} | https://github.com/keras-team/keras.git | |
4 | modularity | def modularity(G, communities, weight="weight", resolution=1):
r
if not isinstance(communities, list):
communities = list(communities)
if not is_partition(G, communities):
raise NotAPartition(G, communities)
directed = G.is_directed()
if directed:
out_degree = dict(G.out_deg... | f6755ffa00211b523c6c0bec5398bc6c3c43c8b1 | 15 | quality.py | 226 | Update black (#5438)
* CI: sync up black dev requirements version with precommit
* Run black
Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com> | 41,926 | 0 | 145 | 152 | 36 | 176,475 | 58 | networkx | 20 | networkx/algorithms/community/quality.py | Python | 99 | {
"docstring": "Returns the modularity of the given partition of the graph.\n\n Modularity is defined in [1]_ as\n\n .. math::\n Q = \\frac{1}{2m} \\sum_{ij} \\left( A_{ij} - \\gamma\\frac{k_ik_j}{2m}\\right)\n \\delta(c_i,c_j)\n\n where $m$ is the number of edges, $A$ is the adjacency matr... | https://github.com/networkx/networkx.git | |
2 | handle | def handle(self, query, args, env, session):
if isinstance(self.result, dict):
return self.result
else:
return self.result(query, args, env, session)
| 3023d6e0223e50c2d7cbe850f1c5355e5d505ceb | 10 | responder.py | 63 | renaming | 25,106 | 0 | 60 | 43 | 14 | 114,143 | 17 | mindsdb | 9 | mindsdb/api/mongo/classes/responder.py | Python | 5 | {
"docstring": " making answer based on params:\n\n query (dict): document(s) from request\n args (dict): all other significant information from request: flags, collection name, rows to return, etc\n env (dict): config, model_interface instance, and other mindsdb related stuff\n session (o... | https://github.com/mindsdb/mindsdb.git | |
3 | GetContainingXLAContext | def GetContainingXLAContext(ctxt):
while ctxt:
if ctxt.IsXLAContext():
return ctxt
ctxt = ctxt.outer_context
return None
| 84afc5193d38057e2e2badf9c889ea87d80d8fbf | 9 | control_flow_util.py | 44 | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | 81,705 | 0 | 47 | 25 | 11 | 276,712 | 13 | keras | 4 | keras/utils/control_flow_util.py | Python | 6 | {
"docstring": "Returns the first ancestor XLAContext of `ctxt`.\n\n Returns `ctxt` if `ctxt` is a XLAContext, or None if `ctxt` is not in a\n while loop.\n\n Args:\n ctxt: ControlFlowContext\n\n Returns:\n `ctxt` if `ctxt` is a XLAContext, the most nested XLAContext containing\n `ctxt`, or... | https://github.com/keras-team/keras.git | |
1 | get_model | def get_model(self, git_model_id, model_filename, backend):
model = GetModel(model_filename, git_model_id).model_path
model = cv2.dnn.readNetFromCaffe(model[1], model[0])
model.setPreferableTarget(self.get_backend(backend))
return model
| f2e6f24651f62b28ccfb412180baca0aa7baf96a | 9 | vgg_face.py | 81 | Centralize model storage | 20,368 | 0 | 51 | 53 | 13 | 100,921 | 16 | faceswap | 13 | lib/vgg_face.py | Python | 5 | {
"docstring": " Check if model is available, if not, download and unzip it ",
"language": "en",
"n_whitespaces": 12,
"n_words": 11,
"vocab_size": 10
} | https://github.com/deepfakes/faceswap.git | |
1 | copy_sign | def copy_sign(self, a, b):
a = _convert_other(a, raiseit=True)
return a.copy_sign(b)
| 8198943edd73a363c266633e1aa5b2a9e9c9f526 | 9 | _pydecimal.py | 43 | add python 3.10.4 for windows | 55,690 | 0 | 31 | 27 | 10 | 219,662 | 10 | XX-Net | 6 | python3.10.4/Lib/_pydecimal.py | Python | 3 | {
"docstring": "Copies the second operand's sign to the first one.\n\n In detail, it returns a copy of the first operand with the sign\n equal to the sign of the second operand.\n\n >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33'))\n Decimal('1.50')\n >>> ExtendedCont... | https://github.com/XX-net/XX-Net.git | |
2 | forward | def forward(self, feats, img_metas):
batch_size = len(img_metas)
input_img_h, input_img_w = img_metas[0]['batch_input_shape']
padding_mask = feats[-1].new_ones(
(batch_size, input_img_h, input_img_w), dtype=torch.float32)
for i in range(batch_size):
img_h... | cac356380d505bf15587f07c0529218cc36b9652 | 17 | maskformer_head.py | 475 | [Feature] Add Maskformer to mmdet (#7212)
* first commit
* add README
* move model description from config to readme
add description for binary_input
add description for dice loss
add a independent panoptic gt processing function
add a independent panoptic gt processing function
remove compatibili... | 70,209 | 0 | 553 | 302 | 97 | 244,039 | 167 | mmdetection | 54 | mmdet/models/dense_heads/maskformer_head.py | Python | 34 | {
"docstring": "Forward function.\n\n Args:\n feats (list[Tensor]): Features from the upstream network, each\n is a 4D-tensor.\n img_metas (list[dict]): List of image information.\n\n Returns:\n all_cls_scores (Tensor): Classification scores for each\\\n ... | https://github.com/open-mmlab/mmdetection.git | |
3 | test_text | def test_text(self, qt_key, upper):
modifiers = Qt.KeyboardModifier.ShiftModifier if upper else Qt.KeyboardModifiers()
info = keyutils.KeyInfo(qt_key.member, modifiers=modifiers)
expected = qt_key.uppertext if upper else qt_key.text
assert info.text() == expected
| 0877fb0d78635692e481c8bde224fac5ad0dd430 | 9 | test_keyutils.py | 90 | Run scripts/dev/rewrite_enums.py | 117,685 | 0 | 61 | 58 | 20 | 321,379 | 26 | qutebrowser | 16 | tests/unit/keyinput/test_keyutils.py | Python | 5 | {
"docstring": "Test KeyInfo.text() with all possible keys.\n\n See key_data.py for inputs and expected values.\n ",
"language": "en",
"n_whitespaces": 27,
"n_words": 13,
"vocab_size": 13
} | https://github.com/qutebrowser/qutebrowser.git | |
28 | present | def present(name, acl_type, acl_name="", perms="", recurse=False, force=False):
ret = {"name": name, "result": True, "changes": {}, "comment": ""}
_octal = {"r": 4, "w": 2, "x": 1, "-": 0}
_octal_lookup = {0: "-", 1: "r", 2: "w", 4: "x"}
if not os.path.exists(name):
ret["comment"] = "{} d... | f2a783643de61cac1ff3288b40241e5ce6e1ddc8 | 23 | linux_acl.py | 1,365 | Update to latest ``pyupgrade`` hook. Stop skipping it on CI.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com> | 54,297 | 0 | 3,212 | 807 | 248 | 215,977 | 522 | salt | 51 | salt/states/linux_acl.py | Python | 155 | {
"docstring": "\n Ensure a Linux ACL is present\n\n name\n The acl path\n\n acl_type\n The type of the acl is used for it can be 'user' or 'group'\n\n acl_name\n The user or group\n\n perms\n Set the permissions eg.: rwx\n\n recurse\n Set the permissions recursiv... | https://github.com/saltstack/salt.git | |
7 | test_rate_limited | def test_rate_limited(self):
org_strings = {1: {"a", "b", "c"}, 2: {"e", "f"}, 3: {"g"}}
with override_options(
{
"sentry-metrics.writes-limiter.limits.releasehealth.per-org": [
{"window_seconds": 10, "granularity_seconds": 10, "limit": 1}
... | c4cc0467974bcfb2b3c95120bd19c337aa977183 | 15 | test_postgres_indexer.py | 476 | feat(metrics_indexer): Add rate limits functionality to indexer [INGEST-1380] (#36263)
* feat(metrics_indexer): Add rate limits functionality to indexer [INGEST-1380]
The postgres string indexer now is able to rate limit writes using four
sentry options. If that happens, `None` is returned in place of an
integer,... | 18,908 | 0 | 631 | 294 | 75 | 92,391 | 137 | sentry | 23 | tests/sentry/sentry_metrics/test_postgres_indexer.py | Python | 46 | {
"docstring": "\n Assert that rate limits per-org and globally are applied at all.\n\n Since we don't have control over ordering in sets/dicts, we have no\n control over which string gets rate-limited. That makes assertions\n quite awkward and imprecise.\n ",
"language": "en",
... | https://github.com/getsentry/sentry.git | |
3 | register_for_auto_class | def register_for_auto_class(cls, auto_class="FlaxAutoModel"):
if not isinstance(auto_class, str):
auto_class = auto_class.__name__
import transformers.models.auto as auto_module
if not hasattr(auto_module, auto_class):
raise ValueError(f"{auto_class} is not a v... | 44b21f117bcf71e3d88a11c3523c94b27949fdbf | 11 | modeling_flax_utils.py | 150 | Save code of registered custom models (#15379)
* Allow dynamic modules to use relative imports
* Work for configs
* Fix last merge conflict
* Save code of registered custom objects
* Map strings to strings
* Fix test
* Add tokenizer
* Rework tests
* Tests
* Ignore fixtures py files for tests... | 6,342 | 0 | 113 | 52 | 47 | 34,808 | 57 | transformers | 21 | src/transformers/modeling_flax_utils.py | Python | 7 | {
"docstring": "\n Register this class with a given auto class. This should only be used for custom models as the ones in the\n library are already mapped with an auto class.\n\n Args:\n auto_class (`str` or `type`, *optional*, defaults to `\"FlaxAutoModel\"`):\n The aut... | https://github.com/huggingface/transformers.git | |
5 | SearchBackend | def SearchBackend(params):
if connection.vendor == 'postgresql':
from .postgres.postgres import PostgresSearchBackend
return PostgresSearchBackend(params)
elif connection.vendor == 'mysql':
from .mysql.mysql import MySQLSearchBackend
return MySQLSearchBackend(params)
eli... | 4248d406c011d6ba6207bb0e0e9b885813d961be | 13 | __init__.py | 177 | Test for presence of fts5 extension in sqlite backend initialisation and migration | 15,513 | 0 | 174 | 99 | 28 | 70,498 | 52 | wagtail | 14 | wagtail/search/backends/database/__init__.py | Python | 18 | {
"docstring": "\n Returns the appropriate search backend for the current 'default' database system\n ",
"language": "en",
"n_whitespaces": 18,
"n_words": 11,
"vocab_size": 10
} | https://github.com/wagtail/wagtail.git | |
2 | test_nca_feature_names_out | def test_nca_feature_names_out():
X = iris_data
y = iris_target
est = NeighborhoodComponentsAnalysis().fit(X, y)
names_out = est.get_feature_names_out()
class_name_lower = est.__class__.__name__.lower()
expected_names_out = np.array(
[f"{class_name_lower}{i}" for i in range(est.c... | 330881a21ca48c543cc8a67aa0d4e4c1dc1001ab | 15 | test_nca.py | 132 | ENH Adds get_feature_names_out to neighbors module (#22212)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> | 75,280 | 0 | 71 | 77 | 25 | 258,535 | 30 | scikit-learn | 24 | sklearn/neighbors/tests/test_nca.py | Python | 11 | {
"docstring": "Check `get_feature_names_out` for `NeighborhoodComponentsAnalysis`.",
"language": "en",
"n_whitespaces": 3,
"n_words": 4,
"vocab_size": 4
} | https://github.com/scikit-learn/scikit-learn.git | |
1 | test_query_with_bool_in_params | def test_query_with_bool_in_params(client):
with mock.patch("rest_api.controller.search.query_pipeline") as mocked_pipeline:
# `run` must return a dictionary containing a `query` key
mocked_pipeline.run.return_value = {"query": TEST_QUERY}
request_body = {
"query": TEST_QUER... | 632cd1c141a8b485c6ef8695685d2d8eef3ca50f | 15 | test_rest_api.py | 185 | Allow values that are not dictionaries in the request params in the `/search` endpoint (#2720)
* let params contain something else than dictionaries
* rewrite the test same style as the main branch | 75,098 | 0 | 145 | 102 | 44 | 257,593 | 54 | haystack | 15 | rest_api/test/test_rest_api.py | Python | 12 | {
"docstring": "\n Ensure items of params can be other types than dictionary, see\n https://github.com/deepset-ai/haystack/issues/2656\n ",
"language": "en",
"n_whitespaces": 22,
"n_words": 12,
"vocab_size": 12
} | https://github.com/deepset-ai/haystack.git | |
2 | _setup_amd | def _setup_amd(cls, arguments):
logger.debug("Setting up for AMD")
try:
import plaidml # noqa pylint:disable=unused-import,import-outside-toplevel
except ImportError:
logger.error("PlaidML not found. Run `pip install plaidml-keras` for AMD support")
... | bdbbad4d310fb606b6f412aa81e9f57ccd994e97 | 11 | launcher.py | 96 | Refactor lib.gpu_stats (#1218)
* inital gpu_stats refactor
* Add dummy CPU Backend
* Update Sphinx documentation | 19,995 | 0 | 132 | 53 | 35 | 100,531 | 41 | faceswap | 13 | lib/cli/launcher.py | Python | 11 | {
"docstring": " Test for plaidml and perform setup for AMD.\n\n Parameters\n ----------\n arguments: :class:`argparse.Namespace`\n The command line arguments passed to Faceswap.\n ",
"language": "en",
"n_whitespaces": 59,
"n_words": 19,
"vocab_size": 18
} | https://github.com/deepfakes/faceswap.git | |
3 | is_arborescence | def is_arborescence(G):
return is_tree(G) and max(d for n, d in G.in_degree()) <= 1
@nx.utils.not_implemented_for("undirected") | 5a7985fc41bc0c686c035de43c66cf4fb5fcc94f | @nx.utils.not_implemented_for("undirected") | 12 | recognition.py | 64 | Added examples in tournament and tree functions (#5536)
* examples
* examples
* examples
* Example changed
* improved styling
* revised
* edge labels
* improved styling
* spacing
* error testing
* examples
* styling
* add_nodes removed
* spaceing
* spacing
* spacing
* ad... | 41,959 | 1 | 19 | 28 | 14 | 176,550 | 14 | networkx | 10 | networkx/algorithms/tree/recognition.py | Python | 2 | {
"docstring": "\n Returns True if `G` is an arborescence.\n\n An arborescence is a directed tree with maximum in-degree equal to 1.\n\n Parameters\n ----------\n G : graph\n The graph to test.\n\n Returns\n -------\n b : bool\n A boolean that is True if `G` is an arborescence.\n... | https://github.com/networkx/networkx.git |
1 | test_public_receipt_can_override_private | def test_public_receipt_can_override_private(self) -> None:
# Send a message as the first user
res = self.helper.send(self.room_id, body="hello", tok=self.tok)
# Send a private read receipt
channel = self.make_request(
"POST",
f"/rooms/{self.room_id}/rec... | 116a4c8340b729ffde43be33df24d417384cb28b | 12 | test_sync.py | 232 | Implement changes to MSC2285 (hidden read receipts) (#12168)
* Changes hidden read receipts to be a separate receipt type
(instead of a field on `m.read`).
* Updates the `/receipts` endpoint to accept `m.fully_read`. | 72,135 | 0 | 248 | 114 | 39 | 248,167 | 62 | synapse | 20 | tests/rest/client/test_sync.py | Python | 22 | {
"docstring": "\n Sending a public read receipt to the same event which has a private read\n receipt should cause that receipt to become public.\n ",
"language": "en",
"n_whitespaces": 44,
"n_words": 22,
"vocab_size": 17
} | https://github.com/matrix-org/synapse.git | |
2 | _print_pgf_to_fh | def _print_pgf_to_fh(self, fh, *, bbox_inches_restore=None):
header_text =
# append the preamble used by the backend as a comment for debugging
header_info_preamble = ["%% Matplotlib used the following preamble"]
for line in _get_preamble().splitlines():
header_info_preamb... | 7bafb8be7c6e81180e9518a91d10da9422321a0c | 11 | backend_pgf.py | 327 | Deprecate internal use of get/set dpi | 23,310 | 0 | 389 | 195 | 77 | 108,693 | 104 | matplotlib | 23 | lib/matplotlib/backends/backend_pgf.py | Python | 46 | {
"docstring": "%% Creator: Matplotlib, PGF backend\n%%\n%% To include the figure in your LaTeX document, write\n%% \\\\input{<filename>.pgf}\n%%\n%% Make sure the required packages are loaded in your preamble\n%% \\\\usepackage{pgf}\n%%\n%% Also ensure that all the required font packages are loaded; for instance... | https://github.com/matplotlib/matplotlib.git | |
2 | to_pandas_refs | def to_pandas_refs(self) -> List[ObjectRef["pandas.DataFrame"]]:
block_to_df = cached_remote_fn(_block_to_df)
return [block_to_df.remote(block) for block in self._blocks.get_blocks()]
| 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | 10 | dataset.py | 65 | [CI] Format Python code with Black (#21975)
See #21316 and #21311 for the motivation behind these changes. | 29,316 | 0 | 34 | 39 | 13 | 130,580 | 13 | ray | 11 | python/ray/data/dataset.py | Python | 15 | {
"docstring": "Convert this dataset into a distributed set of Pandas dataframes.\n\n This is only supported for datasets convertible to Arrow records.\n This function induces a copy of the data. For zero-copy access to the\n underlying data, consider using ``.to_arrow()`` or\n ``.get_inte... | https://github.com/ray-project/ray.git | |
8 | build | def build(self, var_list, exclude_from_weight_decay=None):
super().build(var_list)
if hasattr(self, "_built") and self._built:
return
self._built = True
if not hasattr(self, "_exclude_from_weight_decay"):
self._exclude_from_weight_decay = exclude_from_wei... | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | 15 | adamw.py | 238 | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | 81,348 | 0 | 400 | 145 | 37 | 275,252 | 60 | keras | 17 | keras/optimizers/optimizer_experimental/adamw.py | Python | 28 | {
"docstring": "Initialize optimizer variables.\n\n AdamW optimizer has 3 types of variables: momentums, velocities and\n velocity_hat (only set when amsgrad is applied),\n\n Args:\n var_list: list of model variables to build AdamW variables on.\n exclude_from_weight_decay: list... | https://github.com/keras-team/keras.git | |
3 | validate_input | async def validate_input(data):
base = Alpha2Base(data["host"])
try:
await base.update_data()
except (aiohttp.client_exceptions.ClientConnectorError, asyncio.TimeoutError):
return {"error": "cannot_connect"}
except Exception: # pylint: disable=broad-except
_LOGGER.exceptio... | 243d003acc11d638feb3867410c3cbb1987520bc | 11 | config_flow.py | 123 | Add Moehlenhoff Alpha2 underfloor heating system integration (#42771)
* Add Moehlenhoff Alpha2 underfloor heating system integration
* isort changes
* flake8 changes
* Do not exclude config_flow.py
* pylint changes
* Add config_flow test
* correct requirements_test_all.txt
* more tests
* Update... | 111,624 | 0 | 90 | 65 | 35 | 312,993 | 40 | core | 14 | homeassistant/components/moehlenhoff_alpha2/config_flow.py | Python | 10 | {
"docstring": "Validate the user input allows us to connect.\n\n Data has the keys from DATA_SCHEMA with values provided by the user.\n ",
"language": "en",
"n_whitespaces": 26,
"n_words": 20,
"vocab_size": 18
} | https://github.com/home-assistant/core.git | |
1 | _update | def _update(self) -> int:
retval = self.update()
logger.debug("Updated %s: %s", self.__class__.__name__, retval)
return retval
| e5356a417e7c2124e75c4a2994ed604fc0a3cc74 | 9 | alignments.py | 53 | Alignments update:
- Store face embeddings in PNG header when sorting
- typing + refactor
- Update alignments keys for 'identity' and 'video_meta' + bump to v2.3
- General typing fixes | 21,086 | 0 | 42 | 31 | 13 | 101,682 | 14 | faceswap | 9 | lib/align/alignments.py | Python | 12 | {
"docstring": " Calls the child's :func:`update` method, logs output and sets the\n :attr:`is_updated` flag\n\n Returns\n -------\n int\n The number of items that were updated\n ",
"language": "en",
"n_whitespaces": 69,
"n_words": 22,
"vocab_size": 21
} | https://github.com/deepfakes/faceswap.git | |
1 | test_edgeql_scope_for_with_computable_01 | async def test_edgeql_scope_for_with_computable_01(self):
await self.assert_query_result(
r,
tb.bag([
{"name": "Alice", "namelen": 5},
{"name": "Bob", "namelen": 3},
{"name": "Carol", "namelen": 5},
{"name": "Dave", "namelen... | 0dada08f4eedb104bfa40932b576e44d82218547 | 14 | test_edgeql_scope.py | 111 | Always include the definition context namespace in computable contexts (#3331)
We need to include the *original* source namespace in our ctx
namespace when compiling computables. The current mechanism of trying
to look up in view_sets or failing that using the source namespace
from the computable use, but this was ... | 41,718 | 0 | 131 | 60 | 18 | 176,142 | 25 | edgedb | 5 | tests/test_edgeql_scope.py | Python | 20 | {
"docstring": "\n with props := (\n for h in User union (\n select h {namelen := len(h.name)}\n )\n )\n select props {\n name,\n namelen\n };\n ",
"language": "en",
"n_whitespaces": 146,
"n... | https://github.com/edgedb/edgedb.git | |
5 | transform | def transform(self, X):
check_is_fitted(self)
if self.n_neighbors is not None:
distances, indices = self.nbrs_.kneighbors(X, return_distance=True)
else:
distances, indices = self.nbrs_.radius_neighbors(X, return_distance=True)
# Create the graph of short... | e2e7d75d1e81ce3b67257fcc4cce32ab2d2acd2f | 13 | _isomap.py | 261 | MAINT Extend dtype preserved common test to check transform (#24982) | 76,893 | 0 | 283 | 170 | 85 | 261,613 | 108 | scikit-learn | 27 | sklearn/manifold/_isomap.py | Python | 18 | {
"docstring": "Transform X.\n\n This is implemented by linking the points X into the graph of geodesic\n distances of the training data. First the `n_neighbors` nearest\n neighbors of X are found in the training data, and from these the\n shortest geodesic distances from each point in X t... | https://github.com/scikit-learn/scikit-learn.git | |
2 | check_status | def check_status(self):
status = {
'success': False
}
try:
con = self.__connect()
with closing(con) as con:
status['success'] = con.is_connected()
except Exception as e:
log.error(f'Error connecting to MySQL {self.d... | ef0262e95a1e1a5403896088ca3938adb895a8d6 | 13 | mysql_handler.py | 122 | Add mysql handler | 25,250 | 0 | 146 | 60 | 29 | 114,694 | 34 | mindsdb | 12 | mindsdb/integrations/mysql_handler/mysql_handler.py | Python | 12 | {
"docstring": "\n Check the connection of the MySQL database\n :return: success status and error message if error occurs\n ",
"language": "en",
"n_whitespaces": 38,
"n_words": 16,
"vocab_size": 14
} | https://github.com/mindsdb/mindsdb.git | |
2 | execute | def execute():
auto_email_reports = frappe.db.get_values(
"Auto Email Report", {"report": "Requested Items to Order"}, ["name"]
)
for auto_email_report in auto_email_reports:
frappe.delete_doc("Auto Email Report", auto_email_report[0])
frappe.db.sql(
)
| 494bd9ef78313436f0424b918f200dab8fc7c20b | 11 | delete_report_requested_items_to_order.py | 89 | style: format code with black | 14,316 | 0 | 17 | 49 | 22 | 66,747 | 25 | erpnext | 8 | erpnext/patches/v13_0/delete_report_requested_items_to_order.py | Python | 12 | {
"docstring": "Check for one or multiple Auto Email Reports and delete\n\t\tDELETE FROM `tabReport`\n\t\tWHERE name = 'Requested Items to Order'\n\t",
"language": "en",
"n_whitespaces": 17,
"n_words": 20,
"vocab_size": 20
} | https://github.com/frappe/erpnext.git | |
9 | check_send_to_ereader | def check_send_to_ereader(entry):
formats = list()
book_formats = list()
if len(entry.data):
for ele in iter(entry.data):
if ele.uncompressed_size < config.mail_size:
formats.append(ele.format)
if 'EPUB' in formats:
book_formats.append({'format': ... | fbac3e38ac116855b930ee60fb3c997337ae17b7 | 17 | helper.py | 370 | Eenabled send epubs to E-Reader devices | 40,835 | 0 | 527 | 202 | 65 | 173,321 | 114 | calibre-web | 21 | cps/helper.py | Python | 29 | {
"docstring": "\n returns all available book formats for sending to E-Reader\n ",
"language": "en",
"n_whitespaces": 20,
"n_words": 9,
"vocab_size": 9
} | https://github.com/janeczku/calibre-web.git | |
2 | test_async_on_entire_period | async def test_async_on_entire_period(recorder_mock, hass):
start_time = dt_util.utcnow() - timedelta(minutes=60)
t0 = start_time + timedelta(minutes=20)
t1 = t0 + timedelta(minutes=10)
t2 = t1 + timedelta(minutes=10)
# Start t0 t1 t2 End
# |--20min--|--20min--|--1... | 31a787558fd312331b55e5c2c4b33341fc3601fc | 10 | test_sensor.py | 90 | Ensure recorder test fixture is setup before hass fixture (#80528)
* Ensure recorder test fixture is setup before hass fixture
* Adjust more tests | 88,532 | 0 | 83 | 284 | 20 | 289,390 | 34 | core | 11 | tests/components/history_stats/test_sensor.py | Python | 62 | {
"docstring": "Test the history statistics sensor measuring as on the entire period.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 10
} | https://github.com/home-assistant/core.git | |
1 | on_post_template | def on_post_template(self, output_content, template_name, config):
return output_content
# Page events
| f79b34d174e41084391868e7b503f5c61b8b1bdf | 6 | plugins.py | 23 | Move plugin events docs into source code + refactor
* Create real (no-op) methods for each event in the base class.
* Refactor event dispatcher to not check for methods' existence, instead just call them.
* Move documentation from Markdown into docstrings of these methods.
* Activate the 'mkdocstrings' plugin.
* Use '... | 57,306 | 0 | 27 | 14 | 10 | 224,461 | 10 | mkdocs | 5 | mkdocs/plugins.py | Python | 2 | {
"docstring": "\n The `post_template` event is called after the template is rendered, but before\n it is written to disc and can be used to alter the output of the template.\n If an empty string is returned, the template is skipped and nothing is is\n written to disc.\n\n Parameter... | https://github.com/mkdocs/mkdocs.git | |
1 | frame_has_faces | def frame_has_faces(self, frame_name):
retval = bool(self._data.get(frame_name, {}).get("faces", []))
logger.trace("'%s': %s", frame_name, retval)
return retval
| 5e73437be47f2410439a3c6716de96354e6a0c94 | 13 | alignments.py | 73 | lib.align updates:
- alignments.py
- Add typed dicts for imported alignments
- Explicitly check for presence of thumb value in alignments dict
- linting
- detected_face.py
- Typing
- Linting
- Legacy support for pre-aligned face
- Update dependencies to new property names | 20,638 | 0 | 42 | 44 | 13 | 101,218 | 14 | faceswap | 9 | lib/align/alignments.py | Python | 4 | {
"docstring": " Check whether a given frame_name exists within the alignments :attr:`data` and contains\n at least 1 face.\n\n Parameters\n ----------\n frame_name: str\n The frame name to check. This should be the base name of the frame, not the full path\n\n Returns\n ... | https://github.com/deepfakes/faceswap.git | |
11 | smart_resize | def smart_resize(x, size, interpolation='bilinear'):
if len(size) != 2:
raise ValueError('Expected `size` to be a tuple of 2 integers, '
f'but got: {size}.')
img = tf.convert_to_tensor(x)
if img.shape.rank is not None:
if img.shape.rank < 3 or img.shape.rank > 4:
raise ValueE... | 9dc9a78cc6502226775a99725c654fab3298aa5f | 15 | image_utils.py | 646 | Expose all utilities in `keras.utils.__init__.py`, and resolve the hourglass import issues that led to the creation of an extraneous `all_utils.py` file / library.
PiperOrigin-RevId: 435725558 | 79,905 | 0 | 360 | 404 | 122 | 269,108 | 226 | keras | 35 | keras/utils/image_utils.py | Python | 43 | {
"docstring": "Resize images to a target size without aspect ratio distortion.\n\n Warning: `tf.keras.preprocessing.image.smart_resize` is not recommended for\n new code. Prefer `tf.keras.layers.Resizing`, which provides the same\n functionality as a preprocessing layer and adds `tf.RaggedTensor` support. See\n ... | https://github.com/keras-team/keras.git | |
7 | _port_scan_icmp | def _port_scan_icmp(self, port):
ret = None
# Create the ping command
# Use the system ping command because it already have the sticky bit set
# Python can not create ICMP packet with non root right
if WINDOWS:
timeout_opt = '-w'
count_opt = '-n'... | be927fda3dc4118b77ad0f88d5e6deb652a5f5b3 | 14 | glances_ports.py | 314 | Prepare memory leak test. Not active for the moment | 15,135 | 0 | 518 | 177 | 103 | 69,882 | 142 | glances | 32 | glances/plugins/glances_ports.py | Python | 33 | {
"docstring": "Scan the (ICMP) port structure (dict) and update the status key.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 10
} | https://github.com/nicolargo/glances.git | |
2 | shutdown | async def shutdown(self) -> None:
# Stop polling/writing Console dimensions to clients
self.shutdown_event.set()
await self.size_poll_task
# We're shutting down the server, so inform all connected clients
for client in self.clients:
await client.close()
... | 36d7973c7c6792fd1100d5512140a4701b53ba3d | 10 | service.py | 71 | Code review actions | 44,013 | 0 | 93 | 39 | 30 | 182,936 | 33 | textual | 9 | src/textual/devtools/service.py | Python | 7 | {
"docstring": "Stop server async tasks and clean up all client handlers",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 10
} | https://github.com/Textualize/textual.git | |
7 | _intersection | def _intersection(self, other, sort):
# For IntervalIndex we also know other.inclusive == self.inclusive
if self.left.is_unique and self.right.is_unique:
taken = self._intersection_unique(other)
elif other.left.is_unique and other.right.is_unique and self.isna().sum() <= 1:
... | 7e23a37e1c5bda81234801a6584563e2880769eb | 12 | interval.py | 147 | ENH: consistency of input args for boundaries - Interval (#46522) | 39,853 | 0 | 187 | 88 | 45 | 166,669 | 61 | pandas | 13 | pandas/core/indexes/interval.py | Python | 10 | {
"docstring": "\n intersection specialized to the case with matching dtypes.\n ",
"language": "en",
"n_whitespaces": 23,
"n_words": 8,
"vocab_size": 8
} | https://github.com/pandas-dev/pandas.git | |
1 | load_from_saved_model | def load_from_saved_model(saved_model_path, custom_objects=None):
warnings.warn(
"`tf.keras.experimental.load_from_saved_model` is deprecated"
"and will be removed in a future version. "
"Please switch to `tf.keras.models.load_model`.",
stacklevel=2,
)
# restore model to... | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | 12 | saved_model_experimental.py | 250 | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | 81,599 | 0 | 194 | 154 | 57 | 276,218 | 69 | keras | 28 | keras/saving/saved_model_experimental.py | Python | 24 | {
"docstring": "Loads a keras Model from a SavedModel created by `export_saved_model()`.\n\n This function reinstantiates model state by:\n 1) loading model topology from json (this will eventually come\n from metagraph).\n 2) loading model weights from checkpoint.\n\n Example:\n\n ```python\n ... | https://github.com/keras-team/keras.git | |
1 | add_html_cache_busting | def add_html_cache_busting(app, pagename, templatename, context, doctree):
from sphinx.builders.html import Stylesheet, JavaScript
css_tag = context['css_tag']
js_tag = context['js_tag']
| e87416b33b01f6fc4e3b2290d6e8a60e6ddb6e55 | 8 | conf.py | 57 | DOC: Add cache busting to all static assets
We have seen both in `/stable` and `/3.6.0`, some styling is broken
because old CSS is cached. CSS might change from updating
sphinx-gallery, mpl-sphinx-theme, pydata-sphinx-theme, etc. Adding a
versioned query breaks the cache. It's a bit over-eager to base it on
Matplotlib... | 23,644 | 0 | 29 | 52 | 16 | 109,556 | 17 | matplotlib | 13 | doc/conf.py | Python | 8 | {
"docstring": "\n Add cache busting query on CSS and JavaScript assets.\n\n This adds the Matplotlib version as a query to the link reference in the\n HTML, if the path is not absolute (i.e., it comes from the `_static`\n directory) and doesn't already have a query.\n ",
"language": "en",
"n_white... | https://github.com/matplotlib/matplotlib.git | |
2 | target_temperature_high | def target_temperature_high(self):
if self.hvac_mode == HVACMode.HEAT_COOL:
return self._econet.cool_set_point
return None
| 04b9c9300645fb30541e2bf0881d35cc698a47c5 | 9 | climate.py | 39 | Use climate enums in econet (#70633) | 97,626 | 0 | 42 | 23 | 9 | 298,684 | 10 | core | 7 | homeassistant/components/econet/climate.py | Python | 4 | {
"docstring": "Return the higher bound temperature we try to reach.",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 9
} | https://github.com/home-assistant/core.git | |
10 | _promote_shapes | def _promote_shapes(fun_name, *args):
if len(args) < 2:
return args
else:
shapes = [shape(arg) for arg in args]
if _all(len(shapes[0]) == len(s) for s in shapes[1:]):
return args # no need for rank promotion, so rely on lax promotion
nonscalar_ranks = {len(shp) for shp in shapes if shp}
... | d9dcd1394aedf760272f14c3560cd5415495c28a | 15 | lax_numpy.py | 203 | djax: let make_jaxpr build dyn shape jaxprs | 26,552 | 0 | 126 | 128 | 49 | 119,183 | 72 | jax | 19 | jax/_src/numpy/lax_numpy.py | Python | 15 | {
"docstring": "Apply NumPy-style broadcasting, making args shape-compatible for lax.py.",
"language": "en",
"n_whitespaces": 7,
"n_words": 8,
"vocab_size": 8
} | https://github.com/google/jax.git | |
2 | _build_attention | def _build_attention(self, qkv_rank):
if self._attention_axes is None:
self._attention_axes = tuple(range(1, qkv_rank - 2))
else:
self._attention_axes = tuple(self._attention_axes) # pragma: no cover
(
self._dot_product_equation,
self._co... | b97d27d2e916025f65fed751d54c089d4d4bd022 | 14 | keras_layers.py | 176 | clean up imports | 41,666 | 0 | 194 | 113 | 36 | 176,008 | 46 | autokeras | 22 | autokeras/keras_layers.py | Python | 17 | {
"docstring": "Builds multi-head dot-product attention computations.\n\n This function builds attributes necessary for `_compute_attention` to\n costomize attention computation to replace the default dot-product\n attention.\n\n Args:\n qkv_rank: the rank of query, key, value ten... | https://github.com/keras-team/autokeras.git | |
1 | test_visibility_when_disabled | def test_visibility_when_disabled(self) -> None:
room_id = self.helper.create_room_as(self.user_id, tok=self.token)
self.helper.send_state(
room_id=room_id,
event_type=EventTypes.Retention,
body={"max_lifetime": one_day_ms},
tok=self.token,
... | 4cc4229cd7a55d2556c798fecbb1c9660dc821c8 | 11 | test_retention.py | 160 | Prevent expired events from being filtered out when retention is disabled (#12611)
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> | 72,235 | 0 | 120 | 102 | 25 | 248,358 | 27 | synapse | 19 | tests/rest/client/test_retention.py | Python | 12 | {
"docstring": "Retention policies should be ignored when the retention feature is disabled.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 11
} | https://github.com/matrix-org/synapse.git | |
2 | update_status_for_contracts | def update_status_for_contracts():
contracts = frappe.get_all(
"Contract",
filters={"is_signed": True, "docstatus": 1},
fields=["name", "start_date", "end_date"],
)
for contract in contracts:
status = get_status(contract.get("start_date"), contract.get("end_date"))
frappe.db.set_value("Contract", cont... | 494bd9ef78313436f0424b918f200dab8fc7c20b | 13 | contract.py | 138 | style: format code with black | 13,992 | 0 | 17 | 78 | 25 | 65,709 | 26 | erpnext | 12 | erpnext/crm/doctype/contract/contract.py | Python | 9 | {
"docstring": "\n\tRun the daily hook to update the statuses for all signed\n\tand submitted Contracts\n\t",
"language": "en",
"n_whitespaces": 12,
"n_words": 14,
"vocab_size": 13
} | https://github.com/frappe/erpnext.git | |
1 | test_unique_id | async def test_unique_id(hass):
await setup_test_entity(
hass,
{
"unique": {
"command_open": "echo open",
"command_close": "echo close",
"command_stop": "echo stop",
"unique_id": "unique",
},
"no... | d26275011ae4e8ba0a8dcdc2a7ef81b5911d3900 | 13 | test_cover.py | 264 | Add unique_id configuration variable to command_line integration (#58596) | 107,219 | 0 | 386 | 138 | 38 | 308,463 | 78 | core | 11 | tests/components/command_line/test_cover.py | Python | 32 | {
"docstring": "Test unique_id option and if it only creates one cover per id.",
"language": "en",
"n_whitespaces": 11,
"n_words": 12,
"vocab_size": 12
} | https://github.com/home-assistant/core.git | |
1 | MultivariateT | def MultivariateT(syms, mu, sigma, v):
return multivariate_rv(MultivariateTDistribution, syms, mu, sigma, v)
#-------------------------------------------------------------------------------
# Multivariate Normal Gamma distribution ---------------------------------------
| 7fe8e027ae1d7f683243c0229b961671a6cbb4c5 | 7 | joint_rv_types.py | 37 | Improved some documentation in the stats module | 48,612 | 0 | 22 | 25 | 16 | 197,534 | 18 | sympy | 7 | sympy/stats/joint_rv_types.py | Python | 2 | {
"docstring": "\n Creates a joint random variable with multivariate T-distribution.\n\n Parameters\n ==========\n\n syms : A symbol/str\n For identifying the random variable.\n mu : A list/matrix\n Representing the location vector\n sigma : The shape matrix for the distribution\n\n ... | https://github.com/sympy/sympy.git | |
8 | choose_agent | async def choose_agent(self) -> Optional[JobAgentSubmissionClient]:
# the number of agents which has an available HTTP port.
while True:
raw_agent_infos = await DataOrganizer.get_all_agent_infos()
agent_infos = {
key: value
for key, value ... | db2f84bdfa49d218f97bf7f10678232bff8c48d5 | 14 | job_head.py | 333 | [Job Submission][refactor 5/N] Remove the head node dependency on the `Raylet` process (#28599)
* introduce stop_job
Signed-off-by: Catch-Bull <burglarralgrub@gmail.com>
* save
Signed-off-by: Catch-Bull <burglarralgrub@gmail.com>
* save
Signed-off-by: Catch-Bull <burglarralgrub@gmail.com>
* save
S... | 28,655 | 0 | 451 | 199 | 86 | 128,291 | 117 | ray | 30 | dashboard/modules/job/job_head.py | Python | 40 | {
"docstring": "\n Try to disperse as much as possible to select one of\n the `CANDIDATE_AGENT_NUMBER` agents to solve requests.\n the agents will not pop from `self._agents` unless\n it's dead. Saved in `self._agents` is the agent that was\n used before.\n Strategy:\n ... | https://github.com/ray-project/ray.git | |
1 | test_switch_read_alarm_state | async def test_switch_read_alarm_state(hass, utcnow):
helper = await setup_test_component(hass, create_security_system_service)
await helper.async_update(
ServicesTypes.SECURITY_SYSTEM,
{CharacteristicsTypes.SECURITY_SYSTEM_STATE_CURRENT: 0},
)
state = await helper.poll_and_get_sta... | 58b8c30221a6f6e5acbbe98b7e3298b03fb741f5 | 11 | test_alarm_control_panel.py | 305 | Improve homekit_controller tests (#65266) | 110,112 | 0 | 222 | 186 | 30 | 311,447 | 83 | core | 14 | tests/components/homekit_controller/test_alarm_control_panel.py | Python | 33 | {
"docstring": "Test that we can read the state of a HomeKit alarm accessory.",
"language": "en",
"n_whitespaces": 11,
"n_words": 12,
"vocab_size": 12
} | https://github.com/home-assistant/core.git |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.