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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
299,377 | 18 | 10 | 8 | 72 | 7 | 0 | 24 | 92 | async_set_repeat | Improve repeat and shuffle support for Squeezebox (#70941) | https://github.com/home-assistant/core.git | async def async_set_repeat(self, repeat):
if repeat == REPEAT_MODE_ALL:
repeat_mode = "playlist"
elif repeat == REPEAT_MODE_ONE:
repeat_mode = "song"
else:
repeat_mode = "none"
await self._player.async_set_repeat(repeat_mode)
| 38 | media_player.py | Python | homeassistant/components/squeezebox/media_player.py | 0264f060e4fc988f3a0442ba8f951677816c11ea | core | 3 | |
213,043 | 106 | 13 | 56 | 542 | 30 | 0 | 195 | 789 | add_resource_policy | fix: Py27hash fix (#2182)
* Add third party py27hash code
* Add Py27UniStr and unit tests
* Add py27hash_fix utils and tests
* Add to_py27_compatible_template and tests
* Apply py27hash fix to wherever it is needed
* Apply py27hash fix, all tests pass except api_with_any_method_in_swagger
* apply py2... | https://github.com/aws/serverless-application-model.git | def add_resource_policy(self, resource_policy, path, stage):
if resource_policy is None:
return
SwaggerEditor.validate_is_dict(resource_policy, "Resource Policy is not a valid dictionary.")
aws_account_whitelist = resource_policy.get("AwsAccountWhitelist")
aws_accou... | 322 | swagger.py | Python | samtranslator/swagger/swagger.py | a5db070f446b7cfebdaa6ad2e3dcf78f6105a272 | serverless-application-model | 8 | |
101,298 | 27 | 11 | 8 | 106 | 9 | 0 | 34 | 88 | toggle_mask_display | Data Augmentation update (#1263)
- lib.detected_face
- Subclass Masks for Landmark based masks
- Add training mask propery + methods to DetectedFace
- lib.training_training
- subclass TrainingDataGenerator for training and preview data
- Split cache into own module
- Reduce thread count to ... | https://github.com/deepfakes/faceswap.git | def toggle_mask_display(self) -> None:
if not (self._model.config["learn_mask"] or self._model.config["penalized_mask_loss"]):
return
display_mask = not self._display_mask
print("") # Break to not garble loss output
logger.info("Toggling mask display %s...", "on" if... | 58 | _base.py | Python | plugins/train/trainer/_base.py | 2beceffad9b15c1fd78f06b9b272563321c5a41e | faceswap | 4 | |
168,323 | 7 | 9 | 15 | 46 | 8 | 0 | 8 | 22 | isin | TYP: pandas.core.series annotations from pandas-stubs (#47926)
* TYP: pandas.core.series annotations from pandas-stubs
* and DataFrame
* more compatibility with pandas-stub tests
* mypy address line-off-by-one (merge?) issue | https://github.com/pandas-dev/pandas.git | def isin(self, values) -> npt.NDArray[np.bool_]:
return isin(np.asarray(self), values)
| 29 | base.py | Python | pandas/core/arrays/base.py | 50c2af1a6322375359a8bacfd79056ca4ab02df2 | pandas | 1 | |
158,111 | 47 | 15 | 10 | 183 | 27 | 0 | 60 | 157 | evaluate_accuracy_gpus | [PaddlePaddle] Merge master into Paddle branch (#1186)
* change 15.2 title in chinese version (#1109)
change title ’15.2. 情感分析:使用递归神经网络‘ to ’15.2. 情感分析:使用循环神经网络‘
* 修改部分语义表述 (#1105)
* Update r0.17.5 (#1120)
* Bump versions in installation
* 94行typo: (“bert.mall”)->(“bert.small”) (#1129)
* line 313: "b... | https://github.com/d2l-ai/d2l-zh.git | def evaluate_accuracy_gpus(net, data_iter, split_f=d2l.split_batch):
# Query the list of devices
devices = list(net.collect_params().values())[0].list_ctx()
# No. of correct predictions, no. of predictions
metric = d2l.Accumulator(2)
for features, labels in data_iter:
X_shards, y_shards... | 118 | mxnet.py | Python | d2l/mxnet.py | b64b41d8c1ac23c43f7a4e3f9f6339d6f0012ab2 | d2l-zh | 4 | |
107,880 | 55 | 12 | 17 | 352 | 33 | 1 | 74 | 294 | test_colorbar_extension_inverted_axis | FIX: Handle inverted colorbar axes with extensions
This fixes the colorbar extensions to use the proper color when the
long axis is inverted. | https://github.com/matplotlib/matplotlib.git | def test_colorbar_extension_inverted_axis(orientation, extend, expected):
data = np.arange(12).reshape(3, 4)
fig, ax = plt.subplots()
cmap = plt.get_cmap("viridis").with_extremes(under=(0, 0, 0, 1),
over=(1, 1, 1, 1))
im = ax.imshow(data, cmap=cmap)
... | @pytest.mark.parametrize('use_gridspec', [True, False])
@image_comparison(['cbar_with_orientation',
'cbar_locationing',
'double_cbar',
'cbar_sharing',
],
extensions=['png'], remove_text=True,
savefig_kwarg={'... | 177 | test_colorbar.py | Python | lib/matplotlib/tests/test_colorbar.py | ec374f5148631e4d392ed7e6d4c454d163a62f21 | matplotlib | 3 |
191,688 | 12 | 11 | 5 | 71 | 9 | 0 | 12 | 28 | test_run_args_and_kwargs_error | change run to use args and kwargs (#367)
Before, `run` was not able to be called with multiple arguments. This
expands the functionality. | https://github.com/hwchase17/langchain.git | def test_run_args_and_kwargs_error() -> None:
chain = FakeChain(the_input_keys=["foo", "bar"])
with pytest.raises(ValueError):
chain.run("bar", foo="bar")
| 37 | test_base.py | Python | tests/unit_tests/chains/test_base.py | 8d0869c6d3ed63b2b15d4f75ea664e089dcc569d | langchain | 1 | |
31,016 | 13 | 9 | 3 | 53 | 9 | 0 | 16 | 31 | _set_gradient_checkpointing | M-CTC-T Model (#16402)
* added cbs to notebooks, made copy-paste error fix in generation_utils
* initial push for mctc model
* mctc feature extractor done
* added processor, tokenizer and their tests for MCTC. Have added an MCTC modeling test, adjusting model code accordingly.
* added processor, tokenizer ... | https://github.com/huggingface/transformers.git | def _set_gradient_checkpointing(self, module, value=False):
if isinstance(module, (MCTCTEncoder)):
module.gradient_checkpointing = value
MCTCT_START_DOCSTRING = r
MCTCT_INPUTS_DOCSTRING = r
| 26 | modeling_mctct.py | Python | src/transformers/models/mctct/modeling_mctct.py | 119e3c0fc83db5803d20d0749eef1220f27cfdc8 | transformers | 2 | |
264,638 | 23 | 11 | 10 | 120 | 19 | 0 | 25 | 119 | enqueue_job | Allow setting individual timeouts on scripts and reports | https://github.com/netbox-community/netbox.git | def enqueue_job(cls, func, name, obj_type, user, *args, **kwargs):
job_result = cls.objects.create(
name=name,
obj_type=obj_type,
user=user,
job_id=uuid.uuid4()
)
queue = django_rq.get_queue("default")
queue.enqueue(func, ... | 80 | models.py | Python | netbox/extras/models/models.py | 36d6ae33d15e93cc552827cdea363a9c00c7f823 | netbox | 1 | |
273,842 | 9 | 9 | 7 | 51 | 8 | 0 | 12 | 69 | _create_non_trackable_mask_cache | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def _create_non_trackable_mask_cache(self):
self._dropout_mask_cache = backend.ContextValueCache(
self._create_dropout_mask
)
self._recurrent_dropout_mask_cache = backend.ContextValueCache(
self._create_recurrent_dropout_mask
)
| 30 | dropout_rnn_cell_mixin.py | Python | keras/layers/rnn/dropout_rnn_cell_mixin.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 1 | |
296,571 | 23 | 12 | 7 | 78 | 14 | 0 | 23 | 73 | _get_bytes | Add missing typing in AsusWRT router class (#70189)
* Add missing typing in AsusWRT router class
* Fix typing in device tracker
* Fix mypy incompatible type | https://github.com/home-assistant/core.git | async def _get_bytes(self) -> dict[str, Any]:
try:
datas = await self._api.async_get_bytes_total()
except (OSError, ValueError) as exc:
raise UpdateFailed(exc) from exc
return _get_dict(SENSORS_BYTES, datas)
| 48 | router.py | Python | homeassistant/components/asuswrt/router.py | b7c1fbc842ef362672a32c762c5bfb5cb84326ab | core | 2 | |
259,605 | 85 | 17 | 33 | 328 | 24 | 0 | 125 | 603 | predict_proba | DEP loss "log" in favor of "log loss" in SGDClassifier (#23046)
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> | https://github.com/scikit-learn/scikit-learn.git | def predict_proba(self, X):
check_is_fitted(self)
# TODO(1.3): Remove "log"
if self.loss in ("log_loss", "log"):
return self._predict_proba_lr(X)
elif self.loss == "modified_huber":
binary = len(self.classes_) == 2
scores = self.decision_fun... | 204 | _stochastic_gradient.py | Python | sklearn/linear_model/_stochastic_gradient.py | 0c20ba744966d23ede67cffd7c5d2e0d01cd0658 | scikit-learn | 6 | |
299,281 | 6 | 8 | 3 | 33 | 6 | 0 | 6 | 20 | is_online | Use shorthand attributes in sharkiq vacuum (#70844) | https://github.com/home-assistant/core.git | def is_online(self) -> bool:
return self.coordinator.device_is_online(self._serial_number)
| 19 | vacuum.py | Python | homeassistant/components/sharkiq/vacuum.py | 0425f8bc4e03beb848bac99ff3ee8f60ad45c74c | core | 1 | |
43,586 | 93 | 12 | 3 | 333 | 49 | 0 | 137 | 344 | upload_file | Migrate Google example DAG s3_to_gcs to new design AIP-47 (#24641)
related: #22447, #22430 | https://github.com/apache/airflow.git | def upload_file():
s3_hook = S3Hook()
s3_hook.load_file(filename=UPLOAD_FILE, key=PREFIX, bucket_name=BUCKET_NAME)
with models.DAG(
DAG_ID,
schedule_interval='@once',
start_date=datetime(2021, 1, 1),
catchup=False,
tags=['example', 's3'],
) as dag:
create_s3_bucket = S3CreateBucke... | 26 | example_s3_to_gcs.py | Python | tests/system/providers/google/cloud/gcs/example_s3_to_gcs.py | 7a7ca5016019f93ebee052a2bf99772145b7fc03 | airflow | 1 | |
153,578 | 33 | 12 | 7 | 114 | 13 | 0 | 35 | 93 | idxmax | DOCS-#3099: Fix `BasePandasDataSet` docstrings warnings (#4333)
Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru>
Signed-off-by: Alexander Myskov <alexander.myskov@intel.com> | https://github.com/modin-project/modin.git | def idxmax(self, axis=0, skipna=True): # noqa: PR01, RT01, D200
if not all(d != np.dtype("O") for d in self._get_dtypes()):
raise TypeError("reduce operation 'argmax' not allowed for this dtype")
axis = self._get_axis_number(axis)
return self._reduce_dimension(
... | 69 | base.py | Python | modin/pandas/base.py | 605efa618e7994681f57b11d04d417f353ef8d50 | modin | 3 | |
9,813 | 36 | 15 | 17 | 121 | 11 | 0 | 40 | 171 | ports | 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 ports(self) -> Dict:
# Container peas are started in separate docker containers, so we should not expose port_in here
if (
(
self.params.pea_role
and PeaRoleType.from_string(self.params.pea_role) != PeaRoleType.HEAD
)
and s... | 67 | dependencies.py | Python | daemon/api/dependencies.py | 933415bfa1f9eb89f935037014dfed816eb9815d | jina | 5 | |
261,869 | 47 | 15 | 16 | 233 | 23 | 0 | 60 | 219 | common_voice | Update TTS.tts formatters (#1228)
* Return Dict from tts formatters
* Make style | https://github.com/coqui-ai/TTS.git | def common_voice(root_path, meta_file, ignored_speakers=None):
txt_file = os.path.join(root_path, meta_file)
items = []
with open(txt_file, "r", encoding="utf-8") as ttf:
for line in ttf:
if line.startswith("client_id"):
continue
cols = line.split("\t")
... | 136 | formatters.py | Python | TTS/tts/datasets/formatters.py | 127118c6378168e3d36a1e5d19ede777fd20684f | TTS | 5 | |
89,804 | 7 | 8 | 6 | 39 | 6 | 0 | 7 | 28 | get_response_from_control_silo | feat(hybrid-cloud): Create a base parser and middleware for webhooks (#42267)
See [HC-468](https://getsentry.atlassian.net/browse/HC-468)
Requires https://github.com/getsentry/sentry/pull/42260
This PR establishes the base parser that will be inherited from to
forward webhooks to the appropriate integration. It... | https://github.com/getsentry/sentry.git | def get_response_from_control_silo(self) -> HttpResponse:
self._ensure_control_silo()
return self.response_handler(self.request)
| 22 | base.py | Python | src/sentry/middleware/integrations/parsers/base.py | d8609112d6e2f373692b414acff6d4a2f7466750 | sentry | 1 | |
286,575 | 9 | 8 | 9 | 52 | 8 | 0 | 9 | 23 | get_categories | [IMPROVE] Fix Docstring formatting/Fix missing, incomplete type hints (#3412)
* Fixes
* Update stocks_helper.py
* update git-actions set-output to new format
* Update stocks_helper.py
* Update terminal_helper.py
* removed LineAnnotateDrawer from qa_view
* lint
* few changes
* updates
* sdk a... | https://github.com/OpenBB-finance/OpenBBTerminal.git | def get_categories(self) -> Union[Dict[Any, Any], List[Any]]:
return self.coin.get("categories", {})
| 33 | pycoingecko_model.py | Python | openbb_terminal/cryptocurrency/due_diligence/pycoingecko_model.py | 59d8b36bb0467a1a99513b10e8b8471afaa56fd6 | OpenBBTerminal | 1 | |
156,683 | 30 | 11 | 9 | 61 | 6 | 0 | 32 | 132 | codes | Add ``AttributeNotImplementedError`` for properties so IPython glob search works (#9231) | https://github.com/dask/dask.git | def codes(self):
if not self.known:
msg = (
"`df.column.cat.codes` with unknown categories is not "
"supported. Please use `column.cat.as_known()` or "
"`df.categorize()` beforehand to ensure known categories"
)
raise ... | 31 | categorical.py | Python | dask/dataframe/categorical.py | ecbab9d7cb52a2d96cb1b8dc397a87811e6f8059 | dask | 2 | |
276,382 | 50 | 19 | 30 | 313 | 26 | 0 | 75 | 333 | generate_combinations_with_testcase_name | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def generate_combinations_with_testcase_name(**kwargs):
sort_by_key = lambda k: k[0]
combinations = []
for key, values in sorted(kwargs.items(), key=sort_by_key):
if not isinstance(values, list):
values = [values]
combinations.append([(key, value) for value in values])
... | 194 | test_utils.py | Python | keras/testing_infra/test_utils.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 7 | |
290,665 | 77 | 14 | 31 | 470 | 34 | 0 | 116 | 437 | _parse_routing_response | Use HERE API v8 (#80892)
* Use HERE API v8
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
* Add migration
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
* Catch correct voluptuous error
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
* Use list comprehen... | https://github.com/home-assistant/core.git | def _parse_routing_response(self, response) -> HERETravelTimeData:
section: dict = response["routes"][0]["sections"][0]
summary: dict = section["summary"]
mapped_origin_lat: float = section["departure"]["place"]["location"]["lat"]
mapped_origin_lon: float = section["departure"][... | 270 | coordinator.py | Python | homeassistant/components/here_travel_time/coordinator.py | aedbfdabee67e3e7b915b842d28f151a08cb3d7f | core | 4 | |
20,353 | 83 | 14 | 24 | 366 | 44 | 0 | 107 | 371 | format | 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 format(self, tokensource, outfile):
self._create_drawables(tokensource)
self._draw_line_numbers()
im = Image.new(
'RGB',
self._get_image_size(self.maxlinelength, self.maxlineno),
self.background_color
)
self._paint_line_number_bg(i... | 244 | img.py | Python | pipenv/patched/notpip/_vendor/pygments/formatters/img.py | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | pipenv | 5 | |
180,363 | 22 | 13 | 9 | 119 | 14 | 0 | 31 | 102 | call_function | Callable blocks (#1437)
* format backend
* blocks callable
* call blocks
* format
* fixed upload
* fix mix
* formatting
* formatting
* formatting
* added serialization/deserialization for video
* formatting
* blocks
* formatting
* fix tests
* formatting | https://github.com/gradio-app/gradio.git | async def call_function(self, fn_index, processed_input):
block_fn = self.fns[fn_index]
start = time.time()
if inspect.iscoroutinefunction(block_fn.fn):
prediction = await block_fn.fn(*processed_input)
else:
prediction = await run_in_threadpool(block_fn.... | 72 | blocks.py | Python | gradio/blocks.py | 71bcfdbe929c83c10d761018042078041e956b81 | gradio | 2 | |
113,058 | 47 | 12 | 22 | 236 | 27 | 1 | 62 | 194 | test_multi_trial | [retiarii] fix experiment does not exit after done (#4916) | https://github.com/microsoft/nni.git | def test_multi_trial():
evaluator_kwargs = {
'max_epochs': 1
}
to_test = [
# (model, evaluator)
_mnist_net('simple', evaluator_kwargs),
_mnist_net('simple_value_choice', evaluator_kwargs),
_mnist_net('value_choice', evaluator_kwargs),
_mnist_net('repeat', eva... | @pytest.mark.timeout(600) | 131 | test_multitrial.py | Python | test/ut/retiarii/test_multitrial.py | 2bc984412c0fec3dae84e6f6a8253a615d2b6ebd | nni | 2 |
260,489 | 90 | 15 | 31 | 331 | 41 | 0 | 123 | 439 | fit | MAINT validate parameter in `EmpiricalCovariance`, `MinCovDet`, and `EllipticEnvelope` (#23842)
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> | https://github.com/scikit-learn/scikit-learn.git | def fit(self, X, y=None):
self._validate_params()
X = self._validate_data(X, ensure_min_samples=2, estimator="MinCovDet")
random_state = check_random_state(self.random_state)
n_samples, n_features = X.shape
# check that the empirical covariance is full rank
if (l... | 211 | _robust_covariance.py | Python | sklearn/covariance/_robust_covariance.py | 47dd54f727f09a47e84fb4cb53d33f9b0f239edb | scikit-learn | 3 | |
101,691 | 6 | 6 | 4 | 24 | 3 | 0 | 6 | 20 | thumbnails | Alignments update:
- Store face embeddings in PNG header when sorting
- typing + refactor
- Update alignments keys for 'identity' and 'video_meta' + bump to v2.3
- General typing fixes | https://github.com/deepfakes/faceswap.git | def thumbnails(self) -> "Thumbnails":
return self._thumbnails
| 12 | alignments.py | Python | lib/align/alignments.py | e5356a417e7c2124e75c4a2994ed604fc0a3cc74 | faceswap | 1 | |
129,565 | 62 | 13 | 25 | 350 | 28 | 0 | 100 | 388 | test_apex_dqn_compilation_and_per_worker_epsilon_values | [RLlib] Preparatory PR for multi-agent multi-GPU learner (alpha-star style) #03 (#21652) | https://github.com/ray-project/ray.git | def test_apex_dqn_compilation_and_per_worker_epsilon_values(self):
config = apex.APEX_DEFAULT_CONFIG.copy()
config["num_workers"] = 3
config["num_gpus"] = 0
config["learning_starts"] = 1000
config["prioritized_replay"] = True
config["timesteps_per_iteration"] = 1... | 220 | test_apex_dqn.py | Python | rllib/agents/dqn/tests/test_apex_dqn.py | d5bfb7b7da6f8ec505dd8ed69f0be419decfdcc0 | ray | 5 | |
303,357 | 51 | 13 | 24 | 246 | 21 | 0 | 63 | 307 | async_update | Remove attribution from extra state attributes (#76172) | https://github.com/home-assistant/core.git | async def async_update(self):
try:
await self.device.update()
if self._removed:
_LOGGER.debug("%s reacquired", self.name)
self._removed = False
except AgentError:
# server still available - camera error
if self.device.c... | 148 | camera.py | Python | homeassistant/components/agent_dvr/camera.py | 22eba6ce1ba3611421c526b61432ac90592eff08 | core | 6 | |
298,007 | 38 | 12 | 19 | 126 | 10 | 0 | 51 | 272 | _update_effect_list | String formatting and max line length - Part 6 (#84525) | https://github.com/home-assistant/core.git | def _update_effect_list(self, effect_list):
if effect_list in (None, "None", ""):
self._effect_list = None
return
if not isinstance(effect_list, list):
_LOGGER.error(
(
"Received invalid effect list: %s for entity %s. Expe... | 75 | light.py | Python | homeassistant/components/template/light.py | 8819634b613f6bfd55885283bab86c3852ae40c4 | core | 4 | |
26,067 | 14 | 8 | 4 | 50 | 7 | 0 | 17 | 38 | test_is_user_address_limit_reached_false | Limit number of user addresses (#9205)
* Add migration for clearing user addresses
* Adjust checkout flow - do not save address for client with more than max addresses value
* Remove the oldest user address when new address above limit is added | https://github.com/saleor/saleor.git | def test_is_user_address_limit_reached_false(customer_user, address):
# given
customer_user.addresses.set([address])
# when
limit_reached = is_user_address_limit_reached(customer_user)
# then
assert limit_reached is False
| 28 | test_utils.py | Python | saleor/account/tests/test_utils.py | 9ebd28ab8a3b7f6c341ef8474820ab225548fe0e | saleor | 1 | |
212,377 | 19 | 13 | 8 | 81 | 13 | 0 | 22 | 72 | port | 12089 support unix socket (#12091)
* Support unix socket with bokeh server
This commit adds a command line argument to bokeh serve to allow bokeh server to listen to a unix socket.
Usage: bokeh serve --unix-socket /path/to/socket
Reference: https://github.com/bokeh/bokeh/issues/12089
* Fix failing tests
... | https://github.com/bokeh/bokeh.git | def port(self) -> int | None:
sock = next(
sock for sock in self._http._sockets.values()
if sock.family in (socket.AF_INET, socket.AF_INET6)
)
return sock.getsockname()[1]
| 51 | server.py | Python | bokeh/server/server.py | dd9668e0b61d961c9e4bb76d9d0951d4f82e1dad | bokeh | 3 | |
129,371 | 30 | 16 | 30 | 162 | 8 | 0 | 47 | 393 | testAutoscalingNewNode | Tune test autoscaler / fix stale node detection bug (#21516)
See #21458. Currently, Tune keeps its own list of alive node IPs, but this information is only updated every 10 seconds and is usually stale when a new node is added. Because of this, the first trial scheduled on this node is usually marked as failed. This P... | https://github.com/ray-project/ray.git | def testAutoscalingNewNode(self):
self.cluster.update_config({
"provider": {
"head_resources": {
"CPU": 4,
"GPU": 0
}
},
"available_node_types": {
"ray.worker.cpu": {
... | 114 | test_multinode_sync.py | Python | python/ray/tune/tests/test_multinode_sync.py | 8fd5b7a5a80e88f7f70c4ebb179129c8eed65b72 | ray | 1 | |
93,204 | 110 | 11 | 60 | 694 | 41 | 0 | 176 | 581 | test_issue_message_builder | test(msteams): Add tests for building group card (#36834)
Add tests for build_group_card which builds issues cards. Does NOT test all visual aspects of the card. Only ensures that certain important elements are present and the basic structure of the card is correct. | https://github.com/getsentry/sentry.git | def test_issue_message_builder(self):
self.event1.data["metadata"].update({"value": "some error"})
self.group1.data["metadata"].update({"value": "some error"})
self.event1.data["type"] = self.group1.data["type"] = "error"
issue_card = build_group_card(
group=self.group1, eve... | 402 | test_message_builder.py | Python | tests/sentry/integrations/msteams/test_message_builder.py | db35e231ceababe8c9f5ca7b5d2ca685f07c7d5b | sentry | 3 | |
267,974 | 6 | 7 | 3 | 28 | 4 | 0 | 6 | 20 | id | ansible-test - Use more native type hints. (#78435)
* ansible-test - Use more native type hints.
Simple search and replace to switch from comments to native type hints for return types of functions with no arguments.
* ansible-test - Use more native type hints.
Conversion of simple single-line function annota... | https://github.com/ansible/ansible.git | def id(self) -> str:
return self.inspection['Id']
| 15 | docker_util.py | Python | test/lib/ansible_test/_internal/docker_util.py | 3eb0485dd92c88cc92152d3656d94492db44b183 | ansible | 1 | |
19,966 | 39 | 14 | 16 | 194 | 20 | 0 | 49 | 238 | rollback | 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 rollback(self) -> None:
for p in self._moves:
logger.info("Moving to %s\n from %s", *p)
for new_path, path in self._moves:
try:
logger.debug("Replacing %s from %s", new_path, path)
if os.path.isfile(new_path) or os.path.islink(new_pat... | 116 | req_uninstall.py | Python | pipenv/patched/notpip/_internal/req/req_uninstall.py | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | pipenv | 7 | |
100,929 | 43 | 13 | 13 | 157 | 12 | 0 | 52 | 189 | _get_tooltip | Core updates
- Change loss loading mechanism
- Autosize tooltips based on content size
- Random linting + code modernisation | https://github.com/deepfakes/faceswap.git | def _get_tooltip(widget, text=None, text_variable=None):
_RECREATE_OBJECTS["tooltips"][str(widget)] = {"text": text,
"text_variable": text_variable}
logger.debug("Adding to tooltips dict: (widget: %s. text: '%s')", widget, text)
wrap_length = 400
i... | 100 | control_helper.py | Python | lib/gui/control_helper.py | bad5025aea1adb9126580e14e064e6c99089243d | faceswap | 5 | |
271,893 | 6 | 8 | 2 | 27 | 3 | 0 | 6 | 12 | is_feature_layer | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def is_feature_layer(layer):
return getattr(layer, "_is_feature_layer", False)
| 15 | training_utils_v1.py | Python | keras/engine/training_utils_v1.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 1 | |
152,834 | 23 | 9 | 9 | 100 | 13 | 0 | 24 | 56 | get_deepbooru_tags | refactored the deepbooru module to improve speed on running multiple interogations in a row. Added the option to generate deepbooru tags for textual inversion preproccessing. | https://github.com/AUTOMATIC1111/stable-diffusion-webui.git | def get_deepbooru_tags(pil_image, threshold=0.5):
from modules import shared # prevents circular reference
create_deepbooru_process(threshold)
shared.deepbooru_process_return["value"] = -1
shared.deepbooru_process_queue.put(pil_image)
while shared.deepbooru_process_return["value"] == -1:
... | 61 | deepbooru.py | Python | modules/deepbooru.py | 1f92336be768d235c18a82acb2195b7135101ae7 | stable-diffusion-webui | 2 | |
274,533 | 50 | 17 | 15 | 160 | 24 | 0 | 59 | 246 | __call__ | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def __call__(self, y_true, y_pred, sample_weight=None):
# If we are wrapping a lambda function strip '<>' from the name as it is not
# accepted in scope name.
graph_ctx = tf_utils.graph_context_for_symbolic_tensors(
y_true, y_pred, sample_weight
)
with backen... | 101 | losses.py | Python | keras/losses.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 2 | |
107,434 | 32 | 9 | 24 | 84 | 8 | 0 | 38 | 71 | use | Rename outdated seaborn styles.
They are kept available under a versioned name for backcompat. | https://github.com/matplotlib/matplotlib.git | def use(style):
if isinstance(style, (str, Path)) or hasattr(style, 'keys'):
# If name is a single str, Path or dict, make it a single element list.
styles = [style]
else:
styles = style
style_alias = {'mpl20': 'default', 'mpl15': 'classic'}
| 144 | core.py | Python | lib/matplotlib/style/core.py | 06c92b8a8b81bbdacc3baf7ff0f1566c53fbe1b0 | matplotlib | 8 | |
256,254 | 126 | 16 | 35 | 328 | 27 | 0 | 226 | 629 | _words_to_tokens | Apply black formatting (#2115)
* Testing black on ui/
* Applying black on docstores
* Add latest docstring and tutorial changes
* Create a single GH action for Black and docs to reduce commit noise to the minimum, slightly refactor the OpenAPI action too
* Remove comments
* Relax constraints on pydoc-ma... | https://github.com/deepset-ai/haystack.git | def _words_to_tokens(words, word_offsets, tokenizer):
tokens = []
token_offsets = []
start_of_word = []
idx = 0
for w, w_off in zip(words, word_offsets):
idx += 1
if idx % 500000 == 0:
logger.info(idx)
# Get (subword) tokens of single word.
# empty /... | 195 | tokenization.py | Python | haystack/modeling/model/tokenization.py | a59bca366174d9c692fa19750c24d65f47660ef7 | haystack | 10 | |
291,784 | 72 | 13 | 45 | 567 | 22 | 0 | 162 | 705 | handle_event | Create a UUID from given LG soundbar device name (#81918)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Fixes https://github.com/home-assistant/core/issues/77524
fixes undefined | https://github.com/home-assistant/core.git | def handle_event(self, response):
data = response["data"] if "data" in response else {}
if response["msg"] == "EQ_VIEW_INFO":
if "i_bass" in data:
self._bass = data["i_bass"]
if "i_treble" in data:
self._treble = data["i_treble"]
... | 305 | media_player.py | Python | homeassistant/components/lg_soundbar/media_player.py | 4167edc52d92577d9bceb800d6699167a1a8b4c8 | core | 25 | |
266,053 | 6 | 6 | 2 | 20 | 4 | 0 | 6 | 20 | prep_related_object_data | 4347 Add JSON/YAML import support for all objects (#10367)
* 4347 initial code for json import
* 4347 initial code for json import
* Clean up form processing logic
* Consolidate import forms
* Consolidate object import/update logic
* Clean up bulk import view
Co-authored-by: jeremystretch <jstretch@n... | https://github.com/netbox-community/netbox.git | def prep_related_object_data(self, parent, data):
return data
| 12 | bulk_views.py | Python | netbox/netbox/views/generic/bulk_views.py | 93e7457e0d84ad24cba22cc5c0811777ddebf94e | netbox | 1 | |
102,252 | 40 | 11 | 120 | 198 | 25 | 0 | 54 | 108 | infer_concrete_type_builder | Per-overload torch.ops API (#67254)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/67254
Fixes https://github.com/pytorch/pytorch/issues/65997
TODO: disallow `default` as an overload name for aten operators.
BC breaking:
`output = torch.ops._test.leaky_relu(self=torch.tensor(-1.0))` now fai... | https://github.com/pytorch/pytorch.git | def infer_concrete_type_builder(nn_module, share_types=True):
concrete_type_builder = torch._C.ConcreteModuleTypeBuilder(type(nn_module))
if isinstance(nn_module, (torch.nn.ModuleDict)):
concrete_type_builder.set_module_dict()
if isinstance(nn_module, (torch.nn.ModuleList, torch.nn.Sequential))... | 846 | _recursive.py | Python | torch/jit/_recursive.py | 8e6d1738a41cb28c36db3dc5e10fd812417673de | pytorch | 37 | |
293,923 | 27 | 13 | 15 | 126 | 14 | 0 | 35 | 113 | test_from_event_to_delete_state | Convert unindexed domain queries to entity_id queries (#68404) | https://github.com/home-assistant/core.git | def test_from_event_to_delete_state():
event = ha.Event(
EVENT_STATE_CHANGED,
{
"entity_id": "sensor.temperature",
"old_state": ha.State("sensor.temperature", "18"),
"new_state": None,
},
)
db_state = States.from_event(event)
assert db_st... | 78 | test_models.py | Python | tests/components/recorder/test_models.py | 3150915cb72df2ca94a67fa29ebc9164d8deabf1 | core | 1 | |
120,239 | 145 | 14 | 34 | 580 | 55 | 1 | 218 | 280 | _lstsq | remove numpy.linalg._promote_arg_dtypes
in favor of numpy.util._promote_dtypes_inexact | https://github.com/google/jax.git | def _lstsq(a, b, rcond, *, numpy_resid=False):
# TODO: add lstsq to lax_linalg and implement this function via those wrappers.
# TODO: add custom jvp rule for more robust lstsq differentiation
a, b = _promote_dtypes_inexact(a, b)
if a.shape[0] != b.shape[0]:
raise ValueError("Leading dimensions of input arr... | @_wraps(np.linalg.lstsq, lax_description=textwrap.dedent("""\
It has two important differences:
1. In `numpy.linalg.lstsq`, the default `rcond` is `-1`, and warns that in the future
the default will be `None`. Here, the default rcond is `None`.
2. In `np.linalg.lstsq` the returned residuals are empt... | 336 | linalg.py | Python | jax/_src/numpy/linalg.py | bb2682db6df5b9388ce0b161e3f449624238718b | jax | 10 |
19,913 | 17 | 10 | 18 | 74 | 9 | 0 | 22 | 97 | installed_location | 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 installed_location(self) -> Optional[str]:
egg_link = egg_link_path_from_location(self.raw_name)
if egg_link:
location = egg_link
elif self.location:
location = self.location
else:
return None
return normalize_path(location)
| 44 | base.py | Python | pipenv/patched/notpip/_internal/metadata/base.py | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | pipenv | 3 | |
188,416 | 61 | 16 | 15 | 214 | 22 | 0 | 74 | 154 | validate_and_return_id_token | Fix rbac (#7699)
* perf: 优化 suggesstion
* perf: 修改 migrations
* feat: 添加OIDC认证逻辑
* perf: 修改 backend
* perf: 优化认证backends
* perf: 优化认证backends
* perf: 优化CAS认证, 用户多域名进行访问时回调到各自域名
Co-authored-by: ibuler <ibuler@qq.com> | https://github.com/jumpserver/jumpserver.git | def validate_and_return_id_token(jws, nonce=None, validate_nonce=True):
log_prompt = "Validate ID Token: {}"
logger.debug(log_prompt.format('Get shared key'))
shared_key = settings.AUTH_OPENID_CLIENT_ID \
if settings.AUTH_OPENID_PROVIDER_SIGNATURE_ALG == 'HS256' \
else settings.AUTH_OPE... | 126 | utils.py | Python | apps/authentication/backends/oidc/utils.py | edfca5eb2486c2f006257723ffeda6f56b170170 | jumpserver | 3 | |
153,580 | 37 | 11 | 9 | 140 | 13 | 0 | 51 | 137 | aggregate | DOCS-#3099: Fix `BasePandasDataSet` docstrings warnings (#4333)
Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru>
Signed-off-by: Alexander Myskov <alexander.myskov@intel.com> | https://github.com/modin-project/modin.git | def aggregate(self, func=None, axis=0, *args, **kwargs): # noqa: PR01, RT01, D200
axis = self._get_axis_number(axis)
result = None
if axis == 0:
result = self._aggregate(func, _axis=axis, *args, **kwargs)
# TODO: handle case when axis == 1
if result is None... | 87 | base.py | Python | modin/pandas/base.py | 605efa618e7994681f57b11d04d417f353ef8d50 | modin | 3 | |
288,763 | 10 | 9 | 5 | 38 | 6 | 0 | 10 | 42 | open_position | Powerview refactor prep for all shade types (#79862) | https://github.com/home-assistant/core.git | def open_position(self) -> PowerviewShadeMove:
return PowerviewShadeMove(
self._shade.open_position, {POS_KIND_VANE: MIN_POSITION}
)
| 23 | cover.py | Python | homeassistant/components/hunterdouglas_powerview/cover.py | 3ab294e8efc00c9f3cda2993318bb582ba675f8c | core | 1 | |
282,602 | 19 | 12 | 5 | 104 | 8 | 0 | 27 | 43 | lambda_int_or_round_float | adjusted format of logs (#1292)
adjusted format of logs | https://github.com/OpenBB-finance/OpenBBTerminal.git | def lambda_int_or_round_float(x) -> str:
if (x - int(x) < -sys.float_info.epsilon) or (x - int(x) > sys.float_info.epsilon):
return " " + str(round(x, 2))
return " " + str(int(x))
| 62 | helper_funcs.py | Python | gamestonk_terminal/helper_funcs.py | fd5821928265429d1ffb6e6d53f019915b3afbbc | OpenBBTerminal | 3 | |
293,605 | 6 | 8 | 3 | 27 | 4 | 0 | 6 | 20 | extra_restore_state_data | Restore state of trigger based template binary sensor (#67538) | https://github.com/home-assistant/core.git | def extra_restore_state_data(self) -> AutoOffExtraStoredData:
return AutoOffExtraStoredData(self._auto_off_time)
| 15 | binary_sensor.py | Python | homeassistant/components/template/binary_sensor.py | 7fc0ffd5c591429cef805aca707acdda0ca304e6 | core | 1 | |
19,288 | 55 | 17 | 23 | 332 | 30 | 0 | 76 | 418 | planning | Add optional robot radius to RRT/RRTStar path planners (#655)
* Add optional robot radius to RRT/RRTStar path planners.
* update __init__ and check_collision to include radius
* during animation, if a robot radius is given then it is drawn
* Add test for robot radius
* Correct import error
* Correct missing... | https://github.com/AtsushiSakai/PythonRobotics.git | def planning(self, animation=True):
self.node_list = [self.start]
for i in range(self.max_iter):
rnd_node = self.get_random_node()
nearest_ind = self.get_nearest_node_index(self.node_list, rnd_node)
nearest_node = self.node_list[nearest_ind]
new... | 218 | rrt.py | Python | PathPlanning/RRT/rrt.py | b53fdf75f66ccb63b5cfaadaa81253d43f01805a | PythonRobotics | 10 | |
125,798 | 3 | 8 | 2 | 26 | 4 | 0 | 3 | 17 | testTerminateUnhealthyWorkers | [autoscaler][kuberay] Disable autoscaler health check and drain functionality (#26764)
Signed-off-by: Dmitri Gekhtman <dmitri.m.gekhtman@gmail.com>
For KubeRay,
Disables autoscaler's RPC drain of worker nodes prior to termination.
Disables autoscaler's termination of nodes disconnected from the GCS. | https://github.com/ray-project/ray.git | def testTerminateUnhealthyWorkers(self):
self.unhealthyWorkerHelper(disable_liveness_check=False)
| 14 | test_autoscaler.py | Python | python/ray/tests/test_autoscaler.py | b2b11316cd0be45857b157d39ab4a89ffaf059b3 | ray | 1 | |
152,690 | 3 | 6 | 6 | 15 | 3 | 0 | 3 | 6 | get_learned_conditioning_prompt_schedules | prompt_parser: allow spaces in schedules, add test, log/ignore errors
Only build the parser once (at import time) instead of for each step.
doctest is run by simply executing modules/prompt_parser.py | https://github.com/AUTOMATIC1111/stable-diffusion-webui.git | def get_learned_conditioning_prompt_schedules(prompts, steps):
| 42 | prompt_parser.py | Python | modules/prompt_parser.py | 90e911fd546e76f879b38a764473569911a0f845 | stable-diffusion-webui | 3 | |
256,283 | 17 | 15 | 17 | 94 | 11 | 0 | 19 | 80 | get_nodes_by_class | Apply black formatting (#2115)
* Testing black on ui/
* Applying black on docstores
* Add latest docstring and tutorial changes
* Create a single GH action for Black and docs to reduce commit noise to the minimum, slightly refactor the OpenAPI action too
* Remove comments
* Relax constraints on pydoc-ma... | https://github.com/deepset-ai/haystack.git | def get_nodes_by_class(self, class_type) -> List[Any]:
matches = [
self.graph.nodes.get(node)["component"]
for node in self.graph.nodes
if isinstance(self.graph.nodes.get(node)["component"], class_type)
]
return matches
| 59 | base.py | Python | haystack/pipelines/base.py | a59bca366174d9c692fa19750c24d65f47660ef7 | haystack | 3 | |
244,036 | 19 | 8 | 10 | 88 | 9 | 0 | 19 | 117 | info | [Feature] Add Maskformer to mmdet (#7212)
* first commit
* add README
* move model description from config to readme
add description for binary_input
add description for dice loss
add a independent panoptic gt processing function
add a independent panoptic gt processing function
remove compatibili... | https://github.com/open-mmlab/mmdetection.git | def info(self):
return {
'pos_inds': self.pos_inds,
'neg_inds': self.neg_inds,
'pos_masks': self.pos_masks,
'neg_masks': self.neg_masks,
'pos_is_gt': self.pos_is_gt,
'num_gts': self.num_gts,
'pos_assigned_gt_inds': self... | 51 | mask_sampling_result.py | Python | mmdet/core/bbox/samplers/mask_sampling_result.py | cac356380d505bf15587f07c0529218cc36b9652 | mmdetection | 1 | |
260,080 | 8 | 8 | 9 | 34 | 7 | 0 | 9 | 18 | test_calibration_without_sample_weight_base_estimator | 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_calibration_without_sample_weight_base_estimator(data):
X, y = data
sample_weight = np.ones_like(y)
| 58 | test_calibration.py | Python | sklearn/tests/test_calibration.py | effdd6e215c67f2ae8ed1e378ea1661e936059a4 | scikit-learn | 1 | |
4,306 | 107 | 19 | 42 | 514 | 24 | 0 | 178 | 524 | test_search_based_stream_should_not_attempt_to_get_more_than_10k_records | 🐛 Source Hubspot: Handled 10K+ search-endpoint queries (#10700)
* Handled search queries that would output more than 10K records
* Getting CRM search objects in ascending chronological ortder
* Fixed stream
* Fixed rebase
* Fixed condition
* Added unit test
* Removed unused import
* Started a new... | https://github.com/airbytehq/airbyte.git | def test_search_based_stream_should_not_attempt_to_get_more_than_10k_records(requests_mock, common_params, fake_properties_list):
responses = [
{
"json": {
"results": [{"id": f"{y}", "updatedAt": "2022-02-25T16:43:11Z"} for y in range(100)],
"paging": {"next... | 277 | test_source.py | Python | airbyte-integrations/connectors/source-hubspot/unit_tests/test_source.py | 710543a9abacc7578238cb5edaa47f43ed7c0431 | airbyte | 7 | |
265,988 | 69 | 15 | 29 | 370 | 36 | 0 | 91 | 283 | applied_filters | Closes #9623: Implement saved filters (#10801)
* Initial work on saved filters
* Return only enabled/shared filters
* Add tests
* Clean up filtering of usable SavedFilters | https://github.com/netbox-community/netbox.git | def applied_filters(context, model, form, query_params):
user = context['request'].user
form.is_valid() # Ensure cleaned_data has been set
applied_filters = []
for filter_name in form.changed_data:
if filter_name not in form.cleaned_data:
continue
querydict = query_pa... | 198 | helpers.py | Python | netbox/utilities/templatetags/helpers.py | 484efdaf75f267a43f9321b938fda1bc967b9e53 | netbox | 7 | |
39,434 | 134 | 16 | 118 | 712 | 27 | 0 | 264 | 887 | fit | Reformat SAR+ SQL queries (#1772)
1. Quote SQL names to allow spaces in names
2. Uppercase SQL keywords and functions
3. Lowercase SQL alias and table names
4. Wrap long lines | https://github.com/microsoft/recommenders.git | def fit(self, df):
df.createOrReplaceTempView(self._format("{prefix}df_train_input"))
if self.timedecay_formula:
# With time decay, we compute a sum over ratings given by
# a user in the case when T=np.inf, so user gets a
# cumulative sum of ratings for a p... | 402 | SARPlus.py | Python | contrib/sarplus/python/pysarplus/SARPlus.py | c8522b45ca90d521ab9054563cbaccd92668eb52 | recommenders | 9 | |
19,577 | 32 | 13 | 9 | 113 | 15 | 1 | 38 | 98 | find_requirements | Code reorg utils into utils module reduces complexity (#4990)
* Split apart the massive utils.py into a utils module | https://github.com/pypa/pipenv.git | def find_requirements(max_depth=3):
i = 0
for c, d, f in walk_up(os.getcwd()):
i += 1
if i < max_depth:
r = os.path.join(c, "requirements.txt")
if os.path.isfile(r):
return r
raise RuntimeError("No requirements.txt found!")
# Borrowed from Pew.... | @contextmanager | 64 | shell.py | Python | pipenv/utils/shell.py | 3387881a6d4fc2d8bdc0f05c484cb2f7222acfb8 | pipenv | 4 |
176,538 | 27 | 13 | 8 | 147 | 14 | 0 | 38 | 74 | is_forest | Added examples in is_forest() and is_tree() (#5524)
* examples
* examples
* examples
* Example changed
* improved styling
* revised
* edge labels
* improved styling
* spacing
* error testing
* examples
* styling
* add_nodes removed
* spaceing
* spacing
* spacing | https://github.com/networkx/networkx.git | def is_forest(G):
if len(G) == 0:
raise nx.exception.NetworkXPointlessConcept("G has no nodes.")
if G.is_directed():
components = (G.subgraph(c) for c in nx.weakly_connected_components(G))
else:
components = (G.subgraph(c) for c in nx.connected_components(G))
return all(le... | 90 | recognition.py | Python | networkx/algorithms/tree/recognition.py | 1e0d829afa67885e3eeaeb191c7dd824e6ae7e21 | networkx | 6 | |
168,264 | 46 | 14 | 133 | 138 | 24 | 0 | 47 | 156 | contains | PERF cache find_stack_level (#48023)
cache stacklevel | https://github.com/pandas-dev/pandas.git | def contains(self, pat, case=True, flags=0, na=None, regex=True):
r
if regex and re.compile(pat).groups:
warnings.warn(
"This pattern is interpreted as a regular expression, and has "
"match groups. To actually get the groups, use str.extract.",
... | 93 | accessor.py | Python | pandas/core/strings/accessor.py | 2f8d0a36703e81e4dca52ca9fe4f58c910c1b304 | pandas | 3 | |
261,716 | 41 | 10 | 17 | 164 | 22 | 0 | 57 | 124 | test_class_wrapper_param_validation | MAINT Allow partial param validation for functions (#25087) | https://github.com/scikit-learn/scikit-learn.git | def test_class_wrapper_param_validation(func_module, class_module):
func, func_name, func_params, required_params = _get_func_info(func_module)
module_name, class_name = class_module.rsplit(".", 1)
module = import_module(module_name)
klass = getattr(module, class_name)
parameter_constraints_f... | 105 | test_public_functions.py | Python | sklearn/tests/test_public_functions.py | 14130f44eb6cba8a2fb2eff8383be8909783cad0 | scikit-learn | 3 | |
3,984 | 47 | 18 | 17 | 224 | 23 | 0 | 56 | 259 | test_execute_in_batch_with_fails | 🐛 Source FB Marketing: fix `execute_in_batch` when batch is bigger than 50 (#10588)
* fix execute_in_batch
* add tests
* fix pre-commit config
Co-authored-by: Sherif A. Nada <snadalive@gmail.com>
Co-authored-by: Eugene Kulak <kulak.eugene@gmail.com>
Co-authored-by: Sherif A. Nada <snadalive@gmail.com> | https://github.com/airbytehq/airbyte.git | def test_execute_in_batch_with_fails(self, api, batch, mock_batch_responses):
mock_batch_responses(
[
{
"json": [
{"body": "{}", "code": 500, "headers": {}},
{"body": json.dumps({"name": "creative 1"}), "cod... | 130 | test_base_streams.py | Python | airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_base_streams.py | 6cd20e6879a42053692c18a16906eb410aad85db | airbyte | 2 | |
164,647 | 19 | 12 | 16 | 73 | 10 | 0 | 19 | 92 | test_repeated_column_labels | TST: Don't use autouse fixture in test_stata (#45831) | https://github.com/pandas-dev/pandas.git | def test_repeated_column_labels(self, datapath):
# GH 13923, 25772
msg =
with pytest.raises(ValueError, match=msg):
read_stata(
datapath("io", "data", "stata", "stata15.dta"),
convert_categoricals=True,
)
| 40 | test_stata.py | Python | pandas/tests/io/test_stata.py | c055dc4e6be9fc1b68d873a1ace286322dadd5e1 | pandas | 1 | |
267,461 | 115 | 21 | 51 | 587 | 41 | 0 | 194 | 1,014 | _run | Forked display via queue (#77056)
* Forked Display via queue
* Docs and simple code cleanup
* Only proxy Display.display
* Remove unused import
* comment
* Update deadlock comment, remove py3 check
* Don't flush display, and don't lock from forks
* clog frag
* ci_complete ci_coverage
* Add u... | https://github.com/ansible/ansible.git | def _run(self):
# import cProfile, pstats, StringIO
# pr = cProfile.Profile()
# pr.enable()
# Set the queue on Display so calls to Display.display are proxied over the queue
display.set_queue(self._final_q)
try:
# execute the task and build a TaskR... | 365 | worker.py | Python | lib/ansible/executor/process/worker.py | 5e369604e1930b1a2e071fecd7ec5276ebd12cb1 | ansible | 7 | |
261,253 | 86 | 13 | 28 | 252 | 20 | 0 | 124 | 415 | _check_interaction_cst | ENH FEA add interaction constraints to HGBT (#21020)
Co-authored-by: Loïc Estève <loic.esteve@ymail.com> | https://github.com/scikit-learn/scikit-learn.git | def _check_interaction_cst(self, n_features):
if self.interaction_cst is None:
return None
if not (
isinstance(self.interaction_cst, Iterable)
and all(isinstance(x, Iterable) for x in self.interaction_cst)
):
raise ValueError(
... | 145 | gradient_boosting.py | Python | sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.py | 5ceb8a6a031ddff26a7ede413db1b53edb64166a | scikit-learn | 12 | |
101,331 | 11 | 9 | 4 | 45 | 7 | 0 | 11 | 43 | _flush_queues | Bugfix: convert - Gif Writer
- Fix non-launch error on Gif Writer
- convert plugins - linting
- convert/fs_media/preview/queue_manager - typing
- Change convert items from dict to Dataclass | https://github.com/deepfakes/faceswap.git | def _flush_queues(self):
for q_name in self.queues:
self.flush_queue(q_name)
logger.debug("QueueManager flushed all queues")
| 25 | queue_manager.py | Python | lib/queue_manager.py | 1022651eb8a7741014f5d2ec7cbfe882120dfa5f | faceswap | 2 | |
133,519 | 36 | 12 | 25 | 174 | 20 | 0 | 53 | 159 | fetch_latest_alerts | [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 fetch_latest_alerts(rds_data_client):
schema = GLOBAL_CONFIG["RELEASE_AWS_DB_STATE_TABLE"]
sql = f
result = rds_data_client.execute_statement(
database=GLOBAL_CONFIG["RELEASE_AWS_DB_NAME"],
secretArn=GLOBAL_CONFIG["RELEASE_AWS_DB_SECRET_ARN"],
resourceArn=GLOBAL_CONFIG["RELEASE... | 107 | alert.py | Python | release/alert.py | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | ray | 4 | |
296,838 | 23 | 11 | 8 | 82 | 12 | 1 | 24 | 62 | fake_schedule | Add initial implementation of a calendar trigger (#68674)
* Add initial implementation of calendar trigger
This is an initial implementation of a calendar trigger, that supports
triggering on calendar start time.
See architecture proposal in:
https://github.com/home-assistant/architecture/discussions/700
* ... | https://github.com/home-assistant/core.git | def fake_schedule(hass, freezer):
# Setup start time for all tests
freezer.move_to("2022-04-19 10:31:02+00:00")
schedule = FakeSchedule(hass, freezer)
with patch(
"homeassistant.components.demo.calendar.DemoCalendar.async_get_events",
new=schedule.async_get_events,
):
... | @pytest.fixture(autouse=True) | 37 | test_trigger.py | Python | tests/components/calendar/test_trigger.py | a2c74b978664b627bafc4a43b26aa2be7b15b229 | core | 1 |
262,772 | 28 | 12 | 5 | 110 | 14 | 0 | 29 | 48 | convert_binary_to_thin_arch | macOS: Remove the timeouts for codesigning/signature stripping/lipo. (#6644) | https://github.com/pyinstaller/pyinstaller.git | def convert_binary_to_thin_arch(filename, thin_arch):
cmd_args = ['lipo', '-thin', thin_arch, filename, '-output', filename]
p = subprocess.run(cmd_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
if p.returncode:
raise SystemError(f"lipo command ({cmd_args}) fai... | 58 | osx.py | Python | PyInstaller/utils/osx.py | 1cd3b73e2939052271a0bc26cf204eebee4dcd15 | pyinstaller | 2 | |
195,558 | 7 | 7 | 5 | 28 | 5 | 0 | 7 | 21 | join_hook | [FSDP] Zero 3 Optimization Support (#4903)
* zero3 init commit
* minor cleanup:
* handle mpeval
* remove fairscale dependence
* fsdp avail
* update reqs
* better reqs
* autoformat
* autofromat | https://github.com/facebookresearch/ParlAI.git | def join_hook(self, **kwargs) -> JoinHook:
return TrainLoopJoinHook(self)
| 16 | fsdp.py | Python | parlai/utils/fsdp.py | 96aa1bb7cc28bae0a7367344f91d2c517485f686 | ParlAI | 1 | |
133,959 | 2 | 6 | 4 | 13 | 2 | 0 | 2 | 5 | ray_start_client_server_for_address | [Test][Client] Only start ray once in client tests (#28835)
It looks like we're frequently starting and shutting down Ray in this test because `ray_start_client_server` isn't connecting to the Ray created by `ray_start_regular_shared`, and is instead starting a new Ray head process every time it launches.
Ray clien... | https://github.com/ray-project/ray.git | def ray_start_client_server_for_address(address):
| 20 | ray_client_helpers.py | Python | python/ray/util/client/ray_client_helpers.py | 297341e107daee1ea3aff991ae8ea8c90993c683 | ray | 1 | |
284,770 | 83 | 13 | 70 | 418 | 39 | 0 | 104 | 768 | call_cpsearch | Preferred data source for a given command and help docs for any command (#1928)
* Add a feature flag loaded from . env for preferred data source
* Update the load command to use the preferred source
* Add a test
* Black syntax checker updates
* Update test syntax
* Update load command documentation
*... | https://github.com/OpenBB-finance/OpenBBTerminal.git | def call_cpsearch(self, other_args):
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="cpsearch",
description=,
)
parser.add_argument(
"-q",
"--query",
... | 259 | discovery_controller.py | Python | openbb_terminal/cryptocurrency/discovery/discovery_controller.py | 497324d75f523f104bc98bd1e3865bf9d19eef3f | OpenBBTerminal | 4 | |
290,683 | 7 | 8 | 2 | 24 | 3 | 0 | 7 | 13 | test_normalize_url_does_not_touch_valid_url | Normalize url entered in fibaro integration setup dialog (#81996)
* Normalize url entered in fibaro integration setup dialog
* Improvements as suggested in code review
* Fix spelling in comments | https://github.com/home-assistant/core.git | async def test_normalize_url_does_not_touch_valid_url():
assert _normalize_url(TEST_URL) == TEST_URL
| 12 | test_config_flow.py | Python | tests/components/fibaro/test_config_flow.py | ff1ec7a028f747de1f96521eb3df6f98d7426434 | core | 1 | |
127,153 | 16 | 12 | 9 | 72 | 12 | 0 | 17 | 72 | get_dashboard_url | [core] Don't override external dashboard URL in internal KV store (#27901)
Fix 2.0.0 release blocker bug where Ray State API and Jobs not accessible if the override URL doesn't support adding additional subpaths. This PR keeps the localhost dashboard URL in the internal KV store and only overrides in values printed or... | https://github.com/ray-project/ray.git | def get_dashboard_url():
if ray_constants.RAY_OVERRIDE_DASHBOARD_URL in os.environ:
return _remove_protocol_from_url(
os.environ.get(ray_constants.RAY_OVERRIDE_DASHBOARD_URL)
)
else:
worker = global_worker
worker.check_connected()
return _global_node.webu... | 42 | worker.py | Python | python/ray/_private/worker.py | 4692e8d8023e789120d3f22b41ffb136b50f70ea | ray | 2 | |
127,274 | 137 | 19 | 74 | 650 | 48 | 0 | 189 | 749 | start_rayservice | [nightly] Add serve ha chaos test into nightly test. (#27413)
This PR adds a serve ha test. The flow of the tests is:
1. check the kube ray build
2. start ray service
3. warm up the cluster
4. start killing nodes
5. get the stats and make sure it's good | https://github.com/ray-project/ray.git | def start_rayservice():
# step-1: generate the yaml file
print(f"Using ray image: {ray_image}")
solution = "\n".join(
[
f" {line}"
for line in pathlib.Path("./solution.py").read_text().splitlines()
]
)
locustfile = "\n".join(
[
f" {li... | 343 | run_gcs_ft_on_k8s.py | Python | release/k8s_tests/run_gcs_ft_on_k8s.py | 4d91f516ca59abd2f4880f36e17630ad3effee11 | ray | 8 | |
278,792 | 3 | 6 | 3 | 15 | 3 | 0 | 3 | 6 | _delegate_method | Remove pylint comments.
PiperOrigin-RevId: 452353044 | https://github.com/keras-team/keras.git | def _delegate_method(keras_tensor_cls, method_name):
| 18 | tf_op_layer.py | Python | keras/layers/core/tf_op_layer.py | 3613c3defc39c236fb1592c4f7ba1a9cc887343a | keras | 1 | |
224,484 | 4 | 8 | 2 | 29 | 4 | 0 | 4 | 18 | is_css | Refactor URI handling to not have to deal with backslashes | https://github.com/mkdocs/mkdocs.git | def is_css(self):
return self.src_uri.endswith('.css')
| 15 | files.py | Python | mkdocs/structure/files.py | 1c50987f9c17b228fdf22456aa369b83bd6b11b9 | mkdocs | 1 | |
289,759 | 8 | 9 | 3 | 34 | 4 | 0 | 8 | 22 | async_uninstall_addon | Refactor zwave_js add-on manager (#80883)
* Make addon slug an instance attribute
* Extract addon name and addon config
* Update docstrings | https://github.com/home-assistant/core.git | async def async_uninstall_addon(self) -> None:
await async_uninstall_addon(self._hass, self.addon_slug)
| 19 | addon.py | Python | homeassistant/components/zwave_js/addon.py | 838691f22f27852a05313809cdf9c51094ad3798 | core | 1 | |
22,866 | 25 | 14 | 9 | 157 | 9 | 0 | 30 | 70 | print_n_speak_index | VoiceAssistant
This is Voice Assistant coded using Python which can do the following: -
1. Speak Text entered by User.
2. Search anything on Google.
3. Search anything on Wikipedia.
4. Read an MS Word(docx) document.
5. Read a book(PDF).
6. Can be used as a Dictator. | https://github.com/geekcomputers/Python.git | def print_n_speak_index(toc):
dash = "-"*(100 - 7)
space = " "*47
print(f"{space}INDEX")
print(f"\n\nName : {dash} PageNo.\n\n\n\n")
for topic in toc:
eq_dash = "-"*(100 - len(topic[1]))
print(f"{topic[1]} {eq_dash} {topic[2]}")
speak(f"{topic[1]} {topic[2]}")
... | 60 | textRead.py | Python | VoiceAssistant/Project_Basic_struct/textRead.py | 39c49e07066b2a53e176d555af6a7bf8aabb8a9c | Python | 2 | |
260,324 | 74 | 13 | 24 | 263 | 30 | 0 | 98 | 345 | fit | MAINT Use _validate_params in Power and Quantile Transformer (#23672)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> | https://github.com/scikit-learn/scikit-learn.git | def fit(self, X, y=None):
self._validate_params()
if self.n_quantiles > self.subsample:
raise ValueError(
"The number of quantiles cannot be greater than"
" the number of samples used. Got {} quantiles"
" and {} samples.".format(self.... | 164 | _data.py | Python | sklearn/preprocessing/_data.py | a63a827e6db3fcb65ea05172ee18f67e6a6a27d7 | scikit-learn | 4 | |
35,044 | 164 | 18 | 46 | 797 | 48 | 0 | 338 | 1,099 | get_position_embeds | Upgrade black to version ~=22.0 (#15565)
* Upgrade black to version ~=22.0
* Check copies
* Fix code | https://github.com/huggingface/transformers.git | def get_position_embeds(self, seq_len, dtype, device):
d_model = self.config.d_model
if self.config.attention_type == "factorized":
# Notations from the paper, appending A.2.2, final formula.
# We need to create and return the matrices phi, psi, pi and omega.
... | 498 | modeling_funnel.py | Python | src/transformers/models/funnel/modeling_funnel.py | 7732d0fe7a759c9844215920e9f1c5540eafb1a6 | transformers | 4 | |
266,444 | 8 | 12 | 2 | 44 | 6 | 0 | 8 | 14 | ansible_concat | Attach concat func to an environment class (#76282)
* Attach concat func to an environment class
ci_complete
* clog and docstrings | https://github.com/ansible/ansible.git | def ansible_concat(nodes):
return ''.join([to_text(_fail_on_undefined(v)) for v in nodes])
| 25 | native_helpers.py | Python | lib/ansible/template/native_helpers.py | 8febd37f325b049afe448af689064ee019d1099c | ansible | 2 | |
178,662 | 110 | 12 | 45 | 428 | 37 | 0 | 159 | 485 | queryRuntimeInformationMultiple | Plugins: Add DLL specific plugin with configuration
* As a first one, this solves the shapely DLL issue with using the new
configuration.
* Existing codes should be migrated to this with time. | https://github.com/Nuitka/Nuitka.git | def queryRuntimeInformationMultiple(self, info_name, setup_codes, values):
info_name = self.plugin_name.replace("-", "_") + "_" + info_name
if info_name in self._runtime_information_cache:
return self._runtime_information_cache[info_name]
keys = []
query_codes = []
... | 253 | PluginBase.py | Python | nuitka/plugins/PluginBase.py | e7e31cbdb430a1b5f9ec4e186f10a9e60908a4e9 | Nuitka | 12 | |
271,565 | 22 | 12 | 11 | 116 | 10 | 0 | 33 | 94 | flatten_metrics_in_order | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def flatten_metrics_in_order(logs, metrics_names):
results = []
for name in metrics_names:
if name in logs:
results.append(logs[name])
for key in sorted(logs.keys()):
if key not in metrics_names:
results.append(logs[key])
if len(results) == 1:
return ... | 73 | training.py | Python | keras/engine/training.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 6 | |
177,502 | 29 | 13 | 8 | 106 | 11 | 0 | 39 | 79 | multi_source_dijkstra_path_length | Hide edges with a weight of None in A*. (#5945)
* Hide edges with a weight of None in A*.
This matches the Dijkstra's weight interface.
* Update Dijkstra's and A* docs for weights of None.
* Add tests for A* with weight of None.
* Add another test for A* with a weight function.
* Document that None indi... | https://github.com/networkx/networkx.git | def multi_source_dijkstra_path_length(G, sources, cutoff=None, weight="weight"):
if not sources:
raise ValueError("sources must not be empty")
for s in sources:
if s not in G:
raise nx.NodeNotFound(f"Node {s} not found in graph")
weight = _weight_function(G, weight)
retu... | 65 | weighted.py | Python | networkx/algorithms/shortest_paths/weighted.py | d82815dba6c8ddce19cd49f700298dc82a58f066 | networkx | 4 | |
100,313 | 79 | 18 | 26 | 425 | 23 | 0 | 107 | 447 | _get_per_session_stats | Update code to support Tensorflow versions up to 2.8 (#1213)
* Update maximum tf version in setup + requirements
* - bump max version of tf version in launcher
- standardise tf version check
* update keras get_custom_objects for tf>2.6
* bugfix: force black text in GUI file dialogs (linux)
* dssim loss -... | https://github.com/deepfakes/faceswap.git | def _get_per_session_stats(self):
if self._per_session_stats is None:
logger.debug("Collating per session stats")
compiled = []
for session_id, ts_data in self._time_stats.items():
logger.debug("Compiling session ID: %s", session_id)
i... | 249 | stats.py | Python | lib/gui/analysis/stats.py | c1512fd41d86ef47a5d1ce618d6d755ef7cbacdf | faceswap | 7 | |
113,522 | 6 | 10 | 3 | 32 | 5 | 0 | 6 | 20 | next_label | Mutable V3 (Stage 1) - Label namespace and utilities (#5194) | https://github.com/microsoft/nni.git | def next_label(self) -> str:
return str(uid(self.absolute_scope))
| 18 | utils.py | Python | nni/mutable/utils.py | 6641d309ac6e98c69295ac3d59bf7fa23bdb6588 | nni | 1 | |
126,266 | 17 | 12 | 9 | 87 | 13 | 1 | 21 | 59 | _detect_config_single | [air] Add annotation for Tune module. (#27060)
Co-authored-by: Kai Fricke <kai@anyscale.com> | https://github.com/ray-project/ray.git | def _detect_config_single(func):
func_sig = inspect.signature(func)
use_config_single = True
try:
func_sig.bind({})
except Exception as e:
logger.debug(str(e))
use_config_single = False
return use_config_single
@PublicAPI() | @PublicAPI() | 45 | util.py | Python | python/ray/tune/utils/util.py | eb69c1ca286a2eec594f02ddaf546657a8127afd | ray | 2 |
245,439 | 44 | 14 | 22 | 323 | 30 | 0 | 62 | 272 | run | [Feature] Support TeacherStudentValLoop (#8503)
* Support MultiValLoop
* Rename as TeacherStudentVaLloop | https://github.com/open-mmlab/mmdetection.git | def run(self):
self.runner.call_hook('before_val')
self.runner.call_hook('before_val_epoch')
self.runner.model.eval()
model = self.runner.model
if is_model_wrapper(model):
model = model.module
assert hasattr(model, 'teacher')
assert hasattr(m... | 191 | loops.py | Python | mmdet/engine/runner/loops.py | 4886ac46ee1e18fe5b0fc3fd5fe3a24dd5a5743f | mmdetection | 5 | |
86,309 | 21 | 12 | 10 | 121 | 22 | 0 | 21 | 131 | test_user_rate_reached_perf_issues | ref(perf issues): Enable ignore in a time period (#39120)
Enable ignoring a performance issue in a time period e.g. ignore this
until it happens 10x / hr or ignore until 10 users experience it in an
hour. | https://github.com/getsentry/sentry.git | def test_user_rate_reached_perf_issues(self):
snooze = GroupSnooze.objects.create(group=self.perf_group, user_count=10, user_window=60)
for i in range(0, 10):
self.store_transaction(
environment=None,
project_id=self.project.id,
user_... | 80 | test_groupsnooze.py | Python | tests/sentry/models/test_groupsnooze.py | d745edbd591063f2c3241cd1960c361834058823 | sentry | 2 | |
187,373 | 56 | 13 | 24 | 316 | 28 | 0 | 73 | 225 | log_current_versions | cli: list all dependencies in debug output
- Require importlib-metadata as fallback on Python < 3.8
- Add importlib_metadata to streamlink_cli.compat
- List all dependencies in `log_current_versions`
- Update tests | https://github.com/streamlink/streamlink.git | def log_current_versions():
if not logger.root.isEnabledFor(logging.DEBUG):
return
# macOS
if sys.platform == "darwin":
os_version = f"macOS {platform.mac_ver()[0]}"
# Windows
elif sys.platform == "win32":
os_version = f"{platform.system()} {platform.release()}"
# L... | 146 | main.py | Python | src/streamlink_cli/main.py | c319aa445e7577134d61da587c6338730b82a4c8 | streamlink | 8 | |
82,383 | 12 | 10 | 3 | 51 | 7 | 0 | 12 | 33 | get_instance_icon_alt | 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 get_instance_icon_alt(self):
instance, plugin = self.get_plugin_instance()
return force_str(plugin.icon_alt(instance)) if instance else ''
| 29 | pluginmodel.py | Python | cms/models/pluginmodel.py | c1290c9ff89cb00caa5469129fd527e9d82cd820 | django-cms | 2 | |
153,982 | 22 | 10 | 5 | 95 | 14 | 0 | 25 | 64 | _multiindex_possibly_contains_key | FIX-#4358: MultiIndex `loc` shouldn't drop levels for full-key lookups (#4608)
Signed-off-by: Karthik Velayutham <vkarthik@ponder.io> | https://github.com/modin-project/modin.git | def _multiindex_possibly_contains_key(self, axis, key):
if not self.qc.has_multiindex(axis=axis):
return False
multiindex = self.df.index if axis == 0 else self.df.columns
return isinstance(key, tuple) and len(key) == len(multiindex.levels)
| 61 | indexing.py | Python | modin/pandas/indexing.py | da7bd1a14752895a38342b2faa3220a8db4cb7ff | modin | 4 | |
277,193 | 19 | 13 | 7 | 109 | 12 | 0 | 23 | 80 | predict | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def predict(self, x, **kwargs):
proba = self.model.predict(x, **kwargs)
if proba.shape[-1] > 1:
classes = proba.argmax(axis=-1)
else:
classes = (proba > 0.5).astype("int32")
return self.classes_[classes]
| 69 | scikit_learn.py | Python | keras/wrappers/scikit_learn.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 2 | |
166,206 | 6 | 7 | 5 | 25 | 4 | 0 | 6 | 20 | size | ENH: Implement DataFrame interchange protocol (#46141) | https://github.com/pandas-dev/pandas.git | def size(self) -> int:
return self._col.size
| 14 | column.py | Python | pandas/core/exchange/column.py | 90140f055892a46f473bd26affab88a7f171e394 | pandas | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.