complexity
int64
1
56
n_identifiers
int64
1
114
code
stringlengths
19
12.7k
path
stringlengths
8
134
n_ast_nodes
int64
12
2.35k
ast_errors
stringlengths
0
4.01k
repo
stringlengths
3
28
documentation
dict
n_words
int64
2
866
language
stringclasses
1 value
vocab_size
int64
2
323
commit_id
stringlengths
40
40
file_name
stringlengths
5
79
id
int64
243
338k
nloc
int64
1
228
token_counts
int64
5
1.4k
fun_name
stringlengths
1
77
url
stringlengths
31
60
commit_message
stringlengths
3
15.3k
n_whitespaces
int64
1
3.23k
n_ast_errors
int64
0
20
d_id
int64
74
121k
ast_levels
int64
4
29
1
2
def tickangle(self): return self["tickangle"]
packages/python/plotly/plotly/graph_objs/bar/marker/_colorbar.py
22
plotly.py
{ "docstring": "\n Sets the angle of the tick labels with respect to the\n horizontal. For example, a `tickangle` of -90 draws the tick\n labels vertically.\n\n The 'tickangle' property is a angle (in degrees) that may be\n specified as a number between -180 and 180. Numeric values ...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_colorbar.py
228,753
2
11
tickangle
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
60,426
7
1
11
def _reset_replica_iterator(self): replicas = list(self.in_flight_queries.keys()) random.shuffle(replicas) self.replica_iterator = itertools.cycle(replicas)
python/ray/serve/_private/router.py
59
ray
{ "docstring": "Reset the iterator used to load balance replicas.\n\n This call is expected to be called after the replica membership has\n been updated. It will shuffle the replicas randomly to avoid multiple\n handle sending requests in the same order.\n ", "language": "en", "n_white...
9
Python
8
545c51609f0f55b41cf99cec95a9c21bee6846de
router.py
126,370
4
34
_reset_replica_iterator
https://github.com/ray-project/ray.git
[Serve] ServeHandle detects ActorError and drop replicas from target group (#26685)
37
0
28,152
11
5
62
def test_workflow_job_template_copy(workflow_job_template, post, get, admin, organization): workflow_job_template.organization = organization label = Label.objects.create(name="foobar", organization=organization) workflow_job_template.labels.add(label) ee = ExecutionEnvironment.objects.create(nam...
awx/main/tests/functional/test_copy.py
837
@pytest.mark.django_db
awx
{ "docstring": "\n Tests the FIELDS_TO_PRESERVE_AT_COPY attribute on WFJTs\n ", "language": "en", "n_whitespaces": 13, "n_words": 6, "vocab_size": 6 }
169
Python
102
7de5f772626a00d31026270865276365287cbe37
test_copy.py
81,880
40
538
test_workflow_job_template_copy
https://github.com/ansible/awx.git
adding test coverage to ensure that FIELDS_TO_PRESERVE_AT_COPY is behaving as expected for WFJTs
328
1
17,273
18
1
10
def line_collection_2d_to_3d(col, zs=0, zdir='z'): segments3d = _paths_to_3d_segments(col.get_paths(), zs, zdir) col.__class__ = Line3DCollection col.set_segments(segments3d)
lib/mpl_toolkits/mplot3d/art3d.py
64
matplotlib
{ "docstring": "Convert a `.LineCollection` to a `.Line3DCollection` object.", "language": "en", "n_whitespaces": 6, "n_words": 7, "vocab_size": 6 }
13
Python
12
df6f95703b60348e01603f98a439b133da2938a0
art3d.py
109,916
4
39
line_collection_2d_to_3d
https://github.com/matplotlib/matplotlib.git
Improve mpl_toolkit documentation
25
0
23,823
10
48
98
def rsolve_hyper(coeffs, f, n, **hints): r coeffs = list(map(sympify, coeffs)) f = sympify(f) r, kernel, symbols = len(coeffs) - 1, [], set() if not f.is_zero: if f.is_Add: similar = {} for g in f.expand().args: if not g.is_hypergeometric(n): ...
sympy/solvers/recurr.py
1,617
sympy
{ "docstring": "\n Given linear recurrence operator `\\operatorname{L}` of order `k`\n with polynomial coefficients and inhomogeneous equation\n `\\operatorname{L} y = f` we seek for all hypergeometric solutions\n over field `K` of characteristic zero.\n\n The inhomogeneous part can be either hypergeom...
553
Python
259
4a7c0c31501685f9d8e6572fe735b592a1fa3c33
recurr.py
198,001
164
1,051
rsolve_hyper
https://github.com/sympy/sympy.git
rsolve_hyper: take into account degenerate solutions This fixes sympy/sympy#8697: In [2]: rsolve(a(n + 3) - a(n + 2) - a(n + 1) + a(n), a(n)) Out[2]: n (-1) ⋅C₁ + C₀ + C₂⋅n Added also test from issue thread, which is not related to the problem. And from PR request diofant/diofant#442. Test for ...
1,808
0
48,766
20
8
22
def parse_targets(self, source): self.dist_log("looking for '@targets' inside -> ", source) # get lines between /*@targets and */ with open(source) as fd: tokens = "" max_to_reach = 1000 # good enough, isn't? start_with = "@targets" start_...
numpy/distutils/ccompiler_opt.py
305
numpy
{ "docstring": "\n Fetch and parse configuration statements that required for\n defining the targeted CPU features, statements should be declared\n in the top of source in between **C** comment and start\n with a special mark **@targets**.\n\n Configuration statements are sort of ke...
122
Python
78
f404e9e92e87a3990712d723d5c562a89300ac01
ccompiler_opt.py
160,174
29
165
parse_targets
https://github.com/numpy/numpy.git
Add space after argument name
511
0
38,546
15
1
8
def data_system_ping_fixture(): return json.loads(load_fixture("system_ping_data.json", "guardian")) @pytest.fixture(name="data_valve_status", scope="session")
tests/components/guardian/conftest.py
58
@pytest.fixture(name="data_valve_status", scope="session")
core
{ "docstring": "Define data from a successful system_ping response.", "language": "en", "n_whitespaces": 6, "n_words": 7, "vocab_size": 7 }
7
Python
7
6bbe38578c74e5ecd8aadcd2cf39cddca8a59a52
conftest.py
310,457
2
17
data_system_ping_fixture
https://github.com/home-assistant/core.git
Add diagnostics to Elexa Guardian (#64599)
12
1
109,142
10
2
18
def _softmax(x, axis): if not dtypes.issubdtype(x.dtype, np.floating): raise TypeError(f"_softmax only accepts floating dtypes, got {x.dtype}") x_max = jnp.max(x, axis, keepdims=True) unnormalized = jnp.exp(x - lax.stop_gradient(x_max)) return unnormalized / unnormalized.sum(axis, keepdims=True)
jax/_src/random.py
118
jax
{ "docstring": "Utility to compute the softmax of x along a given axis.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
30
Python
27
69969ef8031e424b19dd020a396b3fbdc25b703e
random.py
119,870
6
71
_softmax
https://github.com/google/jax.git
add random.loggamma and improve dirichlet & beta implementation
38
0
26,701
12
3
22
def fit(self, X, y=None): if not self.degree >= 1: raise ValueError(f"degree={self.degree} should be >=1.") X = self._validate_data(X, accept_sparse="csc") random_state = check_random_state(self.random_state) n_features = X.shape[1] if self.coef0 != 0: ...
sklearn/kernel_approximation.py
202
scikit-learn
{ "docstring": "Fit the model with X.\n\n Initializes the internal variables. The method needs no information\n about the distribution of data, so we only care about n_features in X.\n\n Parameters\n ----------\n X : {array-like, sparse matrix} of shape (n_samples, n_features)\n ...
50
Python
42
d616e43947340e152e4a901931e954d699368fa9
kernel_approximation.py
259,122
14
126
fit
https://github.com/scikit-learn/scikit-learn.git
ENH Adds feature_names_out for most of kernel_approximation (#22694)
160
0
75,581
12
6
23
def _poll_with_exponential_delay(request, execute_num_retries, max_n, is_done_func, is_error_func): for i in range(0, max_n): try: response = request.execute(num_retries=execute_num_retries) if is_error_func(response): raise ValueError(f'The response contained an...
airflow/providers/google/cloud/hooks/mlengine.py
238
airflow
{ "docstring": "\n Execute request with exponential delay.\n\n This method is intended to handle and retry in case of api-specific errors,\n such as 429 \"Too Many Requests\", unlike the `request.execute` which handles\n lower level errors like `ConnectionError`/`socket.timeout`/`ssl.SSLError`.\n\n :pa...
75
Python
60
602abe8394fafe7de54df7e73af56de848cdf617
mlengine.py
44,110
17
144
_poll_with_exponential_delay
https://github.com/apache/airflow.git
Remove `:type` lines now sphinx-autoapi supports typehints (#20951) * Remove `:type` lines now sphinx-autoapi supports typehints Since we have no updated sphinx-autoapi to a more recent version it supports showing type hints in the documentation, so we don't need to have the type hints _and_ the `:type` lines -- ...
254
0
8,160
20
13
16
def get_change_message(self): if self.change_message and self.change_message[0] == "[": try: change_message = json.loads(self.change_message) except json.JSONDecodeError: return self.change_message messages = [] for sub_mes...
django/contrib/admin/models.py
520
django
{ "docstring": "\n If self.change_message is a JSON structure, interpret it as a change\n string, properly translated.\n ", "language": "en", "n_whitespaces": 36, "n_words": 14, "vocab_size": 13 }
119
Python
64
9c19aff7c7561e3a82978a272ecdaad40dda5c00
models.py
203,402
56
289
get_change_message
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
1,263
0
50,352
22
21
64
def call_ef(self, other_args): parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="ef", description=, ) parser.add_argument( "-p", "--period", ...
openbb_terminal/portfolio/portfolio_optimization/po_controller.py
1,304
OpenBBTerminal
{ "docstring": "Process ef commandThis function plots random portfolios based on their\n risk and returns and shows the efficient frontier.Period to get yfinance data from.\n Possible frequency strings are:\n 'd': means days, for example '252d' means 252 days\n ...
327
Python
194
34bc290dded1bd2418fc3c6b375a79f9cdd68d5a
po_controller.py
284,355
223
800
call_ef
https://github.com/OpenBB-finance/OpenBBTerminal.git
New portfolio optimization menu (#1642) * New-Portfolio-Optimization-Menu * New-Portfolio-Optimization-Menu * New-Portfolio-Optimization-Menu * Update _index.md * New-Portfolio-Optimization-Menu * New-Portfolio-Optimization-Menu * configure portfolio optimization parameters ini * minor improvement...
2,276
0
84,706
13
1
4
def get(cls): min_partition_size = super().get() assert min_partition_size > 0, "`min_partition_size` should be > 0" return min_partition_size
modin/config/envvars.py
42
modin
{ "docstring": "\n Get ``MinPartitionSize`` with extra checks.\n\n Returns\n -------\n int\n ", "language": "en", "n_whitespaces": 44, "n_words": 8, "vocab_size": 8 }
16
Python
13
0bdc482d6f1682e103b4c4d7ee7c4d505d2d3b1c
envvars.py
152,965
4
23
get
https://github.com/modin-project/modin.git
REFACTOR-#3768: change 'compute_chunksize' signature (#3769) Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru> Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
44
0
35,209
10
1
3
def _get_loss(self): return HalfSquaredError() # TODO(1.3): remove
sklearn/linear_model/_glm/glm.py
21
scikit-learn
{ "docstring": "This is only necessary because of the link and power arguments of the\n TweedieRegressor.\n\n Note that we do not need to pass sample_weight to the loss class as this is\n only needed to set loss.constant_hessian on which GLMs do not rely.\n ", "language": "en", "n_whit...
7
Python
7
75a94f518f7bd7d0bf581ffb67d9f961e3c4efbc
glm.py
259,436
2
10
_get_loss
https://github.com/scikit-learn/scikit-learn.git
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>
24
0
75,770
7
9
24
def update_last_purchase_rate(doc, is_submit): import frappe.utils this_purchase_date = frappe.utils.getdate(doc.get("posting_date") or doc.get("transaction_date")) for d in doc.get("items"): # get last purchase details last_purchase_details = get_last_purchase_details(d.item_code, doc.name) # compare las...
erpnext/buying/utils.py
263
erpnext
{ "docstring": "updates last_purchase_rate in item table for each item", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 7 }
121
Python
80
494bd9ef78313436f0424b918f200dab8fc7c20b
utils.py
65,607
16
153
update_last_purchase_rate
https://github.com/frappe/erpnext.git
style: format code with black
98
0
13,953
20
6
14
def clean_subpage_models(cls): if cls._clean_subpage_models is None: subpage_types = getattr(cls, "subpage_types", None) if subpage_types is None: # if subpage_types is not specified on the Page class, allow all page types as subpages cls._clean_s...
wagtail/core/models/__init__.py
137
wagtail
{ "docstring": "\n Returns the list of subpage types, normalised as model classes.\n Throws ValueError if any entry in subpage_types cannot be recognised as a model name,\n or LookupError if a model does not exist (or is not a Page subclass).\n ", "language": "en", "n_whitespaces": 67,...
64
Python
44
d10f15e55806c6944827d801cd9c2d53f5da4186
__init__.py
73,792
14
84
clean_subpage_models
https://github.com/wagtail/wagtail.git
Reformat with black
273
0
16,113
18
1
8
def test_pandas_contiguous_dtypes(): pd = pytest.importorskip("pandas") df1 = pd.DataFrame([[1, 2.2], [3, 4.4]]) df2 = pd.DataFrame([[1.1, 2.2], [3.3, 4.4]]) assert sizeof(df2) < sizeof(df1)
dask/tests/test_sizeof.py
99
dask
{ "docstring": "2+ contiguous columns of the same dtype in the same DataFrame share the same\n surface thus have lower overhead\n ", "language": "en", "n_whitespaces": 25, "n_words": 19, "vocab_size": 15 }
21
Python
17
80dd84d46ef6b7befa1b416c4597c83ef81ef972
test_sizeof.py
157,273
5
75
test_pandas_contiguous_dtypes
https://github.com/dask/dask.git
Deflate sizeof() of duplicate references to pandas object types (#9776)
36
0
36,896
10
1
2
def namelengthsrc(self): return self["namelengthsrc"]
packages/python/plotly/plotly/graph_objs/bar/_hoverlabel.py
22
plotly.py
{ "docstring": "\n Sets the source reference on Chart Studio Cloud for\n `namelength`.\n\n The 'namelengthsrc' property must be specified as a string or\n as a plotly.grid_objs.Column object\n\n Returns\n -------\n str\n ", "language": "en", "n_whitespaces":...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_hoverlabel.py
228,667
2
11
namelengthsrc
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
60,340
7
1
9
def list(self, directory='""', pattern='*'): name = 'LIST' typ, dat = self._simple_command(name, directory, pattern) return self._untagged_response(typ, dat, name)
python3.10.4/Lib/imaplib.py
69
XX-Net
{ "docstring": "List mailbox names in directory matching pattern.\n\n (typ, [data]) = <instance>.list(directory='\"\"', pattern='*')\n\n 'data' is list of LIST responses.\n ", "language": "en", "n_whitespaces": 39, "n_words": 18, "vocab_size": 18 }
17
Python
16
8198943edd73a363c266633e1aa5b2a9e9c9f526
imaplib.py
217,896
4
42
list
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
45
0
54,999
8
2
9
def deploy(self) -> Pipeline: [node.deploy() for node in self._incoming_edges] self._executor = create_executor_from_step_config( self._serialized_callable_factory, self._config ) return Pipeline(self)
python/ray/serve/pipeline/node.py
65
ray
{ "docstring": "Instantiates executors for this and all dependent nodes.\n\n After the pipeline is deployed, .call() and .call_async() can be used.\n ", "language": "en", "n_whitespaces": 33, "n_words": 19, "vocab_size": 18 }
17
Python
17
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
node.py
130,920
10
40
deploy
https://github.com/ray-project/ray.git
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
63
0
29,427
9
1
15
async def test_only_migrate_once(hass, utcnow): entity_registry = er.async_get(hass) aid = get_next_aid() old_light_entry = entity_registry.async_get_or_create( "light", "homekit_controller", f"homekit-00:00:00:00:00:00-{aid}-8", ) new_light_entry = entity_registry.async...
tests/components/homekit_controller/test_light.py
163
core
{ "docstring": "Test a we handle migration happening after an upgrade and than a downgrade and then an upgrade.", "language": "en", "n_whitespaces": 16, "n_words": 17, "vocab_size": 14 }
39
Python
27
f23b1750e85f07091eb896a0b12b8f95e5646338
test_light.py
288,895
22
88
test_only_migrate_once
https://github.com/home-assistant/core.git
Migrate HomeKit Controller to use stable identifiers (#80064)
145
0
88,044
11
1
8
def expectation(self, expr, condition=None, evaluate=True, **kwargs): return _SubstituteRV._expectation(expr, condition, evaluate, **kwargs)
sympy/stats/stochastic_process_types.py
48
sympy
{ "docstring": "\n Computes expectation.\n\n Parameters\n ==========\n\n expr : RandomIndexedSymbol, Relational, Logic\n Condition for which expectation has to be computed. Must\n contain a RandomIndexedSymbol of the process.\n condition : Relational, Logic\n ...
11
Python
11
7fe8e027ae1d7f683243c0229b961671a6cbb4c5
stochastic_process_types.py
197,542
2
33
expectation
https://github.com/sympy/sympy.git
Improved some documentation in the stats module
25
0
48,620
8
2
11
def slice_inputs(self, indices_dataset, inputs): dataset = tf.data.Dataset.zip( (indices_dataset, tf.data.Dataset.from_tensors(inputs).repeat()) )
keras/engine/data_adapter.py
62
keras
{ "docstring": "Slice inputs into a Dataset of batches.\n\n Given a Dataset of batch indices and the unsliced inputs,\n this step slices the inputs in a parallelized fashion\n and produces a dataset of input batches.\n\n Args:\n indices_dataset: A Dataset of batched indices\n ...
10
Python
10
84afc5193d38057e2e2badf9c889ea87d80d8fbf
data_adapter.py
271,113
14
103
slice_inputs
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
42
0
80,693
15
1
2
def operation(self): return self["operation"]
packages/python/plotly/plotly/graph_objs/contour/_contours.py
22
plotly.py
{ "docstring": "\n Sets the constraint operation. \"=\" keeps regions equal to\n `value` \"<\" and \"<=\" keep regions less than `value` \">\" and\n \">=\" keep regions greater than `value` \"[]\", \"()\", \"[)\", and\n \"(]\" keep regions inside `value[0]` to `value[1]` \"][\", \")(\",\n ...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_contours.py
229,518
2
11
operation
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
61,191
7
1
2
def test_generic_inline_model_admin_bad_fk_field(self):
tests/admin_checks/tests.py
13
django
{ "docstring": "\n A GenericInlineModelAdmin errors if the ct_fk_field points to a\n nonexistent field.\n ", "language": "en", "n_whitespaces": 33, "n_words": 11, "vocab_size": 11 }
2
Python
2
9c19aff7c7561e3a82978a272ecdaad40dda5c00
tests.py
207,036
15
72
test_generic_inline_model_admin_bad_fk_field
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
9
0
51,842
6
12
19
def evaluate(self, expr, context): if isinstance(expr, string_types): if expr[0] in '\'"': result = expr[1:-1] else: if expr not in context: raise SyntaxError('unknown variable: %s' % expr) result = context[expr...
pipenv/patched/notpip/_vendor/distlib/markers.py
395
pipenv
{ "docstring": "\n Evaluate a marker expression returned by the :func:`parse_requirement`\n function in the specified context.\n ", "language": "en", "n_whitespaces": 35, "n_words": 13, "vocab_size": 12 }
123
Python
73
f3166e673fe8d40277b804d35d77dcdb760fc3b3
markers.py
20,032
28
233
evaluate
https://github.com/pypa/pipenv.git
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...
463
0
3,185
16
9
18
def _is_function_class_equation(func_class, f, symbol): if f.is_Mul or f.is_Add: return all(_is_function_class_equation(func_class, arg, symbol) for arg in f.args) if f.is_Pow: if not f.exp.has(symbol): return _is_function_class_equation(func_class, f.base, s...
sympy/solvers/solveset.py
185
sympy
{ "docstring": " Tests whether the equation is an equation of the given function class.\n\n The given equation belongs to the given function class if it is\n comprised of functions of the function class which are multiplied by\n or added to expressions independent of the symbol. In addition, the\n argumen...
52
Python
35
e0dc14eca132f37c5f49369eb4051eae37c9b119
solveset.py
197,067
19
119
_is_function_class_equation
https://github.com/sympy/sympy.git
Refactored import ordering in functions
192
0
48,321
14
6
21
def update_connected_interfaces(instance, created, raw=False, **kwargs): logger = logging.getLogger('netbox.wireless.wirelesslink') if raw: logger.debug(f"Skipping endpoint updates for imported wireless link {instance}") return if instance.interface_a.wireless_link != instance: ...
netbox/wireless/signals.py
244
@receiver(post_delete, sender=WirelessLink)
netbox
{ "docstring": "\n When a WirelessLink is saved, save a reference to it on each connected interface.\n ", "language": "en", "n_whitespaces": 21, "n_words": 14, "vocab_size": 13 }
69
Python
46
951627093c11584ffb73ad2be2aef40a91a90934
signals.py
264,921
18
134
update_connected_interfaces
https://github.com/netbox-community/netbox.git
Test cleanup
177
1
77,914
12
19
39
def get_payload(self, i=None, decode=False): # Here is the logic table for this code, based on the email5.0.0 code: # i decode is_multipart result # ------ ------ ------------ ------------------------------ # None True True None # i True ...
python3.10.4/Lib/email/message.py
534
XX-Net
{ "docstring": "Return a reference to the payload.\n\n The payload will either be a list object or a string. If you mutate\n the list object, you modify the message's payload in place. Optional\n i returns that index into the payload.\n\n Optional decode is a flag indicating whether the ...
350
Python
187
8198943edd73a363c266633e1aa5b2a9e9c9f526
message.py
223,818
45
301
get_payload
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
1,271
0
57,083
19
1
2
def notched(self): return self["notched"]
packages/python/plotly/plotly/graph_objs/_box.py
22
plotly.py
{ "docstring": "\n Determines whether or not notches are drawn. Notches displays a\n confidence interval around the median. We compute the\n confidence interval as median +/- 1.57 * IQR / sqrt(N), where\n IQR is the interquartile range and N is the sample size. If two\n boxes' notch...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_box.py
226,302
2
11
notched
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
57,975
7
8
34
def solve_biquadratic(f, g, opt): G = groebner([f, g]) if len(G) == 1 and G[0].is_ground: return None if len(G) != 2: raise SolveFailed x, y = opt.gens p, q = G if not p.gcd(q).is_ground: # not 0-dimensional raise SolveFailed p = Poly(p, x, expand=Fal...
sympy/solvers/polysys.py
266
sympy
{ "docstring": "Solve a system of two bivariate quadratic polynomial equations.\n\n Parameters\n ==========\n\n f: a single Expr or Poly\n First equation\n g: a single Expr or Poly\n Second Equation\n opt: an Options object\n For specifying keyword arguments and generators\n\n R...
77
Python
55
59d22b6bb7287613d598611027f640d068ca5748
polysys.py
196,425
20
170
solve_biquadratic
https://github.com/sympy/sympy.git
Moved imports to higher level
176
0
47,925
13
14
35
def _get_metric_object(self, metric, y_t, y_p): if metric is None: return None # Ok to have no metric for an output. # Convenience feature for selecting b/t binary, categorical, # and sparse categorical. if str(metric).lower() not in ["accuracy", "acc", "crossentro...
keras/engine/compile_utils.py
428
keras
{ "docstring": "Converts user-supplied metric to a `Metric` object.\n\n Args:\n metric: A string, function, or `Metric` object.\n y_t: Sample of label.\n y_p: Sample of output.\n\n Returns:\n A `Metric` object.\n ", "language": "en", "n_whitespaces": 84, ...
157
Python
89
84afc5193d38057e2e2badf9c889ea87d80d8fbf
compile_utils.py
271,042
45
256
_get_metric_object
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
764
0
80,679
16
1
19
def test_visibility_when_disabled(self) -> None: room_id = self.helper.create_room_as(self.user_id, tok=self.token) self.helper.send_state( room_id=room_id, event_type=EventTypes.Retention, body={"max_lifetime": one_day_ms}, tok=self.token, ...
tests/rest/client/test_retention.py
160
synapse
{ "docstring": "Retention policies should be ignored when the retention feature is disabled.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
27
Python
25
4cc4229cd7a55d2556c798fecbb1c9660dc821c8
test_retention.py
248,358
12
102
test_visibility_when_disabled
https://github.com/matrix-org/synapse.git
Prevent expired events from being filtered out when retention is disabled (#12611) Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
120
0
72,235
11
11
12
def __eq__(self, other): if self is other: return True if not isinstance(other, Basic): return self._do_eq_sympify(other) # check for pure number expr if not (self.is_Number and other.is_Number) and ( type(self) != type(other)): ...
sympy/core/basic.py
193
sympy
{ "docstring": "Return a boolean indicating whether a == b on the basis of\n their symbolic trees.\n\n This is the same as a.compare(b) == 0 but faster.\n\n Notes\n =====\n\n If a class that overrides __eq__() needs to retain the\n implementation of __hash__() from a parent c...
71
Python
45
f5ef4e62e5cb5637f2bf2af0ee73e43c58c33c25
basic.py
195,887
17
120
__eq__
https://github.com/sympy/sympy.git
core/basic: Basic.__eq__ only performs user defined conversions core/evalf: no longer create unneeded Tuples with None arguments Fixes #22581 only use _sympify in __eq__ when needed defined _converter and updated Boolean comparisons removed try-except for sympify because it should always be possible at that point ...
253
0
47,468
11
1
4
def check_for_updates(): version_message = get_update_status() print(version_message)
spotdl/utils/console.py
28
spotify-downloader
{ "docstring": "\n Check for updates to the current version.\n ", "language": "en", "n_whitespaces": 14, "n_words": 7, "vocab_size": 7 }
6
Python
6
deca40c2e26afed62e1f9ec4be14aff9e125929b
console.py
30,421
3
14
check_for_updates
https://github.com/spotDL/spotify-downloader.git
moved console actions to a new file
15
0
5,565
8
1
4
def is_packaged_application() -> bool: return cfg.LOGGING_APP_NAME == "gst_packaged"
openbb_terminal/terminal_helper.py
26
OpenBBTerminal
{ "docstring": "Tell whether or not it is a packaged version (Windows or Mac installer).\n\n\n Returns:\n bool: If the application is packaged\n ", "language": "en", "n_whitespaces": 33, "n_words": 20, "vocab_size": 17 }
8
Python
8
eb244a1d8d01e1ad93c5dc349656aa4170397f90
terminal_helper.py
286,154
8
13
is_packaged_application
https://github.com/OpenBB-finance/OpenBBTerminal.git
Docker : building + publishing (#2904) * fixed integrated test test_stocks_ba.openbb * fixed integrated test test_stocks_dd.openbb * improved and centralised the check * fix lint * Docker : update ci + build files * Docker : update build and CD * Docker : update CD * Docker : test * Docker : te...
14
0
85,600
7
4
25
def _optimize_stages(self): context = DatasetContext.get_current() if not context.optimize_fuse_stages: self._optimized_stages = self._stages return # This dummy dataset will be used to get a set of optimized stages. dummy_ds = Dataset( Exec...
python/ray/data/dataset_pipeline.py
217
ray
{ "docstring": "Optimize this pipeline, fusing stages together as possible.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
105
Python
67
45ba0e3cacbf4f38b9724437798c75341c2ddc7c
dataset_pipeline.py
124,671
25
138
_optimize_stages
https://github.com/ray-project/ray.git
Object GC for block splitting inside the dataset splitting (#26196) The pipeline will spill objects when splitting the dataset into multiple equal parts. Co-authored-by: Ubuntu <ubuntu@ip-172-31-32-136.us-west-2.compute.internal>
415
0
27,652
15
2
13
def vertices_loss(criterion_vertices, pred_vertices, gt_vertices, has_smpl): pred_vertices_with_shape = pred_vertices[has_smpl == 1] gt_vertices_with_shape = gt_vertices[has_smpl == 1] if len(gt_vertices_with_shape) > 0: return criterion_vertices(pred_vertices_with_shape, ...
ppdet/modeling/losses/pose3d_loss.py
99
@register @serializable
PaddleDetection
{ "docstring": "\n Compute per-vertex loss if vertex annotations are available.\n ", "language": "en", "n_whitespaces": 15, "n_words": 8, "vocab_size": 8 }
27
Python
23
d4e34fe165c09db65fd00113708be1b711ac957c
pose3d_loss.py
211,434
8
61
vertices_loss
https://github.com/PaddlePaddle/PaddleDetection.git
pose3d metro modeling (#6612) * pose3d metro modeling * delete extra comments
87
1
53,098
13
3
6
def step(self): if self._implements_method("_train") and log_once("_train"): raise DeprecationWarning( "Trainable._train is deprecated and is now removed. Override " "Trainable.step instead." ) raise NotImplementedError
python/ray/tune/trainable.py
55
ray
{ "docstring": "Subclasses should override this to implement train().\n\n The return value will be automatically passed to the loggers. Users\n can also return `tune.result.DONE` or `tune.result.SHOULD_CHECKPOINT`\n as a key to manually trigger termination or checkpointing of this\n trial....
22
Python
19
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
trainable.py
132,815
7
27
step
https://github.com/ray-project/ray.git
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
95
0
29,807
11
1
7
def print_help(self): help_text = console.print(text=help_text, menu="Cryptocurrency - Discovery")
gamestonk_terminal/cryptocurrency/discovery/discovery_controller.py
40
OpenBBTerminal
{ "docstring": "Print help[cmds]\n[src][CoinGecko][/src]\n cgtrending trending coins\n cgvoted most voted coins\n cgvisited most visited coins\n cgvolume coins with highest volume\n cgrecently recently added\n cgsentiment coins with most positive sentim...
8
Python
8
82747072c511beb1b2672846ae2ee4aec53eb562
discovery_controller.py
281,450
21
21
print_help
https://github.com/OpenBB-finance/OpenBBTerminal.git
Terminal Wide Rich (#1161) * My idea for how we handle Rich moving forward * remove independent consoles * FIxed pylint issues * add a few vars * Switched print to console * More transitions * Changed more prints * Replaced all prints * Fixing tabulate * Finished replace tabulate * Finish...
30
0
83,767
9
9
5
def _rpc_stats(self) -> Dict[str, Any]:
freqtrade/rpc/rpc.py
22
freqtrade
{ "docstring": "\n Generate generic stats for trades in database\n ", "language": "en", "n_whitespaces": 22, "n_words": 7, "vocab_size": 7 }
5
Python
5
be84a028c18bdbfd58dea8a51b6d59b77b672a8c
rpc.py
148,776
21
272
_rpc_stats
https://github.com/freqtrade/freqtrade.git
Avoid mixed types in the api for /stats
12
0
34,332
6
4
31
def preprocess_samples(self): r # sort items based on the sequence length in ascending order text_ignore_idx, text_keep_idx = self.sort_and_filter_by_length(self.text_lengths, self.min_text_len, self.max_text_len) audio_ignore_idx, audio_keep_idx = self.sort_and_filter_by_length(self.au...
TTS/tts/datasets/dataset.py
434
TTS
{ "docstring": "Sort `items` based on text length or audio length in ascending order. Filter out samples out or the length\n range.\n ", "language": "en", "n_whitespaces": 34, "n_words": 20, "vocab_size": 16 }
160
Python
95
176b712c1a40cf630da9a77f1826836723c40fde
dataset.py
262,050
26
250
preprocess_samples
https://github.com/coqui-ai/TTS.git
Refactor TTSDataset ⚡️
403
0
77,109
14
1
2
def selectedpoints(self): return self["selectedpoints"]
packages/python/plotly/plotly/graph_objs/_bar.py
22
plotly.py
{ "docstring": "\n Array containing integer indices of selected points. Has an\n effect only for traces that support selections. Note that an\n empty array means an empty selection where the `unselected` are\n turned on for all points, whereas, any other non-array values\n means no ...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_bar.py
226,180
2
11
selectedpoints
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
57,853
7
5
24
def make_release_tree(self, base_dir, files): # Create all the directories under 'base_dir' necessary to # put 'files' there; the 'mkpath()' is just so we don't die # if the manifest happens to be empty. self.mkpath(base_dir) dir_util.create_tree(base_dir, files, dry_run...
python3.10.4/Lib/distutils/command/sdist.py
235
XX-Net
{ "docstring": "Create the directory tree that will become the source\n distribution archive. All directories implied by the filenames in\n 'files' are created under 'base_dir', and then we hard link or copy\n (if hard linking is unavailable) those files into place.\n Essentially, this du...
175
Python
117
8198943edd73a363c266633e1aa5b2a9e9c9f526
sdist.py
222,813
20
134
make_release_tree
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
468
0
56,754
14
1
2
def run_after_hook(self): return None
wagtail/admin/views/generic/mixins.py
16
wagtail
{ "docstring": "\n Define how to run the hooks after the operation is executed.\n The `self.run_hook(hook_name, *args, **kwargs)` from HookResponseMixin\n can be utilised to call the hooks.\n\n If this method returns a response, it will be returned as the view\n response immediately...
4
Python
4
bc1a2ab1148b0f27cfd1435f8cb0e44c2721102d
mixins.py
77,224
2
8
run_after_hook
https://github.com/wagtail/wagtail.git
Extract mixins from Snippet views and use it in generic create/edit/delete views (#8361)
18
0
16,643
6
5
17
def __setitem__(self, name, val): max_count = self.policy.header_max_count(name) if max_count: lname = name.lower() found = 0 for k, v in self._headers: if k.lower() == lname: found += 1 if found >= max_...
python3.10.4/Lib/email/message.py
146
XX-Net
{ "docstring": "Set the value of a header.\n\n Note: this does not overwrite an existing header with the same field\n name. Use __delitem__() first to delete any existing headers.\n ", "language": "en", "n_whitespaces": 49, "n_words": 27, "vocab_size": 25 }
47
Python
39
8198943edd73a363c266633e1aa5b2a9e9c9f526
message.py
223,837
12
89
__setitem__
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
224
0
57,096
19
7
14
def __call__(self, *i): # list indices can be Integer or int; leave this # as it is (don't test or convert it) because this # gets called a lot and should be fast if len(i) == 1: i = i[0] if not isinstance(i, Iterable): i = as_int(i) ...
sympy/combinatorics/permutations.py
204
sympy
{ "docstring": "\n Allows applying a permutation instance as a bijective function.\n\n Examples\n ========\n\n >>> from sympy.combinatorics import Permutation\n >>> p = Permutation([[2, 0], [3, 1]])\n >>> p.array_form\n [2, 3, 0, 1]\n >>> [p(i) for i in range(4)...
100
Python
73
498015021131af4dbb07eb110e5badaba8250c7b
permutations.py
196,174
15
126
__call__
https://github.com/sympy/sympy.git
Updated import locations
348
0
47,674
17
12
56
def transform(self, X): check_is_fitted(self) X = self._validate_input(X, in_fit=False) statistics = self.statistics_ if X.shape[1] != statistics.shape[0]: raise ValueError( "X has %d features per sample, expected %d" % (X.shape[1], ...
sklearn/impute/_base.py
642
scikit-learn
{ "docstring": "Impute all missing values in `X`.\n\n Parameters\n ----------\n X : {array-like, sparse matrix}, shape (n_samples, n_features)\n The input data to complete.\n\n Returns\n -------\n X_imputed : {ndarray, sparse matrix} of shape \\\n (n...
249
Python
160
d8fa96c29828e3ca79ddd5d7466521ac4d95213c
_base.py
261,576
56
388
transform
https://github.com/scikit-learn/scikit-learn.git
ENH keep features with all missing values during imputation (#24770) Co-authored-by: Chiara Marmo <cmarmo@users.noreply.github.com> Co-authored-by: Julien Jerphanion <git@jjerphan.xyz> Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> Co-authored-by: Vitor SRG <vitorssrg@gmail....
1,085
0
76,872
20
2
4
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
python3.10.4/Lib/asyncio/events.py
43
XX-Net
{ "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 }
26
Python
23
8198943edd73a363c266633e1aa5b2a9e9c9f526
events.py
220,442
5
22
get_running_loop
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
48
0
55,997
10
13
44
def _predict_faces(self) -> None: faces_seen = 0 consecutive_no_faces = 0 batch: List[ConvertItem] = [] is_amd = get_backend() == "amd" while True: item: Union[Literal["EOF"], ConvertItem] = self._in_queue.get() if item == "EOF": l...
scripts/convert.py
509
faceswap
{ "docstring": " Run Prediction on the Faceswap model in a background thread.\n\n Reads from the :attr:`self._in_queue`, prepares images for prediction\n then puts the predictions back to the :attr:`self.out_queue`\n ", "language": "en", "n_whitespaces": 48, "n_words": 26, "vocab_size": 2...
221
Python
138
1022651eb8a7741014f5d2ec7cbfe882120dfa5f
convert.py
101,368
51
300
_predict_faces
https://github.com/deepfakes/faceswap.git
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
919
0
20,783
16
3
20
def prepare(self, timestamp, duration, organization): reports = {} for project in organization.project_set.all(): reports[project.id] = self.__encode(self.build(timestamp, duration, project)) if not reports: # XXX: HMSET requires at least one key/value pair, so ...
src/sentry/tasks/reports.py
152
sentry
{ "docstring": "\n For every project belonging to the organization, serially build a report and zlib compress it\n After this completes, store it in Redis with an expiration\n ", "language": "en", "n_whitespaces": 47, "n_words": 25, "vocab_size": 24 }
64
Python
58
9731253cf103cfdced62c36753a0e957ab29d705
reports.py
85,595
10
95
prepare
https://github.com/getsentry/sentry.git
feat: Add instrumentation to Celery tasks for weekly reports (#38561) It seems that if we don't include the parent celery task, it will not trace any of the children tasks. This enables further investigation as to why the building of the report is slow. Fixes WOR-2159.
187
0
18,014
12
1
16
def test_file_not_found_error(self): response = self.get_success_response( self.organization.slug, self.project.slug, qs_params={"file": self.filepath} ) assert response.data["config"] == self.expected_configurations(self.code_mapping1) assert not response.data["sour...
tests/sentry/api/endpoints/test_project_stacktrace_link.py
171
sentry
{ "docstring": "File matches code mapping but it cannot be found in the source repository.", "language": "en", "n_whitespaces": 12, "n_words": 13, "vocab_size": 13 }
55
Python
35
2e0d2c856eb17a842c67d88363bed92c99578c20
test_project_stacktrace_link.py
88,596
12
95
test_file_not_found_error
https://github.com/getsentry/sentry.git
ref(stacktrace_link): Add more than one code mapping in the tests (#41409) Include more than one code mapping in the setup code. Cleaning up a bit how we tag the transactions. This makes the PR for WOR-2395 a little easier to read.
165
0
18,415
12
3
4
def has_pretrained_cfg_key(model_name, cfg_key): if model_name in _model_pretrained_cfgs and cfg_key in _model_pretrained_cfgs[model_name]: return True return False
timm/models/registry.py
39
pytorch-image-models
{ "docstring": " Query model default_cfgs for existence of a specific key.\n ", "language": "en", "n_whitespaces": 13, "n_words": 9, "vocab_size": 9 }
15
Python
13
abc9ba254430ef971ea3dbd12f2b4f1969da55be
registry.py
331,645
4
24
has_pretrained_cfg_key
https://github.com/huggingface/pytorch-image-models.git
Transitioning default_cfg -> pretrained_cfg. Improving handling of pretrained_cfg source (HF-Hub, files, timm config, etc). Checkpoint handling tweaks.
31
0
119,879
8
1
57
def is_ccl_available(): return _is_ccl_available # docstyle-ignore DATASETS_IMPORT_ERROR = # docstyle-ignore TOKENIZERS_IMPORT_ERROR = # docstyle-ignore SENTENCEPIECE_IMPORT_ERROR = # docstyle-ignore PROTOBUF_IMPORT_ERROR = # docstyle-ignore FAISS_IMPORT_ERROR = # docstyle-ignore PYTORCH_IMPORT_ERR...
src/transformers/utils/import_utils.py
611
transformers
{ "docstring": "\n{0} requires the 🤗 Datasets library but it was not found in your environment. You can install it with:\n```\npip install datasets\n```\nIn a notebook or a colab, you can install it by executing a cell with\n```\n!pip install datasets\n```\nthen restarting your kernel.\n\nNote that if you have a loc...
200
Python
118
2b81f72be9fa6d69734ae27cfcbfd72b04988fe4
import_utils.py
32,535
2
6
is_ccl_available
https://github.com/huggingface/transformers.git
start from 1.12, torch_ccl is renamed as oneccl_bindings_for_pytorch … (#18229) * start from 1.12, torch_ccl is renamed as oneccl_bindings_for_pytorch and should import it before use Signed-off-by: Wang, Yi A <yi.a.wang@intel.com> * add doc for perf_train_cpu_many Signed-off-by: Wang, Yi A <yi.a.wang@intel.co...
360
0
5,947
9
2
25
def test_json_get_subscribers(self) -> None: stream_name = gather_subscriptions(self.user_profile)[0][0]["name"] stream_id = get_stream(stream_name, self.user_profile.realm).id expected_subscribers = gather_subscriptions(self.user_profile, include_subscribers=True)[0][ 0 ...
zerver/tests/test_subs.py
231
zulip
{ "docstring": "\n json_get_subscribers in zerver/views/streams.py\n also returns the list of subscribers for a stream, when requested.\n ", "language": "en", "n_whitespaces": 36, "n_words": 14, "vocab_size": 14 }
40
Python
35
a142fbff85302c5e3acb2e204eca2e9c75dbc74b
test_subs.py
84,134
19
141
test_json_get_subscribers
https://github.com/zulip/zulip.git
tests: Refactor away result.json() calls with helpers. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
157
0
17,779
12
9
10
def _fix_compile_args(self, output_dir, macros, include_dirs): if output_dir is None: output_dir = self.output_dir elif not isinstance(output_dir, str): raise TypeError("'output_dir' must be a string or None") if macros is None: macros = self.macros ...
python3.10.4/Lib/distutils/ccompiler.py
199
XX-Net
{ "docstring": "Typecheck and fix-up some of the arguments to the 'compile()'\n method, and return fixed-up values. Specifically: if 'output_dir'\n is None, replaces it with 'self.output_dir'; ensures that 'macros'\n is a list, and augments it with 'self.macros'; ensures that\n 'include_d...
86
Python
48
8198943edd73a363c266633e1aa5b2a9e9c9f526
ccompiler.py
222,586
19
123
_fix_compile_args
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
261
0
56,654
13
4
16
def get_template_names(self): try: names = super().get_template_names() except ImproperlyConfigured: # If template_name isn't specified, it's not a problem -- # we just start with an empty list. names = [] # If the list is a queryset, we'...
django/views/generic/list.py
155
django
{ "docstring": "\n Return a list of template names to be used for the request. Must return\n a list. May not be called if render_to_response is overridden.\n ", "language": "en", "n_whitespaces": 46, "n_words": 24, "vocab_size": 22 }
113
Python
85
9c19aff7c7561e3a82978a272ecdaad40dda5c00
list.py
206,882
20
86
get_template_names
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
391
0
51,781
15
1
3
def _SpinboxSelectHandler(self): self._generic_callback_handler('')
PySimpleGUI.py
25
PySimpleGUI
{ "docstring": "\n Internal callback function for when an entry is selected in a Combobox.\n\n ", "language": "en", "n_whitespaces": 27, "n_words": 12, "vocab_size": 12 }
3
Python
3
40757180b5d0ac66d44958e4ab13329c7b03ea36
PySimpleGUI.py
212,675
2
12
_SpinboxSelectHandler
https://github.com/PySimpleGUI/PySimpleGUI.git
Fix for enable_events for Spin element. Changed how the event is generated. Need to determine manual entry of value still
17
0
53,336
8
1
19
def test_small_integration_test(self): model = TFAutoModelForSeq2SeqLM.from_pretrained("google/mt5-small") tokenizer = AutoTokenizer.from_pretrained("google/mt5-small") input_ids = tokenizer("Hello there", return_tensors="tf").input_ids labels = tokenizer("Hi I am", return_ten...
tests/models/mt5/test_modeling_tf_mt5.py
158
transformers
{ "docstring": "\n For comparision run:\n >>> import t5 # pip install t5==0.7.1\n >>> from t5.data.sentencepiece_vocabulary import SentencePieceVocabulary\n\n >>> path_to_mtf_small_mt5_checkpoint = '<fill_in>'\n >>> path_to_mtf_small_mt5_spm_model_path = '<fill_in>'\n >>> t5...
34
Python
27
5ae087cf8ec080b121c9cdc9bafdc2b35b6e110e
test_modeling_tf_mt5.py
32,078
9
94
test_small_integration_test
https://github.com/huggingface/transformers.git
Fix T5/mT5 tests (#18029)
97
0
5,847
12
1
8
async def test_in_interface(self): iface = gr.Interface(lambda x: x, "text", "markdown") input_data = "Here's an [image](https://gradio.app/images/gradio_logo.png)" output_data = iface(input_data) assert ( output_data == )
test/test_components.py
69
gradio
{ "docstring": "\n Interface, process\n <p>Here's an <a href=\"https://gradio.app/images/gradio_logo.png\">image</a></p>\\n", "language": "en", "n_whitespaces": 20, "n_words": 6, "vocab_size": 6 }
23
Python
20
d79039beb1c3eab597de4871f7eb6522196d1a00
test_components.py
181,302
8
36
test_in_interface
https://github.com/gradio-app/gradio.git
Latex support (#2696) * initial use of dollarmath plugin * add frontend support * chnages * changes * changes * changes * changes * fix * added latex to kinematics blocks * changes * Update CHANGELOG.md Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * added example to chang...
88
0
43,297
10
1
6
def gelu(x): return x * 0.5 * (1.0 + paddle.erf(x / math.sqrt(2.0)))
modules/image/text_to_image/disco_diffusion_cnclip_vitb16/cn_clip/clip/modeling_bert.py
47
PaddleHub
{ "docstring": " Original Implementation of the gelu activation function in Google Bert repo when initially created.\n For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):\n 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3))))\...
12
Python
11
f4d6e64cdc132ae868699a0ba442f4ab1d304a14
modeling_bert.py
49,740
2
34
gelu
https://github.com/PaddlePaddle/PaddleHub.git
add disco_diffusion_cnclip_vitb16 module
18
0
9,899
13
2
20
def _set_preview_feed(self): retval = {} for idx, side in enumerate(("a", "b")): logger.debug("Setting preview feed: (side: '%s')", side) preview_images = self._config.get("preview_images", 14) preview_images = min(max(preview_images, 2), 16) batc...
plugins/train/trainer/_base.py
184
faceswap
{ "docstring": " Set the preview feed for this feeder.\n\n Creates a generator from :class:`lib.training_data.TrainingDataGenerator` specifically\n for previews for the feeder.\n\n Returns\n -------\n dict\n The side (\"a\" or \"b\") as key, :class:`~lib.training_data.Tra...
45
Python
38
c1512fd41d86ef47a5d1ce618d6d755ef7cbacdf
_base.py
100,389
14
116
_set_preview_feed
https://github.com/deepfakes/faceswap.git
Update code to support Tensorflow versions up to 2.8 (#1213) * Update maximum tf version in setup + requirements * - bump max version of tf version in launcher - standardise tf version check * update keras get_custom_objects for tf>2.6 * bugfix: force black text in GUI file dialogs (linux) * dssim loss -...
395
0
19,874
14
4
26
def script_error_handler(path, exc, msg="", tb=False): exception = type(exc).__name__ if msg: exception = msg lineno = "" if hasattr(exc, "lineno"): lineno = str(exc.lineno) log_msg = f"in script {path}:{lineno} {exception}" if tb: etype, value, tback = sys.exc_info(...
mitmproxy/addons/script.py
199
mitmproxy
{ "docstring": "\n Handles all the user's script errors with\n an optional traceback\n ", "language": "en", "n_whitespaces": 20, "n_words": 10, "vocab_size": 10 }
54
Python
37
b3587b52b25077f68116b9852b041d33e7fc6601
script.py
251,307
15
108
script_error_handler
https://github.com/mitmproxy/mitmproxy.git
make it black!
130
0
73,672
14
1
2
def prevent_sync_event_circular_query(func):
saleor/graphql/checkout/utils.py
13
saleor
{ "docstring": "Prevent circular dependencies in synchronous events resolvers.\n\n Synchronous events are not allowed to request fields that are resolved using other\n synchronous events, which would lead to circular calls of the webhook.\n Using this decorator prevents such circular events resolution.\n\n ...
2
Python
2
8201efcde2d7aacccf3512c544cceea6780a0598
utils.py
28,243
3
10
prevent_sync_event_circular_query
https://github.com/saleor/saleor.git
GraphQL subscription support for synchronous webhook events (#9763) * WIP add sync webhooks subscription payload handling * add tests, fix minor things * update schema * remove unneeded code * add fix for circular field resolve * fix-filter-shipping-methods-payload * added_in added to desription *...
5
0
5,164
6
1
3
def iterations(self): return self._iterations
keras/optimizers/optimizer_experimental/optimizer.py
19
keras
{ "docstring": "The number of training steps this `optimizer` has run.\n\n By default, iterations would be incremented by one every time\n `apply_gradients()` is called.\n ", "language": "en", "n_whitespaces": 43, "n_words": 22, "vocab_size": 22 }
4
Python
4
84afc5193d38057e2e2badf9c889ea87d80d8fbf
optimizer.py
275,290
2
10
iterations
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
18
0
81,374
6
1
3
def test_nested_auto_heights(snap_compare): assert snap_compare("snapshot_apps/nested_auto_heights.py", press=["1", "2"]) # --- Other ---
tests/snapshot_tests/test_snapshots.py
38
textual
{ "docstring": "Test refreshing widget within a auto sized container", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
10
Python
9
32b7308ac83c20c49ca422726be149fdc5b8fc2d
test_snapshots.py
186,216
2
19
test_nested_auto_heights
https://github.com/Textualize/textual.git
fox for nested heights
15
0
45,406
10
1
4
def num_arrays_on_dev(dev): return len(get_all_arrays_on_dev(dev)) # noinspection PyShadowingNames
ivy/core/device.py
27
ivy
{ "docstring": "\n Returns the number of arrays which are currently alive on the specified device.\n ", "language": "en", "n_whitespaces": 20, "n_words": 13, "vocab_size": 12 }
7
Python
7
d743336b1f3654cd0315f380f43eed4116997c1d
device.py
213,609
2
14
num_arrays_on_dev
https://github.com/unifyai/ivy.git
renamed dev_str arg to dev for all methods.
12
0
53,674
9
3
6
def pattern(self) -> str | None: if hasattr(self, "_attr_pattern"): return self._attr_pattern if hasattr(self, "entity_description"): return self.entity_description.pattern return None
homeassistant/components/text/__init__.py
65
core
{ "docstring": "Return the regex pattern that the value must match.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 8 }
18
Python
14
003e4224c89a6da381960dc5347750d1521d85c9
__init__.py
291,305
7
38
pattern
https://github.com/home-assistant/core.git
Add `text` platform (#79454) Co-authored-by: Franck Nijhof <frenck@frenck.nl> Co-authored-by: Franck Nijhof <git@frenck.dev>
68
0
90,415
9
6
4
def render_pep440(pieces): if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += plus_or_dot(pieces) rendered += f"{pieces['distance']}.g{pieces['short']}" if pieces["dirty"]: rendered...
pandas/_version.py
163
pandas
{ "docstring": "Build up version string, with post-release \"local version identifier\".\n\n Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you\n get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty\n\n Exceptions:\n 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty...
36
Python
20
e2df99823758210fb2b7c4aba39e23f3445f7cd3
_version.py
171,627
13
65
render_pep440
https://github.com/pandas-dev/pandas.git
BLD: use nonvendor versioneer (#49924) * BLD: remove vendored versioneer * run vis * move config to pyproject.toml * add versioneer to deps * run pyupgrade * fix isort and pylint * fix ci * fix env
142
0
40,694
14
1
4
def clear(self): del self._toklist[:] self._tokdict.clear()
pipenv/patched/notpip/_vendor/pyparsing/results.py
36
pipenv
{ "docstring": "\n Clear all elements and results names.\n ", "language": "en", "n_whitespaces": 21, "n_words": 6, "vocab_size": 6 }
5
Python
5
f3166e673fe8d40277b804d35d77dcdb760fc3b3
results.py
20,624
3
20
clear
https://github.com/pypa/pipenv.git
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...
26
0
3,461
8
1
2
def _refresh_on_access_denied(func):
homeassistant/components/ubus/device_tracker.py
13
core
{ "docstring": "If remove rebooted, it lost our session so rebuild one and try again.", "language": "en", "n_whitespaces": 12, "n_words": 13, "vocab_size": 13 }
2
Python
2
8819634b613f6bfd55885283bab86c3852ae40c4
device_tracker.py
298,014
3
10
_refresh_on_access_denied
https://github.com/home-assistant/core.git
String formatting and max line length - Part 6 (#84525)
5
0
96,962
6
8
14
def format(tokens, formatter, outfile=None): # pylint: disable=redefined-builtin try: if not outfile: realoutfile = getattr(formatter, 'encoding', None) and BytesIO() or StringIO() formatter.format(tokens, realoutfile) return realoutfile.getvalue() else: ...
pipenv/patched/notpip/_vendor/pygments/__init__.py
180
pipenv
{ "docstring": "\n Format a tokenlist ``tokens`` with the formatter ``formatter``.\n\n If ``outfile`` is given and a valid file object (an object\n with a ``write`` method), the result will be written to it, otherwise\n it is returned as a string.\n ", "language": "en", "n_whitespaces": 53, "n_wo...
61
Python
54
f3166e673fe8d40277b804d35d77dcdb760fc3b3
__init__.py
20,262
15
107
format
https://github.com/pypa/pipenv.git
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...
204
0
3,301
15
14
21
def get_bin_path(arg, opt_dirs=None, required=None): opt_dirs = [] if opt_dirs is None else opt_dirs sbin_paths = ['/sbin', '/usr/sbin', '/usr/local/sbin'] paths = [] for d in opt_dirs: if d is not None and os.path.exists(d): paths.append(d) paths += os.environ.get('PATH', ...
lib/ansible/module_utils/common/process.py
303
ansible
{ "docstring": "\n Find system executable in PATH. Raises ValueError if executable is not found.\n Optional arguments:\n - required: [Deprecated] Prior to 2.10, if executable is not found and required is true it raises an Exception.\n In 2.10 and later, an Exception is always raised. T...
101
Python
61
b56d73796e85f162d50b4fcd5930035183032d4a
process.py
267,630
22
187
get_bin_path
https://github.com/ansible/ansible.git
Clarify that sbin directories are always looked at in get_bin_path (#78171)
234
0
78,989
14
10
33
def aggregate(self, *args, **kwargs): if self.query.distinct_fields: raise NotImplementedError("aggregate() + distinct(fields) not implemented.") self._validate_values_are_expressions( (*args, *kwargs.values()), method_name="aggregate" ) for arg in args: ...
django/db/models/query.py
306
django
{ "docstring": "\n Return a dictionary containing the calculations (aggregation)\n over the current queryset.\n\n If args is present the expression is passed as a kwarg using\n the Aggregate object's default alias.\n ", "language": "en", "n_whitespaces": 64, "n_words": 28, "...
117
Python
88
9c19aff7c7561e3a82978a272ecdaad40dda5c00
query.py
205,775
30
191
aggregate
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
540
0
51,208
16
1
16
def to_local_object_without_private_data_child(self) -> NDimEntityPhiTensor: # relative from ..tensor import Tensor public_shape = getattr(self, "public_shape", None) public_dtype = getattr(self, "public_dtype", None) return Tensor( child=NDimEntityPhiTensor...
packages/syft/src/syft/core/tensor/autodp/ndim_entity_phi.py
137
@serializable(capnp_bytes=True)
PySyft
{ "docstring": "Convert this pointer into a partial version of the NDimEntityPhiTensor but without\n any of the private data therein.", "language": "en", "n_whitespaces": 24, "n_words": 18, "vocab_size": 16 }
38
Python
31
8fdb37e3227eb40d431c32ae8f5bfb44866e4490
ndim_entity_phi.py
967
16
79
to_local_object_without_private_data_child
https://github.com/OpenMined/PySyft.git
working ndept addition
192
1
147
14
1
5
def current_umask() -> int: mask = os.umask(0) os.umask(mask) return mask
pipenv/patched/notpip/_internal/utils/unpacking.py
41
pipenv
{ "docstring": "Get the current umask which involves having to set it temporarily.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
10
Python
9
f3166e673fe8d40277b804d35d77dcdb760fc3b3
unpacking.py
20,003
5
23
current_umask
https://github.com/pypa/pipenv.git
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...
22
0
3,171
8
3
12
async def _recover_running_jobs(self): all_jobs = await self._job_info_client.get_all_jobs() for job_id, job_info in all_jobs.items(): if not job_info.status.is_terminal(): create_task(self._monitor_job(job_id))
dashboard/modules/job/job_manager.py
80
ray
{ "docstring": "Recovers all running jobs from the status client.\n\n For each job, we will spawn a coroutine to monitor it.\n Each will be added to self._running_jobs and reconciled.\n ", "language": "en", "n_whitespaces": 48, "n_words": 27, "vocab_size": 25 }
16
Python
16
326b5bd1acc6d3d00ab0546e4ae45da6bed501f7
job_manager.py
126,657
5
46
_recover_running_jobs
https://github.com/ray-project/ray.git
Convert job_manager to be async (#27123) Updates jobs api Updates snapshot api Updates state api Increases jobs api version to 2 Signed-off-by: Alan Guo aguo@anyscale.com Why are these changes needed? follow-up for #25902 (comment)
63
0
28,217
13
6
16
def collate_full_clips(batch): max_mel_length = max([b[0].shape[1] for b in batch]) if len(batch) > 1 else batch[0][0].shape[1] max_audio_length = max([b[1].shape[0] for b in batch]) if len(batch) > 1 else batch[0][1].shape[0] mels = torch.zeros([len(batch), batch[0][0].shape[0], max_m...
TTS/vocoder/datasets/wavegrad_dataset.py
272
TTS
{ "docstring": "This is used in tune_wavegrad.py.\n It pads sequences to the max length.", "language": "en", "n_whitespaces": 18, "n_words": 12, "vocab_size": 12 }
62
Python
38
2c9f00a808e0aa76a82af2e8b325abb71f50d1df
wavegrad_dataset.py
262,565
11
185
collate_full_clips
https://github.com/coqui-ai/TTS.git
Fix tune wavegrad (#1844) * fix imports in tune_wavegrad * load_config returns Coqpit object instead None * set action (store true) for flag "--use_cuda"; start to tune if module is running as the main program * fix var order in the result of batch collating * make style * make style with black and isor...
155
0
77,276
13
1
7
def waist2rayleigh(w, wavelen, n=1): w, wavelen = map(sympify, (w, wavelen)) return w**2*n*pi/wavelen
sympy/physics/optics/gaussopt.py
55
sympy
{ "docstring": "\n Calculate the rayleigh range from the waist of a gaussian beam.\n\n See Also\n ========\n\n rayleigh2waist, BeamParameter\n\n Examples\n ========\n\n >>> from sympy.physics.optics import waist2rayleigh\n >>> from sympy import symbols\n >>> w, wavelen = symbols('w wavelen'...
12
Python
12
c32aa66c02befb7a12915e6ae4ae953a1a81c8f7
gaussopt.py
196,508
3
36
waist2rayleigh
https://github.com/sympy/sympy.git
Refractive_Index_Parameter_Considered
21
0
47,949
9
1
7
def __copy__(self): # Shallow copy. return self.__constructor__( self.gpu_manager, self.key, self._length_cache, self._width_cache )
modin/core/execution/ray/implementations/cudf_on_ray/partitioning/partition.py
43
modin
{ "docstring": "\n Create a copy of this object.\n\n Returns\n -------\n cuDFOnRayDataframePartition\n A copy of this object.\n ", "language": "en", "n_whitespaces": 61, "n_words": 14, "vocab_size": 10 }
12
Python
12
2bb9a1fab7b0092974853e616dfd5e7ed98f085d
partition.py
155,358
4
27
__copy__
https://github.com/modin-project/modin.git
REFACTOR-#5363: introduce partition constructor; move `add_to_apply_calls` impl in base class (#5354) Signed-off-by: Myachev <anatoly.myachev@intel.com>
51
0
36,353
8
2
16
def upgrade(): try: with op.batch_alter_table('connection') as batch_op: batch_op.alter_column("conn_id", nullable=False, existing_type=sa.String(250, **COLLATION_ARGS)) batch_op.create_unique_constraint(constraint_name="unique_conn_id", columns=["conn_id"]) except sa.exc.I...
airflow/migrations/versions/8d48763f6d53_add_unique_constraint_to_conn_id.py
117
airflow
{ "docstring": "Apply Add unique constraint to ``conn_id`` and set it as non-nullable", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
30
Python
29
69f6f9e01b6df76c3c8fa266d460324163957887
8d48763f6d53_add_unique_constraint_to_conn_id.py
45,476
7
65
upgrade
https://github.com/apache/airflow.git
Autogenerate migration reference doc (#21601) * document airflow version in each alembic migration module and use this to autogen the doc * update each migration module to have the same description used in migration ref (so it can be used in autogen)
75
0
8,603
15
2
19
def forward(self, input_ids, token_type_ids=None, attention_mask=None): r if attention_mask is None: attention_mask = paddle.unsqueeze( (input_ids == self.pad_token_id ).astype(self.pooler.dense.weight.dtype) * -1e4, axis=[1, 2]) embe...
paddlenlp/transformers/tinybert/modeling.py
139
PaddleNLP
{ "docstring": "\n The TinyBertModel forward method, overrides the `__call__()` special method.\n\n Args:\n input_ids (Tensor):\n Indices of input sequence tokens in the vocabulary. They are\n numerical representations of tokens that build the input sequence.\n ...
35
Python
30
b0c35d5e1ff02a634fa26392b60d3885c2c78677
modeling.py
322,100
68
92
forward
https://github.com/PaddlePaddle/PaddleNLP.git
Fix the attention mask for fp16 (#1585)
133
0
118,057
17
1
4
def available(self) -> bool: return self.netdata.available
homeassistant/components/netdata/sensor.py
25
core
{ "docstring": "Could the resource be accessed during the last update call.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
6
Python
6
420733a064286cfe6fc5cf11483835d15ff83462
sensor.py
305,670
3
14
available
https://github.com/home-assistant/core.git
Improve entity type hints [n] (#77824)
20
0
104,454
7
1
6
def vlatex(expr, **settings): r latex_printer = VectorLatexPrinter(settings) return latex_printer.doprint(expr)
sympy/physics/vector/printing.py
38
sympy
{ "docstring": "Function for printing latex representation of sympy.physics.vector\n objects.\n\n For latex representation of Vectors, Dyadics, and dynamicsymbols. Takes the\n same options as SymPy's :func:`~.latex`; see that function for more\n information;\n\n Parameters\n ==========\n\n expr :...
9
Python
9
9a3ffc6781bd44c47cf49e128ef154389c32876a
printing.py
197,452
38
23
vlatex
https://github.com/sympy/sympy.git
Some pep8 cleanup of sympy.physics.vector.
17
0
48,558
8
4
12
def test_pick_two_individuals_eligible_for_crossover_bad(): ind1 = creator.Individual.from_string( 'BernoulliNB(input_matrix, BernoulliNB__alpha=1.0, BernoulliNB__fit_prior=True)', tpot_obj._pset ) ind2 = creator.Individual.from_string( 'BernoulliNB(input_matrix, BernoulliNB__a...
tests/tpot_tests.py
171
tpot
{ "docstring": "Assert that pick_two_individuals_eligible_for_crossover() returns the right output when no pair is eligible", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
102
Python
48
388616b6247ca4ea8de4e2f340d6206aee523541
tpot_tests.py
181,690
19
104
test_pick_two_individuals_eligible_for_crossover_bad
https://github.com/EpistasisLab/tpot.git
Revert "Deployed 7ccda9a with MkDocs version: 1.3.0" This reverts commit bd9629c40e01241766197119b581a99409b07068.
192
0
43,477
9
9
27
def _vindex(x, *indexes): indexes = replace_ellipsis(x.ndim, indexes) nonfancy_indexes = [] reduced_indexes = [] for ind in indexes: if isinstance(ind, Number): nonfancy_indexes.append(ind) elif isinstance(ind, slice): nonfancy_indexes.append(ind) ...
dask/array/core.py
355
dask
{ "docstring": "Point wise indexing with broadcasting.\n\n >>> x = np.arange(56).reshape((7, 8))\n >>> x\n array([[ 0, 1, 2, 3, 4, 5, 6, 7],\n [ 8, 9, 10, 11, 12, 13, 14, 15],\n [16, 17, 18, 19, 20, 21, 22, 23],\n [24, 25, 26, 27, 28, 29, 30, 31],\n [32, 33, 34...
115
Python
82
b016998fa931f644df4d266a3ed5e7604c20d2a9
core.py
156,931
32
221
_vindex
https://github.com/dask/dask.git
Removed unused loop control variables (`B007`) (#9458) Co-authored-by: James Bourbeau <jrbourbeau@gmail.com>
379
0
36,811
16
1
13
def test_warn_once(): with warnings.catch_warnings(record=True) as record: # Ignore Deprecation warnings. warnings.filterwarnings("ignore", category=DeprecationWarning) assert not load_checkpoint() assert not load_checkpoint() assert not save_checkpoint(x=2) ass...
python/ray/train/tests/test_session.py
130
ray
{ "docstring": "Checks if session misuse warning is only shown once per function.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
39
Python
26
0e8eb8aedb3e158da8c3e7378e818ce87ca7813e
test_session.py
128,341
10
73
test_warn_once
https://github.com/ray-project/ray.git
[AIR] More Train and Tune session deprecations (#28856) Signed-off-by: Amog Kamsetty amogkamsetty@yahoo.com Finish marking train. and tune. session APIs as deprecated
107
0
28,675
11
1
6
def _tie_weights(self): # To tie those two weights if they get disconnected (on TPU or when the bias is resized) self.bias = self.decoder.bias @add_start_docstrings( , XLM_ROBERTA_XL_START_DOCSTRING, )
src/transformers/models/xlm_roberta_xl/modeling_xlm_roberta_xl.py
38
@add_start_docstrings( """ XLM-RoBERTa-xlarge Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled output) e.g. for GLUE tasks. """, XLM_ROBERTA_XL_START_DOCSTRING, )
transformers
{ "docstring": "\n XLM-RoBERTa-xlarge Model transformer with a sequence classification/regression head on top (a linear layer on top\n of the pooled output) e.g. for GLUE tasks.\n ", "language": "en", "n_whitespaces": 33, "n_words": 23, "vocab_size": 21 }
27
Python
27
e09473a817c5e5871e11cc81004355ef30250502
modeling_xlm_roberta_xl.py
34,690
2
14
_tie_weights
https://github.com/huggingface/transformers.git
Add support for XLM-R XL and XXL models by modeling_xlm_roberta_xl.py (#13727) * add xlm roberta xl * add convert xlm xl fairseq checkpoint to pytorch * fix init and documents for xlm-roberta-xl * fix indention * add test for XLM-R xl,xxl * fix model hub name * fix some stuff * up * correct ini...
44
1
6,311
8
2
27
def _convert_mesh_to_triangles(self, coordinates): if isinstance(coordinates, np.ma.MaskedArray): p = coordinates.data else: p = coordinates p_a = p[:-1, :-1] p_b = p[:-1, 1:] p_c = p[1:, 1:] p_d = p[1:, :-1] p_center = (p_a + p_b...
lib/matplotlib/collections.py
390
matplotlib
{ "docstring": "\n Convert a given mesh into a sequence of triangles, each point\n with its own color. The result can be used to construct a call to\n `~.RendererBase.draw_gouraud_triangles`.\n ", "language": "en", "n_whitespaces": 56, "n_words": 26, "vocab_size": 23 }
112
Python
56
4a5d09cba5f4a20e14553cebd8f70c1f34d20d35
collections.py
109,611
29
273
_convert_mesh_to_triangles
https://github.com/matplotlib/matplotlib.git
Deprecate draw_gouraud_triangle (#23824) * Deprecate draw_gouraud_triangle * DOC: minor rewording Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> Co-authored-by: Thomas A Caswell <tcaswell@gmail.com> Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
355
0
23,670
12
2
12
def get_binance_available_quotes_for_each_coin() -> dict: trading_pairs = _get_trading_pairs() results = defaultdict(list) for pair in trading_pairs: results[pair["baseAsset"]].append(pair["quoteAsset"]) return results @log_start_end(log=logger)
gamestonk_terminal/cryptocurrency/due_diligence/binance_model.py
82
@log_start_end(log=logger)
OpenBBTerminal
{ "docstring": "Helper methods that for every coin available on Binance add all quote assets. [Source: Binance]\n\n Returns\n -------\n dict:\n All quote assets for given coin\n {'ETH' : ['BTC', 'USDT' ...], 'UNI' : ['ETH', 'BTC','BUSD', ...]\n\n ", "language": "en", "n_whitespaces": 60,...
18
Python
16
e1b6022b9cf156ffc0697d0d25a5ed2772ea8d68
binance_model.py
282,485
15
40
get_binance_available_quotes_for_each_coin
https://github.com/OpenBB-finance/OpenBBTerminal.git
Global plot styles (#1228) * Add default stylesheets * Add terminal style helper class and global style initialization in cfg * Style comments and docstrings * Load rich terminal theme from config file * Add application chart styles to candle charts * Add todos * Remove explicit color setting for som...
39
1
84,165
12
9
19
def get_actual_start_end_datetime_of_shift(employee, for_datetime, consider_default_shift=False): actual_shift_start = actual_shift_end = shift_details = None shift_timings_as_per_timestamp = get_employee_shift_timings( employee, for_datetime, consider_default_shift ) timestamp_list = [] for shift in shift_tim...
erpnext/hr/doctype/shift_assignment/shift_assignment.py
225
erpnext
{ "docstring": "Takes a datetime and returns the 'actual' start datetime and end datetime of the shift in which the timestamp belongs.\n\tHere 'actual' means - taking in to account the \"begin_check_in_before_shift_start_time\" and \"allow_check_out_after_shift_end_time\".\n\tNone is returned if the timestamp is outs...
82
Python
54
494bd9ef78313436f0424b918f200dab8fc7c20b
shift_assignment.py
66,198
23
145
get_actual_start_end_datetime_of_shift
https://github.com/frappe/erpnext.git
style: format code with black
59
0
14,136
14
3
5
def synchronize_labels(self, axis=None): if axis is None: self._deferred_index = True self._deferred_column = True elif axis == 0: self._deferred_index = True else: self._deferred_column = True
modin/core/dataframe/pandas/dataframe/dataframe.py
70
modin
{ "docstring": "\n Set the deferred axes variables for the ``PandasDataframe``.\n\n Parameters\n ----------\n axis : int, default: None\n The deferred axis.\n 0 for the index, 1 for the columns.\n ", "language": "en", "n_whitespaces": 84, "n_words": 26, ...
24
Python
15
3c740dbfcdd69ddc3ab45a42be996e5c61104342
dataframe.py
152,959
8
42
synchronize_labels
https://github.com/modin-project/modin.git
FEAT-#3111: Ensure relabeling Modin Frame does not lose partition shape (#3662) Co-authored-by: Devin Petersohn <devin.petersohn@gmail.com> Signed-off-by: Naren Krishna <naren@ponder.io>
96
0
35,205
10
2
2
def testResourceDeadlock(self):
python/ray/tune/tests/test_trial_runner_pg.py
13
ray
{ "docstring": "Tests that resource deadlock is avoided for heterogeneous PGFs.\n\n We start 4 trials in a cluster with 2 CPUs. The first two trials\n require 1 CPU each, the third trial 2 CPUs, the fourth trial 1 CPU.\n\n The second trial needs a bit more time to finish. This means that the\n ...
2
Python
2
976ece4bc43abdb628cf4cbffc8546abab723a6d
test_trial_runner_pg.py
129,037
24
190
testResourceDeadlock
https://github.com/ray-project/ray.git
[tune] Add test for heterogeneous resource request deadlocks (#21397) This adds a test for potential resource deadlocks in experiments with heterogeneous PGFs. If the PGF of a later trial becomes ready before that of a previous trial, we could run into a deadlock. This is currently avoided, but untested, flagging the ...
9
0
28,880
6
1
34
async def test_vocolinc_flowerbud_setup(hass): accessories = await setup_accessories_from_file(hass, "vocolinc_flowerbud.json") await setup_test_accessories(hass, accessories) await assert_devices_and_entities_created( hass, DeviceTestInfo( unique_id=HUB_TEST_ACCESSORY_ID, ...
tests/components/homekit_controller/specific_devices/test_vocolinc_flowerbud.py
389
core
{ "docstring": "Test that a Vocolinc Flowerbud can be correctly setup in HA.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
84
Python
70
f23b1750e85f07091eb896a0b12b8f95e5646338
test_vocolinc_flowerbud.py
288,885
59
238
test_vocolinc_flowerbud_setup
https://github.com/home-assistant/core.git
Migrate HomeKit Controller to use stable identifiers (#80064)
1,005
0
88,034
19
3
12
def closure(self, rel, depth=-1): from nltk.util import acyclic_breadth_first for synset in acyclic_breadth_first(self, rel, depth): if synset != self: yield synset from nltk.util import acyclic_depth_first as acyclic_tree from nltk.util import unweighted_...
nltk/corpus/reader/wordnet.py
89
nltk
{ "docstring": "\n Return the transitive closure of source under the rel\n relationship, breadth-first, discarding cycles:\n\n >>> from nltk.corpus import wordnet as wn\n >>> computer = wn.synset('computer.n.01')\n >>> topic = lambda s:s.topic_domains()\n >>> print(list(compu...
44
Python
29
692adaff901dd9daf29400fdf3385130aefbfb2a
wordnet.py
42,481
5
38
closure
https://github.com/nltk/nltk.git
Fix some tests in Wordnet-related DocStrings
106
0
7,566
10
2
7
def is_on(self) -> bool: return ( self.coordinator.data[self.entity_description.key] == "TooLow" or self.coordinator.data[self.entity_description.key] == "TooHigh" )
homeassistant/components/flipr/binary_sensor.py
67
core
{ "docstring": "Return true if the binary sensor is on in case of a Problem is detected.", "language": "en", "n_whitespaces": 14, "n_words": 15, "vocab_size": 14 }
14
Python
12
c7dfd6b15a3fc9fa81d260b3dfa8a3d836f9afa8
binary_sensor.py
290,673
6
40
is_on
https://github.com/home-assistant/core.git
Add flipr battery level sensor (#81389) * Addition of battery level sensor. Correction of pylint errors * Review improvement for typing * Review improvement for typing * Correction following review
57
0
89,787
11
1
3
def test_archive_too_large_for_mem_cache(self, cache_set):
tests/sentry/lang/javascript/test_processor.py
15
sentry
{ "docstring": "cache.set is never called if the archive is too large", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
3
Python
3
8cdaa4e86e8296cdbc145f2a53d3eb38cb7a1c2b
test_processor.py
90,778
8
74
test_archive_too_large_for_mem_cache
https://github.com/getsentry/sentry.git
ref: close files explicitly in tests.sentry.lang.javascript.test_processor (#35262)
10
0
18,689
6
1
2
def BurstTaskRunner(): job_queue = []
src/sentry/testutils/helpers/task_runner.py
19
sentry
{ "docstring": "\n A fixture for queueing up Celery tasks and working them off in bursts.\n\n The main interesting property is that one can run tasks at a later point in\n the future, testing \"concurrency\" without actually spawning any kind of\n worker.\n ", "language": "en", "n_whitespaces": 55,...
5
Python
5
ce3e457ef18fe0046d6aca0b545eac55eae8f17c
task_runner.py
87,360
7
28
BurstTaskRunner
https://github.com/getsentry/sentry.git
feat(perf-issues): Move queue info for post_process into headers (ISP… (#40239) Re-do of https://github.com/getsentry/sentry/pull/39946 as merge conflict didn't mesh right. Sends dedicated issue category data to post_process_group call so we can route to the appropriate celery queue Will need to include change...
11
0
18,288
7
8
52
def update_proxy_model_permissions(apps, schema_editor, reverse=False): style = color_style() Permission = apps.get_model("auth", "Permission") ContentType = apps.get_model("contenttypes", "ContentType") alias = schema_editor.connection.alias for Model in apps.get_models(): opts = Model...
django/contrib/auth/migrations/0011_update_proxy_permissions.py
413
django
{ "docstring": "\n Update the content_type of proxy model permissions to use the ContentType\n of the proxy model.\n ", "language": "en", "n_whitespaces": 25, "n_words": 15, "vocab_size": 11 }
106
Python
74
9c19aff7c7561e3a82978a272ecdaad40dda5c00
0011_update_proxy_permissions.py
203,669
36
259
update_proxy_model_permissions
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
422
0
50,502
18
7
20
def get_loss(self, session_id=None): logger.debug("Getting loss: (session_id: %s)", session_id) retval = {} for idx in [session_id] if session_id else self.session_ids: self._check_cache(idx) data = self._cache.get_data(idx, "loss") if not data: ...
lib/gui/analysis/event_reader.py
210
faceswap
{ "docstring": " Read the loss from the TensorBoard event logs\n\n Parameters\n ----------\n session_id: int, optional\n The Session ID to return the loss for. Set to ``None`` to return all session\n losses. Default ``None``\n\n Returns\n -------\n dict\...
56
Python
44
c1512fd41d86ef47a5d1ce618d6d755ef7cbacdf
event_reader.py
100,308
13
132
get_loss
https://github.com/deepfakes/faceswap.git
Update code to support Tensorflow versions up to 2.8 (#1213) * Update maximum tf version in setup + requirements * - bump max version of tf version in launcher - standardise tf version check * update keras get_custom_objects for tf>2.6 * bugfix: force black text in GUI file dialogs (linux) * dssim loss -...
189
0
19,805
14