complexity
int64
1
139
fun_name
stringlengths
1
80
code
stringlengths
101
62.2k
commit_id
stringlengths
40
40
ast_errors
stringlengths
0
3.11k
ast_levels
int64
6
36
file_name
stringlengths
5
79
n_ast_nodes
int64
17
19.2k
commit_message
stringlengths
3
15.3k
d_id
int64
12
121k
n_ast_errors
int64
0
9
n_whitespaces
int64
4
10.8k
token_counts
int64
5
3.06k
vocab_size
int64
4
1.11k
id
int64
20
338k
n_words
int64
4
4.82k
repo
stringlengths
3
22
n_identifiers
int64
2
176
path
stringlengths
7
134
language
stringclasses
1 value
nloc
int64
1
413
documentation
dict
url
stringlengths
31
59
9
get_batch_no
def get_batch_no(doctype, txt, searchfield, start, page_len, filters): doctype = "Batch" cond = "" if filters.get("posting_date"): cond = "and (batch.expiry_date is null or batch.expiry_date >= %(posting_date)s)" batch_nos = None args = { "item_code": filters.get("item_code"), "warehouse": filters.get("ware...
9baa2229761c5415f29646a1a5bed4a3f4981e05
@frappe.whitelist() @frappe.validate_and_sanitize_search_inputs
16
queries.py
501
fix: specify allowed doctype in queries (#31761)
14,981
1
106
280
80
69,113
158
erpnext
29
erpnext/controllers/queries.py
Python
83
{ "docstring": "select sle.batch_no, round(sum(sle.actual_qty),2), sle.stock_uom,\n\t\t\t\tconcat('MFG-',batch.manufacturing_date), concat('EXP-',batch.expiry_date)\n\t\t\t\t{search_columns}\n\t\t\tfrom `tabStock Ledger Entry` sle\n\t\t\t\tINNER JOIN `tabBatch` batch on sle.batch_no = batch.name\n\t\t\twhere\n\t\t\t\...
https://github.com/frappe/erpnext.git
9
allow_serial_nos_with_different_item
def allow_serial_nos_with_different_item(sle_serial_no, sle): allow_serial_nos = False if sle.voucher_type == "Stock Entry" and cint(sle.actual_qty) > 0: stock_entry = frappe.get_cached_doc("Stock Entry", sle.voucher_no) if stock_entry.purpose in ("Repack", "Manufacture"): for d in stock_entry.get("items"): ...
494bd9ef78313436f0424b918f200dab8fc7c20b
17
serial_no.py
163
style: format code with black
14,610
0
39
98
38
67,735
50
erpnext
20
erpnext/stock/doctype/serial_no/serial_no.py
Python
11
{ "docstring": "\n\tAllows same serial nos for raw materials and finished goods\n\tin Manufacture / Repack type Stock Entry\n\t", "language": "en", "n_whitespaces": 15, "n_words": 17, "vocab_size": 17 }
https://github.com/frappe/erpnext.git
5
find_latest_deps_file
def find_latest_deps_file(build_data_working, ansible_version): # imports here so that they don't cause unnecessary deps for all of the plugins from packaging.version import Version data_dir = os.path.join(build_data_working, ansible_version) deps_files = glob.glob(os.path.join(data_dir, '*.deps')...
9545f2e0deae73d142047f02b499940b07b700aa
12
docs_build.py
197
stable docs build: do not use YAML parsing/serialization for .deps files (#79233) * Do not use YAML parsing/serialization for .deps files. * Prevent crash.
79,570
0
191
114
64
268,629
101
ansible
21
hacking/build_library/build_ansible/command_plugins/docs_build.py
Python
17
{ "docstring": "Find the most recent ansible deps file for the given ansible major version.", "language": "en", "n_whitespaces": 12, "n_words": 13, "vocab_size": 11 }
https://github.com/ansible/ansible.git
6
move_tone_curve
def move_tone_curve(img, low_y, high_y): input_dtype = img.dtype if low_y < 0 or low_y > 1: raise ValueError("low_shift must be in range [0, 1]") if high_y < 0 or high_y > 1: raise ValueError("high_shift must be in range [0, 1]") if input_dtype != np.uint8: raise ValueErro...
43201769f044e2f1bcd594a6e5c251903cf14c49
12
functional.py
120
Upgrade black to 22.3.0 (#1181) * Upgrade black to 22.3.0 * Remove sphinx docs build
57,473
0
103
126
42
225,577
61
albumentations
12
albumentations/augmentations/functional.py
Python
15
{ "docstring": "Rescales the relationship between bright and dark areas of the image by manipulating its tone curve.\n\n Args:\n img (numpy.ndarray): RGB or grayscale image.\n low_y (float): y-position of a Bezier control point used\n to adjust the tone curve, must be in range [0, 1]\n ...
https://github.com/albumentations-team/albumentations.git
6
apply_str
def apply_str(self) -> DataFrame | Series: # Caller is responsible for checking isinstance(self.f, str) f = cast(str, self.f) obj = self.obj # Support for `frame.transform('method')` # Some methods (shift, etc.) require the axis argument, others # don't, so ins...
d1485e76b7c48316c0d54f1a4df26c4467792670
13
apply.py
199
CLN: Refactor groupby._make_wrapper (#48400) * CLN: Refactor groupby._make_wrapper * Remove type: ignore * Revert behavior change for corrwith; fix skew and mad * Add docstring
40,394
0
248
117
71
169,112
89
pandas
19
pandas/core/apply.py
Python
20
{ "docstring": "\n Compute apply in case of a string.\n\n Returns\n -------\n result: Series or DataFrame\n ", "language": "en", "n_whitespaces": 49, "n_words": 13, "vocab_size": 13 }
https://github.com/pandas-dev/pandas.git
2
completed_annotations
def completed_annotations(self): if self.project.skip_queue == self.project.SkipQueue.IGNORE_SKIPPED: return self.annotations.filter(Q(ground_truth=False)) else: return self.annotations.filter(Q_finished_annotations)
074af782e6f351c711f18d8ad6a05aa4f632339c
12
models.py
76
feat: DEV-469: Skip queue (#1693) * DEV-469 Skip queue project setting * DEV-469 review fixes * Merge migrations (DEV-469) * Update requirements-test.txt * Update requirements-test.txt * Update test_exception.py * Revert "Update test_exception.py" This reverts commit b9c686c9bacaf298bafe3a207352cc...
42,458
0
54
46
10
177,600
11
label-studio
11
label_studio/tasks/models.py
Python
5
{ "docstring": "Annotations that we take into account when set completed status to the task", "language": "en", "n_whitespaces": 12, "n_words": 13, "vocab_size": 13 }
https://github.com/heartexlabs/label-studio.git
2
test_get_result_correctness
async def test_get_result_correctness(graph1): (_, _, _, dag) = graph1 handle = serve.run(DAGDriver.bind(dag)) visualizer = GraphVisualizer() visualizer.visualize_with_gradio(handle, _launch=False) await visualizer._send_request(random.randint(0, 100), 1, 2) values = await asyncio.gather(...
4c970cc88247f7cfa7351297b8b5050f2372742e
@pytest.mark.asyncio
16
test_gradio_visualization.py
171
[serve] Visualize Deployment Graph with Gradio (#27897)
28,422
1
102
103
35
127,348
40
ray
26
python/ray/serve/tests/test_gradio_visualization.py
Python
13
{ "docstring": "Tests correctness: that after running _send_request(), _get_result() in\n GraphVisualizer correctly returns object refs to the submitted tasks.\n ", "language": "en", "n_whitespaces": 23, "n_words": 17, "vocab_size": 17 }
https://github.com/ray-project/ray.git
2
test_get_backfill_points_in_room
def test_get_backfill_points_in_room(self): setup_info = self._setup_room_for_backfill_tests() room_id = setup_info.room_id backfill_points = self.get_success( self.store.get_backfill_points_in_room(room_id) ) backfill_event_ids = [backfill_point[0] for back...
ac1a31740b6d0dfda4d57a25762aaddfde981caf
11
test_event_federation.py
115
Only try to backfill event if we haven't tried before recently (#13635) Only try to backfill event if we haven't tried before recently (exponential backoff). No need to keep trying the same backfill point that fails over and over. Fix https://github.com/matrix-org/synapse/issues/13622 Fix https://github.com/matrix...
72,983
0
108
67
26
249,543
30
synapse
12
tests/storage/test_event_federation.py
Python
10
{ "docstring": "\n Test to make sure we get some backfill points\n ", "language": "en", "n_whitespaces": 24, "n_words": 9, "vocab_size": 9 }
https://github.com/matrix-org/synapse.git
10
_mixup_transform
def _mixup_transform(self, results): assert 'mix_results' in results assert len( results['mix_results']) == 1, 'MixUp only support 2 images now !' if results['mix_results'][0]['gt_bboxes'].shape[0] == 0: # empty bbox return results retrieve...
c9e1906f00505621b0247ab364feb0ca862fa98c
14
transforms.py
1,292
[Fix] Fix MixUp transform filter boxes failing case. Added test case (#7080)
70,162
0
1,392
835
179
243,959
340
mmdetection
56
mmdet/datasets/pipelines/transforms.py
Python
83
{ "docstring": "MixUp transform function.\n\n Args:\n results (dict): Result dict.\n\n Returns:\n dict: Updated result dict.\n ", "language": "en", "n_whitespaces": 56, "n_words": 13, "vocab_size": 12 }
https://github.com/open-mmlab/mmdetection.git
8
authenticate
def authenticate(self, _=None): # TODO: remove unused var acceptance_wait_time = self.opts["acceptance_wait_time"] acceptance_wait_time_max = self.opts["acceptance_wait_time_max"] if not acceptance_wait_time_max: acceptance_wait_time_max = acceptance_wait_time with ...
70972c8016ff5d6fbdd7f83776077b0936f60dea
20
crypt.py
308
Use salt.channel.client instead of salt.transport.client
54,016
0
954
172
89
215,547
134
salt
28
salt/crypt.py
Python
39
{ "docstring": "\n Authenticate with the master, this method breaks the functional\n paradigm, it will update the master information from a fresh sign\n in, signing in can occur as often as needed to keep up with the\n revolving master AES key.\n\n :rtype: Crypticle\n :return...
https://github.com/saltstack/salt.git
1
test_not_collapsed_with_legacy
def test_not_collapsed_with_legacy(self): # Sidebar should not be collapsed because the feature flag is not enabled self.client.cookies['wagtail_sidebar_collapsed'] = '1' response = self.client.get(reverse('wagtailadmin_home')) self.assertNotContains(response, 'sidebar-collapsed...
18c4d7c81356dbd5c4503db2ea24b21492512317
11
test_menu.py
70
Update Wagtail test cases to match slim sidebar capabilities and implementation details
15,545
0
58
37
21
70,730
23
wagtail
8
wagtail/admin/tests/test_menu.py
Python
4
{ "docstring": "Sidebar should only remember its collapsed state with the slim implementation.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/wagtail/wagtail.git
1
default
def default(method): method._is_default = True # pylint: disable=protected-access return method
84afc5193d38057e2e2badf9c889ea87d80d8fbf
7
generic_utils.py
25
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
81,746
0
20
13
10
276,832
10
keras
3
keras/utils/generic_utils.py
Python
3
{ "docstring": "Decorates a method to detect overrides in subclasses.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/keras-team/keras.git
3
tokenize_wrapper
def tokenize_wrapper(input): skip = {token.NEWLINE, token.INDENT, token.DEDENT} tokens = tokenize.generate_tokens(io.StringIO(input).readline) for quintuple in tokens: type, value, start, end, line_text = quintuple if type not in skip: yield quintuple
8198943edd73a363c266633e1aa5b2a9e9c9f526
11
patcomp.py
92
add python 3.10.4 for windows
55,459
0
65
60
23
218,759
28
XX-Net
19
python3.10.4/Lib/lib2to3/patcomp.py
Python
7
{ "docstring": "Tokenizes a string suppressing significant whitespace.", "language": "en", "n_whitespaces": 5, "n_words": 6, "vocab_size": 6 }
https://github.com/XX-net/XX-Net.git
1
test_get_serials
def test_get_serials(): expected = [ "180720d39cd2db3244ba037417241e90", "1768ac4e5b72bf1d0df0df118b34b959", ] mock = MagicMock( return_value=( "CertInfo\r\n" "================ Certificate 0 ================\r\n" "Serial Number: 180720d39cd2db...
a8d2d1e1397cdc79b2c5f1ad7f6e3b729dcf8857
12
test_win_certutil.py
142
Add tests, fix state module
54,255
0
201
64
36
215,928
46
salt
12
tests/pytests/unit/modules/test_win_certutil.py
Python
21
{ "docstring": "\n Test getting all the serial numbers from a store\n ", "language": "en", "n_whitespaces": 16, "n_words": 9, "vocab_size": 9 }
https://github.com/saltstack/salt.git
3
build_partition
def build_partition(cls, partition_ids, column_widths): return np.array( [ [ cls.frame_partition_cls( part_id[0], length=part_id[2], width=col_width, ) ...
8864bc197974da6d8cda2de2f35ca31d561be1cc
13
parquet_dispatcher.py
81
PERF-#4305: Parallelize `read_parquet` over row groups (#4700) Co-authored-by: mvashishtha <mahesh@ponder.io>
35,794
0
240
56
21
154,121
26
modin
13
modin/core/io/column_stores/parquet_dispatcher.py
Python
14
{ "docstring": "\n Build array with partitions of `cls.frame_partition_cls` class.\n\n Parameters\n ----------\n partition_ids : list\n Array with references to the partitions data.\n column_widths : list\n Number of columns in each partition.\n\n Return...
https://github.com/modin-project/modin.git
5
__new__
def __new__(cls, stylename, **kwargs): # The "class" should have the _style_list attribute, which is a mapping # of style names to style classes. _list = stylename.replace(" ", "").split(",") _name = _list[0].lower() try: _cls = cls._style_list[_name] ...
075ff0952896f44d7d0b0b3318f0978ae53f84d7
12
patches.py
208
Small style fixes.
23,015
0
201
120
59
108,011
76
matplotlib
20
lib/matplotlib/patches.py
Python
13
{ "docstring": "Return the instance of the subclass with the given style name.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 9 }
https://github.com/matplotlib/matplotlib.git
1
get_roi_rel_points_train
def get_roi_rel_points_train(self, mask_pred, labels, cfg): point_coords = get_uncertain_point_coords_with_randomness( mask_pred, labels, cfg.num_points, cfg.oversample_ratio, cfg.importance_sample_ratio) return point_coords
c576e5d570bf64a99e2c6817ed7b5c0084a44a55
9
mask_point_head.py
49
[Enhance] Take point sample related functions out of mask_point_head (#7353) add point sample replace function in mask_point_head
70,231
0
58
34
12
244,083
15
mmdetection
10
mmdet/models/roi_heads/mask_heads/mask_point_head.py
Python
5
{ "docstring": "Get ``num_points`` most uncertain points with random points during\n train.\n\n Sample points in [0, 1] x [0, 1] coordinate space based on their\n uncertainty. The uncertainties are calculated for each point using\n '_get_uncertainty()' function that takes point's logit pre...
https://github.com/open-mmlab/mmdetection.git
2
tempdir_registry
def tempdir_registry() -> Iterator[TempDirectoryTypeRegistry]: global _tempdir_registry old_tempdir_registry = _tempdir_registry _tempdir_registry = TempDirectoryTypeRegistry() try: yield _tempdir_registry finally: _tempdir_registry = old_tempdir_registry
f3166e673fe8d40277b804d35d77dcdb760fc3b3
9
temp_dir.py
53
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...
3,170
0
51
29
12
20,001
19
pipenv
5
pipenv/patched/notpip/_internal/utils/temp_dir.py
Python
11
{ "docstring": "Provides a scoped global tempdir registry that can be used to dictate\n whether directories should be deleted.\n ", "language": "en", "n_whitespaces": 23, "n_words": 17, "vocab_size": 16 }
https://github.com/pypa/pipenv.git
1
lexicographers_mutual_information
def lexicographers_mutual_information(cooccurrence): with np.errstate(invalid="ignore", divide="ignore"): result = cooccurrence * mutual_information(cooccurrence) return np.array(result)
1d7341e93d1f03387699fb3c6ae0b6c0e464296f
11
python_utils.py
64
Add new item similarity metrics for SAR (#1754) * Add mutual information similarity in SAR * Add lexicographers mutual information similarity for SAR * Add cosine similarity for SAR * Add inclusion index for SAR * Typos * Change SARSingleNode to SAR * Convert item similarity matrix to np.array * U...
7,235
0
28
35
12
39,443
12
recommenders
9
recommenders/utils/python_utils.py
Python
4
{ "docstring": "Helper method to calculate the Lexicographers Mutual Information of\n a matrix of co-occurrences.\n\n Due to the bias of mutual information for low frequency items,\n lexicographers mutual information corrects the formula by\n multiplying it by the co-occurrence frequency.\n\n Args:\n ...
https://github.com/microsoft/recommenders.git
3
set_title
def set_title(self, title, prop=None): self._legend_title_box._text.set_text(title) if title: self._legend_title_box._text.set_visible(True) self._legend_title_box.set_visible(True) else: self._legend_title_box._text.set_visible(False) sel...
b9cdf3e2a68bd3d30ad7233b223f88d37044dab3
12
legend.py
136
ENH: add the ability to control label alignment in legends Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
23,426
0
118
84
20
109,064
21
matplotlib
10
lib/matplotlib/legend.py
Python
11
{ "docstring": "\n Set legend title and title style.\n\n Parameters\n ----------\n title : str\n The legend title.\n\n prop : `.font_manager.FontProperties` or `str` or `pathlib.Path`\n The font properties of the legend title.\n If a `str`, it is int...
https://github.com/matplotlib/matplotlib.git
1
get_free_open_trades
def get_free_open_trades(self) -> int: open_trades = Trade.get_open_trade_count() return max(0, self.config['max_open_trades'] - open_trades)
87a3115073562e9abc7efd792569020435a01f6e
10
freqtradebot.py
50
Add get_open_trade_count() to simplify getting open trade count.
34,774
0
33
29
12
150,503
12
freqtrade
8
freqtrade/freqtradebot.py
Python
7
{ "docstring": "\n Return the number of free open trades slots or 0 if\n max number of open trades reached\n ", "language": "en", "n_whitespaces": 39, "n_words": 17, "vocab_size": 13 }
https://github.com/freqtrade/freqtrade.git
4
native_unit_of_measurement
def native_unit_of_measurement(self) -> str | None: raw_units = self.raw_unit_of_measurement # Check if this is a known index pair UOM if isinstance(raw_units, dict) or raw_units in (UOM_ON_OFF, UOM_INDEX): return None if raw_units in ( UnitOfTemperature....
a6ddac9004b7f73633f2019f3b5267e1486756c1
11
sensor.py
94
Use UnitOfTemperature in integrations (i-m) (#84307)
96,664
0
145
61
33
297,698
41
core
17
homeassistant/components/isy994/sensor.py
Python
12
{ "docstring": "Get the Home Assistant unit of measurement for the device.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
https://github.com/home-assistant/core.git
2
find_target_completion
def find_target_completion(target_func, prefix, short): # type: (t.Callable[[], t.Iterable[CompletionTarget]], str, bool) -> t.List[str] try: targets = target_func() matches = list(walk_completion_targets(targets, prefix, short)) return matches except Exception as ex: # pylint: di...
86779cc90376ea70bafa7044b12ce5132409fd63
12
target.py
74
ansible-test - Code cleanup. This helps prepare for a future pylint upgrade.
78,873
0
74
43
30
267,383
35
ansible
10
test/lib/ansible_test/_internal/target.py
Python
7
{ "docstring": "Return a list of targets from the given target function which match the given prefix.", "language": "en", "n_whitespaces": 14, "n_words": 15, "vocab_size": 13 }
https://github.com/ansible/ansible.git
6
test_pipeline_simple
def test_pipeline_simple(self): arr = np.random.randint(0, 1000, (1000, 1000)) df = pd.DataFrame(arr)
3d4404e9d9a9b2a3327f8aee664a8e71ac1f18b8
9
test_pipeline.py
51
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>
35,608
0
32
257
10
153,784
11
modin
9
modin/experimental/batch/test/test_pipeline.py
Python
35
{ "docstring": "Create a simple pipeline and ensure that it runs end to end correctly.", "language": "en", "n_whitespaces": 12, "n_words": 13, "vocab_size": 12 }
https://github.com/modin-project/modin.git
2
__mul__
def __mul__(self, factor): factor = sympify(factor) coords = [simplify(x*factor) for x in self.args] return Point(coords, evaluate=False)
498015021131af4dbb07eb110e5badaba8250c7b
10
point.py
62
Updated import locations
47,775
0
44
39
15
196,275
16
sympy
10
sympy/geometry/point.py
Python
4
{ "docstring": "Multiply point's coordinates by a factor.\n\n Notes\n =====\n\n >>> from sympy import Point\n\n When multiplying a Point by a floating point number,\n the coordinates of the Point will be changed to Floats:\n\n >>> Point(1, 2)*0.1\n Point2D(0.1, 0.2)\n\...
https://github.com/sympy/sympy.git
2
value
def value(self): if hasattr(self, '_m_value'): return self._m_value self._m_value = (self.b & 127) return getattr(self, '_m_value', None)
002f919dda5f01d067c2e786426c68751551d15c
9
vlq_base128_le.py
64
update kaitai definitions
73,952
0
75
38
14
252,418
16
mitmproxy
6
mitmproxy/contrib/kaitaistruct/vlq_base128_le.py
Python
5
{ "docstring": "The 7-bit (base128) numeric value chunk of this group.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/mitmproxy/mitmproxy.git
4
notify
def notify(self, notification, raise_exception=False): event = notification.event try: return self.notify_users( event.group, event, triggering_rules=[r.label for r in notification.rules] ) except ( ApiError, HTTPError, ...
542484c0cd71625e62e086f3f7c5aaf85360f724
16
notify.py
175
fix(plugins): Silence error (#32042)
19,326
0
366
114
45
96,559
48
sentry
26
src/sentry/plugins/bases/notify.py
Python
26
{ "docstring": "\n This calls the notify_users method of the plugin.\n Normally this method eats the error and logs it but if we\n set raise_exception=True like we do for the test plugin button,\n the exception is raised\n ", "language": "en", "n_whitespaces": 70, "n_words": 3...
https://github.com/getsentry/sentry.git
1
create_single_host
def create_single_host(name, variables): # type: (str, t.Dict[str, t.Union[str, int]]) -> Inventory return Inventory(host_groups=dict(all={name: variables}))
a06fa496d3f837cca3c437ab6e9858525633d147
13
host_profiles.py
41
ansible-test - Code cleanup and refactoring. (#77169) * Remove unnecessary PyCharm ignores. * Ignore intentional undefined attribute usage. * Add missing type hints. Fix existing type hints. * Fix docstrings and comments. * Use function to register completion handler. * Pass strings to display functions. * Fix C...
78,585
0
29
24
14
266,782
14
ansible
7
test/lib/ansible_test/_internal/host_profiles.py
Python
2
{ "docstring": "Return an inventory instance created from the given hostname and variables.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/ansible/ansible.git
1
test_syncer_hanging_sync_with_timeout
def test_syncer_hanging_sync_with_timeout(temp_data_dirs): tmp_source, tmp_target = temp_data_dirs
ed5b9e5439811becd062ef7734b1afceca2c7d07
7
test_syncer.py
21
[Tune] Add timeout for experiment checkpoint syncing to cloud (#30855) #28155 introduced a sync timeout for trainable checkpoint syncing to the cloud, in the case that the sync operation (default is with pyarrow) hangs. This PR adds a similar timeout for experiment checkpoint cloud syncing. Signed-off-by: Justin Yu...
31,110
0
12
86
6
137,248
6
ray
4
python/ray/tune/tests/test_syncer.py
Python
16
{ "docstring": "Check that syncing times out when the sync process is hanging.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/ray-project/ray.git
1
draw
def draw(self, renderer): self._set_lims() # this sets the scale in case the parent has set its scale. self._set_scale() super().draw(renderer)
8387676bc049d7b3e071846730c632e6ced137ed
9
_secondary_axes.py
48
Clean up code in SecondaryAxis
23,725
0
54
26
18
109,729
19
matplotlib
6
lib/matplotlib/axes/_secondary_axes.py
Python
4
{ "docstring": "\n Draw the secondary axes.\n\n Consults the parent axes for its limits and converts them\n using the converter specified by\n `~.axes._secondary_axes.set_functions` (or *functions*\n parameter when axes initialized.)\n ", "language": "en", "n_whitespaces"...
https://github.com/matplotlib/matplotlib.git
3
decode
def decode(self, bboxes, pred_bboxes, max_shape=None): bboxes = get_box_tensor(bboxes) assert len(pred_bboxes) == 2 cls_preds, offset_preds = pred_bboxes assert cls_preds.size(0) == bboxes.size(0) and offset_preds.size( 0) == bboxes.size(0) bboxes, loc_confid...
d915740fa8228cf57741b27d9e5d66e358456b8e
11
bucketing_bbox_coder.py
158
[Refactor] Refactor anchor head and base head with boxlist (#8625) * Refactor anchor head * Update * Update * Update * Add a series of boxes tools * Fix box type to support n x box_dim boxes * revert box type changes * Add docstring * refactor retina_head * Update * Update * Fix commen...
70,859
0
254
105
32
245,713
44
mmdetection
18
mmdet/models/task_modules/coders/bucketing_bbox_coder.py
Python
13
{ "docstring": "Apply transformation `pred_bboxes` to `boxes`.\n Args:\n boxes (torch.Tensor or :obj:`BaseBoxes`): Basic boxes.\n pred_bboxes (torch.Tensor): Predictions for bucketing estimation\n and fine regression\n max_shape (tuple[int], optional): Maximum sh...
https://github.com/open-mmlab/mmdetection.git
1
test_include_block_tag_with_plain_value
def test_include_block_tag_with_plain_value(self): result = render_to_string( "tests/blocks/include_block_test.html", { "test_block": 42, }, ) self.assertIn("<body>42</body>", result)
d10f15e55806c6944827d801cd9c2d53f5da4186
11
test_blocks.py
51
Reformat with black
16,220
0
89
28
13
74,116
13
wagtail
5
wagtail/core/tests/test_blocks.py
Python
8
{ "docstring": "\n The include_block tag should be able to render a value without a render_as_block method\n by just rendering it as a string\n ", "language": "en", "n_whitespaces": 43, "n_words": 21, "vocab_size": 19 }
https://github.com/wagtail/wagtail.git
40
meta_from_array
def meta_from_array(x, ndim=None, dtype=None): # If using x._meta, x must be a Dask Array, some libraries (e.g. zarr) # implement a _meta attribute that are incompatible with Dask Array._meta if hasattr(x, "_meta") and isinstance(x, Array): x = x._meta if dtype is None and x is None: ...
7471eb3d1e9ccf085b70b219413aa891c8c2c167
21
utils.py
816
masked scalars input to da.from_array (#8895)
36,621
0
887
524
149
156,257
287
dask
42
dask/array/utils.py
Python
66
{ "docstring": "Normalize an array to appropriate meta object\n\n Parameters\n ----------\n x: array-like, callable\n Either an object that looks sufficiently like a Numpy array,\n or a callable that accepts shape and dtype keywords\n ndim: int\n Number of dimensions of the array\n ...
https://github.com/dask/dask.git
20
async_update
async def async_update(self, *, tries=0): attrs = {} closer_time = None try: yandex_reply = await self.requester.get_stop_info(self._stop_id) except CaptchaError as ex: _LOGGER.error( "%s. You may need to disable the integration for some t...
62690759d483b03932939d28bbf87ce3b293c486
20
sensor.py
545
Move attribution to standalone attribute [t-z] (#80521)
88,455
0
1,075
316
125
289,313
211
core
39
homeassistant/components/yandex_transport/sensor.py
Python
56
{ "docstring": "Get the latest data from maps.yandex.ru and update the states.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
https://github.com/home-assistant/core.git
1
_linear_predictor
def _linear_predictor(self, X): check_is_fitted(self) X = self._validate_data( X, accept_sparse=["csr", "csc", "coo"], dtype=[np.float64, np.float32], ensure_2d=True, allow_nd=False, reset=False, ) return X ...
75a94f518f7bd7d0bf581ffb67d9f961e3c4efbc
11
glm.py
100
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>
75,775
0
124
65
22
259,442
23
scikit-learn
15
sklearn/linear_model/_glm/glm.py
Python
11
{ "docstring": "Compute the linear_predictor = `X @ coef_ + intercept_`.\n\n Note that we often use the term raw_prediction instead of linear predictor.\n\n Parameters\n ----------\n X : {array-like, sparse matrix} of shape (n_samples, n_features)\n Samples.\n\n Returns\n...
https://github.com/scikit-learn/scikit-learn.git
2
async_added_to_hass
async def async_added_to_hass(self): self.async_on_remove( self.device.events.async_add_listener(self.async_write_ha_state) ) if (last_state := await self.async_get_last_state()) is not None: self._attr_is_on = last_state.state == STATE_ON
29a2df3dfcf3b5d1fb6cf20b413e024eb0ebf597
11
binary_sensor.py
79
Restore ONVIF sensors (#70393) Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
98,171
0
69
47
19
299,235
19
core
12
homeassistant/components/onvif/binary_sensor.py
Python
6
{ "docstring": "Connect to dispatcher listening for entity data notifications.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/home-assistant/core.git
3
extensions
def extensions(self) -> list[tuple[int, bytes]]: ret = [] if self._client_hello.extensions: for extension in self._client_hello.extensions.extensions: body = getattr(extension, "_raw_body", extension.body) ret.append((extension.type, body)) re...
e83ec8390ad6be6a86cfcfc57bce14cb8861bf32
13
tls.py
100
`pyupgrade --py39-plus **/*.py`
73,616
0
92
64
21
251,164
23
mitmproxy
13
mitmproxy/tls.py
Python
8
{ "docstring": "The raw list of extensions in the form of `(extension_type, raw_bytes)` tuples.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 11 }
https://github.com/mitmproxy/mitmproxy.git
1
build_runtime_context
def build_runtime_context(self) -> "RuntimeContext": # Defer the import of RuntimeContext until needed to avoid cycles from ray.runtime_context import RuntimeContext return RuntimeContext(self)
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
7
runtime_context.py
36
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,871
0
49
19
19
132,932
21
ray
5
python/ray/util/client/runtime_context.py
Python
4
{ "docstring": "Creates a RuntimeContext backed by the properites of this API", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/ray-project/ray.git
1
test_make_tarball_latin1
def test_make_tarball_latin1(self): self.test_make_tarball('årchiv') # note this isn't a real word
8198943edd73a363c266633e1aa5b2a9e9c9f526
8
test_archive_util.py
26
add python 3.10.4 for windows
56,856
0
24
12
10
223,045
10
XX-Net
3
python3.10.4/Lib/distutils/tests/test_archive_util.py
Python
2
{ "docstring": "\n Mirror test_make_tarball, except filename contains latin characters.\n ", "language": "en", "n_whitespaces": 22, "n_words": 7, "vocab_size": 7 }
https://github.com/XX-net/XX-Net.git
2
ensure_schema_for_first_block
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. ...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
12
block_list.py
113
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,328
0
128
68
32
130,602
39
ray
18
python/ray/data/impl/block_list.py
Python
13
{ "docstring": "Ensure that the schema is set for the first block.\n\n Returns None if the block list is empty.\n ", "language": "en", "n_whitespaces": 32, "n_words": 18, "vocab_size": 15 }
https://github.com/ray-project/ray.git
7
parse257
def parse257(resp): if resp[:3] != '257': raise error_reply(resp) if resp[3:5] != ' "': return '' # Not compliant to RFC 959, but UNIX ftpd does this dirname = '' i = 5 n = len(resp) while i < n: c = resp[i] i = i+1 if c == '"': if i >= n ...
8198943edd73a363c266633e1aa5b2a9e9c9f526
12
ftplib.py
158
add python 3.10.4 for windows
54,790
0
171
90
42
217,445
68
XX-Net
8
python3.10.4/Lib/ftplib.py
Python
17
{ "docstring": "Parse the '257' response for a MKD or PWD request.\n This is a response to a MKD or PWD request: a directory name.\n Returns the directoryname in the 257 reply.", "language": "en", "n_whitespaces": 35, "n_words": 30, "vocab_size": 21 }
https://github.com/XX-net/XX-Net.git
4
to_bag
def to_bag(df, index=False, format="tuple"): from ...bag.core import Bag if not isinstance(df, (DataFrame, Series)): raise TypeError("df must be either DataFrame or Series") name = "to_bag-" + tokenize(df, index, format) if format == "frame": # Use existing graph and name of df, bu...
8a6f6a7b95762df4e44bc4d82ce33a7c388a0676
15
io.py
215
Move Bag.map_partitions to Blockwise (#8646) 1. Adds `format="frame"` option to `dataframe.io.to_bag` (effectively returning a zero-copy view of the same dask graph, that no-longer tracks meta/divisions) 2. Revises `Bag.map_partitions` to use `blockwise` (and to support the `token=` option) 3. Modifies the ACA code ...
36,501
0
176
134
66
155,996
77
dask
25
dask/dataframe/io/io.py
Python
15
{ "docstring": "Create Dask Bag from a Dask DataFrame\n\n Parameters\n ----------\n index : bool, optional\n If True, the elements are tuples of ``(index, value)``, otherwise\n they're just the ``value``. Default is False.\n format : {\"tuple\", \"dict\", \"frame\"}, optional\n Wheth...
https://github.com/dask/dask.git
3
_get_no_faces
def _get_no_faces(self): self.output_message = "Frames with no faces" for frame in tqdm(self._items, desc=self.output_message): logger.trace(frame) # type:ignore frame_name = frame["frame_fullname"] if not self._alignments.frame_has_faces(frame_name): ...
892d8626ed4e7f834ac5607af59f14f5476d5997
12
jobs.py
104
Bugfix: Alignments tool - don't error on from-faces job
21,067
0
112
60
25
101,662
27
faceswap
13
tools/alignments/jobs.py
Python
8
{ "docstring": " yield each frame that has no face match in alignments file ", "language": "en", "n_whitespaces": 12, "n_words": 11, "vocab_size": 11 }
https://github.com/deepfakes/faceswap.git
2
_perform_invalid_key_test
def _perform_invalid_key_test(self, key, expected_warning): msg = expected_warning.replace(key, cache.make_key(key)) tests = [ ("add", [key, 1]), ("get", [key]), ("set", [key, 1]), ("incr", [key]), ("decr", [key]), ("touch"...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
14
tests.py
281
Refs #33476 -- Reformatted code with Black.
50,027
0
259
179
44
201,962
54
django
19
tests/cache/tests.py
Python
19
{ "docstring": "\n While other backends merely warn, memcached should raise for an invalid\n key.\n ", "language": "en", "n_whitespaces": 34, "n_words": 12, "vocab_size": 12 }
https://github.com/django/django.git
5
test_deploy
def test_deploy(self, mock_func): release = Release.objects.create( version="meow" * 10, organization_id=self.project.organization_id, date_released=timezone.now(), ) # The projects can appear out of order. projects = (self.project, self.crea...
b9f5a910dc841b85f58d46266ec049ae5a7fd305
14
test_deploy.py
440
ref(models): `ActivityType` (#34978) ## Objective: We want to separate enum logic from Model logic. This breaks a lot of circular dependencies.
18,703
0
573
244
79
90,884
111
sentry
43
tests/sentry/integrations/slack/notifications/test_deploy.py
Python
45
{ "docstring": "\n Test that a Slack message is sent with the expected payload when a deploy happens.\n ", "language": "en", "n_whitespaces": 30, "n_words": 15, "vocab_size": 14 }
https://github.com/getsentry/sentry.git
1
test_option_then_setting
def test_option_then_setting(self): args = [ "base_command", "testlabel", "--option_a=x", "--settings=alternate_settings", ] self._test(args)
9c19aff7c7561e3a82978a272ecdaad40dda5c00
8
tests.py
46
Refs #33476 -- Reformatted code with Black.
51,933
0
83
24
11
207,338
11
django
4
tests/admin_scripts/tests.py
Python
8
{ "docstring": "Options passed before settings are correctly handled.", "language": "en", "n_whitespaces": 6, "n_words": 7, "vocab_size": 7 }
https://github.com/django/django.git
6
_pandas_dtype_needs_early_conversion
def _pandas_dtype_needs_early_conversion(pd_dtype): try: from pandas.api.types import ( is_extension_array_dtype, is_float_dtype, is_integer_dtype, is_sparse, ) except ImportError: return False if is_sparse(pd_dtype) or not is_ext...
ee5a1b69d1dfa99635a10f0a5b54ec263cedf866
9
validation.py
105
DOC, MNT Typos found by codespell (#22906)
75,712
0
224
62
61
259,327
82
scikit-learn
10
sklearn/utils/validation.py
Python
17
{ "docstring": "Return True if pandas extension pd_dtype need to be converted early.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/scikit-learn/scikit-learn.git
14
on_motion
def on_motion(self, etype, me): if self.disabled or me.dispatch_mode == MODE_DONT_DISPATCH: return if me.type_id not in self.motion_filter: return filtered = self.motion_filter[me.type_id] if filtered[0] is self and len(filtered) == 1: return ...
1830123ba3edf7290b7c6cb1c6f406ccf1d0e5d4
12
widget.py
233
Feature: EventManagerBase (#7658) * Added EventManagerBase class and event_managers attribute to WindowBase class. * Added on_motion event to Widget class. * Updated post_dispatch_input in EventLoopBase to skip non-touch events. * Using type ids in MouseMotionEventProvider. * Added on_motion method to Widget subcl...
46,982
0
317
148
43
194,458
80
kivy
18
kivy/uix/widget.py
Python
20
{ "docstring": "Called when a motion event is received.\n\n :Parameters:\n `etype`: `str`\n Event type, one of \"begin\", \"update\" or \"end\"\n `me`: :class:`~kivy.input.motionevent.MotionEvent`\n Received motion event\n :Returns: `bool`\n ...
https://github.com/kivy/kivy.git
9
call_ef
def call_ef(self, other_args): parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="ef", description=, ) parser.add_argument( "-vs", "--value-short", ...
83377868b25b91b608f04cbda9383f838dff74cd
13
po_controller.py
668
PO_controller refactoring and tests (#2725) * Adding tests * Added tests to po_controller * Refactored po controller * fix custom_resets * fix load * add disable timeout * pylint Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt> Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github...
85,488
0
1,230
436
133
285,988
176
OpenBBTerminal
73
openbb_terminal/portfolio/portfolio_optimization/po_controller.py
Python
95
{ "docstring": "Process ef commandThis function plots random portfolios based on their\n risk and returns and shows the efficient frontier.", "language": "en", "n_whitespaces": 32, "n_words": 18, "vocab_size": 17 }
https://github.com/OpenBB-finance/OpenBBTerminal.git
2
is_pinned
def is_pinned(self) -> bool: specifiers = self.specifier return len(specifiers) == 1 and next(iter(specifiers)).operator in {"==", "==="}
f3166e673fe8d40277b804d35d77dcdb760fc3b3
12
req_install.py
63
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...
3,159
0
37
36
16
19,953
16
pipenv
9
pipenv/patched/notpip/_internal/req/req_install.py
Python
7
{ "docstring": "Return whether I am pinned to an exact version.\n\n For example, some-package==1.2 is pinned; some-package>1.2 is not.\n ", "language": "en", "n_whitespaces": 31, "n_words": 17, "vocab_size": 16 }
https://github.com/pypa/pipenv.git
1
_generate_legacy_events_context_id_query
def _generate_legacy_events_context_id_query() -> Select: # This can be removed once we no longer have event_ids in the states table return ( select( *EVENT_COLUMNS, literal(value=None, type_=sqlalchemy.String).label("shared_data"), States.state, Stat...
26177bd080b4eb6d11cfd9fbdd158be36f4983d4
22
__init__.py
151
Convert logbook to use lambda_stmt (#71624)
99,183
0
183
98
41
300,319
45
core
24
homeassistant/components/logbook/__init__.py
Python
18
{ "docstring": "Generate a legacy events context id query that also joins states.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/home-assistant/core.git
1
test_poisson_glmnet
def test_poisson_glmnet(): # library("glmnet") # options(digits=10) # df <- data.frame(a=c(-2,-1,1,2), b=c(0,0,1,1), y=c(0,1,1,2)) # x <- data.matrix(df[,c("a", "b")]) # y <- df$y # fit <- glmnet(x=x, y=y, alpha=0, intercept=T, family="poisson", # standardize=F, thresh=1e-...
75a94f518f7bd7d0bf581ffb67d9f961e3c4efbc
12
test_glm.py
170
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>
75,787
0
199
123
58
259,457
78
scikit-learn
17
sklearn/linear_model/_glm/tests/test_glm.py
Python
12
{ "docstring": "Compare Poisson regression with L2 regularization and LogLink to glmnet", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/scikit-learn/scikit-learn.git
2
detect_reporter
def _detect_reporter(**kwargs) -> TuneReporterBase: if IS_NOTEBOOK: kwargs.setdefault("overwrite", not has_verbosity(Verbosity.V2_TRIAL_NORM)) progress_reporter = JupyterNotebookReporter(**kwargs) else: progress_reporter = CLIReporter(**kwargs) return progress_reporter
eb69c1ca286a2eec594f02ddaf546657a8127afd
13
progress_reporter.py
78
[air] Add annotation for Tune module. (#27060) Co-authored-by: Kai Fricke <kai@anyscale.com>
28,098
0
51
44
15
126,228
18
ray
11
python/ray/tune/progress_reporter.py
Python
14
{ "docstring": "Detect progress reporter class.\n\n Will return a :class:`JupyterNotebookReporter` if a IPython/Jupyter-like\n session was detected, and a :class:`CLIReporter` otherwise.\n\n Keyword arguments are passed on to the reporter class.\n ", "language": "en", "n_whitespaces": 39, "n_words":...
https://github.com/ray-project/ray.git
5
_w_intercept_raw
def _w_intercept_raw(self, coef, X): if not self.base_loss.is_multiclass: if self.fit_intercept: intercept = coef[-1] weights = coef[:-1] else: intercept = 0.0 weights = coef raw_prediction = X @ weights...
d8d5637cfe372dd353dfc9f79dbb63c3189a9ecc
16
_linear_loss.py
216
ENH Loss module LogisticRegression (#21808) * ENH replace loss in linear logistic regression * MNT remove logistic regression's own loss functions * CLN remove comment * DOC add whatsnew * DOC more precise whatsnew * CLN restore improvements of #19571 * ENH improve fit time by separating mat-vec in m...
75,421
0
340
136
41
258,777
77
scikit-learn
15
sklearn/linear_model/_linear_loss.py
Python
21
{ "docstring": "Helper function to get coefficients, intercept and raw_prediction.\n\n Parameters\n ----------\n coef : ndarray of shape (n_dof,), (n_classes, n_dof) or (n_classes * n_dof,)\n Coefficients of a linear model.\n If shape (n_classes * n_dof,), the classes of one...
https://github.com/scikit-learn/scikit-learn.git
3
_make_class_weight_map_fn
def _make_class_weight_map_fn(class_weight): class_ids = list(sorted(class_weight.keys())) expected_class_ids = list(range(len(class_ids))) if class_ids != expected_class_ids: error_msg = ( "Expected `class_weight` to be a dict with keys from 0 to one less " "than the nu...
84afc5193d38057e2e2badf9c889ea87d80d8fbf
13
data_adapter.py
123
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
80,688
0
116
76
43
271,103
48
keras
17
keras/engine/data_adapter.py
Python
14
{ "docstring": "Applies class weighting to a `Dataset`.\n\n The `Dataset` is assumed to be in format `(x, y)` or `(x, y, sw)`, where\n `y` must be a single `Tensor`.\n\n Args:\n class_weight: A map where the keys are integer class ids and values are\n the class weights, e.g. `{0: 0.2, 1: 0.6, 2: ...
https://github.com/keras-team/keras.git
2
convert_continuos_f0
def convert_continuos_f0(f0): # get uv information as binary f0 = np.copy(f0) uv = np.float32(f0 != 0) # get start and end of f0 if (f0 == 0).all(): print("| all of the f0 values are 0.") return uv, f0 start_f0 = f0[f0 != 0][0] end_f0 = f0[f0 != 0][-1] # padding st...
7eef3bfde63d03acbd1fc9a15a5e56bef47c0ef7
12
cwt.py
255
Add Diffsinger Module (#2120) * add diffsinger * update README * update README
10,585
0
168
159
58
52,497
97
PaddleHub
19
modules/audio/svs/diffsinger/utils/cwt.py
Python
16
{ "docstring": "CONVERT F0 TO CONTINUOUS F0\n Args:\n f0 (ndarray): original f0 sequence with the shape (T)\n Return:\n (ndarray): continuous f0 with the shape (T)\n ", "language": "en", "n_whitespaces": 46, "n_words": 23, "vocab_size": 15 }
https://github.com/PaddlePaddle/PaddleHub.git
1
test_dates
def test_dates(self, mock_handler): df = pd.DataFrame([ {'a': 1, 'b': dt.datetime(2020, 1, 1)}, {'a': 2, 'b': dt.datetime(2020, 1, 2)}, {'a': 1, 'b': dt.datetime(2020, 1, 3)}, ]) self.set_handler(mock_handler, name='pg', tables={'tasks': df}) # --- us...
5b1cd41a6202873e49c9ec43c770cf7d1f700adb
13
test_executor.py
320
keep datetype from predictor
25,689
0
297
198
57
116,198
81
mindsdb
26
tests/unit/test_executor.py
Python
31
{ "docstring": "\n SELECT a, last(b)\n FROM (\n SELECT res.a, res.b \n FROM pg.tasks as source\n JOIN mindsdb.task_model as res\n ) \n group by 1\n order by a\n ", "language": "en", "n_whitespaces": 133, "...
https://github.com/mindsdb/mindsdb.git
2
isfuture
def isfuture(obj): return (hasattr(obj.__class__, '_asyncio_future_blocking') and obj._asyncio_future_blocking is not None)
8198943edd73a363c266633e1aa5b2a9e9c9f526
10
base_futures.py
41
add python 3.10.4 for windows
55,982
0
27
24
10
220,370
10
XX-Net
5
python3.10.4/Lib/asyncio/base_futures.py
Python
3
{ "docstring": "Check for a Future.\n\n This returns True when obj is a Future instance or is advertising\n itself as duck-type compatible by setting _asyncio_future_blocking.\n See comment in Future for more details.\n ", "language": "en", "n_whitespaces": 42, "n_words": 30, "vocab_size": 26 }
https://github.com/XX-net/XX-Net.git
4
density
def density(w, **kwargs): if kwargs: warnings.warn( "Additional keyword arguments are deprecated in version 1.2 and will be" " removed in version 1.4.", FutureWarning, ) if hasattr(w, "toarray"): d = float(w.nnz) / (w.shape[0] * w.shape[1]) e...
5d8a1994620713c2e4226fb8e40fef7e81af1103
17
extmath.py
135
API Deprecate the extra keyword arguments of utils.extmath.density (#24523) Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com> Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
76,700
0
126
82
42
261,230
50
scikit-learn
13
sklearn/utils/extmath.py
Python
12
{ "docstring": "Compute density of a sparse vector.\n\n Parameters\n ----------\n w : array-like\n The sparse vector.\n **kwargs : keyword arguments\n Ignored.\n\n .. deprecated:: 1.2\n ``**kwargs`` were deprecated in version 1.2 and will be removed in\n 1.4.\n\n...
https://github.com/scikit-learn/scikit-learn.git
1
get_faces_in_frame
def get_faces_in_frame(self, frame_name): logger.trace("Getting faces for frame_name: '%s'", frame_name) return self._data.get(frame_name, {}).get("faces", [])
5e73437be47f2410439a3c6716de96354e6a0c94
10
alignments.py
61
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
20,639
0
34
36
13
101,219
13
faceswap
7
lib/align/alignments.py
Python
3
{ "docstring": " Obtain the faces from :attr:`data` associated with a given frame_name.\n\n Parameters\n ----------\n frame_name: str\n The frame name to return faces for. This should be the base name of the frame, not the\n full path\n\n Returns\n -------\n ...
https://github.com/deepfakes/faceswap.git
1
test_switch_change_alarm_state
async def test_switch_change_alarm_state(hass, utcnow): helper = await setup_test_component(hass, create_security_system_service) await hass.services.async_call( "alarm_control_panel", "alarm_arm_home", {"entity_id": "alarm_control_panel.testdevice"}, blocking=True, ) ...
58b8c30221a6f6e5acbbe98b7e3298b03fb741f5
11
test_alarm_control_panel.py
290
Improve homekit_controller tests (#65266)
110,111
0
363
177
28
311,446
69
core
14
tests/components/homekit_controller/test_alarm_control_panel.py
Python
50
{ "docstring": "Test that we can turn a HomeKit alarm on and off again.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
https://github.com/home-assistant/core.git
3
test_cache_multiple_objects
def test_cache_multiple_objects(self): sites = Site.objects.all() search_backend.cache(sites) content_type = ContentType.objects.get_for_model(Site) self.assertEqual( CachedValue.objects.filter(object_type=content_type).count(), len(SiteIndex.fields) * s...
9628dead07ccef9608b32906aa8194bc948e5a09
16
test_search.py
180
Closes #10560: New global search (#10676) * Initial work on new search backend * Clean up search backends * Return only the most relevant result per object * Clear any pre-existing cached entries on cache() * #6003: Implement global search functionality for custom field values * Tweak field weights & do...
78,238
0
299
116
30
265,901
34
netbox
28
netbox/netbox/tests/test_search.py
Python
19
{ "docstring": "\n Test that multiples objects are cached appropriately\n ", "language": "en", "n_whitespaces": 22, "n_words": 7, "vocab_size": 7 }
https://github.com/netbox-community/netbox.git
4
convert
def convert(gr, raw_node): type, value, context, children = raw_node if children or type in gr.number2symbol: # If there's exactly one child, return that child instead of # creating a new node. if len(children) == 1: return children[0] return Node(type, children,...
8198943edd73a363c266633e1aa5b2a9e9c9f526
11
pytree.py
97
add python 3.10.4 for windows
55,497
0
104
63
38
218,844
46
XX-Net
11
python3.10.4/Lib/lib2to3/pytree.py
Python
8
{ "docstring": "\n Convert raw node information to a Node or Leaf instance.\n\n This is passed to the parser driver which calls it whenever a reduction of a\n grammar rule produces a new complete node, so that the tree is build\n strictly bottom-up.\n ", "language": "en", "n_whitespaces": 56, "n_...
https://github.com/XX-net/XX-Net.git
2
has_lib
def has_lib(self): return (self.distribution.has_pure_modules() or self.distribution.has_ext_modules())
8198943edd73a363c266633e1aa5b2a9e9c9f526
10
install.py
42
add python 3.10.4 for windows
56,722
0
35
24
6
222,741
6
XX-Net
5
python3.10.4/Lib/distutils/command/install.py
Python
3
{ "docstring": "Returns true if the current distribution has any Python\n modules to install.", "language": "en", "n_whitespaces": 18, "n_words": 12, "vocab_size": 12 }
https://github.com/XX-net/XX-Net.git
1
get_all_providers
def get_all_providers() -> List[str]: from setup import PROVIDERS_REQUIREMENTS return list(PROVIDERS_REQUIREMENTS.keys())
3ed07474649b1e202f9b106105fef21f7b2cfddc
9
verify_providers.py
41
Seperate provider verification as standalone breeze command (#23454) This is another step in simplifying and converting to Python all of the CI/local development tooling. This PR separates out verification of providers as a separate breeze command `verify-provider-packages`. It was previously part of "prepare_pr...
9,376
0
19
23
10
48,147
10
airflow
7
scripts/in_container/verify_providers.py
Python
7
{ "docstring": "\n Returns all providers for regular packages.\n :return: list of providers that are considered for provider packages\n ", "language": "en", "n_whitespaces": 26, "n_words": 16, "vocab_size": 14 }
https://github.com/apache/airflow.git
1
test_orderby_percentile_with_many_fields_transactions_unsupported_fields
def test_orderby_percentile_with_many_fields_transactions_unsupported_fields(self): response = self.get_response( self.organization.slug, field=[ "p50(sentry.transactions.measurements.lcp)", "sum(user_misery)", ], statsPeri...
9af098891a8243d08ee5ab6e51925a082135e3f2
11
test_organization_metrics.py
123
feat(metrics): Support multi-field orderby for performance [INGEST-805] (#31162) * feat(metrics): Support metrics multi-field orderby queries Adds support for the performance table to the metrics organization data endpoint
19,226
0
219
71
34
95,663
37
sentry
14
tests/sentry/api/endpoints/test_organization_metrics.py
Python
18
{ "docstring": "\n Test that contains a field in the `select` that is performance related but currently\n not supported should return a 400\n ", "language": "en", "n_whitespaces": 42, "n_words": 20, "vocab_size": 18 }
https://github.com/getsentry/sentry.git
3
get_result
def get_result(self) -> Any: if not self._complete.is_set(): logger.warning("Aborting attempt to retrieve result from a LongRunningTask that is " "still running") return None if self.err: logger.debug("Error caught in thread") ...
dc18c74eea0c7837a820d27628cb12b0824fa30e
11
utils.py
177
Bugfix: Preview for extract in batch mode
20,914
0
182
102
35
101,502
45
faceswap
17
lib/gui/utils.py
Python
23
{ "docstring": " Return the result from the given task.\n\n Returns\n -------\n varies:\n The result of the thread will depend on the given task. If a call is made to\n :func:`get_result` prior to the thread completing its task then ``None`` will be\n returned\n ...
https://github.com/deepfakes/faceswap.git
1
get_snap_revisions
def get_snap_revisions(snap, version): print('Getting revision numbers for', snap, version) cmd = ['snapcraft', 'status', snap] process = subprocess.run(cmd, check=True, stdout=subprocess.PIPE, universal_newlines=True) pattern = f'^\s+candidate\s+{version}\s+(\d+)\s*' revisions = re.findall(pat...
39e8d14e1b221bf37526cc05ecc83beee30a3c57
10
finish_release.py
148
Set up 2.0 pre-releases (#9400) * update credential info * update release tooling to use candidate channel * split deploy jobs * pass parameter through * add 2.0 pipeline prerelease * add comments * quote file path
45,646
0
70
79
41
186,893
46
certbot
19
tools/finish_release.py
Python
8
{ "docstring": "Finds the revisions for the snap and version in the candidate channel.\n\n If you call this function without being logged in with snapcraft, it\n will hang with no output.\n\n :param str snap: the name of the snap on the snap store\n :param str version: snap version number, e.g. 1.7.0\n\n ...
https://github.com/certbot/certbot.git
2
dup_zz_mignotte_bound
def dup_zz_mignotte_bound(f, K): from sympy.functions.combinatorial.factorials import binomial d = dup_degree(f) delta = _ceil(d / 2) delta2 = _ceil(delta / 2) # euclidean-norm eucl_norm = K.sqrt( sum( [cf**2 for cf in f] ) ) # biggest values of binomial coefficients (p. 538 of refere...
e0dc14eca132f37c5f49369eb4051eae37c9b119
12
factortools.py
197
Refactored import ordering in functions
48,311
0
155
123
65
197,054
104
sympy
24
sympy/polys/factortools.py
Python
13
{ "docstring": "\n The Knuth-Cohen variant of Mignotte bound for\n univariate polynomials in `K[x]`.\n\n Examples\n ========\n\n >>> from sympy.polys import ring, ZZ\n >>> R, x = ring(\"x\", ZZ)\n\n >>> f = x**3 + 14*x**2 + 56*x + 64\n >>> R.dup_zz_mignotte_bound(f)\n 152\n\n By checking...
https://github.com/sympy/sympy.git
1
require_accelerate
def require_accelerate(test_case): return unittest.skipUnless(is_accelerate_available(), "test requires accelerate")(test_case)
2fbb237967f5d1b2eb65c2131954f23a24bd29ef
10
testing_utils.py
37
Add the auto_find_batch_size capability from Accelerate into Trainer (#17068) Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> - Adds auto_batch_size finder - Moves training loop to an inner training loop
6,873
0
13
20
7
37,824
7
transformers
5
src/transformers/testing_utils.py
Python
2
{ "docstring": "\n Decorator marking a test that requires accelerate. These tests are skipped when accelerate isn't installed.\n ", "language": "en", "n_whitespaces": 22, "n_words": 15, "vocab_size": 15 }
https://github.com/huggingface/transformers.git
3
get_strategy_run_id
def get_strategy_run_id(strategy) -> str: digest = hashlib.sha1() config = deepcopy(strategy.config) # Options that have no impact on results of individual backtest. not_important_keys = ('strategy_list', 'original_config', 'telegram', 'api_server') for k in not_important_keys: if k in...
16861db653ec8166f73fc8480894f186a137e7bd
13
misc.py
184
Implement previous backtest result reuse when config and strategy did not change.
34,273
0
133
107
44
148,500
48
freqtrade
23
freqtrade/misc.py
Python
18
{ "docstring": "\n Generate unique identification hash for a backtest run. Identical config and strategy file will\n always return an identical hash.\n :param strategy: strategy object.\n :return: hex string id.\n ", "language": "en", "n_whitespaces": 43, "n_words": 27, "vocab_size": 26 }
https://github.com/freqtrade/freqtrade.git
10
fit
def fit(self, X, y=None): self._validate_params() dtype = bool if self.metric in PAIRWISE_BOOLEAN_FUNCTIONS else float if dtype == bool and X.dtype != bool: msg = ( "Data will be converted to boolean for" f" metric {self.metric}, to avoid thi...
ed3172b6c5c733906ce3aa2316c4ad60b5c26d10
15
_optics.py
528
MAINT Parameters validation for OPTICS (#24326) Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
76,498
0
908
336
132
260,794
179
scikit-learn
52
sklearn/cluster/_optics.py
Python
60
{ "docstring": "Perform OPTICS clustering.\n\n Extracts an ordered list of points and reachability distances, and\n performs initial clustering using ``max_eps`` distance specified at\n OPTICS object instantiation.\n\n Parameters\n ----------\n X : {ndarray, sparse matrix} of...
https://github.com/scikit-learn/scikit-learn.git
1
_filter_boxes
def _filter_boxes(self, patch, boxes): center = boxes.centers.numpy() mask = (center[:, 0] > patch[0]) * (center[:, 1] > patch[1]) * ( center[:, 0] < patch[2]) * ( center[:, 1] < patch[3]) return mask
af063a6f25ddae4de90646f86b2db824f3d00138
13
transforms.py
117
[Refactor] Refactor pipelines with boxlist. (#8562) * Refactor pipelines and data_preprocesser by boxlist * Refactor browse_dataset.py * Update * Update * Update * Update * update * Update * Change with_box_wrapped to with_boxlist * Fix comments * Fix commits * Update UT
70,808
0
86
78
21
245,502
32
mmdetection
8
mmdet/datasets/transforms/transforms.py
Python
6
{ "docstring": "Check whether the center of each box is in the patch.\n\n Args:\n patch (list[int]): The cropped area, [left, top, right, bottom].\n boxes (numpy array, (N x 4)): Ground truth boxes.\n\n Returns:\n mask (numpy array, (N,)): Each box is inside or outside t...
https://github.com/open-mmlab/mmdetection.git
3
_normalize_index
def _normalize_index(index, axis_size): if issubdtype(_dtype(index), np.unsignedinteger): return index if core.is_constant_dim(axis_size): axis_size_val = _lax_const(index, axis_size) else: axis_size_val = lax.convert_element_type(core.dimension_as_value(axis_size), ...
92ca76a0395ad32423e681b6d6ce6d84c361852b
@_wraps(np.take_along_axis, update_doc=False, lax_description=TAKE_ALONG_AXIS_DOC) @partial(jit, static_argnames=('axis', 'mode'))
13
lax_numpy.py
188
Skip normalization of unsigned indices
26,806
1
107
89
29
120,261
35
jax
25
jax/_src/numpy/lax_numpy.py
Python
12
{ "docstring": "Normalizes an index value in the range [-N, N) to the range [0, N).\nUnlike :func:`numpy.take_along_axis`, :func:`jax.numpy.take_along_axis` takes\nan optional ``mode`` parameter controlling how out-of-bounds indices should be\nhandled. By default, out-of-bounds indices are clamped into range. In a fu...
https://github.com/google/jax.git
2
state_checkpoint_interval
def state_checkpoint_interval(self) -> Optional[int]: if self._is_finished: return 1 return 100
27b5ba338656b9adbfc8ebd90960a200a14d5935
7
streams.py
34
:tada: Source Looker: Migrate to native CDK (#9609)
494
0
42
20
9
3,604
10
airbyte
5
airbyte-integrations/connectors/source-looker/source_looker/streams.py
Python
5
{ "docstring": "this is a workaround: the Airbyte CDK forces for save the latest state after reading of all records", "language": "en", "n_whitespaces": 17, "n_words": 18, "vocab_size": 17 }
https://github.com/airbytehq/airbyte.git
2
timezone_tag
def timezone_tag(parser, token): bits = token.split_contents() if len(bits) != 2: raise TemplateSyntaxError("'%s' takes one argument (timezone)" % bits[0]) tz = parser.compile_filter(bits[1]) nodelist = parser.parse(("endtimezone",)) parser.delete_first_token() return TimezoneNode(n...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
@register.tag("get_current_timezone")
11
tz.py
126
Refs #33476 -- Reformatted code with Black.
51,491
1
56
67
27
206,336
29
django
15
django/templatetags/tz.py
Python
8
{ "docstring": "\n Enable a given time zone just for this block.\n\n The ``timezone`` argument must be an instance of a ``tzinfo`` subclass, a\n time zone name, or ``None``. If it is ``None``, the default time zone is\n used within the block.\n\n Sample usage::\n\n {% timezone \"Europe/Paris\" %...
https://github.com/django/django.git
18
update
def update(self) -> None: with self.lock: # Fetch valid stop information once if not self._origin: stops = self._pygtfs.stops_by_id(self.origin) if not stops: self._available = False _LOGGER.warning("Origin ...
c717fd19de01fc822d146cc5e353959dfa86d5f7
17
sensor.py
727
Move attribution to standalone attribute [e-g] (#80513)
88,424
0
1,402
420
141
289,281
259
core
46
homeassistant/components/gtfs/sensor.py
Python
72
{ "docstring": "Get the latest data from GTFS and update the states.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
https://github.com/home-assistant/core.git
3
file_exists
def file_exists(self, filename): if not self.hass.config.is_allowed_path(filename): _LOGGER.warning("Path not allowed: %s", filename) return False if not os.path.isfile(filename): _LOGGER.warning("Not a file: %s", filename) return False re...
aa57907c1878b5d7bdaf258e0b135c189abb8f27
10
notify.py
91
Improve logging for Discord integration (#68160)
92,734
0
97
54
17
293,677
25
core
11
homeassistant/components/discord/notify.py
Python
8
{ "docstring": "Check if a file exists on disk and is in authorized path.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
https://github.com/home-assistant/core.git
7
get
def get(self): response = { 'learn': False, 'predict': False, 'analyse': False } if os.name != 'posix': return response for process_type in response: processes_dir = Path(tempfile.gettempdir()).joinpath(f'mindsdb/proc...
44d7ef0e08e5144870ad2831ce6e221f9044c47c
@ns_conf.route('/telemetry')
16
util.py
230
'files' route
25,182
1
316
125
42
114,397
55
mindsdb
25
mindsdb/api/http/namespaces/util.py
Python
22
{ "docstring": " Checks server use native for learn or analyse.\n Will return right result only on Linux.\n ", "language": "en", "n_whitespaces": 34, "n_words": 15, "vocab_size": 15 }
https://github.com/mindsdb/mindsdb.git
2
get_task_type_filter_choices
def get_task_type_filter_choices(self): task_type_choices = [ (model, model.get_verbose_name()) for model in self.task_models ] task_type_choices.sort(key=lambda task_type: task_type[1].lower()) return task_type_choices
284380672da91b5f1d5ea35e01b5b86d7a534dbb
12
workflows.py
73
add another helper method get_task_type_filter_choices
15,532
0
74
45
16
70,612
17
wagtail
10
wagtail/admin/views/workflows.py
Python
7
{ "docstring": "\n To be called after dispatch(); returns the list of task type choices for filter on \"existing task\" tab\n ", "language": "en", "n_whitespaces": 33, "n_words": 18, "vocab_size": 18 }
https://github.com/wagtail/wagtail.git
1
test_workflow_action_via_edit_view
def test_workflow_action_via_edit_view(self): # Post self.client.post( reverse("wagtailadmin_pages:edit", args=(self.page.id,)), { "title": "This title was edited while approving", "slug": str(self.page.slug), "content": st...
d10f15e55806c6944827d801cd9c2d53f5da4186
13
test_workflows.py
271
Reformat with black
15,861
0
374
160
67
72,248
99
wagtail
26
wagtail/admin/tests/test_workflows.py
Python
24
{ "docstring": "\n Posting to the 'edit' view with 'action-workflow-action' set should perform the given workflow action in addition to updating page content\n ", "language": "en", "n_whitespaces": 35, "n_words": 20, "vocab_size": 18 }
https://github.com/wagtail/wagtail.git
1
test_zeroVector
def test_zeroVector(self): self.assertTrue(zeroVector(10).__str__().count("0") == 10)
f0af0c43340763724f139fa68aa1e5a9ffe458b4
14
tests.py
48
refactor: clean code Signed-off-by: slowy07 <slowy.arfy@gmail.com>
4,413
0
19
26
5
22,685
5
Python
6
linear-algebra-python/src/tests.py
Python
2
{ "docstring": "\n test for the global function zeroVector(...)\n ", "language": "en", "n_whitespaces": 21, "n_words": 6, "vocab_size": 6 }
https://github.com/geekcomputers/Python.git
1
test_user_can_supply_a_sidecar_container_and_volume
def test_user_can_supply_a_sidecar_container_and_volume(self): manifest = KubernetesJob( command=["echo", "hello"], job={ "apiVersion": "batch/v1", "kind": "Job", "metadata": {"labels": {}}, "spec": { ...
daddc2985f0cba6c6e0ae3903232cbca155e7e91
26
test_kubernetes_job.py
422
Port KubernetesFlowRunner tests to KubernetesJob tests
11,673
0
989
218
65
57,498
101
prefect
8
tests/infrastructure/test_kubernetes_job.py
Python
43
{ "docstring": "The user can supply a custom base job that includes more complex\n modifications, like a sidecar container and volumes", "language": "en", "n_whitespaces": 25, "n_words": 19, "vocab_size": 18 }
https://github.com/PrefectHQ/prefect.git
3
addCondition
def addCondition(self, *fns, **kwargs): for fn in fns: self.parseAction.append(conditionAsParseAction(fn, message=kwargs.get('message'), fatal=kwargs.get('fatal', False))) self.callDuringTry = self.callDuringTry or kwargs.g...
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
15
pyparsing.py
107
upd; format
13,297
0
117
66
19
63,420
20
transferlearning
12
.venv/lib/python3.8/site-packages/pip/_vendor/pyparsing.py
Python
6
{ "docstring": "Add a boolean predicate function to expression's list of parse actions. See\n :class:`setParseAction` for function call signatures. Unlike ``setParseAction``,\n functions passed to ``addCondition`` need to return boolean success/fail of the condition.\n\n Optional keyword argument...
https://github.com/jindongwang/transferlearning.git
4
call_arktrades
def call_arktrades(self, other_args): parser = argparse.ArgumentParser( add_help=False, prog="arktrades", description=, ) parser.add_argument( "-l", "--limit", help="Limit of rows to show", dest="limit",...
42b1acf5c3d2f9e9922ac8c4e956fffc08a5d7ae
11
dd_controller.py
229
Add an API wrapper for terminal functions to be used in python (#1170) * Initial implementation of the API wrapper for stocks/disc * Create a file for helper classes * Move models namespace class where it belongs... TO THE HELPER_CLASSES🚀 * Add backtesting api wrapper * Add ba api wrapper * Add dps api...
83,747
0
405
143
50
281,416
59
OpenBBTerminal
28
gamestonk_terminal/stocks/due_diligence/dd_controller.py
Python
36
{ "docstring": "Process arktrades command\n Get trades for ticker across all ARK funds.\n ", "language": "en", "n_whitespaces": 37, "n_words": 11, "vocab_size": 11 }
https://github.com/OpenBB-finance/OpenBBTerminal.git
3
_solve_svd_design_matrix
def _solve_svd_design_matrix(self, alpha, y, sqrt_sw, X_mean, singvals_sq, U, UT_y): w = ((singvals_sq + alpha) ** -1) - (alpha**-1) if self.fit_intercept: # detect intercept column normalized_sw = sqrt_sw / np.linalg.norm(sqrt_sw) intercept_dim = _find_small...
1fc86b6aacd89da44a3b4e8abf7c3e2ba4336ffe
12
_ridge.py
220
MNT Update black to stable version (#22474)
75,474
0
202
143
57
258,898
76
scikit-learn
25
sklearn/linear_model/_ridge.py
Python
11
{ "docstring": "Compute dual coefficients and diagonal of G^-1.\n\n Used when we have an SVD decomposition of X\n (n_samples > n_features and X is dense).\n ", "language": "en", "n_whitespaces": 44, "n_words": 23, "vocab_size": 20 }
https://github.com/scikit-learn/scikit-learn.git
3
test_parallel_state_with_long_tag
def test_parallel_state_with_long_tag(state, state_tree): short_command = "helloworld" long_command = short_command * 25 sls_contents = .format( short_command, long_command ) with pytest.helpers.temp_file("issue-49738.sls", sls_contents, state_tree): ret = state.sls( ...
f2a783643de61cac1ff3288b40241e5ce6e1ddc8
@pytest.mark.skip_on_darwin(reason="Test is broken on macosx") @pytest.mark.skip_on_windows( reason=( "Functional testing this on windows raises unicode errors. " "Tested in tests/pytests/integration/modules/state/test_state.py" ) )
12
test_state.py
209
Update to latest ``pyupgrade`` hook. Stop skipping it on CI. Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
54,306
1
184
97
67
215,988
86
salt
22
tests/pytests/functional/modules/state/test_state.py
Python
26
{ "docstring": "\n This tests the case where the state being executed has a long ID dec or\n name and states are being run in parallel. The filenames used for the\n parallel state cache were previously based on the tag for each chunk,\n and longer ID decs or name params can cause the cache file to be long...
https://github.com/saltstack/salt.git
2
process_downloaded_dataset
def process_downloaded_dataset(self): makedirs(self.processed_temp_path, exist_ok=True) for dataset in ["training", "testing"]: print(f">>> create ludwig formatted {dataset} data") labels, images = self.read_source_dataset(dataset, self.raw_dataset_path) self...
89d18365c41c4ded68edd2095349ce4a6caf5d18
12
__init__.py
141
Removes skimage and imageio dependencies replacing imsave with torchvision.utils.save_image (#1694)
901
0
106
84
31
5,992
31
ludwig
18
ludwig/datasets/mnist/__init__.py
Python
9
{ "docstring": "Read the training and test directories and write out a csv containing the training path and the\n label.", "language": "en", "n_whitespaces": 24, "n_words": 18, "vocab_size": 13 }
https://github.com/ludwig-ai/ludwig.git
5
stack
def stack(self, level=-1, dropna=True): # noqa: PR01, RT01, D200 if not isinstance(self.columns, pandas.MultiIndex) or ( isinstance(self.columns, pandas.MultiIndex) and is_list_like(level) and len(level) == self.columns.nlevels ): return self._re...
b541b6c18e6fb4515e998b9b4f88528490cf69c6
14
dataframe.py
148
REFACTOR-#3948: Use `__constructor__` in `DataFrame` and `Series` classes (#5485) Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
36,398
0
171
95
28
155,483
35
modin
15
modin/pandas/dataframe.py
Python
13
{ "docstring": "\n Stack the prescribed level(s) from columns to index.\n ", "language": "en", "n_whitespaces": 23, "n_words": 8, "vocab_size": 8 }
https://github.com/modin-project/modin.git
1
set_seed
def set_seed(seed): random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed_all(seed)
5fdb54ece78b5d277fe26a3865beca8da0430495
8
igf.py
59
Add Information Gain Filtration algorithm (#16953) * Add information gain filtration algorithm * Complying with black requirements * Added author * Fixed import order * flake8 corrections Co-authored-by: Javier Turek <javier.turek@intel.com>
6,997
0
21
34
6
38,629
6
transformers
8
examples/research_projects/information-gain-filtration/igf/igf.py
Python
5
{ "docstring": "\n For reproducible training\n\n Args:\n seed: A seed for reproducible training\n\n ", "language": "en", "n_whitespaces": 27, "n_words": 10, "vocab_size": 8 }
https://github.com/huggingface/transformers.git
11
test_step
def test_step(self, data): data = data_adapter.expand_1d(data) x, y, sample_weight = data_adapter.unpack_x_y_sample_weight(data) # These next two lines differ from the base method - they avoid issues when the labels are in # the input dict (and loss is computed internally) ...
44eaa2b3036c5c9a83ed781e08e3dc50aae193a9
16
modeling_tf_utils.py
323
Update TF test_step to match train_step (#15111) * Update TF test_step to match train_step * Update compile() warning to be clearer about what to pass
6,190
0
425
196
108
34,046
173
transformers
31
src/transformers/modeling_tf_utils.py
Python
22
{ "docstring": "\n A modification of Keras's default test_step that cleans up the printed metrics when we use a dummy loss.\n ", "language": "en", "n_whitespaces": 33, "n_words": 18, "vocab_size": 18 }
https://github.com/huggingface/transformers.git
7
get_cloud_sync_client
def get_cloud_sync_client(remote_path): if remote_path.startswith(S3_PREFIX): if not distutils.spawn.find_executable("aws"): raise ValueError( "Upload uri starting with '{}' requires awscli tool" " to be installed".format(S3_PREFIX) ) sync...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
@PublicAPI(stability="beta")
16
sync_client.py
324
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,740
1
524
159
76
132,330
164
ray
19
python/ray/tune/sync_client.py
Python
43
{ "docstring": "Returns a CommandBasedClient that can sync to/from remote storage.\n\n Args:\n remote_path (str): Path to remote storage (S3, GS or HDFS).\n\n Raises:\n ValueError if malformed remote_dir.\n ", "language": "en", "n_whitespaces": 48, "n_words": 25, "vocab_size": 24 }
https://github.com/ray-project/ray.git
1
test_hvac_mode_vs_hvac_action_current_mode_wrong
async def test_hvac_mode_vs_hvac_action_current_mode_wrong(hass, utcnow): helper = await setup_test_component(hass, create_thermostat_service) await helper.async_update( ServicesTypes.THERMOSTAT, { CharacteristicsTypes.TEMPERATURE_CURRENT: 22, CharacteristicsTypes.T...
117c12d135039797e5c00e9f1c87ece7f4be13e0
11
test_climate.py
140
Fix Eve Thermo always showing as heating in homekit_controller even when off (#80019)
87,911
0
147
89
34
288,758
39
core
19
tests/components/homekit_controller/test_climate.py
Python
16
{ "docstring": "Check that we cope with buggy HEATING_COOLING_CURRENT.", "language": "en", "n_whitespaces": 6, "n_words": 7, "vocab_size": 7 }
https://github.com/home-assistant/core.git
8
url_params_from_lookup_dict
def url_params_from_lookup_dict(lookups): params = {} if lookups and hasattr(lookups, "items"): for k, v in lookups.items(): if callable(v): v = v() if isinstance(v, (tuple, list)): v = ",".join(str(x) for x in v) elif isinstance(v...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
16
widgets.py
171
Refs #33476 -- Reformatted code with Black.
50,449
0
181
103
31
203,569
47
django
15
django/contrib/admin/widgets.py
Python
14
{ "docstring": "\n Convert the type of lookups specified in a ForeignKey limit_choices_to\n attribute to a dictionary of query parameters\n ", "language": "en", "n_whitespaces": 27, "n_words": 17, "vocab_size": 15 }
https://github.com/django/django.git
6
from_biadjacency_matrix
def from_biadjacency_matrix(A, create_using=None, edge_attribute="weight"): r G = nx.empty_graph(0, create_using) n, m = A.shape # Make sure we get even the isolated nodes of the graph. G.add_nodes_from(range(n), bipartite=0) G.add_nodes_from(range(n, n + m), bipartite=1) # Create an iterabl...
8a325d26aa7fdd3a72580c4720fa97f971bbefcb
14
matrix.py
243
Use scipy.sparse array datastructure (#6037) * Use scipy.sparse array datastructure * Add reminder to rm wrapper when scipy adds creation fns. * Rm mention of np matrix from code comment. * Update networkx/algorithms/bipartite/matrix.py Co-authored-by: Stefan van der Walt <sjvdwalt@gmail.com> Co-authore...
42,335
0
223
157
93
177,315
159
networkx
27
networkx/algorithms/bipartite/matrix.py
Python
46
{ "docstring": "Creates a new bipartite graph from a biadjacency matrix given as a\n SciPy sparse array.\n\n Parameters\n ----------\n A: scipy sparse array\n A biadjacency matrix representation of a graph\n\n create_using: NetworkX graph\n Use specified graph for result. The default is Gra...
https://github.com/networkx/networkx.git
3
_get_default_coordinate_values
def _get_default_coordinate_values(self) -> list[float | complex]: x_numbers = self.get_x_axis().get_tick_range() y_numbers = self.get_y_axis().get_tick_range() y_numbers = [complex(0, y) for y in y_numbers if y != 0] return [*x_numbers, *y_numbers]
daf23c9d1031b12d9c119b8f6b7e60727d7f9242
10
coordinate_systems.py
99
Upgraded typehints (#2429) * Future Annotations * Delete template_twitter_post.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Apply sugge...
46,112
0
62
61
22
189,522
27
manim
11
manim/mobject/coordinate_systems.py
Python
12
{ "docstring": "Generate a list containing the numerical values of the plane's labels.\n\n Returns\n -------\n List[Union[float, complex]]\n A list of floats representing the x-axis and complex numbers representing the y-axis.\n ", "language": "en", "n_whitespaces": 67, "n...
https://github.com/ManimCommunity/manim.git
7
update
def update(self, **kwargs): for k, v in kwargs.items(): if k in self._AllowedKeys: setattr(self, k, v) else: raise AttributeError(f"{k} is an unknown keyword") for figmanager in _pylab_helpers.Gcf.figs.values(): for ax in figma...
c73f4c455514cf5422d27bf38c93250de8316b21
19
gridspec.py
188
Merge SubplotBase into AxesBase.
23,597
0
231
114
35
109,454
44
matplotlib
24
lib/matplotlib/gridspec.py
Python
13
{ "docstring": "\n Update the subplot parameters of the grid.\n\n Parameters that are not explicitly given are not changed. Setting a\n parameter to *None* resets it to :rc:`figure.subplot.*`.\n\n Parameters\n ----------\n left, right, top, bottom : float or None, optional\n ...
https://github.com/matplotlib/matplotlib.git
1
test_valid_multiple_ops
def test_valid_multiple_ops(self) -> None: yaml_str = self.assert_success_from_gen_backend_stubs(yaml_str)
bb5b4cceb6f737448eaaa6817cd773b6f4b0e77d
7
test_gen_backend_stubs.py
30
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...
21,493
0
21
16
7
102,178
7
pytorch
4
tools/test/test_gen_backend_stubs.py
Python
8
{ "docstring": "\\\nbackend: XLA\ncpp_namespace: torch_xla\nsupported:\n- add.Tensor\n- abs", "language": "en", "n_whitespaces": 4, "n_words": 10, "vocab_size": 9 }
https://github.com/pytorch/pytorch.git
15
meet
def meet(self, timeout_s=180): if timeout_s <= 0: raise ValueError( "The 'timeout' argument must be positive. " "Got '{}'.".format(timeout_s) ) timeout_delta = datetime.timedelta(seconds=timeout_s) elapsed = datetime.timedelta(sec...
905258dbc19753c81039f993477e7ab027960729
24
gloo_collective_group.py
631
Clean up docstyle in python modules and add LINT rule (#25272)
31,999
0
913
372
96
140,528
141
ray
46
python/ray/util/collective/collective_group/gloo_collective_group.py
Python
47
{ "docstring": "Meet at the named actor store.\n\n Args:\n timeout_s: timeout in seconds.\n\n Return:\n None\n ", "language": "en", "n_whitespaces": 56, "n_words": 13, "vocab_size": 13 }
https://github.com/ray-project/ray.git
1
test_vocolinc_vp3_setup
async def test_vocolinc_vp3_setup(hass): entity_registry = er.async_get(hass) outlet = entity_registry.async_get_or_create( "switch", "homekit_controller", "homekit-EU0121203xxxxx07-48", suggested_object_id="original_vocolinc_vp3_outlet", ) sensor = entity_registry....
f23b1750e85f07091eb896a0b12b8f95e5646338
18
test_vocolinc_vp3.py
332
Migrate HomeKit Controller to use stable identifiers (#80064)
88,035
0
582
196
57
288,886
75
core
33
tests/components/homekit_controller/specific_devices/test_vocolinc_vp3.py
Python
53
{ "docstring": "Test that a VOCOlinc VP3 can be correctly setup in HA.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/home-assistant/core.git