complexity
int64
1
56
n_identifiers
int64
1
114
code
stringlengths
19
12.7k
path
stringlengths
8
134
n_ast_nodes
int64
12
2.35k
ast_errors
stringlengths
0
4.01k
repo
stringlengths
3
28
documentation
dict
n_words
int64
2
866
language
stringclasses
1 value
vocab_size
int64
2
323
commit_id
stringlengths
40
40
file_name
stringlengths
5
79
id
int64
243
338k
nloc
int64
1
228
token_counts
int64
5
1.4k
fun_name
stringlengths
1
77
url
stringlengths
31
60
commit_message
stringlengths
3
15.3k
n_whitespaces
int64
1
3.23k
n_ast_errors
int64
0
20
d_id
int64
74
121k
ast_levels
int64
4
29
16
27
def find_python(finder, line=None): if line and not isinstance(line, str): raise TypeError( f"Invalid python search type: expected string, received {line!r}" ) if line and os.path.isabs(line): if os.name == "nt": line = make_posix(line) return line ...
pipenv/utils/shell.py
326
pipenv
{ "docstring": "\n Given a `pythonfinder.Finder` instance and an optional line, find a corresponding python\n\n :param finder: A :class:`pythonfinder.Finder` instance to use for searching\n :type finder: :class:pythonfinder.Finder`\n :param str line: A version, path, name, or nothing, defaults to None\n ...
94
Python
53
3387881a6d4fc2d8bdc0f05c484cb2f7222acfb8
shell.py
19,575
28
194
find_python
https://github.com/pypa/pipenv.git
Code reorg utils into utils module reduces complexity (#4990) * Split apart the massive utils.py into a utils module
258
0
3,027
14
1
4
def val(self, request): return request.param
pandas/tests/series/indexing/test_setitem.py
21
pandas
{ "docstring": "\n NA values that should generally be valid_na for *all* dtypes.\n\n Include both python float NaN and np.float64; only np.float64 has a\n `dtype` attribute.\n ", "language": "en", "n_whitespaces": 52, "n_words": 23, "vocab_size": 23 }
5
Python
5
3510b1fd2a9cf752638f4af751bdeb33496db766
test_setitem.py
163,656
2
12
val
https://github.com/pandas-dev/pandas.git
BUG: setting pd.NA into Series casts to object (#45431)
19
0
39,479
6
4
18
def arange(start, stop=None, step=1, dtype="int32"): # Match the behavior of numpy and Theano by returning an empty sequence. if stop is None and start < 0: start = 0 result = tf.range(start, limit=stop, delta=step, name="arange") if dtype != "int32": result = cast(result, dtype) ...
keras/backend.py
134
@keras_export("keras.backend.tile") @tf.__internal__.dispatch.add_dispatch_support @doc_controls.do_not_generate_docs
keras
{ "docstring": "Creates a 1D tensor containing a sequence of integers.\n\n The function arguments use the same convention as\n Theano's arange: if only one argument is provided,\n it is in fact the \"stop\" argument and \"start\" is 0.\n\n The default type of the returned tensor is `'int32'` to\n match...
48
Python
41
84afc5193d38057e2e2badf9c889ea87d80d8fbf
backend.py
269,614
7
65
arange
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
77
1
80,233
10
1
15
def test_guest_access_token(self): token = self.macaroon_generator.generate_guest_access_token("@user:tesths") user_id = self.macaroon_generator.verify_guest_token(token) self.assertEqual(user_id, "@user:tesths") # Raises with another secret key with self.assertRaises(M...
tests/util/test_macaroons.py
177
synapse
{ "docstring": "Test the generation and verification of guest access tokens", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
48
Python
36
fe1daad67237c2154a3d8d8cdf6c603f0d33682e
test_macaroons.py
248,583
12
96
test_guest_access_token
https://github.com/matrix-org/synapse.git
Move the "email unsubscribe" resource, refactor the macaroon generator & simplify the access token verification logic. (#12986) This simplifies the access token verification logic by removing the `rights` parameter which was only ever used for the unsubscribe link in email notifications. The latter has been moved un...
154
0
72,364
10
6
29
def get_docker_network(client) -> Optional[str]: import docker if TYPE_CHECKING: # pragma: no cover from docker.models.containers import Container container: 'Container' = None try: hostname = socket.gethostname() container = client.containers.get(hostname) except dock...
jina/orchestrate/pods/container_helper.py
249
jina
{ "docstring": "Do a best-effort guess if the caller is already in a docker network\n\n Check if `hostname` exists in list of docker containers.\n If a container is found, check its network id\n\n :param client: docker client object\n :return: network id if exists\n ", "language": "en", "n_whitespa...
64
Python
41
f5a362f0ffc5070c104c840ab7833689d39b7bdb
container_helper.py
13,330
32
144
get_docker_network
https://github.com/jina-ai/jina.git
chore: add pragma no cover to TYPE_CHECKING branch (#5299)
243
0
2,601
19
1
2
def valueminus(self): return self["valueminus"]
packages/python/plotly/plotly/graph_objs/bar/_error_x.py
22
plotly.py
{ "docstring": "\n Sets the value of either the percentage (if `type` is set to\n \"percent\") or the constant (if `type` is set to \"constant\")\n corresponding to the lengths of the error bars in the bottom\n (left) direction for vertical (horizontal) bars\n\n The 'valueminus' pro...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_error_x.py
228,639
2
11
valueminus
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
60,312
7
1
3
def required_packages() -> List[Text]: return ["sklearn"]
rasa/nlu/classifiers/logistic_regression_classifier.py
27
rasa
{ "docstring": "Any extra python dependencies required for this component to run.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
6
Python
6
dc762814317ce46873a5226ee09033031a7d3604
logistic_regression_classifier.py
159,357
3
14
required_packages
https://github.com/RasaHQ/rasa.git
Add Logistic Regression to our NLU classifiers. (#10650) * added-logistic-regression * added * d0h! gotta copy the imports correctly * run black * black issues fixed * stash * added tolerance hyperparam * added random seed * fixed testing path * ran black * use joblib directly * insura...
20
0
38,212
7
5
15
def get_uom_conv_factor(uom, stock_uom): if uom == stock_uom: return 1.0 from_uom, to_uom = uom, stock_uom # renaming for readability exact_match = frappe.db.get_value( "UOM Conversion Factor", {"to_uom": to_uom, "from_uom": from_uom}, ["value"], as_dict=1 ) if exact_match: return exact_match.value in...
erpnext/stock/doctype/item/item.py
229
@frappe.whitelist()
erpnext
{ "docstring": "Get UOM conversion factor from uom to stock_uom\n\te.g. uom = \"Kg\", stock_uom = \"Gram\" then returns 1000.0\n\t\n\t\t\tselect (first.value / second.value) as value\n\t\t\tfrom `tabUOM Conversion Factor` first\n\t\t\tjoin `tabUOM Conversion Factor` second\n\t\t\t\ton first.from_uom = second.from_uom...
105
Python
64
494bd9ef78313436f0424b918f200dab8fc7c20b
item.py
67,625
30
131
get_uom_conv_factor
https://github.com/frappe/erpnext.git
style: format code with black
82
1
14,581
11
2
12
def stack1(x, filters, blocks, stride1=2, name=None): x = block1(x, filters, stride=stride1, name=name + "_block1") for i in range(2, blocks + 1): x = block1( x, filters, conv_shortcut=False, name=name + "_block" + str(i) ) return x
keras/applications/resnet.py
109
keras
{ "docstring": "A set of stacked residual blocks.\n\n Args:\n x: input tensor.\n filters: integer, filters of the bottleneck layer in a block.\n blocks: integer, blocks in the stacked blocks.\n stride1: default 2, stride of the first layer in the first block.\n name: string, stack label.\n...
35
Python
26
84afc5193d38057e2e2badf9c889ea87d80d8fbf
resnet.py
269,422
7
73
stack1
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
72
0
80,070
14
1
8
def print_rules(self) -> Iterator[str]: yield from self._defined_facts_lines() yield '' yield '' yield from self._full_implications_lines() yield '' yield '' yield from self._prereq_lines() yield '' yield '' yield from self._beta_r...
sympy/core/facts.py
140
sympy
{ "docstring": " Returns a generator with lines to represent the facts and rules ", "language": "en", "n_whitespaces": 12, "n_words": 11, "vocab_size": 11 }
51
Python
24
f68e8de4252200cfc74b9433d00f77c4510ac68d
facts.py
199,955
18
63
print_rules
https://github.com/sympy/sympy.git
refactor
184
0
49,448
8
10
27
def _process_input(self, batch): if not self._additional_keys: existing_keys = list(batch.keys()) original_boxes = np.array([(face.left, face.top, face.width, face.height) for face in batch["detected_faces"]]) adjusted_boxes = self._get_ad...
plugins/extract/align/_base.py
314
faceswap
{ "docstring": " Process the input to the aligner model multiple times based on the user selected\n `re-feed` command line option. This adjusts the bounding box for the face to be fed\n into the model by a random amount within 0.05 pixels of the detected face's shortest axis.\n\n References\n ...
93
Python
53
5e73437be47f2410439a3c6716de96354e6a0c94
_base.py
101,239
20
205
_process_input
https://github.com/deepfakes/faceswap.git
lib.align updates: - alignments.py - Add typed dicts for imported alignments - Explicitly check for presence of thumb value in alignments dict - linting - detected_face.py - Typing - Linting - Legacy support for pre-aligned face - Update dependencies to new property names
323
0
20,659
14
3
6
def reduce_per_replica(values, strategy, reduction): if reduction == "auto": reduction = "first" if backend.is_tpu_strategy(strategy) else "sum"
keras/engine/training.py
49
keras
{ "docstring": "Attempt to reduce the structure `values` to single values.\n\n Given `values` (a `tf.Tensor` or a `PerReplica` structure),\n which represents the values across all the replicas, `reduce_per_replica`\n attempts to \"reduce\" those values and returns the corresponding structure\n that repres...
15
Python
13
47a4cfe06faf54e271ab50e6d0aae73b06a35f86
training.py
279,867
5
40
reduce_per_replica
https://github.com/keras-team/keras.git
Update training.py
28
0
83,158
11
5
20
def auc(x, y): check_consistent_length(x, y) x = column_or_1d(x) y = column_or_1d(y) if x.shape[0] < 2: raise ValueError( "At least 2 points are needed to compute area under curve, but x.shape = %s" % x.shape ) direction = 1 dx = np.diff(x) if n...
sklearn/metrics/_ranking.py
209
scikit-learn
{ "docstring": "Compute Area Under the Curve (AUC) using the trapezoidal rule.\n\n This is a general function, given points on a curve. For computing the\n area under the ROC-curve, see :func:`roc_auc_score`. For an alternative\n way to summarize a precision-recall curve, see\n :func:`average_precision_...
102
Python
79
f5871a39f445d84b55c5d7897c875a86d590408e
_ranking.py
260,010
20
126
auc
https://github.com/scikit-learn/scikit-learn.git
DOC Ensures that sklearn.metrics._ranking.auc passes numpydoc validation (#23433)
235
0
76,030
15
2
10
def _get_stem(self): filename = os.path.basename(self.src_path) stem, ext = os.path.splitext(filename) return 'index' if stem in ('index', 'README') else stem
mkdocs/structure/files.py
73
mkdocs
{ "docstring": "Return the name of the file without it's extension.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 8 }
18
Python
16
e7f07cc82ab2be920ab426ba07456d8b2592714d
files.py
224,035
4
42
_get_stem
https://github.com/mkdocs/mkdocs.git
Remove spaces at the ends of docstrings, normalize quotes
46
0
57,182
9
2
6
def heappop(heap): lastelt = heap.pop() # raises appropriate IndexError if heap is empty if heap: returnitem = heap[0] heap[0] = lastelt _siftup(heap, 0) return returnitem return lastelt
python3.10.4/Lib/heapq.py
64
XX-Net
{ "docstring": "Pop the smallest item off the heap, maintaining the heap invariant.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 9 }
27
Python
19
8198943edd73a363c266633e1aa5b2a9e9c9f526
heapq.py
217,640
8
38
heappop
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
70
0
54,859
9
2
4
def test_get_significant_states_only(hass_history): hass = hass_history entity_id = "sensor.test"
tests/components/history/test_init.py
25
core
{ "docstring": "Test significant states when significant_states_only is set.", "language": "en", "n_whitespaces": 6, "n_words": 7, "vocab_size": 7 }
8
Python
7
29bda196b5e0a90a2bea7e1797742236114afc1c
test_init.py
299,828
36
264
test_get_significant_states_only
https://github.com/home-assistant/core.git
Break apart recorder into tasks and core modules (#71222)
17
0
98,730
7
1
4
def get_labels(self): return ["O", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC", "B-MISC", "I-MISC"], \ self.BUILDER_CONFIGS[self.name]['pos_tags']
paddlenlp/datasets/conll2002.py
72
PaddleNLP
{ "docstring": "\n Returns labels of ner tags and pos tags.\n ", "language": "en", "n_whitespaces": 23, "n_words": 8, "vocab_size": 8 }
14
Python
14
7b455cce47204d4d664deea9661670a838ec8d35
conll2002.py
322,232
3
39
get_labels
https://github.com/PaddlePaddle/PaddleNLP.git
feat: add conll2002 dataset (#1561) Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
42
0
118,099
9
2
21
def supplier_query(doctype, txt, searchfield, start, page_len, filters): supp_master_name = frappe.defaults.get_user_default("supp_master_name") if supp_master_name == "Supplier Name": fields = ["name", "supplier_group"] else: fields = ["name", "supplier_name", "supplier_group"] fields = get_fields("Supplier"...
erpnext/controllers/queries.py
228
@frappe.whitelist() @frappe.validate_and_sanitize_search_inputs
erpnext
{ "docstring": "select {field} from `tabSupplier`\n\t\twhere docstatus < 2\n\t\t\tand ({key} like %(txt)s\n\t\t\tor supplier_name like %(txt)s) and disabled=0\n\t\t\tand (on_hold = 0 or (on_hold = 1 and CURDATE() > release_date))\n\t\t\t{mcond}\n\t\torder by\n\t\t\tif(locate(%(_txt)s, name), locate(%(_txt)s, name), 9...
54
Python
43
494bd9ef78313436f0424b918f200dab8fc7c20b
queries.py
65,658
24
119
supplier_query
https://github.com/frappe/erpnext.git
style: format code with black
39
1
13,978
15
2
9
def _eval_evalf(self, prec): return Quaternion(*[arg.evalf(n=prec_to_dps(prec)) for arg in self.args])
sympy/algebras/quaternion.py
52
sympy
{ "docstring": "Returns the floating point approximations (decimal numbers) of the quaternion.\n\n Returns\n =======\n\n Quaternion\n Floating point approximations of quaternion(self)\n\n Examples\n ========\n\n >>> from sympy import Quaternion\n >>> from sy...
9
Python
9
498015021131af4dbb07eb110e5badaba8250c7b
quaternion.py
196,019
2
32
_eval_evalf
https://github.com/sympy/sympy.git
Updated import locations
23
0
47,519
14
2
16
def call_deploy(cls, fname, col_partitions, **kwargs): return np.array( [ cls.deploy( cls.parse, num_returns=NPartitions.get() + 2, fname=fname, columns=cols, num_splits=NPart...
modin/core/io/column_stores/column_store_dispatcher.py
96
modin
{ "docstring": "\n Deploy remote tasks to the workers with passed parameters.\n\n Parameters\n ----------\n fname : str, path object or file-like object\n Name of the file to read.\n col_partitions : list\n List of arrays with columns names that should be read\...
24
Python
24
97769988a6f19e4b76f34238c97bf159ee7626a5
column_store_dispatcher.py
153,543
14
65
call_deploy
https://github.com/modin-project/modin.git
REFACTOR-#3853: interacting with Dask interface through 'DaskWrapper' class (#3854) Co-authored-by: Devin Petersohn <devin-petersohn@users.noreply.github.com> Co-authored-by: Dmitry Chigarev <dchigarev@users.noreply.github.com> Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru> Signed-off-by: Anatoly Myachev <...
226
0
35,432
15
8
53
def load_and_dump(self) -> None: with ExitStack() as stack: # set env vars stack.enter_context(change_env('JINA_FULL_CLI', 'true')) # change directory to `workspace` stack.enter_context(change_cwd(get_workspace_path(self.workspace_id))) # lo...
daemon/api/dependencies.py
446
jina
{ "docstring": "\n every Flow created inside JinaD lives inside a container. It is important to know the\n list of ports to be published with localhost before actually starting the container.\n\n 1. `load` the flow yaml here.\n - yaml is stored in `workspace` directory, so we'll `cd` t...
128
Python
94
933415bfa1f9eb89f935037014dfed816eb9815d
dependencies.py
9,812
59
273
load_and_dump
https://github.com/jina-ai/jina.git
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 ...
858
0
1,704
18
5
12
def hvac_action(self) -> HVACAction: if self._model != NA_VALVE and self._boilerstatus is not None: return CURRENT_HVAC_MAP_NETATMO[self._boilerstatus] # Maybe it is a valve if ( heating_req := getattr(self._room, "heating_power_request", 0) ) is not None...
homeassistant/components/netatmo/climate.py
95
core
{ "docstring": "Return the current running hvac operation if supported.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
40
Python
32
81abeac83ed85c5753cb8f2ac317caf079cf1868
climate.py
287,828
9
60
hvac_action
https://github.com/home-assistant/core.git
Netatmo refactor to use pyatmo 7.0.1 (#73482) (#78523) Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
115
0
87,015
12
2
18
def test_actual_timeouts(mock_build_dir): query = bazel_sharding.get_target_expansion_query( ["..."], tests_only=False, exclude_manual=False ) xml_output = bazel_sharding.run_bazel_query(query, debug=False) rules = set(bazel_sharding.extract_rules_from_xml(xml_output)) expected_timeouts...
ci/run/bazel_sharding/tests/test_bazel_sharding.py
218
ray
{ "docstring": "Test that size and timeout attrs are mapped to seconds correctly.\n\n Assert that each of the fake rules is mapped correctly.\n ", "language": "en", "n_whitespaces": 27, "n_words": 21, "vocab_size": 18 }
68
Python
42
d1aa5608979891e3dd859c07fa919fa01cfead5f
test_bazel_sharding.py
134,048
20
134
test_actual_timeouts
https://github.com/ray-project/ray.git
[CI] Make bazel sharding for parallel buildkite more intelligent (#29221) This PR implements two changes to our `bazel-sharding.py` script, used for determining which bazel tests to run on each instance when buildkite parallelism is used: * An ability to filter tests before they are sharded, using the same logic as `...
172
0
30,180
10
2
3
def configTestMesh(device_type_mesh_map): # pylint: disable=invalid-name reset_context()
keras/dtensor/test_util.py
20
keras
{ "docstring": "Configs corresponding mesh given test context.\n\n If runs on a CPU mesh, set virtual device on CPU.\n If runs on a GPU mesh, sets virtual device on GPU with proper memory limits.\n if runs on a TPU mesh, initializes TPU system.\n\n Args:\n device_type_mesh_map: A ...
6
Python
6
84afc5193d38057e2e2badf9c889ea87d80d8fbf
test_util.py
270,641
12
75
configTestMesh
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
21
0
80,502
7
1
22
async def test_lights(hass, mock_bridge_v2, v2_resources_test_data): await mock_bridge_v2.api.load_test_data(v2_resources_test_data) await setup_platform(hass, mock_bridge_v2, "light") # there shouldn't have been any requests at this point assert len(mock_bridge_v2.mock_requests) == 0 # 6 enti...
tests/components/hue/test_light_v2.py
729
core
{ "docstring": "Test if all v2 lights get created with correct features.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
264
Python
124
dbef90654f3693401a2df88fa00afbbffbdffcd2
test_light_v2.py
294,272
52
423
test_lights
https://github.com/home-assistant/core.git
Add effects feature to Hue lights (#68567)
458
0
93,309
11
1
5
def get_devices(self) -> dict[str, dict]: return self.devices
tests/components/lutron_caseta/__init__.py
28
core
{ "docstring": "Will return all known devices connected to the Smart Bridge.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
7
Python
7
8b1713a691bd0c90824261be785f1998ad89f66f
__init__.py
304,501
3
17
get_devices
https://github.com/home-assistant/core.git
Add support for non-serialized devices (light, switch, cover, fan in RA3 Zones) (#75323) Co-authored-by: J. Nick Koston <nick@koston.org>
21
0
103,308
6
5
14
def SearchBackend(params): if connection.vendor == 'postgresql': from .postgres.postgres import PostgresSearchBackend return PostgresSearchBackend(params) elif connection.vendor == 'mysql': from .mysql.mysql import MySQLSearchBackend return MySQLSearchBackend(params) eli...
wagtail/search/backends/database/__init__.py
177
wagtail
{ "docstring": "\n Returns the appropriate search backend for the current 'default' database system\n ", "language": "en", "n_whitespaces": 18, "n_words": 11, "vocab_size": 10 }
52
Python
28
4248d406c011d6ba6207bb0e0e9b885813d961be
__init__.py
70,498
18
99
SearchBackend
https://github.com/wagtail/wagtail.git
Test for presence of fts5 extension in sqlite backend initialisation and migration
174
0
15,513
13
3
13
def at_time(self, time, asof=False, axis=None): # noqa: PR01, RT01, D200 axis = self._get_axis_number(axis) idx = self.index if axis == 0 else self.columns indexer = pandas.Series(index=idx).at_time(time, asof=asof).index return self.loc[indexer] if axis == 0 else self.loc[:, i...
modin/pandas/base.py
118
modin
{ "docstring": "\n Select values at particular time of day (e.g., 9:30AM).\n ", "language": "en", "n_whitespaces": 24, "n_words": 9, "vocab_size": 9 }
35
Python
27
605efa618e7994681f57b11d04d417f353ef8d50
base.py
153,617
5
78
at_time
https://github.com/modin-project/modin.git
DOCS-#3099: Fix `BasePandasDataSet` docstrings warnings (#4333) Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru> Signed-off-by: Alexander Myskov <alexander.myskov@intel.com>
71
0
35,498
12
1
7
def autocorrelation_plot(series, ax=None, **kwargs) -> Axes: plot_backend = _get_plot_backend("matplotlib") return plot_backend.autocorrelation_plot(series=series, ax=ax, **kwargs)
pandas/plotting/_misc.py
60
pandas
{ "docstring": "\n Autocorrelation plot for time series.\n\n Parameters\n ----------\n series : Time series\n ax : Matplotlib axis object, optional\n **kwargs\n Options to pass to matplotlib plotting method.\n\n Returns\n -------\n class:`matplotlib.axis.Axes`\n\n Examples\n --...
13
Python
12
4bb1fd50a63badd38b5d96d9c4323dae7bc36d8d
_misc.py
167,386
32
37
autocorrelation_plot
https://github.com/pandas-dev/pandas.git
TYP: Missing return annotations in util/tseries/plotting (#47510) * TYP: Missing return annotations in util/tseries/plotting * the more tricky parts
22
0
39,990
9
9
20
def _atomic(e, recursive=False): pot = _preorder_traversal(e) seen = set() if isinstance(e, Basic): free = getattr(e, "free_symbols", None) if free is None: return {e} else: return set() from .symbol import Symbol from .function import Derivative, Functio...
sympy/core/basic.py
232
sympy
{ "docstring": "Return atom-like quantities as far as substitution is\n concerned: Derivatives, Functions and Symbols. Do not\n return any 'atoms' that are inside such quantities unless\n they also appear outside, too, unless `recursive` is True.\n\n Examples\n ========\n\n >>> from sympy import Der...
68
Python
46
65be461082dda54c8748922f9c29a19af1279fe1
basic.py
197,309
24
140
_atomic
https://github.com/sympy/sympy.git
Remove abbreviations in documentation
228
0
48,452
14
6
14
def ode_order(expr, func): a = Wild('a', exclude=[func]) if expr.match(a): return 0 if isinstance(expr, Derivative): if expr.args[0] == func: return len(expr.variables) else: return max(ode_order(arg, func) for arg in expr.args[0].args) + len(expr.variab...
sympy/solvers/deutils.py
161
sympy
{ "docstring": "\n Returns the order of a given differential\n equation with respect to func.\n\n This function is implemented recursively.\n\n Examples\n ========\n\n >>> from sympy import Function\n >>> from sympy.solvers.deutils import ode_order\n >>> from sympy.abc import x\n >>> f, g =...
38
Python
26
bd9f607176c58dfba01e27c05c2b7d49ff97c901
deutils.py
198,418
11
103
ode_order
https://github.com/sympy/sympy.git
Improve loop performance in solvers
103
0
48,925
17
1
9
def add_to_apply_calls(self, func, *args, **kwargs): return type(self)( self.list_of_partitions_to_combine, full_axis=self.full_axis, call_queue=self.call_queue + [(func, args, kwargs)], )
modin/core/execution/ray/implementations/pandas_on_ray/partitioning/virtual_partition.py
69
modin
{ "docstring": "\n Add a function to the call queue.\n\n Parameters\n ----------\n func : callable or ray.ObjectRef\n Function to be added to the call queue.\n *args : iterable\n Additional positional arguments to be passed in `func`.\n **kwargs : dict\n...
15
Python
15
8d1004fdbdaa05700613c8e6287641a732acf606
virtual_partition.py
153,194
6
47
add_to_apply_calls
https://github.com/modin-project/modin.git
FIX-#3675: Expand virtual partitioning utility (#3886) Co-authored-by: mvashishtha <mahesh@ponder.io> Co-authored-by: jeffreykennethli <jkli@ponder.io> Co-authored-by: Anatoly Myachev <anatoly.myachev@intel.com> Co-authored-by: Vasily Litvinov <vasilij.n.litvinov@intel.com> Co-authored-by: Alexey Prutskov <alexey....
69
0
35,294
11
2
5
def is_active_loop_rejected(self) -> bool: return self.active_loop is not None and self.active_loop.rejected
rasa/shared/core/trackers.py
35
rasa
{ "docstring": "Return True if there is an active loop and it's rejected.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
11
Python
11
e798bf049f036a5865c14d4343ed8a833864aabe
trackers.py
159,565
3
21
is_active_loop_rejected
https://github.com/RasaHQ/rasa.git
convert TrackerActiveLoop to a dataclass
25
0
38,337
8
1
3
def clear(self): self._value = False
python3.10.4/Lib/asyncio/locks.py
21
XX-Net
{ "docstring": "Reset the internal flag to false. Subsequently, coroutines calling\n wait() will block until set() is called to set the internal flag\n to true again.", "language": "en", "n_whitespaces": 37, "n_words": 24, "vocab_size": 19 }
5
Python
5
8198943edd73a363c266633e1aa5b2a9e9c9f526
locks.py
220,548
2
11
clear
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
19
0
56,047
7
2
13
def unmap(self) -> BaseOperator: dag = self.get_dag() if not dag: raise RuntimeError("Cannot unmap a task unless it has a DAG") dag._remove_task(self.task_id) return self.create_unmapped_operator(dag) # TODO: Deprecate for Airflow 3.0 Chainable = Union[DependencyMi...
airflow/models/baseoperator.py
85
airflow
{ "docstring": "Get the \"normal\" Operator after applying the current mapping", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 8 }
33
Python
31
fded2ca0b9c995737b401896b89e5c9fd7f24c91
baseoperator.py
44,593
7
39
unmap
https://github.com/apache/airflow.git
Rewrite decorated task mapping (#21328)
77
0
8,308
10
2
5
def get_admin_urls_for_registration(self): urls = () for instance in self.modeladmin_instances: urls += instance.get_admin_urls_for_registration() return urls
wagtail/contrib/modeladmin/options.py
45
wagtail
{ "docstring": "\n Utilised by Wagtail's 'register_admin_urls' hook to register urls for\n used by any associated ModelAdmin instances\n ", "language": "en", "n_whitespaces": 37, "n_words": 15, "vocab_size": 14 }
14
Python
12
de3fcba9e95818e9634ab7de6bfcb1f4221f2775
options.py
70,994
5
26
get_admin_urls_for_registration
https://github.com/wagtail/wagtail.git
Fix warnings from flake8-comprehensions.
53
0
15,593
10
1
9
def print_help(self): help_text = f console.print(text=help_text, menu="Stocks - Backtesting")
gamestonk_terminal/stocks/backtesting/bt_controller.py
54
OpenBBTerminal
{ "docstring": "Print help\n[param]Ticker: [/param]{self.ticker.upper()}[cmds]\n\n whatif what if you had bought X shares on day Y\n\n ema buy when price exceeds EMA(l)\n ema_cross buy when EMA(short) > EMA(long)\n rsi buy when RSI < low and sell when RSI > high[/cmds]\n ", ...
9
Python
9
82747072c511beb1b2672846ae2ee4aec53eb562
bt_controller.py
281,535
11
22
print_help
https://github.com/OpenBB-finance/OpenBBTerminal.git
Terminal Wide Rich (#1161) * My idea for how we handle Rich moving forward * remove independent consoles * FIxed pylint issues * add a few vars * Switched print to console * More transitions * Changed more prints * Replaced all prints * Fixing tabulate * Finished replace tabulate * Finish...
30
0
83,833
11
4
17
def resolve_url(root, info): open_as = root.get("open_as", AppExtensionOpenAs.POPUP) app_url = root["app_url"] url = root["url"] if url.startswith("/") and app_url and open_as == AppExtensionOpenAs.POPUP: parsed_url = urlparse(app_url) new_path = urljoin(...
saleor/graphql/app/types.py
139
saleor
{ "docstring": "Return an extension url.\n\n Apply url stitching when these 3 conditions are met:\n - url starts with /\n - openAs == \"POPUP\"\n - appUrl is defined\n ", "language": "en", "n_whitespaces": 73, "n_words": 26, "vocab_size": 23 }
32
Python
23
4e6dca3085479e0ed0c471fe64dbd4ccd7a77a12
types.py
25,584
9
83
resolve_url
https://github.com/saleor/saleor.git
Add new type of target and include openAs option
107
0
4,908
12
2
13
def get_train_dataloader(self): if self.train_dataset is None: raise ValueError("Trainer: training requires a train_dataset.") train_dataset = self.train_dataset train_sampler = self._get_train_sampler() return DataLoader( train_dataset, ba...
paddlenlp/trainer/trainer_base.py
87
PaddleNLP
{ "docstring": "\n Returns the training [`~paddle.io.DataLoader`].\n\n Will use no sampler if `self.train_dataset` does not implement `__len__`, a random sampler (adapted to\n distributed training if necessary) otherwise.\n\n Subclass and override this method if you want to inject some cus...
25
Python
23
44a290e94d1becd1f09fddc3d873f9e19c9d6919
trainer_base.py
323,137
10
54
get_train_dataloader
https://github.com/PaddlePaddle/PaddleNLP.git
[Trainer] Add init version of paddlenlp trainer and apply finetune for ernie-1.0 pretraining. (#1761) * add some datasets for finetune. * support fine tune for all tastks. * add trainer prototype. * init verison for paddlenlp trainer. * refine trainer. * update for some details. * support multi-card...
115
0
118,380
10
13
38
def __call__(self, samples, context=None): coarsest_stride = self.pad_to_stride # multi scale input is nested list if isinstance(samples, typing.Sequence) and len(samples) > 0 and isinstance( samples[0], typing.Sequence): inne...
ppdet/data/transform/batch_operators.py
575
@register_op
PaddleDetection
{ "docstring": "\n Args:\n samples (list): a batch of sample, each is dict.\n ", "language": "en", "n_whitespaces": 36, "n_words": 10, "vocab_size": 10 }
166
Python
85
0a3d768ce3464fca945ba58f0742fbe003930ec7
batch_operators.py
210,019
40
363
__call__
https://github.com/PaddlePaddle/PaddleDetection.git
[dev] update assigner and tood_head (#5169)
699
1
52,850
15
2
11
def is_categorical(arr) -> bool: warnings.warn( "is_categorical is deprecated and will be removed in a future version. " "Use is_categorical_dtype instead.", FutureWarning, stacklevel=find_stack_level(), ) return isinstance(arr, ABCCategorical) or is_categorical_dtype(ar...
pandas/core/dtypes/common.py
62
pandas
{ "docstring": "\n Check whether an array-like is a Categorical instance.\n\n .. deprecated:: 1.1.0\n Use ``is_categorical_dtype`` instead.\n\n Parameters\n ----------\n arr : array-like\n The array-like to check.\n\n Returns\n -------\n boolean\n Whether or not the array-...
28
Python
28
0106c26529900bad0561efb9c9180f7f016365b0
common.py
169,777
39
36
is_categorical
https://github.com/pandas-dev/pandas.git
REVERT caching in find_stack_level (#49053) Revert "PERF cache find_stack_level (#48023)" This reverts commit 2f8d0a36703e81e4dca52ca9fe4f58c910c1b304. Co-authored-by: MarcoGorelli <>
68
0
40,464
10
1
18
def regularization_terms(self) -> torch.Tensor: off_diagonal_entries = torch.masked_select(self.w, ~torch.eye(self.num_classes, dtype=bool)) weight_matrix_loss = self.off_diagonal_l2 * torch.linalg.vector_norm(off_diagonal_entries) bias_vector_loss = self.mu * torch.linalg.vector_norm(s...
ludwig/utils/calibration.py
110
ludwig
{ "docstring": "Off-Diagonal and Intercept Regularisation (ODIR).\n\n Described in \"Beyond temperature scaling: Obtaining well-calibrated multiclass probabilities with Dirichlet\n calibration\"\n https://proceedings.neurips.cc/paper/2019/file/8ca01ea920679a0fe3728441494041b9-Paper.pdf\n "...
24
Python
19
e65f74e87e8e29922f4e9f9d839978ffb2c5b029
calibration.py
7,068
11
70
regularization_terms
https://github.com/ludwig-ai/ludwig.git
Adds mechanism for calibrating probabilities for category and binary features (#1949) * Started adding files for calibration implementation. * Adds option to return logits and labels in predictor. * Pre-commit fixes * First pass temperature scaling working. * Fixes calibration for categorical feature. *...
59
0
1,113
12
7
38
def get_video_input_devices_names() -> List[str]: # based on https://docs.microsoft.com/ru-ru/windows/win32/directshow/selecting-a-capture-device names = [] sys_dev_enum = strmif.ICreateDevEnum() if ole32.CoCreateInstance(uuids.CLSID_SystemDeviceEnum, None, ole32.CLSCTX.CLSCTX_INPROC_SERVER, strmi...
xlib/api/win32/dshow/helper.py
363
DeepFaceLive
{ "docstring": "\n returns a list of available names of VideoInputDevice's\n\n ole32 should be initialized before use\n ", "language": "en", "n_whitespaces": 24, "n_words": 14, "vocab_size": 13 }
82
Python
55
2be32787538f1b0ef83f648ee60d2d4d4868d3fd
helper.py
179,091
25
230
get_video_input_devices_names
https://github.com/iperov/DeepFaceLive.git
update xlib.api.win32
317
0
42,899
21
1
2
def more_better_error_messages(func):
src/sentry/db/postgres/decorators.py
13
sentry
{ "docstring": "\n Wraps functions where the first param is a SQL statement and enforces\n any exceptions thrown will also contain the statement in the message.\n ", "language": "en", "n_whitespaces": 33, "n_words": 23, "vocab_size": 20 }
2
Python
2
71583b888a5c079749333875a0bbb277188ef693
decorators.py
96,697
4
15
more_better_error_messages
https://github.com/getsentry/sentry.git
ref(lang): 🙊 (#32292)
5
0
19,339
6
40
42
def meta_from_array(x, ndim=None, dtype=None): # If using x._meta, x must be a Dask Array, some libraries (e.g. zarr) # implement a _meta attribute that are incompatible with Dask Array._meta if hasattr(x, "_meta") and isinstance(x, Array): x = x._meta if dtype is None and x is None: ...
dask/array/utils.py
816
dask
{ "docstring": "Normalize an array to appropriate meta object\n\n Parameters\n ----------\n x: array-like, callable\n Either an object that looks sufficiently like a Numpy array,\n or a callable that accepts shape and dtype keywords\n ndim: int\n Number of dimensions of the array\n ...
287
Python
149
7471eb3d1e9ccf085b70b219413aa891c8c2c167
utils.py
156,257
66
524
meta_from_array
https://github.com/dask/dask.git
masked scalars input to da.from_array (#8895)
887
0
36,621
21
14
49
def generate_deleted_models(self): new_keys = self.new_model_keys | self.new_unmanaged_keys deleted_models = self.old_model_keys - new_keys deleted_unmanaged_models = self.old_unmanaged_keys - new_keys all_deleted_models = chain( sorted(deleted_models), sorted(delete...
django/db/migrations/autodetector.py
593
django
{ "docstring": "\n Find all deleted models (managed and unmanaged) and make delete\n operations for them as well as separate operations to delete any\n foreign key or M2M relationships (these are optimized later, if\n possible).\n\n Also bring forward removal of any model options th...
223
Python
130
9c19aff7c7561e3a82978a272ecdaad40dda5c00
autodetector.py
205,280
75
389
generate_deleted_models
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
1,559
0
51,062
17
3
7
def all_subclasses(cls): return set(cls.__subclasses__()).union([s for c in cls.__subclasses__() for s in all_subclasses(c)])
scripts/extract_schema.py
61
ludwig
{ "docstring": "Returns recursively-generated list of all children classes inheriting from given `cls`.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
12
Python
10
23a33eef3bc7ea3ba33ec56dc9b56ba38462648a
extract_schema.py
6,557
2
37
all_subclasses
https://github.com/ludwig-ai/ludwig.git
feat: Modify Trainer to use marshmallow_dataclass syntax for handling hyperparameters. Add basic scripting for docstring extraction to marshmallow schema. Fix some existing marshmallow issues. (#1606)
18
0
1,029
11
1
11
def test_second_upgrade_after_delay(self) -> None: channel1 = self._upgrade_room() self.assertEqual(200, channel1.code, channel1.result) channel2 = self._upgrade_room(expire_cache=True) self.assertEqual(200, channel2.code, channel2.result) self.assertNotEqual( ...
tests/rest/client/test_upgrade_room.py
115
synapse
{ "docstring": "A second room upgrade is not deduplicated after some time has passed.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
20
Python
18
99d3931974e65865d1102ee79d7b7e2b017a3180
test_upgrade_room.py
248,621
10
72
test_second_upgrade_after_delay
https://github.com/matrix-org/synapse.git
Add more tests for room upgrades (#13074) Signed-off-by: Sean Quah <seanq@element.io>
91
0
72,379
9
1
8
def test_setup_connection_for_dialect_sqlite(sqlite_version, db_supports_row_number): instance_mock = MagicMock(_db_supports_row_number=True) execute_args = [] close_mock = MagicMock()
tests/components/recorder/test_util.py
44
core
{ "docstring": "Test setting up the connection for a sqlite dialect.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
12
Python
10
a4c1bcefb9d2a6f2aa0bc189fca496d46c78e3b0
test_util.py
300,937
22
143
test_setup_connection_for_dialect_sqlite
https://github.com/home-assistant/core.git
Tune sqlite based on configured settings (#72016)
24
0
99,791
9
1
10
def dry_run(self) -> None: pod = self.build_pod_request_obj() print(yaml.dump(prune_dict(pod.to_dict(), mode='strict')))
airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
62
airflow
{ "docstring": "\n Prints out the pod definition that would be created by this operator.\n Does not include labels specific to the task instance (since there isn't\n one in a dry_run) and excludes all empty elements.\n ", "language": "en", "n_whitespaces": 62, "n_words": 33, "vocab...
9
Python
9
04082ac091e92587b22c8323170ebe38bc68a19a
kubernetes_pod.py
46,963
8
35
dry_run
https://github.com/apache/airflow.git
Cleanup dup code now that k8s provider requires 2.3.0+ (#22845)
30
0
9,046
13
2
19
def get_2d_sincos_pos_embed(embed_dim, grid_size, add_cls_token=False): grid_h = tf.range(grid_size, dtype=tf.float32) grid_w = tf.range(grid_size, dtype=tf.float32) grid = tf.meshgrid(grid_w, grid_h) # here w goes first grid = tf.stack(grid, axis=0) grid = tf.reshape(grid, [2, 1, grid_size, ...
src/transformers/models/vit_mae/modeling_tf_vit_mae.py
176
transformers
{ "docstring": "\n Create 2D sin/cos positional embeddings.\n\n Args:\n embed_dim (`int`):\n Embedding dimension.\n grid_size (`int`):\n The grid height and width.\n add_cls_token (`bool`, *optional*, defaults to `False`):\n Whether or not to add a classific...
46
Python
32
5b40a37bc4da9dc6cd33876ce9bb3f7f48450a03
modeling_tf_vit_mae.py
36,650
10
118
get_2d_sincos_pos_embed
https://github.com/huggingface/transformers.git
Add TF ViT MAE (#16255) * ported TFViTMAEIntermediate and TFViTMAEOutput. * added TFViTMAEModel and TFViTMAEDecoder. * feat: added a noise argument in the implementation for reproducibility. * feat: vit mae models with an additional noise argument for reproducibility. Co-authored-by: ariG23498 <aritra.born...
81
0
6,659
14
5
26
def _test_for_audio_stream(self) -> bool: exe = im_ffm.get_ffmpeg_exe() cmd = [exe, "-hide_banner", "-i", self._source_video, "-f", "ffmetadata", "-"] try: out = check_output(cmd, stderr=STDOUT) except CalledProcessError as err: out = err.output.decode(e...
plugins/convert/writer/ffmpeg.py
251
faceswap
{ "docstring": " Check whether the source video file contains an audio stream.\n\n If we attempt to mux audio from a source video that does not contain an audio stream\n ffmpeg will crash faceswap in a fairly ugly manner.\n\n Returns\n -------\n bool\n ``True if an audio ...
69
Python
57
5a8b5d7b3c6b0b413fe2b4d9247b9dd0cd692fa0
ffmpeg.py
100,688
34
138
_test_for_audio_stream
https://github.com/deepfakes/faceswap.git
bugfix: ffmpeg writer - prevent crash if no audio in source
271
0
20,144
15
4
12
def process_dict_for_yaml_dump(data): for k, v in data.items(): if isinstance(v, dict): data[k] = process_dict_for_yaml_dump(v) elif isinstance(v, str): data[k] = remove_ansi_escape_sequences(v) return data @click.group(help="CLI for managing Serve instances on a...
python/ray/serve/scripts.py
102
@click.group(help="CLI for managing Serve instances on a Ray cluster.")
ray
{ "docstring": "\n Removes ANSI escape sequences recursively for all strings in dict.\n\n We often need to use yaml.dump() to print dictionaries that contain exception\n tracebacks, which can contain ANSI escape sequences that color printed text. However\n yaml.dump() will format the tracebacks incorrectl...
30
Python
26
b856daebbdc923a216ce412be477c61e6cc5707e
scripts.py
125,444
7
53
process_dict_for_yaml_dump
https://github.com/ray-project/ray.git
[Serve] Fix Formatting of Error Messages printed in `serve status` (#26578)
74
1
27,872
13
1
2
async def test_inject_db(db):
tests/orion/database/test_dependencies.py
14
prefect
{ "docstring": "\n Regression test for async-mangling behavior of inject_db() decorator.\n\n Previously, when wrapping a coroutine function, the decorator returned\n that function's coroutine object, instead of the coroutine function.\n\n This worked fine in most cases because both a coroutine function an...
3
Python
3
86956bde0a7efe9699703c5a318afdc76a59efab
test_dependencies.py
52,989
5
25
test_inject_db
https://github.com/PrefectHQ/prefect.git
Expand on regression test description
6
0
10,682
6
1
23
def build_agent_spaces(self) -> Tuple[Space, Space]: # noqa: E501 action_space = Discrete(19) # The football field's corners are [+-1., +-0.42]. However, the players # and balls may get out of the field. Thus we multiply those limits by # a factor of 2. xlim = 1.0 * 2 ...
rllib/env/wrappers/kaggle_wrapper.py
627
ray
{ "docstring": "Construct the action and observation spaces\n\n Description of actions and observations:\n https://github.com/google-research/football/blob/master/gfootball/doc/\n observation.md\n ", "language": "en", "n_whitespaces": 41, "n_words": 13, "vocab_size": 12 }
192
Python
129
8e680c483ce326cefc62e44f68ab1a6948b1c3d2
kaggle_wrapper.py
137,755
62
408
build_agent_spaces
https://github.com/ray-project/ray.git
[RLlib] gymnasium support (new `Env.reset()/step()/seed()/render()` APIs). (#28369)
1,613
0
31,237
21
1
5
def column_names(self) -> List[str]: return self._data.column_names
src/datasets/arrow_dataset.py
29
datasets
{ "docstring": "Names of the columns in the dataset.\n\n Example:\n\n ```py\n >>> from datasets import load_dataset\n >>> ds = load_dataset(\"rotten_tomatoes\", split=\"validation\")\n >>> ds.column_names\n ['text', 'label']\n ```\n ", "language": "en", "n_w...
6
Python
6
445107bae3fcd6ac9eeae503232960fa4ba8ccfd
arrow_dataset.py
104,761
13
17
column_names
https://github.com/huggingface/datasets.git
Add code examples to API docs (#4168) * add code examples for functions related to the base dataset class * ✨ make style * 🖍 make each code example fully reproducible where applicable * 🖍 show parameter usage for some functions * 🖍 add examples for DatasetInfo functions
20
0
21,956
7
2
10
def clean_copy(self) -> "StorableObject": if self.is_proxy: self._data.generate_presigned_url() return StorableObject( id=self.id, data=self._data, tags=self.tags, description=self.description, ) ...
packages/syft/src/syft/core/store/storeable_object.py
119
PySyft
{ "docstring": "\n This method return a copy of self, but clean up the search_permissions and\n read_permissions attributes.\n ", "language": "en", "n_whitespaces": 37, "n_words": 15, "vocab_size": 15 }
22
Python
17
2260fe77c69381a2c815a7213562115969cbf8a3
storeable_object.py
745
17
77
clean_copy
https://github.com/OpenMined/PySyft.git
syft: integrate upload to s3 in send method - data proxy property in storable object class - add method to get presigned GET url in ProxyDataClass - update .get method to support s3 presigned url in case of proxy data class Co-authored-by: IonesioJunior <ionesiojr@gmail.com>
173
0
110
12
7
47
def test_cluster_rllib_restore(start_connected_cluster, tmpdir): cluster = start_connected_cluster dirpath = str(tmpdir) script = .format( address=cluster.address, checkpoint_dir=dirpath ) run_string_as_driver_nonblocking(script) # Wait until the right checkpoint is saved. # The trai...
python/ray/tune/tests/test_cluster.py
365
@pytest.mark.skip(reason="Not very consistent.")
ray
{ "docstring": "\nimport time\nimport ray\nfrom ray import tune\n\nray.init(address=\"{address}\")\n\n\ntune.run(\n \"PG\",\n name=\"experiment\",\n config=dict(env=\"CartPole-v1\", framework=\"tf\"),\n stop=dict(training_iteration=10),\n local_dir=\"{checkpoint_dir}\",\n checkpoint_freq=1,\n max...
124
Python
95
e142be077f0c727ab11ba51ecaba9a98b7bfe474
test_cluster.py
128,591
55
204
test_cluster_rllib_restore
https://github.com/ray-project/ray.git
[tune] Store sync config/checkpoint config in experiment, trial (#29019) This is some clean-up required for future changes to the syncing/checkpointing behavior. At the moment we pass single attributes of these configs to the Experiment class, and then subsequently to the Trial class, from which it is passed on to the...
396
1
28,755
15
3
15
def predict_snli(net, vocab, premise, hypothesis): premise = np.array(vocab[premise], ctx=d2l.try_gpu()) hypothesis = np.array(vocab[hypothesis], ctx=d2l.try_gpu()) label = np.argmax(net([premise.reshape((1, -1)), hypothesis.reshape((1, -1))]), axis=1) return 'entailment'...
d2l/mxnet.py
183
d2l-zh
{ "docstring": "Predict the logical relationship between the premise and hypothesis.\n\n Defined in :numref:`sec_natural-language-inference-attention`", "language": "en", "n_whitespaces": 14, "n_words": 12, "vocab_size": 11 }
40
Python
31
b64b41d8c1ac23c43f7a4e3f9f6339d6f0012ab2
mxnet.py
158,223
7
104
predict_snli
https://github.com/d2l-ai/d2l-zh.git
[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...
97
0
37,391
15
10
59
def _prepare_output_docstrings(output_type, config_class, min_indent=None): output_docstring = output_type.__doc__ # Remove the head of the docstring to keep the list of args only lines = output_docstring.split("\n") i = 0 while i < len(lines) and re.search(r"^\s*(Args|Parameters):\s*$", lines...
src/transformers/utils/doc.py
784
transformers
{ "docstring": "\n Prepares the return part of the docstring using `output_type`.\n \n Example:\n\n ```python\n >>> from transformers import {processor_class}, {model_class}\n >>> import torch\n\n >>> tokenizer = {processor_class}.from_pretrained(\"{checkpoint}\")\n >>> model = {model_class}.f...
304
Python
165
4975002df50c472cbb6f8ac3580e475f570606ab
doc.py
36,379
24
209
_prepare_output_docstrings
https://github.com/huggingface/transformers.git
Reorganize file utils (#16264) * Split file_utils in several submodules * Fixes * Add back more objects * More fixes * Who exactly decided to import that from there? * Second suggestion to code with code review * Revert wront move * Fix imports * Adapt all imports * Adapt all imports everywh...
513
0
6,603
16
1
13
def test_medium_does_not_exist(self) -> None: # test for unknown medium url = "/_synapse/admin/v1/threepid/publickey/users/unknown-key" channel = self.make_request( "GET", url, access_token=self.admin_user_tok, ) self.assertEqual(404...
tests/rest/admin/test_user.py
178
synapse
{ "docstring": "Tests that both a lookup for a medium that does not exist and a user that\n doesn't exist with that third party ID returns a 404", "language": "en", "n_whitespaces": 32, "n_words": 26, "vocab_size": 19 }
48
Python
28
a3623af74e0af0d2f6cbd37b47dc54a1acd314d5
test_user.py
249,805
19
110
test_medium_does_not_exist
https://github.com/matrix-org/synapse.git
Add an Admin API endpoint for looking up users based on 3PID (#14405)
205
0
73,140
10
1
2
async def _async_poll(self) -> None:
homeassistant/components/sonos/binary_sensor.py
17
core
{ "docstring": "Stub for abstract class implementation. Not a pollable attribute.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
5
Python
5
8a8ffa1c0844106a8827dd28b1d42792b366c5ee
binary_sensor.py
308,638
2
8
_async_poll
https://github.com/home-assistant/core.git
Add support for Sonos microphone binary_sensor (#63097) Co-authored-by: J. Nick Koston <nick@koston.org>
12
0
107,383
6
1
7
def argpartition(a, kth, axis=-1, kind='introselect', order=None): return _wrapfunc(a, 'argpartition', kth, axis=axis, kind=kind, order=order)
numpy/core/fromnumeric.py
63
numpy
{ "docstring": "\n Perform an indirect partition along the given axis using the\n algorithm specified by the `kind` keyword. It returns an array of\n indices of the same shape as `a` that index data along the given\n axis in partitioned order.\n\n .. versionadded:: 1.8.0\n\n Parameters\n --------...
13
Python
12
95a7bb4746197a05fd23dbe39c7b3dbb105a18d9
fromnumeric.py
160,087
2
42
argpartition
https://github.com/numpy/numpy.git
DOC: typo corrected in numpy.argpartition (#21201) * DOC: numpy.argpartition typo corrected Co-authored-by: Matti Picus <matti.picus@gmail.com>
19
0
38,481
8
1
5
def get_ylim(self): return tuple(self.viewLim.intervaly)
lib/matplotlib/axes/_base.py
27
matplotlib
{ "docstring": "\n Return the y-axis view limits.\n\n Returns\n -------\n bottom, top : (float, float)\n The current y-axis limits in data coordinates.\n\n See Also\n --------\n .Axes.set_ylim\n set_ybound, get_ybound\n invert_yaxis, yaxis_inve...
4
Python
4
c6e43ff4cfd3cb583b30f9882d6228041edc0fd6
_base.py
107,579
2
15
get_ylim
https://github.com/matplotlib/matplotlib.git
Fix ambiguous link targets in docs.
18
0
22,826
9
3
9
def remove(self, key): self._vertices.remove(key) for f in self._forwards.pop(key): self._backwards[f].remove(key) for t in self._backwards.pop(key): self._forwards[t].remove(key)
.venv/lib/python3.8/site-packages/pip/_vendor/resolvelib/structs.py
98
transferlearning
{ "docstring": "Remove a vertex from the graph, disconnecting all edges from/to it.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
14
Python
12
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
structs.py
63,709
6
62
remove
https://github.com/jindongwang/transferlearning.git
upd; format
64
0
13,480
11
3
27
def adaptive_parzen_normal(args, history_mus, prior_mu, prior_sigma): mus = np.append(history_mus, prior_mu) order = np.argsort(mus) mus = mus[order] prior_index = np.searchsorted(mus, prior_mu) if len(mus) == 1: sigmas = np.asarray([prior_sigma]) elif len(mus) == 2: sigmas...
nni/algorithms/hpo/tpe_tuner.py
373
nni
{ "docstring": "\n The \"Adaptive Parzen Estimator\" described in paper section 4.2, for normal distribution.\n\n Because TPE internally only supports categorical and normal distributed space (domain),\n this function is used for everything other than \"choice\" and \"randint\".\n\n Parameters\n ------...
101
Python
65
b52f7756fbcf6669dbe92e97e11415c4084cf881
tpe_tuner.py
111,911
21
249
adaptive_parzen_normal
https://github.com/microsoft/nni.git
HPO doc (#4579)
199
0
24,508
16
1
26
def test_tqdm_progress_bar_print_no_train(tqdm_write, tmpdir): model = PrintModel() bar = TQDMProgressBar() trainer = Trainer( default_root_dir=tmpdir, num_sanity_val_steps=0, limit_val_batches=1, limit_test_batches=1, limit_predict_batches=1, max_steps=1...
tests/callbacks/test_tqdm_progress_bar.py
183
@mock.patch("builtins.print") @mock.patch("pytorch_lightning.callbacks.progress.tqdm_progress.Tqdm.write")
lightning
{ "docstring": "Test that printing in the LightningModule redirects arguments to the progress bar without training.", "language": "en", "n_whitespaces": 13, "n_words": 14, "vocab_size": 13 }
34
Python
32
97710406210a64f94b135500742165d40ef69cf8
test_tqdm_progress_bar.py
241,747
20
99
test_tqdm_progress_bar_print_no_train
https://github.com/Lightning-AI/lightning.git
Add typing to `TQDMProgressBar` (#11369)
132
1
69,681
11
1
9
async def get_appservice_last_pos(self) -> int: return await self.db_pool.simple_select_one_onecol( table="appservice_stream_position", retcol="stream_ordering", keyvalues={}, desc="get_appservice_last_pos", )
synapse/storage/databases/main/appservice.py
60
synapse
{ "docstring": "\n Get the last stream ordering position for the appservice process.\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 9 }
13
Python
13
21eeacc99551febcddcef21db96a2bd82166fc7e
appservice.py
248,735
10
34
get_appservice_last_pos
https://github.com/matrix-org/synapse.git
Federation Sender & Appservice Pusher Stream Optimisations (#13251) * Replace `get_new_events_for_appservice` with `get_all_new_events_stream` The functions were near identical and this brings the AS worker closer to the way federation senders work which can allow for multiple workers to handle AS traffic. * P...
78
0
72,433
10
1
14
def test_from_estimator_not_fitted(pyplot): regressor = Ridge() with pytest.raises(NotFittedError, match="is not fitted yet."): PredictionErrorDisplay.from_estimator(regressor, X, y) @pytest.mark.parametrize("class_method", ["from_estimator", "from_predictions"]) @pytest.mark.parametrize("kind", ...
sklearn/metrics/_plot/tests/test_predict_error_display.py
113
@pytest.mark.parametrize("class_method", ["from_estimator", "from_predictions"]) @pytest.mark.parametrize("kind", ["actual_vs_predicted", "residual_vs_predicted"])
scikit-learn
{ "docstring": "Check that we raise a `NotFittedError` when the passed regressor is not\n fit.", "language": "en", "n_whitespaces": 15, "n_words": 13, "vocab_size": 13 }
20
Python
20
40d7d880eddaf3a9a5e37ba2a8206caf22744926
test_predict_error_display.py
261,659
4
33
test_from_estimator_not_fitted
https://github.com/scikit-learn/scikit-learn.git
FEA add PredictionErrorDisplay (#18020) Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
34
1
76,920
11
5
32
def test_pagination_from_sync_and_messages(self): channel = self._send_relation(RelationTypes.ANNOTATION, "m.reaction", "A") self.assertEquals(200, channel.code, channel.json_body) annotation_id = channel.json_body["event_id"] # Send an event after the relation events. s...
tests/rest/client/test_relations.py
505
synapse
{ "docstring": "Pagination tokens from /sync and /messages can be used to paginate /relations.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
226
Python
111
df36945ff0e4a293a9dac0da07e2c94256835b32
test_relations.py
246,307
39
289
test_pagination_from_sync_and_messages
https://github.com/matrix-org/synapse.git
Support pagination tokens from /sync and /messages in the relations API. (#11952)
681
0
71,142
13
2
8
def make_vcs_requirement_url(repo_url, rev, project_name, subdir=None): # type: (str, str, str, Optional[str]) -> str egg_project_name = project_name.replace("-", "_") req = f'{repo_url}@{rev}#egg={egg_project_name}' if subdir: req += f'&subdirectory={subdir}' return req
.venv/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.py
80
transferlearning
{ "docstring": "\n Return the URL for a VCS requirement.\n\n Args:\n repo_url: the remote VCS url, with any needed VCS prefix (e.g. \"git+\").\n project_name: the (unescaped) project name.\n ", "language": "en", "n_whitespaces": 45, "n_words": 25, "vocab_size": 21 }
27
Python
23
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
versioncontrol.py
61,401
6
37
make_vcs_requirement_url
https://github.com/jindongwang/transferlearning.git
upd; format
52
0
12,547
10
1
14
def test_alter_value(self): altered_raw_data = apply_changes_to_raw_data( raw_data=self.raw_data, block_path_str="char1", operation=AlterBlockValueOperation(new_value="foo"), streamfield=models.SampleModel.content, ) self.assertEqual(alt...
wagtail/tests/streamfield_migrations/test_simple_structures.py
181
wagtail
{ "docstring": "Change the value of each `char1` block to `foo`\n\n Check whether the value of each `char1` block has changed to `foo`.\n Check whether the values of other blocks are intact.\n ", "language": "en", "n_whitespaces": 51, "n_words": 30, "vocab_size": 19 }
18
Python
17
ad65741b94f36fbe793cf15f0ab002482070cdb6
test_simple_structures.py
80,146
11
110
test_alter_value
https://github.com/wagtail/wagtail.git
Add tests for streamfield migration helpers Currently failing due to wagtail-factories being broken on Wagtail 4.1: https://github.com/wagtail/wagtail-factories/issues/65
111
0
17,024
13
3
17
def upgrade(): conn = op.get_bind() is_sqlite = bool(conn.dialect.name == "sqlite") if is_sqlite: op.execute("PRAGMA foreign_keys=off") with op.batch_alter_table('dag') as batch_op: batch_op.alter_column( 'concurrency', new_column_name='max_active_tasks', ...
airflow/migrations/versions/30867afad44a_rename_concurrency_column_in_dag_table_.py
137
airflow
{ "docstring": "Apply Rename concurrency column in dag table to max_active_tasks", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
28
Python
24
6e5c9c845f7f0975178dbeb76d4ccfe95d0ed803
30867afad44a_rename_concurrency_column_in_dag_table_.py
45,122
14
75
upgrade
https://github.com/apache/airflow.git
Fix some migrations (#21670) In the xcom migration, there's a bad join. The clauses need to be wrapped in and_. And in both, for sqlite we need to temporarily suspend FK enforcement before dropping the tables.
118
0
8,488
12
1
2
def try_except(f): # pylint: disable=inconsistent-return-statements
gamestonk_terminal/decorators.py
14
OpenBBTerminal
{ "docstring": "Adds a try except block if the user is not in development mode\n\n Parameters\n ----------\n f: function\n The function to be wrapped\n ", "language": "en", "n_whitespaces": 41, "n_words": 22, "vocab_size": 21 }
5
Python
5
006b3570b795215a17c64841110b649b03db9a98
decorators.py
281,227
4
17
try_except
https://github.com/OpenBB-finance/OpenBBTerminal.git
Baseclass (#1141) * A working decorator * Basic intro * Added more * Refactor * Refactor * Cleaned code * Simplified function (thanks Chavi) * Small change * Updating tests : fix issue with mock * Updating tests : fix remaining mocks after merging * Updating tests : black * Cleaned up ...
11
0
83,631
6
6
28
def feature_extra_checks(self, name): assert isinstance(name, str) d = self.feature_supported[name] extra_checks = d.get("extra_checks", []) if not extra_checks: return [] self.dist_log("Testing extra checks for feature '%s'" % name, extra_checks) fl...
numpy/distutils/ccompiler_opt.py
267
numpy
{ "docstring": "\n Return a list of supported extra checks after testing them against\n the compiler.\n\n Parameters\n ----------\n names : str\n CPU feature name in uppercase.\n ", "language": "en", "n_whitespaces": 77, "n_words": 23, "vocab_size": 23 }
79
Python
59
f404e9e92e87a3990712d723d5c562a89300ac01
ccompiler_opt.py
160,177
24
162
feature_extra_checks
https://github.com/numpy/numpy.git
Add space after argument name
311
0
38,549
13
5
4
def is_reachable(G, s, t):
networkx/algorithms/tournament.py
17
networkx
{ "docstring": "Decides whether there is a path from `s` to `t` in the\n tournament.\n\n This function is more theoretically efficient than the reachability\n checks than the shortest path algorithms in\n :mod:`networkx.algorithms.shortest_paths`.\n\n The given graph **must** be a tournament, otherwise...
4
Python
4
5a7985fc41bc0c686c035de43c66cf4fb5fcc94f
tournament.py
176,547
5
54
is_reachable
https://github.com/networkx/networkx.git
Added examples in tournament and tree functions (#5536) * examples * examples * examples * Example changed * improved styling * revised * edge labels * improved styling * spacing * error testing * examples * styling * add_nodes removed * spaceing * spacing * spacing * ad...
7
0
41,956
6
1
9
def forward(self, inputs, labels): logits = self.nsp(inputs) loss = F.cross_entropy(logits, labels) return loss
modules/image/text_to_image/disco_diffusion_ernievil_base/vit_b_16x/ernievil2/transformers/ernie_modeling.py
48
PaddleHub
{ "docstring": "\n Args:\n start_pos (optional, `Variable` of shape [batch_size]):\n token index of start of answer span in `context`\n end_pos (optional, `Variable` of shape [batch_size]):\n token index of end of answer span in `context`\n Returns:\n ...
13
Python
11
ffcde21305c61d950a9f93e57e6180c9a9665b87
ernie_modeling.py
50,263
4
30
forward
https://github.com/PaddlePaddle/PaddleHub.git
add disco_diffusion_ernievil_base
41
0
10,073
8
1
4
def identify(self, requirement_or_candidate): # type: (Candidate | Requirement) -> str return requirement_or_candidate.canonical_package_id
lib/ansible/galaxy/dependency_resolution/providers.py
22
ansible
{ "docstring": "Given requirement or candidate, return an identifier for it.\n\n This is used to identify a requirement or candidate, e.g.\n whether two requirements should have their specifier parts\n (version ranges or pins) merged, whether two candidates would\n conflict with each other...
12
Python
12
8b2e6285650ec42ec4a19075a8567047e8304ba2
providers.py
266,878
2
12
identify
https://github.com/ansible/ansible.git
galaxy - Clean up type hints and imports.
33
0
78,637
6
6
17
def detect_indentation(self) -> int: _indentations = { len(match.group(1)) for match in re.finditer(r"^( *)(.*)$", self.plain, flags=re.MULTILINE) } try: indentation = ( reduce(gcd, [indent for indent in _indentations if not indent %...
pipenv/patched/notpip/_vendor/rich/text.py
116
pipenv
{ "docstring": "Auto-detect indentation of code.\n\n Returns:\n int: Number of spaces used to indent code.\n ", "language": "en", "n_whitespaces": 38, "n_words": 13, "vocab_size": 11 }
41
Python
32
f3166e673fe8d40277b804d35d77dcdb760fc3b3
text.py
20,864
17
74
detect_indentation
https://github.com/pypa/pipenv.git
check point progress on only bringing in pip==22.0.4 (#4966) * vendor in pip==22.0.4 * updating vendor packaging version * update pipdeptree to fix pipenv graph with new version of pip. * Vendoring of pip-shims 0.7.0 * Vendoring of requirementslib 1.6.3 * Update pip index safety restrictions patch for p...
153
0
3,602
16
9
54
def save_model(model, filepath, weights_format="h5"): if not filepath.endswith(".keras"): raise ValueError( "Invalid filename: expected a `.keras` extension. " f"Received: filepath={filepath}" ) if weights_format == "h5" and h5py is None: raise ImportError("h...
keras/saving/experimental/saving_lib.py
521
keras
{ "docstring": "Save a zip-archive representing a Keras model to the given filepath.\n\n The zip-based archive contains the following structure:\n\n - JSON-based configuration file (config.json): Records of model, layer, and\n other trackables' configuration.\n - NPZ-based trackable state files, found...
181
Python
129
e6f739a31247c43a86c37c33b0b8b2ba6be6a5f6
saving_lib.py
280,200
59
291
save_model
https://github.com/keras-team/keras.git
- Add standalone weights file saving/loading functionality. - Switch to in-memory, single write / single read archive saving for better performance. - Remove ability to pick between zipping or not zipping a Keras saved artifact: it's always a zip archive now. PiperOrigin-RevId: 483705728
770
0
83,285
17
5
23
def process_deferred_accounting(posting_date=None): if not posting_date: posting_date = today() if not cint( frappe.db.get_singles_value( "Accounts Settings", "automatically_process_deferred_accounting_entry" ) ): return start_date = add_months(today(), -1) end_date = add_days(today(), -1) compan...
erpnext/accounts/deferred_revenue.py
207
erpnext
{ "docstring": "Converts deferred income/expense into income/expense\n\tExecuted via background jobs on every month end", "language": "en", "n_whitespaces": 11, "n_words": 13, "vocab_size": 12 }
54
Python
43
494bd9ef78313436f0424b918f200dab8fc7c20b
deferred_revenue.py
64,731
26
124
process_deferred_accounting
https://github.com/frappe/erpnext.git
style: format code with black
28
0
13,709
16
1
21
def test_disabled(self) -> None: fake_oidc_server = self.helper.fake_oidc_server() user = "john" login_resp, grant = self.helper.login_via_oidc( fake_oidc_server, user, with_sid=True ) access_token: str = login_resp["access_token"] self.helper.whoami...
tests/rest/client/test_auth.py
163
synapse
{ "docstring": "\n Receiving a logout token should do nothing if it is disabled in the config\n ", "language": "en", "n_whitespaces": 29, "n_words": 14, "vocab_size": 14 }
47
Python
39
cc3a52b33df72bb4230367536b924a6d1f510d36
test_auth.py
249,779
15
100
test_disabled
https://github.com/matrix-org/synapse.git
Support OIDC backchannel logouts (#11414) If configured an OIDC IdP can log a user's session out of Synapse when they log out of the identity provider. The IdP sends a request directly to Synapse (and must be configured with an endpoint) when a user logs out.
149
0
73,122
9
2
2
def test_literal_slice_boxing(self):
numba/tests/test_slices.py
13
numba
{ "docstring": "\n Tests that a literal slice can be used\n as an argument to a JIT function.\n ", "language": "en", "n_whitespaces": 45, "n_words": 15, "vocab_size": 14 }
2
Python
2
0294ef37a19ecd995823678462faedbe10a09b22
test_slices.py
161,979
13
77
test_literal_slice_boxing
https://github.com/numba/numba.git
support for boxing SliceLiteral type
9
0
39,117
6
1
4
def _expects_training_arg(self): return self._call_spec.expects_training_arg
keras/engine/base_layer.py
22
keras
{ "docstring": "Whether the call function uses 'training' as a parameter.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
4
Python
4
84afc5193d38057e2e2badf9c889ea87d80d8fbf
base_layer.py
270,679
2
12
_expects_training_arg
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
18
0
80,522
7
1
5
def __array_wrap__(self, result, context=None): # TODO: This is very inefficient. __array__ and as_matrix have been # changed to call the more efficient to_numpy, but this has been left # unchanged since we are not sure of its purpose. return self._default_to_pandas("__array_wra...
modin/pandas/base.py
43
modin
{ "docstring": "\n Get called after a ufunc and other functions.\n\n Parameters\n ----------\n result : np.ndarray\n The result of the ufunc or other function called on the NumPy array\n returned by __array__.\n context : tuple of (func, tuple, int), optional\n...
42
Python
38
605efa618e7994681f57b11d04d417f353ef8d50
base.py
153,621
2
25
__array_wrap__
https://github.com/modin-project/modin.git
DOCS-#3099: Fix `BasePandasDataSet` docstrings warnings (#4333) Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru> Signed-off-by: Alexander Myskov <alexander.myskov@intel.com>
77
0
35,502
8
2
8
def get_primary_key_column(self, cursor, table_name): cursor.execute( , [table_name], ) row = cursor.fetchone() return self.identifier_converter(row[0]) if row else None
django/db/backends/oracle/introspection.py
63
django
{ "docstring": "\n SELECT\n cols.column_name\n FROM\n user_constraints,\n user_cons_columns cols\n WHERE\n user_constraints.constraint_name = cols.constraint_name AND\n user_constraints.constraint_type = 'P' AN...
17
Python
16
c5cd8783825b5f6384417dac5f3889b4210b7d08
introspection.py
203,224
18
41
get_primary_key_column
https://github.com/django/django.git
Refs #33476 -- Refactored problematic code before reformatting by Black. In these cases Black produces unexpected results, e.g. def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789', ): or cursor.execute(""" SELECT ... """, ...
66
0
50,258
9
3
8
def get_extra_loggers(self) -> List[str]: return ( [name.strip() for name in self.extra_loggers.split(",")] if self.extra_loggers else [] )
src/prefect/utilities/settings.py
64
prefect
{ "docstring": "\n Parse the `extra_loggers` CSV and trim whitespace from logger names\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 10 }
16
Python
16
a452d8b8917000774302411a7aeb949f7e326814
settings.py
53,193
9
39
get_extra_loggers
https://github.com/PrefectHQ/prefect.git
Strip logger name to prevent accidental spaces
70
0
10,735
12
3
16
def _get_input_from_iterator(iterator, model): next_element = iterator.get_next() # `len(nest.flatten(x))` is going to not count empty elements such as {}. # len(nest.flatten([[0,1,2], {}])) is 3 and not 4. The `next_element` is # going to get flattened in `_prepare_feed_values` to work around t...
keras/distribute/distributed_training_utils_v1.py
176
keras
{ "docstring": "Get elements from the iterator and verify the input shape and type.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 10 }
115
Python
67
84afc5193d38057e2e2badf9c889ea87d80d8fbf
distributed_training_utils_v1.py
270,328
17
108
_get_input_from_iterator
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
215
0
80,431
12
7
28
def _get_target_nodes(self) -> List[Tuple[str, str]]: location = self._config.location target_nodes = get_all_node_ids() if location == DeploymentMode.NoServer: return [] if location == DeploymentMode.HeadOnly: head_node_resource_key = get_current_node_...
python/ray/serve/http_state.py
235
ray
{ "docstring": "Return the list of (id, resource_key) to deploy HTTP servers on.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
101
Python
72
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
http_state.py
130,910
26
137
_get_target_nodes
https://github.com/ray-project/ray.git
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
426
0
29,422
16
3
9
async def cancel_triggers(self): while self.to_cancel: trigger_id = self.to_cancel.popleft() if trigger_id in self.triggers: # We only delete if it did not exit already self.triggers[trigger_id]["task"].cancel() await asyncio.sleep(0)
airflow/jobs/triggerer_job.py
83
airflow
{ "docstring": "\n Drain the to_cancel queue and ensure all triggers that are not in the\n DB are cancelled, so the cleanup job deletes them.\n ", "language": "en", "n_whitespaces": 44, "n_words": 22, "vocab_size": 19 }
25
Python
23
c20ad79b40ea2b213f6dca221221c6dbd55bd08f
triggerer_job.py
43,650
6
47
cancel_triggers
https://github.com/apache/airflow.git
Rename `to_delete` to `to_cancel` in TriggerRunner (#20658) The queue's purpose is to track triggers that need to be canceled. The language `to_delete` was a bit confusing because for one it does not actually delete them but cancel them. The deletion work is actually in `cleanup_finished_triggers`. It seems that thi...
102
0
8,018
14
2
5
def set_url_path(self, parent): if parent: self.url_path = parent.url_path + self.slug + "/" else: # a page without a parent is the tree root, which always has a url_path of '/' self.url_path = "/" return self.url_path
wagtail/core/models/__init__.py
63
wagtail
{ "docstring": "\n Populate the url_path field based on this page's slug and the specified parent page.\n (We pass a parent in here, rather than retrieving it via get_parent, so that we can give\n new unsaved pages a meaningful URL when previewing them; at that point the page has not\n bee...
35
Python
28
d10f15e55806c6944827d801cd9c2d53f5da4186
__init__.py
73,844
6
35
set_url_path
https://github.com/wagtail/wagtail.git
Reformat with black
96
0
16,139
11
2
6
def order(self): if self.characteristic == 0: raise NotImplementedError("Still not implemented") return len(self.points())
sympy/ntheory/elliptic_curve.py
49
sympy
{ "docstring": "\n Number of points in Finite field.\n\n Examples\n ========\n\n >>> from sympy.ntheory.elliptic_curve import EllipticCurve\n >>> e2 = EllipticCurve(1, 0, modulus=19)\n >>> e2.order\n 19\n\n ", "language": "en", "n_whitespaces": 79, "n_word...
12
Python
12
8fc835bcd86ea080644783a363e47adca6dff3a7
elliptic_curve.py
200,253
4
27
order
https://github.com/sympy/sympy.git
Remove redundant list calls
44
0
49,567
10
1
33
async def test_fossil_energy_consumption(hass, hass_ws_client, recorder_mock): now = dt_util.utcnow() later = dt_util.as_utc(dt_util.parse_datetime("2022-09-01 00:00:00")) await async_setup_component(hass, "history", {}) await async_setup_component(hass, "sensor", {}) await async_recorder_bloc...
tests/components/energy/test_websocket_api.py
1,475
core
{ "docstring": "Test fossil_energy_consumption with co2 sensor data.", "language": "en", "n_whitespaces": 5, "n_words": 6, "vocab_size": 6 }
397
Python
139
5d7756885be0fd044d86e60ec0d2639f9d114ea3
test_websocket_api.py
288,579
183
904
test_fossil_energy_consumption
https://github.com/home-assistant/core.git
Normalize to kWh when handling WS energy/fossil_energy_consumption (#79649) * Normalize to kWh when handling WS energy/fossil_energy_consumption * Improve test
1,806
0
87,736
15
7
54
def test_application_services_receive_bursts_of_to_device(self): # Register two application services with exclusive interest in a user interested_appservices = [] for _ in range(2): appservice = self._register_application_service( namespaces={ ...
tests/handlers/test_appservice.py
514
synapse
{ "docstring": "\n Test that when a user sends >100 to-device messages at once, any\n interested AS's will receive them in separate transactions.\n\n Also tests that uninterested application services do not receive messages.\n ", "language": "en", "n_whitespaces": 59, "n_words": 30, ...
373
Python
199
64ec45fc1b0856dc7daacca7d3ab75d50bd89f84
test_appservice.py
246,233
64
308
test_application_services_receive_bursts_of_to_device
https://github.com/matrix-org/synapse.git
Send to-device messages to application services (#11215) Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
1,357
0
71,114
17
1
2
def imaginaryaxis(self): return self["imaginaryaxis"]
packages/python/plotly/plotly/graph_objs/layout/_smith.py
22
plotly.py
{ "docstring": "\n The 'imaginaryaxis' property is an instance of Imaginaryaxis\n that may be specified as:\n - An instance of :class:`plotly.graph_objs.layout.smith.Imaginaryaxis`\n - A dict of string/value properties that will be passed\n to the Imaginaryaxis constructor\n...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_smith.py
231,700
2
11
imaginaryaxis
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
63,144
7
2
6
def vf2pp_is_isomorphic(G1, G2, node_label=None, default_label=None): if vf2pp_isomorphism(G1, G2, node_label, default_label) is not None: return True return False
networkx/algorithms/isomorphism/vf2pp.py
51
networkx
{ "docstring": "Examines whether G1 and G2 are isomorphic.\n\n Parameters\n ----------\n G1, G2 : NetworkX Graph or MultiGraph instances.\n The two graphs to check for isomorphism.\n\n node_label : str, optional\n The name of the node attribute to be used when comparing nodes.\n The d...
17
Python
15
a796f526c7ce6a7f182aee4b81b8499feabe1a45
vf2pp.py
177,286
4
35
vf2pp_is_isomorphic
https://github.com/networkx/networkx.git
VF2++ for Directed Graphs (#5972) Modify vf2pp implementation to support directed graphs. Updates all helper functions and state/parameter objects to account for in/out degree. Includes other changes such as renaming the keyword argument from node_labels to node_label to better reflect the fact that the label kwa...
33
0
42,325
8
1
7
def commit_sha(): return run_command( ['git', 'rev-parse', 'HEAD'], capture_output=True, text=True, check=False ).stdout.strip()
dev/breeze/src/airflow_breeze/utils/run_utils.py
58
airflow
{ "docstring": "Returns commit SHA of current repo. Cached for various usages.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
11
Python
11
4ffd4f09532fceb67675fce4c1f5cd383eff992e
run_utils.py
46,790
4
34
commit_sha
https://github.com/apache/airflow.git
Prepare Breeze2 for prime time :) (#22713) This is a review and clean-up for all the parameters and commands for Breeze2 in order to prepare it for being used by the contribugors. There are various small fixes here and there, removal of duplicated code, refactoring and moving code around as well as cleanup and ...
27
0
8,994
12
11
23
def _copy_source_without_wildcard(self, hook, prefix): objects = hook.list(self.source_bucket, prefix=prefix, delimiter=self.delimiter) if not self.replace: # If we are not replacing, ignore files already existing in source buckets objects = self._ignore_existing_files(...
airflow/providers/google/cloud/transfers/gcs_to_gcs.py
296
airflow
{ "docstring": "\n For source_objects with no wildcard, this operator would first list\n all files in source_objects, using provided delimiter if any. Then copy\n files from source_objects to destination_object and rename each source\n file.\n\n Example 1:\n\n\n The following...
111
Python
77
ec84ffe71cfa8246155b9b4cb10bf2167e75adcf
gcs_to_gcs.py
42,927
23
185
_copy_source_without_wildcard
https://github.com/apache/airflow.git
Fix GCSToGCSOperator cannot copy a single file/folder without copying other files/folders with that prefix (#24039)
413
0
7,766
14
21
39
def _encode_files(files, data): if not files: raise ValueError("Files must be provided.") elif isinstance(data, basestring): raise ValueError("Data must not be a string.") new_fields = [] fields = to_key_val_list(data or {}) files = to_key_val_li...
pipenv/patched/pip/_vendor/requests/models.py
497
pipenv
{ "docstring": "Build the body for a multipart/form-data request.\n\n Will successfully encode files when passed as a dict or a list of\n tuples. Order is retained if data is a list of tuples but arbitrary\n if parameters are supplied as a dict.\n The tuples may be 2-tuples (filename, file...
184
Python
106
cd5a9683be69c86c8f3adcd13385a9bc5db198ec
models.py
22,102
49
313
_encode_files
https://github.com/pypa/pipenv.git
Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir.
905
0
4,180
18
1
2
def sector(self): return self["sector"]
packages/python/plotly/plotly/graph_objs/layout/_polar.py
22
plotly.py
{ "docstring": "\n Sets angular span of this polar subplot with two angles (in\n degrees). Sector are assumed to be spanned in the\n counterclockwise direction with 0 corresponding to rightmost\n limit of the polar subplot.\n\n The 'sector' property is an info ar...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_polar.py
231,632
2
11
sector
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
63,076
7