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
10
21
def show(*names, **kwargs): kwargs = salt.utils.args.clean_kwargs(**kwargs) refresh = kwargs.pop("refresh", False) filter_ = salt.utils.args.split_input( kwargs.pop("filter", []), lambda x: str(x) if not isinstance(x, str) else x.lower(), ) if kwargs: salt.utils.args.inv...
salt/modules/aptpkg.py
200
salt
{ "docstring": "\n .. versionadded:: 2019.2.0\n\n Runs an ``apt-cache show`` on the passed package names, and returns the\n results in a nested dictionary. The top level of the return data will be\n the package name, with each package name mapping to a dictionary of version\n numbers to any additional ...
43
Python
36
f2a783643de61cac1ff3288b40241e5ce6e1ddc8
aptpkg.py
215,944
34
225
show
https://github.com/saltstack/salt.git
Update to latest ``pyupgrade`` hook. Stop skipping it on CI. Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
105
0
54,267
13
12
34
def gaunt(l_1, l_2, l_3, m_1, m_2, m_3, prec=None): r l_1, l_2, l_3, m_1, m_2, m_3 = [ as_int(i) for i in (l_1, l_2, l_3, m_1, m_2, m_3)] if l_1 + l_2 - l_3 < 0: return S.Zero if l_1 - l_2 + l_3 < 0: return S.Zero if -l_1 + l_2 + l_3 < 0: return S.Zero if (m_1 + ...
sympy/physics/wigner.py
736
sympy
{ "docstring": "\n Calculate the Gaunt coefficient.\n\n Explanation\n ===========\n\n The Gaunt coefficient is defined as the integral over three\n spherical harmonics:\n\n .. math::\n\n \\begin{aligned}\n \\operatorname{Gaunt}(l_1,l_2,l_3,m_1,m_2,m_3)\n &=\\int Y_{l_1,m_1}(\\Om...
306
Python
106
bcb817024d689b65db350a5a565c08f367b899ee
wigner.py
200,006
141
505
gaunt
https://github.com/sympy/sympy.git
Update wigner.py
517
0
49,490
20
1
8
def test_profile_typesafety(): with pytest.raises(TypeError, match="Invalid type for Profile"): ImageCms.ImageCmsProfile(0).tobytes() with pytest.raises(TypeError, match="Invalid type for Profile"): ImageCms.ImageCmsProfile(1).tobytes()
Tests/test_imagecms.py
90
Pillow
{ "docstring": "Profile init type safety\n\n prepatch, these would segfault, postpatch they should emit a typeerror\n ", "language": "en", "n_whitespaces": 20, "n_words": 14, "vocab_size": 14 }
16
Python
10
983a6139d57b37a883344972c6b1de50bb757de0
test_imagecms.py
243,028
5
49
test_profile_typesafety
https://github.com/python-pillow/Pillow.git
Check other exception messages
39
0
69,956
11
2
24
def _crop_source_faces(self): logger.debug("Updating source faces") self._faces = {} for image in self.source: detected_face = image["detected_faces"][0] src_img = image["image"] detected_face.load_aligned(src_img, size=self._size, centering=self._cen...
tools/preview/preview.py
247
faceswap
{ "docstring": " Extract the source faces from the source frames, along with their filenames and the\n transformation matrix used to extract the faces. ", "language": "en", "n_whitespaces": 29, "n_words": 21, "vocab_size": 17 }
39
Python
33
71c20252c2e747f692289cdefe80ad0d5a456ea6
preview.py
100,516
17
150
_crop_source_faces
https://github.com/deepfakes/faceswap.git
bugfix: Preview Tool, ensure all config items are written
396
0
19,982
14
8
11
def partition_spans_by_kind(traces): server_spans = [] client_spans = [] internal_spans = [] for trace in traces: for span in trace['spans']: for tag in span['tags']: if 'span.kind' == tag.get('key', ''): span_kind = tag.get('value', '') ...
tests/integration/instrumentation/__init__.py
180
jina
{ "docstring": "Returns three lists each containing spans of kind SpanKind.SERVER, SpanKind.CLIENT and SpandKind.INTERNAL", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
51
Python
35
107631e955b21db8a4ddb3bee02130de3650d032
__init__.py
13,265
16
102
partition_spans_by_kind
https://github.com/jina-ai/jina.git
feat(instrumentation): add OpenTelemetry tracing and metrics with basic configurations (#5175)
247
0
2,592
18
2
5
def PreStem(name=None): if name is None: name = "prestem" + str(backend.get_uid("prestem"))
keras/applications/convnext.py
49
keras
{ "docstring": "Normalizes inputs with ImageNet-1k mean and std.\n\n Args:\n name (str): Name prefix.\n\n Returns:\n A presemt function.\n ", "language": "en", "n_whitespaces": 25, "n_words": 16, "vocab_size": 16 }
11
Python
10
2d1086447a25d281f9428832d046c473d80ad761
convnext.py
269,281
5
30
PreStem
https://github.com/keras-team/keras.git
Corrected preprocess_input docstring in regnet.py and convnext.py
24
0
80,000
14
1
6
async def get_users_expiring_soon(self) -> List[Tuple[str, int]]:
synapse/storage/databases/main/registration.py
27
synapse
{ "docstring": "Selects users whose account will expire in the [now, now + renew_at] time\n window (see configuration for account_validity for information on what renew_at\n refers to).\n\n Returns:\n A list of tuples, each with a user ID and expiration time (in milliseconds).\n ...
6
Python
6
1783156dbcf4164692e66275d1c29857c434995b
registration.py
248,020
15
47
get_users_expiring_soon
https://github.com/matrix-org/synapse.git
Add some type hints to datastore (#12423) * Add some type hints to datastore * newsfile * change `Collection` to `List` * refactor return type of `select_users_txn` * correct type hint in `stream.py` * Remove `Optional` in `select_users_txn` * remove not needed return type in `__init__` * Revert c...
13
0
72,051
6
7
14
def get_topic_progress(topic, course_name, program): student = get_current_student() if not student: return None course_enrollment = get_or_create_course_enrollment(course_name, program) progress = student.get_topic_progress(course_enrollment.name, topic) if not progress: return None count = sum([activity["...
erpnext/education/utils.py
188
erpnext
{ "docstring": "\n\tReturn the porgress of a course in a program as well as the content to continue from.\n\t :param topic_name:\n\t :param course_name:\n\t", "language": "en", "n_whitespaces": 34, "n_words": 21, "vocab_size": 17 }
59
Python
36
494bd9ef78313436f0424b918f200dab8fc7c20b
utils.py
65,962
15
113
get_topic_progress
https://github.com/frappe/erpnext.git
style: format code with black
44
0
14,072
11
1
9
def subscription_app_deleted_webhook(subscription_webhook): return subscription_webhook( APP_DELETED_SUBSCRIPTION_QUERY, WebhookEventAsyncType.APP_DELETED ) APP_STATUS_CHANGED_SUBSCRIPTION_QUERY = ( APP_DETAILS_FRAGMENT + ) @pytest.fixture
saleor/plugins/webhook/tests/subscription_webhooks/fixtures.py
42
@pytest.fixture
saleor
{ "docstring": "\n subscription{\n event{\n ...on AppStatusChanged{\n app{\n ...AppDetails\n }\n }\n }\n }\n", "language": "en", "n_whitespaces": 69, "n_words": 10, "vocab_size": 7 }
14
Python
13
b5e414c98a1535d287721c859994424cf0eea081
fixtures.py
27,099
4
14
subscription_app_deleted_webhook
https://github.com/saleor/saleor.git
New events related to apps changes. (#9698) * New events related to apps changes. * Schema update after rebase * CHANGELOG.md update * New events description fix * Missing app event added to CHANGELOG.md
30
1
5,092
8
1
4
def entity_id(self) -> str: # type: ignore[override] return self._entity_id
homeassistant/helpers/template.py
23
core
{ "docstring": "Wrap State.entity_id.\n\n Intentionally does not collect state\n ", "language": "en", "n_whitespaces": 21, "n_words": 7, "vocab_size": 7 }
9
Python
9
aa02a53ac667d08c66a536baf139993bcfe4d7d6
template.py
291,227
6
12
entity_id
https://github.com/home-assistant/core.git
Add type hints to template states (#82582) * Add type hints to template states * Undo rename * Remove invalid mypy issue link
24
0
90,337
6
2
16
def compute_or_load(self, wav_file): pitch_file = self.create_pitch_file_path(wav_file, self.cache_path) if not os.path.exists(pitch_file): pitch = self._compute_and_save_pitch(self.ap, wav_file, pitch_file) else: pitch = np.load(pitch_file) return pitch....
TTS/tts/datasets/dataset.py
102
TTS
{ "docstring": "\n compute pitch and return a numpy array of pitch values\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 9 }
21
Python
18
176b712c1a40cf630da9a77f1826836723c40fde
dataset.py
262,049
7
64
compute_or_load
https://github.com/coqui-ai/TTS.git
Refactor TTSDataset ⚡️
78
0
77,108
11
1
35
def test_enqueue_task_instances_sets_ti_state_to_None_if_dagrun_in_finish_state(self, state, dag_maker): dag_id = 'SchedulerJobTest.test_enqueue_task_instances_with_queued_state' task_id_1 = 'dummy' session = settings.Session() with dag_maker(dag_id=dag_id, start_date=DEFAULT_DA...
tests/jobs/test_scheduler_job.py
233
airflow
{ "docstring": "This tests that task instances whose dagrun is in finished state are not queued", "language": "en", "n_whitespaces": 13, "n_words": 14, "vocab_size": 14 }
47
Python
38
49e336ae0302b386a2f47269a6d13988382d975f
test_scheduler_job.py
47,522
17
139
test_enqueue_task_instances_sets_ti_state_to_None_if_dagrun_in_finish_state
https://github.com/apache/airflow.git
Replace usage of `DummyOperator` with `EmptyOperator` (#22974) * Replace usage of `DummyOperator` with `EmptyOperator`
174
0
9,144
11
3
20
def _class_means(X, y): xp, is_array_api = get_namespace(X) classes, y = xp.unique_inverse(y) means = xp.zeros(shape=(classes.shape[0], X.shape[1])) if is_array_api: for i in range(classes.shape[0]): means[i, :] = xp.mean(X[y == i], axis=0) else: # TODO: Explore the...
sklearn/discriminant_analysis.py
186
scikit-learn
{ "docstring": "Compute class means.\n\n Parameters\n ----------\n X : array-like of shape (n_samples, n_features)\n Input data.\n\n y : array-like of shape (n_samples,) or (n_samples, n_targets)\n Target values.\n\n Returns\n -------\n means : array-like of shape (n_classes, n_feat...
60
Python
53
2710a9e7eefd2088ce35fd2fb6651d5f97e5ef8b
discriminant_analysis.py
261,005
12
121
_class_means
https://github.com/scikit-learn/scikit-learn.git
ENH Adds Array API support to LinearDiscriminantAnalysis (#22554) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
134
0
76,620
14
4
9
def degree_centrality(G): if len(G) <= 1: return {n: 1 for n in G} s = 1.0 / (len(G) - 1.0) centrality = {n: d * s for n, d in G.degree()} return centrality @not_implemented_for("undirected")
networkx/algorithms/centrality/degree_alg.py
102
@not_implemented_for("undirected")
networkx
{ "docstring": "Compute the degree centrality for nodes.\n\n The degree centrality for a node v is the fraction of nodes it\n is connected to.\n\n Parameters\n ----------\n G : graph\n A networkx graph\n\n Returns\n -------\n nodes : dictionary\n Dictionary of nodes with degree cent...
34
Python
26
b8d1438e4ea3d8190c650110b3b7d7c141224842
degree_alg.py
176,972
6
61
degree_centrality
https://github.com/networkx/networkx.git
added examples to degree_alg.py (#5644) * added example on degree centrality * added example on in degree centrality * added example on out degree centrality * added opening braces
55
1
42,200
11
2
6
def get_registered_name(obj): if obj in _GLOBAL_CUSTOM_NAMES: return _GLOBAL_CUSTOM_NAMES[obj] else: return obj.__name__ @tf_contextlib.contextmanager
keras/utils/generic_utils.py
45
@tf_contextlib.contextmanager
keras
{ "docstring": "Returns the name registered to an object within the Keras framework.\n\n This function is part of the Keras serialization and deserialization\n framework. It maps objects to the string names associated with those objects\n for serialization/deserialization.\n\n Args:\n obj: The object...
12
Python
11
84afc5193d38057e2e2badf9c889ea87d80d8fbf
generic_utils.py
276,868
5
22
get_registered_name
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
34
1
81,767
9
3
8
async def notify_clients(cls) -> None: while not cls.STOP: await asyncio.sleep(cls.UPDATE_INTERVALS) if cls.EVENT_QUEUE: await cls.broadcast_estimations()
gradio/event_queue.py
61
gradio
{ "docstring": "\n Notify clients about events statuses in the queue periodically.\n ", "language": "en", "n_whitespaces": 24, "n_words": 9, "vocab_size": 9 }
14
Python
13
b1dfc9a172440e9c9736566f326ba339ff559604
event_queue.py
180,689
8
34
notify_clients
https://github.com/gradio-app/gradio.git
Release new queue beta (#1969) * queue-refactor-backend (#1489) * queue-refactor-backend - create a template for the new design * queue-refactor-backend - clean after the old queue * queue-refactor-backend - add basic test to websocket endpoint * queue-refactor-backend - small fix * queue-re...
65
0
43,215
12
3
10
def scan_with_get_slave_id(self): # type: () -> List[XCPScannerResult] log_automotive.info("Start scan with GetSlaveId id in range: " + str( self.id_range)) for identifier in self.id_range: ids = self._send_get_slave_id(identifier) if len(ids) > 0: ...
scapy/contrib/automotive/xcp/scanner.py
81
scapy
{ "docstring": "Starts the scan for XCP devices on CAN with the transport specific\n GetSlaveId Message", "language": "en", "n_whitespaces": 20, "n_words": 14, "vocab_size": 13 }
33
Python
30
495b21f2867e48286767085c8cf2918e4092e9dc
scanner.py
209,602
8
47
scan_with_get_slave_id
https://github.com/secdev/scapy.git
Add Automotive Logger for all debug outputs of the automotive layer
116
0
52,744
11
7
17
def all_view_models() -> List[Path]: file_list = [] all_files = os.walk(base_path) for root, _, files in all_files: for filename in files: if filename.endswith(".py"): if "view" in filename or "model" in filename: file_list.append(f"{root}/{filen...
openbb_terminal/core/scripts/sdk_audit.py
137
OpenBBTerminal
{ "docstring": "Geta all files with 'view' or 'model' in the name.\n\n Returns:\n ----------\n List[Path]\n All paths in openbb_terminal with 'view' or 'model' in the name\n ", "language": "en", "n_whitespaces": 43, "n_words": 24, "vocab_size": 17 }
40
Python
30
963ca9b2b924d0514e0e65243dc8d9d7af023ad1
sdk_audit.py
286,656
17
77
all_view_models
https://github.com/OpenBB-finance/OpenBBTerminal.git
Audit SDK and View/Model functions (#3384) * Initial commit * Finalized functionality * update script * Allow using it without forecasting * Update gitignore * Update `sdk_audit.py` * Fixed issues, found more * Added fix for helper functions, and column for SDK type * Checked one more thing ...
110
0
85,961
17
7
55
def _get_textdoc(self, index): assert self._opt is not None # FIXME we probably should do eliding here. See # qcommonstyle.cpp:viewItemDrawText # https://github.com/qutebrowser/qutebrowser/issues/118 text_option = QTextOption() if self._opt.features & QStyleOptio...
qutebrowser/completion/completiondelegate.py
469
qutebrowser
{ "docstring": "Create the QTextDocument of an item.\n\n Args:\n index: The QModelIndex of the item to draw.\n ", "language": "en", "n_whitespaces": 40, "n_words": 15, "vocab_size": 13 }
90
Python
68
a20bb67a878b2e68abf8268c1b0a27f018d01352
completiondelegate.py
320,770
33
292
_get_textdoc
https://github.com/qutebrowser/qutebrowser.git
mypy: Upgrade to PyQt5-stubs 5.15.6.0 For some unknown reason, those new stubs cause a *lot* of things now to be checked by mypy which formerly probably got skipped due to Any being implied somewhere. The stubs themselves mainly improved, with a couple of regressions too. In total, there were some 337 (!) new mypy e...
466
0
117,338
19
1
4
def role(self) -> 'PeaRoleType': return self.args.pea_role
jina/peapods/peas/__init__.py
27
jina
{ "docstring": "Get the role of this pea in a pod\n .. #noqa: DAR201", "language": "en", "n_whitespaces": 18, "n_words": 12, "vocab_size": 12 }
6
Python
6
933415bfa1f9eb89f935037014dfed816eb9815d
__init__.py
9,851
4
14
role
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 ...
20
0
1,730
7
1
7
def __reduce__(self): (serialized, _) = self._serialization_helper() # There is no outer object ref when the actor handle is # deserialized out-of-band using pickle. return ActorHandle._deserialization_helper, (serialized, None)
python/ray/actor.py
46
ray
{ "docstring": "This code path is used by pickling but not by Ray forking.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 11 }
27
Python
24
f084546d41f0533c1e9e96a7249532d0eb4ff47d
actor.py
126,889
3
27
__reduce__
https://github.com/ray-project/ray.git
Fix out-of-band deserialization of actor handle (#27700) When we deserialize actor handle via pickle, we will register it with an outer object ref equaling to itself which is wrong. For out-of-band deserialization, there should be no outer object ref. Signed-off-by: Jiajun Yao <jeromeyjj@gmail.com>
62
0
28,292
8
11
20
def validate_parameter_constraints(parameter_constraints, params, caller_name): if len(set(parameter_constraints) - set(params)) != 0: raise ValueError( f"The parameter constraints {list(parameter_constraints)}" " contain unexpected parameters" f" {set(parameter_cons...
sklearn/utils/_param_validation.py
330
scikit-learn
{ "docstring": "Validate types and values of given parameters.\n\n Parameters\n ----------\n parameter_constraints : dict or {\"no_validation\"}\n If \"no_validation\", validation is skipped for this parameter.\n\n If a dict, it must be a dictionary `param_name: list of constraints`.\n A...
181
Python
117
91f02270a8f49e3e52882dc0fa634eff4d138fc8
_param_validation.py
260,513
32
137
validate_parameter_constraints
https://github.com/scikit-learn/scikit-learn.git
MAINT Add one-sided set differences for clarity in param validation (#23772) Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
590
0
76,307
25
4
10
def from_bytes(b): if len(b) == 4: seconds = struct.unpack("!L", b)[0] nanoseconds = 0 elif len(b) == 8: data64 = struct.unpack("!Q", b)[0] seconds = data64 & 0x00000003FFFFFFFF nanoseconds = data64 >> 34 elif len(b) == 12: ...
.venv/lib/python3.8/site-packages/pip/_vendor/msgpack/ext.py
159
transferlearning
{ "docstring": "Unpack bytes into a `Timestamp` object.\n\n Used for pure-Python msgpack unpacking.\n\n :param b: Payload from msgpack ext message with code -1\n :type b: bytes\n\n :returns: Timestamp object unpacked from msgpack ext payload\n :rtype: Timestamp\n ", "langua...
60
Python
44
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
ext.py
62,784
15
96
from_bytes
https://github.com/jindongwang/transferlearning.git
upd; format
205
0
13,038
13
2
9
def do_patch() -> None: from synapse.logging.context import current_context global _already_patched orig_inline_callbacks = defer.inlineCallbacks if _already_patched: return
synapse/util/patch_inline_callbacks.py
44
synapse
{ "docstring": "\n Patch defer.inlineCallbacks so that it checks the state of the logcontext on exit\n ", "language": "en", "n_whitespaces": 20, "n_words": 13, "vocab_size": 12 }
16
Python
16
fa0eab9c8e159b698a31fc7cfaafed643f47e284
patch_inline_callbacks.py
248,214
12
36
do_patch
https://github.com/matrix-org/synapse.git
Use `ParamSpec` in a few places (#12667)
38
0
72,158
7
3
11
def __rsub__(self, other): if isinstance(other, str_type): other = self._literalStringClass(other) if not isinstance(other, ParserElement): raise TypeError( "Cannot combine element of type {} with ParserElement".format( type(other).__n...
pipenv/patched/notpip/_vendor/pyparsing/core.py
86
pipenv
{ "docstring": "\n Implementation of ``-`` operator when left operand is not a :class:`ParserElement`\n ", "language": "en", "n_whitespaces": 26, "n_words": 11, "vocab_size": 11 }
30
Python
26
f3166e673fe8d40277b804d35d77dcdb760fc3b3
core.py
20,553
10
52
__rsub__
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...
140
0
3,422
14
8
32
def _get_categorical_mapping(self, scale, data): levels = categorical_order(data, scale.order) n = len(levels) values = scale.values if isinstance(values, dict): self._check_dict_entries(levels, values) # TODO where to ensure that dict values have consis...
seaborn/_core/properties.py
311
seaborn
{ "docstring": "Define mapping as lookup in list of discrete color values.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
124
Python
89
a07ef69882ed76e09a0ed43d6f3ea33780c1b2be
properties.py
41,391
28
184
_get_categorical_mapping
https://github.com/mwaskom/seaborn.git
Transition mappings->properties, leaving a few loose ends
415
0
7,413
17
1
59
def generate_random_string(): import random import string return "".join(random.choices(string.ascii_uppercase + string.digits, k=8)) random_string = generate_random_string() # [START create_queue] create_queue = CloudTasksQueueCreateOperator( location=LOCATION, ...
tests/system/providers/google/tasks/example_queue.py
517
airflow
{ "docstring": "\n Generate random string for queue and task names.\n Queue name cannot be repeated in preceding 7 days and\n task name in the last 1 hour.\n ", "language": "en", "n_whitespaces": 54, "n_words": 25, "vocab_size": 21 }
221
Python
115
3977e1798d8294ba628b5f330f43702c1a5c79fc
example_queue.py
48,117
4
31
generate_random_string
https://github.com/apache/airflow.git
CloudTasks assets & system tests migration (AIP-47) (#23282)
636
0
9,364
13
1
3
def test_resource_requirements_none(mock_get_all_node_ids, mock_deployment_state):
python/ray/serve/tests/test_deployment_state.py
15
ray
{ "docstring": "Ensure resource_requirements doesn't break if a requirement is None", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
3
Python
3
65d0c0aa48be8f9f7faae857d3ab71444997755a
test_deployment_state.py
128,270
7
52
test_resource_requirements_none
https://github.com/ray-project/ray.git
[Serve] add alpha gRPC support (#28175)
6
0
28,652
6
1
41
def host_local_array_to_global_array(local_inputs, global_mesh, pspecs): def _convert(arr, pspec): if isinstance(arr, array.ArrayImpl) and isinstance(arr.sharding, PmapSharding): arr = np.array(arr) local_sharding = MeshPspecSharding(global_mesh.local_mesh, pspec) arrays = [ device_put(ar...
jax/experimental/pjit.py
262
jax
{ "docstring": "Converts a host local value to a globally sharded `jax.Array`.\n\n You can use this function to transition to `jax.Array`. Using `jax.Array` with\n `pjit` has the same semantics of using GDA with pjit i.e. all `jax.Array`\n inputs to pjit should be globally shaped.\n\n If you are currently passing...
63
Python
55
4da72cf3988b4918f65b1401e46c40b7c4504963
pjit.py
122,219
7
54
host_local_array_to_global_array
https://github.com/google/jax.git
Add `host_local_array_to_global_array` and `global_array_to_host_local_array` for enabling transition to jax.Array. Also support `FROM_GDA` for `jax.Array` as a backwards compatible change so that users can continue to use that until they transition to jax.Array. Its currently required because of usage like `in_axis_r...
151
0
27,124
15
1
5
def telemetry_write_key() -> Optional[Text]: return _fetch_write_key("segment", TELEMETRY_WRITE_KEY_ENVIRONMENT_VARIABLE)
rasa/telemetry.py
31
rasa
{ "docstring": "Read the Segment write key from the segment key text file.\n\n The segment key text file should by present only in wheel/sdist packaged\n versions of Rasa Open Source. This avoids running telemetry locally when\n developing on Rasa or when running CI builds.\n\n In local development, this ...
7
Python
7
6339856514897056716bb531acb8489c9cf05d26
telemetry.py
159,329
13
17
telemetry_write_key
https://github.com/RasaHQ/rasa.git
Add support for different recipes (#10641) * Add support for different recipes Fixes https://github.com/RasaHQ/rasa/issues/10473 * Update docs/docs/graph-recipe.mdx Co-authored-by: Joe Juzl <joejuzl@gmail.com>
13
0
38,201
8
5
33
def testClusterAutoscaling(self): self.cluster.update_config( { "provider": {"head_resources": {"CPU": 4, "GPU": 0}}, } ) self.cluster.start() self.cluster.connect(client=True, timeout=120) self.assertGreater(ray.cluster_resources...
python/ray/tune/tests/test_multinode_sync.py
513
ray
{ "docstring": "Sanity check that multinode tests with autoscaling are working", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
126
Python
90
57cdbb1769a9c32972ba0ec9e7e857eeea961869
test_multinode_sync.py
127,553
42
300
testClusterAutoscaling
https://github.com/ray-project/ray.git
Migrate the deprecated placement_group option to PlacementGroupSchedulingStrategy (#28437) placement_group option is deprecated, use PlacementGroupSchedulingStrategy instead.
579
0
28,467
17
10
19
def _from_module(self, module, object): if module is None: return True elif inspect.getmodule(object) is not None: return module is inspect.getmodule(object) elif inspect.isfunction(object): return module.__dict__ is object.__globals__ elif in...
python3.10.4/Lib/doctest.py
242
XX-Net
{ "docstring": "\n Return true if the given object is defined in the given\n module.\n ", "language": "en", "n_whitespaces": 34, "n_words": 12, "vocab_size": 10 }
88
Python
47
8198943edd73a363c266633e1aa5b2a9e9c9f526
doctest.py
223,483
23
148
_from_module
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
317
0
56,928
13
2
4
def add_prefix(self, field_name): return "%s-%s" % (self.prefix, field_name) if self.prefix else field_name
django/forms/forms.py
39
django
{ "docstring": "\n Return the field name with a prefix appended, if this Form has a\n prefix set.\n\n Subclasses may wish to override.\n ", "language": "en", "n_whitespaces": 49, "n_words": 20, "vocab_size": 18 }
12
Python
12
9c19aff7c7561e3a82978a272ecdaad40dda5c00
forms.py
205,963
2
24
add_prefix
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
26
0
51,300
9
3
10
def arc_tangent(value, default=_SENTINEL): try: return math.atan(float(value)) except (ValueError, TypeError): if default is _SENTINEL: raise_no_default("atan", value) return default
homeassistant/helpers/template.py
70
core
{ "docstring": "Filter and function to get arc tangent of the value.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
17
Python
15
4885331509eeffe50f42d76b234996467b06170f
template.py
300,618
7
42
arc_tangent
https://github.com/home-assistant/core.git
Fail template functions when no default specified (#71687)
58
0
99,478
13
1
3
def master_target(self): return self._master_target
keras/distribute/distribute_coordinator_utils.py
19
keras
{ "docstring": "Returns the session master for the corresponding task to connect to.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 10 }
4
Python
4
84afc5193d38057e2e2badf9c889ea87d80d8fbf
distribute_coordinator_utils.py
270,214
2
10
master_target
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
18
0
80,417
6
1
5
def new(key, msg=None, digestmod=''): return HMAC(key, msg, digestmod)
python3.10.4/Lib/hmac.py
37
XX-Net
{ "docstring": "Create a new hashing object and return it.\n\n key: bytes or buffer, The starting key for the hash.\n msg: bytes or buffer, Initial input for the hash, or None.\n digestmod: A hash name suitable for hashlib.new(). *OR*\n A hashlib constructor returning a new hash object. *OR*\n ...
8
Python
8
8198943edd73a363c266633e1aa5b2a9e9c9f526
hmac.py
217,657
2
23
new
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
14
0
54,872
7
1
23
def test_websocket_connect(self): with patch( "streamlit.server.server.LocalSourcesWatcher" ), self._patch_app_session(): yield self.start_server_loop() self.assertFalse(self.server.browser_is_connected) # Open a websocket connection ...
lib/tests/streamlit/server_test.py
224
streamlit
{ "docstring": "Test that we can connect to the server via websocket.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
54
Python
42
704eab3478cf69847825b23dabf15813a8ac9fa2
server_test.py
118,640
15
132
test_websocket_connect
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".
262
0
26,342
15
5
36
def call_find(self, other_args): parser = argparse.ArgumentParser( prog="find", add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, description=, ) parser.add_argument( "-c", "--coin", ...
openbb_terminal/cryptocurrency/crypto_controller.py
406
OpenBBTerminal
{ "docstring": "Process find command\n Find similar coin by name, symbol, or id. If you don't remember exact name or id of the Coin at CoinGecko,\n Binance, Coinbase or CoinPaprika you can use this command to display coins with similar name, symbol or id\n to your search query.\n ...
114
Python
90
09f753da1c2a2f03c41fe6a3ca2eb79f6ea58995
crypto_controller.py
286,398
82
257
call_find
https://github.com/OpenBB-finance/OpenBBTerminal.git
More Fixes to Crypto + key sort (#3244) * fix #3095 - autocomplete and command working + key sort * fix #3056 * fix [Bug] bugs #3048 * fix [Bug] bug #3017 * sort -> sortby, not ascend, tests * fix my goof ups Co-authored-by: james <jmaslek11@gmail.com>
880
0
85,785
14
9
26
def load_file(file_location=None): if str(file_location).endswith(".ini"): params = configparser.RawConfigParser() params.read(file_location) params.optionxform = str # type: ignore params = params["OPENBB"] if "technique" in params: current_model = params[...
openbb_terminal/portfolio/portfolio_optimization/parameters/params_view.py
363
OpenBBTerminal
{ "docstring": "\n Loads in the configuration file and return the parameters in a dictionary including the model if available.\n\n Parameters\n ----------\n file_location: str\n The location of the file to be loaded in either xlsx or ini.\n\n Returns\n -------\n Return the parameters and t...
116
Python
70
34bc290dded1bd2418fc3c6b375a79f9cdd68d5a
params_view.py
284,352
30
176
load_file
https://github.com/OpenBB-finance/OpenBBTerminal.git
New portfolio optimization menu (#1642) * New-Portfolio-Optimization-Menu * New-Portfolio-Optimization-Menu * New-Portfolio-Optimization-Menu * Update _index.md * New-Portfolio-Optimization-Menu * New-Portfolio-Optimization-Menu * configure portfolio optimization parameters ini * minor improvement...
325
0
84,704
19
1
2
def showticklabels(self): return self["showticklabels"]
packages/python/plotly/plotly/graph_objs/bar/marker/_colorbar.py
22
plotly.py
{ "docstring": "\n Determines whether or not the tick labels are drawn.\n\n The 'showticklabels' property must be specified as a bool\n (either True, or False)\n\n Returns\n -------\n bool\n ", "language": "en", "n_whitespaces": 75, "n_words": 25, "vocab_size":...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_colorbar.py
228,743
2
11
showticklabels
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
60,416
7
1
3
def get_trial_id() -> str: return _trial_id
nni/trial.py
18
nni
{ "docstring": "\n Return unique ID of the trial that is current running.\n\n This is shown as \"ID\" in the web portal's trial table.\n ", "language": "en", "n_whitespaces": 31, "n_words": 21, "vocab_size": 18 }
6
Python
6
553e91f4205b286ce7d71142f517c010bbcefac7
trial.py
112,010
7
9
get_trial_id
https://github.com/microsoft/nni.git
Update trial and experiment docstr (#4672)
12
0
24,548
6
35
61
def make_stock_entry(**args): def process_serial_numbers(serial_nos_list): serial_nos_list = [ "\n".join(serial_num["serial_no"] for serial_num in serial_nos_list if serial_num.serial_no) ] uniques = list(set(serial_nos_list[0].split("\n"))) return "\n".join(uniques) s = frappe.new_doc("Stock Entry")...
erpnext/stock/doctype/stock_entry/stock_entry_utils.py
1,040
erpnext
{ "docstring": "Helper function to make a Stock Entry\n\n\t:item_code: Item to be moved\n\t:qty: Qty to be moved\n\t:company: Company Name (optional)\n\t:from_warehouse: Optional\n\t:to_warehouse: Optional\n\t:rate: Optional\n\t:serial_no: Optional\n\t:batch_no: Optional\n\t:posting_date: Optional\n\t:posting_time: O...
280
Python
164
494bd9ef78313436f0424b918f200dab8fc7c20b
stock_entry_utils.py
67,763
84
574
make_stock_entry
https://github.com/frappe/erpnext.git
style: format code with black
186
0
14,615
15
3
11
def get_one_match(expr, lines): # member names in the ld_headers output are between square brackets expr = rf'\[({expr})\]' matches = list(filter(None, (re.search(expr, line) for line in lines))) if len(matches) == 1: return matches[0].group(1) else: return None # additional pr...
python3.10.4/Lib/ctypes/_aix.py
98
XX-Net
{ "docstring": "\n Must be only one match, otherwise result is None.\n When there is a match, strip leading \"[\" and trailing \"]\"\n ", "language": "en", "n_whitespaces": 30, "n_words": 20, "vocab_size": 18 }
47
Python
41
8198943edd73a363c266633e1aa5b2a9e9c9f526
_aix.py
221,800
7
58
get_one_match
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
78
0
56,517
13
1
11
def test_config_validation_for_choices_workaround(business_client, project_id): payload = { 'label_config': '<View><Text name="artist" /><View><Choices name="choices_1" toName="artist"><Choice name="choice_1" value="1"/></Choices></View><View><Choices name="choices_2" toName="artist"><Choice name="choi...
label_studio/tests/test_config_validation.py
143
label-studio
{ "docstring": "\n Validate Choices tag for 1 choice with workaround\n Example bug DEV-3635\n ", "language": "en", "n_whitespaces": 21, "n_words": 11, "vocab_size": 11 }
55
Python
28
e3c87a8a709006f9064b8c32782fbd5461bd0d1d
test_config_validation.py
178,285
17
80
test_config_validation_for_choices_workaround
https://github.com/heartexlabs/label-studio.git
fix: DEV-4035: Fix single choice workaround for several choices tags (#3319) * fix: DEV-3635: Fix single choice workaround for several choices tags
138
0
42,647
11
3
23
def get_count(self, dttm_filter, session, states) -> int: TI = TaskInstance DR = DagRun if not dttm_filter: return 0 if self.external_task_ids: count = ( session.query(func.count()) # .count() is inefficient .filter( ...
airflow/sensors/external_task.py
238
airflow
{ "docstring": "\n Get the count of records against dttm filter and states\n\n :param dttm_filter: date time filter for execution date\n :param session: airflow session object\n :param states: task or dag states\n :return: count of record against the filters\n ", "language"...
59
Python
40
baf50cddd86ac07f064c8cbd95efb22d038b3832
external_task.py
44,412
36
152
get_count
https://github.com/apache/airflow.git
Fix tests for mssql after SQLA 1.4 upgrade (#21303) The way SQLA 1.4 constructed the query then `exeuction_date.in_([])` changed, and as a result it started failing. But we don't even need to ask the database in this case, as we know it won't return any rows.
428
0
8,251
18
1
27
async def test_boost_mode(hass, aioclient_mock, mock_deconz_websocket): data = { "sensors": { "0": { "config": { "battery": 58, "heatsetpoint": 2200, "locked": False, "mode": "heat", ...
tests/components/deconz/test_climate.py
549
core
{ "docstring": "Test that a climate device with boost mode and different state works.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
151
Python
112
7a6897c7578dffd6b67f57747ebd81b67b153e01
test_climate.py
308,133
58
297
test_boost_mode
https://github.com/home-assistant/core.git
Add deconz current hvac operation to thermostate based on "state" (#59989) * deconz - add current hvac operation to thermostate based on "state" * deconz - extend current hvac operation to thermostate based on "state" and "mode" * Add tests for current hvac action * Add boost mode as special case * format ...
811
0
106,894
15
1
9
def exp_var(self): var1 = self.y_pred_true.selectExpr("variance(label - prediction)").collect()[0][ 0 ] var2 = self.y_pred_true.selectExpr("variance(label)").collect()[0][0] # numpy divide is more tolerant to var2 being zero return 1 - np.divide(var1, var2)
recommenders/evaluation/spark_evaluation.py
96
recommenders
{ "docstring": "Calculate explained variance.\n\n .. note::\n Spark MLLib's implementation is buggy (can lead to values > 1), hence we use var().\n\n Returns:\n float: Explained variance (min=0, max=1).\n ", "language": "en", "n_whitespaces": 68, "n_words": 26, "vocab...
27
Python
24
4637482026d2afc5dd93e1fdce6a3c9285427062
spark_evaluation.py
39,311
6
57
exp_var
https://github.com/microsoft/recommenders.git
use numpy divide in explained variance
80
0
7,208
13
1
11
def center_to_corners_format(x): x_center, y_center, width, height = x.unbind(-1) boxes = [(x_center - 0.5 * width), (y_center - 0.5 * height), (x_center + 0.5 * width), (y_center + 0.5 * height)] return torch.stack(boxes, dim=-1)
src/transformers/models/owlvit/feature_extraction_owlvit.py
103
transformers
{ "docstring": "\n Converts a PyTorch tensor of bounding boxes of center format (center_x, center_y, width, height) to corners format\n (left, top, right, bottom).\n ", "language": "en", "n_whitespaces": 31, "n_words": 21, "vocab_size": 19 }
33
Python
22
12d66b47012c9258f9557e6d3a0c13bcd1c72871
feature_extraction_owlvit.py
32,353
4
76
center_to_corners_format
https://github.com/huggingface/transformers.git
Add OWL-ViT model for zero-shot object detection (#17938) * add owlvit model skeleton * add class and box predictor heads * convert modified flax clip to pytorch * fix box and class predictors * add OwlViTImageTextEmbedder * convert class and box head checkpoints * convert image text embedder checkpo...
45
0
5,912
10
5
32
def _sort_key(self, candidate): # type: (InstallationCandidate) -> CandidateSortingKey valid_tags = self._supported_tags support_num = len(valid_tags) build_tag = () # type: BuildTag binary_preference = 0 link = candidate.link if link.is_wheel: ...
.venv/lib/python3.8/site-packages/pip/_internal/index/package_finder.py
289
transferlearning
{ "docstring": "\n Function to pass as the `key` argument to a call to sorted() to sort\n InstallationCandidates by preference.\n\n Returns a tuple such that tuples sorting as greater using Python's\n default comparison operator are more preferred.\n\n The preference is as follows:\...
109
Python
79
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
package_finder.py
60,747
31
178
_sort_key
https://github.com/jindongwang/transferlearning.git
upd; format
479
0
12,274
16
1
4
def extract(self) -> str: return self._src.extract()
pipenv/vendor/tomlkit/parser.py
29
pipenv
{ "docstring": "\n Extracts the value between marker and index\n ", "language": "en", "n_whitespaces": 22, "n_words": 7, "vocab_size": 7 }
6
Python
6
8faa74cdc9da20cfdcc69f5ec29b91112c95b4c9
parser.py
21,815
5
16
extract
https://github.com/pypa/pipenv.git
Update tomlkit==0.9.2 Used: python -m invoke vendoring.update --package=tomlkit
20
0
4,057
8
1
10
def cumsum(x, axis=0): return tf.cumsum(x, axis=axis) @keras_export("keras.backend.cumprod") @tf.__internal__.dispatch.add_dispatch_support @doc_controls.do_not_generate_docs
keras/backend.py
63
@keras_export("keras.backend.cumprod") @tf.__internal__.dispatch.add_dispatch_support @doc_controls.do_not_generate_docs
keras
{ "docstring": "Cumulative sum of the values in a tensor, alongside the specified axis.\n\n Args:\n x: A tensor or variable.\n axis: An integer, the axis to compute the sum.\n\n Returns:\n A tensor of the cumulative sum of values of `x` along `axis`.\n ", "language": "en", "n_whitesp...
9
Python
9
84afc5193d38057e2e2badf9c889ea87d80d8fbf
backend.py
269,599
2
21
cumsum
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
12
1
80,220
8
3
11
def is_done(self, best_sum_logprobs, cur_len): if len(self) < self.num_beams: return False elif self.early_stopping: return True else: cur_score = best_sum_logprobs / cur_len**self.length_penalty ret = self.worst_score >= cur_score ...
src/transformers/generation_tf_utils.py
79
transformers
{ "docstring": "\n If there are enough hypotheses and that none of the hypotheses being generated can become better than the worst\n one in the heap, then we are done with this sentence.\n ", "language": "en", "n_whitespaces": 52, "n_words": 30, "vocab_size": 26 }
27
Python
22
7732d0fe7a759c9844215920e9f1c5540eafb1a6
generation_tf_utils.py
35,036
9
49
is_done
https://github.com/huggingface/transformers.git
Upgrade black to version ~=22.0 (#15565) * Upgrade black to version ~=22.0 * Check copies * Fix code
110
0
6,381
12
1
13
def test_dataset_shard_with_only_local(self): config = { "input": "dataset", "input_config": {"format": "json", "paths": self.dset_path}, } # two ways of doing this: # we have no remote workers _, shards = get_dataset_and_shards(config, num_work...
rllib/offline/tests/test_dataset_reader.py
107
ray
{ "docstring": "Tests whether the dataset_shard function works correctly for a single shard\n for the local worker.", "language": "en", "n_whitespaces": 21, "n_words": 15, "vocab_size": 13 }
37
Python
34
569fe0109629048d08e1d9e023f7769f10bd2244
test_dataset_reader.py
125,001
8
61
test_dataset_shard_with_only_local
https://github.com/ray-project/ray.git
[RLlib] improved unittests for dataset_reader and fixed bugs (#26458)
115
0
27,741
11
1
4
def for_all_test_methods(decorator, *args, **kwargs):
keras/testing_infra/test_utils.py
21
keras
{ "docstring": "Generate class-level decorator from given method-level decorator.\n\n It is expected for the given decorator to take some arguments and return\n a method that is then called on the test method to produce a decorated\n method.\n\n Args:\n decorator: The decorator to apply.\n *args...
4
Python
4
84afc5193d38057e2e2badf9c889ea87d80d8fbf
test_utils.py
276,383
3
16
for_all_test_methods
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
7
0
81,645
6
1
10
def get_theme_dir(name): theme = get_themes()[name] return os.path.dirname(os.path.abspath(theme.load().__file__))
mkdocs/utils/__init__.py
61
mkdocs
{ "docstring": "Return the directory of an installed theme by name.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
7
Python
7
e7f07cc82ab2be920ab426ba07456d8b2592714d
__init__.py
224,062
3
36
get_theme_dir
https://github.com/mkdocs/mkdocs.git
Remove spaces at the ends of docstrings, normalize quotes
16
0
57,209
12
1
16
def test_cache() -> None: ledger_store = DictLedgerStore() user_key = b"1322" ledger = DataSubjectLedger.get_or_create(store=ledger_store, user_key=user_key) assert ( ledger._cache_constant2epsilon[0] == 0.05372712063485988 ), "The first value in the cache is incorrect" assert ( ...
packages/syft/tests/syft/core/adp/data_subject_ledger_test.py
211
PySyft
{ "docstring": "Ensure the most up to date RDP-to-epsilon cache is being used.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
81
Python
43
61f4138eeb028287425f6007d692bf7faa808e75
data_subject_ledger_test.py
3,245
22
139
test_cache
https://github.com/OpenMined/PySyft.git
Add tests for ledger and cache
164
0
413
11
4
17
def _apply_scores(self, scores, value, scores_mask=None, training=None): if scores_mask is not None: padding_mask = tf.logical_not(scores_mask) # Bias so padding positions do not contribute to attention distribution. # Note 65504. is the max float16 value. ...
keras/layers/attention/base_dense_attention.py
153
keras
{ "docstring": "Applies attention scores to the given value tensor.\n\n To use this method in your attention layer, follow the steps:\n\n * Use `query` tensor of shape `[batch_size, Tq]` and `key` tensor of shape\n `[batch_size, Tv]` to calculate the attention `scores`.\n * Pass `scores`...
60
Python
44
84afc5193d38057e2e2badf9c889ea87d80d8fbf
base_dense_attention.py
272,375
15
133
_apply_scores
https://github.com/keras-team/keras.git
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
184
0
81,002
16
1
3
def drain_call_queue(self, num_splits=None):
modin/core/execution/ray/implementations/pandas_on_ray/partitioning/virtual_partition.py
18
modin
{ "docstring": "\n Execute all operations stored in this partition's call queue.\n\n Parameters\n ----------\n num_splits : int, default: None\n The number of times to split the result object.\n ", "language": "en", "n_whitespaces": 72, "n_words": 25, "vocab_size"...
3
Python
3
3d4404e9d9a9b2a3327f8aee664a8e71ac1f18b8
virtual_partition.py
153,772
7
40
drain_call_queue
https://github.com/modin-project/modin.git
FEAT-#4412: Add Batch Pipeline API to Modin (#4452) Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru> Co-authored-by: Mahesh Vashishtha <mvashishtha@users.noreply.github.com> Signed-off-by: Rehan Durrani <rehan@ponder.io>
10
0
35,596
6
3
14
def has_completed_sso(request, organization_id) -> bool: sso_session_in_request = request.session.get( SsoSession.django_session_key(organization_id), None ) if not sso_session_in_request: metrics.incr("sso.no-value-in-session") return False django_session_value = SsoSessi...
src/sentry/utils/auth.py
125
sentry
{ "docstring": "\n look for the org id under the sso session key, and check that the timestamp isn't past our expiry limit\n ", "language": "en", "n_whitespaces": 27, "n_words": 20, "vocab_size": 18 }
32
Python
24
2bad4600970d40bc799143571ab708a19e9774d1
auth.py
95,876
18
73
has_completed_sso
https://github.com/getsentry/sentry.git
chore(auth): remove deprecated SSO key check (#30889) * remove deprecated sso values * clean up checking logic * update metric name
101
0
19,252
10
7
14
def process_arguments(self): args = [arg for arg in sys.argv] # pylint:disable=unnecessary-comprehension if self.updater: from lib.utils import get_backend # pylint:disable=import-outside-toplevel args.append(f"--{get_backend()}") for arg in args: ...
setup.py
129
faceswap
{ "docstring": " Process any cli arguments and dummy in cli arguments if calling from updater. ", "language": "en", "n_whitespaces": 14, "n_words": 13, "vocab_size": 11 }
45
Python
28
c1512fd41d86ef47a5d1ce618d6d755ef7cbacdf
setup.py
100,422
12
70
process_arguments
https://github.com/deepfakes/faceswap.git
Update code to support Tensorflow versions up to 2.8 (#1213) * Update maximum tf version in setup + requirements * - bump max version of tf version in launcher - standardise tf version check * update keras get_custom_objects for tf>2.6 * bugfix: force black text in GUI file dialogs (linux) * dssim loss -...
175
0
19,905
13
3
29
def _load_icons(): size = get_config().user_config_dict.get("icon_size", 16) size = int(round(size * get_config().scaling_factor)) icons = {} pathicons = os.path.join(PATHCACHE, "icons") for fname in os.listdir(pathicons): name, ext = os.path.splitext(fname) ...
lib/gui/utils.py
216
faceswap
{ "docstring": " Scan the icons cache folder and load the icons into :attr:`icons` for retrieval\n throughout the GUI.\n\n Returns\n -------\n dict:\n The icons formatted as described in :attr:`icons`\n\n ", "language": "en", "n_whitespaces": 73, "n_words": 26, "v...
46
Python
34
c1512fd41d86ef47a5d1ce618d6d755ef7cbacdf
utils.py
100,336
14
132
_load_icons
https://github.com/deepfakes/faceswap.git
Update code to support Tensorflow versions up to 2.8 (#1213) * Update maximum tf version in setup + requirements * - bump max version of tf version in launcher - standardise tf version check * update keras get_custom_objects for tf>2.6 * bugfix: force black text in GUI file dialogs (linux) * dssim loss -...
172
0
19,832
14
2
10
def run_coroutine_threadsafe(coro, loop): if not coroutines.iscoroutine(coro): raise TypeError('A coroutine object is required') future = concurrent.futures.Future()
python3.10.4/Lib/asyncio/tasks.py
55
XX-Net
{ "docstring": "Submit a coroutine object to a given event loop.\n\n Return a concurrent.futures.Future to access the result.\n ", "language": "en", "n_whitespaces": 22, "n_words": 16, "vocab_size": 13 }
15
Python
15
8198943edd73a363c266633e1aa5b2a9e9c9f526
tasks.py
220,805
7
41
run_coroutine_threadsafe
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
31
0
56,124
10
4
32
def find_airflow_sources_root_to_operate_on() -> Path: installation_airflow_sources = get_installation_airflow_sources() if installation_airflow_sources is None and not skip_upgrade_check(): console.print( "\n[red]Breeze should only be installed with -e flag[/]\n\n" "[bright...
dev/breeze/src/airflow_breeze/utils/path_utils.py
286
airflow
{ "docstring": "\n Find the root of airflow sources we operate on. Handle the case when Breeze is installed via `pipx` from\n a different source tree, so it searches upwards of the current directory to find the right root of\n airflow directory we are actually in. This **might** be different than the sources...
120
Python
77
bca849b4586c7446438f959b62903da4b997b9ea
path_utils.py
46,871
38
73
find_airflow_sources_root_to_operate_on
https://github.com/apache/airflow.git
Switch to `pipx` as the only installation Breeze2 method (#22740) Switching Breeze2 to only use `pipx` for installation of Breeze2 due to problems it might cause for autocompletion if entrypoint is not avaiable on PATH.
211
0
9,029
12
5
4
def process_task(self, task): # processing tasks so that no arguments are included # unless it's a fromfile or jsonfile one if 'fromfile:' in task or 'jsonfile:' in task or 'internal:' in task: return None if self.ignore_task else task return task ##############...
parlai/scripts/generate_model_card.py
60
ParlAI
{ "docstring": "\n tries to remap tasks to their external version, and then may ignore the tasks\n w/o ext.\n\n version depending on `ignore_task`\n ", "language": "en", "n_whitespaces": 49, "n_words": 20, "vocab_size": 18 }
47
Python
35
81f722d29045a7a5841d0931a082ded1d1f13863
generate_model_card.py
194,778
4
31
process_task
https://github.com/facebookresearch/ParlAI.git
autoformat (#4378)
102
0
47,071
9
2
5
def should_save(self): if self.save_on_each_node: return self.local_process_index == 0 else: return self.process_index == 0
paddlenlp/trainer/trainer_args.py
43
PaddleNLP
{ "docstring": "\n Whether or not the current process should write to disk, e.g., to save models and checkpoints.\n ", "language": "en", "n_whitespaces": 31, "n_words": 16, "vocab_size": 15 }
13
Python
10
44a290e94d1becd1f09fddc3d873f9e19c9d6919
trainer_args.py
323,119
5
25
should_save
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...
56
0
118,366
10
1
6
def get_default_rl_module_class(self) -> Union[Type["RLModule"], str]: raise NotImplementedError
rllib/algorithms/algorithm_config.py
31
ray
{ "docstring": "Returns the RLModule class to use for this algorithm.\n\n Override this method in the sub-class to return the RLModule class type given\n the input framework.\n\n Returns:\n The RLModule class to use for this algorithm either as a class type or as\n a string ...
7
Python
7
f9ec2d1ae2e14e1f1ed38d315dfd643f600dc397
algorithm_config.py
137,403
11
18
get_default_rl_module_class
https://github.com/ray-project/ray.git
[RLlib] Make RLModule initialization easy (#31069) 1. Moved the `_enable_rl_module_api` signature into `rl_module()` api of the algorithmConfig. 2. Added the ability for the user to override the entire RLModule from algorithmConfig by simply changing the class. 3. updated marl_module: we now have only one MARLModul...
21
0
31,158
7
1
4
def host(self) -> str: return self.first_pod_args.host
jina/orchestrate/deployments/__init__.py
25
jina
{ "docstring": "Get the host name of this deployment\n\n\n .. # noqa: DAR201\n ", "language": "en", "n_whitespaces": 25, "n_words": 11, "vocab_size": 11 }
6
Python
6
13edc16d806fb5d77a6849551178ccc75937f25f
__init__.py
10,837
7
14
host
https://github.com/jina-ai/jina.git
refactor: rename pod to deployment (#4230) * refactor: rename pod to deployment * style: fix overload and cli autocomplete * fix: undo daemon mistake * refactor: leftover cleanup * fix: more test fixes * fix: more fixes * fix: more fixes * fix: more fixes * fix: more tests * fix: fix more te...
20
0
1,940
7
20
19
def select_traces(self, selector=None, row=None, col=None, secondary_y=None): if not selector and not isinstance(selector, int): selector = {} if row is not None or col is not None or secondary_y is not None: grid_ref = self._validate_get_grid_ref() filter_b...
packages/python/plotly/plotly/basedatatypes.py
335
plotly.py
{ "docstring": "\n Select traces from a particular subplot cell and/or traces\n that satisfy custom selection criteria.\n\n Parameters\n ----------\n selector: dict, function, int, str or None (default None)\n Dict to use as selection criteria.\n Traces will be...
173
Python
78
321c77230a794d9f0595038a2674c955889ed0e3
basedatatypes.py
241,434
30
217
select_traces
https://github.com/plotly/plotly.py.git
Avoid selecting all traces on selector=0
614
0
69,523
15
2
12
def _max_values(self) -> np.array: if self._max_vals_cache is not None: return self._max_vals_cache return np.array(list(map(lambda x: x.max_val, self.flat_scalars))).reshape( self.shape )
packages/syft/src/syft/core/tensor/autodp/intermediate_gamma.py
82
PySyft
{ "docstring": "WARNING: DO NOT MAKE THIS AVAILABLE TO THE POINTER!!!\n DO NOT ADD THIS METHOD TO THE AST!!!\n ", "language": "en", "n_whitespaces": 31, "n_words": 17, "vocab_size": 12 }
18
Python
16
f56f2b6fb96017472095a43f7d6b13bb8c21718f
intermediate_gamma.py
243
9
51
_max_values
https://github.com/OpenMined/PySyft.git
reduced reliance on .flat_scalars for __add__ which is very slow
68
0
74
15
4
16
def integrate(*args, meijerg=None, conds='piecewise', risch=None, heurisch=None, manual=None, **kwargs): doit_flags = { 'deep': False, 'meijerg': meijerg, 'conds': conds, 'risch': risch, 'heurisch': heurisch, 'manual': manual } integral = Integral(*ar...
sympy/integrals/integrals.py
190
sympy
{ "docstring": "integrate(f, var, ...)\n\n Explanation\n ===========\n\n Compute definite or indefinite integral of one or more variables\n using Risch-Norman algorithm and table lookup. This procedure is\n able to handle elementary algebraic and transcendental functions\n and also a huge class of s...
48
Python
43
1eeb01e15f06c6692a5bfd6fd2d2a3002d864a07
integrals.py
196,850
16
119
integrate
https://github.com/sympy/sympy.git
Fix a few docstring formatting issues
144
0
48,217
14
9
27
def get_cluster_status_to_report(gcs_client, num_retries) -> ClusterStatusToReport: try: cluster_status = ray._private.utils.internal_kv_get_with_retry( gcs_client, ray.ray_constants.DEBUG_AUTOSCALING_STATUS, namespace=None, num_retries=num_retries, ...
python/ray/_private/usage/usage_lib.py
337
ray
{ "docstring": "Get the current status of this cluster.\n\n It is a blocking API.\n\n Params:\n gcs_client (GCSClient): The GCS client to perform KV operation GET.\n num_retries (int): Max number of times to retry if GET fails.\n\n Returns:\n The current cluster status or empty if it fai...
110
Python
70
62a5404369d71a84fdd4da9c4bfd597fce33f2f6
usage_lib.py
147,021
44
195
get_cluster_status_to_report
https://github.com/ray-project/ray.git
Collect more usage stats data (#23167)
396
0
33,835
15
1
2
def zoom(self): return self["zoom"]
packages/python/plotly/plotly/graph_objs/layout/_mapbox.py
22
plotly.py
{ "docstring": "\n Sets the zoom level of the map (mapbox.zoom).\n\n The 'zoom' property is a number and may be specified as:\n - An int or float\n\n Returns\n -------\n int|float\n ", "language": "en", "n_whitespaces": 79, "n_words": 27, "vocab_size": 26 }
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_mapbox.py
231,602
2
11
zoom
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
63,046
7
2
14
def _set_locations(self) -> Dict[str, str]: default: str = self.loc["root"] temp: str = os.path.join(self.root, "ports.conf") if os.path.isfile(temp): listen = temp name = temp else: listen = default name = default return...
certbot-apache/certbot_apache/_internal/parser.py
130
certbot
{ "docstring": "Set default location for directives.\n\n Locations are given as file_paths\n .. todo:: Make sure that files are included\n\n ", "language": "en", "n_whitespaces": 39, "n_words": 18, "vocab_size": 17 }
36
Python
26
7d9e9a49005de7961e84d2a7c608db57dbab3046
parser.py
186,683
16
77
_set_locations
https://github.com/certbot/certbot.git
Add typing to certbot.apache (#9071) * Add typing to certbot.apache Co-authored-by: Adrien Ferrand <ferrand.ad@gmail.com>
122
0
45,590
9
2
10
def get_valuation_rate(): item_val_rate_map = {} for d in frappe.db.sql( , as_dict=1, ): item_val_rate_map.setdefault(d.item_code, d.val_rate) return item_val_rate_map
erpnext/stock/report/item_prices/item_prices.py
66
erpnext
{ "docstring": "Get an average valuation rate of an item from all warehousesselect item_code,\n\t\tsum(actual_qty*valuation_rate)/sum(actual_qty) as val_rate\n\t\tfrom tabBin where actual_qty > 0 group by item_code", "language": "en", "n_whitespaces": 21, "n_words": 24, "vocab_size": 22 }
16
Python
15
494bd9ef78313436f0424b918f200dab8fc7c20b
item_prices.py
67,881
10
40
get_valuation_rate
https://github.com/frappe/erpnext.git
style: format code with black
8
0
14,653
10
2
2
def test_order_by(self) -> None:
tests/rest/admin/test_federation.py
16
synapse
{ "docstring": "\n Testing order list with parameter `order_by`\n ", "language": "en", "n_whitespaces": 21, "n_words": 6, "vocab_size": 6 }
4
Python
4
3b51c763ba5601e155e3e27a46cddf0370da83eb
test_federation.py
246,024
48
645
test_order_by
https://github.com/matrix-org/synapse.git
Fix get federation status of destination if no error occured (#11593)
11
0
70,953
6
10
21
def _get_locale_dirs(resources, include_core=True): contrib_dir = os.path.join(os.getcwd(), "django", "contrib") dirs = [] # Collect all locale directories for contrib_name in os.listdir(contrib_dir): path = os.path.join(contrib_dir, contrib_name, "locale") if os.path.isdir(path): ...
scripts/manage_translations.py
315
django
{ "docstring": "\n Return a tuple (contrib name, absolute path) for all locale directories,\n optionally including the django core catalog.\n If resources list is not None, filter directories matching resources content.\n ", "language": "en", "n_whitespaces": 41, "n_words": 28, "vocab_size": 27 }
98
Python
72
9c19aff7c7561e3a82978a272ecdaad40dda5c00
manage_translations.py
206,916
21
191
_get_locale_dirs
https://github.com/django/django.git
Refs #33476 -- Reformatted code with Black.
267
0
51,797
16
11
27
def parse_sources(self, cache=False): parsed = False # allow for multiple inventory parsing for source in self._sources: if source: if ',' not in source: source = unfrackpath(source, follow=False) parse = self.parse_sourc...
lib/ansible/inventory/manager.py
272
ansible
{ "docstring": " iterate over inventory sources and parse each one to populate it", "language": "en", "n_whitespaces": 11, "n_words": 11, "vocab_size": 11 }
93
Python
63
5b44035983aba190791df479fa7004ce20872042
manager.py
266,994
20
169
parse_sources
https://github.com/ansible/ansible.git
Hide "[WARNING]: No inventory was parsed" message (#65499) * Add config option INVENTORY_UNPARSED_WARNING to hide the warning "No inventory was parsed, only implicit localhost is available"
339
0
78,680
15
1
28
def test_send_receipts_with_backoff(self): mock_send_transaction = ( self.hs.get_federation_transport_client().send_transaction ) mock_send_transaction.return_value = make_awaitable({}) sender = self.hs.get_federation_sender() receipt = ReadReceipt( ...
tests/federation/test_federation_sender.py
519
synapse
{ "docstring": "Send two receipts in quick succession; the second should be flushed, but\n only after 20ms", "language": "en", "n_whitespaces": 21, "n_words": 15, "vocab_size": 15 }
119
Python
57
c52abc1cfdd9e5480cdb4a03d626fe61cacc6573
test_federation_sender.py
248,389
63
296
test_send_receipts_with_backoff
https://github.com/matrix-org/synapse.git
Additional constants for EDU types. (#12884) Instead of hard-coding strings in many places.
1,066
0
72,260
21
4
10
def register(self, name, color_list): if name in self._BUILTIN_COLOR_SEQUENCES: raise ValueError(f"{name!r} is a reserved name for a builtin " "color sequence") color_list = list(color_list) # force copy and coerce type to list for color in col...
lib/matplotlib/colors.py
108
matplotlib
{ "docstring": "\n Register a new color sequence.\n\n The color sequence registry stores a copy of the given *color_list*, so\n that future changes to the original list do not affect the registered\n color sequence. Think of this as the registry taking a snapshot\n of *color_list* a...
51
Python
41
0abe0ce2f2748d1d0383154d045da3609a4b871b
colors.py
108,332
12
58
register
https://github.com/matplotlib/matplotlib.git
Add a registry for color sequences Color sequences are simply lists of colors, that we store by name in a registry. The registry is modelled similar to the ColormapRegistry to 1) support immutable builtin color sequences and 2) to return copies so that one cannot mess with the global definition of the color sequence t...
197
0
23,144
14
1
6
def quantize_output(self, output, config, **kwargs): # Put your code to generate `new_output` here new_output = ... return new_output
docs/source/tutorials/quantization_customize.py
30
nni
{ "docstring": "\n quantize should overload this method to quantize output.\n This method is effectively hooked to `:meth:`forward` of the model.\n\n Parameters\n ----------\n output : Tensor\n output that needs to be quantized\n config : dict\n the conf...
18
Python
17
a16212368718dccf6e3e07f0d9da950a365a3f90
quantization_customize.py
111,927
3
18
quantize_output
https://github.com/microsoft/nni.git
update customize compressor (#4639)
46
0
24,510
6
1
9
async def connect(self) -> None: self.client = WebOsClient(self.host, self.client_key) with suppress(*WEBOSTV_EXCEPTIONS, WebOsTvPairError): await self.client.connect()
homeassistant/components/webostv/__init__.py
68
core
{ "docstring": "Attempt a connection, but fail gracefully if tv is off for example.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
14
Python
14
dee843bf6e5ca84a94f336a239f6a6138c4c28e6
__init__.py
309,593
5
39
connect
https://github.com/home-assistant/core.git
Add LG webOS Smart TV config flow support (#64117) * Add webOS Smart TV config flow support (#53256) * Add Webostv config flow * Fix tests mocks and apply review comments * Apply review comments * Change config flow to use ssdp UDN as unique_id * Fix device info * More review comments * Fix _async...
46
0
108,291
11
8
44
def _inject_greasemonkey_scripts(self, scripts): if sip.isdeleted(self._widget): return # Since we are inserting scripts into a per-tab collection, # rather than just injecting scripts on page load, we need to # make sure we replace existing scripts, not just add ne...
qutebrowser/browser/webengine/webenginetab.py
453
qutebrowser
{ "docstring": "Register user JavaScript files with the current tab.\n\n Args:\n scripts: A list of GreasemonkeyScripts.\n ", "language": "en", "n_whitespaces": 39, "n_words": 14, "vocab_size": 14 }
203
Python
145
0877fb0d78635692e481c8bde224fac5ad0dd430
webenginetab.py
321,142
38
232
_inject_greasemonkey_scripts
https://github.com/qutebrowser/qutebrowser.git
Run scripts/dev/rewrite_enums.py
856
0
117,562
19
3
15
def get_heading(self, queryset, field): heading_override = self.export_headings.get(field) if heading_override: return force_str(heading_override) try: return force_str(queryset.model._meta.get_field(field).verbose_name.title()) except (AttributeError, Fi...
wagtail/admin/views/mixins.py
100
wagtail
{ "docstring": "Get the heading label for a given field for a spreadsheet generated from queryset", "language": "en", "n_whitespaces": 13, "n_words": 14, "vocab_size": 12 }
19
Python
17
d10f15e55806c6944827d801cd9c2d53f5da4186
mixins.py
72,431
8
62
get_heading
https://github.com/wagtail/wagtail.git
Reformat with black
87
0
15,894
16
8
27
def to_euler(self, seq, angle_addition=True, avoid_square_root=False): extrinsic = _is_extrinsic(seq) i, j, k = seq.lower() # get index corresponding to elementary basis vectors i = 'xyz'.index(i) + 1 j = 'xyz'.index(j) + 1 k = 'xyz'.index(k) + 1 if not...
sympy/algebras/quaternion.py
545
sympy
{ "docstring": "Returns Euler angles representing same rotation as the quaternion,\n in the sequence given by `seq`. This implements the method described\n in [1]_.\n\n Parameters\n ==========\n\n seq : string of length 3\n Represents the sequence of rotations.\n ...
218
Python
105
c254b28e2ba0f4cdfe9ff6523ffa6e369ab415ce
quaternion.py
200,702
36
349
to_euler
https://github.com/sympy/sympy.git
added two options to to_euler
557
0
49,777
16
4
19
def _update_class_log_prior(self, class_prior=None): n_classes = len(self.classes_) if class_prior is not None: if len(class_prior) != n_classes: raise ValueError("Number of priors must match number of classes.") self.class_log_prior_ = np.log(class_prior...
sklearn/naive_bayes.py
195
scikit-learn
{ "docstring": "Update class log priors.\n\n The class log priors are based on `class_prior`, class count or the\n number of classes. This method is called each time `fit` or\n `partial_fit` update the model.\n ", "language": "en", "n_whitespaces": 59, "n_words": 31, "vocab_size": ...
69
Python
55
b6bc5599ae063a90c27c9c1fef1940d620b5a206
naive_bayes.py
259,009
13
115
_update_class_log_prior
https://github.com/scikit-learn/scikit-learn.git
DOC Clarifies comments and docstrings in _BaseDiscreteNB (#22565) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
245
0
75,522
15
4
15
def change_member_label(self, label, new_label): if label not in self._member_labels: raise ValueError("No such member exists for the Truss") else: members_duplicate = self._members.copy() for member in members_duplicate: if member[0] == labe...
sympy/physics/continuum_mechanics/truss.py
241
sympy
{ "docstring": "\n This method changes the label of a member.\n\n Parameters\n ==========\n label: String or Symbol\n The label of the member for which the label has\n to be changed.\n\n new_label: String or Symbol\n The new label of the member.\n\n ...
48
Python
39
99ede53223eafb56b2c2b4ab7b8a6764b628c9d9
truss.py
198,535
13
161
change_member_label
https://github.com/sympy/sympy.git
remove_load method added along with other changes
231
0
48,987
18
1
2
def multiselect(self): return self["multiselect"]
packages/python/plotly/plotly/graph_objs/parcoords/_dimension.py
22
plotly.py
{ "docstring": "\n Do we allow multiple selection ranges or just a single range?\n\n The 'multiselect' property must be specified as a bool\n (either True, or False)\n\n Returns\n -------\n bool\n ", "language": "en", "n_whitespaces": 77, "n_words": 27, "vocab_...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_dimension.py
233,094
2
11
multiselect
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
64,538
7
9
18
def _ask_default(self, default=''): self.prompt_output.write('Please enter the default value as valid Python.') if default: self.prompt_output.write( f"Accept the default '{default}' by pressing 'Enter' or " f"provide another value." ) ...
django/db/migrations/questioner.py
288
django
{ "docstring": "\n Prompt for a default value.\n\n The ``default`` argument allows providing a custom default value (as a\n string) which will be shown to the user and used as the return value\n if the user doesn't provide any other input.\n ", "language": "en", "n_whitespaces":...
119
Python
91
0ab58c120939093fea90822f376e1866fc714d1f
questioner.py
202,903
30
158
_ask_default
https://github.com/django/django.git
Refs #29026 -- Allowed customizing InteractiveMigrationQuestioner's prompt destination. Previously, the questioner did not obey the value of stdout provided to the command.
473
0
50,164
17
3
21
def item_group_query(doctype, txt, searchfield, start, page_len, filters): item_groups = [] cond = "1=1" pos_profile = filters.get("pos_profile") if pos_profile: item_groups = get_item_groups(pos_profile) if item_groups: cond = "name in (%s)" % (", ".join(["%s"] * len(item_groups))) cond = cond % tuple(...
erpnext/selling/page/point_of_sale/point_of_sale.py
181
@frappe.whitelist()
erpnext
{ "docstring": " select distinct name from `tabItem Group`\n\t\t\twhere {condition} and (name like %(txt)s) limit {start}, {page_len}", "language": "en", "n_whitespaces": 14, "n_words": 15, "vocab_size": 15 }
51
Python
39
494bd9ef78313436f0424b918f200dab8fc7c20b
point_of_sale.py
67,383
16
102
item_group_query
https://github.com/frappe/erpnext.git
style: format code with black
35
1
14,511
17
11
28
def load_config(self, modelpath, use_gpu, gpu_id, use_mkldnn, cpu_threads): # 对运行位置进行配置 if use_gpu: try: int(os.environ.get('CUDA_VISIBLE_DEVICES')) except Exception: print( ) use_gpu = False ...
modules/image/keypoint_detection/hand_pose_localization/model.py
496
PaddleHub
{ "docstring": "\r\n load the model config\r\n modelpath: inference model path\r\n use_gpu: use gpu or not\r\n use_mkldnn: use mkldnn or not\r\n Error! Unable to use GPU. Please set the environment variables \"CUDA_VISIBLE_DEVICES=GPU_id\" to use GPU. Now switch to CPU to continue.....
151
Python
76
6b42963d62833925ffed1cdb73400e7d528a5353
model.py
50,991
40
291
load_config
https://github.com/PaddlePaddle/PaddleHub.git
update hand_pose_localization (#1967) * update hand_pose_localization * add clean func
699
0
10,250
16
1
13
def call(cls, y_true, y_pred): diff = K.abs(y_true - y_pred) max_loss = K.max(diff, axis=(1, 2), keepdims=True) loss = K.mean(max_loss, axis=-1) return loss
lib/model/losses_tf.py
84
faceswap
{ "docstring": " Call the L-inf norm loss function.\n\n Parameters\n ----------\n y_true: tensor or variable\n The ground truth value\n y_pred: tensor or variable\n The predicted value\n\n Returns\n -------\n tensor\n The loss value\n ...
21
Python
18
c1512fd41d86ef47a5d1ce618d6d755ef7cbacdf
losses_tf.py
100,356
5
55
call
https://github.com/deepfakes/faceswap.git
Update code to support Tensorflow versions up to 2.8 (#1213) * Update maximum tf version in setup + requirements * - bump max version of tf version in launcher - standardise tf version check * update keras get_custom_objects for tf>2.6 * bugfix: force black text in GUI file dialogs (linux) * dssim loss -...
56
0
19,845
10
1
29
def test_column_feature_type_mismatch_fill(): cat_feat = category_feature() bin_feat = binary_feature() input_features = [cat_feat] output_features = [bin_feat] config = {"input_features": input_features, "output_features": output_features} # Construct dataframe with int-like column repres...
tests/integration_tests/test_preprocessing.py
230
@pytest.mark.parametrize("format", ["file", "df"])
ludwig
{ "docstring": "Tests that we are able to fill missing values even in columns where the column dtype and desired feature\n dtype do not match.", "language": "en", "n_whitespaces": 25, "n_words": 23, "vocab_size": 22 }
66
Python
56
1e6dbeff57fc5065b97dd018b904b9907468676f
test_preprocessing.py
7,805
15
125
test_column_feature_type_mismatch_fill
https://github.com/ludwig-ai/ludwig.git
Treat dataset columns as object dtype during first pass of handle_missing_values (#2398)
140
1
1,273
17
1
5
def _numel_arraylike(x, **kwargs): return _numel(x, coerce_np_ndarray=False, **kwargs)
dask/array/backends.py
34
dask
{ "docstring": "Numel implementation for arrays that want to return numel of the same type.", "language": "en", "n_whitespaces": 12, "n_words": 13, "vocab_size": 13 }
7
Python
7
8b95f983c232c1bd628e9cba0695d3ef229d290b
backends.py
156,880
2
21
_numel_arraylike
https://github.com/dask/dask.git
Sparse array reductions (#9342)
13
0
36,797
8
1
5
def _new_step(self): self.should_save = False self.should_evaluate = False self.should_log = False
paddlenlp/trainer/trainer_callback.py
37
PaddleNLP
{ "docstring": "Internal method that resets the variable for a new step.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
11
Python
7
44a290e94d1becd1f09fddc3d873f9e19c9d6919
trainer_callback.py
323,153
4
21
_new_step
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...
39
0
118,389
7
1
29
def test_realm_quota(self) -> None: self.login("hamlet") d1 = StringIO("zulip!") d1.name = "dummy_1.txt" result = self.client_post("/json/user_uploads", {"file": d1}) response_dict = self.assert_json_success(result) d1_path_id = re.sub("/user_uploads/", "", resp...
zerver/tests/test_upload.py
402
zulip
{ "docstring": "\n Realm quota for uploading should not be exceeded.\n ", "language": "en", "n_whitespaces": 23, "n_words": 8, "vocab_size": 8 }
117
Python
69
a142fbff85302c5e3acb2e204eca2e9c75dbc74b
test_upload.py
84,150
30
223
test_realm_quota
https://github.com/zulip/zulip.git
tests: Refactor away result.json() calls with helpers. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
327
0
17,789
11
1
2
def readable(self): return False
python3.10.4/Lib/_pyio.py
16
XX-Net
{ "docstring": "Return a bool indicating whether object was opened for reading.\n\n If False, read() will raise OSError.\n ", "language": "en", "n_whitespaces": 30, "n_words": 16, "vocab_size": 16 }
4
Python
4
8198943edd73a363c266633e1aa5b2a9e9c9f526
_pyio.py
219,890
2
8
readable
https://github.com/XX-net/XX-Net.git
add python 3.10.4 for windows
18
0
55,883
6
3
13
async def get_object_refs_from_last_execute(self) -> Dict[str, Any]: cache = {} for node_uuid, value in self.cache_from_last_execute.items(): if isinstance(value, asyncio.Task): cache[node_uuid] = await value else: cache[node_uuid] = value...
python/ray/dag/dag_node.py
92
ray
{ "docstring": "Gets cached object refs from the last call to execute().\n\n After this DAG is executed through execute(), retrieves a map between node\n UUID to a reference to the return value of the default executor on that node.\n ", "language": "en", "n_whitespaces": 58, "n_words": 37, ...
27
Python
21
4c970cc88247f7cfa7351297b8b5050f2372742e
dag_node.py
127,340
13
57
get_object_refs_from_last_execute
https://github.com/ray-project/ray.git
[serve] Visualize Deployment Graph with Gradio (#27897)
107
0
28,418
12
1
2
def editrevision(self): return self["editrevision"]
packages/python/plotly/plotly/graph_objs/_layout.py
22
plotly.py
{ "docstring": "\n Controls persistence of user-driven changes in `editable: true`\n configuration, other than trace names and axis titles. Defaults\n to `layout.uirevision`.\n\n The 'editrevision' property accepts values of any type\n\n Returns\n -------\n Any\n ...
4
Python
4
43e3a4011080911901176aab919c0ecf5046ddd3
_layout.py
227,325
2
11
editrevision
https://github.com/plotly/plotly.py.git
switch to black .22
18
0
58,998
7
5
7
def RGS_generalized(m): d = zeros(m + 1) for i in range(m + 1): d[0, i] = 1 for i in range(1, m + 1): for j in range(m): if j <= m - i: d[i, j] = j * d[i - 1, j] + d[i - 1, j + 1] else: d[i, j] = 0 return d
sympy/combinatorics/partitions.py
148
sympy
{ "docstring": "\n Computes the m + 1 generalized unrestricted growth strings\n and returns them as rows in matrix.\n\n Examples\n ========\n\n >>> from sympy.combinatorics.partitions import RGS_generalized\n >>> RGS_generalized(6)\n Matrix([\n [ 1, 1, 1, 1, 1, 1, 1],\n [ 1, 2, ...
57
Python
32
7d773eb18daaef3c54f34d1ac6cbc5b83a5bb16c
partitions.py
198,361
11
99
RGS_generalized
https://github.com/sympy/sympy.git
Cleanup loops and ranges
138
0
48,881
16
1
4
def _draw_rasterized(figure, artists, renderer):
lib/matplotlib/axes/_base.py
17
matplotlib
{ "docstring": "\n A helper function for rasterizing the list of artists.\n\n The bookkeeping to track if we are or are not in rasterizing mode\n with the mixed-mode backends is relatively complicated and is now\n handled in the matplotlib.artist.allow_rasterization decorator.\n\n This helper defines t...
4
Python
4
eb52a34559bad8e86c85069e5af15d0eb3d5c6f9
_base.py
110,772
8
37
_draw_rasterized
https://github.com/matplotlib/matplotlib.git
DOC: add docstring to too-clever helper function
7
0
24,287
6