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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
309,437 | 11 | 9 | 5 | 38 | 6 | 0 | 11 | 43 | is_on | Add support for setting RGB and RGBW values for Twinkly lights (#62337)
* Change library to ttls
* Add rgbw support
* Add client session to config flow
* Fix config flow
* Adjust tests 1
* Fix more tests
* Fix last tests
* Add new tests
* Update test for coverage
* Update test for coverage 2... | https://github.com/home-assistant/core.git | async def is_on(self) -> bool:
if self.is_offline:
raise ClientConnectionError()
return self.state
| 21 | __init__.py | Python | tests/components/twinkly/__init__.py | 49a32c398c2b094975a0b8abe3ce356948c911bd | core | 2 | |
130,358 | 16 | 10 | 7 | 84 | 12 | 0 | 18 | 71 | stop_instances | [CI] Format Python code with Black (#21975)
See #21316 and #21311 for the motivation behind these changes. | https://github.com/ray-project/ray.git | def stop_instances(self, instance_ids, stopped_mode="StopCharging"):
request = StopInstancesRequest()
request.set_InstanceIds(instance_ids)
request.set_StoppedMode(stopped_mode)
response = self._send_request(request)
if response is None:
logging.error("stop_i... | 48 | utils.py | Python | python/ray/autoscaler/_private/aliyun/utils.py | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | ray | 2 | |
105,945 | 8 | 9 | 2 | 36 | 5 | 0 | 8 | 14 | _version_tuple_to_str | Make `Version` hashable (#5238)
* Make Version hashable
* Remove Version.match (unused method) | https://github.com/huggingface/datasets.git | def _version_tuple_to_str(version_tuple):
return ".".join(str(v) for v in version_tuple)
| 20 | version.py | Python | src/datasets/utils/version.py | bde7504fbafa9a0cc9ae847ed55aafd4c0dbc9de | datasets | 2 | |
249,805 | 28 | 10 | 19 | 178 | 13 | 0 | 48 | 205 | test_medium_does_not_exist | Add an Admin API endpoint for looking up users based on 3PID (#14405) | https://github.com/matrix-org/synapse.git | def test_medium_does_not_exist(self) -> None:
# test for unknown medium
url = "/_synapse/admin/v1/threepid/publickey/users/unknown-key"
channel = self.make_request(
"GET",
url,
access_token=self.admin_user_tok,
)
self.assertEqual(404... | 110 | test_user.py | Python | tests/rest/admin/test_user.py | a3623af74e0af0d2f6cbd37b47dc54a1acd314d5 | synapse | 1 | |
188,426 | 78 | 13 | 21 | 220 | 24 | 0 | 112 | 323 | authenticate | 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 authenticate(request=None, **credentials):
username = credentials.get('username')
for backend, backend_path in _get_backends(return_tuples=True):
# 预先检查,不浪费认证时间
if not backend.username_can_authenticate(username):
continue
# 原生
backend_signature = inspect.si... | 125 | mixins.py | Python | apps/authentication/mixins.py | edfca5eb2486c2f006257723ffeda6f56b170170 | jumpserver | 7 | |
191,410 | 53 | 9 | 11 | 124 | 7 | 0 | 97 | 139 | test_document_lookup | Harrison/add react chain (#24)
from https://arxiv.org/abs/2210.03629
still need to think if docstore abstraction makes sense | https://github.com/hwchase17/langchain.git | def test_document_lookup() -> None:
page = Document(page_content=_PAGE_CONTENT)
# Start with lookup on "LangChain".
output = page.lookup("LangChain")
assert output == "(Result 1/2) This is a page about LangChain."
# Now switch to looking up "framework".
output = page.lookup("framework")
... | 63 | test_document.py | Python | tests/unit_tests/docstore/test_document.py | ce7b14b84381c766ae42a0f71953b2a56c024dbb | langchain | 1 | |
259,900 | 93 | 12 | 10 | 434 | 23 | 1 | 147 | 564 | test_fetch_openml_inactive | ENH improve ARFF parser using pandas (#21938)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@gmail.com>
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com> | https://github.com/scikit-learn/scikit-learn.git | def test_fetch_openml_inactive(monkeypatch, gzip_response, dataset_params):
data_id = 40675
_monkey_patch_webbased_functions(monkeypatch, data_id, gzip_response)
msg = "Version 1 of dataset glass2 is inactive,"
with pytest.warns(UserWarning, match=msg):
glass2 = fetch_openml(
ca... | @pytest.mark.parametrize("gzip_response", [True, False])
@pytest.mark.parametrize(
"data_id, params, err_type, err_msg",
[
(40675, {"name": "glass2"}, ValueError, "No active dataset glass2 found"),
(
61,
{"data_id": 61, "target_column": ["sepalwidth", "class"]},
... | 76 | test_openml.py | Python | sklearn/datasets/tests/test_openml.py | a47d569e670fd4102af37c3165c9b1ddf6fd3005 | scikit-learn | 1 |
211,327 | 40 | 14 | 13 | 223 | 20 | 0 | 67 | 126 | choose_best_pointorder_fit_another | Refactor rbox (#6704)
* refactor rbox
* modify the code of save results
* fix some problem
* add .gitignore in dataset/dota
* fix test anno path | https://github.com/PaddlePaddle/PaddleDetection.git | def choose_best_pointorder_fit_another(poly1, poly2):
x1, y1, x2, y2, x3, y3, x4, y4 = poly1
combinate = [
np.array([x1, y1, x2, y2, x3, y3, x4, y4]),
np.array([x2, y2, x3, y3, x4, y4, x1, y1]),
np.array([x3, y3, x4, y4, x1, y1, x2, y2]),
np.array([x4, y4, x1, y1, x2, y2, x3... | 168 | slicebase.py | Python | configs/rotate/tools/slicebase.py | e55e41945d42db787a0f7c557d53d06a6b24536b | PaddleDetection | 2 | |
158,396 | 44 | 12 | 15 | 197 | 22 | 0 | 54 | 114 | train_batch_ch13 | [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 train_batch_ch13(net, X, y, loss, trainer, devices):
if isinstance(X, list):
# Required for BERT fine-tuning (to be covered later)
X = [x.to(devices[0]) for x in X]
else:
X = X.to(devices[0])
y = y.to(devices[0])
net.train()
trainer.zero_grad()
pred = net(X)
... | 124 | torch.py | Python | d2l/torch.py | b64b41d8c1ac23c43f7a4e3f9f6339d6f0012ab2 | d2l-zh | 3 | |
86,689 | 78 | 19 | 52 | 436 | 53 | 0 | 92 | 672 | __fetch_randomly_sampled_transactions | feat(dynamic-sampling): Improve empty transaction breakdown message [TET-338] (#39539)
This PR add new attribute parentProjectBreakdown to
/api/0/projects/<organization_slug>/<project_slug>/dynamic-sampling/distribution/
api:
```
{
"projectBreakdown": null,
"sampleSize": 0,
"startTimestamp": null,
"end... | https://github.com/getsentry/sentry.git | def __fetch_randomly_sampled_transactions(self, project, query, sample_size, query_time_range):
sampling_factor = self.__generate_transactions_sampling_factor(
project=project,
query=query,
sample_size=sample_size,
query_time_range=query_time_range,
... | 275 | project_dynamic_sampling.py | Python | src/sentry/api/endpoints/project_dynamic_sampling.py | ceee9dfd8d6fed70d34546e7b46ebb7bf1d49745 | sentry | 1 | |
247,315 | 43 | 15 | 42 | 412 | 15 | 0 | 69 | 500 | test_search_filter_not_labels | 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_search_filter_not_labels(self) -> None:
request_data = json.dumps(
{
"search_categories": {
"room_events": {
"search_term": "label",
"filter": self.FILTER_NOT_LABELS,
}
... | 236 | test_rooms.py | Python | tests/rest/client/test_rooms.py | 2ffaf30803f93273a4d8a65c9e6c3110c8433488 | synapse | 2 | |
271,596 | 71 | 13 | 14 | 89 | 9 | 0 | 87 | 274 | _assert_weights_created | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def _assert_weights_created(self):
if self.dynamic:
return
if (
"build" in self.__class__.__dict__
and self.__class__ != Model
and not self.built
):
# For any model that has customized build() method but hasn't
# b... | 43 | training.py | Python | keras/engine/training.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 5 | |
47,758 | 10 | 6 | 28 | 44 | 10 | 0 | 12 | 33 | _iter_all_mapped_downstreams | Ensure TaskMap only checks "relevant" dependencies (#23053)
When looking for "mapped dependants" of a task, we only want a task if
it not only is a direct downstream of the task, but also it actually
"uses" the task's pushed XCom for task mapping. So we need to peek into
the mapped downstream task's expansion kwarg... | https://github.com/apache/airflow.git | def _iter_all_mapped_downstreams(self) -> Iterator["MappedOperator"]:
from airflow.models.mappedoperator import MappedOperator
from airflow.utils.task_group import TaskGroup
| 82 | taskmixin.py | Python | airflow/models/taskmixin.py | 197cff3194e855b9207c3c0da8ae093a0d5dda55 | airflow | 6 | |
245,836 | 12 | 11 | 3 | 41 | 7 | 0 | 12 | 37 | _forward | [Feature] Support training detection models in detectron2 (#8672)
* [Feature]Support using mmengine to train detectron2
* update
* del unnecessary comments
* minor fix
* minor fix
* Support mask rcnn and retinanet
* minor fix
* minor fix
* minor fix
* minor fix
* minor fix
* minor fix
... | https://github.com/open-mmlab/mmdetection.git | def _forward(self, *args, **kwargs):
raise NotImplementedError(
f'`_forward` is not implemented in {self.__class__.__name__}')
| 18 | d2_wrapper.py | Python | mmdet/models/detectors/d2_wrapper.py | 9c1b26726eebe4a196d213249dc22e8017761fab | mmdetection | 1 | |
188,886 | 242 | 17 | 100 | 940 | 48 | 0 | 464 | 2,148 | get_bookmark_data | Automated upgrade of code to python 3.7+
Done by https://github.com/asottile/pyupgrade
Consists mainly of moving string formatting to f-strings and removing
encoding declarations | https://github.com/kovidgoyal/calibre.git | def get_bookmark_data(self):
user_notes = {}
self.timestamp = os.path.getmtime(self.path)
cursor = self.db_connection.cursor()
book_query_values = (self.contentId,)
kepub_chapter_query = (
'SELECT c.ContentID, c.BookTitle, c.Title, c.VolumeIndex, c.___NumPa... | 518 | bookmark.py | Python | src/calibre/devices/kobo/bookmark.py | eb78a761a99ac20a6364f85e12059fec6517d890 | calibre | 17 | |
177,015 | 40 | 13 | 12 | 183 | 22 | 0 | 57 | 177 | assert_lca_dicts_same | Naive lowest common ancestor implementation (#5736)
* Add naive lca methods
* Naive algorithm implementation for LCA
* Modify naive lca functions
* Correct parameters of nx.ancestors
* Update lowest_common_ancestors.py
* Parametrize tests
* Apply suggestions from code review
Co-authored-by: Dan Sc... | https://github.com/networkx/networkx.git | def assert_lca_dicts_same(self, d1, d2, G=None):
if G is None:
G = self.DG
root_distance = self.root_distance
else:
roots = [n for n, deg in G.in_degree if deg == 0]
assert len(roots) == 1
root_distance = nx.shortest_path_length(G, sou... | 124 | test_lowest_common_ancestors.py | Python | networkx/algorithms/tests/test_lowest_common_ancestors.py | b2f91c34a23058dd70b41784af0d87890216026a | networkx | 6 | |
14,007 | 9 | 6 | 12 | 38 | 7 | 0 | 9 | 16 | stream | refactor: make server link to gateway so that custom gateway can inherit (#5526) | https://github.com/jina-ai/jina.git | async def stream(self, request_iterator, context=None, *args, **kwargs) -> AsyncIterator['Request']:
| 50 | gateway.py | Python | jina/serve/runtimes/gateway/grpc/gateway.py | f854d5ddc10f6d4392a7da8722482463af56be9b | jina | 2 | |
68,196 | 47 | 14 | 21 | 225 | 19 | 0 | 72 | 51 | get_actual_start_end_datetime_of_shift | refactor: consider timeslots in `get_employee_shift` | https://github.com/frappe/erpnext.git | def get_actual_start_end_datetime_of_shift(employee, for_datetime, consider_default_shift=False):
actual_shift_start = actual_shift_end = shift_details = None
shift_timings_as_per_timestamp = get_employee_shift_timings(employee, for_datetime, consider_default_shift)
timestamp_list = []
for shift in shift_timings... | 145 | shift_assignment.py | Python | erpnext/hr/doctype/shift_assignment/shift_assignment.py | 625a9f69f592be8c50c9b1bd1a16e0b7b9157988 | erpnext | 9 | |
286,290 | 25 | 14 | 7 | 130 | 12 | 0 | 41 | 76 | get_last_time_market_was_open | [SDK] Allow silencing verbose output in commands that use stocks/load (#3180)
* remove verbose on load
* Revert implementation of the verbosity setting in stocks controller
* Edit docstrings to comply with pydocstyle linting rules
* Fix typos in variable names and help text
* Add verbosity setting to forex... | https://github.com/OpenBB-finance/OpenBBTerminal.git | def get_last_time_market_was_open(dt):
# Check if it is a weekend
if dt.date().weekday() > 4:
dt = get_last_time_market_was_open(dt - timedelta(hours=24))
# Check if it is a holiday
if dt.strftime("%Y-%m-%d") in us_holidays():
dt = get_last_time_market_was_open(dt - timedelta(hours... | 77 | helper_funcs.py | Python | openbb_terminal/helper_funcs.py | 47549cbd9f52a436c06b040fda5b88a7d2bf700a | OpenBBTerminal | 3 | |
32,820 | 7 | 8 | 5 | 48 | 5 | 0 | 12 | 27 | _patch_hf_hub_tqdm | Use new huggingface_hub tools for download models (#18438)
* Draft new cached_file
* Initial draft for config and model
* Small fixes
* Fix first batch of tests
* Look in cache when internet is down
* Fix last tests
* Bad black, not fixing all quality errors
* Make diff less
* Implement change ... | https://github.com/huggingface/transformers.git | def _patch_hf_hub_tqdm():
old_tqdm = huggingface_hub.file_download.tqdm
huggingface_hub.file_download.tqdm = tqdm
yield
huggingface_hub.file_download.tqdm = old_tqdm
| 27 | hub.py | Python | src/transformers/utils/hub.py | 5cd40323684c183c30b34758aea1e877996a7ac9 | transformers | 1 | |
85,460 | 39 | 11 | 9 | 158 | 16 | 1 | 54 | 95 | test_spanner_indexer_implementation_bulk_insert_twice_gives_same_result | feat(indexer-spanner): Implementation of core api's (#37802)
Implementation of all the api's of `RawCloudSpannerIndexer`. The
`bulk_record` implementation uses DML instead of mutations. Did not
implement the `bulk_record` implementation using mutations since this PR
is already big.
The test cases run when setup ... | https://github.com/getsentry/sentry.git | def test_spanner_indexer_implementation_bulk_insert_twice_gives_same_result(testing_indexer):
record = {"org_id": 55555, "string": get_random_string(10)}
record1_int = testing_indexer.record(
use_case_id=UseCaseKey.PERFORMANCE, org_id=record["org_id"], string=record["string"]
)
# Insert th... | @patch(
"sentry.sentry_metrics.indexer.cloudspanner.cloudspanner.RawCloudSpannerIndexer._insert_collisions_handled"
)
@pytest.mark.skip(reason="TODO: Implement it correctly") | 76 | test_cloudspanner.py | Python | tests/sentry/sentry_metrics/test_cloudspanner.py | 21bf2ff99d3352c7cc8b7901fb3b4c264a71a8e8 | sentry | 1 |
176,383 | 22 | 11 | 6 | 122 | 15 | 0 | 24 | 42 | test_to_numpy_array_structured_dtype_attrs_from_fields | Add structured dtypes to `to_numpy_array` (#5324)
* Add basic test for supporting multi-attr adjacency.
* WIP: sloppy implementation of multiattr adjacency in to_numpy_array.
Conditionals could be improved.
* Reorg conditionals.
* Test to_numpy_array raises with structured dtype for multigraphs.
* Fix d... | https://github.com/networkx/networkx.git | def test_to_numpy_array_structured_dtype_attrs_from_fields(G, expected):
G.add_edge(0, 1, weight=10, cost=5.0)
dtype = np.dtype([("weight", int), ("cost", int)])
A = nx.to_numpy_array(G, dtype=dtype, weight=None)
expected = np.asarray(expected, dtype=dtype)
npt.assert_array_equal(A, expected)
| 82 | test_convert_numpy.py | Python | networkx/tests/test_convert_numpy.py | d2278b4c3402c735a31e266adde75ecc2eeb98eb | networkx | 1 | |
123,994 | 25 | 11 | 14 | 78 | 9 | 0 | 26 | 91 | _garbage_collect | [workflow] Major refactoring - new async workflow executor (#25618)
* major workflow refactoring | https://github.com/ray-project/ray.git | def _garbage_collect(self) -> None:
state = self._state
while state.free_outputs:
# garbage collect all free outputs immediately
gc_task_id = state.free_outputs.pop()
assert state.get_input(gc_task_id) is not None
state.output_map.pop(gc_task_id, ... | 47 | workflow_executor.py | Python | python/ray/workflow/workflow_executor.py | ddd63aba77b0e4da699e358beba37cd907f7cb37 | ray | 2 | |
91,381 | 26 | 12 | 14 | 198 | 30 | 0 | 32 | 142 | test_upgrade_org_config_no_dsn | ref: replace self.assertRaises with pytest.raises (#35685)
* add flake8 plugin to detect assertRaises
* ref: replace self.assertRaises with pytest.raises
* non-sed fixes | https://github.com/getsentry/sentry.git | def test_upgrade_org_config_no_dsn(self):
with self.tasks():
self.assert_setup_flow()
project_id = self.project.id
org = self.organization
data = {
"project_mappings": [[project_id, "Qme9NXBpguaRxcXssZ1NWHVaM98MAL6PHDXUs1jPrgiM8H"]]
}
in... | 118 | test_integration.py | Python | tests/sentry/integrations/vercel/test_integration.py | 284e980df0018f8baee659999268bdd4c7d08255 | sentry | 1 | |
259,862 | 25 | 13 | 10 | 131 | 20 | 0 | 27 | 69 | test_partial_fit_validate_feature_names | FIX partial_fit from SelectFromModel doesn't validate the parameters (#23299)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> | https://github.com/scikit-learn/scikit-learn.git | def test_partial_fit_validate_feature_names(as_frame):
pytest.importorskip("pandas")
X, y = datasets.load_iris(as_frame=as_frame, return_X_y=True)
selector = SelectFromModel(estimator=SGDClassifier(), max_features=4).partial_fit(
X, y, classes=[0, 1, 2]
)
if as_frame:
assert_ar... | 82 | test_from_model.py | Python | sklearn/feature_selection/tests/test_from_model.py | eace47aea7431b4b6ea08e4fb33bd73805d1f1b0 | scikit-learn | 2 | |
125,200 | 7 | 12 | 2 | 47 | 8 | 0 | 7 | 13 | _multiline_width | [State Observability] Use a table format by default (#26159)
NOTE: tabulate is copied/pasted to the codebase for table formatting.
This PR changes the default layout to be the table format for both summary and list APIs. | https://github.com/ray-project/ray.git | def _multiline_width(multiline_s, line_width_fn=len):
return max(map(line_width_fn, re.split("[\r\n]", multiline_s)))
| 27 | tabulate.py | Python | python/ray/_private/thirdparty/tabulate/tabulate.py | adf24bfa9723b0621183bb27f0c889b813c06e8a | ray | 1 | |
260,243 | 94 | 25 | 29 | 315 | 20 | 0 | 145 | 504 | validate_parameter_constraints | MNT Param validation: Allow to skip validation of a parameter (#23602) | https://github.com/scikit-learn/scikit-learn.git | def validate_parameter_constraints(parameter_constraints, params, caller_name):
if params.keys() != parameter_constraints.keys():
raise ValueError(
f"The parameter constraints {list(parameter_constraints.keys())} do not "
f"match the parameters to validate {list(params.keys())}.... | 126 | _param_validation.py | Python | sklearn/utils/_param_validation.py | d7c38282839d09676c49ac60fdd67af89d61e79c | scikit-learn | 10 | |
311,432 | 75 | 11 | 10 | 160 | 25 | 0 | 113 | 247 | _entry_from_accessory | Remove deprecated helper functions from homekit_controller pairing flow (#65270) | https://github.com/home-assistant/core.git | async def _entry_from_accessory(self, pairing):
# The bulk of the pairing record is stored on the config entry.
# A specific exception is the 'accessories' key. This is more
# volatile. We do cache it, but not against the config entry.
# So copy the pairing data and mutate the c... | 92 | config_flow.py | Python | homeassistant/components/homekit_controller/config_flow.py | cc94af2872945667d80f8f76512260ae6205d739 | core | 2 | |
269,753 | 19 | 15 | 10 | 118 | 6 | 0 | 33 | 95 | generate_benchmark_params_cpu_gpu | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def generate_benchmark_params_cpu_gpu(*params_list):
benchmark_params = []
for params in params_list:
benchmark_params.extend(
[((param[0] + "_CPU",) + param[1:]) for param in params]
)
benchmark_params.extend(
[((param[0] + "_GPU",) + param[1:]) for param in... | 74 | benchmark_util.py | Python | keras/benchmarks/benchmark_util.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 4 | |
190,115 | 30 | 10 | 24 | 217 | 21 | 0 | 48 | 272 | add_bases | Replaced renderer strings with :class:`.RendererType` enum entries (#3017)
* remove unused constants
* remove deprecated --use_opengl_renderer flag
* remove unnecessary workaround with class initialization
* add OpenGLMobject.name to get rid of one renderer check
* add VMobject.n_points_per_curve property ... | https://github.com/ManimCommunity/manim.git | def add_bases(self):
if config.renderer == RendererType.OPENGL:
color = self.color
opacity = self.opacity
elif config.renderer == RendererType.CAIRO:
color = self.fill_color
opacity = self.fill_opacity
self.base_top = Circle(
... | 144 | three_dimensions.py | Python | manim/mobject/three_d/three_dimensions.py | bd844f46d804c8cad50d06ad20ab5bebaee9987b | manim | 3 | |
290,428 | 25 | 10 | 12 | 97 | 15 | 0 | 25 | 133 | async_return_to_base | Use `_attr_` for MQTT vacuum (#81534)
* Use `_attr_` for MQTT vacuum
* Remove unneeded properties
* Follow-up comment
* Remove default value | https://github.com/home-assistant/core.git | async def async_return_to_base(self, **kwargs):
if self.supported_features & VacuumEntityFeature.RETURN_HOME == 0:
return None
await self.async_publish(
self._command_topic,
self._payloads[CONF_PAYLOAD_RETURN_TO_BASE],
self._qos,
self... | 61 | schema_legacy.py | Python | homeassistant/components/mqtt/vacuum/schema_legacy.py | b364ef98a073214aad8deff4ff9b91e9ff041557 | core | 2 | |
131,041 | 12 | 11 | 27 | 77 | 12 | 2 | 12 | 25 | test_working_dir_basic | [CI] Format Python code with Black (#21975)
See #21316 and #21311 for the motivation behind these changes. | https://github.com/ray-project/ray.git | def test_working_dir_basic(ray_start, tmp_dir, use_ray_client):
with open("hello", "w") as f:
f.write("world")
driver = | driver = """
import ray
from ray import serve
job_config = ray.job_config.JobConfig(runtime_env={{"working_dir": "."}})
if {use_ray_client}:
ray.util.connect("{client_addr}", job_config=job_config)
else:
ray.init(address="auto", job_config=job_config)@serve.deployment | 43 | test_runtime_env.py | Python | python/ray/serve/tests/test_runtime_env.py | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | ray | 1 |
259,452 | 110 | 12 | 27 | 604 | 42 | 1 | 168 | 315 | test_glm_sample_weight_consistency | ENH migrate GLMs / TweedieRegressor to linear loss (#22548)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> | https://github.com/scikit-learn/scikit-learn.git | def test_glm_sample_weight_consistency(fit_intercept, alpha, GLMEstimator):
rng = np.random.RandomState(0)
n_samples, n_features = 10, 5
X = rng.rand(n_samples, n_features)
y = rng.rand(n_samples)
glm_params = dict(alpha=alpha, fit_intercept=fit_intercept)
glm = GLMEstimator(**glm_params)... | @pytest.mark.parametrize("fit_intercept", [True, False])
@pytest.mark.parametrize(
"estimator",
[
PoissonRegressor(),
GammaRegressor(),
TweedieRegressor(power=3.0),
TweedieRegressor(power=0, link="log"),
TweedieRegressor(power=1.5),
TweedieRegressor(power=4.5),
... | 314 | test_glm.py | Python | sklearn/linear_model/_glm/tests/test_glm.py | 75a94f518f7bd7d0bf581ffb67d9f961e3c4efbc | scikit-learn | 1 |
200,594 | 182 | 22 | 107 | 1,238 | 59 | 0 | 550 | 2,634 | contract_metric | TensMul.contract_metric: correctly handle case where expr.canon_bp() == 0
Earlier, contract_metric would complain that S.Zero has no attribute
contract_metric.
https://github.com/sympy/sympy/issues/24354 | https://github.com/sympy/sympy.git | def contract_metric(self, g):
expr = self.expand()
if self != expr:
expr = expr.canon_bp()
if expr == S.Zero:
return expr
else:
return expr.contract_metric(g)
pos_map = self._get_indices_to_args_pos()
args = lis... | 788 | tensor.py | Python | sympy/tensor/tensor.py | 6f23dae79adad542f4b47f47c2e2f4d6f5bfef1c | sympy | 46 | |
32,875 | 22 | 14 | 17 | 118 | 12 | 0 | 31 | 80 | get_memory_footprint | `bitsandbytes` - `Linear8bitLt` integration into `transformers` models (#17901)
* first commit
* correct replace function
* add final changes
- works like charm!
- cannot implement tests yet
- tested
* clean up a bit
* add bitsandbytes dependencies
* working version
- added import function
- ad... | https://github.com/huggingface/transformers.git | def get_memory_footprint(self, return_buffers=True):
r
mem = sum([param.nelement() * param.element_size() for param in self.parameters()])
if return_buffers:
mem_bufs = sum([buf.nelement() * buf.element_size() for buf in self.buffers()])
mem = mem + mem_bufs
retur... | 73 | modeling_utils.py | Python | src/transformers/modeling_utils.py | 4a51075a96d2049f368b5f3dd6c0e9f08f599b62 | transformers | 4 | |
286,761 | 10 | 9 | 10 | 59 | 9 | 1 | 13 | 24 | sdk_dt_format | Fixing Forecast SDK with data from other menus (#3554)
* minor check incase using sdk
* fixes combine
* datetime formating
* Update forecast.md
* fix testing | https://github.com/OpenBB-finance/OpenBBTerminal.git | def sdk_dt_format(x) -> str:
x = pd.to_datetime(x)
x = x.strftime("%Y-%m-%d")
return x
@log_start_end(log=logger) | @log_start_end(log=logger) | 26 | forecast_model.py | Python | openbb_terminal/forecast/forecast_model.py | 7c57fb71c5bc1032dfd4ef4f3edfc74afa8c0a2e | OpenBBTerminal | 1 |
304,033 | 6 | 6 | 3 | 21 | 4 | 0 | 6 | 12 | _get_manager | Rework bluetooth to support scans from multiple sources (#76900) | https://github.com/home-assistant/core.git | def _get_manager() -> BluetoothManager:
return models.MANAGER
| 11 | __init__.py | Python | tests/components/bluetooth/__init__.py | 3bcc274dfa90d7d3c01ace83137c46a0898c107f | core | 1 | |
320,776 | 78 | 18 | 41 | 494 | 38 | 0 | 114 | 608 | completion_item_focus | mypy: Upgrade to PyQt5-stubs 5.15.6.0
For some unknown reason, those new stubs cause a *lot* of things now to be
checked by mypy which formerly probably got skipped due to Any being implied
somewhere.
The stubs themselves mainly improved, with a couple of regressions too.
In total, there were some 337 (!) new mypy e... | https://github.com/qutebrowser/qutebrowser.git | def completion_item_focus(self, which, history=False):
if history:
if (self._cmd.text() == ':' or self._cmd.history.is_browsing() or
not self._active):
if which == 'next':
self._cmd.command_history_next()
return
... | 292 | completionwidget.py | Python | qutebrowser/completion/completionwidget.py | a20bb67a878b2e68abf8268c1b0a27f018d01352 | qutebrowser | 14 | |
291,932 | 102 | 18 | 51 | 564 | 53 | 0 | 170 | 866 | async_send_message | Replace discord.py with nextcord (#66540)
* Replace discord.py with nextcord
* Typing tweak
* Another pip check decrease :) | https://github.com/home-assistant/core.git | async def async_send_message(self, message, **kwargs):
nextcord.VoiceClient.warn_nacl = False
discord_bot = nextcord.Client()
images = None
embedding = None
if ATTR_TARGET not in kwargs:
_LOGGER.error("No target specified")
return None
d... | 347 | notify.py | Python | homeassistant/components/discord/notify.py | cb03db8df4bf8b50945b36a4b0debcaaed1190a8 | core | 19 | |
260,724 | 52 | 13 | 26 | 251 | 32 | 0 | 71 | 310 | fit | MAINT Parameter Validation for Lars, LarsCV, LassoLars, LassoLarsCV and LassoLarsIC (#24033)
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr> | https://github.com/scikit-learn/scikit-learn.git | def fit(self, X, y, Xy=None):
self._validate_params()
X, y = self._validate_data(X, y, y_numeric=True, multi_output=True)
_normalize = _deprecate_normalize(
self.normalize, default=True, estimator_name=self.__class__.__name__
)
alpha = getattr(self, "alpha... | 169 | _least_angle.py | Python | sklearn/linear_model/_least_angle.py | 6c0e0b2e4723d11e29057635c7061a36bc1a8512 | scikit-learn | 3 | |
290,687 | 8 | 6 | 137 | 23 | 5 | 0 | 8 | 14 | test_statistic_during_period_hole | Fix statistic_during_period for data with holes (#81847) | https://github.com/home-assistant/core.git | async def test_statistic_during_period_hole(recorder_mock, hass, hass_ws_client):
id = 1
| 900 | test_websocket_api.py | Python | tests/components/recorder/test_websocket_api.py | 9b8f94363c0b4ecd1434ac1ac3bb82febd3889d0 | core | 17 | |
111,333 | 61 | 17 | 19 | 260 | 27 | 0 | 100 | 356 | set_annotations | Add SpanRuler component (#9880)
* Add SpanRuler component
Add a `SpanRuler` component similar to `EntityRuler` that saves a list
of matched spans to `Doc.spans[spans_key]`. The matches from the token
and phrase matchers are deduplicated and sorted before assignment but
are not otherwise filtered.
* Update spa... | https://github.com/explosion/spaCy.git | def set_annotations(self, doc, matches):
entities = list(doc.ents)
new_entities = []
seen_tokens = set()
for match_id, start, end in matches:
if any(t.ent_type for t in doc[start:end]) and not self.overwrite:
continue
# check for end - 1 h... | 171 | entityruler.py | Python | spacy/pipeline/entityruler.py | a322d6d5f2f85c2da6cded4fcd6143d41b5a9e96 | spaCy | 11 | |
166,951 | 8 | 9 | 2 | 61 | 9 | 1 | 8 | 13 | data_missing | DOC: Added docstrings to fixtures defined in array module (#47211) | https://github.com/pandas-dev/pandas.git | def data_missing(dtype):
return pd.array([np.nan, 1], dtype=dtype)
@pytest.fixture(params=["data", "data_missing"]) | @pytest.fixture(params=["data", "data_missing"]) | 23 | conftest.py | Python | pandas/tests/arrays/integer/conftest.py | 89be1f053b695c4ce1c0569f737caf3f03c12128 | pandas | 1 |
124,040 | 51 | 12 | 24 | 174 | 18 | 0 | 64 | 268 | save | [RLlib] Save serialized PolicySpec. Extract `num_gpus` related logics into a util function. (#25954) | https://github.com/ray-project/ray.git | def save(self) -> bytes:
filters = self.get_filters(flush_after=True)
state = {}
policy_specs = {}
connector_enabled = self.policy_config.get("enable_connectors", False)
for pid in self.policy_map:
state[pid] = self.policy_map[pid].get_state()
pol... | 106 | rollout_worker.py | Python | rllib/evaluation/rollout_worker.py | d83bbda2816b1781eb61342b4539578149eeb686 | ray | 3 | |
276,780 | 40 | 13 | 15 | 176 | 27 | 0 | 48 | 181 | test_get_file_with_failed_integrity_check | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def test_get_file_with_failed_integrity_check(self):
orig_dir = self.get_temp_dir()
file_path = os.path.join(orig_dir, "test.txt")
with open(file_path, "w") as text_file:
text_file.write("Float like a butterfly, sting like a bee.")
hashval = "0" * 64
origi... | 100 | data_utils_test.py | Python | keras/utils/data_utils_test.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 1 | |
266,327 | 65 | 14 | 14 | 215 | 17 | 0 | 88 | 231 | _get_user_property | user: Update logic to check if user exists in macOS (#76592)
'dscl -list' returns 0 even if the user does not exists. This
leads to errorenous condition in user module.
Using 'dscl -read UniqueID' can return if user exists or not.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> | https://github.com/ansible/ansible.git | def _get_user_property(self, property):
cmd = self._get_dscl()
cmd += ['-read', '/Users/%s' % self.name, property]
(rc, out, err) = self.execute_command(cmd, obey_checkmode=False)
if rc != 0:
return None
# from dscl(1)
# if property contains embedded ... | 130 | user.py | Python | lib/ansible/modules/user.py | 66e392d4e219bf93d690c1fb3d3c854069efa27f | ansible | 5 | |
256,951 | 12 | 9 | 6 | 50 | 8 | 0 | 12 | 21 | is_telemetry_enabled | Add basic telemetry features (#2314)
* add basic telemetry features
* change pipeline_config to _component_config
* Update Documentation & Code Style
* add super().__init__() calls to error classes
* make posthog mock work with python 3.7
* Update Documentation & Code Style
* update link to docs web ... | https://github.com/deepset-ai/haystack.git | def is_telemetry_enabled() -> bool:
telemetry_environ = os.environ.get(HAYSTACK_TELEMETRY_ENABLED, "True")
return telemetry_environ.lower() != "false"
| 27 | telemetry.py | Python | haystack/telemetry.py | ac5617e757e9ace6f30b7291686d9dbbc339f433 | haystack | 1 | |
150,410 | 14 | 10 | 7 | 100 | 8 | 0 | 17 | 66 | start_leader_mode | initial concept for replicate, basic leader and follower logic | https://github.com/freqtrade/freqtrade.git | def start_leader_mode(self):
logger.info("Running rpc.replicate in Leader mode")
logger.info("-" * 15)
logger.info(f"API_KEY: {self.secret_api_key}")
logger.info("-" * 15)
self.register_leader_endpoint()
self.submit_coroutine(self.leader_loop())
| 50 | __init__.py | Python | freqtrade/rpc/replicate/__init__.py | 9f6bba40af1a407f190a89f5c0c8b4e3f528ba46 | freqtrade | 1 | |
297,518 | 58 | 15 | 23 | 216 | 39 | 0 | 71 | 288 | async_get_measures | Refactor withings constant (#84095)
Split withings constant | https://github.com/home-assistant/core.git | async def async_get_measures(self) -> dict[Measurement, Any]:
_LOGGER.debug("Updating withings measures")
now = dt.utcnow()
startdate = now - datetime.timedelta(days=7)
response = await self._hass.async_add_executor_job(
self._api.measure_get_meas, None, None, start... | 144 | common.py | Python | homeassistant/components/withings/common.py | c51c8f7e8f4b9ede57a0fbbec0d74023d87d553e | core | 4 | |
36,057 | 14 | 11 | 5 | 67 | 9 | 0 | 19 | 42 | softmax_backward_data | DeBERTa/DeBERTa-v2/SEW Support for torch 1.11 (#16043)
* Support for torch 1.11
* Address Sylvain's comment | https://github.com/huggingface/transformers.git | def softmax_backward_data(parent, grad_output, output, dim, self):
if is_torch_less_than_1_11:
return _softmax_backward_data(grad_output, output, parent.dim, self)
else:
return _softmax_backward_data(grad_output, output, parent.dim, self.dtype)
| 47 | pytorch_utils.py | Python | src/transformers/pytorch_utils.py | e66743e6c9601a4b12ffc2335a9f60a41d1ca60c | transformers | 2 | |
133,852 | 48 | 20 | 30 | 293 | 27 | 0 | 74 | 452 | build_q_model | [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 build_q_model(self, obs_space, action_space, num_outputs, q_model_config, name):
self.concat_obs_and_actions = False
if self.discrete:
input_space = obs_space
else:
orig_space = getattr(obs_space, "original_space", obs_space)
if isinstance(orig_sp... | 189 | sac_torch_model.py | Python | rllib/agents/sac/sac_torch_model.py | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | ray | 6 | |
20,609 | 96 | 26 | 53 | 627 | 48 | 0 | 164 | 615 | _makeTags | 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 _makeTags(tagStr, xml, suppress_LT=Suppress("<"), suppress_GT=Suppress(">")):
if isinstance(tagStr, str_type):
resname = tagStr
tagStr = Keyword(tagStr, caseless=not xml)
else:
resname = tagStr.name
tagAttrName = Word(alphas, alphanums + "_-:")
if xml:
tagAttrVa... | 365 | helpers.py | Python | pipenv/patched/notpip/_vendor/pyparsing/helpers.py | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | pipenv | 3 | |
309,622 | 35 | 13 | 13 | 168 | 18 | 0 | 42 | 169 | async_send_message | Add LG webOS Smart TV config flow support (#64117)
* Add webOS Smart TV config flow support (#53256)
* Add Webostv config flow
* Fix tests mocks and apply review comments
* Apply review comments
* Change config flow to use ssdp UDN as unique_id
* Fix device info
* More review comments
* Fix _async... | https://github.com/home-assistant/core.git | async def async_send_message(self, message="", **kwargs):
try:
if not self._client.is_connected():
await self._client.connect()
data = kwargs.get(ATTR_DATA)
icon_path = data.get(CONF_ICON, "") if data else None
await self._client.send_mes... | 97 | notify.py | Python | homeassistant/components/webostv/notify.py | dee843bf6e5ca84a94f336a239f6a6138c4c28e6 | core | 6 | |
133,550 | 3 | 6 | 20 | 15 | 3 | 0 | 3 | 6 | run_task_workload | [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 run_task_workload(total_num_cpus, smoke):
| 131 | test_chaos_basic.py | Python | release/nightly_tests/chaos_test/test_chaos_basic.py | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | ray | 3 | |
248,367 | 81 | 13 | 27 | 256 | 25 | 0 | 106 | 442 | test_do_not_prune_gap_if_state_different | Pull out less state when handling gaps mk2 (#12852) | https://github.com/matrix-org/synapse.git | def test_do_not_prune_gap_if_state_different(self):
# Fudge a second event which points to an event we don't have.
remote_event_2 = event_from_pdu_json(
{
"type": EventTypes.Message,
"state_key": "@user:other",
"content": {},
... | 149 | test_events.py | Python | tests/storage/test_events.py | b83bc5fab57b37f75a79d02213d6032c586fd36e | synapse | 1 | |
190,708 | 17 | 11 | 4 | 63 | 7 | 0 | 18 | 43 | test_allow_ordered_sequences_only | Disallow unordered sequences in pytest.approx (#9709)
Fix #9692 | https://github.com/pytest-dev/pytest.git | def test_allow_ordered_sequences_only(self) -> None:
with pytest.raises(TypeError, match="only supports ordered sequences"):
assert {1, 2, 3} == approx({1, 2, 3})
| 39 | approx.py | Python | testing/python/approx.py | 5f3d94c47eb0f4487ef52ac520b3c48170220fc6 | pytest | 1 | |
128,593 | 62 | 11 | 29 | 337 | 33 | 0 | 92 | 206 | test_remove_node_before_result | [tune] Store sync config/checkpoint config in experiment, trial (#29019)
This is some clean-up required for future changes to the syncing/checkpointing behavior. At the moment we pass single attributes of these configs to the Experiment class, and then subsequently to the Trial class, from which it is passed on to the... | https://github.com/ray-project/ray.git | def test_remove_node_before_result(start_connected_emptyhead_cluster):
cluster = start_connected_emptyhead_cluster
node = cluster.add_node(num_cpus=1)
cluster.wait_for_nodes()
runner = TrialRunner(BasicVariantGenerator())
kwargs = {
"stopping_criterion": {"training_iteration": 3},
... | 195 | test_cluster.py | Python | python/ray/tune/tests/test_cluster.py | e142be077f0c727ab11ba51ecaba9a98b7bfe474 | ray | 2 | |
181,624 | 11 | 9 | 10 | 58 | 10 | 0 | 13 | 26 | test_generate_import_code | Revert "Deployed 7ccda9a with MkDocs version: 1.3.0"
This reverts commit bd9629c40e01241766197119b581a99409b07068. | https://github.com/EpistasisLab/tpot.git | def test_generate_import_code():
pipeline = creator.Individual.from_string('GaussianNB(RobustScaler(input_matrix))', tpot_obj._pset)
expected_code =
assert expected_code == generate_import_code(pipeline, tpot_obj.operators)
| 33 | export_tests.py | Python | tests/export_tests.py | 388616b6247ca4ea8de4e2f340d6206aee523541 | tpot | 1 | |
83,384 | 45 | 13 | 30 | 275 | 32 | 0 | 59 | 270 | test_subscriptions_add_notification_default_none | stream_settings: Show stream privacy & description in stream events.
Provide stream privacy and description in stream notification events
when stream is created.
In function "send_messages_for_new_subscribers" for when stream is
created, put policy name and description of the stream.
Fixes #21004 | https://github.com/zulip/zulip.git | def test_subscriptions_add_notification_default_none(self) -> None:
user_profile = self.example_user("iago")
invitee_user_id = user_profile.id
invitee_realm = user_profile.realm
user_profile.enable_stream_desktop_notifications = True
user_profile.enable_stream_push_notif... | 157 | test_subs.py | Python | zerver/tests/test_subs.py | 4b9770e270823b7ed2bbbeda0e4450f0ba6a288b | zulip | 1 | |
154,378 | 63 | 14 | 20 | 176 | 21 | 1 | 82 | 282 | eval_to_file | TEST-#4879: Use pandas `ensure_clean()` in place of `io_tests_data` (#4881)
Signed-off-by: Karthik Velayutham <vkarthik@ponder.io> | https://github.com/modin-project/modin.git | def eval_to_file(modin_obj, pandas_obj, fn, extension, **fn_kwargs):
with ensure_clean_dir() as dirname:
unique_filename_modin = get_unique_filename(
extension=extension, data_dir=dirname
)
unique_filename_pandas = get_unique_filename(
extension=extension, data_d... | @pytest.fixture | 104 | test_io.py | Python | modin/pandas/test/test_io.py | 5086a9ea37bc37e6e58da0ceaf5864b16cc8e0ed | modin | 3 |
89,030 | 6 | 8 | 38 | 25 | 5 | 0 | 6 | 12 | resolve_condition | perf(issue-search): optimize querying on perf issues by using hasAny on transaction.group_id (#41685)
Special optimization for searching on transactions for performance
issues by doing a `hasAny` check instead of arrayJoining `group_ids`
column and applying a filter after.
before query:
```
SELECT (arrayJoin(... | https://github.com/getsentry/sentry.git | def resolve_condition(cond, column_resolver):
index = get_function_index(cond)
| 312 | snuba.py | Python | src/sentry/utils/snuba.py | 1bcb129d69a6c4e481b950ebc5871e9c118db74f | sentry | 17 | |
265,190 | 50 | 14 | 13 | 206 | 19 | 0 | 68 | 156 | prepare_cloned_fields | Closes #9414: Add clone() method to NetBoxModel for copying instance attributes | https://github.com/netbox-community/netbox.git | def prepare_cloned_fields(instance):
# Generate the clone attributes from the instance
if not hasattr(instance, 'clone'):
return None
attrs = instance.clone()
# Prepare querydict parameters
params = []
for key, value in attrs.items():
if type(value) in (list, tuple):
... | 122 | utils.py | Python | netbox/utilities/utils.py | f9d81fd36232e9bf3f60a215d2c6a405b9b342fb | netbox | 7 | |
144,307 | 17 | 11 | 17 | 113 | 12 | 0 | 25 | 112 | _get_toplevel_child_nodes | [Ray DAG] Implement experimental Ray DAG API for task/class (#22058) | https://github.com/ray-project/ray.git | def _get_toplevel_child_nodes(self) -> Set["DAGNode"]:
children = set()
for a in self.get_args():
if isinstance(a, DAGNode):
children.add(a)
for a in self.get_kwargs().values():
if isinstance(a, DAGNode):
children.add(a)
r... | 68 | dag_node.py | Python | python/ray/experimental/dag/dag_node.py | c065e3f69ec248383d98b45a8d1c00832ccfdd57 | ray | 5 | |
272,020 | 138 | 24 | 84 | 539 | 40 | 0 | 325 | 2,133 | _validate_or_infer_batch_size | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | https://github.com/keras-team/keras.git | def _validate_or_infer_batch_size(self, batch_size, steps, x):
if isinstance(
x, (tf.compat.v1.data.Dataset, tf.data.Dataset, data_utils.Sequence)
) or tf_inspect.isgenerator(x):
if batch_size is not None:
raise ValueError(
"The `batch... | 330 | training_v1.py | Python | keras/engine/training_v1.py | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | keras | 18 | |
19,898 | 44 | 12 | 16 | 112 | 14 | 0 | 52 | 160 | requires_python | 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 requires_python(self) -> SpecifierSet:
value = self.metadata.get("Requires-Python")
if value is None:
return SpecifierSet()
try:
# Convert to str to satisfy the type checker; this can be a Header object.
spec = SpecifierSet(str(value))
exc... | 64 | base.py | Python | pipenv/patched/notpip/_internal/metadata/base.py | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | pipenv | 3 | |
189,464 | 18 | 13 | 5 | 61 | 9 | 0 | 20 | 59 | _attribute_to_float | 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 _attribute_to_float(self, attr):
stripped_attr = "".join(
[char for char in attr if char in string.digits + ".-e"],
)
return float(stripped_attr)
| 36 | svg_mobject.py | Python | manim/mobject/svg/svg_mobject.py | 902e7eb4f0147b5882a613b67467e38a1d47f01e | manim | 3 | |
120,755 | 76 | 18 | 27 | 287 | 26 | 0 | 96 | 246 | test_converters | [jax2tf] Rewrites the converters_eval framework and makes various improvements.
The most visible change is that we are now outputting a single table with models to test as rows, and the converters that are being tested as columns. This allows us to compare converters much easier: [NEW OUTPUT](https://github.com/google... | https://github.com/google/jax.git | def test_converters():
results = {}
converters = {x: CONVERTERS[x] for x in FLAGS.converters}
for example_name, test_case_fn in get_test_cases().items():
if FLAGS.examples and example_name not in FLAGS.examples:
continue
test_case = test_case_fn() # This will create the model's variables.
c... | 169 | models_test.py | Python | jax/experimental/jax2tf/converters_eval/models_test.py | 1ecfe05a9e1e8e7b261ceb9c0b03a4ee48dee5b1 | jax | 10 | |
247,159 | 27 | 12 | 12 | 142 | 10 | 0 | 33 | 169 | test_check_for_extra_dependencies | Use importlib.metadata to read requirements (#12088)
* Pull runtime dep checks into their own module
* Reimplement `check_requirements` using `importlib`
I've tried to make this clearer. We start by working out which of
Synapse's requirements we need to be installed here and now. I was
surprised that there wasn'... | https://github.com/matrix-org/synapse.git | def test_check_for_extra_dependencies(self) -> None:
with patch(
"synapse.util.check_dependencies.metadata.requires",
return_value=["dummypkg >= 1; extra == 'cool-extra'"],
), patch("synapse.util.check_dependencies.EXTRAS", {"cool-extra"}):
with self.mock_ins... | 77 | test_check_dependencies.py | Python | tests/util/test_check_dependencies.py | 313581e4e9bc2ec3d59ccff86e3a0c02661f71c4 | synapse | 1 | |
288,093 | 11 | 11 | 4 | 43 | 5 | 0 | 12 | 44 | _fmt_dewpoint | Use unit_conversion in components (#79204)
* Use unit_conversion in components
* Two more | https://github.com/home-assistant/core.git | def _fmt_dewpoint(dewpoint):
if dewpoint is not None:
return round(TemperatureConverter.kelvin_to_celsius(dewpoint), 1)
return None
| 26 | weather_update_coordinator.py | Python | homeassistant/components/openweathermap/weather_update_coordinator.py | 24c26dc03267da84e3c17d747ecb7143b54e8489 | core | 2 | |
44,241 | 6 | 6 | 16 | 23 | 4 | 0 | 6 | 20 | get_ui_field_behaviour | Add optional features in providers. (#21074)
Some features in providers can be optional, depending on the
presence of some libraries. Since Providers Manager tries
to import the right classes that are exposed via providers it
should not - in this case - log warning message for those
optional features. Previously, ... | https://github.com/apache/airflow.git | def get_ui_field_behaviour() -> Dict[str, Any]:
...
| 13 | base.py | Python | airflow/hooks/base.py | cb73053211367e2c2dd76d5279cdc7dc7b190124 | airflow | 1 | |
64,212 | 49 | 13 | 35 | 298 | 20 | 0 | 86 | 63 | get_gl_entries | patch: Removed files and code related to old distributed cost center feature | https://github.com/frappe/erpnext.git | def get_gl_entries(filters, accounting_dimensions):
currency_map = get_currency(filters)
select_fields =
order_by_statement = "order by posting_date, account, creation"
if filters.get("include_dimensions"):
order_by_statement = "order by posting_date, creation"
if filters.get("group_by") == "Group by Voucher... | 166 | general_ledger.py | Python | erpnext/accounts/report/general_ledger/general_ledger.py | 3dadfc9048d804e097ebfe6801802f2c980e04a7 | erpnext | 7 | |
112,954 | 12 | 9 | 10 | 51 | 6 | 0 | 14 | 30 | silence_stdout | Logging refactor (step 1) - experiment handlers (#4792) | https://github.com/microsoft/nni.git | def silence_stdout() -> None:
handler = _handlers.pop('_stdout_', None)
if handler is not None:
_root_logger.removeHandler(handler)
| 29 | log.py | Python | nni/runtime/log.py | 4feab0e34b490500b06efd6e7e8a34d686702c2f | nni | 2 | |
22,604 | 11 | 8 | 19 | 73 | 11 | 0 | 11 | 17 | indiac | refactor: clean code
Signed-off-by: slowy07 <slowy.arfy@gmail.com> | https://github.com/geekcomputers/Python.git | def indiac():
cases = f
print(cases)
print(
)
print("\nDeveloped By @TheDarkW3b")
| 12 | coronacases.py | Python | coronacases.py | f0af0c43340763724f139fa68aa1e5a9ffe458b4 | Python | 1 | |
337,632 | 22 | 9 | 6 | 83 | 10 | 0 | 26 | 43 | load_training_checkpoint | DeepSpeed Revamp (#405)
* deepspeed revamp
* Update dataclasses.py
* Update deepspeed.py
* quality
* fixing code
* quality
* FIx imports
* saving 16bit model in zero stage 3
1. Saving 16bit model in zero stage 3
2. zero init in stage 3 support using HFDeepSpeedConfig
* quality
* adding test and fixing bugs
... | https://github.com/huggingface/accelerate.git | def load_training_checkpoint(model, load_dir, tag=None, **kwargs):
_, checkpoint_state_dict = model.load_checkpoint(load_dir, tag=tag, **kwargs)
epoch = checkpoint_state_dict["epoch"]
last_global_step = checkpoint_state_dict["last_global_step"]
del checkpoint_state_dict
return (epoch, last_glob... | 52 | deepspeed_with_config_support.py | Python | examples/by_feature/deepspeed_with_config_support.py | 1703b79a797dab765996764707186def7533d8fd | accelerate | 1 | |
129,422 | 4 | 7 | 17 | 20 | 3 | 0 | 4 | 11 | test_actor_task_stacktrace | [Part 5] Set actor died error message in ActorDiedError (#20903)
This is the second last PR to improve `ActorDiedError` exception.
This propagates Actor death cause metadata to the ray error object. In this way, we can raise a better actor died error exception.
After this PR is merged, I will add more metadata ... | https://github.com/ray-project/ray.git | def test_actor_task_stacktrace(ray_start_regular):
expected_output =
| 63 | test_traceback.py | Python | python/ray/tests/test_traceback.py | 5514711a3506f9e2675786b13b78c8f10a008f34 | ray | 2 | |
244,143 | 47 | 14 | 16 | 217 | 25 | 0 | 80 | 249 | forward_head | [Feature] Add Mask2Former to mmdet (#6938)
update doc
update doc format
deepcopy pixel_decoder cfg
move mask_pseudo_sampler cfg to config file
move part of postprocess from head to detector
fix bug in postprocessing
move class setting from head to config file
remove if else
move mask2bbox to ma... | https://github.com/open-mmlab/mmdetection.git | def forward_head(self, decoder_out, mask_feature, attn_mask_target_size):
decoder_out = self.transformer_decoder.post_norm(decoder_out)
decoder_out = decoder_out.transpose(0, 1)
# shape (num_queries, batch_size, c)
cls_pred = self.cls_embed(decoder_out)
# shape (num_quer... | 137 | mask2former_head.py | Python | mmdet/models/dense_heads/mask2former_head.py | 14f0e9585c15c28f0c31dcc3ea352449bbe5eb96 | mmdetection | 1 | |
267,950 | 25 | 8 | 7 | 77 | 10 | 1 | 27 | 73 | close | 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 close(self) -> None:
if not self.process:
return # forwarding not in use
self.process.terminate()
display.info('Waiting for the session SSH port forwarding process to terminate.', verbosity=1)
self.process.wait()
@contextlib.contextmanager | @contextlib.contextmanager | 39 | containers.py | Python | test/lib/ansible_test/_internal/containers.py | 3eb0485dd92c88cc92152d3656d94492db44b183 | ansible | 2 |
101,421 | 13 | 9 | 5 | 57 | 11 | 0 | 14 | 42 | _random_choice | 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 _random_choice(self) -> List[int]:
retval = [random.choice(indices) for indices in self._indices]
logger.debug(retval)
return retval
| 35 | preview.py | Python | tools/preview/preview.py | 1022651eb8a7741014f5d2ec7cbfe882120dfa5f | faceswap | 2 | |
4,880 | 10 | 6 | 12 | 32 | 7 | 0 | 10 | 24 | check_connection | python generators output `spec.yaml` files (#12245)
* generators output spec.yaml files
* source-singer generator also uses spec.yaml
* update scaffold
* update python cdk tutorials to use spec.yaml
* add docs updates
* consistency | https://github.com/airbytehq/airbyte.git | def check_connection(self, logger, config) -> Tuple[bool, any]:
return True, None
| 21 | source.py | Python | airbyte-integrations/connectors/source-scaffold-source-http/source_scaffold_source_http/source.py | 0c12ad9136d992cde35e3975ad6056669188554c | airbyte | 1 | |
189,525 | 20 | 13 | 9 | 112 | 17 | 0 | 25 | 71 | extract_face_coords | Upgraded typehints (#2429)
* Future Annotations
* Delete template_twitter_post.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Apply sugge... | https://github.com/ManimCommunity/manim.git | def extract_face_coords(self) -> list[list[np.ndarray]]:
new_vertex_coords = []
for v in self.graph.vertices:
new_vertex_coords.append(self.graph[v].get_center())
layout = dict(enumerate(new_vertex_coords))
return [[layout[j] for j in i] for i in self.faces_list]
| 72 | polyhedra.py | Python | manim/mobject/polyhedra.py | daf23c9d1031b12d9c119b8f6b7e60727d7f9242 | manim | 4 | |
89,805 | 8 | 6 | 6 | 22 | 3 | 0 | 8 | 22 | get_integration | 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_integration(self) -> Integration | None:
return None
| 12 | base.py | Python | src/sentry/middleware/integrations/parsers/base.py | d8609112d6e2f373692b414acff6d4a2f7466750 | sentry | 1 | |
106,355 | 92 | 15 | 33 | 604 | 44 | 0 | 121 | 404 | get | [utils, etc] Kill child processes when yt-dl is killed
* derived from PR #26592, closes #26592
Authored by: Unrud | https://github.com/ytdl-org/youtube-dl.git | def get(self, url, html=None, video_id=None, note=None, note2='Executing JS on webpage', headers={}, jscode='saveAndExit();'):
if 'saveAndExit();' not in jscode:
raise ExtractorError('`saveAndExit();` not found in `jscode`')
if not html:
html = self.extractor._download_w... | 352 | openload.py | Python | youtube_dl/extractor/openload.py | 0700fde6403aa9eec1ff02bff7323696a205900c | youtube-dl | 7 | |
293,766 | 15 | 10 | 7 | 66 | 8 | 0 | 15 | 48 | test_lazy_state_prefers_shared_attrs_over_attrs | Separate attrs into another table (reduces database size) (#68224) | https://github.com/home-assistant/core.git | async def test_lazy_state_prefers_shared_attrs_over_attrs(caplog):
row = PropertyMock(
entity_id="sensor.invalid",
shared_attrs='{"shared":true}',
attributes='{"shared":false}',
)
assert LazyState(row).attributes == {"shared": True}
| 36 | test_models.py | Python | tests/components/recorder/test_models.py | 9215702388eef03c7c3ed9f756ea0db533d5beec | core | 1 | |
213,056 | 57 | 15 | 25 | 326 | 18 | 0 | 88 | 319 | _add_iam_resource_policy_for_method | 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_iam_resource_policy_for_method(self, policy_list, effect, resource_list):
if not policy_list:
return
if effect not in ["Allow", "Deny"]:
raise ValueError("Effect must be one of {}".format(["Allow", "Deny"]))
if not isinstance(policy_list, (dict, list))... | 187 | swagger.py | Python | samtranslator/swagger/swagger.py | a5db070f446b7cfebdaa6ad2e3dcf78f6105a272 | serverless-application-model | 7 | |
163,143 | 94 | 21 | 48 | 427 | 49 | 0 | 115 | 840 | write_file | DOC: improve IO & General Functions API reference (#45208) | https://github.com/pandas-dev/pandas.git | def write_file(self) -> None:
with get_handle(
self._fname,
"wb",
compression=self._compression,
is_text=False,
storage_options=self.storage_options,
) as self.handles:
if self.handles.compression["method"] is not None:
... | 251 | stata.py | Python | pandas/io/stata.py | fa3dfdb41f0a75c937e85059a5983da5e5d5aac6 | pandas | 6 | |
309,489 | 9 | 8 | 3 | 43 | 9 | 0 | 9 | 30 | delete | Import frontend (#64104)
Co-authored-by: epenet <epenet@users.noreply.github.com> | https://github.com/home-assistant/core.git | async def delete(self, request, addon):
frontend.async_remove_panel(self.hass, addon)
return web.Response()
| 26 | addon_panel.py | Python | homeassistant/components/hassio/addon_panel.py | 946238fb02bc484328603625abf106486b8e6c4a | core | 1 | |
81,148 | 87 | 15 | 14 | 193 | 23 | 0 | 108 | 249 | job_stats_wrapup | Fix notification timing issue by sending in the latter of 2 events (#12110)
* Track host_status_counts and use that to process notifications
* Remove now unused setting
* Back out changes to callback class not needed after all
* Skirt the need for duck typing by leaning on the cached field
* Delete tests f... | https://github.com/ansible/awx.git | def job_stats_wrapup(job_identifier, event=None):
try:
# empty dict (versus default of None) can still indicate that events have been processed
# for job types like system jobs, and jobs with no hosts matched
host_status_counts = {}
if event:
host_status_counts = eve... | 106 | callback.py | Python | awx/main/dispatch/worker/callback.py | 29d60844a8cee16bcd31657cecc444a692ade689 | awx | 5 | |
246,128 | 18 | 12 | 15 | 127 | 9 | 0 | 24 | 161 | test_avatar_constraints_file_size | Configurable limits on avatars (#11846)
Only allow files which file size and content types match configured
limits to be set as avatar.
Most of the inspiration from the non-test code comes from matrix-org/synapse-dinsic#19 | https://github.com/matrix-org/synapse.git | def test_avatar_constraints_file_size(self):
self._setup_local_files(
{
"small": {"size": 40},
"big": {"size": 60},
}
)
res = self.get_success(
self.handler.check_avatar_size_and_mime_type("mxc://test/small")
)... | 71 | test_profile.py | Python | tests/handlers/test_profile.py | bf60da1a60096fac5fb778b732ff2214862ac808 | synapse | 1 | |
104,183 | 29 | 13 | 13 | 116 | 18 | 0 | 30 | 87 | from_directory | Run pyupgrade for Python 3.6+ (#3560)
* Run pyupgrade for Python 3.6+
* Fix lint issues
* Revert changes for the datasets code
Co-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com> | https://github.com/huggingface/datasets.git | def from_directory(cls, metric_info_dir) -> "MetricInfo":
logger.info(f"Loading Metric info from {metric_info_dir}")
if not metric_info_dir:
raise ValueError("Calling MetricInfo.from_directory() with undefined metric_info_dir.")
with open(os.path.join(metric_info_dir, confi... | 64 | info.py | Python | src/datasets/info.py | 21bfd0d3f5ff3fbfd691600e2c7071a167816cdf | datasets | 2 | |
109,421 | 4 | 6 | 2 | 19 | 3 | 0 | 4 | 18 | get_boxstyle | Harmonize docstrings for boxstyle/connectionstyle/arrowstyle.
- Rely on `__init_subclass__` to avoid the need for the out-of-order
`interpd.update`/`dedent_interpd`.
- Use consistent wording for all setters, and add ACCEPTS list in all
cases.
- Move get_boxstyle right next to set_boxstyle (consistently with the
... | https://github.com/matplotlib/matplotlib.git | def get_boxstyle(self):
return self._bbox_transmuter
| 10 | patches.py | Python | lib/matplotlib/patches.py | 0dc472b4c7cdcc1e88228988fff17762c90f1cb9 | matplotlib | 1 | |
316,274 | 24 | 14 | 7 | 122 | 16 | 0 | 28 | 53 | test_key_error | Search/replace RESULT_TYPE_* by FlowResultType enum (#74642) | https://github.com/home-assistant/core.git | async def test_key_error(hass):
flow = config_flow.SomaFlowHandler()
flow.hass = hass
with patch.object(SomaApi, "list_devices", return_value={}):
result = await flow.async_step_import({"host": MOCK_HOST, "port": MOCK_PORT})
assert result["type"] == data_entry_flow.FlowResultType.ABORT
... | 68 | test_config_flow.py | Python | tests/components/soma/test_config_flow.py | 7cd68381f1d4f58930ffd631dfbfc7159d459832 | core | 1 | |
212,687 | 37 | 11 | 10 | 101 | 14 | 0 | 50 | 139 | fonts_installed_list | Added Text.fonts_installed_list - returns the fonts installed as reported by tkinter. | https://github.com/PySimpleGUI/PySimpleGUI.git | def fonts_installed_list(cls):
# if no windows have been created (there is no hidden master root to rely on) then temporarily make a window so the measurement can happen
if Window.hidden_master_root is None:
root = tk.Tk()
else:
root = Window.hidden_master_root
... | 58 | PySimpleGUI.py | Python | PySimpleGUI.py | 81599f643bae6867c29cf2006e6110b9f2265f5e | PySimpleGUI | 3 | |
337,710 | 38 | 16 | 13 | 129 | 12 | 0 | 58 | 219 | del_config_sub_tree | Migrate HFDeepSpeedConfig from trfrs to accelerate (#432)
* Migrate HFDeepSpeedConfig from trfrs to accelerate
* update state.py to resolve comments
1. Adds static method to have a simple API for integrating deepspeed config in transformers trainer.
* reverting changes and addressing comments
* Marking Dep... | https://github.com/huggingface/accelerate.git | def del_config_sub_tree(self, ds_key_long, must_exist=False):
config = self.config
# find the config node of interest if it exists
nodes = ds_key_long.split(".")
for node in nodes:
parent_config = config
config = config.get(node)
if config is... | 70 | deepspeed.py | Python | src/accelerate/utils/deepspeed.py | 873dcc63a461558152eec20af991482204e8248f | accelerate | 5 | |
295,372 | 9 | 10 | 4 | 69 | 4 | 1 | 11 | 22 | unauthorized_update_message_text | Refactor telegram_bot polling/webhooks platforms and add tests (#66433)
Co-authored-by: Pär Berge <paer.berge@gmail.com> | https://github.com/home-assistant/core.git | def unauthorized_update_message_text(update_message_text):
update_message_text["message"]["from"]["id"] = 1234
update_message_text["message"]["chat"]["id"] = 1234
return update_message_text
@pytest.fixture | @pytest.fixture | 32 | conftest.py | Python | tests/components/telegram_bot/conftest.py | d7375f1a9c4a69858a65a56bd524f5a78ecab23c | core | 1 |
154,161 | 11 | 12 | 6 | 47 | 6 | 0 | 11 | 65 | mask | FIX-#4676: drain sub-virtual-partition call queues. (#4695)
Signed-off-by: mvashishtha <mahesh@ponder.io>
Co-authored-by: Alexey Prutskov <lehaprutskov@gmail.com> | https://github.com/modin-project/modin.git | def mask(self, row_indices, col_indices):
return (
self.force_materialization()
.list_of_block_partitions[0]
.mask(row_indices, col_indices)
)
| 30 | virtual_partition.py | Python | modin/core/execution/dask/implementations/pandas_on_dask/partitioning/virtual_partition.py | 9bf8d57ca44e22fd69b0abc55793cf60c199ab4d | modin | 1 | |
3,835 | 48 | 12 | 14 | 310 | 32 | 0 | 68 | 166 | test_stream_slices_with_state | 🎉 🎉 Source FB Marketing: performance and reliability fixes (#9805)
* Facebook Marketing performance improvement
* add comments and little refactoring
* fix integration tests with the new config
* improve job status handling, limit concurrency to 10
* fix campaign jobs, refactor manager
* big refactori... | https://github.com/airbytehq/airbyte.git | def test_stream_slices_with_state(self, api, async_manager_mock, start_date):
end_date = start_date + duration(days=10)
cursor_value = start_date + duration(days=5)
state = {AdsInsights.cursor_field: cursor_value.date().isoformat()}
stream = AdsInsights(api=api, start_date=start... | 197 | test_base_insight_streams.py | Python | airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_base_insight_streams.py | a3aae8017a0a40ff2006e2567f71dccb04c997a5 | airbyte | 1 | |
127,765 | 29 | 10 | 15 | 101 | 13 | 0 | 34 | 98 | sample | [RLlib] A few updates for offline DQN usage (#28593)
1. Allow users to select between huber or mse losses for num_atoms=1 case.
2. Allow users to configure temperature parameter for Categorical distribution.
3. Introduce FifoReplayBuffer to allow off-policy algorithms to be used without a real ReplayBuffer.
Signe... | https://github.com/ray-project/ray.git | def sample(self, *args, **kwargs) -> Optional[SampleBatchType]:
if len(self._queue) <= 0:
# Return empty SampleBatch if queue is empty.
return MultiAgentBatch({}, 0)
batch = self._queue.pop(0)
# Equal weights of 1.0.
batch["weights"] = np.ones(len(batch))... | 61 | fifo_replay_buffer.py | Python | rllib/utils/replay_buffers/fifo_replay_buffer.py | 4105ca4d2be368a7893df9a0bd64e1641936c046 | ray | 2 | |
260,025 | 7 | 10 | 3 | 44 | 9 | 0 | 7 | 21 | _validate_targets | ENH Deprecate `class_weight_` in regression/single class models in SVM module (#22898)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> | https://github.com/scikit-learn/scikit-learn.git | def _validate_targets(self, y):
return column_or_1d(y, warn=True).astype(np.float64, copy=False)
| 38 | _base.py | Python | sklearn/svm/_base.py | f205b9579ab44988d28d890a9b4c944b37d89e73 | scikit-learn | 1 | |
247,511 | 68 | 11 | 49 | 414 | 33 | 0 | 112 | 586 | test_thumbnail_repeated_thumbnail | 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_thumbnail_repeated_thumbnail(self) -> None:
self._test_thumbnail(
"scale", self.test_image.expected_scaled, self.test_image.expected_found
)
if not self.test_image.expected_found:
return
# Fetching again should work, without re-requesting the i... | 263 | test_media_storage.py | Python | tests/rest/media/v1/test_media_storage.py | 32c828d0f760492711a98b11376e229d795fd1b3 | synapse | 4 | |
20,858 | 13 | 12 | 5 | 71 | 6 | 0 | 13 | 45 | plain | 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 plain(self) -> str:
if len(self._text) != 1:
self._text[:] = ["".join(self._text)]
return self._text[0]
| 42 | text.py | Python | pipenv/patched/notpip/_vendor/rich/text.py | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | pipenv | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.