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
19,350
134
17
47
721
49
0
192
552
astar_torus
docs: Fix a few typos (#695) There are small typos in: - ArmNavigation/arm_obstacle_navigation/arm_obstacle_navigation.py - ArmNavigation/arm_obstacle_navigation/arm_obstacle_navigation_2.py - docs/modules/slam/FastSLAM1/FastSLAM1_main.rst - docs/modules/slam/ekf_slam/ekf_slam_main.rst Fixes: - Should read `co...
https://github.com/AtsushiSakai/PythonRobotics.git
def astar_torus(grid, start_node, goal_node): colors = ['white', 'black', 'red', 'pink', 'yellow', 'green', 'orange'] levels = [0, 1, 2, 3, 4, 5, 6, 7] cmap, norm = from_levels_and_colors(levels, colors) grid[start_node] = 4 grid[goal_node] = 5 parent_map = [[() for _ in range(M)] for _ i...
475
arm_obstacle_navigation.py
Python
ArmNavigation/arm_obstacle_navigation/arm_obstacle_navigation.py
c6bdd48715adcbe17c4146b7cae3b0fc569f7bde
PythonRobotics
13
10,180
3
6
13
15
3
0
3
6
test_bad_flow_skip_handle_join
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 test_bad_flow_skip_handle_join(mocker, protocol):
98
test_flow_skip.py
Python
tests/unit/flow-construct/test_flow_skip.py
933415bfa1f9eb89f935037014dfed816eb9815d
jina
1
308,747
55
16
26
253
30
0
68
269
test_button_uid
Add unique id to flic buttons (#61496) * Use bluetooth address as unique id for flic buttons. * Always lower case address for uid and add tests. * Update test to set up component. * Use format_mac(addr) as unique id. * Only patch pyflic objects and use query entity registry for buttons. * Replace ExitSt...
https://github.com/home-assistant/core.git
async def test_button_uid(hass): address_to_name = { "80:e4:da:78:6e:11": "binary_sensor.flic_80e4da786e11", # Uppercase address should not change uid. "80:E4:DA:78:6E:12": "binary_sensor.flic_80e4da786e12", } flic_client = _MockFlicClient(tuple(address_to_name)) with mock...
148
test_binary_sensor.py
Python
tests/components/flic/test_binary_sensor.py
ce138dd30e7262fc71253ab5c2936f869b891fda
core
2
212,929
59
14
13
125
10
0
76
256
theme_global
Better error checking/reporting in theme_global. NEW THEME DarkGrey15
https://github.com/PySimpleGUI/PySimpleGUI.git
def theme_global(new_theme=None): if new_theme is not None: if new_theme not in theme_list(): popup_error_with_traceback('Cannot use custom themes with theme_global call', 'Your request to use theme {} cannot be performed.'.format(new_theme), ...
71
PySimpleGUI.py
Python
PySimpleGUI.py
dfad2e3b7671b7128895c8a0e29fff38d7efe6e9
PySimpleGUI
3
130,602
32
12
13
113
18
0
39
128
ensure_schema_for_first_block
[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 ensure_schema_for_first_block(self) -> Optional[Union["pyarrow.Schema", type]]: get_schema = cached_remote_fn(_get_schema) try: block = next(self.iter_blocks()) except (StopIteration, ValueError): # Dataset is empty (no blocks) or was manually cleared. ...
68
block_list.py
Python
python/ray/data/impl/block_list.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
2
167,478
41
11
19
171
23
0
49
181
test_css_excel_cell_cache
PERF: Improve Styler `to_excel` Performance (#47371) * Move CSS expansion lookup to dictionary * Implement simple CSSToExcelConverter cache * Eliminate list -> str -> list in CSSResolver * Allow for resolution of duplicate properties * Add performance benchmark for styled Excel * CLN: Clean up PEP8 issu...
https://github.com/pandas-dev/pandas.git
def test_css_excel_cell_cache(styles, cache_hits, cache_misses): # See GH 47371 converter = CSSToExcelConverter() converter.__call__.cache_clear() css_styles = {(0, i): _style for i, _style in enumerate(styles)} for css_row, css_col in css_styles: CssExcelCell( row=0, ...
112
test_to_excel.py
Python
pandas/tests/io/formats/test_to_excel.py
ad842d36bb62a6c7a5e8f93a9594129ff46cc5cb
pandas
3
320,832
76
11
62
479
21
0
88
912
migrate
Add setting to allow pasting from clipboard Closes #5256 Supersedes and closes #6315
https://github.com/qutebrowser/qutebrowser.git
def migrate(self) -> None: self._migrate_configdata() self._migrate_bindings_default() self._migrate_font_default_family() self._migrate_font_replacements() self._migrate_bool('tabs.favicons.show', 'always', 'never') self._migrate_bool('scrolling.bar', 'always',...
266
configfiles.py
Python
qutebrowser/config/configfiles.py
4a6df3a8e84780e9f58dbda31c3a9bfa1e35cebe
qutebrowser
3
312,158
14
10
5
53
6
0
16
48
is_closed
Enable strict typing for isy994 (#65439) Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
https://github.com/home-assistant/core.git
def is_closed(self) -> bool | None: if self._node.status == ISY_VALUE_UNKNOWN: return None return bool(self._node.status == 0)
32
cover.py
Python
homeassistant/components/isy994/cover.py
6c38a6b5697bcf4587e00101771001bf596974f9
core
2
262,777
44
13
17
159
17
0
52
153
build_script
splash: add always_on_top option for behavior configuration Allow user to enable or disable the always-on-top behavior at build time via always_on_top boolean argument to Splash(). By default, the always-on-top behavior is enabled for the sake of consistency with previous releases.
https://github.com/pyinstaller/pyinstaller.git
def build_script(text_options=None, always_on_top=False): # Order is important! script = [ ipc_script, image_script, splash_canvas_setup, ] if text_options: # If the default font is used we need a different syntax if text_options['font'] == "TkDefaultFont": ...
94
splash_templates.py
Python
PyInstaller/building/splash_templates.py
bfd5c729919b16e5e9457fca28e931b0e897a60a
pyinstaller
4
107,634
41
12
14
203
22
0
51
172
set_rgrids
Clarify error message for bad keyword arguments. `plot([], [], foo=42)` previously emitted ``` 'Line2D' object has no property 'foo' ``` which refers to the Matplotlib-specific concept of "properties". It now instead emits ``` Line2D.set() got an unexpected keyword argument 'foo' ``` which is modeled after the standa...
https://github.com/matplotlib/matplotlib.git
def set_rgrids(self, radii, labels=None, angle=None, fmt=None, **kwargs): # Make sure we take into account unitized data radii = self.convert_xunits(radii) radii = np.asarray(radii) self.set_yticks(radii) if labels is not None: self.set_yticklabels(labels) ...
127
polar.py
Python
lib/matplotlib/projections/polar.py
d69be2554cf6d1ac711bf433b1d6f176e3290d4f
matplotlib
5
47,864
28
11
20
153
18
1
29
134
test_check_docker_version_unknown
Fix and improve consistency of checking command return code (#23189) This is an aftermath of #23104 after switchig to docs building by breeze, failure of build documentation did not trigger failure of the docs build (but it did trigger main failure of pushing the documentation). This change improves and simplifi...
https://github.com/apache/airflow.git
def test_check_docker_version_unknown(mock_console, mock_run_command, mock_check_docker_permission_denied): mock_check_docker_permission_denied.return_value = False check_docker_version(verbose=True) expected_run_command_calls = [ call( ['docker', 'version', '--format', '{{.Client.Versio...
@mock.patch('airflow_breeze.utils.docker_command_utils.check_docker_permission_denied') @mock.patch('airflow_breeze.utils.docker_command_utils.run_command') @mock.patch('airflow_breeze.utils.docker_command_utils.console')
72
test_docker_command_utils.py
Python
dev/breeze/tests/test_docker_command_utils.py
be51aece54ef98a8868845ad8033f08689dd7ad1
airflow
1
266,443
10
7
2
27
2
0
11
17
_ansible_finalize
Attach concat func to an environment class (#76282) * Attach concat func to an environment class ci_complete * clog and docstrings
https://github.com/ansible/ansible.git
def _ansible_finalize(thing): return thing if thing is not None else ''
15
__init__.py
Python
lib/ansible/template/__init__.py
8febd37f325b049afe448af689064ee019d1099c
ansible
2
269,496
6
8
2
31
5
0
6
12
_constant_to_tensor
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def _constant_to_tensor(x, dtype): return tf.constant(x, dtype=dtype)
19
backend.py
Python
keras/backend.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
272,025
8
9
3
44
6
0
8
17
_sanitize_column_name_for_variable_scope
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def _sanitize_column_name_for_variable_scope(name): invalid_char = re.compile("[^A-Za-z0-9_.\\-]") return invalid_char.sub("_", name)
23
base_feature_layer.py
Python
keras/feature_column/base_feature_layer.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
249,339
24
10
13
115
14
0
25
129
test_create_token_invalid_chars
Use literals in place of `HTTPStatus` constants in tests (#13488) * Use literals in place of `HTTPStatus` constants in tests * newsfile * code style * code style
https://github.com/matrix-org/synapse.git
def test_create_token_invalid_chars(self) -> None: data = { "token": "abc/def", } channel = self.make_request( "POST", self.url + "/new", data, access_token=self.admin_user_tok, ) self.assertEqual(400, channel...
70
test_registration_tokens.py
Python
tests/rest/admin/test_registration_tokens.py
2281427175e4c93a30c39607fb4ac23c2a1f399f
synapse
1
45,940
31
13
25
235
33
0
41
158
test_dagrun_callbacks_commited_before_sent
Store callbacks in database if standalone_dag_processor config is True. (#21731)
https://github.com/apache/airflow.git
def test_dagrun_callbacks_commited_before_sent(self, dag_maker): with dag_maker(dag_id='test_dagrun_callbacks_commited_before_sent'): DummyOperator(task_id='dummy') self.scheduler_job = SchedulerJob(subdir=os.devnull) self.scheduler_job.processor_agent = mock.Mock() ...
188
test_scheduler_job.py
Python
tests/jobs/test_scheduler_job.py
5ace37a16d1773adb71c684450838e4c8e69b581
airflow
1
147,478
10
10
4
52
9
0
13
45
is_ready
[tune] Use new Checkpoint interface internally (#22801) Follow up from #22741, also use the new checkpoint interface internally. This PR is low friction and just replaces some internal bookkeeping methods. With the new Checkpoint interface, there is no need to revamp the save/restore APIs completely. Instead, we wi...
https://github.com/ray-project/ray.git
def is_ready(self): if self.storage == _TuneCheckpoint.PERSISTENT: return isinstance(self.value, str) return self.storage == _TuneCheckpoint.MEMORY
32
checkpoint_manager.py
Python
python/ray/tune/checkpoint_manager.py
1465eaa30634c189fe3ebc9db8609f47d19a78cc
ray
2
320,735
27
14
12
156
16
0
38
152
sizeHint
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 sizeHint(self): idx = self._model().last_index() bottom = self.visualRect(idx).bottom() if bottom != -1: margins = self.contentsMargins() height = (bottom + margins.top() + margins.bottom() + 2 * self.spacing()) size = QSize(...
93
downloadview.py
Python
qutebrowser/browser/downloadview.py
a20bb67a878b2e68abf8268c1b0a27f018d01352
qutebrowser
2
148,344
27
11
25
66
7
1
30
88
get_replica_context
[serve] Introduce `context.py` and `client.py` (#24067) Serve stores context state, including the `_INTERNAL_REPLICA_CONTEXT` and the `_global_client` in `api.py`. However, these data structures are referenced throughout the codebase, causing circular dependencies. This change introduces two new files: * `context.p...
https://github.com/ray-project/ray.git
def get_replica_context() -> ReplicaContext: internal_replica_context = get_internal_replica_context() if internal_replica_context is None: raise RayServeException( "`serve.get_replica_context()` " "may only be called from within a " "Ray Serve deployment." ...
@PublicAPI(stability="beta")
26
api.py
Python
python/ray/serve/api.py
b51d0aa8b12ceb7ce082b69db4d2707ea52c0b69
ray
2
11,925
39
11
23
160
18
0
53
181
mixin_client_gateway_parser
feat: improve client interface (#4510) * feat: add host unpacking * feat: add tests for host unpacking * feat: raise error when duplicate parameters def in client * fix: batter url host parsing * feat: rename https to tls * feat: add deprecation warning for https arg * feat: add docs * feat: updat...
https://github.com/jina-ai/jina.git
def mixin_client_gateway_parser(parser): gp = add_arg_group(parser, title='ClientGateway') _add_host(gp) _add_proxy(gp) gp.add_argument( '--port', type=int, default=helper.random_port(), help='The port of the Gateway, which the client should connect to.', ) ...
94
remote.py
Python
jina/parsers/orchestrate/runtimes/remote.py
b0f839b2030b1371518082be7bf79778d6e9f88d
jina
1
87,079
51
18
36
323
14
0
76
656
test_no_dynamic_sampling_returned_from_get_on_am2_plan
feat(ds): Handle GET and PUT in project details for v2 dynamic sampling [TET-475] (#40181) Ensures that when new AM2 plan flag is enabled GET request does not return `dynamicSampling` data in response, and for PUT request guards against storing `dynamicSampling` data. Also, handles popping `dynamicSampling` data fr...
https://github.com/getsentry/sentry.git
def test_no_dynamic_sampling_returned_from_get_on_am2_plan(self): dynamic_sampling_data = { "rules": [ { "sampleRate": 0.7, "type": "trace", "active": True, "condition": { ...
180
test_project_details.py
Python
tests/sentry/api/endpoints/test_project_details.py
8c51b98545d71ed7ef0b3b924db13461e924023a
sentry
1
291,083
48
11
8
92
11
0
56
147
_async_stop_scanner
Accept advertisements from alternate scanners when a scanner stops scanning (#82448)
https://github.com/home-assistant/core.git
async def _async_stop_scanner(self) -> None: self.scanning = False _LOGGER.debug("%s: Stopping bluetooth discovery", self.name) try: await self.scanner.stop() # type: ignore[no-untyped-call] except BleakError as ex: # This is not fatal, and they may want...
50
scanner.py
Python
homeassistant/components/bluetooth/scanner.py
a7caa038be2c0b05b53756ba6c9563854b2ca1ea
core
2
249,561
65
14
56
456
37
0
116
777
_generate_room
Persist CreateRoom events to DB in a batch (#13800)
https://github.com/matrix-org/synapse.git
def _generate_room(self) -> Tuple[str, List[Set[str]]]: room_id = self.helper.create_room_as(self.user_id, tok=self.token) # Mark the room as not having a chain cover index self.get_success( self.store.db_pool.simple_update( table="rooms", ke...
306
test_event_chain.py
Python
tests/storage/test_event_chain.py
8ab16a92edd675453c78cfd9974081e374b0f998
synapse
1
249,741
5
6
9
17
2
0
5
12
_delete_expired_login_tokens
Save login tokens in database (#13844) * Save login tokens in database Signed-off-by: Quentin Gliech <quenting@element.io> * Add upgrade notes * Track login token reuse in a Prometheus metric Signed-off-by: Quentin Gliech <quenting@element.io>
https://github.com/matrix-org/synapse.git
async def _delete_expired_login_tokens(self) -> None:
41
registration.py
Python
synapse/storage/databases/main/registration.py
8756d5c87efc5637da55c9e21d2a4eb2369ba693
synapse
1
43,119
39
14
21
194
26
0
47
151
load_package_data
Fix links to sources for examples (#24386) The links to example sources in exampleinclude have been broken in a number of providers and they were additionally broken by AIP-47. This PR fixes it. Fixes: #23632 Fixes: https://github.com/apache/airflow-site/issues/536
https://github.com/apache/airflow.git
def load_package_data() -> List[Dict[str, Any]]: schema = _load_schema() result = [] for provider_yaml_path in get_provider_yaml_paths(): with open(provider_yaml_path) as yaml_file: provider = yaml.safe_load(yaml_file) try: jsonschema.validate(provider, schema=sc...
112
provider_yaml_utils.py
Python
docs/exts/provider_yaml_utils.py
08b675cf6642171cb1c5ddfb09607b541db70b29
airflow
3
310,837
7
10
2
44
8
0
7
21
async_turn_on
Update method names reflecting changes in UniFi library (#64817) * Update method names * Bump dependency to v30
https://github.com/home-assistant/core.git
async def async_turn_on(self, **kwargs): await self.device.set_port_poe_mode(self.client.switch_port, self.poe_mode)
26
switch.py
Python
homeassistant/components/unifi/switch.py
76bfbbafe1ef3761c75e397c285e8057db926fe4
core
1
3,770
34
13
23
134
7
0
35
261
_filter_all_statuses
🎉 🎉 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 _filter_all_statuses(self) -> MutableMapping[str, Any]: filt_values = [ "active", "archived", "completed", "limited", "not_delivering", "deleted", "not_published", "pending_review", "permanen...
68
base_streams.py
Python
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/base_streams.py
a3aae8017a0a40ff2006e2567f71dccb04c997a5
airbyte
1
106,796
17
12
3
63
9
0
17
37
get
Splitting all handlers into socket and base handlers
https://github.com/fossasia/visdom.git
def get(self): new_sub = ClientSocketWrapper(self.app) self.write(json.dumps({'success': True, 'sid': new_sub.sid})) # TODO refactor socket wrappers to one class
35
socket_handlers.py
Python
py/visdom/server/handlers/socket_handlers.py
76185b240badc5a4134aacfd114b159d2884c041
visdom
1
146,292
2
6
6
13
2
0
2
5
test_dag_to_workflow_options
[workflow] Convert DAG to workflow (#22925) * convert DAG to a workflow * deduplicate * check duplication of steps * add test for object refs
https://github.com/ray-project/ray.git
def test_dag_to_workflow_options(workflow_start_regular_shared):
51
test_dag_to_workflow.py
Python
python/ray/workflow/tests/test_dag_to_workflow.py
0a9f966e63a1a1d38a1e291338384b1e84b3a2a9
ray
1
176,291
85
11
93
248
17
0
147
272
average_shortest_path_length
DOC: Update documentation to include callables for weight argument (#5307) Update docs to include functions as valid input for weight argument.
https://github.com/networkx/networkx.git
def average_shortest_path_length(G, weight=None, method=None): r single_source_methods = ["unweighted", "dijkstra", "bellman-ford"] all_pairs_methods = ["floyd-warshall", "floyd-warshall-numpy"] supported_methods = single_source_methods + all_pairs_methods if method is None: method = "unwei...
239
generic.py
Python
networkx/algorithms/shortest_paths/generic.py
b5d41847b8db0c82372faf69cd3a339d11da7ef0
networkx
16
20,351
89
16
31
318
37
0
144
677
_create_drawables
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 _create_drawables(self, tokensource): lineno = charno = maxcharno = 0 maxlinelength = linelength = 0 for ttype, value in tokensource: while ttype not in self.styles: ttype = ttype.parent style = self.styles[ttype] # TODO: make sure...
197
img.py
Python
pipenv/patched/notpip/_vendor/pygments/formatters/img.py
f3166e673fe8d40277b804d35d77dcdb760fc3b3
pipenv
6
320,950
74
18
36
445
48
0
95
312
build_sdist
build-release: Modernize pathlib, type annotations, modern syntax, dataclasses
https://github.com/qutebrowser/qutebrowser.git
def build_sdist() -> List[Artifact]: utils.print_title("Building sdist") dist_path = pathlib.Path('dist') _maybe_remove(dist_path) subprocess.run([sys.executable, '-m', 'build'], check=True) dist_files = list(dist_path.glob('*.tar.gz')) filename = f'qutebrowser-{qutebrowser.__version__}....
261
build_release.py
Python
scripts/dev/build_release.py
611a6d5cb2f15182e14c2249d1b5cedc44385878
qutebrowser
5
81,074
40
12
12
167
18
0
52
167
pseudo_build_inventory
Merge pull request #5784 from ansible/runner_changes_42 (#12083)
https://github.com/ansible/awx.git
def pseudo_build_inventory(self, inventory_update, private_data_dir): src = inventory_update.source injector = None if inventory_update.source in InventorySource.injectors: injector = InventorySource.injectors[src]() if injector is not None: content = i...
104
jobs.py
Python
awx/main/tasks/jobs.py
a0ccc8c92583db0a8cf8e36e06ca631c65fdaaec
awx
4
288,029
8
8
3
35
5
0
8
22
sw_version
Refactor apcupsd to use config flow (#64809) * Add Config Flow to APCUPSd integration and remove YAML support. * Hide the binary sensor if user does not select STATFLAG resource. * Add tests for config flows. * Simplify config flow code. * Spell fix. * Fix pylint warnings. * Simplify the code for con...
https://github.com/home-assistant/core.git
def sw_version(self) -> str | None: return self.status.get("VERSION")
19
__init__.py
Python
homeassistant/components/apcupsd/__init__.py
52307708c843b947a2d631f2fe7ddaa8bd9a90d7
core
1
26,039
27
10
9
126
19
0
35
71
test_query_pages_by_staff_no_perm
Allow fetching unpublished pages by app with manage pages permission (#9181) * Allow fetching unpublished pages by app with manage pages permission * Update changelog
https://github.com/saleor/saleor.git
def test_query_pages_by_staff_no_perm(staff_api_client, page_list, page): # given unpublished_page = page unpublished_page.is_published = False unpublished_page.save(update_fields=["is_published"]) page_count = Page.objects.count() # when response = staff_api_client.post_graphql(PAGE...
72
test_pages.py
Python
saleor/graphql/page/tests/queries/test_pages.py
098ff7b495ff9d37242ecdd38d9b08bfddb2cd19
saleor
1
165,784
23
11
8
80
10
0
27
95
mid
TYP: fix mid and length for Interval and Intervalarray (#46472)
https://github.com/pandas-dev/pandas.git
def mid(self) -> Index: try: return 0.5 * (self.left + self.right) except TypeError: # datetime safe version return self.left + 0.5 * self.length _interval_shared_docs["overlaps"] = textwrap.dedent( )
39
interval.py
Python
pandas/core/arrays/interval.py
6d7e004b1fc69942390d953bf21098a786c12c92
pandas
2
44,105
27
13
10
113
13
0
36
142
setdefault
Remove `:type` lines now sphinx-autoapi supports typehints (#20951) * Remove `:type` lines now sphinx-autoapi supports typehints Since we have no updated sphinx-autoapi to a more recent version it supports showing type hints in the documentation, so we don't need to have the type hints _and_ the `:type` lines -- ...
https://github.com/apache/airflow.git
def setdefault(cls, key, default, description=None, deserialize_json=False): obj = Variable.get(key, default_var=None, deserialize_json=deserialize_json) if obj is None: if default is not None: Variable.set(key, default, description=description, serialize_json=deseri...
74
variable.py
Python
airflow/models/variable.py
602abe8394fafe7de54df7e73af56de848cdf617
airflow
3
100,826
6
6
3
24
3
0
6
20
state
Refactoring and TravisCI to Github Actions (#1239) * refactor training * travis to actions
https://github.com/deepfakes/faceswap.git
def state(self) -> "State": return self._state
12
model.py
Python
plugins/train/model/_base/model.py
ff6b0209dd5ad57b81b0aca570df7f39a7119bfb
faceswap
1
183,586
19
13
12
104
10
0
29
86
_get_scrollbar_thicknesses
[css] Add "scrollbar-size" CSS properties - first step
https://github.com/Textualize/textual.git
def _get_scrollbar_thicknesses(self) -> tuple[int, int]: vertical_scrollbar_size = horizontal_scrollbar_size = 1 if self.styles.scrollbar_size_vertical is not None: vertical_scrollbar_size = int(self.styles.scrollbar_size_vertical.value) if self.styles.scrollbar_size_horizon...
66
widget.py
Python
src/textual/widget.py
ee30b54828fa5212e0a30437f777b045dec4a8cc
textual
3
299,429
43
17
20
196
31
0
54
214
test_change_relay_mode
Insteon Device Control Panel (#70834) Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
https://github.com/home-assistant/core.git
async def test_change_relay_mode(hass, hass_ws_client, iolinc_properties_data): ws_client, devices = await _setup( hass, hass_ws_client, "44.44.44", iolinc_properties_data ) device = devices["44.44.44"] relay_prop = device.configuration[RELAY_MODE] assert relay_prop.value == RelayMode.M...
121
test_api_properties.py
Python
tests/components/insteon/test_api_properties.py
a9ca774e7ed1d8fe502a53d5b765c1d9b393a524
core
1
266,098
4
6
2
16
3
0
4
18
list_buttons
4751 Enable plugins to inject content within object list views (#10901) * 4751 add plugin buttons to list templates * 4751 add plugin buttons to list templates * 4751 add documentation * 4751 fix object reference * 4751 update docs
https://github.com/netbox-community/netbox.git
def list_buttons(self): raise NotImplementedError
8
templates.py
Python
netbox/extras/plugins/templates.py
27bf7b4a9add27b4f3f8b0f4fd5dfc4cfe74a65b
netbox
1
292,688
13
11
6
88
12
0
16
51
poll_track_info
Refactor Sonos media metadata handling (#66840) Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
https://github.com/home-assistant/core.git
def poll_track_info(self) -> dict[str, Any]: track_info = self.soco.get_current_track_info() track_info[DURATION_SECONDS] = _timespan_secs(track_info.get("duration")) track_info[POSITION_SECONDS] = _timespan_secs(track_info.get("position")) return track_info
52
media.py
Python
homeassistant/components/sonos/media.py
cfd763db40544c31077b46631bbdd9655581dfe9
core
1
269,503
27
12
7
110
14
0
35
71
_get_available_gpus
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def _get_available_gpus(): if tf.compat.v1.executing_eagerly_outside_functions(): # Returns names of devices directly. return [d.name for d in tf.config.list_logical_devices("GPU")] global _LOCAL_DEVICES if _LOCAL_DEVICES is None: _LOCAL_DEVICES = get_session().list_devices() ...
65
backend.py
Python
keras/backend.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
6
102,165
48
8
8
49
6
0
56
83
test_supported_invalid_op
Revert "Revert D32498569: allow external backend codegen to toggle whether to generate out= and inplace kernels" (#69950) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/69950 This reverts commit f6cad53443704dfe5a20cc62bee14d91e3bffcaa. Test Plan: Imported from OSS Reviewed By: albanD Diff...
https://github.com/pytorch/pytorch.git
def test_supported_invalid_op(self) -> None: yaml_str = output_error = self.get_errors_from_gen_backend_stubs(yaml_str) self.assertExpectedInline(output_error, ) # The backend is valid, but doesn't have a valid autograd key. They can't override autograd kernels in that case. # Only usi...
26
test_gen_backend_stubs.py
Python
tools/test/test_gen_backend_stubs.py
bb5b4cceb6f737448eaaa6817cd773b6f4b0e77d
pytorch
1
288,149
6
6
3
26
5
0
6
20
characteristics
Add ESPHome BleakClient (#78911) Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
https://github.com/home-assistant/core.git
def characteristics(self) -> list[BleakGATTCharacteristic]: return self.__characteristics
15
service.py
Python
homeassistant/components/esphome/bluetooth/service.py
7042d6d35be54865b1252c0b28a50cce1a92eabc
core
1
20,293
15
10
5
68
10
0
19
42
_load_formatters
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 _load_formatters(module_name): mod = __import__(module_name, None, None, ['__all__']) for formatter_name in mod.__all__: cls = getattr(mod, formatter_name) _formatter_cache[cls.name] = cls
43
__init__.py
Python
pipenv/patched/notpip/_vendor/pygments/formatters/__init__.py
f3166e673fe8d40277b804d35d77dcdb760fc3b3
pipenv
2
43,853
27
13
16
165
11
0
42
146
env_vars
Test util `env_vars` to take arbitrary env vars (#20818) Currently it assumes that you will only use this for config settings (which you can already do with `conf_vars`). We should allow any kind of env var so that for example it could be used to patch an airflow conn or any other env var (which is sort of what is ...
https://github.com/apache/airflow.git
def env_vars(overrides): orig_vars = {} new_vars = [] for env, value in overrides.items(): if env in os.environ: orig_vars[env] = os.environ.pop(env, '') else: new_vars.append(env) os.environ[env] = value try: yield finally: for en...
100
config.py
Python
tests/test_utils/config.py
17a594f8cbb7ff07dff4e7b6b3797d98ec5a9ac5
airflow
6
294,231
57
13
18
203
21
0
74
270
async_scheduled_update_request
Motion request update till stop (#68580) * update untill stop * fixes * fix spelling
https://github.com/home-assistant/core.git
async def async_scheduled_update_request(self, *_): # add the last position to the list and keep the list at max 2 items self._previous_positions.append(self.current_cover_position) if len(self._previous_positions) > 2: del self._previous_positions[: len(self._previous_posit...
125
cover.py
Python
homeassistant/components/motion_blinds/cover.py
83983bc875445d7147cb98e70f1214c6ed270da9
core
5
113,930
671
32
451
5,598
186
0
2,169
13,762
_parse_query
Better error messaging in mysql api (#1911) * Better error messaging in mysql api
https://github.com/mindsdb/mindsdb.git
def _parse_query(self, sql): mindsdb_sql_struct = parse_sql(sql, dialect='mindsdb') # is it query to 'predictors'? if ( isinstance(mindsdb_sql_struct.from_table, Identifier) and mindsdb_sql_struct.from_table.parts[-1].lower() == 'predictors' and ( ...
3,320
sql_query.py
Python
mindsdb/api/mysql/mysql_proxy/classes/sql_query.py
10a5300838e4ae45d42495fdf53d76c702f66518
mindsdb
153
280,886
18
12
29
188
11
0
22
64
print_help
Mutual funds (#1106) * Add mutual fund menu based primarily on investpy (investment.com) * Add start/end date for loading + some bug fixes * hugo * poetry add investpy rich dnspython then poetry update * fix reset (need to load country) and dim yfinance commands when country not US * Fix search and add...
https://github.com/OpenBB-finance/OpenBBTerminal.git
def print_help(self): fund_string = f"{self.fund_name or None}" fund_string2 = f" ({self.fund_symbol})" if self.fund_symbol else "" fund_string += fund_string2 help_str = f t_console.print(help_str)
33
mutual_fund_controller.py
Python
gamestonk_terminal/mutual_funds/mutual_fund_controller.py
e437f29ae498124b34a401015b001cb6c27c1e93
OpenBBTerminal
2
186,460
47
12
15
170
23
0
52
210
test_ssl_config_files_hash_in_all_hashes
Improve assertions in certbot-apache tests. (#9131) * Improve assertions in certbot-apache tests. Replacements inspired by flake8-assertive. * Fix test failures * assertEqual is not for None :D * Pass all tests :)
https://github.com/certbot/certbot.git
def test_ssl_config_files_hash_in_all_hashes(self): from certbot_apache._internal.constants import ALL_SSL_OPTIONS_HASHES import pkg_resources tls_configs_dir = pkg_resources.resource_filename( "certbot_apache", os.path.join("_internal", "tls_configs")) all_files = ...
102
configurator_test.py
Python
certbot-apache/tests/configurator_test.py
a0dbe1e85035f12e194d91148836d830871ec554
certbot
4
118,736
15
8
2
27
4
0
15
32
container
Replace static apps with live Cloud apps (#4317) Co-authored-by: kajarenc <kajarenc@gmail.com>
https://github.com/streamlit/streamlit.git
def container(self): return self.dg._block() # TODO: Enforce that columns are not nested or in Sidebar
14
layouts.py
Python
lib/streamlit/elements/layouts.py
72703b38029f9358a0ec7ca5ed875a6b438ece19
streamlit
1
268,847
23
11
12
148
11
1
29
54
_name_scope_unnester
Fix tf.name_scope support for Keras nested layers. Infer nested layer structure inside `Layer.__call__` PiperOrigin-RevId: 423989336
https://github.com/keras-team/keras.git
def _name_scope_unnester(full_name_scope): if not getattr(_name_scope_unnester_stack, 'value', None): _name_scope_unnester_stack.value = [''] _name_scope_unnester_stack.value.append(full_name_scope) try: full_name_scope = _name_scope_unnester_stack.value[-1] outer_name_scope = _name_scope_unneste...
@keras_export('keras.layers.Layer')
79
base_layer.py
Python
keras/engine/base_layer.py
9733982976f62c351ea3db2aeb1f28a67bb5d2fa
keras
3
108,748
4
7
3
31
4
0
4
25
clear
Add internal method to clear without update to simplify code
https://github.com/matplotlib/matplotlib.git
def clear(self): self._clear_without_update() self.update()
16
widgets.py
Python
lib/matplotlib/widgets.py
a2540ac2387223a00af88f295121c9e5aa51079d
matplotlib
1
262,665
22
16
12
143
14
0
25
59
logsumexp
Adding OverFlow (#2183) * Adding encoder * currently modifying hmm * Adding hmm * Adding overflow * Adding overflow setting up flat start * Removing runs * adding normalization parameters * Fixing models on same device * Training overflow and plotting evaluations * Adding inference * At t...
https://github.com/coqui-ai/TTS.git
def logsumexp(x, dim): r m, _ = x.max(dim=dim) mask = m == -float("inf") s = (x - m.masked_fill_(mask, 0).unsqueeze(dim=dim)).exp().sum(dim=dim) return s.masked_fill_(mask, 1).log() + m.masked_fill_(mask, -float("inf"))
88
common_layers.py
Python
TTS/tts/layers/overflow/common_layers.py
3b8b105b0d6539ac12972de94e0b2a5077fa1ce2
TTS
1
299,859
6
6
54
21
6
0
6
9
record_meter_states
Break apart recorder into tasks and core modules (#71222)
https://github.com/home-assistant/core.git
def record_meter_states(hass, zero, entity_id, _attributes, seq):
447
test_recorder.py
Python
tests/components/sensor/test_recorder.py
29bda196b5e0a90a2bea7e1797742236114afc1c
core
3
272,667
5
9
2
32
4
0
5
11
maximum
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def maximum(inputs, **kwargs): return Maximum(**kwargs)(inputs)
18
maximum.py
Python
keras/layers/merging/maximum.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
101,377
30
12
18
180
16
0
33
193
_convert_images
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 _convert_images(self) -> None: logger.debug("Converting images") self._patch_threads.start() while True: self._check_thread_error() if self._disk_io.completion_event.is_set(): logger.debug("DiskIO completion event set. Joining Pool") ...
97
convert.py
Python
scripts/convert.py
1022651eb8a7741014f5d2ec7cbfe882120dfa5f
faceswap
4
260,810
67
11
22
254
24
0
95
310
_predict_recursive
MAINT Remove `x_squared_norms` arg from `k_means_lloyd` signature (#24264) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
https://github.com/scikit-learn/scikit-learn.git
def _predict_recursive(self, X, sample_weight, cluster_node): if cluster_node.left is None: # This cluster has no subcluster. Labels are just the label of the cluster. return np.full(X.shape[0], cluster_node.label, dtype=np.int32) # Determine if data points belong to th...
171
_bisect_k_means.py
Python
sklearn/cluster/_bisect_k_means.py
60f16feaadaca28f9a1cc68d2f406201860d27e8
scikit-learn
3
19,993
17
9
9
42
6
0
18
45
is_wheel_installed
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 is_wheel_installed() -> bool: try: import pipenv.vendor.wheel as wheel # noqa: F401 except ImportError: return False return True
24
misc.py
Python
pipenv/patched/notpip/_internal/utils/misc.py
f3166e673fe8d40277b804d35d77dcdb760fc3b3
pipenv
2
156,830
45
14
16
205
23
0
63
146
test_set_index_interpolate_large_uint
Revise divisions logic in from_pandas (#9221) * rewrite/fix sorted_division_locations * format * mem cleanup * fix some tests - but there is still an existing bug in merge_asof * saving partial test fixes * get test_dataframe.py passing * testing revisions * perfectly satisfy npartitions * twe...
https://github.com/dask/dask.git
def test_set_index_interpolate_large_uint(engine): if engine == "cudf": # NOTE: engine == "cudf" requires cudf/dask_cudf, # will be skipped by non-GPU CI. cudf = pytest.importorskip("cudf") dask_cudf = pytest.importorskip("dask_cudf") df = pd.DataFrame( {"x": np.ar...
122
test_shuffle.py
Python
dask/dataframe/tests/test_shuffle.py
c97193156a8ba6d9bf18c4e9f5d68830471aec74
dask
3
281,535
9
11
11
54
9
0
9
30
print_help
Terminal Wide Rich (#1161) * My idea for how we handle Rich moving forward * remove independent consoles * FIxed pylint issues * add a few vars * Switched print to console * More transitions * Changed more prints * Replaced all prints * Fixing tabulate * Finished replace tabulate * Finish...
https://github.com/OpenBB-finance/OpenBBTerminal.git
def print_help(self): help_text = f console.print(text=help_text, menu="Stocks - Backtesting")
22
bt_controller.py
Python
gamestonk_terminal/stocks/backtesting/bt_controller.py
82747072c511beb1b2672846ae2ee4aec53eb562
OpenBBTerminal
1
20,718
58
22
26
259
20
0
75
615
_check_buffer
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 _check_buffer(self) -> None: if self.quiet: del self._buffer[:] return with self._lock: if self._buffer_index == 0: if self.is_jupyter: # pragma: no cover from .jupyter import display display(self....
148
console.py
Python
pipenv/patched/notpip/_vendor/rich/console.py
f3166e673fe8d40277b804d35d77dcdb760fc3b3
pipenv
8
249,628
32
13
10
149
7
0
47
147
test_cache_age
Be more lenient in the oEmbed response parsing. (#14089) Attempt to parse any valid information from an oEmbed response (instead of bailing at the first unexpected data). This should allow for more partial oEmbed data to be returned, resulting in better / more URL previews, even if those URL previews are only parti...
https://github.com/matrix-org/synapse.git
def test_cache_age(self) -> None: # Correct-ish cache ages are allowed. for cache_age in ("1", 1.0, 1): result = self.parse_response({"cache_age": cache_age}) self.assertEqual(result.cache_age, 1000) # Invalid cache ages are ignored. for cache_age in ("i...
90
test_oembed.py
Python
tests/rest/media/v1/test_oembed.py
00c93d2e7ef5642c9cf900f3fdcfa229e70f843d
synapse
3
134,317
54
17
31
187
23
0
69
375
_fetch_next_result
[AIR] Hard deprecate train.report, warn on air.session misuse (#29613) Signed-off-by: Antoni Baum antoni.baum@protonmail.com Hard deprecates `ray.train.report` and other session functions and ensures that the user is informed when using `ray.air.session` if they are not in session for consistency with the old funct...
https://github.com/ray-project/ray.git
def _fetch_next_result(self) -> Optional[List[Dict]]: while True: results = self._backend_executor.get_next_results() if results is None: return None first_result = results[0] result_type = first_result.type if result_type is ...
108
trainer.py
Python
python/ray/train/trainer.py
9b29fd6501ff0e3e69d0333bf214482b86f9e97f
ray
6
176,084
22
6
30
34
8
2
23
54
test_edgeql_for_in_computable_09
Add a `bag` type that tells assert_query_result to ignore order (#3314) assert_query_result currently supports using sets to ignore order, but that doesn't work for objects, which can't be hashed or sorted. There is a system for specifying a sort key for internal data, but it is way clunkier than just saying we d...
https://github.com/edgedb/edgedb.git
async def test_edgeql_for_in_computable_09(self): # This is basically test_edgeql_for_in_computable_01 but with # a WITH binding in front of the whole shape await self.assert_query_result( r
# This is basically test_edgeql_for_in_computable_01 but with # a WITH binding in front of the whole shape await self.assert_query_result( r''' WITH U := ( SELECT User { select_deck := ( ...
48
test_edgeql_for.py
Python
tests/test_edgeql_for.py
26be7d28bdb4eb96c888e373e08f46e6b85711e3
edgedb
1
150,408
20
13
8
94
12
0
22
94
start_threaded_loop
initial concept for replicate, basic leader and follower logic
https://github.com/freqtrade/freqtrade.git
def start_threaded_loop(self): self._loop = asyncio.new_event_loop() if not self._thread: self._thread = Thread(target=self._loop.run_forever) self._thread.start() self._running = True else: raise RuntimeError("A loop is already running")...
54
__init__.py
Python
freqtrade/rpc/replicate/__init__.py
9f6bba40af1a407f190a89f5c0c8b4e3f528ba46
freqtrade
2
276,025
21
13
9
87
10
0
24
123
_search_for_child_node
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def _search_for_child_node(self, parent_id, path_to_child): if not path_to_child: return parent_id for child in self._proto.nodes[parent_id].children: if child.local_name == path_to_child[0]: return self._search_for_child_node( child....
57
load.py
Python
keras/saving/saved_model/load.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
4
299,285
76
11
41
474
33
0
172
311
test_group_media_states
Add state buffering to media_player and use it in cast (#70802)
https://github.com/home-assistant/core.git
async def test_group_media_states(hass, mz_mock): entity_id = "media_player.speaker" reg = er.async_get(hass) info = get_fake_chromecast_info() chromecast, _ = await async_setup_media_player_cast(hass, info) _, conn_status_cb, media_status_cb, group_media_status_cb = get_status_callbacks( ...
275
test_media_player.py
Python
tests/components/cast/test_media_player.py
66551e6fcbd063e53c13adc8a6462b8e00ce1450
core
1
259,113
9
8
3
44
5
0
9
30
get_feature_names_out
DOC Improve get_feature_names_out docstrings (#22718) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
https://github.com/scikit-learn/scikit-learn.git
def get_feature_names_out(self, input_features=None): input_features = _check_feature_names_in(self, input_features) return input_features[self.get_support()]
27
_base.py
Python
sklearn/feature_selection/_base.py
279388d9ed2ea83194dd45a2d78161be30b43aa7
scikit-learn
1
299,241
26
11
8
111
15
0
30
99
_async_update_data
Add config flow to steam_online integration (#67261) Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
https://github.com/home-assistant/core.git
async def _async_update_data(self) -> dict[str, dict[str, str | int]]: try: return await self.hass.async_add_executor_job(self._update) except (steam.api.HTTPError, steam.api.HTTPTimeoutError) as ex: if "401" in str(ex): raise ConfigEntryAuthFailed from ...
70
coordinator.py
Python
homeassistant/components/steam_online/coordinator.py
b1a6521abd71c0086b24849acc44f02eaabccff6
core
3
269,554
37
13
15
232
31
1
44
114
ctc_batch_cost
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def ctc_batch_cost(y_true, y_pred, input_length, label_length): label_length = tf.cast(tf.squeeze(label_length, axis=-1), tf.int32) input_length = tf.cast(tf.squeeze(input_length, axis=-1), tf.int32) sparse_labels = tf.cast( ctc_label_dense_to_sparse(y_true, label_length), tf.int32 ) y...
@keras_export("keras.backend.ctc_decode") @tf.__internal__.dispatch.add_dispatch_support @doc_controls.do_not_generate_docs
137
backend.py
Python
keras/backend.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
43,922
10
12
15
42
8
0
10
24
test_written_task_map
Add TaskMap and TaskInstance.map_id (#20286) Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com>
https://github.com/apache/airflow.git
def test_written_task_map(self, dag_maker, xcom_value, expected_length, expected_keys): with dag_maker(dag_id="test_written_task_map") as dag:
119
test_taskinstance.py
Python
tests/models/test_taskinstance.py
d48a3a357fd89ec805d086d5b6c1f1d4daf77b9a
airflow
3
266,111
70
12
18
332
22
0
112
302
post_save_handler
Closes #10851: New staging mechanism (#10890) * WIP * Convert checkout() context manager to a class * Misc cleanup * Drop unique constraint from Change model * Extend staging tests * Misc cleanup * Incorporate M2M changes * Don't cancel wipe out creation records when an object is deleted * Rena...
https://github.com/netbox-community/netbox.git
def post_save_handler(self, sender, instance, **kwargs): key = self.get_key_for_instance(instance) object_type = instance._meta.verbose_name # Creating a new object if kwargs.get('created'): logger.debug(f"[{self.branch}] Staging creation of {object_type} {instance}...
164
staging.py
Python
netbox/netbox/staging.py
a5308ea28e851a4ddb65a4e7ca2297b641e5891f
netbox
5
124,249
6
5
23
25
7
2
6
9
test_storage_isolation
[core][gcs] Add storage namespace to redis storage in GCS. (#25994) To enable one storage be able to be shared by multiple ray clusters, a special prefix is added to isolate the data between clusters: "<EXTERNAL_STORAGE_NAMESPACE>@" The namespace is given by an os environment: `RAY_external_storage_namespace` when ...
https://github.com/ray-project/ray.git
def test_storage_isolation(external_redis, call_ray_start, call_ray_start_2): script =
script = """ import ray ray.init("{address}", namespace="a")@ray.remote
75
test_advanced_9.py
Python
python/ray/tests/test_advanced_9.py
096c0cd66802f0eb86301343180eddb3eae0f03a
ray
1
32,190
5
8
4
42
6
0
5
33
as_target_tokenizer
NLLB tokenizer (#18126) * NLLB tokenizer * Apply suggestions from code review - Thanks Stefan! Co-authored-by: Stefan Schweter <stefan@schweter.it> * Final touches * Style :) * Update docs/source/en/model_doc/nllb.mdx Co-authored-by: Stefan Schweter <stefan@schweter.it> * Apply suggestions from co...
https://github.com/huggingface/transformers.git
def as_target_tokenizer(self): self.set_tgt_lang_special_tokens(self.tgt_lang) yield self.set_src_lang_special_tokens(self.src_lang)
23
tokenization_nllb.py
Python
src/transformers/models/nllb/tokenization_nllb.py
c1c79b06550b587b2a975016ef9d18b53258025b
transformers
1
124,881
17
6
62
15
2
0
18
27
test_recover_start_from_replica_actor_names
[Serve][Part2] Migrate the tests to use deployment graph api (#26507)
https://github.com/ray-project/ray.git
def test_recover_start_from_replica_actor_names(serve_instance): # Test failed to deploy with total of 2 replicas, # but first constructor call fails.
343
test_controller_recovery.py
Python
python/ray/serve/tests/fault_tolerance_tests/test_controller_recovery.py
09a6e5336ad6ab3c41e4a16e906c778aee2450bc
ray
14
211,968
29
11
19
132
21
0
35
142
to_json
Redesign serialization protocol (#11960) * Redesign serialization in bokeh * Redesign deserialization in bokehjs * Resolve type issues and test failures * Make 'bytes' serialization work in bokeh * Partially update bokeh's serialization tests * Resolve issues with cyclic references * Don't limit Stat...
https://github.com/bokeh/bokeh.git
def to_json(self) -> DocJson: data_models = [ model for model in Model.model_class_reverse_map.values() if is_DataModel(model) ] serializer = Serializer() defs = serializer.encode(data_models) roots = serializer.encode(self._roots) doc_json = DocJson( versi...
83
document.py
Python
bokeh/document/document.py
fca16442ae90afcd2ac61f4e554e538776730831
bokeh
3
261,652
68
11
27
313
39
0
98
199
test_learning_curve_display_default_usage
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_default_usage(pyplot, data): X, y = data estimator = DecisionTreeClassifier(random_state=0) train_sizes = [0.3, 0.6, 0.9] display = LearningCurveDisplay.from_estimator( estimator, X, y, train_sizes=train_sizes ) import matplotlib as mpl assert ...
211
test_plot.py
Python
sklearn/model_selection/tests/test_plot.py
758fe0d9c72ba343097003e7992c9239e58bfc63
scikit-learn
3
310,957
77
17
44
427
24
0
148
651
fetch_data
Cleanup GitHub sensor classes and descriptions (#64853)
https://github.com/home-assistant/core.git
async def fetch_data(self) -> IssuesPulls: pulls_count = 0 pull_last = None issues_count = 0 issue_last = None try: pull_response = await self._client.repos.pulls.list( self.repository, **{"params": {"per_page": 1}, "etag": sel...
266
coordinator.py
Python
homeassistant/components/github/coordinator.py
b07f4ba398bf7f7fb65dd6f365454ed5ccfc8a58
core
11
26,596
38
15
31
212
27
0
53
171
test_homepage_events
Update orderNumber field in OrderEvent type (#9447)
https://github.com/saleor/saleor.git
def test_homepage_events(order_events, staff_api_client, permission_manage_orders): query = response = staff_api_client.post_graphql( query, permissions=[permission_manage_orders] ) content = get_graphql_content(response) edges = content["data"]["homepageEvents"]["edges"] only_types = {...
125
test_homepage.py
Python
saleor/graphql/order/tests/test_homepage.py
bef5dc4fca6dbb4b67e3d00cabef66cbd0bb25a6
saleor
3
112,046
7
7
10
29
5
0
7
21
get_origin2wrapped_parameter_name_map
[Model Compression] Pruning Wrapper Refactor (#4488)
https://github.com/microsoft/nni.git
def get_origin2wrapped_parameter_name_map(self) -> Dict[str, str]: raise NotImplementedError()
17
compressor.py
Python
nni/algorithms/compression/v2/pytorch/base/compressor.py
2566badb06095b9e3ea16eb6f00fd58da65a95fd
nni
1
189,283
10
10
3
48
5
0
11
28
is_streaming_blob_type
Document streaming blob type Not having streaming blobs documented is causing users to pass in the wrong input for blob arguments. This commit resolves the issue by explicitly marking streaming blob types and auto-generating a usage note for streaming blobs.
https://github.com/aws/aws-cli.git
def is_streaming_blob_type(shape): return (shape and shape.type_name == 'blob' and shape.serialization.get('streaming', False))
27
utils.py
Python
awscli/utils.py
ff9b332d6ad9d3e7e845d08d40a9970f4d08ff18
aws-cli
3
44,419
10
8
3
47
8
0
10
24
key
Make `airflow dags test` be able to execute Mapped Tasks (#21210) * Make `airflow dags test` be able to execute Mapped Tasks In order to do this there were two steps required: - The BackfillJob needs to know about mapped tasks, both to expand them, and in order to update it's TI tracking - The DebugExecutor ...
https://github.com/apache/airflow.git
def key(self) -> TaskInstanceKey: return TaskInstanceKey(self.dag_id, self.task_id, self.run_id, self.try_number, self.map_index)
31
taskinstance.py
Python
airflow/models/taskinstance.py
6fc6edf6af7f676bfa54ff3a2e6e6d2edb938f2e
airflow
1
64,295
57
20
23
404
26
0
85
62
get_incoming_rate
refactor: get incoming fifo/lifo rate functions Re-use same logic for computing incoming rate.
https://github.com/frappe/erpnext.git
def get_incoming_rate(args, raise_error_if_no_rate=True): from erpnext.stock.stock_ledger import get_previous_sle, get_valuation_rate if isinstance(args, str): args = json.loads(args) in_rate = 0 if (args.get("serial_no") or "").strip(): in_rate = get_avg_purchase_rate(args.get("serial_no")) else: valuati...
235
utils.py
Python
erpnext/stock/utils.py
61c5ad44d3fe282e453d77df8acd1fbf9642c44a
erpnext
13
248,275
25
13
68
92
12
0
29
86
_expire_url_cache_data
URL preview cache expiry logs: INFO -> DEBUG, text clarifications (#12720)
https://github.com/matrix-org/synapse.git
async def _expire_url_cache_data(self) -> None: assert self._worker_run_media_background_jobs now = self.clock.time_msec() logger.debug("Running url preview cache expiry") if not (await self.store.db_pool.updates.has_completed_background_updates()): logger.debug(...
329
preview_url_resource.py
Python
synapse/rest/media/v1/preview_url_resource.py
57f6c496d0e26b1b455de936bd950e1899a5ae25
synapse
12
121,981
28
13
8
104
13
1
29
43
_use_python_method
Introduce class PyArray that contains the data members of python Array. A few key methods is implemented in C++ while the rest are still implmemented in python and added to the class later. A class decorator, @use_cpp_array, is added to add python methods to xc.Array. PiperOrigin-RevId: 473075244
https://github.com/google/jax.git
def _use_python_method(f): # TODO(chky): remove 'type: ignore' on decorated property once mypy does a release if isinstance(f, property): _python_methods.add(cast(property, f).fget.__name__) elif isinstance(f, pxla.maybe_cached_property): _python_methods.add(f.func.__name__) else: _python_methods...
@_use_cpp_array
61
array.py
Python
jax/experimental/array.py
0400db959be865b3ca312ca3355824f0706723c7
jax
3
140,064
71
13
27
271
29
0
98
371
get_next
Ignore previous tasks before submitting ones via `map` and `map_unordered` (#23684)
https://github.com/ray-project/ray.git
def get_next(self, timeout=None, ignore_if_timedout=False): if not self.has_next(): raise StopIteration("No more results to get") if self._next_return_index >= self._next_task_index: raise ValueError( "It is not allowed to call get_next() after get_next_u...
166
actor_pool.py
Python
python/ray/util/actor_pool.py
5b9b4fa018af04089320b03394711c9916a61e23
ray
8
293,909
18
9
3
63
8
0
20
29
get_state
Avoid selecting attributes in the history api when `no_attributes` is passed (#68352)
https://github.com/home-assistant/core.git
def get_state(hass, utc_point_in_time, entity_id, run=None, no_attributes=False): states = get_states(hass, utc_point_in_time, (entity_id,), run, None, no_attributes) return states[0] if states else None
46
history.py
Python
homeassistant/components/recorder/history.py
816695cc96c19110ccda10431d92160ea6064d32
core
2
309,027
9
7
4
30
6
0
10
26
_get_distance_unit
Use SensorEntityDescription in Mazda integration (#63423) * Use SensorEntityDescription in Mazda integration * Change lambdas to functions * Minor fixes * Address review comments
https://github.com/home-assistant/core.git
def _get_distance_unit(unit_system): if unit_system.name == CONF_UNIT_SYSTEM_IMPERIAL: return LENGTH_MILES return LENGTH_KILOMETERS
17
sensor.py
Python
homeassistant/components/mazda/sensor.py
8915b73f724b58e93284a823c0d2e99fbfc13e84
core
2
124,544
39
13
23
149
12
0
51
215
get_state
[RLlib] Checkpoint and restore connectors. (#26253)
https://github.com/ray-project/ray.git
def get_state(self) -> PolicyState: state = { # All the policy's weights. "weights": self.get_weights(), # The current global timestep. "global_timestep": self.global_timestep, } if self.config.get("enable_connectors", False): ...
84
policy.py
Python
rllib/policy/policy.py
0c469e490e0ed5e6ca848c627f3b852382e2bf2a
ray
4
170,050
24
11
16
107
12
0
36
89
test_execute_fail
TST/CLN: Ensure sqlite memory connections are closed (#49154) * TST/CLN: Use fixtures for TestXSQLite * More sqlite closing
https://github.com/pandas-dev/pandas.git
def test_execute_fail(self, sqlite_buildin): create_sql = cur = sqlite_buildin.cursor() cur.execute(create_sql) sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', sqlite_buildin) sql.execute('INSERT INTO test VALUES("foo", "baz", 2.567)', sqlite_buildin) with ...
61
test_sql.py
Python
pandas/tests/io/test_sql.py
5a4339f686225ed5eadc5c4b7d2508c0765ef577
pandas
1
39,809
31
14
28
164
18
0
41
175
_set_random_id
improve error message and logic for _set_random_id exclusions
https://github.com/plotly/dash.git
def _set_random_id(self): if hasattr(self, "id"): return getattr(self, "id") kind = f"`{self._namespace}.{self._type}`" # pylint: disable=no-member if getattr(self, "persistence", False): raise RuntimeError( f ) if "dash_snapshots" ...
85
base_component.py
Python
dash/development/base_component.py
0ef2b4aac220def202aa240db84cc3976c5d796b
dash
4
162,632
154
19
209
792
44
0
266
991
process_info
Add pre-processor stage `after_filter` * Move `_match_entry` and `post_extract` to `process_video_result`. It is also left in `process_info` for API compat * `--list-...` options and `--force-write-archive` now obey filtering options * Move `SponsorBlockPP` to `after_filter`. Closes https://github.com/yt-dlp/yt-dlp/is...
https://github.com/yt-dlp/yt-dlp.git
def process_info(self, info_dict): assert info_dict.get('_type', 'video') == 'video' original_infodict = info_dict if 'format' not in info_dict and 'ext' in info_dict: info_dict['format'] = info_dict['ext'] # This is mostly just for backward compatibility of proce...
1,463
YoutubeDL.py
Python
yt_dlp/YoutubeDL.py
09b49e1f688831c3ad7181decf38c90f8451e6c4
yt-dlp
70
259,434
109
10
25
255
25
0
174
383
test_tweedie_log_identity_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_tweedie_log_identity_consistency(p): half_tweedie_log = HalfTweedieLoss(power=p) half_tweedie_identity = HalfTweedieLossIdentity(power=p) n_samples = 10 y_true, raw_prediction = random_y_true_raw_prediction( loss=half_tweedie_log, n_samples=n_samples, seed=42 ) y_pred = hal...
155
test_loss.py
Python
sklearn/_loss/tests/test_loss.py
75a94f518f7bd7d0bf581ffb67d9f961e3c4efbc
scikit-learn
1
153,340
4
11
2
42
8
0
4
10
display_time_updates
REFACTOR-#4251: define public interfaces in `modin.core.execution.ray` module (#3868) Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
https://github.com/modin-project/modin.git
def display_time_updates(bar): threading.Thread(target=_show_time_updates, args=(bar,)).start()
25
modin_aqp.py
Python
modin/core/execution/ray/generic/modin_aqp.py
e7cb2e82f8b9c7a68f82abdd3b6011d661230b7e
modin
1
274,800
18
10
7
105
11
0
23
76
test_sparse_categorical_accuracy_eager
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def test_sparse_categorical_accuracy_eager(self): metric = metrics.sparse_categorical_accuracy y_true = np.arange(6).reshape([6, 1]) y_pred = np.arange(36).reshape([6, 6]) self.assertAllEqual( metric(y_true, y_pred), [0.0, 0.0, 0.0, 0.0, 0.0, 1.0] )
82
metrics_functional_test.py
Python
keras/metrics/metrics_functional_test.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
224,002
46
15
10
184
15
0
62
155
get_theme_dir
Remove spaces at the ends of docstrings, normalize quotes
https://github.com/mkdocs/mkdocs.git
def get_theme_dir(self): entry_points = EntryPoint.parse_map(self.distribution.entry_points, self.distribution) if 'mkdocs.themes' not in entry_points: raise DistutilsOptionError("no mkdocs.themes are defined in entry_points") if self.theme is None and len(entry_points['mkdo...
108
babel.py
Python
mkdocs/commands/babel.py
e7f07cc82ab2be920ab426ba07456d8b2592714d
mkdocs
5
186,643
7
8
6
48
6
0
7
28
_autohsts_save_state
Add typing to certbot.apache (#9071) * Add typing to certbot.apache Co-authored-by: Adrien Ferrand <ferrand.ad@gmail.com>
https://github.com/certbot/certbot.git
def _autohsts_save_state(self) -> None: self.storage.put("autohsts", self._autohsts) self.storage.save()
27
configurator.py
Python
certbot-apache/certbot_apache/_internal/configurator.py
7d9e9a49005de7961e84d2a7c608db57dbab3046
certbot
1
285,199
88
13
12
230
31
0
103
151
get_engle_granger_two_step_cointegration_test
Here we merge all API Refactor related branches (#2236) * Update api.py * Updated forex menu * refactor ycrv command * refactor ycrv command black * refactor ecocal command * Minh changes * Adding space to test pushing * title fix ecocal df * get economic calendar annotation * fix investingc...
https://github.com/OpenBB-finance/OpenBBTerminal.git
def get_engle_granger_two_step_cointegration_test(dependent_series, independent_series): warnings.simplefilter(action="ignore", category=FutureWarning) long_run_ols = sm.OLS(dependent_series, sm.add_constant(independent_series)) warnings.simplefilter(action="default", category=FutureWarning) long_...
147
econometrics_model.py
Python
openbb_terminal/econometrics/econometrics_model.py
9e1a58e2dbedec4e4a9f9c2e32ddf091776c606b
OpenBBTerminal
1