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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
259,478 | 60 | 10 | 20 | 271 | 27 | 0 | 93 | 270 | plot | 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 plot(self, plot_method="contourf", ax=None, xlabel=None, ylabel=None, **kwargs):
check_matplotlib_support("DecisionBoundaryDisplay.plot")
import matplotlib.pyplot as plt # noqa
if plot_method not in ("contourf", "contour", "pcolormesh"):
raise ValueError(
... | 169 | decision_boundary.py | Python | sklearn/inspection/_plot/decision_boundary.py | d400723a2112f15c5d5b4d40dfac2ed8a19cca5c | scikit-learn | 9 | |
299,567 | 6 | 6 | 3 | 22 | 4 | 0 | 6 | 20 | name | Add application credentials platform (#69148)
* Initial developer credentials scaffolding
- Support websocket list/add/delete
- Add developer credentials protocol from yaml config
- Handle OAuth credential registration and de-registration
- Tests for websocket and integration based registration
* Fix pydoc text... | https://github.com/home-assistant/core.git | def name(self) -> str:
return self.client_id
| 12 | __init__.py | Python | homeassistant/components/application_credentials/__init__.py | 00b5d30e24dccebcc61839be7cf6ca9d87b2a3de | core | 1 | |
300,691 | 9 | 8 | 3 | 45 | 6 | 0 | 9 | 18 | test_timestamp_to_utc | Sync event timed_fired and the context ulid time (#71854) | https://github.com/home-assistant/core.git | def test_timestamp_to_utc():
utc_now = dt_util.utcnow()
assert dt_util.utc_to_timestamp(utc_now) == utc_now.timestamp()
| 25 | test_dt.py | Python | tests/util/test_dt.py | ebce5660e3f80ceb95c21d8fe231f792ad0dfd7f | core | 1 | |
93,712 | 29 | 13 | 13 | 167 | 20 | 0 | 31 | 178 | request_hook | ref(Jira): Split Jira Cloud and Jira Server (#37034)
* Split Jira Cloud and Jira Server | https://github.com/getsentry/sentry.git | def request_hook(self, method, path, data, params, **kwargs):
if "auth" not in kwargs:
kwargs["auth"] = OAuth1(
client_key=self.credentials["consumer_key"],
rsa_key=self.credentials["private_key"],
resource_owner_key=self.credentials["access_t... | 107 | client.py | Python | src/sentry/integrations/jira_server/client.py | 2fbf550ec05c8501cbc9eca62e73526e717dcbdf | sentry | 2 | |
64,175 | 16 | 9 | 6 | 77 | 9 | 0 | 19 | 13 | update_product_bundle_rate | refactor: Price fetching and updation logic
- fetch price from price list, use item master valuation rate as fallback fo0r packed item
- use a item code, item row name map to maintain cumulative price
- reset table if item in a row is replaced
- loop over items table only to set price, lesser iterations than packed it... | https://github.com/frappe/erpnext.git | def update_product_bundle_rate(parent_items_price, pi_row):
key = (pi_row.parent_item, pi_row.parent_detail_docname)
rate = parent_items_price.get(key)
if not rate:
parent_items_price[key] = 0.0
parent_items_price[key] += flt(pi_row.rate)
| 50 | packed_item.py | Python | erpnext/stock/doctype/packed_item/packed_item.py | 2f4d266ee132e34d81034321f47a0aca96ee1774 | erpnext | 2 | |
19,508 | 22 | 11 | 6 | 96 | 14 | 0 | 22 | 48 | download_file | 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 download_file(url, filename, max_retries=1):
r = _get_requests_session(max_retries).get(url, stream=True)
if not r.ok:
raise OSError("Unable to download file")
with open(filename, "wb") as f:
f.write(r.content)
| 56 | internet.py | Python | pipenv/utils/internet.py | 3387881a6d4fc2d8bdc0f05c484cb2f7222acfb8 | pipenv | 2 | |
269,992 | 21 | 14 | 11 | 81 | 11 | 0 | 24 | 177 | _check_counts | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def _check_counts(self, counter, expected_counts):
for method_name, expected_count in expected_counts.items():
self.assertEqual(
counter.method_counts[method_name],
expected_count,
msg="For method {}: expected {}, got: {}".format(
... | 54 | callbacks_test.py | Python | keras/callbacks_test.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 2 | |
130,577 | 14 | 8 | 22 | 58 | 11 | 0 | 14 | 42 | to_modin | [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 to_modin(self) -> "modin.DataFrame":
from modin.distributed.dataframe.pandas.partitions import from_partitions
pd_objs = self.to_pandas_refs()
return from_partitions(pd_objs, axis=0)
| 36 | dataset.py | Python | python/ray/data/dataset.py | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | ray | 1 | |
178,942 | 31 | 10 | 19 | 112 | 16 | 0 | 32 | 156 | addMacOSCodeSignature | macOS: Add support for specifying signing identity and access to protected resources. | https://github.com/Nuitka/Nuitka.git | def addMacOSCodeSignature(filenames):
# Weak signing.
identity = getMacOSSigningIdentity()
command = [
"codesign",
"-s",
identity,
"--force",
"--deep",
"--preserve-metadata=entitlements",
]
assert type(filenames) is not str
command.extend(f... | 66 | Signing.py | Python | nuitka/utils/Signing.py | 51ca460bd8c382cc165cbb1325e7cb65895d1a0b | Nuitka | 1 | |
156,127 | 26 | 18 | 15 | 139 | 14 | 0 | 36 | 173 | functions_of | absolufy-imports - No relative - PEP8 (#8796)
Conversation in https://github.com/dask/distributed/issues/5889 | https://github.com/dask/dask.git | def functions_of(task):
funcs = set()
work = [task]
sequence_types = {list, tuple}
while work:
new_work = []
for task in work:
if type(task) in sequence_types:
if istask(task):
funcs.add(unwrap_partial(task[0]))
n... | 84 | optimization.py | Python | dask/optimization.py | cccb9d8d8e33a891396b1275c2448c352ef40c27 | dask | 5 | |
215,072 | 38 | 18 | 24 | 286 | 29 | 1 | 50 | 265 | test_minion_module_refresh_beacons_refresh | Fix test cases with PermissionError on /var/cache/salt
When running the test cases without root permission, some test cases fail:
```
$ python3 -m pytest -ra tests/pytests/unit/state/test_state_compiler.py tests/pytests/unit/test_minion.py
[...]
FAILED tests/pytests/unit/state/test_state_compiler.py::test_render_requ... | https://github.com/saltstack/salt.git | def test_minion_module_refresh_beacons_refresh(tmp_path):
with patch("salt.minion.Minion.ctx", MagicMock(return_value={})), patch(
"salt.utils.process.SignalHandlingProcess.start",
MagicMock(return_value=True),
), patch(
"salt.utils.process.SignalHandlingProcess.join",
Magic... | @pytest.mark.slow_test | 164 | test_minion.py | Python | tests/pytests/unit/test_minion.py | fae21e4698d9bb45a407345e7dff5ce3b69f799d | salt | 2 |
125,024 | 6 | 7 | 3 | 23 | 4 | 0 | 6 | 20 | has_batch | [Datasets] [Local Shuffle - 1/N] Add local shuffling option. (#26094)
Co-authored-by: Eric Liang <ekhliang@gmail.com>
Co-authored-by: matthewdeng <matthew.j.deng@gmail.com>
Co-authored-by: Matthew Deng <matt@anyscale.com>
Co-authored-by: Richard Liaw <rliaw@berkeley.edu> | https://github.com/ray-project/ray.git | def has_batch(self) -> bool:
raise NotImplementedError()
| 12 | batcher.py | Python | python/ray/data/_internal/batcher.py | 864af14f410ab12c7553332dd3a62e716f24a667 | ray | 1 | |
300,189 | 21 | 12 | 12 | 78 | 15 | 0 | 25 | 89 | test_supported_features | Add ws66i core integration (#56094)
* Add ws66i core integration
* Remove all ws66i translations
* Update ws66i unit tests to meet minimum code coverage
* Update ws66i based on @bdraco review
* General improvements after 2nd PR review
* Disable entities if amp shutoff, set default source names, set 30se... | https://github.com/home-assistant/core.git | async def test_supported_features(hass):
await _setup_ws66i(hass, MockWs66i())
state = hass.states.get(ZONE_1_ID)
assert (
SUPPORT_VOLUME_MUTE
| SUPPORT_VOLUME_SET
| SUPPORT_VOLUME_STEP
| SUPPORT_TURN_ON
| SUPPORT_TURN_OFF
| SUPPORT_SELECT_SOURCE
... | 46 | test_media_player.py | Python | tests/components/ws66i/test_media_player.py | 5e737bfe4fbc5a724f5fdf04ea9319c2224cb114 | core | 1 | |
276,189 | 25 | 9 | 8 | 122 | 16 | 0 | 26 | 89 | test_trainable_custom_model_false | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def test_trainable_custom_model_false(self):
# Set all layers to *not* be trainable.
model = test_utils.SmallSubclassMLP(1, 4, trainable=False)
model.compile(loss="mse", optimizer="rmsprop")
self._train_model(model, use_dataset=False)
loaded = self._save_and_load(model)
... | 74 | saved_model_test.py | Python | keras/saving/saved_model/saved_model_test.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 1 | |
249,238 | 17 | 10 | 15 | 93 | 13 | 0 | 18 | 126 | test_requester_is_no_admin | Use literals in place of `HTTPStatus` constants in tests (#13479)
Replace
- `HTTPStatus.NOT_FOUND`
- `HTTPStatus.FORBIDDEN`
- `HTTPStatus.UNAUTHORIZED`
- `HTTPStatus.CONFLICT`
- `HTTPStatus.CREATED`
Signed-off-by: Dirk Klimpel <dirk@klimpel.org> | https://github.com/matrix-org/synapse.git | def test_requester_is_no_admin(self) -> None:
channel = self.make_request(
"GET",
self.url,
access_token=self.other_user_tok,
)
self.assertEqual(
403,
channel.code,
msg=channel.json_body,
)
self.as... | 59 | test_event_reports.py | Python | tests/rest/admin/test_event_reports.py | 1595052b2681fb86c1c1b9a6028c1bc0d38a2e4b | synapse | 1 | |
256,253 | 134 | 15 | 45 | 548 | 46 | 0 | 195 | 628 | tokenize_batch_question_answering | 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 tokenize_batch_question_answering(pre_baskets, tokenizer, indices):
assert len(indices) == len(pre_baskets)
assert tokenizer.is_fast, (
"Processing QA data is only supported with fast tokenizers for now.\n"
"Please load Tokenizers with 'use_fast=True' option."
)
baskets = []
... | 331 | tokenization.py | Python | haystack/modeling/model/tokenization.py | a59bca366174d9c692fa19750c24d65f47660ef7 | haystack | 8 | |
81,351 | 22 | 13 | 10 | 102 | 17 | 0 | 27 | 69 | test_activity_stream_related | Optimize object creation by getting fewer empty relationships (#12508)
This optimizes the ActivityStreamSerializer by only getting many-to-many
relationships that are speculatively non-empty
based on information we have in other fields
We run this every time we create an object as an on_commit action
so it... | https://github.com/ansible/awx.git | def test_activity_stream_related():
serializer_related = set(
ActivityStream._meta.get_field(field_name).related_model
for field_name, stuff in ActivityStreamSerializer()._local_summarizable_fk_fields(None)
if hasattr(ActivityStream, field_name)
)
models = set(activity_stream_r... | 62 | test_activity_stream_serializer.py | Python | awx/main/tests/unit/api/serializers/test_activity_stream_serializer.py | 2d310dc4e50c6f7cd298f9fb8af69da258cd9ea6 | awx | 3 | |
168,320 | 36 | 13 | 11 | 92 | 8 | 0 | 41 | 153 | _validate_scalar | ENH: Make categories setitem error more readable (#48087) | https://github.com/pandas-dev/pandas.git | def _validate_scalar(self, fill_value):
if is_valid_na_for_dtype(fill_value, self.categories.dtype):
fill_value = -1
elif fill_value in self.categories:
fill_value = self._unbox_scalar(fill_value)
else:
raise TypeError(
"Cannot setite... | 52 | categorical.py | Python | pandas/core/arrays/categorical.py | 06dd5dab93ff4a55377309c0315aa767fdf9937e | pandas | 3 | |
153,056 | 26 | 10 | 6 | 105 | 16 | 0 | 30 | 79 | reduce | REFACTOR-#2656: Update modin to fit algebra (code only) (#3717)
Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru>
Co-authored-by: Vasily Litvinov <vasilij.n.litvinov@intel.com>
Co-authored-by: Alexey Prutskov <alexey.prutskov@intel.com>
Co-authored-by: Devin Petersohn <devin-petersohn@users.noreply.github.com... | https://github.com/modin-project/modin.git | def reduce(self, func):
keys = [partition.get_key() for partition in self.partitions]
gpu = self.partitions[0].get_gpu_manager()
# FIXME: Method `gpu_manager.reduce_key_list` does not exist.
key = gpu.reduce_key_list.remote(keys, func)
key = ray.get(key)
return ... | 66 | axis_partition.py | Python | modin/core/execution/ray/implementations/cudf_on_ray/partitioning/axis_partition.py | 58bbcc37477866d19c8b092a0e1974a4f0baa586 | modin | 2 | |
20,189 | 6 | 6 | 3 | 22 | 4 | 0 | 6 | 20 | site_config_dir | 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 site_config_dir(self) -> str:
return self.user_config_dir
| 12 | android.py | Python | pipenv/patched/notpip/_vendor/platformdirs/android.py | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | pipenv | 1 | |
249,299 | 10 | 10 | 17 | 39 | 5 | 0 | 10 | 31 | test_trace_decorator_async | Allow use of both `@trace` and `@tag_args` stacked on the same function (#13453)
```py
@trace
@tag_args
async def get_oldest_event_ids_with_depth_in_room(...)
...
```
Before this PR, you would see a warning in the logs and the span was not exported:
```
2022-08-03 19:11:59,383 - synapse.logging.opentracing... | https://github.com/matrix-org/synapse.git | def test_trace_decorator_async(self) -> None:
reactor = MemoryReactorClock()
with LoggingContext("root context"):
| 94 | test_opentracing.py | Python | tests/logging/test_opentracing.py | 1b09b0832ed56bfc994deadb3315755d0c20433b | synapse | 2 | |
189,494 | 99 | 18 | 52 | 612 | 38 | 0 | 182 | 888 | _text2settings | Hide more private methods from the docs. (#2468)
* hide privs from text_mobject.py
* hide privs from tex_mobject.py
* hide privs from code_mobject.py
* hide privs from svg_mobject.py
* remove SVGPath and utils from __init__.py
* don't import string_to_numbers
* hide privs from geometry.py
* hide p... | https://github.com/ManimCommunity/manim.git | def _text2settings(self):
t2xs = [
(self.t2f, "font"),
(self.t2s, "slant"),
(self.t2w, "weight"),
(self.t2c, "color"),
]
setting_args = {arg: getattr(self, arg) for _, arg in t2xs}
settings = self._get_settings_from_t2xs(t2xs)
... | 389 | text_mobject.py | Python | manim/mobject/svg/text_mobject.py | 902e7eb4f0147b5882a613b67467e38a1d47f01e | manim | 17 | |
212,626 | 60 | 13 | 23 | 312 | 36 | 0 | 104 | 401 | update | Docstring changes for all Element.update methods to indicate that the change will not be visible until Window.refresh or Window.read is called | https://github.com/PySimpleGUI/PySimpleGUI.git | def update(self, current_count=None, max=None, bar_color=None, visible=None):
if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow
return False
if self.ParentForm.TKrootDestroyed:
return False
if visible is False:
... | 182 | PySimpleGUI.py | Python | PySimpleGUI.py | 9c80a060e2463bcf4534d388f48003b538deb64b | PySimpleGUI | 9 | |
112,868 | 16 | 10 | 5 | 80 | 11 | 0 | 18 | 53 | _earlystop_notify_tuner | Support multiple HPO experiments in one process (#4855) | https://github.com/microsoft/nni.git | def _earlystop_notify_tuner(self, data):
_logger.debug('Early stop notify tuner data: [%s]', data)
data['type'] = MetricType.FINAL
data['value'] = dump(data['value'])
self.enqueue_command(CommandType.ReportMetricData, data)
| 46 | msg_dispatcher.py | Python | nni/runtime/msg_dispatcher.py | 98c1a77f61900d486f46d284c49fb65675dbee6a | nni | 1 | |
258,603 | 21 | 11 | 9 | 104 | 16 | 0 | 25 | 56 | test_feature_agglomeration_feature_names_out | ENH Adds get_feature_names to cluster module (#22255) | https://github.com/scikit-learn/scikit-learn.git | def test_feature_agglomeration_feature_names_out():
X, _ = make_blobs(n_features=6, random_state=0)
agglo = FeatureAgglomeration(n_clusters=3)
agglo.fit(X)
n_clusters = agglo.n_clusters_
names_out = agglo.get_feature_names_out()
assert_array_equal(
[f"featureagglomeration{i}" for i... | 61 | test_feature_agglomeration.py | Python | sklearn/cluster/tests/test_feature_agglomeration.py | 5219b6f479d79bf201ccbc6210607d6190ebbed4 | scikit-learn | 2 | |
154,139 | 70 | 16 | 23 | 273 | 16 | 0 | 147 | 518 | _validate_axes_lengths | FEAT-#4725: Make index and columns lazy in Modin DataFrame (#4726)
Co-authored-by: Mahesh Vashishtha <mvashishtha@users.noreply.github.com>
Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru>
Signed-off-by: Vasily Litvinov <fam1ly.n4me@yandex.ru> | https://github.com/modin-project/modin.git | def _validate_axes_lengths(self):
if self._row_lengths_cache is not None and len(self.index) > 0:
# An empty frame can have 0 rows but a nonempty index. If the frame
# does have rows, the number of rows must equal the size of the
# index.
num_rows = sum(s... | 142 | dataframe.py | Python | modin/core/dataframe/pandas/dataframe/dataframe.py | adb16a17f721048005520388080627975c6852d8 | modin | 9 | |
42,592 | 9 | 17 | 3 | 81 | 9 | 0 | 9 | 34 | load_wiki_q | Support both iso639-3 codes and BCP-47 language tags (#3060)
* Add support for iso639-3 language codes
* Add support for retired language codes
* Move langnames.py to the top-level
* Add langcode() function
* Add iso639retired dictionary
* Improve wrapper functions
* Add module docstring with doctest... | https://github.com/nltk/nltk.git | def load_wiki_q(self):
with self.open("cldr/tools-cldr-rdf-external-entityToCode.tsv") as fp:
self.wiki_q = self.wiki_dict(fp.read().strip().split("\n")[1:])
| 43 | bcp47.py | Python | nltk/corpus/reader/bcp47.py | f019fbedb3d2b6a2e6b58ec1b38db612b106568b | nltk | 1 | |
168,252 | 12 | 12 | 13 | 69 | 13 | 0 | 12 | 73 | _start | PERF cache find_stack_level (#48023)
cache stacklevel | https://github.com/pandas-dev/pandas.git | def _start(self) -> int:
warnings.warn(
self._deprecation_message.format("_start", "start"),
FutureWarning,
stacklevel=find_stack_level(inspect.currentframe()),
)
return self.start
| 41 | range.py | Python | pandas/core/indexes/range.py | 2f8d0a36703e81e4dca52ca9fe4f58c910c1b304 | pandas | 1 | |
168,718 | 7 | 10 | 32 | 34 | 7 | 0 | 7 | 13 | is_float_dtype | DOC: Remove mention that is_float_dtype is private (#48156) | https://github.com/pandas-dev/pandas.git | def is_float_dtype(arr_or_dtype) -> bool:
return _is_dtype_type(arr_or_dtype, classes(np.floating))
| 20 | common.py | Python | pandas/core/dtypes/common.py | 6d458eefdf9ae17dceff39471853e4af136ab495 | pandas | 1 | |
215,754 | 61 | 13 | 31 | 359 | 15 | 0 | 104 | 277 | acl_create | [merge jam] Master port 49261 - consul modules (#58101)
* add consul states and acl function present/absent
* add consul to states doc index
* refact/fix consul states
* fix doc, fix states
* fix name parameter for acl_changes
* fixing pylint errors
* small changes after review by @rallytime
* fix... | https://github.com/saltstack/salt.git | def acl_create(consul_url=None, token=None, **kwargs):
ret = {}
data = {}
if not consul_url:
consul_url = _get_config()
if not consul_url:
log.error("No Consul URL found.")
ret["message"] = "No Consul URL found."
ret["res"] = False
return ... | 196 | consul.py | Python | salt/modules/consul.py | fb825aa760fa0585a2c8fdafc6e62be8aec8cecf | salt | 8 | |
265,491 | 8 | 8 | 4 | 40 | 4 | 0 | 9 | 41 | destinations | Fixes #9778: Fix exception during cable deletion after deleting a connected termination | https://github.com/netbox-community/netbox.git | def destinations(self):
if not self.is_complete:
return []
return self.path_objects[-1]
| 23 | cables.py | Python | netbox/dcim/models/cables.py | 367bf25618d1be55c10b7e707101f2759711e855 | netbox | 2 | |
323,170 | 11 | 10 | 5 | 43 | 5 | 0 | 12 | 35 | total_processes_number | [Trainer] Add init version of paddlenlp trainer and apply finetune for ernie-1.0 pretraining. (#1761)
* add some datasets for finetune.
* support fine tune for all tastks.
* add trainer prototype.
* init verison for paddlenlp trainer.
* refine trainer.
* update for some details.
* support multi-card... | https://github.com/PaddlePaddle/PaddleNLP.git | def total_processes_number(local_rank):
if local_rank != -1:
import paddle
return paddle.distributed.get_world_size()
return 1
| 24 | trainer_utils.py | Python | paddlenlp/trainer/trainer_utils.py | 44a290e94d1becd1f09fddc3d873f9e19c9d6919 | PaddleNLP | 2 | |
159,359 | 6 | 6 | 3 | 26 | 5 | 0 | 6 | 20 | required_components | Add Logistic Regression to our NLU classifiers. (#10650)
* added-logistic-regression
* added
* d0h! gotta copy the imports correctly
* run black
* black issues fixed
* stash
* added tolerance hyperparam
* added random seed
* fixed testing path
* ran black
* use joblib directly
* insura... | https://github.com/RasaHQ/rasa.git | def required_components(cls) -> List[Type]:
return [Featurizer]
| 15 | logistic_regression_classifier.py | Python | rasa/nlu/classifiers/logistic_regression_classifier.py | dc762814317ce46873a5226ee09033031a7d3604 | rasa | 1 | |
247,527 | 41 | 13 | 27 | 254 | 23 | 0 | 48 | 241 | test_blacklisted_ip_range_whitelisted_ip | Add type hints to `tests/rest`. (#12208)
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> | https://github.com/matrix-org/synapse.git | def test_blacklisted_ip_range_whitelisted_ip(self) -> None:
self.lookups["example.com"] = [(IPv4Address, "1.1.1.1")]
channel = self.make_request(
"GET",
"preview_url?url=http://example.com",
shorthand=False,
await_result=False,
)
... | 149 | test_url_preview.py | Python | tests/rest/media/v1/test_url_preview.py | 32c828d0f760492711a98b11376e229d795fd1b3 | synapse | 1 | |
268,038 | 13 | 12 | 4 | 87 | 15 | 1 | 13 | 33 | serialize | 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 serialize(self) -> t.Tuple[str, t.Dict[str, t.Any]]:
name = type(self).__name__[3:].lower()
return name, self.__dict__
@dataclasses.dataclass(frozen=True) | @dataclasses.dataclass(frozen=True) | 46 | python_requirements.py | Python | test/lib/ansible_test/_internal/python_requirements.py | 3eb0485dd92c88cc92152d3656d94492db44b183 | ansible | 1 |
180,946 | 5 | 6 | 2 | 18 | 3 | 0 | 5 | 19 | postprocess | Add docs to blocks context postprocessing function (#2332)
Co-authored-by: Ian Gonzalez <ian.gl@protonmail.com> | https://github.com/gradio-app/gradio.git | def postprocess(self, y):
return y
| 10 | blocks.py | Python | gradio/blocks.py | 027bbc0180051076c266bcc43c79918c74e922f4 | gradio | 1 | |
269,085 | 28 | 14 | 13 | 120 | 15 | 0 | 38 | 71 | _serialize_function_to_config | Refactor RNN classes such that V2 cells and layers no longer depend on V1 counterparts.
V2 GRU and LSTM cells no longer extend their V1 counterpart; instead the inheritance is the other way around.
V2 GRU and LSTM layers no longer extend their V1 counterpart; instead the common code was duplicated.
V2 cell wrappers an... | https://github.com/keras-team/keras.git | def _serialize_function_to_config(function):
if isinstance(function, python_types.LambdaType):
output = generic_utils.func_dump(function)
output_type = "lambda"
module = function.__module__
elif callable(function):
output = function.__name__
output_type = "function"
module = function.__mo... | 65 | cell_wrappers.py | Python | keras/layers/rnn/cell_wrappers.py | 62aab556c6252e54b9f3ee3fa65243aecd6aea52 | keras | 3 | |
153,974 | 9 | 9 | 2 | 40 | 7 | 0 | 9 | 23 | wait_partitions | FIX-#4491: Wait for all partitions in parallel in benchmark mode (#4656)
* FIX-#4491: Wait for all partitions in parallel in benchmark mode
Signed-off-by: Jonathan Shi <jhshi@ponder.io> | https://github.com/modin-project/modin.git | def wait_partitions(cls, partitions):
wait([partition._data for partition in partitions], return_when="ALL_COMPLETED")
| 24 | partition_manager.py | Python | modin/core/execution/dask/implementations/pandas_on_dask/partitioning/partition_manager.py | 7a36071c0b00e0392615a0dd9d5c2ddd5f7c0d27 | modin | 2 | |
155,409 | 7 | 8 | 10 | 29 | 5 | 0 | 7 | 13 | q1_sql | FEAT-#5223: Execute SQL queries on the HDK backend (#5224)
Signed-off-by: Andrey Pavlenko <andrey.a.pavlenko@gmail.com> | https://github.com/modin-project/modin.git | def q1_sql(df):
sql =
return query(sql, trips=df)
| 17 | nyc-taxi-hdk.py | Python | examples/docker/modin-hdk/nyc-taxi-hdk.py | 26e10c2ccc0eb670e61e32f08eacb61ca8414f95 | modin | 1 | |
138,348 | 36 | 11 | 21 | 103 | 13 | 0 | 42 | 198 | _get_all_child_nodes | [Serve] Address incremental memory leak due to _PyObjScanner (#31317) | https://github.com/ray-project/ray.git | def _get_all_child_nodes(self) -> List["DAGNode"]:
scanner = _PyObjScanner()
# we use List instead of Set here, reason explained
# in `_get_toplevel_child_nodes`.
children = []
for n in scanner.find_nodes(
[
self._bound_args,
... | 62 | dag_node.py | Python | python/ray/dag/dag_node.py | 01b19bafb224ddd2b7cc3aef557274ffb38c9c42 | ray | 3 | |
247,309 | 9 | 11 | 4 | 69 | 4 | 0 | 10 | 31 | test_bad_alias | Add type hints to `tests/rest/client` (#12108)
* Add type hints to `tests/rest/client`
* newsfile
* fix imports
* add `test_account.py`
* Remove one type hint in `test_report_event.py`
* change `on_create_room` to `async`
* update new functions in `test_third_party_rules.py`
* Add `test_filter.py`... | https://github.com/matrix-org/synapse.git | def test_bad_alias(self) -> None:
self._set_canonical_alias({"alias": "@unknown:test"}, expected_code=400)
self._set_canonical_alias({"alt_aliases": ["@unknown:test"]}, expected_code=400)
| 38 | test_rooms.py | Python | tests/rest/client/test_rooms.py | 2ffaf30803f93273a4d8a65c9e6c3110c8433488 | synapse | 1 | |
209,482 | 65 | 20 | 27 | 384 | 32 | 0 | 107 | 431 | command | Kerberos: documentation + various fixes + demo (#3693)
* MS-PAC, more key usage numbers
* Properly document Kerberos
* Fix command() for lists
* More doc, examples, Kerberos AS client
* Python 2.7 fix
* Add great schema | https://github.com/secdev/scapy.git | def command(self):
# type: () -> str
f = []
for fn, fv in six.iteritems(self.fields):
fld = self.get_field(fn)
if isinstance(fv, (list, dict, set)) and len(fv) == 0:
continue
if isinstance(fv, Packet):
fv = fv.command()... | 233 | packet.py | Python | scapy/packet.py | 5a527a90ab3928e86497cd9ab0e5779159cf1244 | scapy | 14 | |
266,496 | 9 | 6 | 2 | 17 | 2 | 0 | 9 | 24 | is_content_root | ansible-test - Improve help for unsupported cwd. (#76866)
* ansible-test - Improve help for unsupported cwd.
* The `--help` option is now available when an unsupported cwd is in use.
* The `--help` output now shows the same instructions about cwd as would be shown in error messages if the cwd is unsupported.
* Ad... | https://github.com/ansible/ansible.git | def is_content_root(path): # type: (str) -> bool
return False
| 8 | unsupported.py | Python | test/lib/ansible_test/_internal/provider/layout/unsupported.py | de5f60e374524de13fe079b52282cd7a9eeabd5f | ansible | 1 | |
244,119 | 78 | 16 | 33 | 510 | 26 | 1 | 123 | 415 | model_scaling | [Feature] Support efficientnet in mmdetection. (#7514)
* Initial implementation
* Add missing import
* Add MemoryEfficientSwishImplementation. Add docstrings
* Add efficientnet2mmdet tool
* Add config folder
* Flake8
* Flake8
* Flake8
* Fix config
* Requested changes
* docformatter
* U... | https://github.com/open-mmlab/mmdetection.git | def model_scaling(layer_setting, arch_setting):
# scale width
new_layer_setting = copy.deepcopy(layer_setting)
for layer_cfg in new_layer_setting:
for block_cfg in layer_cfg:
block_cfg[1] = make_divisible(block_cfg[1] * arch_setting[0], 8)
# scale depth
split_layer_setting ... | @BACKBONES.register_module() | 325 | efficientnet.py | Python | mmdet/models/backbones/efficientnet.py | 3f0f2a059743593fd07b629c261b609bd9a767e6 | mmdetection | 13 |
126,957 | 43 | 14 | 28 | 300 | 32 | 0 | 66 | 404 | test_dqn_compilation | [RLlib] Move learning_starts logic from buffers into `training_step()`. (#26032) | https://github.com/ray-project/ray.git | def test_dqn_compilation(self):
num_iterations = 1
config = (
dqn.dqn.DQNConfig()
.rollouts(num_rollout_workers=2)
.training(num_steps_sampled_before_learning_starts=0)
)
for _ in framework_iterator(config, with_eager_tracing=True):
... | 181 | test_dqn.py | Python | rllib/algorithms/dqn/tests/test_dqn.py | 0dceddb912ed92286032b5563dd2e541a8a7031f | ray | 4 | |
256,077 | 22 | 15 | 9 | 142 | 15 | 0 | 30 | 75 | get_dependency_links | Introduce readonly DCDocumentStore (without labels support) (#1991)
* minimal DCDocumentStore
* support filters
* implement get_documents_by_id
* handle not existing documents
* add docstrings
* auth added
* add tests
* generate docs
* Add latest docstring and tutorial changes
* add response... | https://github.com/deepset-ai/haystack.git | def get_dependency_links(filename):
with open(filename) as file:
parsed_requirements = file.read().splitlines()
dependency_links = list()
for line in parsed_requirements:
line = line.strip()
if line.startswith('--find-links'):
dependency_links.append(line.split('=')[... | 66 | setup.py | Python | setup.py | 8a32d8da92e4548e308bc971910e94bedb320029 | haystack | 3 | |
299,314 | 18 | 13 | 10 | 97 | 16 | 0 | 18 | 93 | cleanup | Skip invalid segments in stream recorder (#70896)
* Skip segment if duration is None
* Copy segments deque before passing to thread | https://github.com/home-assistant/core.git | def cleanup(self) -> None:
_LOGGER.debug("Starting recorder worker thread")
thread = threading.Thread(
name="recorder_save_worker",
target=recorder_save_worker,
args=(self.video_path, self._segments.copy()),
)
thread.start()
super().c... | 57 | recorder.py | Python | homeassistant/components/stream/recorder.py | 9281f46bcd9b76e88f9e490f16c6677f8b5ca738 | core | 1 | |
113,152 | 29 | 7 | 9 | 41 | 6 | 0 | 34 | 55 | evaluate | [Compression] lightning & legacy evaluator - step 1 (#4950) | https://github.com/microsoft/nni.git | def evaluate(self) -> float | None | Tuple[float, Any] | Tuple[None, Any]:
# Note that the first item of the returned value will be used as the default metric used by NNI.
raise NotImplementedError
| 26 | evaluator.py | Python | nni/algorithms/compression/v2/pytorch/utils/evaluator.py | 5a3d82e842906dc8f695fafe52434fde781615be | nni | 1 | |
306,790 | 13 | 8 | 5 | 43 | 8 | 0 | 13 | 32 | test_convert_from_cubic_meters | Refactor distance, speed and volume utils (#77952)
* Refactor distance util
* Fix bmw connected drive tests
* Adjust here travel time tests
* Adjust waze travel time tests
* Adjust test_distance
* Adjust rounding values
* Adjust more tests
* Adjust volume conversions
* Add tests | https://github.com/home-assistant/core.git | def test_convert_from_cubic_meters():
cubic_meters = 5
assert volume_util.convert(
cubic_meters, VOLUME_CUBIC_METERS, VOLUME_CUBIC_FEET
) == pytest.approx(176.5733335)
| 28 | test_volume.py | Python | tests/util/test_volume.py | 9490771a8737892a7a86afd866a3520b836779fd | core | 1 | |
319,215 | 41 | 13 | 13 | 108 | 16 | 0 | 49 | 115 | scan_file_for_seperating_barcodes | add first tests for barcode reader
Signed-off-by: florian on nixos (Florian Brandes) <florian.brandes@posteo.de> | https://github.com/paperless-ngx/paperless-ngx.git | def scan_file_for_seperating_barcodes(filepath) -> list:
seperator_page_numbers = [ ]
# use a temporary directory in case the file os too big to handle in memory
with tempfile.TemporaryDirectory() as path:
pages_from_path = convert_from_path(filepath, output_folder=path)
for current_pag... | 62 | tasks.py | Python | src/documents/tasks.py | 76e43bcb89dc96f18c966fab273f439f7efe2e12 | paperless-ngx | 3 | |
139,700 | 25 | 12 | 14 | 61 | 3 | 0 | 26 | 172 | get_invalid_runtime_envs | [Serve] Add deployment graph `import_path` and `runtime_env` to `ServeApplicationSchema` (#24814)
A newly planned version of the Serve schema (used in the REST API and CLI) requires the user to pass in their deployment graph's`import_path` and optionally a runtime_env containing that graph. This new schema can then pi... | https://github.com/ray-project/ray.git | def get_invalid_runtime_envs() -> List[Dict]:
return [
# Local URIs in working_dir and py_modules
{
"working_dir": ".",
"py_modules": [
"/Desktop/my_project",
(
"https://github.com/shrekris-anyscale/"
... | 31 | test_schema.py | Python | python/ray/serve/tests/test_schema.py | 3a2bd16ecae15d6e26585c32c113dcfe7469ccd7 | ray | 1 | |
20,795 | 14 | 9 | 7 | 74 | 7 | 0 | 23 | 73 | elapsed | 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 elapsed(self) -> Optional[float]:
if self.start_time is None:
return None
if self.stop_time is not None:
return self.stop_time - self.start_time
return self.get_time() - self.start_time
| 46 | progress.py | Python | pipenv/patched/notpip/_vendor/rich/progress.py | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | pipenv | 3 | |
37,512 | 8 | 9 | 2 | 33 | 5 | 0 | 8 | 14 | custom_tokenizers | Update all require decorators to use skipUnless when possible (#16999) | https://github.com/huggingface/transformers.git | def custom_tokenizers(test_case):
return unittest.skipUnless(_run_custom_tokenizers, "test of custom tokenizers")(test_case)
| 18 | testing_utils.py | Python | src/transformers/testing_utils.py | 57e6464ac9a31156f1c93e59107323e6ec01309e | transformers | 1 | |
257,821 | 55 | 18 | 24 | 210 | 20 | 0 | 78 | 232 | to_dict | refactor: improve support for dataclasses (#3142)
* refactor: improve support for dataclasses
* refactor: refactor class init
* refactor: remove unused import
* refactor: testing 3.7 diffs
* refactor: checking meta where is Optional
* refactor: reverting some changes on 3.7
* refactor: remove unused ... | https://github.com/deepset-ai/haystack.git | def to_dict(self, field_map={}) -> Dict:
inv_field_map = {v: k for k, v in field_map.items()}
_doc: Dict[str, str] = {}
for k, v in self.__dict__.items():
# Exclude internal fields (Pydantic, ...) fields from the conversion process
if k.startswith("__"):
... | 130 | schema.py | Python | haystack/schema.py | 621e1af74c9c7d04b79ca5f5826ddcc06e1237f0 | haystack | 8 | |
250,081 | 24 | 11 | 8 | 138 | 11 | 0 | 27 | 90 | test_shutdown | Require types in tests.storage. (#14646)
Adds missing type hints to `tests.storage` package
and does not allow untyped definitions. | https://github.com/matrix-org/synapse.git | def test_shutdown(self) -> None:
# Acquire two locks
lock = self.get_success(self.store.try_acquire_lock("name", "key1"))
self.assertIsNotNone(lock)
lock2 = self.get_success(self.store.try_acquire_lock("name", "key2"))
self.assertIsNotNone(lock2)
# Now call the ... | 79 | test_lock.py | Python | tests/storage/databases/main/test_lock.py | 3ac412b4e2f8c5ba11dc962b8a9d871c1efdce9b | synapse | 1 | |
153,672 | 114 | 14 | 37 | 515 | 55 | 1 | 176 | 366 | test_export_unaligned_at_chunks | FEAT-#4244: Implement dataframe exchange protocol for OmniSci (#4269)
Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru>
Co-authored-by: Vasily Litvinov <vasilij.n.litvinov@intel.com>
Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com> | https://github.com/modin-project/modin.git | def test_export_unaligned_at_chunks(data_has_nulls):
# Modin DataFrame constructor can't process PyArrow's category when using `from_arrow`, so exclude it
data = get_data_of_all_types(has_nulls=data_has_nulls, exclude_dtypes=["category"])
pd_df = pandas.DataFrame(data)
# divide columns in 3 groups:... | @pytest.mark.parametrize("data_has_nulls", [True, False]) | 310 | test_protocol.py | Python | modin/test/exchange/dataframe_protocol/omnisci/test_protocol.py | 0c1a2129df64cf45bf1ff49c8ed92c510fdb1c82 | modin | 9 |
13,596 | 137 | 14 | 85 | 469 | 16 | 0 | 291 | 854 | mixin_pod_runtime_args_parser | refactor: inject dependencies at contruction with runtime args (#5418)
Co-authored-by: Joan Fontanals <joan.martinez@jina.ai>
Co-authored-by: Jina Dev Bot <dev-bot@jina.ai> | https://github.com/jina-ai/jina.git | def mixin_pod_runtime_args_parser(arg_group, pod_type='worker'):
port_description = (
'The port for input data to bind to, default is a random port between [49152, 65535]. '
'In the case of an external Executor (`--external` or `external=True`) this can be a list of ports, separated by commas. ... | 283 | pod.py | Python | jina/parsers/orchestrate/pod.py | beecc7863e5a6b2580a0e1f10095253549279614 | jina | 2 | |
158,210 | 31 | 12 | 6 | 116 | 16 | 0 | 35 | 60 | evaluate_loss | [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_loss(net, data_iter, loss):
metric = d2l.Accumulator(2) # Sum of losses, no. of examples
for X, y in data_iter:
l = loss(net(X), y)
metric.add(d2l.reduce_sum(l), d2l.size(l))
return metric[0] / metric[1]
DATA_HUB = dict()
DATA_URL = 'http://d2l-data.s3-accelerate.amazonaw... | 64 | mxnet.py | Python | d2l/mxnet.py | b64b41d8c1ac23c43f7a4e3f9f6339d6f0012ab2 | d2l-zh | 2 | |
224,448 | 7 | 6 | 2 | 22 | 5 | 0 | 7 | 21 | on_template_context | Move plugin events docs into source code + refactor
* Create real (no-op) methods for each event in the base class.
* Refactor event dispatcher to not check for methods' existence, instead just call them.
* Move documentation from Markdown into docstrings of these methods.
* Activate the 'mkdocstrings' plugin.
* Use '... | https://github.com/mkdocs/mkdocs.git | def on_template_context(self, context, template_name, config):
return context
| 14 | plugins.py | Python | mkdocs/plugins.py | f79b34d174e41084391868e7b503f5c61b8b1bdf | mkdocs | 1 | |
174,578 | 46 | 16 | 15 | 177 | 24 | 0 | 55 | 119 | _create_runnable_pip | Speed up build environment creation
Instead of creating a zip file from the current pip's sources, add the
current copy of pip, to the build environment's interpreter's import
system using `sys.meta_path`. This avoids the overhead of creating the
zipfile, allows us to use the current pip's sources as-is,
meaningfully ... | https://github.com/pypa/pip.git | def _create_runnable_pip() -> Generator[str, None, None]:
source = pathlib.Path(pip_location).resolve().parent
# Return the current instance if `source` is not a directory. It likely
# means that this copy of pip is already standalone.
if not source.is_dir():
yield str(source)
retu... | 100 | build_env.py | Python | src/pip/_internal/build_env.py | d36bd5a96e50c4beee10eb283e4e15688e0d0eb6 | pip | 2 | |
104,411 | 7 | 10 | 2 | 46 | 6 | 0 | 7 | 21 | from_pandas | Update docs to new frontend/UI (#3690)
* WIP: update docs to new UI
* make style
* Rm unused
* inject_arrow_table_documentation __annotations__
* hasattr(arrow_table_method, "__annotations__")
* Update task_template.rst
* Codeblock PT-TF-SPLIT
* Convert loading scripts
* Convert docs to mdx
... | https://github.com/huggingface/datasets.git | def from_pandas(cls, *args, **kwargs):
return cls(pa.Table.from_pandas(*args, **kwargs))
| 28 | table.py | Python | src/datasets/table.py | e35be138148333078284b942ccc9ed7b1d826f97 | datasets | 1 | |
36,547 | 26 | 10 | 10 | 136 | 19 | 1 | 35 | 117 | serving_output | Add TF implementation of GPT-J (#15623)
* Initial commit
* Add TFGPTJModel
* Fix a forward pass
* Add TFGPTJCausalLM
* Add TFGPTJForSequenceClassification
* Add TFGPTJForQuestionAnswering
* Fix docs
* Deal with TF dynamic shapes
* Add Loss parents to models
* Adjust split and merge heads to ... | https://github.com/huggingface/transformers.git | def serving_output(self, output):
pkv = tf.convert_to_tensor(output.past_key_values) if self.config.use_cache else None
hs = tf.convert_to_tensor(output.hidden_states) if self.config.output_hidden_states else None
attns = tf.convert_to_tensor(output.attentions) if self.config.output_attentions e... | @add_start_docstrings(
"""
The GPT-J Model transformer with a language modeling head on top.
""",
GPTJ_START_DOCSTRING,
) | 83 | modeling_tf_gptj.py | Python | src/transformers/models/gptj/modeling_tf_gptj.py | ed2ee373d07aa8fd3f97e5f9fac9649511cf46fd | transformers | 4 |
288,892 | 23 | 11 | 13 | 106 | 14 | 0 | 26 | 85 | test_migrate_unique_id | Migrate HomeKit Controller to use stable identifiers (#80064) | https://github.com/home-assistant/core.git | async def test_migrate_unique_id(hass, utcnow):
entity_registry = er.async_get(hass)
aid = get_next_aid()
cover_entry = entity_registry.async_get_or_create(
"cover",
"homekit_controller",
f"homekit-00:00:00:00:00:00-{aid}-8",
)
await setup_test_component(hass, create_gar... | 58 | test_cover.py | Python | tests/components/homekit_controller/test_cover.py | f23b1750e85f07091eb896a0b12b8f95e5646338 | core | 1 | |
95,082 | 45 | 12 | 16 | 134 | 12 | 0 | 48 | 226 | test_failure_rate_without_transactions | feat(performance): Update performance queries to use generic_metrics dataset [TET-227] (#37855)
If I get a use case id = Performance, I should route to generic_metrics,
whereas if I get use case id=RELEASE_HEALTH, I should route to metrics.
Note for reviewer:
Also i've migrated tests to use `self.store_metric` i... | https://github.com/getsentry/sentry.git | def test_failure_rate_without_transactions(self):
# Not sending buckets means no project is created automatically. We need
# a project without transaction data, so create one:
self.project
response = self.get_success_response(
self.organization.slug,
fie... | 76 | test_organization_metric_data.py | Python | tests/sentry/api/endpoints/test_organization_metric_data.py | 91bbcc1795642a02e1e5ba29558c01fe55e2fa26 | sentry | 1 | |
176,434 | 16 | 10 | 6 | 88 | 12 | 0 | 19 | 37 | test_tutte_polynomial_disjoint_C5 | Add Tutte polynomial (#5265)
Add a new polynomial module to algorithms for characteristic polynomials.
Adds the Tutte polynomial, which is computed and ultimate represented as a
sympy expression.
Co-authored-by: Dan Schult <dschult@colgate.edu>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> | https://github.com/networkx/networkx.git | def test_tutte_polynomial_disjoint_C5():
g = nx.cycle_graph(5)
t_g = nx.tutte_polynomial(g)
h = nx.disjoint_union(g, g)
t_h = nx.tutte_polynomial(h)
assert sympy.simplify(t_g * t_g).equals(t_h)
| 53 | test_polynomials.py | Python | networkx/algorithms/tests/test_polynomials.py | f11068c0115ede0c7b631f771c10be7efd0b950b | networkx | 1 | |
101,260 | 74 | 14 | 24 | 298 | 30 | 0 | 110 | 374 | copy | lib.align updates:
- alignments.py
- Add typed dicts for imported alignments
- Explicitly check for presence of thumb value in alignments dict
- linting
- detected_face.py
- Typing
- Linting
- Legacy support for pre-aligned face
- Update dependencies to new property names | https://github.com/deepfakes/faceswap.git | def copy(self, frame_index, direction):
logger.debug("frame: %s, direction: %s", frame_index, direction)
faces = self._faces_at_frame_index(frame_index)
frames_with_faces = [idx for idx, faces in enumerate(self._detected_faces.current_faces)
if len(faces) > ... | 187 | detected_faces.py | Python | tools/manual/detected_faces.py | 5e73437be47f2410439a3c6716de96354e6a0c94 | faceswap | 11 | |
189,043 | 10 | 10 | 7 | 56 | 5 | 0 | 10 | 43 | chdir | add flake8-quotes plugin
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com> | https://github.com/giampaolo/psutil.git | def chdir(dirname):
curdir = os.getcwd()
try:
os.chdir(dirname)
yield
finally:
os.chdir(curdir)
| 30 | __init__.py | Python | psutil/tests/__init__.py | ddea4072684561fc8fe754a7f2baf0cc6a787c33 | psutil | 2 | |
245,720 | 8 | 8 | 3 | 30 | 5 | 0 | 9 | 30 | encode | [Refactor] Refactor anchor head and base head with boxlist (#8625)
* Refactor anchor head
* Update
* Update
* Update
* Add a series of boxes tools
* Fix box type to support n x box_dim boxes
* revert box type changes
* Add docstring
* refactor retina_head
* Update
* Update
* Fix commen... | https://github.com/open-mmlab/mmdetection.git | def encode(self, bboxes, gt_bboxes):
gt_bboxes = get_box_tensor(gt_bboxes)
return gt_bboxes
| 18 | pseudo_bbox_coder.py | Python | mmdet/models/task_modules/coders/pseudo_bbox_coder.py | d915740fa8228cf57741b27d9e5d66e358456b8e | mmdetection | 1 | |
125,487 | 7 | 10 | 6 | 47 | 7 | 0 | 7 | 21 | name | [Datasets] Automatically cast tensor columns when building Pandas blocks. (#26684)
This PR tries to automatically cast tensor columns to our TensorArray extension type when building Pandas blocks, logging a warning and falling back to the opaque object-typed column if the cast fails. This should allow users to remain ... | https://github.com/ray-project/ray.git | def name(self) -> str:
return f"{type(self).__name__}(shape={self._shape}, dtype={self._dtype})"
| 11 | pandas.py | Python | python/ray/air/util/tensor_extensions/pandas.py | 0c139914bbb3e3557f13738b5f3f9fe8d2d428b4 | ray | 1 | |
166,957 | 53 | 9 | 7 | 126 | 13 | 0 | 66 | 96 | np_dtype_to_arrays | DOC: Added docstrings to fixtures defined in array module (#47211) | https://github.com/pandas-dev/pandas.git | def np_dtype_to_arrays(any_real_numpy_dtype):
np_dtype = np.dtype(any_real_numpy_dtype)
pa_type = pa.from_numpy_dtype(np_dtype)
# None ensures the creation of a bitmask buffer.
pa_array = pa.array([0, 1, 2, None], type=pa_type)
# Since masked Arrow buffer slots are not required to contain a sp... | 84 | test_arrow_compat.py | Python | pandas/tests/arrays/masked/test_arrow_compat.py | 89be1f053b695c4ce1c0569f737caf3f03c12128 | pandas | 1 | |
142,458 | 23 | 11 | 6 | 79 | 10 | 0 | 24 | 70 | was_current_actor_reconstructed | [api] Annotate as public / move ray-core APIs to _private and add enforcement rule (#25695)
Enable checking of the ray core module, excluding serve, workflows, and tune, in ./ci/lint/check_api_annotations.py. This required moving many files to ray._private and associated fixes. | https://github.com/ray-project/ray.git | def was_current_actor_reconstructed(self):
assert (
not self.actor_id.is_nil()
), "This method should't be called inside Ray tasks."
actor_info = ray._private.state.actors(self.actor_id.hex())
return actor_info and actor_info["NumRestarts"] != 0
| 46 | runtime_context.py | Python | python/ray/runtime_context.py | 43aa2299e6623c8f8c7c4a1b80133459d0aa68b0 | ray | 2 | |
36,152 | 36 | 9 | 3 | 64 | 10 | 1 | 40 | 59 | _set_gradient_checkpointing | Visual Attention Network (VAN) (#16027)
* encoder works
* addded files
* norm in stage
* convertion script
* tests
* fix copies
* make fix-copies
* fixed __init__
* make fix-copies
* fix
* shapiro test needed
* make fix-copie
* minor changes
* make style + quality
* minor refa... | https://github.com/huggingface/transformers.git | def _set_gradient_checkpointing(self, module, value=False):
if isinstance(module, VanModel):
module.gradient_checkpointing = value
VAN_START_DOCSTRING = r
VAN_INPUTS_DOCSTRING = r
@add_start_docstrings(
"The bare VAN model outputting raw features without any specific head on top. Note, VAN ... | @add_start_docstrings(
"The bare VAN model outputting raw features without any specific head on top. Note, VAN does not have an embedding layer.",
VAN_START_DOCSTRING,
) | 24 | modeling_van.py | Python | src/transformers/models/van/modeling_van.py | 0a057201a96565df29984d716f660fd8d634329a | transformers | 2 |
291,719 | 6 | 6 | 2 | 20 | 3 | 0 | 6 | 12 | aiohttp_server | Upgrade pytest-aiohttp (#82475)
* Upgrade pytest-aiohttp
* Make sure executors, tasks and timers are closed
Some test will trigger warnings on garbage collect, these warnings
spills over into next test.
Some test trigger tasks that raise errors on shutdown, these spill
over into next test.
This is to mim... | https://github.com/home-assistant/core.git | def aiohttp_server(event_loop, aiohttp_server, socket_enabled):
return aiohttp_server
| 12 | test_camera.py | Python | tests/components/motioneye/test_camera.py | c576a68d336bc91fd82c299d9b3e5dfdc1c14960 | core | 1 | |
141,293 | 13 | 6 | 9 | 30 | 7 | 0 | 13 | 34 | to_config | [RLlib] Introduce basic connectors library. (#25311) | https://github.com/ray-project/ray.git | def to_config(self) -> Tuple[str, List[Any]]:
# Must implement by each connector.
return NotImplementedError
| 18 | connector.py | Python | rllib/connectors/connector.py | 9b65d5535df7fcdfb5cb8fd7ad90c328eb1f1aed | ray | 1 | |
259,994 | 32 | 16 | 11 | 164 | 14 | 0 | 37 | 106 | test_iforest | TST use global_random_seed in sklearn/ensemble/tests/test_iforest.py (#22901)
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> | https://github.com/scikit-learn/scikit-learn.git | def test_iforest(global_random_seed):
X_train = np.array([[0, 1], [1, 2]])
X_test = np.array([[2, 1], [1, 1]])
grid = ParameterGrid(
{"n_estimators": [3], "max_samples": [0.5, 1.0, 3], "bootstrap": [True, False]}
)
with ignore_warnings():
for params in grid:
Isolat... | 109 | test_iforest.py | Python | sklearn/ensemble/tests/test_iforest.py | 6ca1f5e4d0d16bc9a7f28582079a15e14f012719 | scikit-learn | 2 | |
280,071 | 33 | 13 | 12 | 103 | 12 | 0 | 40 | 151 | clone_model | Move serialization-related logic in utils/generic_utils.py to saving/legacy/serialization.py.
PiperOrigin-RevId: 479688207 | https://github.com/keras-team/keras.git | def clone_model(model, input_tensors=None, clone_function=None):
with serialization.DisableSharedObjectScope():
if clone_function is None:
clone_function = _clone_layer
if isinstance(model, Sequential):
return _clone_sequential_model(
model, input_tensor... | 65 | cloning.py | Python | keras/models/cloning.py | c269e3cd8fed713fb54d2971319df0bfe6e1bf10 | keras | 3 | |
189,882 | 13 | 8 | 10 | 44 | 7 | 0 | 13 | 34 | get_end_anchors | Fix vm.get_end_anchors() docstring (#2755)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at> | https://github.com/ManimCommunity/manim.git | def get_end_anchors(self) -> np.ndarray:
nppcc = self.n_points_per_cubic_curve
return self.points[nppcc - 1 :: nppcc]
| 26 | vectorized_mobject.py | Python | manim/mobject/types/vectorized_mobject.py | e8124bb95609237e53f0be3e7dd208e3e2dfd255 | manim | 1 | |
266,730 | 34 | 11 | 11 | 126 | 23 | 0 | 40 | 91 | command_coverage_analyze_targets_expand | ansible-test - Code cleanup and refactoring. (#77169)
* Remove unnecessary PyCharm ignores.
* Ignore intentional undefined attribute usage.
* Add missing type hints. Fix existing type hints.
* Fix docstrings and comments.
* Use function to register completion handler.
* Pass strings to display functions.
* Fix C... | https://github.com/ansible/ansible.git | def command_coverage_analyze_targets_expand(args): # type: (CoverageAnalyzeTargetsExpandConfig) -> None
host_state = prepare_profiles(args) # coverage analyze targets expand
if args.delegate:
raise Delegate(host_state=host_state)
covered_targets, covered_path_arcs, covered_path_lines = read... | 81 | expand.py | Python | test/lib/ansible_test/_internal/commands/coverage/analyze/targets/expand.py | a06fa496d3f837cca3c437ab6e9858525633d147 | ansible | 3 | |
272,366 | 11 | 10 | 4 | 73 | 10 | 0 | 12 | 40 | test_scale_none | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def test_scale_none(self):
attention_layer = keras.layers.Attention()
attention_layer.build(input_shape=([1, 1, 1], [1, 1, 1]))
self.assertIsNone(attention_layer.scale)
| 47 | attention_test.py | Python | keras/layers/attention/attention_test.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 1 | |
132,220 | 9 | 8 | 4 | 39 | 7 | 0 | 9 | 41 | __call__ | [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 __call__(self, env):
return self.after_iteration(
env.model, env.iteration, env.evaluation_result_list
)
| 25 | xgboost.py | Python | python/ray/tune/integration/xgboost.py | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | ray | 1 | |
194,668 | 18 | 8 | 4 | 50 | 9 | 0 | 21 | 33 | test_kivy_log_mode_marker_on | Support KivyLogMode environment variable for logging testing (#7971)
* Support KivyLogMode for logging testing
Also:
Remove unused imports.
Remove Python 2 only code
Run through Black to canonicalize formatting
* Undo formatting changes
Undo black. | https://github.com/kivy/kivy.git | def test_kivy_log_mode_marker_on():
from kivy.logger import previous_stderr
assert sys.stderr == previous_stderr, "Kivy.logging override stderr"
assert logging.root.parent is None, "Kivy.logging override root logger"
| 29 | test_logger.py | Python | kivy/tests/test_logger.py | 2d9755ad8a82ba0777299cbc1666bed25278db94 | kivy | 1 | |
22,285 | 26 | 12 | 14 | 143 | 12 | 0 | 43 | 125 | which_pip | Remove other spots that did not use the internal pip version to exectue pipenv commands. | https://github.com/pypa/pipenv.git | def which_pip(project):
location = None
if "VIRTUAL_ENV" in os.environ:
location = os.environ["VIRTUAL_ENV"]
pip = project._which("python", location=location)
if pip:
return pip
if not pip:
for p in ("pip", "pip3", "pip2"):
where = system_which(p)
... | 83 | core.py | Python | pipenv/core.py | 374b670afb206c6e1ae9b2edd27c244dae5d296a | pipenv | 6 | |
154,654 | 21 | 11 | 7 | 69 | 9 | 0 | 24 | 93 | __getattr__ | REFACTOR-#5026: Change exception names to simplify grepping (#5027)
Signed-off-by: Myachev <anatoly.myachev@intel.com> | https://github.com/modin-project/modin.git | def __getattr__(self, key):
try:
return object.__getattribute__(self, key)
except AttributeError as err:
if key not in _ATTRS_NO_LOOKUP and key in self.index:
return self[key]
raise err
| 43 | series.py | Python | modin/pandas/series.py | 0a2c0de4451f7e2e8f337a9478d7595473aa348e | modin | 4 | |
102,230 | 149 | 16 | 42 | 502 | 40 | 0 | 250 | 584 | broadcast_object_list | Prevent sum overflow in broadcast_object_list (#70605)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70605
broadcast_object_list casted the sum of all object lengths to int from long causing overflows.
Test Plan:
Add a Tensor with >2GB storage requirement (in distributed_test.py) to object... | https://github.com/pytorch/pytorch.git | def broadcast_object_list(object_list, src=0, group=None, device=None):
if _rank_not_in_group(group):
_warn_not_in_group("broadcast_object_list")
return
my_rank = get_rank()
# Serialize object_list elements to tensors on src rank.
if my_rank == src:
tensor_list, size_list =... | 301 | distributed_c10d.py | Python | torch/distributed/distributed_c10d.py | e1e43c4e710389a3fcf54cd7f3537336e21d3ae5 | pytorch | 14 | |
160,501 | 7 | 7 | 2 | 35 | 6 | 1 | 7 | 12 | inner | DIC: Misc RST reformatting.
This contains various RST reformatting.
One, moving `(C)` one line up, is specific to a bug in tree-sitter-rst
that mis parses this section. Another is adding one black line for a
similar reason where `..` is seen as section underline by
tree-sitter-rst.
This is some shuffling of section ... | https://github.com/numpy/numpy.git | def inner(a, b):
return (a, b)
@array_function_from_c_func_and_dispatcher(_multiarray_umath.where) | @array_function_from_c_func_and_dispatcher(_multiarray_umath.where) | 14 | multiarray.py | Python | numpy/core/multiarray.py | 84eeca630ec9c5bf580bc456035c87d8591c1389 | numpy | 1 |
179,282 | 25 | 10 | 8 | 90 | 9 | 0 | 31 | 64 | resize_and_crop | Format The Codebase
- black formatting
- isort formatting | https://github.com/gradio-app/gradio.git | def resize_and_crop(img, size, crop_type="center"):
if crop_type == "top":
center = (0, 0)
elif crop_type == "center":
center = (0.5, 0.5)
else:
raise ValueError
return ImageOps.fit(img, size, centering=center)
##################
# Audio
##################
| 57 | processing_utils.py | Python | gradio/processing_utils.py | cc0cff893f9d7d472788adc2510c123967b384fe | gradio | 3 | |
92,536 | 20 | 13 | 12 | 107 | 17 | 0 | 20 | 128 | update_snuba_subscription | feat(mep): Restructure how we determine entity subscription for alerts (#36605)
Previously we mapped a specific `EntityKey` to all `EntitySubscription` classes. As part of
introducing metric based performance alerts, we want to have the `EntitySubscription` determine the
specific entity that the subscription will ru... | https://github.com/getsentry/sentry.git | def update_snuba_subscription(subscription, old_query_type, old_dataset):
with transaction.atomic():
subscription.update(status=QuerySubscription.Status.UPDATING.value)
update_subscription_in_snuba.apply_async(
kwargs={
"query_subscription_id": subscription.id,
... | 65 | subscriptions.py | Python | src/sentry/snuba/subscriptions.py | 06885ee7284a274d02a9dc1f6a0348c8edc07184 | sentry | 1 | |
118,531 | 17 | 9 | 8 | 98 | 15 | 1 | 22 | 49 | experimental_set_query_params | 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 experimental_set_query_params(**query_params):
ctx = _get_script_run_ctx()
if ctx is None:
return
ctx.query_string = _parse.urlencode(query_params, doseq=True)
msg = _ForwardMsg_pb2.ForwardMsg()
msg.page_info_changed.query_string = ctx.query_string
ctx.enqueue(msg)
@_contextli... | @_contextlib.contextmanager | 54 | __init__.py | Python | lib/streamlit/__init__.py | 704eab3478cf69847825b23dabf15813a8ac9fa2 | streamlit | 2 |
9,928 | 5 | 8 | 3 | 40 | 5 | 0 | 5 | 26 | replace_docs | 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 replace_docs(request, docs):
request.docs.clear()
request.docs.extend(docs)
| 23 | data_request_handler.py | Python | jina/peapods/runtimes/request_handlers/data_request_handler.py | 933415bfa1f9eb89f935037014dfed816eb9815d | jina | 1 | |
261,647 | 49 | 12 | 32 | 273 | 23 | 0 | 76 | 233 | test_learning_curve_display_plot_kwargs | FEA add LearningCurveDisplay to show plot learning curve (#24084)
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
Co-authored-by: Arturo Amor <86408019+ArturoAmorQ@users.noreply.github.com> | https://github.com/scikit-learn/scikit-learn.git | def test_learning_curve_display_plot_kwargs(pyplot, data):
X, y = data
estimator = DecisionTreeClassifier(random_state=0)
train_sizes = [0.3, 0.6, 0.9]
std_display_style = "fill_between"
line_kw = {"color": "red"}
fill_between_kw = {"color": "red", "alpha": 1.0}
display = LearningCurve... | 188 | test_plot.py | Python | sklearn/model_selection/tests/test_plot.py | 758fe0d9c72ba343097003e7992c9239e58bfc63 | scikit-learn | 1 | |
132,079 | 34 | 12 | 18 | 203 | 16 | 0 | 39 | 121 | trial | [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 trial(request):
job_id = request.GET.get("job_id")
trial_id = request.GET.get("trial_id")
recent_trials = TrialRecord.objects.filter(job_id=job_id).order_by("-start_time")
recent_results = ResultRecord.objects.filter(trial_id=trial_id).order_by("-date")[
0:2000
]
current_trial =... | 118 | view.py | Python | python/ray/tune/automlboard/frontend/view.py | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | ray | 1 | |
256,613 | 16 | 10 | 4 | 78 | 12 | 1 | 18 | 29 | delete_feedback | Add `DELETE /feedback` for testing and make the label's id generate server-side (#2159)
* Add DELETE /feedback for testing and make the ID generate server-side
* Make sure to delete only user generated labels
* Reduce fixture scope, was too broad
* Make test a bit more generic
Co-authored-by: github-action... | https://github.com/deepset-ai/haystack.git | def delete_feedback():
all_labels = DOCUMENT_STORE.get_all_labels()
user_label_ids = [label.id for label in all_labels if label.origin == "user-feedback"]
DOCUMENT_STORE.delete_labels(ids=user_label_ids)
@router.post("/eval-feedback") | @router.post("/eval-feedback") | 37 | feedback.py | Python | rest_api/controller/feedback.py | be8f50c9e3de4e264b3f345f5f4b9c9ec518ed08 | haystack | 3 |
118,728 | 15 | 11 | 5 | 86 | 10 | 0 | 19 | 62 | bar_chart | Replace static apps with live Cloud apps (#4317)
Co-authored-by: kajarenc <kajarenc@gmail.com> | https://github.com/streamlit/streamlit.git | def bar_chart(self, data=None, width=0, height=0, use_container_width=True):
if _use_arrow():
return self.dg._arrow_bar_chart(data, width, height, use_container_width)
else:
return self.dg._legacy_bar_chart(data, width, height, use_container_width)
| 59 | dataframe_selector.py | Python | lib/streamlit/elements/dataframe_selector.py | 72703b38029f9358a0ec7ca5ed875a6b438ece19 | streamlit | 2 | |
189,797 | 2 | 6 | 4 | 13 | 2 | 0 | 2 | 5 | test_animate_with_changed_custom_attribute | Improved handling of attributes when using the ``.animate`` syntax (#2665)
* apply all methods to original mobject after finishing _MethodBuilder animation
* added test to check whether custom attributes are changed
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-c... | https://github.com/ManimCommunity/manim.git | def test_animate_with_changed_custom_attribute(using_temp_config):
| 21 | test_play_logic.py | Python | tests/test_scene_rendering/test_play_logic.py | b6311098df07c87f3c3991a3aa95847721c202d3 | manim | 1 | |
176,348 | 36 | 11 | 8 | 128 | 17 | 0 | 42 | 92 | _lg_directed | MAINT: Remove unnecessary helper functions, use inbuilt methods for line graph generator (#5327)
* MAINT: Remove unnecessary helper functions, use inbuilt methods
* Use multigraph key to create node, add tests for multi(di)graphs | https://github.com/networkx/networkx.git | def _lg_directed(G, create_using=None):
L = nx.empty_graph(0, create_using, default=G.__class__)
# Create a graph specific edge function.
get_edges = partial(G.edges, keys=True) if G.is_multigraph() else G.edges
for from_node in get_edges():
# from_node is: (u,v) or (u,v,key)
L.ad... | 82 | line.py | Python | networkx/generators/line.py | e308b80f17264b89acf8defe185c71c6656d5105 | networkx | 4 | |
296,150 | 13 | 10 | 5 | 49 | 6 | 0 | 14 | 46 | state | Improve typing of deCONZ alarm control panel (#69680)
* Improve typing of deCONZ alarm control panel
* Fix review comments | https://github.com/home-assistant/core.git | def state(self) -> str | None:
if self._device.panel in DECONZ_TO_ALARM_STATE:
return DECONZ_TO_ALARM_STATE[self._device.panel]
return None
| 30 | alarm_control_panel.py | Python | homeassistant/components/deconz/alarm_control_panel.py | 81a55703bfa9d285cd4c9b38c337dc08f3a6bc4b | core | 2 | |
287,765 | 6 | 7 | 3 | 29 | 5 | 0 | 6 | 20 | supported_channels | Clean up Speech-to-text integration and add tests (#79012) | https://github.com/home-assistant/core.git | def supported_channels(self) -> list[AudioChannels]:
return [AudioChannels.CHANNEL_MONO]
| 17 | test_init.py | Python | tests/components/stt/test_init.py | 57746642349a3ca62959de4447a4eb5963a84ae1 | core | 1 | |
181,631 | 20 | 10 | 8 | 136 | 15 | 0 | 26 | 50 | test_FeatureSetSelector_5 | Revert "Deployed 7ccda9a with MkDocs version: 1.3.0"
This reverts commit bd9629c40e01241766197119b581a99409b07068. | https://github.com/EpistasisLab/tpot.git | def test_FeatureSetSelector_5():
ds = FeatureSetSelector(subset_list="tests/subset_test.csv", sel_subset=0)
ds.fit(test_X, y=None)
transformed_X = ds.transform(test_X)
assert transformed_X.shape[0] == test_X.shape[0]
assert transformed_X.shape[1] != test_X.shape[1]
assert transformed_X.sha... | 88 | feature_set_selector_tests.py | Python | tests/feature_set_selector_tests.py | 388616b6247ca4ea8de4e2f340d6206aee523541 | tpot | 1 | |
68,837 | 31 | 18 | 34 | 157 | 19 | 0 | 39 | 25 | get_mode_of_payments | refactor: DB independent quoting and truthy/falsy values (#31358)
* refactor: DB independent quoting and truthy/falsy values
* style: reformat to black spec
* fix: ifnull -> coalesce
* fix: coalesce -> Coalesce
* fix: revert pypika comparison
* refactor: convert queries to QB
* fix: incorrect value t... | https://github.com/frappe/erpnext.git | def get_mode_of_payments(filters):
mode_of_payments = {}
invoice_list = get_invoices(filters)
invoice_list_names = ",".join("'" + invoice["name"] + "'" for invoice in invoice_list)
if invoice_list:
inv_mop = frappe.db.sql(
.format(
invoice_list_names=invoice_list_names
),
as_dict=1,
)
for d in in... | 93 | sales_payment_summary.py | Python | erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py | 74a782d81d8f8c4a4d9214a9c06377e5e6e464dd | erpnext | 4 | |
111,232 | 28 | 12 | 16 | 165 | 14 | 0 | 33 | 100 | to_bytes | Fix entity linker batching (#9669)
* Partial fix of entity linker batching
* Add import
* Better name
* Add `use_gold_ents` option, docs
* Change to v2, create stub v1, update docs etc.
* Fix error type
Honestly no idea what the right type to use here is.
ConfigValidationError seems wrong. Maybe a N... | https://github.com/explosion/spaCy.git | def to_bytes(self, *, exclude=tuple()):
self._validate_serialization_attrs()
serialize = {}
if hasattr(self, "cfg") and self.cfg is not None:
serialize["cfg"] = lambda: srsly.json_dumps(self.cfg)
serialize["vocab"] = lambda: self.vocab.to_bytes(exclude=exclude)
... | 99 | entity_linker.py | Python | spacy/pipeline/legacy/entity_linker.py | 91acc3ea75d219ad07ed2b106e7b8bdcb01516dd | spaCy | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.