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
3
as_airbyte_message
def as_airbyte_message(self) -> AirbyteMessage: now_millis = datetime.now().timestamp() * 1000.0 trace_exc = self._exception or self stack_trace_str = "".join(traceback.TracebackException.from_exception(trace_exc).format()) trace_message = AirbyteTraceMessage( type...
73c7fad7fce952a8c3ba827ca858e4280bd846f3
14
traced_exception.py
166
CDK: emit `AirbyteTraceMessage` with exception trace information (#12593)
710
0
198
107
40
5,031
45
airbyte
30
airbyte-cdk/python/airbyte_cdk/utils/traced_exception.py
Python
18
{ "docstring": "\n Builds an AirbyteTraceMessage from the exception\n ", "language": "en", "n_whitespaces": 21, "n_words": 6, "vocab_size": 6 }
https://github.com/airbytehq/airbyte.git
1
_get_model_info
def _get_model_info(self, model_name): # noqa return self.storage.get('models')[model_name]
4b49bf89ad95fcc645a249983efd764c1a73e3bb
9
lightwood_handler.py
36
copy from /lightwood_handler branch: added generic serializer for dill support, lw integration functional
25,193
0
22
20
7
114,440
7
mindsdb
5
mindsdb/integrations/lightwood_handler/lightwood_handler/lightwood_handler.py
Python
2
{ "docstring": " Returns a dictionary with three keys: 'jsonai', 'predictor' (serialized), and 'code'. ", "language": "en", "n_whitespaces": 12, "n_words": 11, "vocab_size": 11 }
https://github.com/mindsdb/mindsdb.git
1
get_views
def get_views(self): query = f"SELECT * FROM information_schema.views WHERE table_schema NOT IN ('information_schema', 'pg_catalog')" result = self.run_native_query(query) return result
7e3da9157508a5eb38dbfabbd7f08ba8fa6c5a88
8
postgres_handler.py
36
Get tables, views, describe
25,222
0
47
20
17
114,587
19
mindsdb
5
mindsdb/integrations/postgres_handler/postgres_handler.py
Python
4
{ "docstring": "\n List all views in PostgreSQL without the system views information_schema and pg_catalog\n ", "language": "en", "n_whitespaces": 27, "n_words": 12, "vocab_size": 11 }
https://github.com/mindsdb/mindsdb.git
10
mod_inverse
def mod_inverse(a, m): r c = None try: a, m = as_int(a), as_int(m) if m != 1 and m != -1: x, _, g = igcdex(a, m) if g == 1: c = x % m except ValueError: a, m = sympify(a), sympify(m) if not (a.is_number and m.is_number): ...
f3b08522003f40868afb20304fc0fa5b16d13f6a
15
numbers.py
240
Cleanup documentation
48,421
0
240
149
64
197,274
97
sympy
18
sympy/core/numbers.py
Python
63
{ "docstring": "\n Return the number $c$ such that, $a \\times c = 1 \\pmod{m}$\n where $c$ has the same sign as $m$. If no such value exists,\n a ValueError is raised.\n\n Examples\n ========\n\n >>> from sympy import mod_inverse, S\n\n Suppose we wish to find multiplicative inverse $x$ of\n ...
https://github.com/sympy/sympy.git
9
potentially_ragged_concat
def potentially_ragged_concat(tensors): if len(tensors) == 1: return tensors[0] if isinstance(tensors[0], tf.SparseTensor): return tf.sparse.concat(axis=0, sp_inputs=tensors) elif isinstance(tensors[0], tf.RaggedTensor): return tf.concat(tensors, axis=0) elif not tf.__intern...
84afc5193d38057e2e2badf9c889ea87d80d8fbf
14
training.py
380
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
80,801
0
237
242
68
271,566
106
keras
31
keras/engine/training.py
Python
25
{ "docstring": "Concats `Tensor`s along their first dimension.\n\n Args:\n tensors: List of `Tensor`s.\n\n Returns:\n Concatenation of the inputs along the first dimension -- of type `Tensor`\n if all input shapes are compatible, or `RaggedTensor` if not.\n ", "language": "en", "n_whitespa...
https://github.com/keras-team/keras.git
8
dag_longest_path
def dag_longest_path(G, weight="weight", default_weight=1, topo_order=None): if not G: return [] if topo_order is None: topo_order = nx.topological_sort(G) dist = {} # stores {v : (length, u)} for v in topo_order: us = [ (dist[u][0] + data.get(weight, default_...
304682fd71ba3bae9c456b004bbabafb96022add
@not_implemented_for("undirected")
14
dag.py
295
Add example of topo_order kwarg to dag_longest_path (#5728)
42,147
1
241
185
74
176,856
109
networkx
23
networkx/algorithms/dag.py
Python
22
{ "docstring": "Returns the longest path in a directed acyclic graph (DAG).\n\n If `G` has edges with `weight` attribute the edge data are used as\n weight values.\n\n Parameters\n ----------\n G : NetworkX DiGraph\n A directed acyclic graph (DAG)\n\n weight : str, optional\n Edge data...
https://github.com/networkx/networkx.git
6
test_conversation_part_filtering_based_on_conversation
def test_conversation_part_filtering_based_on_conversation(requests_mock, conversation_parts_responses): updated_at = 1650988200 state = {"updated_at": updated_at} expected_record_ids = set() for response_tuple in conversation_parts_responses: requests_mock.register_uri('GET', response_tupl...
1642630461c25e447ede67bb42ba6ea6ec700e52
16
unit_test.py
239
🐛 Source Intercom: Fixed filtering of conversation_parts (#12374)
690
0
110
149
39
4,928
51
airbyte
28
airbyte-integrations/connectors/source-intercom/unit_tests/unit_test.py
Python
13
{ "docstring": "\n Test shows that conversation_parts filters conversations (from parent stream) correctly\n ", "language": "en", "n_whitespaces": 17, "n_words": 10, "vocab_size": 10 }
https://github.com/airbytehq/airbyte.git
6
get_lexer_for_mimetype
def get_lexer_for_mimetype(_mime, **options): for modname, name, _, _, mimetypes in LEXERS.values(): if _mime in mimetypes: if name not in _lexer_cache: _load_lexers(modname) return _lexer_cache[name](**options) for cls in find_plugin_lexers(): if _mi...
f3166e673fe8d40277b804d35d77dcdb760fc3b3
13
__init__.py
123
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,380
0
116
77
31
20,452
42
pipenv
14
pipenv/patched/notpip/_vendor/pygments/lexers/__init__.py
Python
10
{ "docstring": "Get a lexer for a mimetype.\n\n Raises ClassNotFound if not found.\n ", "language": "en", "n_whitespaces": 17, "n_words": 11, "vocab_size": 10 }
https://github.com/pypa/pipenv.git
6
_extract_gradient_tags
def _extract_gradient_tags(self): tags = re.finditer( r'<gradient\s+from="([^"]+)"\s+to="([^"]+)"(\s+offset="([^"]+)")?>(.+?)</gradient>', self.original_text, re.S, ) gradientmap = [] for tag in tags: start = self._count_real_chars...
902e7eb4f0147b5882a613b67467e38a1d47f01e
14
text_mobject.py
311
Hide more private methods from the docs. (#2468) * hide privs from text_mobject.py * hide privs from tex_mobject.py * hide privs from code_mobject.py * hide privs from svg_mobject.py * remove SVGPath and utils from __init__.py * don't import string_to_numbers * hide privs from geometry.py * hide p...
46,096
0
378
197
60
189,496
75
manim
22
manim/mobject/svg/text_mobject.py
Python
25
{ "docstring": "Used to determine which parts (if any) of the string should be formatted\n with a gradient.\n\n Removes the ``<gradient>`` tag, as it is not part of Pango's markup and would cause an error.\n ", "language": "en", "n_whitespaces": 54, "n_words": 33, "vocab_size": 31 }
https://github.com/ManimCommunity/manim.git
5
get_feature_names_out
def get_feature_names_out(self, input_features=None): input_features = _check_feature_names_in( self, input_features, generate_names=True ) est_name = self.__class__.__name__.lower() names_list = [f"{est_name}_{name}_sqrt" for name in input_features] for j ...
67a3feed2fe4e82c1cc129c34b9e223b94a8d531
11
kernel_approximation.py
176
ENH Adds get_feature_names_out for AdditiveChi2Sampler (#22137) Co-authored-by: Olivier Grisel <olivier.grisel@gmail.com> Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
75,584
0
138
94
31
259,125
45
scikit-learn
21
sklearn/kernel_approximation.py
Python
11
{ "docstring": "Get output feature names for transformation.\n\n Parameters\n ----------\n input_features : array-like of str or None, default=None\n Only used to validate feature names with the names seen in :meth:`fit`.\n\n Returns\n -------\n feature_names_out :...
https://github.com/scikit-learn/scikit-learn.git
3
scalar_potential_difference
def scalar_potential_difference(field, frame, point1, point2, origin): _check_frame(frame) if isinstance(field, Vector): # Get the scalar potential function scalar_fn = scalar_potential(field, frame) else: # Field is a scalar scalar_fn = field # Express positions in...
9a3ffc6781bd44c47cf49e128ef154389c32876a
10
fieldfunctions.py
208
Some pep8 cleanup of sympy.physics.vector.
48,541
0
155
133
56
197,433
77
sympy
23
sympy/physics/vector/fieldfunctions.py
Python
14
{ "docstring": "\n Returns the scalar potential difference between two points in a\n certain frame, wrt a given field.\n\n If a scalar field is provided, its values at the two points are\n considered. If a conservative vector field is provided, the values\n of its scalar potential function at the two p...
https://github.com/sympy/sympy.git
7
prev_lexicographic
def prev_lexicographic(self): i = self.superset_size - 1 indices = Subset.subset_indices(self.subset, self.superset) while i >= 0 and i not in indices: i = i - 1 if i == 0 or i - 1 in indices: indices.remove(i) else: if i >= 0: ...
498015021131af4dbb07eb110e5badaba8250c7b
13
subsets.py
192
Updated import locations
47,719
0
217
120
35
196,219
62
sympy
13
sympy/combinatorics/subsets.py
Python
17
{ "docstring": "\n Generates the previous lexicographically ordered subset.\n\n Examples\n ========\n\n >>> from sympy.combinatorics import Subset\n >>> a = Subset([], ['a', 'b', 'c', 'd'])\n >>> a.prev_lexicographic().subset\n ['d']\n >>> a = Subset(['c','d'], ...
https://github.com/sympy/sympy.git
3
add_base_argument
def add_base_argument(self, parser, *args, **kwargs): for arg in args: if arg in self.suppressed_base_arguments: kwargs["help"] = argparse.SUPPRESS break parser.add_argument(*args, **kwargs)
9c19aff7c7561e3a82978a272ecdaad40dda5c00
12
base.py
73
Refs #33476 -- Reformatted code with Black.
50,806
0
81
45
17
204,596
19
django
10
django/core/management/base.py
Python
6
{ "docstring": "\n Call the parser's add_argument() method, suppressing the help text\n according to BaseCommand.suppressed_base_arguments.\n ", "language": "en", "n_whitespaces": 34, "n_words": 12, "vocab_size": 11 }
https://github.com/django/django.git
3
get_holiday
def get_holiday(holiday_list, month): holiday_map = frappe._dict() for d in holiday_list: if d: holiday_map.setdefault( d, frappe.db.sql( , (d, month), ), ) return holiday_map @frappe.whitelist()
494bd9ef78313436f0424b918f200dab8fc7c20b
@frappe.whitelist()
14
monthly_attendance_sheet.py
83
style: format code with black
14,150
1
10
47
22
66,259
23
erpnext
11
erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
Python
13
{ "docstring": "select day(holiday_date), weekly_off from `tabHoliday`\n\t\t\t\twhere parent=%s and month(holiday_date)=%s", "language": "en", "n_whitespaces": 7, "n_words": 9, "vocab_size": 9 }
https://github.com/frappe/erpnext.git
1
add_hedge_option
def add_hedge_option(price, implied_volatility, strike, days, side): # Determine delta position given the option delta = calc_delta(price, implied_volatility, strike, days, 0, side) # Determine gamma position given the option gamma = calc_gamma(price, implied_volatility, strike, days, 0) # De...
54a1b6f545a0016c576e9e00eef5c003d229dacf
8
hedge_model.py
88
Feature/hedge (#1768) * [Bug] Incorrect log for reddit keys. #1733 fix * Create new feature-hedge * Significantly improve code of hedge menu * More robust * Robustness * Fix tests * Fix can't multiply sequence by non-int of type 'numpy.float64' error * Temporary fix of singular matrix error. Retur...
84,764
0
77
64
25
284,498
53
OpenBBTerminal
12
openbb_terminal/stocks/options/hedge/hedge_model.py
Python
5
{ "docstring": "Determine the delta, gamma and vega value of the portfolio and/or options.\n\n Parameters\n ----------\n price: int\n The price.\n implied_volatility: float\n The implied volatility.\n strike: float\n The strike price.\n days: float\n The amount of days un...
https://github.com/OpenBB-finance/OpenBBTerminal.git
1
__radd__
def __radd__(self, other): # In analogy with __rsub__ and __rdiv__, use original order: # we get here from `other + self`. return np.add(other, self)
6d77c591c59b5678f14ae5af2127eebb7d2415bc
7
core.py
30
ENH: Adding __array_ufunc__ capability to MaskedArrays. This enables any ufunc numpy operations that are called on a MaskedArray to use the masked version of that function automatically without needing to resort to np.ma.func() calls.
38,785
0
52
17
23
160,889
24
numpy
5
numpy/ma/core.py
Python
2
{ "docstring": "\n Add other to self, and return a new masked array.\n\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 10 }
https://github.com/numpy/numpy.git
6
__getattribute__
def __getattribute__(self, attr): # All module metadata must be garnered from __spec__ in order to avoid # using mutated values. # Stop triggering this method. self.__class__ = types.ModuleType # Get the original name to make sure no object substitution occurred ...
8198943edd73a363c266633e1aa5b2a9e9c9f526
14
util.py
249
add python 3.10.4 for windows
55,258
0
494
143
123
218,361
174
XX-Net
25
python3.10.4/Lib/importlib/util.py
Python
19
{ "docstring": "Trigger the load of the module and return the attribute.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 8 }
https://github.com/XX-net/XX-Net.git
2
_reset_build_compile_trackers
def _reset_build_compile_trackers(model): # Reset build state model.built = False model.inputs = None model.outputs = None # Reset compile state model._is_compiled = False # pylint:disable=protected-access if not tf.compat.v1.executing_eagerly_outside_functions(): model._v1_com...
84afc5193d38057e2e2badf9c889ea87d80d8fbf
@keras_export( "keras.__internal__.models.in_place_subclassed_model_state_restoration", v1=[], )
10
cloning.py
103
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
81,325
1
76
48
24
275,169
37
keras
13
keras/models/cloning.py
Python
8
{ "docstring": "Reset state trackers for model.\n\n Note that we do not actually zero out attributes such as optimizer,\n but instead rely on the expectation that all of the attrs will be\n over-written on calling build/compile/etc. This is somewhat fragile,\n insofar as we check elsewhere for the presenc...
https://github.com/keras-team/keras.git
5
compress
def compress(self): modules_to_compress = self.get_modules_to_compress() for layer, config in modules_to_compress: module = layer.module if "weight" in config.get("quant_types", []): scale, zero_point = self.calculate_qparams(layer.name, 'weight') ...
d68c786ff81bad19c04619d6a999ff34aaa724e7
14
observer_quantizer.py
421
[Compression] remove pruning v1 & refactor directory (#5228)
24,988
0
519
251
46
113,648
73
nni
25
nni/compression/pytorch/quantization/observer_quantizer.py
Python
26
{ "docstring": "\n Calculate quantization information of each tensor. Note that the inference of\n the compressed model will no longer update the corresponding. Instead, the quantization\n process will be simulated, which is used to test the accuracy of the quantization.\n ", "language":...
https://github.com/microsoft/nni.git
1
change_logging
def change_logging(request): current_request.set(request) webhooks_queue.set([]) # Connect our receivers to the post_save and post_delete signals. post_save.connect(handle_changed_object, dispatch_uid='handle_changed_object') m2m_changed.connect(handle_changed_object, dispatch_uid='handle_chan...
cd8943144bec52ff608ddad3db5d0155832a4a23
9
context_managers.py
215
Use context vars instead of thread-local storage for change logging
78,284
0
122
121
49
266,089
62
netbox
17
netbox/extras/context_managers.py
Python
15
{ "docstring": "\n Enable change logging by connecting the appropriate signals to their receivers before code is run, and\n disconnecting them afterward.\n\n :param request: WSGIRequest object with a unique `id` set\n ", "language": "en", "n_whitespaces": 41, "n_words": 28, "vocab_size": 28 }
https://github.com/netbox-community/netbox.git
1
upgrade
def upgrade(): with op.batch_alter_table("task_instance", schema=None) as batch_op: batch_op.alter_column("pool_slots", existing_type=sa.Integer, nullable=False, server_default='1')
66c342d033bd3cb959b4dc4e7e4b8aad597aab63
11
8646922c8a04_change_default_pool_slots_to_1.py
70
Support generating SQL script for upgrades (#20962) This PR attempts to add support for generating sql scripts for upgrade. Example command: `airflow db upgrade --revision-range e8d98d8ss99:78daisdu38d` `airflow db upgrade --range 2.0.0:2.2.3`
8,439
0
24
39
11
45,007
11
airflow
11
airflow/migrations/versions/8646922c8a04_change_default_pool_slots_to_1.py
Python
3
{ "docstring": "Change default pool_slots to 1 and make pool_slots not nullable", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
https://github.com/apache/airflow.git
3
gca
def gca(self, **kwargs): if kwargs: _api.warn_deprecated( "3.4", message="Calling gca() with keyword arguments was deprecated " "in Matplotlib %(since)s. Starting %(removal)s, gca() will " "take no keyword arguments. The gca() ...
8669c4636ce3b6ac6f4905c365ab41685186da56
12
figure.py
97
Rewrite AxesStack independently of cbook.Stack. AxesStack is fairly independent from cbook.Stack: cbook.Stack handles the forward/back/home buttons of the navbar, and therefore additionally maintains a movable "cursor" in the stack; AxesStack, on the other hand, needs to keep track both of "original" order and of "gca...
22,547
0
238
52
59
107,009
79
matplotlib
10
lib/matplotlib/figure.py
Python
13
{ "docstring": "\n Get the current Axes.\n\n If there is currently no Axes on this Figure, a new one is created\n using `.Figure.add_subplot`. (To test whether there is currently an\n Axes on a Figure, check whether ``figure.axes`` is empty. To test\n whether there is currently a ...
https://github.com/matplotlib/matplotlib.git
2
run_report
def run_report(job_result, *args, **kwargs): module_name, report_name = job_result.name.split('.', 1) report = get_report(module_name, report_name) try: report.run(job_result) except Exception as e: print(e) job_result.set_status(JobResultStatusChoices.STATUS_ERRORED) ...
f13a00b2dd33bffc3048c861b494096df457f212
13
reports.py
127
Save old JobResults
77,780
0
78
108
26
264,668
28
netbox
20
netbox/extras/reports.py
Python
17
{ "docstring": "\n Helper function to call the run method on a report. This is needed to get around the inability to pickle an instance\n method for queueing into the background processor.\n ", "language": "en", "n_whitespaces": 39, "n_words": 29, "vocab_size": 24 }
https://github.com/netbox-community/netbox.git
4
location
def location(self) -> str: location = "" if self.storage: location = ( self.storage.basepath + "/" if not self.storage.basepath.endswith("/") else "" ) if self.path: location += self.path return ...
0a59ec9279d929fe6a7199ff7ff7c0b58cffa100
15
deployments.py
94
Add location as a computed property of deployments
11,802
0
141
53
21
58,708
28
prefect
7
src/prefect/deployments.py
Python
17
{ "docstring": "\n The 'location' that this deployment points to is given by `path` alone\n in the case of no remote storage, and otherwise by `storage.basepath / path`.\n\n The underlying flow entrypoint is interpreted relative to this location.\n ", "language": "en", "n_whitespaces":...
https://github.com/PrefectHQ/prefect.git
1
test_dispatch_key_raises_when_public_and_private_handlers
async def test_dispatch_key_raises_when_public_and_private_handlers(): widget = DuplicateHandlersWidget() with pytest.raises(DuplicateKeyHandlers): await widget.dispatch_key(Key(widget, key="x", char="x")) assert widget.called_by is None
17bc375e080c30d8754dfeccf44f9a607e041e1b
14
test_message_pump.py
77
Support for key aliases, key handling tests
44,966
0
35
42
16
185,308
16
textual
11
tests/test_message_pump.py
Python
5
{ "docstring": "When both a public and private handler exists for one key, we fail fast via exception.", "language": "en", "n_whitespaces": 15, "n_words": 16, "vocab_size": 16 }
https://github.com/Textualize/textual.git
1
test_unschedule_view_post
def test_unschedule_view_post(self): # Post to the unschedule page response = self.client.post( reverse( "wagtailadmin_pages:revisions_unschedule", args=(self.christmas_event.id, self.this_christmas_revision.id), ) ) # Sh...
d10f15e55806c6944827d801cd9c2d53f5da4186
14
test_revisions.py
167
Reformat with black
15,720
0
269
103
40
71,728
56
wagtail
19
wagtail/admin/tests/pages/test_revisions.py
Python
19
{ "docstring": "\n This posts to the unschedule view and checks that the revision was unscheduled\n ", "language": "en", "n_whitespaces": 28, "n_words": 13, "vocab_size": 12 }
https://github.com/wagtail/wagtail.git
1
_wrap_call_and_conditional_losses
def _wrap_call_and_conditional_losses(layer): # Create function that generates both outputs and losses layer_call = _get_layer_call_method(layer)
84afc5193d38057e2e2badf9c889ea87d80d8fbf
8
save_impl.py
24
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
81,567
0
23
21
14
276,118
14
keras
4
keras/saving/saved_model/save_impl.py
Python
4
{ "docstring": "Wraps call function that returns a tuple of (outputs, losses).\n\n The losses returned are conditional on the inputs passed to the call function.\n Unconditional losses (e.g. weight regularizeration) are wrapped separately.\n\n Args:\n layer: a Keras layer object\n\n Returns:\n p...
https://github.com/keras-team/keras.git
1
_get_no_autofield_sequence_name
def _get_no_autofield_sequence_name(self, table): name_length = self.max_name_length() - 3 return "%s_SQ" % truncate_name(strip_quotes(table), name_length).upper()
9c19aff7c7561e3a82978a272ecdaad40dda5c00
12
operations.py
57
Refs #33476 -- Reformatted code with Black.
51,012
0
34
33
13
205,087
13
django
8
django/db/backends/oracle/operations.py
Python
3
{ "docstring": "\n Manually created sequence name to keep backward compatibility for\n AutoFields that aren't Oracle identity columns.\n ", "language": "en", "n_whitespaces": 37, "n_words": 15, "vocab_size": 15 }
https://github.com/django/django.git
6
_unify_values
def _unify_values(self, section, vars): sectiondict = {} try: sectiondict = self._sections[section] except KeyError: if section != self.default_section: raise NoSectionError(section) from None # Update with the entry specific variables ...
8198943edd73a363c266633e1aa5b2a9e9c9f526
14
configparser.py
147
add python 3.10.4 for windows
56,460
0
206
93
42
221,655
53
XX-Net
17
python3.10.4/Lib/configparser.py
Python
14
{ "docstring": "Create a sequence of lookups with 'vars' taking priority over\n the 'section' which takes priority over the DEFAULTSECT.\n\n ", "language": "en", "n_whitespaces": 32, "n_words": 18, "vocab_size": 15 }
https://github.com/XX-net/XX-Net.git
5
dag_state
def dag_state(args, session=NEW_SESSION): dag = DagModel.get_dagmodel(args.dag_id, session=session) if not dag: raise SystemExit(f"DAG: {args.dag_id} does not exist in 'dag' table") dr = session.query(DagRun).filter_by(dag_id=args.dag_id, execution_date=args.execution_date).one_or_none() o...
b1ad017cee66f5e042144cc7baa2d44b23b47c4f
@cli_utils.action_cli
12
dag_command.py
179
pydocstyle D202 added (#24221)
7,780
1
84
101
36
42,996
47
airflow
25
airflow/cli/commands/dag_command.py
Python
10
{ "docstring": "\n Returns the state (and conf if exists) of a DagRun at the command line.\n >>> airflow dags state tutorial 2015-01-01T00:00:00.000000\n running\n >>> airflow dags state a_dag_with_conf_passed 2015-01-01T00:00:00.000000\n failed, {\"name\": \"bob\", \"age\": \"42\"}\n ", "language...
https://github.com/apache/airflow.git
1
_search
def _search(self, check_return_type=True) -> Union[SourceReadList, DestinationReadList, ConnectionReadList]: return self._search_fn(self.api_instance, self.search_payload, _check_return_type=check_return_type)
56bf982cb96f831fe04f5e44a92ee4a669b9e16a
8
resources.py
53
🐙 octavia-cli: `apply` connections (#10881)
641
0
25
36
11
4,247
11
airbyte
11
octavia-cli/octavia_cli/apply/resources.py
Python
7
{ "docstring": "Run search of a resources on the remote Airbyte instance.\n\n Returns:\n Union[SourceReadList, DestinationReadList, ConnectionReadList]: Search results\n ", "language": "en", "n_whitespaces": 41, "n_words": 16, "vocab_size": 16 }
https://github.com/airbytehq/airbyte.git
4
_resize
def _resize(self, image, shorter=800, longer=1333, size_divisor=32, resample=Image.BICUBIC): if not isinstance(image, Image.Image): image = self.to_pil_image(image) w, h = image.size min_size = shorter max_size = longer scale = min_size / min(w, h) i...
ac227093e41cecb07c7e0f2fc9a504850907bd06
11
feature_extraction_vilt.py
266
Add ViLT (#14895) * First commit * Add conversion script * Make conversion script work for base model * More improvements * Update conversion script, works for vqa * Add indexing argument to meshgrid * Make conversion script work for ViltForPreTraining * Add ViltForPreTraining to docs * Fix dev...
6,252
0
247
169
52
34,302
97
transformers
23
src/transformers/models/vilt/feature_extraction_vilt.py
Python
18
{ "docstring": "\n Resizes the shorter edge of `image` to `shorter` and limits the longer edge to under `longer`, while preserving\n the aspect ratio. Also makes sure that both the height and width can be divided by `size_divisor`.\n\n Based on original implementation:\n https://github.com...
https://github.com/huggingface/transformers.git
1
test_instance_url_mismatch
def test_instance_url_mismatch(self): self.plugin.set_option("instance_url", "https://hellboy.atlassian.net", self.project) group = self.create_group(message="Hello world", culprit="foo.bar") plugin_issue = GroupMeta.objects.create( key=f"{self.plugin.slug}:tid", group_id=gr...
f5e5a3b1ed97383e0699aff9eb0363e9eb5db479
14
test_integration.py
237
feat(Jira): Plugin issue migration endpoint (#37577) * feat(jira): Plugin issue migration endpoint
19,082
0
169
132
27
94,414
33
sentry
28
tests/sentry/integrations/jira/test_integration.py
Python
16
{ "docstring": "Test that if the plugin's instance URL does not match the integration's base URL, we don't migrate the issues", "language": "en", "n_whitespaces": 18, "n_words": 19, "vocab_size": 17 }
https://github.com/getsentry/sentry.git
1
create_experiment
def create_experiment(workspace, experiment_name): logger.debug("create: experiment_name {}".format(experiment_name)) exp = Experiment(workspace=workspace, name=experiment_name) return exp
f1b06e2f758b5b4a965f7bf428d006621d19c0b0
10
submit_azureml_pytest.py
56
changed folder structure for aml tests
7,141
0
24
33
11
39,219
12
recommenders
9
tests/ci/aml_tests_old/submit_azureml_pytest.py
Python
4
{ "docstring": "\n AzureML requires an experiment as a container of trials.\n This will either create a new experiment or use an\n existing one.\n\n Args:\n workspace (str) : name of AzureML workspace\n experiment_name (str) : AzureML experiment name\n Return:\n exp - AzureML exper...
https://github.com/microsoft/recommenders.git
3
test_localtaskjob_essential_attr
def test_localtaskjob_essential_attr(self, dag_maker): with dag_maker('test_localtaskjob_essential_attr'): op1 = EmptyOperator(task_id='op1') dr = dag_maker.create_dagrun() ti = dr.get_task_instance(task_id=op1.task_id) job1 = LocalTaskJob(task_instance=ti, ignore...
49e336ae0302b386a2f47269a6d13988382d975f
12
test_local_task_job.py
184
Replace usage of `DummyOperator` with `EmptyOperator` (#22974) * Replace usage of `DummyOperator` with `EmptyOperator`
9,123
0
129
111
36
47,474
48
airflow
23
tests/jobs/test_local_task_job.py
Python
11
{ "docstring": "\n Check whether essential attributes\n of LocalTaskJob can be assigned with\n proper values without intervention\n ", "language": "en", "n_whitespaces": 43, "n_words": 14, "vocab_size": 14 }
https://github.com/apache/airflow.git
1
decode
def decode(s): return urllib.parse.parse_qsl(s, keep_blank_values=True, errors="surrogateescape")
b3587b52b25077f68116b9852b041d33e7fc6601
9
url.py
39
make it black!
73,725
0
12
23
6
251,414
6
mitmproxy
7
mitmproxy/net/http/url.py
Python
2
{ "docstring": "\n Takes a urlencoded string and returns a list of surrogate-escaped (key, value) tuples.\n ", "language": "en", "n_whitespaces": 20, "n_words": 13, "vocab_size": 12 }
https://github.com/mitmproxy/mitmproxy.git
1
test_collapse_event
def test_collapse_event(self) -> None: client = self.get_client_descriptor() queue = client.event_queue queue.push({"type": "restart", "server_generation": 1, "timestamp": "1"}) # Verify the server_generation event is stored as a virtual event self.assertEqual( ...
b0ce4f1bce8031881addecb1e86073483517f392
12
test_event_queue.py
414
docs: Fix many spelling mistakes. Signed-off-by: Anders Kaseorg <anders@zulip.com>
17,634
0
389
223
64
83,239
121
zulip
13
zerver/tests/test_event_queue.py
Python
34
{ "docstring": "\n This mostly focuses on the internals of\n how we store \"virtual_events\" that we\n can collapse if subsequent events are\n of the same form. See the code in\n EventQueue.push for more context.\n ", "language": "en", "n_whitespaces": 75, "n_words": 3...
https://github.com/zulip/zulip.git
3
test_get_primary_key_column
def test_get_primary_key_column(self): testable_column_strings = ( ("id", "id"), ("[id]", "id"), ("`id`", "id"), ('"id"', "id"), ("[id col]", "id col"), ("`id col`", "id col"), ('"id col"', "id col"), ) ...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
17
test_introspection.py
215
Refs #33476 -- Reformatted code with Black.
49,992
0
390
119
52
201,772
64
django
14
tests/backends/sqlite/test_introspection.py
Python
22
{ "docstring": "\n Get the primary key column regardless of whether or not it has\n quotation.\n ", "language": "en", "n_whitespaces": 35, "n_words": 13, "vocab_size": 13 }
https://github.com/django/django.git
2
print_help
def print_help(self): colored = self.ticker and self.selected_date help_text = f print(help_text)
5a5c7193db3cf15ee7bb881ba912b8289aa83a80
10
options_controller.py
140
Volatility surface (#1176) * Add a 3D volatility surface from yfinance data * Update _index.md * other tests
83,744
0
39
23
10
281,411
11
OpenBBTerminal
10
gamestonk_terminal/stocks/options/options_controller.py
Python
30
{ "docstring": "Print help.\n unu show unusual options activity [fdscanner.com]\n calc basic call/put PnL calculator\n\n load load new ticker\n exp see and set expiration dates\n\nTicker: {self.ticker or None}\nExpiry: {self.selected_date or None}\n{\"\" if self.ticke...
https://github.com/OpenBB-finance/OpenBBTerminal.git
2
list_installed_files
def list_installed_files(self): for result in self._get_records(): yield result
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
8
database.py
31
upd; format
12,755
0
33
17
7
61,930
8
transferlearning
4
.venv/lib/python3.8/site-packages/pip/_vendor/distlib/database.py
Python
3
{ "docstring": "\n Iterates over the ``RECORD`` entries and returns a tuple\n ``(path, hash, size)`` for each line.\n\n :returns: iterator of (path, hash, size)\n ", "language": "en", "n_whitespaces": 50, "n_words": 21, "vocab_size": 20 }
https://github.com/jindongwang/transferlearning.git
2
test_dataset
def test_dataset(ray_start_4_cpus, use_local): model_creator = mlp_identity.model_creator optimizer_creator = mlp_identity.optimizer_creator dataset_creator = mlp_identity.dataset_creator DatasetOperator = TrainingOperator.from_creators( model_creator=model_creator, optimizer_crea...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
@pytest.mark.parametrize("use_local", [True, False])
13
test_torch_2.py
216
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,963
1
141
130
41
133,242
51
ray
31
python/ray/util/sgd/tests/test_torch_2.py
Python
21
{ "docstring": "\n This test tries training the mlp_identity example. We check the accuracy of\n the model as an all inclusive way of ensuring that we are properly sharding\n and iterating over the entire dataset (instead of repeating the first set\n of points for example).\n ", "language": "en", "...
https://github.com/ray-project/ray.git
4
_is_current
def _is_current(self, file_path, zip_path): timestamp, size = self._get_date_and_size(self.zipinfo[zip_path]) if not os.path.isfile(file_path): return False stat = os.stat(file_path) if stat.st_size != size or stat.st_mtime != timestamp: return False ...
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
11
__init__.py
152
upd; format
13,147
0
143
92
36
63,102
47
transferlearning
21
.venv/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py
Python
11
{ "docstring": "\n Return True if the file_path is current for this zip_path\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 10 }
https://github.com/jindongwang/transferlearning.git
4
load
def load(self): # Try to scan config file model_config_fpaths = list(self.model_fpath.parent.rglob("*.json")) if len(model_config_fpaths)>0 and model_config_fpaths[0].exists(): with model_config_fpaths[0].open("r", encoding="utf-8") as f: hparams.loadJson(json.load(f)...
0536874dec68e68969502ce1774168552727fa17
15
inference.py
335
Add config file for pretrained
38,850
0
535
213
49
160,998
52
MockingBird
50
synthesizer/inference.py
Python
26
{ "docstring": "\n Instantiates and loads the model given the weights file that was passed in the constructor.\n ", "language": "en", "n_whitespaces": 30, "n_words": 15, "vocab_size": 13 }
https://github.com/babysor/MockingBird.git
4
paste
def paste(self, im, box=None): if box is not None: warnings.warn( "The box parameter is deprecated and will be removed in Pillow 10 " "(2023-07-01).", DeprecationWarning, ) # convert to blittable im.load() ...
a724be66bef4b692994e5defa22ba3f1b2a1f771
12
ImageTk.py
154
Deprecated PhotoImage.paste() box parameter
69,895
0
217
92
50
242,703
62
Pillow
19
src/PIL/ImageTk.py
Python
15
{ "docstring": "\n Paste a PIL image into the photo image. Note that this can\n be very slow if the photo image is displayed.\n\n :param im: A PIL image. The size must match the target region. If the\n mode does not match, the image is converted to the mode of\n ...
https://github.com/python-pillow/Pillow.git
1
test_sensor_arrival_time_custom_timestamp
async def test_sensor_arrival_time_custom_timestamp(hass): assert hass.states.get("sensor.google_travel_time").state == "27" @pytest.mark.usefixtures("mock_update")
beb30a1ff199596163c655e8ae745a0f1649b78a
@pytest.mark.usefixtures("mock_update")
10
test_sensor.py
55
Add google_travel_time sensor tests (#66568) Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
91,334
1
13
19
8
292,234
8
core
8
tests/components/google_travel_time/test_sensor.py
Python
2
{ "docstring": "Test that sensor works for arrival time with a custom timestamp.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/home-assistant/core.git
3
col
def col (loc, strg): s = strg return 1 if 0 < loc < len(s) and s[loc-1] == '\n' else loc - s.rfind("\n", 0, loc)
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
10
pyparsing.py
72
upd; format
13,225
0
34
44
23
63,273
25
transferlearning
6
.venv/lib/python3.8/site-packages/pip/_vendor/pyparsing.py
Python
3
{ "docstring": "Returns current column within a string, counting newlines as line separators.\n The first column is number 1.\n\n Note: the default parsing behavior is to expand tabs in the input string\n before starting the parsing process. See\n :class:`ParserElement.parseString` for more\n information o...
https://github.com/jindongwang/transferlearning.git
1
ensure_future
def ensure_future(coro_or_future, *, loop=None): return _ensure_future(coro_or_future, loop=loop)
8198943edd73a363c266633e1aa5b2a9e9c9f526
8
tasks.py
34
add python 3.10.4 for windows
56,137
0
13
21
7
220,829
7
XX-Net
4
python3.10.4/Lib/asyncio/tasks.py
Python
2
{ "docstring": "Wrap a coroutine or an awaitable in a future.\n\n If the argument is a Future, it is returned directly.\n ", "language": "en", "n_whitespaces": 25, "n_words": 19, "vocab_size": 16 }
https://github.com/XX-net/XX-Net.git
5
_discover_secrets_backends
def _discover_secrets_backends(self) -> None: for provider_package, provider in self._provider_dict.items(): if provider.data.get("secrets-backends"): for secrets_backends_class_name in provider.data["secrets-backends"]: if _sanity_check(provider_package,...
b5a786b38148295c492da8ab731d5e2f6f86ccf7
16
providers_manager.py
97
Suppress import errors for providers from sources (#22579) When we are running airflow locally with providers installed from sources, often many providers will be discovered which we haven't installed the deps for. This generally results in a very large amount of traceback logging, which has a very negative effect on...
8,932
0
102
59
17
46,604
20
airflow
12
airflow/providers_manager.py
Python
7
{ "docstring": "Retrieves all secrets backends defined in the providers", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/apache/airflow.git
1
test_sends_note_notification
def test_sends_note_notification(self): # leave a comment url = f"/api/0/issues/{self.group.id}/comments/" with self.tasks(): response = self.client.post(url, format="json", data={"text": "blah blah"}) assert response.status_code == 201, response.content ms...
1730c481f1a8a71446326fa1ff72e10663016385
14
test_notifications.py
271
fix(notifications): Use `metrics_key` (#34572)
19,673
0
274
122
53
99,595
86
sentry
26
tests/sentry/notifications/test_notifications.py
Python
20
{ "docstring": "\n Test that an email AND Slack notification are sent with\n the expected values when a comment is created on an issue.\n ", "language": "en", "n_whitespaces": 43, "n_words": 21, "vocab_size": 20 }
https://github.com/getsentry/sentry.git
2
connect
def connect(self) -> HandlerStatusResponse: url = self.connection_args.get('url') try: ckan = rc(url) self.is_connected = True self.ckan = ckan except Exception as e: return HandlerStatusResponse(False, f'Failed to connect to CKAN: {e}') ...
75686f43be1d82794e50277acefda517eced0b6c
12
ckan_handler.py
105
Add CKAN Handler for MindsDB
25,464
0
120
59
26
115,450
34
mindsdb
12
mindsdb/integrations/handlers/ckan_handler/ckan_handler.py
Python
13
{ "docstring": "\n Handles the connection to a CKAN remote portal instance.\n ", "language": "en", "n_whitespaces": 24, "n_words": 9, "vocab_size": 9 }
https://github.com/mindsdb/mindsdb.git
3
unbatch
def unbatch(batches_struct): flat_batches = tree.flatten(batches_struct) out = [] for batch_pos in range(len(flat_batches[0])): out.append( tree.unflatten_as( batches_struct, [flat_batches[i][batch_pos] for i in range(len(flat_batches))], ...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
17
space_utils.py
104
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
33,102
0
105
66
19
144,060
24
ray
12
rllib/utils/spaces/space_utils.py
Python
11
{ "docstring": "Converts input from (nested) struct of batches to batch of structs.\n\n Input: Struct of different batches (each batch has size=3):\n {\"a\": [1, 2, 3], \"b\": ([4, 5, 6], [7.0, 8.0, 9.0])}\n Output: Batch (list) of structs (each of these structs representing a\n single action):\n ...
https://github.com/ray-project/ray.git
8
sample
def sample(self, n_samples=1): check_is_fitted(self) if n_samples < 1: raise ValueError( "Invalid value for 'n_samples': %d . The sampling requires at " "least one sample." % (self.n_components) ) _, n_features = self.means_.shap...
254ea8c453cd2100ade07644648f1f00392611a6
18
_base.py
372
ENH Replaced RandomState with Generator compatible calls (#22271)
75,335
0
657
245
73
258,624
118
scikit-learn
35
sklearn/mixture/_base.py
Python
41
{ "docstring": "Generate random samples from the fitted Gaussian distribution.\n\n Parameters\n ----------\n n_samples : int, default=1\n Number of samples to generate.\n\n Returns\n -------\n X : array, shape (n_samples, n_features)\n Randomly generated...
https://github.com/scikit-learn/scikit-learn.git
1
test_adapter_recovery
async def test_adapter_recovery(hass, one_adapter): called_start = 0 called_stop = 0 _callback = None mock_discovered = []
0e2ebfe5c45716250280186234123f170e3bd08c
7
test_scanner.py
38
Move bluetooth watchdog into the scanner base class (#83888)
96,435
0
31
221
12
297,466
16
core
7
tests/components/bluetooth/test_scanner.py
Python
50
{ "docstring": "Test we can recover when the adapter stops responding.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/home-assistant/core.git
2
test_ohe_infrequent_two_levels_user_cats_one_frequent
def test_ohe_infrequent_two_levels_user_cats_one_frequent(kwargs): X_train = np.array([["a"] * 5 + ["e"] * 30], dtype=object).T ohe = OneHotEncoder( categories=[["c", "d", "a", "b"]], sparse=False, handle_unknown="infrequent_if_exist", **kwargs, ).fit(X_train) X_te...
7f0006c8aad1a09621ad19c3db19c3ff0555a183
14
test_encoders.py
324
ENH Adds infrequent categories to OneHotEncoder (#16018) * ENH Completely adds infrequent categories * STY Linting * STY Linting * DOC Improves wording * DOC Lint * BUG Fixes * CLN Address comments * CLN Address comments * DOC Uses math to description float min_frequency * DOC Adds comment r...
75,663
0
146
201
54
259,229
68
scikit-learn
22
sklearn/preprocessing/tests/test_encoders.py
Python
17
{ "docstring": "'a' is the only frequent category, all other categories are infrequent.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/scikit-learn/scikit-learn.git
1
test_decrease_stock_multiple_lines_deallocate_stock_raises_error
def test_decrease_stock_multiple_lines_deallocate_stock_raises_error(order_with_lines): # given order_line_1 = order_with_lines.lines.first() order_line_2 = order_with_lines.lines.last() allocation_1 = order_line_1.allocations.first() allocation_2 = order_line_2.allocations.first() stock...
c052f59016d82568a675e2c202ea1363f9e355ff
12
test_stock_management.py
399
Fix incorrect stock allocation (#8963) * Fix incorrect stock allocation * Drop unused restock_order_lines order utils
4,910
0
417
251
70
25,599
117
saleor
37
saleor/warehouse/tests/test_stock_management.py
Python
49
{ "docstring": "Ensure that when some of the lines raise an error during the deallocation\n quantity allocated value for all allocation will be updated.", "language": "en", "n_whitespaces": 24, "n_words": 22, "vocab_size": 21 }
https://github.com/saleor/saleor.git
27
verify_local_collection
def verify_local_collection(local_collection, remote_collection, artifacts_manager): # type: (Candidate, Candidate | None, ConcreteArtifactsManager) -> CollectionVerifyResult result = CollectionVerifyResult(local_collection.fqcn) b_collection_path = to_bytes(local_collection.src, errors='surrogate_or_...
b439e41a915ccec0ccbabecc966919ea406db74e
17
__init__.py
1,307
expand ansible-doc coverage (#74963) * Expand ansible-doc to tests/filters and fix existing issues enable filter/test docs if in single file or companion yaml add docs for several filters/tests plugins allow .yml companion for docs for other plugins, must be colocated verify plugins are valid (not module...
78,753
0
1,652
793
300
267,135
550
ansible
79
lib/ansible/galaxy/collection/__init__.py
Python
126
{ "docstring": "Verify integrity of the locally installed collection.\n\n :param local_collection: Collection being checked.\n :param remote_collection: Upstream collection (optional, if None, only verify local artifact)\n :param artifacts_manager: Artifacts manager.\n :return: a collection verify result ...
https://github.com/ansible/ansible.git
6
traverse_by
def traverse_by(self, fixers, traversal): if not fixers: return for node in traversal: for fixer in fixers[node.type]: results = fixer.match(node) if results: new = fixer.transform(node, results) if ...
8198943edd73a363c266633e1aa5b2a9e9c9f526
15
refactor.py
104
add python 3.10.4 for windows
55,531
0
191
66
24
218,888
34
XX-Net
12
python3.10.4/Lib/lib2to3/refactor.py
Python
11
{ "docstring": "Traverse an AST, applying a set of fixers to each node.\n\n This is a helper method for refactor_tree().\n\n Args:\n fixers: a list of fixer instances.\n traversal: a generator that yields AST nodes.\n\n Returns:\n None\n ", "language": "e...
https://github.com/XX-net/XX-Net.git
3
test_appo_compilation_use_kl_loss
def test_appo_compilation_use_kl_loss(self): config = ppo.appo.DEFAULT_CONFIG.copy() config["num_workers"] = 1 config["use_kl_loss"] = True num_iterations = 2 for _ in framework_iterator(config, with_eager_tracing=True): trainer = ppo.APPOTrainer(config=conf...
8ebc50f844f42e283f125792d630ea6d0a2a7000
12
test_appo.py
152
[RLlib] Issue 21334: Fix APPO when kl_loss is enabled. (#21855)
29,010
0
165
90
27
129,737
34
ray
22
rllib/agents/ppo/tests/test_appo.py
Python
13
{ "docstring": "Test whether an APPOTrainer can be built with kl_loss enabled.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/ray-project/ray.git
2
intercept_unary_unary
async def intercept_unary_unary(self, continuation, client_call_details, request): if context.get_value(_SUPPRESS_INSTRUMENTATION_KEY): return await continuation(client_call_details, request) method = client_call_details.method.decode("utf-8") with self._start_span( ...
107631e955b21db8a4ddb3bee02130de3650d032
11
_aio_client.py
143
feat(instrumentation): add OpenTelemetry tracing and metrics with basic configurations (#5175)
2,579
0
187
91
32
13,243
38
jina
21
jina/serve/instrumentation/_aio_client.py
Python
15
{ "docstring": "Intercepts a unary-unary invocation asynchronously.\n\n :param continuation: A coroutine that proceeds with the invocation by executing\n the next interceptor in the chain or invoking the actual RPC on the\n underlying Channel. It is the interceptor's responsibility to cal...
https://github.com/jina-ai/jina.git
7
from_current_timezone
def from_current_timezone(value): if settings.USE_TZ and value is not None and timezone.is_naive(value): current_timezone = timezone.get_current_timezone() try: if not timezone._is_pytz_zone( current_timezone ) and timezone._datetime_ambiguous_or_imaginar...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
16
utils.py
170
Refs #33476 -- Reformatted code with Black.
51,326
0
300
100
54
206,016
68
django
18
django/forms/utils.py
Python
20
{ "docstring": "\n When time zone support is enabled, convert naive datetimes\n entered in the current time zone to aware datetimes.\n ", "language": "en", "n_whitespaces": 28, "n_words": 18, "vocab_size": 16 }
https://github.com/django/django.git
1
active
def active(self) -> Optional[Scope]: ctx = current_context() return ctx.scope
6ad012ef89c966cbb3616c1be63d964db48d49ca
8
scopecontextmanager.py
35
More type hints for `synapse.logging` (#13103) Completes type hints for synapse.logging.scopecontextmanager and (partially) for synapse.logging.opentracing.
72,415
0
30
20
9
248,680
9
synapse
7
synapse/logging/scopecontextmanager.py
Python
13
{ "docstring": "\n Returns the currently active Scope which can be used to access the\n currently active Scope.span.\n If there is a non-null Scope, its wrapped Span\n becomes an implicit parent of any newly-created Span at\n Tracer.start_active_span() time.\n\n Return:\n ...
https://github.com/matrix-org/synapse.git
1
isocalendar
def isocalendar(self): return self._get_values().isocalendar().set_index(self._parent.index)
5531195f6f0d87817a704b288008809a3c98a304
11
accessors.py
44
fix-ci-isocalendar (#46690)
39,746
0
18
25
4
165,949
4
pandas
6
pandas/core/indexes/accessors.py
Python
2
{ "docstring": "\n Calculate year, week, and day according to the ISO 8601 standard.\n\n .. versionadded:: 1.1.0\n\n Returns\n -------\n DataFrame\n With columns year, week and day.\n\n See Also\n --------\n Timestamp.isocalendar : Function return a 3...
https://github.com/pandas-dev/pandas.git
9
update
def update(self, user=None, next_task=None): if self.status != self.STATUS_IN_PROGRESS: # Updating a completed or cancelled workflow should have no effect return try: current_status = self.current_task_state.status except AttributeError: c...
d10f15e55806c6944827d801cd9c2d53f5da4186
17
__init__.py
275
Reformat with black
16,154
0
630
168
71
73,874
129
wagtail
22
wagtail/core/models/__init__.py
Python
29
{ "docstring": "Checks the status of the current task, and progresses (or ends) the workflow if appropriate. If the workflow progresses,\n next_task will be used to start a specific task next if provided.", "language": "en", "n_whitespaces": 37, "n_words": 31, "vocab_size": 26 }
https://github.com/wagtail/wagtail.git
2
new_name
def new_name(self, template="xxx_todo_changeme"): name = template while name in self.used_names: name = template + str(next(self.numbers)) self.used_names.add(name) return name
8198943edd73a363c266633e1aa5b2a9e9c9f526
14
fixer_base.py
73
add python 3.10.4 for windows
55,411
0
64
43
13
218,598
18
XX-Net
9
python3.10.4/Lib/lib2to3/fixer_base.py
Python
6
{ "docstring": "Return a string suitable for use as an identifier\n\n The new name is guaranteed not to conflict with other identifiers.\n ", "language": "en", "n_whitespaces": 34, "n_words": 20, "vocab_size": 20 }
https://github.com/XX-net/XX-Net.git
4
getxmp
def getxmp(self): for segment, content in self.applist: if segment == "APP1": marker, xmp_tags = content.rsplit(b"\x00", 1) if marker == b"http://ns.adobe.com/xap/1.0/": return self._getxmp(xmp_tags) return {}
601c9d8515dba996af3f0b96d1a671619de37f10
13
JpegImagePlugin.py
83
Fix return in docs
69,830
0
105
49
21
242,323
24
Pillow
9
src/PIL/JpegImagePlugin.py
Python
7
{ "docstring": "\n Returns a dictionary containing the XMP tags.\n Requires defusedxml to be installed.\n\n :returns: XMP tags in a dictionary.\n ", "language": "en", "n_whitespaces": 47, "n_words": 18, "vocab_size": 16 }
https://github.com/python-pillow/Pillow.git
1
alias
def alias(self, *args, **kwargs): self._not_support_combined_queries("alias") return self._annotate(args, kwargs, select=False)
9c19aff7c7561e3a82978a272ecdaad40dda5c00
8
query.py
51
Refs #33476 -- Reformatted code with Black.
51,184
0
30
31
9
205,739
9
django
7
django/db/models/query.py
Python
3
{ "docstring": "\n Return a query set with added aliases for extra data or aggregations.\n ", "language": "en", "n_whitespaces": 27, "n_words": 12, "vocab_size": 12 }
https://github.com/django/django.git
2
agg
def agg(self, agg): assert isinstance(agg, str) agg_exprs = OrderedDict() for col in self.columns: agg_exprs[col] = AggregateExpr(agg, self.ref(col)) return self.__constructor__( columns=self.columns, dtypes=self._dtypes_for_exprs(agg_exprs)...
e5b1888cd932909e49194d58035da34b210b91c4
13
dataframe.py
138
FEAT-#4946: Replace OmniSci with HDK (#4947) Co-authored-by: Iaroslav Igoshev <Poolliver868@mail.ru> Signed-off-by: Andrey Pavlenko <andrey.a.pavlenko@gmail.com>
36,085
0
137
92
28
154,575
29
modin
18
modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py
Python
12
{ "docstring": "\n Perform specified aggregation along columns.\n\n Parameters\n ----------\n agg : str\n Name of the aggregation function to perform.\n\n Returns\n -------\n HdkOnNativeDataframe\n New frame containing the result of aggregation.\n...
https://github.com/modin-project/modin.git
5
get_feature_names_out
def get_feature_names_out(self, input_features=None): powers = self.powers_ input_features = _check_feature_names_in(self, input_features) feature_names = [] for row in powers: inds = np.where(row)[0] if len(inds): name = " ".join( ...
279388d9ed2ea83194dd45a2d78161be30b43aa7
16
_polynomial.py
176
DOC Improve get_feature_names_out docstrings (#22718) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
75,579
0
258
111
41
259,120
51
scikit-learn
21
sklearn/preprocessing/_polynomial.py
Python
17
{ "docstring": "Get output feature names for transformation.\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 `f...
https://github.com/scikit-learn/scikit-learn.git
1
revert_challenge_config
def revert_challenge_config(self) -> None: self.revert_temporary_config() self.new_vhost = None self.parser.load()
16aad35d31a887dab157f9d4f5e0fe9218d06064
8
configurator.py
45
Fully type certbot-nginx module (#9124) * Work in progress * Fix type * Work in progress * Work in progress * Work in progress * Work in progress * Work in progress * Oups. * Fix typing in UnspacedList * Fix logic * Finish typing * List certbot-nginx as fully typed in tox * Fix lint...
45,497
0
37
25
9
186,581
9
certbot
6
certbot-nginx/certbot_nginx/_internal/configurator.py
Python
9
{ "docstring": "Used to cleanup challenge configurations.\n\n :raises .errors.PluginError: If unable to revert the challenge config.\n\n ", "language": "en", "n_whitespaces": 28, "n_words": 14, "vocab_size": 12 }
https://github.com/certbot/certbot.git
7
execute
def execute(): frappe.reload_doc("Accounts", "doctype", "Salary Component Account") if frappe.db.has_column("Salary Component Account", "default_account"): rename_field("Salary Component Account", "default_account", "account") doctype_list = [ {"module": "HR", "doctype": "Employee Advance"}, {"module": "HR",...
494bd9ef78313436f0424b918f200dab8fc7c20b
17
updates_for_multi_currency_payroll.py
773
style: format code with black
14,360
0
197
415
133
66,842
285
erpnext
24
erpnext/patches/v13_0/updates_for_multi_currency_payroll.py
Python
106
{ "docstring": "\n\t\t\tupdate `tab{doctype}`\n\t\t\tset company = (select company from tabEmployee where name=`tab{doctype}`.employee)\n\t\tupdate `tab{doctype}` set currency = %s where company=%s\n\t\t\tupdate `tabPayroll Entry`\n\t\t\tset currency = %s,\n\t\t\t\texchange_rate = 1,\n\t\t\t\tpayroll_payable_account=...
https://github.com/frappe/erpnext.git
5
get_libdir
def get_libdir(self): # Module unavailable if not self.available: raise ValueError(f"Module {self.name} {self.version} is unavailable!") # Module has no associated shared libraries if not self.sharedlibs: return None for lib in self.sharedlibs: ...
684bfac8adcf254fec5777f212c13eb62181f900
14
gi.py
143
hooks: refactor GObject introspection (gi) hooks The modules imported from gi.repository are marked as runtime modules by their corresponding pre-safe-import-module hooks. Therefore, their standard hooks are always loaded and executed, regardless of whether the modue is actually importable or not. In PyInstaller v5, ...
77,455
0
156
64
37
263,831
48
pyinstaller
13
PyInstaller/utils/hooks/gi.py
Python
10
{ "docstring": "\n Return the path to shared library used by the module. If no libraries are associated with the typelib, None is\n returned. If multiple library names are associated with the typelib, the path to the first resolved shared\n library is returned. Raises exception if module is unava...
https://github.com/pyinstaller/pyinstaller.git
2
ratio
def ratio(self): matches = sum(triple[-1] for triple in self.get_matching_blocks()) return _calculate_ratio(matches, len(self.a) + len(self.b))
8198943edd73a363c266633e1aa5b2a9e9c9f526
11
difflib.py
70
add python 3.10.4 for windows
56,607
0
35
43
14
222,511
14
XX-Net
10
python3.10.4/Lib/difflib.py
Python
3
{ "docstring": "Return a measure of the sequences' similarity (float in [0,1]).\n\n Where T is the total number of elements in both sequences, and\n M is the number of matches, this is 2.0*M / T.\n Note that this is 1 if the sequences are identical, and 0 if\n they have nothing in common.\...
https://github.com/XX-net/XX-Net.git
2
_linear_eq_to_dict_inner
def _linear_eq_to_dict_inner(eqs, syms): syms = set(syms) eqsdict, ind = [], [] for eq in eqs: c, eqdict = _lin_eq2dict(eq, syms) eqsdict.append(eqdict) ind.append(c) return eqsdict, ind
041eeb41b6a083dd106a0e6316d6f07e2248cd61
10
linsolve.py
88
linear_coeffs has nonstrict option
49,076
0
61
54
21
198,995
25
sympy
11
sympy/polys/matrices/linsolve.py
Python
8
{ "docstring": "Convert a system Expr/Eq equations into dict form, returning\n the coefficient dictionaries and a list of syms-independent terms\n from each expression in ``eqs```.\n\n Examples\n ========\n\n >>> from sympy.polys.matrices.linsolve import _linear_eq_to_dict_inner as F\n >>> from symp...
https://github.com/sympy/sympy.git
3
construct_actor_groups
def construct_actor_groups(actors): actor_groups = _group_actors_by_python_class(actors) stats_by_group = { name: _get_actor_group_stats(group) for name, group in actor_groups.items() } summarized_actor_groups = {} for name, group in actor_groups.items(): summarized_actor_group...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
11
actor_utils.py
110
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,041
0
98
67
24
129,861
34
ray
10
dashboard/modules/actor/actor_utils.py
Python
12
{ "docstring": "actors is a dict from actor id to an actor or an\n actor creation task The shared fields currently are\n \"actorClass\", \"actorId\", and \"state\" ", "language": "en", "n_whitespaces": 30, "n_words": 24, "vocab_size": 21 }
https://github.com/ray-project/ray.git
1
test_change_view_history_link
def test_change_view_history_link(self): url = reverse( "admin:%s_modelwithstringprimarykey_change" % ModelWithStringPrimaryKey._meta.app_label, args=(quote(self.pk),), ) response = self.client.get(url) self.assertEqual(response.status_code, 2...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
13
tests.py
144
Refs #33476 -- Reformatted code with Black.
52,085
0
171
89
22
207,753
31
django
18
tests/admin_views/tests.py
Python
16
{ "docstring": "Object history button link should work and contain the pk value quoted.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
https://github.com/django/django.git
10
generate_dimino
def generate_dimino(self, af=False): idn = list(range(self.degree)) order = 0 element_list = [idn] set_element_list = {tuple(idn)} if af: yield idn else: yield _af_new(idn) gens = [p._array_form for p in self.generators] f...
498015021131af4dbb07eb110e5badaba8250c7b
23
perm_groups.py
305
Updated import locations
47,647
0
728
187
68
196,147
106
sympy
30
sympy/combinatorics/perm_groups.py
Python
32
{ "docstring": "Yield group elements using Dimino's algorithm.\n\n If ``af == True`` it yields the array form of the permutations.\n\n Examples\n ========\n\n >>> from sympy.combinatorics import Permutation, PermutationGroup\n >>> a = Permutation([0, 2, 1, 3])\n >>> b = Permu...
https://github.com/sympy/sympy.git
4
size
def size(self) -> DataFrame | Series: result = self.grouper.size() if self.axis == 1: return DataFrame( data=np.tile(result.values, (self.obj.shape[0], 1)), columns=result.index, index=self.obj.index, ) # GH28330 ...
15a06d3d9e7656afff239da7a295a7b684456680
16
groupby.py
214
BUG: groupby.size and groupby.transform('size') incorrect for axis=1 (#45987)
39,620
0
228
135
49
164,913
60
pandas
24
pandas/core/groupby/groupby.py
Python
24
{ "docstring": "\n Compute group sizes.\n\n Returns\n -------\n DataFrame or Series\n Number of rows in each group as a Series if as_index is True\n or a DataFrame if as_index is False.\n ", "language": "en", "n_whitespaces": 86, "n_words": 28, "vocab_s...
https://github.com/pandas-dev/pandas.git
7
_iter_requires_txt_entries
def _iter_requires_txt_entries(self) -> Iterator[RequiresEntry]: content = self._dist.read_text("requires.txt") if content is None: return extra = marker = "" # Section-less entries don't have markers. for line in content.splitlines(): line = line.strip(...
c69d55f7c82d5ae2cce542bcfb98d043ca4836a0
15
_dists.py
191
Vendor in pip 22.1.2
3,750
0
195
108
44
21,283
57
pipenv
17
pipenv/patched/notpip/_internal/metadata/importlib/_dists.py
Python
23
{ "docstring": "Parse a ``requires.txt`` in an egg-info directory.\n\n This is an INI-ish format where an egg-info stores dependencies. A\n section name describes extra other environment markers, while each entry\n is an arbitrary string (not a key-value pair) representing a dependency\n a...
https://github.com/pypa/pipenv.git
6
named_parameters
def named_parameters(self, *args, **kwargs): arch = kwargs.pop('arch', False) for name, p in super().named_parameters(*args, **kwargs): if any(name == par_name for par_name in self._arch_parameter_names): if arch: yield name, p else: ...
14d2966b9e91ae16dcc39de8f41017a75cec8ff9
14
differentiable.py
117
Valuechoice oneshot lightning (#4602)
24,602
0
145
71
22
112,161
34
nni
12
nni/retiarii/oneshot/pytorch/supermodule/differentiable.py
Python
9
{ "docstring": "Named parameters excluding architecture parameters.", "language": "en", "n_whitespaces": 4, "n_words": 5, "vocab_size": 5 }
https://github.com/microsoft/nni.git
2
get_stats
def get_stats(self) -> SystemStats: deleted = self.db.query(Message.deleted, func.count()).group_by(Message.deleted) nthreads = self.db.query(None, func.count(Message.id)).filter(Message.parent_id.is_(None)) query = deleted.union_all(nthreads) result = {k: v for k, v in query.al...
ef3a35ff9c9da7aab45e6f40103f32558f861e9b
13
prompt_repository.py
222
fixes
54,687
0
131
146
31
216,799
38
Open-Assistant
23
backend/oasst_backend/prompt_repository.py
Python
15
{ "docstring": "\n Get data stats such as number of all messages in the system,\n number of deleted and active messages and number of message trees.\n ", "language": "en", "n_whitespaces": 45, "n_words": 23, "vocab_size": 17 }
https://github.com/LAION-AI/Open-Assistant.git
1
make_sampling_table
def make_sampling_table(size, sampling_factor=1e-5): gamma = 0.577 rank = np.arange(size) rank[0] = 1 inv_fq = rank * (np.log(rank) + gamma) + 0.5 - 1. / (12. * rank) f = sampling_factor * inv_fq return np.minimum(1., f / np.sqrt(f)) @keras_export('keras.preprocessing.sequence.skipgrams')
f1aa8b7d2a0c89591c5c42eca5b6f013114a7bbd
@keras_export('keras.preprocessing.sequence.skipgrams')
13
sequence.py
125
Copy sequence utils from keras_preprocessing directly into core keras PiperOrigin-RevId: 424915569
79,742
1
44
81
27
268,874
38
keras
13
keras/preprocessing/sequence.py
Python
7
{ "docstring": "Generates a word rank-based probabilistic sampling table.\n\n Used for generating the `sampling_table` argument for `skipgrams`.\n `sampling_table[i]` is the probability of sampling\n the word i-th most common word in a dataset\n (more common words should be sampled less frequently, for balance).\...
https://github.com/keras-team/keras.git
3
execute
def execute(): company = frappe.get_all("Company", filters={"country": "India"}) if not company: return frappe.reload_doc("Payroll", "doctype", "payroll_period") frappe.reload_doc("Payroll", "doctype", "employee_tax_exemption_declaration") frappe.reload_doc("Payroll", "doctype", "employee_tax_exemption_proof_su...
494bd9ef78313436f0424b918f200dab8fc7c20b
12
sync_india_custom_fields.py
241
style: format code with black
14,367
0
27
126
34
66,869
47
erpnext
10
erpnext/patches/v8_7/sync_india_custom_fields.py
Python
31
{ "docstring": "delete from `tabCustom Field` where dt = %s\n\t\t\tand fieldname in ('port_code', 'shipping_bill_number', 'shipping_bill_date')\n\t\tupdate `tabCustom Field`\n\t\tset reqd = 0, `default` = ''\n\t\twhere fieldname = 'reason_for_issuing_document'\n\t\n\t\tupdate tabAddress\n\t\tset gst_state_number=conc...
https://github.com/frappe/erpnext.git
3
run
def run(self, request, pk): # Check that the user has permission to run reports. if not request.user.has_perm('extras.run_report'): raise PermissionDenied("This user does not have permission to run reports.") # Check that at least one RQ worker is running if not Wor...
36d6ae33d15e93cc552827cdea363a9c00c7f823
12
views.py
201
Allow setting individual timeouts on scripts and reports
77,772
0
249
118
62
264,636
84
netbox
32
netbox/extras/api/views.py
Python
17
{ "docstring": "\n Run a Report identified as \"<module>.<script>\" and return the pending JobResult as the result\n ", "language": "en", "n_whitespaces": 29, "n_words": 14, "vocab_size": 12 }
https://github.com/netbox-community/netbox.git
1
test_purge_room_and_not_block
def test_purge_room_and_not_block(self) -> None: # Test that room is not purged with self.assertRaises(AssertionError): self._is_purged(self.room_id) # Test that room is not blocked self._is_blocked(self.room_id, expect=False) # Assert one user in room ...
c97042f7eef3748e17c90e48a4122389a89c4735
12
test_room.py
298
Use literals in place of `HTTPStatus` constants in tests (#13469)
72,642
0
231
183
45
249,135
57
synapse
24
tests/rest/admin/test_room.py
Python
22
{ "docstring": "Test to purge a room and do not block it.\n Members will not be moved to a new room and will not receive a message.\n ", "language": "en", "n_whitespaces": 39, "n_words": 25, "vocab_size": 17 }
https://github.com/matrix-org/synapse.git
1
get_next_connection
async def get_next_connection(self): return await self._get_next_connection(num_retries=3)
d21870ac47fc1594b45a5f01ee48cddf5c18b2ff
9
networking.py
30
fix: fix reconnect issues (#4941)
2,365
0
20
16
6
12,659
6
jina
4
jina/serve/networking.py
Python
2
{ "docstring": "\n Returns a connection from the list. Strategy is round robin\n :returns: A connection from the pool\n ", "language": "en", "n_whitespaces": 38, "n_words": 16, "vocab_size": 13 }
https://github.com/jina-ai/jina.git
3
load_data_for_viz
def load_data_for_viz(load_type, model_file_statistics, dtype=int, ground_truth_split=2) -> Dict[str, Any]: supported_load_types = dict( load_json=load_json, load_from_file=partial(load_from_file, dtype=dtype, ground_truth_split=ground_truth_split), ) loader = supported_load_types[load_...
4f40ffec8e81eb3f6385243498babe1409a675be
12
visualize.py
131
Changes learning_curves to use "step" or "epoch" as x-axis label. (#2578) * Started building dataclasses for model training output. * Adds EvaluationFrequency to training stats, dataclasses for training results. * Adds x_label, x_step to learning_curves. * fix x axis when using checkpoints_per_epoch. * Fix...
1,405
0
106
84
44
8,364
47
ludwig
21
ludwig/visualize.py
Python
19
{ "docstring": "Load JSON files (training stats, evaluation stats...) for a list of models.\n\n :param load_type: type of the data loader to be used.\n :param model_file_statistics: JSON file or list of json files containing any\n model experiment stats.\n :return List of training statistics loaded...
https://github.com/ludwig-ai/ludwig.git
7
check_input_folder
def check_input_folder(self) -> Optional[cv2.VideoCapture]: err = None loadtype = self.__class__.__name__ if not self.folder: err = f"ERROR: A {loadtype} folder must be specified" elif not os.path.exists(self.folder): err = f"ERROR: The {loadtype} locatio...
e2a77e7c6e84e81f642cb22f528e25e3f2d2dbc1
14
media.py
252
Alignments Tool - Typing, Documentation + Re-org
21,148
0
300
140
65
101,744
94
faceswap
23
tools/alignments/media.py
Python
27
{ "docstring": " makes sure that the frames or faces folder exists\n If frames folder contains a video file return imageio reader object\n\n Returns\n -------\n :class:`cv2.VideoCapture`\n Object for reading a video stream\n ", "language": "en", "n_whitespaces": 8...
https://github.com/deepfakes/faceswap.git
2
generate_heatmap
def generate_heatmap(logits, num_classes): keypoint_colours = np.array([plt.cm.spectral(x) for x in np.linspace(0, 1, num_classes + 1)])[ ..., :3].astype(np.float32) prediction = tf.nn.softmax(logits) heatmap = tf.matmul(tf.reshape(prediction, (-1, num_classes + 1)), keypoint_colours) hea...
7375ee364e0df2a417f92593e09557f1b2a3575a
16
utils.py
195
initialize ostec
1,586
0
129
131
29
9,335
36
insightface
21
reconstruction/ostec/external/landmark_detector/utils.py
Python
9
{ "docstring": "Generates a coloured heatmap from the keypoint logits.\n\n Args:\n features: A `Tensor` of dimensions [num_batch, height, width, FLAGS.n_landmarks + 1].\n ", "language": "en", "n_whitespaces": 33, "n_words": 20, "vocab_size": 20 }
https://github.com/deepinsight/insightface.git
1
update_worker_pea_args
def update_worker_pea_args(self): self.peas_args['peas'] = self._set_peas_args(self.args)
933415bfa1f9eb89f935037014dfed816eb9815d
9
__init__.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,761
0
19
21
5
9,894
5
jina
5
jina/peapods/pods/__init__.py
Python
2
{ "docstring": " Update args of all its worker peas based on Pod args. Does not touch head and tail", "language": "en", "n_whitespaces": 17, "n_words": 17, "vocab_size": 17 }
https://github.com/jina-ai/jina.git
1
to_local_object_without_private_data_child
def to_local_object_without_private_data_child(self) -> SingleEntityPhiTensor: public_shape = getattr(self, "public_shape", None) public_dtype = getattr(self, "public_dtype", None) return Tensor( child=SingleEntityPhiTensor( child=FixedPrecisionTensor(value=...
a90188ecc017971b64778aa0ff41127a9d5d9d44
14
single_entity_phi.py
121
working fpt for SMPC+DP
125
0
188
79
26
803
32
PySyft
14
packages/syft/src/syft/core/tensor/autodp/single_entity_phi.py
Python
16
{ "docstring": "Convert this pointer into a partial version of the SingleEntityPhiTensor but without\n any of the private data therein.", "language": "en", "n_whitespaces": 24, "n_words": 18, "vocab_size": 16 }
https://github.com/OpenMined/PySyft.git
6
_measurements
def _measurements(self): ismeasured = {} for i,g in enumerate(self._gates()): if getattr(g,'measurement',False): for target in g.targets: if target in ismeasured: if ismeasured[target] > i: ismea...
55c2eba0fc6eefa30c07e2e76795c1df89488b11
17
circuitplot.py
113
Update documentation
48,582
0
197
70
20
197,501
32
sympy
10
sympy/physics/quantum/circuitplot.py
Python
11
{ "docstring": "Return a dict ``{i:j}`` where i is the index of the wire that has\n been measured, and j is the gate where the wire is measured.\n ", "language": "en", "n_whitespaces": 40, "n_words": 26, "vocab_size": 19 }
https://github.com/sympy/sympy.git
1
parse_example_proto_and_decode
def parse_example_proto_and_decode(example_serialized): image_buffer, label = _parse_example_proto(example_serialized) image_buffer = tf.reshape(image_buffer, shape=[]) image_buffer = tf.io.decode_jpeg(image_buffer, channels=NUM_CHANNELS) return image_buffer, label
02f911ce78137cb63ecb685a8ef8e56dcb60062c
10
tf_utils.py
73
Benchmarking Ray Data bulk ingest as input file size changes. (#29296) This PR adds a benchmark which takes work from https://github.com/anyscale/air-benchmarks and makes it run as a release test. Full metrics are stored in Databricks. Signed-off-by: Cade Daniel <cade@anyscale.com>
30,205
0
32
45
12
134,154
17
ray
12
release/air_tests/air_benchmarks/mlperf-train/tf_utils.py
Python
5
{ "docstring": "Parses an example and decodes the image to prepare for caching.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/ray-project/ray.git
3
get_currency
def get_currency(filters): company = get_appropriate_company(filters) company_currency = get_company_currency(company) presentation_currency = ( filters["presentation_currency"] if filters.get("presentation_currency") else company_currency ) report_date = filters.get("to_date") if not report_date: fiscal_...
494bd9ef78313436f0424b918f200dab8fc7c20b
14
utils.py
161
style: format code with black
13,877
0
23
95
29
65,389
40
erpnext
15
erpnext/accounts/report/utils.py
Python
17
{ "docstring": "\n\tReturns a dictionary containing currency information. The keys of the dict are\n\t- company: The company for which we are fetching currency information. if no\n\tcompany is specified, it will fallback to the default company.\n\t- company currency: The functional currency of the said company.\n\t- ...
https://github.com/frappe/erpnext.git
1
test_query_order_fields_order_with_new_id_by_anonymous_user
def test_query_order_fields_order_with_new_id_by_anonymous_user(order, api_client): # given variables = {"id": graphene.Node.to_global_id("Order", order.pk)} # when response = api_client.post_graphql(QUERY_ORDER_FIELDS_BY_ID, variables) # then content = get_graphql_content(response) a...
71c19c951bcfba66fa9a9ee5809a46ad3af8f11f
12
test_order.py
194
Allow fetching by id all order data for new orders (#9728)
5,103
0
106
109
28
27,234
39
saleor
17
saleor/graphql/order/tests/test_order.py
Python
14
{ "docstring": "Ensure that all fields that are available for order owner can be fetched with\n use of new id by the customer user.", "language": "en", "n_whitespaces": 24, "n_words": 22, "vocab_size": 21 }
https://github.com/saleor/saleor.git
1
mkdtemp
def mkdtemp(self): d = tempfile.mkdtemp() self.tempdirs.append(d) return d
8198943edd73a363c266633e1aa5b2a9e9c9f526
8
support.py
41
add python 3.10.4 for windows
56,849
0
36
23
7
223,013
8
XX-Net
6
python3.10.4/Lib/distutils/tests/support.py
Python
4
{ "docstring": "Create a temporary directory that will be cleaned up.\n\n Returns the path of the directory.\n ", "language": "en", "n_whitespaces": 29, "n_words": 15, "vocab_size": 14 }
https://github.com/XX-net/XX-Net.git
3
__str__
def __str__(self): call_str = f'db.{self.collection}' for step in self.pipeline: args_str = [] for arg in step['args']: args_str.append(MongoJSONEncoder().encode(arg)) call_str += f'.{step["method"]}({",".join(args_str)})' return call...
d5b6d8cf5bd69a1f3427bac153fa09159dfe96d0
15
mongodb_query.py
113
added converters: - mongo to str - str to mongo creating predictor from sql using mongo data tests
25,455
0
98
48
17
115,416
22
mindsdb
12
mindsdb/integrations/handlers/mongodb_handler/utils/mongodb_query.py
Python
8
{ "docstring": "\n converts call to string\n\n {\n 'collection': 'fish',\n 'call': [ // call is sequence of methods\n {\n 'method': 'find',\n 'args': [{a:1}, {b:2}]\n },\n {\n 'm...
https://github.com/mindsdb/mindsdb.git
1
pairwise
def pairwise(iterable): # type: (Iterable[Any]) -> Iterator[Tuple[Any, Any]] iterable = iter(iterable) return zip_longest(iterable, iterable)
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
8
misc.py
34
upd; format
12,448
0
26
19
14
61,223
14
transferlearning
4
.venv/lib/python3.8/site-packages/pip/_internal/utils/misc.py
Python
3
{ "docstring": "\n Return paired elements.\n\n For example:\n s -> (s0, s1), (s2, s3), (s4, s5), ...\n ", "language": "en", "n_whitespaces": 31, "n_words": 14, "vocab_size": 14 }
https://github.com/jindongwang/transferlearning.git
6
complete_code
def complete_code(accelerator, model, tokenizer, dataloader, n_tasks, batch_size=20, **gen_kwargs): gen_token_dict = defaultdict(list) # dict of list of generated tokens for step, batch in tqdm(enumerate(dataloader)): with torch.no_grad(): gen_kwargs["stopping_criteria"][0].start_lengt...
4868a830db5f19f56712f540979d637368221d50
17
human_eval.py
387
Jia multi gpu eval (#16428) * add simple multi gpu complet * add human_eval_multi_gpu * use copy strategy to distribute across gpu, to avoid padding * add doc string * update code style * use task id to arrange output * truncate input to avoid zero pad * Stop the copy mechanism * update style ...
6,716
0
317
246
66
37,029
96
transformers
46
examples/research_projects/codeparrot/scripts/human_eval.py
Python
23
{ "docstring": "Generate multiple codes for each task in the dataset. This function leverage accelerator to distribute\n the processing to multiple GPUs.\n dataloader, a wrapper around a TokenizeDataset objectm is supposed to send all the prompts from\n the evalution dataset to the modelm as the following:\n...
https://github.com/huggingface/transformers.git
16
delegate_command
def delegate_command(args, host_state, exclude, require): # type: (EnvironmentConfig, HostState, t.List[str], t.List[str]) -> None con = host_state.controller_profile.get_origin_controller_connection() working_directory = host_state.controller_profile.get_working_directory() host_delegation = not isin...
a06fa496d3f837cca3c437ab6e9858525633d147
17
delegation.py
803
ansible-test - Code cleanup and refactoring. (#77169) * Remove unnecessary PyCharm ignores. * Ignore intentional undefined attribute usage. * Add missing type hints. Fix existing type hints. * Fix docstrings and comments. * Use function to register completion handler. * Pass strings to display functions. * Fix C...
78,575
0
770
487
154
266,772
231
ansible
76
test/lib/ansible_test/_internal/delegation.py
Python
57
{ "docstring": "Delegate execution based on the provided host state.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/ansible/ansible.git
6
decrypt_string
def decrypt_string(self, content, key=0): # precondition assert isinstance(key, int) and isinstance(content, str) key = key or self.__key or 1 # make sure key can be any size while key > 255: key -= 255 # This will be returned ans = "" ...
f0af0c43340763724f139fa68aa1e5a9ffe458b4
13
XOR_cipher.py
105
refactor: clean code Signed-off-by: slowy07 <slowy.arfy@gmail.com>
4,360
0
145
64
42
22,544
53
Python
12
XORcipher/XOR_cipher.py
Python
9
{ "docstring": "\n input: 'content' of type string and 'key' of type int\n output: decrypted string 'content'\n if key not passed the method uses the key by the constructor.\n otherwise key = 1\n ", "language": "en", "n_whitespaces": 66, "n_words": 30, "vocab_size": 22 }
https://github.com/geekcomputers/Python.git