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
47,513
97
13
28
347
40
0
136
402
test_timeout_triggers
Replace usage of `DummyOperator` with `EmptyOperator` (#22974) * Replace usage of `DummyOperator` with `EmptyOperator`
https://github.com/apache/airflow.git
def test_timeout_triggers(self, dag_maker): session = settings.Session() # Create the test DAG and task with dag_maker( dag_id='test_timeout_triggers', start_date=DEFAULT_DATE, schedule_interval='@once', max_active_runs=1, ses...
207
test_scheduler_job.py
Python
tests/jobs/test_scheduler_job.py
49e336ae0302b386a2f47269a6d13988382d975f
airflow
1
275,522
23
10
6
69
7
0
27
59
_var_key
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def _var_key(var): # pylint: disable=protected-access # Get the distributed variable if it exists. if hasattr(var, "_distributed_container"): var = var._distributed_container() if getattr(var, "_in_graph_mode", False): return var._shared_name return var._unique_id
39
optimizer_v2.py
Python
keras/optimizers/optimizer_v2/optimizer_v2.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
3
153,567
19
11
7
75
9
0
20
86
diff
DOCS-#3099: Fix `BasePandasDataSet` docstrings warnings (#4333) Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru> Signed-off-by: Alexander Myskov <alexander.myskov@intel.com>
https://github.com/modin-project/modin.git
def diff(self, periods=1, axis=0): # noqa: PR01, RT01, D200 axis = self._get_axis_number(axis) return self.__constructor__( query_compiler=self._query_compiler.diff( fold_axis=axis, axis=axis, periods=periods ) )
48
base.py
Python
modin/pandas/base.py
605efa618e7994681f57b11d04d417f353ef8d50
modin
1
243,968
66
13
21
325
38
0
91
218
draw_masks
[Feature] Support visualization for Panoptic Segmentation (#7041) * First commit of v2 * split the functions * Support to show panoptic result * temp * Support to show gt * support show gt * fix lint * Support to browse datasets * Fix unit tests * Fix findContours * fix comments * Fix ...
https://github.com/open-mmlab/mmdetection.git
def draw_masks(ax, img, masks, color=None, with_edge=True, alpha=0.8): taken_colors = set([0, 0, 0]) if color is None: random_colors = np.random.randint(0, 255, (masks.size(0), 3)) color = [tuple(c) for c in random_colors] color = np.array(color, dtype=np.uint8) polygons = [] ...
217
image.py
Python
mmdet/core/visualization/image.py
301d4a2d4cfe1cdb62608e2892924be3e67e3098
mmdetection
7
277,143
3
6
3
18
3
0
3
6
inject_argument_info_in_traceback
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def inject_argument_info_in_traceback(fn, object_name=None):
25
traceback_utils.py
Python
keras/utils/traceback_utils.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
215,557
140
17
50
563
48
0
211
790
fire_master
Use salt.channel.client instead of salt.transport.client
https://github.com/saltstack/salt.git
def fire_master(data, tag, preload=None): if ( __opts__.get("local", None) or __opts__.get("file_client", None) == "local" ) and not __opts__.get("use_master_when_local", False): # We can't send an event if we're in masterless mode log.warning("Local mode detected. Event with tag %...
326
event.py
Python
salt/modules/event.py
70972c8016ff5d6fbdd7f83776077b0936f60dea
salt
13
257,683
23
13
6
115
16
0
26
72
test__create_document_index_wrong_mapping_raises
Use opensearch-py in OpenSearchDocumentStore (#2691) * add Opensearch extras * let OpenSearchDocumentStore use opensearch-py * Update Documentation & Code Style * fix a bug found after adding tests Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: ...
https://github.com/deepset-ai/haystack.git
def test__create_document_index_wrong_mapping_raises(self, mocked_document_store, index): mocked_document_store.search_fields = ["age"] mocked_document_store.client.indices.exists.return_value = True mocked_document_store.client.indices.get.return_value = {self.index_name: index} ...
66
test_opensearch.py
Python
test/document_stores/test_opensearch.py
e7627c3f8b241654b61f8523479c81f855102f0a
haystack
1
119,982
12
11
5
64
10
0
12
99
bcoo_broadcast_in_dim
[sparse] Update docstrings for bcoo primitives. PiperOrigin-RevId: 438685829
https://github.com/google/jax.git
def bcoo_broadcast_in_dim(mat, *, shape, broadcast_dimensions): return BCOO(_bcoo_broadcast_in_dim(mat.data, mat.indices, spinfo=mat._info, shape=shape, broadcast_dimensions=broadcast_dimensions), shape=shape)
44
bcoo.py
Python
jax/experimental/sparse/bcoo.py
3184dd65a222354bffa2466d9a375162f5649132
jax
1
70,190
30
13
7
67
10
0
34
106
connect_docker
First version. Container list and CPU ok, need others stats
https://github.com/nicolargo/glances.git
def connect_docker(self): try: # Do not use the timeout option (see issue #1878) ret = docker.from_env() except Exception as e: logger.error("docker plugin - Can not connect to Docker ({})".format(e)) ret = None return ret
36
glances_docker.py
Python
glances/plugins/glances_docker.py
0e098407e15bc1dc341c571cec8fd34ecb4b0943
glances
2
309,563
37
15
26
185
21
0
41
267
favorites_folder_payload
Allow browsing favorites in Sonos media browser (#64082) * Allow browsing favorites in Sonos media browser * Group favorites by type, add thumbnails * Update homeassistant/components/sonos/media_player.py * Apply suggestions from code review Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Keep fa...
https://github.com/home-assistant/core.git
def favorites_folder_payload(favorites, media_content_id): children = [] content_type = SONOS_TYPES_MAPPING[media_content_id] for favorite in favorites: if favorite.reference.item_class != media_content_id: continue children.append( BrowseMedia( ...
123
media_browser.py
Python
homeassistant/components/sonos/media_browser.py
2f18058fe739cabc0495a14e00df3ced60009ba2
core
3
82,431
38
17
21
308
30
0
56
279
test_sitemap_unpublished_titles
ci: Added codespell (#7355) Co-authored-by: Christian Clauss <cclauss@me.com> * ci: codespell config taken from #7292
https://github.com/django-cms/django-cms.git
def test_sitemap_unpublished_titles(self): sitemap = CMSSitemap() locations = [] urlset = sitemap.get_urls() unpublished_titles = set() for item in urlset: locations.append(item['location']) for page in Page.objects.drafts(): if page.get_p...
167
test_sitemap.py
Python
cms/tests/test_sitemap.py
c1290c9ff89cb00caa5469129fd527e9d82cd820
django-cms
6
104,073
16
13
7
111
13
0
20
53
xsplitext
Add SVHN dataset (#3535) * Add SVHN * Add support for streaming * README fix * Don't specify labels twice
https://github.com/huggingface/datasets.git
def xsplitext(a): a, *b = a.split("::") if is_local_path(a): return os.path.splitext(Path(a).as_posix()) else: a, ext = posixpath.splitext(a) return "::".join([a] + b), ext
64
streaming_download_manager.py
Python
src/datasets/utils/streaming_download_manager.py
a6ff8d6fb5ba2770737d2d922976c50f480d23a2
datasets
2
249,435
26
12
17
133
13
0
27
162
test_400_missing_param_without_id_access_token
Drop support for calling `/_matrix/client/v3/rooms/{roomId}/invite` without an `id_access_token` (#13241) Fixes #13206 Signed-off-by: Jacek Kusnierz jacek.kusnierz@tum.de
https://github.com/matrix-org/synapse.git
def test_400_missing_param_without_id_access_token(self) -> None: channel = self.make_request( method="POST", path="/rooms/" + self.room_id + "/invite", content={ "id_server": "example.com", "medium": "email", "address"...
75
test_rooms.py
Python
tests/rest/client/test_rooms.py
84ddcd7bbfe4100101741a408a91f283a8f742c7
synapse
1
14,004
8
9
27
39
6
0
9
38
__anext__
refactor: avoid run in executor creating threads (#5518)
https://github.com/jina-ai/jina.git
async def __anext__(self): if isinstance(self.iterator, Iterator): if not self._iterate_sync_in_thread:
108
helper.py
Python
jina/serve/stream/helper.py
5a0830cfb6bfa33dcffb38681f86efe5f6f0f97c
jina
7
153,106
20
10
4
44
6
0
21
64
_check_index_name
FIX-#3197: do not pass lambdas to the backend in GroupBy (#3373) Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
https://github.com/modin-project/modin.git
def _check_index_name(self, result): if self._by is not None: # pandas does not name the index for this case result._query_compiler.set_index_name(None) return result
26
groupby.py
Python
modin/pandas/groupby.py
1e65a4afd191cf61ba05b80545d23f9b88962f41
modin
2
64,242
120
19
48
708
45
0
214
162
update_billed_amount_based_on_so
refactor: use frappe.qb instead of sql (cherry picked from commit 0a9ec9f591f8b4d0e630a3c902b69c9996f080dd)
https://github.com/frappe/erpnext.git
def update_billed_amount_based_on_so(so_detail, update_modified=True): from frappe.query_builder.functions import Sum # Billed against Sales Order directly si = frappe.qb.DocType("Sales Invoice").as_("si") si_item = frappe.qb.DocType("Sales Invoice Item").as_("si_item") sum_amount = Sum(si_item.amount).as_("amoun...
440
delivery_note.py
Python
erpnext/stock/doctype/delivery_note/delivery_note.py
ce0b84f54d495fc78a6792a9b05d0eb1dc799ed2
erpnext
11
257,136
68
11
13
206
30
1
82
148
mock_json_schema
Change YAML version exception into a warning (#2385) * Change exception into warning, add strict_version param, and remove compatibility between schemas * Simplify update_json_schema * Rename unstable into master * Prevent validate_config from changing the config to validate * Fix version validation and ad...
https://github.com/deepset-ai/haystack.git
def mock_json_schema(request, monkeypatch, tmp_path): # Do not patch integration tests if "integration" in request.keywords: return # Mock the subclasses list to make it very small, containing only mock nodes monkeypatch.setattr( haystack.nodes._json_schema, "find_subclasse...
@pytest.mark.integration @pytest.mark.elasticsearch
114
test_pipeline_yaml.py
Python
test/test_pipeline_yaml.py
4eec2dc45ee60e8b8780aa4f956aea8ad3624da3
haystack
2
176,591
6
7
2
25
4
0
6
12
node_connected_component
Added examples in connected and strongly connected functions (#5559) * added examples * Update networkx/algorithms/components/connected.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
https://github.com/networkx/networkx.git
def node_connected_component(G, n): return _plain_bfs(G, n)
15
connected.py
Python
networkx/algorithms/components/connected.py
7cad29b3542ad867f1eb5b7b6a9087495f252749
networkx
1
199,702
33
13
9
132
13
1
42
84
dup_hermite
Run orthopolys and appellseqs through a common interface Including unifying the two Chebyshev generators into one function. There are also two kinds of Hermite polynomials, and they too share the same recurrence, but the second type He_n(x) (aka the probabilist, reduced or small polynomials) will not be added here.
https://github.com/sympy/sympy.git
def dup_hermite(n, K): if n < 1: return [1] m2, m1 = [1], [2, 0] for i in range(2, n+1): a = dup_lshift(m1, 1, K) b = dup_mul_ground(m2, i-1, K) m2, m1 = m1, dup_mul_ground(dup_sub(a, b, K), 2, K) return m1 @public
@public
87
orthopolys.py
Python
sympy/polys/orthopolys.py
d1d46df73ebaad94089847558d00a8b7269f554d
sympy
3
155,341
84
22
43
473
23
0
173
786
_build_repr_df
REFACTOR-#5310: Remove some hasattr('columns') checks. (#5311) Signed-off-by: mvashishtha <mahesh@ponder.io>
https://github.com/modin-project/modin.git
def _build_repr_df(self, num_rows, num_cols): # Fast track for empty dataframe. if len(self.index) == 0 or (self._is_dataframe and len(self.columns) == 0): return pandas.DataFrame( index=self.index, columns=self.columns if self._is_dataframe else None...
295
base.py
Python
modin/pandas/base.py
2ebc9cf51bfc773e3d4c898f5a33c0f60ad7ebc5
modin
14
131,824
65
13
19
335
24
1
117
269
test_get_conda_env_dir
[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_get_conda_env_dir(tmp_path): # Simulate starting in an env named tf1. d = tmp_path / "envs" / "tf1" Path.mkdir(d, parents=True) with mock.patch.dict( os.environ, {"CONDA_PREFIX": str(d), "CONDA_DEFAULT_ENV": "tf1"} ): with pytest.raises(ValueError): # Env t...
@pytest.mark.skipif( os.environ.get("CI") and sys.platform != "linux", reason="This test is only run on linux CI machines.", )
152
test_runtime_env_complicated.py
Python
python/ray/tests/test_runtime_env_complicated.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
1
166,973
14
9
2
45
3
0
14
35
reso
DOC: Added docstrings to fixtures defined in array module (#47211)
https://github.com/pandas-dev/pandas.git
def reso(self, unit): # TODO: avoid hard-coding return {"s": 7, "ms": 8, "us": 9}[unit]
25
test_datetimes.py
Python
pandas/tests/arrays/test_datetimes.py
89be1f053b695c4ce1c0569f737caf3f03c12128
pandas
1
267,468
18
10
4
48
7
0
18
50
set_queue
Forked display via queue (#77056) * Forked Display via queue * Docs and simple code cleanup * Only proxy Display.display * Remove unused import * comment * Update deadlock comment, remove py3 check * Don't flush display, and don't lock from forks * clog frag * ci_complete ci_coverage * Add u...
https://github.com/ansible/ansible.git
def set_queue(self, queue): if multiprocessing_context.parent_process() is None: raise RuntimeError('queue cannot be set in parent process') self._final_q = queue
27
display.py
Python
lib/ansible/utils/display.py
5e369604e1930b1a2e071fecd7ec5276ebd12cb1
ansible
2
124,651
32
13
32
220
24
0
44
421
_get_tune_run_arguments
[AIR] Fix `ResourceChangingScheduler` not working with AIR (#26307) This PR ensures that the new trial resources set by `ResourceChangingScheduler` are respected by the train loop logic by modifying the scaling config to match. Previously, even though trials had their resources updated, the scaling config was not modi...
https://github.com/ray-project/ray.git
def _get_tune_run_arguments(self) -> Dict[str, Any]: return dict( mode=self._tune_config.mode, metric=self._tune_config.metric, callbacks=self._run_config.callbacks, sync_config=self._run_config.sync_config, stop=self._run_config.stop, ...
155
tuner_internal.py
Python
python/ray/tune/impl/tuner_internal.py
b3878e26d765e28dd7c69abadbd856181037db97
ray
5
274,552
31
10
13
134
15
0
43
110
get
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def get(identifier): if identifier is None: return None if isinstance(identifier, str): identifier = str(identifier) return deserialize(identifier) if isinstance(identifier, dict): return deserialize(identifier) if callable(identifier): return identifier ...
59
losses.py
Python
keras/losses.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
5
288,074
33
9
12
126
15
1
37
84
test_discover_device_tracker
Move MQTT discovery hass.data globals to dataclass (#78706) * Add MQTT discovery hass.data globals to dataclass * isort * Additional rework * Add hass.data["mqtt_tags"] to dataclass * Follow-up comment * Corrections
https://github.com/home-assistant/core.git
async def test_discover_device_tracker(hass, mqtt_mock_entry_no_yaml_config, caplog): await mqtt_mock_entry_no_yaml_config() async_fire_mqtt_message( hass, "homeassistant/device_tracker/bla/config", '{ "name": "test", "state_topic": "test_topic" }', ) await hass.async_block_...
@pytest.mark.no_fail_on_log_exception
65
test_device_tracker_discovery.py
Python
tests/components/mqtt/test_device_tracker_discovery.py
84b2c74746b694d217fe6d448a8dfff4bc2d7a9e
core
1
263,853
106
13
19
216
21
0
165
283
_get_module_collection_mode
building: more module collection modes, consolidate noarchive codepath Map the module collection mode strings into (combinations of) integer flags that control try basic collection modes: - collect a pyc into PYZ archive - collect a pyc as a data file - collect a py as a data file Consolidate the `noarchive=True` cod...
https://github.com/pyinstaller/pyinstaller.git
def _get_module_collection_mode(mode_dict, name, noarchive=False): # Default mode: collect into PYZ, unless noarchive is enabled. In that case, collect as pyc. mode_flags = _ModuleCollectionMode.PYC if noarchive else _ModuleCollectionMode.PYZ # If we have no collection mode settings, end here and now....
122
build_main.py
Python
PyInstaller/building/build_main.py
6e1bfa2de254d8ae302f54dcea0cfefae4dd3585
pyinstaller
8
160,904
39
11
7
143
18
0
50
145
test_error_message_unsigned
TST: Add a failing test case to demonstrate the bug gh2176
https://github.com/numpy/numpy.git
def test_error_message_unsigned(self): # Ensure to test for potential overflow in the case of: # x - y # and # y - x x = np.asarray([0, 1, 8], dtype='uint8') y = np.asarray([4, 4, 4], dtype='uint8') with pytest.raises(AssertionError) as exc_...
84
test_utils.py
Python
numpy/testing/tests/test_utils.py
57d04d883e874c611091933c4c36e1cd43ea0e04
numpy
1
211,439
48
12
26
272
33
0
73
343
forward
Update box head (#6804) * add flag loss_normalize_pos * add faster vitdet * update faster vitdet
https://github.com/PaddlePaddle/PaddleDetection.git
def forward(self, body_feats=None, rois=None, rois_num=None, inputs=None): if self.training: rois, rois_num, targets = self.bbox_assigner(rois, rois_num, inputs) self.assigned_rois = (rois, rois_num) self.assigned_targets = targets rois_feat = self.roi_extra...
182
bbox_head.py
Python
ppdet/modeling/heads/bbox_head.py
0b8165cf0029495d9b51007863d73c7db414313f
PaddleDetection
4
107,161
14
11
8
129
17
0
18
42
test_constrained_layout22
ENH: implement and use base layout_engine for more flexible layout.
https://github.com/matplotlib/matplotlib.git
def test_constrained_layout22(): fig, ax = plt.subplots(layout="constrained") fig.draw_without_rendering() extents0 = np.copy(ax.get_position().extents) fig.suptitle("Suptitle", y=0.5) fig.draw_without_rendering() extents1 = np.copy(ax.get_position().extents) np.testing.assert_allclo...
77
test_constrainedlayout.py
Python
lib/matplotlib/tests/test_constrainedlayout.py
ec4dfbc3c83866f487ff0bc9c87b0d43a1c02b22
matplotlib
1
107,536
70
17
31
380
26
0
98
376
encode_multipart_formdata
Properly capitalize "Unicode". See e.g. https://en.wikipedia.org/wiki/Unicode, https://docs.python.org/3/howto/unicode.html. Also associated minor doc cleanups.
https://github.com/matplotlib/matplotlib.git
def encode_multipart_formdata(fields, boundary=None): # copy requests imports in here: from io import BytesIO from requests.packages.urllib3.filepost import ( choose_boundary, writer, b, get_content_type ) body = BytesIO() if boundary is None: boundary = choose_boundary() ...
215
gh_api.py
Python
tools/gh_api.py
88cb4c9d0aa1e790fc4689ca7e68725bf851bf63
matplotlib
6
155,520
181
15
66
824
71
0
299
798
take
DOC: normalize whitespace in doctests in slicing.py (#8512)
https://github.com/dask/dask.git
def take(outname, inname, chunks, index, itemsize, axis=0): from .core import PerformanceWarning plan = slicing_plan(chunks[axis], index) if len(plan) >= len(chunks[axis]) * 10: factor = math.ceil(len(plan) / len(chunks[axis])) warnings.warn( "Slicing with an out-of-order ...
509
slicing.py
Python
dask/array/slicing.py
fa8dfede71677a2301d4cd602cf4b27af41cbc4f
dask
17
292,711
33
14
12
211
20
0
49
157
_fetch_status
Correctly handle missing mpd albumart (#66771) Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
https://github.com/home-assistant/core.git
async def _fetch_status(self): self._status = await self._client.status() self._currentsong = await self._client.currentsong() await self._async_update_media_image_hash() if (position := self._status.get("elapsed")) is None: position = self._status.get("time") ...
123
media_player.py
Python
homeassistant/components/mpd/media_player.py
facf22c2ddccbf9b205a2d8b26da457330b53ba6
core
6
9,833
26
10
17
105
9
0
39
126
mixin_head_parser
feat: star routing (#3900) * feat(proto): adjust proto for star routing (#3844) * feat(proto): adjust proto for star routing * feat(proto): generate proto files * feat(grpc): refactor grpclet interface (#3846) * feat: refactor connection pool for star routing (#3872) * feat(k8s): add more labels to k8s ...
https://github.com/jina-ai/jina.git
def mixin_head_parser(parser): gp = add_arg_group(parser, title='Head') gp.add_argument( '--uses-before-address', type=str, help='The address of the uses-before runtime', ) gp.add_argument( '--uses-after-address', type=str, help='The address of the...
61
head.py
Python
jina/parsers/peapods/runtimes/head.py
933415bfa1f9eb89f935037014dfed816eb9815d
jina
1
266,160
22
11
7
85
7
0
28
122
_get_color
Closes #10904: Added Colors to SVG for Front and Rear Ports (#10905) * Added Colors to SVG for Front and Reaer Ports Fix for feature request 10904 thanks to @TheZackCodec * Simplify termination color resolution Co-authored-by: jeremystretch <jstretch@ns1.com>
https://github.com/netbox-community/netbox.git
def _get_color(cls, instance): if hasattr(instance, 'parent_object'): # Termination return getattr(instance, 'color', 'f0f0f0') or 'f0f0f0' if hasattr(instance, 'device_role'): # Device return instance.device_role.color else: #...
45
cables.py
Python
netbox/dcim/svg/cables.py
a2007a4728faafeee5c296afabc116707db42344
netbox
4
181,559
14
9
10
61
7
0
17
33
mask_color
format(black): formatted files to latest version (#1735)
https://github.com/Zulko/moviepy.git
def mask_color(clip, color=None, threshold=0, stiffness=1): if color is None: color = [0, 0, 0] color = np.array(color)
67
mask_color.py
Python
moviepy/video/fx/mask_color.py
0b63f472ee0b67bf000412179bfb8ee30c52ce27
moviepy
2
269,377
70
17
34
380
17
0
119
390
_preprocess_symbolic_input
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def _preprocess_symbolic_input(x, data_format, mode): if mode == "tf": x /= 127.5 x -= 1.0 return x elif mode == "torch": x /= 255.0 mean = [0.485, 0.456, 0.406] std = [0.229, 0.224, 0.225] else: if data_format == "channels_first": # '...
266
imagenet_utils.py
Python
keras/applications/imagenet_utils.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
8
261,290
42
11
14
164
26
0
51
109
test_lassolarsic_noise_variance
MAINT Clean deprecation for 1.2: normalize in linear models (#24391)
https://github.com/scikit-learn/scikit-learn.git
def test_lassolarsic_noise_variance(fit_intercept): rng = np.random.RandomState(0) X, y = datasets.make_regression( n_samples=10, n_features=11 - fit_intercept, random_state=rng ) model = make_pipeline(StandardScaler(), LassoLarsIC(fit_intercept=fit_intercept)) err_msg = ( "Yo...
102
test_least_angle.py
Python
sklearn/linear_model/tests/test_least_angle.py
e41753ebd57c44ae91b389f190c43ddc0b384a75
scikit-learn
1
249,737
75
13
34
406
13
0
101
523
test_tokenize_query
Unified search query syntax using the full-text search capabilities of the underlying DB. (#11635) Support a unified search query syntax which leverages more of the full-text search of each database supported by Synapse. Supports, with the same syntax across Postgresql 11+ and Sqlite: - quoted "search terms" -...
https://github.com/matrix-org/synapse.git
def test_tokenize_query(self) -> None: cases = ( ("brown", ["brown"]), ("quick brown", ["quick", SearchToken.And, "brown"]), ("quick \t brown", ["quick", SearchToken.And, "brown"]), ('"brown quick"', [Phrase(["brown", "quick"])]), ("furphy OR ...
240
test_room_search.py
Python
tests/storage/test_room_search.py
d902181de98399d90c46c4e4e2cf631064757941
synapse
2
43,076
25
11
6
119
15
0
26
72
test_test_with_existing_dag_run
Mask secrets in stdout for 'airflow tasks test' (#24362) A stdout redirector is implemented to mask all values to stdout and redact any secrets in it with the secrets masker. This redirector is applied to the 'airflow.task' logger. Co-authored-by: Alex Kennedy <alex.kennedy@astronomer.io>
https://github.com/apache/airflow.git
def test_test_with_existing_dag_run(self, caplog): task_id = 'print_the_context' args = self.parser.parse_args(["tasks", "test", self.dag_id, task_id, DEFAULT_DATE.isoformat()]) with caplog.at_level("INFO", logger="airflow.task"): task_command.task_test(args) assert ...
62
test_task_command.py
Python
tests/cli/commands/test_task_command.py
3007159c2468f8e74476cc17573e03655ab168fa
airflow
1
40,644
69
15
16
175
12
0
91
364
_determine_axis_sharing
Refactor figure setup and subplot metadata tracking into Subplots class Squashed commit of the following: commit e6f99078d46947eab678b9dd0303657a3129f9fc Author: Michael Waskom <mwaskom@nyu.edu> Date: Sun Aug 1 17:56:49 2021 -0400 Address a couple TODOs commit c48ba3af8095973b7dca9554934a695751f58726 Author: ...
https://github.com/mwaskom/seaborn.git
def _determine_axis_sharing(self) -> None: axis_to_dim = {"x": "col", "y": "row"} key: str val: str | bool for axis in "xy": key = f"share{axis}" # Always use user-specified value, if present if key not in self.subplot_spec: if...
97
subplots.py
Python
seaborn/_core/subplots.py
c16180493bd44fd76092fdd9ea0060bac91e47fe
seaborn
6
69,330
72
20
35
544
39
0
118
83
get_item_map
refactor: rewrite `Stock Projected Qty Report` queries in `QB`
https://github.com/frappe/erpnext.git
def get_item_map(item_code, include_uom): bin = frappe.qb.DocType("Bin") item = frappe.qb.DocType("Item") query = ( frappe.qb.from_(item) .select(item.name, item.item_name, item.description, item.item_group, item.brand, item.stock_uom) .where( (item.is_stock_item == 1) & (item.disabled == 0) & ( ...
340
stock_projected_qty.py
Python
erpnext/stock/report/stock_projected_qty/stock_projected_qty.py
c18f13a45ba6498245ba0429e61205a0df2434a6
erpnext
8
259,435
110
15
32
446
43
1
159
438
test_loss_of_perfect_prediction
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_loss_of_perfect_prediction(loss, sample_weight): if not loss.is_multiclass: # Use small values such that exp(value) is not nan. raw_prediction = np.array([-10, -0.1, 0, 0.1, 3, 10]) # If link is identity, we must respect the interval of y_pred: if isinstance(loss.link, ...
@pytest.mark.parametrize("loss", LOSS_INSTANCES, ids=loss_instance_name) @pytest.mark.parametrize("sample_weight", [None, "range"])
266
test_loss.py
Python
sklearn/_loss/tests/test_loss.py
75a94f518f7bd7d0bf581ffb67d9f961e3c4efbc
scikit-learn
6
259,424
22
12
8
110
16
0
24
88
transform
ENH Preserving dtypes for ICA (#22806) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
https://github.com/scikit-learn/scikit-learn.git
def transform(self, X, copy=True): check_is_fitted(self) X = self._validate_data( X, copy=(copy and self._whiten), dtype=[np.float64, np.float32], reset=False ) if self._whiten: X -= self.mean_ return np.dot(X, self.components_.T)
73
_fastica.py
Python
sklearn/decomposition/_fastica.py
d14fd82cf423c21ab6d01f7d0430083f9d7026be
scikit-learn
3
120,507
103
17
81
439
27
0
181
334
polar
Change implementation of jax.scipy.linalg.polar() and jax._src.scipy.eigh to use the QDWH decomposition from jax._src.lax.qdwh. Remove jax._src.lax.polar. PiperOrigin-RevId: 448241206
https://github.com/google/jax.git
def polar(a, side='right', *, method='qdwh', eps=None, max_iterations=None): r a = jnp.asarray(a) if a.ndim != 2: raise ValueError("The input `a` must be a 2-D array.") if side not in ["right", "left"]: raise ValueError("The argument `side` must be either 'right' or 'left'.") m, n = a.shape if met...
258
linalg.py
Python
jax/_src/scipy/linalg.py
7ba36fc1784a7a286aa13ab7c098f84ff64336f1
jax
10
167,666
9
9
4
55
6
1
9
24
data_missing_for_sorting
ENH/TST: Add BaseMethodsTests tests for ArrowExtensionArray (#47552) * ENH/TST: Add BaseMethodsTests tests for ArrowExtensionArray * Passing test now * add xfails for arraymanager * Fix typo * Trigger CI * Add xfails for min version and datamanger * Adjust more tests
https://github.com/pandas-dev/pandas.git
def data_missing_for_sorting(data_for_grouping): return type(data_for_grouping)._from_sequence( [data_for_grouping[0], data_for_grouping[2], data_for_grouping[4]] ) @pytest.fixture
@pytest.fixture
31
test_arrow.py
Python
pandas/tests/extension/test_arrow.py
700ef33b4dd5d5e76220ee50d1f07775dff15428
pandas
1
190,658
4
6
11
16
2
0
4
11
test_class_or_function_idval
Refactor idmaker functions into class IdMaker This commit only refactors, it does not change or add functionality yet. Public API is retained. Reason or refactoring: User provided parameter IDs (e.g. Metafunc.parametrize(ids=...)) had so far only been used to calculate a unique test ID for each test invocation. That ...
https://github.com/pytest-dev/pytest.git
def test_class_or_function_idval(self) -> None:
66
metafunc.py
Python
testing/python/metafunc.py
b21b008118fc8cf65b4bcd9b059f1cd704e05c68
pytest
2
257,715
56
16
10
152
17
0
85
214
load_search_paths
Add enhanced pydoc-markdown pre-hook (#2979) * add pydoc-markdown pre-hook * add more comments, remove debug prints
https://github.com/deepset-ai/haystack.git
def load_search_paths(): paths = dict() for fname in glob.glob("docs/_src/api/pydoc/*.yml"): with open(fname) as f: config = yaml.safe_load(f.read()) # we always have only one loader in Haystack loader = config["loaders"][0] # `search_path` is a list ...
85
pydoc-markdown.py
Python
.github/utils/pydoc-markdown.py
0e8efdafa9e1b3e1a7096308b13760e5163f1439
haystack
2
195,007
41
11
10
155
14
0
49
125
contains_offensive_language
Fix `detect_offensive_language` script (#4054) * add fix * add test * make utils/safety robust to empty strings
https://github.com/facebookresearch/ParlAI.git
def contains_offensive_language(self, text): if not text: return False, 1.0 act = {'text': text, 'episode_done': True} self.model.observe(act) response = self.model.act()['text'] pred_class, prob = [x.split(': ')[-1] for x in response.split('\n')] pre...
92
safety.py
Python
parlai/utils/safety.py
e98b8603d83ab538ec6715f913a5ca980421ad6a
ParlAI
3
211,971
76
12
35
273
34
0
110
327
recompute
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 recompute(self) -> None: document = self._document() if document is None: return new_models: Set[Model] = set() for mr in document.roots: new_models |= mr.references() old_models = set(self._models.values()) to_detach = old_models -...
170
models.py
Python
bokeh/document/models.py
fca16442ae90afcd2ac61f4e554e538776730831
bokeh
7
84,404
14
9
26
75
10
0
16
51
test_receive_stream_email_forwarded_success
email_error: Improve tests for inbound email edge case. Tests to assist with clarifying #22585.
https://github.com/zulip/zulip.git
def test_receive_stream_email_forwarded_success(self) -> None: msgtext = user_profile = self.example_user("hamlet") self.login_user(user_profile) self.subscribe(user_profile, "Denmark") stream = get_stream("Denmark", user_profile.realm)
73
test_email_mirror.py
Python
zerver/tests/test_email_mirror.py
c6931434e994aee5fa15696be4d8db2c99c6c891
zulip
1
30,315
9
8
6
33
4
0
9
39
clean_ansi_sequence
remove ansi sequences from output in tests fixing tests Update test_entry_point.py
https://github.com/spotDL/spotify-downloader.git
def clean_ansi_sequence(text): return re.sub( r'(?:\x1B[@-Z\\-_]|[\x80-\x9A\x9C-\x9F]|(?:\x1B\[|\x9B)[0-?]*[ -/]*[@-~])', '', text, )
19
conftest.py
Python
tests/conftest.py
e2155b300889d657a29f4db0471643b25a8af982
spotify-downloader
1
101,386
7
11
3
42
6
0
7
21
has_predicted_mask
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 has_predicted_mask(self) -> bool: return bool(self._model.config.get("learn_mask", False))
24
convert.py
Python
scripts/convert.py
1022651eb8a7741014f5d2ec7cbfe882120dfa5f
faceswap
1
12,806
13
12
6
54
7
0
14
68
collect_all_results
fix: fix specific params problem with branches (#5038)
https://github.com/jina-ai/jina.git
def collect_all_results(self): res = {} for node in self.all_nodes: if node.result_in_params_returned: res.update(node.result_in_params_returned) return res
32
topology_graph.py
Python
jina/serve/runtimes/gateway/graph/topology_graph.py
032bd5e662dd16d4cfb394857074779970ae444a
jina
3
19,465
21
11
11
64
8
0
23
53
_looks_like_bpo_44860
Vendor in pip 21.2.4 release (from pip 21.2.2 prior). (#5009) * Vendor in pip 21.2.4 release (from pip 21.2.2 prior). * Add news fragment for pip 21.2.4 vendor update. * Add potentially missing LICENSE files
https://github.com/pypa/pipenv.git
def _looks_like_bpo_44860() -> bool: from distutils.command.install import INSTALL_SCHEMES # type: ignore try: unix_user_platlib = INSTALL_SCHEMES["unix_user"]["platlib"] except KeyError: return False return unix_user_platlib == "$usersite"
35
__init__.py
Python
pipenv/patched/notpip/_internal/locations/__init__.py
7e33fcae4384563b4c927fd44318c29dd524a097
pipenv
2
247,938
9
8
14
32
5
0
10
31
test_lots_of_queued_things
Convert `Linearizer` tests from `inlineCallbacks` to async (#12353) Signed-off-by: Sean Quah <seanq@element.io>
https://github.com/matrix-org/synapse.git
def test_lots_of_queued_things(self) -> None: linearizer = Linearizer() key = ""
72
test_linearizer.py
Python
tests/util/test_linearizer.py
41b5f72677ea9763f3cf920d4f6df507653222f2
synapse
2
243,932
116
19
42
642
63
0
178
828
forward
Fix None grad problem during training TOOD by adding SigmoidGeometricMean (#7090)
https://github.com/open-mmlab/mmdetection.git
def forward(self, feats): cls_scores = [] bbox_preds = [] for idx, (x, scale, stride) in enumerate( zip(feats, self.scales, self.prior_generator.strides)): b, c, h, w = x.shape anchor = self.prior_generator.single_level_grid_priors( ...
415
tood_head.py
Python
mmdet/models/dense_heads/tood_head.py
08bc3d7a8b08d9452d0734e9ff29c2e9b98890e5
mmdetection
6
68,836
50
18
71
304
22
0
80
49
get_mode_of_payment_details
refactor: DB independent quoting and truthy/falsy values (#31358) * refactor: DB independent quoting and truthy/falsy values * style: reformat to black spec * fix: ifnull -> coalesce * fix: coalesce -> Coalesce * fix: revert pypika comparison * refactor: convert queries to QB * fix: incorrect value t...
https://github.com/frappe/erpnext.git
def get_mode_of_payment_details(filters): mode_of_payment_details = {} invoice_list = get_invoices(filters) invoice_list_names = ",".join("'" + invoice["name"] + "'" for invoice in invoice_list) if invoice_list: inv_mop_detail = frappe.db.sql( .format( invoice_list_names=invoice_list_names ), as_dict...
181
sales_payment_summary.py
Python
erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
74a782d81d8f8c4a4d9214a9c06377e5e6e464dd
erpnext
9
278,956
6
7
22
22
4
0
6
12
_replace_child_layer_functions
Remove pylint comments. PiperOrigin-RevId: 452353044
https://github.com/keras-team/keras.git
def _replace_child_layer_functions(layer, serialization_cache): original_fns = {}
106
save_impl.py
Python
keras/saving/saved_model/save_impl.py
3613c3defc39c236fb1592c4f7ba1a9cc887343a
keras
6
130,340
64
14
24
267
18
0
92
296
fillout_resources_kubernetes
[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 fillout_resources_kubernetes(config): if "available_node_types" not in config: return config node_types = copy.deepcopy(config["available_node_types"]) head_node_type = config["head_node_type"] for node_type in node_types: node_config = node_types[node_type]["node_config"] ...
151
config.py
Python
python/ray/autoscaler/_private/_kubernetes/config.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
5
132,909
20
9
3
47
10
0
20
48
nodes
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
https://github.com/ray-project/ray.git
def nodes(self): # This should be imported here, otherwise, it will error doc build. import ray.core.generated.ray_client_pb2 as ray_client_pb2 return self.worker.get_cluster_info(ray_client_pb2.ClusterInfoType.NODES)
29
api.py
Python
python/ray/util/client/api.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
1
260,539
20
10
13
124
16
0
21
128
fit
MAINT parameter validation for CountVectorizer & TfidfVectorizer (#23853) Co-authored-by: Meekail Zain <zainmeekail@gmail.com> Co-authored-by: jeremiedbb <jeremiedbb@yahoo.fr>
https://github.com/scikit-learn/scikit-learn.git
def fit(self, raw_documents, y=None): self._validate_params() self._check_params() self._warn_for_unused_params() self._tfidf = TfidfTransformer( norm=self.norm, use_idf=self.use_idf, smooth_idf=self.smooth_idf, sublinear_tf=self.s...
78
text.py
Python
sklearn/feature_extraction/text.py
c300a8f2178fcae847f82ad548fe9452f2ba8bbb
scikit-learn
1
296,854
30
9
10
123
7
0
48
126
pretty_duration
Refactor history_stats to minimize database access (part 2) (#70255)
https://github.com/home-assistant/core.git
def pretty_duration(hours): seconds = int(3600 * hours) days, seconds = divmod(seconds, 86400) hours, seconds = divmod(seconds, 3600) minutes, seconds = divmod(seconds, 60) if days > 0: return "%dd %dh %dm" % (days, hours, minutes) if hours > 0: ...
76
helpers.py
Python
homeassistant/components/history_stats/helpers.py
73a368c24246b081cdb98923ca3180937d436c3b
core
3
249,151
36
10
36
177
13
0
47
219
test_search_term
Use literals in place of `HTTPStatus` constants in tests (#13469)
https://github.com/matrix-org/synapse.git
def test_search_term(self) -> None: # Create two test rooms room_id_1 = self.helper.create_room_as(self.admin_user, tok=self.admin_user_tok) room_id_2 = self.helper.create_room_as(self.admin_user, tok=self.admin_user_tok) room_name_1 = "something" room_name_2 = "LoremIp...
221
test_room.py
Python
tests/rest/admin/test_room.py
c97042f7eef3748e17c90e48a4122389a89c4735
synapse
1
273,184
70
12
19
248
25
0
99
294
get_vocabulary
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def get_vocabulary(self, include_special_tokens=True): # The lookup table data will not be sorted, so we will create a inverted # lookup here, and use that to lookup a range of indices [0, vocab_size). if self.lookup_table.size() == 0: vocab, indices = [], [] else: ...
158
index_lookup.py
Python
keras/layers/preprocessing/index_lookup.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
7
26,497
9
8
3
31
5
0
11
16
test_validate_invalid_subscription_and_query
Add Webhook payload via graphql subscriptions (#9394) * Add PoC of webhook subscriptions * add async webhooks subscription payloads feature * remove unneeded file * add translations subscription handling, fixes after review * remove todo * add descriptions * add descriptions, move subsrciption_payloa...
https://github.com/saleor/saleor.git
def test_validate_invalid_subscription_and_query(): result = validate_subscription_query(TEST_INVALID_MULTIPLE_SUBSCRIPTION_AND_QUERY) assert result is False TEST_INVALID_MULTIPLE_SUBSCRIPTION =
14
test_create_deliveries_for_subscription.py
Python
saleor/plugins/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.py
aca6418d6c36956bc1ab530e6ef7e146ec9df90c
saleor
1
176,825
37
15
23
209
19
0
62
319
analyze_symmetry
Update ISMAGS.analyze_symmetry docstring. (#5696) * Update ISMAGS.analyze_symmetry docstring. Co-authored-by: Peter C Kroon <pckroon@users.noreply.github.com> * Fix formatting. Co-authored-by: Peter C Kroon <pckroon@users.noreply.github.com>
https://github.com/networkx/networkx.git
def analyze_symmetry(self, graph, node_partitions, edge_colors): if self._symmetry_cache is not None: key = hash( ( tuple(graph.nodes), tuple(graph.edges), tuple(map(tuple, node_partitions)), tup...
140
ismags.py
Python
networkx/algorithms/isomorphism/ismags.py
52fe06608904ded6d3a0d49a64129e043351b308
networkx
4
261,313
31
11
9
95
8
0
34
125
set_output
ENH Introduces set_output API for pandas output (#23734) * Introduces set_output API for all transformers * TransformerMixin inherits from _SetOutputMixin * Adds tests * Adds whatsnew * Adds example on using set_output API * Adds developer docs for set_output
https://github.com/scikit-learn/scikit-learn.git
def set_output(self, *, transform=None): if hasattr(super(), "set_output"): return super().set_output(transform=transform) if transform == "pandas" and self.feature_names_out is None: warnings.warn( 'With transform="pandas", `func` should return a DataFr...
53
_function_transformer.py
Python
sklearn/preprocessing/_function_transformer.py
2a6703d9e8d1e54d22dd07f2bfff3c92adecd758
scikit-learn
4
167,798
40
11
21
138
11
0
45
116
add_flex_arithmetic_methods
TYP: more return annotations in core/ (#47618) * TYP: more return annotations in core/ * from __future__ import annotations * more __future__
https://github.com/pandas-dev/pandas.git
def add_flex_arithmetic_methods(cls) -> None: flex_arith_method, flex_comp_method = _get_method_wrappers(cls) new_methods = _create_methods(cls, flex_arith_method, flex_comp_method) new_methods.update( { "multiply": new_methods["mul"], "subtract": new_methods["sub"], ...
80
methods.py
Python
pandas/core/ops/methods.py
f65417656ba8c59438d832b6e2a431f78d40c21c
pandas
2
19,668
68
15
30
349
35
0
88
425
get_paths
Issue 4993 Add standard pre commit hooks and apply linting. (#4994) * Add .pre-commit-config.yaml to the project and exclude tests (for now). This does not include the MyPy linting that pip does but does include everything else.
https://github.com/pypa/pipenv.git
def get_paths(self): # type: () -> Optional[Dict[str, str]] tmpfile = vistir.path.create_tracked_tempfile(suffix=".json") tmpfile.close() tmpfile_path = make_posix(tmpfile.name) py_command = self.build_command( python_lib=True, python_inc=True, scripts=True, ...
197
environment.py
Python
pipenv/environment.py
9a3b3ce70621af6f9adaa9eeac9cf83fa149319c
pipenv
5
153,789
8
9
43
38
6
0
8
22
test_postprocessing_with_all_metadata
FEAT-#4412: Add Batch Pipeline API to Modin (#4452) Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru> Co-authored-by: Mahesh Vashishtha <mvashishtha@users.noreply.github.com> Signed-off-by: Rehan Durrani <rehan@ponder.io>
https://github.com/modin-project/modin.git
def test_postprocessing_with_all_metadata(self): arr = np.random.randint(0, 1000, (1000, 1000))
335
test_pipeline.py
Python
modin/experimental/batch/test/test_pipeline.py
3d4404e9d9a9b2a3327f8aee664a8e71ac1f18b8
modin
9
19,989
6
8
10
30
4
0
6
12
captured_stdout
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 captured_stdout() -> ContextManager[StreamWrapper]: return captured_output("stdout")
15
misc.py
Python
pipenv/patched/notpip/_internal/utils/misc.py
f3166e673fe8d40277b804d35d77dcdb760fc3b3
pipenv
1
215,964
104
19
40
451
33
0
135
470
list_sites
Update to latest ``pyupgrade`` hook. Stop skipping it on CI. Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
https://github.com/saltstack/salt.git
def list_sites(): ret = dict() ps_cmd = [ "Get-ChildItem", "-Path", r"'IIS:\Sites'", "|", "Select-Object applicationPool, Bindings, ID, Name, PhysicalPath, State", ] keep_keys = ("certificateHash", "certificateStoreName", "protocol", "sslFlags") cmd_ret...
260
win_iis.py
Python
salt/modules/win_iis.py
f2a783643de61cac1ff3288b40241e5ce6e1ddc8
salt
9
200,378
33
14
8
82
10
0
41
133
_construct
Fix various typos Found via `codespell -q 3 -L aboves,aline,ans,aother,arithmetics,assum,atleast,braket,clen,declar,declars,dorder,dum,enew,fo,fro,inout,iself,ist,ket,lamda,lightyear,lightyears,nd,numer,numers,orderd,ot,pring,rcall,rever,ro,ser,siz,splitted,sring,supercedes,te,tht,unequality,upto,vas,versin,whet`
https://github.com/sympy/sympy.git
def _construct(cls, attr, arg): # arg may be ``NoneToken()``, so comparison is done using == instead of ``is`` operator if arg == None: return cls.defaults.get(attr, none) else: if isinstance(arg, Dummy): # SymPy's replace uses Dummy instances re...
50
ast.py
Python
sympy/codegen/ast.py
24f1e7730119fe958cc8e28411f790c9a5ec04eb
sympy
3
101,232
10
10
4
66
9
0
10
43
_kwarg_requirements
lib.align updates: - alignments.py - Add typed dicts for imported alignments - Explicitly check for presence of thumb value in alignments dict - linting - detected_face.py - Typing - Linting - Legacy support for pre-aligned face - Update dependencies to new property names
https://github.com/deepfakes/faceswap.git
def _kwarg_requirements(self) -> Dict[Literal["gaussian", "normalized"], List[str]]: return dict(gaussian=["ksize", "sigmaX"], normalized=["ksize"])
38
detected_face.py
Python
lib/align/detected_face.py
5e73437be47f2410439a3c6716de96354e6a0c94
faceswap
1
259,041
56
14
18
207
15
0
74
194
_set_order
MNT Drops Python 3.7 in CI, wheel building, and docs (#22617) * MNT Drops Python 3.7 * MNT Bump NumPy and SciPy * FIX Fix build * FIX Bump versions improved * DOC Fixes numpy version [pypy] * BLD [pypy] [icc-build] * Update docs * MAINT use scipy.optimize.LinearConstraint in test * MAINT scipy ...
https://github.com/scikit-learn/scikit-learn.git
def _set_order(X, y, order="C"): if order not in [None, "C", "F"]: raise ValueError( "Unknown value for order. Got {} instead of None, 'C' or 'F'.".format(order) ) sparse_X = sparse.issparse(X) sparse_y = sparse.issparse(y) if order is not None: sparse_format = "...
123
_coordinate_descent.py
Python
sklearn/linear_model/_coordinate_descent.py
f1d3417b086550be670cbfbb5b3c1760ac99203f
scikit-learn
6
47,487
48
13
22
314
38
0
68
238
test_find_executable_task_instances_order_execution_date
Replace usage of `DummyOperator` with `EmptyOperator` (#22974) * Replace usage of `DummyOperator` with `EmptyOperator`
https://github.com/apache/airflow.git
def test_find_executable_task_instances_order_execution_date(self, dag_maker): dag_id_1 = 'SchedulerJobTest.test_find_executable_task_instances_order_execution_date-a' dag_id_2 = 'SchedulerJobTest.test_find_executable_task_instances_order_execution_date-b' task_id = 'task-a' ses...
193
test_scheduler_job.py
Python
tests/jobs/test_scheduler_job.py
49e336ae0302b386a2f47269a6d13988382d975f
airflow
3
166,202
6
10
5
36
6
0
6
20
null_count
ENH: Implement DataFrame interchange protocol (#46141)
https://github.com/pandas-dev/pandas.git
def null_count(self) -> int: return self._col.isna().sum()
20
column.py
Python
pandas/core/exchange/column.py
90140f055892a46f473bd26affab88a7f171e394
pandas
1
305,039
5
6
2
20
3
1
5
11
async_remove
Add a callback for data flow handler removal (#77394) * Add a callback for when data flows are removed * Call `async_remove` at the very end * Handle and log exceptions caught during flow removal * Log the error as an exception, with a traceback * Adjust test's expected logging output to match updated form...
https://github.com/home-assistant/core.git
def async_remove(self) -> None: @callback
@callback
8
data_entry_flow.py
Python
homeassistant/data_entry_flow.py
2224d0f43a048052cfc4572df95c7afcccdf3a57
core
1
185,711
28
12
18
122
12
0
36
167
_binding_chain
Don't include self in DOMNode.ancestors any more As well as dropping `self` from the list that DOMNode.ancestors provides, this commit also adds DOMNode.ancestors_with_self, which maintains the previous behaviour of DOMNode.ancestors.
https://github.com/Textualize/textual.git
def _binding_chain(self) -> list[tuple[DOMNode, Bindings]]: focused = self.focused namespace_bindings: list[tuple[DOMNode, Bindings]] if focused is None: namespace_bindings = [ (self.screen, self.screen._bindings), (self, self._bindings), ...
82
app.py
Python
src/textual/app.py
e3130f95c69648916f121e779a325b6f6f87e6ba
textual
3
177,497
12
9
3
55
8
0
14
23
multi_source_dijkstra_path
Hide edges with a weight of None in A*. (#5945) * Hide edges with a weight of None in A*. This matches the Dijkstra's weight interface. * Update Dijkstra's and A* docs for weights of None. * Add tests for A* with weight of None. * Add another test for A* with a weight function. * Document that None indi...
https://github.com/networkx/networkx.git
def multi_source_dijkstra_path(G, sources, cutoff=None, weight="weight"): length, path = multi_source_dijkstra(G, sources, cutoff=cutoff, weight=weight) return path
36
weighted.py
Python
networkx/algorithms/shortest_paths/weighted.py
d82815dba6c8ddce19cd49f700298dc82a58f066
networkx
1
224,010
29
12
7
69
11
1
29
108
load_file
Remove spaces at the ends of docstrings, normalize quotes
https://github.com/mkdocs/mkdocs.git
def load_file(self, config_file): try: return self.load_dict(utils.yaml_load(config_file)) except YAMLError as e: # MkDocs knows and understands ConfigurationErrors raise exceptions.ConfigurationError( f"MkDocs encountered an error parsing the...
@contextmanager
35
base.py
Python
mkdocs/config/base.py
e7f07cc82ab2be920ab426ba07456d8b2592714d
mkdocs
2
101,270
64
19
29
480
34
0
135
430
reload_images
lib.align updates: - alignments.py - Add typed dicts for imported alignments - Explicitly check for presence of thumb value in alignments dict - linting - detected_face.py - Typing - Linting - Legacy support for pre-aligned face - Update dependencies to new property names
https://github.com/deepfakes/faceswap.git
def reload_images(self, group_method, img_list): logger.info("Preparing to group...") if group_method == 'group_blur': filename_list, image_list = self._get_images() blurs = [self.estimate_blur(img) for img in image_list] temp_list = list(zip(filename_list, b...
301
sort.py
Python
tools/sort/sort.py
5e73437be47f2410439a3c6716de96354e6a0c94
faceswap
12
149,760
21
10
8
153
13
0
26
82
append_predictions
add freqao backend machinery, user interface, documentation
https://github.com/freqtrade/freqtrade.git
def append_predictions(self, predictions, do_predict, len_dataframe): ones = np.ones(len_dataframe) s_mean, s_std = ones*self.data['s_mean'], ones*self.data['s_std'] self.predictions = np.append(self.predictions,predictions) self.do_predict = np.append(self.do_predict,do_predi...
98
data_handler.py
Python
freqtrade/freqai/data_handler.py
fc837c4daa27a18ff0e86128f4d52089b88fa5fb
freqtrade
1
154,264
50
12
23
230
29
0
64
265
build_query_compiler
FEAT-#4733: Support fastparquet as engine for `read_parquet` (#4807) Signed-off-by: Karthik Velayutham <vkarthik@ponder.io>
https://github.com/modin-project/modin.git
def build_query_compiler(cls, dataset, columns, index_columns, **kwargs): storage_options = kwargs.pop("storage_options", {}) or {} col_partitions, column_widths = cls.build_columns(columns) partition_ids = cls.call_deploy( dataset, col_partitions, storage_options, **kwargs ...
152
parquet_dispatcher.py
Python
modin/core/io/column_stores/parquet_dispatcher.py
b240370bf83c88589d293b76b4a2409294e06f90
modin
5
83,239
64
12
34
414
13
0
121
389
test_collapse_event
docs: Fix many spelling mistakes. Signed-off-by: Anders Kaseorg <anders@zulip.com>
https://github.com/zulip/zulip.git
def test_collapse_event(self) -> None: client = self.get_client_descriptor() queue = client.event_queue queue.push({"type": "restart", "server_generation": 1, "timestamp": "1"}) # Verify the server_generation event is stored as a virtual event self.assertEqual( ...
223
test_event_queue.py
Python
zerver/tests/test_event_queue.py
b0ce4f1bce8031881addecb1e86073483517f392
zulip
1
100,362
89
17
26
366
33
0
109
595
_download_model
Update code to support Tensorflow versions up to 2.8 (#1213) * Update maximum tf version in setup + requirements * - bump max version of tf version in launcher - standardise tf version check * update keras get_custom_objects for tf>2.6 * bugfix: force black text in GUI file dialogs (linux) * dssim loss -...
https://github.com/deepfakes/faceswap.git
def _download_model(self): self.logger.info("Downloading model: '%s' from: %s", self._model_name, self._url_download) for attempt in range(self._retries): try: downloaded_size = self._url_partial_size req = urllib.request.Request(self._url_download) ...
220
utils.py
Python
lib/utils.py
c1512fd41d86ef47a5d1ce618d6d755ef7cbacdf
faceswap
5
275,791
5
9
2
31
5
0
5
19
texts_to_sequences
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def texts_to_sequences(self, texts): return list(self.texts_to_sequences_generator(texts))
18
text.py
Python
keras/preprocessing/text.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
76,882
6
9
2
39
7
1
6
11
notification_static
Rename BASE_URL to WAGTAILADMIN_BASE_URL & add docs - add documentation for WAGTAILADMIN_BASE_URL - ensure that WAGTAILADMIN_BASE_URL is used via a util so that it can fallback from request - resolves #3248 - remove settings URL from pagination template - not required for query string URLs
https://github.com/wagtail/wagtail.git
def notification_static(path): return urljoin(base_url_setting(), static(path)) @register.simple_tag
@register.simple_tag
18
wagtailadmin_tags.py
Python
wagtail/admin/templatetags/wagtailadmin_tags.py
cb7fc4cb1403436c9e7803c341278c20d3b06158
wagtail
1
270,330
3
6
22
15
3
0
3
6
_make_eager_execution_function
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def _make_eager_execution_function(model, mode):
119
distributed_training_utils_v1.py
Python
keras/distribute/distributed_training_utils_v1.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
270,738
141
10
8
118
15
0
212
380
add_variable
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def add_variable(self, *args, **kwargs): warnings.warn( "`layer.add_variable` is deprecated and " "will be removed in a future version. " "Please use the `layer.add_weight()` method instead.", stacklevel=2, ) return self.add_weight(*args, ...
36
base_layer.py
Python
keras/engine/base_layer.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
22,670
4
6
2
19
3
0
4
18
width
refactor: clean code Signed-off-by: slowy07 <slowy.arfy@gmail.com>
https://github.com/geekcomputers/Python.git
def width(self): return self.__width
10
lib.py
Python
linear-algebra-python/src/lib.py
f0af0c43340763724f139fa68aa1e5a9ffe458b4
Python
1
52,364
33
13
14
163
16
0
47
129
get_in_turn_repetition
update plato2_en_base (#2113) * update plato2_en_base * update README
https://github.com/PaddlePaddle/PaddleHub.git
def get_in_turn_repetition(pred, is_cn=False): if len(pred) == 0: return 1.0 if isinstance(pred[0], str): pred = [tok.lower() for tok in pred] if is_cn: pred = "".join(pred) tri_grams = set() for i in range(len(pred) - 2): tri_gram = tuple(pred[i:i + 3]) ...
107
model.py
Python
modules/text/text_generation/plato2_en_base/model.py
36ce4789c748040238a87598b5d6b2a5c817a73e
PaddleHub
7
247,331
7
9
5
45
7
0
7
21
test_legacy_on_create_room
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_legacy_on_create_room(self) -> None: self.helper.create_room_as(self.user_id, tok=self.tok, expect_code=403)
28
test_third_party_rules.py
Python
tests/rest/client/test_third_party_rules.py
2ffaf30803f93273a4d8a65c9e6c3110c8433488
synapse
1
47,589
42
13
18
281
35
0
61
203
test_dag_removed_if_serialized_dag_is_removed
Replace usage of `DummyOperator` with `EmptyOperator` (#22974) * Replace usage of `DummyOperator` with `EmptyOperator`
https://github.com/apache/airflow.git
def test_dag_removed_if_serialized_dag_is_removed(self, dag_maker): from airflow.operators.empty import EmptyOperator with dag_maker( dag_id="test_dag_removed_if_serialized_dag_is_removed", schedule_interval=None, start_date=tz.datetime(2021, 10, 12), ...
180
test_dagbag.py
Python
tests/models/test_dagbag.py
49e336ae0302b386a2f47269a6d13988382d975f
airflow
1
256,315
45
10
20
191
14
0
71
171
reduce_annotations
Apply black formatting (#2115) * Testing black on ui/ * Applying black on docstores * Add latest docstring and tutorial changes * Create a single GH action for Black and docs to reduce commit noise to the minimum, slightly refactor the OpenAPI action too * Remove comments * Relax constraints on pydoc-ma...
https://github.com/deepset-ai/haystack.git
def reduce_annotations(anno_types, answers): for at in set(anno_types): assert at in ("no_answer", "short_answer") if anno_types.count("short_answer") >= anno_types.count("no_answer"): majority = "short_answer" is_impossible = False else: majority = "no_answer" i...
112
nq_to_squad.py
Python
test/benchmarks/nq_to_squad.py
a59bca366174d9c692fa19750c24d65f47660ef7
haystack
6
681
8
8
4
27
2
0
9
18
reference_scalar_manager
Reverting changes to REPT and moving new code to NDEPT - Added tests and methods to lazyrepeatarray - Started fleshing out NDEPT - Added serde to NDEPT - Added test for NDEPT serde
https://github.com/OpenMined/PySyft.git
def reference_scalar_manager() -> VirtualMachinePrivateScalarManager: reference_scalar_manager = VirtualMachinePrivateScalarManager() return reference_scalar_manager
14
ndim_entity_phi_test.py
Python
packages/syft/tests/syft/core/tensor/adp/ndim_entity_phi_test.py
d8bf644d529b155467539a707cf5f8538ae41283
PySyft
1
247,933
59
8
21
221
23
0
88
264
test_cancellation
Convert `Linearizer` tests from `inlineCallbacks` to async (#12353) Signed-off-by: Sean Quah <seanq@element.io>
https://github.com/matrix-org/synapse.git
def test_cancellation(self) -> None: linearizer = Linearizer() key = object() d1, acquired_d1, unblock1 = self._start_task(linearizer, key) self.assertTrue(acquired_d1.called) # Create a second task, waiting for the first task. d2, acquired_d2, _ = self._start...
134
test_linearizer.py
Python
tests/util/test_linearizer.py
41b5f72677ea9763f3cf920d4f6df507653222f2
synapse
1
264,000
85
13
11
170
14
0
130
216
add_suffix_to_extension
building: move filename processing of EXTENSION entries to analysis stage Move filename processing of EXTENSION TOC entries (i.e., converting the module name to file path and adding the suffix) from the build stage (i.e., `assemble` in `PKG`, `COLLECT`, and `BUNDLE`) into analysis stage. This ensures that during the ...
https://github.com/pyinstaller/pyinstaller.git
def add_suffix_to_extension(inm, fnm, typ): # No-op for non-extension if typ != 'EXTENSION': return inm, fnm, typ # If inm completely fits into end of the fnm, it has already been processed. if fnm.endswith(inm): return inm, fnm, typ # Change the dotted name into a relative pa...
103
utils.py
Python
PyInstaller/building/utils.py
04984a040c2396127f234518f783cbed088408bb
pyinstaller
4
86,877
9
9
5
34
3
0
10
33
clear_region_to_control_producer
chore(hybrid-cloud): AuditLogEntry is a control silo model now (#39890) In the control silo, creating an audit log entry writes to the db directly, whilst in region silo mode creating an audit log entry will instead push to a new kafka producer that consumes into the control silo asynchronously.
https://github.com/getsentry/sentry.git
def clear_region_to_control_producer(): global _publisher if _publisher: _publisher.close() _publisher = None
18
producer.py
Python
src/sentry/region_to_control/producer.py
941184cd24186324fd9f7f304b7f713041834726
sentry
2