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
131,209
4
5
60
22
5
2
4
7
test_whether_worker_leaked_when_task_finished_with_errors
[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_whether_worker_leaked_when_task_finished_with_errors(ray_start_regular): driver_template =
driver_template = """ import ray import os import ray import numpy as np import time ray.init(address="{address}", namespace="test")@ray.remote
139
test_advanced_2.py
Python
python/ray/tests/test_advanced_2.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
2
271,883
4
6
40
20
4
0
4
7
check_array_lengths
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def check_array_lengths(inputs, targets, weights=None):
223
training_utils_v1.py
Python
keras/engine/training_utils_v1.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
13
270,982
54
12
18
138
19
0
68
238
add_update
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def add_update(self, updates): call_context = base_layer_utils.call_context() if ( tf.distribute.has_strategy() and tf.distribute.in_cross_replica_context() and # When saving the model, the distribution strategy context should be # ig...
104
base_layer_v1.py
Python
keras/engine/base_layer_v1.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
7
336,889
18
14
23
95
14
0
18
68
test_textual_inversion
Add smoke tests for the training examples (#585) * Add smoke tests for the training examples * upd * use a dummy dataset * mark as slow * cleanup * Update test cases * naming
https://github.com/huggingface/diffusers.git
def test_textual_inversion(self): with tempfile.TemporaryDirectory() as tmpdir: test_args = f.split() run_command(self._launch_args + test_args) # save_pretrained smoke test self.assertTrue(os.path.isfile(os.path.join(tmpdir, "learned_embeds.bin")))
52
test_examples.py
Python
examples/test_examples.py
4f1c989ffbbfb14e1244dcdae975ab3b2f6aa966
diffusers
1
137,776
97
17
23
349
23
0
173
570
_get_step_results
[RLlib] gymnasium support (new `Env.reset()/step()/seed()/render()` APIs). (#28369)
https://github.com/ray-project/ray.git
def _get_step_results(self): obs = {} rewards = {} infos = {} for behavior_name in self.unity_env.behavior_specs: decision_steps, terminal_steps = self.unity_env.get_steps(behavior_name) # Important: Only update those sub-envs that are currently ...
220
unity3d_env.py
Python
rllib/env/wrappers/unity3d_env.py
8e680c483ce326cefc62e44f68ab1a6948b1c3d2
ray
9
47,756
14
9
5
62
11
0
14
46
iter_mapped_dependencies
Ensure TaskMap only checks "relevant" dependencies (#23053) When looking for "mapped dependants" of a task, we only want a task if it not only is a direct downstream of the task, but also it actually "uses" the task's pushed XCom for task mapping. So we need to peek into the mapped downstream task's expansion kwarg...
https://github.com/apache/airflow.git
def iter_mapped_dependencies(self) -> Iterator["Operator"]: from airflow.models.xcom_arg import XComArg for ref in XComArg.iter_xcom_args(self._get_expansion_kwargs()): yield ref.operator
37
mappedoperator.py
Python
airflow/models/mappedoperator.py
197cff3194e855b9207c3c0da8ae093a0d5dda55
airflow
2
288,048
15
11
5
84
9
0
24
47
test_convert_invalid_unit
Remove argument validation in Unit Converter (#79107) * Remove argument validation in Unit Converter * Use HomeAssistantError * Adjust tests * Improve coverage
https://github.com/home-assistant/core.git
def test_convert_invalid_unit(): with pytest.raises(HomeAssistantError, match="is not a recognized .* unit"): distance_util.convert(5, INVALID_SYMBOL, VALID_SYMBOL) with pytest.raises(HomeAssistantError, match="is not a recognized .* unit"): distance_util.convert(5, VALID_SYMBOL, INVALID_S...
49
test_distance.py
Python
tests/util/test_distance.py
c96c5bed7da446b094e45ef8969dd0ecee6ec85d
core
1
269,302
6
7
2
47
7
1
6
10
tanh
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def tanh(x): return tf.tanh(x) @keras_export("keras.activations.sigmoid") @tf.__internal__.dispatch.add_dispatch_support
@keras_export("keras.activations.sigmoid") @tf.__internal__.dispatch.add_dispatch_support
13
activations.py
Python
keras/activations.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
132,413
30
11
9
106
15
0
32
130
testOnCheckpointUnavailableAttribute
[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 testOnCheckpointUnavailableAttribute(self): checkpoint_manager = self.checkpoint_manager(keep_checkpoints_num=1) no_attr_checkpoint = Checkpoint(Checkpoint.PERSISTENT, 0, {}) with patch.object(logger, "error") as log_error_mock: checkpoint_manager.on_checkpoint(no_attr_...
62
test_checkpoint_manager.py
Python
python/ray/tune/tests/test_checkpoint_manager.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
1
19,892
37
10
12
75
10
0
45
52
_should_use_sysconfig
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 _should_use_sysconfig() -> bool: return bool(getattr(sysconfig, "_PIP_USE_SYSCONFIG", _USE_SYSCONFIG_DEFAULT)) _USE_SYSCONFIG = _should_use_sysconfig() # Be noisy about incompatibilities if this platforms "should" be using # sysconfig, but is explicitly opting out and using distutils instead. if _USE_SY...
19
__init__.py
Python
pipenv/patched/notpip/_internal/locations/__init__.py
f3166e673fe8d40277b804d35d77dcdb760fc3b3
pipenv
1
303,229
18
8
7
83
13
0
24
45
test_device_name
MotionBlinds use device_name helper (#72438) * use device_name helper * fix typo * fix import * fix isort * add gateway_test * implement gateway test * correct test blind mac
https://github.com/home-assistant/core.git
async def test_device_name(hass): blind = Mock() blind.blind_type = BlindType.RollerBlind.name blind.mac = TEST_BLIND_MAC assert device_name(blind) == "RollerBlind 0001" blind.device_type = DEVICE_TYPES_WIFI[0] assert device_name(blind) == "RollerBlind"
47
test_gateway.py
Python
tests/components/motion_blinds/test_gateway.py
6cadd4f6657ee5f12b5a6d28f61455a3c94cefa0
core
1
53,343
18
10
5
55
8
0
20
66
k8s_hosted_orion
Kubernetes flow runner (PrefectHQ/orion#780) Add a Kubernetes flow runner
https://github.com/PrefectHQ/prefect.git
def k8s_hosted_orion(self): kubernetes = pytest.importorskip("kubernetes") # TODO: pytest flag to configure this URL k8s_api_url = "http://localhost:4205/api" with temporary_settings(PREFECT_ORION_HOST=k8s_api_url): yield k8s_api_url
27
test_flow_runners.py
Python
tests/test_flow_runners.py
be671cbecee46c621dc08ed47bb520f795b34a42
prefect
1
276,195
15
10
6
47
6
0
17
71
checkpointable_objects
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def checkpointable_objects(self): return { key: value for key, value in self._object_dict.items() if value is not None }
29
serialized_attributes.py
Python
keras/saving/saved_model/serialized_attributes.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
3
180,902
71
16
12
430
43
0
98
244
get_blocks_party_spaces
Adding a Playground Tab to the Website (#1860) * added playground with 12 demos * change name to recipes, restyle navbar * add explanatory text to page * fix demo mapping * categorize demos, clean up design * styling * cateogry naming and emojis * refactor and add text demos * add view code but...
https://github.com/gradio-app/gradio.git
def get_blocks_party_spaces(): r = requests.get(path) d = r.json() spaces = [SpaceInfo(**x) for x in d] blocks_spaces = {} for i in range(0,len(spaces)): if spaces[i].id.split('/')[0] == 'Gradio-Blocks' and hasattr(spaces[i], 'likes') and spaces[i].id != 'Gradio-Blocks/Leaderboard' and space...
157
run.py
Python
demo/leaderboard/run.py
597337dcb8762cca6e718b59a4ab6f5e333645fd
gradio
8
36,203
9
12
3
67
11
0
10
31
_adapt_logits_for_beam_search
Replace all deprecated `jax.ops` operations with jnp's `at` (#16078) * Replace all deprecated `jax.ops` operations with jnp's `at` * np to jnp scores * suggested changes
https://github.com/huggingface/transformers.git
def _adapt_logits_for_beam_search(self, logits): logits = logits.at[jax.ops.index[:, :, self.config.pad_token_id]].set(float("-inf")) return logits
41
modeling_flax_marian.py
Python
src/transformers/models/marian/modeling_flax_marian.py
ee27b3d7df397a44dc88324e5aa639a20bf67e53
transformers
1
160,813
76
13
18
193
19
0
114
234
_get_machar
BUG: Fix discovered MachAr (still used within valgrind) This fixes the missing attributes. I tested the warning and fix on valgrind itself. These attributes were added in gh-18536 but the fallback path was not checked there. Replaces gh-21813, although something more like it may make sense if it allows us to just de...
https://github.com/numpy/numpy.git
def _get_machar(ftype): params = _MACHAR_PARAMS.get(ftype) if params is None: raise ValueError(repr(ftype)) # Detect known / suspected types key = ftype('-0.1').newbyteorder('<').tobytes() ma_like = None if ftype == ntypes.longdouble: # Could be 80 bit == 10 byte extended pr...
105
getlimits.py
Python
numpy/core/getlimits.py
4756c54e13154bcbc7ae2612874f03a0ccbaa9af
numpy
5
130,354
25
13
12
135
14
0
38
138
describe_security_groups
[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 describe_security_groups(self, vpc_id=None, tags=None): request = DescribeSecurityGroupsRequest() if vpc_id is not None: request.set_VpcId(vpc_id) if tags is not None: request.set_Tags(tags) response = self._send_request(request) if response i...
80
utils.py
Python
python/ray/autoscaler/_private/aliyun/utils.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
4
260,083
91
11
28
310
31
0
118
264
test_calibrated_classifier_cv_zeros_sample_weights_equivalence
API Rename base_estimator in CalibratedClassifierCV (#22054) Co-authored-by: Kevin Roice <kevinroice@Kevins-Air.broadband> Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
https://github.com/scikit-learn/scikit-learn.git
def test_calibrated_classifier_cv_zeros_sample_weights_equivalence(method, ensemble): X, y = load_iris(return_X_y=True) # Scale the data to avoid any convergence issue X = StandardScaler().fit_transform(X) # Only use 2 classes and select samples such that 2-fold cross-validation # split will le...
197
test_calibration.py
Python
sklearn/tests/test_calibration.py
effdd6e215c67f2ae8ed1e378ea1661e936059a4
scikit-learn
2
109,028
39
10
11
194
23
0
50
133
sharez
Let Axes.clear iterate over Axises. ... so that the implementation also works for 3D. This means also adding a sharez() method, which is copy-pasted from sharex()/sharey() (note that it is resolves a slight inconsistency in the old Axes3D.clear, which would previously not copy the z-autoscaleness status of a z-shared...
https://github.com/matplotlib/matplotlib.git
def sharez(self, other): _api.check_isinstance(maxes._base._AxesBase, other=other) if self._sharez is not None and other is not self._sharez: raise ValueError("z-axis is already shared") self._shared_axes["z"].join(self, other) self._sharez = other self.zaxis...
122
axes3d.py
Python
lib/mpl_toolkits/mplot3d/axes3d.py
716a35f05ea714acc0e562e37e3404150435da79
matplotlib
3
34,874
60
12
22
225
21
1
83
276
forward
Add ConvNeXT (#15277) * First draft * Add conversion script * Improve conversion script * Improve docs and implement tests * Define model output class * Fix tests * Fix more tests * Add model to README * Apply suggestions from code review Co-authored-by: Sylvain Gugger <35901082+sgugger@user...
https://github.com/huggingface/transformers.git
def forward(self, pixel_values=None, output_hidden_states=None, return_dict=None): output_hidden_states = ( output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states ) return_dict = return_dict if return_dict is not None else self.config.use_retur...
@add_start_docstrings( """ ConvNext Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for ImageNet. """, CONVNEXT_START_DOCSTRING, )
141
modeling_convnext.py
Python
src/transformers/models/convnext/modeling_convnext.py
84eec9e6ba55c5aceee2a92fd820fcca4b67c510
transformers
5
19,222
20
11
15
108
12
0
20
129
rev_list
add diff style check test (#617) * add diff style check test * add diff style check test * add diff style check test * add diff style check test * add license * add license
https://github.com/AtsushiSakai/PythonRobotics.git
def rev_list(branch, num_commits): res = subprocess.run( [ 'git', 'rev-list', '--max-count', f'{num_commits}', '--first-parent', branch ], stdout=subprocess.PIPE, encoding='utf-8', ) res.check_return...
59
test_diff_codestyle.py
Python
tests/test_diff_codestyle.py
0dfa274be3eaddb270b2bcee197f7d34acbc1363
PythonRobotics
1
259,492
90
10
27
460
41
1
153
427
test_decision_boundary_display
FEA Add DecisionBoundaryDisplay (#16061) Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
https://github.com/scikit-learn/scikit-learn.git
def test_decision_boundary_display(pyplot, fitted_clf, response_method, plot_method): fig, ax = pyplot.subplots() eps = 2.0 disp = DecisionBoundaryDisplay.from_estimator( fitted_clf, X, grid_resolution=5, response_method=response_method, plot_method=plot_method, ...
@pytest.mark.parametrize( "response_method, msg", [ ( "predict_proba", "MyClassifier has none of the following attributes: predict_proba", ), ( "decision_function", "MyClassifier has none of the following attributes: decision_function", ...
251
test_boundary_decision_display.py
Python
sklearn/inspection/_plot/tests/test_boundary_decision_display.py
d400723a2112f15c5d5b4d40dfac2ed8a19cca5c
scikit-learn
1
127,466
72
11
35
352
12
0
96
380
to_dict
[RLlib; AIR; Tune] Replace all remaining `tune.run()` with `tune.Tuner(...).fit()`. (#28325)
https://github.com/ray-project/ray.git
def to_dict(self) -> AlgorithmConfigDict: config = copy.deepcopy(vars(self)) config.pop("algo_class") # Worst naming convention ever: NEVER EVER use reserved key-words... if "lambda_" in config: assert hasattr(self, "lambda_") config["lambda"] = getattr(...
193
algorithm_config.py
Python
rllib/algorithms/algorithm_config.py
42864d711d1eb2013a83670efc284ad22a62b929
ray
4
320,113
16
9
10
81
13
0
18
100
test_scan_file_for_separating_barcodes_fax_decode
Adds specific handling for CCITT Group 4, which pikepdf decodes, but not correctly
https://github.com/paperless-ngx/paperless-ngx.git
def test_scan_file_for_separating_barcodes_fax_decode(self): test_file = os.path.join( self.BARCODE_SAMPLE_DIR, "barcode-fax-image.pdf", ) pdf_file, separator_page_numbers = barcodes.scan_file_for_separating_barcodes( test_file, ) sel...
50
test_barcodes.py
Python
src/documents/tests/test_barcodes.py
4cc2976614b3a350ef5483456bc028534075e194
paperless-ngx
1
133,379
56
16
23
143
6
0
86
327
choose_amp_backend
[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 choose_amp_backend(use_fp16, native_amp=None, apex_amp=None): if use_fp16 not in (True, False, "apex"): raise ValueError("use_fp16 must be a bool or 'apex'.") if not use_fp16: return use_fp16 if use_fp16 == "apex": if not apex_amp: raise ImportError( ...
76
utils.py
Python
python/ray/util/sgd/torch/utils.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
7
275,065
32
11
8
91
11
0
36
83
create_sgd
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def create_sgd(base_optimizer_cls, *args, **kwargs): if base_optimizer_cls == optimizer_v2.OptimizerV2: return gradient_descent.SGD(*args, **kwargs) else: assert ( base_optimizer_cls == optimizer_experimental.Optimizer ), f"Got invalid base_optimizer_cls: {base_optimizer...
54
loss_scale_optimizer_test.py
Python
keras/mixed_precision/loss_scale_optimizer_test.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
2
45,472
109
16
81
1,113
40
0
196
859
downgrade
Autogenerate migration reference doc (#21601) * document airflow version in each alembic migration module and use this to autogen the doc * update each migration module to have the same description used in migration ref (so it can be used in autogen)
https://github.com/apache/airflow.git
def downgrade(): dialect_name = op.get_bind().dialect.name dt_type = TIMESTAMP string_id_col_type = StringID() op.add_column('task_instance', sa.Column('execution_date', dt_type, nullable=True)) op.add_column('task_reschedule', sa.Column('execution_date', dt_type, nullable=True)) update_q...
633
7b2661a43ba3_taskinstance_keyed_to_dagrun.py
Python
airflow/migrations/versions/7b2661a43ba3_taskinstance_keyed_to_dagrun.py
69f6f9e01b6df76c3c8fa266d460324163957887
airflow
2
153,838
51
15
50
176
27
0
58
134
_read
REFACTOR-#4510: Align experimental and regular IO modules initializations (#4511) Signed-off-by: alexander3774 <myskova977@gmail.com>
https://github.com/modin-project/modin.git
def _read(**kwargs) -> DataFrame: Engine.subscribe(_update_engine) from modin.core.execution.dispatching.factories.dispatcher import FactoryDispatcher try: pd_obj = FactoryDispatcher.read_csv_glob(**kwargs) except AttributeError: raise AttributeError("read_csv_glob() is only implem...
100
io.py
Python
modin/experimental/pandas/io.py
dcee13d57ebf9a006460deedb734c15791acae7a
modin
3
263,468
35
12
15
227
19
1
53
162
run
Bootloader: Building: Unpack waf's lib archive. Doing so makes it easier to modify. This is a temporary measure until the next waf version is released (although I'm tempted to keep it since it's much more IDE completion friendly).
https://github.com/pyinstaller/pyinstaller.git
def run(self): bld = self.generator.bld get = self.env.get_flat cmd1 = "%s %s --prefix=%s --header > %s" % ( get('GLIB_GENMARSHAL'), self.inputs[0].srcpath(), get('GLIB_GENMARSHAL_PREFIX'), self.outputs[0].abspath() ) ret = bld.exec_command(cmd1) if ret: ...
@taskgen_method
136
glib2.py
Python
bootloader/waflib/Tools/glib2.py
64ccb7aea824fbec57f7ed1bbe483ec486183c13
pyinstaller
2
85,468
37
11
14
150
19
0
43
157
get_next_event_id
feat(perf issues): Return prev/next for transaction events (#38274) * feat(perf issues): Return prev/next for transaction events
https://github.com/getsentry/sentry.git
def get_next_event_id(self, event, filter): assert filter, "You must provide a filter" if not event: return None filter = deepcopy(filter) filter.conditions = filter.conditions or [] filter.conditions.extend(get_after_event_condition(event)) filter....
94
backend.py
Python
src/sentry/eventstore/snuba/backend.py
6d7681529f68a87e41d4c11a4aa1e6732cb15ade
sentry
4
129,004
7
8
4
34
5
0
8
40
address
[GCS][Bootstrap n/n] Do not start Redis in GCS bootstrapping mode (#21232) After this change in GCS bootstrapping mode, Redis no longer starts and `address` is treated as the GCS address of the Ray cluster. Co-authored-by: Yi Cheng <chengyidna@gmail.com> Co-authored-by: Yi Cheng <74173148+iycheng@users.noreply.git...
https://github.com/ray-project/ray.git
def address(self): if use_gcs_for_bootstrap(): return self._gcs_address return self._redis_address
19
node.py
Python
python/ray/node.py
70db5c5592d94b611fee0a334414f1f4f5cc151a
ray
2
133,007
11
10
14
46
8
0
11
25
reduce
[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 reduce(self, tensors, reduce_options=ReduceOptions()): root_rank = len(tensors) * reduce_options.root_rank + reduce_options.root_tensor
40
nccl_collective_group.py
Python
python/ray/util/collective/collective_group/nccl_collective_group.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
1
108,519
15
8
2
22
2
0
15
21
spring
Cleanup documentation generation for pyplot - remove the awkward `pyplot.plotting()` function, which only served as a namespace to take up the docs for pyplot and output them via `.. autofunction` - Instead generate the same information using `.. autosummary::`. We have to list the desired methods here explicitl...
https://github.com/matplotlib/matplotlib.git
def spring(): set_cmap('spring') # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
9
pyplot.py
Python
lib/matplotlib/pyplot.py
032316bc6c7798fca6c82de24167c975f237687f
matplotlib
1
130,986
103
12
51
937
37
0
224
401
test_deploy_with_partial_constructor_failure
[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_deploy_with_partial_constructor_failure(mock_deployment_state): deployment_state, timer, goal_manager = mock_deployment_state b_info_1, b_version_1 = deployment_info(num_replicas=2) create_goal, updating = deployment_state.deploy(b_info_1) goal_obj = goal_manager.get_goal(create_goal) ...
619
test_deployment_state.py
Python
python/ray/serve/tests/test_deployment_state.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
1
84,291
75
12
22
247
31
0
94
275
test_public_only_export_files_private_uploads_not_included
test_import_export: Test exclusion of private uploads from realm export.
https://github.com/zulip/zulip.git
def test_public_only_export_files_private_uploads_not_included(self) -> None: user_profile = self.example_user("hamlet") realm = user_profile.realm # We create an attachment tied to a personal message. That means it shouldn't be # included in a public export, as it's private d...
142
test_import_export.py
Python
zerver/tests/test_import_export.py
e6264cd85b0617bae2fa37c1672eaf3260576e4a
zulip
1
260,303
15
11
4
50
5
0
19
51
_check_infrequent_enabled
MAINT validate parameter in OneHotEncoder and OrdinalEncoder (#23579) Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
https://github.com/scikit-learn/scikit-learn.git
def _check_infrequent_enabled(self): self._infrequent_enabled = ( self.max_categories is not None and self.max_categories >= 1 ) or self.min_frequency is not None
31
_encoders.py
Python
sklearn/preprocessing/_encoders.py
8a8d0687eed25481db39aa5c5b85148b2933d0a7
scikit-learn
3
102,169
27
7
9
32
4
0
30
58
test_valid_with_autograd_ops
Revert "Revert D32498569: allow external backend codegen to toggle whether to generate out= and inplace kernels" (#69950) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/69950 This reverts commit f6cad53443704dfe5a20cc62bee14d91e3bffcaa. Test Plan: Imported from OSS Reviewed By: albanD Diff...
https://github.com/pytorch/pytorch.git
def test_valid_with_autograd_ops(self) -> None: yaml_str = # External codegen on a yaml file with no operators is effectively a no-op, # so there's no reason to parse the backend self.assert_success_from_gen_backend_stubs(yaml_str)
16
test_gen_backend_stubs.py
Python
tools/test/test_gen_backend_stubs.py
bb5b4cceb6f737448eaaa6817cd773b6f4b0e77d
pytorch
1
245,586
26
14
19
133
14
0
34
91
assert_params_all_zeros
[Fix] Fix UT and remove delete mmcv ops. (#8623) * Remove get_root_logger * Fix UT * Update
https://github.com/open-mmlab/mmdetection.git
def assert_params_all_zeros(module) -> bool: weight_data = module.weight.data is_weight_zero = weight_data.allclose( weight_data.new_zeros(weight_data.size())) if hasattr(module, 'bias') and module.bias is not None: bias_data = module.bias.data is_bias_zero = bias_data.allclose...
80
test_resnet.py
Python
tests/test_models/test_backbones/test_resnet.py
73a12e6508d4ba0331b84b1313027a511ba26fe3
mmdetection
4
100,830
6
6
4
22
4
0
6
20
model_name
Refactoring and TravisCI to Github Actions (#1239) * refactor training * travis to actions
https://github.com/deepfakes/faceswap.git
def model_name(self) -> str: return self.name
12
model.py
Python
plugins/train/model/_base/model.py
ff6b0209dd5ad57b81b0aca570df7f39a7119bfb
faceswap
1
90,847
94
17
37
410
48
0
120
754
notify_if_ready
ref(models): `ActivityType` (#34978) ## Objective: We want to separate enum logic from Model logic. This breaks a lot of circular dependencies.
https://github.com/getsentry/sentry.git
def notify_if_ready(cls, deploy_id, fetch_complete=False): from sentry.models import Activity, Environment, ReleaseCommit, ReleaseHeadCommit lock_key = cls.get_lock_key(deploy_id) lock = locks.get(lock_key, duration=30) with TimedRetryPolicy(10)(lock.acquire): deplo...
256
deploy.py
Python
src/sentry/models/deploy.py
b9f5a910dc841b85f58d46266ec049ae5a7fd305
sentry
7
22,224
43
12
13
181
17
1
52
109
get_finder
Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir.
https://github.com/pypa/pipenv.git
def get_finder(sources=None, pip_command=None, pip_options=None): # type: (List[Dict[S, Union[S, bool]]], Optional[Command], Any) -> PackageFinder if not pip_command: pip_command = shims.InstallCommand() if not sources: sources = [{"url": "https://pypi.org/simple", "name": "pypi", "ver...
@contextlib.contextmanager
104
dependencies.py
Python
pipenv/vendor/requirementslib/models/dependencies.py
cd5a9683be69c86c8f3adcd13385a9bc5db198ec
pipenv
4
249,451
16
9
9
65
8
0
17
89
setup
Share some metrics between the Prometheus exporter and the phone home stats (#13671)
https://github.com/matrix-org/synapse.git
async def setup(self) -> None: await self._update_gauges() self._clock.looping_call( run_as_background_process, 5 * 60 * 1000, desc="common_usage_metrics_update_gauges", func=self._update_gauges, )
39
common_usage_metrics.py
Python
synapse/metrics/common_usage_metrics.py
898fef2789c9b1a20ef53c7d588f536f51f0fe2f
synapse
1
78,845
4
8
2
24
4
0
4
18
clean_name
Update panel templates for new designs (EditHandler rewrite) Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
https://github.com/wagtail/wagtail.git
def clean_name(self): return safe_snake_case(self.heading)
13
panels.py
Python
wagtail/admin/panels.py
5521e3b59f45af830ebac3c5686e092616eb82e4
wagtail
1
156,128
140
15
87
909
45
0
315
1,061
fuse_linear
absolufy-imports - No relative - PEP8 (#8796) Conversation in https://github.com/dask/distributed/issues/5889
https://github.com/dask/dask.git
def fuse_linear(dsk, keys=None, dependencies=None, rename_keys=True): if keys is not None and not isinstance(keys, set): if not isinstance(keys, list): keys = [keys] keys = set(flatten(keys)) if dependencies is None: dependencies = {k: get_dependencies(dsk, k, as_list=T...
581
optimization.py
Python
dask/optimization.py
cccb9d8d8e33a891396b1275c2448c352ef40c27
dask
32
322,360
11
8
8
48
9
0
11
39
split_sentences
Add model Prohetnet (#1698) * add Prohetnet model * update prohetnet * update format * pre commit * add prophetnet example * update tokenizer.py,run_train.sh,train_prophetnet.py * remove evaluate/gigaword/__init__.py Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
https://github.com/PaddlePaddle/PaddleNLP.git
def split_sentences(self): from pyrouge.utils.sentence_splitter import PunktSentenceSplitter self.log.info("Splitting sentences.") ss = PunktSentenceSplitter()
47
bs_pyrouge.py
Python
examples/text_summarization/prophetnet/evaluate/cnndm/bs_pyrouge.py
487162262196bead8d9b4c2306f313b8f64edf9b
PaddleNLP
1
32,802
38
14
9
176
24
0
53
99
prepare_video
Add VideoMAE (#17821) * First draft * Add VideoMAEForVideoClassification * Improve conversion script * Add VideoMAEForPreTraining * Add VideoMAEFeatureExtractor * Improve VideoMAEFeatureExtractor * Improve docs * Add first draft of model tests * Improve VideoMAEForPreTraining * Fix base_mode...
https://github.com/huggingface/transformers.git
def prepare_video(feature_extract_tester, width=10, height=10, numpify=False, torchify=False): video = [] for i in range(feature_extract_tester.num_frames): video.append(np.random.randint(255, size=(feature_extract_tester.num_channels, width, height), dtype=np.uint8)) if not numpify and not t...
117
test_feature_extraction_common.py
Python
tests/test_feature_extraction_common.py
f9a0008d2d3082a665f711b24f5314e4a8205fab
transformers
7
181,890
18
13
8
89
7
0
25
61
positive_integer
Revert "Deployed 7ccda9a with MkDocs version: 1.3.0" This reverts commit bd9629c40e01241766197119b581a99409b07068.
https://github.com/EpistasisLab/tpot.git
def positive_integer(value): try: value = int(value) except Exception: raise argparse.ArgumentTypeError('Invalid int value: \'{}\''.format(value)) if value < 0: raise argparse.ArgumentTypeError('Invalid positive int value: \'{}\''.format(value)) return value
48
driver.py
Python
tpot/driver.py
388616b6247ca4ea8de4e2f340d6206aee523541
tpot
3
273,881
11
9
5
61
8
0
12
27
function_register
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def function_register(func, *args, **kwargs): concrete_func = func.get_concrete_function(*args, **kwargs) concrete_func.add_to_graph() concrete_func.add_gradient_functions_to_graph() return concrete_func
36
gru_lstm_utils.py
Python
keras/layers/rnn/gru_lstm_utils.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
124,605
4
5
27
30
6
2
4
7
test_pip_no_working_dir
[Serve] [runtime_env] [CI] Skip flaky Ray Client test (#26400)
https://github.com/ray-project/ray.git
def test_pip_no_working_dir(ray_start): driver =
driver = """ import ray from ray import serve import requests ray.init(address="auto")@serve.deployment
18
test_runtime_env_2.py
Python
python/ray/serve/tests/test_runtime_env_2.py
0914e5602d387fe46b0c27b41bb65bd593f5e393
ray
1
293,550
7
9
3
47
7
0
8
29
async_turn_off
Add switch platform to the Mazda integration (#68025)
https://github.com/home-assistant/core.git
async def async_turn_off(self, **kwargs): await self.client.stop_charging(self.vehicle_id) await self.refresh_status_and_write_state()
26
switch.py
Python
homeassistant/components/mazda/switch.py
0bd65db31cfcc07b79882e44f555b22899471ec6
core
1
153,213
8
13
2
54
6
0
8
22
to_numpy
REFACTOR-#3990: remove code duplication in PandasDataframePartition hierarchy (#3991) Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
https://github.com/modin-project/modin.git
def to_numpy(self, **kwargs): return self.apply(lambda df, **kwargs: df.to_numpy(**kwargs)).get()
32
partition.py
Python
modin/core/dataframe/pandas/partitioning/partition.py
4f69410776e74196ee749e66794be48d68b8f869
modin
1
259,457
58
12
12
170
17
0
78
199
test_poisson_glmnet
ENH migrate GLMs / TweedieRegressor to linear loss (#22548) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
https://github.com/scikit-learn/scikit-learn.git
def test_poisson_glmnet(): # library("glmnet") # options(digits=10) # df <- data.frame(a=c(-2,-1,1,2), b=c(0,0,1,1), y=c(0,1,1,2)) # x <- data.matrix(df[,c("a", "b")]) # y <- df$y # fit <- glmnet(x=x, y=y, alpha=0, intercept=T, family="poisson", # standardize=F, thresh=1e-...
123
test_glm.py
Python
sklearn/linear_model/_glm/tests/test_glm.py
75a94f518f7bd7d0bf581ffb67d9f961e3c4efbc
scikit-learn
1
311,205
7
11
3
40
7
0
7
21
_refresh
Implement coordinator class for Tradfri integration (#64166) * Initial commit coordinator * More coordinator implementation * More coordinator implementation * Allow integration reload * Move API calls to try/catch block * Move back fixture * Remove coordinator test file * Ensure unchanged file ...
https://github.com/home-assistant/core.git
def _refresh(self) -> None: self._device_data = self.coordinator.data.blind_control.blinds[0]
24
cover.py
Python
homeassistant/components/tradfri/cover.py
9d404b749a0aa0d0527e145c911559df5ecf2afd
core
1
153,816
9
10
2
44
7
0
9
24
mode
REFACTOR-#4513: Fix spelling mistakes in docs and docstrings (#4514) Co-authored-by: Rehan Sohail Durrani <rdurrani@berkeley.edu> Signed-off-by: jeffreykennethli <jkli@ponder.io>
https://github.com/modin-project/modin.git
def mode(self, **kwargs): # noqa: PR02 return DataFrameDefault.register(pandas.DataFrame.mode)(self, **kwargs)
26
query_compiler.py
Python
modin/core/storage_formats/base/query_compiler.py
57e29bc5d82348006c5170ef9ac0a9eedcd9acf9
modin
1
137,385
24
10
10
69
9
0
27
76
to_json
[Jobs] [Job Status refactor 1/n] Use JSON for JobInfo instead of pickled Python class (#30955) Updates the JobInfo storage to use JSON instead of a pickled Python class. This allows it to be read by the GCS (which is in C++). Related issue number This a first step towards resolving #29621. The goal is to unify the...
https://github.com/ray-project/ray.git
def to_json(self) -> Dict[str, Any]: json_dict = asdict(self) # Convert enum values to strings. json_dict["status"] = str(json_dict["status"]) # Assert that the dictionary is JSON-serializable. json.dumps(json_dict) return json_dict
39
common.py
Python
dashboard/modules/job/common.py
b028e6b35d56baa2c19b4353f2e2605968bc93b6
ray
1
269,370
7
10
2
34
6
0
7
13
round_repeats
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def round_repeats(repeats, depth_coefficient): return int(math.ceil(depth_coefficient * repeats))
20
efficientnet_v2.py
Python
keras/applications/efficientnet_v2.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
178,311
15
9
7
45
4
0
15
51
createPreModuleLoadCode
Plugins: Massive cleanup and API improvements and Kivy support * Added method to locate a DLL and to create a DLL entry point as expected, removing need for imports and making it more clear as an API. * The location of modules had already an API, but it wasn' used where it could be. * Moved implicit imports an...
https://github.com/Nuitka/Nuitka.git
def createPreModuleLoadCode(module): if module.getFullName() == "gi": code = r return code, "Set typelib search path"
23
GiPlugin.py
Python
nuitka/plugins/standard/GiPlugin.py
56eb59d93f13815e66d0dea07e7669dfe275fa10
Nuitka
2
241,681
11
11
8
51
9
0
12
44
train_batch_idx
Integrate progress tracking into the progress bar (#11213)
https://github.com/Lightning-AI/lightning.git
def train_batch_idx(self) -> int: if self.trainer is None: return 0 return self.trainer.fit_loop.epoch_loop.batch_progress.current.processed
31
base.py
Python
pytorch_lightning/callbacks/progress/base.py
8a549a550cb10189ff1db382f546a40cd1c6c5b3
lightning
2
225,775
7
6
8
20
2
0
7
13
_mock_query_select
add unit test to tree index (#44) Co-authored-by: Jerry Liu <jerry@robustintelligence.com>
https://github.com/jerryjliu/llama_index.git
def _mock_query_select() -> str: return "ANSWER: 1"
9
mock_predict.py
Python
tests/mock_utils/mock_predict.py
606baf1cd456dd6d735da61d72bba847f749dbf7
llama_index
1
140,580
30
12
11
164
22
0
42
147
synchronize
Clean up docstyle in python modules and add LINT rule (#25272)
https://github.com/ray-project/ray.git
def synchronize(local_filters, remotes, update_remote=True): remote_filters = ray.get( [r.get_filters.remote(flush_after=True) for r in remotes] ) for rf in remote_filters: for k in local_filters: local_filters[k].apply_changes(rf[k], with_buffer=...
107
filter_manager.py
Python
rllib/utils/filter_manager.py
905258dbc19753c81039f993477e7ab027960729
ray
7
246,865
52
15
38
438
19
0
94
482
test_aggregation_get_event_for_thread
Replace assertEquals and friends with non-deprecated versions. (#12092)
https://github.com/matrix-org/synapse.git
def test_aggregation_get_event_for_thread(self): channel = self._send_relation(RelationTypes.THREAD, "m.room.test") self.assertEqual(200, channel.code, channel.json_body) thread_id = channel.json_body["event_id"] # Annotate the annotation. channel = self._send_relation(...
249
test_relations.py
Python
tests/rest/client/test_relations.py
02d708568b476f2f7716000b35c0adfa4cbd31b3
synapse
1
130,567
49
17
16
182
17
0
61
257
wait_for_nodes
[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 wait_for_nodes(self, timeout=30): start_time = time.time() while time.time() - start_time < timeout: clients = self.global_state.node_table() live_clients = [client for client in clients if client["Alive"]] expected = len(self.list_all_nodes()) ...
100
cluster_utils.py
Python
python/ray/cluster_utils.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
5
82,360
30
12
11
190
26
0
35
153
test_cache_limit_ttl_greater_than_default_cache_ttl
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
https://github.com/django-cms/django-cms.git
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__,...
109
test_cache.py
Python
cms/tests/test_cache.py
c412e97acba65a2a68e70ca15ea950bd31f90d3e
django-cms
1
250,280
41
13
35
237
12
0
65
486
test_update_version
Add missing type hints to tests.handlers. (#14680) And do not allow untyped defs in tests.handlers.
https://github.com/matrix-org/synapse.git
def test_update_version(self) -> None: version = self.get_success( self.handler.create_version( self.local_user, { "algorithm": "m.megolm_backup.v1", "auth_data": "first_version_auth_data", }, ...
137
test_e2e_room_keys.py
Python
tests/handlers/test_e2e_room_keys.py
652d1669c5a103b1c20478770c4aaf18849c09a3
synapse
1
101,055
28
11
13
144
13
0
42
125
_get_rgb_xyz_map
Add Flip Loss Function - Add Flip for AMD and TF - Split Perceptual Loss functions to own modules - Fix allowed input shape for models - Allow GUI tooltip to display at higher width
https://github.com/deepfakes/faceswap.git
def _get_rgb_xyz_map(cls) -> Tuple[Tensor, Tensor]: mapping = np.array([[10135552 / 24577794, 8788810 / 24577794, 4435075 / 24577794], [2613072 / 12288897, 8788810 / 12288897, 887015 / 12288897], [1425312 / 73733382, 8788810 / 73733382, 70074185 ...
97
keras_utils.py
Python
lib/keras_utils.py
582c2ce40c11ef235dd3f9100f70e1e2832f8dd3
faceswap
1
309,854
11
10
3
48
9
0
11
20
test_null_name
Avoid removing zwave_js devices for non-ready nodes (#59964) * Only replace a node if the mfgr id / prod id / prod type differ * Prefer original device name for unready node * move register_node_in_dev_reg into async_setup_entry * simplify get_device_id_ext * Don't need hex ids * Revert "move register_node_in_dev...
https://github.com/home-assistant/core.git
async def test_null_name(hass, client, null_name_check, integration): node = null_name_check assert hass.states.get(f"switch.node_{node.node_id}")
25
test_init.py
Python
tests/components/zwave_js/test_init.py
cb89c23c0ffd7beba1ecc0cb84d80e8842f9a571
core
1
142,825
17
10
5
46
6
0
19
73
get_staged_trial
[tune/structure] Introduce execution package (#26015) Execution-specific packages are moved to tune.execution. Co-authored-by: Xiaowei Jiang <xwjiang2010@gmail.com>
https://github.com/ray-project/ray.git
def get_staged_trial(self): # TODO(xwjiang): This method should consider `self._cached_actor_pg`. for trial in self._staged_trials: if self._pg_manager.has_ready(trial): return trial return None
27
ray_trial_executor.py
Python
python/ray/tune/execution/ray_trial_executor.py
0959f44b6fc217a4f2766ed46a721eb79b067b2c
ray
3
156,083
12
10
4
60
7
0
16
32
quote
absolufy-imports - No relative - PEP8 (#8796) Conversation in https://github.com/dask/distributed/issues/5889
https://github.com/dask/dask.git
def quote(x): if istask(x) or type(x) is list or type(x) is dict: return (literal(x),) return x
36
core.py
Python
dask/core.py
cccb9d8d8e33a891396b1275c2448c352ef40c27
dask
4
82,439
126
18
35
515
49
0
222
515
assign_plugins
ci: Added codespell (#7355) Co-authored-by: Christian Clauss <cclauss@me.com> * ci: codespell config taken from #7292
https://github.com/django-cms/django-cms.git
def assign_plugins(request, placeholders, template=None, lang=None, is_fallback=False): if not placeholders: return placeholders = tuple(placeholders) lang = lang or get_language_from_request(request) qs = get_cmsplugin_queryset(request) qs = qs.filter(placeholder__in=placeholders, lang...
329
plugins.py
Python
cms/utils/plugins.py
c1290c9ff89cb00caa5469129fd527e9d82cd820
django-cms
19
86,182
10
9
6
41
6
0
10
35
get
feat: Add arroyo compatible synchronized consumer (#39340) This brings over the synchronized consumer code that was previously part of arroyo. It was removed in https://github.com/getsentry/arroyo/pull/81 since it was no longer being used by Snuba and should not live in the shared library. This implementation diffe...
https://github.com/getsentry/sentry.git
def get(self) -> Generator[T, None, None]: with self.__lock: yield self.__value
24
synchronized.py
Python
src/sentry/eventstream/kafka/synchronized.py
3caca8f2eace81edf9a18fd825f16186e53eb755
sentry
1
246,857
36
14
24
216
18
0
47
343
test_send_relation
Replace assertEquals and friends with non-deprecated versions. (#12092)
https://github.com/matrix-org/synapse.git
def test_send_relation(self): channel = self._send_relation(RelationTypes.ANNOTATION, "m.reaction", key="👍") self.assertEqual(200, channel.code, channel.json_body) event_id = channel.json_body["event_id"] channel = self.make_request( "GET", "/rooms/%s...
130
test_relations.py
Python
tests/rest/client/test_relations.py
02d708568b476f2f7716000b35c0adfa4cbd31b3
synapse
1
110,569
53
16
18
304
13
0
112
206
_get_aligned_offsets
Reparametrize offsetbox calculations in terms of bboxes. Passing a single bbox instead of (xdescent, ydescent, width, height) separately is easier to follow (see e.g. the changes in VPacker and HPacker, which no longer have to repeatedly pack/unpack whd_list), and avoids having to figure out e.g. the sign of the desce...
https://github.com/matplotlib/matplotlib.git
def _get_aligned_offsets(yspans, height, align="baseline"): _api.check_in_list( ["baseline", "left", "top", "right", "bottom", "center"], align=align) if height is None: height = max(y1 - y0 for y0, y1 in yspans) if align == "baseline": yspan = (min(y0 for y0, y1 in yspans), m...
190
offsetbox.py
Python
lib/matplotlib/offsetbox.py
de2192589f8ea50c9dc90be87b649399ff623feb
matplotlib
12
132,999
96
14
30
285
22
0
145
418
_check_gpu_tensors
[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 _check_gpu_tensors(tensors): if not tensors or not isinstance(tensors, list): raise RuntimeError("'tensors' must be a nonempty list.") if len(tensors) > nccl_util.get_num_gpus(): raise RuntimeError( "Tensor list cannot be larger than the number" "of available GPU...
165
nccl_collective_group.py
Python
python/ray/util/collective/collective_group/nccl_collective_group.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
9
301,842
32
10
13
167
13
0
48
91
test_device_trackers_numerical_name
Add test for mikrotik device tracker with numerical device name (#72808) Add mikrotik test for numerical device name
https://github.com/home-assistant/core.git
async def test_device_trackers_numerical_name(hass, mock_device_registry_devices): await setup_mikrotik_entry( hass, dhcp_data=[DEVICE_3_DHCP_NUMERIC_NAME], wireless_data=[DEVICE_3_WIRELESS] ) device_3 = hass.states.get("device_tracker.123") assert device_3 is not None assert device_3...
96
test_device_tracker.py
Python
tests/components/mikrotik/test_device_tracker.py
9ac0c5907f8e7a4a0906559b482ac450f42892c0
core
1
200,374
15
7
2
26
3
0
15
36
arguments
Fix various typos Found via `codespell -q 3 -L aboves,aline,ans,aother,arithmetics,assum,atleast,braket,clen,declar,declars,dorder,dum,enew,fo,fro,inout,iself,ist,ket,lamda,lightyear,lightyears,nd,numer,numers,orderd,ot,pring,rcall,rever,ro,ser,siz,splitted,sring,supercedes,te,tht,unequality,upto,vas,versin,whet`
https://github.com/sympy/sympy.git
def arguments(self): # Will be changed to self.args[1:] after args overriding is removed return self._args[1:]
14
assume.py
Python
sympy/assumptions/assume.py
24f1e7730119fe958cc8e28411f790c9a5ec04eb
sympy
1
176,531
101
12
12
300
30
0
135
200
test_draw_networkx_edges_undirected_selfloop_colors
added extra condition for fancy arrow colors (#5407) * added extra condition for fancy arrow colors * keep fancy edges ids to get a correct prop's value * Add test for selfloop color mapping in undirected graphs. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
https://github.com/networkx/networkx.git
def test_draw_networkx_edges_undirected_selfloop_colors(): fig, ax = plt.subplots() # Edge list and corresponding colors edgelist = [(1, 3), (1, 2), (2, 3), (1, 1), (3, 3), (2, 2)] edge_colors = ["pink", "cyan", "black", "red", "blue", "green"] G = nx.Graph(edgelist) pos = {n: (n, n) for n...
197
test_pylab.py
Python
networkx/drawing/tests/test_pylab.py
1a38c171a560d9cdddd0d4bf1f1d613d80c5af7c
networkx
3
250,743
29
12
8
132
15
0
31
75
test_warn_no_nextlayer
exit for all tools on startup error, fix #4544 (#5187)
https://github.com/mitmproxy/mitmproxy.git
async def test_warn_no_nextlayer(): ps = Proxyserver() with taddons.context(ps) as tctx: tctx.configure(ps, listen_host="127.0.0.1", listen_port=0) await ps.running() await tctx.master.await_log("Proxy server listening at", level="info") assert tctx.master.has_log("Warning: ...
72
test_proxyserver.py
Python
test/mitmproxy/addons/test_proxyserver.py
e2f42ddb301737a1d8179c1034226a838ccd74f1
mitmproxy
1
130,363
16
8
6
73
11
0
16
58
stop_instance
[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 stop_instance(self, instance_id, force_stop=False): request = StopInstanceRequest() request.set_InstanceId(instance_id) request.set_ForceStop(force_stop) logging.info("Stop %s command submit successfully.", instance_id) self._send_request(request)
43
utils.py
Python
python/ray/autoscaler/_private/aliyun/utils.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
1
281,550
36
15
15
226
22
0
47
204
call_list
Terminal Wide Rich (#1161) * My idea for how we handle Rich moving forward * remove independent consoles * FIxed pylint issues * add a few vars * Switched print to console * More transitions * Changed more prints * Replaced all prints * Fixing tabulate * Finished replace tabulate * Finish...
https://github.com/OpenBB-finance/OpenBBTerminal.git
def call_list(self, other_args): parser = argparse.ArgumentParser( add_help=False, prog="list", description=, ) ns_parser = parse_known_args_and_warn(parser, other_args) if ns_parser: length = max(len(self.calls), len(self.puts)) -...
129
payoff_controller.py
Python
gamestonk_terminal/stocks/options/payoff_controller.py
82747072c511beb1b2672846ae2ee4aec53eb562
OpenBBTerminal
5
45,034
22
11
12
83
14
0
25
47
_get_function_params
Add params dag_id, task_id etc to XCom.serialize_value (#19505) When implementing a custom XCom backend, in order to store XCom objects organized by dag_id, run_id etc, we need to pass those params to `serialize_value`.
https://github.com/apache/airflow.git
def _get_function_params(function) -> List[str]: parameters = inspect.signature(function).parameters bound_arguments = [ name for name, p in parameters.items() if p.kind not in (p.VAR_POSITIONAL, p.VAR_KEYWORD) ] return bound_arguments
53
xcom.py
Python
airflow/models/xcom.py
56285eee04285d8b6fac90911248d7e9dd5504d8
airflow
3
118,561
27
11
16
141
22
0
30
174
start
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".
https://github.com/streamlit/streamlit.git
def start(self): if self._script_thread is not None: raise Exception("ScriptRunner was already started") self._script_thread = threading.Thread( target=self._process_request_queue, name="ScriptRunner.scriptThread", ) script_run_ctx = ScriptR...
90
script_runner.py
Python
lib/streamlit/script_runner.py
704eab3478cf69847825b23dabf15813a8ac9fa2
streamlit
2
104,792
14
9
16
58
8
0
14
35
cache_files
Add code examples for DatasetDict (#4245) * 📝 add code examples for DatasetDict * 🖍 apply quentin review
https://github.com/huggingface/datasets.git
def cache_files(self) -> Dict[str, Dict]: self._check_values_type() return {k: dataset.cache_files for k, dataset in self.items()}
36
dataset_dict.py
Python
src/datasets/dataset_dict.py
1904d0c0a3a96330d9b870cdca3e9a3a137f2977
datasets
2
100,848
62
12
28
215
19
0
86
353
_get_mask_channels
Refactoring and TravisCI to Github Actions (#1239) * refactor training * travis to actions
https://github.com/deepfakes/faceswap.git
def _get_mask_channels(self) -> List[int]: eye_multiplier = self._config["eye_multiplier"] mouth_multiplier = self._config["mouth_multiplier"] if not self._config["penalized_mask_loss"] and (eye_multiplier > 1 or mouth_multiplier >...
130
settings.py
Python
plugins/train/model/_base/settings.py
ff6b0209dd5ad57b81b0aca570df7f39a7119bfb
faceswap
7
64,692
66
15
17
266
22
0
146
118
split_invoices
fix(pos): cannot close the pos if sr. no. is sold & returned
https://github.com/frappe/erpnext.git
def split_invoices(invoices): # Input # invoices = [ # {'pos_invoice': 'Invoice with SR#1 & SR#2', 'is_return': 0}, # {'pos_invoice': 'Invoice with SR#1', 'is_return': 1}, # {'pos_invoice': 'Invoice with SR#2', 'is_return': 0} # ] # Output # _invoices = [ # [{'pos_invoice': 'Invoice with SR#1 & SR#2', 'i...
160
pos_invoice_merge_log.py
Python
erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
cf51a0a1b8ec45bf653c9478bd57cee676b384d9
erpnext
15
9,832
87
10
68
249
21
0
129
370
mixin_base_pod_parser
feat: star routing (#3900) * feat(proto): adjust proto for star routing (#3844) * feat(proto): adjust proto for star routing * feat(proto): generate proto files * feat(grpc): refactor grpclet interface (#3846) * feat: refactor connection pool for star routing (#3872) * feat(k8s): add more labels to k8s ...
https://github.com/jina-ai/jina.git
def mixin_base_pod_parser(parser): gp = add_arg_group(parser, title='Pod') gp.add_argument( '--uses-before', type=str, help='The executor attached after the Peas described by --uses, typically before sending to all ' 'shards, accepted type follows `--uses`', ) gp.ad...
219
pod.py
Python
jina/parsers/peapods/pod.py
933415bfa1f9eb89f935037014dfed816eb9815d
jina
2
96,631
150
17
78
871
79
0
236
1,125
apply_rule
feat(issue_alert_status): Start writing issue alert history (#32045) This adds a postgres backend for issue alert history and calls record after an issue alert fires.
https://github.com/getsentry/sentry.git
def apply_rule(self, rule, status): condition_match = rule.data.get("action_match") or Rule.DEFAULT_CONDITION_MATCH filter_match = rule.data.get("filter_match") or Rule.DEFAULT_FILTER_MATCH rule_condition_list = rule.data.get("conditions", ()) frequency = rule.data.get("frequenc...
541
processor.py
Python
src/sentry/rules/processor.py
f6dd9b183a170a6813a41ccee656d61e14670d80
sentry
24
42,778
30
11
10
116
14
0
36
149
oss_read
SSL Bucket, Light Logic Refactor and Docstring Update for Alibaba Provider (#23891)
https://github.com/apache/airflow.git
def oss_read(self, remote_log_location, return_error=False): try: oss_remote_log_location = f'{self.base_folder}/{remote_log_location}' self.log.info("read remote log: %s", oss_remote_log_location) return self.hook.read_key(self.bucket_name, oss_remote_log_location) ...
61
oss_task_handler.py
Python
airflow/providers/alibaba/cloud/log/oss_task_handler.py
d19cb86660d40e665d8c4fe2b07d76b88532bd8b
airflow
3
118,603
4
10
3
39
6
0
4
25
test_without_spinner
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".
https://github.com/streamlit/streamlit.git
def test_without_spinner(self): function_without_spinner() self.assertTrue(self.forward_msg_queue.is_empty())
21
cache_spinner_test.py
Python
lib/tests/streamlit/cache_spinner_test.py
704eab3478cf69847825b23dabf15813a8ac9fa2
streamlit
1
287,887
34
13
15
173
17
0
46
215
_build_observations_by_entity
Fix Bayesian sensor to use negative observations (#67631) Co-authored-by: Diogo Gomes <diogogomes@gmail.com>
https://github.com/home-assistant/core.git
def _build_observations_by_entity(self): observations_by_entity: dict[str, list[OrderedDict]] = {} for i, obs in enumerate(self._observations): obs["id"] = i if "entity_id" not in obs: continue observations_by_entity.setdefault(obs["entity_i...
102
binary_sensor.py
Python
homeassistant/components/bayesian/binary_sensor.py
49eeeae51da329284070eb7b91ed6cc8078d2f19
core
7
156,775
24
12
31
207
14
0
59
97
test_series_format
Change repr methods to avoid Layer materialization (#9289) * change task count to layer count in DataFrame and Array reprs * add test * address doctest failure * simplify test * support pluralization * use 'graph layers' instead of 'layers' to be more explicit
https://github.com/dask/dask.git
def test_series_format(): s = pd.Series([1, 2, 3, 4, 5, 6, 7, 8], index=list("ABCDEFGH")) ds = dd.from_pandas(s, 3) exp = assert repr(ds) == exp assert str(ds) == exp exp = assert ds.to_string() == exp s = pd.Series([1, 2, 3, 4, 5, 6, 7, 8], index=list("ABCDEFGH"), name="XXX") ds...
135
test_format.py
Python
dask/dataframe/tests/test_format.py
ddcb841903f8f180aa359bd8db0054aa3b5964e3
dask
1
290,182
29
10
6
71
11
0
31
78
available
Improve MQTT type hints part 1 (#80523) * Improve typing alarm_control_panel * Improve typing binary_sensor * Improve typing button * Add misssed annotation * Move CONF_EXPIRE_AFTER to _setup_from_config * Use CALL_BACK type * Remove assert, improve code style
https://github.com/home-assistant/core.git
def available(self) -> bool: expire_after: int | None = self._config.get(CONF_EXPIRE_AFTER) # mypy doesn't know about fget: https://github.com/python/mypy/issues/6185 return MqttAvailability.available.fget(self) and ( # type: ignore[attr-defined] expire_after is None or not...
42
binary_sensor.py
Python
homeassistant/components/mqtt/binary_sensor.py
b4ad03784f1d02995da39f3094c80adb4a60492b
core
3
108,847
57
13
21
142
13
1
77
167
_tex_escape
Tweak pgf escapes. - We don't need to escape underscores manually, but can rely on the underscore package like we already do for usetex. - We don't actually escape dollars (we parse them as math delimiters first). - Slightly tweak error message generation. - Move escaping tests before the big `create_figure` defin...
https://github.com/matplotlib/matplotlib.git
def _tex_escape(text): r # Sometimes, matplotlib adds the unknown command \mathdefault. # Not using \mathnormal instead since this looks odd for the latex cm font. text = _replace_mathdefault(text) text = text.replace("\N{MINUS SIGN}", r"\ensuremath{-}") # split text into normaltext and inline m...
@_api.deprecated("3.6")
73
backend_pgf.py
Python
lib/matplotlib/backends/backend_pgf.py
b5c535b3cf08a15115637035a67a2a730856090b
matplotlib
3
53,536
22
13
36
158
20
0
40
126
generate_welcome_blub
Fix escape warnings; use config set in welcome blurb to connect to orion
https://github.com/PrefectHQ/prefect.git
def generate_welcome_blub(base_url): blurb = textwrap.dedent( r ).format(api_url=base_url + "/api") visit_dashboard = textwrap.dedent( f ) dashboard_not_built = textwrap.dedent( ) dashboard_disabled = textwrap.dedent( ) if not os.path.exists(pref...
90
orion.py
Python
src/prefect/cli/orion.py
487fc4fb7ae2db5c767ef0bc68b14598e3b7e643
prefect
3
27,099
13
8
4
42
9
1
14
30
subscription_app_deleted_webhook
New events related to apps changes. (#9698) * New events related to apps changes. * Schema update after rebase * CHANGELOG.md update * New events description fix * Missing app event added to CHANGELOG.md
https://github.com/saleor/saleor.git
def subscription_app_deleted_webhook(subscription_webhook): return subscription_webhook( APP_DELETED_SUBSCRIPTION_QUERY, WebhookEventAsyncType.APP_DELETED ) APP_STATUS_CHANGED_SUBSCRIPTION_QUERY = ( APP_DETAILS_FRAGMENT + ) @pytest.fixture
@pytest.fixture
14
fixtures.py
Python
saleor/plugins/webhook/tests/subscription_webhooks/fixtures.py
b5e414c98a1535d287721c859994424cf0eea081
saleor
1
212,822
35
11
8
85
11
0
38
116
get_previous_focus
Added key and widget Element properties, new focus methods Element.get_next_focus, Element.get_previous_focus. New Window method Window.widget_to_element
https://github.com/PySimpleGUI/PySimpleGUI.git
def get_previous_focus(self): if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow return None try: next_widget_focus = self.widget.tk_focusPrev() # tkinter.Widget return self.ParentForm.widget_to_element(next_widget_...
47
PySimpleGUI.py
Python
PySimpleGUI.py
9b814f003b0685757d76ce56ee9c98eae114d346
PySimpleGUI
3
183,565
8
7
7
25
5
0
8
22
mode_is_supported
[terminal buffering] Add support for the "mode 2026" That task is definitely way more complicated that it seemed to be 😅
https://github.com/Textualize/textual.git
def mode_is_supported(self) -> bool: return self.report_parameter in MODE_REPORTS_PARAMETERS_INDICATING_SUPPORT
14
events.py
Python
src/textual/events.py
d14659c1a3760eade2dd3479b66eb8b2e7711db0
textual
1
303,208
23
10
9
89
12
0
24
102
async_added_to_hass
Keep track of a context for each listener (#72702) * Remove async_remove_listener This avoids the ambuigity as to what happens if same callback is added multiple times. * Keep track of a context for each listener This allow a update coordinator to adapt what data to request on update from the backing service ...
https://github.com/home-assistant/core.git
async def async_added_to_hass(self): await super().async_added_to_hass() self.coordinator.entities.append(self) # Sensors should also register callbacks to HA when their state changes self.coordinator.musiccast.register_group_update_callback( self.update_all_mc_entit...
51
media_player.py
Python
homeassistant/components/yamaha_musiccast/media_player.py
8910d265d6cf15fed4e6e98b4344031019c1016d
core
1
247,482
73
12
28
391
39
0
94
318
test_single_private_joined_room
Add some type hints to the tests.handlers module. (#12207)
https://github.com/matrix-org/synapse.git
def test_single_private_joined_room(self) -> None: room_id = self.helper.create_room_as(self.user1, tok=self.token1) self.helper.send_state( room_id, EventTypes.RoomHistoryVisibility, body={"history_visibility": "joined"}, tok=self.token1, ...
254
test_admin.py
Python
tests/handlers/test_admin.py
e10a2fe0c28ec9206c0e2275df492f61ff5025f2
synapse
3
189,964
6
16
5
147
35
10
6
13
add_sound
fix: SoundExample video autoplaying with sound (#2911)
https://github.com/ManimCommunity/manim.git
def add_sound(self, sound_file, time_offset=0, gain=None, **kwargs):
""" This method is used to add a sound to the animation. Parameters ---------- sound_file : str The path to the sound file. time_offset : int,float, optional The offset in the sound file after which""" Thisused to add a sound to thesound...
53
scene.py
Python
manim/scene/scene.py
aeeb6da3572e89fac605872288988823c93ea146
manim
2
291,460
30
18
16
143
17
0
39
227
select_source
Use _attr_state in ziggo mediabox xl media player (#82844)
https://github.com/home-assistant/core.git
def select_source(self, source): if str(source).isdigit(): digits = str(source) else: digits = next( ( key for key, value in self._mediabox.channels().items() if value == source )...
86
media_player.py
Python
homeassistant/components/ziggo_mediabox_xl/media_player.py
cee716b89287cd76c0b50ce562487a0cc4ba0481
core
6