id
int64
20
338k
vocab_size
int64
2
671
ast_levels
int64
4
32
nloc
int64
1
451
n_ast_nodes
int64
12
5.6k
n_identifiers
int64
1
186
n_ast_errors
int64
0
10
n_words
int64
2
2.17k
n_whitespaces
int64
2
13.8k
fun_name
stringlengths
2
73
commit_message
stringlengths
51
15.3k
url
stringlengths
31
59
code
stringlengths
51
31k
ast_errors
stringlengths
0
1.46k
token_counts
int64
6
3.32k
file_name
stringlengths
5
56
language
stringclasses
1 value
path
stringlengths
7
134
commit_id
stringlengths
40
40
repo
stringlengths
3
28
complexity
int64
1
153
185,436
4
8
2
23
2
0
4
10
test_checkboxes
Checkbox polishing + fix auto-width in Horizontal layout (#942) * checkbox widget * fixes * Checkbox additions, fix content width in horizontal layout * Update docs, add tests for checkbox * Remove some test code * Small renaming of test class Co-authored-by: Will McGugan <willmcgugan@gmail.com>
https://github.com/Textualize/textual.git
def test_checkboxes(snap_compare): assert snap_compare("docs/examples/widgets/checkbox.py")
11
test_snapshots.py
Python
tests/snapshot_tests/test_snapshots.py
4a0dc49bca6fdae8880c105ccf816180e65dc2a6
textual
1
95,593
26
9
9
92
13
0
28
92
send
feat(notifications): Nudge Notifications (#30409) Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
https://github.com/getsentry/sentry.git
def send(self) -> None: from sentry.notifications.notify import notify participants_by_provider = self.get_participants() if not participants_by_provider: return context = self.get_context() for provider, recipients in participants_by_provider.items(): ...
58
base.py
Python
src/sentry/notifications/notifications/base.py
2a5e2fd78a7e1a963e2827f90c64f353928d79b4
sentry
3
153,895
24
14
15
127
18
0
33
238
binary_operation
PERF-#4182, FIX-#4059: Add cell-wise execution for binary ops, fix bin ops for empty dataframes (#4391) Signed-off-by: Alexey Prutskov <lehaprutskov@gmail.com>
https://github.com/modin-project/modin.git
def binary_operation(cls, left, func, right): [part.drain_call_queue() for part in right.flatten()] func = cls.preprocess_func(func) return np.array( [ [ part.apply( func, right[row_idx][col...
84
partition_manager.py
Python
modin/core/dataframe/pandas/partitioning/partition_manager.py
8f35ab57996d18f2c1f001d624682952853454cd
modin
4
293,362
8
6
3
25
4
0
8
22
discovery_hash
Add MQTT notify platform (#64728) * Mqtt Notify service draft * fix updates * Remove TARGET config parameter * do not use protected attributes * complete tests * device support for auto discovery * Add targets attribute and support for data param * Add tests and resolve naming issues * CONF_COM...
https://github.com/home-assistant/core.git
def discovery_hash(self) -> tuple | None: return self._discovery_hash
14
notify.py
Python
homeassistant/components/mqtt/notify.py
e574a3ef1d855304b2a78c389861c421b1548d74
core
1
293,993
9
6
9
28
5
0
10
24
in_progress
Add update entity platform (#68248) Co-authored-by: Glenn Waters <glenn@watrs.ca>
https://github.com/home-assistant/core.git
def in_progress(self) -> bool | int | None: return self._attr_in_progress
16
__init__.py
Python
homeassistant/components/update/__init__.py
073fb40b79cf8aa06790fdceb23b6857db888c99
core
1
257,868
89
17
25
556
26
0
153
369
get_type
Classify pipeline's type based on its components (#3132) * Add pipeline get_type mehod * Add pipeline uptime * Add pipeline telemetry event sending * Send pipeline telemetry once a day (at most) * Add pipeline invocation counter, change invocation counter logic * Update allowed telemetry parameters - al...
https://github.com/deepset-ai/haystack.git
def get_type(self) -> str: # values of the dict are functions evaluating whether components of this pipeline match the pipeline type # specified by dict keys pipeline_types = { "GenerativeQAPipeline": lambda x: {"Generator", "Retriever"} <= set(x.keys()), "FAQPip...
317
base.py
Python
haystack/pipelines/base.py
938e6fda5b686ec49c52cb23f786a74d9321e048
haystack
10
290,236
8
9
3
35
6
0
8
22
available
Bump nexia to 2.0.6 (#81474) * Bump nexia to 2.0.6 - Marks thermostat unavailable when it is offline * is property
https://github.com/home-assistant/core.git
def available(self) -> bool: return super().available and self._thermostat.is_online
20
entity.py
Python
homeassistant/components/nexia/entity.py
b313f3794692fd5edd97e5637efabb1efeeff14d
core
2
168,150
13
12
5
46
8
0
13
27
_disabled
TYP: annotate functions that always error with NoReturn (#48002)
https://github.com/pandas-dev/pandas.git
def _disabled(self, *args, **kwargs) -> NoReturn: raise TypeError(f"'{type(self).__name__}' does not support mutable operations.")
20
frozen.py
Python
pandas/core/indexes/frozen.py
6ba2a67556526db2e5b0b60a566b5f2039cf4a46
pandas
1
133,141
2
6
18
13
2
0
2
5
test_multiple_callbacks
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
https://github.com/ray-project/ray.git
def test_multiple_callbacks(ray_start_1_cpu):
98
test_dask_callback.py
Python
python/ray/util/dask/tests/test_dask_callback.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
1
130,503
69
13
22
162
17
0
87
384
destroy_autoscaler_workers
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
https://github.com/ray-project/ray.git
def destroy_autoscaler_workers(self): if self.autoscaler is None: return # Nothing to clean up. if self.autoscaling_config is None: # This is a logic error in the program. Can't do anything. logger.error("Monitor: Cleanup failed due to lack of autoscaler c...
92
monitor.py
Python
python/ray/autoscaler/_private/monitor.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
5
278,879
28
11
4
51
6
0
33
55
_policy_equivalent_to_dtype
Remove pylint comments. PiperOrigin-RevId: 452353044
https://github.com/keras-team/keras.git
def _policy_equivalent_to_dtype(policy): # We use type() instead of isinstance because a subclass of Policy is never # equivalent to a dtype. return type(policy) == Policy and ( policy.name == "_infer" or _is_convertible_to_dtype(policy.name) )
28
policy.py
Python
keras/mixed_precision/policy.py
3613c3defc39c236fb1592c4f7ba1a9cc887343a
keras
3
79,828
10
10
4
50
5
0
11
43
_get_image_dimensions
feat: use Willow instead of Pillow for images. Override all Django code calling Pillow, so that we can more easily implement SVG support when it lands in Willow.
https://github.com/wagtail/wagtail.git
def _get_image_dimensions(self): if not hasattr(self, "_dimensions_cache"): self._dimensions_cache = self.get_image_dimensions() return self._dimensions_cache
28
models.py
Python
wagtail/images/models.py
912747f6aeb585a688b9d3536cf7bd7e1c94487c
wagtail
2
85,040
68
16
23
223
23
0
81
377
test_archiving_interrupted
ruff: Fix B017 `assertRaises(Exception):` should be considered evil. Signed-off-by: Anders Kaseorg <anders@zulip.com>
https://github.com/zulip/zulip.git
def test_archiving_interrupted(self) -> None: expired_msg_ids = self._make_expired_zulip_messages(7) expired_usermsg_ids = self._get_usermessage_ids(expired_msg_ids) # Insert an exception near the end of the archiving process of a chunk: with mock.patch( "zerver.lib...
132
test_retention.py
Python
zerver/tests/test_retention.py
033d2615f6614b06c8268fe60c6ee2a37892c204
zulip
1
224,462
8
6
2
24
6
0
8
22
on_page_markdown
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 '...
https://github.com/mkdocs/mkdocs.git
def on_page_markdown(self, markdown, page, config, files): return markdown
16
plugins.py
Python
mkdocs/plugins.py
f79b34d174e41084391868e7b503f5c61b8b1bdf
mkdocs
1
259,566
6
8
2
29
4
0
6
12
completeness_score
DOC Ensure completeness_score passes numpydoc validation (#23016)
https://github.com/scikit-learn/scikit-learn.git
def completeness_score(labels_true, labels_pred): return homogeneity_completeness_v_measure(labels_true, labels_pred)[1]
18
_supervised.py
Python
sklearn/metrics/cluster/_supervised.py
59428da95751fa92d46687850932f8f6ab1b4f3d
scikit-learn
1
165,251
8
13
5
44
5
0
8
22
has_dropped_na
BUG: Fix some cases of groupby(...).transform with dropna=True (#45953)
https://github.com/pandas-dev/pandas.git
def has_dropped_na(self) -> bool: return bool((self.group_info[0] < 0).any())
26
ops.py
Python
pandas/core/groupby/ops.py
1efa4fb9cca4e313b644c66608a08cf768b4ed04
pandas
1
260,585
14
7
3
34
5
0
14
42
fit
MNT TrucatedSVD uses _validate_parameters (#23987) Co-authored-by: jeremiedbb <jeremiedbb@yahoo.fr>
https://github.com/scikit-learn/scikit-learn.git
def fit(self, X, y=None): # param validation is done in fit_transform self.fit_transform(X) return self
20
_truncated_svd.py
Python
sklearn/decomposition/_truncated_svd.py
7da7ba603d42398c6e7cf89ea5336b8aabac7bae
scikit-learn
1
177,959
11
6
2
19
3
0
11
20
forwards
fix: DEV-2589: Move calculate_stats_all_orgs to rq_workers, swap migration (#2569)
https://github.com/heartexlabs/label-studio.git
def forwards(apps, schema_editor): # This migration was moved to 0024_manual_migrate_counters_again.py return
9
0018_manual_migrate_counters.py
Python
label_studio/tasks/migrations/0018_manual_migrate_counters.py
55f09c794840fcd99659a1ab8f9319560d769495
label-studio
1
147,576
10
7
14
31
3
0
10
31
callbacks
[RLlib] POC: Config objects instead of dicts (PPO only). (#23491)
https://github.com/ray-project/ray.git
def callbacks(self, callbacks_class) -> "TrainerConfig": self.callbacks_class = callbacks_class return self
17
trainer_config.py
Python
rllib/agents/trainer_config.py
2eaa54bd763ae0e63158ae0d939633c804394b78
ray
1
12,673
170
12
95
534
27
0
294
874
mixin_pod_parser
feat: allow to pass a list of port monitoring to replicas (#4961)
https://github.com/jina-ai/jina.git
def mixin_pod_parser(parser, port_monitoring=True): gp = add_arg_group(parser, title='Pod') gp.add_argument( '--runtime-cls', type=str, default='WorkerRuntime', help='The runtime class to run inside the Pod', ) gp.add_argument( '--timeout-ready', t...
326
pod.py
Python
jina/parsers/orchestrate/pod.py
27a3f942c7f228f072c35832aa9e4fb1d30a6118
jina
5
135,648
16
14
10
61
10
0
16
48
ignore_ray_errors
Refactor ActorManager to store underlying remote actors in dict. (#29953) Signed-off-by: Jun Gong <jungong@anyscale.com>
https://github.com/ray-project/ray.git
def ignore_ray_errors(self) -> Iterator[ResultOrError]: return self._Iterator( [r for r in self.result_or_errors if not isinstance(r.get(), RayError)] )
38
actor_manager.py
Python
rllib/utils/actor_manager.py
b84dac2609bd587c43ed17bb6fa18fb7241a41de
ray
3
250,754
16
9
14
65
7
0
20
92
load
Rotate stream files (#5097) * Example addon for saving streamed data including a small bug fix to make it work. * Revert "Example addon for saving streamed data including a small bug fix to make it work." This reverts commit 02ab78def9a52eaca1a89d0757cd9475ce250eaa. * Add support for rotating stream files eve...
https://github.com/mitmproxy/mitmproxy.git
def load(self, loader): loader.add_option( "save_stream_file", typing.Optional[str], None, ) loader.add_option( "save_stream_filter", typing.Optional[str], None, "Filter which flows are written to file." )
41
save.py
Python
mitmproxy/addons/save.py
3a5550a09cd40d76acfe71aa45c7a8309525ad51
mitmproxy
1
269,121
64
17
14
159
19
0
86
156
validate_per_replica_inputs
Rework a test to avoid instantiating DistributedValues directly. PiperOrigin-RevId: 438824819
https://github.com/keras-team/keras.git
def validate_per_replica_inputs(distribution_strategy, x): # Convert the inputs and targets into a list of PerReplica objects. per_replica_list = tf.nest.flatten(x) x_values_list = [] for x in per_replica_list: # At this point x should contain only tensors. x_values = distribution_strategy.unwrap(x) ...
94
distributed_training_utils_v1.py
Python
keras/distribute/distributed_training_utils_v1.py
2d7dc6080f0824200e317f255e3290da60e0f98a
keras
5
156,724
33
14
10
147
12
0
42
139
transpose
Don't include docs in ``Array`` methods, just refer to module docs (#9244) Co-authored-by: James Bourbeau <jrbourbeau@users.noreply.github.com>
https://github.com/dask/dask.git
def transpose(self, *axes): from dask.array.routines import transpose if not axes: axes = None elif len(axes) == 1 and isinstance(axes[0], Iterable): axes = axes[0] if (axes == tuple(range(self.ndim))) or (axes == tuple(range(-self.ndim, 0))): ...
93
core.py
Python
dask/array/core.py
2820bae493a49cb1d0a6e376985c5473b8f04fa8
dask
6
109,425
21
11
7
80
10
0
23
84
set_connectionstyle
Harmonize docstrings for boxstyle/connectionstyle/arrowstyle. - Rely on `__init_subclass__` to avoid the need for the out-of-order `interpd.update`/`dedent_interpd`. - Use consistent wording for all setters, and add ACCEPTS list in all cases. - Move get_boxstyle right next to set_boxstyle (consistently with the ...
https://github.com/matplotlib/matplotlib.git
def set_connectionstyle(self, connectionstyle=None, **kwargs): if connectionstyle is None: return ConnectionStyle.pprint_styles() self._connector = ( ConnectionStyle(connectionstyle, **kwargs) if isinstance(connectionstyle, str) else connectionstyle) ...
51
patches.py
Python
lib/matplotlib/patches.py
0dc472b4c7cdcc1e88228988fff17762c90f1cb9
matplotlib
3
258,627
10
10
3
50
9
0
11
32
_sample_hiddens
ENH Replaced RandomState with Generator compatible calls (#22271)
https://github.com/scikit-learn/scikit-learn.git
def _sample_hiddens(self, v, rng): p = self._mean_hiddens(v) return rng.uniform(size=p.shape) < p
31
_rbm.py
Python
sklearn/neural_network/_rbm.py
254ea8c453cd2100ade07644648f1f00392611a6
scikit-learn
1
247,584
55
9
12
152
18
0
76
192
test_cancellation_while_holding_read_lock
Add cancellation support to `ReadWriteLock` (#12120) Also convert `ReadWriteLock` to use async context managers. Signed-off-by: Sean Quah <seanq@element.io>
https://github.com/matrix-org/synapse.git
def test_cancellation_while_holding_read_lock(self): rwlock = ReadWriteLock() key = "key" # 1. A reader takes the lock and blocks. reader_d, _, _ = self._start_blocking_reader(rwlock, key, "read completed") # 2. A writer waits for the reader to complete. writer...
88
test_rwlock.py
Python
tests/util/test_rwlock.py
605d161d7d585847fd1bb98d14d5281daeac8e86
synapse
1
42,077
34
15
11
165
22
0
46
138
adjust_legend_subtitles
Workaround for matplotlib rc_context issue (#2925) * Workaround for matplotlib rc_context issue Fixes #2914 * Add some additional comments about this workaround
https://github.com/mwaskom/seaborn.git
def adjust_legend_subtitles(legend): # Legend title not in rcParams until 3.0 font_size = plt.rcParams.get("legend.title_fontsize", None) hpackers = legend.findobj(mpl.offsetbox.VPacker)[0].get_children() for hpack in hpackers: draw_area, text_area = hpack.get_children() handles = d...
100
utils.py
Python
seaborn/utils.py
6460a21555ba6557e1f6f06f4d677d9c19148169
seaborn
6
31,387
7
13
2
54
9
0
7
12
fill_with_neg_inf
Not use -1e4 as attn mask (#17306) * Use torch.finfo(self.dtype).min * for GPTNeoX * for Albert * For Splinter * Update src/transformers/models/data2vec/modeling_data2vec_audio.py Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com> * fix -inf used in Bart-like models * Fix a few remain...
https://github.com/huggingface/transformers.git
def fill_with_neg_inf(t): return t.float().fill_(torch.finfo(t.dtype).min).type_as(t) # Public API
31
modeling_fsmt.py
Python
src/transformers/models/fsmt/modeling_fsmt.py
d3cb28886ac68beba9a6646b422a4d727b056c0c
transformers
1
52,513
11
9
2
44
7
0
11
25
encode
Add Diffsinger Module (#2120) * add diffsinger * update README * update README
https://github.com/PaddlePaddle/PaddleHub.git
def encode(self, s): return [int(w) + self._num_reserved_ids for w in s.split()]
27
text_encoder.py
Python
modules/audio/svs/diffsinger/utils/text_encoder.py
7eef3bfde63d03acbd1fc9a15a5e56bef47c0ef7
PaddleHub
2
136,752
42
12
172
181
25
0
54
150
test_logs_manager_resolve_file
[core][observability] Refactor ray log API (#30422) This PR changes a few ray log semantics based on this: https://docs.google.com/document/d/1mwLz589IZ4LlPh218dDTMskec9hp3r40hw7ROYq3eVo/edit Change ray logs with various ids to ray logs <subcommand> i.e. ray logs worker --pid=x and ray logs actor --id=x and ray lo...
https://github.com/ray-project/ray.git
async def test_logs_manager_resolve_file(logs_manager): node_id = NodeID(b"1" * 28) logs_client = logs_manager.data_source_client logs_client.get_all_registered_agent_ids = MagicMock() logs_client.get_all_registered_agent_ids.return_value = [node_id.hex()] expected_filename = "filename" log...
874
test_state_api_log.py
Python
python/ray/tests/test_state_api_log.py
acff8b6fa615bfe6463fd76660b14ef2bbafda42
ray
1
131,590
43
6
37
45
8
1
61
85
test_run_driver_twice
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
https://github.com/ray-project/ray.git
def test_run_driver_twice(ray_start_regular): # We used to have issue 2165 and 2288: # https://github.com/ray-project/ray/issues/2165 # https://github.com/ray-project/ray/issues/2288 # both complain that driver will hang when run for the second time. # This test is used to verify the fix for above i...
driver_script = """
37
test_multi_node_3.py
Python
python/ray/tests/test_multi_node_3.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
2
85,028
29
13
10
96
10
0
32
97
test_create_realm_no_creation_key
realm_creation: Rework error pages. The previous error page was inadequate for serving the two different scenarios where we show errors in realm_creations, in particular containing a misleading sentence about realm creation being disabled (even in the case where it was actually enabled and the user simply had an expir...
https://github.com/zulip/zulip.git
def test_create_realm_no_creation_key(self) -> None: email = "user1@test.com" with self.settings(OPEN_REALM_CREATION=False): # Create new realm with the email, but no creation key. result = self.client_post("/new/", {"email": email}) self.assertEqual(result....
53
test_signup.py
Python
zerver/tests/test_signup.py
582d5b0aa31ac79a5ee1af95b2e71c4bfc53d5aa
zulip
1
215,983
20
12
5
68
8
1
20
38
is_photonos
Update to latest ``pyupgrade`` hook. Stop skipping it on CI. Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
https://github.com/saltstack/salt.git
def is_photonos(): (osname, osrelease, oscodename) = ( x.strip('"').strip("'") for x in linux_distribution() ) return osname == "VMware Photon OS" @real_memoize
@real_memoize
36
platform.py
Python
salt/utils/platform.py
f2a783643de61cac1ff3288b40241e5ce6e1ddc8
salt
2
259,057
24
10
6
94
11
0
29
55
_array_indexing
MNT Clean fixes and compat for old versions of our dependencies (#22642) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
https://github.com/scikit-learn/scikit-learn.git
def _array_indexing(array, key, key_dtype, axis): if issparse(array) and key_dtype == "bool": key = np.asarray(key) if isinstance(key, tuple): key = list(key) return array[key] if axis == 0 else array[:, key]
60
__init__.py
Python
sklearn/utils/__init__.py
34f9dbf54164e3c62d68765fe45f27f067a45562
scikit-learn
5
244,274
33
12
11
130
17
0
47
139
forward_single
[Feature] Support DDOD: Disentangle Your Dense Object Detector(ACM MM2021 oral) (#7279) * add ddod feature * add ddod feature * modify new * [Feature] modify ddod code0225 * [Feature] modify ddod code0226 * [Feature] modify ddod code0228 * [Feature] modify ddod code0228#7279 * [Feature] modify ddo...
https://github.com/open-mmlab/mmdetection.git
def forward_single(self, x, scale): cls_feat = x reg_feat = x for cls_conv in self.cls_convs: cls_feat = cls_conv(cls_feat) for reg_conv in self.reg_convs: reg_feat = reg_conv(reg_feat) cls_score = self.atss_cls(cls_feat) # we just follow ...
79
ddod_head.py
Python
mmdet/models/dense_heads/ddod_head.py
151a803ed0119560f59dbe7b73824dbdcae08fc6
mmdetection
3
291,307
8
6
3
25
4
0
8
22
native_value
Add `text` platform (#79454) Co-authored-by: Franck Nijhof <frenck@frenck.nl> Co-authored-by: Franck Nijhof <git@frenck.dev>
https://github.com/home-assistant/core.git
def native_value(self) -> str | None: return self._attr_native_value
14
__init__.py
Python
homeassistant/components/text/__init__.py
003e4224c89a6da381960dc5347750d1521d85c9
core
1
8,423
4
8
2
24
4
0
4
18
to_dict
Config Object (#2426) * Fixed loss instances across features * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed binary OneOfImplementation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci ...
https://github.com/ludwig-ai/ludwig.git
def to_dict(self): return convert_submodules(self.__dict__)
13
model_config.py
Python
ludwig/schema/model_config.py
4d2d81f9fdefc52eea6a9bf0826a6f2ffc8d681b
ludwig
1
27,990
62
16
21
271
24
0
94
360
preprocess
Better media thumbnails including WebP support (#9988) * Add thumbnail app * Update get_thumbnail_size method and add tests * Add logic for creating thumbnails * Update logic for getting thumbnail * Allow defining format for tumbnail generation * Clear handle_thumbnail views * Add prepare_image_proxy...
https://github.com/saleor/saleor.git
def preprocess(self, image, image_format): format = self.format or image_format save_kwargs = {"format": format} # Ensuring image is properly rotated if hasattr(image, "_getexif"): exif_datadict = image._getexif() # returns None if no EXIF data if exif_...
162
utils.py
Python
saleor/thumbnail/utils.py
5d1a36b9aaf408016957db04f86397b2e53c2500
saleor
8
189,440
38
12
23
163
10
0
42
319
_get_formatter
Hide more private methods from the docs. (#2468) * hide privs from text_mobject.py * hide privs from tex_mobject.py * hide privs from code_mobject.py * hide privs from svg_mobject.py * remove SVGPath and utils from __init__.py * don't import string_to_numbers * hide privs from geometry.py * hide p...
https://github.com/ManimCommunity/manim.git
def _get_formatter(self, **kwargs): config = { attr: getattr(self, attr) for attr in [ "include_sign", "group_with_commas", "num_decimal_places", ] } config.update(kwargs) return "".join( ...
92
numbers.py
Python
manim/mobject/numbers.py
902e7eb4f0147b5882a613b67467e38a1d47f01e
manim
4
87,194
27
12
14
135
16
0
30
184
test_get_dynamic_sampling_after_migrating_to_new_plan_default_biases
feat(ds): Support new DS behaviour in project_details endpoint (#40387) Supports new adaptive dynamic sampling behaviour alongside the deprecated dynamic sampling behaviour and achieves that through feature flag differentiation This PR achieve that through the following: - Introducing a new `DynamicSamplingBiasS...
https://github.com/getsentry/sentry.git
def test_get_dynamic_sampling_after_migrating_to_new_plan_default_biases(self): self.project.update_option("sentry:dynamic_sampling", self.dynamic_sampling_data) with Feature( { self.universal_ds_flag: True, self.old_ds_flag: True, s...
83
test_project_details.py
Python
tests/sentry/api/endpoints/test_project_details.py
5462ee11ad11ebb9a50323befcd286816d7898c8
sentry
1
19,360
25
11
9
115
9
0
36
107
calc_second_derivative
enhance cubic spline path doc (#698) * enhance cublic spline path doc * enhance cublic spline path doc * enhance cublic spline path doc * enhance cublic spline path doc * enhance cublic spline path doc * enhance cublic spline path doc * enhance cublic spline path doc * enhance cublic spline path d...
https://github.com/AtsushiSakai/PythonRobotics.git
def calc_second_derivative(self, x): if x < self.x[0]: return None elif x > self.x[-1]: return None i = self.__search_index(x) dx = x - self.x[i] ddy = 2.0 * self.c[i] + 6.0 * self.d[i] * dx return ddy
78
cubic_spline_planner.py
Python
PathPlanning/CubicSpline/cubic_spline_planner.py
def289b723e9216830c2a7b2577cb31b55710167
PythonRobotics
3
80,457
45
14
21
358
36
0
62
273
final_run_hook
Make task logic use consistent artifact dir location
https://github.com/ansible/awx.git
def final_run_hook(self, instance, status, private_data_dir, fact_modification_times): instance.log_lifecycle("finalize_run") artifact_dir = os.path.join(private_data_dir, 'artifacts', str(self.instance.id)) job_profiling_dir = os.path.join(artifact_dir, 'playbook_profiling') aw...
214
jobs.py
Python
awx/main/tasks/jobs.py
8fac1c18c8c0ad04d4a32ed3e7f24e883b6e5261
awx
5
289,724
8
10
4
41
4
0
8
29
async_added_to_hass
Use DataUpdateCoordinator in scrape (#80593) * Add DataUpdateCoordinator to scrape * Fix tests
https://github.com/home-assistant/core.git
async def async_added_to_hass(self) -> None: await super().async_added_to_hass() self._async_update_from_rest_data()
21
sensor.py
Python
homeassistant/components/scrape/sensor.py
64d6d04ade1ae851e1bd1fe63f89ae62c0de55ab
core
1
19,673
34
15
12
157
18
0
42
149
dist_is_in_project
Issue 4993 Add standard pre commit hooks and apply linting. (#4994) * Add .pre-commit-config.yaml to the project and exclude tests (for now). This does not include the MyPy linting that pip does but does include everything else.
https://github.com/pypa/pipenv.git
def dist_is_in_project(self, dist): # type: (pkg_resources.Distribution) -> bool from .environments import normalize_pipfile_path as _normalized prefixes = [ _normalized(prefix) for prefix in self.base_paths["libdirs"].split(os.pathsep) if _normalize...
95
environment.py
Python
pipenv/environment.py
9a3b3ce70621af6f9adaa9eeac9cf83fa149319c
pipenv
5
187,499
10
12
7
67
11
0
10
34
test_failure_schema
plugin.api.validate: add re.Pattern validation Use the `search()` method and return `None` or a `re.Match` instance. This avoids having to explicitly define the validation pattern ```py validate.transform(re.compile(...).search) ```
https://github.com/streamlink/streamlink.git
def test_failure_schema(self): with pytest.raises(validate.ValidationError) as cm: validate.validate(re.compile(r"foo"), 123) assert_validationerror(cm.value, )
39
test_api_validate.py
Python
tests/test_api_validate.py
b083eb3709c3abf0e3b7c0a2524ddacb5ac80f2e
streamlink
1
81,001
46
21
17
246
33
0
57
156
reap
Specifically abort the reaper if instance not registered
https://github.com/ansible/awx.git
def reap(instance=None, status='failed', excluded_uuids=[]): me = instance if me is None: try: me = Instance.objects.me() except RuntimeError as e: logger.warning(f'Local instance is not registered, not running reaper: {e}') return now = tz_now() ...
147
reaper.py
Python
awx/main/dispatch/reaper.py
fe5736dc7f9566fad26bcc43241e50355a391fd6
awx
4
28,452
16
8
6
67
7
0
20
44
test_delete_files_from_storage_task_files_not_existing_files
Fix the migration for removing media marked as to remove (#10429) * Add celery task for removing multiple files from storage * Fix the migration for removing media marked as to remove
https://github.com/saleor/saleor.git
def test_delete_files_from_storage_task_files_not_existing_files(media_root): # given path = "random/test-path" path_2 = "random/test-path-2" assert not default_storage.exists(path) assert not default_storage.exists(path_2) # when delete_files_from_storage_task([path, path_2])
36
test_tasks.py
Python
saleor/core/tests/test_tasks.py
2611883cda3b84ccbfcbf37221f5b62a08bc9af1
saleor
1
288,884
67
22
75
475
33
0
108
1,553
test_velux_cover_setup
Migrate HomeKit Controller to use stable identifiers (#80064)
https://github.com/home-assistant/core.git
async def test_velux_cover_setup(hass): accessories = await setup_accessories_from_file(hass, "velux_gateway.json") await setup_test_accessories(hass, accessories) await assert_devices_and_entities_created( hass, DeviceTestInfo( unique_id=HUB_TEST_ACCESSORY_ID, ...
290
test_velux_gateway.py
Python
tests/components/homekit_controller/specific_devices/test_velux_gateway.py
f23b1750e85f07091eb896a0b12b8f95e5646338
core
1
195,147
7
9
2
39
4
0
7
21
_get_text
Friends Dataset Teacher Add `speakers` field and flag to exclude speaker labels in `text` (#4693) * add speakers field; add flag to exclude speaker labels in text * fix logic * update test fixture * refactor out method
https://github.com/facebookresearch/ParlAI.git
def _get_text(self, utterance): return utterance['text'].replace('\n', ' ')
20
agents.py
Python
parlai/tasks/friends/agents.py
982acb50f99261133ffa90ba04c569881389db6d
ParlAI
1
178,803
71
15
28
242
26
0
94
362
getWindowsShortPathName
Windows: Fix, need to ignore permission denied when shortening paths. * We shorten paths that may be inaccessible anyway, then it does not make a difference we assume.
https://github.com/Nuitka/Nuitka.git
def getWindowsShortPathName(filename): import ctypes.wintypes GetShortPathNameW = ctypes.windll.kernel32.GetShortPathNameW GetShortPathNameW.argtypes = [ ctypes.wintypes.LPCWSTR, ctypes.wintypes.LPWSTR, ctypes.wintypes.DWORD, ] GetShortPathNameW.restype = ctypes.wintype...
149
FileOperations.py
Python
nuitka/utils/FileOperations.py
5e056fe7f99b902cf7ac0539d6639d8fc666e0ee
Nuitka
6
259,553
154
15
30
524
46
1
238
390
ols_ridge_dataset
TST tight and clean tests for Ridge (#22910) * MNT replace pinvh by solve * DOC more info for svd solver * TST rewrite test_ridge * MNT remove test_ridge_singular * MNT restructure into several tests * MNT remove test_toy_ridge_object * MNT remove test_ridge_sparse_svd This is tested in test_ridge...
https://github.com/scikit-learn/scikit-learn.git
def ols_ridge_dataset(global_random_seed, request): # Make larger dim more than double as big as the smaller one. # This helps when constructing singular matrices like (X, X). if request.param == "long": n_samples, n_features = 12, 4 else: n_samples, n_features = 4, 12 k = min(n...
@pytest.mark.parametrize("solver", SOLVERS) @pytest.mark.parametrize("fit_intercept", [True, False])
306
test_ridge.py
Python
sklearn/linear_model/tests/test_ridge.py
6528e14085d059f9d0c94f93378e7e3c0b967f27
scikit-learn
3
143,133
6
6
3
22
4
0
6
20
metric
[tune/structure] Refactor `suggest` into `search` package (#26074) This PR renames the `suggest` package to `search` and alters the layout slightly. In the new package, the higher-level abstractions are on the top level and the search algorithms have their own subdirectories. In a future refactor, we can turn al...
https://github.com/ray-project/ray.git
def metric(self) -> str: return self._metric
12
searcher.py
Python
python/ray/tune/search/searcher.py
75d08b06328d213656e7280639b35ccecdfc34d0
ray
1
264,299
24
13
6
80
13
0
25
79
export_template
Refactor generic views; add plugins dev documentation
https://github.com/netbox-community/netbox.git
def export_template(self, template, request): try: return template.render_to_response(self.queryset) except Exception as e: messages.error(request, f"There was an error rendering the selected export template ({template.name}): {e}") return redirect(request.pa...
42
bulk_views.py
Python
netbox/netbox/views/generic/bulk_views.py
54834c47f8870e7faabcd847c3270da0bd3d2884
netbox
2
135,916
4
6
2
19
3
0
4
18
experiment_name
[air/wandb] Deprecate Wandb mixin, move to `setup_wandb()` function (#29828) The wandb trainable mixin is clunky to use and can't be used with training loops of Ray AIR trainers. Instead we introduce a utility method `setup_wandb()` which initializes a wandb session with (overwritable) default values. This method achi...
https://github.com/ray-project/ray.git
def experiment_name(self): return self._experiment_name
10
function_trainable.py
Python
python/ray/tune/trainable/function_trainable.py
e7d9c242afab6028a2dd87def73389969d1dbd70
ray
1
56,987
15
12
12
65
10
0
15
110
activate
add initial test coverage for KubernetesClusterConfig
https://github.com/PrefectHQ/prefect.git
def activate(self) -> None: try: load_kube_config_from_dict( config_dict=self.config, context=self.context, ) except AttributeError as ae: print(str(ae)) raise
38
kubernetes.py
Python
src/prefect/blocks/kubernetes.py
5472ef18cf79bf24ed4c0175a97c70cbca7bb92a
prefect
2
33,579
11
12
7
78
4
0
16
45
get_model
create Past CI results as tables for GitHub issue (#18953) * create Past CI results as tables for GitHub issue Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
https://github.com/huggingface/transformers.git
def get_model(test): test = test.split("::")[0] if test.startswith("tests/models/"): test = test.split("/")[2] else: test = None return test
43
get_ci_error_statistics.py
Python
utils/get_ci_error_statistics.py
367026000bbe9957f95eb1eb7d9649d78ac0b468
transformers
2
82,124
38
12
12
125
13
0
52
180
get_reason_if_failed
No InventoryUpdates when source Project is failed (#13063) Previously, in some cases, an InventoryUpdate sourced by an SCM project would still run and be successful even after the project it is sourced from failed to update. This would happen because the InventoryUpdate would revert the project back to its last wor...
https://github.com/ansible/awx.git
def get_reason_if_failed(self): if self.status not in ('error', 'failed'): return None latest_update = self.project_updates.last() if latest_update is not None and latest_update.failed: failed_validation_tasks = latest_update.project_update_events.filter( ...
69
projects.py
Python
awx/main/models/projects.py
1c65339a24cab91d0ab6c49824dff3925160b23f
awx
5
208,058
49
11
9
190
16
0
71
148
apply
Canvas Header Stamping (#7384) * Strip down the header-stamping PR to the basics. * Serialize groups. * Add groups to result backend meta data. * Fix spelling mistake. * Revert changes to canvas.py * Revert changes to app/base.py * Add stamping implementation to canvas.py * Send task to AMQP with ...
https://github.com/celery/celery.git
def apply(self, args=None, kwargs=None, **options): args = args if args else () kwargs = kwargs if kwargs else {} groups = self.options.get("groups") stamped_headers = self.options.get("stamped_headers") self.stamp(visitor=GroupStampingVisitor(groups=groups, stamped_head...
122
canvas.py
Python
celery/canvas.py
1c4ff33bd22cf94e297bd6449a06b5a30c2c1fbc
celery
5
288,859
63
10
20
252
14
0
109
181
test_ecobee3_add_sensors_at_runtime
Migrate HomeKit Controller to use stable identifiers (#80064)
https://github.com/home-assistant/core.git
async def test_ecobee3_add_sensors_at_runtime(hass): entity_registry = er.async_get(hass) # Set up a base Ecobee 3 with no additional sensors. # There shouldn't be any entities but climate visible. accessories = await setup_accessories_from_file(hass, "ecobee3_no_sensors.json") await setup_tes...
138
test_ecobee3.py
Python
tests/components/homekit_controller/specific_devices/test_ecobee3.py
f23b1750e85f07091eb896a0b12b8f95e5646338
core
1
281,119
21
11
18
97
18
0
24
158
call_dev
Crypto menu refactor (#1119) * enabled some crypto commands in dd to be called independent of source loaded * support for coin_map_df in all dd functions + load ta and plot chart refactor * updated tests and removed coingecko scrapping where possible * removed ref of command from hugo * updated pycoingecko...
https://github.com/OpenBB-finance/OpenBBTerminal.git
def call_dev(self, other_args): parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="dev", description=, ) ns_parser = parse_known_args_and_warn( parser, other_args, EX...
61
dd_controller.py
Python
gamestonk_terminal/cryptocurrency/due_diligence/dd_controller.py
ea964109d654394cc0a5237e6ec5510ba6404097
OpenBBTerminal
2
20,763
6
7
3
27
3
0
6
20
unsplit
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...
https://github.com/pypa/pipenv.git
def unsplit(self) -> None: del self._children[:]
15
layout.py
Python
pipenv/patched/notpip/_vendor/rich/layout.py
f3166e673fe8d40277b804d35d77dcdb760fc3b3
pipenv
1
300,613
28
13
10
107
15
0
33
106
timestamp_custom
Fail template functions when no default specified (#71687)
https://github.com/home-assistant/core.git
def timestamp_custom(value, date_format=DATE_STR_FORMAT, local=True, default=_SENTINEL): try: date = dt_util.utc_from_timestamp(value) if local: date = dt_util.as_local(date) return date.strftime(date_format) except (ValueError, TypeError): # If timestamp can't...
66
template.py
Python
homeassistant/helpers/template.py
4885331509eeffe50f42d76b234996467b06170f
core
4
106,953
53
8
13
214
19
0
110
215
rotate
Micro-optimize rotation transform. The following test script shows a ~3x speedup. ```python import math, numpy as np mtx = np.array([[.1, .2, .3], [.4, .5, .6], [0, 0, 1]]) theta = np.pi / 4 def rotate(mtx, theta): a = math.cos(theta) b = math.sin(theta) rotate_mtx = np.array([[a, -b, 0.0], [b, a, 0.0],...
https://github.com/matplotlib/matplotlib.git
def rotate(self, theta): a = math.cos(theta) b = math.sin(theta) mtx = self._mtx # Operating and assigning one scalar at a time is much faster. (xx, xy, x0), (yx, yy, y0), _ = mtx.tolist() # mtx = [[a -b 0], [b a 0], [0 0 1]] * mtx mtx[0, 0] = a * xx - b ...
143
transforms.py
Python
lib/matplotlib/transforms.py
ff120cdc5aef1d609913678b1ac8c26e6f30691e
matplotlib
1
113,296
88
15
45
734
23
0
191
730
import_data_test
[FEAT]: resume waiting/running, dedup on tuner side (TPE-only) (#4931)
https://github.com/microsoft/nni.git
def import_data_test(self, tuner_factory, stype="choice_str", support_middle=True): if stype == "choice_str": search_space = { "choice_str": { "_type": "choice", "_value": ["cat", "dog", "elephant", "cow", "sheep", "panda", "tiger"] ...
429
test_builtin_tuners.py
Python
test/ut/sdk/test_builtin_tuners.py
d03c411c8eb865a840242d59260a942d041e2fba
nni
7
155,163
8
10
3
49
8
0
8
17
wait
FEAT-#5053: Add pandas on unidist execution with MPI backend (#5059) Signed-off-by: Igoshev, Iaroslav <iaroslav.igoshev@intel.com>
https://github.com/modin-project/modin.git
def wait(obj_refs): unique_refs = list(set(obj_refs)) return unidist.wait(unique_refs, num_returns=len(unique_refs))
29
utils.py
Python
modin/core/execution/unidist/common/utils.py
193505fdf0c984743397ba3df56262f30aee13a8
modin
1
288,487
13
9
5
43
4
0
15
47
template
Refactor bayesian observations using dataclass (#79590) * refactor * remove some changes * remove typehint * improve codestyle * move docstring to comment * < 88 chars * avoid short var names * more readable * fix rename * Update homeassistant/components/bayesian/helpers.py Co-authored-by...
https://github.com/home-assistant/core.git
def template(self) -> str | None: if self.value_template is not None: return self.value_template.template return None
26
helpers.py
Python
homeassistant/components/bayesian/helpers.py
dd1463da287f591652e47b00eee0c5b77f5f5b7c
core
2
249,242
21
10
12
109
14
0
22
97
test_media_does_not_exist
Use literals in place of `HTTPStatus` constants in tests (#13479) Replace - `HTTPStatus.NOT_FOUND` - `HTTPStatus.FORBIDDEN` - `HTTPStatus.UNAUTHORIZED` - `HTTPStatus.CONFLICT` - `HTTPStatus.CREATED` Signed-off-by: Dirk Klimpel <dirk@klimpel.org>
https://github.com/matrix-org/synapse.git
def test_media_does_not_exist(self) -> None: url = "/_synapse/admin/v1/media/%s/%s" % (self.server_name, "12345") channel = self.make_request( "DELETE", url, access_token=self.admin_user_tok, ) self.assertEqual(404, channel.code, msg=channel...
67
test_media.py
Python
tests/rest/admin/test_media.py
1595052b2681fb86c1c1b9a6028c1bc0d38a2e4b
synapse
1
21,744
8
9
11
38
5
0
8
14
inline_table
Update tomlkit==0.9.2 Used: python -m invoke vendoring.update --package=tomlkit
https://github.com/pypa/pipenv.git
def inline_table() -> InlineTable: return InlineTable(Container(), Trivia(), new=True)
22
api.py
Python
pipenv/vendor/tomlkit/api.py
8faa74cdc9da20cfdcc69f5ec29b91112c95b4c9
pipenv
1
323,146
78
15
28
341
31
0
115
408
_pad_across_processes
[Trainer] Add init version of paddlenlp trainer and apply finetune for ernie-1.0 pretraining. (#1761) * add some datasets for finetune. * support fine tune for all tastks. * add trainer prototype. * init verison for paddlenlp trainer. * refine trainer. * update for some details. * support multi-card...
https://github.com/PaddlePaddle/PaddleNLP.git
def _pad_across_processes(self, tensor, pad_index=-100): if isinstance(tensor, (list, tuple)): return type(tensor)(self._pad_across_processes( t, pad_index=pad_index) for t in tensor) elif isinstance(tensor, dict): return type(tensor)({ k:...
214
trainer_base.py
Python
paddlenlp/trainer/trainer_base.py
44a290e94d1becd1f09fddc3d873f9e19c9d6919
PaddleNLP
9
124,808
103
16
22
221
17
0
140
490
prepare_for_shutdown
docs: Fix a few typos (#26556) There are small typos in: - doc/source/data/faq.rst - python/ray/serve/replica.py Fixes: - Should read `successfully` rather than `succssifully`. - Should read `pseudo` rather than `psuedo`.
https://github.com/ray-project/ray.git
async def prepare_for_shutdown(self): while True: # Sleep first because we want to make sure all the routers receive # the notification to remove this replica first. await asyncio.sleep(self._shutdown_wait_loop_s) method_stat = self._get_handle_request_st...
110
replica.py
Python
python/ray/serve/replica.py
e42dc7943e11449e224419b0bae846766c06bbab
ray
8
45,056
6
10
3
38
7
0
6
20
all_weight_rules
Refactor TriggerRule & WeightRule classes to inherit from Enum (#21264) closes: #19905 related: #5302,#18627 Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com> Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
https://github.com/apache/airflow.git
def all_weight_rules(cls) -> Set[str]: return set(cls.__members__.values())
22
weight_rule.py
Python
airflow/utils/weight_rule.py
9ad4de835cbbd296b9dbd1ff0ea88c1cd0050263
airflow
1
299,993
76
12
21
234
22
0
104
285
_get_content_filter
Relax dlna_dmr filtering when browsing media (#69576) * Fix incorrect types of test data structures * Loosen MIME-type filtering for async_browse_media * Add option to not filter results when browsing media Some devices do not report all that they support, and in this case filtering will hide media that's ac...
https://github.com/home-assistant/core.git
def _get_content_filter(self) -> Callable[[BrowseMedia], bool]: if not self._device or not self._device.sink_protocol_info: # Nothing is specified by the renderer, so show everything _LOGGER.debug("Get content filter with no device or sink protocol info") return lamb...
143
media_player.py
Python
homeassistant/components/dlna_dmr/media_player.py
eebf3acb93507f8f706f8043d57fdfd09942a750
core
6
304,811
35
10
17
107
10
0
52
231
_queued_event_check
Improve type hint in flic binary sensor entity (#77161)
https://github.com/home-assistant/core.git
def _queued_event_check(self, click_type, time_diff): time_string = f"{time_diff:d} {'second' if time_diff == 1 else 'seconds'}" if time_diff > self._timeout: _LOGGER.warning( "Queued %s dropped for %s. Time in queue was %s", click_type, ...
55
binary_sensor.py
Python
homeassistant/components/flic/binary_sensor.py
3031caafed9811e0b3da146c2ee5a8a7f0080b5e
core
2
3,604
9
7
5
34
5
0
10
42
state_checkpoint_interval
:tada: Source Looker: Migrate to native CDK (#9609)
https://github.com/airbytehq/airbyte.git
def state_checkpoint_interval(self) -> Optional[int]: if self._is_finished: return 1 return 100
20
streams.py
Python
airbyte-integrations/connectors/source-looker/source_looker/streams.py
27b5ba338656b9adbfc8ebd90960a200a14d5935
airbyte
2
141,965
50
10
13
153
26
0
55
116
test_syncer_callback_wait_for_all_error
[tune] Refactor Syncer / deprecate Sync client (#25655) This PR includes / depends on #25709 The two concepts of Syncer and SyncClient are confusing, as is the current API for passing custom sync functions. This PR refactors Tune's syncing behavior. The Sync client concept is hard deprecated. Instead, we offer a...
https://github.com/ray-project/ray.git
def test_syncer_callback_wait_for_all_error(ray_start_2_cpus, temp_data_dirs): tmp_source, tmp_target = temp_data_dirs syncer_callback = TestSyncerCallback( sync_period=0, local_logdir_override=tmp_target, ) trial1 = MockTrial(trial_id="a", logdir=tmp_source) # Inject Failing...
92
test_syncer_callback.py
Python
python/ray/tune/tests/test_syncer_callback.py
6313ddc47cf9df4df8c8907997df559850a1b874
ray
1
275,131
4
6
2
19
3
0
4
18
variable_dtype
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def variable_dtype(self): return self._variable_dtype
10
policy.py
Python
keras/mixed_precision/policy.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
248,360
25
12
36
139
9
0
41
299
test_query_3pe_authenticates_token
Add authentication to thirdparty bridge APIs (#12746) Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
https://github.com/matrix-org/synapse.git
def test_query_3pe_authenticates_token(self): SUCCESS_RESULT_USER = [ { "protocol": PROTOCOL, "userid": "@a:user", "fields": { "more": "fields", }, } ] SUCCESS_RESULT_LOCATION = ...
178
test_api.py
Python
tests/appservice/test_api.py
6855024e0a363ff09d50586dcf1b089b77ac3b0c
synapse
1
34,270
26
12
11
112
11
0
32
149
_clean_text
Add FastTokenizer to REALM (#15211) * Remove BertTokenizer abstraction * Add FastTokenizer to REALM * Fix config archive map * Fix copies * Update realm.mdx * Apply suggestions from code review
https://github.com/huggingface/transformers.git
def _clean_text(self, text): output = [] for char in text: cp = ord(char) if cp == 0 or cp == 0xFFFD or _is_control(char): continue if _is_whitespace(char): output.append(" ") else: output.append(cha...
65
tokenization_realm.py
Python
src/transformers/models/realm/tokenization_realm.py
841d979190319098adc8101f9820a02ee3be4c8b
transformers
6
191,408
19
9
5
52
7
0
21
36
test_document_lookups_dont_exist
Harrison/add react chain (#24) from https://arxiv.org/abs/2210.03629 still need to think if docstore abstraction makes sense
https://github.com/hwchase17/langchain.git
def test_document_lookups_dont_exist() -> None: page = Document(page_content=_PAGE_CONTENT) # Start with lookup on "harrison". output = page.lookup("harrison") assert output == "No Results"
27
test_document.py
Python
tests/unit_tests/docstore/test_document.py
ce7b14b84381c766ae42a0f71953b2a56c024dbb
langchain
1
52,343
46
11
20
244
29
0
57
351
tracking
Update mot modules (#2111) * remove fluid api * fix readme
https://github.com/PaddlePaddle/PaddleHub.git
def tracking(self, video_stream, output_dir='mot_result', visualization=True, draw_threshold=0.5, use_gpu=False): self.video_stream = video_stream self.output_dir = output_dir self.visualization = visualization self.draw_threshold = draw_threshold self.use_gpu = use_gpu ...
152
module.py
Python
modules/video/multiple_object_tracking/fairmot_dla34/module.py
e8f5bf8eab3aa1159fe0d96d87be64a2ba6fd7f2
PaddleHub
2
299,420
6
10
2
54
8
1
6
11
kpl_properties_data_fixture
Insteon Device Control Panel (#70834) Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
https://github.com/home-assistant/core.git
def kpl_properties_data_fixture(): return json.loads(load_fixture("insteon/kpl_properties.json")) @pytest.fixture(name="iolinc_properties_data", scope="session")
@pytest.fixture(name="iolinc_properties_data", scope="session")
15
test_api_properties.py
Python
tests/components/insteon/test_api_properties.py
a9ca774e7ed1d8fe502a53d5b765c1d9b393a524
core
1
181,660
10
9
11
54
6
0
16
73
test_dense2_with_non_sparse_components
Revert "Deployed 7ccda9a with MkDocs version: 1.3.0" This reverts commit bd9629c40e01241766197119b581a99409b07068.
https://github.com/EpistasisLab/tpot.git
def test_dense2_with_non_sparse_components(): fit_then_transform( dense2_partial_1h, dense2, categorical_features=[True, True, False] ) fit_then_transform_dense( dense2_partial_1h, dense2, categorical_features=[True, True, False] )
37
one_hot_encoder_tests.py
Python
tests/one_hot_encoder_tests.py
388616b6247ca4ea8de4e2f340d6206aee523541
tpot
1
316,448
13
13
30
61
10
0
13
39
test_flow_with_default_discovery
Search/replace RESULT_TYPE_* by FlowResultType enum (#74642)
https://github.com/home-assistant/core.git
async def test_flow_with_default_discovery(hass, manager, discovery_source): mock_integration( hass, MockModule("comp", async_setup_entry=AsyncMock(return_value=True)), ) mock_entity_platform(hass, "config_flow.comp", None)
225
test_config_entries.py
Python
tests/test_config_entries.py
7cd68381f1d4f58930ffd631dfbfc7159d459832
core
1
181,736
23
10
13
99
18
0
24
91
test_fit_3
Revert "Deployed 7ccda9a with MkDocs version: 1.3.0" This reverts commit bd9629c40e01241766197119b581a99409b07068.
https://github.com/EpistasisLab/tpot.git
def test_fit_3(): tpot_obj = TPOTClassifier( random_state=42, population_size=1, offspring_size=2, generations=1, subsample=0.8, verbosity=0, config_dict='TPOT light' ) tpot_obj.fit(training_features, training_target) assert isinstance(tpot_o...
67
tpot_tests.py
Python
tests/tpot_tests.py
388616b6247ca4ea8de4e2f340d6206aee523541
tpot
1
292,452
81
13
19
176
19
0
112
352
async_added_to_hass
Add dlna_dms integration to support DLNA Digital Media Servers (#66437)
https://github.com/home-assistant/core.git
async def async_added_to_hass(self) -> None: # Try to connect to the last known location, but don't worry if not available if not self._device and self.location: try: await self.device_connect() except UpnpError as err: LOGGER.debug("Coul...
102
dms.py
Python
homeassistant/components/dlna_dms/dms.py
b19bf9b147f4321e89d1f7f01e68337f2102f460
core
4
69,015
4
8
2
25
3
0
4
2
get_doctypes_for_bank_reconciliation
fix: Remove Expense Claim from Bank Reconciliation - add hooks `get_matching_queries` and `bank_reconciliation_doctypes` to extend the functionality in other apps
https://github.com/frappe/erpnext.git
def get_doctypes_for_bank_reconciliation(): return frappe.get_hooks("bank_reconciliation_doctypes")
12
bank_transaction.py
Python
erpnext/accounts/doctype/bank_transaction/bank_transaction.py
466bf998354b7452fbbebb62b751a93c41aa2f8f
erpnext
1
276,031
24
12
8
111
18
0
30
118
_unblock_model_reconstruction
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def _unblock_model_reconstruction(self, layer_id, layer): for model_id, v in self.model_layer_dependencies.items(): _, layers = v if layer_id not in layers: continue layers[layers.index(layer_id)] = layer if all(isinstance(x, base_layer.La...
71
load.py
Python
keras/saving/saved_model/load.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
5
245,504
8
8
18
34
6
0
8
14
autocast_box_type
[Refactor] Refactor pipelines with boxlist. (#8562) * Refactor pipelines and data_preprocesser by boxlist * Refactor browse_dataset.py * Update * Update * Update * Update * update * Update * Change with_box_wrapped to with_boxlist * Fix comments * Fix commits * Update UT
https://github.com/open-mmlab/mmdetection.git
def autocast_box_type(dst_box_type='hbox') -> Callable: _, box_type_cls = get_box_type(dst_box_type)
22
box_type.py
Python
mmdet/structures/bbox/box_type.py
af063a6f25ddae4de90646f86b2db824f3d00138
mmdetection
1
245,255
51
12
26
239
28
0
68
287
load_data_list
[Refactor] refactor XMLDataset and VOCDataset, and add VOCMetric
https://github.com/open-mmlab/mmdetection.git
def load_data_list(self) -> List[dict]: assert self._metainfo.get('CLASSES', None) is not None, \ 'CLASSES in `XMLDataset` can not be None.' self.cat2label = { cat: i for i, cat in enumerate(self._metainfo['CLASSES']) } data_list = [] ...
144
xml_style.py
Python
mmdet/datasets/xml_style.py
2d9e2a00bc8214f670fe13293201a050f7e58be5
mmdetection
3
155,986
6
9
2
38
5
0
6
20
ordered
Add `Series.str`,`Series.dt`, and `Series.cat` accessors to docs (#8757) - Refactors the dataframe accessor implementation to define all methods/properties statically on import. This makes it so that methods can be accessed on the class itself, rather than only on instances. - Use a different descriptor for adding ...
https://github.com/dask/dask.git
def ordered(self): return self._delegate_property(self._series._meta, "cat", "ordered")
21
categorical.py
Python
dask/dataframe/categorical.py
9634da11a5a6e5eb64cf941d2088aabffe504adb
dask
1
22,223
70
14
23
177
17
0
98
279
get_dependencies_from_cache
Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir.
https://github.com/pypa/pipenv.git
def get_dependencies_from_cache(ireq): if ireq.editable or not is_pinned_requirement(ireq): return if ireq not in DEPENDENCY_CACHE: return cached = set(DEPENDENCY_CACHE[ireq]) # Preserving sanity: Run through the cache and make sure every entry if # valid. If this fails, someth...
105
dependencies.py
Python
pipenv/vendor/requirementslib/models/dependencies.py
cd5a9683be69c86c8f3adcd13385a9bc5db198ec
pipenv
10
106,241
44
17
15
243
22
0
59
212
_n_descramble
Implement n-param descrambling using JSInterp Fixes #29326, closes #29790, closes #30004, closes #30024, closes #30052, closes #30088, closes #30097, closes #30102, closes #30109, closes #30119, closes #30125, closes #30128, closes #30162, closes #30173, closes #30186, closes #30192, closes #30221, closes #30239, clos...
https://github.com/ytdl-org/youtube-dl.git
def _n_descramble(self, n_param, player_url, video_id): sig_id = ('nsig_value', n_param) if sig_id in self._player_cache: return self._player_cache[sig_id] try: player_id = ('nsig', player_url) if player_id not in self._player_cache: ...
155
youtube.py
Python
youtube_dl/extractor/youtube.py
af9e72507ea38e5ab3fa2751ed09ec88021260cb
youtube-dl
5
32,145
59
13
15
206
8
0
96
183
booleans_processing
TF: remove graph mode distinction when processing boolean options (#18102)
https://github.com/huggingface/transformers.git
def booleans_processing(config, **kwargs): final_booleans = {} # Pure conv models (such as ConvNext) do not have `output_attentions`. If the signature has # `output_attentions`, it will be present here in `kwargs`, even if unset (in that case, as `None`) if "output_attentions" in kwargs: f...
120
modeling_tf_utils.py
Python
src/transformers/modeling_tf_utils.py
fcefa200b2d9636d98fd21ea3b176a09fe801c29
transformers
7
195,057
81
15
20
389
47
0
105
334
rank_eval_label_candidates
Decoder-Only Transformer (#4329) * quick and dirty decoder-only implementation * fix decoder_only incremental decoding * remove unused code, add some comments, propogate func signature change * consolidate code in decoder.py * unify encoder_state * export PassThroughEncoder * add missing build_ funct...
https://github.com/facebookresearch/ParlAI.git
def rank_eval_label_candidates(self, batch, batchsize): # compute roughly ppl to rank candidates cand_choices = [] cand_choices_scores = [] encoder_states = self.model.encoder(*self._encoder_input(batch)) for i in range(batchsize): num_cands = len(batch.candi...
249
torch_generator_agent.py
Python
parlai/core/torch_generator_agent.py
ecdfbd0bb2ab76876e9fd3817d4502c3938a2ade
ParlAI
3
3,753
10
9
10
46
10
0
10
31
_get_current_throttle_value
🎉 🎉 Source FB Marketing: performance and reliability fixes (#9805) * Facebook Marketing performance improvement * add comments and little refactoring * fix integration tests with the new config * improve job status handling, limit concurrency to 10 * fix campaign jobs, refactor manager * big refactori...
https://github.com/airbytehq/airbyte.git
def _get_current_throttle_value(self) -> float: throttle = self._api.api.ads_insights_throttle return min(throttle.per_account, throttle.per_application)
28
async_job_manager.py
Python
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/async_job_manager.py
a3aae8017a0a40ff2006e2567f71dccb04c997a5
airbyte
1
138,432
6
6
3
22
4
0
6
20
base_dir
[Datasets] Add Path Partitioning Support for All Content Types (#23624) Adds a content-type-agnostic partition parser with support for filtering files. Also adds some corner-case bug fixes and usability improvements for supporting more robust input path types.
https://github.com/ray-project/ray.git
def base_dir(self) -> str: return self._base_dir
12
partitioning.py
Python
python/ray/data/datasource/partitioning.py
9f4cb9b3c9c27ae21bf7807595973231b6814648
ray
1
777
16
15
6
70
14
0
18
36
test_object_with_id_binary_deserialization
Refactored store interface to eliminate confusion with __getitem__ - Fixed serde tests effected by protobuf magic bytes
https://github.com/OpenMined/PySyft.git
def test_object_with_id_binary_deserialization() -> None: obj = sy.deserialize(blob=blob_bytes, from_bytes=True) assert obj == ObjectWithID( id=UID(value=uuid.UUID(int=333779996850170035686993356951732753684)) ) # ----------------------- CHILDREN -----------------------
42
object_test.py
Python
packages/syft/tests/syft/core/common/object_test.py
b61c1fc4b83fc740d3d9d0d84d0ca6022a3c49bb
PySyft
1
269,421
25
8
2
149
18
0
33
38
decode_predictions
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def decode_predictions(preds, top=5): return imagenet_utils.decode_predictions(preds, top=top) preprocess_input.__doc__ = imagenet_utils.PREPROCESS_INPUT_DOC.format( mode="", ret=imagenet_utils.PREPROCESS_INPUT_RET_DOC_CAFFE, error=imagenet_utils.PREPROCESS_INPUT_ERROR_DOC, ) decode_predictions.__doc_...
20
resnet.py
Python
keras/applications/resnet.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
105,909
31
13
10
143
24
0
36
91
parquet_to_arrow
Multiprocessed dataset builder [WIP] (#5107) * multiprocessing-compatible naming scheme and refactor * multiprocessed shard writing for GeneratorBasedBuilder * multiprocessed shard writing for ArrowBasedBuilder * style * multiprocessed dataset loading * compatibility with non-sharded datasets * bugfi...
https://github.com/huggingface/datasets.git
def parquet_to_arrow(source, destination) -> List[int]: stream = None if isinstance(destination, str) else destination with ArrowWriter(path=destination, stream=stream) as writer: parquet_file = pa.parquet.ParquetFile(source) for record_batch in parquet_file.iter_batches(): pa_t...
89
arrow_writer.py
Python
src/datasets/arrow_writer.py
2945690ea731f85a356220a71cdc630281c676f4
datasets
3