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
2
6
def on_predict_end(self, logs=None): logs = self._process_logs(logs) for callback in self.callbacks: callback.on_predict_end(logs)
keras/callbacks.py
51
keras
{ "docstring": "Calls the `on_predict_end` methods of its callbacks.\n\n Args:\n logs: Dict. Currently, no data is passed via this argument\n for this method, but that may change in the future.\n ", "language": "en", "n_whitespaces": 66, "n_words": 28, "vocab_size": 26 }
11
Python
11
84afc5193d38057e2e2badf9c889ea87d80d8fbf
callbacks.py
269,909
4
31
on_predict_end
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
43
0
80,323
9
3
5
def get_func(cls, key, **kwargs): if "agg_func" in kwargs: return cls.inplace_applyier_builder(key, kwargs["agg_func"]) elif "func_dict" in kwargs: return cls.inplace_applyier_builder(key, kwargs["func_dict"]) else: return cls.inplace_applyier_builder...
modin/core/dataframe/algebra/default2pandas/groupby.py
92
modin
{ "docstring": "\n Extract aggregation function from groupby arguments.\n\n Parameters\n ----------\n key : callable or str\n Default aggregation function. If aggregation function is not specified\n via groupby arguments, then `key` function is used.\n **kwargs...
21
Python
16
1e65a4afd191cf61ba05b80545d23f9b88962f41
groupby.py
153,097
7
54
get_func
https://github.com/modin-project/modin.git
FIX-#3197: do not pass lambdas to the backend in GroupBy (#3373) Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
82
0
35,257
12
2
30
def mock_json_schema(request, monkeypatch, tmp_path): # Do not patch integration tests if "integration" in request.keywords: return # Mock the subclasses list to make it very small, containing only mock nodes monkeypatch.setattr( haystack.nodes._json_schema, "find_subclasse...
test/test_pipeline_yaml.py
209
@pytest.mark.integration @pytest.mark.elasticsearch
haystack
{ "docstring": "\n JSON schema with the unstable version and only mocked nodes.\n ", "language": "en", "n_whitespaces": 17, "n_words": 10, "vocab_size": 10 }
82
Python
68
11cf94a9652a577732941f27ad59eb7c8bc5063e
test_pipeline_yaml.py
256,915
13
116
mock_json_schema
https://github.com/deepset-ai/haystack.git
Pipeline's YAML: syntax validation (#2226) * Add BasePipeline.validate_config, BasePipeline.validate_yaml, and some new custom exception classes * Make error composition work properly * Clarify typing * Help mypy a bit more * Update Documentation & Code Style * Enable autogenerated docs for Milvus1 and ...
148
1
74,961
11
2
6
def _get_name_info(name_index, name_list): argval = name_index if name_list is not None: argval = name_list[name_index] argrepr = argval else: argrepr = repr(argval) return argval, argrepr
python3.10.4/Lib/dis.py
63
XX-Net
{ "docstring": "Helper to get optional details about named references\n\n Returns the dereferenced name as both value and repr if the name\n list is defined.\n Otherwise returns the name index and its repr().\n ", "language": "en", "n_whitespaces": 52, "n_words": 31, "vocab_size": 26 }
24
Python
17
8198943edd73a363c266633e1aa5b2a9e9c9f526
dis.py
222,538
8
38
_get_name_info
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
60
0
56,627
11
9
10
def cast_losses_to_common_dtype(losses): highest_float = None for loss in losses: if loss.dtype.is_floating: if highest_float is None or loss.dtype.size > highest_float.size: highest_float = loss.dtype elif {loss.dtype, highest_float} == {"bfloat16", "float16...
keras/utils/losses_utils.py
148
keras
{ "docstring": "Cast a list of losses to a common dtype.\n\n If any loss is floating-point, they will all be casted to the most-precise\n floating-point loss. Otherwise the losses are not casted. We also skip casting\n losses if there are any complex losses.\n\n Args:\n losses: A list of losses.\n\n ...
61
Python
43
84afc5193d38057e2e2badf9c889ea87d80d8fbf
losses_utils.py
276,973
15
91
cast_losses_to_common_dtype
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
187
0
81,807
14
5
17
def get_available_models() -> List[str]: modelpath = os.path.join(os.path.dirname(__file__), "train", "model") models = sorted(item.name.replace(".py", "").replace("_", "-") for item in os.scandir(modelpath) if not item.name.startswith("_") ...
plugins/plugin_loader.py
163
faceswap
{ "docstring": " Return a list of available training models\n\n Returns\n -------\n list:\n A list of the available training model plugin names\n ", "language": "en", "n_whitespaces": 59, "n_words": 19, "vocab_size": 15 }
28
Python
24
13cfb3f39e72e9ca181f173b7b3db2a048db0d08
plugin_loader.py
101,476
15
93
get_available_models
https://github.com/deepfakes/faceswap.git
extract: Add batch processing mode
148
0
20,889
15
1
13
def cosine_similarity(cooccurrence): diag_rows, diag_cols = _get_row_and_column_matrix(cooccurrence.diagonal()) with np.errstate(invalid="ignore", divide="ignore"): result = cooccurrence / np.sqrt(diag_rows * diag_cols) return np.array(result)
recommenders/utils/python_utils.py
90
recommenders
{ "docstring": "Helper method to calculate the Cosine similarity of a matrix of\n co-occurrences.\n\n Cosine similarity can be interpreted as the angle between the i-th\n and j-th item.\n\n Args:\n cooccurrence (numpy.ndarray): The symmetric matrix of co-occurrences of items.\n\n Returns:\n ...
18
Python
17
1d7341e93d1f03387699fb3c6ae0b6c0e464296f
python_utils.py
39,442
5
51
cosine_similarity
https://github.com/microsoft/recommenders.git
Add new item similarity metrics for SAR (#1754) * Add mutual information similarity in SAR * Add lexicographers mutual information similarity for SAR * Add cosine similarity for SAR * Add inclusion index for SAR * Typos * Change SARSingleNode to SAR * Convert item similarity matrix to np.array * U...
37
0
7,234
12
1
2
def ray_start_client_server_for_address(address):
python/ray/util/client/ray_client_helpers.py
13
ray
{ "docstring": "\n Starts a Ray client server that initializes drivers at the specified address.\n ", "language": "en", "n_whitespaces": 19, "n_words": 12, "vocab_size": 12 }
2
Python
2
297341e107daee1ea3aff991ae8ea8c90993c683
ray_client_helpers.py
133,959
4
20
ray_start_client_server_for_address
https://github.com/ray-project/ray.git
[Test][Client] Only start ray once in client tests (#28835) It looks like we're frequently starting and shutting down Ray in this test because `ray_start_client_server` isn't connecting to the Ray created by `ray_start_regular_shared`, and is instead starting a new Ray head process every time it launches. Ray clien...
5
0
30,162
6
1
5
def voidcmd(self, cmd): self.putcmd(cmd) return self.voidresp()
python3.10.4/Lib/ftplib.py
35
XX-Net
{ "docstring": "Send a command and expect a response beginning with '2'.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
6
Python
6
8198943edd73a363c266633e1aa5b2a9e9c9f526
ftplib.py
217,436
3
20
voidcmd
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
27
0
54,784
7
5
14
def all_shortest_paths(G, source, target, weight=None, method="dijkstra"): method = "unweighted" if weight is None else method if method == "unweighted": pred = nx.predecessor(G, source) elif method == "dijkstra": pred, dist = nx.dijkstra_predecessor_and_distance(G, source, weight=weigh...
networkx/algorithms/shortest_paths/generic.py
168
networkx
{ "docstring": "Compute all shortest simple paths in the graph.\n\n Parameters\n ----------\n G : NetworkX graph\n\n source : node\n Starting node for path.\n\n target : node\n Ending node for path.\n\n weight : None, string or function, optional (default = None)\n If None, every ...
53
Python
36
b5d41847b8db0c82372faf69cd3a339d11da7ef0
generic.py
176,292
11
103
all_shortest_paths
https://github.com/networkx/networkx.git
DOC: Update documentation to include callables for weight argument (#5307) Update docs to include functions as valid input for weight argument.
102
0
41,809
12
1
8
def test_assumptions_about_jsonpatch(self): patch_1 = JsonPatch([{"op": "add", "path": "/hi", "value": "there"}]) patch_2 = JsonPatch([{"op": "add", "path": "/hi", "value": "there"}]) patch_3 = JsonPatch([{"op": "add", "path": "/different", "value": "there"}]) assert patch_1 is ...
tests/flow_runners/test_kubernetes.py
239
prefect
{ "docstring": "Assert our assumptions about the behavior of the jsonpatch library, so we\n can be alert to any upstream changes", "language": "en", "n_whitespaces": 25, "n_words": 19, "vocab_size": 18 }
55
Python
24
ab322ef9b1bb65887984854dc39b316f98da3b97
test_kubernetes.py
56,187
11
131
test_assumptions_about_jsonpatch
https://github.com/PrefectHQ/prefect.git
Allow Kubernetes users to customize or replace the Job manifest for flow runs Adding support for either replacing the base `job=` for a KubernetesFlowRunner, applying a list of RFC 6902 JSON patches provided by `customizations=`, or both. This implements the core changes, while preserving backwards compatiblity with t...
132
0
11,459
12
12
23
def can_fast_delete(self, objs, from_field=None): if from_field and from_field.remote_field.on_delete is not CASCADE: return False if hasattr(objs, "_meta"): model = objs._meta.model elif hasattr(objs, "model") and hasattr(objs, "_raw_delete"): model ...
django/db/models/deletion.py
230
django
{ "docstring": "\n Determine if the objects in the given queryset-like or single object\n can be fast-deleted. This can be done if there are no cascades, no\n parents and no signal listeners for the object class.\n\n The 'from_field' tells where we are coming from - we need this to\n ...
108
Python
70
9c19aff7c7561e3a82978a272ecdaad40dda5c00
deletion.py
205,460
29
142
can_fast_delete
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
471
0
51,132
16
4
12
def get_chunk_n_rows(row_bytes, *, max_n_rows=None, working_memory=None): if working_memory is None: working_memory = get_config()["working_memory"] chunk_n_rows = int(working_memory * (2**20) // row_bytes) if max_n_rows is not None: chunk_n_rows = min(chunk_n_rows, max_n_rows) if...
sklearn/utils/__init__.py
148
scikit-learn
{ "docstring": "Calculates how many rows can be processed within working_memory.\n\n Parameters\n ----------\n row_bytes : int\n The expected number of bytes of memory that will be consumed\n during the processing of each row.\n max_n_rows : int, default=None\n The maximum return valu...
55
Python
40
1fc86b6aacd89da44a3b4e8abf7c3e2ba4336ffe
__init__.py
258,953
14
88
get_chunk_n_rows
https://github.com/scikit-learn/scikit-learn.git
MNT Update black to stable version (#22474)
141
0
75,492
16
6
25
def _prepare_socket_file(self, socket_path, default_prefix): result = socket_path is_mac = sys.platform.startswith("darwin") if sys.platform == "win32": if socket_path is None: result = f"tcp://{self._localhost}" f":{self._get_unused_port()}" else: ...
python/ray/node.py
234
ray
{ "docstring": "Prepare the socket file for raylet and plasma.\n\n This method helps to prepare a socket file.\n 1. Make the directory if the directory does not exist.\n 2. If the socket file exists, do nothing (this just means we aren't the\n first worker on the node).\n\n Args:...
77
Python
56
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
node.py
130,803
20
127
_prepare_socket_file
https://github.com/ray-project/ray.git
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
333
0
29,375
17
1
6
def make_union(*transformers, n_jobs=None, verbose=False): return FeatureUnion(_name_estimators(transformers), n_jobs=n_jobs, verbose=verbose)
sklearn/pipeline.py
48
scikit-learn
{ "docstring": "Construct a FeatureUnion from the given transformers.\n\n This is a shorthand for the FeatureUnion constructor; it does not require,\n and does not permit, naming the transformers. Instead, they will be given\n names automatically based on their types. It also does not allow weighting.\n\n ...
8
Python
8
ecef8cb7f44ab6a8438b43eb33f519269511cbbf
pipeline.py
260,484
2
31
make_union
https://github.com/scikit-learn/scikit-learn.git
DOC numpydoc validation for `make_union` (#23909) Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com> Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
14
0
76,280
9
3
10
def sections(self) -> List[str]: return sorted(set(plugin.split(".")[0] for plugin in self._config.config.sections() if plugin.split(".")[0] != "writer"))
tools/preview/preview.py
87
faceswap
{ "docstring": " list: The sorted section names that exist within the convert Configuration options. ", "language": "en", "n_whitespaces": 13, "n_words": 12, "vocab_size": 12 }
14
Python
14
1022651eb8a7741014f5d2ec7cbfe882120dfa5f
preview.py
101,443
4
51
sections
https://github.com/deepfakes/faceswap.git
Bugfix: convert - Gif Writer - Fix non-launch error on Gif Writer - convert plugins - linting - convert/fs_media/preview/queue_manager - typing - Change convert items from dict to Dataclass
53
0
20,856
15
3
8
def get_conn(self) -> paramiko.SFTPClient: # type: ignore[override] if self.conn is None: # TODO: remove support for ssh_hook when it is removed from SFTPOperator if self.ssh_hook is not None: self.conn = self.ssh_hook.get_conn().open_sftp() else: ...
airflow/providers/sftp/hooks/sftp.py
105
airflow
{ "docstring": "\n Opens an SFTP connection to the remote host\n\n :rtype: paramiko.SFTPClient\n ", "language": "en", "n_whitespaces": 32, "n_words": 10, "vocab_size": 10 }
37
Python
28
f3aacebe502c4ea5dc2b7d29373539296fa037eb
sftp.py
43,253
12
61
get_conn
https://github.com/apache/airflow.git
Convert sftp hook to use paramiko instead of pysftp (#24512)
122
0
7,891
17
2
10
def only_targets(self, target_type): # type: (t.Type[THostConfig]) -> t.List[THostConfig] if not self.targets: raise Exception('There must be one or more targets.') assert type_guard(self.targets, target_type) return t.cast(t.List[THostConfig], self.targets)
test/lib/ansible_test/_internal/config.py
72
ansible
{ "docstring": "\n Return a list of target host configurations.\n Requires that there are one or more targets, all the specified type.\n ", "language": "en", "n_whitespaces": 41, "n_words": 19, "vocab_size": 19 }
25
Python
25
a06fa496d3f837cca3c437ab6e9858525633d147
config.py
266,768
5
44
only_targets
https://github.com/ansible/ansible.git
ansible-test - Code cleanup and refactoring. (#77169) * Remove unnecessary PyCharm ignores. * Ignore intentional undefined attribute usage. * Add missing type hints. Fix existing type hints. * Fix docstrings and comments. * Use function to register completion handler. * Pass strings to display functions. * Fix C...
65
0
78,571
10
4
32
def update_replay_sample_priority(self) -> int: num_samples_trained_this_itr = 0 for _ in range(self.learner_thread.outqueue.qsize()): if self.learner_thread.is_alive(): ( replay_actor, priority_dict, env_st...
rllib/agents/dqn/apex.py
296
ray
{ "docstring": "Update the priorities of the sample batches with new priorities that are\n computed by the learner thread.\n\n Returns:\n The number of samples trained by the learner thread since the last\n training iteration.\n ", "language": "en", "n_whitespaces": 75, ...
63
Python
48
b76273357bd1b74757b0aa1d64cee551369d7fa6
apex.py
139,297
35
183
update_replay_sample_priority
https://github.com/ray-project/ray.git
[RLlib] APEX-DQN replay buffer config validation fix. (#24588)
451
0
31,651
15
4
10
def make_action_immutable(obj): if isinstance(obj, np.ndarray): obj.setflags(write=False) return obj elif isinstance(obj, OrderedDict): return MappingProxyType(dict(obj)) elif isinstance(obj, dict): return MappingProxyType(obj) else: return ob...
rllib/utils/numpy.py
96
ray
{ "docstring": "Flags actions immutable to notify users when trying to change\n them.\n\n Can also be used with any tree-like structure containing either\n dictionaries, numpy arrays or already immutable objects per se.\n Note, however that `tree.map_structure()` will in general not \n include the shal...
21
Python
14
ff575eeafc610b5a71fac37682e388476b2fb8ea
numpy.py
138,869
10
59
make_action_immutable
https://github.com/ray-project/ray.git
[RLlib] Make actions sent by RLlib to the env immutable. (#24262)
87
0
31,539
12
2
6
def test_system_config(ray_start_cluster_head): cluster = ray_start_cluster_head worker = cluster.add_node() cluster.wait_for_nodes()
python/ray/tests/test_multi_node_2.py
39
ray
{ "docstring": "Checks that the internal configuration setting works.\n\n We set the cluster to timeout nodes after 2 seconds of no timeouts. We\n then remove a node, wait for 1 second to check that the cluster is out\n of sync, then wait another 2 seconds (giving 1 second of leeway) to check\n that the c...
9
Python
8
fdc7077dbcd8f54991cd36f6890d219519260dc4
test_multi_node_2.py
135,576
12
83
test_system_config
https://github.com/ray-project/ray.git
[core] Introduce pull based health check to GCS. (#29442) This PR introduced the pull-based health check to GCS. This is to fix the false positive issues when GCS is overloaded and incorrectly marks the healthy node as dead. The health check service in each ray component is implemented using gRPC built-in services....
21
0
30,660
8
1
3
def get_backend() -> ValidBackends: return _FS_BACKEND
lib/utils.py
18
faceswap
{ "docstring": " Get the backend that Faceswap is currently configured to use.\n\n Returns\n -------\n str\n The backend configuration in use by Faceswap\n ", "language": "en", "n_whitespaces": 40, "n_words": 20, "vocab_size": 18 }
6
Python
6
91fecc47b2157d684ab9c219a860df51543222a3
utils.py
100,998
9
9
get_backend
https://github.com/deepfakes/faceswap.git
lib.Utils - add DPI detector
12
0
20,441
6
1
4
def quote_name(self, name): raise NotImplementedError( "subclasses of BaseDatabaseOperations may require a quote_name() method" )
django/db/backends/base/operations.py
25
django
{ "docstring": "\n Return a quoted version of the given table, index, or column name. Do\n not quote the given name if it's already been quoted.\n ", "language": "en", "n_whitespaces": 45, "n_words": 23, "vocab_size": 21 }
14
Python
14
9c19aff7c7561e3a82978a272ecdaad40dda5c00
operations.py
204,863
4
13
quote_name
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
46
0
50,940
8
1
6
def inspect(self) -> DockerInspect: return docker_inspect(self.args, self.container_id)
test/lib/ansible_test/_internal/connections.py
32
ansible
{ "docstring": "Inspect the container and return a DockerInspect instance with the results.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 10 }
7
Python
7
3eb0485dd92c88cc92152d3656d94492db44b183
connections.py
267,949
3
19
inspect
https://github.com/ansible/ansible.git
ansible-test - Use more native type hints. (#78435) * ansible-test - Use more native type hints. Simple search and replace to switch from comments to native type hints for return types of functions with no arguments. * ansible-test - Use more native type hints. Conversion of simple single-line function annota...
21
0
79,224
8
2
14
def to_state_create(self) -> schemas.actions.StateCreate: from prefect.results import BaseResult return schemas.actions.StateCreate( type=self.type, name=self.name, message=self.message, data=self.data if isinstance(self.data, BaseResult) else No...
src/prefect/client/schemas.py
99
prefect
{ "docstring": "\n Convert this state to a `StateCreate` type which can be used to set the state of\n a run in the API.\n\n This method will drop this state's `data` if it is not a result type. Only\n results should be sent to the API. Other data is only available locally.\n ", "l...
21
Python
21
2f2faf370f602cfd9df307ff71e785c1c9d6a538
schemas.py
59,285
16
67
to_state_create
https://github.com/PrefectHQ/prefect.git
Update engine to use new results (#7094) # Conflicts: # .github/workflows/integration-tests.yaml # src/prefect/deployments.py # src/prefect/engine.py
104
0
11,889
12
1
13
def _jvp(f, primals, tangents): with tf.autodiff.ForwardAccumulator(primals, tangents) as acc: primals_out = f(*primals) return primals_out, acc.jvp( primals_out, unconnected_gradients=tf.UnconnectedGradients.ZERO )
keras/integration_test/forwardprop_test.py
78
keras
{ "docstring": "Compute the jacobian of `f` at `primals` multiplied by `tangents`.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
18
Python
17
84afc5193d38057e2e2badf9c889ea87d80d8fbf
forwardprop_test.py
272,179
6
48
_jvp
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
44
0
80,971
11
5
14
def _signature_bound_method(sig): params = tuple(sig.parameters.values()) if not params or params[0].kind in (_VAR_KEYWORD, _KEYWORD_ONLY): raise ValueError('invalid method signature') kind = params[0].kind if kind in (_POSITIONAL_OR_KEYWORD, _POSITIONAL_ONLY): # Drop first param...
python3.10.4/Lib/inspect.py
147
XX-Net
{ "docstring": "Private helper to transform signatures for unbound\n functions to bound methods.\n ", "language": "en", "n_whitespaces": 17, "n_words": 11, "vocab_size": 10 }
77
Python
52
8198943edd73a363c266633e1aa5b2a9e9c9f526
inspect.py
218,395
11
86
_signature_bound_method
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
180
0
55,281
13
5
13
def subs(self, *args, **kwargs): # should mirror core.basic.subs if len(args) == 1 and not isinstance(args[0], (dict, set)) and iter(args[0]) and not is_sequence(args[0]): args = (list(args[0]),) return self.applyfunc(lambda x: x.subs(*args, **kwargs))
sympy/matrices/common.py
130
sympy
{ "docstring": "Return a new matrix with subs applied to each entry.\n\n Examples\n ========\n\n >>> from sympy.abc import x, y\n >>> from sympy import SparseMatrix, Matrix\n >>> SparseMatrix(1, 1, [x])\n Matrix([[x]])\n >>> _.subs(x, y)\n Matrix([[y]])\n ...
30
Python
27
59d22b6bb7287613d598611027f640d068ca5748
common.py
196,366
4
83
subs
https://github.com/sympy/sympy.git
Moved imports to higher level
64
0
47,866
12
4
12
def _resolve_script(self, script_entity_id) -> None: for entity in script.entities_in_script(self.hass, script_entity_id): self._add_or_resolve("entity", entity) for device in script.devices_in_script(self.hass, script_entity_id): self._add_or_resolve("device", device) ...
homeassistant/components/search/__init__.py
120
core
{ "docstring": "Resolve a script.\n\n Will only be called if script is an entry point.\n ", "language": "en", "n_whitespaces": 27, "n_words": 13, "vocab_size": 13 }
26
Python
20
c0b04e9f91a34dfee0ceb12770148317fe3e2cbf
__init__.py
307,722
11
76
_resolve_script
https://github.com/home-assistant/core.git
Sort some code in the search integration (#78519)
87
0
106,489
10
1
7
def test_escape_sequence_resulting_in_multiple_keypresses(parser): events = list(parser.feed("\x1b[2;4~")) assert len(events) == 2 assert events[0].key == "escape" assert events[1].key == "shift+insert"
tests/test_xterm_parser.py
75
textual
{ "docstring": "Some sequences are interpreted as more than 1 keypress", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
17
Python
13
bfb962bacf274373e5706090cd854b6aa0857270
test_xterm_parser.py
183,781
5
42
test_escape_sequence_resulting_in_multiple_keypresses
https://github.com/Textualize/textual.git
Backtracking unknown escape sequences, various tests for XTermParser
32
0
44,334
11
2
5
async def _api_startup_event(self): if not ApiServer._message_stream: ApiServer._message_stream = MessageStream()
freqtrade/rpc/api_server/webserver.py
36
freqtrade
{ "docstring": "\n Creates the MessageStream class on startup\n so it has access to the same event loop\n as uvicorn\n ", "language": "en", "n_whitespaces": 46, "n_words": 17, "vocab_size": 16 }
9
Python
9
442467e8aed2ff639bfba04e7a2f6e175f774af1
webserver.py
151,672
3
19
_api_startup_event
https://github.com/freqtrade/freqtrade.git
remove old comments and code
34
0
35,096
10
1
24
def test_ohe_infrequent_three_levels_drop_frequent(drop): X_train = np.array([["a"] * 5 + ["b"] * 20 + ["c"] * 10 + ["d"] * 3]).T ohe = OneHotEncoder( handle_unknown="infrequent_if_exist", sparse=False, max_categories=3, drop=drop ).fit(X_train) X_test = np.array([["b"], ["c"], ["d"]]) ...
sklearn/preprocessing/tests/test_encoders.py
322
@pytest.mark.parametrize("drop", [["a"], ["d"]])
scikit-learn
{ "docstring": "Test three levels and dropping the frequent category.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
63
Python
49
7f0006c8aad1a09621ad19c3db19c3ff0555a183
test_encoders.py
259,235
12
176
test_ohe_infrequent_three_levels_drop_frequent
https://github.com/scikit-learn/scikit-learn.git
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...
109
1
75,667
16
1
3
def indented(self): cli_logger = self
python/ray/autoscaler/_private/cli_logger.py
18
ray
{ "docstring": "Context manager that starts an indented block of output.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
5
Python
5
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
cli_logger.py
130,421
6
20
indented
https://github.com/ray-project/ray.git
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
19
0
29,267
6
1
3
def lsb_release_info(self): # type: () -> Dict[str, str] return self._lsb_release_info
pipenv/patched/notpip/_vendor/distro.py
20
pipenv
{ "docstring": "\n Return a dictionary containing key-value pairs for the information\n items from the lsb_release command data source of the OS\n distribution.\n\n For details, see :func:`distro.lsb_release_info`.\n ", "language": "en", "n_whitespaces": 60, "n_words": 24, "...
10
Python
10
f3166e673fe8d40277b804d35d77dcdb760fc3b3
distro.py
20,074
2
10
lsb_release_info
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...
31
0
3,219
6
1
5
def test_batch_mapper_numpy_data_format(ds_with_expected_pandas_numpy_df): ds, expected_df, expected_numpy_df = ds_with_expected_pandas_numpy_df
python/ray/data/tests/test_batch_mapper.py
23
ray
{ "docstring": "Tests batch mapper functionality for numpy data format.\n\n Note:\n For single column pandas dataframes, we automatically convert it to\n single column tensor with column name as `__value__`.\n ", "language": "en", "n_whitespaces": 47, "n_words": 27, "vocab_size": 24 }
7
Python
7
9c39a28ba2f6221ffd8327fa21cb8294f0390fee
test_batch_mapper.py
128,154
20
145
test_batch_mapper_numpy_data_format
https://github.com/ray-project/ray.git
[AIR][Numpy] Add numpy narrow waist to `Preprocessor` and `BatchMapper` (#28418) Co-authored-by: Eric Liang <ekhliang@gmail.com> Co-authored-by: Clark Zinzow <clarkzinzow@gmail.com> Co-authored-by: Amog Kamsetty <amogkamsetty@yahoo.com>
13
0
28,614
7
1
14
def test_realm_admin_remove_others_from_public_stream(self) -> None: result = self.attempt_unsubscribe_of_principal( query_count=15, target_users=[self.example_user("cordelia")], is_realm_admin=True, is_subbed=True, invite_only=False, ...
zerver/tests/test_subs.py
120
zulip
{ "docstring": "\n If you're a realm admin, you can remove people from public streams, even\n those you aren't on.\n ", "language": "en", "n_whitespaces": 39, "n_words": 17, "vocab_size": 16 }
21
Python
20
803982e87254e3b1ebcb16ed795e224afceea3a3
test_subs.py
83,836
16
76
test_realm_admin_remove_others_from_public_stream
https://github.com/zulip/zulip.git
message_flags: Short-circuit if no messages changed. Omit sending an event, and updating the database, if there are no matching messages.
129
0
17,731
13
5
11
def _splitext(p, sep, altsep, extsep): # NOTE: This code must work for text and bytes strings. sepIndex = p.rfind(sep) if altsep: altsepIndex = p.rfind(altsep) sepIndex = max(sepIndex, altsepIndex) dotIndex = p.rfind(extsep) if dotIndex > sepIndex: # skip all leading d...
python3.10.4/Lib/genericpath.py
154
XX-Net
{ "docstring": "Split the extension from a pathname.\n\n Extension is everything from the last dot to the end, ignoring\n leading dots. Returns \"(root, ext)\"; ext may be empty.", "language": "en", "n_whitespaces": 32, "n_words": 26, "vocab_size": 23 }
62
Python
48
8198943edd73a363c266633e1aa5b2a9e9c9f526
genericpath.py
217,520
13
97
_splitext
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
155
0
54,832
14
1
23
def any_numeric_dtype(request): return request.param # categoricals are handled separately _any_skipna_inferred_dtype = [ ("string", ["a", np.nan, "c"]), ("string", ["a", pd.NA, "c"]), ("mixed", ["a", pd.NaT, "c"]), # pd.NaT not considered valid by is_string_array ("bytes", [b"a", np.nan, b"...
pandas/conftest.py
591
@pytest.fixture(params=_any_skipna_inferred_dtype, ids=ids)
pandas
{ "docstring": "\n Parameterized fixture for all numeric dtypes.\n\n * int\n * 'int8'\n * 'uint8'\n * 'int16'\n * 'uint16'\n * 'int32'\n * 'uint32'\n * 'int64'\n * 'uint64'\n * float\n * 'float32'\n * 'float64'\n * complex\n * 'complex64'\n * 'complex128'\n * 'UInt8'...
149
Python
103
fe9e5d023e20304ad1bdfa1da53f3af452c72a00
conftest.py
169,100
2
10
any_numeric_dtype
https://github.com/pandas-dev/pandas.git
REGR: .describe on unsigned dtypes results in object (#48473)
244
1
40,391
10
3
11
def get_variation_axes(self): try: axes = self.font.getvaraxes() except AttributeError as e: msg = "FreeType 2.9.1 or greater is required" raise NotImplementedError(msg) from e for axis in axes: axis["name"] = axis["name"].replace(b"\x00",...
src/PIL/ImageFont.py
100
Pillow
{ "docstring": "\n :returns: A list of the axes in a variation font.\n :exception OSError: If the font is not a variation font.\n ", "language": "en", "n_whitespaces": 42, "n_words": 20, "vocab_size": 16 }
32
Python
29
2ae55ccbdad9c842929fb238ea1eb81d1f999024
ImageFont.py
243,751
9
57
get_variation_axes
https://github.com/python-pillow/Pillow.git
Improve exception traceback readability
111
0
70,111
12
2
20
def flatten(index, name="segmented_flatten"): batch_size = tf.reduce_prod(index.batch_shape()) offset = tf.range(batch_size) * index.num_segments offset = tf.reshape(offset, index.batch_shape()) for _ in range(index.batch_dims, index.indices.shape.rank): offset = tf.expand_dims(offset, -1) ...
src/transformers/models/tapas/modeling_tf_tapas.py
193
transformers
{ "docstring": "\n Flattens a batched index map to a 1d index map. This operation relabels the segments to keep batch elements\n distinct. The k-th batch element will have indices shifted by `num_segments` * (k - 1). The result is a tensor with\n `num_segments` multiplied by the number of elements in the bat...
37
Python
30
f04257fdbcb6ecb5a9bef75f4c2a8d2e8b5a6209
modeling_tf_tapas.py
38,044
8
124
flatten
https://github.com/huggingface/transformers.git
Add test to ensure models can take int64 inputs (#17210) * Add test to ensure models can take int64 inputs * is_integer is an attribute, not a method * Fix test when some inputs aren't tensors * Add casts to blenderbot and blenderbot-small * Add casts to the other failing models
65
0
6,902
12
1
37
def test_job_job_events_children_summary_is_tree(get, organization_factory, job_template_factory): objs = organization_factory("org", superusers=['admin']) jt = job_template_factory("jt", organization=objs.organization, inventory='test_inv', project='test_proj').job_template job = jt.create_unified_job...
awx/main/tests/functional/api/test_events.py
722
awx
{ "docstring": "\n children_summary should return {is_tree: False} if the event structure is not tree-like\n \n E1\n E2\n E3\n E4 (verbose)\n E5\n E6 <-- parent is E2, but comes after another \"branch\" E5\n ", "language": "en", "n_whitespaces": 74, "n_words": 29, "v...
128
Python
65
550d9d5e42a605a23cb540584bf439c07c4185d4
test_events.py
81,243
40
442
test_job_job_events_children_summary_is_tree
https://github.com/ansible/awx.git
detect if job events are tree-like and collapsable in the UI
248
0
17,173
12
4
22
def normalize_span_op_histogram_results(span_op, histogram_params, results): histogram_column = get_span_count_histogram_column(span_op, histogram_params) bin_name = get_function_alias(histogram_column) # zerofill and rename the columns while making sure to adjust for precision bucket_map = {} ...
src/sentry/snuba/discover.py
203
sentry
{ "docstring": "\n Normalizes the span histogram results by renaming the columns to key and bin\n and make sure to zerofill any missing values.\n\n :param str span_op: The span op for which you want to generate the\n histograms for.\n :param HistogramParams histogram_params: The histogram parameter...
90
Python
71
12bb908ad28a4c1b6564253053a6f65ba4cdded9
discover.py
93,873
15
124
normalize_span_op_histogram_results
https://github.com/getsentry/sentry.git
feat(spans): Add a span count distribution endpoint (#36957) * hack histogram endpoint to serve span counts * wip * clean up * more clean up * clean up * fixes and test * address comments
184
0
19,022
13
5
11
def simplify_ner_for_qa(output): compact_output = [] for answer in output["answers"]: entities = [] for entity in answer.meta["entities"]: if ( entity["start"] >= answer.offsets_in_document[0].start and entity["end"] <= answer.offsets_in_document...
haystack/nodes/extractor/entity.py
152
haystack
{ "docstring": "\n Returns a simplified version of the output dictionary\n with the following structure:\n [\n {\n answer: { ... }\n entities: [ { ... }, {} ]\n }\n ]\n The entities included are only the ones that overlap with\n the answer itself.\n\n :param ou...
33
Python
28
15a59fd04071dc1e13c256680407ba1b63e7b1f2
entity.py
257,972
12
90
simplify_ner_for_qa
https://github.com/deepset-ai/haystack.git
feat: Updated EntityExtractor to handle long texts and added better postprocessing (#3154) * Remove dependence on HuggingFace TokenClassificationPipeline and group all postprocessing functions under one class * Added copyright notice for HF and deepset to entity file to acknowledge that a lot of the postprocess...
133
0
75,176
15
1
7
def _combine_individual_stats(self, operator_count, cv_score, individual_stats): stats = deepcopy( individual_stats ) # Deepcopy, since the string reference to predecessor should be cloned stats["operator_count"] = operator_count stats["internal_cv_score"] = cv_scor...
tpot/base.py
55
tpot
{ "docstring": "Combine the stats with operator count and cv score and preprare to be written to _evaluated_individuals\n\n Parameters\n ----------\n operator_count: int\n number of components in the pipeline\n cv_score: float\n internal cross validation score\n ...
29
Python
26
388616b6247ca4ea8de4e2f340d6206aee523541
base.py
181,816
7
32
_combine_individual_stats
https://github.com/EpistasisLab/tpot.git
Revert "Deployed 7ccda9a with MkDocs version: 1.3.0" This reverts commit bd9629c40e01241766197119b581a99409b07068.
83
0
43,600
8
1
13
def test_ridgecv_normalize_deprecated(Estimator): X = np.array([[1, -1], [1, 1]]) y = np.array([0, 1]) estimator = Estimator(normalize=True) with pytest.warns( FutureWarning, match=r"Set parameter alphas to: original_alphas \* n_samples" ): estimator.fit(X, y)
sklearn/linear_model/tests/test_ridge.py
108
scikit-learn
{ "docstring": "Check that the normalize deprecation warning mentions the rescaling of alphas\n\n Non-regression test for issue #22540\n ", "language": "en", "n_whitespaces": 22, "n_words": 16, "vocab_size": 15 }
28
Python
26
f14af688b7e77ecb6df9dfee93ec39b6c0334b86
test_ridge.py
259,066
8
68
test_ridgecv_normalize_deprecated
https://github.com/scikit-learn/scikit-learn.git
FIX Make Ridge*CV warn about rescaling alphas with scaling (#22585)
60
0
75,551
11
4
12
def load(cls, request_or_site=None): # We can only cache on the request, so if there is no request then # we know there's nothing in the cache. if request_or_site is None or isinstance(request_or_site, Site): return cls._get_or_create() # Check if we already have t...
wagtail/contrib/settings/models.py
110
wagtail
{ "docstring": "\n Get or create an instance of this model. There is only ever one\n instance of models inheriting from `AbstractSetting` so we can\n use `pk=1`.\n\n If `request_or_site` is present and is a request object, then we cache\n the result on the request for faster repeat ...
72
Python
53
d967eccef28ce47f60d26be1c28f2d83a25f40b0
models.py
78,250
9
67
load
https://github.com/wagtail/wagtail.git
Add generic settings to compliment site-specific settings (#8327)
171
0
16,749
9
1
6
def map_to_type(self, name, cls): self.registry[name.lower()] = cls
python3.10.4/Lib/email/headerregistry.py
36
XX-Net
{ "docstring": "Register cls as the specialized class for handling \"name\" headers.\n\n ", "language": "en", "n_whitespaces": 17, "n_words": 10, "vocab_size": 10 }
7
Python
7
8198943edd73a363c266633e1aa5b2a9e9c9f526
headerregistry.py
223,760
2
22
map_to_type
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
21
0
57,051
9
2
5
def search_projects(self, group=None, query=None, simple=True):
src/sentry/integrations/gitlab/client.py
28
sentry
{ "docstring": "Get projects\n\n See https://docs.gitlab.com/ee/api/groups.html#list-a-group-s-projects\n and https://docs.gitlab.com/ee/api/projects.html#list-all-projects\n ", "language": "en", "n_whitespaces": 27, "n_words": 6, "vocab_size": 6 }
5
Python
5
73959a1d9b946cd0b7054bebcbc9f50929bc9dc3
client.py
95,879
8
55
search_projects
https://github.com/getsentry/sentry.git
I have rebased 15188 (round #2) (#31375) * Make GitLab Group Path optional Co-authored-by: King Chung Huang <kinghuang@mac.com> Co-authored-by: Colleen O'Rourke <colleen@sentry.io>
12
0
19,254
6
1
11
def test_launcher_ensures_stdio(self): from kitty.constants import kitty_exe import subprocess exe = kitty_exe() cp = subprocess.run([exe, '+runpy', f]) self.assertEqual(cp.returncode, 0)
kitty_tests/check_build.py
76
kitty
{ "docstring": "\\\nimport os, sys\nif sys.stdin:\n os.close(sys.stdin.fileno())\nif sys.stdout:\n os.close(sys.stdout.fileno())\nif sys.stderr:\n os.close(sys.stderr.fileno())\nos.execlp({exe!r}, 'kitty', '+runpy', 'import sys; raise SystemExit(1 if sys.stdout is None or sys.stdin is None or sys.stderr is N...
18
Python
16
e2a1f8dde783c55dbca449691986923cb4025721
check_build.py
103,729
15
43
test_launcher_ensures_stdio
https://github.com/kovidgoyal/kitty.git
...
52
0
21,712
11
1
15
def test_redirect_to_default(self): start_url = reverse("wagtailsettings:edit", args=["tests", "testsetting"]) dest_url = reverse( "wagtailsettings:edit", args=["tests", "testsetting", self.default_site.pk] ) response = self.client.get(start_url, follow=True) ...
wagtail/contrib/settings/tests/test_admin.py
116
wagtail
{ "docstring": "\n Should redirect to the setting for the default site.\n ", "language": "en", "n_whitespaces": 24, "n_words": 9, "vocab_size": 8 }
25
Python
21
d10f15e55806c6944827d801cd9c2d53f5da4186
test_admin.py
73,498
9
70
test_redirect_to_default
https://github.com/wagtail/wagtail.git
Reformat with black
96
0
16,029
12
1
14
def _unfold(arr, axis, size, step): new_shape = [*arr.shape, size] new_strides = [*arr.strides, arr.strides[axis]] new_shape[axis] = (new_shape[axis] - size) // step + 1 new_strides[axis] = new_strides[axis] * step return np.lib.stride_tricks.as_strided(arr, ...
lib/matplotlib/cbook/__init__.py
129
matplotlib
{ "docstring": "\n Append an extra dimension containing sliding windows along *axis*.\n\n All windows are of size *size* and begin with every *step* elements.\n\n Parameters\n ----------\n arr : ndarray, shape (N_1, ..., N_k)\n The input array\n axis : int\n Axis along which the window...
32
Python
27
13438f842729df1b04445d44ea83f616d1b85567
__init__.py
110,054
9
85
_unfold
https://github.com/matplotlib/matplotlib.git
Fix some minor docstring typos
176
0
23,899
11
2
18
def test_5_model(self): query = predict_query = for cid, char in [(CID_A, 'a'), (CID_B, 'b')]: self.sql_via_http( query.format(char, char), company_id=cid, expected_resp_type=RESPONSE_TYPE.OK ) response = se...
tests/integration_tests/flows/test_company_independent.py
142
mindsdb
{ "docstring": "\n CREATE MODEL mindsdb.model_{}\n FROM test_integration_{} (\n select * from test_data.home_rentals limit 50\n ) PREDICT rental_price\n USING join_learn_process=true, time_aim=5\n \n select * from mindsdb.model_{} where sqft...
29
Python
24
7c02e15aa403a4ca1fa34489dd2df9136d6c961c
test_company_independent.py
117,189
23
90
test_5_model
https://github.com/mindsdb/mindsdb.git
Projects structure (#3532) Projects structure
196
0
25,918
13
1
22
def test_predictor_tableau_header(self, mock_handler): df = pd.DataFrame([ {'a': 1, 'b': 'one'}, {'a': 2, 'b': 'two'}, {'a': 1, 'b': 'three'}, ]) self.set_handler(mock_handler, name='pg', tables={'tasks': df}) # --- use predictor --- predicted...
tests/unit/test_executor.py
250
mindsdb
{ "docstring": "\n SELECT \n SUM(1) AS `cnt__0B4A4E8BD11C48FFB4730D4D2C32191A_ok`,\n sum(`Custom SQL Query`.`a`) AS `sum_height_ok`,\n max(`Custom SQL Query`.`p`) AS `sum_length1_ok`\n FROM (\n SELECT res.a, res.p \n FROM pg.tasks ...
82
Python
64
02a831997cdffafca7cb160eb1938e72020ee049
test_executor.py
116,154
32
143
test_predictor_tableau_header
https://github.com/mindsdb/mindsdb.git
executor tests
298
0
25,675
12
1
9
def test_single_file_metadata(pyi_builder): # Add directory containing the my-test-package metadata to search path extra_path = os.path.join(_MODULES_DIR, "pyi_single_file_metadata") pyi_builder.test_source( , pyi_args=['--paths', extra_path] )
tests/functional/test_misc.py
54
pyinstaller
{ "docstring": "\n import pkg_resources\n\n # The pkg_resources.get_distribution() call automatically triggers collection of the metadata. While it does not\n # raise an error if metadata is not found while freezing, the calls below will fall at run-time in that case.\n dist = pkg_resource...
21
Python
21
460a53842a220faa70f892ab0127b6d4dd21c4eb
test_misc.py
262,791
17
31
test_single_file_metadata
https://github.com/pyinstaller/pyinstaller.git
tests: add a test for single-file metadata collection
46
0
77,372
10
2
8
def should_toggle_mask(self) -> bool: with self._lock: retval = self._triggers["toggle_mask"] if retval: logger.debug("Sending toggle mask") self._triggers["toggle_mask"] = False return retval
scripts/train.py
74
faceswap
{ "docstring": " Check whether the mask should be toggled and return the value. If ``True`` is returned\n then resets mask toggle back to ``False``\n\n Returns\n -------\n bool\n ``True`` if the mask should be toggled otherwise ``False``. ", "language": "en", "n_whitespaces"...
19
Python
16
3c73ae4ec9f0f30649a5e20465a268bbcfd690eb
train.py
101,049
14
40
should_toggle_mask
https://github.com/deepfakes/faceswap.git
bugfix: Update preview screen in GUI
92
0
20,487
12
1
3
def shape(self): return self.table.shape
src/datasets/table.py
22
datasets
{ "docstring": "\n Dimensions of the table: (#rows, #columns).\n\n Returns:\n :obj:`(int, int)`: Number of rows and number of columns.\n ", "language": "en", "n_whitespaces": 49, "n_words": 16, "vocab_size": 14 }
4
Python
4
e35be138148333078284b942ccc9ed7b1d826f97
table.py
104,426
2
12
shape
https://github.com/huggingface/datasets.git
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 ...
18
0
21,862
7
1
7
def add_preheated_app_session(self) -> None: session = self._create_or_reuse_app_session(ws=None) session.handle_rerun_script_request(is_preheat=True)
lib/streamlit/server/server.py
45
streamlit
{ "docstring": "Register a fake browser with the server and run the script.\n\n This is used to start running the user's script even before the first\n browser connects.\n ", "language": "en", "n_whitespaces": 47, "n_words": 26, "vocab_size": 22 }
8
Python
8
704eab3478cf69847825b23dabf15813a8ac9fa2
server.py
118,567
8
26
add_preheated_app_session
https://github.com/streamlit/streamlit.git
Rename and refactor `Report` machinery (#4141) This refactor renames (almost) everything related to the outdated "report" concept with more precise concepts that we use throughout our code, primarily "script run", "session", and "app".
29
0
26,297
9
3
21
def sample_y(self, X, n_samples=1, random_state=0): rng = check_random_state(random_state) y_mean, y_cov = self.predict(X, return_cov=True) if y_mean.ndim == 1: y_samples = rng.multivariate_normal(y_mean, y_cov, n_samples).T else: y_samples = [ ...
sklearn/gaussian_process/_gpr.py
171
scikit-learn
{ "docstring": "Draw samples from Gaussian process and evaluate at X.\n\n Parameters\n ----------\n X : array-like of shape (n_samples_X, n_features) or list of object\n Query points where the GP is evaluated.\n\n n_samples : int, default=1\n Number of samples drawn f...
44
Python
36
3786daf7dc5c301478d489b0756f90d0ac5d010f
_gpr.py
258,794
14
114
sample_y
https://github.com/scikit-learn/scikit-learn.git
BUG Fix covariance and stdev shape in GPR with normalize_y (#22199) Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> Co-authored-by: Nakamura-Zimmerer, Tenavi (ARC-AF) <tenavi.nakamura-zimmerer@nasa.gov>
194
0
75,430
16
1
16
def test_regex_includes_scripts_for(gm_manager, url, expected_matches): gh_dark_example = textwrap.dedent(r) _save_script(gh_dark_example, 'test.user.js') gm_manager.load_scripts() scripts = gm_manager.scripts_for(QUrl(url)) assert len(scripts.start + scripts.end + scripts.idle) == expected_ma...
tests/unit/javascript/test_greasemonkey.py
96
qutebrowser
{ "docstring": "Ensure our GM @*clude support supports regular expressions.\n // ==UserScript==\n // @include /^https?://((gist|guides|help|raw|status|developer)\\.)?github\\.com/((?!generated_pages\\/preview).)*$/\n // @exclude /https?://github\\.com/foo/\n // @run-at document-sta...
21
Python
19
21419c9ef5a90ea36a27afaf2503a57f8f9f8536
test_greasemonkey.py
320,963
12
58
test_regex_includes_scripts_for
https://github.com/qutebrowser/qutebrowser.git
greasemonkey: Don't implicitly load scripts Needed for #7245 and also seems like cleaner code.
39
0
117,467
11
3
19
def cal_predicts_accuracy(char_ops, preds, preds_lod, labels, labels_lod, is_remove_duplicate=False): acc_num = 0 img_num = 0 for ino in range(len(labels_lod) - 1): beg_no = preds_lod[ino] end_no = preds_lod[ino + 1] preds_text = preds[beg_no:end_no].reshape(-1) preds_te...
modules/image/text_recognition/ppocrv3_rec_ch/character.py
209
PaddleHub
{ "docstring": "\n Calculate prediction accuracy\n Args:\n char_ops: CharacterOps\n preds: preds result,text index\n preds_lod: lod tensor of preds\n labels: label of input image, text index\n labels_lod: lod tensor of label\n is_remove_duplicate: Whether to remove dup...
70
Python
44
9b3119dfb63c4cbb7acfb9f1f1c09ac24e6d68d2
character.py
49,450
17
139
cal_predicts_accuracy
https://github.com/PaddlePaddle/PaddleHub.git
add module
169
0
9,747
12
1
6
def fit_predict(self, X, y=None): # As fit_predict would be different from fit.predict, fit_predict is # only available for outlier detection (novelty=False) return self.fit(X)._predict()
sklearn/neighbors/_lof.py
40
scikit-learn
{ "docstring": "Fit the model to the training set X and return the labels.\n\n **Not available for novelty detection (when novelty is set to True).**\n Label is 1 for an inlier and -1 for an outlier according to the LOF\n score and the contamination parameter.\n\n Parameters\n -----...
23
Python
21
60cc5b596f38d0d236dab34e02c05d98b5a72bad
_lof.py
260,993
2
23
fit_predict
https://github.com/scikit-learn/scikit-learn.git
FEA Fused sparse-dense support for `PairwiseDistancesReduction` (#23585) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com> Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com> Co-authored-by: Thomas J. Fan <thomasjpf...
51
0
76,611
9
3
24
def get_attendance_years() -> str: Attendance = frappe.qb.DocType('Attendance') year_list = ( frappe.qb.from_(Attendance) .select(Extract('year', Attendance.attendance_date).as_('year')) .distinct() ).run(as_dict=True) if year_list: year_list.sort(key=lambda d: d.year, reverse=True) else: year_list = ...
erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
177
erpnext
{ "docstring": "Returns all the years for which attendance records exist", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
31
Python
28
e79d292233000985a04c5d46859513c1e0d7c88c
monthly_attendance_sheet.py
68,213
13
104
get_attendance_years
https://github.com/frappe/erpnext.git
refactor: Monthly Attendance Sheet - split into smaller functions - add type hints - get rid of unnecessary db calls and loops - add docstrings for functions
19
0
14,743
18
2
10
def _set_gradient_checkpointing(self, module, value=False): if isinstance(module, ConvNextModel): module.gradient_checkpointing = value CONVNEXT_START_DOCSTRING = r CONVNEXT_INPUTS_DOCSTRING = r @add_start_docstrings( "The bare ConvNext model outputting raw features without any specific hea...
src/transformers/models/convnext/modeling_convnext.py
64
@add_start_docstrings( "The bare ConvNext model outputting raw features without any specific head on top.", CONVNEXT_START_DOCSTRING, )
transformers
{ "docstring": "\n This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it\n as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and\n behavior.\n\n Parameters:\n config ([`ConvNextCon...
32
Python
29
84eec9e6ba55c5aceee2a92fd820fcca4b67c510
modeling_convnext.py
34,876
3
24
_set_gradient_checkpointing
https://github.com/huggingface/transformers.git
Add ConvNeXT (#15277) * First draft * Add conversion script * Improve conversion script * Improve docs and implement tests * Define model output class * Fix tests * Fix more tests * Add model to README * Apply suggestions from code review Co-authored-by: Sylvain Gugger <35901082+sgugger@user...
51
1
6,354
9
1
10
def test_rbf_sampler_gamma_scale(): X, y = [[0.0], [1.0]], [0, 1] rbf = RBFSampler(gamma="scale") rbf.fit(X, y) assert rbf._gamma == pytest.approx(4)
sklearn/tests/test_kernel_approximation.py
83
scikit-learn
{ "docstring": "Check the inner value computed when `gamma='scale'`.", "language": "en", "n_whitespaces": 6, "n_words": 7, "vocab_size": 7 }
18
Python
17
61ae92a7786baa132970cdc69da786f9952d8bda
test_kernel_approximation.py
261,468
5
55
test_rbf_sampler_gamma_scale
https://github.com/scikit-learn/scikit-learn.git
ENH Add gamma='scale' option to RBFSampler (#24755) Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
33
0
76,824
10
3
8
def vocab_size(self) -> int: if self.is_category_target: return self.model.training_set_metadata[self.target_feature_name]["vocab_size"] elif self.is_binary_target: return 2 return 1
ludwig/explain/explainer.py
60
ludwig
{ "docstring": "The vocab size of the target feature.\n\n For regression (number) this is 1, for binary it is 2, and for category it is the vocab size.\n ", "language": "en", "n_whitespaces": 40, "n_words": 26, "vocab_size": 20 }
14
Python
12
1caede3a2da4ec71cb8650c7e45120c26948a5b9
explainer.py
8,246
10
36
vocab_size
https://github.com/ludwig-ai/ludwig.git
Explanation API and feature importance for GBM (#2564) * add docstring for explain_ig * solidify Explainer API * add gbm explainer * add dataclasses for typed explanations * add GBM feature importance * remove unused imports * add tests * fix test * extract explanation into file * rename bas...
64
0
1,380
11
1
2
def zaxis(self): return self["zaxis"]
packages/python/plotly/plotly/graph_objs/layout/_scene.py
22
plotly.py
{ "docstring": "\n The 'zaxis' property is an instance of ZAxis\n that may be specified as:\n - An instance of :class:`plotly.graph_objs.layout.scene.ZAxis`\n - A dict of string/value properties that will be passed\n to the ZAxis constructor\n\n Supported dict pro...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_scene.py
231,647
2
11
zaxis
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
63,091
7
1
5
def get_deployment_statuses() -> Dict[str, DeploymentStatusInfo]: return internal_get_global_client().get_deployment_statuses()
python/ray/serve/api.py
35
ray
{ "docstring": "Returns a dictionary of deployment statuses.\n\n A deployment's status is one of {UPDATING, UNHEALTHY, and HEALTHY}.\n\n Example:\n >>> from ray.serve.api import get_deployment_statuses\n >>> statuses = get_deployment_statuses() # doctest: +SKIP\n >>> status_info = statuses[\"deployment...
7
Python
7
60054995e65304fb14e6d0ab69bdec07aa9389fe
api.py
147,381
18
20
get_deployment_statuses
https://github.com/ray-project/ray.git
[docs] fix doctests and activate CI (#23418)
13
0
33,930
9
15
7
def lexicographical_topological_sort(G, key=None): if not G.is_directed(): msg = "Topological sort not defined on undirected graphs." raise nx.NetworkXError(msg) if key is None:
networkx/algorithms/dag.py
58
networkx
{ "docstring": "Generate the nodes in the unique lexicographical topological sort order.\n\n Generates a unique ordering of nodes by first sorting topologically (for which there are often\n multiple valid orderings) and then additionally by sorting lexicographically.\n\n A topological sort arranges the nodes...
21
Python
19
99a925f695080787d077f620972c6552c4b0b4ba
dag.py
177,149
32
212
lexicographical_topological_sort
https://github.com/networkx/networkx.git
docstring update to lexicographical_topological_sort issue 5681 (#5930) * docstring update to lex-topo-sort - explain effect and purpose for lexi sort - add hints for fixing non-sortable nodes - add hint to exception msg - Add examples * Shorten the first line of the doc_string Co-authored-by: Dan Schult <...
44
0
42,289
9
1
17
def test_run_summarization_no_trainer(self): tmp_dir = self.get_auto_remove_tmp_dir() testargs = f.split() run_command(self._launch_args + testargs) result = get_results(tmp_dir) self.assertGreaterEqual(result["eval_rouge1"], 10) self.assertGreaterEqual(result["eval_roug...
examples/pytorch/test_accelerate_examples.py
213
transformers
{ "docstring": "\n {self.examples_dir}/pytorch/summarization/run_summarization_no_trainer.py\n --model_name_or_path t5-small\n --train_file tests/fixtures/tests_samples/xsum/sample.json\n --validation_file tests/fixtures/tests_samples/xsum/sample.json\n --output_...
26
Python
22
99eb9b523f9b9ea6096323ce5610ce6633acc88a
test_accelerate_examples.py
32,333
24
122
test_run_summarization_no_trainer
https://github.com/huggingface/transformers.git
Fix `no_trainer` CI (#18242) * Fix all tests
95
0
5,907
12
3
21
def test_views(self, postgres_db): query = for cid, char in [(CID_A, 'a'), (CID_B, 'b')]: self.sql_via_http( query.format(f'test_view_{char}', char), company_id=cid, expected_resp_type=RESPONSE_TYPE.OK ) tables = sel...
tests/integration_tests/flows/test_company_independent.py
309
mindsdb
{ "docstring": "\n CREATE VIEW mindsdb.{}\n FROM test_integration_{} (\n select * from rentals limit 50\n )\n ", "language": "en", "n_whitespaces": 69, "n_words": 13, "vocab_size": 13 }
81
Python
43
b96825c643cb2ce062d80868a5b7824d99bca07f
test_company_independent.py
118,187
54
200
test_views
https://github.com/mindsdb/mindsdb.git
fix tests
602
0
26,187
13
7
27
def plot(*args, show=True, **kwargs): args = list(map(sympify, args)) free = set() for a in args: if isinstance(a, Expr): free |= a.free_symbols if len(free) > 1: raise ValueError( 'The same variable should be used in all ' ...
sympy/plotting/plot.py
246
sympy
{ "docstring": "Plots a function of a single variable as a curve.\n\n Parameters\n ==========\n\n args :\n The first argument is the expression representing the function\n of single variable to be plotted.\n\n The last argument is a 3-tuple denoting the range of the free\n variabl...
76
Python
59
1473b1782d0e440c17ee0ce6283bff0aa7f515af
plot.py
197,253
20
148
plot
https://github.com/sympy/sympy.git
Use LaTeX for labels in matplotlib backend
204
0
48,412
15
1
4
def setcbreak(filehandle): set_console_mode(filehandle, CBREAK_MODE)
src/textual/drivers/win32.py
22
textual
{ "docstring": "\n Args:\n filehandle(int): Windows filehandle object as returned by :py:func:`msvcrt.get_osfhandle`\n\n Raises:\n OSError: Error calling Windows API\n\n Convenience function which mimics :py:func:`tty.setcbreak` behavior\n\n All console input options are disabled except ``EN...
4
Python
4
54e63428644710112215c4f2d27cd64daeeda6fa
win32.py
182,009
2
12
setcbreak
https://github.com/Textualize/textual.git
windows driver
10
0
43,728
7
1
9
def test_pandas_arff_parser_strip_double_quotes(parser_func): pd = pytest.importorskip("pandas") arff_file = BytesIO( textwrap.dedent(
sklearn/datasets/tests/test_arff_parser.py
39
arff_file = BytesIO( textwrap.dedent( """
scikit-learn
{ "docstring": "Check that we properly strip double quotes from the data.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
9
Python
8
8515b486810e844bc7f5f1a4fb2227405d46871e
test_arff_parser.py
260,158
54
186
test_pandas_arff_parser_strip_double_quotes
https://github.com/scikit-learn/scikit-learn.git
FIX make pandas and liac arff parser quoting behaviour closer (#23497) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
37
1
76,098
9
6
10
def url_result(url, ie=None, video_id=None, video_title=None, *, url_transparent=False, **kwargs): if ie is not None: kwargs['ie_key'] = ie if isinstance(ie, str) else ie.ie_key() if video_id is not None: kwargs['id'] = video_id if video_title is not None: ...
yt_dlp/extractor/common.py
151
yt-dlp
{ "docstring": "Returns a URL that points to a page that should be processed", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 10 }
49
Python
33
311b6615d85d3530f2709c50e4223ff3b6b14361
common.py
162,332
12
94
url_result
https://github.com/yt-dlp/yt-dlp.git
[extractor] Improve `url_result` and related
157
0
39,190
11
4
12
def stamp(self, visitor=None, **headers): headers = headers.copy() if visitor is not None: headers.update(visitor.on_signature(self, **headers)) else: headers["stamped_headers"] = [header for header in headers.keys() if header not in self.options] _me...
celery/canvas.py
130
celery
{ "docstring": "Apply this task asynchronously.\n\n Arguments:\n visitor (StampingVisitor): Visitor API object.\n headers (Dict): Stamps that should be added to headers.\n ", "language": "en", "n_whitespaces": 55, "n_words": 19, "vocab_size": 19 }
31
Python
26
1c4ff33bd22cf94e297bd6449a06b5a30c2c1fbc
canvas.py
208,054
8
81
stamp
https://github.com/celery/celery.git
Canvas Header Stamping (#7384) * Strip down the header-stamping PR to the basics. * Serialize groups. * Add groups to result backend meta data. * Fix spelling mistake. * Revert changes to canvas.py * Revert changes to app/base.py * Add stamping implementation to canvas.py * Send task to AMQP with ...
99
0
52,183
13
1
3
def input_specs_inference(self) -> ModelSpec: return ModelSpec()
rllib/core/rl_module/rl_module.py
23
ray
{ "docstring": "Returns the input specs of the forward_inference method.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 7 }
6
Python
6
37de814a8598e0ea3dea23d5ae0caf9df54fa0e6
rl_module.py
134,355
3
12
input_specs_inference
https://github.com/ray-project/ray.git
[RLlib] RLModule base class, RLModule PR 3/N (#29642) Signed-off-by: Kourosh Hakhamaneshi <kourosh@anyscale.com>
20
0
30,267
7
1
13
def test_payment_refund_or_void_void_called(void_mock, payment): # given payment.can_void = Mock(return_value=True) assert payment.can_void() is True payment.transactions.count() == 0 # when gateway.payment_refund_or_void(payment, get_plugins_manager(), None) # then assert void_mo...
saleor/payment/tests/test_gateway.py
101
@patch("saleor.payment.gateway.void")
saleor
{ "docstring": "Ensure that the refund method is called when payment can be voided\n and there is no void transaction for given payment.", "language": "en", "n_whitespaces": 23, "n_words": 21, "vocab_size": 20 }
25
Python
22
0881beec1ac02dfa97525c5173687defb356d85c
test_gateway.py
26,688
6
53
test_payment_refund_or_void_void_called
https://github.com/saleor/saleor.git
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
51
1
5,047
9
2
11
def idxmin(self, axis=0, skipna=True, *args, **kwargs): i = self.argmin(axis, skipna, *args, **kwargs) if i == -1: return np.nan return self.index[i]
pandas/core/series.py
80
pandas
{ "docstring": "\n Return the row label of the minimum value.\n\n If multiple values equal the minimum, the first row label with that\n value is returned.\n\n Parameters\n ----------\n axis : {0 or 'index'}\n Unused. Parameter needed for compatibility with DataFram...
20
Python
17
244f747bb63f45c1c439193f0672c6162853b168
series.py
166,614
5
53
idxmin
https://github.com/pandas-dev/pandas.git
make series axis parameter docs consistent (#47109) * make series docs consistent add series unused param info to DF docs * fix trailing whitespace * fix docs build * add unused * add or update docs for all series methods * small fix * fix line length * fix param order * fix param order *...
59
0
39,843
9
1
15
def test_04_query_predictor_single_where_condition(self): time.sleep(120) # TODO query = f response = self.handler.native_query(query) self.assertTrue(response.type == RESPONSE_TYPE.TABLE) self.assertTrue(len(response.data_frame) == 1) self.assertTrue(response.data_frame...
mindsdb/integrations/handlers/lightwood_handler/tests/test_lightwood_handler.py
143
mindsdb
{ "docstring": "\n SELECT target\n from {self.test_model_1}\n WHERE sqft=100\n ", "language": "en", "n_whitespaces": 47, "n_words": 6, "vocab_size": 6 }
24
Python
21
b999051fd8153a1d3624471cac5483867116f985
test_lightwood_handler.py
116,582
12
83
test_04_query_predictor_single_where_condition
https://github.com/mindsdb/mindsdb.git
test fix
73
0
25,781
11
1
19
def test_archive_too_large_for_disk_cache(self, cache_getfile): release = Release.objects.create(version="1", organization_id=self.project.organization_id) self._create_archive(release, "foo") # cache.getfile is only called for index, not for the archive with override_options(...
tests/sentry/lang/javascript/test_processor.py
134
sentry
{ "docstring": "ReleaseFile.cache is not used if the archive is too large", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
38
Python
32
8cdaa4e86e8296cdbc145f2a53d3eb38cb7a1c2b
test_processor.py
90,777
8
79
test_archive_too_large_for_disk_cache
https://github.com/getsentry/sentry.git
ref: close files explicitly in tests.sentry.lang.javascript.test_processor (#35262)
105
0
18,688
12
3
6
def _is_current_explicit_device(device_type): device_type = device_type.upper() if device_type not in ["CPU", "GPU"]: raise ValueError('`device_type` should be either "CPU" or "GPU".') device = _get_current_tf_device() return device is not None and device.device_type == device_type.upper() ...
keras/backend.py
85
keras
{ "docstring": "Check if the current device is explicitly set on the device type specified.\n\n Args:\n device_type: A string containing `GPU` or `CPU` (case-insensitive).\n\n Returns:\n A boolean indicating if the current device scope is explicitly set on the\n device type.\n\n Raises:\...
31
Python
26
84afc5193d38057e2e2badf9c889ea87d80d8fbf
backend.py
269,492
6
48
_is_current_explicit_device
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
53
0
80,124
10
8
17
def _promote_fields(dt1, dt2): # Both must be structured and have the same names in the same order if (dt1.names is None or dt2.names is None) or dt1.names != dt2.names: raise TypeError("invalid type promotion") new_fields = [] for name in dt1.names: field1 = dt1.fields[name] ...
numpy/core/_internal.py
231
numpy
{ "docstring": " Perform type promotion for two structured dtypes.\n\n Parameters\n ----------\n dt1 : structured dtype\n First dtype.\n dt2 : structured dtype\n Second dtype.\n\n Returns\n -------\n out : dtype\n The promoted dtype\n\n Notes\n -----\n If one of the ...
81
Python
62
a0c2e826738daa0cbd83aba85852405b73878f5b
_internal.py
160,283
15
147
_promote_fields
https://github.com/numpy/numpy.git
API: Fix structured dtype cast-safety, promotion, and comparison This PR replaces the old gh-15509 implementing proper type promotion for structured voids. It further fixes the casting safety to consider casts with equivalent field number and matching order as "safe" and if the names, titles, and offsets match as "eq...
188
0
38,591
15
1
29
def test_read_video_from_file_rescale_width_and_height(self, test_video): # video related width, height, min_dimension, max_dimension = 320, 240, 0, 0 video_start_pts, video_end_pts = 0, -1 video_timebase_num, video_timebase_den = 0, 1 # audio related samples, ch...
test/test_video_reader.py
208
vision
{ "docstring": "\n Test the case when decoder starts with a video file to decode frames, and\n both video height and width are set.\n ", "language": "en", "n_whitespaces": 43, "n_words": 21, "vocab_size": 19 }
84
Python
52
c50d48845f7b1ca86d6a3b7f37a59be0ae11e36b
test_video_reader.py
192,311
31
145
test_read_video_from_file_rescale_width_and_height
https://github.com/pytorch/vision.git
Improve test_video_reader (#5498) * Improve test_video_reader * Fix linter error
394
0
46,880
10
1
20
def test_queries(self): sql = "SELECT 1" + connection.features.bare_select_suffix with connection.cursor() as cursor: reset_queries() cursor.execute(sql) self.assertEqual(1, len(connection.queries)) self.assertIsInstance(connection.queries, list) ...
tests/backends/tests.py
421
django
{ "docstring": "\n Test the documented API of connection.queries.\n ", "language": "en", "n_whitespaces": 21, "n_words": 6, "vocab_size": 6 }
79
Python
58
9c19aff7c7561e3a82978a272ecdaad40dda5c00
tests.py
201,818
24
257
test_queries
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
274
0
50,001
11
3
14
def b16decode(s, casefold=False): s = _bytes_from_decode_data(s) if casefold: s = s.upper() if re.search(b'[^0-9A-F]', s): raise binascii.Error('Non-base16 digit found') return binascii.unhexlify(s) # # Ascii85 encoding/decoding # _a85chars = None _a85chars2 = None _A85START = b"<...
python3.10.4/Lib/base64.py
113
XX-Net
{ "docstring": "Decode the Base16 encoded bytes-like object or ASCII string s.\n\n Optional casefold is a flag specifying whether a lowercase alphabet is\n acceptable as input. For security purposes, the default is False.\n\n The result is returned as a bytes object. A binascii.Error is raised if\n s is...
37
Python
27
8198943edd73a363c266633e1aa5b2a9e9c9f526
base64.py
221,084
7
51
b16decode
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
59
0
56,192
10
2
15
def timezone_tag(parser, token): bits = token.split_contents() if len(bits) != 2: raise TemplateSyntaxError("'%s' takes one argument (timezone)" % bits[0]) tz = parser.compile_filter(bits[1]) nodelist = parser.parse(("endtimezone",)) parser.delete_first_token() return TimezoneNode(n...
django/templatetags/tz.py
126
@register.tag("get_current_timezone")
django
{ "docstring": "\n Enable a given time zone just for this block.\n\n The ``timezone`` argument must be an instance of a ``tzinfo`` subclass, a\n time zone name, or ``None``. If it is ``None``, the default time zone is\n used within the block.\n\n Sample usage::\n\n {% timezone \"Europe/Paris\" %...
29
Python
27
9c19aff7c7561e3a82978a272ecdaad40dda5c00
tz.py
206,336
8
67
timezone_tag
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
56
1
51,491
11
4
15
def rich_text_style(self) -> Style: # TODO: Feels like there may be opportunity for caching here. background = Color(0, 0, 0, 0) color = Color(255, 255, 255, 0) style = Style() for node in reversed(self.ancestors): styles = node.styles if styles...
src/textual/dom.py
165
textual
{ "docstring": "Get the text style object.\n\n A widget's style is influenced by its parent. For instance if a widgets background has an alpha,\n then its parent's background color will show throw. Additionally, widgets will inherit their\n parent's text style (i.e. bold, italic etc).\n\n ...
58
Python
41
4090d351684342b8e28ef9d5451c7c821e18d1ae
dom.py
183,097
22
103
rich_text_style
https://github.com/Textualize/textual.git
new layout
188
0
44,049
11
11
37
def to_numpy_recarray(G, nodelist=None, dtype=None, order=None): import numpy as np if dtype is None: dtype = [("weight", float)] if nodelist is None: nodelist = list(G) nodeset = G nlen = len(G) else: nlen = len(nodelist) nodeset = set(G.nbunch_ite...
networkx/convert_matrix.py
385
networkx
{ "docstring": "Returns the graph adjacency matrix as a NumPy recarray.\n\n Parameters\n ----------\n G : graph\n The NetworkX graph used to construct the NumPy recarray.\n\n nodelist : list, optional\n The rows and columns are ordered according to the nodes in `nodelist`.\n If `nodelis...
119
Python
75
78cd999e9b60d1b403cb4b736311cb0e00335eea
convert_matrix.py
176,299
28
246
to_numpy_recarray
https://github.com/networkx/networkx.git
Document default dtype in to_numpy_recarray docstring. (#5315)
323
0
41,816
18
2
13
def __new__(cls, name, manifold, **kwargs): if not isinstance(name, Str): name = Str(name) obj = super().__new__(cls, name, manifold) obj.manifold.patches.append(obj) # deprecated obj.coord_systems = _deprecated_list( , []) return obj
sympy/diffgeom/diffgeom.py
101
sympy
{ "docstring": "\n Patch.coord_systms is deprecated. The Patch class is now\n immutable. Instead use a separate list to keep track of coordinate\n systems.\n ", "language": "en", "n_whitespaces": 65, "n_words": 20, "vocab_size": 19 }
27
Python
23
f8674bfe4988332e7ce60ceb36b365ce9aff662a
diffgeom.py
197,095
12
64
__new__
https://github.com/sympy/sympy.git
Update the sympy.diffgeom mutability deprecations
83
0
48,335
10
1
12
def real_quick_ratio(self): la, lb = len(self.a), len(self.b) # can't have more matches than the number of elements in the # shorter sequence return _calculate_ratio(min(la, lb), la + lb) __class_getitem__ = classmethod(GenericAlias)
python3.10.4/Lib/difflib.py
72
XX-Net
{ "docstring": "Return an upper bound on ratio() very quickly.\n\n This isn't defined beyond that it is an upper bound on .ratio(), and\n is faster to compute than either .ratio() or .quick_ratio().\n ", "language": "en", "n_whitespaces": 51, "n_words": 30, "vocab_size": 25 }
31
Python
28
8198943edd73a363c266633e1aa5b2a9e9c9f526
difflib.py
222,485
3
37
real_quick_ratio
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
69
0
56,586
10
1
1
def test_model_exclude_copy_on_model_validation():
tests/test_main.py
12
pydantic
{ "docstring": "When `Config.copy_on_model_validation` is set, it should keep private attributes and excluded fields", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
2
Python
2
5490ad5173743ef2bf85216d11b9ff0822b3d25b
test_main.py
14,093
29
236
test_model_exclude_copy_on_model_validation
https://github.com/pydantic/pydantic.git
fix: `Config.copy_on_model_validation` does a deep copy and not a shallow one (#3642) * fix: `Config.copy_on_model_validation` does a deep copy and not a shallow one closes #3641 * fix: typo * use python 3.10 to run fastapi tests * fix fastapi test call Co-authored-by: Samuel Colvin <s@muelcolvin.com>
5
0
2,817
6
3
12
def calculate_env(self): env = dict(os.environ) # Make sure we're using a local executor flavour if conf.get("core", "executor") not in [ executor_constants.LOCAL_EXECUTOR, executor_constants.SEQUENTIAL_EXECUTOR, ]: if "sqlite" in conf.get("da...
airflow/cli/commands/standalone_command.py
153
airflow
{ "docstring": "\n Works out the environment variables needed to run subprocesses.\n We override some settings as part of being standalone.\n ", "language": "en", "n_whitespaces": 40, "n_words": 18, "vocab_size": 18 }
47
Python
36
d8889da29ccfcbecd2c89b9e8e278c480767d678
standalone_command.py
47,323
13
84
calculate_env
https://github.com/apache/airflow.git
Move the database configuration to a new section (#22284) Co-authored-by: gitstart-airflow <gitstart@users.noreply.github.com> Co-authored-by: GitStart <1501599+gitstart@users.noreply.github.com> Co-authored-by: Egbosi Kelechi <egbosikelechi@gmail.com>
193
0
9,065
13
4
76
def interpret(*args): df = pd.DataFrame([args], columns=X_train.columns) df = df.astype({col: "category" for col in categorical_columns}) shap_values = explainer.shap_values(xgb.DMatrix(df, enable_categorical=True)) scores_desc = list(zip(shap_values[0], X_train.columns)) scores_desc = sorted(scores...
demo/xgboost-income-prediction-with-explainability/run.py
1,103
gradio
{ "docstring": "\n **Income Classification with XGBoost 💰**: This demo uses an XGBoost classifier predicts income based on demographic factors, along with Shapley value-based *explanations*. The [source code for this Gradio demo is here](https://huggingface.co/spaces/gradio/xgboost-income-prediction-with-explain...
239
Python
149
597337dcb8762cca6e718b59a4ab6f5e333645fd
run.py
180,915
13
138
interpret
https://github.com/gradio-app/gradio.git
Adding a Playground Tab to the Website (#1860) * added playground with 12 demos * change name to recipes, restyle navbar * add explanatory text to page * fix demo mapping * categorize demos, clean up design * styling * cateogry naming and emojis * refactor and add text demos * add view code but...
1,686
0
43,252
16
1
4
def regex_lookup(self, lookup_type): raise NotImplementedError( "subclasses of BaseDatabaseOperations may require a regex_lookup() method" )
django/db/backends/base/operations.py
25
django
{ "docstring": "\n Return the string to use in a query when performing regular expression\n lookups (using \"regex\" or \"iregex\"). It should contain a '%s'\n placeholder for the column being searched against.\n\n If the feature is not supported (or part of it is not supported), raise\n ...
14
Python
14
9c19aff7c7561e3a82978a272ecdaad40dda5c00
operations.py
204,878
4
13
regex_lookup
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
46
0
50,951
8
2
8
def execute(): frappe.reload_doc("accounts", "doctype", "gl_entry") for doctype in ["Sales Invoice", "Purchase Invoice", "Journal Entry"]: frappe.reload_doc("accounts", "doctype", frappe.scrub(doctype)) frappe.db.sql( .format( # nosec doctype=doctype ) )
erpnext/patches/v12_0/update_due_date_in_gle.py
101
erpnext
{ "docstring": " UPDATE `tabGL Entry`, `tab{doctype}`\n SET\n `tabGL Entry`.due_date = `tab{doctype}`.due_date\n WHERE\n `tabGL Entry`.voucher_no = `tab{doctype}`.name and `tabGL Entry`.party is not null\n and `tabGL Entry`.voucher_type in ('Sales Inv...
24
Python
20
494bd9ef78313436f0424b918f200dab8fc7c20b
update_due_date_in_gle.py
66,693
15
55
execute
https://github.com/frappe/erpnext.git
style: format code with black
16
0
14,296
12
1
2
async def async_tear_down(self) -> None:
homeassistant/components/mqtt/mixins.py
17
core
{ "docstring": "Handle the cleanup of platform specific parts, extend to the platform.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 10 }
5
Python
5
3b2aae5045f9f08dc8f174c5d975852588e1a132
mixins.py
296,364
2
8
async_tear_down
https://github.com/home-assistant/core.git
Refactor MQTT discovery (#67966) * Proof of concept * remove notify platform * remove loose test * Add rework from #67912 (#1) * Move notify serviceupdater to Mixins * Move tag discovery handler to Mixins * fix tests * Add typing for async_load_platform_helper * Add add entry unload support for...
12
0
95,348
6
7
13
def unpolarify(eq, subs=None, exponents_only=False): if isinstance(eq, bool): return eq eq = sympify(eq) if subs is not None: return unpolarify(eq.subs(subs)) changed = True pause = False if exponents_only: pause = True while changed: changed = False ...
sympy/functions/elementary/complexes.py
184
sympy
{ "docstring": "\n If `p` denotes the projection from the Riemann surface of the logarithm to\n the complex line, return a simplified version `eq'` of `eq` such that\n `p(eq') = p(eq)`.\n Also apply the substitution subs in the end. (This is a convenience, since\n ``unpolarify``, in a certain sense, un...
75
Python
46
cda8dfe6f45dc5ed394c2f5cda706cd6c729f713
complexes.py
195,857
19
116
unpolarify
https://github.com/sympy/sympy.git
Improved documentation formatting
190
0
47,444
11
1
4
def get_url_name(self, view_name): return self.name + ":" + view_name
wagtail/admin/viewsets/base.py
29
wagtail
{ "docstring": "\n Returns the namespaced URL name for the given view.\n ", "language": "en", "n_whitespaces": 24, "n_words": 9, "vocab_size": 8 }
9
Python
8
b4d3cf1c30b5fbe7eed09fab90c845f0cd0f678c
base.py
77,721
2
16
get_url_name
https://github.com/wagtail/wagtail.git
Docs for base ViewSet class
23
0
16,698
8
4
10
def text(self, data): data = data middle = data.lstrip(spaceCharacters) left = data[:len(data) - len(middle)] if left: yield {"type": "SpaceCharacters", "data": left} data = middle middle = data.rstrip(spaceCharacters) right = data[len(middle)...
.venv/lib/python3.8/site-packages/pip/_vendor/html5lib/treewalkers/base.py
169
transferlearning
{ "docstring": "Generates SpaceCharacters and Characters tokens\n\n Depending on what's in the data, this generates one or more\n ``SpaceCharacters`` and ``Characters`` tokens.\n\n For example:\n\n >>> from html5lib.treewalkers.base import TreeWalker\n >>> # Give it an empty...
44
Python
26
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
base.py
62,629
13
94
text
https://github.com/jindongwang/transferlearning.git
upd; format
147
0
13,021
11
5
13
def adapt_datetimefield_value(self, value): if value is None: return None # Expression values are adapted by the database. if hasattr(value, "resolve_expression"): return value # cx_Oracle doesn't support tz-aware datetimes if timezone.is_aware...
django/db/backends/oracle/operations.py
112
django
{ "docstring": "\n Transform a datetime value to an object compatible with what is expected\n by the backend driver for datetime columns.\n\n If naive datetime is passed assumes that is in UTC. Normally Django\n models.DateTimeField makes sure that if USE_TZ is True passed datetime\n ...
53
Python
42
9c19aff7c7561e3a82978a272ecdaad40dda5c00
operations.py
205,092
13
66
adapt_datetimefield_value
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
210
0
51,013
14