complexity
int64
1
139
fun_name
stringlengths
1
80
code
stringlengths
101
62.2k
commit_id
stringlengths
40
40
ast_errors
stringlengths
0
3.11k
ast_levels
int64
6
36
file_name
stringlengths
5
79
n_ast_nodes
int64
17
19.2k
commit_message
stringlengths
3
15.3k
d_id
int64
12
121k
n_ast_errors
int64
0
9
n_whitespaces
int64
4
10.8k
token_counts
int64
5
3.06k
vocab_size
int64
4
1.11k
id
int64
20
338k
n_words
int64
4
4.82k
repo
stringlengths
3
22
n_identifiers
int64
2
176
path
stringlengths
7
134
language
stringclasses
1 value
nloc
int64
1
413
documentation
dict
url
stringlengths
31
59
1
get_word_index
def get_word_index(path="reuters_word_index.json"): origin_folder = ( "https://storage.googleapis.com/tensorflow/tf-keras-datasets/" ) path = get_file( path, origin=origin_folder + "reuters_word_index.json", file_hash="4d44cc38712099c9e383dc6e5f11a921", ) with op...
84afc5193d38057e2e2badf9c889ea87d80d8fbf
11
reuters.py
83
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
80,402
0
75
45
20
270,139
22
keras
10
keras/datasets/reuters.py
Python
11
{ "docstring": "Retrieves a dict mapping words to their index in the Reuters dataset.\n\n Args:\n path: where to cache the data (relative to `~/.keras/dataset`).\n\n Returns:\n The word index dictionary. Keys are word strings, values are their index.\n ", "language": "en", "n_whitespaces": ...
https://github.com/keras-team/keras.git
3
test_flow_run_respects_extra_loggers
async def test_flow_run_respects_extra_loggers(orion_client, logger_test_deployment): flow_run = await orion_client.create_flow_run_from_deployment( logger_test_deployment ) await SubprocessFlowRunner( env={"PREFECT_LOGGING_EXTRA_LOGGERS": "foo"} ).submit_flow_run(flow_run, MagicMo...
b110baccdbfde300f410b069c873e8b2a2c98e00
@pytest.mark.parametrize("name", ["default", None, ""])
14
test_logging.py
311
Add test
10,716
1
165
163
62
53,099
88
prefect
35
tests/test_logging.py
Python
20
{ "docstring": "\n Runs a flow in a subprocess to check that PREFECT_LOGGING_EXTRA_LOGGERS works as\n intended. This avoids side-effects of modifying the loggers in this test run without\n confusing mocking.\n ", "language": "en", "n_whitespaces": 40, "n_words": 27, "vocab_size": 25 }
https://github.com/PrefectHQ/prefect.git
5
save
def save(self): s = self._read_from_storage() # type: _Settings for k, v in self.__dict__.items(): if k[0] == '_': continue if hasattr(s, k): setattr(s, k, v) log.debug("_ConfigSQL updating storage") self._session.merge(...
4ea80e9810a14ca3617f08a4ae5cfa6b50482e9a
11
config_sql.py
170
Code cosmetics
40,839
0
182
99
38
173,342
40
calibre-web
20
cps/config_sql.py
Python
15
{ "docstring": "Apply all configuration values to the underlying storage.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/janeczku/calibre-web.git
3
try_all_gpus
def try_all_gpus(): num_gpus = len(tf.config.experimental.list_physical_devices('GPU')) devices = [tf.device(f'/GPU:{i}') for i in range(num_gpus)] return devices if devices else [tf.device('/CPU:0')]
b64b41d8c1ac23c43f7a4e3f9f6339d6f0012ab2
12
tensorflow.py
91
[PaddlePaddle] Merge master into Paddle branch (#1186) * change 15.2 title in chinese version (#1109) change title ’15.2. 情感分析:使用递归神经网络‘ to ’15.2. 情感分析:使用循环神经网络‘ * 修改部分语义表述 (#1105) * Update r0.17.5 (#1120) * Bump versions in installation * 94行typo: (“bert.mall”)->(“bert.small”) (#1129) * line 313: "b...
37,441
0
30
51
15
158,288
18
d2l-zh
11
d2l/tensorflow.py
Python
4
{ "docstring": "Return all available GPUs, or [cpu(),] if no GPU exists.\n\n Defined in :numref:`sec_use_gpu`", "language": "en", "n_whitespaces": 15, "n_words": 13, "vocab_size": 13 }
https://github.com/d2l-ai/d2l-zh.git
1
gen_fake_dataset
def gen_fake_dataset(): # For fake dataset, since the dataset is randomized, we create it once on the # driver, and then send the same dataset to all the training workers. # Use 10% of nodes for validation and 10% for testing. fake_dataset = FakeDataset(transform=RandomNodeSplit(num_val=0.1, num_t...
732175e2458ec671c80484bcd35150dcdc7e600b
12
distributed_sage_example.py
41
[AIR] Add distributed `torch_geometric` example (#23580) Add example for distributed pytorch geometric (graph learning) with Ray AIR This only showcases distributed training, but with data small enough that it can be loaded in by each training worker individually. Distributed data ingest is out of scope for this PR...
34,236
0
60
30
36
148,314
45
ray
7
python/ray/ml/examples/pytorch_geometric/distributed_sage_example.py
Python
4
{ "docstring": "Returns a function to be called on each worker that returns a Fake Dataset.", "language": "en", "n_whitespaces": 13, "n_words": 14, "vocab_size": 13 }
https://github.com/ray-project/ray.git
9
read_dict
def read_dict(self, dictionary, source='<dict>'): elements_added = set() for section, keys in dictionary.items(): section = str(section) try: self.add_section(section) except (DuplicateSectionError, ValueError): if self._strict...
8198943edd73a363c266633e1aa5b2a9e9c9f526
14
configparser.py
222
add python 3.10.4 for windows
56,469
0
298
141
42
221,674
60
XX-Net
19
python3.10.4/Lib/configparser.py
Python
18
{ "docstring": "Read configuration from a dictionary.\n\n Keys are section names, values are dictionaries with keys and values\n that should be present in the section. If the used dictionary type\n preserves order, sections and their keys will be added in order.\n\n All types held in the d...
https://github.com/XX-net/XX-Net.git
1
get_deployment_statuses
def get_deployment_statuses() -> Dict[str, DeploymentStatusInfo]: return internal_get_global_client().get_deployment_statuses()
1100c982223757f697a410a0d0c3d8bf3ff9c805
9
api.py
35
[serve] Implement Serve Application object (#22917) The concept of a Serve Application, a data structure containing all information needed to deploy Serve on a Ray cluster, has surfaced during recent design discussions. This change introduces a formal Application data structure and refactors existing code to use it.
33,628
0
13
20
7
146,198
7
ray
5
python/ray/serve/api.py
Python
18
{ "docstring": "Returns a dictionary of deployment statuses.\n\n A deployment's status is one of {UPDATING, UNHEALTHY, and HEALTHY}.\n\n Example:\n\n >>> statuses = get_deployment_statuses()\n >>> status_info = statuses[\"deployment_name\"]\n >>> status = status_info.status\n >>> message = status_in...
https://github.com/ray-project/ray.git
1
test_remove_config_entry_from_device_fails
async def test_remove_config_entry_from_device_fails(hass, hass_ws_client): assert await async_setup_component(hass, "config", {}) ws_client = await hass_ws_client(hass) device_registry = mock_device_registry(hass)
c496748125b811ef5437ad666d21c09025e0967f
9
test_device_registry.py
56
Add WS API for removing a config entry from a device (#66188) * Add WS API for removing a config entry from a device * Address review comments * Address review comments * Remove entity cleanup from ConfigEntries * Update + add tests * Improve comments in test * Add negative test * Refactor accordi...
91,454
0
28
617
14
292,362
16
core
7
tests/components/config/test_device_registry.py
Python
132
{ "docstring": "Test removing config entry from device failing cases.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/home-assistant/core.git
6
geometric_edges
def geometric_edges(G, radius, p=2): nodes_pos = G.nodes(data="pos") try: import scipy as sp import scipy.spatial # call as sp.spatial except ImportError: # no scipy KDTree so compute by for-loop radius_p = radius**p edges = [ (u, v) for ...
ad99a5862264355d5eaaa309136475bfb9a66c12
@py_random_state(5)
18
geometric.py
247
Add default value p=2 for minkowski distance metric. (#5700)
42,122
1
206
153
69
176,826
93
networkx
31
networkx/generators/geometric.py
Python
18
{ "docstring": "Returns edge list of node pairs within `radius` of each other.\n\n Parameters\n ----------\n G : networkx graph\n The graph from which to generate the edge list. The nodes in `G` should\n have an attribute ``pos`` corresponding to the node position, which is\n used to com...
https://github.com/networkx/networkx.git
4
fields
def fields(class_or_instance): # Might it be worth caching this, per class? try: fields = getattr(class_or_instance, _FIELDS) except AttributeError: raise TypeError('must be called with a dataclass type or instance') # Exclude pseudo-fields. Note that fields is sorted by insertio...
8198943edd73a363c266633e1aa5b2a9e9c9f526
11
dataclasses.py
76
add python 3.10.4 for windows
56,538
0
98
43
53
222,330
62
XX-Net
11
python3.10.4/Lib/dataclasses.py
Python
6
{ "docstring": "Return a tuple describing the fields of this dataclass.\n\n Accepts a dataclass or an instance of one. Tuple elements are of\n type Field.\n ", "language": "en", "n_whitespaces": 32, "n_words": 23, "vocab_size": 20 }
https://github.com/XX-net/XX-Net.git
2
_invert_monoms
def _invert_monoms(p1): terms = list(p1.items()) terms.sort() deg = p1.degree() R = p1.ring p = R.zero cv = p1.listcoeffs() mv = p1.listmonoms() for mvi, cvi in zip(mv, cv): p[(deg - mvi[0],)] = cvi return p
7d773eb18daaef3c54f34d1ac6cbc5b83a5bb16c
12
ring_series.py
131
Cleanup loops and ranges
48,908
0
71
80
26
198,397
34
sympy
19
sympy/polys/ring_series.py
Python
11
{ "docstring": "\n Compute ``x**n * p1(1/x)`` for a univariate polynomial ``p1`` in ``x``.\n\n Examples\n ========\n\n >>> from sympy.polys.domains import ZZ\n >>> from sympy.polys.rings import ring\n >>> from sympy.polys.ring_series import _invert_monoms\n >>> R, x = ring('x', ZZ)\n >>> p = x...
https://github.com/sympy/sympy.git
4
to_python
def to_python(self, value): value = super().to_python(value) if value in self.empty_values: return None if self.localize: value = formats.sanitize_separators(value) # Strip trailing decimal and zeros. try: value = int(self.re_decimal.s...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
14
fields.py
139
Refs #33476 -- Reformatted code with Black.
51,297
0
136
83
28
205,955
36
django
17
django/forms/fields.py
Python
11
{ "docstring": "\n Validate that int() can be called on the input. Return the result\n of int() or None for empty values.\n ", "language": "en", "n_whitespaces": 41, "n_words": 19, "vocab_size": 17 }
https://github.com/django/django.git
3
_zoom_data_limits
def _zoom_data_limits(self, scale_u, scale_v, scale_w): scale = np.array([scale_u, scale_v, scale_w]) # Only perform frame conversion if unequal scale factors if not np.allclose(scale, scale_u): # Convert the scale factors from the view frame to the data frame R...
4896ec1a2cfb8c454e385632d8df213c915ced52
16
axes3d.py
246
Add pan and zoom toolbar handling to 3D Axes (Replaces PR#22614) (#23449) * ENH: Add pan and zoom toolbar handling to 3D Axes 1) This moves the pan logic that was already in the mouse move handler into the "drag_pan" method to make it available from the toolbar. 2) This expands upon the panning logic to enable ...
23,730
0
231
159
59
109,746
85
matplotlib
26
lib/mpl_toolkits/mplot3d/axes3d.py
Python
11
{ "docstring": "\n Zoom in or out of a 3D plot.\n Will scale the data limits by the scale factors. These will be\n transformed to the x, y, z data axes based on the current view angles.\n A scale factor > 1 zooms out and a scale factor < 1 zooms in.\n\n For an axes that has had its ...
https://github.com/matplotlib/matplotlib.git
2
start
def start(self): self.worker = _get_worker( args=self.args, target=run, kwargs={ 'args': self.args, 'name': self.name, 'container_name': self.container_name, 'net_mode': self.net_mode, 'r...
933415bfa1f9eb89f935037014dfed816eb9815d
12
container.py
172
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,734
0
267
104
35
9,859
35
jina
18
jina/peapods/peas/container.py
Python
20
{ "docstring": "Start the ContainerPea.\n This method calls :meth:`start` in :class:`threading.Thread` or :class:`multiprocesssing.Process`.\n .. #noqa: DAR201\n ", "language": "en", "n_whitespaces": 35, "n_words": 14, "vocab_size": 14 }
https://github.com/jina-ai/jina.git
1
info
def info(self, pretty=False, best=False): # type: (bool, bool) -> InfoDict return dict( id=self.id(), version=self.version(pretty, best), version_parts=dict( major=self.major_version(best), minor=self.minor_version(best), ...
f3166e673fe8d40277b804d35d77dcdb760fc3b3
13
distro.py
130
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,224
0
162
86
23
20,079
23
pipenv
15
pipenv/patched/notpip/_vendor/distro.py
Python
12
{ "docstring": "\n Return certain machine-readable information about the OS\n distribution.\n\n For details, see :func:`distro.info`.\n ", "language": "en", "n_whitespaces": 41, "n_words": 12, "vocab_size": 12 }
https://github.com/pypa/pipenv.git
1
data
def data(self) -> 'DataRequest._DataContent': return DataRequest._DataContent(self.proto_with_data.data)
c3849c6fee4a65a77a82b2cfda9670d727ff0f53
9
data.py
35
feat: allow to access parameters of data request wo loading data (#4991)
2,384
0
20
19
6
12,698
6
jina
5
jina/types/request/data.py
Python
6
{ "docstring": "Get the data contained in this data request\n\n :return: the data content as an instance of _DataContent wrapping docs\n ", "language": "en", "n_whitespaces": 33, "n_words": 19, "vocab_size": 16 }
https://github.com/jina-ai/jina.git
1
test_modify_event
def test_modify_event(self) -> None: # first patch the event checker so that it will modify the event
2ffaf30803f93273a4d8a65c9e6c3110c8433488
6
test_third_party_rules.py
17
Add type hints to `tests/rest/client` (#12108) * Add type hints to `tests/rest/client` * newsfile * fix imports * add `test_account.py` * Remove one type hint in `test_report_event.py` * change `on_create_room` to `async` * update new functions in `test_third_party_rules.py` * Add `test_filter.py`...
71,596
0
31
139
15
247,330
17
synapse
2
tests/rest/client/test_third_party_rules.py
Python
20
{ "docstring": "The module can return a modified version of the event", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/matrix-org/synapse.git
1
Dagum
def Dagum(name, p, a, b): r return rv(name, DagumDistribution, (p, a, b)) #------------------------------------------------------------------------------- # Erlang distribution ----------------------------------------------------------
9ad8ab9fe58051cf11626ba6654852fcfec60147
8
crv_types.py
40
Documentation cleanup 5
48,100
0
20
28
16
196,682
17
sympy
7
sympy/stats/crv_types.py
Python
57
{ "docstring": "\n Create a continuous random variable with a Dagum distribution.\n\n Explanation\n ===========\n\n The density of the Dagum distribution is given by\n\n .. math::\n f(x) := \\frac{a p}{x} \\left( \\frac{\\left(\\tfrac{x}{b}\\right)^{a p}}\n {\\left(\\left(\\tfrac{...
https://github.com/sympy/sympy.git
1
diffusion_defaults
def diffusion_defaults(): return dict( learn_sigma=False, diffusion_steps=1000, noise_schedule="linear", timestep_respacing="", use_kl=False, predict_xstart=False, rescale_timesteps=False, rescale_learned_sigmas=False, )
f4d6e64cdc132ae868699a0ba442f4ab1d304a14
9
script_util.py
63
add disco_diffusion_cnclip_vitb16 module
9,936
0
78
41
13
49,840
13
PaddleHub
10
modules/image/text_to_image/disco_diffusion_cnclip_vitb16/reverse_diffusion/model/script_util.py
Python
11
{ "docstring": "\n Defaults for image and classifier training.\n ", "language": "en", "n_whitespaces": 13, "n_words": 6, "vocab_size": 6 }
https://github.com/PaddlePaddle/PaddleHub.git
6
resize
def resize(self, n): aform = self.array_form l = len(aform) if n > l: aform += list(range(l, n)) return Permutation._af_new(aform) elif n < l: cyclic_form = self.full_cyclic_form new_cyclic_form = [] for cycle in cycli...
498015021131af4dbb07eb110e5badaba8250c7b
20
permutations.py
197
Updated import locations
47,668
0
378
116
58
196,168
77
sympy
24
sympy/combinatorics/permutations.py
Python
21
{ "docstring": "Resize the permutation to the new size ``n``.\n\n Parameters\n ==========\n\n n : int\n The new size of the permutation.\n\n Raises\n ======\n\n ValueError\n If the permutation cannot be resized to the given size.\n This may on...
https://github.com/sympy/sympy.git
3
_remove_old_push_actions_that_have_rotated
async def _remove_old_push_actions_that_have_rotated(self) -> None: # We want to clear out anything that is older than a day that *has* already # been rotated. rotated_upto_stream_ordering = await self.db_pool.simple_select_one_onecol( table="event_push_summary_stream_order...
46bd7f4ed9020bbed459c03a11c26d7f7c3093b0
11
event_push_actions.py
72
Clarifications for event push action processing. (#13485) * Clarifies comments. * Fixes an erroneous comment (about return type) added in #13455 (ec24813220f9d54108924dc04aecd24555277b99). * Clarifies the name of a variable. * Simplifies logic of pulling out the latest join for the requesting user.
72,870
0
131
64
34
249,367
38
synapse
11
synapse/storage/databases/main/event_push_actions.py
Python
18
{ "docstring": "Clear out old push actions that have been summarised.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/matrix-org/synapse.git
1
_asarray
def _asarray(arr): _check_arraylike("_asarray", arr) dtype, weak_type = dtypes._lattice_result_type(arr) return lax_internal._convert_element_type(arr, dtype, weak_type)
ddf23dead3a4214e6ef8a515d0a51648360ab797
8
util.py
55
lax_numpy.py: factor out some common utilities Re-lands part of #9724 PiperOrigin-RevId: 433838553
26,678
0
16
33
11
119,743
12
jax
9
jax/_src/numpy/util.py
Python
4
{ "docstring": "\n Pared-down utility to convert object to a DeviceArray.\n Note this will not correctly handle lists or tuples.\n ", "language": "en", "n_whitespaces": 21, "n_words": 17, "vocab_size": 16 }
https://github.com/google/jax.git
2
_get_driver
def _get_driver(self) -> str: drivers = [device.get("driverVersion", "No Driver Found") for device in self._device_details] self._log("debug", f"GPU Drivers: {drivers}") return drivers
bdbbad4d310fb606b6f412aa81e9f57ccd994e97
10
amd.py
69
Refactor lib.gpu_stats (#1218) * inital gpu_stats refactor * Add dummy CPU Backend * Update Sphinx documentation
20,028
0
66
37
19
100,564
20
faceswap
8
lib/gpu_stats/amd.py
Python
12
{ "docstring": " Obtain the AMD driver version currently in use.\n\n Returns\n -------\n str\n The current AMD GPU driver versions\n ", "language": "en", "n_whitespaces": 57, "n_words": 17, "vocab_size": 15 }
https://github.com/deepfakes/faceswap.git
1
test_payment_refund_or_void_refund_called
def test_payment_refund_or_void_refund_called(refund_mock, payment): # given payment.transactions.count() == 0 payment.charge_status = ChargeStatus.FULLY_CHARGED payment.save(update_fields=["charge_status"]) # when gateway.payment_refund_or_void(payment, get_plugins_manager(), None) #...
0881beec1ac02dfa97525c5173687defb356d85c
@patch("saleor.payment.gateway.refund")
10
test_gateway.py
101
Fix payment flow (#9504) * Do not capture payment again when it should be refunded or voided * Do not create order when then is ongoing refund
5,044
1
48
52
20
26,685
22
saleor
15
saleor/payment/tests/test_gateway.py
Python
6
{ "docstring": "Ensure that the refund method is called when payment can be refunded\n and there is no refund transaction.", "language": "en", "n_whitespaces": 20, "n_words": 18, "vocab_size": 16 }
https://github.com/saleor/saleor.git
16
telescopic
def telescopic(L, R, limits): (i, a, b) = limits if L.is_Add or R.is_Add: return None # We want to solve(L.subs(i, i + m) + R, m) # First we try a simple match since this does things that # solve doesn't do, e.g. solve(f(k+m)-f(k), m) fails k = Wild("k") sol = (-R).match(L.sub...
f757f3daae6e11ea0cfb7dadc133274d8d74315f
19
summations.py
374
Reordered imports 2
48,161
0
391
242
104
196,771
189
sympy
27
sympy/concrete/summations.py
Python
27
{ "docstring": "\n Tries to perform the summation using the telescopic property.\n\n Return None if not possible.\n ", "language": "en", "n_whitespaces": 24, "n_words": 14, "vocab_size": 13 }
https://github.com/sympy/sympy.git
1
insights_lookback_period
def insights_lookback_period(self): return pendulum.duration(days=self._insights_lookback_window)
76032e66dd2b75c611440bdccfc3d55863fb3e39
9
base_insight_streams.py
30
Source Facebook Marketing: Add lookback window to insights streams (#12402)
773
0
18
17
4
5,494
4
airbyte
6
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/base_insight_streams.py
Python
2
{ "docstring": "\n Facebook freezes insight data 28 days after it was generated, which means that all data\n from the past 28 days may have changed since we last emitted it, so we retrieve it again.\n But in some cases users my have define their own lookback window, thats\n why the value f...
https://github.com/airbytehq/airbyte.git
5
check_permissions_for_custom_prices
def check_permissions_for_custom_prices(app, lines): if any(["price" in line for line in lines]) and ( not app or not app.has_perm(CheckoutPermissions.HANDLE_CHECKOUTS) ): raise PermissionDenied(permissions=[CheckoutPermissions.HANDLE_CHECKOUTS])
620569b3a2466e8dda80df20a11b99ec0bec8c7c
12
utils.py
79
Custom prices (#9393) * Add price_override to CheckoutLine model * Allow to define custom price in checkout mutations * Apply code review suggestions * Use custom price when generating checkout payload * Use price override when calculating prices for checkout * Update populatedb - create checkout with c...
5,029
0
44
48
18
26,585
21
saleor
10
saleor/graphql/checkout/mutations/utils.py
Python
5
{ "docstring": "Raise PermissionDenied when custom price is changed by user or app without perm.\n\n Checkout line custom price can be changed only by app with\n handle checkout permission.\n ", "language": "en", "n_whitespaces": 36, "n_words": 27, "vocab_size": 22 }
https://github.com/saleor/saleor.git
4
_perform_invalid_key_test
def _perform_invalid_key_test(self, key, expected_warning, key_func=None): # mimic custom ``make_key`` method being defined since the default will # never show the below warnings
9c19aff7c7561e3a82978a272ecdaad40dda5c00
6
tests.py
24
Refs #33476 -- Reformatted code with Black.
50,040
0
43
191
20
202,050
22
django
5
tests/cache/tests.py
Python
24
{ "docstring": "\n All the builtin backends should warn (except memcached that should\n error) on keys that would be refused by memcached. This encourages\n portable caching code without making it too difficult to use production\n backends with more liberal key rules. Refs #6447.\n ...
https://github.com/django/django.git
1
set_negative_aliases
def set_negative_aliases(self, negative_alias): self._check_alias_dict(negative_alias, "negative alias") self.negative_alias = negative_alias
8198943edd73a363c266633e1aa5b2a9e9c9f526
8
fancy_getopt.py
37
add python 3.10.4 for windows
56,809
0
30
21
9
222,921
9
XX-Net
4
python3.10.4/Lib/distutils/fancy_getopt.py
Python
3
{ "docstring": "Set the negative aliases for this option parser.\n 'negative_alias' should be a dictionary mapping option names to\n option names, both the key and value must already be defined\n in the option table.", "language": "en", "n_whitespaces": 52, "n_words": 32, "vocab_size": 26...
https://github.com/XX-net/XX-Net.git
9
aug_test_bboxes
def aug_test_bboxes(self, feats, img_metas, rescale=False): # check with_nms argument gb_sig = signature(self.get_results) gb_args = [p.name for p in gb_sig.parameters.values()] gbs_sig = signature(self._get_results_single) gbs_args = [p.name for p in gbs_sig.parameters....
9a3bf7660e6ced54672741095f96df07919f9ba7
14
dense_test_mixins.py
567
[Refactor] Refactor dense head outputs to InstanceResults.
70,341
0
674
361
122
244,349
171
mmdetection
54
mmdet/models/dense_heads/dense_test_mixins.py
Python
46
{ "docstring": "Test det bboxes with test time augmentation, can be applied in\n DenseHead except for ``RPNHead`` and its variants, e.g., ``GARPNHead``,\n etc.\n\n Args:\n feats (list[Tensor]): the outer list indicates test-time\n augmentations and inner Tensor should ha...
https://github.com/open-mmlab/mmdetection.git
7
remove_if_stale
def remove_if_stale(self): try: pid = self.read_pid() except ValueError: print('Broken pidfile found - Removing it.', file=sys.stderr) self.remove() return True if not pid: self.remove() return True try: ...
13d545b2155ebe9ee0ffad9e9d9ffc09a39185df
14
platforms.py
202
Fix grammar typos on the whole project
52,237
0
285
119
35
208,205
63
celery
18
celery/platforms.py
Python
22
{ "docstring": "Remove the lock if the process isn't running.\n\n I.e. process does not respond to signal.\n ", "language": "en", "n_whitespaces": 29, "n_words": 15, "vocab_size": 13 }
https://github.com/celery/celery.git
1
_tie_weights
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, )
e09473a817c5e5871e11cc81004355ef30250502
@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, )
8
modeling_xlm_roberta_xl.py
38
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...
6,311
1
44
14
27
34,690
27
transformers
6
src/transformers/models/xlm_roberta_xl/modeling_xlm_roberta_xl.py
Python
2
{ "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 }
https://github.com/huggingface/transformers.git
5
uri_to_iri
def uri_to_iri(uri): if uri is None: return uri uri = force_bytes(uri) # Fast selective unquote: First, split on '%' and then starting with the # second block, decode the first 2 bytes if they represent a hex code to # decode. The rest of the block is the part after '%AB', not containin...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
17
encoding.py
212
Refs #33476 -- Reformatted code with Black.
51,602
0
280
126
77
206,644
105
django
16
django/utils/encoding.py
Python
21
{ "docstring": "\n Convert a Uniform Resource Identifier(URI) into an Internationalized\n Resource Identifier(IRI).\n\n This is the algorithm from section 3.2 of RFC 3987, excluding step 4.\n\n Take an URI in ASCII bytes (e.g. '/I%20%E2%99%A5%20Django/') and return\n a string containing the encoded res...
https://github.com/django/django.git
1
test_ohe_drop_first_handle_unknown_ignore_warns
def test_ohe_drop_first_handle_unknown_ignore_warns(handle_unknown): X = [["a", 0], ["b", 2], ["b", 1]] ohe = OneHotEncoder(drop="first", sparse=False, handle_unknown=handle_unknown) X_trans = ohe.fit_transform(X) X_expected = np.array( [ [0, 0, 0], [1, 0, 1], ...
7f0006c8aad1a09621ad19c3db19c3ff0555a183
@pytest.mark.parametrize("handle_unknown", ["ignore", "infrequent_if_exist"])
12
test_encoders.py
307
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,665
1
221
178
71
259,232
96
scikit-learn
27
sklearn/preprocessing/tests/test_encoders.py
Python
24
{ "docstring": "Check drop='first' and handle_unknown='ignore'/'infrequent_if_exist'\n during transform.", "language": "en", "n_whitespaces": 8, "n_words": 6, "vocab_size": 6 }
https://github.com/scikit-learn/scikit-learn.git
3
_add_x_axis_labels
def _add_x_axis_labels(self): val_range = np.arange( 0.5, len(self.bar_names), 1 ) # 0.5 shifted so that labels are centered, not on ticks labels = VGroup() for i, (value, bar_name) in enumerate(zip(val_range, self.bar_names)): # to accommodate negati...
149479f9132daf2266c27caa7a3e11ce06be501d
12
probability.py
211
Refactored :class:`~.BarChart` and made it inherit from :class:`~.Axes`. (#2387) * rebase * fixed None bar_names * fixed scale issues * fixed to accept negative bar values * fixed some bugs * Added docs for parameters (DRAFT) * clean up parameters * more clean up * clean up __init__ * replac...
46,048
0
316
135
64
189,413
81
manim
27
manim/mobject/probability.py
Python
20
{ "docstring": "Essentially ``:meth:~.NumberLine.add_labels``, but differs in that\n the direction of the label with respect to the x_axis changes to UP or DOWN\n depending on the value.\n\n UP for negative values and DOWN for positive values.\n ", "language": "en", "n_whitespaces": 62...
https://github.com/ManimCommunity/manim.git
2
async_cancel_refresh_callback
def async_cancel_refresh_callback(self) -> None: if self._refresh_callback is not None: self._refresh_callback() self._refresh_callback = None
274584f2a47b7db9943168316122196a540080e5
9
entity.py
45
Add strict typing for litterrobot (#75540)
116,446
0
49
26
11
317,880
13
core
3
homeassistant/components/litterrobot/entity.py
Python
5
{ "docstring": "Clear the refresh callback if it has not already fired.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/home-assistant/core.git
8
all_displays
def all_displays(): # lazy import to avoid circular imports from sklearn.base from ._testing import ignore_warnings all_classes = [] root = str(Path(__file__).parent.parent) # sklearn package # Ignore deprecation warnings triggered at import time and from walking # packages with ignor...
b22f7fa552c03aa7f6b9b4d661470d0173f8db5d
17
discovery.py
258
MNT numpydoc validation for Displays (#21469) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
76,673
0
304
153
69
261,168
91
scikit-learn
37
sklearn/utils/discovery.py
Python
21
{ "docstring": "Get a list of all displays from `sklearn`.\n\n Returns\n -------\n displays : list of tuples\n List of (name, class), where ``name`` is the display class name as\n string and ``class`` is the actual type of the class.\n ", "language": "en", "n_whitespaces": 63, "n_words...
https://github.com/scikit-learn/scikit-learn.git
4
on_mode_entered
def on_mode_entered(self, mode): if (config.val.tabs.mode_on_change == 'restore' and mode in modeman.INPUT_MODES): tab = self.widget.currentWidget() if tab is not None: assert isinstance(tab, browsertab.AbstractTab), tab tab.data.i...
a20bb67a878b2e68abf8268c1b0a27f018d01352
12
tabbedbrowser.py
96
mypy: Upgrade to PyQt5-stubs 5.15.6.0 For some unknown reason, those new stubs cause a *lot* of things now to be checked by mypy which formerly probably got skipped due to Any being implied somewhere. The stubs themselves mainly improved, with a couple of regressions too. In total, there were some 337 (!) new mypy e...
117,362
0
107
60
21
320,800
26
qutebrowser
17
qutebrowser/mainwindow/tabbedbrowser.py
Python
7
{ "docstring": "Save input mode when tabs.mode_on_change = restore.", "language": "en", "n_whitespaces": 6, "n_words": 7, "vocab_size": 7 }
https://github.com/qutebrowser/qutebrowser.git
5
user_state_dir
def user_state_dir(appname=None, appauthor=None, version=None, roaming=False): r if system in ["win32", "darwin"]: path = user_data_dir(appname, appauthor, None, roaming) else: path = os.getenv('XDG_STATE_HOME', os.path.expanduser("~/.local/state")) if appname: path = os....
47b5c8af57f0f927d50fe94f3474b09a54292553
14
appdirs.py
150
Standardize cache directory
7,368
0
91
95
28
40,266
38
seaborn
12
seaborn/external/appdirs.py
Python
40
{ "docstring": "Return full path to the user-specific state dir for this application.\n\n \"appname\" is the name of application.\n If None, just the system directory is returned.\n \"appauthor\" (only used on Windows) is the name of the\n appauthor or distributing body for this ap...
https://github.com/mwaskom/seaborn.git
2
test_01_drop_predictor
def test_01_drop_predictor(self): if self.test_model_1 not in self.handler.get_tables().data_frame.values: # TODO: seems redundant because of test_02 query = f self.handler.native_query(query) response = self.handler.native_query(f"DROP PREDICTOR {self.test_model_1}")...
871793d4fbd99f454c0c1ff14db6ce3c385e656c
11
test_lightwood_handler.py
120
add more TS tests
25,578
0
79
58
25
115,838
26
mindsdb
16
mindsdb/integrations/handlers/lightwood_handler/tests/test_lightwood_handler.py
Python
10
{ "docstring": "\n CREATE PREDICTOR {self.test_model_1}\n FROM {PG_HANDLER_NAME} (SELECT * FROM {self.data_table_1} limit 50)\n PREDICT rental_price\n ", "language": "en", "n_whitespaces": 70, "n_words": 13, "vocab_size": 12 }
https://github.com/mindsdb/mindsdb.git
1
truncated_cube_graph
def truncated_cube_graph(create_using=None): description = [ "adjacencylist", "Truncated Cube Graph", 24, [ [2, 3, 5], [12, 15], [4, 5], [7, 9], [6], [17, 19], [8, 9], [11, 13], ...
dec723f072eb997a497a159dbe8674cd39999ee9
9
small.py
197
Docstrings for the small.py module (#5240) * added description for the first 5 small graphs * modified descriptions based on comment and added description for two more functions * added doctrings to all the functions * Minor touchups. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
41,741
0
370
152
46
176,171
56
networkx
5
networkx/generators/small.py
Python
34
{ "docstring": "\n Returns the skeleton of the truncated cube.\n\n The truncated cube is an Archimedean solid with 14 regular\n faces (6 octagonal and 8 triangular), 36 edges and 24 nodes [1]_.\n The truncated cube is created by truncating (cutting off) the tips\n of the cube one third of the way into ...
https://github.com/networkx/networkx.git
8
on_no_available_trials
def on_no_available_trials(self, all_trials): # This is approximately saying we are not making progress. if len(all_trials) == self._last_trial_num: if self._no_running_trials_since == -1: self._no_running_trials_since = time.monotonic() elif ( ...
eb69c1ca286a2eec594f02ddaf546657a8127afd
20
insufficient_resources_manager.py
217
[air] Add annotation for Tune module. (#27060) Co-authored-by: Kai Fricke <kai@anyscale.com>
28,086
0
602
125
72
126,210
108
ray
19
python/ray/tune/execution/insufficient_resources_manager.py
Python
22
{ "docstring": "Tracks information across the life of Tune loop and makes guesses\n about if Tune loop is stuck due to infeasible resources.\n If so, outputs certain warning messages.\n The logic should be conservative, non-intrusive and informative.\n For example, rate limiting is applied...
https://github.com/ray-project/ray.git
1
test_door_lock_no_value
async def test_door_lock_no_value(hass, client, lock_schlage_be469_state, integration): node_state = replace_value_of_zwave_value( lock_schlage_be469_state, [ ZwaveValueMatcher( property_=CURRENT_MODE_PROPERTY, command_class=CommandClass.DOOR_LOCK, ...
d4c28e04e4793c328d1a1d096c2085ebbe7c5e7c
13
test_lock.py
134
Reduce missed coverage in zwave_js (#79571) * Reduce missed coverage in zwave_js.climate and cover * Add switch platform coverage * Add select platform * Add lock platform * Remove one line of coverage from number platform * update docstring
88,425
0
144
85
31
289,282
37
core
24
tests/components/zwave_js/test_lock.py
Python
17
{ "docstring": "Test a lock entity with door lock command class that has no value for mode.", "language": "en", "n_whitespaces": 14, "n_words": 15, "vocab_size": 14 }
https://github.com/home-assistant/core.git
2
make_model
def make_model(): r inputs = [] intermediates = [] for _ in range(_NUM_LEARNERS): inp = keras.layers.Input(shape=(1,), dtype=tf.int32) layer = keras.layers.Embedding(1, 4)(inp) layer = keras.layers.Dense(1)(layer) inputs.append(inp) intermediates.append(layer) ...
84afc5193d38057e2e2badf9c889ea87d80d8fbf
12
optimizer_v2_test.py
454
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
81,429
0
229
123
57
275,572
86
keras
44
keras/optimizers/optimizer_v2/optimizer_v2_test.py
Python
41
{ "docstring": "Constructs a simple ensemble of weak learners model.\n\n --------- --------- --------- ---------\n | Input | | Input | ... | Input | | Input |\n --------- --------- --------- ---------\n | | | |...
https://github.com/keras-team/keras.git
2
add_department_leaves
def add_department_leaves(events, start, end, employee, company): department = frappe.db.get_value("Employee", employee, "department") if not department: return # department leaves department_employees = frappe.db.sql_list( , (department, company), ) filter_conditions = ' and employee in ("%s")' % '", "'...
494bd9ef78313436f0424b918f200dab8fc7c20b
10
leave_application.py
113
style: format code with black
14,117
0
28
71
33
66,160
39
erpnext
15
erpnext/hr/doctype/leave_application/leave_application.py
Python
11
{ "docstring": "select name from tabEmployee where department=%s\n\t\tand company=%s", "language": "en", "n_whitespaces": 6, "n_words": 8, "vocab_size": 8 }
https://github.com/frappe/erpnext.git
1
test_dataset_stats_read_parquet
def test_dataset_stats_read_parquet(ray_start_regular_shared, tmp_path): ds = ray.data.range(1000, parallelism=10) ds.write_parquet(str(tmp_path)) ds = ray.data.read_parquet(str(tmp_path)).map(lambda x: x) stats = canonicalize(ds.stats()) print(stats) assert stats ==
e9068c45faf2928cd8e38f6d38c5260cb06130d2
12
test_stats.py
113
[data] Instrument most remaining dataset functions and add docs (#21412) This PR finishes most of the stats todos for dataset. The main thing punted for future work is instrumentation of split(), which is particularly tricky since only certain blocks are transformed. Co-authored-by: Clark Zinzow <clarkzinzow@gmail....
28,886
0
38
69
16
129,063
20
ray
16
python/ray/data/tests/test_stats.py
Python
20
{ "docstring": "Stage Z read: N/N blocks executed in T\n* Remote wall time: T min, T max, T mean, T total\n* Remote cpu time: T min, T max, T mean, T total\n* Output num rows: N min, N max, N mean, N total\n* Output size bytes: N min, N max, N mean, N total\n* Tasks per node: N min, N max, N mean; N nodes used\n\nSta...
https://github.com/ray-project/ray.git
7
emitCurrentToken
def emitCurrentToken(self): token = self.currentToken # Add token to the queue to be yielded if (token["type"] in tagTokenTypes): token["name"] = token["name"].translate(asciiUpper2Lower) if token["type"] == tokenTypes["StartTag"]: raw = token["da...
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
17
_tokenizer.py
293
upd; format
12,978
0
408
162
56
62,468
78
transferlearning
17
.venv/lib/python3.8/site-packages/pip/_vendor/html5lib/_tokenizer.py
Python
19
{ "docstring": "This method is a generic handler for emitting the tags. It also sets\n the state to \"data\" because that's what's needed after a token has been\n emitted.\n ", "language": "en", "n_whitespaces": 48, "n_words": 27, "vocab_size": 25 }
https://github.com/jindongwang/transferlearning.git
12
remove
def remove(name=None, pkgs=None, **kwargs): targets = salt.utils.args.split_input(pkgs) if pkgs else [name] if not targets: return {} if pkgs: log.debug("Removing these fileset(s)/rpm package(s) %s: %s", name, targets) errors = [] # Get a list of the currently installed pkgs....
fbcc707e76f11770712e6828155258ac61e00ff8
16
aixpkg.py
443
work in progress while resolve issue of python3_32 usage by dnf and yum
53,792
0
513
256
106
215,074
157
salt
38
salt/modules/aixpkg.py
Python
40
{ "docstring": "\n Remove specified fileset(s)/rpm package(s).\n\n name\n The name of the fileset or rpm package to be deleted.\n\n .. versionadded:: 3005\n\n preference to install rpm packages are to use in the following order:\n /opt/freeware/bin/dnf\n /opt/freeware/bin/...
https://github.com/saltstack/salt.git
16
_async_update_existing_host_entry
def _async_update_existing_host_entry(self) -> config_entries.ConfigEntry | None: for entry in self._async_current_entries(include_ignore=False): mac = entry.data.get(CONF_MAC) mac_match = mac and self._mac and mac == self._mac upnp_udn_match = self._upnp_udn and sel...
2d4ccddd99bcc4bd314f813214be693788b1c0bf
15
config_flow.py
312
Fix SSDP unique id in SamsungTV config flow (#67811) Co-authored-by: epenet <epenet@users.noreply.github.com> Co-authored-by: J. Nick Koston <nick@koston.org>
92,385
0
401
197
49
293,322
86
core
26
homeassistant/components/samsungtv/config_flow.py
Python
29
{ "docstring": "Check existing entries and update them.\n\n Returns the existing entry if it was updated.\n ", "language": "en", "n_whitespaces": 28, "n_words": 14, "vocab_size": 13 }
https://github.com/home-assistant/core.git
1
_load_environment_vars
def _load_environment_vars(self): # type: () -> None self._config[kinds.ENV_VAR].update( self._normalized_keys(":env:", self.get_environ_vars()) )
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
11
configuration.py
53
upd; format
12,235
0
50
30
11
60,669
11
transferlearning
8
.venv/lib/python3.8/site-packages/pip/_internal/configuration.py
Python
4
{ "docstring": "Loads configuration from environment variables\n ", "language": "en", "n_whitespaces": 12, "n_words": 5, "vocab_size": 5 }
https://github.com/jindongwang/transferlearning.git
1
open
def open(self, host=None, port=None, timeout=None): self.host = None # For compatibility with parent class self.port = None self.sock = None self.file = None self.process = subprocess.Popen(self.command, bufsize=DEFAULT_BUFFER_SIZE, stdin=s...
8198943edd73a363c266633e1aa5b2a9e9c9f526
10
imaplib.py
139
add python 3.10.4 for windows
55,008
0
133
92
28
217,910
37
XX-Net
20
python3.10.4/Lib/imaplib.py
Python
11
{ "docstring": "Setup a stream connection.\n This connection will be used by the routines:\n read, readline, send, shutdown.\n ", "language": "en", "n_whitespaces": 41, "n_words": 16, "vocab_size": 16 }
https://github.com/XX-net/XX-Net.git
13
collapse_addresses
def collapse_addresses(addresses): addrs = [] ips = [] nets = [] # split IP addresses and networks for ip in addresses: if isinstance(ip, _BaseAddress): if ips and ips[-1]._version != ip._version: raise TypeError("%s and %s are not of the same version" % ( ...
8198943edd73a363c266633e1aa5b2a9e9c9f526
18
ipaddress.py
333
add python 3.10.4 for windows
55,342
0
448
205
71
218,488
128
XX-Net
23
python3.10.4/Lib/ipaddress.py
Python
28
{ "docstring": "Collapse a list of IP objects.\n\n Example:\n collapse_addresses([IPv4Network('192.0.2.0/25'),\n IPv4Network('192.0.2.128/25')]) ->\n [IPv4Network('192.0.2.0/24')]\n\n Args:\n addresses: An iterator of IPv4Network or IPv6Network ...
https://github.com/XX-net/XX-Net.git
1
test_creating_algo_config_from_legacy_dict
def test_creating_algo_config_from_legacy_dict(self): config_dict = { "evaluation_config": { "lr": 0.1, }, "lr": 0.2, # Old-style multi-agent dict. "multiagent": { "policies": {"pol1", "pol2"}, "...
5af66e66cc6aa3859e2e15637c66f6decbec13b9
13
test_algorithm_config.py
238
[RLlib] AlgorithmConfigs: Broad rollout; Example scripts. (#29700)
30,578
0
258
146
45
135,275
55
ray
18
rllib/algorithms/tests/test_algorithm_config.py
Python
20
{ "docstring": "Tests, whether translation from dict to AlgorithmConfig works as expected.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/ray-project/ray.git
9
cov
def cov(self, ddof=1, split_every=None, split_out=1, std=False): if self.sort is None and split_out > 1: warnings.warn(SORT_SPLIT_OUT_WARNING, FutureWarning) levels = _determine_levels(self.by) is_mask = any(is_series_like(s) for s in self.by) if self._slice: ...
72832d4bd685a25000ee646966a1aa5d0d8a1793
15
groupby.py
368
Groupby sort upstream compatibility (#9486)
36,829
0
400
244
68
157,016
87
dask
39
dask/dataframe/groupby.py
Python
31
{ "docstring": "Groupby covariance is accomplished by\n\n 1. Computing intermediate values for sum, count, and the product of\n all columns: a b c -> a*a, a*b, b*b, b*c, c*c.\n\n 2. The values are then aggregated and the final covariance value is calculated:\n cov(X, Y) = X*Y - Xbar ...
https://github.com/dask/dask.git
4
copyin_matrix
def copyin_matrix(self, key, value): rlo, rhi, clo, chi = self.key2bounds(key) shape = value.shape dr, dc = rhi - rlo, chi - clo if shape != (dr, dc): raise ShapeError(filldedent("The Matrix `value` doesn't have the " "same dim...
59d22b6bb7287613d598611027f640d068ca5748
13
repmatrix.py
150
Moved imports to higher level
47,899
0
219
96
47
196,399
62
sympy
19
sympy/matrices/repmatrix.py
Python
11
{ "docstring": "Copy in values from a matrix into the given bounds.\n\n Parameters\n ==========\n\n key : slice\n The section of this matrix to replace.\n value : Matrix\n The matrix to copy values from.\n\n Examples\n ========\n\n >>> from sympy ...
https://github.com/sympy/sympy.git
8
step
def step(self) -> ResultDict: step_attempt_results = None with self._step_context() as step_ctx: while not step_ctx.should_stop(step_attempt_results): # Try to train one step. try: step_attempt_results = self.step_attempt() ...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
19
trainer.py
254
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
30,128
0
726
142
90
133,868
123
ray
25
rllib/agents/trainer.py
Python
43
{ "docstring": "Implements the main `Trainer.train()` logic.\n\n Takes n attempts to perform a single training step. Thereby\n catches RayErrors resulting from worker failures. After n attempts,\n fails gracefully.\n\n Override this method in your Trainer sub-classes if you would like to\n...
https://github.com/ray-project/ray.git
19
deltaintegrate
def deltaintegrate(f, x): if not f.has(DiracDelta): return None # g(x) = DiracDelta(h(x)) if f.func == DiracDelta: h = f.expand(diracdelta=True, wrt=x) if h == f: # can't simplify the expression #FIXME: the second term tells whether is DeltaDirac or Derivative ...
f757f3daae6e11ea0cfb7dadc133274d8d74315f
26
deltafunctions.py
585
Reordered imports 2
48,168
0
1,179
364
173
196,780
297
sympy
40
sympy/integrals/deltafunctions.py
Python
48
{ "docstring": "\n deltaintegrate(f, x)\n\n Explanation\n ===========\n\n The idea for integration is the following:\n\n - If we are dealing with a DiracDelta expression, i.e. DiracDelta(g(x)),\n we try to simplify it.\n\n If we could simplify it, then we integrate the resulting expression.\n...
https://github.com/sympy/sympy.git
1
to_batches
def to_batches(self, *args, **kwargs): return self.table.to_batches(*args, **kwargs)
e35be138148333078284b942ccc9ed7b1d826f97
8
table.py
41
Update docs to new frontend/UI (#3690) * WIP: update docs to new UI * make style * Rm unused * inject_arrow_table_documentation __annotations__ * hasattr(arrow_table_method, "__annotations__") * Update task_template.rst * Codeblock PT-TF-SPLIT * Convert loading scripts * Convert docs to mdx ...
21,831
0
21
25
7
104,394
7
datasets
5
src/datasets/table.py
Python
2
{ "docstring": "\n Convert Table to list of (contiguous) RecordBatch objects.\n\n Args:\n max_chunksize (:obj:`int`, defaults to `None`):\n Maximum size for RecordBatch chunks. Individual chunks may be\n smaller depending on the chunk layout of individual columns...
https://github.com/huggingface/datasets.git
5
check_for_updates
def check_for_updates() -> None: # The commit has was commented out because the terminal was crashing due to git import for multiple users # ({str(git.Repo('.').head.commit)[:7]}) try: r = requests.get( "https://api.github.com/repos/openbb-finance/openbbterminal/releases/latest", ...
7b374b76629a963cef9a22b41bc8acbef70e876a
16
terminal_helper.py
202
Add check for updates at terminal startup (#1839) * Add check for updates at terminal startup * Fix ycrv missing from documentation * Add new line after update check message Co-authored-by: didierlopes.eth <dro.lopes@campus.fct.unl.pt> Co-authored-by: James Maslek <jmaslek11@gmail.com>
84,784
0
276
109
70
284,534
93
OpenBBTerminal
15
openbb_terminal/terminal_helper.py
Python
27
{ "docstring": "Check if the latest version is running.\n\n Checks github for the latest release version and compares it to obbff.VERSION.\n ", "language": "en", "n_whitespaces": 25, "n_words": 19, "vocab_size": 16 }
https://github.com/OpenBB-finance/OpenBBTerminal.git
1
load_array
def load_array(data_arrays, batch_size, is_train=True): dataset = gluon.data.ArrayDataset(*data_arrays) return gluon.data.DataLoader(dataset, batch_size, shuffle=is_train)
b64b41d8c1ac23c43f7a4e3f9f6339d6f0012ab2
9
mxnet.py
59
[PaddlePaddle] Merge master into Paddle branch (#1186) * change 15.2 title in chinese version (#1109) change title ’15.2. 情感分析:使用递归神经网络‘ to ’15.2. 情感分析:使用循环神经网络‘ * 修改部分语义表述 (#1105) * Update r0.17.5 (#1120) * Bump versions in installation * 94行typo: (“bert.mall”)->(“bert.small”) (#1129) * line 313: "b...
37,377
0
20
38
10
158,208
11
d2l-zh
10
d2l/mxnet.py
Python
3
{ "docstring": "Construct a Gluon data iterator.\n\n Defined in :numref:`sec_linear_concise`", "language": "en", "n_whitespaces": 10, "n_words": 8, "vocab_size": 8 }
https://github.com/d2l-ai/d2l-zh.git
16
a85decode
def a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v'): b = _bytes_from_decode_data(b) if adobe: if not b.endswith(_A85END): raise ValueError( "Ascii85 encoded byte sequences must end " "with {!r}".format(_A85END) ) ...
8198943edd73a363c266633e1aa5b2a9e9c9f526
17
base64.py
513
add python 3.10.4 for windows
56,193
0
686
281
138
221,085
212
XX-Net
34
python3.10.4/Lib/base64.py
Python
47
{ "docstring": "Decode the Ascii85 encoded bytes-like object or ASCII string b.\n\n foldspaces is a flag that specifies whether the 'y' short sequence should be\n accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature is\n not supported by the \"standard\" Adobe encoding.\n\n adobe cont...
https://github.com/XX-net/XX-Net.git
2
_load_formatters
def _load_formatters(module_name): mod = __import__(module_name, None, None, ['__all__']) for formatter_name in mod.__all__: cls = getattr(mod, formatter_name) _formatter_cache[cls.name] = cls
f3166e673fe8d40277b804d35d77dcdb760fc3b3
10
__init__.py
68
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,315
0
42
43
15
20,293
19
pipenv
10
pipenv/patched/notpip/_vendor/pygments/formatters/__init__.py
Python
5
{ "docstring": "Load a formatter (and all others in the module too).", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/pypa/pipenv.git
1
test_resolved_in_release_performance_issue
def test_resolved_in_release_performance_issue(self, mock_func): event = self.create_performance_issue() notification = ResolvedInReleaseActivityNotification( Activity( project=self.project, group=event.group, user=self.user, ...
495d45c6547e398a5d4d3c1fa8cb97e69b1751f8
14
test_resolved_in_release.py
230
ref(slack): Update workflow alerts for perf issues (#40463) Slack workflow alerts for performance issues are showing a text value of "no value". This PR adds feature parity with error issues for workflow alerts so that they are shown with the proper data.
18,284
0
317
122
58
87,329
74
sentry
25
tests/sentry/integrations/slack/notifications/test_resolved_in_release.py
Python
25
{ "docstring": "\n Test that a Slack message is sent with the expected payload when a performance issue is resolved in a release\n ", "language": "en", "n_whitespaces": 35, "n_words": 20, "vocab_size": 17 }
https://github.com/getsentry/sentry.git
4
make_png
def make_png(cls, tex, fontsize, dpi): basefile = cls.get_basefile(tex, fontsize, dpi) pngfile = '%s.png' % basefile # see get_rgba for a discussion of the background if not os.path.exists(pngfile): dvifile = cls.make_dvi(tex, fontsize) cmd = ["dvipng", "...
13147992b317c29c6e832ca7f6d05bf48aeb0718
14
texmanager.py
198
Move towards making texmanager stateless. Previously, TexManager needed to call get_font_config at a specific place in the middle of processing to update some internal attributes before proceeding with TeX source generation. Instead, move towards making TexManager stateless (except for caching), i.e. the user facing ...
23,022
0
276
117
78
108,023
94
matplotlib
21
lib/matplotlib/texmanager.py
Python
12
{ "docstring": "\n Generate a png file containing latex's rendering of tex string.\n\n Return the file name.\n ", "language": "en", "n_whitespaces": 36, "n_words": 14, "vocab_size": 13 }
https://github.com/matplotlib/matplotlib.git
3
_wait_threads
def _wait_threads(self): # Note that you need two loops, since you can't say which # thread will get each sentinel for t in self._threads: self._to_fetch.put(None) # sentinel for t in self._threads: t.join() self._threads = []
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
10
locators.py
68
upd; format
12,843
0
102
39
27
62,036
35
transferlearning
7
.venv/lib/python3.8/site-packages/pip/_vendor/distlib/locators.py
Python
6
{ "docstring": "\n Tell all the threads to terminate (by sending a sentinel value) and\n wait for them to do so.\n ", "language": "en", "n_whitespaces": 40, "n_words": 18, "vocab_size": 17 }
https://github.com/jindongwang/transferlearning.git
2
table_id
def table_id(connection, table_name, schema_name=None): schema_idm = schema_id(connection=connection,schema_name=schema_name) q = f cur = connection.cursor() cur.execute(q) try: table_id = cur.fetchall()[0][0] except: raise exc.NoSuchTableError(table_name) ...
3d8422b16d8ad72005ffed2f7869eefe0b330c35
12
monet_get_id.py
117
utils used for getting schema_id and table_id
25,664
0
70
67
19
116,090
23
mindsdb
13
mindsdb/integrations/handlers/monetdb_handler/utils/monet_get_id.py
Python
15
{ "docstring": "Fetch the id for schema.table_name, defaulting to current schema if\n schema is None\n \n SELECT id\n FROM sys.tables\n WHERE name = '{table_name}'\n AND schema_id = {schema_idm}\n ", "language": "en", "n_whitespaces": 70, "n_words": 25, "vocab_size"...
https://github.com/mindsdb/mindsdb.git
1
is_flow_ready
def is_flow_ready(self, **kwargs) -> bool: return run_async(self.client._is_flow_ready, **kwargs) dry_run = deprecate_by(is_flow_ready)
273fda5a86da0d6bf48f423fa50700e828b40be6
9
mixin.py
48
refactor: merge dryrun into ping (#5151) * refactor: merge dryrun into ping * style: fix overload and cli autocomplete * refactor: merge dryrun into ping * refactor: merge dryrun into ping * refactor: merge dryrun into ping * refactor: merge dryrun into ping Co-authored-by: Jina Dev Bot <dev-bot@jina...
2,490
0
28
23
10
12,995
11
jina
9
jina/clients/mixin.py
Python
7
{ "docstring": "Check if the Flow is ready to receive requests\n\n :param kwargs: potential kwargs received passed from the public interface\n :return: boolean indicating the health/readiness of the Flow\n ", "language": "en", "n_whitespaces": 48, "n_words": 27, "vocab_size": 23 }
https://github.com/jina-ai/jina.git
1
is_decompressed_wo_data
def is_decompressed_wo_data(self) -> bool: return type(self._pb_body) is jina_pb2.DataRequestProtoWoData
c3849c6fee4a65a77a82b2cfda9670d727ff0f53
9
data.py
33
feat: allow to access parameters of data request wo loading data (#4991)
2,382
0
22
19
8
12,696
8
jina
7
jina/types/request/data.py
Python
7
{ "docstring": "\n Checks if the underlying proto object was already deserialized into a :class:`jina.proto.jina_pb2.DataRequestProtoWoData`. It means that the proto is loaded without the data ( docs ).\n\n :return: True if the proto was deserialized before into a DataRequest without docs\n ", ...
https://github.com/jina-ai/jina.git
3
_update_trackables
def _update_trackables(self): for trackable_obj in self._self_tracked_trackables: if isinstance( trackable_obj, tf.__internal__.tracking.TrackableDataStructure ): self._track_variables(trackable_obj)
00524152437b957ca4e850a5db014e223d3c6826
12
base_layer.py
54
isort, black and flake8 checked
83,115
0
78
33
12
279,734
12
keras
10
keras/engine/base_layer.py
Python
6
{ "docstring": "Track variables added to lists/dicts after creation", "language": "en", "n_whitespaces": 6, "n_words": 7, "vocab_size": 7 }
https://github.com/keras-team/keras.git
3
get_unpositioned_tip
def get_unpositioned_tip(self, tip_shape=None, tip_length=None): from manim.mobject.geometry.tips import ArrowTriangleFilledTip if tip_shape is None: tip_shape = ArrowTriangleFilledTip if tip_length is None: tip_length = self.get_default_tip_length() col...
e040bcacd38378386749db18aeba575b93f4ebca
10
arc.py
134
Improved structure of the :mod:`.mobject` module (#2476) * group graphing and update its references * group text and update its references * group opengl and update its references * group three_d and update its references * group geometry and update (most) references * move some chaning.py + updater fil...
46,162
0
123
83
27
189,675
38
manim
17
manim/mobject/geometry/arc.py
Python
11
{ "docstring": "\n Returns a tip that has been stylistically configured,\n but has not yet been given a position in space.\n ", "language": "en", "n_whitespaces": 40, "n_words": 18, "vocab_size": 15 }
https://github.com/ManimCommunity/manim.git
29
fit
def fit(self, X, y, sample_weight=None): solver = _check_solver(self.solver, self.penalty, self.dual) if not isinstance(self.C, numbers.Number) or self.C < 0: raise ValueError("Penalty term must be positive; got (C=%r)" % self.C) if self.penalty == "elasticnet": ...
5f75acdd12d77b973471961ad716367c6199d01c
16
_logistic.py
1,352
MNT Bump joblib version dependency to 1.0.0 (#22365)
75,396
0
2,295
858
258
258,737
490
scikit-learn
81
sklearn/linear_model/_logistic.py
Python
152
{ "docstring": "\n Fit the model according to the given training data.\n\n Parameters\n ----------\n X : {array-like, sparse matrix} of shape (n_samples, n_features)\n Training vector, where `n_samples` is the number of samples and\n `n_features` is the number of feat...
https://github.com/scikit-learn/scikit-learn.git
1
ds
def ds(self): return DeepsetCloudDocumentStore(api_endpoint=DC_API_ENDPOINT, api_key=DC_API_KEY, index=DC_TEST_INDEX) # Integration tests
255072d8d548a19a1678ddc46b41d41cf5d09bc4
8
test_deepsetcloud.py
35
refactor: move dC tests to their own module and job (#3529) * move dC tests to their own module and job * restore global var * revert
75,193
0
26
21
9
258,161
9
haystack
9
test/document_stores/test_deepsetcloud.py
Python
2
{ "docstring": "\n We make this fixture depend on `dc_api_mock` so that passing the document store will\n activate the mocking and we spare one function parameter.\n ", "language": "en", "n_whitespaces": 45, "n_words": 23, "vocab_size": 22 }
https://github.com/deepset-ai/haystack.git
6
_postprocess
def _postprocess(self, inputs): results = [] for examples, texts, temp_results in zip(inputs['batch_examples'], inputs['batch_texts'], inputs['batch_results']): for i in range(len(exam...
1e2ee01dade0d4076ba98aa613c3eb150c615abb
17
text_correction.py
297
Update Taskflow word_segmentation and ner tasks (#1666) * Add AutoSplitter & AutoJoiner * codestyle fix * unify auto joiner * add comments * add sentence split mode * update params * add paddle version check * add wordtag for word_segmentation * add wordtag for word_segmentation * add ner-la...
118,205
0
565
186
54
322,613
77
PaddleNLP
26
paddlenlp/taskflow/text_correction.py
Python
27
{ "docstring": "\n The model output is the logits and probs, this function will convert the model output to raw text.\n ", "language": "en", "n_whitespaces": 33, "n_words": 18, "vocab_size": 15 }
https://github.com/PaddlePaddle/PaddleNLP.git
16
label_tag
def label_tag(self, contents=None, attrs=None, label_suffix=None, tag=None): contents = contents or self.label if label_suffix is None: label_suffix = ( self.field.label_suffix if self.field.label_suffix is not None else self.form.labe...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
15
boundfield.py
380
Refs #33476 -- Reformatted code with Black.
51,286
0
497
230
94
205,927
142
django
23
django/forms/boundfield.py
Python
30
{ "docstring": "\n Wrap the given contents in a <label>, if the field has an ID attribute.\n contents should be mark_safe'd to avoid HTML escaping. If contents\n aren't given, use the field's HTML-escaped label.\n\n If attrs are given, use them as HTML attributes on the <label> tag.\n\n ...
https://github.com/django/django.git
3
__call__
def __call__(self, bbox_pred, gt_bboxes): if self.box_format == 'xywh': gt_bboxes = bbox_xyxy_to_cxcywh(gt_bboxes) elif self.box_format == 'xyxy': bbox_pred = bbox_cxcywh_to_xyxy(bbox_pred) bbox_cost = torch.cdist(bbox_pred, gt_bboxes, p=1) return bbox_co...
cac356380d505bf15587f07c0529218cc36b9652
@MATCH_COST.register_module()
11
match_cost.py
103
[Feature] Add Maskformer to mmdet (#7212) * first commit * add README * move model description from config to readme add description for binary_input add description for dice loss add a independent panoptic gt processing function add a independent panoptic gt processing function remove compatibili...
70,199
1
84
56
23
244,027
28
mmdetection
14
mmdet/core/bbox/match_costs/match_cost.py
Python
7
{ "docstring": "\n Args:\n bbox_pred (Tensor): Predicted boxes with normalized coordinates\n (cx, cy, w, h), which are all in range [0, 1]. Shape\n (num_query, 4).\n gt_bboxes (Tensor): Ground truth boxes with normalized\n coordinates (x1, y1, ...
https://github.com/open-mmlab/mmdetection.git
2
_get_queryset
def _get_queryset(klass): # If it is a model class or anything else with ._default_manager if hasattr(klass, "_default_manager"): return klass._default_manager.all() return klass
9c19aff7c7561e3a82978a272ecdaad40dda5c00
10
shortcuts.py
44
Refs #33476 -- Reformatted code with Black.
51,389
0
40
24
20
206,164
21
django
5
django/shortcuts.py
Python
4
{ "docstring": "\n Return a QuerySet or a Manager.\n Duck typing in action: any class with a `get()` method (for\n get_object_or_404) or a `filter()` method (for get_list_or_404) might do\n the job.\n ", "language": "en", "n_whitespaces": 44, "n_words": 28, "vocab_size": 22 }
https://github.com/django/django.git
3
_get_classifier_artifacts
def _get_classifier_artifacts(fitted_estimator, prefix, X, y_true, sample_weight): import sklearn if not _is_plotting_supported(): return []
847eb6b22d03f0cffef945996cf835272870435a
8
utils.py
41
Improve confusion matrix plot (#5273) * update Signed-off-by: Weichen Xu <weichen.xu@databricks.com> * fix Signed-off-by: Weichen Xu <weichen.xu@databricks.com> * update Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
2,909
0
29
187
13
19,198
13
mlflow
8
mlflow/sklearn/utils.py
Python
48
{ "docstring": "\n Draw and record various common artifacts for classifier\n\n For all classifiers, we always log:\n (1) confusion matrix:\n https://scikit-learn.org/stable/modules/generated/sklearn.metrics.plot_confusion_matrix.html\n\n For only binary classifiers, we will log:\n (2) precision reca...
https://github.com/mlflow/mlflow.git
1
mock_device_tracker_update_config
def mock_device_tracker_update_config(): with patch("homeassistant.components.device_tracker.legacy.update_config"): yield
31a787558fd312331b55e5c2c4b33341fc3601fc
10
test_init.py
29
Ensure recorder test fixture is setup before hass fixture (#80528) * Ensure recorder test fixture is setup before hass fixture * Adjust more tests
88,492
0
18
12
5
289,350
5
core
2
tests/components/demo/test_init.py
Python
3
{ "docstring": "Prevent device tracker from creating known devices file.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/home-assistant/core.git
2
coplanar
def coplanar(self, other): aq = self.axis() ar = other.axis() return (aq == ar or aq == -ar)
e8c5f4fe692e863bf0a48573a1d0c7b92487c5c1
9
quaternion.py
56
hamilton
47,953
0
45
33
13
196,513
17
sympy
6
sympy/algebras/quaternion.py
Python
4
{ "docstring": "\n Returns if the two quaternions are coplanar or not.\n\n Parameters\n ==========\n\n other : a quaternion\n\n Examples\n ========\n\n >>> from sympy.algebras.quaternion import Quaternion\n >>> q = Quaternion(1, 4, 4, 4)\n >>> q1 = Quater...
https://github.com/sympy/sympy.git
2
_TLS_Ext_CertTypeDispatcher
def _TLS_Ext_CertTypeDispatcher(m, *args, **kargs): tmp_len = struct.unpack("!H", m[2:4])[0] if tmp_len == 1: cls = TLS_Ext_ServerCertType else: cls = TLS_Ext_ClientCertType return cls(m, *args, **kargs)
2001f35c7a9762d2d58f5ec402d93d10bbfd8e10
11
extensions.py
87
Fix spellcheck
52,772
0
52
54
18
209,767
23
scapy
10
scapy/layers/tls/extensions.py
Python
7
{ "docstring": "\n We need to select the correct one on dissection. We use the length for\n that, as 1 for client version would imply an empty list.\n ", "language": "en", "n_whitespaces": 35, "n_words": 25, "vocab_size": 22 }
https://github.com/secdev/scapy.git
2
_set_gradient_checkpointing
def _set_gradient_checkpointing(self, module, value=False): if isinstance(module, (Data2VecAudioEncoder, Data2VecAudioFeatureEncoder)): module.gradient_checkpointing = value DATA2VEC_AUDIO_START_DOCSTRING = r DATA2VEC_AUDIO_INPUTS_DOCSTRING = r @add_start_docstrings( "The bare Data2VecAudi...
df5a4094a6e3f98f2cb2058cdb688fcc3f453220
@add_start_docstrings( "The bare Data2VecAudio Model transformer outputting raw hidden-states without any specific head on top.", DATA2VEC_AUDIO_START_DOCSTRING, )
9
modeling_data2vec_audio.py
69
Add Data2Vec (#15507) * Add data2vec model cloned from roberta * Add checkpoint conversion script * Fix copies * Update docs * Add checkpoint conversion script * Remove fairseq data2vec_text script and fix format * Add comment on where to get data2vec_text.py * Remove mock implementation cheat.py ...
6,521
1
53
28
31
35,671
34
transformers
11
src/transformers/models/data2vec/modeling_data2vec_audio.py
Python
3
{ "docstring": "\n Data2VecAudio was proposed in [data2vec: A General Framework for Self-supervised Learning in Speech, Vision and\n Language](https://arxiv.org/pdf/2202.03555) by Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu and\n Michael Auli.\n\n This model inherits from [`PreTrainedM...
https://github.com/huggingface/transformers.git
1
print_help
def print_help(self): help_text = f console.print(text=help_text, menu="Econometrics")
f2ca215132de40804667feb4deaa0c6b8bfc3d25
12
econometrics_controller.py
60
Econometrics Menu (#1403) * Add Statistics Menu * Add Granger Causality test * Apply Black formatting * Add Cointegration Tests * Adjust plotting for Cointegration test * Add Significant parameter to Cointegration tests * Move regression functions to seperate .py files * Progress on Panel Data * A lot of progr...
84,276
0
28
22
7
282,726
7
OpenBBTerminal
9
gamestonk_terminal/econometrics/econometrics_controller.py
Python
35
{ "docstring": "Print help[cmds]\n load load in custom data sets\n export export a dataset\n remove remove a dataset\n options show available column-dataset options[/cmds]\n\n[param]Loaded files:[/param] {\", \".join(self.files) or None}[cmds]\n\nExploration\n sh...
https://github.com/OpenBB-finance/OpenBBTerminal.git
7
print_dict
def print_dict(d, logger, delimiter=0): for k, v in sorted(d.items()): if isinstance(v, dict): logger.info("{}{} : ".format(delimiter * " ", str(k))) print_dict(v, logger, delimiter + 4) elif isinstance(v, list) and len(v) >= 1 and isinstance(v[0], dict): log...
11f6ff38dcc61348aa4aae8ad2fbbe42b0eab34d
@functools.lru_cache()
16
utils.py
234
add supplementary
4,507
1
156
139
37
23,061
60
PaddleOCR
18
test_tipc/supplementary/utils.py
Python
11
{ "docstring": "\n Recursively visualize a dict and\n indenting acrrording by the relationship of keys.\n ", "language": "en", "n_whitespaces": 22, "n_words": 12, "vocab_size": 12 }
https://github.com/PaddlePaddle/PaddleOCR.git
6
is_tradesignal
def is_tradesignal(self, action): # trade signal return not ((action == Actions.Neutral.value and self._position == Positions.Neutral) or (action == Actions.Short.value and self._position == Positions.Short) or (action == Actions.Long.value and self._posi...
8eeaab27467fa2e0bdc7314bdb888998bbb20af8
14
RLPrediction_env.py
102
add reward function
34,793
0
90
65
20
150,565
31
freqtrade
10
freqtrade/freqai/prediction_models/RL/RLPrediction_env.py
Python
4
{ "docstring": "\n not trade signal is :\n Action: Neutral, position: Neutral -> Nothing\n Action: Long, position: Long -> Hold Long\n Action: Short, position: Short -> Hold Short\n ", "language": "en", "n_whitespaces": 61, "n_words": 25, "vocab_size": 16 }
https://github.com/freqtrade/freqtrade.git
3
testPlacementGroupDistributedTraining
def testPlacementGroupDistributedTraining(self, reuse_actors=False): head_bundle = {"CPU": 1, "GPU": 0, "custom": 0} child_bundle = {"CPU": 1} placement_group_factory = PlacementGroupFactory( [head_bundle, child_bundle, child_bundle, child_bundle] )
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
9
test_trial_runner_pg.py
77
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,793
0
69
213
19
132,695
23
ray
7
python/ray/tune/tests/test_trial_runner_pg.py
Python
31
{ "docstring": "Run distributed training using placement groups.\n\n Each trial requests 4 CPUs and starts 4 remote training workers.\n ", "language": "en", "n_whitespaces": 31, "n_words": 17, "vocab_size": 15 }
https://github.com/ray-project/ray.git
11
start
def start(self) -> 'Deployment': if self.is_sandbox and not self._sandbox_deployed: self.update_sandbox_args() if self.pod_args['uses_before'] is not None: _args = self.pod_args['uses_before'] if getattr(self.args, 'noblock_on_start', False): ...
7c4c39a9d82c58ef2493c21a288c755901a9594e
13
__init__.py
417
fix: do not deploy sandbox on init (#4844)
2,287
0
420
256
43
12,429
87
jina
20
jina/orchestrate/deployments/__init__.py
Python
40
{ "docstring": "\n Start to run all :class:`Pod` in this BaseDeployment.\n\n :return: started deployment\n\n .. note::\n If one of the :class:`Pod` fails to start, make sure that all of them\n are properly closed.\n ", "language": "en", "n_whitespaces": 81, "n_w...
https://github.com/jina-ai/jina.git
1
test_roots
def test_roots(self): with DAG("test_dag", start_date=DEFAULT_DATE) as dag: op1 = EmptyOperator(task_id="t1") op2 = EmptyOperator(task_id="t2") op3 = EmptyOperator(task_id="t3") op4 = EmptyOperator(task_id="t4") op5 = EmptyOperator(task_id="t5...
49e336ae0302b386a2f47269a6d13988382d975f
12
test_dag.py
148
Replace usage of `DummyOperator` with `EmptyOperator` (#22974) * Replace usage of `DummyOperator` with `EmptyOperator`
9,164
0
125
86
28
47,576
34
airflow
15
tests/models/test_dag.py
Python
9
{ "docstring": "Verify if dag.roots returns the root tasks of a DAG.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/apache/airflow.git
9
_post_validate_environment
def _post_validate_environment(self, attr, value, templar): env = {} if value is not None:
884244f1b2da3c3f367e064ef4ac0123fcb12675
7
task.py
35
Python 3.9 min for controller (#77566)
79,001
0
34
137
13
267,689
13
ansible
6
lib/ansible/playbook/task.py
Python
22
{ "docstring": "\n Override post validation of vars on the play, as we don't want to\n template these too early.\n ", "language": "en", "n_whitespaces": 39, "n_words": 17, "vocab_size": 17 }
https://github.com/ansible/ansible.git
3
get_edge_data
def get_edge_data(self, u, v, key=None, default=None): try: if key is None: return self._adj[u][v] else: return self._adj[u][v][key] except KeyError: return default
8f4c99debc9440728c5e85f8bffa5d26b232eb6f
14
multigraph.py
83
Multigraph docs update (#5389) * Updated MultiDiGraph documentation to include more examples of actually using parallel edges, and fixed references to things like G[u, v] where G[u, v, k] is required for a MultiDigraph. Have not made parallel changes in MultiGraph which should maybe also be made? Docs tests pass...
41,879
0
104
55
18
176,414
20
networkx
8
networkx/classes/multigraph.py
Python
8
{ "docstring": "Returns the attribute dictionary associated with edge (u, v,\n key).\n\n If a key is not provided, returns a dictionary mapping edge keys\n to attribute dictionaries for each edge between u and v.\n\n This is identical to `G[u][v][key]` except the default is returned\n ...
https://github.com/networkx/networkx.git
2
test_nested_condition_not_filters
def test_nested_condition_not_filters(self, ds, documents): ds.write_documents(documents) filters = { "$not": { "$or": { "$and": {"numbers": {"$lt": 5.0}, "month": {"$ne": "01"}}, "$not": {"year": {"$lte": "2021", "$gte": "2020...
2bb81331b75aec68de0d45c4cb116170d265f1fe
17
test_base.py
366
feat: add SQLDocumentStore tests (#3517) * port SQL tests * cleanup document_store_tests.py from sql tests * leftover * Update .github/workflows/tests.yml Co-authored-by: Sara Zan <sara.zanzottera@deepset.ai> * review comments * Update test/document_stores/test_base.py Co-authored-by: bogdankostic...
75,190
0
352
202
61
258,126
98
haystack
12
test/document_stores/test_base.py
Python
25
{ "docstring": "\n Test nested logical operations within \"$not\", important as we apply De Morgan's laws in WeaviateDocumentstore\n ", "language": "en", "n_whitespaces": 30, "n_words": 15, "vocab_size": 15 }
https://github.com/deepset-ai/haystack.git
2
_project_modified
def _project_modified(self): return any(var.get() for var in self._modified_vars.values())
dab823a3eb7a5257cb1e0818ee10ed234d3de97f
11
project.py
43
Typing - lib.gui.display_command
21,303
0
22
25
8
101,924
8
faceswap
7
lib/gui/project.py
Python
2
{ "docstring": "bool: ``True`` if the project has been modified otherwise ``False``. ", "language": "en", "n_whitespaces": 10, "n_words": 10, "vocab_size": 10 }
https://github.com/deepfakes/faceswap.git
1
test_get_pdu_event_from_cache_is_pristine
def test_get_pdu_event_from_cache_is_pristine(self): # Get the PDU in the cache remote_pdu = self._get_pdu_once() # Modify the the event reference. # This change should not make it back to the `_get_pdu_cache`. remote_pdu.internal_metadata.outlier = True # Get...
0f971ca68e808dd16f53f5594a6b33b7bddcc9a9
13
test_federation_client.py
135
Update `get_pdu` to return the original, pristine `EventBase` (#13320) Update `get_pdu` to return the untouched, pristine `EventBase` as it was originally seen over federation (no metadata added). Previously, we returned the same `event` reference that we stored in the cache which downstream code modified in place and...
72,509
0
246
80
56
248,918
81
synapse
16
tests/federation/test_federation_client.py
Python
13
{ "docstring": "Test that modifications made to events returned by `get_pdu()`\n do not propagate back to to the internal cache (events returned should\n be a copy).\n ", "language": "en", "n_whitespaces": 45, "n_words": 24, "vocab_size": 21 }
https://github.com/matrix-org/synapse.git
5
_store_rejected_events_txn
def _store_rejected_events_txn(self, txn, events_and_contexts): # Remove the rejected events from the list now that we've added them # to the events table and the events_json table. to_remove = set() for event, context in events_and_contexts: if context.rejected: ...
2aa37a4250675f6d9feb57ec0dce65b2a6a3cde6
12
events.py
100
Add `state_key` and `rejection_reason` to `events` (#11792) ... and start populating them for new events
70,993
0
178
63
51
246,084
65
synapse
13
synapse/storage/databases/main/events.py
Python
7
{ "docstring": "Add rows to the 'rejections' table for received events which were\n rejected\n\n Args:\n txn (twisted.enterprise.adbapi.Connection): db connection\n events_and_contexts (list[(EventBase, EventContext)]): events\n we are persisting\n\n Returns:\...
https://github.com/matrix-org/synapse.git
5
read_template
def read_template(self): log.info("reading manifest template '%s'", self.template) template = TextFile(self.template, strip_comments=1, skip_blanks=1, join_lines=1, lstrip_ws=1, rstrip_ws=1, collapse_join=1) try: while...
8198943edd73a363c266633e1aa5b2a9e9c9f526
17
sdist.py
180
add python 3.10.4 for windows
56,758
0
453
110
59
222,820
69
XX-Net
23
python3.10.4/Lib/distutils/command/sdist.py
Python
18
{ "docstring": "Read and parse manifest template file named by self.template.\n\n (usually \"MANIFEST.in\") The parsing and processing is done by\n 'self.filelist', which updates itself accordingly.\n ", "language": "en", "n_whitespaces": 44, "n_words": 23, "vocab_size": 21 }
https://github.com/XX-net/XX-Net.git
3
_clone
def _clone(self) -> HasProps: attrs = self.properties_with_values(include_defaults=False, include_undefined=True) return self.__class__(**{key: val for key, val in attrs.items() if val is not Undefined}) KindRef = Any # TODO
b23a3b77447ede916b31756fca997cbb1b806de7
12
has_props.py
84
Discover unstable defaults in `HasProps.__init__()` (#11959) * Discover unstable defaults in HasProps.__init__() * Make HasProps.__getattr__() fail properly * More sensible implementation of HasProps._clone() * Make InstanceDefault a generic class * Fix recursive model definition in tests * Fix default ...
53,205
0
46
49
23
212,208
26
bokeh
14
bokeh/core/has_props.py
Python
8
{ "docstring": " Duplicate a HasProps object.\n\n Values that are containers are shallow-copied.\n\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 9 }
https://github.com/bokeh/bokeh.git
1
timetz
def timetz(self) -> npt.NDArray[np.object_]: return ints_to_pydatetime(self.asi8, self.tz, box="time")
521259299f7829da667ba39302ec77acedde9e5e
9
datetimes.py
49
DOC: Improve doc summaries in series.rst (#45237)
39,395
0
22
30
8
163,187
8
pandas
10
pandas/core/arrays/datetimes.py
Python
8
{ "docstring": "\n Returns numpy array of :class:`datetime.time` objects with timezone\n information.\n\n The time part of the Timestamps.\n ", "language": "en", "n_whitespaces": 44, "n_words": 15, "vocab_size": 14 }
https://github.com/pandas-dev/pandas.git
3
add_project
def add_project(self, project): from sentry.models import Project try: with atomic_transaction(using=router.db_for_write(ReleaseProject)): created = ReleaseProject.objects.get_or_create(project=project, release=self)[1] if not project.flags.has_relea...
5ceb67a008be09eac939346e9882d2ec244b7e45
19
release.py
150
fix(releases): Fix bug where project.has_releases would be false when there are releases associated with the project (#34205) We increment `new_groups` in `ReleaseProject` in buffers. If `ReleaseProject` doesn't already exist, then buffers will also create the row. The problem here is that we usually rely on `Releas...
19,630
0
153
91
24
99,254
28
sentry
21
src/sentry/models/release.py
Python
11
{ "docstring": "\n Add a project to this release.\n\n Returns True if the project was added and did not already exist.\n ", "language": "en", "n_whitespaces": 40, "n_words": 18, "vocab_size": 17 }
https://github.com/getsentry/sentry.git
3
build
def build(self, var_list): super().build(var_list) if getattr(self, "_built", False): return self._built = True self._momentums = [] self._velocities = [] self._u_product = tf.Variable(1.0, dtype=var_list[0].dtype) # Keep a counter on how many...
84afc5193d38057e2e2badf9c889ea87d80d8fbf
13
nadam.py
182
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
81,352
0
289
113
48
275,258
59
keras
18
keras/optimizers/optimizer_experimental/nadam.py
Python
20
{ "docstring": "Initialize optimizer variables.\n\n Nadam optimizer has 2 types of variables: momentums and velocities.\n\n Args:\n var_list: list of model variables to build Nadam variables on.\n ", "language": "en", "n_whitespaces": 54, "n_words": 24, "vocab_size": 20 }
https://github.com/keras-team/keras.git
1
test_conflicting_autogenerated_basenames
def test_conflicting_autogenerated_basenames(self): self.router.register(r'notes', NoteViewSet) with pytest.raises(ImproperlyConfigured): self.router.register(r'notes_kwduplicate', KWargedNoteViewSet) with pytest.raises(ImproperlyConfigured): self.router.regist...
48a21aa0eb3a95d32456c2a927eff9552a04231e
10
test_routers.py
94
raise ImproperlyConfigured exception if `basename` is not unique (#8438) * raise ImproperlyConfigured if basename already exists * rename already_registered function; return True/False * additional basename tests * additional basename tests * Update rest_framework/routers.py Co-authored-by: David Graves...
9,585
0
62
55
9
48,734
12
django-rest-framework
9
tests/test_routers.py
Python
6
{ "docstring": "\n Ensure 2 routers with the same model, and no basename specified\n throws an ImproperlyConfigured exception\n ", "language": "en", "n_whitespaces": 37, "n_words": 15, "vocab_size": 15 }
https://github.com/encode/django-rest-framework.git
8
meshgrid
def meshgrid(*xi, copy=True, sparse=False, indexing='xy'): ndim = len(xi) if indexing not in ['xy', 'ij']: raise ValueError( "Valid values for `indexing` are 'xy' and 'ij'.") s0 = (1,) * ndim output = [np.asanyarray(x).reshape(s0[:i] + (-1,) + s0[i + 1:]) for i, ...
85a2a7776e8cc01ce3efdc92e262a7764f5fc061
13
function_base.py
275
DOC: Fix typo in meshgrid example coordinate was misspelled in a comment in the example code [ci skip]
38,447
0
198
172
67
159,925
98
numpy
19
numpy/lib/function_base.py
Python
16
{ "docstring": "\n Return coordinate matrices from coordinate vectors.\n\n Make N-D coordinate arrays for vectorized evaluations of\n N-D scalar/vector fields over N-D grids, given\n one-dimensional coordinate arrays x1, x2,..., xn.\n\n .. versionchanged:: 1.9\n 1-D and 0-D cases are allowed.\n\n...
https://github.com/numpy/numpy.git