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
1
__reduce__
def __reduce__(self): (serialized, _) = self._serialization_helper() # There is no outer object ref when the actor handle is # deserialized out-of-band using pickle. return ActorHandle._deserialization_helper, (serialized, None)
f084546d41f0533c1e9e96a7249532d0eb4ff47d
8
actor.py
46
Fix out-of-band deserialization of actor handle (#27700) When we deserialize actor handle via pickle, we will register it with an outer object ref equaling to itself which is wrong. For out-of-band deserialization, there should be no outer object ref. Signed-off-by: Jiajun Yao <jeromeyjj@gmail.com>
28,292
0
62
27
24
126,889
27
ray
7
python/ray/actor.py
Python
3
{ "docstring": "This code path is used by pickling but not by Ray forking.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 11 }
https://github.com/ray-project/ray.git
2
resample
def resample(self, memo): if self.label in memo: self._sampled = memo[self.label] else: self._sampled = random.choice(self.op_names) return {self.label: self._sampled}
14d2966b9e91ae16dcc39de8f41017a75cec8ff9
12
sampling.py
79
Valuechoice oneshot lightning (#4602)
24,618
0
67
49
15
112,187
17
nni
8
nni/retiarii/oneshot/pytorch/supermodule/sampling.py
Python
6
{ "docstring": "Random choose one path if label is not found in memo.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/microsoft/nni.git
3
__getitem__
def __getitem__(self, key): use_func = key.startswith(self.prefix) if use_func: key = key[len(self.prefix) :] value = super().__getitem__(key) if use_func: return self.func(value) return value
9c19aff7c7561e3a82978a272ecdaad40dda5c00
13
datastructures.py
91
Refs #33476 -- Reformatted code with Black.
51,581
0
85
55
15
206,594
21
django
10
django/utils/datastructures.py
Python
8
{ "docstring": "\n Retrieve the real value after stripping the prefix string (if\n present). If the prefix is present, pass the value through self.func\n before returning, otherwise return the raw value.\n ", "language": "en", "n_whitespaces": 57, "n_words": 28, "vocab_size": 22 }
https://github.com/django/django.git
4
_read_until
def _read_until(s, start, term): if start == len(s): return "", start + 1 for i in range(start, len(s)): if s[i] in term: return s[start:i], i return s[start : i + 1], i + 1
b3587b52b25077f68116b9852b041d33e7fc6601
12
cookies.py
104
make it black!
73,717
0
71
67
23
251,401
34
mitmproxy
7
mitmproxy/net/http/cookies.py
Python
7
{ "docstring": "\n Read until one of the characters in term is reached.\n ", "language": "en", "n_whitespaces": 17, "n_words": 10, "vocab_size": 10 }
https://github.com/mitmproxy/mitmproxy.git
3
save_preview
def save_preview(self, *args) -> None: if not self._save_var.get() and not isinstance(args[0], tk.Event): return root_path = os.path.join(os.path.realpath(os.path.dirname(sys.argv[0]))) now = datetime.now().strftime("%Y-%m-%d_%H.%M.%S") filename = os.path.join(root_...
7da2cc3dd266aabebf41a31384cc2e0e7e5af6e5
14
preview_tk.py
200
Training - Use custom preview pop-out
20,967
0
106
119
29
101,557
32
faceswap
27
lib/training/preview_tk.py
Python
18
{ "docstring": " Save out the full size preview to the faceswap folder on a save button press\n\n Parameters\n ----------\n args: tuple\n Tuple containing either the key press event (Ctrl+s shortcut) or the tk variable\n arguments (save button press)\n ", "language"...
https://github.com/deepfakes/faceswap.git
1
subgridspec
def subgridspec(self, nrows, ncols, **kwargs): return GridSpecFromSubplotSpec(nrows, ncols, self, **kwargs)
9b6abd0b4933811e0a45c2535ab8fd107db65dd9
8
gridspec.py
37
DOC: improve grammar and consistency
24,026
0
24
25
9
110,284
10
matplotlib
6
lib/matplotlib/gridspec.py
Python
2
{ "docstring": "\n Create a GridSpec within this subplot.\n\n The created `.GridSpecFromSubplotSpec` will have this `SubplotSpec` as\n a parent.\n\n Parameters\n ----------\n nrows : int\n Number of rows in grid.\n\n ncols : int\n Number of column...
https://github.com/matplotlib/matplotlib.git
2
random_brightness
def random_brightness(x, brightness_range, scale=True): if len(brightness_range) != 2: raise ValueError( "`brightness_range should be tuple or list of two floats. " "Received: %s" % (brightness_range,) ) u = np.random.uniform(brightness_range[0], brightness_range[1]...
84afc5193d38057e2e2badf9c889ea87d80d8fbf
12
image.py
92
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
81,454
0
81
58
33
275,725
33
keras
11
keras/preprocessing/image.py
Python
8
{ "docstring": "Performs a random brightness shift.\n\n Deprecated: `tf.keras.preprocessing.image.random_brightness` does not operate\n on tensors and is not recommended for new code. Prefer\n `tf.keras.layers.RandomBrightness` which provides equivalent functionality as\n a preprocessing layer. For more i...
https://github.com/keras-team/keras.git
1
get_job_id
def get_job_id(self) -> str: job_id = self.worker.current_job_id assert not job_id.is_nil() return job_id.hex()
90cea203befa8f2e86e9c1c18bb3972296358e7b
8
runtime_context.py
49
Ray 2.0 API deprecation (#26116) Ray 2.0 API deprecation for: ray.remote(): placement_group ray.remote(): placement_group_bundle_index ray.remote(): placement_group_capture_child_tasks ray.get_dashboard_url() ray.get_resource_ids() ray.disconnect() ray.connect() ray.util.ActorGroup ray.util.ActorPo...
27,932
0
40
28
12
125,635
12
ray
8
python/ray/runtime_context.py
Python
13
{ "docstring": "Get current job ID for this worker or driver.\n\n Job ID is the id of your Ray drivers that create tasks or actors.\n\n Returns:\n If called by a driver, this returns the job ID. If called in\n a task, return the job ID of the associated driver. The\n ...
https://github.com/ray-project/ray.git
1
test_select_related
def test_select_related(self, expected_queries=4): request = self.get_request() self._create_importantpages_object() # force site query beforehand Site.find_for_request(request) # fetch settings and access foreiegn keys with self.assertNumQueries(expected_quer...
d10f15e55806c6944827d801cd9c2d53f5da4186
10
test_model.py
94
Reformat with black
16,035
0
121
53
25
73,513
28
wagtail
15
wagtail/contrib/settings/tests/test_model.py
Python
9
{ "docstring": "The `select_related` attribute on setting models is `None` by default, so fetching foreign keys values requires additional queries", "language": "en", "n_whitespaces": 17, "n_words": 18, "vocab_size": 18 }
https://github.com/wagtail/wagtail.git
4
_check_input_folder
def _check_input_folder(self) -> bool: if not os.path.exists(self._args.input_dir): logger.error("Input location %s not found.", self._args.input_dir) sys.exit(1) if (os.path.isfile(self._args.input_dir) and os.path.splitext(self._args.input_dir)[1].lower...
1022651eb8a7741014f5d2ec7cbfe882120dfa5f
15
fsmedia.py
186
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
20,808
0
153
113
28
101,393
37
faceswap
18
scripts/fsmedia.py
Python
19
{ "docstring": " Check whether the input is a folder or video.\n\n Returns\n -------\n bool\n ``True`` if the input is a video otherwise ``False``\n ", "language": "en", "n_whitespaces": 61, "n_words": 21, "vocab_size": 17 }
https://github.com/deepfakes/faceswap.git
1
test_empty
def test_empty(self): response = self.client.get(reverse("admin:admin_views_podcast_changelist")) self.assertNotContains(response, "release_date__year=") self.assertNotContains(response, "release_date__month=") self.assertNotContains(response, "release_date__day=")
9c19aff7c7561e3a82978a272ecdaad40dda5c00
11
tests.py
78
Refs #33476 -- Reformatted code with Black.
52,156
0
46
43
9
207,903
11
django
7
tests/admin_views/tests.py
Python
5
{ "docstring": "\n No date hierarchy links display with empty changelist.\n ", "language": "en", "n_whitespaces": 23, "n_words": 8, "vocab_size": 8 }
https://github.com/django/django.git
1
test_async_generate_path
async def test_async_generate_path(hass): path = webhook.async_generate_path("some_id") assert path == "/api/webhook/some_id"
7872f87dd74fb4e2b610bb589facc0f763f153ae
9
test_init.py
37
Allow registering a webhook as local only (#63516)
107,567
0
19
18
9
308,838
10
core
5
tests/components/webhook/test_init.py
Python
3
{ "docstring": "Test generating just the path component of the url correctly.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
https://github.com/home-assistant/core.git
1
test_not_logged_in_redirect_default_settings
def test_not_logged_in_redirect_default_settings(self): # Get dashboard with default LOGIN_URL setting with self.settings(LOGIN_URL="django.contrib.auth.views.login"): response = self.client.get(reverse("wagtailadmin_home")) # Check that the user was redirected to the login...
d10f15e55806c6944827d801cd9c2d53f5da4186
13
test_account_management.py
110
Reformat with black
15,743
0
156
58
47
71,787
60
wagtail
11
wagtail/admin/tests/test_account_management.py
Python
8
{ "docstring": "\n This does the same as the above test but checks that it\n redirects to the correct place when the user has not set\n the LOGIN_URL setting correctly\n ", "language": "en", "n_whitespaces": 56, "n_words": 27, "vocab_size": 23 }
https://github.com/wagtail/wagtail.git
8
send_beacon
def send_beacon(): from sentry import options from sentry.models import Broadcast, Organization, Project, Team, User install_id = get_install_id() if should_skip_beacon(install_id): return end = timezone.now() events_24h = tsdb.get_sums( model=tsdb.models.internal, keys=[...
1c949dfcf87384cdf976710ebf8fe3c536e26807
@instrumented_task(name="sentry.tasks.send_beacon_metric", queue="update")
19
beacon.py
772
feat(locks): Add locks count metrics tagged with name (#36002)
18,853
1
670
434
159
92,011
213
sentry
71
src/sentry/tasks/beacon.py
Python
56
{ "docstring": "\n Send a Beacon to a remote server operated by the Sentry team.\n\n See the documentation for more details.\n ", "language": "en", "n_whitespaces": 28, "n_words": 18, "vocab_size": 16 }
https://github.com/getsentry/sentry.git
1
add_to_apply_calls
def add_to_apply_calls(self, func, *args, length=None, width=None, **kwargs): return PandasOnUnidistDataframePartition( self._data, call_queue=self.call_queue + [[func, args, kwargs]], length=length, width=width, )
193505fdf0c984743397ba3df56262f30aee13a8
11
partition.py
76
FEAT-#5053: Add pandas on unidist execution with MPI backend (#5059) Signed-off-by: Igoshev, Iaroslav <iaroslav.igoshev@intel.com>
36,279
0
83
54
18
155,188
18
modin
10
modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py
Python
7
{ "docstring": "\n Add a function to the call queue.\n\n Parameters\n ----------\n func : callable or unidist.ObjectRef\n Function to be added to the call queue.\n *args : iterable\n Additional positional arguments to be passed in `func`.\n length : unid...
https://github.com/modin-project/modin.git
6
compose_all
def compose_all(graphs): R = None # add graph attributes, H attributes take precedent over G attributes for i, G in enumerate(graphs): if i == 0: # create new graph R = G.__class__() elif G.is_multigraph() != R.is_multigraph(): raise nx.NetworkXError...
50ff08de69c6e9541cd6c029bede5dabf56cfe73
13
all.py
197
Make all.py generator friendly (#5984) * Make compose_all generator friendly * Make disjoint_union_all and intersection_all generator friendly * Refactor disjoint_union_all to yield relabeled graphs * Make union_all generator friendly * Fix intersection_all * Fix union_all signature * Allow passing a...
42,318
0
179
118
55
177,254
68
networkx
19
networkx/algorithms/operators/all.py
Python
15
{ "docstring": "Returns the composition of all graphs.\n\n Composition is the simple union of the node sets and edge sets.\n The node sets of the supplied graphs need not be disjoint.\n\n Parameters\n ----------\n graphs : iterable\n Iterable of NetworkX graphs\n\n Returns\n -------\n C ...
https://github.com/networkx/networkx.git
2
test_backfill_with_many_backward_extremities
def test_backfill_with_many_backward_extremities(self) -> None: # create the room user_id = self.register_user("kermit", "test") tok = self.login("kermit", "test") requester = create_requester(user_id) room_id = self.helper.create_room_as(room_creator=user_id, tok=tok) ...
9e06e220649cc0139749c388a894bee0d65d5f4e
17
test_federation.py
335
Add type hints to more tests files. (#12240)
71,879
0
795
197
106
247,729
141
synapse
33
tests/handlers/test_federation.py
Python
47
{ "docstring": "\n Check that we can backfill with many backward extremities.\n The goal is to make sure that when we only use a portion\n of backwards extremities(the magic number is more than 5),\n no errors are thrown.\n\n Regression test, see #11027\n ", "language": "en...
https://github.com/matrix-org/synapse.git
2
project_ids_with_team_membership
def project_ids_with_team_membership(self) -> FrozenSet[int]: teams = self._team_memberships.keys() if not teams: return frozenset() with sentry_sdk.start_span(op="get_project_access_in_teams") as span: projects = frozenset( Project.objects.filt...
b3ce25d7c3ce85a9b7195f97c6d3d76c764e1808
18
access.py
168
ref(access): Remove models from Access fields (#40940) Anticipating changes for Hybrid Cloud silo boundaries, change the public interface of the `Access` class to not expose any ORM models as dataclass fields. As a first step, replace all such objects with their raw IDs. (Credit to @corps for the underlying idea. F...
18,338
0
168
98
29
87,840
33
sentry
25
src/sentry/auth/access.py
Python
22
{ "docstring": "Return the IDs of projects to which the user has access via actual team membership.\n\n This represents the set of all projects for which `has_project_membership`\n returns true. Use that method where possible and use this property only when\n you need to iterate or query for all ...
https://github.com/getsentry/sentry.git
10
setdiff1d
def setdiff1d(ar1, ar2, assume_unique=False, *, size=None, fill_value=None): _check_arraylike("setdiff1d", ar1, ar2) if size is None: ar1 = core.concrete_or_error(None, ar1, "The error arose in setdiff1d()") else: size = core.concrete_or_error(operator.index, size, "The error arose in setdiff1d()") ar1 ...
466bea1662ea13d1c5334f4db414bec20deb1fb4
@_wraps(np.union1d, lax_description=_dedent(""" Because the size of the output of ``union1d`` is data-dependent, the function is not typically compatible with JIT. The JAX version adds the optional ``size`` argument which must be specified statically for ``jnp.union1d`` to be used within some of JAX's ...
17
setops.py
374
lax_numpy: refactor set operations into separate private submodule
26,702
1
167
223
80
119,872
121
jax
29
jax/_src/numpy/setops.py
Python
20
{ "docstring": "\n Because the size of the output of ``union1d`` is data-dependent, the function is not\n typically compatible with JIT. The JAX version adds the optional ``size`` argument which\n must be specified statically for ``jnp.union1d`` to be used within some of JAX's\n transformations.\n size...
https://github.com/google/jax.git
4
select_related
def select_related(self, *fields): self._not_support_combined_queries("select_related") if self._fields is not None: raise TypeError( "Cannot call select_related() after .values() or .values_list()" ) obj = self._chain() if fields == (Non...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
11
query.py
122
Refs #33476 -- Reformatted code with Black.
51,212
0
164
72
33
205,781
38
django
10
django/db/models/query.py
Python
14
{ "docstring": "\n Return a new QuerySet instance that will select related objects.\n\n If fields are specified, they must be ForeignKey fields and only those\n related objects are included in the selection.\n\n If select_related(None) is called, clear the list.\n ", "language": "...
https://github.com/django/django.git
1
update_mask
def update_mask(self, padding_mask, dataset_batch): original_batch_size = self.get_real_batch_size(dataset_batch) missing_count = self.padded_batch_size - original_batch_size mask = backend.concatenate( [tf.ones(original_batch_size), tf.zeros(missing_count)], axis=0 ...
84afc5193d38057e2e2badf9c889ea87d80d8fbf
11
partial_batch_padding_handler.py
101
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
80,781
0
76
66
20
271,475
23
keras
15
keras/engine/partial_batch_padding_handler.py
Python
7
{ "docstring": "Calculate and cache the amount of padding required for a batch.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/keras-team/keras.git
11
release_zoom
def release_zoom(self, event): if self._zoom_info is None: return # We don't check the event button here, so that zooms can be cancelled # by (pressing and) releasing another mouse button. self.canvas.mpl_disconnect(self._zoom_info.cid) self.remove_rubberban...
f156db08eee54d285ab0fb4e031e48d078ba6aa3
14
backend_bases.py
392
DOC: More cleanup axes -> Axes
22,787
0
521
240
118
107,500
176
matplotlib
31
lib/matplotlib/backend_bases.py
Python
27
{ "docstring": "Callback for mouse button release in zoom to rect mode.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/matplotlib/matplotlib.git
1
set_text_props
def set_text_props(self, **kwargs): self._text._internal_update(kwargs) self.stale = True
d69be2554cf6d1ac711bf433b1d6f176e3290d4f
8
table.py
38
Clarify error message for bad keyword arguments. `plot([], [], foo=42)` previously emitted ``` 'Line2D' object has no property 'foo' ``` which refers to the Matplotlib-specific concept of "properties". It now instead emits ``` Line2D.set() got an unexpected keyword argument 'foo' ``` which is modeled after the standa...
22,849
0
28
22
7
107,638
7
matplotlib
6
lib/matplotlib/table.py
Python
3
{ "docstring": "\n Update the text properties.\n\n Valid keyword arguments are:\n\n %(Text:kwdoc)s\n ", "language": "en", "n_whitespaces": 38, "n_words": 9, "vocab_size": 9 }
https://github.com/matplotlib/matplotlib.git
8
get_quantifier
def get_quantifier(ch, input_iter): if ch in "*?+": try: ch2, escaped = next(input_iter) except StopIteration: ch2 = None if ch2 == "?": ch2 = None if ch == "+": return 1, ch2 return 0, ch2 quant = [] while ch != "...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
12
regex_helper.py
225
Refs #33476 -- Reformatted code with Black.
51,659
0
226
128
39
206,725
79
django
13
django/utils/regex_helper.py
Python
24
{ "docstring": "\n Parse a quantifier from the input, where \"ch\" is the first character in the\n quantifier.\n\n Return the minimum number of occurrences permitted by the quantifier and\n either None or the next character from the input_iter if the next character\n is not part of the quantifier.\n ...
https://github.com/django/django.git
2
placement_map
def placement_map(self) -> Mapping[tuple[int, int], list[WidgetPlacement]]: if self._map is None: self._map = self._build_placements(self._placements) return self._map return self._map
8d3b0f22eca8babf95470acf39fc626a1b0be1b4
11
_spatial_map.py
74
first iteration of spatial map
45,286
0
60
48
13
186,002
17
textual
10
src/textual/_spatial_map.py
Python
10
{ "docstring": "A mapping of block coordinate on to widget placement.\n\n Returns:\n Mapping[tuple[int, int], list[WidgetPlacement]]: Mapping.\n ", "language": "en", "n_whitespaces": 39, "n_words": 14, "vocab_size": 14 }
https://github.com/Textualize/textual.git
2
_get_tightbbox_for_layout_only
def _get_tightbbox_for_layout_only(obj, *args, **kwargs): try: return obj.get_tightbbox(*args, **{**kwargs, "for_layout_only": True}) except TypeError: return obj.get_tightbbox(*args, **kwargs)
9b6abd0b4933811e0a45c2535ab8fd107db65dd9
13
artist.py
76
DOC: improve grammar and consistency
23,986
0
38
46
13
110,244
15
matplotlib
6
lib/matplotlib/artist.py
Python
5
{ "docstring": "\n Matplotlib's `.Axes.get_tightbbox` and `.Axis.get_tightbbox` support a\n *for_layout_only* kwarg; this helper tries to use the kwarg but skips it\n when encountering third-party subclasses that do not support it.\n ", "language": "en", "n_whitespaces": 40, "n_words": 27, "vocab_...
https://github.com/matplotlib/matplotlib.git
4
_worker_health_check
def _worker_health_check(self) -> List[int]: logger.info("Health checking all workers ...") remote_results = self.__worker_manager.foreach_actor( lambda w: w.sample_with_count(), healthy_only=False, ) return [ r.actor_id for r in...
e707ce4fb3717e3c05118c57f503dfbd03552ca9
12
worker_set.py
105
[RLlib] Refactor `WorkerSet` on top of `FaultTolerantActorManager`. (#29938) Signed-off-by: Jun Gong <jungong@anyscale.com>
30,789
0
128
65
30
135,997
31
ray
18
rllib/evaluation/worker_set.py
Python
17
{ "docstring": "Performs a health-check on each remote worker.\n\n Returns:\n List of indices (into `self._remote_workers` list) of faulty workers.\n Note that index=1 is the 0th item in `self._remote_workers`.\n ", "language": "en", "n_whitespaces": 62, "n_words": 26, "voc...
https://github.com/ray-project/ray.git
2
get_running_loop
def get_running_loop(): # NOTE: this function is implemented in C (see _asynciomodule.c) loop = _get_running_loop() if loop is None: raise RuntimeError('no running event loop') return loop
8198943edd73a363c266633e1aa5b2a9e9c9f526
10
events.py
43
add python 3.10.4 for windows
55,997
0
48
22
23
220,442
26
XX-Net
4
python3.10.4/Lib/asyncio/events.py
Python
5
{ "docstring": "Return the running event loop. Raise a RuntimeError if there is none.\n\n This function is thread-specific.\n ", "language": "en", "n_whitespaces": 23, "n_words": 16, "vocab_size": 15 }
https://github.com/XX-net/XX-Net.git
4
_get_feature_index
def _get_feature_index(fx, feature_names=None): if isinstance(fx, str): if feature_names is None: raise ValueError( f"Cannot plot partial dependence for feature {fx!r} since " "the list of feature names was not provided, neither as " "column n...
c1cfc4d4f36f9c00413e20d0ef85bed208a502ca
14
_pd_utils.py
107
ENH Extend PDP for nominal categorical features (#18298) Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> Closes https://github.com/scikit-learn/scikit-learn/issues/1...
76,930
0
196
56
50
261,669
62
scikit-learn
8
sklearn/inspection/_pd_utils.py
Python
14
{ "docstring": "Get feature index.\n\n Parameters\n ----------\n fx : int or str\n Feature index or name.\n\n feature_names : list of str, default=None\n All feature names from which to search the indices.\n\n Returns\n -------\n idx : int\n Feature index.\n ", "language...
https://github.com/scikit-learn/scikit-learn.git
1
GeneralizedMultivariateLogGamma
def GeneralizedMultivariateLogGamma(syms, delta, v, lamda, mu): return multivariate_rv(GeneralizedMultivariateLogGammaDistribution, syms, delta, v, lamda, mu)
9ad8ab9fe58051cf11626ba6654852fcfec60147
7
joint_rv_types.py
39
Documentation cleanup 5
48,117
0
46
29
10
196,699
13
sympy
8
sympy/stats/joint_rv_types.py
Python
3
{ "docstring": "\n Creates a joint random variable with generalized multivariate log gamma\n distribution.\n\n The joint pdf can be found at [1].\n\n Parameters\n ==========\n\n syms: list/tuple/set of symbols for identifying each component\n delta: A constant in range $[0, 1]$\n v: Positive r...
https://github.com/sympy/sympy.git
4
test_dqn_compilation_integer_rewards
def test_dqn_compilation_integer_rewards(self): num_iterations = 1 config = ( dqn.dqn.DQNConfig() .rollouts(num_rollout_workers=2) .training(num_steps_sampled_before_learning_starts=0) ) for _ in framework_iterator(config, with_eager_tracing=...
7ba37885c67844d2eb18a63dcf3b7ac7f66ce89f
14
test_dqn.py
300
Cast rewards as tf.float32 to fix error in DQN in tf2 (#28384) * Cast rewards as tf.float32 to fix error in DQN in tf2 Signed-off-by: mgerstgrasser <matthias@gerstgrasser.net> * Add test case for DQN with integer rewards Signed-off-by: mgerstgrasser <matthias@gerstgrasser.net> Signed-off-by: mgerstgrasser ...
28,479
0
404
181
43
127,648
66
ray
32
rllib/algorithms/dqn/tests/test_dqn.py
Python
28
{ "docstring": "Test whether DQN can be built on all frameworks.\n Unlike the previous test, this uses an environment with integer rewards\n in order to test that type conversions are working correctly.", "language": "en", "n_whitespaces": 43, "n_words": 30, "vocab_size": 30 }
https://github.com/ray-project/ray.git
2
_estimator_has
def _estimator_has(attr): return lambda self: ( hasattr(self.estimators_[0], attr) if hasattr(self, "estimators_") else hasattr(self.base_estimator, attr) )
a794c58692a1f3e7a85a42d8c7f7ddd5fcf18baa
12
_bagging.py
62
MNT Replace if_delegate_has_method with available_if in ensemble and semi_supervised (#20545) Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
75,632
0
45
39
14
259,191
15
scikit-learn
6
sklearn/ensemble/_bagging.py
Python
6
{ "docstring": "Check if we can delegate a method to the underlying estimator.\n\n First, we check the first fitted estimator if available, otherwise we\n check the base estimator.\n ", "language": "en", "n_whitespaces": 35, "n_words": 26, "vocab_size": 19 }
https://github.com/scikit-learn/scikit-learn.git
1
test_project_config_dynamic_sampling_is_none
def test_project_config_dynamic_sampling_is_none(default_project): default_project.update_option("sentry:dynamic_sampling", None) with Feature({"organizations:server-side-sampling": True}): cfg = get_project_config(default_project) cfg = cfg.to_dict() dynamic_sampling = get_path(cfg, "con...
e0e2c4ff4248042abda3cc93024930dada416af8
@pytest.mark.django_db
12
test_config.py
103
feat(dynamic-sampling): Handles updating ProjectConfig with uniform DS rule for v2 [TET-465] (#40268) This PR forces your uniform rule by your plan or respect old logic. If both feature flags are enabled dynamic-sampling-basic flag takes the highest precedence. Original PR https://github.com/getsentry/sentry/pull...
18,216
1
47
51
19
87,078
23
sentry
12
tests/sentry/relay/test_config.py
Python
7
{ "docstring": "\n Tests test check inc-237 that dynamic sampling is None,\n so it's pass when we have fix and fails when we dont\n ", "language": "en", "n_whitespaces": 31, "n_words": 21, "vocab_size": 19 }
https://github.com/getsentry/sentry.git
3
get_all_distribution_names
def get_all_distribution_names(url=None): if url is None: url = DEFAULT_INDEX client = ServerProxy(url, timeout=3.0) try: return client.list_packages() finally: client('close')()
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
12
locators.py
75
upd; format
12,837
0
54
44
16
62,028
18
transferlearning
7
.venv/lib/python3.8/site-packages/pip/_vendor/distlib/locators.py
Python
8
{ "docstring": "\n Return all distribution names known by an index.\n :param url: The URL of the index.\n :return: A list of all known distribution names.\n ", "language": "en", "n_whitespaces": 36, "n_words": 23, "vocab_size": 18 }
https://github.com/jindongwang/transferlearning.git
1
convert_tokens_to_string
def convert_tokens_to_string(self, tokens): out_string = "".join(tokens).replace(SPIECE_UNDERLINE, " ").strip() return out_string
c1c79b06550b587b2a975016ef9d18b53258025b
13
tokenization_nllb.py
52
NLLB tokenizer (#18126) * NLLB tokenizer * Apply suggestions from code review - Thanks Stefan! Co-authored-by: Stefan Schweter <stefan@schweter.it> * Final touches * Style :) * Update docs/source/en/model_doc/nllb.mdx Co-authored-by: Stefan Schweter <stefan@schweter.it> * Apply suggestions from co...
5,877
0
31
29
9
32,198
10
transformers
8
src/transformers/models/nllb/tokenization_nllb.py
Python
3
{ "docstring": "Converts a sequence of tokens (strings for sub-words) in a single string.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 11 }
https://github.com/huggingface/transformers.git
1
start
def start(self, workflow_state, user=None): task_state = self.get_task_state_class()(workflow_state=workflow_state) task_state.status = TaskState.STATUS_IN_PROGRESS task_state.page_revision = workflow_state.page.get_latest_revision() task_state.task = self task_state.sav...
d10f15e55806c6944827d801cd9c2d53f5da4186
10
__init__.py
122
Reformat with black
16,102
0
120
77
20
73,775
24
wagtail
20
wagtail/core/models/__init__.py
Python
12
{ "docstring": "Start this task on the provided workflow state by creating an instance of TaskState", "language": "en", "n_whitespaces": 13, "n_words": 14, "vocab_size": 14 }
https://github.com/wagtail/wagtail.git
1
test_parse_qsd
def test_parse_qsd(self): assert validate(parse_qsd(), 'foo=bar&foo=baz') == {"foo": "baz"} with self.assertRaises(ValueError) as cm: validate(parse_qsd(), 123) assert_validationerror(cm.exception, )
3d44da082b3ba202b9d0557bfd8ce747a1d7960c
11
test_api_validate.py
84
plugin.api.validate: implement ValidationError - Implement `ValidationError` - Inherit from `ValueError` to preserve backwards compatiblity - Allow collecting multiple errors (AnySchema) - Keep an error stack of parent `ValidationError`s or other exceptions - Format error stack when converting error to string ...
45,710
0
47
46
15
187,150
16
streamlink
9
tests/test_api_validate.py
Python
8
{ "docstring": "\n ValidationError:\n Unable to parse query string: 'int' object has no attribute 'decode' (123)\n ", "language": "en", "n_whitespaces": 45, "n_words": 13, "vocab_size": 13 }
https://github.com/streamlink/streamlink.git
1
upgrade
def upgrade(): # install pg_trgm op.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm;") with op.get_context().autocommit_block(): op.execute( )
0f0430b003e710f2e59a7e575dd2fac183b9ca28
11
2022_10_31_161719_41e5ed9e1034_.py
54
Allow filtering of Work Queues via the API based on name prefix (#7394)
11,915
0
49
27
15
59,614
15
prefect
5
src/prefect/orion/database/migrations/versions/postgresql/2022_10_31_161719_41e5ed9e1034_.py
Python
10
{ "docstring": "\n CREATE INDEX CONCURRENTLY\n trgm_ix_work_queue_name\n ON work_queue USING gin (name gin_trgm_ops);\n ", "language": "en", "n_whitespaces": 55, "n_words": 10, "vocab_size": 10 }
https://github.com/PrefectHQ/prefect.git
5
add_trusted_host
def add_trusted_host(self, host, source=None, suppress_logging=False): # type: (str, Optional[str], bool) -> None if not suppress_logging: msg = f'adding trusted host: {host!r}' if source is not None: msg += f' (from {source})' logger.info(msg...
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
12
session.py
172
upd; format
12,338
0
264
99
49
60,907
64
transferlearning
15
.venv/lib/python3.8/site-packages/pip/_internal/network/session.py
Python
18
{ "docstring": "\n :param host: It is okay to provide a host that has previously been\n added.\n :param source: An optional source string, for logging where the host\n string came from.\n ", "language": "en", "n_whitespaces": 72, "n_words": 28, "vocab_size": 26 }
https://github.com/jindongwang/transferlearning.git
1
test_paginate_pages
def test_paginate_pages(user_api_client, page, page_type): page.is_published = True data_02 = { "slug": "test02-url", "title": "Test page", "content": dummy_editorjs("Content for page 1"), "is_published": True, "page_type": page_type, } data_03 = { "slug":...
85681143d185863ae1a54af03f0690d11af04563
11
test_page_update.py
221
Update files structure of page tests (#9182)
4,929
0
166
122
39
26,031
60
saleor
18
saleor/graphql/page/tests/mutations/test_page_update.py
Python
34
{ "docstring": "\n query PagesQuery {\n pages(first: 2) {\n edges {\n node {\n id\n title\n }\n }\n }\n }\n ", "language": "en", "n_whitespaces": 174, "n_w...
https://github.com/saleor/saleor.git
10
prettify_exc
def prettify_exc(error): errors = [] for exc in KNOWN_EXCEPTIONS: search_string = exc.match_string if exc.match_string else exc.exception_name split_string = ( exc.show_from_string if exc.show_from_string else exc.exception_name ) if search_string in error: ...
9a3b3ce70621af6f9adaa9eeac9cf83fa149319c
16
exceptions.py
231
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.
3,069
0
267
126
51
19,700
80
pipenv
19
pipenv/exceptions.py
Python
19
{ "docstring": "Catch known errors and prettify them instead of showing the\n entire traceback, for better UX", "language": "en", "n_whitespaces": 17, "n_words": 15, "vocab_size": 15 }
https://github.com/pypa/pipenv.git
1
log_deletion
def log_deletion(self, request, obj, object_repr): from django.contrib.admin.models import DELETION, LogEntry return LogEntry.objects.log_action( user_id=request.user.pk, content_type_id=get_content_type_for_model(obj).pk, object_id=obj.pk, objec...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
11
options.py
90
Refs #33476 -- Reformatted code with Black.
50,382
0
101
63
18
203,451
18
django
20
django/contrib/admin/options.py
Python
9
{ "docstring": "\n Log that an object will be deleted. Note that this method must be\n called before the deletion.\n\n The default implementation creates an admin LogEntry object.\n ", "language": "en", "n_whitespaces": 54, "n_words": 25, "vocab_size": 22 }
https://github.com/django/django.git
139
_parse_query
def _parse_query(self, sql): mindsdb_sql_struct = parse_sql(sql, dialect='mindsdb') # is it query to 'predictors'? if ( isinstance(mindsdb_sql_struct.from_table, Identifier) and mindsdb_sql_struct.from_table.parts[-1].lower() == 'predictors' and ( ...
bc3b53170ee1bc542682366ed93bc362cf26e152
30
sql_query.py
5,091
fix selecting from files
25,033
0
9,407
3,055
531
113,817
1,533
mindsdb
176
mindsdb/api/mysql/mysql_proxy/classes/sql_query.py
Python
413
{ "docstring": "\n SELECT * FROM {a_name} as ta full join {b_name} as tb\n ON ta.{left_columns_map_reverse[('__mindsdb_row_id', '__mindsdb_row_id')]}\n = tb.{right_columns_map_reverse[('__mindsdb_row_id', '__mindsdb_row_id')]}\n ", "language":...
https://github.com/mindsdb/mindsdb.git
1
test_payment_refund_or_void_refund_called_txn_exist
def test_payment_refund_or_void_refund_called_txn_exist(refund_mock, payment): # given payment.charge_status = ChargeStatus.FULLY_CHARGED payment.save(update_fields=["charge_status"]) assert payment.can_refund() is True payment.captured_amount = payment.total payment.save(update_fields=["ca...
0881beec1ac02dfa97525c5173687defb356d85c
@patch("saleor.payment.gateway.refund")
11
test_gateway.py
202
Fix payment flow (#9504) * Do not capture payment again when it should be refunded or voided * Do not create order when then is ongoing refund
5,046
1
140
120
37
26,687
43
saleor
29
saleor/payment/tests/test_gateway.py
Python
19
{ "docstring": "Ensure that the refund method is called when the refund process\n is already ongoing but not covered full payment captured amount.", "language": "en", "n_whitespaces": 23, "n_words": 21, "vocab_size": 18 }
https://github.com/saleor/saleor.git
6
get_item_price
def get_item_price(args, item_code, ignore_party=False): args["item_code"] = item_code conditions = conditions += "and ifnull(batch_no, '') in ('', %(batch_no)s)" if not ignore_party: if args.get("customer"): conditions += " and customer=%(customer)s" elif args.get("supplier"): conditions += " and ...
494bd9ef78313436f0424b918f200dab8fc7c20b
12
get_item_details.py
181
style: format code with black
14,635
0
50
96
43
67,838
68
erpnext
10
erpnext/stock/get_item_details.py
Python
27
{ "docstring": "\n\tGet name, price_list_rate from Item Price based on conditions\n\t Check if the desired qty is within the increment of the packing list.\n\t:param args: dict (or frappe._dict) with mandatory fields price_list, uom\n\t optional fields transaction_date, customer, supplier\n\t:param item...
https://github.com/frappe/erpnext.git
3
make_compound_path_from_polys
def make_compound_path_from_polys(cls, XY): # for each poly: 1 for the MOVETO, (numsides-1) for the LINETO, 1 for # the CLOSEPOLY; the vert for the closepoly is ignored but we still # need it to keep the codes aligned with the vertices numpolys, numsides, two = XY.shape ...
b26040884de54145ae857a37a6737e110b2607c4
10
path.py
183
Cleanup make_compound_path_from_poly doc, example.
23,762
0
215
115
70
109,822
95
matplotlib
22
lib/matplotlib/path.py
Python
13
{ "docstring": "\n Make a compound `Path` object to draw a number of polygons with equal\n numbers of sides.\n\n .. plot:: gallery/misc/histogram_path.py\n\n Parameters\n ----------\n XY : (numpolys, numsides, 2) array\n ", "language": "en", "n_whitespaces": 77, ...
https://github.com/matplotlib/matplotlib.git
4
_ip_int_from_string
def _ip_int_from_string(cls, ip_str): if not ip_str: raise AddressValueError('Address cannot be empty') octets = ip_str.split('.') if len(octets) != 4: raise AddressValueError("Expected 4 octets in %r" % ip_str) try: return int.from_bytes(ma...
8198943edd73a363c266633e1aa5b2a9e9c9f526
12
ipaddress.py
131
add python 3.10.4 for windows
55,382
0
130
76
37
218,550
44
XX-Net
13
python3.10.4/Lib/ipaddress.py
Python
10
{ "docstring": "Turn the given IP string into an integer for comparison.\n\n Args:\n ip_str: A string, the IP ip_str.\n\n Returns:\n The IP ip_str as an integer.\n\n Raises:\n AddressValueError: if ip_str isn't a valid IPv4 Address.\n\n ", "language": "en...
https://github.com/XX-net/XX-Net.git
2
user_can_authenticate
def user_can_authenticate(self, user): is_active = getattr(user, "is_active", None) return is_active or is_active is None
9c19aff7c7561e3a82978a272ecdaad40dda5c00
9
backends.py
40
Refs #33476 -- Reformatted code with Black.
50,472
0
35
24
12
203,605
14
django
5
django/contrib/auth/backends.py
Python
3
{ "docstring": "\n Reject users with is_active=False. Custom user models that don't have\n that attribute are allowed.\n ", "language": "en", "n_whitespaces": 36, "n_words": 14, "vocab_size": 13 }
https://github.com/django/django.git
20
get_tokens_unprocessed
def get_tokens_unprocessed(self, text=None, context=None): tokendefs = self._tokens if not context: ctx = LexerContext(text, 0) statetokens = tokendefs['root'] else: ctx = context statetokens = tokendefs[ctx.stack[-1]] text = c...
f3166e673fe8d40277b804d35d77dcdb760fc3b3
24
lexer.py
609
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,369
0
1,512
373
108
20,440
193
pipenv
30
pipenv/patched/notpip/_vendor/pygments/lexer.py
Python
56
{ "docstring": "\n Split ``text`` into (tokentype, text) pairs.\n If ``context`` is given, use this lexer context instead.\n ", "language": "en", "n_whitespaces": 37, "n_words": 15, "vocab_size": 15 }
https://github.com/pypa/pipenv.git
6
update_runtime_cls
def update_runtime_cls(args, copy=False) -> 'Namespace': _args = deepcopy(args) if copy else args gateway_runtime_dict = { GatewayProtocolType.GRPC: 'GRPCGatewayRuntime', GatewayProtocolType.WEBSOCKET: 'WebSocketGatewayRuntime', GatewayProtocolType.HTTP: 'HTTPGatewayRuntime', } ...
933415bfa1f9eb89f935037014dfed816eb9815d
12
helper.py
204
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 ...
1,737
0
142
122
40
9,864
55
jina
23
jina/peapods/peas/helper.py
Python
23
{ "docstring": "Get runtime_cls as a string from args\n\n :param args: pea/pod namespace args\n :param copy: True if args shouldn't be modified in-place\n :return: runtime class as a string\n ", "language": "en", "n_whitespaces": 39, "n_words": 27, "vocab_size": 21 }
https://github.com/jina-ai/jina.git
4
set_thetalim
def set_thetalim(self, *args, **kwargs): r orig_lim = self.get_xlim() # in radians if 'thetamin' in kwargs: kwargs['xmin'] = np.deg2rad(kwargs.pop('thetamin')) if 'thetamax' in kwargs: kwargs['xmax'] = np.deg2rad(kwargs.pop('thetamax')) new_min, new_max =...
162bd59f50a9c59a51574aee5dc9e932133bb971
13
polar.py
200
DOC: More capitalization of Axes In line with #18726. Triggered by #22242.
22,680
0
188
115
65
107,297
80
matplotlib
17
lib/matplotlib/projections/polar.py
Python
26
{ "docstring": "\n Set the minimum and maximum theta values.\n\n Can take the following signatures:\n\n - ``set_thetalim(minval, maxval)``: Set the limits in radians.\n - ``set_thetalim(thetamin=minval, thetamax=maxval)``: Set the limits\n in degrees.\n\n where minval and m...
https://github.com/matplotlib/matplotlib.git
1
get_tables
def get_tables(self) -> Response: result = {} result['data_frame'] = pd.DataFrame([self.connection_data.get('collection')]) df = result.data_frame result.data_frame = df.rename(columns={df.columns[0]: 'table_name'}) return result
eb78c9016971609746d063b135e76dc01898d821
13
solr_handler.py
103
Added Solr Handler #2740
25,838
0
61
60
14
116,815
19
mindsdb
12
mindsdb/integrations/handlers/solr_handler/solr_handler.py
Python
9
{ "docstring": "\n Get a list with all of the tables in Solr\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 10 }
https://github.com/mindsdb/mindsdb.git
10
attach
def attach(self, filename=None, content=None, mimetype=None): if isinstance(filename, MIMEBase): if content is not None or mimetype is not None: raise ValueError( "content and mimetype must not be given when a MIMEBase " "instance is p...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
17
message.py
221
Refs #33476 -- Reformatted code with Black.
50,791
0
470
134
67
204,574
96
django
19
django/core/mail/message.py
Python
24
{ "docstring": "\n Attach a file with the given filename and content. The filename can\n be omitted and the mimetype is guessed, if not provided.\n\n If the first parameter is a MIMEBase subclass, insert it directly\n into the resulting message attachments.\n\n For a text/* mimetype...
https://github.com/django/django.git
2
safestring_in_template_exception
def safestring_in_template_exception(request): template = Template('{% extends "<script>alert(1);</script>" %}') try: template.render(Context()) except Exception: return technical_500_response(request, *sys.exc_info())
c5c7a15b09368a58340d3a65ba9d1f1441e92dc8
13
views.py
67
Fixed #33461 -- Escaped template errors in the technical 500 debug page.
50,242
0
41
37
15
203,167
15
django
10
tests/view_tests/views.py
Python
6
{ "docstring": "\n Trigger an exception in the template machinery which causes a SafeString\n to be inserted as args[0] of the Exception.\n ", "language": "en", "n_whitespaces": 29, "n_words": 19, "vocab_size": 18 }
https://github.com/django/django.git
1
test_fillna_frame
def test_fillna_frame(self): super().test_fillna_frame() unhashable = pytest.mark.xfail(reason="Unhashable")
24652cf178c12562585639cba39c46d62b95f107
9
test_json.py
47
TST: Convert skip -> xfail (#46427)
39,706
0
19
13
6
165,750
6
pandas
8
pandas/tests/extension/json/test_json.py
Python
2
{ "docstring": "We treat dictionaries as a mapping in fillna, not a scalar.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 10 }
https://github.com/pandas-dev/pandas.git
1
test_import_missing_required
def test_import_missing_required(self): # Set one of our CustomFields to required CustomField.objects.filter(name='text').update(required=True) form_data = { 'name': 'Site 1', 'slug': 'site-1', } form = SiteImportForm(data=form_data) sel...
23c0ca456f2753dc35aa2717f69cdc62b405a233
11
test_customfields.py
115
#4347: Rename NetBoxModelCSVForm to NetBoxModelImportForm
78,301
0
104
63
25
266,134
26
netbox
16
netbox/extras/tests/test_customfields.py
Python
9
{ "docstring": "\n Attempt to import an object missing a required custom field.\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 10 }
https://github.com/netbox-community/netbox.git
1
disable_constraint_checking
def disable_constraint_checking(self): with self.cursor() as cursor: cursor.execute("SET foreign_key_checks=0") return True
9c19aff7c7561e3a82978a272ecdaad40dda5c00
10
base.py
46
Refs #33476 -- Reformatted code with Black.
50,989
0
42
23
10
204,952
10
django
4
django/db/backends/mysql/base.py
Python
4
{ "docstring": "\n Disable foreign key checks, primarily for use in adding rows with\n forward references. Always return True to indicate constraint checks\n need to be re-enabled.\n ", "language": "en", "n_whitespaces": 53, "n_words": 24, "vocab_size": 23 }
https://github.com/django/django.git
2
_set_mouse_bindings
def _set_mouse_bindings(self) -> None: logger.debug("Binding mouse events") if system() == "Linux": self._canvas.tag_bind(self._canvas.image_id, "<Button-4>", self._on_bound_zoom) self._canvas.tag_bind(self._canvas.image_id, "<Button-5>", self._on_bound_zoom) els...
7da2cc3dd266aabebf41a31384cc2e0e7e5af6e5
12
preview_tk.py
198
Training - Use custom preview pop-out
20,985
0
112
119
22
101,575
30
faceswap
11
lib/training/preview_tk.py
Python
15
{ "docstring": " Set the mouse bindings for interacting with the preview image\n\n Mousewheel: Zoom in and out\n Mouse click: Move image\n ", "language": "en", "n_whitespaces": 41, "n_words": 19, "vocab_size": 17 }
https://github.com/deepfakes/faceswap.git
3
sections
def sections(self) -> List[str]: return sorted(set(plugin.split(".")[0] for plugin in self._config.config.sections() if plugin.split(".")[0] != "writer"))
1022651eb8a7741014f5d2ec7cbfe882120dfa5f
15
preview.py
87
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
20,856
0
53
51
14
101,443
14
faceswap
10
tools/preview/preview.py
Python
4
{ "docstring": " list: The sorted section names that exist within the convert Configuration options. ", "language": "en", "n_whitespaces": 13, "n_words": 12, "vocab_size": 12 }
https://github.com/deepfakes/faceswap.git
1
test_parse_dockerfile_label
def test_parse_dockerfile_label(self): mock_dockerfile = assert "airbyte/source-salesforce" == parse_dockerfile_repository_label(mock_dockerfile)
fa22d32e146dff62a4be881c12e2f611e556abca
8
build_report.py
29
Filter daily build report to only GA & Beta connectors (#12684)
711
0
30
15
8
5,043
8
airbyte
4
tools/bin/build_report.py
Python
7
{ "docstring": "\nENTRYPOINT [\"python\", \"/airbyte/integration_code/main.py\"]\n\nLABEL io.airbyte.version=1.0.8\nLABEL io.airbyte.name=airbyte/source-salesforce", "language": "en", "n_whitespaces": 4, "n_words": 7, "vocab_size": 6 }
https://github.com/airbytehq/airbyte.git
6
_fetch_next_result
def _fetch_next_result(self) -> Optional[List[Dict]]: while True: results = ray.get(self._backend_executor_actor.get_next_results.remote()) if results is None: return None first_result = results[0] result_type = first_result.type ...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
17
trainer.py
198
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,641
0
375
115
54
132,035
69
ray
26
python/ray/train/trainer.py
Python
31
{ "docstring": "Fetch next results produced by ``train.report()`` from each worker.\n\n Assumes ``start_training`` has already been called.\n\n Returns:\n A list of dictionaries of values passed to ``train.report()`` from\n each worker. Each item corresponds to an intermediate ...
https://github.com/ray-project/ray.git
3
requires
def requires(self, extras=()): dm = self._dep_map deps = [] deps.extend(dm.get(None, ())) for ext in extras: try: deps.extend(dm[safe_extra(ext)]) except KeyError: raise UnknownExtra( "%s has no such ext...
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
14
__init__.py
113
upd; format
13,115
0
162
69
32
63,049
34
transferlearning
12
.venv/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py
Python
13
{ "docstring": "List of Requirements needed for this distro if `extras` are used", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/jindongwang/transferlearning.git
1
upgrade
def upgrade(): with op.get_context().autocommit_block(): op.execute( ) op.execute( ) op.execute( ) op.execute( )
b5b3d808bf059294a7adf17156e4ccdb5a3799da
11
2022_06_04_133535_d60c18774a5d_add_indexes_for_partial_name_matches.py
77
Add index migrations
11,462
0
118
39
6
56,199
12
prefect
5
src/prefect/orion/database/migrations/versions/postgresql/2022_06_04_133535_d60c18774a5d_add_indexes_for_partial_name_matches.py
Python
30
{ "docstring": "\n CREATE INDEX CONCURRENTLY \n trgm_ix_flow_name \n ON flow USING gin (name gin_trgm_ops);\n \n CREATE INDEX CONCURRENTLY \n trgm_ix_flow_run_name \n ON flow_run USING gin (name gin_trgm_ops);\n \n CREA...
https://github.com/PrefectHQ/prefect.git
9
_in_unstable_openblas_configuration
def _in_unstable_openblas_configuration(): # Import libraries which might load OpenBLAS. import numpy # noqa import scipy # noqa modules_info = threadpool_info() open_blas_used = any(info["internal_api"] == "openblas" for info in modules_info) if not open_blas_used: return Fals...
6a16763c008446953ed9380e084ed70a285a9f7e
12
__init__.py
186
ENH Introduce `PairwiseDistancesReduction` and `PairwiseDistancesArgKmin` (feature branch) (#22134) * MAINT Introduce Pairwise Distances Reductions private submodule (#22064) * MAINT Introduce FastEuclideanPairwiseArgKmin (#22065) * fixup! Merge branch 'main' into pairwise-distances-argkmin Remove duplicate...
75,509
0
268
100
69
258,990
104
scikit-learn
13
sklearn/utils/__init__.py
Python
21
{ "docstring": "Return True if in an unstable configuration for OpenBLAS", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/scikit-learn/scikit-learn.git
1
test_result_list_set_empty_value_display_in_model_admin
def test_result_list_set_empty_value_display_in_model_admin(self): new_child = Child.objects.create(name="name", parent=None) request = self.factory.get("/child/") request.user = self.superuser m = EmptyValueChildAdmin(Child, admin.site) cl = m.get_changelist_instance(re...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
11
tests.py
235
Refs #33476 -- Reformatted code with Black.
51,813
0
273
140
57
206,964
73
django
35
tests/admin_changelist/tests.py
Python
24
{ "docstring": "\n Empty value display can be set in ModelAdmin or individual fields.\n ", "language": "en", "n_whitespaces": 26, "n_words": 11, "vocab_size": 11 }
https://github.com/django/django.git
5
get_stacktrace_processing_task
def get_stacktrace_processing_task(infos, processors): by_processor = {} to_lookup = {} # by_stacktrace_info requires stable sorting as it is used in # StacktraceProcessingTask.iter_processable_stacktraces. This is important # to guarantee reproducible symbolicator requests. by_stacktrace_...
286bf2ae7ecfdd6698d8fb1cd4753f107159d4d2
14
processing.py
211
ref: use dict instead of OrderedDict since sentry is >python3.6 (#39695) partially automated (especially the fixtures) also via `\(([^]+), (.*)\),$` -> `\1: \2,`
18,122
0
225
132
54
86,534
76
sentry
23
src/sentry/stacktraces/processing.py
Python
20
{ "docstring": "Returns a list of all tasks for the processors. This can skip over\n processors that seem to not handle any frames.\n ", "language": "en", "n_whitespaces": 28, "n_words": 21, "vocab_size": 21 }
https://github.com/getsentry/sentry.git
3
dup_chebyshevu
def dup_chebyshevu(n, K): if n < 1: return [K.one] m2, m1 = [K.one], [K(2), K.zero] for i in range(2, n+1): m2, m1 = m1, dup_sub(dup_mul_ground(dup_lshift(m1, 1, K), K(2), K), m2, K) return m1 @public
3d30d00c37371f142e6a0e9dc5058752d8c9d401
@public
15
orthopolys.py
129
Restore domain elements in dup_* functions
49,373
1
62
84
27
199,717
34
sympy
13
sympy/polys/orthopolys.py
Python
7
{ "docstring": "Low-level implementation of Chebyshev polynomials of the second kind.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 8 }
https://github.com/sympy/sympy.git
1
test_media_from_actions_form
def test_media_from_actions_form(self): response = self.client.get(reverse("admin:admin_views_subscriber_changelist")) media_path = MediaActionForm.Media.js[0] self.assertIsInstance(response.context["action_form"], MediaActionForm) self.assertIn("media", response.context) ...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
11
test_actions.py
125
Refs #33476 -- Reformatted code with Black.
51,978
0
65
75
15
207,487
16
django
15
tests/admin_views/test_actions.py
Python
7
{ "docstring": "\n The action form's media is included in the changelist view's media.\n ", "language": "en", "n_whitespaces": 26, "n_words": 11, "vocab_size": 11 }
https://github.com/django/django.git
3
create_cgroup
def create_cgroup(self, name): if isinstance(name, str): name = name.encode() node = Node(name, parent=self) if node in self.children: raise RuntimeError('Node {} already exists under {}'.format(name, self.path)) fp = os.path.join(self.full_path, name) ...
68aa01936c37f9b03468cc83e3f32766ae0ba5cb
12
nodes.py
135
Add cgroupspy to _vendor folder (#22206) This is just importing existing cgroupspy library without code modifications. In the next step we will modify the cgroupspy code to work from the new location, then we will fix it to implement Python 3.10 compatibility and finally we will change airflow to use the vendored ...
8,836
0
111
84
28
46,269
33
airflow
19
airflow/_vendor/cgroupspy/nodes.py
Python
10
{ "docstring": "\n Create a cgroup by name and attach it under this node.\n ", "language": "en", "n_whitespaces": 26, "n_words": 11, "vocab_size": 11 }
https://github.com/apache/airflow.git
2
_get_all_child_nodes
def _get_all_child_nodes(self) -> Set["DAGNode"]: scanner = _PyObjScanner() children = set() for n in scanner.find_nodes( [ self._bound_args, self._bound_kwargs, self._bound_other_args_to_resolve, ] ): ...
54a71e6c4f430f210685e3b1bccef8051dd1260c
9
dag_node.py
85
[Ray DAG] Add `execute()` interface to take user inputs with ENTRY_POINT tag. (#22196) ## Diff Summary Current implementation of DAGNode pre-bind inputs and the signature of `def execute(self)` doesn't take user input yet. This PR extends the interface to take user input, mark DAG entrypoint methods as first stop o...
33,256
0
143
52
21
144,569
23
ray
13
python/ray/experimental/dag/dag_node.py
Python
19
{ "docstring": "Return the set of nodes referenced by the args, kwargs, and\n args_to_resolve in current node, even they're deeply nested.\n\n Examples:\n f.remote(a, [b]) -> set(a, b)\n f.remote(a, [b], key={\"nested\": [c]}) -> set(a, b, c)\n ", "language": "en", "n_wh...
https://github.com/ray-project/ray.git
1
get_feature_names_out
def get_feature_names_out(self, input_features=None): input_features = _check_feature_names_in(self, input_features) return self._encoder.get_feature_names_out(input_features)
279388d9ed2ea83194dd45a2d78161be30b43aa7
8
_discretization.py
44
DOC Improve get_feature_names_out docstrings (#22718) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
75,576
0
30
27
9
259,117
9
scikit-learn
5
sklearn/preprocessing/_discretization.py
Python
3
{ "docstring": "Get output feature names.\n\n Parameters\n ----------\n input_features : array-like of str or None, default=None\n Input features.\n\n - If `input_features` is `None`, then `feature_names_in_` is\n used as feature names in. If `feature_names_in_`...
https://github.com/scikit-learn/scikit-learn.git
1
test_orders_without_channel
def test_orders_without_channel(staff_api_client, permission_manage_orders, orders): query = staff_api_client.user.user_permissions.add(permission_manage_orders) response = staff_api_client.post_graphql(query) edges = get_graphql_content(response)["data"]["orders"]["edges"] assert len(edges) == O...
9effd5aec81acbdd2a1076c1d72bbee1afcc65a1
11
test_order.py
105
restructure order app tests (#11226)
5,253
0
32
62
15
29,670
17
saleor
17
saleor/graphql/order/tests/queries/test_order.py
Python
16
{ "docstring": "\n query OrdersQuery {\n orders(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\n ", "language": "en", "n_whitespaces": 110, "n_words": 15, "vocab_size": 9 }
https://github.com/saleor/saleor.git
1
test_basic_add_GET
def test_basic_add_GET(self): add_url = reverse("admin_custom_urls:admin_custom_urls_action_add") self.assertTrue(add_url.endswith("/!add/")) response = self.client.get(add_url) self.assertIsInstance(response, TemplateResponse) self.assertEqual(response.status_code, 200)...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
10
tests.py
88
Refs #33476 -- Reformatted code with Black.
51,855
0
55
51
12
207,064
13
django
13
tests/admin_custom_urls/tests.py
Python
6
{ "docstring": "\n Ensure GET on the add_view works.\n ", "language": "en", "n_whitespaces": 21, "n_words": 6, "vocab_size": 6 }
https://github.com/django/django.git
2
shutdown
def shutdown(self): for deployment_state in self._deployment_states.values(): deployment_state.delete() # TODO(jiaodong): This might not be 100% safe since we deleted # everything without ensuring all shutdown goals are completed # yet. Need to address in follow-up...
48adb6f7bb335b28fb0fb0d1190bd6c5dfc8ddfa
9
deployment_state.py
57
[serve] Introduce DeploymentStatus, poll for statuses instead of using async goals (#22121)
33,278
0
123
30
46
144,664
56
ray
8
python/ray/serve/deployment_state.py
Python
4
{ "docstring": "\n Shutdown all running replicas by notifying the controller, and leave\n it to the controller event loop to take actions afterwards.\n\n Once shutdown signal is received, it will also prevent any new\n deployments or replicas from being created.\n\n One can send mul...
https://github.com/ray-project/ray.git
2
from_spmatrix
def from_spmatrix(cls, data, index=None, columns=None) -> DataFrame: from pandas._libs.sparse import IntIndex from pandas import DataFrame data = data.tocsc() index, columns = cls._prep_index(data, index, columns) n_rows, n_columns = data.shape # We need to mak...
f65417656ba8c59438d832b6e2a431f78d40c21c
12
accessor.py
261
TYP: more return annotations in core/ (#47618) * TYP: more return annotations in core/ * from __future__ import annotations * more __future__
40,093
0
299
171
91
167,731
111
pandas
34
pandas/core/arrays/sparse/accessor.py
Python
49
{ "docstring": "\n Create a new DataFrame from a scipy sparse matrix.\n\n .. versionadded:: 0.25.0\n\n Parameters\n ----------\n data : scipy.sparse.spmatrix\n Must be convertible to csc format.\n index, columns : Index, optional\n Row and column labels ...
https://github.com/pandas-dev/pandas.git
3
has_no_leverage
def has_no_leverage(self) -> bool: return ((self.leverage == 1.0 or self.leverage is None) and not self.is_short)
b58e811b1486ae62e835cbea3e40cf88128243a0
11
trade_model.py
48
Move trade/order Models to their own class
34,502
0
29
31
15
149,719
15
freqtrade
5
freqtrade/persistence/trade_model.py
Python
3
{ "docstring": "Returns true if this is a non-leverage, non-short trade", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/freqtrade/freqtrade.git
1
test_limited_filter
def test_limited_filter(self): response = self.client.get(reverse("admin:admin_views_thing_changelist")) self.assertContains( response, '<div id="changelist-filter">', msg_prefix="Expected filter not found in changelist view", ) self.assertNot...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
11
tests.py
80
Refs #33476 -- Reformatted code with Black.
52,009
0
137
45
25
207,583
29
django
9
tests/admin_views/tests.py
Python
12
{ "docstring": "Ensure admin changelist filters do not contain objects excluded via limit_choices_to.\n This also tests relation-spanning filters (e.g. 'color__value').\n ", "language": "en", "n_whitespaces": 32, "n_words": 18, "vocab_size": 17 }
https://github.com/django/django.git
3
new_locator
def new_locator(self, nx, ny, nx1=None, ny1=None): return AxesLocator( self, nx, ny, nx1 if nx1 is not None else nx + 1, ny1 if ny1 is not None else ny + 1)
df6f95703b60348e01603f98a439b133da2938a0
9
axes_divider.py
67
Improve mpl_toolkit documentation
23,789
0
78
49
21
109,880
31
matplotlib
7
lib/mpl_toolkits/axes_grid1/axes_divider.py
Python
5
{ "docstring": "\n Return a new `.AxesLocator` for the specified cell.\n\n Parameters\n ----------\n nx, nx1 : int\n Integers specifying the column-position of the\n cell. When *nx1* is None, a single *nx*-th column is\n specified. Otherwise, location of co...
https://github.com/matplotlib/matplotlib.git
5
random_port
def random_port() -> Optional[int]: import threading import multiprocessing from contextlib import closing import socket
933415bfa1f9eb89f935037014dfed816eb9815d
6
helper.py
38
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 ...
1,713
0
29
131
11
9,827
14
jina
8
jina/helper.py
Python
28
{ "docstring": "\n Get a random available port number from '49153' to '65535'.\n\n :return: A random port.\n ", "language": "en", "n_whitespaces": 24, "n_words": 14, "vocab_size": 13 }
https://github.com/jina-ai/jina.git
1
local_devices_fixture
def local_devices_fixture(): return json.loads(load_fixture("awair/local_devices.json")) @pytest.fixture(name="gen1_data", scope="session")
ebbff7b60e43f17d65ead811d314602b9daddfc4
@pytest.fixture(name="gen1_data", scope="session")
10
conftest.py
54
Add Awair Local API support (#75535)
102,572
1
11
15
6
303,763
6
core
8
tests/components/awair/conftest.py
Python
2
{ "docstring": "Fixture representing devices returned by Awair local API.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/home-assistant/core.git
1
in_test_phase
def in_test_phase(x, alt, training=None): return in_train_phase(alt, x, training=training) # NN OPERATIONS @keras_export("keras.backend.relu") @tf.__internal__.dispatch.add_dispatch_support @doc_controls.do_not_generate_docs
84afc5193d38057e2e2badf9c889ea87d80d8fbf
@keras_export("keras.backend.relu") @tf.__internal__.dispatch.add_dispatch_support @doc_controls.do_not_generate_docs
8
backend.py
65
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
80,162
1
16
23
14
269,534
14
keras
12
keras/backend.py
Python
2
{ "docstring": "Selects `x` in test phase, and `alt` otherwise.\n\n Note that `alt` should have the *same shape* as `x`.\n\n Args:\n x: What to return in test phase\n (tensor or callable that returns a tensor).\n alt: What to return otherwise\n (tensor or callable that return...
https://github.com/keras-team/keras.git
1
parse
def parse(self, stream, *args, **kwargs): self._parse(stream, False, None, *args, **kwargs) return self.tree.getDocument()
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
8
html5parser.py
58
upd; format
12,985
0
33
38
11
62,541
12
transferlearning
8
.venv/lib/python3.8/site-packages/pip/_vendor/html5lib/html5parser.py
Python
3
{ "docstring": "Parse a HTML document into a well-formed tree\n\n :arg stream: a file-like object or string containing the HTML to be parsed\n\n The optional encoding parameter must be a string that indicates\n the encoding. If specified, that encoding will be used,\n regardle...
https://github.com/jindongwang/transferlearning.git
4
numeric_assortativity_coefficient
def numeric_assortativity_coefficient(G, attribute, nodes=None): if nodes is None: nodes = G.nodes vals = {G.nodes[n][attribute] for n in nodes} mapping = {d: i for i, d, in enumerate(vals)} M = attribute_mixing_matrix(G, attribute, nodes, mapping) return _numeric_ac(M, mapping)
34d9d630bb02426d297d3e20fedb7da8c3ced03a
10
correlation.py
111
MAINT: Cleanup assortativity module, remove unused variables (#5301) Remove unused variables, sort imports, raise errors instead of accepting invalid arguments silently Co-authored-by: Dan Schult <dschult@colgate.edu>
41,834
0
61
75
28
176,320
36
networkx
13
networkx/algorithms/assortativity/correlation.py
Python
7
{ "docstring": "Compute assortativity for numerical node attributes.\n\n Assortativity measures the similarity of connections\n in the graph with respect to the given numeric attribute.\n\n Parameters\n ----------\n G : NetworkX graph\n\n attribute : string\n Node attribute key.\n\n nodes:...
https://github.com/networkx/networkx.git
3
pretty_duration
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: ...
73a368c24246b081cdb98923ca3180937d436c3b
9
helpers.py
123
Refactor history_stats to minimize database access (part 2) (#70255)
95,828
0
126
76
30
296,854
48
core
7
homeassistant/components/history_stats/helpers.py
Python
10
{ "docstring": "Format a duration in days, hours, minutes, seconds.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/home-assistant/core.git
2
_normalize_entries
def _normalize_entries(entries, separators=None): norm_files = {} for entry in entries: norm_files[normalize_file(entry.path, separators=separators)] = entry return norm_files
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
12
util.py
57
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,206
0
35
36
13
130,281
16
ray
7
python/ray/_private/thirdparty/pathspec/util.py
Python
5
{ "docstring": "\n Normalizes the entry paths to use the POSIX path separator.\n\n *entries* (:class:`~collections.abc.Iterable` of :class:`.TreeEntry`)\n contains the entries to be normalized.\n\n *separators* (:class:`~collections.abc.Collection` of :class:`str`; or\n :data:`None`) optionally contain...
https://github.com/ray-project/ray.git
1
_connect_picklable
def _connect_picklable(self, signal, func): cid = self.connect(signal, func) self._pickled_cids.add(cid) return cid # Keep a reference to sys.is_finalizing, as sys may have been cleared out # at that point.
4caa5ba85c11cc499eb1a45372eb249173e6b1fd
8
__init__.py
50
Simplify the internal API to connect picklable callbacks. The API may be made public in the future, but right now the point is only to make its internal use more ergonomic as it can be helpful in some other internal places too (to be updated in a separate patch).
22,893
0
62
30
26
107,727
28
matplotlib
8
lib/matplotlib/cbook/__init__.py
Python
4
{ "docstring": "\n Like `.connect`, but the callback is kept when pickling/unpickling.\n\n Currently internal-use only.\n ", "language": "en", "n_whitespaces": 34, "n_words": 12, "vocab_size": 12 }
https://github.com/matplotlib/matplotlib.git
1
_get_win_folder_from_registry
def _get_win_folder_from_registry(csidl_name): import winreg as _winreg shell_folder_name = { "CSIDL_APPDATA": "AppData", "CSIDL_COMMON_APPDATA": "Common AppData", "CSIDL_LOCAL_APPDATA": "Local AppData", }[csidl_name] key = _winreg.OpenKey( _winreg.HKEY_CURRENT_USE...
47b5c8af57f0f927d50fe94f3474b09a54292553
10
appdirs.py
99
Standardize cache directory
7,372
0
91
56
29
40,277
32
seaborn
11
seaborn/external/appdirs.py
Python
13
{ "docstring": "This is a fallback technique at best. I'm not sure if using the\n registry for this guarantees us the correct answer for all CSIDL_*\n names.\n ", "language": "en", "n_whitespaces": 34, "n_words": 25, "vocab_size": 23 }
https://github.com/mwaskom/seaborn.git
4
getPrimeNumbers
def getPrimeNumbers(N): # precondition assert isinstance(N, int) and (N > 2), "'N' must been an int and > 2" ans = [] # iterates over all numbers between 2 up to N+1 # if a number is prime then appends to list 'ans' for number in range(2, N + 1): if isPrime(number): ...
f0af0c43340763724f139fa68aa1e5a9ffe458b4
11
primelib.py
102
refactor: clean code Signed-off-by: slowy07 <slowy.arfy@gmail.com>
4,442
0
115
60
54
22,751
68
Python
10
primelib/primelib.py
Python
8
{ "docstring": "\n input: positive integer 'N' > 2\n returns a list of prime numbers from 2 up to N (inclusive)\n This function is more efficient as function 'sieveEr(...)'\n ", "language": "en", "n_whitespaces": 39, "n_words": 26, "vocab_size": 24 }
https://github.com/geekcomputers/Python.git
1
onBootstrapBinary
def onBootstrapBinary(self, filename): # Virtual method, pylint: disable=no-self-use,unused-argument return None
68e62e62d6d1c92209dcc1c7b60c3b5e09bcf308
6
PluginBase.py
19
Plugins: Add support for upx compression of onefile tempdir Linux * This also avoids the padding done for Windows signing tool to be applied to other platforms, not needed there. * For UPX not preserving payload outside of Windows, we need to apply it before the payload gets attached on Linux with temp file mod...
42,707
0
31
10
10
178,479
10
Nuitka
3
nuitka/plugins/PluginBase.py
Python
2
{ "docstring": "Called after successfully creating a bootstrap binary, but without payload.\n\n Args:\n filename: the created bootstrap binary, will be modified later\n\n Returns:\n None\n ", "language": "en", "n_whitespaces": 65, "n_words": 22, "vocab_size": 20 }
https://github.com/Nuitka/Nuitka.git
1
FDistribution
def FDistribution(name, d1, d2): r return rv(name, FDistributionDistribution, (d1, d2)) #------------------------------------------------------------------------------- # Fisher Z distribution --------------------------------------------------------
9ad8ab9fe58051cf11626ba6654852fcfec60147
8
crv_types.py
36
Documentation cleanup 5
48,098
0
19
24
16
196,680
16
sympy
6
sympy/stats/crv_types.py
Python
58
{ "docstring": "\n Create a continuous random variable with a F distribution.\n\n Explanation\n ===========\n\n The density of the F distribution is given by\n\n .. math::\n f(x) := \\frac{\\sqrt{\\frac{(d_1 x)^{d_1} d_2^{d_2}}\n {(d_1 x + d_2)^{d_1 + d_2}}}}\n {x \...
https://github.com/sympy/sympy.git
13
read_lines_to_outerboundary
def read_lines_to_outerboundary(self): next_boundary = b"--" + self.outerboundary last_boundary = next_boundary + b"--" delim = b"" last_line_lfend = True _read = 0 while 1: if self.limit is not None and 0 <= self.limit <= _read: brea...
8198943edd73a363c266633e1aa5b2a9e9c9f526
14
cgi.py
393
add python 3.10.4 for windows
56,312
0
709
230
69
221,275
145
XX-Net
21
python3.10.4/Lib/cgi.py
Python
42
{ "docstring": "Internal: read lines until outerboundary.\n Data is read as bytes: boundaries and line ends must be converted\n to bytes for comparisons.\n ", "language": "en", "n_whitespaces": 42, "n_words": 21, "vocab_size": 20 }
https://github.com/XX-net/XX-Net.git
3
suggested_unit_of_measurement
def suggested_unit_of_measurement(self) -> str | None: if hasattr(self, "_attr_suggested_unit_of_measurement"): return self._attr_suggested_unit_of_measurement if hasattr(self, "entity_description"): return self.entity_description.suggested_unit_of_measurement re...
6979cd95b0fe85c3ee8eca3dbc9881b8d05591e8
9
__init__.py
65
Add suggested_unit_of_measurement attribute to sensors (#80638) * Add suggested_unit_of_measurement attribute to sensors * Lazy calculation of initial entity options * Add type alias for entity options * Small tweak * Add tests * Store suggested_unit_of_measurement in its own option key * Adapt to re...
88,882
0
68
38
14
289,746
18
core
6
homeassistant/components/sensor/__init__.py
Python
22
{ "docstring": "Return the unit which should be used for the sensor's state.\n\n This can be used by integrations to override automatic unit conversion rules,\n for example to make a temperature sensor display in °C even if the configured\n unit system prefers °F.\n\n For sensors without a...
https://github.com/home-assistant/core.git
2
manual_download_instructions
def manual_download_instructions(self): *processed, _ = self.config.name.split(".") return ( None if processed else )
eab78694e17f10c200bceb60c6f21a2f70eadf68
10
medical_dialog.py
55
Add configs with processed data to medical_dialog dataset (#4127) * Add configs with processed data in medical_dialog dataset * Update metadata JSON * Update dataset card * Rename dummy data dirs * Fix script
21,934
0
67
28
13
104,693
13
datasets
7
datasets/medical_dialog/medical_dialog.py
Python
25
{ "docstring": "\\\n \\n For English:\\nYou need to go to https://drive.google.com/drive/folders/1g29ssimdZ6JzTST6Y8g6h-ogUNReBtJD?usp=sharing,\\\n and manually download the dataset from Google Drive. Once it is completed,\n a file named Medical-Dialogue-Dataset-English-<timestamp-info>.zip will appear in y...
https://github.com/huggingface/datasets.git
5
set_bbox_to_anchor
def set_bbox_to_anchor(self, bbox, transform=None): if bbox is None or isinstance(bbox, BboxBase): self._bbox_to_anchor = bbox else: try: l = len(bbox) except TypeError as err: raise ValueError(f"Invalid bbox: {bbox}") from err...
075ff0952896f44d7d0b0b3318f0978ae53f84d7
15
offsetbox.py
153
Small style fixes.
23,014
0
183
95
38
108,010
48
matplotlib
16
lib/matplotlib/offsetbox.py
Python
13
{ "docstring": "\n Set the bbox that the box is anchored to.\n\n *bbox* can be a Bbox instance, a list of [left, bottom, width,\n height], or a list of [left, bottom] where the width and\n height will be assumed to be zero. The bbox will be\n transformed to display coordinate by the...
https://github.com/matplotlib/matplotlib.git
1
test_mark_checked_unexpected_exception
def test_mark_checked_unexpected_exception(self, mock_patch_already_checked, mock_delete_pod): k = KubernetesPodOperator( namespace="default", image="ubuntu:16.04", name="test", task_id="task", is_delete_operator_pod=False, ) s...
c3d883a971a8e4e65ccc774891928daaaa0f4442
10
test_kubernetes_pod.py
133
KubernetesPodOperator should patch "already checked" always (#22734) When not configured to delete pods, at end of task execution the current behavior is to patch the pod as "already checked", but only if pod not successful. We should also patch when successful so it isn't "reattached" to after a task clear.
9,243
0
146
77
22
47,750
24
airflow
21
tests/providers/cncf/kubernetes/operators/test_kubernetes_pod.py
Python
14
{ "docstring": "If we aren't deleting pods and have an exception, mark it so we don't reattach to it", "language": "en", "n_whitespaces": 16, "n_words": 17, "vocab_size": 15 }
https://github.com/apache/airflow.git
1
is_immutable_rev_checkout
def is_immutable_rev_checkout(self, url, dest): # type: (str, str) -> bool return False
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
6
versioncontrol.py
21
upd; format
12,563
0
33
12
12
61,420
12
transferlearning
4
.venv/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.py
Python
2
{ "docstring": "\n Return true if the commit hash checked out at dest matches\n the revision in url.\n\n Always return False, if the VCS does not support immutable commit\n hashes.\n\n This method does not check if there are local uncommitted changes\n in dest after checkout,...
https://github.com/jindongwang/transferlearning.git
1
unauthorized_update_message_text
def unauthorized_update_message_text(update_message_text): update_message_text["message"]["from"]["id"] = 1234 update_message_text["message"]["chat"]["id"] = 1234 return update_message_text @pytest.fixture
d7375f1a9c4a69858a65a56bd524f5a78ecab23c
@pytest.fixture
10
conftest.py
69
Refactor telegram_bot polling/webhooks platforms and add tests (#66433) Co-authored-by: Pär Berge <paer.berge@gmail.com>
94,390
1
22
32
9
295,372
11
core
4
tests/components/telegram_bot/conftest.py
Python
4
{ "docstring": "Fixture for mocking an incoming update of type message/text that is not in our `allowed_chat_ids`.", "language": "en", "n_whitespaces": 14, "n_words": 15, "vocab_size": 15 }
https://github.com/home-assistant/core.git
15
installed
def installed(name, updates=None): if isinstance(updates, str): updates = [updates] if not updates: updates = name ret = {"name": name, "changes": {}, "result": True, "comment": ""} wua = salt.utils.win_update.WindowsUpdateAgent() # Search for updates install_list = wua....
52c922760e8447f0c9efd23b12481ba1a7509dcd
17
win_wua.py
772
Remove 40 character limit to update Title
54,320
0
699
441
114
216,011
215
salt
37
salt/states/win_wua.py
Python
59
{ "docstring": "\n Ensure Microsoft Updates are installed. Updates will be downloaded if\n needed.\n\n Args:\n\n name (str):\n The identifier of a single update to install.\n\n updates (list):\n A list of identifiers for updates to be installed. Overrides\n ``na...
https://github.com/saltstack/salt.git
5
unquote_header_value
def unquote_header_value(value, is_filename=False): r if value and value[0] == value[-1] == '"': # this is not the real unquoting, but fixing this so that the # RFC is met will result in bugs with internet explorer and # probably some other browsers as well. IE for example is # ...
cd5a9683be69c86c8f3adcd13385a9bc5db198ec
14
utils.py
127
Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir.
4,230
0
226
66
87
22,160
127
pipenv
4
pipenv/patched/pip/_vendor/requests/utils.py
Python
13
{ "docstring": "Unquotes a header value. (Reversal of :func:`quote_header_value`).\n This does not use the real unquoting but what browsers are actually\n using for quoting.\n\n :param value: the header value to unquote.\n :rtype: str\n ", "language": "en", "n_whitespaces": 47, "n_words": 31, ...
https://github.com/pypa/pipenv.git
7
create_ray_logs_for_failed_test
def create_ray_logs_for_failed_test(rep): # We temporarily restrict to Linux until we have artifact dirs # for Windows and Mac if platform.system() != "Linux": return # Only archive failed tests after the "call" phase of the test if rep.when != "call" or not rep.failed: return...
fc1cd89020ca1362951a9af301547b4890fb93ae
12
conftest.py
249
[ci] Add short failing test summary for pytests (#24104) It is sometimes hard to find all failing tests in buildkite output logs - even filtering for "FAILED" is cumbersome as the output can be overloaded. This PR adds a small utility to add a short summary log in a separate output section at the end of the buildkite ...
31,492
0
192
131
69
138,636
103
ray
25
python/ray/tests/conftest.py
Python
17
{ "docstring": "Creates artifact zip of /tmp/ray/session_latest/logs for failed tests", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/ray-project/ray.git